mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-05 17:18:13 +01:00
FIX Duplicate select2 when we split a supplier order receipt item
This commit is contained in:
@@ -2517,7 +2517,8 @@ elseif (! empty($object->id))
|
|||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
//print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Receive").'</td></tr>';
|
//print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Receive").'</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("DeliveryDate").'</td><td>';
|
print '<tr><td>'.$langs->trans("DeliveryDate").'</td><td>';
|
||||||
print $form->select_date('','',1,1,'',"commande",1,1,1);
|
$datepreselected = dol_now();
|
||||||
|
print $form->select_date($datepreselected,'',1,1,'',"commande",1,1,1);
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
|
|
||||||
print "<tr><td class=\"fieldrequired\">".$langs->trans("Delivery")."</td><td>\n";
|
print "<tr><td class=\"fieldrequired\">".$langs->trans("Delivery")."</td><td>\n";
|
||||||
|
|||||||
@@ -626,11 +626,11 @@ if ($id > 0 || ! empty($ref)) {
|
|||||||
print '<td>';
|
print '<td>';
|
||||||
print '<input type="text" class="inputlotnumber" id="lot_number' . $suffix . '" name="lot_number' . $suffix . '" size="40" value="' . GETPOST('lot_number' . $suffix) . '">';
|
print '<input type="text" class="inputlotnumber" id="lot_number' . $suffix . '" name="lot_number' . $suffix . '" size="40" value="' . GETPOST('lot_number' . $suffix) . '">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td class="nowraponall">';
|
||||||
$dlcdatesuffix = dol_mktime(0, 0, 0, GETPOST('dlc' . $suffix . 'month'), GETPOST('dlc' . $suffix . 'day'), GETPOST('dlc' . $suffix . 'year'));
|
$dlcdatesuffix = dol_mktime(0, 0, 0, GETPOST('dlc' . $suffix . 'month'), GETPOST('dlc' . $suffix . 'day'), GETPOST('dlc' . $suffix . 'year'));
|
||||||
$form->select_date($dlcdatesuffix, 'dlc' . $suffix, '', '', 1, "");
|
$form->select_date($dlcdatesuffix, 'dlc' . $suffix, '', '', 1, "");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td class="nowraponall">';
|
||||||
$dluodatesuffix = dol_mktime(0, 0, 0, GETPOST('dluo' . $suffix . 'month'), GETPOST('dluo' . $suffix . 'day'), GETPOST('dluo' . $suffix . 'year'));
|
$dluodatesuffix = dol_mktime(0, 0, 0, GETPOST('dluo' . $suffix . 'month'), GETPOST('dluo' . $suffix . 'day'), GETPOST('dluo' . $suffix . 'year'));
|
||||||
$form->select_date($dluodatesuffix, 'dluo' . $suffix, '', '', 1, "");
|
$form->select_date($dluodatesuffix, 'dluo' . $suffix, '', '', 1, "");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@@ -685,9 +685,9 @@ if ($id > 0 || ! empty($ref)) {
|
|||||||
// Warehouse
|
// Warehouse
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
if (count($listwarehouses) > 1) {
|
if (count($listwarehouses) > 1) {
|
||||||
print $formproduct->selectWarehouses(GETPOST("entrepot" . $suffix)?GETPOST("entrepot" . $suffix):($objp->fk_default_warehouse?$objp->fk_default_warehouse:''), "entrepot" . $suffix, '', 1, 0, $objp->fk_product, '', 1);
|
print $formproduct->selectWarehouses(GETPOST("entrepot" . $suffix)?GETPOST("entrepot" . $suffix):($objp->fk_default_warehouse?$objp->fk_default_warehouse:''), "entrepot" . $suffix, '', 1, 0, $objp->fk_product, '', 1, 0, null, 'csswarehouse'.$suffix);
|
||||||
} elseif (count($listwarehouses) == 1) {
|
} elseif (count($listwarehouses) == 1) {
|
||||||
print $formproduct->selectWarehouses(GETPOST("entrepot" . $suffix)?GETPOST("entrepot" . $suffix):($objp->fk_default_warehouse?$objp->fk_default_warehouse:''), "entrepot" . $suffix, '', 0, 0, $objp->fk_product, '', 1);
|
print $formproduct->selectWarehouses(GETPOST("entrepot" . $suffix)?GETPOST("entrepot" . $suffix):($objp->fk_default_warehouse?$objp->fk_default_warehouse:''), "entrepot" . $suffix, '', 0, 0, $objp->fk_product, '', 1, 0, null, 'csswarehouse'.$suffix);
|
||||||
} else {
|
} else {
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
print $langs->trans("ErrorNoWarehouseDefined");
|
print $langs->trans("ErrorNoWarehouseDefined");
|
||||||
@@ -852,7 +852,7 @@ if ($id > 0 || ! empty($ref)) {
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// date
|
// date
|
||||||
print '<td>' . dol_print_date($objp->datec) . '</td>';
|
print '<td>' . dol_print_date($objp->datec, "dayhour") . '</td>';
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ function addDispatchLine(index, type, mode)
|
|||||||
{
|
{
|
||||||
mode = mode || 'qtymissing'
|
mode = mode || 'qtymissing'
|
||||||
|
|
||||||
console.log("Split line type="+type+" index="+index+" mode="+mode);
|
console.log("fourn/js/lib_dispatch.js Split line type="+type+" index="+index+" mode="+mode);
|
||||||
var $row = $("tr[name='"+type+'_0_'+index+"']").clone(true), // clone first batch line to jQuery object
|
var $row = $("tr[name='"+type+'_0_'+index+"']").clone(true), // clone first batch line to jQuery object
|
||||||
nbrTrs = $("tr[name^='"+type+"_'][name$='_"+index+"']").length, // position of line for batch
|
nbrTrs = $("tr[name^='"+type+"_'][name$='_"+index+"']").length, // position of line for batch
|
||||||
qtyOrdered = parseFloat($("#qty_ordered_0_"+index).val()), // Qty ordered is same for all rows
|
qtyOrdered = parseFloat($("#qty_ordered_0_"+index).val()), // Qty ordered is same for all rows
|
||||||
@@ -62,8 +62,11 @@ function addDispatchLine(index, type, mode)
|
|||||||
$row.attr('name',type+'_'+nbrTrs+'_'+index);
|
$row.attr('name',type+'_'+nbrTrs+'_'+index);
|
||||||
//insert new row before last row
|
//insert new row before last row
|
||||||
$("tr[name^='"+type+"_'][name$='_"+index+"']:last").after($row);
|
$("tr[name^='"+type+"_'][name$='_"+index+"']:last").after($row);
|
||||||
|
|
||||||
//remove cloned select2 with duplicate id.
|
//remove cloned select2 with duplicate id.
|
||||||
$("#s2id_entrepot_"+nbrTrs+'_'+index).detach();
|
$("#s2id_entrepot_"+nbrTrs+'_'+index).detach(); // old way to find duplicated select2 component
|
||||||
|
$(".csswarehouse_"+nbrTrs+"_"+index+":first-child").parents("span.selection").parents(".select2").detach();
|
||||||
|
|
||||||
/* Suffix of lines are: _ trs.length _ index */
|
/* Suffix of lines are: _ trs.length _ index */
|
||||||
$("#qty_"+nbrTrs+"_"+index).focus();
|
$("#qty_"+nbrTrs+"_"+index).focus();
|
||||||
$("#qty_dispatched_0_"+index).val(qtyDispatched);
|
$("#qty_dispatched_0_"+index).val(qtyDispatched);
|
||||||
|
|||||||
Reference in New Issue
Block a user