mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'main' into 'dev/pedidos_v1'
Main See merge request jjimenez/safekat!272
This commit is contained in:
94
ci4/app/Models/Configuracion/SeriesFacturasModel.php
Normal file
94
ci4/app/Models/Configuracion/SeriesFacturasModel.php
Normal file
@ -0,0 +1,94 @@
|
||||
<?php
|
||||
namespace App\Models\Configuracion;
|
||||
|
||||
class SeriesFacturasModel extends \App\Models\BaseModel
|
||||
{
|
||||
protected $table = "series";
|
||||
|
||||
/**
|
||||
* Whether primary key uses auto increment.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $useAutoIncrement = true;
|
||||
|
||||
const SORTABLE = [
|
||||
1 => "t1.id",
|
||||
2 => "t1.nombre",
|
||||
3 => "t1.tipo",
|
||||
4 => "t1.formato",
|
||||
5 => "t1.next",
|
||||
6 => "t1.grupo"
|
||||
];
|
||||
|
||||
protected $allowedFields = ["nombre", "tipo", "formato", "next", "grupo"];
|
||||
protected $returnType = "App\Entities\Configuracion\SeriesFacturasEntity";
|
||||
|
||||
public static $labelField = "nombre";
|
||||
|
||||
protected $validationRules = [
|
||||
"nombre" => [
|
||||
"label" => "SeriesFacturas.nombre",
|
||||
"rules" => "trim|required|max_length[255]",
|
||||
],
|
||||
"tipo" => [
|
||||
"label" => "SeriesFacturas.tipo",
|
||||
"rules" => "required",
|
||||
],
|
||||
"formato" => [
|
||||
"label" => "SeriesFacturas.nombre",
|
||||
"rules" => "trim|required|max_length[255]",
|
||||
],
|
||||
"next" => [
|
||||
"label" => "SeriesFacturas.next",
|
||||
"rules" => "required",
|
||||
]
|
||||
];
|
||||
|
||||
protected $validationMessages = [
|
||||
"nombre" => [
|
||||
"max_length" => "SeriesFacturas.validation.nombre.max_length",
|
||||
"required" => "SeriesFacturas.validation.nombre.required",
|
||||
],
|
||||
"tipo" => [
|
||||
"required" => "SeriesFacturas.validation.tipo.required",
|
||||
],
|
||||
"formato" => [
|
||||
"max_length" => "SeriesFacturas.validation.formato.max_length",
|
||||
"required" => "SeriesFacturas.validation.formato.required",
|
||||
],
|
||||
"next" => [
|
||||
"required" => "SeriesFacturas.validation.next.required",
|
||||
],
|
||||
|
||||
];
|
||||
|
||||
/**
|
||||
* Get resource data.
|
||||
*
|
||||
* @param string $search
|
||||
*
|
||||
* @return \CodeIgniter\Database\BaseBuilder
|
||||
*/
|
||||
public function getResource(string $search = "")
|
||||
{
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.id AS id, t1.nombre AS nombre, t1.tipo AS tipo, t1.formato AS formato,
|
||||
t1.next AS next, t1.grupo AS grupo"
|
||||
);
|
||||
|
||||
return empty($search)
|
||||
? $builder
|
||||
: $builder
|
||||
->groupStart()
|
||||
->like("t1.id", $search)
|
||||
->orLike("t1.nombre", $search)
|
||||
->orLike("t1.tipo", $search)
|
||||
->orLike("t1.formato", $search)
|
||||
->orLike("t1.next", $search)
|
||||
->orLike("t1.grupo", $search)
|
||||
->groupEnd();
|
||||
}
|
||||
}
|
||||
62
ci4/app/Models/Configuracion/UbicacionesModel.php
Normal file
62
ci4/app/Models/Configuracion/UbicacionesModel.php
Normal file
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
namespace App\Models\Configuracion;
|
||||
|
||||
class UbicacionesModel extends \App\Models\BaseModel
|
||||
{
|
||||
protected $table = "ubicaciones";
|
||||
|
||||
/**
|
||||
* Whether primary key uses auto increment.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $useAutoIncrement = true;
|
||||
|
||||
const SORTABLE = [
|
||||
1 => "t1.id",
|
||||
2 => "t1.nombre"
|
||||
];
|
||||
|
||||
protected $allowedFields = ["nombre"];
|
||||
protected $returnType = "App\Entities\Configuracion\UbicacionesEntity";
|
||||
|
||||
public static $labelField = "nombre";
|
||||
|
||||
protected $validationRules = [
|
||||
"nombre" => [
|
||||
"label" => "Paises.nombre",
|
||||
"rules" => "trim|required|max_length[255]",
|
||||
]
|
||||
];
|
||||
|
||||
protected $validationMessages = [
|
||||
"nombre" => [
|
||||
"max_length" => "Paises.validation.nombre.max_length",
|
||||
"required" => "Paises.validation.nombre.required",
|
||||
]
|
||||
];
|
||||
|
||||
/**
|
||||
* Get resource data.
|
||||
*
|
||||
* @param string $search
|
||||
*
|
||||
* @return \CodeIgniter\Database\BaseBuilder
|
||||
*/
|
||||
public function getResource(string $search = "")
|
||||
{
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.id AS id, t1.nombre AS nombre"
|
||||
);
|
||||
|
||||
return empty($search)
|
||||
? $builder
|
||||
: $builder
|
||||
->groupStart()
|
||||
->like("t1.id", $search)
|
||||
->orLike("t1.nombre", $search)
|
||||
->groupEnd();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user