hide eatby, sellby dates

This commit is contained in:
Christian Foellmann 2020-07-13 13:08:15 +02:00
parent 3281d5ec17
commit b6af4014de
2 changed files with 58 additions and 31 deletions

View File

@ -733,8 +733,12 @@ if ($id > 0 || !empty($ref)) {
print '<td>'.$langs->trans("Description").'</td>';
if (!empty($conf->productbatch->enabled)) {
print '<td class="dispatch_batch_number_title">'.$langs->trans("batch_number").'</td>';
print '<td class="dispatch_dluo_title">'.$langs->trans("EatByDate").'</td>';
print '<td class="dispatch_dlc_title">'.$langs->trans("SellByDate").'</td>';
if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
print '<td class="dispatch_dluo_title">'.$langs->trans("EatByDate").'</td>';
}
if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
print '<td class="dispatch_dlc_title">'.$langs->trans("SellByDate").'</td>';
}
} else {
print '<td></td>';
print '<td></td>';
@ -819,8 +823,12 @@ if ($id > 0 || !empty($ref)) {
print $linktoprod;
print "</td>";
print '<td class="dispatch_batch_number"></td>';
print '<td class="dispatch_dluo"></td>';
print '<td class="dispatch_dlc"></td>';
if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
print '<td class="dispatch_dluo"></td>';
}
if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
print '<td class="dispatch_dlc"></td>';
}
} else {
print '<td>';
print $linktoprod;
@ -828,8 +836,12 @@ if ($id > 0 || !empty($ref)) {
print '<td class="dispatch_batch_number">';
print $langs->trans("ProductDoesNotUseBatchSerial");
print '</td>';
print '<td class="dispatch_dluo"></td>';
print '<td class="dispatch_dlc"></td>';
if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
print '<td class="dispatch_dluo"></td>';
}
if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
print '<td class="dispatch_dlc"></td>';
}
}
} else {
print '<td colspan="4">';
@ -896,14 +908,18 @@ if ($id > 0 || !empty($ref)) {
print '<td>';
print '<input type="text" class="inputlotnumber quatrevingtquinzepercent" id="lot_number'.$suffix.'" name="lot_number'.$suffix.'" value="'.GETPOST('lot_number'.$suffix).'">';
print '</td>';
print '<td class="nowraponall">';
$dlcdatesuffix = dol_mktime(0, 0, 0, GETPOST('dlc'.$suffix.'month'), GETPOST('dlc'.$suffix.'day'), GETPOST('dlc'.$suffix.'year'));
print $form->selectDate($dlcdatesuffix, 'dlc'.$suffix, '', '', 1, '');
print '</td>';
print '<td class="nowraponall">';
$dluodatesuffix = dol_mktime(0, 0, 0, GETPOST('dluo'.$suffix.'month'), GETPOST('dluo'.$suffix.'day'), GETPOST('dluo'.$suffix.'year'));
print $form->selectDate($dluodatesuffix, 'dluo'.$suffix, '', '', 1, '');
print '</td>';
if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
print '<td class="nowraponall">';
$dlcdatesuffix = dol_mktime( 0, 0, 0, GETPOST( 'dlc' . $suffix . 'month' ), GETPOST( 'dlc' . $suffix . 'day' ), GETPOST( 'dlc' . $suffix . 'year' ) );
print $form->selectDate( $dlcdatesuffix, 'dlc' . $suffix, '', '', 1, '' );
print '</td>';
}
if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
print '<td class="nowraponall">';
$dluodatesuffix = dol_mktime(0, 0, 0, GETPOST('dluo'.$suffix.'month'), GETPOST('dluo'.$suffix.'day'), GETPOST('dluo'.$suffix.'year'));
print $form->selectDate($dluodatesuffix, 'dluo'.$suffix, '', '', 1, '');
print '</td>';
}
print '<td colspan="3">&nbsp</td>'; // Supplier ref + Qty ordered + qty already dispatched
} else {
$type = 'dispatch';
@ -1118,8 +1134,12 @@ if ($id > 0 || !empty($ref)) {
print '<td>'.$langs->trans("DateDeliveryPlanned").'</td>';
if (!empty($conf->productbatch->enabled)) {
print '<td class="dispatch_batch_number_title">'.$langs->trans("batch_number").'</td>';
print '<td class="dispatch_dluo_title">'.$langs->trans("EatByDate").'</td>';
print '<td class="dispatch_dlc_title">'.$langs->trans("SellByDate").'</td>';
if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
print '<td class="dispatch_dluo_title">' . $langs->trans( "EatByDate" ) . '</td>';
}
if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
print '<td class="dispatch_dlc_title">' . $langs->trans( "SellByDate" ) . '</td>';
}
}
print '<td class="right">'.$langs->trans("QtyDispatched").'</td>';
print '<td>'.$langs->trans("Warehouse").'</td>';
@ -1174,8 +1194,12 @@ if ($id > 0 || !empty($ref)) {
$lot=new Productlot($db);
$lot->fetch(0, $objp->pid, $objp->batch);
print '<td class="dispatch_batch_number">'.$lot->getNomUrl(1).'</td>';
print '<td class="dispatch_dluo">'.dol_print_date($lot->eatby, 'day').'</td>';
print '<td class="dispatch_dlc">'.dol_print_date($lot->sellby, 'day').'</td>';
if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
print '<td class="dispatch_dluo">' . dol_print_date( $lot->eatby, 'day' ) . '</td>';
}
if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
print '<td class="dispatch_dlc">' . dol_print_date( $lot->sellby, 'day' ) . '</td>';
}
} else {
print '<td class="dispatch_batch_number"></td>';
print '<td class="dispatch_dluo"></td>';

View File

@ -327,21 +327,24 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '</td></tr>';
// Eat by
print '<tr><td>';
print $form->editfieldkey($langs->trans('EatByDate'), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker');
print '</td><td>';
print $form->editfieldval($langs->trans('EatByDate'), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker');
print '</td>';
print '</tr>';
if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
print '<tr><td>';
print $form->editfieldkey( $langs->trans( 'EatByDate' ), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker' );
print '</td><td>';
print $form->editfieldval( $langs->trans( 'EatByDate' ), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker' );
print '</td>';
print '</tr>';
}
// Sell by
print '<tr><td>';
print $form->editfieldkey($langs->trans('SellByDate'), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker');
print '</td><td>';
print $form->editfieldval($langs->trans('SellByDate'), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker');
print '</td>';
print '</tr>';
if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
print '<tr><td>';
print $form->editfieldkey( $langs->trans( 'SellByDate' ), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker' );
print '</td><td>';
print $form->editfieldval( $langs->trans( 'SellByDate' ), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker' );
print '</td>';
print '</tr>';
}
// Other attributes
$cols = 2;
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';