-
-
Notifications
You must be signed in to change notification settings - Fork 821
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9948 from KarinG/CRM-19966
Fixes for CRM-19966 Unfair Double Taxation and net_amounts.
- Loading branch information
Showing
5 changed files
with
86 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -851,4 +851,75 @@ public function testSubmitWithOutSaleTax() { | |
$this->assertTrue(empty($lineItem['tax_amount'])); | ||
} | ||
|
||
/** | ||
* Create a contribution & then edit it via backoffice form, checking tax with: default price_set | ||
* | ||
* @throws \Exception | ||
*/ | ||
public function testReSubmitSaleTax() { | ||
$this->enableTaxAndInvoicing(); | ||
$this->relationForFinancialTypeWithFinancialAccount($this->_financialTypeId); | ||
$form = new CRM_Contribute_Form_Contribution(); | ||
|
||
$form->testSubmit(array( | ||
'total_amount' => 100, | ||
'financial_type_id' => $this->_financialTypeId, | ||
'receive_date' => '04/21/2015', | ||
'receive_date_time' => '11:27PM', | ||
'contact_id' => $this->_individualId, | ||
'payment_instrument_id' => array_search('Check', $this->paymentInstruments), | ||
'contribution_status_id' => 1, | ||
'price_set_id' => 0, | ||
), | ||
CRM_Core_Action::ADD | ||
); | ||
$contribution = $this->callAPISuccessGetSingle('Contribution', | ||
array( | ||
'contribution_id' => 1, | ||
'return' => array('tax_amount', 'total_amount', 'net_amount', 'financial_type_id', 'receive_date', 'payment_instrument_id'), | ||
) | ||
); | ||
$this->assertEquals(110, $contribution['total_amount']); | ||
$this->assertEquals(10, $contribution['tax_amount']); | ||
$this->assertEquals(110, $contribution['net_amount']); | ||
|
||
$mut = new CiviMailUtils($this, TRUE); | ||
// Testing here if when we edit something trivial like adding a check_number tax, net, total amount stay the same: | ||
$form->testSubmit(array( | ||
'id' => $contribution['id'], | ||
'tax_amount' => $contribution['tax_amount'], | ||
'financial_type_id' => $contribution['financial_type_id'], | ||
'receive_date' => $contribution['receive_date'], | ||
'payment_instrument_id' => $contribution['payment_instrument_id'], | ||
'price_set_id' => 0, | ||
'check_number' => 12345, | ||
'contribution_status_id' => 1, | ||
'is_email_receipt' => 1, | ||
'from_email_address' => '[email protected]', | ||
), | ||
CRM_Core_Action::UPDATE | ||
); | ||
$contribution = $this->callAPISuccessGetSingle('Contribution', | ||
array( | ||
'contribution_id' => 1, | ||
'return' => array('tax_amount', 'total_amount', 'net_amount', 'financial_type_id', 'receive_date', 'payment_instrument_id'), | ||
) | ||
); | ||
$this->assertEquals(110, $contribution['total_amount']); | ||
$this->assertEquals(10, $contribution['tax_amount']); | ||
$this->assertEquals(110, $contribution['net_amount']); | ||
|
||
$strings = array( | ||
'Total Tax Amount : $ 10.00', | ||
'Total Amount : $ 110.00', | ||
'Date Received: April 21st, 2015', | ||
'Paid By: Check', | ||
'Check Number: 12345', | ||
); | ||
|
||
$mut->checkMailLog($strings); | ||
$this->callAPISuccessGetCount('FinancialTrxn', array(), 3); | ||
$this->callAPISuccessGetCount('FinancialItem', array(), 2); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters