From: Eileen McNaughton Date: Thu, 30 Apr 2015 03:32:57 +0000 (-0600) Subject: CRM-16367 (Back office contribution page) refactor pledge update into a separate... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=239b59740cebb39c9bbe415a164c172a1f09f5e1;p=civicrm-core.git CRM-16367 (Back office contribution page) refactor pledge update into a separate function (another var) --- diff --git a/CRM/Contribute/Form/Contribution.php b/CRM/Contribute/Form/Contribution.php index 4b1541db6e..315310a4f6 100644 --- a/CRM/Contribute/Form/Contribution.php +++ b/CRM/Contribute/Form/Contribution.php @@ -1825,7 +1825,8 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP 'id', 'contribution_id' ); - $this->updateRelatedPledge($action, $pledgePaymentID, $contribution, $pledgePaymentId, $formValues); + $this->updateRelatedPledge($action, $pledgePaymentID, $contribution, $pledgePaymentId, $formValues, + $formValues['total_amount'], $this->_defaults['total_amount']); $statusMsg = ts('The contribution record has been saved.'); @@ -1851,8 +1852,18 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP * @param CRM_Contribute_BAO_Contribution $contribution * @param int $pledgePaymentId * @param $formValues + * @param float $total_amount + * @param float $original_total_amount */ - protected function updateRelatedPledge($action, $pledgePaymentID, $contribution, $pledgePaymentId, $formValues) { + protected function updateRelatedPledge( + $action, + $pledgePaymentID, + $contribution, + $pledgePaymentId, + $formValues, + $total_amount, + $original_total_amount + ) { if ((($pledgePaymentID && $contribution->id) && $action & CRM_Core_Action::ADD) || (($pledgePaymentId) && $action & CRM_Core_Action::UPDATE) ) { @@ -1885,7 +1896,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP $updatePledgePaymentStatus = TRUE; } elseif ($action & CRM_Core_Action::UPDATE && (($this->_defaults['contribution_status_id'] != $formValues['contribution_status_id']) || - ($this->_defaults['total_amount'] != $formValues['total_amount'])) + ($original_total_amount != $total_amount)) ) { $updatePledgePaymentStatus = TRUE; }