From 821e7e289403e85a83c31442a76c253a4602a526 Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Mon, 10 Aug 2020 15:39:05 +0200 Subject: [PATCH] set default unit to `PRODUCT_USE_UNITS` value --- htdocs/bom/tpl/objectline_create.tpl.php | 2 +- htdocs/core/tpl/objectline_create.tpl.php | 2 +- htdocs/product/card.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php index 8501f1ca30f..74eb88393df 100644 --- a/htdocs/bom/tpl/objectline_create.tpl.php +++ b/htdocs/bom/tpl/objectline_create.tpl.php @@ -113,7 +113,7 @@ if ($conf->global->PRODUCT_USE_UNITS) { $coldisplay++; print ''; - print $form->selectUnits($line->fk_unit, "units"); + print $form->selectUnits(empty($line->fk_unit) ? $conf->global->PRODUCT_USE_UNITS : $line->fk_unit, "units"); print ''; } diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 9bb792afbc7..821b18a3c3f 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -362,7 +362,7 @@ if ($nolinesbefore) { if (!empty($conf->global->PRODUCT_USE_UNITS)) { $coldisplay++; print ''; - print $form->selectUnits($line->fk_unit, "units"); + print $form->selectUnits( empty($line->fk_unit) ? $conf->global->PRODUCT_USE_UNITS : $line->fk_unit, "units"); print ''; } $remise_percent = $buyer->remise_percent; diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 0327456615c..32c50ccb661 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1107,7 +1107,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''.$langs->trans('DefaultUnitToShow').''; print ''; - print $form->selectUnits('', 'units'); + print $form->selectUnits(empty($line->fk_unit) ? $conf->global->PRODUCT_USE_UNITS : $line->fk_unit, 'units'); print ''; }