CRM-15960 fix for net_amount being wiped:
authorEileen McNaughton <eileen@fuzion.co.nz>
Thu, 12 Feb 2015 05:40:26 +0000 (18:40 +1300)
committerEileen McNaughton <eileen@fuzion.co.nz>
Thu, 12 Feb 2015 05:40:26 +0000 (18:40 +1300)
CRM/Core/Payment/BaseIPN.php

index f8b2839fd1630b182191dbaae0a1a245522eb244..d21bcc9d4f7971eb883f68bfe9207d56d8fe97b7 100644 (file)
@@ -580,10 +580,21 @@ LIMIT 1;";
         'labelColumn' => 'name',
         'flip' => 1,
       ));
+
+    // @todo this section should call the api  in order to have hooks called &
+    // because all this 'messiness' setting variables could be avoided
+    // by letting the api resolve pseudoconstants & copy set values and format dates.
     $contribution->contribution_status_id = $contributionStatuses['Completed'];
     $contribution->is_test = $input['is_test'];
-    $contribution->fee_amount = CRM_Utils_Array::value('fee_amount', $input, 0);
-    $contribution->net_amount = CRM_Utils_Array::value('net_amount', $input, 0);
+
+    // CRM-15960 If we don't have a value we 'want' for the amounts, leave it to the BAO to sort out.
+    if (isset($input['net_amount'])) {
+      $contribution->fee_amount = CRM_Utils_Array::value('fee_amount', $input, 0);
+    }
+    if (isset($input['net_amount'])) {
+      $contribution->net_amount = $input['net_amount'];
+    }
+
     $contribution->trxn_id = $input['trxn_id'];
     $contribution->receive_date = CRM_Utils_Date::isoToMysql($contribution->receive_date);
     $contribution->thankyou_date = CRM_Utils_Date::isoToMysql($contribution->thankyou_date);