mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
presupuestos direcciones!
This commit is contained in:
@ -19,10 +19,11 @@ class ClienteDireccionesModel extends \App\Models\GoBaseModel
|
||||
2 => "t1.email",
|
||||
3 => "t1.direccion",
|
||||
4 => "t1.cp",
|
||||
5 => "t5.municipio_nombre",
|
||||
6 => "t4.nombre",
|
||||
7 => "t3.nombre",
|
||||
8 => "t1.telefono",
|
||||
5 => "t1.municipio",
|
||||
6 => "t1.provincia",
|
||||
7 => "t4.nombre",
|
||||
8 => "t3.nombre",
|
||||
9 => "t1.telefono",
|
||||
];
|
||||
|
||||
protected $allowedFields = [
|
||||
|
||||
89
ci4/app/Models/Presupuestos/PresupuestoDireccionesModel.php
Normal file
89
ci4/app/Models/Presupuestos/PresupuestoDireccionesModel.php
Normal file
@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Presupuestos;
|
||||
|
||||
class PresupuestoDireccionesModel extends \App\Models\GoBaseModel
|
||||
{
|
||||
protected $table = "presupuesto_direcciones";
|
||||
|
||||
/**
|
||||
* Whether primary key uses auto increment.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $useAutoIncrement = true;
|
||||
|
||||
const SORTABLE = [
|
||||
0 => "t1.cantidad",
|
||||
1 => "t1.att",
|
||||
2 => "t1.email",
|
||||
3 => "t1.direccion",
|
||||
4 => "t1.cp",
|
||||
5 => "t1.municipio",
|
||||
6 => "t1.provincia",
|
||||
7 => "t2.nombre",
|
||||
8 => "t1.telefono",
|
||||
];
|
||||
|
||||
protected $allowedFields = [
|
||||
"presupuesto_id",
|
||||
"cantidad",
|
||||
"peso",
|
||||
"att",
|
||||
"email",
|
||||
"direccion",
|
||||
"pais_id",
|
||||
"ccaa_id",
|
||||
"provincia",
|
||||
"municipio",
|
||||
"cp",
|
||||
"telefono",
|
||||
'precio',
|
||||
'margen',
|
||||
];
|
||||
|
||||
protected $returnType = "App\Entities\Clientes\ClienteDireccionesEntity";
|
||||
|
||||
public static $labelField = "id";
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get resource data.
|
||||
*
|
||||
* @param string $search
|
||||
*
|
||||
* @return \CodeIgniter\Database\BaseBuilder
|
||||
*/
|
||||
public function getResource(string $search = "", $presupuesto_id = -1)
|
||||
{
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.id AS id, t1.presupuesto_id AS presupuesto_id, t1.att AS att,
|
||||
t1.email AS email, t1.direccion AS direccion, t1.pais_id AS pais_id, t2.nombre AS pais,
|
||||
t1.ccaa_id AS ccaa_id, t3.nombre AS ccaa_nombre,
|
||||
t1.municipio AS municipio, t1.provincia AS provincia, t1.cp AS cp, t1.telefono AS telefono,
|
||||
t1.cantidad AS cantidad, t1.precio AS precio, t1.margen AS margen"
|
||||
);
|
||||
|
||||
$builder->where('t1.presupuesto_id', $presupuesto_id);
|
||||
$builder->join("lg_paises t2", "t1.pais_id = t2.id", "left");
|
||||
$builder->join("lg_comunidades_autonomas t3", "t1.ccaa_id = t3.id", "left");
|
||||
|
||||
return empty($search)
|
||||
? $builder
|
||||
: $builder
|
||||
->groupStart()
|
||||
->like("t1.att", $search)
|
||||
->orLike("t1.email", $search)
|
||||
->orLike("t1.direccion", $search)
|
||||
->orLike("t2.nombre", $search)
|
||||
->orLike("t3.nombre", $search)
|
||||
->orLike("t1.municipio", $search)
|
||||
->orLike("t1.provincia", $search)
|
||||
->orLike("t1.cp", $search)
|
||||
->orLike("t1.telefono", $search)
|
||||
->groupEnd();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user