From 1991bba1d36f4e4d9d53de3125cbd305e35c3974 Mon Sep 17 00:00:00 2001 From: Dave Greenberg Date: Tue, 1 Jul 2014 17:06:13 -0700 Subject: [PATCH] CRM-14807 - replacing stale PR 3450 ---------------------------------------- * CRM-14807: https://issues.civicrm.org/jira/browse/CRM-14807 --- CRM/Admin/Form/ScheduleReminders.php | 7 ++++++- CRM/Core/BAO/ActionSchedule.php | 4 ++++ CRM/Upgrade/Incremental/sql/4.5.beta1.mysql.tpl | 5 +++++ templates/CRM/Admin/Form/ScheduleReminders.tpl | 8 ++++++++ templates/CRM/Admin/Page/ScheduleReminders.hlp | 8 ++++++++ xml/schema/Core/ActionSchedule.xml | 14 ++++++++++++++ 6 files changed, 45 insertions(+), 1 deletion(-) diff --git a/CRM/Admin/Form/ScheduleReminders.php b/CRM/Admin/Form/ScheduleReminders.php index 4d089cfeba..076a2f3c3c 100644 --- a/CRM/Admin/Form/ScheduleReminders.php +++ b/CRM/Admin/Form/ScheduleReminders.php @@ -186,6 +186,9 @@ class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form { $this->add('select', 'end_action', ts('Repetition Condition'), $condition, TRUE); $this->add('select', 'end_date', ts('Date Field'), $sel4, TRUE); + $this->add('text', 'from_name', ts('From Name')); + $this->add('text', 'from_email', ts('From Email')); + $recipient = 'activity_contacts'; $recipientListingOptions = array(); @@ -358,7 +361,9 @@ class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form { 'record_activity', 'limit_to', 'mode', - 'sms_provider_id' + 'sms_provider_id', + 'from_name', + 'from_email', ); foreach ($keys as $key) { $params[$key] = CRM_Utils_Array::value($key, $values); diff --git a/CRM/Core/BAO/ActionSchedule.php b/CRM/Core/BAO/ActionSchedule.php index e1e48608e4..1ac9deb7fc 100755 --- a/CRM/Core/BAO/ActionSchedule.php +++ b/CRM/Core/BAO/ActionSchedule.php @@ -680,6 +680,10 @@ WHERE cas.entity_value = $id AND while ($actionSchedule->fetch()) { $extraSelect = $extraJoin = $extraWhere = $extraOn = ''; + if ($actionSchedule->from_email) + $fromEmailAddress = "$actionSchedule->from_name <$actionSchedule->from_email>"; + + if ($actionSchedule->record_activity) { if ($mapping->entity == 'civicrm_membership') { $activityTypeID = diff --git a/CRM/Upgrade/Incremental/sql/4.5.beta1.mysql.tpl b/CRM/Upgrade/Incremental/sql/4.5.beta1.mysql.tpl index 553c71502b..f1a4e4ba1c 100644 --- a/CRM/Upgrade/Incremental/sql/4.5.beta1.mysql.tpl +++ b/CRM/Upgrade/Incremental/sql/4.5.beta1.mysql.tpl @@ -1 +1,6 @@ {* file to handle db changes in 4.5.beta1 during upgrade *} +-- CRM-14807 +ALTER TABLE `civicrm_action_schedule` + ADD COLUMN `from_name` varchar(255) AFTER `absolute_date`; +ALTER TABLE `civicrm_action_schedule` + ADD COLUMN `from_email` varchar(255) AFTER `from_name`; diff --git a/templates/CRM/Admin/Form/ScheduleReminders.tpl b/templates/CRM/Admin/Form/ScheduleReminders.tpl index 1ef667c393..e77c78b896 100644 --- a/templates/CRM/Admin/Form/ScheduleReminders.tpl +++ b/templates/CRM/Admin/Form/ScheduleReminders.tpl @@ -71,6 +71,14 @@ + + {$form.from_name.label} + {$form.from_name.html}  {help id="id-from_name_email"} + + + {$form.from_email.label} + {$form.from_email.html}   + {$form.recipient.label}{$form.limit_to.html}  {$form.recipient.html}  {help id="recipient" title=$form.recipient.label} diff --git a/templates/CRM/Admin/Page/ScheduleReminders.hlp b/templates/CRM/Admin/Page/ScheduleReminders.hlp index b10302985e..8028a071a2 100644 --- a/templates/CRM/Admin/Page/ScheduleReminders.hlp +++ b/templates/CRM/Admin/Page/ScheduleReminders.hlp @@ -26,3 +26,11 @@ {htxt id="recipient"} {ts}Only send reminders to participants with the status(es) selected above AND who match this criteria. If you select Manual Recipients - only those people will receive the reminder (AND only if they are ALSO participants with the selected status).{/ts} {/htxt} + +{htxt id="id-from_name_email-title"} + {ts}Specify FROM Name and Email{/ts} +{/htxt} + +{htxt id="id-from_name_email"} + {ts}You can set the FROM name and email address for this reminder in these fields. If you leave these fields blank, the default FROM name and email address for your site will be used (Administer > Communications > FROM Email Addresses).{/ts} +{/htxt} diff --git a/xml/schema/Core/ActionSchedule.xml b/xml/schema/Core/ActionSchedule.xml index 8d2fa36eaa..bdb9bc9b9c 100644 --- a/xml/schema/Core/ActionSchedule.xml +++ b/xml/schema/Core/ActionSchedule.xml @@ -250,6 +250,20 @@ Date on which the reminder be sent. 4.1 + + from_name + varchar + 255 + Name in "from" field + 4.5 + + + from_email + varchar + 255 + Email address in "from" field + 4.5 + mode Message Mode -- 2.25.1