From 35724050685bc025d8c3ddbba51cc2d2c4439f82 Mon Sep 17 00:00:00 2001 From: Brian Shaughnessy Date: Tue, 13 Sep 2016 09:11:24 -0400 Subject: [PATCH] CRM-19354 fix fatal on pdf generation if no trxn_id exists --- CRM/Contribute/Form/Task/PDF.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/CRM/Contribute/Form/Task/PDF.php b/CRM/Contribute/Form/Task/PDF.php index 00bdc93082..7f21365de7 100644 --- a/CRM/Contribute/Form/Task/PDF.php +++ b/CRM/Contribute/Form/Task/PDF.php @@ -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 -- 2.25.1