From 475357448a6491c6ba23db3b53e537918822c94e Mon Sep 17 00:00:00 2001 From: pascal Date: Sun, 3 Dec 2023 15:25:22 +0100 Subject: [PATCH 1/6] FIX #26912 --- htdocs/admin/barcode.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index 47e79ab9cc6..2c1cf0bef0b 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -181,7 +181,7 @@ foreach ($dirbarcode as $reldir) { } if ($module->isEnabled()) { - $barcodelist[$filebis] = $module->info(); + $barcodelist[$filebis] = $module->info($langs); } } } From 7c266a58206c65a135b4cda4ccf7ffef927825b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 4 Dec 2023 21:48:27 +0100 Subject: [PATCH 2/6] fix auguria --- htdocs/core/menus/init_menu_auguria.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 344418ce20e..d9e6ad3f370 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -18,7 +18,7 @@ insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, left insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity, prefix) values ( 16__+MAX_llx_menu__, 'bom|mrp', 'isModEnabled("bom") || isModEnabled("mrp")', __HANDLER__, 'top', 'mrp', '', 0, '/mrp/index.php?mainmenu=mrp&leftmenu=', 'MRP', -1, 'mrp', '$user->hasRight("bom","read") || $user->hasRight("mrp","read")', '', 0, 31, __ENTITY__, ''); insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity, prefix) values ( 7__+MAX_llx_menu__, 'projet', 'isModEnabled("project")', __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->hasRight("projet","lire")', '', 2, 32, __ENTITY__, ''); insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity, prefix) values ( 5__+MAX_llx_menu__, 'propal|commande|fournisseur|supplier_order|supplier_invoice|contrat|ficheinter', 'isModEnabled("propal") || isModEnabled("commande") || isModEnabled("supplier_order") || isModEnabled("contrat") || isModEnabled("ficheinter")', __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->hasRight("societe","lire") || $user->hasRight("societe","contact","lire")', '', 2, 40, __ENTITY__, ''); -insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity, prefix) values ( 6__+MAX_llx_menu__, 'facture|don|tax|salaries|loan|banque', 'isModEnabled("comptabilite") || isModEnabled("accounting") || isModEnabled("facture") || isModEnabled("don") || isModEnabled("tax") || isModEnabled("salaries") || isModEnabled("supplier_invoice") || isModEnabled("loan") || isModEnabled("banque")', __HANDLER__, 'top', 'billing', '', 0, '/compta/index.php?mainmenu=billing&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->hasRight('facture','lire') || $user->hasRight('don','lire') || $user->hasRight('tax','charges','lire') || $user->hasRight('salaries','read') || $user->hasRight('loan','read') || $user->hasRight("banque","lire") || $user->hasRight("fournisseur","facture","lire") || $user->hasRight("supplier_invoice","read")', '', 2, 50, __ENTITY__, ''); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity, prefix) values ( 6__+MAX_llx_menu__, 'facture|don|tax|salaries|loan|banque', 'isModEnabled("comptabilite") || isModEnabled("accounting") || isModEnabled("facture") || isModEnabled("don") || isModEnabled("tax") || isModEnabled("salaries") || isModEnabled("supplier_invoice") || isModEnabled("loan") || isModEnabled("banque")', __HANDLER__, 'top', 'billing', '', 0, '/compta/index.php?mainmenu=billing&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->hasRight("facture","lire") || $user->hasRight("don","lire") || $user->hasRight("tax","charges","lire") || $user->hasRight("salaries","read") || $user->hasRight("loan","read") || $user->hasRight("banque","lire") || $user->hasRight("fournisseur","facture","lire") || $user->hasRight("supplier_invoice","read")', '', 2, 50, __ENTITY__, ''); insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity, prefix) values ( 14__+MAX_llx_menu__, 'banque|prelevement', 'isModEnabled("banque") || isModEnabled("prelevement")', __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/list.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->hasRight("banque","lire") || $user->hasRight("prelevement","bons","lire")', '', 0, 52, __ENTITY__, ''); insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity, prefix) values ( 9__+MAX_llx_menu__, 'comptabilite|accounting|asset', 'isModEnabled("comptabilite") || isModEnabled("accounting") || isModEnabled("asset")', __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=accountancy', 'MenuAccountancy', -1, 'main', '$user->hasRight("compta","resultat","lire") || $user->hasRight("accounting","mouvements","lire") || $user->hasRight("asset","read")', '', 2, 54, __ENTITY__, ''); insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity, prefix) values ( 8__+MAX_llx_menu__, '', '', __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&leftmenu=', 'Tools', -1, 'other', '', '', 2, 90, __ENTITY__, ''); From 92161b67cdc24475b1f15f20a2e50f2ea95dcf67 Mon Sep 17 00:00:00 2001 From: Dario Contrino Date: Mon, 4 Dec 2023 21:51:02 +0100 Subject: [PATCH 3/6] FIX #26965 add check for global variable VARIANT_ALLOW_STOCK_MOVEMENT_ON_VARIANT_PARENT Adding an OR clause in the check if product is a variant. Same structure as in check if user has rights to create movement. --- 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 bd1897c47b8..c5792768256 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -959,7 +959,7 @@ if (empty($reshook)) { } -if (!$variants) { +if (!$variants || getDolGlobalString('VARIANT_ALLOW_STOCK_MOVEMENT_ON_VARIANT_PARENT')) { /* * Stock detail (by warehouse). May go down into batch details. */ From 829adfcf5d1a340481ed61489df22b7f11ec601a Mon Sep 17 00:00:00 2001 From: David Date: Tue, 5 Dec 2023 11:19:13 +0100 Subject: [PATCH 4/6] FIX: discount rate was rounded to 2 digits price2num() was called with 2 params instead of 3, the second one being '2', the rate was rounded to 2 digits. --- htdocs/contrat/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 71370dbc04c..fc10785c6d9 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -462,7 +462,7 @@ if (empty($reshook)) { $tva_tx = GETPOST('tva_tx', 'alpha'); $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS'); - $remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef), 2) : 0); + $remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef), '', 2) : 0); if (empty($remise_percent)) { $remise_percent = 0; } @@ -766,7 +766,7 @@ if (empty($reshook)) { // TODO Use object->updateline instead objedtline->update $price_ht = price2num(GETPOST('elprice'), 'MU'); - $remise_percent = price2num(GETPOST('elremise_percent'), 2); + $remise_percent = price2num(GETPOST('elremise_percent'), '', 2); if ($remise_percent > 0) { $remise = round(($price_ht * $remise_percent / 100), 2); $price_ht = ($price_ht - $remise); From 0dd46d1b2c52254926968446301a5011655e7e43 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 5 Dec 2023 14:12:43 +0100 Subject: [PATCH 5/6] FIX Define global (detected undefined phan #26480) --- htdocs/categories/class/categorie.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 0885d0369e9..d3b0288e790 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -542,6 +542,8 @@ class Categorie extends CommonObject */ public function update(User $user) { + global $langs; + $error = 0; // Clean parameters From cdf9d045d693290cdc72de88ef39992b5ce15177 Mon Sep 17 00:00:00 2001 From: Sylvain Legrand Date: Wed, 6 Dec 2023 06:41:08 +0100 Subject: [PATCH 6/6] Update card.php When using a discount or credit equal to the invoice amount, set that invoice as paid. --- htdocs/fourn/facture/card.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 1f338317902..90446c20584 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -510,6 +510,7 @@ if (empty($reshook)) { dol_print_error($db, $object->error); } } elseif ($action == "setabsolutediscount" && $usercancreate) { + $db->begin(); // We use the credit to reduce amount of invoice if (GETPOST("remise_id", "int")) { $ret = $object->fetch($id); @@ -530,7 +531,8 @@ if (empty($reshook)) { //var_dump($object->getRemainToPay(0)); //var_dump($discount->amount_ttc);exit; - if (price2num($discount->amount_ttc) > price2num($object->getRemainToPay(0))) { + $remaintopay = $object->getRemainToPay(0); + if (price2num($discount->amount_ttc) > price2num($remaintopay)) { // TODO Split the discount in 2 automatically $error++; setEventMessages($langs->trans("ErrorDiscountLargerThanRemainToPaySplitItBefore"), null, 'errors'); @@ -539,12 +541,23 @@ if (empty($reshook)) { if (!$error) { $result = $discount->link_to_invoice(0, $id); if ($result < 0) { + $error++; setEventMessages($discount->error, $discount->errors, 'errors'); } } + if (!$error) { + $newremaintopay = $object->getRemainToPay(0); + if ($newremaintopay == 0) { + $object->setPaid($user); + } + } } - - if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) { + if (!$error) { + $db->commit(); + } else { + $db->rollback(); + } + if (empty($error) && !getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) { $outputlangs = $langs; $newlang = ''; if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) {