From a29aa48100535db440af5b2314c5e4421a48faea Mon Sep 17 00:00:00 2001 From: Abdelaziz MISBAH Date: Tue, 7 Jun 2022 13:11:30 +0100 Subject: [PATCH 1/2] Send Notification Without File when E-mail Template does'nt attach file When we create an Email Template that does'nt require main file to be attached, we still send notification with an attached file, eg: when we send a notification when validating proposal it send proposal with attached file with mention NOT VALIDATED. I added OR condition on checking pdf_path. --- htdocs/core/class/notify.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 452d066886e..e66b378ca38 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -615,7 +615,7 @@ class Notify $ref = dol_sanitizeFileName($newref); $pdf_path = $dir_output."/".$ref.".pdf"; - if (!dol_is_file($pdf_path)) { + if (!dol_is_file($pdf_path)||!$arraydefaultmessage->joinfiles) { // We can't add PDF as it is not generated yet. $filepdf = ''; } else { From 14e7c5454ec0d983c1540b8b951b1fa737e3374c Mon Sep 17 00:00:00 2001 From: Abdelaziz MISBAH Date: Thu, 9 Jun 2022 11:47:34 +0100 Subject: [PATCH 2/2] FIX #21141 Update condition to check for attached file to E-mail Template Update condition to check for attached file to E-ail Template, initial Commit doesn't check for if null (may generate fatal error depending on context), now we check if is an object, before checking if we join files. --- htdocs/core/class/notify.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index e66b378ca38..92e0272c00c 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -615,7 +615,7 @@ class Notify $ref = dol_sanitizeFileName($newref); $pdf_path = $dir_output."/".$ref.".pdf"; - if (!dol_is_file($pdf_path)||!$arraydefaultmessage->joinfiles) { + if (!dol_is_file($pdf_path)||(is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0 && !$arraydefaultmessage->joinfiles)) { // We can't add PDF as it is not generated yet. $filepdf = ''; } else {