From 86992971f852159956ad29f8eedde715ec4bbc89 Mon Sep 17 00:00:00 2001 From: Mellisa Hankins Date: Wed, 4 Sep 2013 16:32:24 +1000 Subject: [PATCH] FEATURE: Add data and form arguments to Filtered Email Recipients Most use cases for Filtered Email Recipients will probably require using the data submitted via the user form. --- code/model/UserDefinedForm.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/model/UserDefinedForm.php b/code/model/UserDefinedForm.php index dad0431..47cdbf7 100755 --- a/code/model/UserDefinedForm.php +++ b/code/model/UserDefinedForm.php @@ -280,10 +280,10 @@ class UserDefinedForm extends Page { * * @return ArrayList */ - public function FilteredEmailRecipients() { + public function FilteredEmailRecipients($data = null, $form = null) { $recipients = new ArrayList($this->getComponents('EmailRecipients')->toArray()); - $this->extend('updateFilteredEmailRecipients', $recipients); + $this->extend('updateFilteredEmailRecipients', $recipients, $data, $form); return $recipients; } @@ -964,7 +964,7 @@ JS ); // email users on submit. - if($this->FilteredEmailRecipients()) { + if($recipients = $this->FilteredEmailRecipients($data, $form)) { $email = new UserDefinedForm_SubmittedFormEmail($submittedFields); if($attachments){ @@ -979,7 +979,7 @@ JS } } - foreach($this->FilteredEmailRecipients() as $recipient) { + foreach($recipients as $recipient) { $email->populateTemplate($recipient); $email->populateTemplate($emailData); $email->setFrom($recipient->EmailFrom);