From 992acd472e7e5a8416fc748dea3a6ffafbd858b0 Mon Sep 17 00:00:00 2001 From: Abderrahim Darghal Belkacemi Date: Wed, 22 Jul 2026 12:31:08 +0200 Subject: [PATCH 1/8] =?UTF-8?q?docs:=20ordenar=20los=20docblocks=20de=20pr?= =?UTF-8?q?opiedades=20a=20@var=20tipo=20descripci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Las descripciones de las propiedades usaban el orden /** descripción @var tipo */; se pasan al formato canónico /** @var tipo descripción */. --- Model/EstadoProyecto.php | 10 +++++----- Model/NotaProyecto.php | 12 ++++++------ Model/Proyecto.php | 30 +++++++++++++++--------------- Model/StockProyecto.php | 16 ++++++++-------- Model/TareaProyecto.php | 20 ++++++++++---------- 5 files changed, 44 insertions(+), 44 deletions(-) diff --git a/Model/EstadoProyecto.php b/Model/EstadoProyecto.php index 29fe7ab..6f5e57b 100644 --- a/Model/EstadoProyecto.php +++ b/Model/EstadoProyecto.php @@ -33,19 +33,19 @@ class EstadoProyecto extends ModelClass { use ModelTrait; - /** Color de fondo asociado al estado. @var string */ + /** @var string Color de fondo asociado al estado. */ public $color; - /** Indica si los proyectos con este estado se pueden editar. @var bool */ + /** @var bool Indica si los proyectos con este estado se pueden editar. */ public $editable; - /** Identificador del estado. @var integer */ + /** @var integer Identificador del estado. */ public $idestado; - /** Nombre del estado. @var string */ + /** @var string Nombre del estado. */ public $nombre; - /** Indica si es el estado predeterminado para nuevos proyectos. @var bool */ + /** @var bool Indica si es el estado predeterminado para nuevos proyectos. */ public $predeterminado; public function clear(): void diff --git a/Model/NotaProyecto.php b/Model/NotaProyecto.php index 5a01853..78b5024 100644 --- a/Model/NotaProyecto.php +++ b/Model/NotaProyecto.php @@ -34,22 +34,22 @@ class NotaProyecto extends ModelClass { use ModelTrait; - /** Texto de la nota. @var string */ + /** @var string Texto de la nota. */ public $descripcion; - /** Fecha de la nota. @var string */ + /** @var string Fecha de la nota. */ public $fecha; - /** Identificador de la nota. @var integer */ + /** @var integer Identificador de la nota. */ public $idnota; - /** Identificador del proyecto al que pertenece la nota. @var integer */ + /** @var integer Identificador del proyecto al que pertenece la nota. */ public $idproyecto; - /** Identificador de la tarea a la que pertenece la nota. @var integer */ + /** @var integer Identificador de la tarea a la que pertenece la nota. */ public $idtarea; - /** Nick del usuario que crea la nota. @var string */ + /** @var string Nick del usuario que crea la nota. */ public $nick; public function clear(): void diff --git a/Model/Proyecto.php b/Model/Proyecto.php index 3a17906..13c469e 100644 --- a/Model/Proyecto.php +++ b/Model/Proyecto.php @@ -39,49 +39,49 @@ class Proyecto extends ModelClass { use ModelTrait; - /** Código del cliente asociado al proyecto. @var string */ + /** @var string Código del cliente asociado al proyecto. */ public $codcliente; - /** Descripción del proyecto. @var string */ + /** @var string Descripción del proyecto. */ public $descripcion; - /** Indica si el proyecto se puede editar. @var bool */ + /** @var bool Indica si el proyecto se puede editar. */ public $editable; - /** Fecha de creación del proyecto. @var string */ + /** @var string Fecha de creación del proyecto. */ public $fecha; - /** Fecha de finalización del proyecto. @var string */ + /** @var string Fecha de finalización del proyecto. */ public $fechafin; - /** Fecha de inicio del proyecto. @var string */ + /** @var string Fecha de inicio del proyecto. */ public $fechainicio; - /** Identificador de la empresa. @var int */ + /** @var int Identificador de la empresa. */ public $idempresa; - /** Identificador del estado actual del proyecto. @var int */ + /** @var int Identificador del estado actual del proyecto. */ public $idestado; - /** Identificador del proyecto. @var int */ + /** @var int Identificador del proyecto. */ public $idproyecto; - /** Nick del usuario que crea el proyecto. @var string */ + /** @var string Nick del usuario que crea el proyecto. */ public $nick; - /** Nombre del proyecto. @var string */ + /** @var string Nombre del proyecto. */ public $nombre; - /** Indica si el proyecto es privado y solo lo pueden ver los usuarios asignados. @var bool */ + /** @var bool Indica si el proyecto es privado y solo lo pueden ver los usuarios asignados. */ public $privado; - /** Total de compras asociadas al proyecto. @var float */ + /** @var float Total de compras asociadas al proyecto. */ public $totalcompras; - /** Total pendiente de facturar del proyecto. @var float */ + /** @var float Total pendiente de facturar del proyecto. */ public $totalpendientefacturar; - /** Total de ventas asociadas al proyecto. @var float */ + /** @var float Total de ventas asociadas al proyecto. */ public $totalventas; public function clear(): void diff --git a/Model/StockProyecto.php b/Model/StockProyecto.php index d7cf3d1..27173ea 100644 --- a/Model/StockProyecto.php +++ b/Model/StockProyecto.php @@ -37,28 +37,28 @@ class StockProyecto extends ModelClass const MAX_DECIMALS = 3; - /** Cantidad total en stock para el proyecto. @var float */ + /** @var float Cantidad total en stock para el proyecto. */ public $cantidad; - /** Cantidad disponible (cantidad menos reservada). @var float */ + /** @var float Cantidad disponible (cantidad menos reservada). */ public $disponible; - /** Identificador del registro. @var int */ + /** @var int Identificador del registro. */ public $id; - /** Identificador del producto. @var int */ + /** @var int Identificador del producto. */ public $idproducto; - /** Identificador del proyecto. @var int */ + /** @var int Identificador del proyecto. */ public $idproyecto; - /** Cantidad pendiente de recibir. @var float */ + /** @var float Cantidad pendiente de recibir. */ public $pterecibir; - /** Referencia de la variante del producto. @var string */ + /** @var string Referencia de la variante del producto. */ public $referencia; - /** Cantidad reservada para el proyecto. @var float */ + /** @var float Cantidad reservada para el proyecto. */ public $reservada; public function clear(): void diff --git a/Model/TareaProyecto.php b/Model/TareaProyecto.php index 653b4f7..44673c9 100644 --- a/Model/TareaProyecto.php +++ b/Model/TareaProyecto.php @@ -40,34 +40,34 @@ class TareaProyecto extends ModelClass const TYPE_PROCESSING = 2; const TYPE_CANCELED = 1; - /** Cantidad de unidades asociadas a la tarea. @var int */ + /** @var int Cantidad de unidades asociadas a la tarea. */ public $cantidad; - /** Descripción de la tarea. @var string */ + /** @var string Descripción de la tarea. */ public $descripcion; - /** Fecha de creación de la tarea. @var string */ + /** @var string Fecha de creación de la tarea. */ public $fecha; - /** Fecha de finalización de la tarea. @var string */ + /** @var string Fecha de finalización de la tarea. */ public $fechafin; - /** Fecha de inicio de la tarea. @var string */ + /** @var string Fecha de inicio de la tarea. */ public $fechainicio; - /** Identificador de la fase en la que se encuentra la tarea. @var int */ + /** @var int Identificador de la fase en la que se encuentra la tarea. */ public $idfase; - /** Identificador del proyecto al que pertenece la tarea. @var int */ + /** @var int Identificador del proyecto al que pertenece la tarea. */ public $idproyecto; - /** Identificador de la tarea. @var int */ + /** @var int Identificador de la tarea. */ public $idtarea; - /** Nombre de la tarea. @var string */ + /** @var string Nombre de la tarea. */ public $nombre; - /** Nick del usuario asignado a la tarea. @var string */ + /** @var string Nick del usuario asignado a la tarea. */ public $nick; public function clear(): void From 2af5bace4f0dc617b889eacd9a002eebb63b4344 Mon Sep 17 00:00:00 2001 From: Abderrahim Darghal Belkacemi Date: Wed, 22 Jul 2026 12:45:02 +0200 Subject: [PATCH 2/8] =?UTF-8?q?refactor:=20usar=20loadWhereEq()=20en=20vez?= =?UTF-8?q?=20de=20loadWhere()=20con=20un=20=C3=BAnico=20Where::eq()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Simplifica las llamadas a loadWhere([Where::eq(...)]) por loadWhereEq() en Model/StockProyecto.php y Model/TareaProyecto.php. --- Model/StockProyecto.php | 4 +--- Model/TareaProyecto.php | 7 ++----- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/Model/StockProyecto.php b/Model/StockProyecto.php index 27173ea..1d01e37 100644 --- a/Model/StockProyecto.php +++ b/Model/StockProyecto.php @@ -19,7 +19,6 @@ namespace FacturaScripts\Plugins\Proyectos\Model; -use FacturaScripts\Core\Where; use FacturaScripts\Core\Template\ModelClass; use FacturaScripts\Core\Template\ModelTrait; use FacturaScripts\Core\Tools; @@ -87,8 +86,7 @@ public function deleteFromProject($idproyecto): bool public function getVariant() { $variant = new Variante(); - $where = [Where::eq('referencia', $this->referencia)]; - $variant->loadWhere($where); + $variant->loadWhereEq('referencia', $this->referencia); return $variant; } diff --git a/Model/TareaProyecto.php b/Model/TareaProyecto.php index 44673c9..bc9b947 100644 --- a/Model/TareaProyecto.php +++ b/Model/TareaProyecto.php @@ -19,7 +19,6 @@ namespace FacturaScripts\Plugins\Proyectos\Model; -use FacturaScripts\Core\Where; use FacturaScripts\Core\Template\ModelClass; use FacturaScripts\Core\Template\ModelTrait; use FacturaScripts\Core\Tools; @@ -237,8 +236,7 @@ protected function deepTaskCheck($project, $tasks): void if ($completed + $canceled === count($tasks)) { $phase = new FaseTarea(); - $where = [Where::eq('tipo', self::TYPE_COMPLETED)]; - if ($phase->loadWhere($where)) { + if ($phase->loadWhereEq('tipo', self::TYPE_COMPLETED)) { $project->idestado = $phase->idestado; $project->save(); } @@ -274,8 +272,7 @@ protected function onUpdate(): void protected function setDefaultProjectStatus(): void { $defaultStatus = new EstadoProyecto(); - $where = [Where::eq('predeterminado', true)]; - if ($defaultStatus->loadWhere($where)) { + if ($defaultStatus->loadWhereEq('predeterminado', true)) { $project = $this->getProject(); $project->idestado = $defaultStatus->idestado; $project->save(); From 66a3f73ffdcd245570c81c4f882982f4176c2111 Mon Sep 17 00:00:00 2001 From: Abderrahim Darghal Belkacemi Date: Wed, 22 Jul 2026 12:46:41 +0200 Subject: [PATCH 3/8] =?UTF-8?q?refactor:=20usar=20load()=20en=20vez=20de?= =?UTF-8?q?=20loadFromCode()=20para=20cargar=20por=20c=C3=B3digo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Simplifica las llamadas a loadFromCode($id) por load($id) en Extension/Controller/NewServicioAT.php. --- Extension/Controller/NewServicioAT.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Extension/Controller/NewServicioAT.php b/Extension/Controller/NewServicioAT.php index acb2671..25066cf 100644 --- a/Extension/Controller/NewServicioAT.php +++ b/Extension/Controller/NewServicioAT.php @@ -35,7 +35,7 @@ public function load(): Closure // buscamos el proyecto $project = new Proyecto(); $id = $this->request->get('idproyecto'); - if (false === $project->loadFromCode($id)) { + if (false === $project->load($id)) { Tools::log()->warning('project-not-found', [ 'project' => $id ]); @@ -57,7 +57,7 @@ public function saveNewService(): Closure // buscamos el proyecto $project = new Proyecto(); $id = $this->request->get('idproyecto'); - if (false === $project->loadFromCode($id)) { + if (false === $project->load($id)) { Tools::log()->warning('project-not-found', [ 'project' => $id ]); From cdeb5843caf72facd82bb4a943139061fe0422b8 Mon Sep 17 00:00:00 2001 From: Abderrahim Darghal Belkacemi Date: Thu, 23 Jul 2026 09:27:44 +0200 Subject: [PATCH 4/8] refactor: usar mainTabName() y tabModelValue() en vez de getMainViewName() y getViewModelValue() Sustituye las llamadas deprecadas getMainViewName() y getViewModelValue() por sus reemplazos mainTabName() y tabModelValue() en Controller/EditNotaProyecto.php, Controller/EditProyecto.php, Controller/EditTareaProyecto.php, Extension/Controller/EditCliente.php y Extension/Controller/EditProducto.php. --- Controller/EditNotaProyecto.php | 2 +- Controller/EditProyecto.php | 8 ++++---- Controller/EditTareaProyecto.php | 10 +++++----- Extension/Controller/EditCliente.php | 2 +- Extension/Controller/EditProducto.php | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Controller/EditNotaProyecto.php b/Controller/EditNotaProyecto.php index febf6a3..0e5e4ec 100644 --- a/Controller/EditNotaProyecto.php +++ b/Controller/EditNotaProyecto.php @@ -53,7 +53,7 @@ public function getPageData(): array protected function loadData($viewName, $view) { switch ($viewName) { - case $this->getMainViewName(): + case $this->mainTabName(): parent::loadData($viewName, $view); if (false === $view->model->getProject()->userCanSee($this->user)) { $this->setTemplate('Error/AccessDenied'); diff --git a/Controller/EditProyecto.php b/Controller/EditProyecto.php index 365a102..dd3f558 100644 --- a/Controller/EditProyecto.php +++ b/Controller/EditProyecto.php @@ -217,7 +217,7 @@ protected function createViews() // disable company column if there is only one company if ($this->empresa->count() < 2) { - $this->views[$this->getMainViewName()]->disableColumn('company'); + $this->views[$this->mainTabName()]->disableColumn('company'); } $this->createViewsTasks(); @@ -779,8 +779,8 @@ protected function linkUpAction(string $modelName): bool */ protected function loadData($viewName, $view) { - $mainViewName = $this->getMainViewName(); - $idproyecto = $this->getViewModelValue($mainViewName, 'idproyecto'); + $mainViewName = $this->mainTabName(); + $idproyecto = $this->tabModelValue($mainViewName, 'idproyecto'); switch ($viewName) { case $mainViewName: @@ -825,7 +825,7 @@ protected function loadData($viewName, $view) // añadimos el botón de nuevo documento, no para asientos if ($viewName !== 'ListAsiento') { - $codcliente = $this->getViewModelValue($mainViewName, 'codcliente'); + $codcliente = $this->tabModelValue($mainViewName, 'codcliente'); $url = $view->model->url('edit') . '?idproyecto=' . $idproyecto; if (false === empty($codcliente) && in_array($view->model->modelClassName(), ['PresupuestoCliente', 'PedidoCliente', 'AlbaranCliente', 'FacturaCliente'])) { diff --git a/Controller/EditTareaProyecto.php b/Controller/EditTareaProyecto.php index ab4555d..1365e6a 100644 --- a/Controller/EditTareaProyecto.php +++ b/Controller/EditTareaProyecto.php @@ -63,7 +63,7 @@ protected function createViews() ? $this->getModel()->idproyecto : $this->request->get('idproyecto', ''); - $this->addButton($this->getMainViewName(), [ + $this->addButton($this->mainTabName(), [ 'type' => 'link', 'action' => 'KanbanProyectos?idproyecto=' . $idproyecto, 'icon' => 'fa-brands fa-trello', @@ -127,7 +127,7 @@ protected function execPreviousAction($action) */ protected function loadData($viewName, $view) { - $mainViewName = $this->getMainViewName(); + $mainViewName = $this->mainTabName(); switch ($viewName) { case $mainViewName: parent::loadData($viewName, $view); @@ -146,15 +146,15 @@ protected function loadData($viewName, $view) break; case 'EditNotaProyecto': - $where = [Where::eq('idtarea', $this->getViewModelValue($mainViewName, 'idtarea'))]; + $where = [Where::eq('idtarea', $this->tabModelValue($mainViewName, 'idtarea'))]; $view->loadData('', $where, ['fecha' => 'DESC']); if (false === $view->model->exists()) { - $view->model->idproyecto = $this->getViewModelValue($mainViewName, 'idproyecto'); + $view->model->idproyecto = $this->tabModelValue($mainViewName, 'idproyecto'); } break; case 'docfiles': - $this->loadDataDocFiles($view, $this->getModelClassName(), $this->getViewModelValue($mainViewName, 'idtarea')); + $this->loadDataDocFiles($view, $this->getModelClassName(), $this->tabModelValue($mainViewName, 'idtarea')); break; } } diff --git a/Extension/Controller/EditCliente.php b/Extension/Controller/EditCliente.php index e716bcf..c085ba6 100644 --- a/Extension/Controller/EditCliente.php +++ b/Extension/Controller/EditCliente.php @@ -50,7 +50,7 @@ public function loadData(): Closure { return function ($viewName, $view) { if ($viewName === 'ListProyecto') { - $codcliente = $this->getViewModelValue($this->getMainViewName(), 'codcliente'); + $codcliente = $this->tabModelValue($this->mainTabName(), 'codcliente'); $where = [Where::eq('codcliente', $codcliente)]; $view->loadData('', $where); } diff --git a/Extension/Controller/EditProducto.php b/Extension/Controller/EditProducto.php index e4a6138..150e071 100644 --- a/Extension/Controller/EditProducto.php +++ b/Extension/Controller/EditProducto.php @@ -52,7 +52,7 @@ public function loadData(): Closure { return function ($viewName, $view) { if ($viewName === 'ListStockProyecto') { - $idproducto = $this->getViewModelValue($this->getMainViewName(), 'idproducto'); + $idproducto = $this->tabModelValue($this->mainTabName(), 'idproducto'); $where = [Where::eq('idproducto', $idproducto)]; $view->loadData('', $where); } From b8b0f5fd9bd9d23823c315597a90cba03fdb8109 Mon Sep 17 00:00:00 2001 From: Abderrahim Darghal Belkacemi Date: Thu, 23 Jul 2026 09:36:17 +0200 Subject: [PATCH 5/8] refactor: usar queryOrInput() en vez de get() en las peticiones Sustituye las llamadas deprecadas $this->request->get() por $this->request->queryOrInput() en Controller/EditProyecto.php, Controller/EditTareaProyecto.php, Extension/Controller/NewServicioAT.php y Extension/Traits/ProjectControllerSalesPurchases.php. --- Controller/EditProyecto.php | 10 +++++----- Controller/EditTareaProyecto.php | 4 ++-- Extension/Controller/NewServicioAT.php | 8 ++++---- Extension/Traits/ProjectControllerSalesPurchases.php | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Controller/EditProyecto.php b/Controller/EditProyecto.php index dd3f558..a055d15 100644 --- a/Controller/EditProyecto.php +++ b/Controller/EditProyecto.php @@ -567,7 +567,7 @@ protected function createViewsTasks(string $viewName = 'ListTareaProyecto'): voi $this->addButton($viewName, [ 'type' => 'link', - 'action' => 'KanbanProyectos?idproyecto=' . $this->request->get('code', ''), + 'action' => 'KanbanProyectos?idproyecto=' . $this->request->queryOrInput('code', ''), 'icon' => 'fa-brands fa-trello', 'label' => 'kanban', 'color' => 'info', @@ -694,13 +694,13 @@ protected function importTaskAction(): bool // cargamos el proyecto actual $origProject = new Proyecto(); - if (false === $origProject->load($this->request->get('code', ''))) { + if (false === $origProject->load($this->request->queryOrInput('code', ''))) { return true; } // obtenemos el ID del proyecto a copiar $copyProject = new Proyecto(); - if (false === $copyProject->load($this->request->get('idproyecto', '')) || + if (false === $copyProject->load($this->request->queryOrInput('idproyecto', '')) || $origProject->idproyecto === $copyProject->idproyecto) { return true; } @@ -757,7 +757,7 @@ protected function linkUpAction(string $modelName): bool $modelTable = $model->tableName(); $modelKey = $model->primaryColumn(); $code = $this->request->request->get('linkupcode', ''); - $idproyecto = $this->request->get('code', ''); + $idproyecto = $this->request->queryOrInput('code', ''); $sql = "UPDATE $modelTable SET idproyecto = " . $this->dataBase->var2str($idproyecto) . " WHERE " . $this->dataBase->escapeColumn($modelKey) . " = " . $this->dataBase->var2str($code) . ';'; @@ -889,7 +889,7 @@ protected function unlinkUpAction(string $modelName): bool // obtenemos el proyecto $project = $this->getModel(); - if (false === $project->load($this->request->get('code', ''))) { + if (false === $project->load($this->request->queryOrInput('code', ''))) { return true; } diff --git a/Controller/EditTareaProyecto.php b/Controller/EditTareaProyecto.php index 1365e6a..0931aad 100644 --- a/Controller/EditTareaProyecto.php +++ b/Controller/EditTareaProyecto.php @@ -59,9 +59,9 @@ protected function createViews() $this->createViewsNotes(); $this->createViewDocFiles(); - $idproyecto = $this->request->get('code', '') + $idproyecto = $this->request->queryOrInput('code', '') ? $this->getModel()->idproyecto - : $this->request->get('idproyecto', ''); + : $this->request->queryOrInput('idproyecto', ''); $this->addButton($this->mainTabName(), [ 'type' => 'link', diff --git a/Extension/Controller/NewServicioAT.php b/Extension/Controller/NewServicioAT.php index 25066cf..684838b 100644 --- a/Extension/Controller/NewServicioAT.php +++ b/Extension/Controller/NewServicioAT.php @@ -28,13 +28,13 @@ class NewServicioAT public function load(): Closure { return function () { - if (empty($this->request->get('idproyecto')) || !empty($this->codcliente)) { + if (empty($this->request->queryOrInput('idproyecto')) || !empty($this->codcliente)) { return; } // buscamos el proyecto $project = new Proyecto(); - $id = $this->request->get('idproyecto'); + $id = $this->request->queryOrInput('idproyecto'); if (false === $project->load($id)) { Tools::log()->warning('project-not-found', [ 'project' => $id @@ -50,13 +50,13 @@ public function load(): Closure public function saveNewService(): Closure { return function ($service) { - if (empty($this->request->get('idproyecto'))) { + if (empty($this->request->queryOrInput('idproyecto'))) { return; } // buscamos el proyecto $project = new Proyecto(); - $id = $this->request->get('idproyecto'); + $id = $this->request->queryOrInput('idproyecto'); if (false === $project->load($id)) { Tools::log()->warning('project-not-found', [ 'project' => $id diff --git a/Extension/Traits/ProjectControllerSalesPurchases.php b/Extension/Traits/ProjectControllerSalesPurchases.php index c210df8..fd01b48 100644 --- a/Extension/Traits/ProjectControllerSalesPurchases.php +++ b/Extension/Traits/ProjectControllerSalesPurchases.php @@ -50,7 +50,7 @@ public function execPreviousAction(): Closure return function ($action) { if ($action === 'autocomplete-project') { $this->setTemplate(false); - $query = (string)$this->request->get('term', ''); + $query = (string)$this->request->queryOrInput('term', ''); $this->response->setContent(json_encode($this->autocompleteProjectAction($query))); return false; } From cd60aa8778118a85cfc5d0a2ab562d7bb5fc1a2f Mon Sep 17 00:00:00 2001 From: Abderrahim Darghal Belkacemi Date: Thu, 23 Jul 2026 09:40:27 +0200 Subject: [PATCH 6/8] refactor: usar tab() y listView() en vez de acceder a $this->views[] Sustituye el acceso directo $this->views[$viewName] por tab($viewName) para la vista principal o listView($viewName) para vistas de lista en Controller/ListProyecto.php, Controller/EditNotaProyecto.php, Controller/EditProyecto.php y Controller/EditTareaProyecto.php. --- Controller/EditNotaProyecto.php | 2 +- Controller/EditProyecto.php | 36 ++++++++++++++++---------------- Controller/EditTareaProyecto.php | 2 +- Controller/ListProyecto.php | 2 +- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Controller/EditNotaProyecto.php b/Controller/EditNotaProyecto.php index 0e5e4ec..e237e54 100644 --- a/Controller/EditNotaProyecto.php +++ b/Controller/EditNotaProyecto.php @@ -60,7 +60,7 @@ protected function loadData($viewName, $view) } if (empty($view->model->idtarea)) { - $this->views[$viewName]->disableColumn('task'); + $this->tab($viewName)->disableColumn('task'); } break; } diff --git a/Controller/EditProyecto.php b/Controller/EditProyecto.php index a055d15..6391c3f 100644 --- a/Controller/EditProyecto.php +++ b/Controller/EditProyecto.php @@ -217,7 +217,7 @@ protected function createViews() // disable company column if there is only one company if ($this->empresa->count() < 2) { - $this->views[$this->mainTabName()]->disableColumn('company'); + $this->tab($this->mainTabName())->disableColumn('company'); } $this->createViewsTasks(); @@ -436,7 +436,7 @@ protected function createViewsNotes(string $viewName = 'ListNotaProyecto'): void ->addSearchFields(['descripcion']); $status = $this->codeModel->all('tareas', 'idtarea', 'nombre'); - $this->views[$viewName]->addFilterSelect('idtarea', 'task', 'idtarea', $status); + $this->listView($viewName)->addFilterSelect('idtarea', 'task', 'idtarea', $status); } protected function createViewsServices(string $viewName = 'ListServicioAT'): void @@ -453,22 +453,22 @@ protected function createViewsServices(string $viewName = 'ListServicioAT'): voi ->addSearchFields(['descripcion', 'idservicio', 'material', 'observaciones', 'solucion']); // filters - $this->views[$viewName]->addFilterPeriod('fecha', 'date', 'fecha') + $this->listView($viewName)->addFilterPeriod('fecha', 'date', 'fecha') ->addFilterAutocomplete('codcliente', 'customer', 'codcliente', 'clientes', 'codcliente', 'nombre'); $priority = $this->codeModel->all('serviciosat_prioridades', 'id', 'nombre'); - $this->views[$viewName]->addFilterSelect('idprioridad', 'priority', 'idprioridad', $priority); + $this->listView($viewName)->addFilterSelect('idprioridad', 'priority', 'idprioridad', $priority); $status = $this->codeModel->all('serviciosat_estados', 'id', 'nombre'); - $this->views[$viewName]->addFilterSelect('idestado', 'status', 'idestado', $status); + $this->listView($viewName)->addFilterSelect('idestado', 'status', 'idestado', $status); $users = $this->codeModel->all('users', 'nick', 'nick'); - $this->views[$viewName]->addFilterSelect('nick', 'user', 'nick', $users); + $this->listView($viewName)->addFilterSelect('nick', 'user', 'nick', $users); $agents = $this->codeModel->all('agentes', 'codagente', 'nombre'); - $this->views[$viewName]->addFilterSelect('codagente', 'agent', 'codagente', $agents); + $this->listView($viewName)->addFilterSelect('codagente', 'agent', 'codagente', $agents); - $this->views[$viewName]->addFilterNumber('netogt', 'net', 'neto', '>=') + $this->listView($viewName)->addFilterNumber('netogt', 'net', 'neto', '>=') ->addFilterNumber('netolt', 'net', 'neto', '<='); // asignamos colores @@ -478,7 +478,7 @@ protected function createViewsServices(string $viewName = 'ListServicioAT'): voi continue; } - $this->views[$viewName]->getRow('status')->options[] = [ + $this->listView($viewName)->getRow('status')->options[] = [ 'tag' => 'option', 'children' => [], 'color' => $estado->color, @@ -507,13 +507,13 @@ protected function createViewsStock(string $viewName = 'ListStockProyecto'): voi ->addOrderBy(['pterecibir'], 'pending-reception'); // filters - $this->views[$viewName]->addFilterNumber('cantidad', 'quantity', 'cantidad') + $this->listView($viewName)->addFilterNumber('cantidad', 'quantity', 'cantidad') ->addFilterNumber('reservada', 'reserved', 'reservada') ->addFilterNumber('pterecibir', 'pending-reception', 'pterecibir') ->addFilterNumber('disponible', 'available', 'disponible'); // disable column - $this->views[$viewName]->disableColumn('project'); + $this->listView($viewName)->disableColumn('project'); // disable buttons $this->setSettings($viewName, 'btnDelete', false); @@ -542,21 +542,21 @@ protected function createViewsTasks(string $viewName = 'ListTareaProyecto'): voi ->addSearchFields(['descripcion', 'nombre']); // filters - $this->views[$viewName]->addFilterPeriod('fecha', 'start-date', 'fecha'); - $this->views[$viewName]->addFilterPeriod('fechafin', 'end-date', 'fechafin'); + $this->listView($viewName)->addFilterPeriod('fecha', 'start-date', 'fecha'); + $this->listView($viewName)->addFilterPeriod('fechafin', 'end-date', 'fechafin'); $status = $this->codeModel->all('tareas_fases', 'idfase', 'nombre'); - $this->views[$viewName]->addFilterSelect('idfase', 'phase', 'idfase', $status); + $this->listView($viewName)->addFilterSelect('idfase', 'phase', 'idfase', $status); // filtro por usuario asignado $users = $this->codeModel->all('users', 'nick', 'nick'); if (count($users) > 1) { - $this->views[$viewName]->addFilterSelect('nick', 'user', 'nick', $users); + $this->listView($viewName)->addFilterSelect('nick', 'user', 'nick', $users); } // disable columns - $this->views[$viewName]->disableColumn('project'); - $this->views[$viewName]->disableColumn('company'); + $this->listView($viewName)->disableColumn('project'); + $this->listView($viewName)->disableColumn('company'); $this->addButton($viewName, [ 'type' => 'modal', @@ -579,7 +579,7 @@ protected function createViewsUsers(string $viewName = 'EditUserProyecto'): void $this->addEditListView($viewName, 'UserProyecto', 'users', 'fa-solid fa-users'); // disable column - $this->views[$viewName]->disableColumn('project'); + $this->tab($viewName)->disableColumn('project'); } /** diff --git a/Controller/EditTareaProyecto.php b/Controller/EditTareaProyecto.php index 0931aad..fd2cc23 100644 --- a/Controller/EditTareaProyecto.php +++ b/Controller/EditTareaProyecto.php @@ -135,7 +135,7 @@ protected function loadData($viewName, $view) $this->setTemplate('Error/AccessDenied'); } elseif (false === $view->model->getProject()->editable) { $this->disableTaskColumns($view); - $this->views['EditTareaProyecto']->disableColumn('code'); + $this->tab('EditTareaProyecto')->disableColumn('code'); } // Si el modelo no existe, desactivamos la pestaña de archivos diff --git a/Controller/ListProyecto.php b/Controller/ListProyecto.php index 756da2a..8d3f152 100644 --- a/Controller/ListProyecto.php +++ b/Controller/ListProyecto.php @@ -138,7 +138,7 @@ protected function setProjectColors(string $viewName): void continue; } - $this->views[$viewName]->getRow('status')->options[] = [ + $this->listView($viewName)->getRow('status')->options[] = [ 'tag' => 'option', 'children' => [], 'color' => $estado->color, From a1387feaaadd6107a588a72eb5d7bbc4074be0bc Mon Sep 17 00:00:00 2001 From: Abderrahim Darghal Belkacemi Date: Thu, 23 Jul 2026 09:42:01 +0200 Subject: [PATCH 7/8] refactor: usar tab($viewName)->addButton() en vez de addButton($viewName, ...) Sustituye las llamadas deprecadas addButton($viewName, $btnArray) por tab($viewName)->addButton($btnArray) en Controller/EditProyecto.php y Controller/EditTareaProyecto.php. --- Controller/EditProyecto.php | 12 ++++++------ Controller/EditTareaProyecto.php | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Controller/EditProyecto.php b/Controller/EditProyecto.php index 6391c3f..0fed75a 100644 --- a/Controller/EditProyecto.php +++ b/Controller/EditProyecto.php @@ -83,7 +83,7 @@ protected function addCommonSalesPurchases(string $viewName, string $modelName): $this->listView($viewName)->disableColumn('project'); // añadimos botón para enlazar documentos - $this->addButton($viewName, [ + $this->tab($viewName)->addButton([ 'type' => 'modal', 'action' => 'link-up-' . $modelName, 'icon' => 'fa-solid fa-link', @@ -521,7 +521,7 @@ protected function createViewsStock(string $viewName = 'ListStockProyecto'): voi $this->setSettings($viewName, 'checkBoxes', false); if ($this->user->admin) { - $this->addButton($viewName, [ + $this->tab($viewName)->addButton([ 'action' => 'rebuild-stock', 'color' => 'warning', 'confirm' => true, @@ -558,14 +558,14 @@ protected function createViewsTasks(string $viewName = 'ListTareaProyecto'): voi $this->listView($viewName)->disableColumn('project'); $this->listView($viewName)->disableColumn('company'); - $this->addButton($viewName, [ + $this->tab($viewName)->addButton([ 'type' => 'modal', 'action' => 'import-task', 'icon' => 'fa-solid fa-file-import', 'label' => 'import' ]); - $this->addButton($viewName, [ + $this->tab($viewName)->addButton([ 'type' => 'link', 'action' => 'KanbanProyectos?idproyecto=' . $this->request->queryOrInput('code', ''), 'icon' => 'fa-brands fa-trello', @@ -831,7 +831,7 @@ protected function loadData($viewName, $view) && in_array($view->model->modelClassName(), ['PresupuestoCliente', 'PedidoCliente', 'AlbaranCliente', 'FacturaCliente'])) { $url .= '&codcliente=' . $codcliente; } - $this->addButton($viewName, [ + $this->tab($viewName)->addButton([ 'type' => 'link', 'action' => $url, 'color' => 'success', @@ -841,7 +841,7 @@ protected function loadData($viewName, $view) // si hay documentos añadimos el botón de desvincular if ($view->count > 0) { - $this->addButton($viewName, [ + $this->tab($viewName)->addButton([ 'type' => 'action', 'action' => 'unlink-up-' . $view->model->modelClassName(), 'color' => 'warning', diff --git a/Controller/EditTareaProyecto.php b/Controller/EditTareaProyecto.php index fd2cc23..6eb8e3f 100644 --- a/Controller/EditTareaProyecto.php +++ b/Controller/EditTareaProyecto.php @@ -63,7 +63,7 @@ protected function createViews() ? $this->getModel()->idproyecto : $this->request->queryOrInput('idproyecto', ''); - $this->addButton($this->mainTabName(), [ + $this->tab($this->mainTabName())->addButton([ 'type' => 'link', 'action' => 'KanbanProyectos?idproyecto=' . $idproyecto, 'icon' => 'fa-brands fa-trello', From b243879ac020ceef5569f4665150297e19980402 Mon Sep 17 00:00:00 2001 From: Abderrahim Darghal Belkacemi Date: Thu, 23 Jul 2026 09:42:10 +0200 Subject: [PATCH 8/8] refactor: usar id() en vez de primaryColumnValue() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sustituye la llamada deprecada primaryColumnValue() por el nuevo método simplificado id() en Controller/EditProyecto.php. --- Controller/EditProyecto.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Controller/EditProyecto.php b/Controller/EditProyecto.php index 0fed75a..ab72446 100644 --- a/Controller/EditProyecto.php +++ b/Controller/EditProyecto.php @@ -799,7 +799,7 @@ protected function loadData($viewName, $view) break; case 'docfiles': - $this->loadDataDocFiles($view, $this->getModelClassName(), $this->getModel()->primaryColumnValue()); + $this->loadDataDocFiles($view, $this->getModelClassName(), $this->getModel()->id()); break; case 'EditUserProyecto':