From d400212b9683607725a022e7f405c27ba1fb2106 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Antonio=20Cuello=20Principal?= Date: Wed, 28 May 2025 10:57:51 +0200 Subject: [PATCH 1/2] refactor to last core --- Mod/CalculatorMod.php | 3 +-- Mod/SalesFooterHTMLMod.php | 36 ++++++++++++++++++++++-------------- Mod/SalesLineHTMLMod.php | 7 ++++--- 3 files changed, 27 insertions(+), 19 deletions(-) mode change 100644 => 100755 Mod/SalesFooterHTMLMod.php diff --git a/Mod/CalculatorMod.php b/Mod/CalculatorMod.php index 7a873af..df0c888 100644 --- a/Mod/CalculatorMod.php +++ b/Mod/CalculatorMod.php @@ -19,13 +19,12 @@ namespace FacturaScripts\Plugins\Comisiones\Mod; +use FacturaScripts\Core\Base\Contract\CalculatorModInterface; use FacturaScripts\Core\Base\DataBase\DataBaseWhere; -use FacturaScripts\Core\Contract\CalculatorModInterface; use FacturaScripts\Core\Model\Base\BusinessDocument; use FacturaScripts\Core\Model\Base\BusinessDocumentLine; use FacturaScripts\Core\Model\Base\SalesDocument; use FacturaScripts\Core\Model\Base\SalesDocumentLine; -use FacturaScripts\Core\Tools; use FacturaScripts\Dinamic\Model\Comision; use FacturaScripts\Dinamic\Model\ComisionPenalizacion; diff --git a/Mod/SalesFooterHTMLMod.php b/Mod/SalesFooterHTMLMod.php old mode 100644 new mode 100755 index 8fb66d5..07579c9 --- a/Mod/SalesFooterHTMLMod.php +++ b/Mod/SalesFooterHTMLMod.php @@ -1,7 +1,7 @@ + * Copyright (C) 2022-2023 Carlos Garcia Gomez * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -19,17 +19,19 @@ namespace FacturaScripts\Plugins\Comisiones\Mod; -use FacturaScripts\Core\Contract\SalesModInterface; +use FacturaScripts\Core\Base\Contract\SalesModInterface; +use FacturaScripts\Core\Base\Translator; use FacturaScripts\Core\Model\Base\SalesDocument; +use FacturaScripts\Core\Model\User; use FacturaScripts\Core\Tools; class SalesFooterHTMLMod implements SalesModInterface { - public function apply(SalesDocument &$model, array $formData): void + public function apply(SalesDocument &$model, array $formData, User $user) { } - public function applyBefore(SalesDocument &$model, array $formData): void + public function applyBefore(SalesDocument &$model, array $formData, User $user) { } @@ -44,29 +46,35 @@ public function newBtnFields(): array public function newFields(): array { - return ['totalcomision']; + return []; } public function newModalFields(): array { - return []; + return ['totalcomision']; } - public function renderField(SalesDocument $model, string $field): ?string + public function renderField(Translator $i18n, SalesDocument $model, string $field): ?string { if ($field === 'totalcomision') { - return $this->totalcomision($model); + return $this->totalcomision($i18n, $model); } return null; } - private function totalcomision(SalesDocument $model): string + private function totalcomision(Translator $i18n, SalesDocument $model): string { - return empty($model->{'totalcomision'}) ? '' : '
' - . '
' - . Tools::lang()->trans('commission') - . '' + if (false === property_exists($model, 'totalcomision')) { + return ''; + } + + return '
' + . '
' + . $i18n->trans('commission') + . '' . '
' - . '
'; + . '
'; } } diff --git a/Mod/SalesLineHTMLMod.php b/Mod/SalesLineHTMLMod.php index 87e69c8..b4b9276 100644 --- a/Mod/SalesLineHTMLMod.php +++ b/Mod/SalesLineHTMLMod.php @@ -19,7 +19,8 @@ namespace FacturaScripts\Plugins\Comisiones\Mod; -use FacturaScripts\Core\Contract\SalesLineModInterface; +use FacturaScripts\Core\Base\Contract\SalesLineModInterface; +use FacturaScripts\Core\Base\Translator; use FacturaScripts\Core\Model\Base\SalesDocument; use FacturaScripts\Core\Model\Base\SalesDocumentLine; use FacturaScripts\Core\Tools; @@ -70,7 +71,7 @@ public function newTitles(): array return []; } - public function renderField(string $idlinea, SalesDocumentLine $line, SalesDocument $model, string $field): ?string + public function renderField(Translator $i18n, string $idlinea, SalesDocumentLine $line, SalesDocument $model, string $field): ?string { if ($field === 'porcomision') { return $this->porcomision($idlinea, $line, $model); @@ -78,7 +79,7 @@ public function renderField(string $idlinea, SalesDocumentLine $line, SalesDocum return null; } - public function renderTitle(SalesDocument $model, string $field): ?string + public function renderTitle(Translator $i18n, SalesDocument $model, string $field): ?string { return null; } From 56d83215dc9def0b4ba6be97c1852d3071d551e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Antonio=20Cuello=20Principal?= Date: Wed, 28 May 2025 11:01:56 +0200 Subject: [PATCH 2/2] update license --- Controller/EditComision.php | 2 +- Controller/EditComisionPenalizacion.php | 2 +- Controller/EditLiquidacionComision.php | 2 +- Extension/Controller/EditAgente.php | 2 +- Extension/Controller/ListAgente.php | 2 +- Extension/Model/Base/SalesDocument.php | 2 +- Extension/Model/Base/SalesDocumentLine.php | 2 +- Extension/XMLView/EditAlbaranCliente.xml | 2 +- Extension/XMLView/EditFacturaCliente.xml | 2 +- Extension/XMLView/EditPedidoCliente.xml | 2 +- Extension/XMLView/EditPresupuestoCliente.xml | 2 +- Extension/XMLView/ListAlbaranCliente.xml | 2 +- Extension/XMLView/ListFacturaCliente.xml | 2 +- Extension/XMLView/ListPedidoCliente.xml | 2 +- Extension/XMLView/ListPresupuestoCliente.xml | 2 +- Mod/CalculatorMod.php | 2 +- Mod/SalesFooterHTMLMod.php | 2 +- Mod/SalesLineHTMLMod.php | 2 +- Model/Comision.php | 2 +- Model/ComisionPenalizacion.php | 2 +- Model/Join/LiquidacionComisionFactura.php | 2 +- Model/LiquidacionComision.php | 2 +- View/Block/PenaltyInfo.html.twig | 2 +- XMLView/EditComision.xml | 2 +- XMLView/EditComisionPenalizacion.xml | 2 +- XMLView/EditLiquidacionComision.xml | 2 +- XMLView/ListComision.xml | 2 +- XMLView/ListComisionPenalizacion.xml | 2 +- XMLView/ListLiquidacionComision.xml | 2 +- XMLView/ListLiquidacionComisionFactura.xml | 2 +- 30 files changed, 30 insertions(+), 30 deletions(-) diff --git a/Controller/EditComision.php b/Controller/EditComision.php index f7183ff..e17cea2 100644 --- a/Controller/EditComision.php +++ b/Controller/EditComision.php @@ -1,7 +1,7 @@ + * Copyright (C) 2022-2025 Carlos Garcia Gomez * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as diff --git a/Controller/EditComisionPenalizacion.php b/Controller/EditComisionPenalizacion.php index f48d4d0..fe936b1 100644 --- a/Controller/EditComisionPenalizacion.php +++ b/Controller/EditComisionPenalizacion.php @@ -1,7 +1,7 @@ + * Copyright (C) 2022-2025 Carlos Garcia Gomez * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as diff --git a/Controller/EditLiquidacionComision.php b/Controller/EditLiquidacionComision.php index 668a527..227261a 100644 --- a/Controller/EditLiquidacionComision.php +++ b/Controller/EditLiquidacionComision.php @@ -1,7 +1,7 @@ + * Copyright (C) 2022-2025 Carlos Garcia Gomez * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as diff --git a/Extension/Controller/EditAgente.php b/Extension/Controller/EditAgente.php index ff334d8..24d3918 100644 --- a/Extension/Controller/EditAgente.php +++ b/Extension/Controller/EditAgente.php @@ -1,7 +1,7 @@ + * Copyright (C) 2022-2025 Carlos Garcia Gomez * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as diff --git a/Extension/Controller/ListAgente.php b/Extension/Controller/ListAgente.php index f78bba7..afa25e0 100644 --- a/Extension/Controller/ListAgente.php +++ b/Extension/Controller/ListAgente.php @@ -1,7 +1,7 @@ + * Copyright (C) 2022-2025 Carlos Garcia Gomez * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as diff --git a/Extension/Model/Base/SalesDocument.php b/Extension/Model/Base/SalesDocument.php index 4294b34..c07bbef 100644 --- a/Extension/Model/Base/SalesDocument.php +++ b/Extension/Model/Base/SalesDocument.php @@ -1,7 +1,7 @@ + * Copyright (C) 2022-2025 Carlos Garcia Gomez * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as diff --git a/Extension/Model/Base/SalesDocumentLine.php b/Extension/Model/Base/SalesDocumentLine.php index 29ff80d..4fd78a8 100644 --- a/Extension/Model/Base/SalesDocumentLine.php +++ b/Extension/Model/Base/SalesDocumentLine.php @@ -1,7 +1,7 @@ + * Copyright (C) 2022-2025 Carlos Garcia Gomez * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as diff --git a/Extension/XMLView/EditAlbaranCliente.xml b/Extension/XMLView/EditAlbaranCliente.xml index d5e6208..8a7b478 100644 --- a/Extension/XMLView/EditAlbaranCliente.xml +++ b/Extension/XMLView/EditAlbaranCliente.xml @@ -1,7 +1,7 @@