From 73c52280fcdb232d6f962e8e0940231f9d1ae275 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Fali=C3=A8re?= Date: Tue, 30 Jul 2024 15:33:24 +0200 Subject: [PATCH 1/2] FIX(supplier): order and invoice subtotal lines --- ChangeLog.md | 1 + class/subtotal.class.php | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index e558260..4b83079 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file. # [Unreleased] +- FIX(supplier): order and invoice subtotal lines # Release 3.25 - 24/07/2024 diff --git a/class/subtotal.class.php b/class/subtotal.class.php index 6c0cafd..172e59e 100644 --- a/class/subtotal.class.php +++ b/class/subtotal.class.php @@ -141,7 +141,11 @@ static function addSubTotalLine(&$object, $label, $qty, $rang=-1) { /** @var FactureFournisseur $object */ $object->special_code = TSubtotal::$module_number; if( (float)DOL_VERSION < 6 ) $rang = $object->line_max() + 1; - $res = $object->addline($label,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang,false,0,null,0,0,'',TSubtotal::$module_number); + if ((int)DOL_VERSION < 17) { + $res = $object->addline($label,0,0,0,0,$qty, 0,0,'','', 0, '', 'HT', 9, $rang, false, 0, null, 0,0,'',TSubtotal::$module_number, 0,0); + } else { + $res = $object->addline($label,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang); + } } /** * @var $object Propal @@ -160,8 +164,13 @@ static function addSubTotalLine(&$object, $label, $qty, $rang=-1) { * @var $object Commande fournisseur */ else if($object->element=='order_supplier') { - $object->special_code = TSubtotal::$module_number; // à garder pour la rétrocompatibilité - $res = $object->addline($label, 0,$qty,0,0,0,0,0,'',0,'HT', 0, 9, 0, false, null, null, 0, null, 0, '', 0, -1, TSubtotal::$module_number); + /** @var CommandeFournisseur $object */ + $object->special_code = TSubtotal::$module_number; + if ((int)DOL_VERSION < 17) { + $res = $object->addline($label, 0, $qty, 0, 0, 0, 0, 0, '', 0, 'HT', 0, 9, 0, false, null, null, 0, null, 0, '', 0 ,$rang, TSubtotal::$module_number); + } else { + $res = $object->addline($label, 0,$qty,0,0,0,0,0,'',0,'HT', 0, 9); + } } /** * @var $object Facturerec From def0fa37333ea3711afbd02d5945f6550a9729c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Fali=C3=A8re?= <121813548+altairis-benjamin@users.noreply.github.com> Date: Wed, 31 Jul 2024 10:04:14 +0200 Subject: [PATCH 2/2] Update subtotal.class.php Inversed versions function calls --- class/subtotal.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/class/subtotal.class.php b/class/subtotal.class.php index 172e59e..60d9ed7 100644 --- a/class/subtotal.class.php +++ b/class/subtotal.class.php @@ -142,9 +142,9 @@ static function addSubTotalLine(&$object, $label, $qty, $rang=-1) { $object->special_code = TSubtotal::$module_number; if( (float)DOL_VERSION < 6 ) $rang = $object->line_max() + 1; if ((int)DOL_VERSION < 17) { - $res = $object->addline($label,0,0,0,0,$qty, 0,0,'','', 0, '', 'HT', 9, $rang, false, 0, null, 0,0,'',TSubtotal::$module_number, 0,0); - } else { $res = $object->addline($label,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang); + } else { + $res = $object->addline($label,0,0,0,0,$qty, 0,0,'','', 0, '', 'HT', 9, $rang, false, 0, null, 0,0,'',TSubtotal::$module_number, 0,0); } } /** @@ -167,9 +167,9 @@ static function addSubTotalLine(&$object, $label, $qty, $rang=-1) { /** @var CommandeFournisseur $object */ $object->special_code = TSubtotal::$module_number; if ((int)DOL_VERSION < 17) { - $res = $object->addline($label, 0, $qty, 0, 0, 0, 0, 0, '', 0, 'HT', 0, 9, 0, false, null, null, 0, null, 0, '', 0 ,$rang, TSubtotal::$module_number); - } else { $res = $object->addline($label, 0,$qty,0,0,0,0,0,'',0,'HT', 0, 9); + } else { + $res = $object->addline($label, 0, $qty, 0, 0, 0, 0, 0, '', 0, 'HT', 0, 9, 0, false, null, null, 0, null, 0, '', 0 ,$rang, TSubtotal::$module_number); } } /**