From: jitendrapurohit Date: Thu, 1 Sep 2016 12:00:12 +0000 (+0530) Subject: Additional fixes X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=2f44fc9667a9a487bae279478fb5c7bd98da9ae4;p=civicrm-core.git Additional fixes --- diff --git a/CRM/Admin/Form/Preferences/Contribute.php b/CRM/Admin/Form/Preferences/Contribute.php index d8a1030388..3d484f7541 100644 --- a/CRM/Admin/Form/Preferences/Contribute.php +++ b/CRM/Admin/Form/Preferences/Contribute.php @@ -248,9 +248,7 @@ class CRM_Admin_Form_Preferences_Contribute extends CRM_Admin_Form_Preferences { else { $setting = explode(CRM_Core_DAO::VALUE_SEPARATOR, substr($values['user_dashboard_options'], 1, -1)); $invoiceKey = array_search($setKey, $setting); - if (!empty($invoiceKey)) { - unset($setting[$invoiceKey]); - } + unset($setting[$invoiceKey]); $settingName = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR, array_values($setting)) . CRM_Core_DAO::VALUE_SEPARATOR; diff --git a/CRM/Contribute/Form/Contribution/Confirm.php b/CRM/Contribute/Form/Contribution/Confirm.php index 2cc2edc77f..39af77a1ca 100644 --- a/CRM/Contribute/Form/Contribution/Confirm.php +++ b/CRM/Contribute/Form/Contribution/Confirm.php @@ -390,7 +390,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $params = $this->_params; // make sure we have values for it - if (!empty($this->_values['honoree_profile_id']) && !empty($params['soft_credit_type_id'])) { + if (!empty($this->_values['honoree_profile_id']) && !empty($params['soft_credit_type_id']) && empty($this->_ccid)) { $honorName = NULL; $softCreditTypes = CRM_Core_OptionGroup::values("soft_credit_type", FALSE); @@ -433,7 +433,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $this->set('option', $option); } $config = CRM_Core_Config::singleton(); - if (in_array('CiviMember', $config->enableComponents)) { + if (in_array('CiviMember', $config->enableComponents) && empty($this->_ccid)) { if (isset($params['selectMembership']) && $params['selectMembership'] != 'no_thanks' ) { @@ -451,14 +451,16 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $this->assign('membershipBlock', FALSE); } } - $this->buildCustom($this->_values['custom_pre_id'], 'customPre', TRUE); - $this->buildCustom($this->_values['custom_post_id'], 'customPost', TRUE); + if (empty($this->_ccid)) { + $this->buildCustom($this->_values['custom_pre_id'], 'customPre', TRUE); + $this->buildCustom($this->_values['custom_post_id'], 'customPost', TRUE); + } if (!empty($this->_values['onbehalf_profile_id']) && !empty($params['onbehalf']) && ($this->_values['is_for_organization'] == 2 || !empty($params['is_for_organization']) - ) + ) && empty($this->_ccid) ) { $fieldTypes = array('Contact', 'Organization'); $contactSubType = CRM_Contact_BAO_ContactType::subTypes('Organization'); @@ -1997,7 +1999,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr // organization params in a separate variable, to make sure // normal behavior is continued. And use that variable to // process on-behalf-of functionality. - if (!empty($this->_values['onbehalf_profile_id'])) { + if (!empty($this->_values['onbehalf_profile_id']) && empty($this->_ccid)) { $behalfOrganization = array(); $orgFields = array('organization_name', 'organization_id', 'org_option'); foreach ($orgFields as $fld) { diff --git a/CRM/Contribute/Form/Contribution/Main.php b/CRM/Contribute/Form/Contribution/Main.php index b3307f570c..1fee2ce6c7 100644 --- a/CRM/Contribute/Form/Contribution/Main.php +++ b/CRM/Contribute/Form/Contribution/Main.php @@ -319,13 +319,15 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu public function buildQuickForm() { // build profiles first so that we can determine address fields etc // and then show copy address checkbox - $this->buildCustom($this->_values['custom_pre_id'], 'customPre'); - $this->buildCustom($this->_values['custom_post_id'], 'customPost'); + if (empty($this->_ccid)) { + $this->buildCustom($this->_values['custom_pre_id'], 'customPre'); + $this->buildCustom($this->_values['custom_post_id'], 'customPost'); - // CRM-18399: used by template to pass pre profile id as a url arg - $this->assign('custom_pre_id', $this->_values['custom_pre_id']); + // CRM-18399: used by template to pass pre profile id as a url arg + $this->assign('custom_pre_id', $this->_values['custom_pre_id']); - $this->buildComponentForm($this->_id, $this); + $this->buildComponentForm($this->_id, $this); + } // Build payment processor form CRM_Core_Payment_ProcessorForm::buildQuickForm($this); @@ -1151,7 +1153,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $this->set('amount_level', CRM_Utils_Array::value('amount_level', $params)); } - if ($this->_ccid) { + if (!empty($this->_ccid)) { $this->set('lineItem', $this->_lineItem); } elseif ($priceSetId = CRM_Utils_Array::value('priceSetId', $params)) { diff --git a/CRM/Contribute/Form/Contribution/ThankYou.php b/CRM/Contribute/Form/Contribution/ThankYou.php index 753d41c774..37c7b281a8 100644 --- a/CRM/Contribute/Form/Contribution/ThankYou.php +++ b/CRM/Contribute/Form/Contribution/ThankYou.php @@ -89,6 +89,7 @@ class CRM_Contribute_Form_Contribution_ThankYou extends CRM_Contribute_Form_Cont */ public function buildQuickForm() { $this->assignToTemplate(); + $this->_ccid = $this->get('ccid'); $productID = $this->get('productID'); $option = $this->get('option'); $membershipTypeID = $this->get('membershipTypeID'); @@ -184,13 +185,15 @@ class CRM_Contribute_Form_Contribution_ThankYou extends CRM_Contribute_Form_Cont $this->_separateMembershipPayment = $this->get('separateMembershipPayment'); $this->assign("is_separate_payment", $this->_separateMembershipPayment); - $this->buildCustom($this->_values['custom_pre_id'], 'customPre', TRUE); - $this->buildCustom($this->_values['custom_post_id'], 'customPost', TRUE); + if (empty($this->_ccid)) { + $this->buildCustom($this->_values['custom_pre_id'], 'customPre', TRUE); + $this->buildCustom($this->_values['custom_post_id'], 'customPost', TRUE); + } if (!empty($this->_values['onbehalf_profile_id']) && !empty($params['onbehalf']) && ($this->_values['is_for_organization'] == 2 || !empty($params['is_for_organization']) - ) + ) && empty($this->_ccid) ) { $fieldTypes = array('Contact', 'Organization'); $contactSubType = CRM_Contact_BAO_ContactType::subTypes('Organization'); diff --git a/templates/CRM/Contribute/Form/Contribution/Main.tpl b/templates/CRM/Contribute/Form/Contribution/Main.tpl index 3121b9da89..a093570ef3 100644 --- a/templates/CRM/Contribute/Form/Contribution/Main.tpl +++ b/templates/CRM/Contribute/Form/Contribution/Main.tpl @@ -348,6 +348,8 @@ } function hidePayLater() { + cj('#billingcheckbox').hide(); + cj('#billingcheckbox').next('label').hide(); cj('input:radio[name="payment_processor_id"][value=0]').hide(); cj('input:radio[name="payment_processor_id"][value=0]').next('label').hide(); } diff --git a/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php b/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php index e52ffdcc1c..b3fe619200 100644 --- a/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php @@ -505,7 +505,10 @@ class WebTest_Contribute_OnlineContributionTest extends CiviSeleniumTestCase { $this->webtestVerifyTabularData($expected); } - public function testOnlineContributionWithPayNowLink() { + /** + * CRM-19263 - Test online pay now functionality + */ + public function testOnlineContributionWithPayNowLink() { $this->webtestLogin(); $pageId = 1; $this->openCiviPage("admin/contribute/amount", "reset=1&action=update&id=$pageId", 'is_pay_later'); @@ -584,7 +587,7 @@ class WebTest_Contribute_OnlineContributionTest extends CiviSeleniumTestCase { 1 => '$ 588.50', 2 => '$ 98.50', ); - foreach($amountValues as $row => $amount) { + foreach ($amountValues as $row => $amount) { $this->clickLink("xpath=//table[@class='selector row-highlight']/tbody/tr[{$row}]/td[8]/span//a[text()='View']", "_qf_ContributionView_cancel-bottom", FALSE); // View Contribution Record and test for expected values @@ -603,6 +606,11 @@ class WebTest_Contribute_OnlineContributionTest extends CiviSeleniumTestCase { } } + /** + * Contribute using pay now link + * @param string $firstName + * @param bool $priceSet + */ public function _testContributeWithPayNow($firstName, $priceSet = FALSE) { //user dashboard $this->openCiviPage("user", "reset=1"); @@ -638,6 +646,13 @@ class WebTest_Contribute_OnlineContributionTest extends CiviSeleniumTestCase { } + /** + * Contribute with pay later + * + * @param int $pageId + * @param string $firstName + * @param bool $priceSet + */ public function _testContributeWithPayLater($pageId, $firstName, $priceSet = FALSE) { $this->openCiviPage("contribute/transact", "reset=1&action=preview&id=$pageId", NULL); $this->waitForElementPresent("email-5"); @@ -671,6 +686,14 @@ class WebTest_Contribute_OnlineContributionTest extends CiviSeleniumTestCase { $this->assertElementContainsText("xpath=//div[@class='help']/div/p", $payLaterInstructionsText); } + /** + * Create test user + * + * @param string $firstName + * @param string $lastName + * + * @return string + */ public function _testCreateUser($firstName, $lastName) { $this->open($this->sboxPath . "admin/people/create");