NEW: ref in product customer price: add field in forms and form handlers

This commit is contained in:
Marc de Lima Lucio 2020-10-26 12:18:24 +01:00
parent c2518e92fb
commit 496c31d63a
2 changed files with 20 additions and 0 deletions

View File

@ -499,6 +499,7 @@ if (empty($reshook))
// add price by customer
$prodcustprice->fk_soc = GETPOST('socid', 'int');
$prodcustprice->ref_customer = GETPOST('ref_customer', 'alpha');
$prodcustprice->fk_product = $object->id;
$prodcustprice->price = price2num(GETPOST("price"), 'MU');
$prodcustprice->price_min = price2num(GETPOST("price_min"), 'MU');
@ -600,6 +601,7 @@ if (empty($reshook))
$prodcustprice->fetch(GETPOST('lineid', 'int'));
// update price by customer
$prodcustprice->ref_customer = GETPOST('ref_customer', 'alpha');
$prodcustprice->price = price2num(GETPOST("price"), 'MU');
$prodcustprice->price_min = price2num(GETPOST("price_min"), 'MU');
$prodcustprice->price_base_type = GETPOST("price_base_type", 'alpha');
@ -1662,6 +1664,10 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES))
print '</td>';
print '</tr>';
// Ref. Customer
print '<tr><td>' . $langs->trans('RefCustomer') . '</td>';
print '<td><input name="ref_customer" size="12"></td></tr>';
// VAT
print '<tr><td class="fieldrequired">'.$langs->trans("DefaultTaxRate").'</td><td>';
print $form->load_tva("tva_tx", $object->default_vat_code ? $object->tva_tx.' ('.$object->default_vat_code.')' : $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr, $object->type, false, 1);
@ -1748,6 +1754,10 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES))
print "<td colspan='2'>".$staticsoc->getNomUrl(1)."</td>";
print '</tr>';
// Ref. Customer
print '<tr><td>' . $langs->trans('RefCustomer') . '</td>';
print '<td><input name="ref_customer" size="12" value="' . dol_escape_htmltag($prodcustprice->ref_customer) . '"></td></tr>';
// VAT
print '<tr><td>'.$langs->trans("DefaultTaxRate").'</td><td colspan="2">';
print $form->load_tva("tva_tx", $prodcustprice->default_vat_code ? $prodcustprice->tva_tx.' ('.$prodcustprice->default_vat_code.')' : $prodcustprice->tva_tx, $mysoc, '', $object->id, $prodcustprice->recuperableonly, $object->type, false, 1);

View File

@ -88,6 +88,7 @@ if (empty($reshook))
// add price by customer
$prodcustprice->fk_soc = $socid;
$prodcustprice->ref_customer = GETPOST('ref_customer', 'alpha');
$prodcustprice->fk_product = GETPOST('prodid', 'int');
$prodcustprice->price = price2num(GETPOST("price"), 'MU');
$prodcustprice->price_min = price2num(GETPOST("price_min"), 'MU');
@ -162,6 +163,7 @@ if (empty($reshook))
$update_child_soc = GETPOST('updatechildprice');
// update price by customer
$prodcustprice->ref_customer = GETPOST('ref_customer', 'alpha');
$prodcustprice->price = price2num(GETPOST("price"), 'MU');
$prodcustprice->price_min = price2num(GETPOST("price_min"), 'MU');
$prodcustprice->price_base_type = GETPOST("price_base_type", 'alpha');
@ -294,6 +296,10 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
print '</td>';
print '</tr>';
// Ref. Customer
print '<tr><td>' . $langs->trans('RefCustomer') . '</td>';
print '<td><input name="ref_customer" size="12"></td></tr>';
// VAT
print '<tr><td>'.$langs->trans("VATRate").'</td><td>';
print $form->load_tva("tva_tx", $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr, '', false, 1);
@ -372,6 +378,10 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
print "<td>".$staticprod->getNomUrl(1)."</td>";
print '</tr>';
// Ref. Customer
print '<tr><td>' . $langs->trans('RefCustomer') . '</td>';
print '<td><input name="ref_customer" size="12" value="' . dol_escape_htmltag($prodcustprice->ref_customer) . '"></td></tr>';
// VAT
print '<tr><td>'.$langs->trans("VATRate").'</td><td>';
print $form->load_tva("tva_tx", $prodcustprice->tva_tx, $mysoc, '', $staticprod->id, $prodcustprice->recuperableonly);