From b6af4014dec821d583e8e6b6d6205a241bfa2646 Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Mon, 13 Jul 2020 13:08:15 +0200 Subject: [PATCH 01/11] hide eatby, sellby dates --- htdocs/fourn/commande/dispatch.php | 60 +++++++++++++++++------- htdocs/product/stock/productlot_card.php | 29 +++++++----- 2 files changed, 58 insertions(+), 31 deletions(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index c64d158ac2c..4b077d861f3 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -733,8 +733,12 @@ if ($id > 0 || !empty($ref)) { print ''.$langs->trans("Description").''; if (!empty($conf->productbatch->enabled)) { print ''.$langs->trans("batch_number").''; - print ''.$langs->trans("EatByDate").''; - print ''.$langs->trans("SellByDate").''; + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print ''.$langs->trans("EatByDate").''; + } + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + print ''.$langs->trans("SellByDate").''; + } } else { print ''; print ''; @@ -819,8 +823,12 @@ if ($id > 0 || !empty($ref)) { print $linktoprod; print ""; print ''; - print ''; - print ''; + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print ''; + } + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + print ''; + } } else { print ''; print $linktoprod; @@ -828,8 +836,12 @@ if ($id > 0 || !empty($ref)) { print ''; print $langs->trans("ProductDoesNotUseBatchSerial"); print ''; - print ''; - print ''; + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print ''; + } + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + print ''; + } } } else { print ''; @@ -896,14 +908,18 @@ if ($id > 0 || !empty($ref)) { print ''; print ''; print ''; - print ''; - $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 ''; - print ''; - $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 ''; + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print ''; + $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 ''; + } + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print ''; + $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 ''; + } print ' '; // Supplier ref + Qty ordered + qty already dispatched } else { $type = 'dispatch'; @@ -1118,8 +1134,12 @@ if ($id > 0 || !empty($ref)) { print ''.$langs->trans("DateDeliveryPlanned").''; if (!empty($conf->productbatch->enabled)) { print ''.$langs->trans("batch_number").''; - print ''.$langs->trans("EatByDate").''; - print ''.$langs->trans("SellByDate").''; + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print '' . $langs->trans( "EatByDate" ) . ''; + } + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + print '' . $langs->trans( "SellByDate" ) . ''; + } } print ''.$langs->trans("QtyDispatched").''; print ''.$langs->trans("Warehouse").''; @@ -1174,8 +1194,12 @@ if ($id > 0 || !empty($ref)) { $lot=new Productlot($db); $lot->fetch(0, $objp->pid, $objp->batch); print ''.$lot->getNomUrl(1).''; - print ''.dol_print_date($lot->eatby, 'day').''; - print ''.dol_print_date($lot->sellby, 'day').''; + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print '' . dol_print_date( $lot->eatby, 'day' ) . ''; + } + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + print '' . dol_print_date( $lot->sellby, 'day' ) . ''; + } } else { print ''; print ''; diff --git a/htdocs/product/stock/productlot_card.php b/htdocs/product/stock/productlot_card.php index 9b6de313b65..f091de9d78e 100644 --- a/htdocs/product/stock/productlot_card.php +++ b/htdocs/product/stock/productlot_card.php @@ -327,21 +327,24 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; // Eat by - print ''; - print $form->editfieldkey($langs->trans('EatByDate'), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker'); - print ''; - print $form->editfieldval($langs->trans('EatByDate'), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker'); - print ''; - print ''; + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print ''; + print $form->editfieldkey( $langs->trans( 'EatByDate' ), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker' ); + print ''; + print $form->editfieldval( $langs->trans( 'EatByDate' ), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker' ); + print ''; + print ''; + } // Sell by - print ''; - print $form->editfieldkey($langs->trans('SellByDate'), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker'); - print ''; - print $form->editfieldval($langs->trans('SellByDate'), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker'); - print ''; - print ''; - + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + print ''; + print $form->editfieldkey( $langs->trans( 'SellByDate' ), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker' ); + print ''; + print $form->editfieldval( $langs->trans( 'SellByDate' ), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker' ); + print ''; + print ''; + } // Other attributes $cols = 2; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; From 819144700794ecc50e657c00a580fd4ec56aa14d Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 13 Jul 2020 11:12:53 +0000 Subject: [PATCH 02/11] Fixing style errors. --- htdocs/fourn/commande/dispatch.php | 12 ++++++------ htdocs/product/stock/productlot_card.php | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 4b077d861f3..f3a1b1d86dd 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -910,8 +910,8 @@ if ($id > 0 || !empty($ref)) { print ''; if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { print ''; - $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, '' ); + $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 ''; } if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { @@ -1135,10 +1135,10 @@ if ($id > 0 || !empty($ref)) { if (!empty($conf->productbatch->enabled)) { print ''.$langs->trans("batch_number").''; if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { - print '' . $langs->trans( "EatByDate" ) . ''; + print '' . $langs->trans("EatByDate") . ''; } if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { - print '' . $langs->trans( "SellByDate" ) . ''; + print '' . $langs->trans("SellByDate") . ''; } } print ''.$langs->trans("QtyDispatched").''; @@ -1195,10 +1195,10 @@ if ($id > 0 || !empty($ref)) { $lot->fetch(0, $objp->pid, $objp->batch); print ''.$lot->getNomUrl(1).''; if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { - print '' . dol_print_date( $lot->eatby, 'day' ) . ''; + print '' . dol_print_date($lot->eatby, 'day') . ''; } if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { - print '' . dol_print_date( $lot->sellby, 'day' ) . ''; + print '' . dol_print_date($lot->sellby, 'day') . ''; } } else { print ''; diff --git a/htdocs/product/stock/productlot_card.php b/htdocs/product/stock/productlot_card.php index f091de9d78e..0f706c3ccae 100644 --- a/htdocs/product/stock/productlot_card.php +++ b/htdocs/product/stock/productlot_card.php @@ -329,9 +329,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Eat by if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { print ''; - print $form->editfieldkey( $langs->trans( 'EatByDate' ), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker' ); + print $form->editfieldkey($langs->trans('EatByDate'), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker'); print ''; - print $form->editfieldval( $langs->trans( 'EatByDate' ), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker' ); + print $form->editfieldval($langs->trans('EatByDate'), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker'); print ''; print ''; } @@ -339,9 +339,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Sell by if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { print ''; - print $form->editfieldkey( $langs->trans( 'SellByDate' ), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker' ); + print $form->editfieldkey($langs->trans('SellByDate'), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker'); print ''; - print $form->editfieldval( $langs->trans( 'SellByDate' ), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker' ); + print $form->editfieldval($langs->trans('SellByDate'), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker'); print ''; print ''; } From 2873e6bdcab43f696cfa0fdbaf32f4afd4874505 Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Thu, 6 Aug 2020 15:51:12 +0200 Subject: [PATCH 03/11] hide dates in productlot_list --- htdocs/product/stock/productlot_list.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index 0fb3c4a0388..58a03fd2563 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -99,6 +99,12 @@ $arrayfields = array( 't.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), //'t.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), ); +if (!empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + unset($arrayfields['t.sellby']); +} +if (!empty($conf->global->PRODUCT_DISABLE_EATBY)) { + unset($arrayfields['t.eatby']); +} // Extra fields if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) { @@ -338,8 +344,8 @@ if ($resql) if (!empty($arrayfields['t.entity']['checked'])) print ''; if (!empty($arrayfields['t.batch']['checked'])) print ''; if (!empty($arrayfields['t.fk_product']['checked'])) print ''; - if (!empty($arrayfields['t.sellby']['checked'])) print ''; - if (!empty($arrayfields['t.eatby']['checked'])) print ''; + if (!empty($arrayfields['t.sellby']['checked']) && empty($conf->global->PRODUCT_DISABLE_SELLBY)) print ''; + if (!empty($arrayfields['t.eatby']['checked']) && empty($conf->global->PRODUCT_DISABLE_EATBY)) print ''; if (!empty($arrayfields['t.fk_user_creat']['checked'])) print ''; if (!empty($arrayfields['t.fk_user_modif']['checked'])) print ''; if (!empty($arrayfields['t.import_key']['checked'])) print ''; @@ -381,8 +387,8 @@ if ($resql) if (!empty($arrayfields['t.entity']['checked'])) print_liste_field_titre($arrayfields['t.entity']['label'], $_SERVER['PHP_SELF'], 't.entity', '', $param, '', $sortfield, $sortorder); if (!empty($arrayfields['t.batch']['checked'])) print_liste_field_titre($arrayfields['t.batch']['label'], $_SERVER['PHP_SELF'], 't.batch', '', $param, '', $sortfield, $sortorder); if (!empty($arrayfields['t.fk_product']['checked'])) print_liste_field_titre($arrayfields['t.fk_product']['label'], $_SERVER['PHP_SELF'], 't.fk_product', '', $param, '', $sortfield, $sortorder); - if (!empty($arrayfields['t.sellby']['checked'])) print_liste_field_titre($arrayfields['t.sellby']['label'], $_SERVER['PHP_SELF'], 't.sellby', '', $param, '', $sortfield, $sortorder); - if (!empty($arrayfields['t.eatby']['checked'])) print_liste_field_titre($arrayfields['t.eatby']['label'], $_SERVER['PHP_SELF'], 't.eatby', '', $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['t.sellby']['checked']) && empty($conf->global->PRODUCT_DISABLE_SELLBY)) print_liste_field_titre($arrayfields['t.sellby']['label'], $_SERVER['PHP_SELF'], 't.sellby', '', $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['t.eatby']['checked']) && empty($conf->global->PRODUCT_DISABLE_EATBY)) print_liste_field_titre($arrayfields['t.eatby']['label'], $_SERVER['PHP_SELF'], 't.eatby', '', $param, '', $sortfield, $sortorder); if (!empty($arrayfields['t.fk_user_creat']['checked'])) print_liste_field_titre($arrayfields['t.fk_user_creat']['label'], $_SERVER['PHP_SELF'], 't.fk_user_creat', '', $param, '', $sortfield, $sortorder); if (!empty($arrayfields['t.fk_user_modif']['checked'])) print_liste_field_titre($arrayfields['t.fk_user_modif']['label'], $_SERVER['PHP_SELF'], 't.fk_user_modif', '', $param, '', $sortfield, $sortorder); if (!empty($arrayfields['t.import_key']['checked'])) print_liste_field_titre($arrayfields['t.import_key']['label'], $_SERVER['PHP_SELF'], 't.import_key', '', $param, '', $sortfield, $sortorder); @@ -442,12 +448,12 @@ if ($resql) print ''.$productstatic->getNomUrl(1).''; if (!$i) $totalarray['nbfield']++; } - if (!empty($arrayfields['t.sellby']['checked'])) + if (!empty($arrayfields['t.sellby']['checked']) && empty($conf->global->PRODUCT_DISABLE_SELLBY)) { print ''.dol_print_date($db->jdate($obj->sellby), 'day').''; if (!$i) $totalarray['nbfield']++; } - if (!empty($arrayfields['t.eatby']['checked'])) + if (!empty($arrayfields['t.eatby']['checked']) && empty($conf->global->PRODUCT_DISABLE_EATBY)) { print ''.dol_print_date($db->jdate($obj->eatby), 'day').''; if (!$i) $totalarray['nbfield']++; From df3fcec6c6349e1faa10118cb51316a6b0cbe396 Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Wed, 19 Aug 2020 16:44:45 +0200 Subject: [PATCH 04/11] hide dates on erassortlot.php --- htdocs/product/reassortlot.php | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php index de49a11fbc7..050d0d12f4b 100644 --- a/htdocs/product/reassortlot.php +++ b/htdocs/product/reassortlot.php @@ -284,8 +284,12 @@ if ($resql) print ''; print ' '; print ' '; - print ' '; - print ' '; + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print ' '; + } + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + print ' '; + } print ' '; print ' '; print ''; @@ -302,8 +306,12 @@ if ($resql) print_liste_field_titre("Warehouse", $_SERVER["PHP_SELF"], "e.ref", $param, "", '', $sortfield, $sortorder); //print_liste_field_titre("DesiredStock", $_SERVER["PHP_SELF"], "p.desiredstock",$param,"",'',$sortfield,$sortorder, 'right ); print_liste_field_titre("Batch", $_SERVER["PHP_SELF"], "pb.batch", $param, "", '', $sortfield, $sortorder, 'center '); - print_liste_field_titre("EatByDate", $_SERVER["PHP_SELF"], "pb.eatby", $param, "", '', $sortfield, $sortorder, 'center '); - print_liste_field_titre("SellByDate", $_SERVER["PHP_SELF"], "pb.sellby", $param, "", '', $sortfield, $sortorder, 'center '); + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print_liste_field_titre("EatByDate", $_SERVER["PHP_SELF"], "pb.eatby", $param, "", '', $sortfield, $sortorder, 'center '); + } + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + print_liste_field_titre("SellByDate", $_SERVER["PHP_SELF"], "pb.sellby", $param, "", '', $sortfield, $sortorder, 'center '); + } print_liste_field_titre("PhysicalStock", $_SERVER["PHP_SELF"], "stock_physique", $param, "", '', $sortfield, $sortorder, 'right '); // TODO Add info of running suppliers/customers orders //print_liste_field_titre("TheoreticalStock",$_SERVER["PHP_SELF"], "stock_theorique",$param,"",'',$sortfield,$sortorder, 'right '); @@ -400,8 +408,12 @@ if ($resql) } print ''; - print ''.dol_print_date($db->jdate($objp->eatby), 'day').''; - print ''.dol_print_date($db->jdate($objp->sellby), 'day').''; + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print ''.dol_print_date($db->jdate($objp->eatby), 'day').''; + } + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + print ''.dol_print_date($db->jdate($objp->sellby), 'day').''; + } print ''; //if ($objp->seuil_stock_alerte && ($objp->stock_physique < $objp->seuil_stock_alerte)) print img_warning($langs->trans("StockTooLow")).' '; print $objp->stock_physique; From b777c625575d29875cba64caef27a8aae42ece94 Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Thu, 20 Aug 2020 12:13:05 +0200 Subject: [PATCH 05/11] hide eatby sellby on product/stock/product --- htdocs/product/stock/product.php | 46 +++++++++++++------ .../product/stock/tpl/stockcorrection.tpl.php | 20 ++++---- .../product/stock/tpl/stocktransfer.tpl.php | 16 ++++--- 3 files changed, 54 insertions(+), 28 deletions(-) diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index af7a95fb95a..f4669c44cea 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -805,11 +805,18 @@ if (!$variants) { print ''.$langs->trans("EstimatedStockValueSellShort").''; print ''; if ((!empty($conf->productbatch->enabled)) && $object->hasbatch()) { + $colspan = 3; print ''; print ''.$langs->trans("batch_number").''; - print ''.$langs->trans("EatByDate").''; - print ''.$langs->trans("SellByDate").''; - print ''; + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + $colspan--; + print ''.$langs->trans("EatByDate").''; + } + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + $colspan--; + print ''.$langs->trans("SellByDate").''; + } + print ''; print ''; print ''; print ''; @@ -887,14 +894,18 @@ if (!$variants) { print '
'; print ''; print ''; - print ''; - print ''; - print ''; - print ''; +// print ''; + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print ''; + } + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + print ''; + } + print ''; print ''; print '
'; - print $form->selectDate($pdluo->eatby, 'eatby', '', '', 1, '', 1, 0); - print ''; - print $form->selectDate($pdluo->sellby, 'sellby', '', '', 1, '', 1, 0); - print ''.$pdluo->qty.($pdluo->qty < 0 ? ' '.img_warning() : '').''; + print $form->selectDate($pdluo->eatby, 'eatby', '', '', 1, '', 1, 0); + print ''; + print $form->selectDate($pdluo->sellby, 'sellby', '', '', 1, '', 1, 0); + print ''.$pdluo->qty.($pdluo->qty < 0 ? ' '.img_warning() : '').''; print '
'; @@ -911,9 +922,16 @@ if (!$variants) { print ''; print $product_lot_static->getNomUrl(1); print ''; - print ''.dol_print_date($pdluo->eatby, 'day').''; - print ''.dol_print_date($pdluo->sellby, 'day').''; - print ''.$pdluo->qty.($pdluo->qty < 0 ? ' '.img_warning() : '').''; + $colspan = 3; + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + $colspan--; + print ''.dol_print_date($pdluo->eatby, 'day').''; + } + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + $colspan--; + print ''.dol_print_date($pdluo->sellby, 'day').''; + } + print ''.$pdluo->qty.($pdluo->qty < 0 ? ' '.img_warning() : '').''; print ''; print ''; } diff --git a/htdocs/product/stock/tpl/stockcorrection.tpl.php b/htdocs/product/stock/tpl/stockcorrection.tpl.php index 98826ca6799..88cced3b99d 100644 --- a/htdocs/product/stock/tpl/stockcorrection.tpl.php +++ b/htdocs/product/stock/tpl/stockcorrection.tpl.php @@ -103,14 +103,18 @@ if (!empty($conf->productbatch->enabled) && print ''; print ''; print ''; - print ''.$langs->trans("EatByDate").''; - $eatbyselected = dol_mktime(0, 0, 0, GETPOST('eatbymonth'), GETPOST('eatbyday'), GETPOST('eatbyyear')); - print $form->selectDate($eatbyselected, 'eatby', '', '', 1, ""); - print ''; - print ''.$langs->trans("SellByDate").''; - $sellbyselected = dol_mktime(0, 0, 0, GETPOST('sellbymonth'), GETPOST('sellbyday'), GETPOST('sellbyyear')); - print $form->selectDate($sellbyselected, 'sellby', '', '', 1, ""); - print ''; + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print ''.$langs->trans("EatByDate").''; + $eatbyselected = dol_mktime(0, 0, 0, GETPOST('eatbymonth'), GETPOST('eatbyday'), GETPOST('eatbyyear')); + print $form->selectDate($eatbyselected, 'eatby', '', '', 1, ""); + print ''; + } + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + print ''.$langs->trans("SellByDate").''; + $sellbyselected = dol_mktime(0, 0, 0, GETPOST('sellbymonth'), GETPOST('sellbyday'), GETPOST('sellbyyear')); + print $form->selectDate($sellbyselected, 'sellby', '', '', 1, ""); + print ''; + } print ''; } diff --git a/htdocs/product/stock/tpl/stocktransfer.tpl.php b/htdocs/product/stock/tpl/stocktransfer.tpl.php index f725a5ebbfe..0164e99bd37 100644 --- a/htdocs/product/stock/tpl/stocktransfer.tpl.php +++ b/htdocs/product/stock/tpl/stocktransfer.tpl.php @@ -107,12 +107,16 @@ if (!empty($conf->productbatch->enabled) && print ''; print ''; - print ''.$langs->trans("EatByDate").''; - print $form->selectDate(($d_eatby ? $d_eatby : $pdluo->eatby), 'eatby', '', '', 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled - print ''; - print ''.$langs->trans("SellByDate").''; - print $form->selectDate(($d_sellby ? $d_sellby : $pdluo->sellby), 'sellby', '', '', 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled - print ''; + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print ''.$langs->trans("EatByDate").''; + print $form->selectDate(($d_eatby ? $d_eatby : $pdluo->eatby), 'eatby', '', '', 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled + print ''; + } + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + print ''.$langs->trans("SellByDate").''; + print $form->selectDate(($d_sellby ? $d_sellby : $pdluo->sellby), 'sellby', '', '', 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled + print ''; + } print ''; } From b74113e2eb7e4964b705e064f38c3d77c58b379f Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Thu, 20 Aug 2020 12:13:27 +0200 Subject: [PATCH 06/11] hide eatby sellby on expedition --- htdocs/expedition/card.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 929e7ecafd0..94ace4ab64f 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1300,8 +1300,12 @@ if ($action == 'create') $detail = ''; $detail .= $langs->trans("Batch").': '.$dbatch->batch; - $detail .= ' - '.$langs->trans("SellByDate").': '.dol_print_date($dbatch->sellby, "day"); - $detail .= ' - '.$langs->trans("EatByDate").': '.dol_print_date($dbatch->eatby, "day"); + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + $detail .= ' - '.$langs->trans("SellByDate").': '.dol_print_date($dbatch->sellby, "day"); + } + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + $detail .= ' - '.$langs->trans("EatByDate").': '.dol_print_date($dbatch->eatby, "day"); + } $detail .= ' - '.$langs->trans("Qty").': '.$dbatch->qty; $detail .= '
'; print $detail; From a5b4fcedb7a055329ab9c05693166850aa2865b9 Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Thu, 20 Aug 2020 12:48:23 +0200 Subject: [PATCH 07/11] hide eatby sellby in reception --- htdocs/reception/card.php | 45 ++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 7bc99977943..27722c29ed4 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -966,8 +966,12 @@ if ($action == 'create') if (!empty($conf->productbatch->enabled)) { print ''.$langs->trans("batch_number").''; - print ''.$langs->trans("EatByDate").''; - print ''.$langs->trans("SellByDate").''; + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print ''.$langs->trans("EatByDate").''; + } + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + print ''.$langs->trans("SellByDate").''; + } } print "\n"; } @@ -1114,12 +1118,16 @@ if ($action == 'create') if (!empty($product->status_batch)) { print ''; - print ''; - print $form->selectDate($dispatchLines[$indiceAsked]['DLC'], 'dlc'.$indiceAsked, '', '', 1, ""); - print ''; - print ''; - print $form->selectDate($dispatchLines[$indiceAsked]['DLUO'], 'dluo'.$indiceAsked, '', '', 1, ""); - print ''; + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print ''; + print $form->selectDate($dispatchLines[$indiceAsked]['DLC'], 'dlc'.$indiceAsked, '', '', 1, ""); + print ''; + } + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + print ''; + print $form->selectDate($dispatchLines[$indiceAsked]['DLUO'], 'dluo'.$indiceAsked, '', '', 1, ""); + print ''; + } } else { print ''; } @@ -1807,10 +1815,14 @@ if ($action == 'create') if ($conf->productbatch->enabled && !empty($lines[$i]->product->status_batch)) { print '
'; - print $langs->trans('EatByDate').' : '; - print $form->selectDate($lines[$i]->eatby, 'dlc'.$line_id, '', '', 1, "").'
'; - print $langs->trans('SellByDate').' : '; - print $form->selectDate($lines[$i]->sellby, 'dluo'.$line_id, '', '', 1, ""); + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print $langs->trans('EatByDate').' : '; + print $form->selectDate($lines[$i]->eatby, 'dlc'.$line_id, '', '', 1, "").'
'; + } + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + print $langs->trans('SellByDate').' : '; + print $form->selectDate($lines[$i]->sellby, 'dluo'.$line_id, '', '', 1, ""); + } print ''; } print ''; @@ -1856,11 +1868,14 @@ if ($action == 'create') $detail = ''; if ($lines[$i]->product->status_batch) { - $detail .= $langs->trans("Batch").': '.$lines[$i]->batch; + $detail .= $langs->trans("Batch").': '.$lines[$i]->batch; + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { $detail .= ' - '.$langs->trans("SellByDate").': '.dol_print_date($lines[$i]->sellby, "day"); + } + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { $detail .= ' - '.$langs->trans("EatByDate").': '.dol_print_date($lines[$i]->eatby, "day"); - - $detail .= '
'; + } + $detail .= '
'; print $form->textwithtooltip(img_picto('', 'object_barcode').' '.$langs->trans("DetailBatchNumber"), $detail); } else { From 179fc2e70a341b6c929872299bc2dae84618ab5d Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Thu, 20 Aug 2020 15:27:34 +0200 Subject: [PATCH 08/11] hide other eatby sellby dates --- htdocs/expedition/card.php | 8 ++++++-- htdocs/mrp/mo_movements.php | 6 ++++++ htdocs/product/stock/index.php | 16 ++++++++++++---- htdocs/product/stock/movement_list.php | 6 ++++++ 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 94ace4ab64f..621d6421d2d 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -2307,8 +2307,12 @@ if ($action == 'create') foreach ($lines[$i]->detail_batch as $dbatch) // $dbatch is instance of ExpeditionLineBatch { $detail .= $langs->trans("Batch").': '.$dbatch->batch; - $detail .= ' - '.$langs->trans("SellByDate").': '.dol_print_date($dbatch->sellby, "day"); - $detail .= ' - '.$langs->trans("EatByDate").': '.dol_print_date($dbatch->eatby, "day"); + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + $detail .= ' - '.$langs->trans("SellByDate").': '.dol_print_date($dbatch->sellby, "day"); + } + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + $detail .= ' - '.$langs->trans("EatByDate").': '.dol_print_date($dbatch->eatby, "day"); + } $detail .= ' - '.$langs->trans("Qty").': '.$dbatch->qty; $detail .= '
'; } diff --git a/htdocs/mrp/mo_movements.php b/htdocs/mrp/mo_movements.php index f43ccd3dcd4..e281d45ee74 100644 --- a/htdocs/mrp/mo_movements.php +++ b/htdocs/mrp/mo_movements.php @@ -143,6 +143,12 @@ $arrayfields = array( //'m.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), //'m.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500) ); +if (!empty($conf->global->PRODUCT_DISABLE_EATBY)) { + unset($arrayfields['pl.eatby']); +} +if (!empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + unset($arrayfields['pl.sellby']); +} $objectlist->fields = dol_sort_array($objectlist->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); diff --git a/htdocs/product/stock/index.php b/htdocs/product/stock/index.php index fc43d5e8ce3..5a7cd3b2d3d 100644 --- a/htdocs/product/stock/index.php +++ b/htdocs/product/stock/index.php @@ -159,8 +159,12 @@ if ($resql) if (!empty($conf->productbatch->enabled)) { print ''.$langs->trans("Batch").''; - print ''.$langs->trans("SellByDate").''; - print ''.$langs->trans("EatByDate").''; + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + print ''.$langs->trans("SellByDate").''; + } + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print ''.$langs->trans("EatByDate").''; + } } print ''.$langs->trans("Warehouse").''; print ''.$langs->trans("FullList").''; @@ -191,8 +195,12 @@ if ($resql) if (!empty($conf->productbatch->enabled)) { print ''.$objp->batch.''; - print ''.dol_print_date($db->jdate($objp->sellby), 'day').''; - print ''.dol_print_date($db->jdate($objp->eatby), 'day').''; + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + print ''.dol_print_date($db->jdate($objp->sellby), 'day').''; + } + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print ''.dol_print_date($db->jdate($objp->eatby), 'day').''; + } } print ''; print $warehouse->getNomUrl(1); diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index c844bae01e2..ee4c77eb2e4 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -121,6 +121,12 @@ $arrayfields = array( //'m.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), //'m.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500) ); +if (!empty($conf->global->PRODUCT_DISABLE_EATBY)) { + unset($arrayfields['pl.eatby']); +} +if (!empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + unset($arrayfields['pl.sellby']); +} // Security check if (!$user->rights->stock->mouvement->lire) { From 3c108e8bbf571d436b06a3ceeb7f77143674d900 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 20 Aug 2020 13:31:48 +0000 Subject: [PATCH 09/11] Fixing style errors. --- htdocs/product/stock/product.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index f4669c44cea..315a5993d92 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -894,7 +894,7 @@ if (!$variants) { print ''; print ''; print ''; -// print ''; + // print ''; if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { print '
'; print $form->selectDate($pdluo->eatby, 'eatby', '', '', 1, '', 1, 0); From b1849aed5c418b182d79829cd731b8d543d97cb9 Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Mon, 24 Aug 2020 07:53:25 +0200 Subject: [PATCH 10/11] fix for mistakenly uncommented code --- htdocs/product/stock/product.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 315a5993d92..9f7628edc25 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -894,7 +894,7 @@ if (!$variants) { print ''; print ''; print ''; - // print ''; + print ''; if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { print ''; if (!empty($arrayfields['t.batch']['checked'])) print ''; if (!empty($arrayfields['t.fk_product']['checked'])) print ''; - if (!empty($arrayfields['t.sellby']['checked']) && empty($conf->global->PRODUCT_DISABLE_SELLBY)) print ''; - if (!empty($arrayfields['t.eatby']['checked']) && empty($conf->global->PRODUCT_DISABLE_EATBY)) print ''; + if (!empty($arrayfields['t.sellby']['checked'])) print ''; + if (!empty($arrayfields['t.eatby']['checked'])) print ''; if (!empty($arrayfields['t.fk_user_creat']['checked'])) print ''; if (!empty($arrayfields['t.fk_user_modif']['checked'])) print ''; if (!empty($arrayfields['t.import_key']['checked'])) print ''; @@ -387,8 +387,8 @@ if ($resql) if (!empty($arrayfields['t.entity']['checked'])) print_liste_field_titre($arrayfields['t.entity']['label'], $_SERVER['PHP_SELF'], 't.entity', '', $param, '', $sortfield, $sortorder); if (!empty($arrayfields['t.batch']['checked'])) print_liste_field_titre($arrayfields['t.batch']['label'], $_SERVER['PHP_SELF'], 't.batch', '', $param, '', $sortfield, $sortorder); if (!empty($arrayfields['t.fk_product']['checked'])) print_liste_field_titre($arrayfields['t.fk_product']['label'], $_SERVER['PHP_SELF'], 't.fk_product', '', $param, '', $sortfield, $sortorder); - if (!empty($arrayfields['t.sellby']['checked']) && empty($conf->global->PRODUCT_DISABLE_SELLBY)) print_liste_field_titre($arrayfields['t.sellby']['label'], $_SERVER['PHP_SELF'], 't.sellby', '', $param, '', $sortfield, $sortorder); - if (!empty($arrayfields['t.eatby']['checked']) && empty($conf->global->PRODUCT_DISABLE_EATBY)) print_liste_field_titre($arrayfields['t.eatby']['label'], $_SERVER['PHP_SELF'], 't.eatby', '', $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['t.sellby']['checked'])) print_liste_field_titre($arrayfields['t.sellby']['label'], $_SERVER['PHP_SELF'], 't.sellby', '', $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['t.eatby']['checked'])) print_liste_field_titre($arrayfields['t.eatby']['label'], $_SERVER['PHP_SELF'], 't.eatby', '', $param, '', $sortfield, $sortorder); if (!empty($arrayfields['t.fk_user_creat']['checked'])) print_liste_field_titre($arrayfields['t.fk_user_creat']['label'], $_SERVER['PHP_SELF'], 't.fk_user_creat', '', $param, '', $sortfield, $sortorder); if (!empty($arrayfields['t.fk_user_modif']['checked'])) print_liste_field_titre($arrayfields['t.fk_user_modif']['label'], $_SERVER['PHP_SELF'], 't.fk_user_modif', '', $param, '', $sortfield, $sortorder); if (!empty($arrayfields['t.import_key']['checked'])) print_liste_field_titre($arrayfields['t.import_key']['label'], $_SERVER['PHP_SELF'], 't.import_key', '', $param, '', $sortfield, $sortorder); @@ -448,12 +448,12 @@ if ($resql) print ''; if (!$i) $totalarray['nbfield']++; } - if (!empty($arrayfields['t.sellby']['checked']) && empty($conf->global->PRODUCT_DISABLE_SELLBY)) + if (!empty($arrayfields['t.sellby']['checked'])) { print ''; if (!$i) $totalarray['nbfield']++; } - if (!empty($arrayfields['t.eatby']['checked']) && empty($conf->global->PRODUCT_DISABLE_EATBY)) + if (!empty($arrayfields['t.eatby']['checked'])) { print ''; if (!$i) $totalarray['nbfield']++;
'; print $form->selectDate($pdluo->eatby, 'eatby', '', '', 1, '', 1, 0); From 564a47e41c17d0f527eb7fbde5a917ccf49f9f6f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Sep 2020 12:08:10 +0200 Subject: [PATCH 11/11] Update productlot_list.php --- htdocs/product/stock/productlot_list.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index 58a03fd2563..ec5e3ebde69 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -344,8 +344,8 @@ if ($resql) if (!empty($arrayfields['t.entity']['checked'])) print ''.$productstatic->getNomUrl(1).''.dol_print_date($db->jdate($obj->sellby), 'day').''.dol_print_date($db->jdate($obj->eatby), 'day').'