From: Allen Shaw Date: Wed, 1 May 2013 20:53:15 +0000 (-0700) Subject: Refactored out of CRM_Core_PseudoConstant: IMProvider(), pcm(), preferredCommunicatio... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=e7e657f077921a7a39f737e9f107364456995e5b;p=civicrm-core.git Refactored out of CRM_Core_PseudoConstant: IMProvider(), pcm(), preferredCommunicationMethod(), activityContacts(), eventContacts(), getBatchMode(), autoRenew(). CRM-12464 ---------------------------------------- * CRM-12464: Search improvements in 4.4 http://issues.civicrm.org/jira/browse/CRM-12464 ---------------------------------------- * CRM-12464: http://issues.civicrm.org/jira/browse/CRM-12464 * CRM-12464:: http://issues.civicrm.org/jira/browse/CRM-12464: --- diff --git a/CRM/Activity/BAO/Activity.php b/CRM/Activity/BAO/Activity.php index 5c0c0a15c3..314594ca6f 100644 --- a/CRM/Activity/BAO/Activity.php +++ b/CRM/Activity/BAO/Activity.php @@ -91,7 +91,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { $activity->copyValues($params); if ($activity->find(TRUE)) { - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts); $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); @@ -205,7 +205,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { $logMsg = 'Case Activity deleted for'; $msgs = array(); - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts); $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); @@ -349,7 +349,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { } $activityId = $activity->id; - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts); $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); @@ -626,7 +626,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { $session = CRM_Core_Session::singleton(); $id = $session->get('userID'); if (!$id) { - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts); $id = self::getActivityContact($activity->id. $sourceID); } @@ -794,7 +794,7 @@ INNER JOIN {$activityContactTempTable} on {$activityTempTable}.activity_id = {$a $allCampaigns = CRM_Campaign_BAO_Campaign::getCampaigns(NULL, NULL, FALSE, FALSE, FALSE, TRUE); $values = array(); - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts); $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); @@ -1512,7 +1512,7 @@ INNER JOIN civicrm_contact contact ON ac.contact_id = contact.id return $sendResult; } - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); @@ -1567,7 +1567,7 @@ INNER JOIN civicrm_contact contact ON ac.contact_id = contact.id $toDisplayName = $toEmail; } - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); //$sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts); //$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); @@ -1669,7 +1669,7 @@ INNER JOIN civicrm_contact contact ON ac.contact_id = contact.id */ static function getContactActivity($contactId) { $activities = array(); - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts); $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); @@ -2182,7 +2182,7 @@ AND cl.modified_id = c.id if (!$contactId) { return $result; } - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts); $transaction = new CRM_Core_Transaction(); @@ -2305,7 +2305,7 @@ INNER JOIN civicrm_option_group grp ON ( grp.id = val.option_group_id AND grp.n $permission = CRM_Core_Permission::EDIT; } - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts); $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); @@ -2559,7 +2559,7 @@ INNER JOIN civicrm_option_group grp ON ( grp.id = val.option_group_id AND grp.n public static function getSourceContactID($activityId) { static $sourceID = NULL; if (!$sourceID) { - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts); } diff --git a/CRM/Activity/BAO/ActivityAssignment.php b/CRM/Activity/BAO/ActivityAssignment.php index 2c2af568c2..15a02c95ad 100644 --- a/CRM/Activity/BAO/ActivityAssignment.php +++ b/CRM/Activity/BAO/ActivityAssignment.php @@ -58,7 +58,7 @@ class CRM_Activity_BAO_ActivityAssignment extends CRM_Activity_DAO_ActivityConta */ public static function create(&$params) { $assignment = new CRM_Activity_BAO_ActivityContact(); - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); $assignment->copyValues($params); @@ -83,7 +83,7 @@ class CRM_Activity_BAO_ActivityAssignment extends CRM_Activity_DAO_ActivityConta return $assigneeArray; } - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); $sql = " @@ -119,7 +119,7 @@ AND civicrm_contact.is_deleted = 0 if (empty($activityID)) { return $assigneeNames; } - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); $whereClause = ""; diff --git a/CRM/Activity/BAO/ActivityTarget.php b/CRM/Activity/BAO/ActivityTarget.php index d68edc0d7d..cc48bda14f 100644 --- a/CRM/Activity/BAO/ActivityTarget.php +++ b/CRM/Activity/BAO/ActivityTarget.php @@ -58,7 +58,7 @@ class CRM_Activity_BAO_ActivityTarget extends CRM_Activity_DAO_ActivityContact { */ public static function create(&$params) { $target = new CRM_Activity_BAO_ActivityContact(); - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); $target->copyValues($params); @@ -82,7 +82,7 @@ class CRM_Activity_BAO_ActivityTarget extends CRM_Activity_DAO_ActivityContact { return $targetArray; } - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); $sql = " @@ -116,7 +116,7 @@ AND civicrm_contact.is_deleted = 0 if (empty($activityID)) { return $targetNames; } - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); $query = " diff --git a/CRM/Activity/BAO/Query.php b/CRM/Activity/BAO/Query.php index f251f70c26..32bbd84635 100644 --- a/CRM/Activity/BAO/Query.php +++ b/CRM/Activity/BAO/Query.php @@ -231,7 +231,7 @@ class CRM_Activity_BAO_Query { case 'activity_role': CRM_Contact_BAO_Query::$_activityRole = $values[2]; - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts); $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); diff --git a/CRM/Activity/Form/Activity.php b/CRM/Activity/Form/Activity.php index 05f805d8f8..b665527031 100644 --- a/CRM/Activity/Form/Activity.php +++ b/CRM/Activity/Form/Activity.php @@ -1078,7 +1078,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { */ protected function processActivity(&$params) { $activityAssigned = array(); - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); // format assignee params if (!CRM_Utils_Array::crmIsEmptyArray($params['assignee_contact_id'])) { diff --git a/CRM/Activity/Form/Task/PickOption.php b/CRM/Activity/Form/Task/PickOption.php index 86d81431b1..f3f42943bd 100644 --- a/CRM/Activity/Form/Task/PickOption.php +++ b/CRM/Activity/Form/Task/PickOption.php @@ -150,7 +150,7 @@ class CRM_Activity_Form_Task_PickOption extends CRM_Activity_Form_Task { $params = $this->exportValues(); $this->_contacts = array(); - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); //get assignee contacts diff --git a/CRM/Activity/Page/AJAX.php b/CRM/Activity/Page/AJAX.php index 75b235dd25..c2e1bc75bd 100644 --- a/CRM/Activity/Page/AJAX.php +++ b/CRM/Activity/Page/AJAX.php @@ -362,7 +362,7 @@ class CRM_Activity_Page_AJAX { $targetContacts = array_unique(explode(',', $params['targetContactIds'])); } - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts); $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); diff --git a/CRM/Activity/Selector/Search.php b/CRM/Activity/Selector/Search.php index 81a5d9bd79..408c9b9e8e 100644 --- a/CRM/Activity/Selector/Search.php +++ b/CRM/Activity/Selector/Search.php @@ -249,7 +249,7 @@ class CRM_Activity_Selector_Search extends CRM_Core_Selector_Base implements CRM $allCampaigns = CRM_Campaign_BAO_Campaign::getCampaigns(NULL, NULL, FALSE, FALSE, FALSE, TRUE); $engagementLevels = CRM_Campaign_PseudoConstant::engagementLevel(); - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts); $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); diff --git a/CRM/Campaign/BAO/Query.php b/CRM/Campaign/BAO/Query.php index 555e2494cc..c536a003a5 100755 --- a/CRM/Campaign/BAO/Query.php +++ b/CRM/Campaign/BAO/Query.php @@ -204,7 +204,7 @@ class CRM_Campaign_BAO_Query { return $from; } - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts); $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); diff --git a/CRM/Campaign/BAO/Survey.php b/CRM/Campaign/BAO/Survey.php index 333c176c92..884b86ed6d 100644 --- a/CRM/Campaign/BAO/Survey.php +++ b/CRM/Campaign/BAO/Survey.php @@ -516,7 +516,7 @@ Group By contact.id"; } $targetContactIds = ' ( ' . implode(',', $voterIds) . ' ) '; - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); @@ -606,7 +606,7 @@ INNER JOIN civicrm_activity_contact activityAssignment contact_a.display_name as voter_name"; } - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); @@ -1006,7 +1006,7 @@ INNER JOIN civicrm_contact contact_a ON ( activityTarget.contact_id = contact_a } $interviewers = array(); - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); $query = " diff --git a/CRM/Case/BAO/Case.php b/CRM/Case/BAO/Case.php index 9bdad9ac62..4050d5a7dd 100644 --- a/CRM/Case/BAO/Case.php +++ b/CRM/Case/BAO/Case.php @@ -974,7 +974,7 @@ SELECT case_status.label AS case_status, status_id, case_type.label AS case_type static function getCaseActivity($caseID, &$params, $contactID, $context = NULL, $userID = NULL, $type = NULL) { $values = array(); - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); @@ -2256,7 +2256,7 @@ INNER JOIN civicrm_case_contact ON ( civicrm_case.id = civicrm_case_contact.cas $activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'name'); $activityStatuses = CRM_Core_PseudoConstant::activityStatus('name'); - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts); $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); diff --git a/CRM/Case/Form/Activity.php b/CRM/Case/Form/Activity.php index 8a60f1747f..cdbc2bd97d 100644 --- a/CRM/Case/Form/Activity.php +++ b/CRM/Case/Form/Activity.php @@ -603,7 +603,7 @@ class CRM_Case_Form_Activity extends CRM_Activity_Form_Activity { //CRM-5695 //check for notification settings for assignee contacts $selectedContacts = array('contact_check'); - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'activity_assignee_notification' diff --git a/CRM/Case/Form/ActivityView.php b/CRM/Case/Form/ActivityView.php index e425ac405e..3df941e3c9 100644 --- a/CRM/Case/Form/ActivityView.php +++ b/CRM/Case/Form/ActivityView.php @@ -132,7 +132,7 @@ class CRM_Case_Form_ActivityView extends CRM_Core_Form { //viewing activity should get diplayed in recent list.CRM-4670 $activityTypeID = CRM_Core_DAO::getFieldValue('CRM_Activity_DAO_Activity', $activityID, 'activity_type_id'); - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); $activityTargetContacts = CRM_Activity_BAO_ActivityContact::retrieveContactIdsByActivityId($activityID, $targetID); if (!empty($activityTargetContacts)) { diff --git a/CRM/Case/XMLProcessor/Process.php b/CRM/Case/XMLProcessor/Process.php index 9e61115fc2..59377b45cb 100644 --- a/CRM/Case/XMLProcessor/Process.php +++ b/CRM/Case/XMLProcessor/Process.php @@ -253,7 +253,7 @@ class CRM_Case_XMLProcessor_Process extends CRM_Case_XMLProcessor { } function deleteEmptyActivity(&$params) { - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); $query = " diff --git a/CRM/Case/XMLProcessor/Report.php b/CRM/Case/XMLProcessor/Report.php index 572b12be3e..104fd866f0 100644 --- a/CRM/Case/XMLProcessor/Report.php +++ b/CRM/Case/XMLProcessor/Report.php @@ -225,7 +225,7 @@ AND ac.case_id = %1 $joinCaseActivity = " INNER JOIN civicrm_case_activity ca ON a.id = ca.activity_id "; } - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); @@ -301,7 +301,7 @@ WHERE a.id = %1 ); } - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); if (!empty($activityDAO->targetID)) { @@ -373,7 +373,7 @@ WHERE a.id = %1 'value' => $this->redact($creator), 'type' => 'String', ); - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts); $source_contact_id = CRM_Activity_BAO_Activity::getActivityContact($activityDAO->id, $sourceID); $reporter = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', diff --git a/CRM/Contact/BAO/Contact.php b/CRM/Contact/BAO/Contact.php index 16187e10e2..129831576a 100644 --- a/CRM/Contact/BAO/Contact.php +++ b/CRM/Contact/BAO/Contact.php @@ -610,7 +610,7 @@ WHERE civicrm_contact.id = " . CRM_Utils_Type::escape($id, 'Integer'); if ($name == 'im') { CRM_Utils_Array::lookupValue($values, 'provider', - CRM_Core_PseudoConstant::IMProvider(), + CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id'), $reverse ); } diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index b3bf07c144..fba6b89eba 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -2674,7 +2674,7 @@ WHERE id IN ( $groupIDs ) // search tag in activities $etActTable = "`civicrm_entity_act_tag-" . $value . "`"; $tActTable = "`civicrm_act_tag-" . $value . "`"; - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); $this->_tables[$etActTable] = @@ -2738,7 +2738,7 @@ WHERE id IN ( $groupIDs ) // search tag in cases $etCaseTable = "`civicrm_entity_case_tag-" . $value . "`"; - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); $this->_tables[$etCaseTable] = @@ -3624,7 +3624,7 @@ WHERE id IN ( $groupIDs ) } } - $commPref = CRM_Core_PseudoConstant::pcm(); + $commPref = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'preferred_communication_method'); $sqlValue = array(); $sql = "contact_a.preferred_communication_method"; diff --git a/CRM/Contact/Form/Edit/CommunicationPreferences.php b/CRM/Contact/Form/Edit/CommunicationPreferences.php index 3c784c66e6..259ea81bdd 100644 --- a/CRM/Contact/Form/Edit/CommunicationPreferences.php +++ b/CRM/Contact/Form/Edit/CommunicationPreferences.php @@ -73,7 +73,7 @@ class CRM_Contact_Form_Edit_CommunicationPreferences { $form->addGroup($privacy, 'privacy', ts('Privacy'), ' '); // preferred communication method - $comm = CRM_Core_PseudoConstant::pcm(TRUE); + $comm = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'preferred_communication_method', array('loclize' => TRUE)); foreach ($comm as $value => $title) { $commPreff[] = $form->createElement('advcheckbox', $value, NULL, $title); } diff --git a/CRM/Contact/Form/Edit/IM.php b/CRM/Contact/Form/Edit/IM.php index 710abef095..f5f901e069 100644 --- a/CRM/Contact/Form/Edit/IM.php +++ b/CRM/Contact/Form/Edit/IM.php @@ -59,7 +59,7 @@ class CRM_Contact_Form_Edit_IM { $form->applyFilter('__ALL__', 'trim'); //IM provider select - $form->addElement('select', "im[$blockId][provider_id]", '', CRM_Core_PseudoConstant::IMProvider()); + $form->addElement('select', "im[$blockId][provider_id]", '', CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id')); //Block type select $form->addElement('select', "im[$blockId][location_type_id]", '', CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id')); diff --git a/CRM/Contact/Form/Search/Criteria.php b/CRM/Contact/Form/Search/Criteria.php index 6c0ac1aaee..ac7f0e312a 100644 --- a/CRM/Contact/Form/Search/Criteria.php +++ b/CRM/Contact/Form/Search/Criteria.php @@ -241,7 +241,7 @@ class CRM_Contact_Form_Search_Criteria { $form->addRadio('privacy_toggle', ts('Privacy Options'), $options); // preferred communication method - $comm = CRM_Core_PseudoConstant::pcm(); + $comm = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'preferred_communication_method'); $commPreff = array(); foreach ($comm as $k => $v) { diff --git a/CRM/Contact/Form/Search/Custom/ActivitySearch.php b/CRM/Contact/Form/Search/Custom/ActivitySearch.php index 118adb0932..2c50ebc7e2 100644 --- a/CRM/Contact/Form/Search/Custom/ActivitySearch.php +++ b/CRM/Contact/Form/Search/Custom/ActivitySearch.php @@ -224,7 +224,7 @@ class CRM_Contact_Form_Search_Custom_ActivitySearch implements CRM_Contact_Form_ // Regular JOIN statements here to limit results to contacts who have activities. function from() { - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); return " civicrm_contact contact_a diff --git a/CRM/Contact/Form/Task/Label.php b/CRM/Contact/Form/Task/Label.php index 7a61f6da17..ed4a8d0bc6 100644 --- a/CRM/Contact/Form/Task/Label.php +++ b/CRM/Contact/Form/Task/Label.php @@ -329,7 +329,7 @@ class CRM_Contact_Form_Task_Label extends CRM_Contact_Form_Task { foreach ($rows as $id => $row) { if ($commMethods = CRM_Utils_Array::value('preferred_communication_method', $row)) { $val = array_filter(explode(CRM_Core_DAO::VALUE_SEPARATOR, $commMethods)); - $comm = CRM_Core_PseudoConstant::pcm(); + $comm = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'preferred_communication_method'); $temp = array(); foreach ($val as $vals) { $temp[] = $comm[$vals]; diff --git a/CRM/Contact/Form/Task/PDFLetterCommon.php b/CRM/Contact/Form/Task/PDFLetterCommon.php index e46361cc23..fa33e96194 100644 --- a/CRM/Contact/Form/Task/PDFLetterCommon.php +++ b/CRM/Contact/Form/Task/PDFLetterCommon.php @@ -383,7 +383,7 @@ class CRM_Contact_Form_Task_PDFLetterCommon { } } - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); foreach ($form->_contactIds as $contactId) { diff --git a/CRM/Contact/Form/Task/SMSCommon.php b/CRM/Contact/Form/Task/SMSCommon.php index 54607bb23d..152793c962 100644 --- a/CRM/Contact/Form/Task/SMSCommon.php +++ b/CRM/Contact/Form/Task/SMSCommon.php @@ -142,7 +142,7 @@ class CRM_Contact_Form_Task_SMSCommon { continue; } - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); //target contacts limit check $ids = array_keys(CRM_Activity_BAO_ActivityContact::getNames($id, $targetID)); diff --git a/CRM/Contact/Import/Form/MapField.php b/CRM/Contact/Import/Form/MapField.php index 31591528d9..0f2f6fba45 100644 --- a/CRM/Contact/Import/Form/MapField.php +++ b/CRM/Contact/Import/Form/MapField.php @@ -354,7 +354,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Core_Form { $sel2[''] = NULL; $phoneTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id'); - $imProviders = CRM_Core_PseudoConstant::IMProvider(); + $imProviders = CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id'); $websiteTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id'); foreach ($this->_location_types as $key => $value) { @@ -762,7 +762,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Core_Form { $mapperKeysMain = array(); $phoneTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id'); - $imProviders = CRM_Core_PseudoConstant::IMProvider(); + $imProviders = CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id'); $websiteTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id'); $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); diff --git a/CRM/Contact/Import/ImportJob.php b/CRM/Contact/Import/ImportJob.php index 2007de91d1..ddfcbdd352 100644 --- a/CRM/Contact/Import/ImportJob.php +++ b/CRM/Contact/Import/ImportJob.php @@ -145,7 +145,7 @@ class CRM_Contact_Import_ImportJob { $mapper = $this->_mapper; $mapperFields = array(); $phoneTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id'); - $imProviders = CRM_Core_PseudoConstant::IMProvider(); + $imProviders = CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id'); $websiteTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id'); $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); diff --git a/CRM/Contact/Import/Parser/Contact.php b/CRM/Contact/Import/Parser/Contact.php index 608c3426e1..7ec2f4d67b 100644 --- a/CRM/Contact/Import/Parser/Contact.php +++ b/CRM/Contact/Import/Parser/Contact.php @@ -1373,7 +1373,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { $preffComm = array(); $preffComm = explode(',', $value); foreach ($preffComm as $v) { - if (!self::in_value(trim($v), CRM_Core_PseudoConstant::pcm())) { + if (!self::in_value(trim($v), CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'preferred_communication_method'))) { self::addToErrorMsg(ts('Preferred Communication Method'), $errorMessage); } } diff --git a/CRM/Contact/Page/Inline/IM.php b/CRM/Contact/Page/Inline/IM.php index 39fc657c94..f2bfd6698b 100644 --- a/CRM/Contact/Page/Inline/IM.php +++ b/CRM/Contact/Page/Inline/IM.php @@ -53,7 +53,7 @@ class CRM_Contact_Page_Inline_IM extends CRM_Core_Page { $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST); $locationTypes = CRM_Core_PseudoConstant::locationDisplayName(); - $IMProviders = CRM_Core_PseudoConstant::IMProvider(); + $IMProviders = CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id'); $entityBlock = array('contact_id' => $contactId); $ims = CRM_Core_BAO_IM::getValues($entityBlock); diff --git a/CRM/Contact/Selector.php b/CRM/Contact/Selector.php index 734f31ce7c..7a82cb4788 100644 --- a/CRM/Contact/Selector.php +++ b/CRM/Contact/Selector.php @@ -642,7 +642,7 @@ class CRM_Contact_Selector extends CRM_Core_Selector_Base implements CRM_Core_Se elseif (strpos($property, '-im')) { $row[$property] = $result->$property; if (!empty($result->$property)) { - $imProviders = CRM_Core_PseudoConstant::IMProvider(); + $imProviders = CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id'); $providerId = $property . "-provider_id"; $providerName = $imProviders[$result->$providerId]; $row[$property] = $result->$property . " ({$providerName})"; diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index 6f866190e4..6e56b0c763 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -1746,7 +1746,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac AND civicrm_activity_contact.record_type_id = %3 "; - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts); $params = array( diff --git a/CRM/Core/BAO/ActionSchedule.php b/CRM/Core/BAO/ActionSchedule.php index 199641fd74..30712cec5e 100755 --- a/CRM/Core/BAO/ActionSchedule.php +++ b/CRM/Core/BAO/ActionSchedule.php @@ -81,7 +81,7 @@ class CRM_Core_BAO_ActionSchedule extends CRM_Core_DAO_ActionSchedule { $event = CRM_Event_PseudoConstant::event(NULL, FALSE, "( is_template IS NULL OR is_template != 1 )"); $eventType = CRM_Event_PseudoConstant::eventType(); $eventTemplate = CRM_Event_PseudoConstant::eventTemplates(); - $autoRenew = CRM_Core_PseudoConstant::autoRenew(); + $autoRenew = CRM_Core_OptionGroup::values('auto_renew_options'); $membershipType = CRM_Member_PseudoConstant::membershipType(); asort($activityType); @@ -155,15 +155,15 @@ class CRM_Core_BAO_ActionSchedule extends CRM_Core_DAO_ActionSchedule { switch ($entityRecipient) { case 'activity_contacts': - $activityContacts = CRM_Core_PseudoConstant::activityContacts(); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts'); $sel5[$entityRecipient] = $activityContacts + $options; - $recipientMapping += CRM_Core_PseudoConstant::activityContacts('name'); + $recipientMapping += CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); break; case 'event_contacts': - $eventContacts = CRM_Core_PseudoConstant::eventContacts(); + $eventContacts = CRM_Core_OptionGroup::values('event_contacts'); $sel5[$entityRecipient] = $eventContacts + $options; - $recipientMapping += CRM_Core_PseudoConstant::eventContacts('name'); + $recipientMapping += CRM_Core_OptionGroup::values('event_contacts', FALSE, FALSE, FALSE, NULL, 'name'); break; case NULL: @@ -247,15 +247,15 @@ class CRM_Core_BAO_ActionSchedule extends CRM_Core_DAO_ActionSchedule { switch ($entityRecipient) { case 'activity_contacts': - $activityContacts = CRM_Core_PseudoConstant::activityContacts(); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts'); $sel5[$id] = $activityContacts + $options; - $recipientMapping += CRM_Core_PseudoConstant::activityContacts('name'); + $recipientMapping += CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); break; case 'event_contacts': - $eventContacts = CRM_Core_PseudoConstant::eventContacts(); + $eventContacts = CRM_Core_OptionGroup::values('event_contacts'); $sel5[$id] = $eventContacts + $options; - $recipientMapping += CRM_Core_PseudoConstant::eventContacts('name'); + $recipientMapping += CRM_Core_OptionGroup::values('event_contacts', FALSE, FALSE, FALSE, NULL, 'name'); break; case NULL: @@ -289,7 +289,7 @@ class CRM_Core_BAO_ActionSchedule extends CRM_Core_DAO_ActionSchedule { $civicrm_participant_status_type = CRM_Event_PseudoConstant::participantStatus(NULL, NULL, 'label'); $event_template = CRM_Event_PseudoConstant::eventTemplates(); - $auto_renew_options = CRM_Core_PseudoConstant::autoRenew(); + $auto_renew_options = CRM_Core_OptionGroup::values('auto_renew_options'); $civicrm_membership_type = CRM_Member_PseudoConstant::membershipType(); asort($activity_type); @@ -751,7 +751,7 @@ WHERE reminder.action_schedule_id = %1 AND reminder.action_date_time IS NULL if ($mapping->entity == 'civicrm_activity') { $contactField = 'r.contact_id'; - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts); $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); @@ -1026,7 +1026,7 @@ WHERE m.owner_membership_id IS NOT NULL AND switch ($mapping['entity']) { case 'civicrm_participant': - $eventContacts = CRM_Core_PseudoConstant::eventContacts('name'); + $eventContacts = CRM_Core_OptionGroup::values('event_contacts', FALSE, FALSE, FALSE, NULL, 'name'); if (!CRM_Utils_Array::value($recipientType, $eventContacts)) { return $options; } diff --git a/CRM/Core/BAO/Mapping.php b/CRM/Core/BAO/Mapping.php index 752bebe886..0a4912d3b8 100644 --- a/CRM/Core/BAO/Mapping.php +++ b/CRM/Core/BAO/Mapping.php @@ -566,7 +566,7 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping { $sel3[''] = NULL; $sel5[''] = NULL; $phoneTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id'); - $imProviders = CRM_Core_PseudoConstant::IMProvider(); + $imProviders = CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id'); asort($phoneTypes); foreach ($sel1 as $k => $sel) { diff --git a/CRM/Core/BAO/UFGroup.php b/CRM/Core/BAO/UFGroup.php index 2c03cd1b37..6fdaa2a516 100644 --- a/CRM/Core/BAO/UFGroup.php +++ b/CRM/Core/BAO/UFGroup.php @@ -914,7 +914,7 @@ class CRM_Core_BAO_UFGroup extends CRM_Core_DAO_UFGroup { $config = CRM_Core_Config::singleton(); $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); - $imProviders = CRM_Core_PseudoConstant::IMProvider(); + $imProviders = CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id'); $websiteTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id'); $multipleFields = array('url'); @@ -968,7 +968,7 @@ class CRM_Core_BAO_UFGroup extends CRM_Core_DAO_UFGroup { $params[$index] = $details->$idx; } elseif ($name === 'preferred_communication_method') { - $communicationFields = CRM_Core_PseudoConstant::pcm(); + $communicationFields = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'preferred_communication_method'); $compref = array(); $pref = explode(CRM_Core_DAO::VALUE_SEPARATOR, $details->$name); @@ -1802,13 +1802,13 @@ AND ( entity_id IS NULL OR entity_id <= 0 ) } $form->add('select', $providerName, NULL, array( - '' => ts('- select -')) + CRM_Core_PseudoConstant::IMProvider(), $required + '' => ts('- select -')) + CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id'), $required ); } else { $form->add('select', $name . '-provider_id', $title, array( - '' => ts('- select -')) + CRM_Core_PseudoConstant::IMProvider(), $required + '' => ts('- select -')) + CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id'), $required ); } @@ -1916,7 +1916,7 @@ AND ( entity_id IS NULL OR entity_id <= 0 ) ); } elseif ($fieldName === 'preferred_communication_method') { - $communicationFields = CRM_Core_PseudoConstant::pcm(); + $communicationFields = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'preferred_communication_method'); foreach ($communicationFields as $key => $var) { if ($key == '') { continue; diff --git a/CRM/Core/PseudoConstant.php b/CRM/Core/PseudoConstant.php index a6e0a48a11..a3ba2413b7 100644 --- a/CRM/Core/PseudoConstant.php +++ b/CRM/Core/PseudoConstant.php @@ -91,13 +91,6 @@ class CRM_Core_PseudoConstant { */ private static $component; - /** - * im protocols - * @var array - * @static - */ - private static $imProvider; - /** * states, provinces * @var array @@ -196,13 +189,6 @@ class CRM_Core_PseudoConstant { */ private static $currencySymbols; - /** - * preferred communication methods - * @var array - * @static - */ - private static $pcm; - /** * payment processor * @var array @@ -259,34 +245,6 @@ class CRM_Core_PseudoConstant { */ private static $extensions; - /** - * activity contacts - * @var array - * @static - */ - private static $activityContacts; - - /** - * event contacts - * @var array - * @static - */ - private static $eventContacts; - - /** - * auto renew options - * @var array - * @static - */ - private static $autoRenew; - - /** - * batch mode options - * @var array - * @static - */ - private static $batchModes; - /** * contact Type * @var array @@ -651,28 +609,6 @@ class CRM_Core_PseudoConstant { } return self::$component; } - - /** - * Get all the IM Providers from database. - * - * The static array imProvider is returned, and if it's - * called the first time, the IM DAO is used - * to get all the IM Providers. - * - * Note: any database errors will be trapped by the DAO. - * - * @access public - * @static - * - * @return array - array reference of all IM providers. - * - */ - public static function &IMProvider($localize = FALSE) { - if (!self::$imProvider) { - self::$imProvider = CRM_Core_OptionGroup::values('instant_messenger_service', FALSE, FALSE, $localize); - } - return self::$imProvider; - } /** * Get all the State/Province from database. @@ -1454,29 +1390,6 @@ WHERE id = %1"; return self::$county; } - /** - * Get all the Preferred Communication Methods from database. - * - * @access public - * @static - * - * @return array self::pcm - array reference of all preferred communication methods. - * - */ - public static function &pcm($localize = FALSE) { - if (!self::$pcm) { - self::$pcm = CRM_Core_OptionGroup::values('preferred_communication_method', FALSE, FALSE, $localize); - } - return self::$pcm; - } - - /** - * Alias of pcm - */ - public static function preferredCommunicationMethod($localize = FALSE) { - return self::pcm($localize); - } - /** * Get all active payment processors * @@ -1881,46 +1794,6 @@ WHERE id = %1 return CRM_Extension_System::singleton()->getMapper()->getActiveModuleFiles($fresh); } - /** - * Get all Activity Contacts - * - * The static array activityContacts is returned - * - * @access public - * @static - * - * @param string $column db column name/label. - * - * @return array - array reference of all activity Contacts - * - */ - public static function &activityContacts($column = 'label') { - if (!self::$activityContacts) { - self::$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, $column); - } - return self::$activityContacts; - } - - /** - * Get all Event Contacts - * - * The static array eventContacts is returned - * - * @access public - * @static - * - * @param string $column db column name/label. - * - * @return array - array reference of all event Contacts - * - */ - public static function &eventContacts($column = 'label') { - if (!self::$eventContacts) { - self::$eventContacts = CRM_Core_OptionGroup::values('event_contacts', FALSE, FALSE, FALSE, NULL, $column); - } - return self::$eventContacts; - } - /** * Get all options values * @@ -1946,24 +1819,6 @@ WHERE id = %1 return self::$accountOptionValues[$cacheKey]; } - /** - * Get all batch modes - * - * The static array batchModes - * - * @access public - * @static - * - * @return array - array reference of all batch modes - */ - public static function &getBatchMode($columnName = 'label') { - if (!self::$batchModes) { - self::$batchModes = CRM_Core_OptionGroup::values('batch_mode', false, false, false, null, $columnName); - } - - return self::$batchModes; - } - /* * The static array contactType is returned * @@ -1981,21 +1836,5 @@ WHERE id = %1 } return self::$contactType; } - - /** - * Get all the auto renew options - * - * @access public - * @static - * - * @return array self::autoRenew - array reference of all autoRenew - * - */ - public static function &autoRenew() { - if (!self::$autoRenew) { - self::$autoRenew = CRM_Core_OptionGroup::values('auto_renew_options', FALSE, FALSE); - } - return self::$autoRenew; - } } diff --git a/CRM/Event/BAO/Event.php b/CRM/Event/BAO/Event.php index bf6c39c585..46d0bdc282 100644 --- a/CRM/Event/BAO/Event.php +++ b/CRM/Event/BAO/Event.php @@ -1338,7 +1338,7 @@ WHERE civicrm_event.is_active = 1 } } $customVal = ''; - $imProviders = CRM_Core_PseudoConstant::IMProvider(); + $imProviders = CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id'); //start of code to set the default values foreach ($fields as $name => $field) { $skip = FALSE; @@ -1398,7 +1398,7 @@ WHERE civicrm_event.is_active = 1 $values[$index] = $greeting[$params[$name]]; } elseif ($name === 'preferred_communication_method') { - $communicationFields = CRM_Core_PseudoConstant::pcm(); + $communicationFields = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'preferred_communication_method'); $compref = array(); $pref = $params[$name]; if (is_array($pref)) { diff --git a/CRM/Export/BAO/Export.php b/CRM/Export/BAO/Export.php index a6f1b86555..2590e3030b 100644 --- a/CRM/Export/BAO/Export.php +++ b/CRM/Export/BAO/Export.php @@ -84,7 +84,7 @@ class CRM_Export_BAO_Export { $exportCampaign = FALSE; $phoneTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id'); - $imProviders = CRM_Core_PseudoConstant::IMProvider(); + $imProviders = CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id'); $contactRelationshipTypes = CRM_Contact_BAO_Relationship::getContactRelationshipType( NULL, NULL, diff --git a/CRM/Financial/Form/FinancialBatch.php b/CRM/Financial/Form/FinancialBatch.php index fd4376e333..5eca23bdc2 100644 --- a/CRM/Financial/Form/FinancialBatch.php +++ b/CRM/Financial/Form/FinancialBatch.php @@ -224,7 +224,7 @@ class CRM_Financial_Form_FinancialBatch extends CRM_Contribute_Form { } if ($this->_action & CRM_Core_Action::ADD) { - $batchMode = CRM_Core_PseudoConstant::getBatchMode('name'); + $batchMode = CRM_Core_PseudoConstant::get('CRM_Batch_DAO_Batch', 'mode_id', array('labelColumnName' => 'name')); $params['mode_id'] = CRM_Utils_Array::key('Manual Batch', $batchMode); $params['status_id'] = CRM_Utils_Array::key('Open', $batchStatus); $params['created_date'] = date('YmdHis'); diff --git a/CRM/Friend/BAO/Friend.php b/CRM/Friend/BAO/Friend.php index 8f608b00ae..e69debe2a9 100644 --- a/CRM/Friend/BAO/Friend.php +++ b/CRM/Friend/BAO/Friend.php @@ -135,7 +135,7 @@ class CRM_Friend_BAO_Friend extends CRM_Friend_DAO_Friend { //activity creation $activity = CRM_Activity_BAO_Activity::create($activityParams); - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); //friend contacts creation diff --git a/CRM/Logging/Differ.php b/CRM/Logging/Differ.php index a9ba451f9d..c98637ceea 100644 --- a/CRM/Logging/Differ.php +++ b/CRM/Logging/Differ.php @@ -82,7 +82,7 @@ class CRM_Logging_Differ { $contactIdClause = "AND (contact_id_a = %3 OR contact_id_b = %3)"; break; case 'civicrm_activity': - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts); $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); @@ -238,10 +238,10 @@ WHERE log_conn_id = %1 AND 'location_type_id' => CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'), 'payment_instrument_id' => CRM_Contribute_PseudoConstant::paymentInstrument(), 'phone_type_id' => CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id'), - 'preferred_communication_method' => CRM_Core_PseudoConstant::pcm(), + 'preferred_communication_method' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'preferred_communication_method'), 'preferred_language' => CRM_Core_PseudoConstant::languages(), 'prefix_id' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'prefix_id'), - 'provider_id' => CRM_Core_PseudoConstant::IMProvider(), + 'provider_id' => CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id'), 'state_province_id' => CRM_Core_PseudoConstant::stateProvince(), 'suffix_id' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'suffix_id'), 'website_type_id' => CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id'), diff --git a/CRM/Profile/Selector/Listings.php b/CRM/Profile/Selector/Listings.php index 1b469d2cec..4c3018f423 100644 --- a/CRM/Profile/Selector/Listings.php +++ b/CRM/Profile/Selector/Listings.php @@ -568,7 +568,7 @@ class CRM_Profile_Selector_Listings extends CRM_Core_Selector_Base implements CR // we need to determine of overlay profile should be shown $showProfileOverlay = CRM_Core_BAO_UFGroup::showOverlayProfile(); - $imProviders = CRM_Core_PseudoConstant::IMProvider(); + $imProviders = CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id'); $websiteTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id'); $languages = CRM_Core_PseudoConstant::languages(); while ($result->fetch()) { diff --git a/CRM/Report/Form/Activity.php b/CRM/Report/Form/Activity.php index b1f3ff2ea3..2514afa7f9 100644 --- a/CRM/Report/Form/Activity.php +++ b/CRM/Report/Form/Activity.php @@ -349,7 +349,7 @@ class CRM_Report_Form_Activity extends CRM_Report_Form { } function from() { - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts); diff --git a/CRM/Report/Form/Campaign/SurveyDetails.php b/CRM/Report/Form/Campaign/SurveyDetails.php index 44bc492320..8c5c02eb6d 100644 --- a/CRM/Report/Form/Campaign/SurveyDetails.php +++ b/CRM/Report/Form/Campaign/SurveyDetails.php @@ -311,7 +311,7 @@ class CRM_Report_Form_Campaign_SurveyDetails extends CRM_Report_Form { function from() { $this->_from = " FROM civicrm_contact {$this->_aliases['civicrm_contact']} {$this->_aclFrom} "; - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); diff --git a/CRM/Report/Form/Contact/Detail.php b/CRM/Report/Form/Contact/Detail.php index 0804bbaf3a..b0864385e8 100644 --- a/CRM/Report/Form/Contact/Detail.php +++ b/CRM/Report/Form/Contact/Detail.php @@ -469,7 +469,7 @@ class CRM_Report_Form_Contact_Detail extends CRM_Report_Form { } if (CRM_Utils_Array::value('activity_civireport', $this->_selectComponent)) { - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); diff --git a/CRM/Upgrade/Incremental/php/FourFour.php b/CRM/Upgrade/Incremental/php/FourFour.php index 2424e21fda..c4646ddc42 100644 --- a/CRM/Upgrade/Incremental/php/FourFour.php +++ b/CRM/Upgrade/Incremental/php/FourFour.php @@ -85,7 +85,7 @@ class CRM_Upgrade_Incremental_php_FourFour { static function activityContacts(CRM_Queue_TaskContext $ctx) { $upgrade = new CRM_Upgrade_Form(); - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $ovValue[] = $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts); $ovValue[] = $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); $ovValue[] = $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); diff --git a/CRM/Utils/DeprecatedUtils.php b/CRM/Utils/DeprecatedUtils.php index 78182f12b3..acb7e03a2a 100644 --- a/CRM/Utils/DeprecatedUtils.php +++ b/CRM/Utils/DeprecatedUtils.php @@ -881,7 +881,7 @@ function _civicrm_api3_deprecated_add_formatted_param(&$values, &$params) { $comm = array(); $preffComm = array(); $pcm = array(); - $pcm = array_change_key_case(array_flip(CRM_Core_PseudoConstant::pcm()), CASE_LOWER); + $pcm = array_change_key_case(array_flip(CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'preferred_communication_method')), CASE_LOWER); $preffComm = explode(',', $values['preferred_communication_method']); foreach ($preffComm as $v) { diff --git a/CRM/Utils/Migrate/ExportJSON.php b/CRM/Utils/Migrate/ExportJSON.php index 12ea2c7d60..92d86f67af 100644 --- a/CRM/Utils/Migrate/ExportJSON.php +++ b/CRM/Utils/Migrate/ExportJSON.php @@ -375,7 +375,7 @@ AND entity_table = 'civicrm_contact' function activity(&$contactIDs, &$additionalContacts) { static $_activitiesHandled = array(); - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); diff --git a/CRM/Utils/Token.php b/CRM/Utils/Token.php index e22fc06406..a63b5fd96f 100644 --- a/CRM/Utils/Token.php +++ b/CRM/Utils/Token.php @@ -1062,7 +1062,7 @@ class CRM_Utils_Token { if (CRM_Utils_Array::value('preferred_communication_method', $returnProperties) == 1 && array_key_exists('preferred_communication_method', $contactDetails[$contactID]) ) { - $pcm = CRM_Core_PseudoConstant::pcm(); + $pcm = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'preferred_communication_method'); // communication Prefferance $contactPcm = explode(CRM_Core_DAO::VALUE_SEPARATOR, diff --git a/sql/GenerateData.php b/sql/GenerateData.php index c3ac5ef702..1d8e8ff145 100644 --- a/sql/GenerateData.php +++ b/sql/GenerateData.php @@ -1137,7 +1137,7 @@ class CRM_GCD { $contactDAO->find(); $count = 0; - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); while ($contactDAO->fetch()) { if ($count++ > 2) { break; @@ -1256,7 +1256,7 @@ class CRM_GCD { private function addMembership() { $contact = new CRM_Contact_DAO_Contact(); $contact->query("SELECT id FROM civicrm_contact where contact_type = 'Individual'"); - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); while ($contact->fetch()) { $contacts[] = $contact->id; } @@ -1626,7 +1626,7 @@ INSERT INTO civicrm_activity_contact (contact_id, activity_id, record_type_id) VALUES "; - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $currentActivityID = CRM_Core_DAO::singleValueQuery("SELECT MAX(id) FROM civicrm_activity"); $currentActivityID -= 50; $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts); diff --git a/sql/GenerateReportData.php b/sql/GenerateReportData.php index 2c88de2537..14f54b8367 100644 --- a/sql/GenerateReportData.php +++ b/sql/GenerateReportData.php @@ -1116,7 +1116,7 @@ class CRM_GCD { $contactDAO->find(); $count = 0; - $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); while ($contactDAO->fetch()) { if ($count++ > 2) { diff --git a/tests/phpunit/CRM/Core/PseudoConstantTest.php b/tests/phpunit/CRM/Core/PseudoConstantTest.php index 84b1d05cc1..b4fe50ce8f 100644 --- a/tests/phpunit/CRM/Core/PseudoConstantTest.php +++ b/tests/phpunit/CRM/Core/PseudoConstantTest.php @@ -50,16 +50,6 @@ class CRM_Core_PseudoConstantTest extends CiviUnitTestCase { // - sample: Any one value which is expected in the list of option values. // - max: integer (default = 10) maximum number of option values expected. $fields = array( - 'CRM_Batch_DAO_Batch' => array( - array( - 'fieldName' => 'type_id', - 'sample' => 'Membership', - ), - array( - 'fieldName' => 'status_id', - 'sample' => 'Reopened', - ), - ), 'CRM_Project_DAO_Task' => array( array( 'fieldName' => 'priority_id', @@ -97,6 +87,28 @@ class CRM_Core_PseudoConstantTest extends CiviUnitTestCase { 'sample' => 'In Honor of', ), ), + 'CRM_Core_DAO_Phone' => array( + array( + 'fieldName' => 'phone_type_id', + 'sample' => 'Phone', + ), + array( + 'fieldName' => 'location_type_id', + 'sample' => 'Home', + ), + ), + 'CRM_Core_DAO_Email' => array( + array( + 'fieldName' => 'location_type_id', + 'sample' => 'Home', + ), + ), + 'CRM_Core_DAO_Address' => array( + array( + 'fieldName' => 'location_type_id', + 'sample' => 'Home', + ), + ), 'CRM_Core_DAO_Website' => array( array( 'fieldName' => 'website_type_id', @@ -108,6 +120,10 @@ class CRM_Core_PseudoConstantTest extends CiviUnitTestCase { 'fieldName' => 'website_type_id', 'sample' => 'Facebook', ), + array( + 'fieldName' => 'im_provider_id', + 'sample' => 'Yahoo', + ), ), 'CRM_Contact_DAO_Contact' => array( array( @@ -122,39 +138,29 @@ class CRM_Core_PseudoConstantTest extends CiviUnitTestCase { 'fieldName' => 'gender_id', 'sample' => 'Male', ), - ), - 'CRM_Core_DAO_Phone' => array( array( - 'fieldName' => 'phone_type_id', - 'sample' => 'Phone', - ), - array( - 'fieldName' => 'location_type_id', - 'sample' => 'Home', + 'fieldName' => 'preferred_communication_method', + 'sample' => 'Postal Mail', ), ), - 'CRM_Core_DAO_Email' => array( + 'CRM_Batch_DAO_Batch' => array( array( - 'fieldName' => 'location_type_id', - 'sample' => 'Home', + 'fieldName' => 'type_id', + 'sample' => 'Membership', ), - ), - 'CRM_Core_DAO_Address' => array( array( - 'fieldName' => 'location_type_id', - 'sample' => 'Home', + 'fieldName' => 'status_id', + 'sample' => 'Reopened', ), - ), - 'CRM_Core_DAO_Website' => array( array( - 'fieldName' => 'website_type_id', - 'sample' => 'Facebook', + 'fieldName' => 'mode_id', + 'sample' => 'Automatic Batch', ), ), - 'CRM_Core_DAO_MappingField' => array( + 'CRM_Core_DAO_IM' => array( array( - 'fieldName' => 'website_type_id', - 'sample' => 'Facebook', + 'fieldName' => 'provider_id', + 'sample' => 'Yahoo', ), ), ); diff --git a/xml/schema/Batch/Batch.xml b/xml/schema/Batch/Batch.xml index 11068122b0..50b470495c 100644 --- a/xml/schema/Batch/Batch.xml +++ b/xml/schema/Batch/Batch.xml @@ -132,6 +132,9 @@ int unsigned fk to Batch mode options in civicrm_option_values 4.2 + + batch_mode + total diff --git a/xml/schema/Contact/Contact.xml b/xml/schema/Contact/Contact.xml index 5e8ae10894..e6dab38007 100644 --- a/xml/schema/Contact/Contact.xml +++ b/xml/schema/Contact/Contact.xml @@ -212,15 +212,18 @@ 1.1 - preferred_communication_method - Preferred Communication Method - varchar - 255 - true - /^p(ref\w*\s)?c(omm\w*)|( meth\w*)$/i - /^\w+$/ - What is the preferred mode of communication. - 1.1 + preferred_communication_method + Preferred Communication Method + varchar + 255 + true + /^p(ref\w*\s)?c(omm\w*)|( meth\w*)$/i + /^\w+$/ + What is the preferred mode of communication. + 1.1 + + preferred_communication_method + index_preferred_communication_method diff --git a/xml/schema/Core/IM.xml b/xml/schema/Core/IM.xml index 91e797ea3f..8b7f585a3e 100644 --- a/xml/schema/Core/IM.xml +++ b/xml/schema/Core/IM.xml @@ -60,6 +60,9 @@ int unsigned Which IM Provider does this screen name belong to. 1.1 + + instant_messenger_service + UI_provider_id diff --git a/xml/schema/Core/MappingField.xml b/xml/schema/Core/MappingField.xml index c2b67f2dc5..1154e066b8 100644 --- a/xml/schema/Core/MappingField.xml +++ b/xml/schema/Core/MappingField.xml @@ -79,10 +79,13 @@ 2.2 - im_provider_id - int unsigned - Which type of IM Provider does this name belong. - 3.0 + im_provider_id + int unsigned + Which type of IM Provider does this name belong. + 3.0 + + instant_messenger_service + website_type_id