Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRM-18005: Add 'is_paid' variable to contribution invoice template #1

Open
wants to merge 1 commit into
base: 4.6
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CRM/Contribute/Form/Task/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,13 @@ public static function printPDF($contribIDs, &$params, $contactIds, &$form) {
$countryDomain = '';
}

$isPaid = false;
if($contribution->trxn_id != null) {
$r = CRM_Core_DAO::singleValueQuery('SELECT count(1) FROM civicrm_entity_financial_trxn eft LEFT JOIN civicrm_financial_trxn ft ON ft.id = eft.financial_trxn_id WHERE eft.entity_table=\'civicrm_contribution\' AND entity_id=%1 AND status_id=1', array(1 => array($contribution->id, 'String')));

$isPaid = $r > 0;
}

// parameters to be assign for template
$tplParams = array(
'title' => $title,
Expand Down Expand Up @@ -459,6 +466,7 @@ public static function printPDF($contribIDs, &$params, $contactIds, &$form) {
'domain_country' => $countryDomain,
'domain_email' => CRM_Utils_Array::value('email', CRM_Utils_Array::value('1', $locationDefaults['email'])),
'domain_phone' => CRM_Utils_Array::value('phone', CRM_Utils_Array::value('1', $locationDefaults['phone'])),
'is_paid' => $isPaid
);

if (isset($creditNoteId)) {
Expand Down