From 0820cd3189be5cd9043d6c5d23176b8c2b54ee79 Mon Sep 17 00:00:00 2001 From: Fabio Lovato Date: Tue, 31 Mar 2020 19:52:58 +0200 Subject: [PATCH] Revert "Fix scelta allegato durante l'invio email" This reverts commit ae17680838b3eca099799e07dc3462e9ce741e2d. --- actions.php | 8 +++++++- src/Notifications/EmailNotification.php | 9 +++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/actions.php b/actions.php index 4929d05c5..0c9ef414b 100755 --- a/actions.php +++ b/actions.php @@ -229,6 +229,12 @@ elseif (post('op') == 'send-email') { // Conferma di lettura $mail->read_notify = post('read_notify'); + // Stampe da allegare + $prints = post('prints'); + foreach ($prints as $print) { + $mail->addPrint($print); + } + // Allegati originali $files = post('uploads'); foreach ($files as $file) { @@ -238,7 +244,7 @@ elseif (post('op') == 'send-email') { $mail->save(); // Invio mail istantaneo - $email = EmailNotification::build($mail, post('prints')); + $email = EmailNotification::build($mail); $email_success = $email->send(); if ($email_success) { diff --git a/src/Notifications/EmailNotification.php b/src/Notifications/EmailNotification.php index 6956569ac..95c710fc4 100755 --- a/src/Notifications/EmailNotification.php +++ b/src/Notifications/EmailNotification.php @@ -73,16 +73,16 @@ class EmailNotification extends PHPMailer implements NotificationInterface $this->WordWrap = 78; } - public static function build(Mail $mail, $prints = null, $exceptions = null) + public static function build(Mail $mail, $exceptions = null) { $result = new self($mail->account->id, $exceptions); - $result->setMail($mail, $prints); + $result->setMail($mail); return $result; } - public function setMail($mail, $prints) + public function setMail($mail) { $this->mail = $mail; @@ -105,8 +105,9 @@ class EmailNotification extends PHPMailer implements NotificationInterface } // Stampe + $prints = $mail->prints; foreach ($prints as $print) { - $this->addPrint($print, $mail->id_record); + $this->addPrint($print['id'], $mail->id_record); } // Conferma di lettura