Falta testear funcionamiento completo. Edit no funciona

This commit is contained in:
Jaime Jiménez
2023-08-05 12:51:29 +02:00
parent 3e27d3fc17
commit 121b270dd0
15 changed files with 390 additions and 236 deletions

View File

@ -1,5 +1,5 @@
<?php
namespace App\Models\compras;
namespace App\Models\Compras;
class ProveedorModel extends \App\Models\GoBaseModel
{
@ -13,22 +13,9 @@ class ProveedorModel extends \App\Models\GoBaseModel
protected $useAutoIncrement = true;
const SORTABLE = [
1 => "t1.id",
2 => "t1.nombre",
3 => "t1.tipo_id",
4 => "t1.razon_social",
5 => "t1.cif",
6 => "t1.direccion",
7 => "t1.cp",
8 => "t1.ciudad",
9 => "t1.provincia_id",
10 => "t1.pais_id",
11 => "t1.persona_contacto",
12 => "t1.email",
13 => "t1.telefono",
14 => "t2.nombre",
15 => "t3.nombre",
16 => "t4.nombre",
0 => "t1.nombre",
1 => "t2.nombre",
];
protected $allowedFields = [
@ -45,7 +32,7 @@ class ProveedorModel extends \App\Models\GoBaseModel
"email",
"telefono",
];
protected $returnType = "App\Entities\compras\ProveedorEntity";
protected $returnType = "App\Entities\Compras\ProveedorEntity";
protected $useTimestamps = true;
protected $useSoftDeletes = false;
@ -58,72 +45,79 @@ class ProveedorModel extends \App\Models\GoBaseModel
protected $validationRules = [
"cif" => [
"label" => "LgProveedores.cif",
"label" => "Proveedores.cif",
"rules" => "trim|max_length[15]",
],
"tipo_id" => [
"label" => "Proveedores.tipoId",
"rules" => "required",
],
"ciudad" => [
"label" => "LgProveedores.ciudad",
"label" => "Proveedores.ciudad",
"rules" => "trim|max_length[255]",
],
"cp" => [
"label" => "LgProveedores.cp",
"label" => "Proveedores.cp",
"rules" => "trim|max_length[10]",
],
"direccion" => [
"label" => "LgProveedores.direccion",
"label" => "Proveedores.direccion",
"rules" => "trim|max_length[255]",
],
"email" => [
"label" => "LgProveedores.email",
"label" => "Proveedores.email",
"rules" => "trim|max_length[255]|valid_email|permit_empty",
],
"nombre" => [
"label" => "LgProveedores.nombre",
"label" => "Proveedores.nombre",
"rules" => "trim|required|max_length[255]",
],
"persona_contacto" => [
"label" => "LgProveedores.personaContacto",
"label" => "Proveedores.personaContacto",
"rules" => "trim|max_length[255]",
],
"razon_social" => [
"label" => "LgProveedores.razonSocial",
"label" => "Proveedores.razonSocial",
"rules" => "trim|max_length[255]",
],
"telefono" => [
"label" => "LgProveedores.telefono",
"label" => "Proveedores.telefono",
"rules" => "trim|max_length[60]",
],
];
protected $validationMessages = [
"cif" => [
"max_length" => "LgProveedores.validation.cif.max_length",
"max_length" => "Proveedores.validation.cif.max_length",
],
"ciudad" => [
"max_length" => "LgProveedores.validation.ciudad.max_length",
"max_length" => "Proveedores.validation.ciudad.max_length",
],
"cp" => [
"max_length" => "LgProveedores.validation.cp.max_length",
"max_length" => "Proveedores.validation.cp.max_length",
],
"direccion" => [
"max_length" => "LgProveedores.validation.direccion.max_length",
"max_length" => "Proveedores.validation.direccion.max_length",
],
"email" => [
"max_length" => "LgProveedores.validation.email.max_length",
"valid_email" => "LgProveedores.validation.email.valid_email",
"max_length" => "Proveedores.validation.email.max_length",
"valid_email" => "Proveedores.validation.email.valid_email",
],
"nombre" => [
"max_length" => "LgProveedores.validation.nombre.max_length",
"required" => "LgProveedores.validation.nombre.required",
"max_length" => "Proveedores.validation.nombre.max_length",
"required" => "Proveedores.validation.nombre.required",
],
"tipo_id" => [
"required" => "Proveedores.validation.tipo.required",
],
"persona_contacto" => [
"max_length" => "LgProveedores.validation.persona_contacto.max_length",
"max_length" => "Proveedores.validation.persona_contacto.max_length",
],
"razon_social" => [
"max_length" => "LgProveedores.validation.razon_social.max_length",
"max_length" => "Proveedores.validation.razon_social.max_length",
],
"telefono" => [
"max_length" => "LgProveedores.validation.telefono.max_length",
"max_length" => "Proveedores.validation.telefono.max_length",
],
];
public function findAllWithAllRelations(string $selcols = "*", int $limit = null, int $offset = 0)

View File

@ -1,5 +1,5 @@
<?php
namespace App\Models\compras;
namespace App\Models\Compras;
class ProveedorTipoModel extends \App\Models\GoBaseModel
{
@ -20,7 +20,7 @@ class ProveedorTipoModel extends \App\Models\GoBaseModel
];
protected $allowedFields = ["nombre"];
protected $returnType = "App\Entities\compras\ProveedorTipoEntity";
protected $returnType = "App\Entities\Compras\ProveedorTipoEntity";
protected $useTimestamps = true;
protected $useSoftDeletes = false;