merge from main

This commit is contained in:
amazuecos
2024-12-15 19:49:33 +01:00
65 changed files with 2009 additions and 4007 deletions

View File

@ -14,22 +14,13 @@ class MaquinaModel extends \App\Models\BaseModel
protected $useAutoIncrement = true;
const SORTABLE = [
//1 => "t1.id",
0 => "t1.nombre",
0 => "t1.id",
1 => "t2.nombre",
2 => "t1.tipo",
3 => "t1.velocidad",
4 => "t1.duracion_jornada",
5 => "t1.ancho",
6 => "t1.alto",
7 => "t1.ancho_impresion",
8 => "t1.alto_impresion",
9 => "t1.orden_planning",
10 => "t1.min",
11 => "t1.max",
];
3 => "t1.ancho_impresion",
4 => "t1.alto_impresion",
5 => "t1.min",
6 => "t1.max", ];
protected $allowedFields = [
"nombre",
@ -295,7 +286,7 @@ class MaquinaModel extends \App\Models\BaseModel
*
* @return \CodeIgniter\Database\BaseBuilder
*/
public function getResource(string $search = "")
public function getResource($search = [])
{
$builder = $this->db
->table($this->table . " t1")
@ -313,56 +304,18 @@ class MaquinaModel extends \App\Models\BaseModel
//JJO
$builder->where("t1.is_deleted", 0);
return empty($search)
? $builder
: $builder
->groupStart()
->like("t1.id", $search)
->orLike("t1.nombre", $search)
->orLike("t1.tipo", $search)
->orLike("t1.velocidad", $search)
->orLike("t1.ancho", $search)
->orLike("t1.alto", $search)
->orLike("t1.ancho_impresion", $search)
->orLike("t1.alto_impresion", $search)
->orLike("t1.alto_click", $search)
->orLike("t1.min", $search)
->orLike("t1.max", $search)
->orLike("t1.duracion_jornada", $search)
->orLike("t1.orden_planning", $search)
->orLike("t1.precio_tinta_negro", $search)
->orLike("t1.precio_tinta_color", $search)
->orLike("t1.velocidad_corte", $search)
->orLike("t1.precio_hora_corte", $search)
->orLike("t1.metrosxminuto", $search)
->orLike("t1.forzar_num_formas_horizontales_cubierta", $search)
->orLike("t1.forzar_num_formas_verticales_cubierta", $search)
->orLike("t1.observaciones", $search)
->orLike("t2.id", $search)
->orLike("t1.id", $search)
->orLike("t1.nombre", $search)
->orLike("t1.tipo", $search)
->orLike("t1.velocidad", $search)
->orLike("t1.ancho", $search)
->orLike("t1.alto", $search)
->orLike("t1.ancho_impresion", $search)
->orLike("t1.alto_impresion", $search)
->orLike("t1.alto_click", $search)
->orLike("t1.padre_id", $search)
->orLike("t1.min", $search)
->orLike("t1.max", $search)
->orLike("t1.duracion_jornada", $search)
->orLike("t1.orden_planning", $search)
->orLike("t1.precio_tinta_negro", $search)
->orLike("t1.precio_tinta_color", $search)
->orLike("t1.velocidad_corte", $search)
->orLike("t1.precio_hora_corte", $search)
->orLike("t1.metrosxminuto", $search)
->orLike("t1.forzar_num_formas_horizontales_cubierta", $search)
->orLike("t1.forzar_num_formas_verticales_cubierta", $search)
->orLike("t1.observaciones", $search)
->orLike("t2.nombre", $search)
->groupEnd();
if (empty($search))
return $builder;
else {
$builder->groupStart();
foreach ($search as $col_search) {
$column = self::SORTABLE[$col_search[0]];
$value = $col_search[2];
$builder->where("LOWER(CONVERT($column USING utf8)) COLLATE utf8_general_ci LIKE", "%" . strtolower($value) . "%");
}
$builder->groupEnd();
return $builder;
}
}
public function getMaquinaImpresionForPresupuesto($is_rotativa, $tarifa_tipo, $uso_tarifa , $tirada, $papel_impresion_id = -1)

View File

@ -94,6 +94,20 @@ class PapelGenericoModel extends \App\Models\BaseModel
return $data;
}
public function getNombre($id = 0)
{
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.nombre AS nombre"
)
->where("t1.id", $id)
->where("t1.is_deleted", 0);
$data = $builder->get()->getFirstRow();
// se convierte a de stdClass a array
$data = json_decode(json_encode($data), true);
return $data;
}
/**
* Get resource data.