From fc2a834e41526db0f9d335e76ec0a25d86968a6b Mon Sep 17 00:00:00 2001 From: Nicolas Leichtle Date: Sat, 21 Oct 2017 23:54:49 +0200 Subject: [PATCH 1/4] New Add product unit fields for ODT substitution --- htdocs/core/class/commondocgenerator.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 937634de5d4..e544a2ccb16 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -509,6 +509,10 @@ abstract class CommonDocGenerator 'line_multicurrency_total_ht_locale' => price($line->multicurrency_total_ht, 0, $outputlangs), 'line_multicurrency_total_tva_locale' => price($line->multicurrency_total_tva, 0, $outputlangs), 'line_multicurrency_total_ttc_locale' => price($line->multicurrency_total_ttc, 0, $outputlangs), + + // Units + 'line_unit'=>$line->getLabelOfUnit('long'), + 'line_unit_short'=>$line->getLabelOfUnit('short'), ); // Retrieve extrafields From b9c0ea36914f761049f51dbd7c38700eec7485d9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 22 Oct 2017 04:07:54 +0200 Subject: [PATCH 2/4] Update commondocgenerator.class.php --- htdocs/core/class/commondocgenerator.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index e544a2ccb16..972275059bb 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -511,8 +511,8 @@ abstract class CommonDocGenerator 'line_multicurrency_total_ttc_locale' => price($line->multicurrency_total_ttc, 0, $outputlangs), // Units - 'line_unit'=>$line->getLabelOfUnit('long'), - 'line_unit_short'=>$line->getLabelOfUnit('short'), + 'line_unit'=>$outputlangs->trans($line->getLabelOfUnit('long')), + 'line_unit_short'=>$outputlangs->trans($line->getLabelOfUnit('short')), ); // Retrieve extrafields From 764e215ca109674acf01f7adc3c347dbd4c99dd3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 22 Oct 2017 04:12:46 +0200 Subject: [PATCH 3/4] Update commondocgenerator.class.php --- htdocs/core/class/commondocgenerator.class.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 972275059bb..0a78897adcc 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -509,11 +509,14 @@ abstract class CommonDocGenerator 'line_multicurrency_total_ht_locale' => price($line->multicurrency_total_ht, 0, $outputlangs), 'line_multicurrency_total_tva_locale' => price($line->multicurrency_total_tva, 0, $outputlangs), 'line_multicurrency_total_ttc_locale' => price($line->multicurrency_total_ttc, 0, $outputlangs), - - // Units - 'line_unit'=>$outputlangs->trans($line->getLabelOfUnit('long')), - 'line_unit_short'=>$outputlangs->trans($line->getLabelOfUnit('short')), ); + + // Units + if ($conf->global->PRODUCT_USE_UNITS) + { + $resarray['line_unit']=$outputlangs->trans($line->getLabelOfUnit('long')), + $resarray['line_unit_short']=$outputlangs->trans($line->getLabelOfUnit('short')) + } // Retrieve extrafields $extrafieldkey=$line->element; From ba2dd953b42ea349c5ac65fb0a774bbf365f6173 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 22 Oct 2017 04:13:49 +0200 Subject: [PATCH 4/4] Update commondocgenerator.class.php --- htdocs/core/class/commondocgenerator.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 0a78897adcc..666011b3f4a 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -514,8 +514,8 @@ abstract class CommonDocGenerator // Units if ($conf->global->PRODUCT_USE_UNITS) { - $resarray['line_unit']=$outputlangs->trans($line->getLabelOfUnit('long')), - $resarray['line_unit_short']=$outputlangs->trans($line->getLabelOfUnit('short')) + $resarray['line_unit']=$outputlangs->trans($line->getLabelOfUnit('long')); + $resarray['line_unit_short']=$outputlangs->trans($line->getLabelOfUnit('short')); } // Retrieve extrafields