Unit test failure fixes
authordpradeep <pradeep.dorugade@webaccess.co.in>
Mon, 29 Sep 2014 12:12:08 +0000 (17:42 +0530)
committerdpradeep <pradeep.dorugade@webaccess.co.in>
Mon, 29 Sep 2014 12:12:08 +0000 (17:42 +0530)
CRM/Contribute/Form/Contribution/Confirm.php
CRM/Price/BAO/PriceField.php
api/v3/examples/Contribution/Create.php

index 4066df081017aace8902101073cf3131cc710b38..eac0ff9a14c1be9e0a1cec51052472a96e52646c 100644 (file)
@@ -94,7 +94,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
       'receive_date' => (CRM_Utils_Array::value('receive_date', $params)) ? CRM_Utils_Date::processDate($params['receive_date']) : date('YmdHis'),
       'non_deductible_amount' => $nonDeductibleAmount,
       'total_amount' => $params['amount'],
-      'tax_amount' => $params['tax_amount'],
+      'tax_amount' => CRM_Utils_Array::value('tax_amount', $params),
       'amount_level' => CRM_Utils_Array::value('amount_level', $params),
       'invoice_id' => $params['invoiceID'],
       'currency' => $params['currencyID'],
index 2c1b3899b256eff95952405f81f121fa7e65836f..88f89876ea9a944c311ac5d42275b99585173e68 100644 (file)
@@ -553,7 +553,7 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField {
       // ToDo - Code for Hook Invoke
 
       foreach ($options[$fieldId] as $priceFieldId => $priceFieldValues) {
-        if (array_key_exists($priceFieldValues['financial_type_id'], $taxRates)) {
+        if (isset($priceFieldValues['financial_type_id']) && array_key_exists($priceFieldValues['financial_type_id'], $taxRates)) {
           $options[$fieldId][$priceFieldId]['tax_rate'] = $taxRates[$priceFieldValues['financial_type_id']];
           $taxAmount = CRM_Contribute_BAO_Contribution_Utils::calculateTaxAmount($priceFieldValues['amount'], $options[$fieldId][$priceFieldId]['tax_rate']);
           $options[$fieldId][$priceFieldId]['tax_amount'] = round($taxAmount['tax_amount'],2);
index c43b8e855b9f6ec6f95286039968376e53f001c1..a2c2a7296b5b4be251773cb309af4a9a209cf57a 100644 (file)
@@ -69,6 +69,8 @@ function contribution_create_expectedresult(){
           'check_number' => '',
           'campaign_id' => '',
           'contribution_type_id' => '1',
+          'creditnote_id' => '',
+          'tax_amount' => '',
         ),
     ),
 );