From 7f6d993040979d61a4a359d722cb2109c26c90a1 Mon Sep 17 00:00:00 2001 From: David Pareja Rodriguez Date: Tue, 24 Jan 2023 10:54:48 +0100 Subject: [PATCH 01/11] Encase database name in backticks --- htdocs/core/db/mysqli.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index fa24e4a70ac..3514777dd45 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -678,7 +678,7 @@ class DoliDBMysqli extends DoliDB } $tmpdatabase = preg_replace('/[^a-z0-9\.\-\_]/i', '', $database); - $sql = "SHOW TABLES FROM ".$tmpdatabase." ".$like.";"; + $sql = "SHOW TABLES FROM `".$tmpdatabase."` ".$like.";"; //print $sql; $result = $this->query($sql); if ($result) { From 59f163f6998d5929607528513e305e5538539332 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Jan 2023 02:12:42 +0100 Subject: [PATCH 02/11] Fix regression --- htdocs/expensereport/card.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 0756cb1bc7f..0201dfdd7f6 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1158,12 +1158,17 @@ if (empty($reshook)) { unset($date); } else { + $error++; setEventMessages($object->error, $object->errors, 'errors'); } } - header("Location: ".$_SERVER["PHP_SELF"]."?id=".GETPOST('id', 'int')); - exit; + if (!$error) { + header("Location: ".$_SERVER["PHP_SELF"]."?id=".GETPOST('id', 'int')); + exit; + } else { + $action = ''; + } } if ($action == 'confirm_delete_line' && GETPOST("confirm", 'alpha') == "yes" && $user->rights->expensereport->creer) { From 777cfd5753a3d41fe75d3724a736a1e81e0426c8 Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Thu, 26 Jan 2023 15:26:24 +0100 Subject: [PATCH 03/11] FIX : Sub-Bom costs were not good --- htdocs/bom/tpl/objectline_view.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php index 5992578a6e0..2df13e9af83 100644 --- a/htdocs/bom/tpl/objectline_view.tpl.php +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -171,7 +171,7 @@ $tmpbom->calculateCosts(); print ''; $coldisplay++; if (!empty($line->fk_bom_child)) { - echo ''.price($tmpbom->total_cost).''; + echo ''.price($tmpbom->total_cost * $line->qty).''; } else { echo ''.price($line->total_cost).''; } From 52c39d05f796f2435f061e3ee18d0555f2e5590a Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Thu, 26 Jan 2023 15:32:37 +0100 Subject: [PATCH 04/11] FIX : Make help text part bold --- htdocs/langs/fr_FR/mrp.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/fr_FR/mrp.lang b/htdocs/langs/fr_FR/mrp.lang index 557b1f09175..47e8dcf13d3 100644 --- a/htdocs/langs/fr_FR/mrp.lang +++ b/htdocs/langs/fr_FR/mrp.lang @@ -82,7 +82,7 @@ ProductsToConsume=Produits à consommer ProductsToProduce=Produits à produire UnitCost=Coût unitaire TotalCost=Coût total -BOMTotalCost=Le coût de production de cette nomenclature basé sur chaque quantité et produit à consommer (utilise le cout de la sous BOM si existante, sinon le prix de revient du produit si défini, sinon le PMP si défini, sinon le meilleur prix d'achat) +BOMTotalCost=Le coût de production de cette nomenclature basé sur chaque quantité et produit à consommer (utilise le cout de la sous BOM si existante, sinon le prix de revient du produit si défini, sinon le PMP si défini, sinon le meilleur prix d'achat) BOMTotalCostService=Si le module "Poste de travail" est activé et qu'un poste de travail est défini par défaut sur la ligne, alors le calcul est "quantité (convertie en heures) x poste de travail ahr", sinon "quantité (convertie en heures) x prix de revient du service" GoOnTabProductionToProduceFirst=Vous devez avoir la production pour clôturer un Ordre de Fabrication (voir onglet '%s'). Mais vous pouvez l'annuler. ErrorAVirtualProductCantBeUsedIntoABomOrMo=Un kit ne peut pas être utilisé dans une Nomenclature ou un Ordre de fabrication. From 331dd7d4792ab881701845a053628da4087fa7c8 Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Thu, 26 Jan 2023 15:56:04 +0100 Subject: [PATCH 05/11] FIX : Sub-Bom indentations were not good --- htdocs/bom/tpl/objectline_view.tpl.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php index 2df13e9af83..ac277f6e880 100644 --- a/htdocs/bom/tpl/objectline_view.tpl.php +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -269,16 +269,20 @@ if ($resql) { $label = $sub_bom_product->getLabelOfUnit('long'); if ($sub_bom_line->qty_frozen > 0) { print ''.price($sub_bom_line->qty, 0, '', 0, 0).''; - print ''; - if ($label !== '') print $langs->trans($label); - print ''; + if (!empty($conf->global->PRODUCT_USE_UNITS)) { + print ''; + if ($label !== '') print $langs->trans($label); + print ''; + } print ''.$langs->trans('Yes').''; } else { print ''.price($sub_bom_line->qty * $line->qty, 0, '', 0, 0).''; - print ''; - if ($label !== '') print $langs->trans($label); - print ''; - print ''; + if (!empty($conf->global->PRODUCT_USE_UNITS)) { + print ''; + if ($label !== '') print $langs->trans($label); + print ''; + } + print ' '; } From 1200174b83e2974d9c07c5d442527feb55a7a2d4 Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Thu, 26 Jan 2023 18:03:18 +0100 Subject: [PATCH 06/11] FIX : The folder on BOM card who display or not the sub BOM was not working --- htdocs/bom/bom_card.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 333b6232f9f..b25785ae368 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -613,9 +613,6 @@ if (empty($reshook)) { print "\n"; - mrpCollapseBomManagement(); - - //Services $filtertype = 1; $res = $object->fetchLinesbytypeproduct(1); From 791a69dd09b8c487f57ce4b7175f22f68355e732 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 28 Jan 2023 04:48:55 +0100 Subject: [PATCH 07/11] FIX Accountancy - Quadra export --- .../class/accountancyexport.class.php | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 73035c55d5d..2215ed1352e 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -5,7 +5,7 @@ * Copyright (C) 2015 Florian Henry * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2016 Pierre-Henry Favre - * Copyright (C) 2016-2021 Alexandre Spangaro + * Copyright (C) 2016-2023 Alexandre Spangaro * Copyright (C) 2013-2017 Olivier Geffroy * Copyright (C) 2017 Elarifr. Ari Elbaz * Copyright (C) 2017-2019 Frédéric France @@ -518,7 +518,7 @@ class AccountancyExport /** * Export format : Quadratus (Format ASCII) * Format since 2015 compatible QuadraCOMPTA - * Last review for this format : 2021/09/13 Alexandre Spangaro (aspangaro@open-dsi.fr) + * Last review for this format : 2023/01/28 Alexandre Spangaro (aspangaro@open-dsi.fr) * * Help : https://docplayer.fr/20769649-Fichier-d-entree-ascii-dans-quadracompta.html * In QuadraCompta | Use menu : "Outils" > "Suivi des dossiers" > "Import ASCII(Compta)" @@ -536,6 +536,14 @@ class AccountancyExport // $date_ecriture = dol_print_date(dol_now(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy // $date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy foreach ($TData as $data) { + // Clean some data + $data->doc_ref = dol_string_unaccent($data->doc_ref); + $data->label_operation = dol_string_unaccent($data->label_operation); + $data->numero_compte = dol_string_unaccent($data->numero_compte); + $data->label_compte = dol_string_unaccent($data->label_compte); + $data->subledger_account = dol_string_unaccent($data->subledger_account); + $data->subledger_label = dol_string_unaccent($data->subledger_label); + $code_compta = $data->numero_compte; if (!empty($data->subledger_account)) { $code_compta = $data->subledger_account; @@ -567,9 +575,9 @@ class AccountancyExport if ($data->doc_type == 'customer_invoice') { $Tab['type_compte'] = 'C'; } elseif ($data->doc_type == 'supplier_invoice') { - $Tab['coll_compte'] = 'F'; + $Tab['type_compte'] = 'F'; } else { - $Tab['coll_compte'] = 'G'; + $Tab['type_compte'] = 'G'; } $Tab['filler3'] = str_repeat(' ', 235); @@ -590,7 +598,7 @@ class AccountancyExport //$Tab['date_ecriture'] = $date_ecriture; $Tab['date_ecriture'] = dol_print_date($data->doc_date, '%d%m%y'); $Tab['filler'] = ' '; - $Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref).' '.dol_string_unaccent($data->label_operation), 20), 20); + $Tab['libelle_ecriture'] = str_pad(self::trunc($data->doc_ref.' '.$data->label_operation, 20), 20); // Credit invoice - invert sens /* @@ -640,8 +648,8 @@ class AccountancyExport // TODO: we should filter more than only accent to avoid wrong line size // TODO: remove invoice number doc_ref in libelle, // TODO: we should offer an option for customer to build the libelle using invoice number / name / date in accounting software - //$Tab['libelle_ecriture2'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref) . ' ' . dol_string_unaccent($data->label_operation), 30), 30); - $Tab['libelle_ecriture2'] = str_pad(self::trunc(dol_string_unaccent($data->label_operation), 30), 30); + //$Tab['libelle_ecriture2'] = str_pad(self::trunc($data->doc_ref . ' ' . $data->label_operation, 30), 30); + $Tab['libelle_ecriture2'] = str_pad(self::trunc($data->label_operation, 30), 30); $Tab['codetva'] = str_repeat(' ', 2); // We need to keep the 10 lastest number of invoice doc_ref not the beginning part that is the unusefull almost same part From d3b1ee367ac0dec93e5d5be52a6f2b7a40500ff3 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Sat, 28 Jan 2023 14:27:45 +0100 Subject: [PATCH 08/11] fix #23716 : handle hookmanagers returns --- htdocs/public/payment/newpayment.php | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 9cecbc90885..69ce8977030 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -212,6 +212,11 @@ $parameters = [ 'validpaymentmethod' => &$validpaymentmethod ]; $reshook = $hookmanager->executeHooks('doValidatePayment', $parameters, $object, $action); +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} elseif ($reshook > 0) { + print $hookmanager->resPrint; +} // Check security token $valid = true; @@ -1674,6 +1679,12 @@ if ($action != 'dopayment') 'object' => $object ]; $reshook = $hookmanager->executeHooks('doCheckStatus', $parameters, $object, $action); + if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + } elseif ($reshook > 0) { + print $hookmanager->resPrint; + } + if ($source == 'order' && $object->billed) { print '

'.$langs->trans("OrderBilled").''; @@ -1699,6 +1710,12 @@ if ($action != 'dopayment') 'paymentmethod' => $paymentmethod ]; $reshook = $hookmanager->executeHooks('doAddButton', $parameters, $object, $action); + if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + } elseif ($reshook > 0) { + print $hookmanager->resPrint; + } + if ((empty($paymentmethod) || $paymentmethod == 'paybox') && !empty($conf->paybox->enabled)) { print '
'; @@ -2299,9 +2316,13 @@ if (preg_match('/^dopayment/', $action)) // If we choosed/click on the payment 'dopayment' => GETPOST('dopayment', 'alpha') ]; $reshook = $hookmanager->executeHooks('doPayment', $parameters, $object, $action); + if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + } elseif ($reshook > 0) { + print $hookmanager->resPrint; + } } - htmlPrintOnlinePaymentFooter($mysoc, $langs, 1, $suffix, $object); llxFooter('', 'public'); From b963ddb0bc27daae5e2cb6e1d13c9720a6b83386 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Sun, 29 Jan 2023 14:33:13 +0100 Subject: [PATCH 09/11] Fix PHP8 Warning --- htdocs/core/modules/project/task/mod_task_universal.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/core/modules/project/task/mod_task_universal.php b/htdocs/core/modules/project/task/mod_task_universal.php index 6de02dcaf99..ba61a0363df 100644 --- a/htdocs/core/modules/project/task/mod_task_universal.php +++ b/htdocs/core/modules/project/task/mod_task_universal.php @@ -128,8 +128,7 @@ class mod_task_universal extends ModeleNumRefTask require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - // On defini critere recherche compteur - $mask = $conf->global->PROJECT_TASK_UNIVERSAL_MASK; + $mask = !empty($conf->global->PROJECT_TASK_UNIVERSAL_MASK) ? $conf->global->PROJECT_TASK_UNIVERSAL_MASK : ''; if (!$mask) { $this->error = 'NotConfigured'; From 244239d44db2104570f37dcc13016a95d51174e9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 29 Jan 2023 20:52:24 +0100 Subject: [PATCH 10/11] Doc --- dev/dolibarr_changes.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dev/dolibarr_changes.txt b/dev/dolibarr_changes.txt index 461db52f959..e12c237e28e 100644 --- a/dev/dolibarr_changes.txt +++ b/dev/dolibarr_changes.txt @@ -209,6 +209,11 @@ with with foreach ($value[1] as $k => $v) { +* Fix by replacing + if ($res[0] == PDF_TYPE_OBJECT) +with + if ($res && $res[0] == PDF_TYPE_OBJECT) + JSGANTT: From 3fdc32337871ce06dda75eda1b251cc452fbfe7d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Jan 2023 02:41:13 +0100 Subject: [PATCH 11/11] Fix menu --- htdocs/core/menus/standard/eldy.lib.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index bf75035f333..d04cf9edc1a 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1726,7 +1726,10 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef if ($nature) { $langs->load('accountancy'); - $journallabel = $langs->transnoentities($objp->label); // Label of bank account in llx_accounting_journal + $journallabel = ''; + if ($objp->label) { + $journallabel = '('.$langs->transnoentities($objp->label).')'; // Label of bank account in llx_accounting_journal + } $key = $langs->trans("AccountingJournalType".strtoupper($objp->nature)); $transferlabel = ($objp->nature && $key != "AccountingJournalType".strtoupper($langs->trans($objp->nature)) ? $key.($journallabel != $key ? ' '.$journallabel : ''): $journallabel);