From 974bdb4425cf2272c7215ba487a08e7f3369dc57 Mon Sep 17 00:00:00 2001 From: Dave Greenberg Date: Tue, 1 Dec 2015 20:46:13 -0800 Subject: [PATCH] CRM-16761 - Form / UI fixes. ---------------------------------------- * CRM-16761: Self service view, update and cancel for CiviEvent https://issues.civicrm.org/jira/browse/CRM-16761 --- CRM/Event/Form/SelfSvcTransfer.php | 24 ++++--- CRM/Event/Form/SelfSvcUpdate.php | 23 +++---- CRM/Event/xml/Menu/Event.xml | 8 ++- templates/CRM/Event/Form/SelfSvcTransfer.tpl | 70 ++++++++++++-------- templates/CRM/Event/Form/SelfSvcUpdate.tpl | 57 ++++++++-------- 5 files changed, 99 insertions(+), 83 deletions(-) diff --git a/CRM/Event/Form/SelfSvcTransfer.php b/CRM/Event/Form/SelfSvcTransfer.php index 65d5368c1a..6d235f5bd6 100644 --- a/CRM/Event/Form/SelfSvcTransfer.php +++ b/CRM/Event/Form/SelfSvcTransfer.php @@ -134,6 +134,7 @@ class CRM_Event_Form_SelfSvcTransfer extends CRM_Core_Form { * @array string */ protected $contact_id; + /** * Get source values for transfer based on participant id in URL. Line items will * be transferred to this participant - at this point no transaction changes processed @@ -168,10 +169,11 @@ class CRM_Event_Form_SelfSvcTransfer extends CRM_Core_Form { $details = CRM_Event_BAO_Participant::participantDetails($this->_from_participant_id); $optionGroupId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'participant_role', 'id', 'name'); $query = " - SELECT cpst.name as status, cov.name as role, cp.fee_level, cp.fee_amount, cp.register_date + SELECT cpst.name as status, cov.name as role, cp.fee_level, cp.fee_amount, cp.register_date, civicrm_event.start_date FROM civicrm_participant cp LEFT JOIN civicrm_participant_status_type cpst ON cpst.id = cp.status_id LEFT JOIN civicrm_option_value cov ON cov.value = cp.role_id and cov.option_group_id = {$optionGroupId} + LEFT JOIN civicrm_event ON civicrm_event.id = cp.event_id WHERE cp.id = {$this->_from_participant_id}"; $dao = CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray); while ($dao->fetch()) { @@ -180,6 +182,7 @@ class CRM_Event_Form_SelfSvcTransfer extends CRM_Core_Form { $details['fee_level'] = $dao->fee_level; $details['fee_amount'] = $dao->fee_amount; $details['register_date'] = $dao->register_date; + $details['event_start_date'] = $dao->start_date; } $this->assign('details', $details); //This participant row will be cancelled. Get line item(s) to cancel @@ -188,6 +191,7 @@ class CRM_Event_Form_SelfSvcTransfer extends CRM_Core_Form { $this->selfsvctransferText = ts('Update'); $this->selfsvctransferButtonText = ts('Update'); } + /** * Build form for input of transferree email, name * @@ -195,20 +199,18 @@ class CRM_Event_Form_SelfSvcTransfer extends CRM_Core_Form { */ public function buildQuickForm() { $this->add('text', 'email', ts('To Email'), ts($this->_contact_email), TRUE); - $this->add('text', 'last_name', ts('To Last name'), ts($this->_to_contact_last_name), TRUE); - $this->add('text', 'first_name', ts('To First name'), ts($this->_to_contact_first_name), TRUE); + $this->add('text', 'last_name', ts('To Last Name'), ts($this->_to_contact_last_name), TRUE); + $this->add('text', 'first_name', ts('To First Name'), ts($this->_to_contact_first_name), TRUE); $this->addButtons(array( array( 'type' => 'submit', - 'name' => ts('Submit'),), - array( - 'type' => 'cancel', - 'name' => ts('Cancel'),), + 'name' => ts('Transfer Registration'),), ) ); $this->addFormRule(array('CRM_Event_Form_SelfSvcTransfer', 'formRule'), $this); parent::buildQuickForm(); } + /** * Set defaults * @@ -218,6 +220,7 @@ class CRM_Event_Form_SelfSvcTransfer extends CRM_Core_Form { $this->_defaults = array(); return $this->_defaults; } + /** * Validate email and name input * @@ -232,6 +235,7 @@ class CRM_Event_Form_SelfSvcTransfer extends CRM_Core_Form { //return parent::formrule($fields, $files, $self); return empty($errors) ? TRUE : $errors; } + /** * Check whether profile (name, email) is complete * @@ -265,6 +269,7 @@ class CRM_Event_Form_SelfSvcTransfer extends CRM_Core_Form { } return $contact_id; } + /** * Check contact details * @@ -287,6 +292,7 @@ class CRM_Event_Form_SelfSvcTransfer extends CRM_Core_Form { } } } + /** * Process transfer - first add the new participant to the event, then cancel * source participant - send confirmation email to transferee @@ -350,8 +356,9 @@ class CRM_Event_Form_SelfSvcTransfer extends CRM_Core_Form { list($displayName, $email) = CRM_Contact_BAO_Contact_Location::getEmailDetails($contact_id); $statusMsg = ts('Event registration information for %1 has been updated.', array(1 => $displayName)); $statusMsg .= ' ' . ts('A confirmation email has been sent to %1.', array(1 => $email)); - CRM_Core_Session::setStatus($statusMsg, ts('Saved'), 'success'); + CRM_Core_Session::setStatus($statusMsg, ts('Registration Transferred'), 'success'); } + /** * Based on input, create participant row for transferee and send email * @@ -414,6 +421,7 @@ class CRM_Event_Form_SelfSvcTransfer extends CRM_Core_Form { //now registered_id can be updated (mail won't be send if it is set return $res; } + /** * Send confirmation of cancellation to source participant * diff --git a/CRM/Event/Form/SelfSvcUpdate.php b/CRM/Event/Form/SelfSvcUpdate.php index 1e99855f1a..733af64789 100644 --- a/CRM/Event/Form/SelfSvcUpdate.php +++ b/CRM/Event/Form/SelfSvcUpdate.php @@ -1,10 +1,9 @@ _participant_id, 'contribution_id', 'participant_id'); $this->assign('contributionId', $contributionId); $query = " - SELECT cpst.name as status, cov.name as role, cp.fee_level, cp.fee_amount, cp.register_date, cp.status_id + SELECT cpst.name as status, cov.name as role, cp.fee_level, cp.fee_amount, cp.register_date, cp.status_id, civicrm_event.start_date FROM civicrm_participant cp LEFT JOIN civicrm_participant_status_type cpst ON cpst.id = cp.status_id LEFT JOIN civicrm_option_value cov ON cov.value = cp.role_id and cov.option_group_id = {$optionGroupId} + LEFT JOIN civicrm_event ON civicrm_event.id = cp.event_id WHERE cp.id = {$this->_participant_id}"; $dao = CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray); while ($dao->fetch()) { @@ -157,6 +157,7 @@ class CRM_Event_Form_SelfSvcUpdate extends CRM_Core_Form { $details['fee_level'] = $dao->fee_level; $details['fee_amount'] = $dao->fee_amount; $details['register_date'] = $dao->register_date; + $details['event_start_date'] = $dao->start_date; } //verify participant status is still Registered if ($details['status'] != "Registered") { @@ -202,21 +203,16 @@ class CRM_Event_Form_SelfSvcUpdate extends CRM_Core_Form { * return @void */ public function buildQuickForm() { - $this->add('text', 'email', ts('Email'), ts($this->_contact_email), TRUE); - $this->add('text', 'participant', ts('Participant name'), ts($this->_contact_name), TRUE); - $this->add('select', 'action', 'Action', array('-select-', 'Transfer', 'Cancel')); + $this->add('select', 'action', ts('Transfer or Cancel Registration'), array(ts('-select-'), ts('Transfer'), ts('Cancel')), TRUE); $this->addButtons(array( array( 'type' => 'submit', 'name' => ts('Submit'), ), - array( - 'type' => 'cancel', - 'name' => ts('Cancel'), - ), )); parent::buildQuickForm(); } + /** * Set default values for contact * @@ -224,11 +220,10 @@ class CRM_Event_Form_SelfSvcUpdate extends CRM_Core_Form { */ public function setDefaultValues() { $this->_defaults = array(); - $this->_defaults['email'] = $this->_contact_email; - $this->_defaults['participant'] = $this->_contact_name; $this->_defaults['details'] = $this->_details; return $this->_defaults; } + /** * Process submit form - based on user selection of action * transfer or cancel the event @@ -249,6 +244,7 @@ class CRM_Event_Form_SelfSvcUpdate extends CRM_Core_Form { $this->cancelParticipant($params); } } + /** * Transfer to a new form, allowing selection of a new contact * based on email and name. The Event will be transferred to this new participant @@ -262,6 +258,7 @@ class CRM_Event_Form_SelfSvcUpdate extends CRM_Core_Form { $session = CRM_Core_Session::singleton(); $session->replaceUserContext($url); } + /** * Cancel this participant and finish, send cancellation email. At this point no * auto-cancellation of payment is handled, so payment needs to be manually cancelled diff --git a/CRM/Event/xml/Menu/Event.xml b/CRM/Event/xml/Menu/Event.xml index 277f48894c..f9d1d464ef 100644 --- a/CRM/Event/xml/Menu/Event.xml +++ b/CRM/Event/xml/Menu/Event.xml @@ -255,9 +255,10 @@ 1 850 - + civicrm/event/selfsvcupdate - Self Service Update + Self-service Registration Update + true CRM_Event_Form_SelfSvcUpdate 1 1 @@ -265,7 +266,8 @@ civicrm/event/selfsvctransfer - Self Service Transfer + Self-service Registration Transfer + true CRM_Event_Form_SelfSvcTransfer 1 1 diff --git a/templates/CRM/Event/Form/SelfSvcTransfer.tpl b/templates/CRM/Event/Form/SelfSvcTransfer.tpl index a94d49a4ba..fc39e2e5f6 100644 --- a/templates/CRM/Event/Form/SelfSvcTransfer.tpl +++ b/templates/CRM/Event/Form/SelfSvcTransfer.tpl @@ -1,8 +1,8 @@ {* +--------------------------------------------------------------------+ - | CiviCRM version 4.4 | + | CiviCRM version 4.7 | +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2013 | + | Copyright CiviCRM LLC (c) 2004-2015 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | @@ -23,31 +23,43 @@ | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ *} -
{include file="CRM/common/formButtons.tpl" location="top"}
-
- - - - - - - - - - - - -
{$form.email.label}{$form.email.html}
{$form.last_name.label}{$form.last_name.html}
{$form.first_name.label}{$form.first_name.html}
- - - - - - - - - -
ParticipantEventFee LevelFee AmtReg DateStatusRole
{$details.name}{$details.title}{$details.fee_level}{$details.fee_amount}{$details.register_date|truncate:10:''|crmDate}{$details.status}{$details.role}
- -
{include file="CRM/common/formButtons.tpl" location="bottom"}
+
+ + + + + + + + + + + + + + + + + + + +
{ts}Current
Participant{/ts}
{ts}Event{/ts}{ts}Fee Level{/ts}{ts}Amount{/ts}{ts}Registered{/ts}{ts}Status{/ts}{ts}Role{/ts}
{$details.name}{$details.title}
{$details.event_start_date|truncate:10:''|crmDate}
{$details.fee_level}{$details.fee_amount}{$details.register_date|truncate:10:''|crmDate}{$details.status}{$details.role}
+
+
+
{$form.first_name.label}
+
{$form.first_name.html}
+
+
+
+
{$form.last_name.label}
+
{$form.last_name.html}
+
+
+
+
{$form.email.label}
+
{$form.email.html}
+
+
+
+
{include file="CRM/common/formButtons.tpl" location="bottom"}
diff --git a/templates/CRM/Event/Form/SelfSvcUpdate.tpl b/templates/CRM/Event/Form/SelfSvcUpdate.tpl index 463fde90fa..7e54c18378 100644 --- a/templates/CRM/Event/Form/SelfSvcUpdate.tpl +++ b/templates/CRM/Event/Form/SelfSvcUpdate.tpl @@ -1,8 +1,8 @@ {* +--------------------------------------------------------------------+ - | CiviCRM version 4.4 | + | CiviCRM version 4.7 | +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2013 | + | Copyright CiviCRM LLC (c) 2004-2015 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | @@ -23,34 +23,31 @@ | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ *} -
{include file="CRM/common/formButtons.tpl" location="top"}
-
- - - - - - - - - - - - - -
{$form.email.label}{$form.email.html}
{$form.participant.label}{$form.participant.html}
{$form.action.label}{$form.action.html}
- - - - - - - - - -
ParticipantEventFee LevelFee AmtReg DateStatusRole
{$details.name}{$details.title}{$details.fee_level}{$details.fee_amount}{$details.register_date|truncate:10:''|crmDate}{$details.status}{$details.role}
- -
{include file="CRM/common/formButtons.tpl" location="bottom"}
+
+ + + + + + + + + + + + + + + + + +
{ts}Participant{/ts}{ts}Event{/ts}{ts}Fee Level{/ts}{ts}Amount{/ts}{ts}Registered{/ts}{ts}Status{/ts}{ts}Role{/ts}
{$details.name}{$details.title}
{$details.event_start_date|truncate:10:''|crmDate}
{$details.fee_level}{$details.fee_amount}{$details.register_date|truncate:10:''|crmDate}{$details.status}{$details.role}
+
+
{$form.action.label}
+
{$form.action.html}
+
+
+
{include file="CRM/common/formButtons.tpl" location="bottom"}
{literal}