mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'dev/ui_fixing' into 'main'
Dev/ui fixing See merge request jjimenez/safekat!29
This commit is contained in:
97
ci4/app/Models/Configuracion/ComunidadAutonomaModel.php
Normal file
97
ci4/app/Models/Configuracion/ComunidadAutonomaModel.php
Normal file
@ -0,0 +1,97 @@
|
||||
<?php
|
||||
namespace App\Models\Configuracion;
|
||||
|
||||
class ComunidadAutonomaModel extends \App\Models\GoBaseModel
|
||||
{
|
||||
protected $table = "lg_comunidades_autonomas";
|
||||
|
||||
/**
|
||||
* Whether primary key uses auto increment.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $useAutoIncrement = true;
|
||||
|
||||
const SORTABLE = [
|
||||
1 => "t1.id",
|
||||
2 => "t1.nombre",
|
||||
3 => "t1.pais_id",
|
||||
4 => "t1.created_at",
|
||||
5 => "t1.updated_at",
|
||||
6 => "t2.id",
|
||||
];
|
||||
|
||||
protected $allowedFields = ["nombre", "pais_id"];
|
||||
protected $returnType = "App\Entities\Configuracion\ComunidadAutonomaEntity";
|
||||
|
||||
public static $labelField = "nombre";
|
||||
|
||||
protected $validationRules = [
|
||||
"nombre" => [
|
||||
"label" => "ComunidadesAutonomas.nombre",
|
||||
"rules" => "trim|required|max_length[100]",
|
||||
],
|
||||
];
|
||||
|
||||
protected $validationMessages = [
|
||||
"nombre" => [
|
||||
"max_length" => "ComunidadesAutonomas.validation.nombre.max_length",
|
||||
"required" => "ComunidadesAutonomas.validation.nombre.required",
|
||||
],
|
||||
];
|
||||
|
||||
public function findAllWithPaises(string $selcols = "*", int $limit = null, int $offset = 0)
|
||||
{
|
||||
$sql =
|
||||
"SELECT t1." .
|
||||
$selcols .
|
||||
", t2.id AS pais FROM " .
|
||||
$this->table .
|
||||
" t1 LEFT JOIN lg_paises t2 ON t1.pais_id = t2.id";
|
||||
if (!is_null($limit) && intval($limit) > 0) {
|
||||
$sql .= " LIMIT " . $limit;
|
||||
}
|
||||
|
||||
if (!is_null($offset) && intval($offset) > 0) {
|
||||
$sql .= " OFFSET " . $offset;
|
||||
}
|
||||
|
||||
$query = $this->db->query($sql);
|
||||
$result = $query->getResultObject();
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.created_at AS created_at, t1.updated_at AS updated_at, t2.id AS pais"
|
||||
);
|
||||
$builder->join("lg_paises t2", "t1.pais_id = t2.id", "left");
|
||||
|
||||
return empty($search)
|
||||
? $builder
|
||||
: $builder
|
||||
->groupStart()
|
||||
->like("t1.id", $search)
|
||||
->orLike("t1.nombre", $search)
|
||||
->orLike("t1.created_at", $search)
|
||||
->orLike("t1.updated_at", $search)
|
||||
->orLike("t2.id", $search)
|
||||
->orLike("t1.id", $search)
|
||||
->orLike("t1.nombre", $search)
|
||||
->orLike("t1.pais_id", $search)
|
||||
->orLike("t1.created_at", $search)
|
||||
->orLike("t1.updated_at", $search)
|
||||
->orLike("t2.id", $search)
|
||||
->groupEnd();
|
||||
}
|
||||
}
|
||||
97
ci4/app/Models/Configuracion/ComunidadesAutonomasModel.php
Normal file
97
ci4/app/Models/Configuracion/ComunidadesAutonomasModel.php
Normal file
@ -0,0 +1,97 @@
|
||||
<?php
|
||||
namespace App\Models\Configuracion;
|
||||
|
||||
class ComunidadesAutonomasModel extends \App\Models\GoBaseModel
|
||||
{
|
||||
protected $table = "lg_comunidades_autonomas";
|
||||
|
||||
/**
|
||||
* Whether primary key uses auto increment.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $useAutoIncrement = true;
|
||||
|
||||
const SORTABLE = [
|
||||
1 => "t1.id",
|
||||
2 => "t1.nombre",
|
||||
3 => "t1.pais_id",
|
||||
4 => "t1.created_at",
|
||||
5 => "t1.updated_at",
|
||||
6 => "t2.nombre",
|
||||
];
|
||||
|
||||
protected $allowedFields = ["nombre", "pais_id"];
|
||||
protected $returnType = "App\Entities\Configuracion\ComunidadesAutonomasEntity";
|
||||
|
||||
public static $labelField = "nombre";
|
||||
|
||||
protected $validationRules = [
|
||||
"nombre" => [
|
||||
"label" => "ComunidadesAutonomas.nombre",
|
||||
"rules" => "trim|required|max_length[100]",
|
||||
],
|
||||
];
|
||||
|
||||
protected $validationMessages = [
|
||||
"nombre" => [
|
||||
"max_length" => "ComunidadesAutonomas.validation.nombre.max_length",
|
||||
"required" => "ComunidadesAutonomas.validation.nombre.required",
|
||||
],
|
||||
];
|
||||
|
||||
public function findAllWithPaises(string $selcols = "*", int $limit = null, int $offset = 0)
|
||||
{
|
||||
$sql =
|
||||
"SELECT t1." .
|
||||
$selcols .
|
||||
", t2.nombre AS pais FROM " .
|
||||
$this->table .
|
||||
" t1 LEFT JOIN lg_paises t2 ON t1.pais_id = t2.id";
|
||||
if (!is_null($limit) && intval($limit) > 0) {
|
||||
$sql .= " LIMIT " . $limit;
|
||||
}
|
||||
|
||||
if (!is_null($offset) && intval($offset) > 0) {
|
||||
$sql .= " OFFSET " . $offset;
|
||||
}
|
||||
|
||||
$query = $this->db->query($sql);
|
||||
$result = $query->getResultObject();
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.created_at AS created_at, t1.updated_at AS updated_at, t2.nombre AS pais"
|
||||
);
|
||||
$builder->join("lg_paises t2", "t1.pais_id = t2.id", "left");
|
||||
|
||||
return empty($search)
|
||||
? $builder
|
||||
: $builder
|
||||
->groupStart()
|
||||
->like("t1.id", $search)
|
||||
->orLike("t1.nombre", $search)
|
||||
->orLike("t1.created_at", $search)
|
||||
->orLike("t1.updated_at", $search)
|
||||
->orLike("t2.id", $search)
|
||||
->orLike("t1.id", $search)
|
||||
->orLike("t1.nombre", $search)
|
||||
->orLike("t1.pais_id", $search)
|
||||
->orLike("t1.created_at", $search)
|
||||
->orLike("t1.updated_at", $search)
|
||||
->orLike("t2.nombre", $search)
|
||||
->groupEnd();
|
||||
}
|
||||
}
|
||||
68
ci4/app/Models/Configuracion/FormaPagoModel.php
Normal file
68
ci4/app/Models/Configuracion/FormaPagoModel.php
Normal file
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
namespace App\Models\Configuracion;
|
||||
|
||||
class FormaPagoModel extends \App\Models\GoBaseModel
|
||||
{
|
||||
protected $table = "lg_formas_pago";
|
||||
|
||||
/**
|
||||
* Whether primary key uses auto increment.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $useAutoIncrement = true;
|
||||
|
||||
const SORTABLE = [
|
||||
1 => "t1.id",
|
||||
2 => "t1.nombre",
|
||||
3 => "t1.created_at",
|
||||
4 => "t1.updated_at",
|
||||
];
|
||||
|
||||
protected $allowedFields = ["nombre"];
|
||||
protected $returnType = "App\Entities\Configuracion\FormaPagoEntity";
|
||||
|
||||
public static $labelField = "nombre";
|
||||
|
||||
protected $validationRules = [
|
||||
"nombre" => [
|
||||
"label" => "FormasPagoes.nombre",
|
||||
"rules" => "trim|required|max_length[255]",
|
||||
],
|
||||
];
|
||||
|
||||
protected $validationMessages = [
|
||||
"nombre" => [
|
||||
"max_length" => "FormasPagoes.validation.nombre.max_length",
|
||||
"required" => "FormasPagoes.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, t1.created_at AS created_at, t1.updated_at AS updated_at");
|
||||
|
||||
return empty($search)
|
||||
? $builder
|
||||
: $builder
|
||||
->groupStart()
|
||||
->like("t1.id", $search)
|
||||
->orLike("t1.nombre", $search)
|
||||
->orLike("t1.created_at", $search)
|
||||
->orLike("t1.updated_at", $search)
|
||||
->orLike("t1.id", $search)
|
||||
->orLike("t1.nombre", $search)
|
||||
->orLike("t1.created_at", $search)
|
||||
->orLike("t1.updated_at", $search)
|
||||
->groupEnd();
|
||||
}
|
||||
}
|
||||
33
ci4/app/Models/Configuracion/FormasPagoModel.php
Normal file
33
ci4/app/Models/Configuracion/FormasPagoModel.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
namespace App\Models\Configuracion;
|
||||
|
||||
class FormasPagoModel extends \App\Models\GoBaseModel
|
||||
{
|
||||
protected $table = "lg_formas_pago";
|
||||
|
||||
/**
|
||||
* Whether primary key uses auto increment.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $useAutoIncrement = true;
|
||||
|
||||
protected $allowedFields = ["nombre"];
|
||||
protected $returnType = "App\Entities\Configuracion\FormasPagoEntity";
|
||||
|
||||
public static $labelField = "nombre";
|
||||
|
||||
protected $validationRules = [
|
||||
"nombre" => [
|
||||
"label" => "FormasPagoes.nombre",
|
||||
"rules" => "trim|required|max_length[255]",
|
||||
],
|
||||
];
|
||||
|
||||
protected $validationMessages = [
|
||||
"nombre" => [
|
||||
"max_length" => "FormasPagoes.validation.nombre.max_length",
|
||||
"required" => "FormasPagoes.validation.nombre.required",
|
||||
],
|
||||
];
|
||||
}
|
||||
@ -12,8 +12,20 @@ class PaisModel extends \App\Models\GoBaseModel
|
||||
*/
|
||||
protected $useAutoIncrement = true;
|
||||
|
||||
const SORTABLE = [
|
||||
1 => "t1.id",
|
||||
2 => "t1.nombre",
|
||||
3 => "t1.code",
|
||||
4 => "t1.code3",
|
||||
5 => "t1.moneda",
|
||||
6 => "t1.url_erp",
|
||||
7 => "t1.user_erp",
|
||||
8 => "t1.key_erp",
|
||||
9 => "t1.show_erp",
|
||||
];
|
||||
|
||||
protected $allowedFields = ["nombre", "code", "code3", "moneda", "url_erp", "user_erp", "key_erp", "show_erp"];
|
||||
protected $returnType = "App\Entities\Configuracion\Pais";
|
||||
protected $returnType = "App\Entities\Configuracion\PaisEntity";
|
||||
|
||||
public static $labelField = "nombre";
|
||||
|
||||
@ -75,4 +87,42 @@ class PaisModel extends \App\Models\GoBaseModel
|
||||
"max_length" => "Paises.validation.user_erp.max_length",
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* 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.code AS code, t1.code3 AS code3, t1.moneda AS moneda, t1.url_erp AS url_erp, t1.user_erp AS user_erp, t1.key_erp AS key_erp, t1.show_erp AS show_erp"
|
||||
);
|
||||
|
||||
return empty($search)
|
||||
? $builder
|
||||
: $builder
|
||||
->groupStart()
|
||||
->like("t1.id", $search)
|
||||
->orLike("t1.nombre", $search)
|
||||
->orLike("t1.code", $search)
|
||||
->orLike("t1.code3", $search)
|
||||
->orLike("t1.moneda", $search)
|
||||
->orLike("t1.url_erp", $search)
|
||||
->orLike("t1.user_erp", $search)
|
||||
->orLike("t1.key_erp", $search)
|
||||
->orLike("t1.id", $search)
|
||||
->orLike("t1.nombre", $search)
|
||||
->orLike("t1.code", $search)
|
||||
->orLike("t1.code3", $search)
|
||||
->orLike("t1.moneda", $search)
|
||||
->orLike("t1.url_erp", $search)
|
||||
->orLike("t1.user_erp", $search)
|
||||
->orLike("t1.key_erp", $search)
|
||||
->groupEnd();
|
||||
}
|
||||
}
|
||||
|
||||
109
ci4/app/Models/Configuracion/ProvinciaModel.php
Normal file
109
ci4/app/Models/Configuracion/ProvinciaModel.php
Normal file
@ -0,0 +1,109 @@
|
||||
<?php
|
||||
namespace App\Models\Configuracion;
|
||||
|
||||
class ProvinciaModel extends \App\Models\GoBaseModel
|
||||
{
|
||||
protected $table = "lg_provincias";
|
||||
|
||||
/**
|
||||
* Whether primary key uses auto increment.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $useAutoIncrement = true;
|
||||
|
||||
const SORTABLE = [
|
||||
1 => "t1.id",
|
||||
2 => "t1.code",
|
||||
3 => "t1.nombre",
|
||||
4 => "t1.pais_id",
|
||||
5 => "t1.created_at",
|
||||
6 => "t1.updated_at",
|
||||
7 => "t2.nombre",
|
||||
];
|
||||
|
||||
protected $allowedFields = ["code", "nombre", "pais_id"];
|
||||
protected $returnType = "App\Entities\Configuracion\ProvinciaEntity";
|
||||
|
||||
public static $labelField = "nombre";
|
||||
|
||||
protected $validationRules = [
|
||||
"code" => [
|
||||
"label" => "Provincias.code",
|
||||
"rules" => "trim|required|max_length[2]|is_unique[lg_provincias.code,id,{id}]",
|
||||
],
|
||||
"nombre" => [
|
||||
"label" => "Provincias.nombre",
|
||||
"rules" => "trim|required|max_length[255]",
|
||||
],
|
||||
];
|
||||
|
||||
protected $validationMessages = [
|
||||
"code" => [
|
||||
"is_unique" => "Provincias.validation.code.is_unique",
|
||||
"max_length" => "Provincias.validation.code.max_length",
|
||||
"required" => "Provincias.validation.code.required",
|
||||
],
|
||||
"nombre" => [
|
||||
"max_length" => "Provincias.validation.nombre.max_length",
|
||||
"required" => "Provincias.validation.nombre.required",
|
||||
],
|
||||
];
|
||||
|
||||
public function findAllWithPaises(string $selcols = "*", int $limit = null, int $offset = 0)
|
||||
{
|
||||
$sql =
|
||||
"SELECT t1." .
|
||||
$selcols .
|
||||
", t2.nombre AS pais FROM " .
|
||||
$this->table .
|
||||
" t1 LEFT JOIN lg_paises t2 ON t1.pais_id = t2.id";
|
||||
if (!is_null($limit) && intval($limit) > 0) {
|
||||
$sql .= " LIMIT " . $limit;
|
||||
}
|
||||
|
||||
if (!is_null($offset) && intval($offset) > 0) {
|
||||
$sql .= " OFFSET " . $offset;
|
||||
}
|
||||
|
||||
$query = $this->db->query($sql);
|
||||
$result = $query->getResultObject();
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.code AS code, t1.nombre AS nombre, t1.created_at AS created_at, t1.updated_at AS updated_at, t2.nombre AS pais"
|
||||
);
|
||||
$builder->join("lg_paises t2", "t1.pais_id = t2.id", "left");
|
||||
|
||||
return empty($search)
|
||||
? $builder
|
||||
: $builder
|
||||
->groupStart()
|
||||
->like("t1.id", $search)
|
||||
->orLike("t1.code", $search)
|
||||
->orLike("t1.nombre", $search)
|
||||
->orLike("t1.created_at", $search)
|
||||
->orLike("t1.updated_at", $search)
|
||||
->orLike("t2.id", $search)
|
||||
->orLike("t1.id", $search)
|
||||
->orLike("t1.code", $search)
|
||||
->orLike("t1.nombre", $search)
|
||||
->orLike("t1.pais_id", $search)
|
||||
->orLike("t1.created_at", $search)
|
||||
->orLike("t1.updated_at", $search)
|
||||
->orLike("t2.nombre", $search)
|
||||
->groupEnd();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user