From: Pratik Joshi Date: Thu, 16 Jan 2014 12:41:29 +0000 (+0530) Subject: CRM-13973 : worked on fee selection change UI and meta data changes X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=2429e40cdd85cc4cbf6c3262e698b2f2f28a406e;p=civicrm-core.git CRM-13973 : worked on fee selection change UI and meta data changes --- diff --git a/CRM/Event/Form/ParticipantFeeSelection.php b/CRM/Event/Form/ParticipantFeeSelection.php index b87e850ef9..467bcdd3d4 100644 --- a/CRM/Event/Form/ParticipantFeeSelection.php +++ b/CRM/Event/Form/ParticipantFeeSelection.php @@ -34,18 +34,11 @@ */ /** - * This form records additional payments needed when + * This form used for changing / updating fee selections for the events * event/contribution is partially paid * */ class CRM_Event_Form_ParticipantFeeSelection extends CRM_Core_Form { - /** - * related component whose financial payment is being processed - * - * @var string - * @public - */ - protected $_component = NULL; protected $_contactId = NULL; @@ -65,15 +58,14 @@ class CRM_Event_Form_ParticipantFeeSelection extends CRM_Core_Form { public $_values = NULL; - public $_isPaidEvent = NULL; - public $_participantId = NULL; public function preProcess() { $this->_participantId = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE); $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE); - $this->_fromEmails = CRM_Core_BAO_Email::getFromEmail(); $this->_eventId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $this->_participantId, 'event_id'); + $this->_fromEmails = CRM_Event_BAO_Event::getFromEmailIds($this->_eventId); + $this->_contributionId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment', $this->_participantId, 'contribution_id', 'participant_id'); if ($this->_contributionId) { $this->_isPaidEvent = TRUE; @@ -82,6 +74,8 @@ class CRM_Event_Form_ParticipantFeeSelection extends CRM_Core_Form { list($this->_contributorDisplayName, $this->_contributorEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactId); $this->assign('displayName', $this->_contributorDisplayName); + $this->assign('email', $this->_contributorEmail); + //set the payment mode - _mode property is defined in parent class $this->_mode = CRM_Utils_Request::retrieve('mode', 'String', $this); @@ -121,6 +115,14 @@ class CRM_Event_Form_ParticipantFeeSelection extends CRM_Core_Form { } public function buildQuickForm() { + CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js'); + + $statuses = CRM_Event_PseudoConstant::participantStatus(); + CRM_Core_Resources::singleton()->addSetting(array( + 'partiallyPaid' => array_search('Partially paid', $statuses), + 'pendingRefund' => array_search('Pending refund', $statuses), + )); + $config = CRM_Core_Config::singleton(); $this->assign('currencySymbol', $config->defaultCurrencySymbol); @@ -148,12 +150,31 @@ class CRM_Event_Form_ParticipantFeeSelection extends CRM_Core_Form { TRUE ); + $this->addElement('checkbox', + 'send_receipt', + ts('Send Confirmation?'), NULL, + array('onclick' => "showHideByValue('send_receipt','','notice','table-row','radio',false); showHideByValue('send_receipt','','from-email','table-row','radio',false);") + ); + + $this->add('select', 'from_email_address', ts('Receipt From'), $this->_fromEmails['from_email_id']); + + $this->add('textarea', 'receipt_text', ts('Confirmation Message')); + + $noteAttributes = CRM_Core_DAO::getAttribute('CRM_Core_DAO_Note'); + $this->add('textarea', 'note', ts('Notes'), $noteAttributes['note']); + $buttons[] = array( 'type' => 'upload', 'name' => ts('Save'), 'isDefault' => TRUE, ); + $buttons[] = array( + 'type' => 'upload', + 'name' => ts('Save and Record Payment'), + 'subName' => 'new' + ); + $buttons[] = array( 'type' => 'cancel', 'name' => ts('Cancel'), @@ -170,7 +191,14 @@ class CRM_Event_Form_ParticipantFeeSelection extends CRM_Core_Form { public function postProcess() { $params = $this->controller->exportValues($this->_name); - } + $session = CRM_Core_Session::singleton(); + $buttonName = $this->controller->getButtonName(); + if ($buttonName == $this->getButtonName('upload', 'new')) { + $session->replaceUserContext(CRM_Utils_System::url('civicrm/payment/add', + "reset=1&action=add&component=event&id={$this->_participantId}&cid={$this->_contactId}" + )); + } + } static function emailReceipt(&$form, &$params) { // email receipt sending diff --git a/CRM/Upgrade/Incremental/sql/4.5.alpha1.mysql.tpl b/CRM/Upgrade/Incremental/sql/4.5.alpha1.mysql.tpl index 64b3c36c82..dd73c9825c 100644 --- a/CRM/Upgrade/Incremental/sql/4.5.alpha1.mysql.tpl +++ b/CRM/Upgrade/Incremental/sql/4.5.alpha1.mysql.tpl @@ -129,4 +129,5 @@ INSERT INTO `civicrm_option_value` (`option_group_id`, {localize field='label'}`label`{/localize}, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, {localize field='description'}`description`{/localize}, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`) VALUES (@option_group_id_act, {localize}'{ts escape="sql"}Payment{/ts}'{/localize}, @option_group_id_act_val+1, 'Payment', NULL, 1, NULL, @option_group_id_act_wt+1, {localize}'{ts escape="sql"}Additional payment recorded for event or membership fee.{/ts}'{/localize}, 0, 1, 1, @contributeCompId, NULL), - (@option_group_id_act, {localize}'{ts escape="sql"}Refund{/ts}'{/localize}, @option_group_id_act_val+2, 'Refund', NULL, 1, NULL, @option_group_id_act_wt+2, {localize}'{ts escape="sql"}Refund recorded for event or membership fee.{/ts}'{/localize}, 0, 1, 1, @contributeCompId, NULL); \ No newline at end of file + (@option_group_id_act, {localize}'{ts escape="sql"}Refund{/ts}'{/localize}, @option_group_id_act_val+2, 'Refund', NULL, 1, NULL, @option_group_id_act_wt+2, {localize}'{ts escape="sql"}Refund recorded for event or membership fee.{/ts}'{/localize}, 0, 1, 1, @contributeCompId, NULL), + (@option_group_id_act, {localize}'{ts escape="sql"}Change Registration{/ts}'{/localize}, @option_group_id_act_val+3, 'Change Registration', NULL, 1, NULL, @option_group_id_act_wt+3, {localize}'{ts escape="sql"}Changes to an existing event registration.{/ts}'{/localize}, 0, 1, 1, @eventCompId, NULL); \ No newline at end of file diff --git a/templates/CRM/Event/Form/ParticipantFeeSelection.tpl b/templates/CRM/Event/Form/ParticipantFeeSelection.tpl index 731047a625..8e13facf3d 100644 --- a/templates/CRM/Event/Form/ParticipantFeeSelection.tpl +++ b/templates/CRM/Event/Form/ParticipantFeeSelection.tpl @@ -57,6 +57,11 @@ function populatebalanceFee() {
{include file="CRM/common/formButtons.tpl" location="bottom"}
+ {if !$email} +
+
 {ts}You will not be able to send an automatic email receipt for this payment because there is no email address recorded for this contact. If you want a receipt to be sent when this payment is recorded, click Cancel and then click Edit from the Summary tab to add an email address before recording the payment.{/ts} +
+ {/if} @@ -90,19 +95,88 @@ function populatebalanceFee() {
{ts}Total Paid{/ts}
-
{ts}Balance Owed{/ts}
+
{ts}Balance Owed{/ts}
{include file='CRM/Price/Form/Calculate.tpl' currencySymbol=$currencySymbol noCalcValueDisplay='false' displayOveride='true'} {/if}
{ts}Participant{/ts}{$displayName}
{/if} +{if $email} +
{ts}Participant Confirmation{/ts} + + + + + + + + + + + + + +
{ts}Send Confirmation{/ts}{$form.send_receipt.html}
+ {ts 1=$email'}Automatically email a confirmation to %1?{/ts} +
{$form.from_email_address.label}{$form.from_email_address.html} {help id ="id-from_email" file="CRM/Contact/Form/Task/Email.hlp"}
{$form.receipt_text.label} + {ts}Enter a message you want included at the beginning of the confirmation email. EXAMPLE: 'We have made the changes you requested to your registration.'{/ts} +
+ {$form.receipt_text.html|crmAddClass:huge} +
+
+{/if} +
+ + + + +
{$form.note.label}{$form.note.html}
+
{include file="CRM/common/formButtons.tpl" location="bottom"}
+{if $email} +{include file="CRM/common/showHideByFieldValue.tpl" + trigger_field_id ="send_receipt" + trigger_value ="" + target_element_id ="notice" + target_element_type ="table-row" + field_type ="radio" + invert = 0 +} +{include file="CRM/common/showHideByFieldValue.tpl" + trigger_field_id ="send_receipt" + trigger_value ="" + target_element_id ="from-email" + target_element_type ="table-row" + field_type ="radio" + invert = 0 +} +{/if} {literal} {/literal} \ No newline at end of file diff --git a/xml/templates/civicrm_data.tpl b/xml/templates/civicrm_data.tpl index 1074a31358..32d724edb1 100644 --- a/xml/templates/civicrm_data.tpl +++ b/xml/templates/civicrm_data.tpl @@ -368,6 +368,9 @@ VALUES (@option_group_id_act, '{ts escape="sql"}Payment{/ts}', 46, 'Payment', NULL, 1, NULL, 46, '{ts escape="sql"}Additional payment recorded for event or membership fee.{/ts}', 0, 1, 1, @contributeCompId, NULL), (@option_group_id_act, '{ts escape="sql"}Refund{/ts}', 47, 'Refund', NULL, 1, NULL, 47, '{ts escape="sql"}Refund recorded for event or membership fee.{/ts}', 0, 1, 1, @contributeCompId, NULL), + -- for selection changes + (@option_group_id_act, '{ts escape="sql"}Change Registration{/ts}', 48, 'Change Registration', NULL, 1, NULL, 48, '{ts escape="sql"}Changes to an existing event registration.{/ts}', 0, 1, 1, @eventCompId, NULL), + (@option_group_id_gender, '{ts escape="sql"}Female{/ts}', 1, 'Female', NULL, 0, NULL, 1, NULL, 0, 0, 1, NULL, NULL), (@option_group_id_gender, '{ts escape="sql"}Male{/ts}', 2, 'Male', NULL, 0, NULL, 2, NULL, 0, 0, 1, NULL, NULL), (@option_group_id_gender, '{ts escape="sql"}Transgender{/ts}', 3, 'Transgender', NULL, 0, NULL, 3, NULL, 0, 0, 1, NULL, NULL),