From f8df19bb340467db1129c281a509647b96d126e9 Mon Sep 17 00:00:00 2001 From: eileen Date: Fri, 19 Jan 2018 11:09:10 +1300 Subject: [PATCH] CRM-17647 membership form fix for thousand processing error. --- CRM/Member/BAO/Membership.php | 1 + tests/phpunit/CRM/Event/Form/ParticipantTest.php | 14 ++++++++++---- tests/phpunit/CRM/Member/Form/MembershipTest.php | 13 +++++++++---- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/CRM/Member/BAO/Membership.php b/CRM/Member/BAO/Membership.php index f2724dd39d..a0c5445338 100644 --- a/CRM/Member/BAO/Membership.php +++ b/CRM/Member/BAO/Membership.php @@ -2400,6 +2400,7 @@ WHERE civicrm_membership.is_test = 0"; $contributionParams['receipt_date'] = (CRM_Utils_Array::value('receipt_date', $params)) ? $params['receipt_date'] : 'null'; $contributionParams['source'] = CRM_Utils_Array::value('contribution_source', $params); $contributionParams['non_deductible_amount'] = 'null'; + $contributionParams['skipCleanMoney'] = TRUE; $contributionParams['payment_processor'] = CRM_Utils_Array::value('payment_processor_id', $params); $contributionSoftParams = CRM_Utils_Array::value('soft_credit', $params); $recordContribution = array( diff --git a/tests/phpunit/CRM/Event/Form/ParticipantTest.php b/tests/phpunit/CRM/Event/Form/ParticipantTest.php index d137c12700..90fc34bbff 100644 --- a/tests/phpunit/CRM/Event/Form/ParticipantTest.php +++ b/tests/phpunit/CRM/Event/Form/ParticipantTest.php @@ -176,8 +176,13 @@ class CRM_Event_Form_ParticipantTest extends CiviUnitTestCase { /** * Test offline participant mail. + * + * @param string $thousandSeparator + * + * @dataProvider getThousandSeparators */ - public function testParticipantOfflineReceipt() { + public function testParticipantOfflineReceipt($thousandSeparator) { + $this->setCurrencySeparators($thousandSeparator); $mut = new CiviMailUtils($this, TRUE); //Get workflow id of event_offline receipt. @@ -202,11 +207,12 @@ class CRM_Event_Form_ParticipantTest extends CiviUnitTestCase { 'msg_html' => $newMsg, )); - $this->testSubmitWithPayment(); + $this->testSubmitWithPayment($thousandSeparator); //Check if type is correctly populated in mails. - $mail = $mut->checkMailLog(array( + $mail = $mut->checkMailLog([ '

Test event type - 1

', - ) + $this->formatMoneyInput(1550.55), + ] ); } diff --git a/tests/phpunit/CRM/Member/Form/MembershipTest.php b/tests/phpunit/CRM/Member/Form/MembershipTest.php index 01868caba5..96b5d970c1 100644 --- a/tests/phpunit/CRM/Member/Form/MembershipTest.php +++ b/tests/phpunit/CRM/Member/Form/MembershipTest.php @@ -430,8 +430,13 @@ class CRM_Member_Form_MembershipTest extends CiviUnitTestCase { /** * Test the submit function of the membership form. + * + * @param string $thousandSeparator + * + * @dataProvider getThousandSeparators */ - public function testSubmit() { + public function testSubmit($thousandSeparator) { + $this->setCurrencySeparators($thousandSeparator); $form = $this->getForm(); $form->preProcess(); $this->mut = new CiviMailUtils($this, TRUE); @@ -448,7 +453,7 @@ class CRM_Member_Form_MembershipTest extends CiviUnitTestCase { 'max_related' => '', 'num_terms' => '1', 'source' => '', - 'total_amount' => '50.00', + 'total_amount' => $this->formatMoneyInput(1234.56), 'financial_type_id' => '2', //Member dues, see data.xml 'soft_credit_type_id' => '', 'soft_credit_contact_id' => '', @@ -500,7 +505,7 @@ class CRM_Member_Form_MembershipTest extends CiviUnitTestCase { $this->_checkFinancialRecords(array( 'id' => $contribution['id'], - 'total_amount' => 50, + 'total_amount' => 1234.56, 'financial_account_id' => 2, 'payment_instrument_id' => $this->callAPISuccessGetValue('PaymentProcessor', array( 'id' => $this->_paymentProcessorID, @@ -508,7 +513,7 @@ class CRM_Member_Form_MembershipTest extends CiviUnitTestCase { )), ), 'online'); $this->mut->checkMailLog(array( - '50', + CRM_Utils_Money::format('1234.56'), 'Receipt text', )); $this->mut->stop(); -- 2.25.1