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();