add remove of lines for reception
This commit is contained in:
parent
9b141e9d1d
commit
3760f06961
@ -133,7 +133,7 @@ if ($id > 0 || !empty($ref)) {
|
|||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$isdraft = (isset($object->statut) && ($object->statut == $object::STATUS_DRAFT) ? 1 : 0);
|
$isdraft = (isset($object->statut) && ($object->statut == $object::STATUS_DRAFT) ? 1 : 0);
|
||||||
$result = restrictedArea($user, 'fournisseur', $id, 'commande_fournisseur', 'commande', 'fk_soc', 'rowid', $isdraft);
|
$result = restrictedArea($user, 'fournisseur', $object, 'commande_fournisseur', 'commande', 'fk_soc', 'rowid', $isdraft);
|
||||||
|
|
||||||
// Common permissions
|
// Common permissions
|
||||||
$usercanread = ($user->rights->fournisseur->commande->lire || $user->rights->supplier_order->lire);
|
$usercanread = ($user->rights->fournisseur->commande->lire || $user->rights->supplier_order->lire);
|
||||||
|
|||||||
@ -94,7 +94,7 @@ if (empty($conf->reception->enabled)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// $id is id of a purchase order.
|
// $id is id of a purchase order.
|
||||||
$result = restrictedArea($user, 'fournisseur', $id, 'commande_fournisseur', 'commande');
|
$result = restrictedArea($user, 'fournisseur', $object, 'commande_fournisseur', 'commande');
|
||||||
|
|
||||||
if (!isModEnabled('stock')) {
|
if (!isModEnabled('stock')) {
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
@ -978,7 +978,8 @@ if ($id > 0 || !empty($ref)) {
|
|||||||
|
|
||||||
// Qty to dispatch
|
// Qty to dispatch
|
||||||
print '<td class="right">';
|
print '<td class="right">';
|
||||||
print '<input id="qty'.$suffix.'" name="qty'.$suffix.'" type="text" class="width50 right" value="'.(GETPOSTISSET('qty'.$suffix) ? GETPOST('qty'.$suffix, 'int') : (empty($conf->global->SUPPLIER_ORDER_DISPATCH_FORCE_QTY_INPUT_TO_ZERO) ? $remaintodispatch : 0)).'">';
|
print '<a href="#" id="reset'.$suffix.'" class="resetline">'.img_picto($langs->trans("Reset"), 'eraser', 'class="pictofixedwidth opacitymedium"').'</a>';
|
||||||
|
print '<input id="qty'.$suffix.'" name="qty'.$suffix.'" type="text" class="width50 right qtydispatchinput" value="'.(GETPOSTISSET('qty'.$suffix) ? GETPOST('qty'.$suffix, 'int') : (empty($conf->global->SUPPLIER_ORDER_DISPATCH_FORCE_QTY_INPUT_TO_ZERO) ? $remaintodispatch : 0)).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td>';
|
print '<td>';
|
||||||
@ -1115,14 +1116,30 @@ if ($id > 0 || !empty($ref)) {
|
|||||||
$("select[name^=entrepot_]").val(fk_default_warehouse).change();
|
$("select[name^=entrepot_]").val(fk_default_warehouse).change();
|
||||||
});
|
});
|
||||||
|
|
||||||
jQuery("#autoreset").click(function() {';
|
$("#autoreset").click(function() {
|
||||||
$i = 0;
|
$(".qtydispatchinput").each(function(){
|
||||||
while ($i < $nbproduct) {
|
id = $(this).attr("id");
|
||||||
print ' jQuery("#qty_0_'.$i.'").val("");';
|
idtab = id.split("_");
|
||||||
$i++;
|
if(idtab[1] == 0){
|
||||||
}
|
console.log(idtab);
|
||||||
print '
|
$(this).val("");
|
||||||
|
$("#qty_dispatched_0_"+idtab[2]).val("0");
|
||||||
|
} else {
|
||||||
|
obj = $(this).parent().parent();
|
||||||
|
nameobj = obj.attr("name");
|
||||||
|
nametab = nameobj.split("_");
|
||||||
|
obj.remove();
|
||||||
|
$("tr[name^=\'"+nametab[0]+"_\'][name$=\'_"+nametab[2]+"\']:last .splitbutton").show();
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(".resetline").click(function(){
|
||||||
|
id = $(this).attr("id");
|
||||||
|
id = id.split("reset_");
|
||||||
|
console.log("Reset trigger for id = qty_"+id[1]);
|
||||||
|
$("#qty_"+id[1]).val("");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>';
|
</script>';
|
||||||
|
|
||||||
|
|||||||
@ -133,6 +133,21 @@ function addDispatchLine(index, type, mode)
|
|||||||
$("tr[name^='"+type+"_'][name$='_"+index+"'] .splitbutton").hide();
|
$("tr[name^='"+type+"_'][name$='_"+index+"'] .splitbutton").hide();
|
||||||
$("tr[name^='"+type+"_'][name$='_"+index+"']:last .splitbutton").show();
|
$("tr[name^='"+type+"_'][name$='_"+index+"']:last .splitbutton").show();
|
||||||
|
|
||||||
|
$("#reset_"+(nbrTrs)+"_"+index).click(function(){
|
||||||
|
id = $(this).attr("id");
|
||||||
|
id = id.split("reset_");
|
||||||
|
idrow = id[1];
|
||||||
|
idlast = $("tr[name^='"+type+"_'][name$='_"+index+"']:last .qtydispatchinput").attr("id");
|
||||||
|
if (idlast == $("#qty_"+idrow).attr("id")) {
|
||||||
|
console.log("Remove trigger for tr name = "+type+"_"+idrow);
|
||||||
|
$('tr[name="'+type+'_'+idrow+'"').remove();
|
||||||
|
$("tr[name^='"+type+"_'][name$='_"+index+"']:last .splitbutton").show();
|
||||||
|
} else {
|
||||||
|
console.log("Reset trigger for id = #qty_"+idrow);
|
||||||
|
$("#qty_"+idrow).val("");
|
||||||
|
}
|
||||||
|
});;
|
||||||
|
|
||||||
if (mode === 'lessone')
|
if (mode === 'lessone')
|
||||||
{
|
{
|
||||||
qty = 1; // keep 1 in old line
|
qty = 1; // keep 1 in old line
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user