CRM-19054: Update Related Components when status updated from Profile Task
authorjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Fri, 22 Jul 2016 13:18:38 +0000 (18:48 +0530)
committerjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Fri, 22 Jul 2016 13:18:38 +0000 (18:48 +0530)
CRM/Contribute/Form/AbstractEditPayment.php
CRM/Contribute/Form/Contribution.php
CRM/Contribute/Form/Task/Batch.php

index e006218a3ec1f9cfbd40484a23274ece4087f592..622c027a0e7753cebe08b1d0ae14b0db849a9036 100644 (file)
@@ -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;
index 318b7f2290763bdeb1f7a22140a4eff0aab782c2..ab2789805c37ff00e3ed2c5594cdbaabbe3e31d4 100644 (file)
@@ -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
index 4976a0addd0ee75effb16fad081c3c7750f9b946..a97547a942acbf15dfe641e95f40c32dd7e3c6de 100644 (file)
@@ -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'])