Merge branch 'main' into feat/ot-new-features

This commit is contained in:
amazuecos
2025-05-01 06:15:26 +02:00
24 changed files with 1189 additions and 77 deletions

View File

@ -1,7 +1,9 @@
<?php
namespace App\Entities\Cliente;
namespace App\Entities\Clientes;
use CodeIgniter\Entity;
use App\Models\Clientes\ClienteModel;
use App\Models\Configuracion\PaisModel;
class ClienteDireccionesEntity extends \CodeIgniter\Entity\Entity
{
@ -23,4 +25,29 @@ class ClienteDireccionesEntity extends \CodeIgniter\Entity\Entity
"pais_id" => "int",
"cp" => "int",
];
public function getClienteNombre(): ?string
{
if (!$this->cliente_id) {
return null;
}
$clienteModel = model(ClienteModel::class);
$cliente = $clienteModel->find($this->cliente_id);
return $cliente ? $cliente->nombre : null;
}
public function getPaisNombre(): ?string
{
if (!$this->pais_id) {
return null;
}
$paisModel = model(PaisModel::class);
$pais = $paisModel->find($this->pais_id);
return $pais ? $pais->nombre : null;
}
}

View File

@ -48,6 +48,8 @@ class ClienteEntity extends \CodeIgniter\Entity\Entity
"updated_at" => null,
"user_created_id" => 1,
"user_update_id" => 1,
"no_envio_base" => 0,
"forzar_rotativa_pod" => 0,
];
protected $casts = [
"comunidad_autonoma_id" => "?int",
@ -70,6 +72,8 @@ class ClienteEntity extends \CodeIgniter\Entity\Entity
"is_deleted" => "int",
"user_created_id" => "int",
"user_update_id" => "int",
"no_envio_base" => "boolean",
"forzar_rotativa_pod" => "boolean",
];
public function comercial() : ?UserEntity