mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'main' into 'dev/chat'
Main See merge request jjimenez/safekat!296
This commit is contained in:
@ -8,8 +8,8 @@ class FacturaEntity extends \CodeIgniter\Entity\Entity
|
||||
protected $attributes = [
|
||||
'id' => null,
|
||||
'pedido_id' => null,
|
||||
'factura_retificada_id' => null,
|
||||
'factura_retificativa_id' => null,
|
||||
'factura_rectificada_id' => null,
|
||||
'factura_rectificativa_id' => null,
|
||||
'cliente_id' => null,
|
||||
'serie_id' => null,
|
||||
'numero' => null,
|
||||
@ -33,18 +33,14 @@ class FacturaEntity extends \CodeIgniter\Entity\Entity
|
||||
'updated_at' => null,
|
||||
'deleted_at' => null,
|
||||
'user_created_id' => null,
|
||||
'user_update_id' => null,
|
||||
'user_updated_id' => null,
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'id' => 'int',
|
||||
'pedido_id' => 'int',
|
||||
'factura_retificada_id' => 'int',
|
||||
'factura_retificativa_id' => 'int',
|
||||
'cliente_id' => 'int',
|
||||
'serie_id' => 'int',
|
||||
'estado' => 'int',
|
||||
'estado_pago' => 'int',
|
||||
'base' => 'float',
|
||||
'total' => 'float',
|
||||
'pendiente' => 'float',
|
||||
|
||||
@ -8,7 +8,7 @@ class FacturaLineaEntity extends \CodeIgniter\Entity\Entity
|
||||
protected $attributes = [
|
||||
'id' => null,
|
||||
'factura_id' => null,
|
||||
'pedido_impresion_id' => null,
|
||||
'pedido_linea_impresion_id' => null,
|
||||
'pedido_maquetacion_id' => null,
|
||||
'descripcion' => null,
|
||||
'cantidad' => null,
|
||||
@ -19,14 +19,14 @@ class FacturaLineaEntity extends \CodeIgniter\Entity\Entity
|
||||
'total' => null,
|
||||
'data' => null,
|
||||
'deleted_at' => null,
|
||||
'user_update_id' => null,
|
||||
'user_updated_id' => null,
|
||||
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'id' => 'int',
|
||||
'factura_id' => 'int',
|
||||
'pedido_impresion_id' => 'int',
|
||||
'pedido_linea_impresion_id' => 'int',
|
||||
'pedido_maquetacion_id' => 'int',
|
||||
'cantidad' => 'float',
|
||||
'precio_unidad' => 'float',
|
||||
|
||||
@ -14,7 +14,7 @@ class FacturaPagoEntity extends \CodeIgniter\Entity\Entity
|
||||
'forma_pago_id' => null,
|
||||
'total' => null,
|
||||
'deleted_at' => null,
|
||||
'user_update_id' => null,
|
||||
'user_updated_id' => null,
|
||||
|
||||
];
|
||||
|
||||
|
||||
@ -24,18 +24,25 @@ class UserEntity extends \CodeIgniter\Entity\Entity
|
||||
"cliente_id" => "int",
|
||||
"active" => "boolean",
|
||||
];
|
||||
|
||||
/**
|
||||
* Returns a full name: "first last"
|
||||
* Get the full name of the user
|
||||
*
|
||||
* @return string
|
||||
* If the first name and last name are available, the full name is generated as "{first name} {last name}".
|
||||
* If the first name or last name is missing, only the available name is used.
|
||||
* If both the first name and last name are missing, the username is used as the full name.
|
||||
*
|
||||
* @return string The full name of the user
|
||||
*/
|
||||
public function getFullName()
|
||||
{
|
||||
$fullName =
|
||||
(!empty($this->attributes["first_name"]) ? trim($this->attributes["first_name"]) . " " : "") .
|
||||
(!empty($this->attributes["last_name"]) ? trim($this->attributes["last_name"]) : "");
|
||||
$name = empty($fullName) ? $this->attributes["username"] : $fullName;
|
||||
return $name;
|
||||
$firstName = trim($this->attributes["first_name"] ?? "");
|
||||
$lastName = trim($this->attributes["last_name"] ?? "");
|
||||
$fullName = $firstName . ' ' . $lastName;
|
||||
$fullName = trim($fullName); // In case first name is empty, this will remove the leading space
|
||||
|
||||
// Use the username attribute if the full name is still empty after trimming
|
||||
return $fullName ?: $this->attributes["username"];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,16 +1,30 @@
|
||||
<?php
|
||||
namespace App\Entities\Usuarios;
|
||||
|
||||
use CodeIgniter\Entity;
|
||||
use CodeIgniter\Shield\Entities\User;
|
||||
|
||||
class UsersEntity extends User
|
||||
{
|
||||
protected $attributes = [
|
||||
"first_name" => null,
|
||||
"last_name" => null
|
||||
'first_name' => null,
|
||||
'last_name'=> null,
|
||||
'cliente_id' => null,
|
||||
'comments' => null,
|
||||
];
|
||||
protected $casts = [
|
||||
|
||||
"cliente_id" => "int",
|
||||
];
|
||||
|
||||
public function getFullName()
|
||||
{
|
||||
$firstName = trim($this->attributes["first_name"] ?? "");
|
||||
$lastName = trim($this->attributes["last_name"] ?? "");
|
||||
$fullName = $firstName . ' ' . $lastName;
|
||||
$fullName = trim($fullName); // In case first name is empty, this will remove the leading space
|
||||
|
||||
// Use the username attribute if the full name is still empty after trimming
|
||||
return $fullName ?: $this->attributes["username"];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user