From d6121d3e25bbdb4b30c7f55f5b5a93d9f58cf823 Mon Sep 17 00:00:00 2001 From: yashodha Date: Sat, 3 May 2014 02:53:42 +0530 Subject: [PATCH] limit option for confirmation only for free events --- CRM/Event/Form/ManageEvent/Fee.php | 1 - CRM/Event/Form/ManageEvent/Registration.php | 9 +++++--- .../Registration/AdditionalParticipant.php | 1 + CRM/Event/Form/Registration/Register.php | 1 + CRM/Event/StateMachine/Registration.php | 2 +- .../Event/Form/ManageEvent/Registration.tpl | 22 ++++++++++--------- 6 files changed, 21 insertions(+), 15 deletions(-) diff --git a/CRM/Event/Form/ManageEvent/Fee.php b/CRM/Event/Form/ManageEvent/Fee.php index 4747b04569..ff3b4da180 100644 --- a/CRM/Event/Form/ManageEvent/Fee.php +++ b/CRM/Event/Form/ManageEvent/Fee.php @@ -789,7 +789,6 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { $params['id'] = $this->_id; // skip update of financial type in price set $params['skipFinancialType'] = TRUE; - $params['is_confirm_enabled'] = $params['is_monetary']; CRM_Event_BAO_Event::add($params); // Update tab "disabled" css class diff --git a/CRM/Event/Form/ManageEvent/Registration.php b/CRM/Event/Form/ManageEvent/Registration.php index de33780b5d..a759512289 100644 --- a/CRM/Event/Form/ManageEvent/Registration.php +++ b/CRM/Event/Form/ManageEvent/Registration.php @@ -385,10 +385,13 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent */ function buildConfirmationBlock(&$form) { $attributes = CRM_Core_DAO::getAttribute('CRM_Event_DAO_Event'); - - // CRM-11182 - Optional confirmation page for free events - $form->addYesNo('is_confirm_enabled', ts('Use a confirmation screen?'), NULL, NULL, array('onclick' => "return showHideByValue('is_confirm_enabled','','confirm_screen_settings','block','radio',false);")); + // CRM-11182 - Optional confirmation page for free events + $is_monetary = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $form->_id, 'is_monetary'); + $form->assign('is_monetary', $is_monetary); + if ($is_monetary == "0") { + $form->addYesNo('is_confirm_enabled', ts('Use a confirmation screen?'), NULL, NULL, array('onclick' => "return showHideByValue('is_confirm_enabled','','confirm_screen_settings','block','radio',false);")); + } $form->add('text', 'confirm_title', ts('Title'), $attributes['confirm_title']); $form->addWysiwyg('confirm_text', ts('Introductory Text'), $attributes['confirm_text']); // FIXME: This hack forces height of editor to 175px. Need to modify QF classes for editors to allow passing diff --git a/CRM/Event/Form/Registration/AdditionalParticipant.php b/CRM/Event/Form/Registration/AdditionalParticipant.php index 1e7e9f8633..0050b08cc8 100644 --- a/CRM/Event/Form/Registration/AdditionalParticipant.php +++ b/CRM/Event/Form/Registration/AdditionalParticipant.php @@ -715,6 +715,7 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R // Check whether to process the registration now, calling processRegistration() if ( !$this->_values['event']['is_confirm_enabled'] // CRM-11182 - Optional confirmation screen + && !$this->_values['event']['is_monetary'] && CRM_Utils_Array::value('additional_participants', $this->_params[0]) && $this->isLastParticipant() ) { diff --git a/CRM/Event/Form/Registration/Register.php b/CRM/Event/Form/Registration/Register.php index 01c295f602..e97b05344c 100644 --- a/CRM/Event/Form/Registration/Register.php +++ b/CRM/Event/Form/Registration/Register.php @@ -513,6 +513,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { // Change button label depending on whether the next action is confirm or register if ( !$this->_values['event']['is_multiple_registrations'] + && !$this->_values['event']['is_monetary'] && !$this->_values['event']['is_confirm_enabled'] ) { $buttonLabel = ts('Register >>'); diff --git a/CRM/Event/StateMachine/Registration.php b/CRM/Event/StateMachine/Registration.php index 5a946b2020..521b0a0676 100644 --- a/CRM/Event/StateMachine/Registration.php +++ b/CRM/Event/StateMachine/Registration.php @@ -91,7 +91,7 @@ class CRM_Event_StateMachine_Registration extends CRM_Core_StateMachine { $pages = array_merge($pages, $additionalPages); // CRM-11182 - Optional confirmation screen - if (!$is_confirm_enabled) { + if (!$is_confirm_enabled && !$is_monetary) { unset($pages['CRM_Event_Form_Registration_Confirm']); } diff --git a/templates/CRM/Event/Form/ManageEvent/Registration.tpl b/templates/CRM/Event/Form/ManageEvent/Registration.tpl index f5cb13bbd1..859eaf701c 100644 --- a/templates/CRM/Event/Form/ManageEvent/Registration.tpl +++ b/templates/CRM/Event/Form/ManageEvent/Registration.tpl @@ -225,14 +225,16 @@ {*Confirmation Block*}
{ts}Confirmation Screen{/ts} - - - - - -
{$form.is_confirm_enabled.label}{$form.is_confirm_enabled.html} -
{ts}Optionally hide the confirmation screen for free events.{/ts}
-
+ {if !$is_monetary} + + + + + +
{$form.is_confirm_enabled.label}{$form.is_confirm_enabled.html} +
{ts}Optionally hide the confirmation screen for free events.{/ts}
+
+ {/if}
@@ -364,7 +366,7 @@ target_element_type ="block" field_type ="radio" invert = 0 } - +{if !$is_monetary} {include file="CRM/common/showHideByFieldValue.tpl" trigger_field_id ="is_confirm_enabled" trigger_value ="" @@ -373,7 +375,7 @@ target_element_type ="block" field_type ="radio" invert = 0 } - +{/if} {include file="CRM/common/showHideByFieldValue.tpl" trigger_field_id ="is_email_confirm" trigger_value ="" -- 2.25.1