From a4c397a68b723cb4390eef76f2fcb83cd4d4a33e Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 29 Jan 2025 18:35:54 +0100 Subject: [PATCH 01/12] fix: php 8 warning --- htdocs/expensereport/tpl/expensereport_linktofile.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expensereport/tpl/expensereport_linktofile.tpl.php b/htdocs/expensereport/tpl/expensereport_linktofile.tpl.php index 2e02e7b8808..b789360e3f2 100644 --- a/htdocs/expensereport/tpl/expensereport_linktofile.tpl.php +++ b/htdocs/expensereport/tpl/expensereport_linktofile.tpl.php @@ -95,7 +95,7 @@ if (!getDolGlobalString('EXPENSEREPORT_DISABLE_ATTACHMENT_ON_LINES')) { } print '
'; - print $thumbshown ? $thumbshown : img_mime($minifile); + print $thumbshown ? $thumbshown : ($minifile ? img_mime($minifile): ''); print '
'; if (empty($urlforhref) || empty($thumbshown)) { From b4e9367e3d1e73472751556d3dc9ac482b9d4a61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Lukas?= Date: Fri, 31 Jan 2025 14:28:34 +0100 Subject: [PATCH 02/12] Fix #32890 --- htdocs/emailcollector/class/emailcollector.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index c6e97db9d6b..4d9b5a5574d 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -3360,7 +3360,7 @@ class EmailCollector extends CommonObject foreach ($attachments as $attachment) { // $attachment->save($destdir.'/'); $typeattachment = (string) $attachment->getDisposition(); - $filename = $attachment->getFilename(); + $filename = $attachment->getName(); $content = $attachment->getContent(); $this->saveAttachment($destdir, $filename, $content); } From 46125921b1efe625686002d386f8a2767e359c31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Lukas?= Date: Fri, 31 Jan 2025 14:41:19 +0100 Subject: [PATCH 03/12] Fix #32892 --- htdocs/emailcollector/class/emailcollector.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index c6e97db9d6b..755222224ac 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -2872,7 +2872,7 @@ class EmailCollector extends CommonObject $this->errors = $actioncomm->errors; } else { if ($fk_element_type == "ticket" && is_object($objectemail)) { - if ($objectemail->status == Ticket::STATUS_CLOSED || $objectemail->status == Ticket::STATUS_CANCELED) { + if ($objectemail->status == Ticket::STATUS_CLOSED || $objectemail->status == Ticket::STATUS_CANCELED || $objectemail->status == Ticket::STATUS_NEED_MORE_INFO || $objectemail->status == Ticket::STATUS_WAITING) { if ($objectemail->fk_user_assign != null) { $res = $objectemail->setStatut(Ticket::STATUS_ASSIGNED); } else { From ae81f8bf5009ecc81d1be7e666061b5facc64ec1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Lukas?= Date: Fri, 31 Jan 2025 14:55:04 +0100 Subject: [PATCH 04/12] Fix #32894 --- htdocs/emailcollector/class/emailcollector.class.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index c6e97db9d6b..95aea5f8e36 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -3345,6 +3345,13 @@ class EmailCollector extends CommonObject $tickettocreate->context['actionmsg'] = $langs->trans("ActionAC_EMAIL_IN").' - '.$langs->trans("TICKET_CREATEInDolibarr"); //$tickettocreate->email_fields_no_propagate_in_actioncomm = 0; + // Add sender to context array to make sure that confirmation e-mail can be sent by trigger script + $sender_contact = New Contact($this->db); + $sender_contact->fetch(0, null, '', $from); + if (!empty($sender_contact->id)) { + $tickettocreate->context['contactid'] = $sender_contact->id; + } + $result = $tickettocreate->create($user); if ($result <= 0) { $errorforactions++; From adbaaac256ef225472b05250466731d2d54eb27a Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Fri, 31 Jan 2025 17:19:20 +0100 Subject: [PATCH 05/12] add test on null for situation_percent --- htdocs/compta/facture/class/facture.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 67926aa4bdb..d10bf9fd0b3 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3870,7 +3870,7 @@ class Facture extends CommonInvoice if (empty($fk_prev_id)) { $fk_prev_id = 'null'; } - if (!isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '') { + if (!isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '' || $situation_percent == null) { $situation_percent = 100; } if (empty($ref_ext)) { @@ -4131,7 +4131,7 @@ class Facture extends CommonInvoice if (empty($special_code) || $special_code == 3) { $special_code = 0; } - if (!isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '') { + if (!isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '' || $situation_percent == null) { $situation_percent = 100; } if (empty($ref_ext)) { From c39f295d76c5d1735f3b497ae95a4ac3c9092485 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 1 Feb 2025 06:07:12 +0100 Subject: [PATCH 06/12] FIX #32801 VAT type is inverted in form VAT selector --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index ad27dc50266..a72d7dbd176 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6774,7 +6774,7 @@ class Form // Keep only the VAT qualified for $type_vat $arrayofvatrates = array(); foreach ($this->cache_vatrates as $cachevalue) { - if (empty($cachevalue['type_vat']) || $cachevalue['type_vat'] != $type_vat) { + if (empty($cachevalue['type_vat']) || $cachevalue['type_vat'] == $type_vat) { $arrayofvatrates[] = $cachevalue; } } From 76ab4d7ce5a554a021f77c47cc855e6d9977e920 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 Feb 2025 01:21:57 +0100 Subject: [PATCH 07/12] Update emailcollector.class.php --- htdocs/emailcollector/class/emailcollector.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 95aea5f8e36..082b4ac6f67 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -3346,7 +3346,7 @@ class EmailCollector extends CommonObject //$tickettocreate->email_fields_no_propagate_in_actioncomm = 0; // Add sender to context array to make sure that confirmation e-mail can be sent by trigger script - $sender_contact = New Contact($this->db); + $sender_contact = new Contact($this->db); $sender_contact->fetch(0, null, '', $from); if (!empty($sender_contact->id)) { $tickettocreate->context['contactid'] = $sender_contact->id; From ecf1d2553b0df484579666fe8ab6c28d6622f1e7 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 4 Feb 2025 02:27:34 +0100 Subject: [PATCH 08/12] FIX wrong file path + avoid warning --- htdocs/core/class/commonobject.class.php | 2 +- htdocs/holiday/document.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 66ea879552f..e6198c8bb6e 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -10198,7 +10198,7 @@ abstract class CommonObject } // Create lines - if (!empty($this->table_element_line) && !empty($this->fk_element)) { + if (!empty($this->table_element_line) && !empty($this->fk_element) && !empty($this->lines)) { foreach ($this->lines as $line) { $keyforparent = $this->fk_element; $line->$keyforparent = $this->id; diff --git a/htdocs/holiday/document.php b/htdocs/holiday/document.php index 43fe279c57d..9609f214f6d 100644 --- a/htdocs/holiday/document.php +++ b/htdocs/holiday/document.php @@ -95,7 +95,7 @@ if (($id > 0) || $ref) { } -$upload_dir = $conf->holiday->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, ''); +$upload_dir = $conf->holiday->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, ''); $modulepart = 'holiday'; // Protection if external user @@ -293,7 +293,7 @@ if ($object->id) { $permissiontoadd = $user->hasRight('holiday', 'write'); $permtoedit = $user->hasRight('holiday', 'write'); $param = '&id='.$object->id; - $relativepathwithnofile = dol_sanitizeFileName($object->ref).'/'; + $relativepathwithnofile = get_exdir(0, 0, 0, 1, $object, '').'/'; $savingdocmask = dol_sanitizeFileName($object->ref).'-__file__'; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; From 3da1c1c84335f97211e57543b2670703433ae2f0 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 4 Feb 2025 04:54:54 +0100 Subject: [PATCH 09/12] FIX more bugs and warnings --- htdocs/core/lib/files.lib.php | 4 +++- htdocs/core/modules/modAgenda.class.php | 5 +---- htdocs/install/upgrade2.php | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index fccce0cc1a9..9033ff0c87d 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1562,7 +1562,9 @@ function dol_delete_file($file, $disableglob = 0, $nophperrors = 0, $nohook = 0, } } } else { - $ok = false; // to avoid false positive + if (empty($nophperrors)) { + $ok = false; // to avoid false positive + } dol_syslog("No files to delete found", LOG_DEBUG); } } else { diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index 6f05062276d..7e17b32b699 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -603,10 +603,7 @@ class modAgenda extends DolibarrModules // Permissions $this->remove($options); - $sql = array( - "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type='member' AND entity = ".((int) $conf->entity), - "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','member',".((int) $conf->entity).")" - ); + $sql = array(); return $this->_init($sql, $options); } diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 53c9d12c399..a0af8634baa 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -4135,7 +4135,7 @@ function migrate_delete_old_files($db, $langs, $conf) //print ''DOL_DOCUMENT_ROOT.$filetodelete."
\n"; if (preg_match('/\*/', $filetodelete) || file_exists(DOL_DOCUMENT_ROOT.$filetodelete)) { //print "Process file ".$filetodelete."\n"; - $result = dol_delete_file(DOL_DOCUMENT_ROOT.$filetodelete, 0, 0, 0, null, true, false); + $result = dol_delete_file(DOL_DOCUMENT_ROOT.$filetodelete, 0, 1, 0, null, true, false); // nophperrors to avoid false positive with asterisk if (!$result) { $langs->load("errors"); print '
'.$langs->trans("Error").': '.$langs->trans("ErrorFailToDeleteFile", DOL_DOCUMENT_ROOT.$filetodelete); From 064813d72863bc6e8720611d0e91a86bf20e3a0a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 4 Feb 2025 05:11:40 +0100 Subject: [PATCH 10/12] FIX wrong search filter, empty product unit is "none" --- htdocs/product/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 7bb3761497e..306335940a6 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -630,7 +630,7 @@ if ($search_accountancy_code_buy_intra) { if ($search_accountancy_code_buy_export) { $sql .= natural_search($alias_product_perentity . '.accountancy_code_buy_export', clean_account($search_accountancy_code_buy_export)); } -if (getDolGlobalString('PRODUCT_USE_UNITS') && $search_units) { +if (getDolGlobalString('PRODUCT_USE_UNITS') && !empty($search_units) && $search_units !== 'none') { $sql .= natural_search('cu.rowid', $search_units); } // Add where from extra fields From eb58bf92d7fea5c4a90e01cd5bdde0e322200f75 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Feb 2025 23:17:22 +0100 Subject: [PATCH 11/12] Update upgrade2.php --- htdocs/install/upgrade2.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index a0af8634baa..92e58782523 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -4135,7 +4135,7 @@ function migrate_delete_old_files($db, $langs, $conf) //print ''DOL_DOCUMENT_ROOT.$filetodelete."
\n"; if (preg_match('/\*/', $filetodelete) || file_exists(DOL_DOCUMENT_ROOT.$filetodelete)) { //print "Process file ".$filetodelete."\n"; - $result = dol_delete_file(DOL_DOCUMENT_ROOT.$filetodelete, 0, 1, 0, null, true, false); // nophperrors to avoid false positive with asterisk + $result = dol_delete_file(DOL_DOCUMENT_ROOT.$filetodelete, 0, (preg_match('/\*/', $filetodelete) ? 1 : 0), 0, null, true, false); // nophperrors to avoid false positive with asterisk if (!$result) { $langs->load("errors"); print '
'.$langs->trans("Error").': '.$langs->trans("ErrorFailToDeleteFile", DOL_DOCUMENT_ROOT.$filetodelete); From db640de728d7429564b69bcc795ebf0017495631 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 5 Feb 2025 00:02:41 +0100 Subject: [PATCH 12/12] Update expensereport_linktofile.tpl.php --- htdocs/expensereport/tpl/expensereport_linktofile.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expensereport/tpl/expensereport_linktofile.tpl.php b/htdocs/expensereport/tpl/expensereport_linktofile.tpl.php index b789360e3f2..689fe8903fb 100644 --- a/htdocs/expensereport/tpl/expensereport_linktofile.tpl.php +++ b/htdocs/expensereport/tpl/expensereport_linktofile.tpl.php @@ -95,7 +95,7 @@ if (!getDolGlobalString('EXPENSEREPORT_DISABLE_ATTACHMENT_ON_LINES')) { } print '
'; - print $thumbshown ? $thumbshown : ($minifile ? img_mime($minifile): ''); + print $thumbshown ? $thumbshown : (empty($minifile) ? '' : img_mime($minifile)); print '
'; if (empty($urlforhref) || empty($thumbshown)) {