From c3a900a41c16c883ae1ee1dfd4e522c6117f145a Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 12 Oct 2020 11:44:12 +0200 Subject: [PATCH] need to update packaging quantity --- htdocs/product/fournisseurs.php | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index f1b8dd5e455..71ef77213f9 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -169,7 +169,7 @@ if (empty($reshook)) $supplier_description = GETPOST('supplier_description', 'alpha'); $barcode = GETPOST('barcode', 'alpha'); $fk_barcode_type = GETPOST('fk_barcode_type', 'int'); - $packaging = GETPOST('packaging', 'int'); + $packaging = price2num(GETPOST("packaging", 'nohtml'), 'MS'); if ($tva_tx == '') { @@ -230,11 +230,6 @@ if (empty($reshook)) } } - // TODO : may be remove, already done in class update_buyprice - if (empty($packaging)) $packaging = 1; - if ($packaging < $quantity) $packaging = $quantity; - $object->packaging = $packaging; - if (!$error) { $db->begin(); @@ -295,6 +290,10 @@ if (empty($reshook)) $newprice = price2num(GETPOST("price", "alpha")); + if (empty($packaging)) $packaging = 1; + if ($packaging < $quantity) $packaging = $quantity; + $object->packaging = $packaging; + if ($conf->multicurrency->enabled) { $multicurrency_tx = price2num(GETPOST("multicurrency_tx", 'alpha')); @@ -534,14 +533,9 @@ if ($id > 0 || $ref) print ''.$form->textwithpicto($langs->trans("PackagingForThisProduct"), $langs->trans("PackagingForThisProductDesc")).''; print ''; - $packaging = GETPOSTISSET('packaging') ? price2num(GETPOST('packaging', 'nohtml'), 'MS') : "1"; - if ($rowid) - { - print ''; - print price2num($object->packaging, 'MS'); - } else { - print ''; - } + $packaging = GETPOSTISSET('packaging') ? price2num(GETPOST('packaging', 'nohtml'), 'MS') : ((empty($rowid))?"1":price2num($object->packaging, 'MS')); + print ''; + // Units if ($conf->global->PRODUCT_USE_UNITS) { $unit = $object->getLabelOfUnit();