fix: add missing edit field with pakaging option on

This commit is contained in:
Florian HENRY 2020-10-12 11:10:49 +02:00
parent ff739dcbd2
commit df4b208de1
4 changed files with 26 additions and 4 deletions

View File

@ -1664,9 +1664,9 @@ class CommandeFournisseur extends CommonOrder
{
$coeff = intval($qty / $prod->packaging) + 1;
$qty = $prod->packaging * $coeff;
setEventMessage($langs->trans('QtyRecalculatedWithPackaging'), 'mesgs');
}
}
setEventMessage($langs->trans('QtyRecalculatedWithPackaging'), 'mesgs');
}
} else {
$product_type = $type;

View File

@ -272,7 +272,7 @@ class ProductFournisseur extends Product
$charges = price2num($charges, 'MU');
$qty = price2num($qty, 'MS');
$unitBuyPrice = price2num($buyprice / $qty, 'MU');
$packaging = ($this->packaging < $qty) ? $qty : $this->packaging;
$packaging = price2num((($this->packaging < $qty) ? $qty : $this->packaging), 'MS');
$error = 0;
$now = dol_now();

View File

@ -339,6 +339,7 @@ UseProductFournDesc=Add a feature to define the descriptions of products defined
ProductSupplierDescription=Vendor description for the product
UseProductSupplierPackaging=Use packaging on supplier prices (recalculate quantities according to packaging set on supplier price when adding/updating line in supplier documents)
PackagingForThisProduct=Packaging
PackagingForThisProductDesc=On supplier order, you will automaticly order this quantity (or a multiple of this quantity). Cannot be less than minimum buying quantity
QtyRecalculatedWithPackaging=The quantity of the line were recalculated according to supplier packaging
#Attributes

View File

@ -230,10 +230,9 @@ 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)
@ -529,6 +528,28 @@ if ($id > 0 || $ref)
}
print '</td></tr>';
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
// Packaging
print '<tr>';
print '<td class="fieldrequired">'.$form->textwithpicto($langs->trans("PackagingForThisProduct"), $langs->trans("PackagingForThisProductDesc")).'</td>';
print '<td>';
$packaging = GETPOSTISSET('packaging') ? price2num(GETPOST('packaging', 'nohtml'), 'MS') : "1";
if ($rowid)
{
print '<input type="hidden" name="packaging" value="'.$object->packaging.'">';
print price2num($object->packaging, 'MS');
} else {
print '<input class="flat" name="packaging" size="5" value="'.$packaging.'">';
}
// Units
if ($conf->global->PRODUCT_USE_UNITS) {
$unit = $object->getLabelOfUnit();
if ($unit !== '') {
print '&nbsp;&nbsp;'.$langs->trans($unit);
}
}
}
// Vat rate
$default_vat = '';