From 92acf33dee673992b9ae792d47436124c52e5cbd Mon Sep 17 00:00:00 2001 From: Ravish Nair Date: Fri, 7 Jun 2013 21:06:03 +0530 Subject: [PATCH] -- CRM-12771 fix ---------------------------------------- * CRM-12771: contribution pages with a zero amount are not generating receipts or creating contribution records http://issues.civicrm.org/jira/browse/CRM-12771 --- CRM/Contribute/BAO/Contribution/Utils.php | 2 +- CRM/Contribute/Form/Contribution/Confirm.php | 2 +- CRM/Contribute/Form/Contribution/Main.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CRM/Contribute/BAO/Contribution/Utils.php b/CRM/Contribute/BAO/Contribution/Utils.php index 624a100907..ba7a9e9d92 100644 --- a/CRM/Contribute/BAO/Contribution/Utils.php +++ b/CRM/Contribute/BAO/Contribution/Utils.php @@ -255,7 +255,7 @@ class CRM_Contribute_BAO_Contribution_Utils { } $membershipResult[1] = $result; } - elseif ($result) { + elseif ($result || ($form->_amount == 0.0 && !$form->_params['is_pay_later'])) { if ($result) { $form->_params = array_merge($form->_params, $result); } diff --git a/CRM/Contribute/Form/Contribution/Confirm.php b/CRM/Contribute/Form/Contribution/Confirm.php index 6a3940393d..293fcdc035 100644 --- a/CRM/Contribute/Form/Contribution/Confirm.php +++ b/CRM/Contribute/Form/Contribution/Confirm.php @@ -1301,7 +1301,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $contribParams['soft_credit_to'] = $params['soft_credit_to'] = $contribSoftContactId; } - if ($params['amount']) { + if (isset($params['amount'])) { $contribParams['line_item'] = $form->_lineItem; //add contribution record $contribution = CRM_Contribute_BAO_Contribution::add($contribParams, $ids); diff --git a/CRM/Contribute/Form/Contribution/Main.php b/CRM/Contribute/Form/Contribution/Main.php index 8112cda30e..6cafa02d0c 100644 --- a/CRM/Contribute/Form/Contribution/Main.php +++ b/CRM/Contribute/Form/Contribution/Main.php @@ -762,7 +762,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu } } if ($priceField->name == 'other_amount') { - if ($self->_quickConfig && !CRM_Utils_Array::value("price_{$priceField->id}", $fields) && + if ($self->_quickConfig && !isset($fields["price_{$priceField->id}"]) && array_key_exists("price_{$previousId}", $fields) && isset($fields["price_{$previousId}"]) && $self->_values['fee'][$previousId]['name'] == 'contribution_amount' && empty($fields["price_{$previousId}"])) { $otherAmount = $priceField->id; } -- 2.25.1