Skip to content

Commit

Permalink
Merge pull request #16395 from eileenmcnaughton/cont_setting
Browse files Browse the repository at this point in the history
Finish removal of deferred_revenue_enabled from non-standard setting
  • Loading branch information
seamuslee001 authored Jan 28, 2020
2 parents c82fb90 + fc7106d commit d64bafa
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
3 changes: 1 addition & 2 deletions CRM/Contribute/Form/ContributionView.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,9 @@ public function preProcess() {

// 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']);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Core/BAO/FinancialTrxnTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public function testGetTotalPaymentsParticipantOrder() {
* @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,
Expand Down
6 changes: 4 additions & 2 deletions tests/phpunit/CRM/Financial/BAO/FinancialAccountTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,11 @@ public function testValidateFinancialAccount() {

/**
* 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");
Expand Down Expand Up @@ -341,7 +343,7 @@ public function testGetAllDeferredFinancialAccount() {
* 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;
Expand Down
9 changes: 3 additions & 6 deletions tests/phpunit/api/v3/ReportTemplateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -842,16 +842,13 @@ public function setUpIntersectingGroups() {

/**
* 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,
Expand Down

0 comments on commit d64bafa

Please sign in to comment.