From 8f0e6ac3f666df74dc73984a663ab4561b7b49fa Mon Sep 17 00:00:00 2001 From: ATM-NicolasV Date: Mon, 19 Jun 2023 14:10:45 +0200 Subject: [PATCH 1/3] Change strpos for expedition and receipt in files.lib and inversion --- ChangeLog | 3 ++- htdocs/core/lib/files.lib.php | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 63bc0a82a61..08bd5bd3b15 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,7 +3,8 @@ English Dolibarr ChangeLog -------------------------------------------------------------- ***** ChangeLog for 17.0.2 compared to 17.0.1 ***** -FIX : Add hidden conf to add extrafields in canelle template : INVOICE_ADD_EXTRAFIELD_IN_NOTE +FIX: Change strpos for expedition and receipt in files.lib $haystack and $needle inversion +FIX: Add hidden conf to add extrafields in canelle template : INVOICE_ADD_EXTRAFIELD_IN_NOTE FIX: #24414 FIX: #24798 Deleting member subscription is not possible FIX: add a test for updating date on task update in tab time consummed pro… diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 6163afd6ab3..bbd5d61a3dc 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2446,7 +2446,7 @@ function dol_most_recent_file($dir, $regexfilter = '', $excludefilter = array('( * @see restrictedArea() */ function dol_check_secure_access_document($modulepart, $original_file, $entity, $fuser = '', $refname = '', $mode = 'read') -{ +{ global $conf, $db, $user, $hookmanager; global $dolibarr_main_data_root, $dolibarr_main_document_root_alt; global $object; @@ -2931,14 +2931,14 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, if ($fuser->hasRight('expedition', $lire) || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } - $original_file = $conf->expedition->dir_output."/".(strpos('sending/', $original_file) === 0 ? '' : 'sending/').$original_file; + $original_file = $conf->expedition->dir_output."/".(strpos($original_file, 'sending/') === 0 ? '' : 'sending/').$original_file; //$original_file = $conf->expedition->dir_output."/".$original_file; } elseif (($modulepart == 'livraison' || $modulepart == 'delivery') && !empty($conf->expedition->dir_output)) { // Delivery Note Wrapping if ($fuser->hasRight('expedition', 'delivery', $lire) || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } - $original_file = $conf->expedition->dir_output."/".(strpos('receipt/', $original_file) === 0 ? '' : 'receipt/').$original_file; + $original_file = $conf->expedition->dir_output."/".(strpos($original_file, 'receipt/' ) === 0 ? '' : 'receipt/').$original_file; } elseif ($modulepart == 'actions' && !empty($conf->agenda->dir_output)) { // Wrapping pour les actions if ($fuser->hasRight('agenda', 'myactions', $read) || preg_match('/^specimen/i', $original_file)) { From 9abde6c057b62fb1820ea775b959f056dce5337e Mon Sep 17 00:00:00 2001 From: atm-greg Date: Mon, 19 Jun 2023 14:26:49 +0200 Subject: [PATCH 2/3] add missing hook printFieldListValue --- htdocs/compta/bank/bankentries_list.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index d7951233f7b..4316f34a278 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -1507,6 +1507,11 @@ if ($resql) if (!$i) $totalarray['nbfield']++; } + // Fields from hook + $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$objp, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $objecttmp); // Note that $action and $objecttmpect may have been modified by hook + print $hookmanager->resPrint; + // Action edit/delete print ''; // Transaction reconciliated or edit link From e5193f16ccf554873698d1dde35372b54c82d699 Mon Sep 17 00:00:00 2001 From: atm-greg Date: Mon, 19 Jun 2023 16:09:34 +0200 Subject: [PATCH 3/3] add printFieldListJoin --- htdocs/compta/bank/bankentries_list.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 4316f34a278..3ccee35b35c 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -495,6 +495,12 @@ $sql .= " ".MAIN_DB_PREFIX."bank as b"; if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (b.rowid = ef.fk_object)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu ON bu.fk_bank = b.rowid AND type = 'company'"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON bu.url_id = s.rowid"; + +// Add fields from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListJoin', $parameters); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; + $sql .= " WHERE b.fk_account = ba.rowid"; $sql .= " AND ba.entity IN (".getEntity('bank_account').")"; if ($search_account > 0) $sql .= " AND b.fk_account = ".$search_account;