$entityJoinClause .= $extraOn;
$query = "
-SELECT reminder.id as reminderID, reminder.contact_id as contactID, reminder.*, e.id as entityID, e.* {$extraSelect}
+SELECT reminder.id as reminderID, reminder.contact_id as contactID, reminder.entity_table as entityTable, reminder.*, e.id as entityID, e.* {$extraSelect}
FROM civicrm_action_log reminder
{$entityJoinClause}
{$extraJoin}
$entityTokenParams["{$tokenEntity}." . $field] = CRM_Utils_Date::customFormat($dao->$field);
}
elseif ($field == 'balance') {
- $info = CRM_Contribute_BAO_Contribution::getPaymentInfo($dao->entityID, 'event');
- $balancePay = CRM_Utils_Array::value('balance', $info);
- $balancePay = CRM_Utils_Money::format($balancePay);
+ if ($dao->entityTable == 'civicrm_contact') {
+ $balancePay = 'N/A';
+ }
+ elseif (!empty($dao->entityID)) {
+ $info = CRM_Contribute_BAO_Contribution::getPaymentInfo($dao->entityID, 'event');
+ $balancePay = CRM_Utils_Array::value('balance', $info);
+ $balancePay = CRM_Utils_Money::format($balancePay);
+ }
$entityTokenParams["{$tokenEntity}." . $field] = $balancePay;
}
elseif ($field == 'fee_amount') {