Ejegg has submitted this change and it was merged.

Change subject: Fix update script not to fall over on missing check_number
......................................................................


Fix update script not to fall over on missing check_number

During the last round of QA escaping for check_number was re-added. I just 
retested on staging and
it needs the COALESCE change to ensure that the value is not NULL as the 
escaping function expects a string.

The change to the form of the insert query was one suggested before that I made 
this time since I was retesting anyway

Bug: T124979
Change-Id: I5c3d2a04a995704f5c38b79cba9421a1dccbdcae
---
M sites/all/modules/wmf_civicrm/update_7070.php
1 file changed, 5 insertions(+), 5 deletions(-)

Approvals:
  Ejegg: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/sites/all/modules/wmf_civicrm/update_7070.php 
b/sites/all/modules/wmf_civicrm/update_7070.php
index f8b664d..c577c4a 100644
--- a/sites/all/modules/wmf_civicrm/update_7070.php
+++ b/sites/all/modules/wmf_civicrm/update_7070.php
@@ -70,8 +70,8 @@
       cont.total_amount,
       cont.net_amount,
       cont.fee_amount,
-      cont.trxn_id,
-      cont.check_number,
+      COALESCE(cont.trxn_id, '') as trxn_id,
+      COALESCE(cont.check_number, '') as check_number,
       cont.receive_date,
       cont.contact_id,
       cont.financial_type_id
@@ -121,7 +121,7 @@
           from_financial_account_id,
           trxn_date
         )
-       SELECT
+       VALUES(
          {$result->payment_instrument_id},
          %1,
          {$result->total_amount},
@@ -130,10 +130,10 @@
          %2,
          $refundStatus,
          %3,
-         " . (empty($result->payment_instrument_id) ? $financialAccountId : 
$paymentInstrumentMapping[$result->payment_instrument_id]) . " as 
to_financial_account_id,
+         " . (empty($result->payment_instrument_id) ? $financialAccountId : 
$paymentInstrumentMapping[$result->payment_instrument_id]) . ",
          NULL,
          '{$trxn_date}'
-        ";
+        )";
       CRM_Core_DAO::executeQuery($sql, $params);
       $financialTransactionID = CRM_Core_DAO::singleValueQuery("SELECT 
LAST_INSERT_ID()");
 

-- 
To view, visit https://gerrit.wikimedia.org/r/269312
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I5c3d2a04a995704f5c38b79cba9421a1dccbdcae
Gerrit-PatchSet: 2
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen <[email protected]>
Gerrit-Reviewer: Awight <[email protected]>
Gerrit-Reviewer: Cdentinger <[email protected]>
Gerrit-Reviewer: Ejegg <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to