Finish removal of deferred_revenue_enabled from non-standard setting
authoreileen <emcnaughton@wikimedia.org>
Tue, 28 Jan 2020 00:54:24 +0000 (13:54 +1300)
committereileen <emcnaughton@wikimedia.org>
Tue, 28 Jan 2020 00:54:24 +0000 (13:54 +1300)
CRM/Contribute/Form/ContributionView.php
tests/phpunit/CRM/Core/BAO/FinancialTrxnTest.php
tests/phpunit/CRM/Financial/BAO/FinancialAccountTest.php
tests/phpunit/api/v3/ReportTemplateTest.php

index d16922d9ab04fb8e7439f2e46cd08951012418be..fc0181933a1228c8c836b6ea5a05d164c227fc6b 100644 (file)
@@ -165,10 +165,9 @@ class CRM_Contribute_Form_ContributionView extends CRM_Core_Form {
 
     // assign values to the template
     $this->assign($values);
-    $invoiceSettings = Civi::settings()->get('contribution_invoice_settings');
     $invoicing = CRM_Invoicing_Utils::isInvoicingEnabled();
     $this->assign('invoicing', $invoicing);
-    $this->assign('isDeferred', CRM_Utils_Array::value('deferred_revenue_enabled', $invoiceSettings));
+    $this->assign('isDeferred', Civi::settings()->get('deferred_revenue_enabled'));
     if ($invoicing && isset($values['tax_amount'])) {
       $this->assign('totalTaxAmount', $values['tax_amount']);
     }
index ba546e234f6ffe97c58b704d25734812a3ab7b74..eb2d3b89e6fc17c3b50a83e12bfdb910aad756d5 100644 (file)
@@ -116,7 +116,7 @@ class CRM_Core_BAO_FinancialTrxnTest extends CiviUnitTestCase {
    * @throws \CRM_Core_Exception
    */
   public function testCreateDeferredTrxn() {
-    Civi::settings()->set('contribution_invoice_settings', ['deferred_revenue_enabled' => '1']);
+    Civi::settings()->set('deferred_revenue_enabled', TRUE);
     $cid = $this->individualCreate();
     $params = [
       'contact_id' => $cid,
index 7835662b14b893b16588b8ec6c8ec611447a2fbf..773188695ceca4828a842e776225ece50ccab6bb 100644 (file)
@@ -258,9 +258,11 @@ class CRM_Financial_BAO_FinancialAccountTest extends CiviUnitTestCase {
 
   /**
    * Test for validating financial type has deferred revenue account relationship.
+   *
+   * @throws \CRM_Core_Exception
    */
   public function testcheckFinancialTypeHasDeferred() {
-    Civi::settings()->set('deferred_revenue_enabled', 1);
+    Civi::settings()->set('deferred_revenue_enabled', TRUE);
     $params = [];
     $valid = CRM_Financial_BAO_FinancialAccount::checkFinancialTypeHasDeferred($params);
     $this->assertFalse($valid, "This should have been false");
@@ -341,7 +343,7 @@ class CRM_Financial_BAO_FinancialAccountTest extends CiviUnitTestCase {
    * CRM-20037: Test balance due amount, if contribution is done using deferred Financial Type
    */
   public function testBalanceDueIfDeferredRevenueEnabled() {
-    Civi::settings()->set('contribution_invoice_settings', ['deferred_revenue_enabled' => '1']);
+    Civi::settings()->set('deferred_revenue_enabled', TRUE);
     $deferredFinancialTypeID = $this->_createDeferredFinancialAccount();
 
     $totalAmount = 100.00;
index 872d6cc58869b51c8f377d7167389278cc6f9782..21653e943fc87e6729957a5d3ed106d09ad02aaa 100644 (file)
@@ -842,16 +842,13 @@ class api_v3_ReportTemplateTest extends CiviUnitTestCase {
 
   /**
    * Test Deferred Revenue Report.
+   *
+   * @throws \CRM_Core_Exception
    */
   public function testDeferredRevenueReport() {
     $indv1 = $this->individualCreate();
     $indv2 = $this->individualCreate();
-    $params = [
-      'contribution_invoice_settings' => [
-        'deferred_revenue_enabled' => '1',
-      ],
-    ];
-    $this->callAPISuccess('Setting', 'create', $params);
+    Civi::settings()->set('deferred_revenue_enabled', TRUE);
     $this->contributionCreate(
       [
         'contact_id' => $indv1,