From 13837844b530f92d9cd39a1d90925012f416eea2 Mon Sep 17 00:00:00 2001 From: Pratik Joshi Date: Thu, 23 Jan 2014 19:06:26 +0530 Subject: [PATCH] CRM-13965 : introduce new event token for 'balance' amount info display for schedule reminders --- CRM/Core/BAO/ActionSchedule.php | 6 +++++- CRM/Core/SelectValues.php | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CRM/Core/BAO/ActionSchedule.php b/CRM/Core/BAO/ActionSchedule.php index ea000abf11..1cd464761c 100755 --- a/CRM/Core/BAO/ActionSchedule.php +++ b/CRM/Core/BAO/ActionSchedule.php @@ -649,7 +649,7 @@ LEFT JOIN civicrm_option_value ov ON e.activity_type_id = ov.value AND ov.option if ($mapping->entity == 'civicrm_participant') { $tokenEntity = 'event'; - $tokenFields = array('event_type', 'title', 'event_id', 'start_date', 'end_date', 'summary', 'description', 'location', 'info_url', 'registration_url', 'fee_amount', 'contact_email', 'contact_phone'); + $tokenFields = array('event_type', 'title', 'event_id', 'start_date', 'end_date', 'summary', 'description', 'location', 'info_url', 'registration_url', 'fee_amount', 'contact_email', 'contact_phone', 'balance'); $extraSelect = ', ov.label as event_type, ev.title, ev.id as event_id, ev.start_date, ev.end_date, ev.summary, ev.description, address.street_address, address.city, address.state_province_id, address.postal_code, email.email as contact_email, phone.phone as contact_phone '; $extraJoin = " @@ -729,6 +729,10 @@ WHERE reminder.action_schedule_id = %1 AND reminder.action_date_time IS NULL elseif (in_array($field, array('start_date','end_date','join_date','activity_date_time'))) { $entityTokenParams["{$tokenEntity}." . $field] = CRM_Utils_Date::customFormat($dao->$field); } + elseif ($field == 'balance') { + $info = CRM_Contribute_BAO_Contribution::getPaymentInfo($dao->entityID, 'event'); + $entityTokenParams["{$tokenEntity}." . $field] = CRM_Utils_Array::value('balance', $info); + } else { $entityTokenParams["{$tokenEntity}." . $field] = $dao->$field; } diff --git a/CRM/Core/SelectValues.php b/CRM/Core/SelectValues.php index c7b96f54d6..6c4ddbd2f2 100644 --- a/CRM/Core/SelectValues.php +++ b/CRM/Core/SelectValues.php @@ -589,6 +589,7 @@ class CRM_Core_SelectValues { '{event.fee_amount}' => ts('Event Fees'), '{event.info_url}' => ts('Event Info URL'), '{event.registration_url}' => ts('Event Registration URL'), + '{event.balance}' => ts('Event Balance') ); } return $tokens; -- 2.25.1