From f72db5fafbd31cd7c6041bfed85081fc107d748c Mon Sep 17 00:00:00 2001 From: yashodha Date: Wed, 25 May 2016 14:15:43 +0530 Subject: [PATCH] CRM-18139: Notification needed when using Batch Update of Participants via Profile (currently only when using Change Participant Status function) ---------------------------------------- * CRM-18139: Notification needed when using Batch Update of Participants via Profile (currently only when using Change Participant Status function) https://issues.civicrm.org/jira/browse/CRM-18139 --- CRM/Event/Form/Task/Batch.php | 4 +++- CRM/Event/Form/Task/ParticipantStatus.php | 17 ++++++++++----- templates/CRM/Event/Form/Task/Batch.tpl | 26 +++++++++++------------ 3 files changed, 27 insertions(+), 20 deletions(-) diff --git a/CRM/Event/Form/Task/Batch.php b/CRM/Event/Form/Task/Batch.php index cc7b702e62..68b1b374c9 100644 --- a/CRM/Event/Form/Task/Batch.php +++ b/CRM/Event/Form/Task/Batch.php @@ -95,7 +95,6 @@ class CRM_Event_Form_Task_Batch extends CRM_Event_Form_Task { */ public function buildQuickForm() { $ufGroupId = $this->get('ufGroupId'); - if (!$ufGroupId) { CRM_Core_Error::fatal('ufGroupId is missing'); } @@ -105,6 +104,9 @@ class CRM_Event_Form_Task_Batch extends CRM_Event_Form_Task { $this->addDefaultButtons(ts('Save')); $this->_fields = array(); $this->_fields = CRM_Core_BAO_UFGroup::getFields($ufGroupId, FALSE, CRM_Core_Action::VIEW); + if (array_key_exists('participant_status', $this->_fields)) { + CRM_Event_Form_Task_ParticipantStatus::assignToTemplate('statusChangeBatch'); + } // remove file type field and then limit fields $suppressFields = FALSE; diff --git a/CRM/Event/Form/Task/ParticipantStatus.php b/CRM/Event/Form/Task/ParticipantStatus.php index fc9182c911..a6fed6dbfe 100644 --- a/CRM/Event/Form/Task/ParticipantStatus.php +++ b/CRM/Event/Form/Task/ParticipantStatus.php @@ -49,14 +49,21 @@ class CRM_Event_Form_Task_ParticipantStatus extends CRM_Event_Form_Task_Batch { ) + $statuses ); - $this->assign('context', 'statusChange'); - # CRM-4321: display info on users being notified if any of the below statuses is enabled - $notifyingStatuses = array('Pending from waitlist', 'Pending from approval', 'Expired', 'Cancelled'); - $notifyingStatuses = array_intersect($notifyingStatuses, CRM_Event_PseudoConstant::participantStatus()); - $this->assign('notifyingStatuses', implode(', ', $notifyingStatuses)); + self::assignToTemplate('statusChange'); parent::buildQuickForm(); } + public function assignToTemplate($context) { + $notifyingStatuses = array('Pending from waitlist', 'Pending from approval', 'Expired', 'Cancelled'); + $notifyingStatuses = array_intersect($notifyingStatuses, CRM_Event_PseudoConstant::participantStatus()); + $statuses = implode(', ', $notifyingStatuses); + $status = ts('Participants whose status is changed FROM Pending Pay Later TO Registered or Attended will receive a confirmation email and their payment status will be set to completed. If this is not you want to do, you can change their participant status by editing their event registration record directly.'); + if (!empty($notifyingStatuses)) { + $status .= '
' .ts("Participants whose status is changed TO any of the following will be automatically notified via email: %1", array(1 => $statuses)); + } + $this->assign('status', $status); + $this->assign('context', $context); + } } diff --git a/templates/CRM/Event/Form/Task/Batch.tpl b/templates/CRM/Event/Form/Task/Batch.tpl index 1e6aabac10..a45a39b67e 100644 --- a/templates/CRM/Event/Form/Task/Batch.tpl +++ b/templates/CRM/Event/Form/Task/Batch.tpl @@ -25,23 +25,21 @@ *}
-
+
{if $context EQ 'statusChange'} {* Update Participant Status task *} - {ts}Update the status for each participant individually, OR change all statuses to:{/ts} - {$form.status_change.html} {help id="id-status_change"} -
- {ts}Participants whose status is changed FROM Pending Pay Later TO Registered or Attended will receive a confirmation email and their payment status will be set to completed. If this is not what you want to do, you can change their participant status by editing their event registration record directly.{/ts} -
- {if $notifyingStatuses} -
- {ts 1=$notifyingStatuses}Participants whose status is changed TO any of the following will be automatically notified via email: %1.{/ts} -
- {/if} + {ts}Update the status for each participant individually, OR change all statuses to:{/ts} + {$form.status_change.html} {help id="id-status_change"} +
{$status}
{else} - {ts}Update field values for each participant as needed. To set a field to the same value for ALL rows, enter that value for the first participation and then click the Copy icon (next to the column title).{/ts} + {if $context EQ 'statusChangeBatch'} {* Update Participant Status in batch task *} +
{$status}
+ {/if} + {ts}Update field values for each participant as needed. To set a field to the same value for ALL rows, enter that value for the first participation and then click the + Copy icon + (next to the column title).{/ts} {/if} -

{ts}Click Update Participant(s) below to save all your changes.{/ts}

-
+

{ts}ClickUpdate Participant(s)below to save all your changes.{/ts}

+
-- 2.25.1