From 58d3365936f60090fc2e354c393a804abdb14320 Mon Sep 17 00:00:00 2001 From: Pradeep Nayak Date: Fri, 21 Aug 2015 11:29:44 +0530 Subject: [PATCH] CRM-16571, fixed notice error when contribution is deleted ---------------------------------------- * CRM-16571: undefined indexes when deleting a contribution https://issues.civicrm.org/jira/browse/CRM-16571 --- CRM/Contribute/Form/Contribution.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/CRM/Contribute/Form/Contribution.php b/CRM/Contribute/Form/Contribution.php index bae0bb41e1..a41de6b7d4 100644 --- a/CRM/Contribute/Form/Contribution.php +++ b/CRM/Contribute/Form/Contribution.php @@ -929,7 +929,6 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP */ public static function formRule($fields, $files, $self) { $errors = array(); - // Check for Credit Card Contribution. if ($self->_mode) { if (empty($fields['payment_processor_id'])) { @@ -971,11 +970,17 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP CRM_Contribute_BAO_ContributionRecur::validateRecurContribution($fields, $files, $self, $errors); // Form rule for status http://wiki.civicrm.org/confluence/display/CRM/CiviAccounts+4.3+Data+Flow - if ($self->_id && $self->_values['contribution_status_id'] != $fields['contribution_status_id']) { + if (($self->_action & CRM_Core_Action::UPDATE) + && $self->_id + && $self->_values['contribution_status_id'] != $fields['contribution_status_id'] + ) { CRM_Contribute_BAO_Contribution::checkStatusValidation($self->_values, $fields, $errors); } // CRM-16015, add form-rule to restrict change of financial type if using price field of different financial type - if ($self->_id && $self->_values['financial_type_id'] != $fields['financial_type_id']) { + if (($self->_action & CRM_Core_Action::UPDATE) + && $self->_id + && $self->_values['financial_type_id'] != $fields['financial_type_id'] + ) { CRM_Contribute_BAO_Contribution::checkFinancialTypeChange(NULL, $self->_id, $errors); } //FIXME FOR NEW DATA FLOW http://wiki.civicrm.org/confluence/display/CRM/CiviAccounts+4.3+Data+Flow -- 2.25.1