mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'fix/sk-36' into 'main'
Fix/sk 36 See merge request jjimenez/safekat!687
This commit is contained in:
@ -464,7 +464,7 @@ class Cliente extends \App\Controllers\BaseResourceController
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$modelPlantillaPreciosCliente = model('App\Models\Clientes\ClientePlantillaPreciosModel');
|
$modelPlantillaPreciosCliente = model('App\Models\Clientes\ClientePlantillaPreciosModel');
|
||||||
$plantilla = $modelPlantillaPreciosCliente->where("id", $plantilla_id)->where("is_deleted", 0)->first();
|
$plantilla = $modelPlantillaPreciosCliente->where("id", $plantilla_id)->where("deleted_at", null)->first();
|
||||||
if ($plantilla == false) {
|
if ($plantilla == false) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -135,7 +135,6 @@ class ClientePrecios extends \App\Controllers\BaseResourceController
|
|||||||
Field::inst('tipo_impresion'),
|
Field::inst('tipo_impresion'),
|
||||||
Field::inst('user_updated_id'),
|
Field::inst('user_updated_id'),
|
||||||
Field::inst('updated_at'),
|
Field::inst('updated_at'),
|
||||||
Field::inst('is_deleted'),
|
|
||||||
Field::inst('tiempo_min')
|
Field::inst('tiempo_min')
|
||||||
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
|
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
|
||||||
->validator(
|
->validator(
|
||||||
@ -205,7 +204,6 @@ class ClientePrecios extends \App\Controllers\BaseResourceController
|
|||||||
if ($action === Editor::ACTION_CREATE || $action === Editor::ACTION_EDIT) {
|
if ($action === Editor::ACTION_CREATE || $action === Editor::ACTION_EDIT) {
|
||||||
foreach ($data['data'] as $pkey => $values) {
|
foreach ($data['data'] as $pkey => $values) {
|
||||||
// Si no se quiere borrar...
|
// Si no se quiere borrar...
|
||||||
if ($data['data'][$pkey]['is_deleted'] != 1) {
|
|
||||||
$process_data['tiempo_min'] = $data['data'][$pkey]['tiempo_min'];
|
$process_data['tiempo_min'] = $data['data'][$pkey]['tiempo_min'];
|
||||||
$process_data['tiempo_max'] = $data['data'][$pkey]['tiempo_max'];
|
$process_data['tiempo_max'] = $data['data'][$pkey]['tiempo_max'];
|
||||||
$process_data['tipo'] = $data['data'][$pkey]['tipo'];
|
$process_data['tipo'] = $data['data'][$pkey]['tipo'];
|
||||||
@ -217,7 +215,6 @@ class ClientePrecios extends \App\Controllers\BaseResourceController
|
|||||||
if (!empty($response)) {
|
if (!empty($response)) {
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -155,7 +155,6 @@ class Clienteplantillaprecioslineas extends \App\Controllers\BaseResourceControl
|
|||||||
Field::inst( 'tipo_impresion' ),
|
Field::inst( 'tipo_impresion' ),
|
||||||
Field::inst( 'user_updated_id' ),
|
Field::inst( 'user_updated_id' ),
|
||||||
Field::inst( 'deleted_at' ),
|
Field::inst( 'deleted_at' ),
|
||||||
Field::inst( 'is_deleted' ),
|
|
||||||
Field::inst( 'updated_at' ),
|
Field::inst( 'updated_at' ),
|
||||||
Field::inst( 'tiempo_min' )
|
Field::inst( 'tiempo_min' )
|
||||||
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
|
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
|
||||||
|
|||||||
@ -0,0 +1,74 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Database\Migrations;
|
||||||
|
|
||||||
|
use CodeIgniter\Database\Migration;
|
||||||
|
use CodeIgniter\I18n\Time;
|
||||||
|
|
||||||
|
class DropIsDeletedField extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
|
||||||
|
$m = $this->db->table('clientes');
|
||||||
|
$m->where('is_deleted',1)->update(['deleted_at' => Time::now()]);
|
||||||
|
$m->where('is_deleted',0)->update(['deleted_at' => null]);
|
||||||
|
$this->forge->dropColumn('clientes',"is_deleted");
|
||||||
|
|
||||||
|
$m = $this->db->table('cliente_contactos');
|
||||||
|
$m->where('is_deleted',1)->update(['deleted_at' => Time::now()]);
|
||||||
|
$m->where('is_deleted',0)->update(['deleted_at' => null]);
|
||||||
|
$this->forge->dropColumn('cliente_contactos',"is_deleted");
|
||||||
|
|
||||||
|
$m = $this->db->table('cliente_precios');
|
||||||
|
$m->where('is_deleted',1)->update(['deleted_at' => Time::now()]);
|
||||||
|
$m->where('is_deleted',0)->update(['deleted_at' => null]);
|
||||||
|
$this->forge->dropColumn('cliente_precios',"is_deleted");
|
||||||
|
|
||||||
|
$m = $this->db->table('cliente_plantilla_precios_lineas');
|
||||||
|
$m->where('is_deleted',1)->update(['deleted_at' => Time::now()]);
|
||||||
|
$m->where('is_deleted',0)->update(['deleted_at' => null]);
|
||||||
|
$this->forge->dropColumn('cliente_plantilla_precios_lineas',"is_deleted");
|
||||||
|
|
||||||
|
$m = $this->db->table('cliente_plantilla_precios');
|
||||||
|
$m->where('is_deleted',1)->update(['deleted_at' => Time::now()]);
|
||||||
|
$m->where('is_deleted',0)->update(['deleted_at' => null]);
|
||||||
|
$this->forge->dropColumn('cliente_plantilla_precios',"is_deleted");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
$column = [
|
||||||
|
'is_deleted' => [
|
||||||
|
'type' => 'BOOLEAN',
|
||||||
|
'default' => false,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
$this->forge->addColumn('clientes',$column);
|
||||||
|
$m = $this->db->table('clientes');
|
||||||
|
$m->where('deleted_at IS NOT NULL',null,false)->update(['is_deleted' => true]);
|
||||||
|
$m->where('deleted_at',null)->update(['is_deleted' => false]);
|
||||||
|
|
||||||
|
$this->forge->addColumn('cliente_contactos',$column);
|
||||||
|
$m = $this->db->table('cliente_contactos');
|
||||||
|
$m->where('deleted_at IS NOT NULL',null,false)->update(['is_deleted' => true]);
|
||||||
|
$m->where('deleted_at',null)->update(['is_deleted' => false]);
|
||||||
|
|
||||||
|
$this->forge->addColumn('cliente_precios',$column);
|
||||||
|
$m = $this->db->table('cliente_precios');
|
||||||
|
$m->where('deleted_at IS NOT NULL',null,false)->update(['is_deleted' => true]);
|
||||||
|
$m->where('deleted_at',null)->update(['is_deleted' => false]);
|
||||||
|
|
||||||
|
$this->forge->addColumn('cliente_plantilla_precios_lineas',$column);
|
||||||
|
$m = $this->db->table('cliente_plantilla_precios_lineas');
|
||||||
|
$m->where('deleted_at IS NOT NULL',null,false)->update(['is_deleted' => true]);
|
||||||
|
$m->where('deleted_at',null)->update(['is_deleted' => false]);
|
||||||
|
|
||||||
|
$this->forge->addColumn('cliente_plantilla_precios',$column);
|
||||||
|
$m = $this->db->table('cliente_plantilla_precios');
|
||||||
|
$m->where('deleted_at IS NOT NULL',null,false)->update(['is_deleted' => true]);
|
||||||
|
$m->where('deleted_at',null)->update(['is_deleted' => false]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -25,12 +25,12 @@ class ClienteContactoModel extends \App\Models\BaseModel
|
|||||||
protected $returnType = "App\Entities\Clientes\ClienteContactoEntity";
|
protected $returnType = "App\Entities\Clientes\ClienteContactoEntity";
|
||||||
|
|
||||||
protected $useTimestamps = true;
|
protected $useTimestamps = true;
|
||||||
protected $useSoftDeletes = false;
|
protected $useSoftDeletes = true;
|
||||||
|
protected $deletedField = 'deleted_at';
|
||||||
|
|
||||||
protected $createdField = "created_at";
|
protected $createdField = "created_at";
|
||||||
|
|
||||||
protected $updatedField = "updated_at";
|
protected $updatedField = "updated_at";
|
||||||
protected $deletedField = 'deleted_at';
|
|
||||||
|
|
||||||
public static $labelField = "nombre";
|
public static $labelField = "nombre";
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ class ClienteContactoModel extends \App\Models\BaseModel
|
|||||||
);
|
);
|
||||||
|
|
||||||
$builder->where('t1.cliente_id', $cliente_id);
|
$builder->where('t1.cliente_id', $cliente_id);
|
||||||
$builder->where("t1.is_deleted", 0);
|
$builder->where("t1.deleted_at", null);
|
||||||
$builder->join("clientes t2", "t1.cliente_id = t2.id", "left");
|
$builder->join("clientes t2", "t1.cliente_id = t2.id", "left");
|
||||||
|
|
||||||
return empty($search)
|
return empty($search)
|
||||||
|
|||||||
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Models\Clientes;
|
namespace App\Models\Clientes;
|
||||||
|
|
||||||
|
use App\Entities\Clientes\ClienteEntity;
|
||||||
|
|
||||||
class ClienteModel extends \App\Models\BaseModel
|
class ClienteModel extends \App\Models\BaseModel
|
||||||
{
|
{
|
||||||
protected $table = "clientes";
|
protected $table = "clientes";
|
||||||
@ -57,13 +59,11 @@ class ClienteModel extends \App\Models\BaseModel
|
|||||||
"comentarios_tirada_flexible",
|
"comentarios_tirada_flexible",
|
||||||
"margen_plantilla_id",
|
"margen_plantilla_id",
|
||||||
"comentarios",
|
"comentarios",
|
||||||
"is_deleted",
|
|
||||||
"deleted_at",
|
|
||||||
"user_created_id",
|
"user_created_id",
|
||||||
"user_update_id",
|
"user_update_id",
|
||||||
];
|
];
|
||||||
protected $returnType = "App\Entities\Clientes\ClienteEntity";
|
protected $returnType = ClienteEntity::class;
|
||||||
|
protected $useSoftDeletes = true;
|
||||||
protected $deletedField = 'deleted_at';
|
protected $deletedField = 'deleted_at';
|
||||||
|
|
||||||
public static $labelField = "nombre";
|
public static $labelField = "nombre";
|
||||||
@ -197,10 +197,7 @@ class ClienteModel extends \App\Models\BaseModel
|
|||||||
"fecha_vencimiento" => [
|
"fecha_vencimiento" => [
|
||||||
"max_length" => "Clientes.validation.fecha_vencimiento.max_length",
|
"max_length" => "Clientes.validation.fecha_vencimiento.max_length",
|
||||||
],
|
],
|
||||||
"is_deleted" => [
|
|
||||||
"integer" => "Clientes.validation.is_deleted.integer",
|
|
||||||
"required" => "Clientes.validation.is_deleted.required",
|
|
||||||
],
|
|
||||||
"limite_credito" => [
|
"limite_credito" => [
|
||||||
"decimal" => "Clientes.validation.limite_credito.decimal",
|
"decimal" => "Clientes.validation.limite_credito.decimal",
|
||||||
"required" => "Clientes.validation.limite_credito.required",
|
"required" => "Clientes.validation.limite_credito.required",
|
||||||
@ -287,7 +284,7 @@ class ClienteModel extends \App\Models\BaseModel
|
|||||||
->select(
|
->select(
|
||||||
"t1.id AS id, t1.nombre AS nombre, t1.alias AS alias, t1.cif AS cif, t1.email AS email, t1.vencimiento AS vencimiento, t5.first_name AS comercial, t7.nombre AS forma_pago_id"
|
"t1.id AS id, t1.nombre AS nombre, t1.alias AS alias, t1.cif AS cif, t1.email AS email, t1.vencimiento AS vencimiento, t5.first_name AS comercial, t7.nombre AS forma_pago_id"
|
||||||
)
|
)
|
||||||
->where("is_deleted", 0);;
|
->where("t1.deleted_at", null);;
|
||||||
$builder->join("users t5", "t1.comercial_id = t5.id", "left");
|
$builder->join("users t5", "t1.comercial_id = t5.id", "left");
|
||||||
$builder->join("formas_pago t7", "t1.forma_pago_id = t7.id", "left");
|
$builder->join("formas_pago t7", "t1.forma_pago_id = t7.id", "left");
|
||||||
|
|
||||||
@ -315,7 +312,7 @@ class ClienteModel extends \App\Models\BaseModel
|
|||||||
->select(
|
->select(
|
||||||
"t1.limite_credito AS limite_credito"
|
"t1.limite_credito AS limite_credito"
|
||||||
)
|
)
|
||||||
->where("t1.is_deleted", 0)
|
->where("t1.deleted_at", null)
|
||||||
->where("t1.id", $cliente_id);
|
->where("t1.id", $cliente_id);
|
||||||
$limite = $builder->get()->getResultObject();
|
$limite = $builder->get()->getResultObject();
|
||||||
|
|
||||||
@ -340,7 +337,7 @@ class ClienteModel extends \App\Models\BaseModel
|
|||||||
t2.nombre AS cliente_pais, t1.cp AS cliente_cp, t1.ciudad AS cliente_ciudad,
|
t2.nombre AS cliente_pais, t1.cp AS cliente_cp, t1.ciudad AS cliente_ciudad,
|
||||||
t3.nombre AS cliente_provincia, t1.credito_asegurado AS creditoAsegurado"
|
t3.nombre AS cliente_provincia, t1.credito_asegurado AS creditoAsegurado"
|
||||||
)
|
)
|
||||||
->where("t1.is_deleted", 0)
|
->where("t1.deleted_at", null)
|
||||||
->where("t1.id", $cliente_id);
|
->where("t1.id", $cliente_id);
|
||||||
$builder->join("lg_paises t2", "t1.pais_id = t2.id", "left");
|
$builder->join("lg_paises t2", "t1.pais_id = t2.id", "left");
|
||||||
$builder->join("lg_provincias t3", "t1.provincia_id = t3.id", "left");
|
$builder->join("lg_provincias t3", "t1.provincia_id = t3.id", "left");
|
||||||
@ -394,7 +391,7 @@ class ClienteModel extends \App\Models\BaseModel
|
|||||||
"t1.nombre AS nombre"
|
"t1.nombre AS nombre"
|
||||||
)
|
)
|
||||||
->where("id", $id)
|
->where("id", $id)
|
||||||
->where("is_deleted", 0);
|
->where("t1.deleted_at", null);
|
||||||
|
|
||||||
return $builder->get()->getResultObject()[0]->nombre;
|
return $builder->get()->getResultObject()[0]->nombre;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@ -409,7 +406,7 @@ class ClienteModel extends \App\Models\BaseModel
|
|||||||
->select(
|
->select(
|
||||||
"t1.id AS id, t1.nombre AS name"
|
"t1.id AS id, t1.nombre AS name"
|
||||||
)
|
)
|
||||||
->where("is_deleted", 0);
|
->where("t1.deleted_at", null);
|
||||||
return empty($search)
|
return empty($search)
|
||||||
? $builder->get()->getResultObject()
|
? $builder->get()->getResultObject()
|
||||||
: $builder
|
: $builder
|
||||||
@ -586,7 +583,7 @@ class ClienteModel extends \App\Models\BaseModel
|
|||||||
$result['limite_credito'] = $this->db->table('clientes')
|
$result['limite_credito'] = $this->db->table('clientes')
|
||||||
->select('limite_credito')
|
->select('limite_credito')
|
||||||
->where('id', $cliente_id)
|
->where('id', $cliente_id)
|
||||||
->where('is_deleted', 0)
|
->where("deleted_at", null)
|
||||||
->get()
|
->get()
|
||||||
->getResultObject()[0]->limite_credito;
|
->getResultObject()[0]->limite_credito;
|
||||||
$result['limite_credito'] = round(floatval($result['limite_credito']), 2);
|
$result['limite_credito'] = round(floatval($result['limite_credito']), 2);
|
||||||
|
|||||||
@ -36,7 +36,6 @@ class ClientePlantillaPreciosLineasModel extends \App\Models\BaseModel
|
|||||||
"tiempo_max",
|
"tiempo_max",
|
||||||
"precio_hora",
|
"precio_hora",
|
||||||
"margen",
|
"margen",
|
||||||
"is_deleted",
|
|
||||||
"deleted_at",
|
"deleted_at",
|
||||||
"created_at",
|
"created_at",
|
||||||
"updated_at",
|
"updated_at",
|
||||||
@ -45,11 +44,12 @@ class ClientePlantillaPreciosLineasModel extends \App\Models\BaseModel
|
|||||||
protected $returnType = "App\Entities\Clientes\ClientePlantillaPreciosLineasEntity";
|
protected $returnType = "App\Entities\Clientes\ClientePlantillaPreciosLineasEntity";
|
||||||
|
|
||||||
protected $useTimestamps = true;
|
protected $useTimestamps = true;
|
||||||
protected $useSoftDeletes = false;
|
protected $useSoftDeletes = true;
|
||||||
|
|
||||||
protected $createdField = "created_at";
|
protected $createdField = "created_at";
|
||||||
|
|
||||||
protected $updatedField = "updated_at";
|
protected $updatedField = "updated_at";
|
||||||
|
protected $deletedField = 'deleted_at';
|
||||||
|
|
||||||
public static $labelField = "plantilla_id";
|
public static $labelField = "plantilla_id";
|
||||||
|
|
||||||
@ -121,7 +121,6 @@ class ClientePlantillaPreciosLineasModel extends \App\Models\BaseModel
|
|||||||
$this->db
|
$this->db
|
||||||
->table($this->table . " t1")
|
->table($this->table . " t1")
|
||||||
->where('t1.plantilla_id', $plantilla_id)
|
->where('t1.plantilla_id', $plantilla_id)
|
||||||
->set('is_deleted', 1)
|
|
||||||
->set('deleted_at', $date_value)
|
->set('deleted_at', $date_value)
|
||||||
->update();
|
->update();
|
||||||
|
|
||||||
@ -152,7 +151,7 @@ class ClientePlantillaPreciosLineasModel extends \App\Models\BaseModel
|
|||||||
|
|
||||||
$builder->join("users t2", "t1.user_updated_id = t2.id", "left");
|
$builder->join("users t2", "t1.user_updated_id = t2.id", "left");
|
||||||
|
|
||||||
$builder->where('t1.is_deleted', 0);
|
$builder->where('t1.deleted_at', 0);
|
||||||
$builder->where('t1.plantilla_id', $plantilla_id);
|
$builder->where('t1.plantilla_id', $plantilla_id);
|
||||||
|
|
||||||
if (empty($search))
|
if (empty($search))
|
||||||
@ -181,7 +180,7 @@ class ClientePlantillaPreciosLineasModel extends \App\Models\BaseModel
|
|||||||
$rows = $this->db
|
$rows = $this->db
|
||||||
->table($this->table)
|
->table($this->table)
|
||||||
->select("id, tiempo_min, tiempo_max")
|
->select("id, tiempo_min, tiempo_max")
|
||||||
->where("is_deleted", 0)
|
->where("deleted_at", null)
|
||||||
->where("tipo", $data["tipo"])
|
->where("tipo", $data["tipo"])
|
||||||
->where("tipo_maquina", $data["tipo_maquina"])
|
->where("tipo_maquina", $data["tipo_maquina"])
|
||||||
->where("tipo_impresion", $data["tipo_impresion"])
|
->where("tipo_impresion", $data["tipo_impresion"])
|
||||||
|
|||||||
@ -19,11 +19,12 @@ class ClientePlantillaPreciosModel extends \App\Models\BaseModel
|
|||||||
protected $useAutoIncrement = true;
|
protected $useAutoIncrement = true;
|
||||||
|
|
||||||
|
|
||||||
protected $allowedFields = ["nombre", "is_deleted", "deleted_at", "created_at", "updated_at"];
|
protected $allowedFields = ["nombre", "deleted_at", "created_at", "updated_at"];
|
||||||
protected $returnType = "App\Entities\Clientes\ClientePlantillaPreciosEntity";
|
protected $returnType = "App\Entities\Clientes\ClientePlantillaPreciosEntity";
|
||||||
|
|
||||||
protected $useTimestamps = true;
|
protected $useTimestamps = true;
|
||||||
protected $useSoftDeletes = false;
|
protected $useSoftDeletes = true;
|
||||||
|
protected $deletedField = 'deleted_at';
|
||||||
|
|
||||||
protected $createdField = "created_at";
|
protected $createdField = "created_at";
|
||||||
|
|
||||||
@ -61,7 +62,7 @@ class ClientePlantillaPreciosModel extends \App\Models\BaseModel
|
|||||||
"t1.id as id, t1.nombre AS nombre"
|
"t1.id as id, t1.nombre AS nombre"
|
||||||
);
|
);
|
||||||
|
|
||||||
$builder->where('t1.is_deleted', 0);
|
$builder->where('t1.deleted_at', null);
|
||||||
|
|
||||||
if (empty($search))
|
if (empty($search))
|
||||||
return $builder;
|
return $builder;
|
||||||
|
|||||||
@ -34,7 +34,6 @@ class ClientePreciosModel extends \App\Models\BaseModel
|
|||||||
"tiempo_max",
|
"tiempo_max",
|
||||||
"precio_hora",
|
"precio_hora",
|
||||||
"margen",
|
"margen",
|
||||||
"is_deleted",
|
|
||||||
"deleted_at",
|
"deleted_at",
|
||||||
"created_at",
|
"created_at",
|
||||||
"updated_at",
|
"updated_at",
|
||||||
@ -45,7 +44,8 @@ class ClientePreciosModel extends \App\Models\BaseModel
|
|||||||
protected $returnType = "App\Entities\Clientes\ClientePreciosEntity";
|
protected $returnType = "App\Entities\Clientes\ClientePreciosEntity";
|
||||||
|
|
||||||
protected $useTimestamps = true;
|
protected $useTimestamps = true;
|
||||||
protected $useSoftDeletes = false;
|
protected $useSoftDeletes = true;
|
||||||
|
protected $deletedField = 'deleted_at';
|
||||||
|
|
||||||
protected $createdField = "created_at";
|
protected $createdField = "created_at";
|
||||||
|
|
||||||
@ -140,7 +140,6 @@ class ClientePreciosModel extends \App\Models\BaseModel
|
|||||||
$this->db
|
$this->db
|
||||||
->table($this->table . " t1")
|
->table($this->table . " t1")
|
||||||
->where('cliente_id', $cliente_id)
|
->where('cliente_id', $cliente_id)
|
||||||
->set('is_deleted', 1)
|
|
||||||
->set('deleted_at', $date_value)
|
->set('deleted_at', $date_value)
|
||||||
->set('user_updated_id', $session->id_user)
|
->set('user_updated_id', $session->id_user)
|
||||||
->update();
|
->update();
|
||||||
@ -153,7 +152,7 @@ class ClientePreciosModel extends \App\Models\BaseModel
|
|||||||
// Se borran los valores existentes para todos los clientes en una sola consulta
|
// Se borran los valores existentes para todos los clientes en una sola consulta
|
||||||
|
|
||||||
$modelCliente = model('App\Models\Clientes\ClienteModel');
|
$modelCliente = model('App\Models\Clientes\ClienteModel');
|
||||||
$clientes = $modelCliente->select('id')->where('is_deleted', 0)->findAll();
|
$clientes = $modelCliente->select('id')->where('deleted_at', null)->findAll();
|
||||||
|
|
||||||
// Se borra la tabla
|
// Se borra la tabla
|
||||||
$this->db->table($this->table)->truncate();
|
$this->db->table($this->table)->truncate();
|
||||||
@ -288,7 +287,7 @@ class ClientePreciosModel extends \App\Models\BaseModel
|
|||||||
->table($this->table . " t1")
|
->table($this->table . " t1")
|
||||||
->select("t1.cliente_id AS id")
|
->select("t1.cliente_id AS id")
|
||||||
->where('t1.plantilla_id', $plantilla_id)
|
->where('t1.plantilla_id', $plantilla_id)
|
||||||
->where('t1.is_deleted', 0)
|
->where('t1.deleted_at', null)
|
||||||
->distinct()
|
->distinct()
|
||||||
->get()->getResultArray();
|
->get()->getResultArray();
|
||||||
// Extraer solo los IDs de los clientes
|
// Extraer solo los IDs de los clientes
|
||||||
@ -359,7 +358,7 @@ class ClientePreciosModel extends \App\Models\BaseModel
|
|||||||
->where('tipo_impresion', $config->tipo_impresion)
|
->where('tipo_impresion', $config->tipo_impresion)
|
||||||
->where('tiempo_min <=', $tiempo)
|
->where('tiempo_min <=', $tiempo)
|
||||||
->where('tiempo_max >=', $tiempo)
|
->where('tiempo_max >=', $tiempo)
|
||||||
->where('is_deleted', 0)
|
->where('deleted_at', null)
|
||||||
->get()->getResultObject();
|
->get()->getResultObject();
|
||||||
|
|
||||||
if (count($values) > 0) {
|
if (count($values) > 0) {
|
||||||
@ -389,7 +388,7 @@ class ClientePreciosModel extends \App\Models\BaseModel
|
|||||||
|
|
||||||
$builder->join("users t2", "t1.user_updated_id = t2.id", "left");
|
$builder->join("users t2", "t1.user_updated_id = t2.id", "left");
|
||||||
|
|
||||||
$builder->where('t1.is_deleted', 0);
|
$builder->where('t1.deleted_at', 0);
|
||||||
$builder->where('t1.cliente_id', $cliente_id);
|
$builder->where('t1.cliente_id', $cliente_id);
|
||||||
|
|
||||||
if (empty($search))
|
if (empty($search))
|
||||||
@ -415,7 +414,7 @@ class ClientePreciosModel extends \App\Models\BaseModel
|
|||||||
"t1.plantilla_id AS id, t2.nombre AS nombre"
|
"t1.plantilla_id AS id, t2.nombre AS nombre"
|
||||||
);
|
);
|
||||||
|
|
||||||
$builder->where('t1.is_deleted', 0);
|
$builder->where('t1.deleted_at', null);
|
||||||
$builder->where('t1.cliente_id', $cliente_id);
|
$builder->where('t1.cliente_id', $cliente_id);
|
||||||
$builder->join("cliente_plantilla_precios t2", "t1.plantilla_id = t2.id", "left");
|
$builder->join("cliente_plantilla_precios t2", "t1.plantilla_id = t2.id", "left");
|
||||||
$builder->limit(1);
|
$builder->limit(1);
|
||||||
@ -442,7 +441,7 @@ class ClientePreciosModel extends \App\Models\BaseModel
|
|||||||
$rows = $this->db
|
$rows = $this->db
|
||||||
->table($this->table)
|
->table($this->table)
|
||||||
->select("id, tiempo_min, tiempo_max")
|
->select("id, tiempo_min, tiempo_max")
|
||||||
->where("is_deleted", 0)
|
->where("deleted_at", null)
|
||||||
->where("tipo", $data["tipo"])
|
->where("tipo", $data["tipo"])
|
||||||
->where("tipo_maquina", $data["tipo_maquina"])
|
->where("tipo_maquina", $data["tipo_maquina"])
|
||||||
->where("tipo_impresion", $data["tipo_impresion"])
|
->where("tipo_impresion", $data["tipo_impresion"])
|
||||||
@ -476,7 +475,7 @@ class ClientePreciosModel extends \App\Models\BaseModel
|
|||||||
$value = $this->db
|
$value = $this->db
|
||||||
->table($this->table)
|
->table($this->table)
|
||||||
->select("plantilla_id")
|
->select("plantilla_id")
|
||||||
->where("is_deleted", 0)
|
->where("deleted_at", null)
|
||||||
->where("cliente_id", $cliente_id)
|
->where("cliente_id", $cliente_id)
|
||||||
->limit(1)->get()->getResultObject();
|
->limit(1)->get()->getResultObject();
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,8 @@ class ClienteUsuariosModel extends ShieldUserModel
|
|||||||
protected $returnType = "App\Entities\Usuarios\UserEntity";
|
protected $returnType = "App\Entities\Usuarios\UserEntity";
|
||||||
|
|
||||||
protected $useTimestamps = true;
|
protected $useTimestamps = true;
|
||||||
protected $useSoftDeletes = false;
|
protected $useSoftDeletes = true;
|
||||||
|
protected $deletedField = 'deleted_at';
|
||||||
|
|
||||||
protected $createdField = "created_at";
|
protected $createdField = "created_at";
|
||||||
|
|
||||||
|
|||||||
@ -787,10 +787,7 @@ $(document).on('click', '.btn-remove', function(e) {
|
|||||||
},{
|
},{
|
||||||
"name": "deleted_at",
|
"name": "deleted_at",
|
||||||
"type": "hidden"
|
"type": "hidden"
|
||||||
},{
|
}
|
||||||
"name": "is_deleted",
|
|
||||||
"type": "hidden"
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user