From 628801bf281fd21997d6eb2317437a5c8a0fdb9d Mon Sep 17 00:00:00 2001 From: Andrew Hunt Date: Mon, 16 Jun 2014 11:45:53 -0400 Subject: [PATCH] CRM-14879: basics for contact fields to display in schedule reminders form ---------------------------------------- * CRM-14879: Scheduled reminders for contact date fields https://issues.civicrm.org/jira/browse/CRM-14879 --- CRM/Core/BAO/ActionSchedule.php | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/CRM/Core/BAO/ActionSchedule.php b/CRM/Core/BAO/ActionSchedule.php index 7102700a25..585c95cd50 100755 --- a/CRM/Core/BAO/ActionSchedule.php +++ b/CRM/Core/BAO/ActionSchedule.php @@ -88,6 +88,7 @@ class CRM_Core_BAO_ActionSchedule extends CRM_Core_DAO_ActionSchedule { $eventTemplate = CRM_Event_PseudoConstant::eventTemplates(); $autoRenew = CRM_Core_OptionGroup::values('auto_renew_options'); $membershipType = CRM_Member_PseudoConstant::membershipType(); + $dateFields = array('birth_date' => ts('Birth Date')); asort($activityType); @@ -148,6 +149,13 @@ class CRM_Core_BAO_ActionSchedule extends CRM_Core_DAO_ActionSchedule { } $sel2[$key] = $valueLabel + $membershipType; break; + + case 'birth_date': + if ($value['entity'] == 'civicrm_contact') { + $sel1Val = ts('Contact'); + } + $sel2[$key] = $valueLabel + $dateFields; + break; } $sel1[$key] = $sel1Val; @@ -213,6 +221,16 @@ class CRM_Core_BAO_ActionSchedule extends CRM_Core_DAO_ActionSchedule { } break; + case 'none': + foreach ($sel3[$id] as $kkey => & $vval) { + $vval = $statusLabel; + } + break; + + case null: + $sel3[$id] = array('' => 'hello there'); + break; + case '': $sel3[$id] = ''; break; @@ -717,6 +735,13 @@ LEFT JOIN civicrm_phone phone ON phone.id = lb.phone_id } } + if ($mapping->entity == 'civicrm_contact') { + $tokenEntity = 'contact'; + //TODO: get full list somewhere! + $tokenFields = array('birth_date', 'last_name'); + //TODO: is there anything to add here? + } + $entityJoinClause = "INNER JOIN {$mapping->entity} e ON e.id = reminder.entity_id"; if ($actionSchedule->limit_to == 0) { $entityJoinClause = "LEFT JOIN {$mapping->entity} e ON e.id = reminder.entity_id"; @@ -995,6 +1020,10 @@ WHERE reminder.action_schedule_id = %1 AND reminder.action_date_time IS NULL $where[] = "e.status_id IN ({$mStatus})"; } + if ($mapping->entity == 'civicrm_contact') { + // TODO get this working + } + // CRM-13577 Introduce Smart Groups Handling if ($actionSchedule->group_id) { @@ -1332,4 +1361,3 @@ WHERE m.owner_membership_id IS NOT NULL AND return $options; } } - -- 2.25.1