diff --git a/CRM/ACL/Form/ACL.php b/CRM/ACL/Form/ACL.php index 2a2293b1eeea0e3088549c91881af591ca22c87e..5e3722bb6909337c29f05f18d0468342afc11bfc 100644 --- a/CRM/ACL/Form/ACL.php +++ b/CRM/ACL/Form/ACL.php @@ -141,12 +141,12 @@ class CRM_ACL_Form_ACL extends CRM_Admin_Form { $customGroup = [ '-1' => ts('- select set of custom fields -'), '0' => ts('All Custom Groups'), - ] + CRM_Core_PseudoConstant::get('CRM_Core_DAO_CustomField', 'custom_group_id'); + ] + CRM_Core_DAO_CustomField::buildOptions('custom_group_id'); $ufGroup = [ '-1' => ts('- select profile -'), '0' => ts('All Profiles'), - ] + CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id'); + ] + CRM_Core_DAO_UFField::buildOptions('uf_group_id'); $event = [ '-1' => ts('- select event -'), diff --git a/CRM/ACL/Page/ACL.php b/CRM/ACL/Page/ACL.php index 4f14e4461637efbdfdba38b427d8ac67db869938..d7760e85110f0d979706879292327e9bced5f1b7 100644 --- a/CRM/ACL/Page/ACL.php +++ b/CRM/ACL/Page/ACL.php @@ -65,11 +65,11 @@ class CRM_ACL_Page_ACL extends CRM_Core_Page_Basic { $customGroup = [ '-1' => ts('- select -'), '0' => ts('All Custom Groups'), - ] + CRM_Core_PseudoConstant::get('CRM_Core_DAO_CustomField', 'custom_group_id'); + ] + CRM_Core_DAO_CustomField::buildOptions('custom_group_id'); $ufGroup = [ '-1' => ts('- select -'), '0' => ts('All Profiles'), - ] + CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id'); + ] + CRM_Core_DAO_UFField::buildOptions('uf_group_id'); $event = [ '-1' => ts('- select -'), diff --git a/CRM/Activity/BAO/Activity.php b/CRM/Activity/BAO/Activity.php index 84d50b11feb10e1dc5e9f4fcb7c366c9e719833e..b6231c4d7ce72e7ef74ee66a716439cc052f7707 100644 --- a/CRM/Activity/BAO/Activity.php +++ b/CRM/Activity/BAO/Activity.php @@ -290,7 +290,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { // if not set and not 0 empty($params['id']) ) { - $priority = CRM_Core_PseudoConstant::get('CRM_Activity_DAO_Activity', 'priority_id'); + $priority = CRM_Activity_DAO_Activity::buildOptions('priority_id'); $params['priority_id'] = array_search('Normal', $priority); } diff --git a/CRM/Activity/Form/Activity.php b/CRM/Activity/Form/Activity.php index 54ca884e01c542f5f04700e340b85fcc7575a076..9cf4f1fc177d5bd385d5d2dcd978bf15b56529a2 100644 --- a/CRM/Activity/Form/Activity.php +++ b/CRM/Activity/Form/Activity.php @@ -575,7 +575,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { $defaults += $className::setDefaultValues($this); } if (empty($defaults['priority_id'])) { - $priority = CRM_Core_PseudoConstant::get('CRM_Activity_DAO_Activity', 'priority_id'); + $priority = CRM_Activity_DAO_Activity::buildOptions('priority_id'); $defaults['priority_id'] = CRM_Core_PseudoConstant::getKey('CRM_Activity_DAO_Activity', 'priority_id', 'Normal'); } if (empty($defaults['status_id'])) { diff --git a/CRM/Admin/Form/MailSettings.php b/CRM/Admin/Form/MailSettings.php index 6866c431d97948d19e8bbd6c085fc6b3ef787ec1..e717cf1b8e944031ba0a71498aab5aefd4751a3f 100644 --- a/CRM/Admin/Form/MailSettings.php +++ b/CRM/Admin/Form/MailSettings.php @@ -66,7 +66,7 @@ class CRM_Admin_Form_MailSettings extends CRM_Admin_Form { $this->add('select', 'protocol', ts('Protocol'), - ['' => ts('- select -')] + CRM_Core_PseudoConstant::get('CRM_Core_DAO_MailSettings', 'protocol'), + ['' => ts('- select -')] + CRM_Core_DAO_MailSettings::buildOptions('protocol'), TRUE ); diff --git a/CRM/Admin/Form/Mapping.php b/CRM/Admin/Form/Mapping.php index 941fb616b7b3b47759cb520754b8a46982bc8d95..ca65f134620b93d76da2a8fde0b011cf0462f01b 100644 --- a/CRM/Admin/Form/Mapping.php +++ b/CRM/Admin/Form/Mapping.php @@ -64,7 +64,7 @@ class CRM_Admin_Form_Mapping extends CRM_Admin_Form { CRM_Core_DAO::getAttribute('CRM_Core_DAO_Mapping', 'description') ); - $mappingType = $this->addElement('select', 'mapping_type_id', ts('Mapping Type'), CRM_Core_PseudoConstant::get('CRM_Core_DAO_Mapping', 'mapping_type_id')); + $mappingType = $this->addElement('select', 'mapping_type_id', ts('Mapping Type'), CRM_Core_DAO_Mapping::buildOptions('mapping_type_id')); if ($this->_action == CRM_Core_Action::UPDATE) { $mappingType->freeze(); diff --git a/CRM/Admin/Page/MailSettings.php b/CRM/Admin/Page/MailSettings.php index e4b27ab05e57a1ba9224fdffed9e8d7853b4bc8a..7df8eabc37e1b0c3be5d911e1da260a0dae04218 100644 --- a/CRM/Admin/Page/MailSettings.php +++ b/CRM/Admin/Page/MailSettings.php @@ -39,7 +39,7 @@ class CRM_Admin_Page_MailSettings extends CRM_Core_Page_Basic { $allMailSettings = []; $mailSetting = new CRM_Core_DAO_MailSettings(); - $allProtocols = CRM_Core_PseudoConstant::get('CRM_Core_DAO_MailSettings', 'protocol'); + $allProtocols = CRM_Core_DAO_MailSettings::buildOptions('protocol'); //multi-domain support for mail settings. CRM-5244 $mailSetting->domain_id = CRM_Core_Config::domainID(); diff --git a/CRM/Batch/BAO/Batch.php b/CRM/Batch/BAO/Batch.php index 663072d4ef34aa3fa7a94bce31d4ccfce8f92472..4f8f1067eac49e9bb9087b707447d5d59937c9e5 100644 --- a/CRM/Batch/BAO/Batch.php +++ b/CRM/Batch/BAO/Batch.php @@ -252,8 +252,8 @@ class CRM_Batch_BAO_Batch extends CRM_Batch_DAO_Batch implements \Civi\Core\Hook $links = $obj->links(); } - $batchTypes = CRM_Core_PseudoConstant::get('CRM_Batch_DAO_Batch', 'type_id'); - $batchStatus = CRM_Core_PseudoConstant::get('CRM_Batch_DAO_Batch', 'status_id'); + $batchTypes = CRM_Batch_DAO_Batch::buildOptions('type_id'); + $batchStatus = CRM_Batch_DAO_Batch::buildOptions('status_id'); $batchStatusByName = CRM_Core_PseudoConstant::get('CRM_Batch_DAO_Batch', 'status_id', ['labelColumn' => 'name']); $paymentInstrument = CRM_Contribute_PseudoConstant::paymentInstrument(); @@ -626,7 +626,7 @@ class CRM_Batch_BAO_Batch extends CRM_Batch_DAO_Batch implements \Civi\Core\Hook * @param $status */ public static function closeReOpen($batchIds, $status) { - $batchStatus = CRM_Core_PseudoConstant::get('CRM_Batch_DAO_Batch', 'status_id'); + $batchStatus = CRM_Batch_DAO_Batch::buildOptions('status_id'); $params['status_id'] = CRM_Utils_Array::key($status, $batchStatus); $session = CRM_Core_Session::singleton(); $params['modified_date'] = date('YmdHis'); diff --git a/CRM/Contact/BAO/Contact/Utils.php b/CRM/Contact/BAO/Contact/Utils.php index 4cdca81199f96e2ce127a3aedf1a6ec86fdd5ffe..d845a1924993295b4987180122dbbfd170565c16 100644 --- a/CRM/Contact/BAO/Contact/Utils.php +++ b/CRM/Contact/BAO/Contact/Utils.php @@ -494,7 +494,7 @@ WHERE id={$contactId}; "; default: // individual $form->addElement('select', 'prefix_id', ts('Prefix'), - ['' => ts('- prefix -')] + CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'prefix_id') + ['' => ts('- prefix -')] + CRM_Contact_DAO_Contact::buildOptions('prefix_id') ); $form->addElement('text', 'first_name', ts('First Name'), $attributes['first_name'] @@ -506,7 +506,7 @@ WHERE id={$contactId}; "; $attributes['last_name'] ); $form->addElement('select', 'suffix_id', ts('Suffix'), - ['' => ts('- suffix -')] + CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'suffix_id') + ['' => ts('- suffix -')] + CRM_Contact_DAO_Contact::buildOptions('suffix_id') ); } diff --git a/CRM/Contact/BAO/Individual.php b/CRM/Contact/BAO/Individual.php index ae8b21068b4f4827ef40c008436d9b7abd2a44a0..0ef40f3a1cfd693f14ae2fc8f74b8b955dc41014 100644 --- a/CRM/Contact/BAO/Individual.php +++ b/CRM/Contact/BAO/Individual.php @@ -277,8 +277,8 @@ class CRM_Contact_BAO_Individual extends CRM_Contact_DAO_Contact { * the constructed display name */ public function displayName() { - $prefix = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'prefix_id'); - $suffix = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'suffix_id'); + $prefix = CRM_Contact_DAO_Contact::buildOptions('prefix_id'); + $suffix = CRM_Contact_DAO_Contact::buildOptions('suffix_id'); return str_replace(' ', ' ', trim($prefix[$this->prefix_id] . ' ' . $this->first_name . ' ' . $this->middle_name . ' ' . $this->last_name . ' ' . $suffix[$this->suffix_id])); } diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index effe302745e2f692bca203168de13955ff850bf9..72099cedd0ef59de1e619280a8f60f147a5529df 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -3784,7 +3784,7 @@ WHERE $smartGroupClause $this->_tables['civicrm_address'] = 1; $this->_whereTables['civicrm_address'] = 1; - $locationType = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); + $locationType = CRM_Core_DAO_Address::buildOptions('location_type_id'); $names = []; foreach ($value as $id) { $names[] = $locationType[$id]; @@ -6033,7 +6033,7 @@ AND displayRelType.is_active = 1 $viewValues = explode(CRM_Core_DAO::VALUE_SEPARATOR, $val); if ($value['pseudoField'] == 'participant_role') { - $pseudoOptions = CRM_Core_PseudoConstant::get('CRM_Event_DAO_Participant', 'role_id'); + $pseudoOptions = CRM_Event_DAO_Participant::buildOptions('role_id'); foreach ($viewValues as $k => $v) { $viewValues[$k] = $pseudoOptions[$v]; } diff --git a/CRM/Contact/Form/Contact.php b/CRM/Contact/Form/Contact.php index d009c554801420025e224f8628c261eabbf1d33a..da99044c5f3dacc701091be2053e3a407866bbf1 100644 --- a/CRM/Contact/Form/Contact.php +++ b/CRM/Contact/Form/Contact.php @@ -418,7 +418,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { * @param array $defaults */ public function blockSetDefaults(&$defaults) { - $locationTypeKeys = array_filter(array_keys(CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id')), 'is_int'); + $locationTypeKeys = array_filter(array_keys(CRM_Core_DAO_Address::buildOptions('location_type_id')), 'is_int'); sort($locationTypeKeys); // get the default location type diff --git a/CRM/Contact/Form/Edit/OpenID.php b/CRM/Contact/Form/Edit/OpenID.php index 0a123aba3f784f787e01e162e36d9cdb70629fe1..c7633b6e47bf3aa608a03ffdbf78aa4812edb4a2 100644 --- a/CRM/Contact/Form/Edit/OpenID.php +++ b/CRM/Contact/Form/Edit/OpenID.php @@ -45,7 +45,7 @@ class CRM_Contact_Form_Edit_OpenID { $form->addRule("openid[$blockId][openid]", ts('OpenID is not a valid URL.'), 'url'); //Block type - $form->addElement('select', "openid[$blockId][location_type_id]", '', CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id')); + $form->addElement('select', "openid[$blockId][location_type_id]", '', CRM_Core_DAO_Address::buildOptions('location_type_id')); //is_Primary radio $js = ['id' => "OpenID_" . $blockId . "_IsPrimary"]; diff --git a/CRM/Contact/Form/RelatedContact.php b/CRM/Contact/Form/RelatedContact.php index 94ffae0bceb51cfc47f79e0ee35b6ab5ab325d63..21a22eddcf22fa9782b84efa53f119aa6a25c1ea 100644 --- a/CRM/Contact/Form/RelatedContact.php +++ b/CRM/Contact/Form/RelatedContact.php @@ -153,7 +153,7 @@ class CRM_Contact_Form_RelatedContact extends CRM_Core_Form { default: // individual $form->addElement('select', 'prefix_id', ts('Prefix'), - ['' => ts('- prefix -')] + CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'prefix_id') + ['' => ts('- prefix -')] + CRM_Contact_DAO_Contact::buildOptions('prefix_id') ); $form->addElement('text', 'first_name', ts('First Name'), $attributes['first_name'] @@ -165,7 +165,7 @@ class CRM_Contact_Form_RelatedContact extends CRM_Core_Form { $attributes['last_name'] ); $form->addElement('select', 'suffix_id', ts('Suffix'), - ['' => ts('- suffix -')] + CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'suffix_id') + ['' => ts('- suffix -')] + CRM_Contact_DAO_Contact::buildOptions('suffix_id') ); } diff --git a/CRM/Contact/Form/Search/Builder.php b/CRM/Contact/Form/Search/Builder.php index 2cdf2d64a27f0133df9dd7d659547be65b7de0c5..1500d3bb6c2803aaaeb894e495d1711579007b8e 100644 --- a/CRM/Contact/Form/Search/Builder.php +++ b/CRM/Contact/Form/Search/Builder.php @@ -593,7 +593,7 @@ class CRM_Contact_Form_Search_Builder extends CRM_Contact_Form_Search { } } - $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); + $locationTypes = CRM_Core_DAO_Address::buildOptions('location_type_id'); $defaultLocationType = CRM_Core_BAO_LocationType::getDefault(); @@ -628,8 +628,8 @@ class CRM_Contact_Form_Search_Builder extends CRM_Contact_Form_Search { $sel3[''] = NULL; $sel5[''] = NULL; - $phoneTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id'); - $imProviders = CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id'); + $phoneTypes = CRM_Core_DAO_Phone::buildOptions('phone_type_id'); + $imProviders = CRM_Core_DAO_IM::buildOptions('provider_id'); asort($phoneTypes); foreach ($sel1 as $k => $sel) { diff --git a/CRM/Contact/Form/Search/Criteria.php b/CRM/Contact/Form/Search/Criteria.php index b939ee34f0d4823ff7138e9bf1be76aa360f821f..29cd537fb4ac99a38b05fab72f868b104da4917e 100644 --- a/CRM/Contact/Form/Search/Criteria.php +++ b/CRM/Contact/Form/Search/Criteria.php @@ -233,8 +233,8 @@ class CRM_Contact_Form_Search_Criteria { // Phone search $form->addElement('text', 'phone_numeric', ts('Phone'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Phone', 'phone')); - $locationType = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); - $phoneType = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id'); + $locationType = CRM_Core_DAO_Address::buildOptions('location_type_id'); + $phoneType = CRM_Core_DAO_Phone::buildOptions('phone_type_id'); $form->add('select', 'phone_location_type_id', ts('Phone Location'), ['' => ts('- any -')] + $locationType, FALSE, ['class' => 'crm-select2']); $form->add('select', 'phone_phone_type_id', ts('Phone Type'), ['' => ts('- any -')] + $phoneType, FALSE, ['class' => 'crm-select2']); } @@ -480,7 +480,7 @@ class CRM_Contact_Form_Search_Criteria { $form->addSelect('world_region', ['entity' => 'address', 'context' => 'search']); // select for location type - $locationType = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); + $locationType = CRM_Core_DAO_Address::buildOptions('location_type_id'); $form->add('select', 'location_type', ts('Address Location'), $locationType, FALSE, [ 'multiple' => TRUE, 'class' => 'crm-select2', @@ -563,7 +563,7 @@ class CRM_Contact_Form_Search_Criteria { $form->addFormFieldsFromMetadata(); // radio button for gender $genderOptionsAttributes = []; - $gender = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'); + $gender = CRM_Contact_DAO_Contact::buildOptions('gender_id'); foreach ($gender as $key => $var) { $genderOptionsAttributes[$key] = ['id' => "civicrm_gender_{$var}_{$key}"]; } diff --git a/CRM/Contact/Form/Task/Label.php b/CRM/Contact/Form/Task/Label.php index 04b1fb732feeddfc495c13467edd2661b96a1f29..6bc47734305a86e38c2bfd976bb70af9daab9e01 100644 --- a/CRM/Contact/Form/Task/Label.php +++ b/CRM/Contact/Form/Task/Label.php @@ -52,7 +52,7 @@ class CRM_Contact_Form_Task_Label extends CRM_Contact_Form_Task { $form->addElement('select', 'location_type_id', ts('Select Location'), [ '' => ts('Primary'), - ] + CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'), TRUE + ] + CRM_Core_DAO_Address::buildOptions('location_type_id'), TRUE ); // checkbox for SKIP contacts with Do Not Mail privacy option @@ -144,7 +144,7 @@ class CRM_Contact_Form_Task_Label extends CRM_Contact_Form_Task { //get the contacts information $params = []; if (!empty($fv['location_type_id'])) { - $locType = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); + $locType = CRM_Core_DAO_Address::buildOptions('location_type_id'); $locName = $locType[$fv['location_type_id']]; $location = ['location' => ["{$locName}" => $addressReturnProperties]]; $returnProperties = array_merge($returnProperties, $location); @@ -233,7 +233,7 @@ class CRM_Contact_Form_Task_Label extends CRM_Contact_Form_Task { $commMethods = $row['preferred_communication_method'] ?? NULL; if ($commMethods) { $val = array_filter(explode(CRM_Core_DAO::VALUE_SEPARATOR, $commMethods)); - $comm = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'preferred_communication_method'); + $comm = CRM_Contact_DAO_Contact::buildOptions('preferred_communication_method'); $temp = []; foreach ($val as $vals) { $temp[] = $comm[$vals]; diff --git a/CRM/Contact/Form/Task/LabelCommon.php b/CRM/Contact/Form/Task/LabelCommon.php index 31c9b3add4974f8b4aeda5fdf799cbd63630dc67..35acf85ec7a5303822de950d1f5b73930bcee18e 100644 --- a/CRM/Contact/Form/Task/LabelCommon.php +++ b/CRM/Contact/Form/Task/LabelCommon.php @@ -118,7 +118,7 @@ class CRM_Contact_Form_Task_LabelCommon { $params[] = ['is_deceased', '=', 0, 0, 0]; if ($locationTypeID) { - $locType = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); + $locType = CRM_Core_DAO_Address::buildOptions('location_type_id'); $locName = $locType[$locationTypeID]; $location = ['location' => ["{$locName}" => $addressReturnProperties]]; $returnProperties = array_merge($returnProperties, $location); diff --git a/CRM/Contact/Import/Form/MapField.php b/CRM/Contact/Import/Form/MapField.php index c0424febb7d4d195632874cba0991955aaf5aced..c7eccc756883638f8c63d2eb6db25b7bd0b048f9 100644 --- a/CRM/Contact/Import/Form/MapField.php +++ b/CRM/Contact/Import/Form/MapField.php @@ -106,9 +106,9 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { $sel1 = $this->_mapperFields; $sel2[''] = NULL; - $phoneTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id'); - $imProviders = CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id'); - $websiteTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id'); + $phoneTypes = CRM_Core_DAO_Phone::buildOptions('phone_type_id'); + $imProviders = CRM_Core_DAO_IM::buildOptions('provider_id'); + $websiteTypes = CRM_Core_DAO_Website::buildOptions('website_type_id'); foreach ($this->getLocationTypes() as $key => $value) { $sel3['phone'][$key] = &$phoneTypes; @@ -432,7 +432,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { * @return array */ protected function getLocationTypes(): array { - return ['Primary' => ts('Primary')] + CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); + return ['Primary' => ts('Primary')] + CRM_Core_DAO_Address::buildOptions('location_type_id'); } /** diff --git a/CRM/Contact/Page/Inline/CommunicationPreferences.php b/CRM/Contact/Page/Inline/CommunicationPreferences.php index 4c4ca42054033d71a095c7c253936a83dd0ae341..7b994a28032b1e62f10b5c579b97e51462ecbfa2 100644 --- a/CRM/Contact/Page/Inline/CommunicationPreferences.php +++ b/CRM/Contact/Page/Inline/CommunicationPreferences.php @@ -37,7 +37,7 @@ class CRM_Contact_Page_Inline_CommunicationPreferences extends CRM_Core_Page { CRM_Contact_BAO_Contact::getValues($params, $defaults); $defaults['privacy_values'] = CRM_Core_SelectValues::privacy(); - $communicationStyle = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'communication_style_id'); + $communicationStyle = CRM_Contact_DAO_Contact::buildOptions('communication_style_id'); if (!empty($communicationStyle)) { if (!empty($defaults['communication_style_id'])) { $defaults['communication_style_display'] = $communicationStyle[$defaults['communication_style_id']]; diff --git a/CRM/Contact/Page/Inline/Demographics.php b/CRM/Contact/Page/Inline/Demographics.php index e3a714872fb88a335f404ab0870d049e1a90f525..f12ad625c4b8f208b29749a31d5a648e32f35299 100644 --- a/CRM/Contact/Page/Inline/Demographics.php +++ b/CRM/Contact/Page/Inline/Demographics.php @@ -35,7 +35,7 @@ class CRM_Contact_Page_Inline_Demographics extends CRM_Core_Page { CRM_Contact_BAO_Contact::getValues($params, $defaults); if (!empty($defaults['gender_id'])) { - $gender = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'); + $gender = CRM_Contact_DAO_Contact::buildOptions('gender_id'); $defaults['gender_display'] = $gender[$defaults['gender_id']]; } $this->assignFieldMetadataToTemplate('Contact'); diff --git a/CRM/Contact/Page/Inline/IM.php b/CRM/Contact/Page/Inline/IM.php index e20782a3265a9f1447ab5c5b20c9dfa405be4d02..738b017580adf3f69a7419cc3ed9faf470f7f2bc 100644 --- a/CRM/Contact/Page/Inline/IM.php +++ b/CRM/Contact/Page/Inline/IM.php @@ -30,7 +30,7 @@ class CRM_Contact_Page_Inline_IM extends CRM_Core_Page { $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE); $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', ['labelColumn' => 'display_name']); - $IMProviders = CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id'); + $IMProviders = CRM_Core_DAO_IM::buildOptions('provider_id'); $entityBlock = ['contact_id' => $contactId]; $ims = CRM_Core_BAO_IM::getValues($entityBlock); diff --git a/CRM/Contact/Page/Inline/Phone.php b/CRM/Contact/Page/Inline/Phone.php index 714c1c039dd715a6132b5e524bd62453bc980c15..bd62f1024f7eac4df4cdd3cb44e5e8e9eaed8b83 100644 --- a/CRM/Contact/Page/Inline/Phone.php +++ b/CRM/Contact/Page/Inline/Phone.php @@ -32,7 +32,7 @@ class CRM_Contact_Page_Inline_Phone extends CRM_Core_Page { $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE); $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', ['labelColumn' => 'display_name']); - $phoneTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id'); + $phoneTypes = CRM_Core_DAO_Phone::buildOptions('phone_type_id'); $entityBlock = ['contact_id' => $contactId]; $phones = CRM_Core_BAO_Phone::getValues($entityBlock); diff --git a/CRM/Contact/Page/Inline/Website.php b/CRM/Contact/Page/Inline/Website.php index de416295df8da6c15cd918882ecc0771719c17fc..b29695d69892e3a14a3da2f0592adb0e26d9dd8d 100644 --- a/CRM/Contact/Page/Inline/Website.php +++ b/CRM/Contact/Page/Inline/Website.php @@ -31,7 +31,7 @@ class CRM_Contact_Page_Inline_Website extends CRM_Core_Page { // get the emails for this contact $contactId = CRM_Utils_Request::retrieveValue('cid', 'Positive'); - $websiteTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id'); + $websiteTypes = CRM_Core_DAO_Website::buildOptions('website_type_id'); $params = ['contact_id' => $contactId]; $websites = CRM_Core_BAO_Website::getValues($params); diff --git a/CRM/Contact/Page/View/Summary.php b/CRM/Contact/Page/View/Summary.php index 79f3b44e7ce7feaaf4ff401ca9c64aa7ed9c6193..0ff3516146d1b10f826a15c50380ee3ac9634625 100644 --- a/CRM/Contact/Page/View/Summary.php +++ b/CRM/Contact/Page/View/Summary.php @@ -220,7 +220,7 @@ class CRM_Contact_Page_View_Summary extends CRM_Contact_Page_View { $defaults['gender_display'] = CRM_Core_PseudoConstant::getLabel('CRM_Contact_DAO_Contact', 'gender_id', $defaults['gender_id'] ?? NULL); - $communicationStyle = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'communication_style_id'); + $communicationStyle = CRM_Contact_DAO_Contact::buildOptions('communication_style_id'); if (!empty($communicationStyle)) { if (!empty($defaults['communication_style_id'])) { $defaults['communication_style_display'] = $communicationStyle[$defaults['communication_style_id']]; diff --git a/CRM/Contact/Selector.php b/CRM/Contact/Selector.php index 509759be03d6f39d5edd8223514273aee7e93db8..045ddc3b8af602544fff244a0bc4ea34cd287d39 100644 --- a/CRM/Contact/Selector.php +++ b/CRM/Contact/Selector.php @@ -602,7 +602,7 @@ class CRM_Contact_Selector extends CRM_Core_Selector_Base implements CRM_Core_Se } if ($this->_ufGroupID) { - $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); + $locationTypes = CRM_Core_DAO_Address::buildOptions('location_type_id'); $names = []; static $skipFields = ['group', 'tag']; @@ -690,7 +690,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::get('CRM_Core_DAO_IM', 'provider_id'); + $imProviders = CRM_Core_DAO_IM::buildOptions('provider_id'); $providerId = $property . "-provider_id"; $providerName = $imProviders[$result->$providerId]; $row[$property] = $result->$property . " ({$providerName})"; @@ -716,7 +716,7 @@ class CRM_Contact_Selector extends CRM_Core_Selector_Base implements CRM_Core_Se $propertyArray = explode('-', $property); $websiteFld = $websiteKey . '-' . array_pop($propertyArray); if (!empty($result->$websiteFld)) { - $websiteTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id'); + $websiteTypes = CRM_Core_DAO_Website::buildOptions('website_type_id'); $websiteType = $websiteTypes[$result->{"$websiteKey-website_type_id"}]; $websiteValue = $result->$websiteFld; $websiteUrl = "<a href=\"{$websiteValue}\">{$websiteValue} ({$websiteType})</a>"; diff --git a/CRM/Contribute/BAO/ContributionSoft.php b/CRM/Contribute/BAO/ContributionSoft.php index 6da9fe813144cfd45493c5bc8bf1f69a1c1d1be6..b6b29cd7a5699275fc9d7e647457e88906b8ce1a 100644 --- a/CRM/Contribute/BAO/ContributionSoft.php +++ b/CRM/Contribute/BAO/ContributionSoft.php @@ -634,7 +634,7 @@ class CRM_Contribute_BAO_ContributionSoft extends CRM_Contribute_DAO_Contributio case 'Individual': if (array_key_exists('prefix_id', $params)) { $honorName = CRM_Utils_Array::value($params['prefix_id'], - CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'prefix_id') + CRM_Contact_DAO_Contact::buildOptions('prefix_id') ); unset($profileFields['prefix_id']); } @@ -643,7 +643,7 @@ class CRM_Contribute_BAO_ContributionSoft extends CRM_Contribute_DAO_Contributio unset($profileFields['last_name']); if (array_key_exists('suffix_id', $params)) { $honorName .= ' ' . CRM_Utils_Array::value($params['suffix_id'], - CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'suffix_id') + CRM_Contact_DAO_Contact::buildOptions('suffix_id') ); unset($profileFields['suffix_id']); } diff --git a/CRM/Core/BAO/Address.php b/CRM/Core/BAO/Address.php index 70161a145a64e36e9da5f0962d6fffe6a7d78e95..27f30690ad4889080e3c93c66d59c427e83c5327 100644 --- a/CRM/Core/BAO/Address.php +++ b/CRM/Core/BAO/Address.php @@ -387,7 +387,7 @@ class CRM_Core_BAO_Address extends CRM_Core_DAO_Address implements Civi\Core\Hoo $address->find(); - $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); + $locationTypes = CRM_Core_DAO_Address::buildOptions('location_type_id'); $count = 1; while ($address->fetch()) { // deprecate reference. diff --git a/CRM/Core/BAO/LocationType.php b/CRM/Core/BAO/LocationType.php index 55290124f647c8f19e4698b643f8fcaf1842feb8..f48fc5eaa72c90910820083b326ec102ebe24503 100644 --- a/CRM/Core/BAO/LocationType.php +++ b/CRM/Core/BAO/LocationType.php @@ -70,7 +70,7 @@ class CRM_Core_BAO_LocationType extends CRM_Core_DAO_LocationType implements \Ci */ public static function getBilling() { if (self::$_billingLocationType == NULL) { - $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', [], 'validate'); + $locationTypes = CRM_Core_DAO_Address::buildOptions('location_type_id', 'validate'); self::$_billingLocationType = array_search('Billing', $locationTypes); } return self::$_billingLocationType; diff --git a/CRM/Core/BAO/Phone.php b/CRM/Core/BAO/Phone.php index f34f4c80d6c4bfa43659ce5a41426b113b1fabe4..00f8c76ea479141089c6b7547ab55b439ddec23f 100644 --- a/CRM/Core/BAO/Phone.php +++ b/CRM/Core/BAO/Phone.php @@ -159,7 +159,7 @@ ORDER BY civicrm_phone.is_primary DESC, phone_id ASC "; $cond = NULL; if ($type) { - $phoneTypeId = array_search($type, CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id')); + $phoneTypeId = array_search($type, CRM_Core_DAO_Phone::buildOptions('phone_type_id')); if ($phoneTypeId) { $cond = " AND civicrm_phone.phone_type_id = $phoneTypeId"; } diff --git a/CRM/Core/BAO/UFGroup.php b/CRM/Core/BAO/UFGroup.php index cbcb5683e91d182930bb72a49d091340ced069e3..3a5d312b8f17ba523724cf0250be664b72b69820 100644 --- a/CRM/Core/BAO/UFGroup.php +++ b/CRM/Core/BAO/UFGroup.php @@ -211,7 +211,7 @@ class CRM_Core_BAO_UFGroup extends CRM_Core_DAO_UFGroup implements \Civi\Core\Ho $fields = $subset; } else { - $ufGroups = CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id'); + $ufGroups = CRM_Core_DAO_UFField::buildOptions('uf_group_id'); $fields = []; foreach ($ufGroups as $id => $title) { @@ -1873,12 +1873,12 @@ AND ( entity_id IS NULL OR entity_id <= 0 ) $providerName = substr($name, 0, -1) . '-provider_id]'; } $form->add('select', $providerName, NULL, - CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id'), $required + CRM_Core_DAO_IM::buildOptions('provider_id'), $required ); } else { $form->add('select', $name . '-provider_id', $title, - CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id'), $required + CRM_Core_DAO_IM::buildOptions('provider_id'), $required ); } @@ -1979,7 +1979,7 @@ AND ( entity_id IS NULL OR entity_id <= 0 ) ); } elseif ($fieldName === 'preferred_communication_method') { - $communicationFields = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'preferred_communication_method'); + $communicationFields = CRM_Contact_DAO_Contact::buildOptions('preferred_communication_method'); foreach ($communicationFields as $key => $var) { if ($key == '') { continue; @@ -2434,7 +2434,7 @@ AND ( entity_id IS NULL OR entity_id <= 0 ) */ public static function getProfiles($types, $onlyPure = FALSE) { $profiles = []; - $ufGroups = CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id'); + $ufGroups = CRM_Core_DAO_UFField::buildOptions('uf_group_id'); CRM_Utils_Hook::aclGroup(CRM_Core_Permission::ADMIN, NULL, 'civicrm_uf_group', $ufGroups, $ufGroups); @@ -2468,7 +2468,7 @@ AND ( entity_id IS NULL OR entity_id <= 0 ) } $profiles = []; - $ufGroups = CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id'); + $ufGroups = CRM_Core_DAO_UFField::buildOptions('uf_group_id'); CRM_Utils_Hook::aclGroup(CRM_Core_Permission::ADMIN, NULL, 'civicrm_uf_group', $ufGroups, $ufGroups); diff --git a/CRM/Core/Page/Basic.php b/CRM/Core/Page/Basic.php index 355e764841a450783a6229c8ccd9bb14a7bd2cfb..d4f3e7271916eef6dc3c9d83ac371bf47607dad1 100644 --- a/CRM/Core/Page/Basic.php +++ b/CRM/Core/Page/Basic.php @@ -426,7 +426,7 @@ abstract class CRM_Core_Page_Basic extends CRM_Core_Page { $this->action($object, $action, $values[$object->id], $links, $permission); if (isset($object->mapping_type_id)) { - $mappintTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Mapping', 'mapping_type_id'); + $mappintTypes = CRM_Core_DAO_Mapping::buildOptions('mapping_type_id'); $values[$object->id]['mapping_type'] = $mappintTypes[$object->mapping_type_id]; } } diff --git a/CRM/Core/Permission.php b/CRM/Core/Permission.php index cbc50c68bc70a9a986a23ceaaebb364e35971e9a..161a3edaeeec9ccc6785f8207390e087afe6f489 100644 --- a/CRM/Core/Permission.php +++ b/CRM/Core/Permission.php @@ -306,7 +306,7 @@ class CRM_Core_Permission { * @return array */ public static function ufGroup($type = CRM_Core_Permission::VIEW) { - $ufGroups = CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id'); + $ufGroups = CRM_Core_DAO_UFField::buildOptions('uf_group_id'); $allGroups = array_keys($ufGroups); diff --git a/CRM/Event/BAO/Event.php b/CRM/Event/BAO/Event.php index 2500801f9d7f53bfbb64e755115336d3197b42a4..051cceb2d8e2ef58fc0f79d1be76ef211342f466 100644 --- a/CRM/Event/BAO/Event.php +++ b/CRM/Event/BAO/Event.php @@ -1353,7 +1353,7 @@ WHERE civicrm_event.is_active = 1 $groupTitle['groupTitle'] = CRM_Core_BAO_UFGroup::getFrontEndTitle((int) $gid); } - $imProviders = CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id'); + $imProviders = CRM_Core_DAO_IM::buildOptions('provider_id'); //start of code to set the default values foreach ($fields as $name => $field) { $customVal = ''; @@ -1409,7 +1409,7 @@ WHERE civicrm_event.is_active = 1 $values[$index] = $greeting[$params[$name]]; } elseif ($name === 'preferred_communication_method') { - $communicationFields = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'preferred_communication_method'); + $communicationFields = CRM_Contact_DAO_Contact::buildOptions('preferred_communication_method'); $compref = []; $pref = $params[$name]; if (is_array($pref)) { diff --git a/CRM/Event/Form/ManageEvent.php b/CRM/Event/Form/ManageEvent.php index b785cea2c604eaaa7cfe0f468b57c56922b48dc8..cabaa5b04eeea9870c1613b2c0bdb0827b30fbd3 100644 --- a/CRM/Event/Form/ManageEvent.php +++ b/CRM/Event/Form/ManageEvent.php @@ -159,7 +159,7 @@ class CRM_Event_Form_ManageEvent extends CRM_Core_Form { $this->assign('isRepeatingEntity', $this->_isRepeatingEvent); // CRM-16776 - show edit/copy/create buttons for Profiles if user has required permission. - $ufGroups = CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id'); + $ufGroups = CRM_Core_DAO_UFField::buildOptions('uf_group_id'); $ufCreate = CRM_ACL_API::group(CRM_Core_Permission::CREATE, NULL, 'civicrm_uf_group', $ufGroups); $ufEdit = CRM_ACL_API::group(CRM_Core_Permission::EDIT, NULL, 'civicrm_uf_group', $ufGroups); $checkPermission = [ diff --git a/CRM/Event/Page/EventInfo.php b/CRM/Event/Page/EventInfo.php index 6c1eaeadfb4e001e8a802e1ecb5272fbe6376780..49c4cab71ce97a8f64b1ad01ab64375aece19cc5 100644 --- a/CRM/Event/Page/EventInfo.php +++ b/CRM/Event/Page/EventInfo.php @@ -152,7 +152,7 @@ class CRM_Event_Page_EventInfo extends CRM_Core_Page { // fix phone type labels if (!empty($values['location']['phone'])) { - $phoneTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id'); + $phoneTypes = CRM_Core_DAO_Phone::buildOptions('phone_type_id'); foreach ($values['location']['phone'] as &$val) { if (!empty($val['phone_type_id'])) { $val['phone_type_display'] = $phoneTypes[$val['phone_type_id']]; diff --git a/CRM/Export/BAO/ExportProcessor.php b/CRM/Export/BAO/ExportProcessor.php index 1e935d9ce621c23f052bdcc334f54844e2086a20..80ec7221fab369dbc8bae639d00fda663839e4d9 100644 --- a/CRM/Export/BAO/ExportProcessor.php +++ b/CRM/Export/BAO/ExportProcessor.php @@ -977,7 +977,7 @@ class CRM_Export_BAO_ExportProcessor { if ($this->isHouseholdToSkip($iterationDAO->contact_id)) { return FALSE; } - $imProviders = CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id'); + $imProviders = CRM_Core_DAO_IM::buildOptions('provider_id'); $row = []; $householdMergeRelationshipType = $this->getHouseholdMergeTypeForRow($iterationDAO->contact_id); @@ -2122,8 +2122,8 @@ WHERE id IN ( $deleteIDString ) * @throws \Exception */ public function fetchRelationshipDetails($relDAO, $value, $field, &$row) { - $phoneTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id'); - $imProviders = CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id'); + $phoneTypes = CRM_Core_DAO_Phone::buildOptions('phone_type_id'); + $imProviders = CRM_Core_DAO_IM::buildOptions('provider_id'); $i18n = CRM_Core_I18n::singleton(); $field = $field . '_'; diff --git a/CRM/Financial/BAO/EntityFinancialAccount.php b/CRM/Financial/BAO/EntityFinancialAccount.php index 41f4f5b0691bb494d4b1a0662284e1f9c60bcce6..0a3bdf7ba59d0cb8a17d2070ff845c4457730640 100644 --- a/CRM/Financial/BAO/EntityFinancialAccount.php +++ b/CRM/Financial/BAO/EntityFinancialAccount.php @@ -96,7 +96,7 @@ class CRM_Financial_BAO_EntityFinancialAccount extends CRM_Financial_DAO_EntityF // check if financial type is present $check = FALSE; - $relationValues = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship'); + $relationValues = CRM_Financial_DAO_EntityFinancialAccount::buildOptions('account_relationship'); $financialTypeId = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_EntityFinancialAccount', $financialTypeAccountId, 'entity_id'); // check dependencies @@ -266,7 +266,7 @@ class CRM_Financial_BAO_EntityFinancialAccount extends CRM_Financial_DAO_EntityF $financialAccountLinks = CRM_Financial_BAO_FinancialAccount::getfinancialAccountRelations(); $financialAccountType = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialAccount', $financialTypeAccount->financial_account_id, 'financial_account_type_id'); if (($financialAccountLinks[$financialTypeAccount->account_relationship] ?? NULL) != $financialAccountType) { - $accountRelationships = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship'); + $accountRelationships = CRM_Financial_DAO_EntityFinancialAccount::buildOptions('account_relationship'); throw new CRM_Core_Exception(ts("This financial account cannot have '%1' relationship.", [1 => $accountRelationships[$financialTypeAccount->account_relationship]])); } } diff --git a/CRM/Financial/BAO/FinancialItem.php b/CRM/Financial/BAO/FinancialItem.php index d46e6be7f989557c1c5ce4547e5fcde90a43c66a..8d06731c41168c51f467a85efe5ae754df1ab14d 100644 --- a/CRM/Financial/BAO/FinancialItem.php +++ b/CRM/Financial/BAO/FinancialItem.php @@ -43,7 +43,7 @@ class CRM_Financial_BAO_FinancialItem extends CRM_Financial_DAO_FinancialItem { * @return CRM_Financial_DAO_FinancialItem */ public static function add($lineItem, $contribution, $taxTrxnID = FALSE, $trxnId = NULL) { - $financialItemStatus = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_FinancialItem', 'status_id'); + $financialItemStatus = CRM_Financial_DAO_FinancialItem::buildOptions('status_id'); $contributionStatus = CRM_Core_PseudoConstant::getName('CRM_Contribute_BAO_Contribution', 'contribution_status_id', $contribution->contribution_status_id); $itemStatus = NULL; if ($contributionStatus === 'Completed' || $contributionStatus === 'Pending refund') { diff --git a/CRM/Financial/Form/FinancialAccount.php b/CRM/Financial/Form/FinancialAccount.php index 9af95e9c42ee3efeefcbdc9b0f40cedf6b9adaaf..32972bd406750465fa5782929535da91fa0f67d8 100644 --- a/CRM/Financial/Form/FinancialAccount.php +++ b/CRM/Financial/Form/FinancialAccount.php @@ -102,7 +102,7 @@ class CRM_Financial_Form_FinancialAccount extends CRM_Contribute_Form { $element->freeze(); } - $financialAccountType = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_FinancialAccount', 'financial_account_type_id'); + $financialAccountType = CRM_Financial_DAO_FinancialAccount::buildOptions('financial_account_type_id'); if (!empty($financialAccountType)) { $element = $this->add('select', 'financial_account_type_id', ts('Financial Account Type'), ['' => ts('- select -')] + $financialAccountType, TRUE, ['class' => 'crm-select2 huge']); diff --git a/CRM/Financial/Form/FinancialBatch.php b/CRM/Financial/Form/FinancialBatch.php index fbcf4bb3c784c676d5effa500b579092849d7324..4dcb4ab59c4f0a7bd29cb9189b37356a093123b4 100644 --- a/CRM/Financial/Form/FinancialBatch.php +++ b/CRM/Financial/Form/FinancialBatch.php @@ -85,7 +85,7 @@ class CRM_Financial_Form_FinancialBatch extends CRM_Contribute_Form { ); if ($this->_action & CRM_Core_Action::UPDATE && $this->_id) { - $batchStatus = CRM_Core_PseudoConstant::get('CRM_Batch_BAO_Batch', 'status_id'); + $batchStatus = CRM_Batch_BAO_Batch::buildOptions('status_id'); // unset exported status $exportedStatusId = CRM_Core_PseudoConstant::getKey('CRM_Batch_BAO_Batch', 'status_id', 'Exported'); diff --git a/CRM/Financial/Form/FinancialTypeAccount.php b/CRM/Financial/Form/FinancialTypeAccount.php index b28b57360ea52e64ff1021f32083313b0ee7dc9f..e59f325f7026ac705ade7ed4bfa839e3d4bccb7f 100644 --- a/CRM/Financial/Form/FinancialTypeAccount.php +++ b/CRM/Financial/Form/FinancialTypeAccount.php @@ -211,7 +211,7 @@ class CRM_Financial_Form_FinancialTypeAccount extends CRM_Core_Form { $errorMsg = []; $errorFlag = FALSE; if ($self->_action == CRM_Core_Action::DELETE) { - $relationValues = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship'); + $relationValues = CRM_Financial_DAO_EntityFinancialAccount::buildOptions('account_relationship'); if (($values['financial_account_id'] ?? NULL) != 'select') { if ($relationValues[$values['account_relationship']] == 'Premiums Inventory Account is' || $relationValues[$values['account_relationship']] == 'Cost of Sales Account is') { $premiumsProduct = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_PremiumsProduct', $values['financial_type_id'], 'product_id', 'financial_type_id'); diff --git a/CRM/Financial/Page/FinancialAccount.php b/CRM/Financial/Page/FinancialAccount.php index a286705b2e61edc61a41355527a3d5473175f7fe..4b3b2043a06b419f618f45d75b3d704212deeb67 100644 --- a/CRM/Financial/Page/FinancialAccount.php +++ b/CRM/Financial/Page/FinancialAccount.php @@ -87,7 +87,7 @@ class CRM_Financial_Page_FinancialAccount extends CRM_Core_Page_Basic { $dao = new CRM_Financial_DAO_FinancialAccount(); $dao->orderBy('financial_account_type_id, name'); $dao->find(); - $financialAccountType = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_FinancialAccount', 'financial_account_type_id'); + $financialAccountType = CRM_Financial_DAO_FinancialAccount::buildOptions('financial_account_type_id'); while ($dao->fetch()) { $contributionType[$dao->id] = []; diff --git a/CRM/Financial/Page/FinancialTypeAccount.php b/CRM/Financial/Page/FinancialTypeAccount.php index 53ff637fcc22b4ecf7812e061f5872546aed6c2e..f82cf679fbb6f5fdc7e753194fee04e419d6aa53 100644 --- a/CRM/Financial/Page/FinancialTypeAccount.php +++ b/CRM/Financial/Page/FinancialTypeAccount.php @@ -114,8 +114,8 @@ class CRM_Financial_Page_FinancialTypeAccount extends CRM_Core_Page { $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' ")); $this->_title = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialType', $this->_aid, 'name'); CRM_Utils_System::setTitle($this->_title . ' - ' . ts('Assigned Financial Accounts')); - $financialAccountType = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_FinancialAccount', 'financial_account_type_id'); - $accountRelationship = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship'); + $financialAccountType = CRM_Financial_DAO_FinancialAccount::buildOptions('financial_account_type_id'); + $accountRelationship = CRM_Financial_DAO_EntityFinancialAccount::buildOptions('account_relationship'); $dao->copyValues($params); $dao->find(); while ($dao->fetch()) { diff --git a/CRM/Import/Parser.php b/CRM/Import/Parser.php index b6fcee3e988cf3dcd818771f88c07b06704a81ba..3ba297e0da907a5a13c072bb09c650ed50867a95 100644 --- a/CRM/Import/Parser.php +++ b/CRM/Import/Parser.php @@ -1018,7 +1018,7 @@ abstract class CRM_Import_Parser implements UserJobInterface { if (isset($values['individual_prefix'])) { CRM_Core_Error::deprecatedWarning('code should be unreachable, slated for removal'); if (!empty($params['prefix_id'])) { - $prefixes = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'prefix_id'); + $prefixes = CRM_Contact_DAO_Contact::buildOptions('prefix_id'); $params['prefix'] = $prefixes[$params['prefix_id']]; } else { @@ -1030,7 +1030,7 @@ abstract class CRM_Import_Parser implements UserJobInterface { if (isset($values['individual_suffix'])) { CRM_Core_Error::deprecatedWarning('code should be unreachable, slated for removal'); if (!empty($params['suffix_id'])) { - $suffixes = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'suffix_id'); + $suffixes = CRM_Contact_DAO_Contact::buildOptions('suffix_id'); $params['suffix'] = $suffixes[$params['suffix_id']]; } else { @@ -1042,7 +1042,7 @@ abstract class CRM_Import_Parser implements UserJobInterface { if (isset($values['gender'])) { CRM_Core_Error::deprecatedWarning('code should be unreachable, slated for removal'); if (!empty($params['gender_id'])) { - $genders = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'); + $genders = CRM_Contact_DAO_Contact::buildOptions('gender_id'); $params['gender'] = $genders[$params['gender_id']]; } else { diff --git a/CRM/Logging/Differ.php b/CRM/Logging/Differ.php index f7c587b1bbb3cbc2f95be0706e463163e2c316cb..c995f80dc7293c43c90cac38cb2d4a2230d6bcc6 100644 --- a/CRM/Logging/Differ.php +++ b/CRM/Logging/Differ.php @@ -276,20 +276,20 @@ WHERE lt.log_conn_id = %1 'contribution_status_id' => CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'label'), 'financial_type_id' => CRM_Contribute_PseudoConstant::financialType(), 'country_id' => CRM_Core_PseudoConstant::country(), - 'gender_id' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'), - 'location_type_id' => CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'), + 'gender_id' => CRM_Contact_DAO_Contact::buildOptions('gender_id'), + 'location_type_id' => CRM_Core_DAO_Address::buildOptions('location_type_id'), 'payment_instrument_id' => CRM_Contribute_PseudoConstant::paymentInstrument(), - 'phone_type_id' => CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id'), + 'phone_type_id' => CRM_Core_DAO_Phone::buildOptions('phone_type_id'), 'preferred_communication_method' => CRM_Contact_BAO_Contact::buildOptions('preferred_communication_method'), 'preferred_language' => CRM_Contact_BAO_Contact::buildOptions('preferred_language'), 'prefix_id' => CRM_Contact_BAO_Contact::buildOptions('prefix_id'), - 'provider_id' => CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id'), + 'provider_id' => CRM_Core_DAO_IM::buildOptions('provider_id'), 'state_province_id' => CRM_Core_PseudoConstant::stateProvince(), 'suffix_id' => CRM_Contact_BAO_Contact::buildOptions('suffix_id'), - 'website_type_id' => CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id'), + 'website_type_id' => CRM_Core_DAO_Website::buildOptions('website_type_id'), 'activity_type_id' => CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE), 'case_type_id' => CRM_Case_PseudoConstant::caseType('title', FALSE), - 'priority_id' => CRM_Core_PseudoConstant::get('CRM_Activity_DAO_Activity', 'priority_id'), + 'priority_id' => CRM_Activity_DAO_Activity::buildOptions('priority_id'), 'record_type_id' => CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'get'), ]; diff --git a/CRM/Mailing/Form/Approve.php b/CRM/Mailing/Form/Approve.php index 78203d467eda7849926611a1eb89ab69dc3cdd03..91b195e29249ecaa35333794759dcc66e9fd8394 100644 --- a/CRM/Mailing/Form/Approve.php +++ b/CRM/Mailing/Form/Approve.php @@ -77,7 +77,7 @@ class CRM_Mailing_Form_Approve extends CRM_Core_Form { $this->addElement('textarea', 'approval_note', ts('Approve/Reject Note')); - $mailApprovalStatus = CRM_Core_PseudoConstant::get('CRM_Mailing_BAO_Mailing', 'approval_status_id'); + $mailApprovalStatus = CRM_Mailing_BAO_Mailing::buildOptions('approval_status_id'); // eliminate the none option $noneOptionID = CRM_Core_PseudoConstant::getKey('CRM_Mailing_BAO_Mailing', 'approval_status_id', 'None'); diff --git a/CRM/Mailing/MailStore.php b/CRM/Mailing/MailStore.php index 1aa3e62b34197b2acc954a4dce6fbf812cf8373d..27f25d52a15529ef2d6203dd6f3287b35de3c2b0 100644 --- a/CRM/Mailing/MailStore.php +++ b/CRM/Mailing/MailStore.php @@ -47,7 +47,7 @@ class CRM_Mailing_MailStore { throw new Exception("Could not find entry named $name in civicrm_mail_settings"); } - $protocols = CRM_Core_PseudoConstant::get('CRM_Core_DAO_MailSettings', 'protocol', [], 'validate'); + $protocols = CRM_Core_DAO_MailSettings::buildOptions('protocol', 'validate'); // Prepare normalized/hookable representation of the mail settings. $mailSettings = $dao->toArray(); diff --git a/CRM/Member/Form/Membership.php b/CRM/Member/Form/Membership.php index 19c442965c6fdb4f837e2e7ca94957f5976fcdda..7162ae8fbff3a16e0045d33990fd4cd03011fb6e 100644 --- a/CRM/Member/Form/Membership.php +++ b/CRM/Member/Form/Membership.php @@ -208,8 +208,8 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { $resources->addScriptFile('civicrm', 'templates/CRM/Member/Form/MembershipStandalone.js'); $passthru = [ 'typeorgs' => CRM_Member_BAO_MembershipType::getMembershipTypeOrganization(), - 'memtypes' => CRM_Core_PseudoConstant::get('CRM_Member_BAO_Membership', 'membership_type_id'), - 'statuses' => CRM_Core_PseudoConstant::get('CRM_Member_BAO_Membership', 'status_id'), + 'memtypes' => CRM_Member_BAO_Membership::buildOptions('membership_type_id'), + 'statuses' => CRM_Member_BAO_Membership::buildOptions('status_id'), ]; $resources->addSetting(['existingMems' => $passthru]); } diff --git a/CRM/Member/Form/Task/Label.php b/CRM/Member/Form/Task/Label.php index cd00c233895da849b0eb3365c2c0d3ecc4583963..c21aa2f100c84c03da2a9d2d3e265b2fcfb93ae1 100644 --- a/CRM/Member/Form/Task/Label.php +++ b/CRM/Member/Form/Task/Label.php @@ -94,7 +94,7 @@ class CRM_Member_Form_Task_Label extends CRM_Member_Form_Task { $commMethods = $row['preferred_communication_method'] ?? NULL; if ($commMethods) { $val = array_filter(explode(CRM_Core_DAO::VALUE_SEPARATOR, $commMethods)); - $comm = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'preferred_communication_method'); + $comm = CRM_Contact_DAO_Contact::buildOptions('preferred_communication_method'); $temp = []; foreach ($val as $vals) { $temp[] = $comm[$vals]; diff --git a/CRM/PCP/BAO/PCP.php b/CRM/PCP/BAO/PCP.php index 6bc8112a6633bd76368aece1e56e6a0888a7a26a..feede0c47f38946ee525e593433be75d68316086 100644 --- a/CRM/PCP/BAO/PCP.php +++ b/CRM/PCP/BAO/PCP.php @@ -504,7 +504,7 @@ WHERE pcp.id = %1 AND cc.contribution_status_id = %2 AND cc.is_test = 0"; return FALSE; } - $pcpStatus = CRM_Core_PseudoConstant::get('CRM_PCP_BAO_PCP', 'status_id'); + $pcpStatus = CRM_PCP_BAO_PCP::buildOptions('status_id'); $approvedId = array_search('Approved', $pcpStatus); $params = ['id' => $pcpId]; diff --git a/CRM/Profile/Form.php b/CRM/Profile/Form.php index b86c57065ca0f0ec922debdc21773bb2ae2c981b..8f9a89d95918c6ad095036991dcec1cb662a74b3 100644 --- a/CRM/Profile/Form.php +++ b/CRM/Profile/Form.php @@ -823,7 +823,7 @@ class CRM_Profile_Form extends CRM_Core_Form { CRM_Core_Permission::EDIT, NULL, 'civicrm_uf_group', - CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id') + CRM_Core_DAO_UFField::buildOptions('uf_group_id') ) ) ) { diff --git a/CRM/Profile/Selector/Listings.php b/CRM/Profile/Selector/Listings.php index 2f9aae2ab5c25fecdd36ea9bf302df50a08a479a..36741ac35def7c5757db0f9ad0fa5832af692e9e 100644 --- a/CRM/Profile/Selector/Listings.php +++ b/CRM/Profile/Selector/Listings.php @@ -284,7 +284,7 @@ class CRM_Profile_Selector_Listings extends CRM_Core_Selector_Base implements CR ], ]; - $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); + $locationTypes = CRM_Core_DAO_Address::buildOptions('location_type_id'); foreach ($this->_fields as $name => $field) { // skip pseudo fields diff --git a/CRM/Report/Form.php b/CRM/Report/Form.php index 34b7205fdf4d217efd4185dc8d2aef384aa10b11..871ef2f8f825f48caaa6f4d8342ebd9e978d74df 100644 --- a/CRM/Report/Form.php +++ b/CRM/Report/Form.php @@ -2705,7 +2705,7 @@ class CRM_Report_Form extends CRM_Core_Form { * @return mixed */ protected function alterCommunicationtMethod($value, &$row, $fieldname) { - $communicationMethods = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'preferred_communication_method'); + $communicationMethods = CRM_Contact_DAO_Contact::buildOptions('preferred_communication_method'); // Explode padded values. $values = CRM_Utils_Array::explodePadded($value); @@ -4970,7 +4970,7 @@ LEFT JOIN civicrm_contact {$field['alias']} ON {$field['alias']}.id = {$this->_a 'gender_id' => [ 'title' => ts('Gender'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, - 'options' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'), + 'options' => CRM_Contact_DAO_Contact::buildOptions('gender_id'), ], 'birth_date' => [ 'title' => ts('Birth Date'), diff --git a/CRM/Report/Form/Activity.php b/CRM/Report/Form/Activity.php index 10b2ed14fb856086ce511d852787ea828f01ef2e..fba5f58c6515d788fa66f1c0047cb555542f0f24 100644 --- a/CRM/Report/Form/Activity.php +++ b/CRM/Report/Form/Activity.php @@ -342,7 +342,7 @@ class CRM_Report_Form_Activity extends CRM_Report_Form { 'title' => ts('Activity Priority'), 'type' => CRM_Utils_Type::T_STRING, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, - 'options' => CRM_Core_PseudoConstant::get('CRM_Activity_DAO_Activity', 'priority_id'), + 'options' => CRM_Activity_DAO_Activity::buildOptions('priority_id'), ], ], 'order_bys' => [ @@ -932,8 +932,8 @@ GROUP BY civicrm_activity_id $having {$this->_orderBy}"; $entryFound = FALSE; $activityType = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE); $activityStatus = CRM_Core_PseudoConstant::activityStatus(); - $priority = CRM_Core_PseudoConstant::get('CRM_Activity_DAO_Activity', 'priority_id'); - $genders = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'); + $priority = CRM_Activity_DAO_Activity::buildOptions('priority_id'); + $genders = CRM_Contact_DAO_Contact::buildOptions('gender_id'); $viewLinks = FALSE; // Would we ever want to retrieve from the form controller?? diff --git a/CRM/Report/Form/ActivitySummary.php b/CRM/Report/Form/ActivitySummary.php index 32f1f5a78beef5d9dede8a0460f0bb2dba438d8f..b162e9b4c99ae72d2e6f02d1324272ddf72387cb 100644 --- a/CRM/Report/Form/ActivitySummary.php +++ b/CRM/Report/Form/ActivitySummary.php @@ -142,7 +142,7 @@ class CRM_Report_Form_ActivitySummary extends CRM_Report_Form { 'title' => ts('Activity Priority'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, - 'options' => CRM_Core_PseudoConstant::get('CRM_Activity_DAO_Activity', 'priority_id'), + 'options' => CRM_Activity_DAO_Activity::buildOptions('priority_id'), ], ], 'group_bys' => [ @@ -665,7 +665,7 @@ class CRM_Report_Form_ActivitySummary extends CRM_Report_Form { $entryFound = FALSE; $activityType = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE); $activityStatus = CRM_Core_PseudoConstant::activityStatus(); - $priority = CRM_Core_PseudoConstant::get('CRM_Activity_DAO_Activity', 'priority_id'); + $priority = CRM_Activity_DAO_Activity::buildOptions('priority_id'); $onHover = ts('View Contact Summary for this Contact'); foreach ($rows as $rowNum => $row) { // make count columns point to activity detail report diff --git a/CRM/Report/Form/Contribute/History.php b/CRM/Report/Form/Contribute/History.php index 841e395a9ee82c4fdfaa548d4e956ce1668e0b6d..0c55519f9bbb34b54a7ecc93e9132c90ad7ed4e6 100644 --- a/CRM/Report/Form/Contribute/History.php +++ b/CRM/Report/Form/Contribute/History.php @@ -148,7 +148,7 @@ class CRM_Report_Form_Contribute_History extends CRM_Report_Form { 'gender_id' => [ 'title' => ts('Gender'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, - 'options' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'), + 'options' => CRM_Contact_DAO_Contact::buildOptions('gender_id'), ], 'birth_date' => [ 'title' => ts('Birth Date'), diff --git a/CRM/Report/Form/Contribute/Lybunt.php b/CRM/Report/Form/Contribute/Lybunt.php index ee3c8d808ea9d82b05ed74154ea6f0a8104b5d6c..81049c544879720b93289019e84fcca294762c83 100644 --- a/CRM/Report/Form/Contribute/Lybunt.php +++ b/CRM/Report/Form/Contribute/Lybunt.php @@ -109,7 +109,7 @@ class CRM_Report_Form_Contribute_Lybunt extends CRM_Report_Form { 'gender_id' => [ 'title' => ts('Gender'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, - 'options' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'), + 'options' => CRM_Contact_DAO_Contact::buildOptions('gender_id'), ], 'birth_date' => [ 'title' => ts('Birth Date'), diff --git a/CRM/Report/Form/Contribute/SoftCredit.php b/CRM/Report/Form/Contribute/SoftCredit.php index 109af20c51f4950f1f983f39429a65148a226b46..4678ce8f22cd41b4c4aaffddc860b36013281b14 100644 --- a/CRM/Report/Form/Contribute/SoftCredit.php +++ b/CRM/Report/Form/Contribute/SoftCredit.php @@ -146,7 +146,7 @@ class CRM_Report_Form_Contribute_SoftCredit extends CRM_Report_Form { 'gender_id' => [ 'title' => ts('Gender'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, - 'options' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'), + 'options' => CRM_Contact_DAO_Contact::buildOptions('gender_id'), ], 'birth_date' => [ 'title' => ts('Birth Date'), diff --git a/CRM/Report/Form/Contribute/Sybunt.php b/CRM/Report/Form/Contribute/Sybunt.php index 318e007cacc38821a3686293297e403b470576c3..72aae08807665baa1324b02277d07740e5d2a5a3 100644 --- a/CRM/Report/Form/Contribute/Sybunt.php +++ b/CRM/Report/Form/Contribute/Sybunt.php @@ -133,7 +133,7 @@ class CRM_Report_Form_Contribute_Sybunt extends CRM_Report_Form { 'gender_id' => [ 'title' => ts('Gender'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, - 'options' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'), + 'options' => CRM_Contact_DAO_Contact::buildOptions('gender_id'), ], 'birth_date' => [ 'title' => ts('Birth Date'), diff --git a/CRM/Report/Form/Event/ParticipantListCount.php b/CRM/Report/Form/Event/ParticipantListCount.php index 5f8bc1659605a9b9353b6bba0eeea057384a8e94..8c172c59fec3b87860c07ecba6910da6715e3d67 100644 --- a/CRM/Report/Form/Event/ParticipantListCount.php +++ b/CRM/Report/Form/Event/ParticipantListCount.php @@ -93,7 +93,7 @@ class CRM_Report_Form_Event_ParticipantListCount extends CRM_Report_Form { 'gender_id' => [ 'title' => ts('Gender'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, - 'options' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'), + 'options' => CRM_Contact_DAO_Contact::buildOptions('gender_id'), ], 'birth_date' => [ 'title' => ts('Birth Date'), diff --git a/CRM/SMS/Provider.php b/CRM/SMS/Provider.php index 8828f5a6ac9a649f2063c65f18f0c1baa7a8d188..c4876d52be543e68fc8fe212bbf3c40c714aa479 100644 --- a/CRM/SMS/Provider.php +++ b/CRM/SMS/Provider.php @@ -179,8 +179,8 @@ INNER JOIN civicrm_mailing_job mj ON mj.mailing_id = m.id AND mj.id = %1"; // unknown mobile sender -- create new contact // use fake @mobile.sms email address for new contact since civi // requires email or name for all contacts - $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); - $phoneTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id'); + $locationTypes = CRM_Core_DAO_Address::buildOptions('location_type_id'); + $phoneTypes = CRM_Core_DAO_Phone::buildOptions('phone_type_id'); $phoneloc = array_search('Home', $locationTypes); $phonetype = array_search('Mobile', $phoneTypes); $stripFrom = $this->stripPhone($message->from); diff --git a/CRM/UF/Form/Field.php b/CRM/UF/Form/Field.php index 0d7b7cb181029229439e217efc3381b5d0284a7b..68d0269421bb49f258613e9ba9abd12269fe66df 100644 --- a/CRM/UF/Form/Field.php +++ b/CRM/UF/Form/Field.php @@ -266,9 +266,9 @@ class CRM_UF_Form_Field extends CRM_Core_Form { } $this->assign('noSearchable', $noSearchable); - $this->_location_types = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); + $this->_location_types = CRM_Core_DAO_Address::buildOptions('location_type_id'); $defaultLocationType = CRM_Core_BAO_LocationType::getDefault(); - $this->_website_types = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id'); + $this->_website_types = CRM_Core_DAO_Website::buildOptions('website_type_id'); /** * FIXME: dirty hack to make the default option show up first. This @@ -323,7 +323,7 @@ class CRM_UF_Form_Field extends CRM_Core_Form { } } $sel3[''] = NULL; - $phoneTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id'); + $phoneTypes = CRM_Core_DAO_Phone::buildOptions('phone_type_id'); ksort($phoneTypes); foreach ($sel1 as $k => $sel) { diff --git a/CRM/UF/Page/Field.php b/CRM/UF/Page/Field.php index 04ff5eb776c748c5104e8aa4f136e17a4ff22746..8c236f17505fb53dedea5982447d60231f4241d4 100644 --- a/CRM/UF/Page/Field.php +++ b/CRM/UF/Page/Field.php @@ -117,8 +117,7 @@ class CRM_UF_Page_Field extends CRM_Core_Page { $this->assign('skipCreate', TRUE); } - $locationType = []; - $locationType = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); + $locationType = CRM_Core_DAO_Address::buildOptions('location_type_id'); $fields = CRM_Contact_BAO_Contact::exportableFields('All', FALSE, TRUE); $fields = array_merge(CRM_Contribute_BAO_Contribution::getContributionFields(), $fields); diff --git a/CRM/UF/Page/Group.php b/CRM/UF/Page/Group.php index 2f92e296291a63a61e274478ca9fe255c346111d..9633e5c06baf40890a175a2153f6b5389dd01b21 100644 --- a/CRM/UF/Page/Group.php +++ b/CRM/UF/Page/Group.php @@ -280,7 +280,7 @@ class CRM_UF_Page_Group extends CRM_Core_Page { return; } - $ufGroups = CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id'); + $ufGroups = CRM_Core_DAO_UFField::buildOptions('uf_group_id'); CRM_Utils_Hook::aclGroup(CRM_Core_Permission::ADMIN, NULL, 'civicrm_uf_group', $ufGroups, $allUFGroups); foreach ($allUFGroups as $id => $value) { diff --git a/CRM/UF/Page/ProfileEditor.php b/CRM/UF/Page/ProfileEditor.php index e68edee16980e7b7cb019787e978969a7f28e33b..ede55041d0566464ac387088eb54f40869fde80f 100644 --- a/CRM/UF/Page/ProfileEditor.php +++ b/CRM/UF/Page/ProfileEditor.php @@ -45,9 +45,9 @@ class CRM_UF_Page_ProfileEditor extends CRM_Core_Page { } return [ 'PseudoConstant' => [ - 'locationType' => CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'), - 'websiteType' => CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id'), - 'phoneType' => CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id'), + 'locationType' => CRM_Core_DAO_Address::buildOptions('location_type_id'), + 'websiteType' => CRM_Core_DAO_Website::buildOptions('website_type_id'), + 'phoneType' => CRM_Core_DAO_Phone::buildOptions('phone_type_id'), ], 'initialProfileList' => $ufGroups, 'contactSubTypes' => CRM_Contact_BAO_ContactType::subTypes(), diff --git a/Civi/API/Subscriber/PermissionCheck.php b/Civi/API/Subscriber/PermissionCheck.php index 9441800733ce01cd88b1c83877ebd66ee74217ff..2801d067307e7735bd4517c40bcd448352a68885 100644 --- a/Civi/API/Subscriber/PermissionCheck.php +++ b/Civi/API/Subscriber/PermissionCheck.php @@ -94,7 +94,7 @@ class PermissionCheck implements EventSubscriberInterface { switch ($apiRequest['entity']) { case 'UFGroup': case 'UFField': - $ufGroups = \CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id'); + $ufGroups = \CRM_Core_DAO_UFField::buildOptions('uf_group_id'); $aclCreate = \CRM_ACL_API::group(\CRM_Core_Permission::CREATE, NULL, 'civicrm_uf_group', $ufGroups); $aclEdit = \CRM_ACL_API::group(\CRM_Core_Permission::EDIT, NULL, 'civicrm_uf_group', $ufGroups); $ufGroupId = $apiRequest['entity'] == 'UFGroup' ? $apiRequest['params']['id'] : $apiRequest['params']['uf_group_id']; diff --git a/api/v3/Contact.php b/api/v3/Contact.php index 747b62f07e2a0fb343792e57701b0be2124881b8..604571d16cc91ecc50fb908e072d7dc203575e57 100644 --- a/api/v3/Contact.php +++ b/api/v3/Contact.php @@ -69,7 +69,7 @@ function civicrm_api3_contact_create($params) { } if (!empty($params['home_url'])) { - $websiteTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id'); + $websiteTypes = CRM_Core_DAO_Website::buildOptions('website_type_id'); $params['website'] = [ 1 => [ 'website_type_id' => key($websiteTypes), diff --git a/ext/civigrant/CRM/Grant/BAO/Grant.php b/ext/civigrant/CRM/Grant/BAO/Grant.php index abb03897753f083e3612e5b518052c303dba5156..9bec9b46e1294595f70fa91f4ea50e8e23eb8091 100644 --- a/ext/civigrant/CRM/Grant/BAO/Grant.php +++ b/ext/civigrant/CRM/Grant/BAO/Grant.php @@ -40,7 +40,7 @@ class CRM_Grant_BAO_Grant extends CRM_Grant_DAO_Grant implements \Civi\Core\Hook $status = []; $summary = []; $summary['total_grants'] = NULL; - $status = CRM_Core_PseudoConstant::get('CRM_Grant_DAO_Grant', 'status_id'); + $status = CRM_Grant_DAO_Grant::buildOptions('status_id'); foreach ($status as $id => $name) { $stats[$id] = [ diff --git a/ext/civigrant/CRM/Grant/Form/GrantView.php b/ext/civigrant/CRM/Grant/Form/GrantView.php index 85df01e9b5442f545699147c426e156ab9d97295..d48f8077a6908ca45f840a17506196f5888d4970 100644 --- a/ext/civigrant/CRM/Grant/Form/GrantView.php +++ b/ext/civigrant/CRM/Grant/Form/GrantView.php @@ -30,8 +30,8 @@ class CRM_Grant_Form_GrantView extends CRM_Core_Form { ]; $values = []; CRM_Grant_BAO_Grant::retrieve($params, $values); - $grantType = CRM_Core_PseudoConstant::get('CRM_Grant_DAO_Grant', 'grant_type_id'); - $grantStatus = CRM_Core_PseudoConstant::get('CRM_Grant_DAO_Grant', 'status_id'); + $grantType = CRM_Grant_DAO_Grant::buildOptions('grant_type_id'); + $grantStatus = CRM_Grant_DAO_Grant::buildOptions('status_id'); $this->assign('grantType', $grantType[$values['grant_type_id']]); $this->assign('grantStatus', $grantStatus[$values['status_id']]); $grantTokens = [ diff --git a/ext/civigrant/CRM/Grant/Form/Task/Update.php b/ext/civigrant/CRM/Grant/Form/Task/Update.php index 80514bc5b4076f81be704b9e837bd800e28c74cd..929398c4e80fc7ab13dfd4059347472026e7ff94 100644 --- a/ext/civigrant/CRM/Grant/Form/Task/Update.php +++ b/ext/civigrant/CRM/Grant/Form/Task/Update.php @@ -43,7 +43,7 @@ class CRM_Grant_Form_Task_Update extends CRM_Grant_Form_Task { * @return void */ public function buildQuickForm() { - $grantStatus = CRM_Core_PseudoConstant::get('CRM_Grant_DAO_Grant', 'status_id'); + $grantStatus = CRM_Grant_DAO_Grant::buildOptions('status_id'); $this->addElement('select', 'status_id', ts('Grant Status'), ['' => ''] + $grantStatus); $this->addElement('text', 'amount_granted', ts('Amount Granted')); diff --git a/ext/civigrant/CRM/Report/Form/Grant/Detail.php b/ext/civigrant/CRM/Report/Form/Grant/Detail.php index ea561a0f6f13c60e9095329daf14663903406fad..704ef46957f9583b42ab767ff567384fd72b217f 100644 --- a/ext/civigrant/CRM/Report/Form/Grant/Detail.php +++ b/ext/civigrant/CRM/Report/Form/Grant/Detail.php @@ -110,14 +110,14 @@ class CRM_Report_Form_Grant_Detail extends CRM_Report_Form { 'name' => 'grant_type_id', 'title' => ts('Grant Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, - 'options' => CRM_Core_PseudoConstant::get('CRM_Grant_DAO_Grant', 'grant_type_id'), + 'options' => CRM_Grant_DAO_Grant::buildOptions('grant_type_id'), ], 'status_id' => [ 'name' => 'status_id', 'title' => ts('Grant Status'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, - 'options' => CRM_Core_PseudoConstant::get('CRM_Grant_DAO_Grant', 'status_id'), + 'options' => CRM_Grant_DAO_Grant::buildOptions('status_id'), ], 'amount_granted' => [ 'title' => ts('Amount Granted'), diff --git a/ext/civigrant/CRM/Report/Form/Grant/Statistics.php b/ext/civigrant/CRM/Report/Form/Grant/Statistics.php index 0ea5e629eaa62169082772b50a9ac7f59ec532b9..c377f0b88a31157abe85fe6900e26eb74bc683e5 100644 --- a/ext/civigrant/CRM/Report/Form/Grant/Statistics.php +++ b/ext/civigrant/CRM/Report/Form/Grant/Statistics.php @@ -83,14 +83,14 @@ class CRM_Report_Form_Grant_Statistics extends CRM_Report_Form { 'name' => 'grant_type_id', 'title' => ts('Grant Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, - 'options' => CRM_Core_PseudoConstant::get('CRM_Grant_DAO_Grant', 'grant_type_id'), + 'options' => CRM_Grant_DAO_Grant::buildOptions('grant_type_id'), ], 'status_id' => [ 'name' => 'status_id', 'title' => ts('Grant Status'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, - 'options' => CRM_Core_PseudoConstant::get('CRM_Grant_DAO_Grant', 'status_id'), + 'options' => CRM_Grant_DAO_Grant::buildOptions('status_id'), ], 'amount_requested' => [ 'name' => 'amount_requested', @@ -134,7 +134,7 @@ class CRM_Report_Form_Grant_Statistics extends CRM_Report_Form { 'name' => 'gender_id', 'title' => ts('Gender'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, - 'options' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'), + 'options' => CRM_Contact_DAO_Contact::buildOptions('gender_id'), ], 'contact_type' => [ 'name' => 'contact_type', @@ -335,9 +335,9 @@ WHERE {$this->_aliases['civicrm_grant']}.amount_total IS NOT NULL $awardedGrantsAmount = $grantsReceived = $totalAmount = $awardedGrants = $grantReportsReceived = 0; $grantStatistics = []; - $grantTypes = CRM_Core_PseudoConstant::get('CRM_Grant_DAO_Grant', 'grant_type_id'); + $grantTypes = CRM_Grant_DAO_Grant::buildOptions('grant_type_id'); $countries = CRM_Core_PseudoConstant::country(); - $gender = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'); + $gender = CRM_Contact_DAO_Contact::buildOptions('gender_id'); $grantAmountTotal = " SELECT COUNT({$this->_aliases['civicrm_grant']}.id) as count , diff --git a/tests/phpunit/CRM/Contact/BAO/ContactTest.php b/tests/phpunit/CRM/Contact/BAO/ContactTest.php index c9b9c4a3890100034e9655560127813f073e43a6..fcfc09a6eecc1641135e79c8d857d20abe815ec6 100644 --- a/tests/phpunit/CRM/Contact/BAO/ContactTest.php +++ b/tests/phpunit/CRM/Contact/BAO/ContactTest.php @@ -1163,8 +1163,8 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { //get display name. $dbDisplayName = CRM_Contact_BAO_Contact::displayName($contactId); - $prefix = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'prefix_id'); - $suffix = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'suffix_id'); + $prefix = CRM_Contact_DAO_Contact::buildOptions('prefix_id'); + $suffix = CRM_Contact_DAO_Contact::buildOptions('suffix_id'); //build display name $paramsDisplayName = $prefix[$params['prefix_id']] . ' ' . $params['first_name'] . ' ' . $params['last_name'] . ' ' . $suffix[$params['suffix_id']]; @@ -1192,8 +1192,8 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { $checkImage = CRM_Contact_BAO_Contact_Utils::getImage($params['contact_type'], FALSE, $contactId); - $prefix = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'prefix_id'); - $suffix = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'suffix_id'); + $prefix = CRM_Contact_DAO_Contact::buildOptions('prefix_id'); + $suffix = CRM_Contact_DAO_Contact::buildOptions('suffix_id'); //build display name $paramsDisplayName = $prefix[$params['prefix_id']] . ' ' . $params['first_name'] . ' ' . $params['last_name'] . ' ' . $suffix[$params['suffix_id']];