From fce81a4bf143253ff342be4a719a76a9669407e0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 3 Jul 2020 01:30:53 +0200 Subject: [PATCH] Rename var and fix position of checkbox --- htdocs/core/lib/functions.lib.php | 4 +-- htdocs/langs/en_US/stocks.lang | 1 + htdocs/product/stock/replenish.php | 48 ++++++++++++++---------------- 3 files changed, 25 insertions(+), 28 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index cd95fe40e5d..538bc20de20 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3055,7 +3055,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'accounting'=>'chart-line', 'category'=>'tag', 'dollyrevert'=>'dolly', 'hrm'=>'umbrella-beach', 'margin'=>'calculator', 'members'=>'users', 'ticket'=>'ticket-alt', 'globe'=>'external-link-alt', 'lot'=>'barcode', 'email'=>'at', - 'edit'=>'pencil-alt', 'grip_title'=>'arrows-alt', 'grip'=>'arrows-alt', 'help'=>'info-circle', + 'edit'=>'pencil-alt', 'grip_title'=>'arrows-alt', 'grip'=>'arrows-alt', 'help'=>'question-circle', 'generic'=>'file', 'holiday'=>'umbrella-beach', 'label'=>'layer-group', 'member'=>'users', 'mrp'=>'cubes', 'trip'=>'wallet', 'group'=>'users', 'sign-out'=>'sign-out-alt', @@ -3143,7 +3143,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ $arrayconvpictotocolor = array( 'address'=>'#37a', 'building'=>'#37a', 'bom'=>'#a69944', 'companies'=>'#37a', 'company'=>'#37a', 'contact'=>'#37a', 'dynamicprice'=>'#a69944', - 'edit'=>'#444', 'note'=>'#999', 'error'=>'', 'listlight'=>'#999', + 'edit'=>'#444', 'note'=>'#999', 'error'=>'', 'help'=>'#bbb', 'listlight'=>'#999', 'dolly'=>'#a69944', 'dollyrevert'=>'#a69944', 'lot'=>'#a69944', 'map-marker-alt'=>'#aaa', 'mrp'=>'#a69944', 'product'=>'#a69944', 'service'=>'#a69944', 'stock'=>'#a69944', 'other'=>'#ddd', diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index c9fd88f920d..7f4d8b0c72f 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -34,6 +34,7 @@ StockMovementForId=Movement ID %d ListMouvementStockProject=List of stock movements associated to project StocksArea=Warehouses area AllWarehouses=All warehouses +IncludeEmptyDesiredStock=Include also undefined desired stock IncludeAlsoDraftOrders=Include also draft orders Location=Location LocationSummary=Short name location diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index a4fb63ae899..d5eeac44995 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -55,7 +55,7 @@ $sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', $type = GETPOST('type', 'int'); $tobuy = GETPOST('tobuy', 'int'); $salert = GETPOST('salert', 'alpha'); -$allalert = GETPOST('allalert', 'alpha'); +$includeproductswithoutdesiredqty = GETPOST('includeproductswithoutdesiredqty', 'alpha'); $mode = GETPOST('mode', 'alpha'); $draftorder = GETPOST('draftorder', 'alpha'); @@ -111,7 +111,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_label = ''; $sall = ''; $salert = ''; - $allalert = ''; + $includeproductswithoutdesiredqty = ''; $draftorder = ''; } if ($draftorder == 'on') $draftchecked = "checked"; @@ -430,7 +430,7 @@ if ($usevirtualstock) $sql .= ' ('.$sqldesiredtock.' >= 0 AND ('.$sqldesiredtock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; $sql .= ' - ('.$sqlCommandesCli.' - '.$sqlExpeditionsCli.') + ('.$sqlCommandesFourn.' - '.$sqlReceptionFourn.') + ('.$sqlProductionToProduce.' - '.$sqlProductionToConsume.')))'; $sql .= ' OR '; - if ($allalert == 'on') { + if ($includeproductswithoutdesiredqty == 'on') { $sql .= ' (('.$sqlalertstock.' >= 0 OR '.$sqlalertstock.' IS NULL) AND ('.$db->ifsql("$sqlalertstock IS NULL", "0", $sqlalertstock).' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; } else { $sql .= ' ('.$sqlalertstock.' >= 0 AND ('.$sqlalertstock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; @@ -441,7 +441,7 @@ if ($usevirtualstock) if ($salert == 'on') // Option to see when stock is lower than alert { $sql .= ' AND (('; - if ($allalert == 'on') { + if ($includeproductswithoutdesiredqty == 'on') { $sql .= $sqlalertstock.' >= 0 OR '.$sqlalertstock.' IS NULL) AND ('.$db->ifsql("$sqlalertstock IS NULL", "0", $sqlalertstock).' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; } else { $sql .= $sqlalertstock.' >= 0 AND ('.$sqlalertstock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; @@ -452,7 +452,7 @@ if ($usevirtualstock) } } else { $sql .= ' HAVING (('.$sqldesiredtock.' >= 0 AND ('.$sqldesiredtock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')))'; - if ($allalert == 'on') { + if ($includeproductswithoutdesiredqty == 'on') { $sql .= ' OR (('.$sqlalertstock.' >= 0 OR '.$sqlalertstock.' IS NULL) AND ('.$db->ifsql("$sqlalertstock IS NULL", "0", $sqlalertstock).' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").'))))'; } else { $sql .= ' OR ('.$sqlalertstock.' >= 0 AND ('.$sqlalertstock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").'))))'; @@ -460,7 +460,7 @@ if ($usevirtualstock) if ($salert == 'on') // Option to see when stock is lower than alert { - if ($allalert == 'on') { + if ($includeproductswithoutdesiredqty == 'on') { $sql .= ' AND (('.$sqlalertstock.' >= 0 OR '.$sqlalertstock.' IS NULL) AND ('.$db->ifsql("$sqlalertstock IS NULL", "0", $sqlalertstock).' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')))'; } else { $sql .= ' AND ('.$sqlalertstock.' >= 0 AND ('.$sqlalertstock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')))'; @@ -469,9 +469,9 @@ if ($usevirtualstock) } } -$allalertchecked = ''; -if ($allalert == 'on') { - $allalertchecked = 'checked'; +$includeproductswithoutdesiredqtychecked = ''; +if ($includeproductswithoutdesiredqty == 'on') { + $includeproductswithoutdesiredqtychecked = 'checked'; } // Add where from hooks @@ -547,7 +547,7 @@ print ''; print ''; print ''; print ''; -print ''; +print ''; print ''; print ''; if ($limit > 0 && $limit != $conf->liste_limit) { @@ -629,7 +629,7 @@ if ($limit > 0 && $limit != $conf->liste_limit) { } $param = (isset($type) ? '&type='.$type : ''); -$param .= '&fourn_id='.$fourn_id.'&search_label='.$search_label.'&allalert='.$allalert.'&salert='.$salert.'&draftorder='.$draftorder; +$param .= '&fourn_id='.$fourn_id.'&search_label='.$search_label.'&includeproductswithoutdesiredqty='.$includeproductswithoutdesiredqty.'&salert='.$salert.'&draftorder='.$draftorder; $param .= '&search_ref='.$search_ref; $param .= '&mode='.$mode; $param .= '&fk_supplier='.$fk_supplier; @@ -686,8 +686,8 @@ print ' '; print ''; print ''; if (!empty($conf->service->enabled) && $type == 1) print ' '; -print ' '; -print ''.$langs->trans('IncludeProductWithUndefinedAlerts').' '; +print ''.$form->textwithpicto($langs->trans('IncludeEmptyDesiredStock'), $langs->trans('IncludeProductWithUndefinedAlerts')).' '; +print ''; print ''.$langs->trans('AlertOnly').' '; print ''.$langs->trans('IncludeAlsoDraftOrders').' '; print ' '; @@ -696,7 +696,7 @@ $parameters = array('param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sort $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; -print ''; +print ''; $searchpicto = $form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; @@ -785,26 +785,23 @@ while ($i < ($limit ? min($num, $limit) : $num)) if (empty($usevirtualstock)) $stocktobuy = max(max($desiredstock, $alertstock) - $stock - $ordered, 0); else $stocktobuy = max(max($desiredstock, $alertstock) - $stock, 0); //ordered is already in $stock in virtual mode - $disabled = ''; + $picto = ''; if ($ordered > 0) { - $stockforcompare = $usevirtualstock ? $stock : $stock + $ordered; - if ($stockforcompare >= $desiredstock) + $stockforcompare = ($usevirtualstock ? $stock : $stock + $ordered); + /*if ($stockforcompare >= $desiredstock) { - $picto = img_picto('', './img/yes', '', 1); - $disabled = 'disabled'; + $picto = img_picto('', 'help'); } else { - $picto = img_picto('', './img/no', '', 1); - } + $picto = img_picto('', 'help'); + }*/ } else { - //$picto = img_help('',$langs->trans("NoPendingReceptionOnSupplierOrder")); - $picto = img_picto($langs->trans("NoPendingReceptionOnSupplierOrder"), './img/no', '', 1); + $picto = img_picto($langs->trans("NoPendingReceptionOnSupplierOrder"), 'help'); } print ''; // Select field - //print ''; print ''; print ''.$prod->getNomUrl(1, '').''; @@ -837,10 +834,9 @@ while ($i < ($limit ? min($num, $limit) : $num)) print ''.$warning.$stock.''; // Already ordered - print ''.$ordered.' '.$picto.''; + print ''.$ordered.' '.$picto.''; // To order - //print ''; print ''; // Supplier