From 3ea7ca336b3ed6c1743ef3e63921cb8c75701b8b Mon Sep 17 00:00:00 2001 From: yashodha Date: Wed, 25 May 2016 16:28:59 +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 | 19 +++++++++++++++++-- CRM/Event/Form/Task/ParticipantStatus.php | 15 ++------------- templates/CRM/Event/Form/Task/Batch.tpl | 2 +- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/CRM/Event/Form/Task/Batch.php b/CRM/Event/Form/Task/Batch.php index 68b1b374c9..4464c74d3d 100644 --- a/CRM/Event/Form/Task/Batch.php +++ b/CRM/Event/Form/Task/Batch.php @@ -105,8 +105,9 @@ class CRM_Event_Form_Task_Batch extends CRM_Event_Form_Task { $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'); - } + $this->assign('statusProfile', 1); + $this->assignToTemplate(); + } // remove file type field and then limit fields $suppressFields = FALSE; @@ -514,4 +515,18 @@ class CRM_Event_Form_Task_Batch extends CRM_Event_Form_Task { return $statusId; } + /** + * Assign the minimal set of variables to the template. + */ + public function assignToTemplate() { + $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 notyou 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); + } + } diff --git a/CRM/Event/Form/Task/ParticipantStatus.php b/CRM/Event/Form/Task/ParticipantStatus.php index a6fed6dbfe..78e06cba3e 100644 --- a/CRM/Event/Form/Task/ParticipantStatus.php +++ b/CRM/Event/Form/Task/ParticipantStatus.php @@ -49,21 +49,10 @@ 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 - self::assignToTemplate('statusChange'); - + parent::assignToTemplate(); 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 a45a39b67e..7625d3222a 100644 --- a/templates/CRM/Event/Form/Task/Batch.tpl +++ b/templates/CRM/Event/Form/Task/Batch.tpl @@ -31,7 +31,7 @@ {$form.status_change.html} {help id="id-status_change"}
{$status}
{else} - {if $context EQ 'statusChangeBatch'} {* Update Participant Status in batch task *} + {if $statusProfile EQ 1} {* 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 -- 2.25.1