keep batch info when correcting stock
This commit is contained in:
parent
239008b67d
commit
dc0e5e8d89
@ -41,6 +41,19 @@ if (empty($id)) {
|
||||
$id = $object->id;
|
||||
}
|
||||
|
||||
$pdluoid = GETPOST('pdluoid', 'int');
|
||||
|
||||
$pdluo = new Productbatch($db);
|
||||
|
||||
if ($pdluoid > 0) {
|
||||
$result = $pdluo->fetch($pdluoid);
|
||||
if ($result > 0) {
|
||||
$pdluoid = $pdluo->id;
|
||||
} else {
|
||||
dol_print_error($db, $pdluo->error, $pdluo->errors);
|
||||
}
|
||||
}
|
||||
|
||||
print '<script type="text/javascript">
|
||||
jQuery(document).ready(function() {
|
||||
function init_price()
|
||||
@ -82,6 +95,9 @@ print dol_get_fiche_head();
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="correct_stock">';
|
||||
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
||||
if ($pdluoid) {
|
||||
print '<input type="hidden" name="pdluoid" value="'.$pdluoid.'">';
|
||||
}
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
// Warehouse or product
|
||||
@ -128,26 +144,34 @@ if (!empty($conf->global->PRODUIT_SOUSPRODUITS) && $object->element == 'product'
|
||||
}
|
||||
|
||||
// Serial / Eat-by date
|
||||
if (!empty($conf->productbatch->enabled) &&
|
||||
if (ismodEnabled('productbatch') &&
|
||||
(($object->element == 'product' && $object->hasbatch())
|
||||
|| ($object->element == 'stock'))
|
||||
) {
|
||||
print '<tr>';
|
||||
print '<td'.($object->element == 'stock' ? '' : ' class="fieldrequired"').'>'.$langs->trans("batch_number").'</td><td colspan="3">';
|
||||
print '<input type="text" name="batch_number" class="minwidth300" value="'.GETPOST("batch_number").'">';
|
||||
if ($pdluoid > 0) {
|
||||
// If form was opened for a specific pdluoid, field is disabled
|
||||
print '<input type="text" name="batch_number_bis" size="40" disabled="disabled" value="'.(GETPOST('batch_number') ?GETPOST('batch_number') : $pdluo->batch).'">';
|
||||
print '<input type="hidden" name="batch_number" value="'.(GETPOST('batch_number') ?GETPOST('batch_number') : $pdluo->batch).'">';
|
||||
} else {
|
||||
print '<input type="text" name="batch_number" class="minwidth300" value="'.(GETPOST('batch_number') ? GETPOST('batch_number') : $pdluo->batch).'">';
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '<tr>';
|
||||
if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
|
||||
print '<td>'.$langs->trans("SellByDate").'</td><td>';
|
||||
$sellbyselected = dol_mktime(0, 0, 0, GETPOST('sellbymonth'), GETPOST('sellbyday'), GETPOST('sellbyyear'));
|
||||
print $form->selectDate($sellbyselected, 'sellby', '', '', 1, "");
|
||||
// If form was opened for a specific pdluoid, field is disabled
|
||||
print $form->selectDate((!empty($sellbyselected) ? $sellbyselected : $pdluo->sellby), 'sellby', '', '', 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0));
|
||||
print '</td>';
|
||||
}
|
||||
if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
|
||||
print '<td>'.$langs->trans("EatByDate").'</td><td>';
|
||||
$eatbyselected = dol_mktime(0, 0, 0, GETPOST('eatbymonth'), GETPOST('eatbyday'), GETPOST('eatbyyear'));
|
||||
print $form->selectDate($eatbyselected, 'eatby', '', '', 1, "");
|
||||
// If form was opened for a specific pdluoid, field is disabled
|
||||
print $form->selectDate((!empty($eatbyselected) ? $eatbyselected : $pdluo->eatby), 'eatby', '', '', 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0));
|
||||
print '</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user