From e45f6ab0cb9ba83103f7cbad2be394711cfe1412 Mon Sep 17 00:00:00 2001 From: Parag Bhilkar Date: Wed, 6 Aug 2014 22:44:31 +0530 Subject: [PATCH] VAT-645 Added is_billing_required field for contribution. --- CRM/Contribute/Form/ContributionPage/Amount.php | 8 ++++++++ CRM/Event/Form/ManageEvent/Fee.php | 8 ++++++++ CRM/Upgrade/Incremental/sql/4.5.alpha1.mysql.tpl | 6 +++++- .../CRM/Contribute/Form/ContributionPage/Amount.tpl | 2 ++ templates/CRM/Event/Form/ManageEvent/Fee.tpl | 4 ++++ xml/schema/Contribute/ContributionPage.xml | 7 +++++++ xml/schema/Event/Event.xml | 11 +++++++++++ .../contribution_online_receipt_html.tpl | 2 +- .../contribution_online_receipt_text.tpl | 2 +- .../message_templates/event_online_receipt_html.tpl | 2 +- .../message_templates/event_online_receipt_text.tpl | 2 +- 11 files changed, 49 insertions(+), 5 deletions(-) diff --git a/CRM/Contribute/Form/ContributionPage/Amount.php b/CRM/Contribute/Form/ContributionPage/Amount.php index 32cd17749b..e9d3309ce9 100644 --- a/CRM/Contribute/Form/ContributionPage/Amount.php +++ b/CRM/Contribute/Form/ContributionPage/Amount.php @@ -141,6 +141,7 @@ SELECT id FALSE ); $this->addWysiwyg('pay_later_receipt', ts('Pay Later Instructions'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'pay_later_receipt')); + $this->addElement('checkbox', 'is_billing_required', ts('Is billing block required')); //add partial payment options @@ -412,6 +413,12 @@ SELECT id public function postProcess() { // get the submitted form values. $params = $this->controller->exportValues($this->_name); + + //update 'is_billing_required' + if (empty($params['is_pay_later'])) { + $params['is_billing_required'] = 0; + } + if (array_key_exists('payment_processor', $params)) { if (array_key_exists(CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_PaymentProcessor', 'AuthNet', 'id', 'payment_processor_type_id' @@ -433,6 +440,7 @@ SELECT id 'max_amount' => "null", 'is_monetary' => FALSE, 'is_pay_later' => FALSE, + 'is_billing_required' => FALSE, 'is_recur_interval' => FALSE, 'is_recur_installments' => FALSE, 'recur_frequency_unit' => "null", diff --git a/CRM/Event/Form/ManageEvent/Fee.php b/CRM/Event/Form/ManageEvent/Fee.php index ff3b4da180..6bb8167cd9 100644 --- a/CRM/Event/Form/ManageEvent/Fee.php +++ b/CRM/Event/Form/ManageEvent/Fee.php @@ -288,6 +288,7 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { ); $this->addWysiwyg('pay_later_receipt', ts('Pay Later Instructions'), CRM_Core_DAO::getAttribute('CRM_Event_DAO_Event', 'pay_later_receipt')); + $this->addElement('checkbox', 'is_billing_required', ts('Is billing block required')); $this->add('text', 'fee_label', ts('Fee Label')); $price = CRM_Price_BAO_PriceSet::getAssoc(FALSE, 'CiviEvent'); @@ -577,6 +578,7 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { } $params['is_pay_later'] = CRM_Utils_Array::value('is_pay_later', $params, 0); + $params['is_billing_required'] = CRM_Utils_Array::value('is_billing_required', $params, 0); if ($this->_id) { @@ -783,6 +785,12 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { } $params['financial_type_id'] = ''; $params['is_pay_later'] = 0; + $params['is_billing_required'] = 0; + } + + //update 'is_billing_required' + if (empty($params['is_pay_later'])) { + $params['is_billing_required'] = False; } //update events table diff --git a/CRM/Upgrade/Incremental/sql/4.5.alpha1.mysql.tpl b/CRM/Upgrade/Incremental/sql/4.5.alpha1.mysql.tpl index 0cd386835f..880f9e838c 100644 --- a/CRM/Upgrade/Incremental/sql/4.5.alpha1.mysql.tpl +++ b/CRM/Upgrade/Incremental/sql/4.5.alpha1.mysql.tpl @@ -567,4 +567,8 @@ VALUES (@option_group_id_udOpt, {localize}'{ts escape="sql"}Invoices / Credit Notes{/ts}'{/localize}, @option_group_id_udOpt_val+1, 'Invoices / Credit Notes', NULL, 0, NULL, @option_group_id_udOpt_wt+1, NULL, 0, 0, 1, NULL, NULL); -- Add new column creditnote_id in contribution table -ALTER TABLE `civicrm_contribution` ADD `creditnote_id` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'unique credit note id, system generated or passed in'; \ No newline at end of file +ALTER TABLE `civicrm_contribution` ADD `creditnote_id` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'unique credit note id, system generated or passed in'; + +-- Add new column is_billing_required in contribution_page and event table +ALTER TABLE `civicrm_event` ADD COLUMN `is_billing_required` tinyint(4) DEFAULT '0' COMMENT 'Billing block required for Event'; +ALTER TABLE `civicrm_contribution_page` ADD COLUMN `is_billing_required` tinyint(4) DEFAULT '0' COMMENT 'Billing block required for Contribution Page'; \ No newline at end of file diff --git a/templates/CRM/Contribute/Form/ContributionPage/Amount.tpl b/templates/CRM/Contribute/Form/ContributionPage/Amount.tpl index 4cec3180a6..ef85c5424f 100644 --- a/templates/CRM/Contribute/Form/ContributionPage/Amount.tpl +++ b/templates/CRM/Contribute/Form/ContributionPage/Amount.tpl @@ -70,6 +70,8 @@ {$form.pay_later_receipt.html|crmAddClass:big}
{ts}Instructions added to Confirmation and Thank-you pages, as well as the confirmation email, when the user selects the 'pay later' option (e.g. 'Mail your check to ... within 3 business days.').{/ts} + {$form.is_billing_required.label} + {$form.is_billing_required.html} diff --git a/templates/CRM/Event/Form/ManageEvent/Fee.tpl b/templates/CRM/Event/Form/ManageEvent/Fee.tpl index e8e2a167d4..9e5f6e14f2 100644 --- a/templates/CRM/Event/Form/ManageEvent/Fee.tpl +++ b/templates/CRM/Event/Form/ManageEvent/Fee.tpl @@ -107,6 +107,10 @@ + + {$form.is_billing_required.html} + {$form.is_billing_required.label} + diff --git a/xml/schema/Contribute/ContributionPage.xml b/xml/schema/Contribute/ContributionPage.xml index 27b67554e3..57d5a9aeb8 100644 --- a/xml/schema/Contribute/ContributionPage.xml +++ b/xml/schema/Contribute/ContributionPage.xml @@ -428,4 +428,11 @@ Can people share the contribution page through social media?4.1 + + is_billing_required + boolean + 0 + if true - is billing required enabled for this online contribution page + 4.5 +
diff --git a/xml/schema/Event/Event.xml b/xml/schema/Event/Event.xml index c0e04fad70..e9a5a7039e 100644 --- a/xml/schema/Event/Event.xml +++ b/xml/schema/Event/Event.xml @@ -837,4 +837,15 @@ id 4.5 + + is_billing_required + Is Billing Required + boolean + 0 + Is Billing Required enabled or disabled for this Event + 4.5 + + CheckBox + + diff --git a/xml/templates/message_templates/contribution_online_receipt_html.tpl b/xml/templates/message_templates/contribution_online_receipt_html.tpl index 8d629700ee..f920d3eff5 100644 --- a/xml/templates/message_templates/contribution_online_receipt_html.tpl +++ b/xml/templates/message_templates/contribution_online_receipt_html.tpl @@ -311,7 +311,7 @@ {/if} {if ! ($contributeMode eq 'notify' OR $contributeMode eq 'directIPN') and $is_monetary} - {if $is_pay_later} + {if $is_pay_later && !$isBillingAddressRequiredForPayLater} {ts}Registered Email{/ts} diff --git a/xml/templates/message_templates/contribution_online_receipt_text.tpl b/xml/templates/message_templates/contribution_online_receipt_text.tpl index 6b60eadcd0..6b36b189a4 100644 --- a/xml/templates/message_templates/contribution_online_receipt_text.tpl +++ b/xml/templates/message_templates/contribution_online_receipt_text.tpl @@ -121,7 +121,7 @@ {/if} {if !( $contributeMode eq 'notify' OR $contributeMode eq 'directIPN' ) and $is_monetary} -{if $is_pay_later} +{if $is_pay_later && !$isBillingAddressRequiredForPayLater} =========================================================== {ts}Registered Email{/ts} diff --git a/xml/templates/message_templates/event_online_receipt_html.tpl b/xml/templates/message_templates/event_online_receipt_html.tpl index 11030468f3..d3e6f0790d 100644 --- a/xml/templates/message_templates/event_online_receipt_html.tpl +++ b/xml/templates/message_templates/event_online_receipt_html.tpl @@ -401,7 +401,7 @@ registration process.{/ts}

{/if} - {if $contributeMode ne 'notify' and !$isAmountzero and !$is_pay_later and !$isOnWaitlist and !$isRequireApproval} + {if $contributeMode ne 'notify' and !$isAmountzero and (!$is_pay_later or $isBillingAddressRequiredForPayLater) and !$isOnWaitlist and !$isRequireApproval} {ts}Billing Name and Address{/ts} diff --git a/xml/templates/message_templates/event_online_receipt_text.tpl b/xml/templates/message_templates/event_online_receipt_text.tpl index 70dfd9604f..a8434ccfc9 100644 --- a/xml/templates/message_templates/event_online_receipt_text.tpl +++ b/xml/templates/message_templates/event_online_receipt_text.tpl @@ -212,7 +212,7 @@ You were registered by: {$payer.name} {if $checkNumber} {ts}Check Number{/ts}: {$checkNumber} {/if} -{if $contributeMode ne 'notify' and !$isAmountzero and !$is_pay_later and !$isOnWaitlist and !$isRequireApproval} +{if $contributeMode ne 'notify' and !$isAmountzero and (!$is_pay_later or $isBillingAddressRequiredForPayLater) and !$isOnWaitlist and !$isRequireApproval} ==========================================================={if $pricesetFieldsCount }===================={/if} -- 2.25.1