From: jitendrapurohit Date: Fri, 22 Jul 2016 13:18:38 +0000 (+0530) Subject: CRM-19054: Update Related Components when status updated from Profile Task X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=a2cd6f6c2a23a410cfc39e1900651c397fdf2f02;p=civicrm-core.git CRM-19054: Update Related Components when status updated from Profile Task --- diff --git a/CRM/Contribute/Form/AbstractEditPayment.php b/CRM/Contribute/Form/AbstractEditPayment.php index e006218a3e..622c027a0e 100644 --- a/CRM/Contribute/Form/AbstractEditPayment.php +++ b/CRM/Contribute/Form/AbstractEditPayment.php @@ -311,7 +311,7 @@ WHERE contribution_id = {$id} * * @return null|string */ - protected function updateRelatedComponent($contributionId, $statusId, $previousStatusId = NULL, $receiveDate = NULL) { + public static function updateRelatedComponent($contributionId, $statusId, $previousStatusId = NULL, $receiveDate = NULL) { $statusMsg = NULL; if (!$contributionId || !$statusId) { return $statusMsg; diff --git a/CRM/Contribute/Form/Contribution.php b/CRM/Contribute/Form/Contribution.php index 318b7f2290..ab2789805c 100644 --- a/CRM/Contribute/Form/Contribution.php +++ b/CRM/Contribute/Form/Contribution.php @@ -1714,7 +1714,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP // process associated membership / participant, CRM-4395 if ($contribution->id && $action & CRM_Core_Action::UPDATE) { - $this->statusMessage[] = $this->updateRelatedComponent($contribution->id, + $this->statusMessage[] = self::updateRelatedComponent($contribution->id, $contribution->contribution_status_id, CRM_Utils_Array::value('contribution_status_id', $this->_values diff --git a/CRM/Contribute/Form/Task/Batch.php b/CRM/Contribute/Form/Task/Batch.php index 4976a0addd..a97547a942 100644 --- a/CRM/Contribute/Form/Task/Batch.php +++ b/CRM/Contribute/Form/Task/Batch.php @@ -234,6 +234,16 @@ class CRM_Contribute_Form_Task_Batch extends CRM_Contribute_Form_Task { unset($value['contribution_source']); $contribution = CRM_Contribute_BAO_Contribution::add($value, $ids); + if (!empty($value['contribution_status_id'])) { + CRM_Contribute_Form_AbstractEditPayment::updateRelatedComponent($contribution->id, + $value['contribution_status_id'], + CRM_Utils_Array::value("field[{$key}][contribution_status_id]", + $this->_defaultValues + ), + $contribution->receive_date + ); + } + // add custom field values if (!empty($value['custom']) && is_array($value['custom'])