From 68130ec274c6c3bc3690d8f696e0ab2ea0183a5d Mon Sep 17 00:00:00 2001 From: atm-florian Date: Fri, 16 Jul 2021 19:24:34 +0200 Subject: [PATCH 001/135] FIX: line extrafields are inoperative in dispatch cards even when they exist --- htdocs/reception/card.php | 68 ++++++++++++++++++++++++++------------- 1 file changed, 46 insertions(+), 22 deletions(-) diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 8a4d5edc611..70dfd7f28b0 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -876,7 +876,14 @@ if ($action == 'create') // Reception lines $numAsked = 0; + + /** + * @var array $suffix2numAsked map HTTP query parameter suffixes (like '1_0') to line indices so that + * extrafields from HTTP query can be assigned to the correct dispatch line + */ + $suffix2numAsked = array(); $dispatchLines = array(); + foreach ($_POST as $key => $value) { // If create form is coming from the button "Create Reception" of previous page @@ -884,14 +891,16 @@ if ($action == 'create') $reg = array(); if (preg_match('/^product_([0-9]+)_([0-9]+)$/i', $key, $reg)) { $numAsked++; + $paramSuffix = $reg[1] . '_' . $reg[2]; + $suffix2numAsked[$paramSuffix] = $numAsked; // $numline=$reg[2] + 1; // line of product $numline = $numAsked; - $prod = "product_".$reg[1].'_'.$reg[2]; - $qty = "qty_".$reg[1].'_'.$reg[2]; - $ent = "entrepot_".$reg[1].'_'.$reg[2]; - $pu = "pu_".$reg[1].'_'.$reg[2]; // This is unit price including discount - $fk_commandefourndet = "fk_commandefourndet_".$reg[1].'_'.$reg[2]; + $prod = "product_" . $paramSuffix; + $qty = "qty_" . $paramSuffix; + $ent = "entrepot_" . $paramSuffix; + $pu = "pu_" . $paramSuffix; // This is unit price including discount + $fk_commandefourndet = "fk_commandefourndet_" . $paramSuffix; $dispatchLines[$numAsked] = array('prod' => GETPOST($prod, 'int'), 'qty' =>GETPOST($qty), 'ent' =>GETPOST($ent, 'int'), 'pu' =>GETPOST($pu), 'comment' =>GETPOST('comment'), 'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int')); } @@ -899,41 +908,51 @@ if ($action == 'create') if (preg_match('/^product_batch_([0-9]+)_([0-9]+)$/i', $key, $reg)) { $numAsked++; + $paramSuffix = $reg[1] . '_' . $reg[2]; + $suffix2numAsked[$paramSuffix] = $numAsked; // eat-by date dispatch // $numline=$reg[2] + 1; // line of product $numline = $numAsked; - $prod = 'product_batch_'.$reg[1].'_'.$reg[2]; - $qty = 'qty_'.$reg[1].'_'.$reg[2]; - $ent = 'entrepot_'.$reg[1].'_'.$reg[2]; - $pu = 'pu_'.$reg[1].'_'.$reg[2]; - $lot = 'lot_number_'.$reg[1].'_'.$reg[2]; - $dDLUO = dol_mktime(12, 0, 0, $_POST['dluo_'.$reg[1].'_'.$reg[2].'month'], $_POST['dluo_'.$reg[1].'_'.$reg[2].'day'], $_POST['dluo_'.$reg[1].'_'.$reg[2].'year']); - $dDLC = dol_mktime(12, 0, 0, $_POST['dlc_'.$reg[1].'_'.$reg[2].'month'], $_POST['dlc_'.$reg[1].'_'.$reg[2].'day'], $_POST['dlc_'.$reg[1].'_'.$reg[2].'year']); - $fk_commandefourndet = 'fk_commandefourndet_'.$reg[1].'_'.$reg[2]; + $prod = 'product_batch_' . $paramSuffix; + $qty = 'qty_' . $paramSuffix; + $ent = 'entrepot_' . $paramSuffix; + $pu = 'pu_' . $paramSuffix; + $lot = 'lot_number_' . $paramSuffix; + $dDLUO = dol_mktime(12, 0, 0, $_POST['dluo_'.$paramSuffix.'month'], $_POST['dluo_'.$paramSuffix.'day'], $_POST['dluo_'.$paramSuffix.'year']); + $dDLC = dol_mktime(12, 0, 0, $_POST['dlc_'.$paramSuffix.'month'], $_POST['dlc_'.$paramSuffix.'day'], $_POST['dlc_'.$paramSuffix.'year']); + $fk_commandefourndet = 'fk_commandefourndet_'.$paramSuffix; $dispatchLines[$numAsked] = array('prod' => GETPOST($prod, 'int'), 'qty' =>GETPOST($qty), 'ent' =>GETPOST($ent, 'int'), 'pu' =>GETPOST($pu), 'comment' =>GETPOST('comment'), 'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int'), 'DLC'=> $dDLC, 'DLUO'=> $dDLUO, 'lot'=> GETPOST($lot, 'alpha')); } // If create form is coming from same page post was sent but an error occured if (preg_match('/^productid([0-9]+)$/i', $key, $reg)) { $numAsked++; + $paramSuffix = $reg[1]; + $suffix2numAsked[$paramSuffix] = $numAsked; // eat-by date dispatch // $numline=$reg[2] + 1; // line of product $numline = $numAsked; - $prod = 'productid'.$reg[1]; - $comment = 'comment'.$reg[1]; - $qty = 'qtyl'.$reg[1]; - $ent = 'entl'.$reg[1]; - $pu = 'pul'.$reg[1]; - $lot = 'batch'.$reg[1]; - $dDLUO = dol_mktime(12, 0, 0, GETPOST('dluo'.$reg[1].'month', 'int'), GETPOST('dluo'.$reg[1].'day', 'int'), GETPOST('dluo'.$reg[1].'year', 'int')); - $dDLC = dol_mktime(12, 0, 0, GETPOST('dlc'.$reg[1].'month', 'int'), GETPOST('dlc'.$reg[1].'day', 'int'), GETPOST('dlc'.$reg[1].'year', 'int')); - $fk_commandefourndet = 'fk_commandefournisseurdet'.$reg[1]; + $prod = 'productid'.$paramSuffix; + $comment = 'comment'.$paramSuffix; + $qty = 'qtyl'.$paramSuffix; + $ent = 'entl'.$paramSuffix; + $pu = 'pul'.$paramSuffix; + $lot = 'batch'.$paramSuffix; + $dDLUO = dol_mktime(12, 0, 0, GETPOST('dluo'.$paramSuffix.'month', 'int'), GETPOST('dluo'.$paramSuffix.'day', 'int'), GETPOST('dluo'.$paramSuffix.'year', 'int')); + $dDLC = dol_mktime(12, 0, 0, GETPOST('dlc'.$paramSuffix.'month', 'int'), GETPOST('dlc'.$paramSuffix.'day', 'int'), GETPOST('dlc'.$paramSuffix.'year', 'int')); + $fk_commandefourndet = 'fk_commandefournisseurdet'.$paramSuffix; $dispatchLines[$numAsked] = array('prod' => GETPOST($prod, 'int'), 'qty' =>GETPOST($qty), 'ent' =>GETPOST($ent, 'int'), 'pu' =>GETPOST($pu), 'comment' =>GETPOST($comment), 'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int'), 'DLC'=> $dDLC, 'DLUO'=> $dDLUO, 'lot'=> GETPOST($lot, 'alpha')); } } + // If extrafield values are passed in the HTTP query, assign them to the correct dispatch line + // Note that if an extrafield with the same name exists in the origin supplier order line, the value + // from the HTTP query will be ignored + foreach ($suffix2numAsked as $suffix => $n) { + $dispatchLines[$n]['array_options'] = $extrafields->getOptionalsFromPost('commande_fournisseur_dispatch', '_' . $suffix, ''); + } print ' '; diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index f175cb083ff..015a33b202f 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -259,11 +259,13 @@ ShowAllBatchByDefault=By default, show batch details on product "stock" tab CollapseBatchDetailHelp=You can set batch detail default display in stocks module configuration ErrorWrongBarcodemode=Unknown Barcode mode ProductDoesNotExist=Product does not exist -ErrorSameBatchNumber=Same batch number found in inventory list +ErrorSameBatchNumber=Several record for the batch number were found in the inventory sheet. No way to know which one to increase. ProductBatchDoesNotExist=Product with batch/serial does not exist ProductBarcodeDoesNotExist=Product with barcode does not exist WarehouseId=Warehouse ID WarehouseRef=Warehouse Ref SaveQtyFirst=Save the real inventoried quantities first, before asking creation of the stock movement. InventoryStartedShort=Started -ErrorOnElementsInventory=Scan was aborted due to following barcode or batch number on error \ No newline at end of file +ErrorOnElementsInventory=Operation canceled for the following reason: +ErrorCantFindCodeInInventory=Can't find the following code in inventory +QtyWasAddedToTheScannedBarcode=Success !! The quantity was added to all the requested barcode. You can close the Scanner tool. \ No newline at end of file diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index c467b4367df..658a521fcc1 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -343,10 +343,15 @@ if (empty($reshook)) { $result = $tmp->create($user); if ($result < 0) { if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { - setEventMessages($langs->trans("DuplicateRecord"), null, 'errors'); + $langs->load("errors"); + setEventMessages($langs->trans("ErrorRecordAlreadyExists"), null, 'errors'); } else { dol_print_error($db, $tmp->error, $tmp->errors); } + } else { + // Clear var + $_POST['batch'] = ''; + $_POST['qtytoadd'] = ''; } } } @@ -606,18 +611,28 @@ if ($object->id > 0) { print ''; + // Link to autofill + print ''.img_picto('', 'autofill', 'class="paddingrightonly"').$langs->trans('AutofillWithExpected').''; + print ''; + + // Link to reset qty + print ''.img_picto('', 'eraser', 'class="paddingrightonly"').$langs->trans("ClearQtys").''; + } else { + print ''.$langs->trans("Save").''."\n"; + } } print '
'; print '
'; @@ -623,7 +621,7 @@ if ($object->id > 0) { var barcodemode = $("input[name=barcodemode]:checked").val(); var barcodeproductqty = $("input[name=barcodeproductqty]").val(); var textarea = $("textarea[name=barcodelist]").val(); - var textarray = textarea.split(/[\s,]+/); + var textarray = textarea.split(/[\s,;]+/); var tabproduct = []; errortab1 = []; errortab2 = []; @@ -813,7 +811,12 @@ if ($object->id > 0) { //Call method to undo changes in real qty print ' +
+ +
+ + + From 27134a1f914c013dd43dd75984ec71e7bd5adc24 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Dec 2021 15:44:04 +0100 Subject: [PATCH 135/135] Fix position of menu --- htdocs/core/menus/init_menu_auguria.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index b032ba5beb4..3b173cecb26 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -283,6 +283,8 @@ 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->accounting->enabled && $conf->expensereport->enabled && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS)', __HANDLER__, 'left', 2420__+MAX_llx_menu__, 'accountancy', 'accountancy_dispatch_expensereport', 2400__+MAX_llx_menu__, '/accountancy/expensereport/index.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_expensereport', 'ExpenseReportsVentilation', 1, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 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->accounting->enabled && $conf->expensereport->enabled && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS) && $leftmenu=="accountancy_dispatch_expensereport"', __HANDLER__, 'left', 2421__+MAX_llx_menu__, 'accountancy', '', 2420__+MAX_llx_menu__, '/accountancy/expensereport/list.php?mainmenu=accountancy', 'ToDispatch', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 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->accounting->enabled && $conf->expensereport->enabled && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS) && $leftmenu=="accountancy_dispatch_expensereport"', __HANDLER__, 'left', 2422__+MAX_llx_menu__, 'accountancy', '', 2420__+MAX_llx_menu__, '/accountancy/expensereport/lines.php?mainmenu=accountancy', 'Dispatched', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 7, __ENTITY__); +-- Export accounting documents +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->comptabilite->enabled || $conf->accounting->enabled', __HANDLER__, 'left', 2436__+MAX_llx_menu__, 'accountancy', 'accountancy_files', 2400__+MAX_llx_menu__, '/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files', 'AccountantFiles', 1, 'accountancy', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire', '', 0, 16, __ENTITY__); -- Journals --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->accounting->enabled', __HANDLER__, 'left', 2705__+MAX_llx_menu__, 'accountancy', '', 2400__+MAX_llx_menu__, '', 'Journalization', 1, 'main', '$user->rights->accounting->comptarapport->lire', '', 0, 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->accounting->enabled', __HANDLER__, 'left', 2707__+MAX_llx_menu__, 'accountancy', '', 2705__+MAX_llx_menu__, '/accountancy/journal/bankjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal=3', 'BankJournal', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__); @@ -295,8 +297,6 @@ 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->accounting->enabled', __HANDLER__, 'left', 2432__+MAX_llx_menu__, 'accountancy', 'bookkeeping', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/listbyaccount.php?mainmenu=accountancy&leftmenu=accountancy_bookeeping', 'Bookkeeping', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 12, __ENTITY__); -- Journals 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->accounting->enabled', __HANDLER__, 'left', 2434__+MAX_llx_menu__, 'accountancy', 'bookkeeping', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/list.php?mainmenu=accountancy&leftmenu=accountancy_bookeeping', 'Journals', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 15, __ENTITY__); --- Export accounting documents -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->comptabilite->enabled || $conf->accounting->enabled', __HANDLER__, 'left', 2436__+MAX_llx_menu__, 'accountancy', 'accountancy_files', 2400__+MAX_llx_menu__, '/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files', 'AccountantFiles', 1, 'accountancy', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire', '', 0, 16, __ENTITY__); -- Closure 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->accounting->enabled', __HANDLER__, 'left', 2437__+MAX_llx_menu__, 'accountancy', 'accountancy_closure', 2400__+MAX_llx_menu__, '/accountancy/closure/index.php?mainmenu=accountancy&leftmenu=accountancy_closure', 'MenuAccountancyClosure', 1, 'accountancy', '$user->rights->accounting->fiscalyear->write', '', 0, 17, __ENTITY__); -- Reports