CRM-19354 fix fatal on pdf generation if no trxn_id exists
authorBrian Shaughnessy <brian@lcdservices.biz>
Tue, 13 Sep 2016 13:11:24 +0000 (09:11 -0400)
committerBrian Shaughnessy <brian@lcdservices.biz>
Tue, 13 Sep 2016 13:11:24 +0000 (09:11 -0400)
CRM/Contribute/Form/Task/PDF.php

index 00bdc93082f316449fa1a097193310c40246d0cc..7f21365de7d7922fcabce190051908ef1d637019 100644 (file)
@@ -186,10 +186,11 @@ AND    {$this->_componentClause}";
       $input['trxn_date'] = isset($contribution->trxn_date) ? $contribution->trxn_date : NULL;
       $input['receipt_update'] = $params['receipt_update'];
       $input['contribution_status_id'] = $contribution->contribution_status_id;
-      $input['paymentProcessor'] = CRM_Core_DAO::singleValueQuery("SELECT payment_processor_id
-        FROM civicrm_financial_trxn
-        WHERE trxn_id = %1
-        LIMIT 1", array(
+      $input['paymentProcessor'] = empty($contribution->trxn_id) ? NULL :
+        CRM_Core_DAO::singleValueQuery("SELECT payment_processor_id
+          FROM civicrm_financial_trxn
+          WHERE trxn_id = %1
+          LIMIT 1", array(
           1 => array($contribution->trxn_id, 'String')));
 
       // CRM_Contribute_BAO_Contribution::composeMessageArray expects mysql formatted date