mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
271 lines
7.8 KiB
PHP
271 lines
7.8 KiB
PHP
<?php
|
|
|
|
namespace App\Entities\Catalogo;
|
|
|
|
use CodeIgniter\Entity\Entity;
|
|
use App\Models\Configuracion\PapelGenericoModel;
|
|
use App\Models\Configuracion\TipoPresupuestoModel;
|
|
use App\Models\Usuarios\UserModel;
|
|
use App\Models\Tarifas\Acabados\ServicioAcabadoModel;
|
|
use App\Models\Clientes\ClienteModel;
|
|
class CatalogoLibroEntity extends Entity
|
|
{
|
|
|
|
protected $attributes = [
|
|
'id' => null,
|
|
'cliente_id' => null,
|
|
'proveedor_id' => null,
|
|
'user_created_id' => 1,
|
|
'user_update_id' => 1,
|
|
'cubierta_archivo' => null,
|
|
'cubierta_url' => null,
|
|
'ancho' => 0.00,
|
|
'alto' => 0.00,
|
|
'peso' => null,
|
|
'titulo' => '',
|
|
'autor' => '',
|
|
'autor_entidad' => null,
|
|
'traductor' => null,
|
|
'ilustrador' => null,
|
|
'idioma' => 'spa',
|
|
'num_edic' => 1,
|
|
'fecha_disponibilidad' => null,
|
|
'fecha_public' => null,
|
|
'num_fotos' => 0,
|
|
'num_ilustr' => 0,
|
|
'num_ilustr_color' => 0,
|
|
'num_ilustr_bn' => 0,
|
|
'coleccion' => '',
|
|
'iskn' => null,
|
|
'isbn' => null,
|
|
'ean' => null,
|
|
'editorial' => '',
|
|
'resumen' => null,
|
|
'resumen_breve' => null,
|
|
'sello' => null,
|
|
'paginas' => 0,
|
|
'tipo_impresion' => null,
|
|
'comentarios' => '',
|
|
'negro_paginas' => null,
|
|
'negro_papel' => null,
|
|
'negro_papel_id' => null,
|
|
'negro_gramaje' => null,
|
|
'negro_pod_papel_id' => null,
|
|
'negro_pod_gramaje' => null,
|
|
'color_paginas' => null,
|
|
'color_papel' => null,
|
|
'color_papel_id' => null,
|
|
'color_gramaje' => null,
|
|
'color_pod_papel_id' => null,
|
|
'color_pod_gramaje' => null,
|
|
'cubierta_paginas' => null,
|
|
'cubierta_papel' => null,
|
|
'cubierta_papel_id' => null,
|
|
'cubierta_gramaje' => null,
|
|
'cubierta_ancho_solapas' => 0.00,
|
|
'cubierta_acabado_id' => null,
|
|
'cubierta_acabado' => null,
|
|
'cubierta_pod_papel_id' => null,
|
|
'cubierta_pod_gramaje' => null,
|
|
'sobrecubierta_paginas' => null,
|
|
'sobrecubierta_papel' => null,
|
|
'sobrecubierta_papel_id' => null,
|
|
'sobrecubierta_gramaje' => null,
|
|
'sobrecubierta_acabado_id' => null,
|
|
'sobrecubierta_acabado' => null,
|
|
'sobrecubierta_pod_papel_id' => null,
|
|
'sobrecubierta_ancho_solapas' => 0.00,
|
|
'sobrecubierta_pod_gramaje' => null,
|
|
'encuadernacion_id' => null,
|
|
'ubicacion' => null,
|
|
'created_at' => null,
|
|
'updated_at' => null,
|
|
'deleted_at' => null,
|
|
];
|
|
|
|
protected $dates = ['created_at', 'updated_at', 'deleted_at', 'fecha_disponibilidad', 'fecha_public'];
|
|
|
|
protected $casts = [
|
|
'id' => 'int',
|
|
'cliente_id' => '?int',
|
|
'proveedor_id' => '?int',
|
|
'user_created_id' => 'int',
|
|
'user_update_id' => 'int',
|
|
'ancho' => 'float',
|
|
'alto' => 'float',
|
|
'peso' => '?float',
|
|
'num_edic' => '?int',
|
|
'num_fotos' => '?int',
|
|
'num_ilustr' => '?int',
|
|
'num_ilustr_color' => '?int',
|
|
'num_ilustr_bn' => '?int',
|
|
'paginas' => 'int',
|
|
'negro_paginas' => '?int',
|
|
'negro_gramaje' => '?float',
|
|
'negro_papel_id' => '?int',
|
|
'negro_pod_papel_id' => '?int',
|
|
'negro_pod_gramaje' => '?float',
|
|
'color_paginas' => '?int',
|
|
'color_gramaje' => '?float',
|
|
'color_papel_id' => '?int',
|
|
'color_pod_papel_id' => '?int',
|
|
'color_pod_gramaje' => '?float',
|
|
'cubierta_paginas' => '?int',
|
|
'cubierta_gramaje' => '?float',
|
|
'cubierta_papel_id' => '?int',
|
|
'cubierta_pod_papel_id' => '?int',
|
|
'cubierta_ancho_solapas' => 'float',
|
|
'cubierta_pod_gramaje' => '?float',
|
|
'cubierta_acabado_id' => '?int',
|
|
'sobrecubierta_paginas' => '?int',
|
|
'sobrecubierta_gramaje' => '?float',
|
|
'sobrecubierta_papel_id' => '?int',
|
|
'sobrecubierta_pod_papel_id' => '?int',
|
|
'sobrecubierta_ancho_solapas' => 'float',
|
|
'sobrecubierta_pod_gramaje' => '?float',
|
|
'sobrecubierta_acabado_id' => '?int',
|
|
'encuadernacion_id' => '?int',
|
|
'fecha_disponibilidad' => 'datetime',
|
|
'fecha_public' => 'datetime',
|
|
];
|
|
|
|
public function getClienteName()
|
|
{
|
|
if (!$this->cliente_id) {
|
|
return null;
|
|
}
|
|
|
|
$cliente = model(ClienteModel::class)->find($this->cliente_id);
|
|
return $cliente->nombre ?? null;
|
|
}
|
|
|
|
public function getEncuadernacionName()
|
|
{
|
|
if (!$this->encuadernacion_id) {
|
|
return null;
|
|
}
|
|
|
|
$enc = model(TipoPresupuestoModel::class)->find($this->encuadernacion_id);
|
|
return $enc->encuadernacion ?? null;
|
|
}
|
|
|
|
public function getCreatedUser()
|
|
{
|
|
if (!$this->user_created_id) {
|
|
return null;
|
|
}
|
|
|
|
return model(UserModel::class)->getFullName($this->user_created_id);
|
|
}
|
|
|
|
public function getUpdatedUser()
|
|
{
|
|
if (!$this->user_update_id) {
|
|
return null;
|
|
}
|
|
|
|
return model(UserModel::class)->getFullName($this->user_update_id);
|
|
}
|
|
|
|
|
|
public function getNegroPapelName()
|
|
{
|
|
if (!$this->negro_papel_id) {
|
|
return null;
|
|
}
|
|
|
|
$papel = model(PapelGenericoModel::class)->asObject()->find($this->negro_papel_id);
|
|
return $papel?->nombre ?? null;
|
|
}
|
|
|
|
public function getNegroPodPapelName()
|
|
{
|
|
if (!$this->negro_pod_papel_id) {
|
|
return null;
|
|
}
|
|
|
|
$papel = model(PapelGenericoModel::class)->asObject()->find($this->negro_pod_papel_id);
|
|
return $papel?->nombre ?? null;
|
|
}
|
|
|
|
public function getColorPapelName()
|
|
{
|
|
if (!$this->color_papel_id) {
|
|
return null;
|
|
}
|
|
|
|
$papel = model(PapelGenericoModel::class)->asObject()->find($this->color_papel_id);
|
|
return $papel?->nombre ?? null;
|
|
}
|
|
|
|
public function getColorPodPapelName()
|
|
{
|
|
if (!$this->color_pod_papel_id) {
|
|
return null;
|
|
}
|
|
|
|
$papel = model(PapelGenericoModel::class)->asObject()->find($this->color_pod_papel_id);
|
|
return $papel?->nombre ?? null;
|
|
}
|
|
|
|
public function getCubiertaPapelName()
|
|
{
|
|
if (!$this->cubierta_papel_id) {
|
|
return null;
|
|
}
|
|
|
|
$papel = model(PapelGenericoModel::class)->asObject()->find($this->cubierta_papel_id);
|
|
return $papel?->nombre ?? null;
|
|
}
|
|
|
|
public function getCubiertaPodPapelName()
|
|
{
|
|
if (!$this->cubierta_pod_papel_id) {
|
|
return null;
|
|
}
|
|
|
|
$papel = model(PapelGenericoModel::class)->asObject()->find($this->cubierta_pod_papel_id);
|
|
return $papel?->nombre ?? null;
|
|
}
|
|
|
|
public function getSobrecubiertaPapelName()
|
|
{
|
|
if (!$this->sobrecubierta_papel_id) {
|
|
return null;
|
|
}
|
|
|
|
$papel = model(PapelGenericoModel::class)->asObject()->find($this->sobrecubierta_papel_id);
|
|
return $papel?->nombre ?? null;
|
|
}
|
|
|
|
public function getSobrecubiertaPodPapelName()
|
|
{
|
|
if (!$this->sobrecubierta_pod_papel_id) {
|
|
return null;
|
|
}
|
|
|
|
$papel = model(PapelGenericoModel::class)->asObject()->find($this->sobrecubierta_pod_papel_id);
|
|
return $papel?->nombre ?? null;
|
|
}
|
|
|
|
public function getCubiertaAcabadoName()
|
|
{
|
|
if (!$this->cubierta_acabado_id) {
|
|
return null;
|
|
}
|
|
|
|
$servicioAcabado = model(ServicioAcabadoModel::class)->asObject()->find($this->cubierta_acabado_id);
|
|
return $servicioAcabado?->nombre ?? null;
|
|
}
|
|
|
|
public function getSobrecubiertaAcabadoName()
|
|
{
|
|
if (!$this->sobrecubierta_acabado_id) {
|
|
return null;
|
|
}
|
|
|
|
$servicioAcabado = model(ServicioAcabadoModel::class)->asObject()->find($this->sobrecubierta_acabado_id);
|
|
return $servicioAcabado?->nombre ?? null;
|
|
}
|
|
}
|