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.
This commit is contained in:
Abdelaziz MISBAH 2022-06-09 11:47:34 +01:00
parent a29aa48100
commit 14e7c5454e

View File

@ -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 {