NEW Add filter "Product subject to lot/Serial" in stock per lot/serial

This commit is contained in:
Laurent Destailleur 2022-09-01 12:32:27 +02:00
parent 57bcc2177a
commit 6c45b13178
6 changed files with 24 additions and 15 deletions

View File

@ -190,7 +190,7 @@ class FormTicket
// TITLE
$email = GETPOSTISSET('email') ? GETPOST('email', 'alphanohtml') : '';
if ($this->withemail) {
print '<tr><td class="titlefield"><label for="email"><span class="fieldrequired">'.$langs->trans("Email").'</span></label></td><td>';
print '<tr><td class="titlefield"><label for="email"><span class="fieldrequired">'.img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("Email").'</span></label></td><td>';
print '<input class="text minwidth200" id="email" name="email" value="'.$email.'" autofocus>';
print '</td></tr>';

View File

@ -119,7 +119,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->product->enabled', __HANDLER__, 'left', 2801__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/card.php?mainmenu=products&amp;leftmenu=product&amp;action=create&amp;type=0', 'NewProduct', 1, 'products', '$user->rights->produit->creer', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->product->enabled', __HANDLER__, 'left', 2802__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/list.php?mainmenu=products&amp;leftmenu=product&amp;type=0', 'List', 1, 'products', '$user->rights->produit->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->product->enabled', __HANDLER__, 'left', 2803__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/reassort.php?mainmenu=products&amp;type=0', 'MenuStocks', 1, 'products', '$user->rights->produit->lire && $user->rights->stock->lire', '', 2, 4, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->productbatch->enabled', __HANDLER__, 'left', 2805__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/reassortlot.php?mainmenu=products&amp;type=0', 'StocksByLotSerial', 1, 'products', '$user->rights->produit->lire && $user->rights->stock->lire', '', 2, 5, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->productbatch->enabled', __HANDLER__, 'left', 2805__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/reassortlot.php?mainmenu=products&amp;type=0&amp;search_subjecttolotserial=1', 'StocksByLotSerial', 1, 'products', '$user->rights->produit->lire && $user->rights->stock->lire', '', 2, 5, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->productbatch->enabled', __HANDLER__, 'left', 2806__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/stock/productlot_list.php?mainmenu=products', 'LotSerial', 1, 'products', '$user->rights->produit->lire && $user->rights->stock->lire', '', 2, 6, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->variants->enabled', __HANDLER__, 'left', 2807__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/variants/list.php?mainmenu=products', 'VariantAttributes', 1, 'products', '$user->rights->produit->lire', '', 2, 7, __ENTITY__);

View File

@ -1998,7 +1998,7 @@ function get_left_menu_products($mainmenu, &$newmenu, $usemenuhider = 1, $leftme
}
if (isModEnabled('productbatch')) {
$langs->load("stocks");
$newmenu->add("/product/reassortlot.php?type=0", $langs->trans("StocksByLotSerial"), 1, $user->rights->produit->lire && $user->rights->stock->lire);
$newmenu->add("/product/reassortlot.php?type=0&search_subjecttolotserial=1", $langs->trans("StocksByLotSerial"), 1, $user->rights->produit->lire && $user->rights->stock->lire);
$newmenu->add("/product/stock/productlot_list.php", $langs->trans("LotSerial"), 1, $user->rights->produit->lire && $user->rights->stock->lire);
}
if (isModEnabled('variants')) {

View File

@ -24,6 +24,7 @@ StockAtDateInFuture=Date in the future
StocksByLotSerial=Stocks by lot/serial
LotSerial=Lots/Serials
LotSerialList=List of lot/serials
SubjectToLotSerialOnly=Products subject to lot/serial only
Movements=Movements
ErrorWarehouseRefRequired=Warehouse reference name is required
ListOfWarehouses=List of warehouses

View File

@ -41,7 +41,7 @@ $snom = GETPOST("snom", 'alpha');
$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
$type = GETPOSTISSET('type') ? GETPOST('type', 'int') : Product::TYPE_PRODUCT;
$search_barcode = GETPOST("search_barcode", 'alpha');
$toolowstock = GETPOST('toolowstock');
$search_toolowstock = GETPOST('search_toolowstock');
$tosell = GETPOST("tosell");
$tobuy = GETPOST("tobuy");
$fourn_id = GETPOST("fourn_id", 'int');
@ -116,7 +116,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$tobuy = "";
$search_sale = "";
$search_categ = "";
$toolowstock = '';
$search_toolowstock = '';
$fourn_id = '';
$sbarcode = '';
$search_stock_physique = '';
@ -210,7 +210,7 @@ $parameters = array();
$reshook = $hookmanager->executeHooks('printFieldSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql_having = '';
if ($toolowstock) {
if ($search_toolowstock) {
$sql_having .= " HAVING SUM(".$db->ifsql('s.reel IS NULL', '0', 's.reel').") < p.seuil_stock_alerte";
}
if ($search_stock_physique != '') {
@ -296,8 +296,8 @@ if ($resql) {
if ($search_categ > 0) {
$param .= "&search_categ=".urlencode($search_categ);
}
if ($toolowstock) {
$param .= "&toolowstock=".urlencode($toolowstock);
if ($search_toolowstock) {
$param .= "&search_toolowstock=".urlencode($search_toolowstock);
}
if ($sbarcode) {
$param .= "&sbarcode=".urlencode($sbarcode);
@ -336,7 +336,7 @@ if ($resql) {
}
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans("StockTooLow").' <input type="checkbox" name="toolowstock" value="1"'.($toolowstock ? ' checked' : '').'>';
$moreforfilter .= '<label for="search_toolowstock">'.$langs->trans("StockTooLow").' </label><input type="checkbox" id="search_toolowstock" name="search_toolowstock" value="1"'.($search_toolowstock ? ' checked' : '').'>';
$moreforfilter .= '</div>';
if (!empty($moreforfilter)) {

View File

@ -52,7 +52,8 @@ $type = GETPOSTISSET('type') ? GETPOST('type', 'int') : Product::TYPE_PRODUCT;
$search_barcode = GETPOST("search_barcode", 'alpha');
$search_warehouse = GETPOST('search_warehouse', 'alpha');
$search_batch = GETPOST('search_batch', 'alpha');
$toolowstock = GETPOST('toolowstock');
$search_toolowstock = GETPOST('search_toolowstock');
$search_subjecttolotserial = GETPOST('search_subjecttolotserial');
$tosell = GETPOST("tosell");
$tobuy = GETPOST("tobuy");
$fourn_id = GETPOST("fourn_id", 'int');
@ -173,7 +174,8 @@ if (empty($reshook)) {
$tobuy = "";
$search_sale = "";
$search_categ = "";
$toolowstock = '';
$search_toolowstock = '';
$search_subjecttolotserial = '';
$search_batch = '';
$search_warehouse = '';
$fourn_id = '';
@ -252,6 +254,9 @@ if (dol_strlen($type)) {
$sql .= " AND p.fk_product_type <> '1'";
}
}
if ($search_subjecttolotserial) {
$sql .= " AND p.tobatch > 0";
}
if ($sref) {
$sql .= natural_search("p.ref", $sref);
}
@ -318,7 +323,7 @@ $sql .= " e.ref, e.lieu, e.fk_parent,";
$sql .= " pb.batch, pb.eatby, pb.sellby,";
$sql .= " pl.rowid, pl.eatby, pl.sellby";
$sql_having = '';
if ($toolowstock) {
if ($search_toolowstock) {
$sql_having .= " HAVING SUM(".$db->ifsql('ps.reel IS NULL', '0', 'ps.reel').") < p.seuil_stock_alerte"; // Not used yet
}
if ($search_stock_physique != '') {
@ -437,8 +442,11 @@ if ($sbarcode) {
if ($search_warehouse) {
$param .= "&search_warehouse=".urlencode($search_warehouse);
}
if ($toolowstock) {
$param .= "&toolowstock=".urlencode($toolowstock);
if ($search_toolowstock) {
$param .= "&search_toolowstock=".urlencode($search_toolowstock);
}
if ($search_subjecttolotserial) {
$param .= "&search_subjecttolotserial=".urlencode($search_subjecttolotserial);
}
if ($search_sale) {
$param .= "&search_sale=".urlencode($search_sale);
@ -487,7 +495,7 @@ if (!empty($conf->categorie->enabled)) {
$moreforfilter .= $htmlother->select_categories(Categorie::TYPE_PRODUCT, $search_categ, 'search_categ', 1);
$moreforfilter .= '</div>';
}
//$moreforfilter.=$langs->trans("StockTooLow").' <input type="checkbox" name="toolowstock" value="1"'.($toolowstock?' checked':'').'>';
$moreforfilter.='<label for="search_subjecttolotserial">'.$langs->trans("SubjectToLotSerialOnly").' </label><input type="checkbox" id="search_subjecttolotserial" name="search_subjecttolotserial" value="1"'.($search_subjecttolotserial?' checked':'').'>';
if (!empty($moreforfilter)) {
print '<div class="liste_titre liste_titre_bydiv centpercent">';