Force to warehouse for consume produt in mo

This commit is contained in:
atm-lena 2022-05-11 12:38:24 +02:00
parent a526021459
commit e716c9abd6

View File

@ -50,6 +50,7 @@ $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'moc
$backtopage = GETPOST('backtopage', 'alpha');
$lineid = GETPOST('lineid', 'int');
$fk_movement = GETPOST('fk_movement', 'int');
$fk_default_warehouse = GETPOST('fk_default_warehouse', 'int');
$collapse = GETPOST('collapse', 'aZ09comma');
@ -734,6 +735,16 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<td>';
if ($collapse || in_array($action, array('consumeorproduce', 'consumeandproduceall'))) {
print $langs->trans("Warehouse");
// Select warehouse to force it everywhere
if(in_array($action, array('consumeorproduce', 'consumeandproduceall'))) {
$listwarehouses = $tmpwarehouse->list_array(1);
if (count($listwarehouses) > 1) {
print '<br><span class="opacitymedium">' . $langs->trans("ForceTo") . '</span> ' . $form->selectarray('fk_default_warehouse', $listwarehouses, $fk_default_warehouse, 1, 0, 0, '', 0, 0, 0, '', 'minwidth100 maxwidth300', 1);
} elseif (count($listwarehouses) == 1) {
print '<br><span class="opacitymedium">' . $langs->trans("ForceTo") . '</span> ' . $form->selectarray('fk_default_warehouse', $listwarehouses, $fk_default_warehouse, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100 maxwidth300', 1);
}
}
}
print '</td>';
if ($conf->stock->enabled) {
@ -1057,6 +1068,16 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '</table>';
print '</div>';
// traitement entrepot par défaut
print '<script type="text/javascript">
$(document).ready(function () {
$("select[name=fk_default_warehouse]").change(function() {
var fk_default_warehouse = $("option:selected", this).val();
$("select[name^=idwarehouse-]").val(fk_default_warehouse).change();
});
});
</script>';
// Lines to produce