From 05cfd3dc529989771b0274dc784e4cf4872f4481 Mon Sep 17 00:00:00 2001 From: ksar <35605507+ksar-ksar@users.noreply.github.com> Date: Wed, 10 Jul 2024 23:36:53 +0200 Subject: [PATCH 1/8] FIX #30274 : Add the include before executing dolibarr_set_const (#30320) --- htdocs/main.inc.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index b7e0c93ffcd..a5a353ff719 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1582,6 +1582,7 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr } // Refresh value of MAIN_IHM_PARAMS_REV before forging the parameter line. if (GETPOST('dol_resetcache')) { + include_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", ((int) $conf->global->MAIN_IHM_PARAMS_REV) + 1, 'chaine', 0, '', $conf->entity); } From eca8735e2216e8378cf1cbea5991946c409de0a1 Mon Sep 17 00:00:00 2001 From: MaximilienR-easya <122890855+MaximilienR-easya@users.noreply.github.com> Date: Sat, 13 Jul 2024 18:13:32 +0200 Subject: [PATCH 2/8] =?UTF-8?q?Fix=20les=20lien=20de=20t=C3=A9l=C3=A9charg?= =?UTF-8?q?ement=20de=20facture=20fournisseur=20sur=20la=20page=20vue=20d'?= =?UTF-8?q?ensemble=20des=20projets=20(#30349)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/projet/element.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 537215896a1..d86076b2633 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -1207,8 +1207,8 @@ foreach ($listofreferent as $key => $value) { $filedir = $conf->fournisseur->commande->multidir_output[$element->entity].'/'.dol_sanitizeFileName($element->ref); } elseif ($element_doc === 'invoice_supplier') { $element_doc = 'facture_fournisseur'; - $filename = get_exdir($element->id, 2, 0, 0, $element, 'product').dol_sanitizeFileName($element->ref); - $filedir = $conf->fournisseur->facture->multidir_output[$element->entity].'/'.get_exdir($element->id, 2, 0, 0, $element, 'invoice_supplier').dol_sanitizeFileName($element->ref); + $filename = get_exdir($element->id, 2, 0, 0, $element, 'invoice_supplier').dol_sanitizeFileName($element->ref); + $filedir = $conf->fournisseur->facture->multidir_output[$element->entity].'/'.$filename; } print '
'.$formfile->getDocumentsLink($element_doc, $filename, $filedir).'
'; From 9487a4f91850078be88e85fa87cc44578cd23327 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 15 Jul 2024 00:43:30 +0200 Subject: [PATCH 3/8] FIX transfer in accountancy for expense reports. --- htdocs/accountancy/journal/bankjournal.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 6b091db2cb8..63726a7dd9a 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -212,10 +212,10 @@ if ($result) { $tabtype = array(); $tabmoreinfo = array(); - // Loop on each line into llx_bank table. For each line, we should get: - // one line tabpay = line into bank - // one line for bank record = tabbq - // one line for thirdparty record = tabtp + // Loop on each line into the table llx_bank. For each line, we should set: + // one line for bank record => tabbq + // one line for payment => tabpay + // one line for thirdparty or user record => tabtp $i = 0; while ($i < $num) { $obj = $db->fetch_object($result); @@ -307,15 +307,25 @@ if ($result) { // get_url may return -1 which is not traversable if (is_array($links) && count($links) > 0) { $is_sc = false; + $is_expensereport = false; foreach ($links as $v) { if ($v['type'] == 'sc') { $is_sc = true; break; } + if ($v['type'] == 'payment_expensereport') { + $is_expensereport = true; + break; + } } + // Now loop on each link of record in bank (code similar to bankentries_list.php) foreach ($links as $key => $val) { - if ($links[$key]['type'] == 'user' && !$is_sc) continue; + if ($links[$key]['type'] == 'user' && !$is_sc && !$is_expensereport) { + // We must avoid as much as possible this "continue". If we want to jump to next loop, it means we don't want to process + // the case the link is user (often because managed by hard coded code into another link), and we must avoid this. + continue; + } if (in_array($links[$key]['type'], array('sc', 'payment_sc', 'payment', 'payment_supplier', 'payment_vat', 'payment_expensereport', 'banktransfert', 'payment_donation', 'member', 'payment_loan', 'payment_salary', 'payment_various'))) { // So we excluded 'company' and 'user' here. We want only payment lines From 75d40e6b7281c8caf5490c4f4b70f2c9afe6f6b7 Mon Sep 17 00:00:00 2001 From: MaximilienR-easya <122890855+MaximilienR-easya@users.noreply.github.com> Date: Mon, 15 Jul 2024 21:07:09 +0200 Subject: [PATCH 4/8] Fix d'une erreur qui survient quand on ne selection aucun entrepot lors d'une recherche avec l'option alerte stock. on fini avec deux conditions d'entrepot qui se contredisent et qui font comme si tous les produits n'avaient aucun stocks (#30382) --- htdocs/product/stock/replenish.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 17be55a8633..603fb2764a9 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -366,7 +366,7 @@ $sql .= ' FROM ' . MAIN_DB_PREFIX . 'product as p'; $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'product_stock as s ON p.rowid = s.fk_product'; $sql .= ' AND s.fk_entrepot IN (' . $db->sanitize($list_warehouse) . ')'; -$list_warehouse_selected = ($fk_entrepot < 0 || empty($fk_entrepot)) ? '0' : $fk_entrepot; +$list_warehouse_selected = ($fk_entrepot < 0 || empty($fk_entrepot)) ? $list_warehouse : $fk_entrepot; $sql .= ' AND s.fk_entrepot IN (' . $db->sanitize($list_warehouse_selected) . ')'; From 8d6d17c18dcde67a6a9b8c8fddd1afb58a3aa04f Mon Sep 17 00:00:00 2001 From: Sylvain Legrand Date: Tue, 16 Jul 2024 12:39:06 +0200 Subject: [PATCH 5/8] fix missing value on fetch (#30390) info_bits value is missing when fetching rows --- htdocs/fourn/class/fournisseur.commande.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 2c9436f7bd7..a25e8dec9a1 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -532,7 +532,7 @@ class CommandeFournisseur extends CommonOrder $sql = "SELECT l.rowid, l.fk_commande, l.ref as ref_supplier, l.fk_product, l.product_type, l.label, l.description, l.qty,"; $sql .= " l.vat_src_code, l.tva_tx, l.remise_percent, l.subprice,"; $sql .= " l.localtax1_tx, l. localtax2_tx, l.localtax1_type, l. localtax2_type, l.total_localtax1, l.total_localtax2,"; - $sql .= " l.total_ht, l.total_tva, l.total_ttc, l.special_code, l.fk_parent_line, l.rang,"; + $sql .= " l.total_ht, l.total_tva, l.total_ttc, l.info_bits, l.special_code, l.fk_parent_line, l.rang,"; $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.description as product_desc, p.tobatch as product_tobatch, p.barcode as product_barcode,"; $sql .= " l.fk_unit,"; $sql .= " l.date_start, l.date_end,"; @@ -633,6 +633,7 @@ class CommandeFournisseur extends CommonOrder $line->multicurrency_total_tva = $objp->multicurrency_total_tva; $line->multicurrency_total_ttc = $objp->multicurrency_total_ttc; + $line->info_bits = $objp->info_bits; $line->special_code = $objp->special_code; $line->fk_parent_line = $objp->fk_parent_line; From 50646e70a0a1600317e8384f5c0a1da1658cde8d Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 17 Jul 2024 19:42:12 +0200 Subject: [PATCH 6/8] FIX Accountancy - Generate entries of expense report with localtax (#30411) * FIX User List - Function is show in wrong column when module HRM enabled * FIX Accountancy - Generate entries of expense report with localtax. $cpttva don't exist --- .../journal/expensereportsjournal.php | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index 20bc41e7752..9b69c837113 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -1,13 +1,13 @@ - * Copyright (C) 2007-2010 Jean Heimburger - * Copyright (C) 2011 Juanjo Menent - * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2013-2023 Alexandre Spangaro - * Copyright (C) 2013-2016 Olivier Geffroy - * Copyright (C) 2013-2016 Florian Henry - * Copyright (C) 2018 Frédéric France - * Copyright (C) 2018 Eric Seigne +/* Copyright (C) 2007-2010 Laurent Destailleur + * Copyright (C) 2007-2010 Jean Heimburger + * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2013-2024 Alexandre Spangaro + * Copyright (C) 2013-2016 Olivier Geffroy + * Copyright (C) 2013-2016 Florian Henry + * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018 Eric Seigne * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -155,8 +155,8 @@ if ($result) { $vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''), $mysoc, $mysoc, 0); $compta_tva = (!empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $account_vat); - $compta_localtax1 = (!empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva); - $compta_localtax2 = (!empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva); + $compta_localtax1 = (!empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $account_vat); + $compta_localtax2 = (!empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $account_vat); // Define array to display all VAT rates that use this accounting account $compta_tva if (price2num($obj->tva_tx) || !empty($obj->vat_src_code)) { From 4479b1e66286885eb38021f674e7b10814231dff Mon Sep 17 00:00:00 2001 From: Florian Charlaix Date: Wed, 17 Jul 2024 19:43:18 +0200 Subject: [PATCH 7/8] FIX Conflict with autoload (#30399) Co-authored-by: Laurent Destailleur --- .../framework/Luracast/Restler/AutoLoader.php | 53 ++++++++++++++----- 1 file changed, 41 insertions(+), 12 deletions(-) diff --git a/htdocs/includes/restler/framework/Luracast/Restler/AutoLoader.php b/htdocs/includes/restler/framework/Luracast/Restler/AutoLoader.php index a5a1fd98750..0f5b2c4e9f7 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/AutoLoader.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/AutoLoader.php @@ -268,8 +268,8 @@ namespace Luracast\Restler { return $this->loadThisLoader($className, $loader); } foreach ($loaders as $loader) - if (false !== $file = $this->loadThisLoader($className, $loader)) - return $file; + if (false !== $file = $this->loadThisLoader($className, $loader)) + return $file; return false; } @@ -285,23 +285,52 @@ namespace Luracast\Restler { */ private function loadThisLoader($className, $loader) { + if (is_array($loader) + && is_callable($loader)) { + $b = new $loader[0]; + //avoid PHP Fatal error: Uncaught Error: Access to undeclared static property: Composer\\Autoload\\ClassLoader::$loader + //in case of multiple autoloader systems + if (property_exists($b, $loader[1])) { + if (false !== $file = $b::$loader[1]($className) + && $this->exists($className, $b::$loader[1])) { + return $file; + } + } + } elseif (is_callable($loader) + && false !== $file = $loader($className) + && $this->exists($className, $loader)) { + return $file; + } + return false; + + /* other code tested to reduce autoload conflict + $s = ''; if (is_array($loader) && is_callable($loader)) { + // @CHANGE DOL avoid autoload conflict + if (!preg_match('/LuraCast/', get_class($loader[0]))) { + return false; + } $b = new $loader[0]; - //avoid PHP Fatal error: Uncaught Error: Access to undeclared static property: Composer\\Autoload\\ClassLoader::$loader + // @CHANGE DOL avoid PHP Fatal error: Uncaught Error: Access to undeclared static property: Composer\\Autoload\\ClassLoader::$loader //in case of multiple autoloader systems if (property_exists($b, $loader[1])) { if (false !== $file = $b::$loader[1]($className) - && $this->exists($className, $b::$loader[1])) { - return $file; - } + && $this->exists($className, $b::$loader[1])) { + return $file; + } + } + } elseif (is_callable($loader, false, $s)) { + // @CHANGE DOL avoid PHP infinite loop (detected when xdebug is on) + if ($s == 'Luracast\Restler\AutoLoader::__invoke') { + return false; + } + if (false !== ($file = $loader($className)) && $this->exists($className, $loader)) { + return $file; } - } elseif (is_callable($loader) - && false !== $file = $loader($className) - && $this->exists($className, $loader)) { - return $file; } return false; + */ } /** @@ -417,7 +446,7 @@ namespace Luracast\Restler { if (false !== $includeReference = $this->discover($className)) return $includeReference; - static::thereCanBeOnlyOne(); + //static::thereCanBeOnlyOne(); if (false !== $includeReference = $this->loadAliases($className)) return $includeReference; @@ -426,7 +455,7 @@ namespace Luracast\Restler { return $includeReference; if (false !== $includeReference = $this->loadLastResort($className)) - return $includeReference; + return $includeReference; static::seen($className, true); return null; From f8da6187896cf6fd76530bb08e6bce026ef1ae92 Mon Sep 17 00:00:00 2001 From: Pichi1966 <57623859+josett225@users.noreply.github.com> Date: Wed, 17 Jul 2024 20:07:40 +0200 Subject: [PATCH 8/8] FIX : issue to get the right files exported in Quadratrus export.php (#30004) * FIX : issue to get the right files exported in Quadratrus export.php The export of files does not work correctly when using Accounting option export Quadratus with file export. The files are not attached to the zip until we uncommment the 3 lines of this PR. * Update export.php --- htdocs/accountancy/bookkeeping/export.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/export.php b/htdocs/accountancy/bookkeeping/export.php index 7f95698caa5..e7c97b475b9 100644 --- a/htdocs/accountancy/bookkeeping/export.php +++ b/htdocs/accountancy/bookkeeping/export.php @@ -1190,7 +1190,6 @@ while ($i < min($num, $limit)) { require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $objectstatic = new Facture($db); $objectstatic->fetch($line->fk_doc); - //$modulepart = 'facture'; $filename = dol_sanitizeFileName($line->doc_ref); $filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($line->doc_ref); @@ -1202,11 +1201,10 @@ while ($i < min($num, $limit)) { require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; $objectstatic = new FactureFournisseur($db); $objectstatic->fetch($line->fk_doc); - //$modulepart = 'invoice_supplier'; $filename = dol_sanitizeFileName($line->doc_ref); - $filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($line->fk_doc, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref); - $subdir = get_exdir($objectstatic->id, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref); + $filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($line->fk_doc, 2, 0, 0, $objectstatic, $objectstatic->element).dol_sanitizeFileName($line->doc_ref); + $subdir = get_exdir($objectstatic->id, 2, 0, 0, $objectstatic, $objectstatic->element).dol_sanitizeFileName($line->doc_ref); $documentlink = $formfile->getDocumentsLink($objectstatic->element, $subdir, $filedir); } elseif ($line->doc_type == 'expense_report') { $langs->loadLangs(array('trips')); @@ -1214,7 +1212,6 @@ while ($i < min($num, $limit)) { require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; $objectstatic = new ExpenseReport($db); $objectstatic->fetch($line->fk_doc); - //$modulepart = 'expensereport'; $filename = dol_sanitizeFileName($line->doc_ref); $filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);