From f98ae1593b8cc43c901c8a5f6407c082db01ffce Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Sep 2024 16:36:19 +0200 Subject: [PATCH] Clean code --- htdocs/reception/card.php | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 9d12af4e288..1dc7214db42 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -975,13 +975,11 @@ if ($action == 'create') { include_once DOL_DOCUMENT_ROOT.'/core/modules/reception/modules_reception.php'; $list = ModelePdfReception::liste_modeles($db); - if (is_array($list) || $list instanceof Countable) { - if (count($list) > 1) { - print "".$langs->trans("DefaultModel").""; - print ''; - print $form->selectarray('model', $list, $conf->global->RECEPTION_ADDON_PDF); - print "\n"; - } + if (is_countable($list) && count($list) > 1) { + print "".$langs->trans("DefaultModel").""; + print ''; + print $form->selectarray('model', $list, getDolGlobalString('RECEPTION_ADDON_PDF')); + print "\n"; } print ""; @@ -1589,7 +1587,7 @@ if ($action == 'create') { if (!empty($object->trueWeight)) { print ' ('.$langs->trans("SumOfProductWeights").': '; } - print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND) ? $conf->global->MAIN_WEIGHT_DEFAULT_ROUND : -1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT) ? $conf->global->MAIN_WEIGHT_DEFAULT_UNIT : 'no'); + print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, getDolGlobalInt('MAIN_WEIGHT_DEFAULT_ROUND', -1), getDolGlobalString('MAIN_WEIGHT_DEFAULT_UNIT', 'no')); if (!empty($object->trueWeight)) { print ')'; } @@ -1641,7 +1639,7 @@ if ($action == 'create') { // If reception volume not defined we use sum of products if ($calculatedVolume > 0) { if ($volumeUnit < 50) { - print showDimensionInBestUnit($calculatedVolume, $volumeUnit, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND) ? $conf->global->MAIN_VOLUME_DEFAULT_ROUND : -1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT) ? $conf->global->MAIN_VOLUME_DEFAULT_UNIT : 'no'); + print showDimensionInBestUnit($calculatedVolume, $volumeUnit, "volume", $langs, getDolGlobalInt('MAIN_VOLUME_DEFAULT_ROUND', -1), getDolGlobalString("MAIN_VOLUME_DEFAULT_UNIT", 'no')); } else { print $calculatedVolume.' '.measuringUnitString(0, "volume", (string) $volumeUnit); } @@ -1650,7 +1648,7 @@ if ($action == 'create') { if ($calculatedVolume) { print ' ('.$langs->trans("SumOfProductVolumes").': '; } - print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND) ? $conf->global->MAIN_VOLUME_DEFAULT_ROUND : -1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT) ? $conf->global->MAIN_VOLUME_DEFAULT_UNIT : 'no'); + print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, getDolGlobalInt('MAIN_VOLUME_DEFAULT_ROUND', -1), getDolGlobalString('MAIN_VOLUME_DEFAULT_UNIT', 'no')); //if (empty($calculatedVolume)) print ' ('.$langs->trans("Calculated").')'; if ($calculatedVolume) { print ')';