From b2b0530a935d010669a24829b6e5d90a47e6b495 Mon Sep 17 00:00:00 2001 From: Allen Shaw Date: Tue, 30 Apr 2013 17:02:49 -0700 Subject: [PATCH] Refactored location_type_id in CRM_Core_PseudoConstant::get() CRM_12464 --- CRM/Activity/Import/Form/MapField.php | 2 +- CRM/Contact/BAO/Contact.php | 6 ++--- CRM/Contact/BAO/Query.php | 8 +++--- CRM/Contact/Form/Contact.php | 2 +- CRM/Contact/Form/Edit/Address.php | 2 +- CRM/Contact/Form/Edit/Email.php | 2 +- CRM/Contact/Form/Edit/IM.php | 2 +- CRM/Contact/Form/Edit/OpenID.php | 2 +- CRM/Contact/Form/Edit/Phone.php | 2 +- CRM/Contact/Form/Search/Criteria.php | 4 +-- CRM/Contact/Form/Task/Label.php | 4 +-- CRM/Contact/Import/Form/MapField.php | 8 +++--- CRM/Contact/Import/Form/Preview.php | 2 +- CRM/Contact/Import/ImportJob.php | 2 +- CRM/Contact/Selector.php | 4 +-- CRM/Contribute/BAO/ContributionPage.php | 2 +- CRM/Contribute/Form/AbstractEditPayment.php | 2 +- CRM/Contribute/Form/ContributionBase.php | 2 +- CRM/Contribute/Form/UpdateBilling.php | 2 +- CRM/Contribute/Import/Form/MapField.php | 2 +- CRM/Core/BAO/LocationType.php | 2 +- CRM/Core/BAO/Mapping.php | 4 +-- CRM/Core/BAO/UFGroup.php | 2 +- CRM/Core/Payment/BaseIPN.php | 4 +-- CRM/Core/PseudoConstant.php | 27 --------------------- CRM/Dedupe/Merger.php | 4 +-- CRM/Event/Cart/Form/Cart.php | 2 +- CRM/Event/Form/Participant.php | 2 +- CRM/Event/Form/Registration.php | 2 +- CRM/Event/Import/Form/MapField.php | 2 +- CRM/Export/BAO/Export.php | 2 +- CRM/Logging/Differ.php | 2 +- CRM/Member/Form/Membership.php | 2 +- CRM/Member/Form/MembershipRenewal.php | 2 +- CRM/Member/Import/Form/MapField.php | 2 +- CRM/Profile/Selector/Listings.php | 4 +-- CRM/SMS/Provider.php | 2 +- CRM/UF/Form/Field.php | 2 +- CRM/UF/Page/Field.php | 2 +- CRM/UF/Page/ProfileEditor.php | 2 +- 40 files changed, 54 insertions(+), 81 deletions(-) diff --git a/CRM/Activity/Import/Form/MapField.php b/CRM/Activity/Import/Form/MapField.php index bf591b03c1..31c455ced6 100644 --- a/CRM/Activity/Import/Form/MapField.php +++ b/CRM/Activity/Import/Form/MapField.php @@ -256,7 +256,7 @@ class CRM_Activity_Import_Form_MapField extends CRM_Core_Form { foreach ($mapperKeys as $key) { $this->_fieldUsed[$key] = FALSE; } - $this->_location_types = CRM_Core_PseudoConstant::locationType(); + $this->_location_types = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); $sel1 = $this->_mapperFields; $sel2[''] = NULL; diff --git a/CRM/Contact/BAO/Contact.php b/CRM/Contact/BAO/Contact.php index c721066b01..ba0816aae6 100644 --- a/CRM/Contact/BAO/Contact.php +++ b/CRM/Contact/BAO/Contact.php @@ -540,7 +540,7 @@ WHERE civicrm_contact.id = " . CRM_Utils_Type::escape($id, 'Integer'); foreach ($defaults[$name] as $count => & $values) { //get location type id. - CRM_Utils_Array::lookupValue($values, 'location_type', CRM_Core_PseudoConstant::locationType(), $reverse); + CRM_Utils_Array::lookupValue($values, 'location_type', CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'), $reverse); if ($name == 'address') { // FIXME: lookupValue doesn't work for vcard_name @@ -1454,7 +1454,7 @@ WHERE id={$id}; "; * @static */ static function &makeHierReturnProperties($fields, $contactId = NULL) { - $locationTypes = CRM_Core_PseudoConstant::locationType(); + $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); $returnProperties = array(); @@ -1801,7 +1801,7 @@ ORDER BY civicrm_email.is_primary DESC"; } // get the billing location type - $locationTypes = CRM_Core_PseudoConstant::locationType(); + $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); $billingLocationTypeId = array_search('Billing', $locationTypes); $blocks = array('email', 'phone', 'im', 'openid'); diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index 9112fbb984..acfd596bcd 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -794,7 +794,7 @@ class CRM_Contact_BAO_Query { return; } - $locationTypes = CRM_Core_PseudoConstant::locationType(); + $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); $processed = array(); $index = 0; @@ -1929,7 +1929,7 @@ class CRM_Contact_BAO_Query { $setTables = FALSE; //get the location name - $locationType = CRM_Core_PseudoConstant::locationType(); + $locationType = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); list($tName, $fldName) = self::getLocationTableName($field['where'], $locType); $where = "`$tName`.$fldName"; @@ -1978,7 +1978,7 @@ class CRM_Contact_BAO_Query { list($tbName, $fldName) = explode(".", $where); //get the location name - $locationType = CRM_Core_PseudoConstant::locationType(); + $locationType = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); $specialFields = array('email', 'im', 'phone', 'openid', 'phone_ext'); if (in_array($locType[0], $specialFields)) { //hack to fix / special handing for phone_ext @@ -3246,7 +3246,7 @@ WHERE id IN ( $groupIDs ) $this->_tables['civicrm_address'] = 1; $this->_whereTables['civicrm_address'] = 1; - $locationType = CRM_Core_PseudoConstant::locationType(); + $locationType = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); $names = array(); foreach (array_keys($value) as $id) { $names[] = $locationType[$id]; diff --git a/CRM/Contact/Form/Contact.php b/CRM/Contact/Form/Contact.php index d9d09ee027..555afde009 100644 --- a/CRM/Contact/Form/Contact.php +++ b/CRM/Contact/Form/Contact.php @@ -467,7 +467,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { * */ function blockSetDefaults(&$defaults) { - $locationTypeKeys = array_filter(array_keys(CRM_Core_PseudoConstant::locationType()), 'is_int'); + $locationTypeKeys = array_filter(array_keys(CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id')), 'is_int'); sort($locationTypeKeys); // get the default location type diff --git a/CRM/Contact/Form/Edit/Address.php b/CRM/Contact/Form/Edit/Address.php index 0b5be3015f..df71a94e4e 100644 --- a/CRM/Contact/Form/Edit/Address.php +++ b/CRM/Contact/Form/Edit/Address.php @@ -74,7 +74,7 @@ class CRM_Contact_Form_Edit_Address { "address[$blockId][location_type_id]", ts('Location Type'), array( - '' => ts('- select -')) + CRM_Core_PseudoConstant::locationType(), + '' => ts('- select -')) + CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'), $js ); diff --git a/CRM/Contact/Form/Edit/Email.php b/CRM/Contact/Form/Edit/Email.php index b272d5da82..3ea3725531 100644 --- a/CRM/Contact/Form/Edit/Email.php +++ b/CRM/Contact/Form/Edit/Email.php @@ -65,7 +65,7 @@ class CRM_Contact_Form_Edit_Email { $form->addRule("email[$blockId][email]", ts('Email is not valid.'), 'email'); if (isset($form->_contactType) || $blockEdit) { //Block type - $form->addElement('select', "email[$blockId][location_type_id]", '', CRM_Core_PseudoConstant::locationType()); + $form->addElement('select', "email[$blockId][location_type_id]", '', CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id')); $multipleBulk = CRM_Core_BAO_Email::isMultipleBulkMail(); diff --git a/CRM/Contact/Form/Edit/IM.php b/CRM/Contact/Form/Edit/IM.php index f0eb69d6bb..710abef095 100644 --- a/CRM/Contact/Form/Edit/IM.php +++ b/CRM/Contact/Form/Edit/IM.php @@ -62,7 +62,7 @@ class CRM_Contact_Form_Edit_IM { $form->addElement('select', "im[$blockId][provider_id]", '', CRM_Core_PseudoConstant::IMProvider()); //Block type select - $form->addElement('select', "im[$blockId][location_type_id]", '', CRM_Core_PseudoConstant::locationType()); + $form->addElement('select', "im[$blockId][location_type_id]", '', CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id')); //IM box $form->addElement('text', "im[$blockId][name]", ts('Instant Messenger'), diff --git a/CRM/Contact/Form/Edit/OpenID.php b/CRM/Contact/Form/Edit/OpenID.php index 97338e75f3..65fb275f89 100644 --- a/CRM/Contact/Form/Edit/OpenID.php +++ b/CRM/Contact/Form/Edit/OpenID.php @@ -64,7 +64,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::locationType()); + $form->addElement('select', "openid[$blockId][location_type_id]", '', CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id')); //is_Primary radio $js = array('id' => "OpenID_" . $blockId . "_IsPrimary"); diff --git a/CRM/Contact/Form/Edit/Phone.php b/CRM/Contact/Form/Edit/Phone.php index c767282e16..6efff32e7c 100644 --- a/CRM/Contact/Form/Edit/Phone.php +++ b/CRM/Contact/Form/Edit/Phone.php @@ -70,7 +70,7 @@ class CRM_Contact_Form_Edit_Phone { if (isset($form->_contactType) || $blockEdit) { //Block type select - $form->addElement('select', "phone[$blockId][location_type_id]", '', CRM_Core_PseudoConstant::locationType()); + $form->addElement('select', "phone[$blockId][location_type_id]", '', CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id')); //is_Primary radio $js = array('id' => 'Phone_' . $blockId . '_IsPrimary', 'onClick' => 'singleSelect( this.id );'); diff --git a/CRM/Contact/Form/Search/Criteria.php b/CRM/Contact/Form/Search/Criteria.php index d95e97c50c..47ea794b32 100644 --- a/CRM/Contact/Form/Search/Criteria.php +++ b/CRM/Contact/Form/Search/Criteria.php @@ -259,7 +259,7 @@ class CRM_Contact_Form_Search_Criteria { // Phone search $form->addElement('text', 'phone_numeric', ts('Phone Number'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Phone', 'phone')); - $locationType = CRM_Core_PseudoConstant::locationType(); + $locationType = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); $phoneType = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id'); $form->add('select', 'phone_location_type_id', ts('Phone Location'), array('' => ts('- any -')) + $locationType); $form->add('select', 'phone_phone_type_id', ts('Phone Type'), array('' => ts('- any -')) + $phoneType); @@ -381,7 +381,7 @@ class CRM_Contact_Form_Search_Criteria { // checkboxes for location type $location_type = array(); - $locationType = CRM_Core_PseudoConstant::locationType(); + $locationType = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); foreach ($locationType as $locationTypeID => $locationTypeName) { $location_type[] = $form->createElement('checkbox', $locationTypeID, NULL, $locationTypeName); } diff --git a/CRM/Contact/Form/Task/Label.php b/CRM/Contact/Form/Task/Label.php index 6af5e9379d..7a61f6da17 100644 --- a/CRM/Contact/Form/Task/Label.php +++ b/CRM/Contact/Form/Task/Label.php @@ -69,7 +69,7 @@ class CRM_Contact_Form_Task_Label extends CRM_Contact_Form_Task { // add select for Location Type $this->addElement('select', 'location_type_id', ts('Select Location'), array( - '' => ts('Primary')) + CRM_Core_PseudoConstant::locationType(), TRUE + '' => ts('Primary')) + CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'), TRUE ); // checkbox for SKIP contacts with Do Not Mail privacy option @@ -164,7 +164,7 @@ class CRM_Contact_Form_Task_Label extends CRM_Contact_Form_Task { //get the contacts information $params = array(); if (CRM_Utils_Array::value('location_type_id', $fv)) { - $locType = CRM_Core_PseudoConstant::locationType(); + $locType = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); $locName = $locType[$fv['location_type_id']]; $location = array('location' => array("{$locName}" => $address)); $returnProperties = array_merge($returnProperties, $location); diff --git a/CRM/Contact/Import/Form/MapField.php b/CRM/Contact/Import/Form/MapField.php index 42b2ed1546..aecbe5aeb8 100644 --- a/CRM/Contact/Import/Form/MapField.php +++ b/CRM/Contact/Import/Form/MapField.php @@ -335,7 +335,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Core_Form { $dataPatterns = $this->get('dataPatterns'); $hasLocationTypes = $this->get('fieldTypes'); - $this->_location_types = CRM_Core_PseudoConstant::locationType(); + $this->_location_types = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); $defaultLocationType = CRM_Core_BAO_LocationType::getDefault(); @@ -764,7 +764,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Core_Form { $phoneTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id'); $imProviders = CRM_Core_PseudoConstant::IMProvider(); $websiteTypes = CRM_Core_PseudoConstant::websiteType(); - $locationTypes = CRM_Core_PseudoConstant::locationType(); + $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); //these mapper params need to set key as array and val as null. $mapperParams = array( @@ -882,7 +882,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Core_Form { //Updating Mapping Records if (CRM_Utils_Array::value('updateMapping', $params)) { - $locationTypes = CRM_Core_PseudoConstant::locationType(); + $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); $mappingFields = new CRM_Core_DAO_MappingField(); $mappingFields->mapping_id = $params['mappingId']; @@ -961,7 +961,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Core_Form { $saveMapping = CRM_Core_BAO_Mapping::add($mappingParams); - $locationTypes = CRM_Core_PseudoConstant::locationType(); + $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); $contactType = $this->get('contactType'); switch ($contactType) { case CRM_Contact_Import_Parser::CONTACT_INDIVIDUAL: diff --git a/CRM/Contact/Import/Form/Preview.php b/CRM/Contact/Import/Form/Preview.php index cba79d017c..f81f354eff 100644 --- a/CRM/Contact/Import/Form/Preview.php +++ b/CRM/Contact/Import/Form/Preview.php @@ -411,7 +411,7 @@ class CRM_Contact_Import_Form_Preview extends CRM_Core_Form { $mapFields = $this->get('fields'); - $locationTypes = CRM_Core_PseudoConstant::locationType(); + $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); $phoneTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id'); foreach ($mapper as $key => $value) { diff --git a/CRM/Contact/Import/ImportJob.php b/CRM/Contact/Import/ImportJob.php index ceeac286e8..a09a2fdb9d 100644 --- a/CRM/Contact/Import/ImportJob.php +++ b/CRM/Contact/Import/ImportJob.php @@ -147,7 +147,7 @@ class CRM_Contact_Import_ImportJob { $phoneTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id'); $imProviders = CRM_Core_PseudoConstant::IMProvider(); $websiteTypes = CRM_Core_PseudoConstant::websiteType(); - $locationTypes = CRM_Core_PseudoConstant::locationType(); + $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); //initialize mapper perperty value. $mapperPeroperties = array( diff --git a/CRM/Contact/Selector.php b/CRM/Contact/Selector.php index 77376ad2b4..a44c79f212 100644 --- a/CRM/Contact/Selector.php +++ b/CRM/Contact/Selector.php @@ -363,7 +363,7 @@ class CRM_Contact_Selector extends CRM_Core_Selector_Base implements CRM_Core_Se ), ); - $locationTypes = CRM_Core_PseudoConstant::locationType(); + $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); foreach ($this->_fields as $name => $field) { if (CRM_Utils_Array::value('in_selector', $field) && @@ -518,7 +518,7 @@ class CRM_Contact_Selector extends CRM_Core_Selector_Base implements CRM_Core_Se } if ($this->_ufGroupID) { - $locationTypes = CRM_Core_PseudoConstant::locationType(); + $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); $names = array(); static $skipFields = array('group', 'tag'); diff --git a/CRM/Contribute/BAO/ContributionPage.php b/CRM/Contribute/BAO/ContributionPage.php index 09f6407d34..bf380b5766 100644 --- a/CRM/Contribute/BAO/ContributionPage.php +++ b/CRM/Contribute/BAO/ContributionPage.php @@ -232,7 +232,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio // get the billing location type if (!array_key_exists('related_contact', $values)) { - $locationTypes = CRM_Core_PseudoConstant::locationType(); + $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); $billingLocationTypeId = array_search('Billing', $locationTypes); } else { diff --git a/CRM/Contribute/Form/AbstractEditPayment.php b/CRM/Contribute/Form/AbstractEditPayment.php index 78f6d64eb4..c7aa8954d0 100644 --- a/CRM/Contribute/Form/AbstractEditPayment.php +++ b/CRM/Contribute/Form/AbstractEditPayment.php @@ -354,7 +354,7 @@ LEFT JOIN civicrm_contribution on (civicrm_contribution.contact_id = civicrm_co * @return void */ public function assignBillingType() { - $locationTypes = CRM_Core_PseudoConstant::locationType(); + $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); $this->_bltID = array_search('Billing', $locationTypes); if (!$this->_bltID) { CRM_Core_Error::fatal(ts('Please set a location type of %1', array(1 => 'Billing'))); diff --git a/CRM/Contribute/Form/ContributionBase.php b/CRM/Contribute/Form/ContributionBase.php index 901527e098..6cad74dc36 100644 --- a/CRM/Contribute/Form/ContributionBase.php +++ b/CRM/Contribute/Form/ContributionBase.php @@ -269,7 +269,7 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { // also check for billing informatin // get the billing location type - $locationTypes = CRM_Core_PseudoConstant::locationType(); + $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); // CRM-8108 remove ts around Billing location type //$this->_bltID = array_search( ts('Billing'), $locationTypes ); $this->_bltID = array_search('Billing', $locationTypes); diff --git a/CRM/Contribute/Form/UpdateBilling.php b/CRM/Contribute/Form/UpdateBilling.php index 625e278d47..25c2bb1ec4 100644 --- a/CRM/Contribute/Form/UpdateBilling.php +++ b/CRM/Contribute/Form/UpdateBilling.php @@ -109,7 +109,7 @@ class CRM_Contribute_Form_UpdateBilling extends CRM_Core_Form { $this->assign('paymentProcessor', $this->_paymentProcessor); // get the billing location type - $locationTypes = CRM_Core_PseudoConstant::locationType(); + $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); $this->_bltID = array_search('Billing', $locationTypes); $this->assign('bltID', $this->_bltID); if (!$this->_bltID) { diff --git a/CRM/Contribute/Import/Form/MapField.php b/CRM/Contribute/Import/Form/MapField.php index 7aaca3f379..c1ac3be980 100644 --- a/CRM/Contribute/Import/Form/MapField.php +++ b/CRM/Contribute/Import/Form/MapField.php @@ -283,7 +283,7 @@ class CRM_Contribute_Import_Form_MapField extends CRM_Core_Form { foreach ($mapperKeys as $key) { $this->_fieldUsed[$key] = FALSE; } - $this->_location_types = CRM_Core_PseudoConstant::locationType(); + $this->_location_types = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); $sel1 = $this->_mapperFields; if (!$this->get('onDuplicate')) { diff --git a/CRM/Core/BAO/LocationType.php b/CRM/Core/BAO/LocationType.php index 36818e16b4..f1c50c1ea1 100644 --- a/CRM/Core/BAO/LocationType.php +++ b/CRM/Core/BAO/LocationType.php @@ -111,7 +111,7 @@ class CRM_Core_BAO_LocationType extends CRM_Core_DAO_LocationType { */ static function getBilling() { if (self::$_billingLocationType == NULL) { - $locationTypes = CRM_Core_PseudoConstant::locationType(); + $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); self::$_billingLocationType = array_search('Billing', $locationTypes); } return self::$_billingLocationType; diff --git a/CRM/Core/BAO/Mapping.php b/CRM/Core/BAO/Mapping.php index 326f4443e4..752bebe886 100644 --- a/CRM/Core/BAO/Mapping.php +++ b/CRM/Core/BAO/Mapping.php @@ -527,7 +527,7 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping { $mapperKeys = array_keys($mapperFields); - $locationTypes = CRM_Core_PseudoConstant::locationType(); + $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); $defaultLocationType = CRM_Core_BAO_LocationType::getDefault(); @@ -1088,7 +1088,7 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping { return $fields; } - $locationTypes = CRM_Core_PseudoConstant::locationType(); + $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); foreach ($params['mapper'] as $key => $value) { foreach ($value as $k => $v) { if (isset($v[1])) { diff --git a/CRM/Core/BAO/UFGroup.php b/CRM/Core/BAO/UFGroup.php index 3c2e751510..5828be16ba 100644 --- a/CRM/Core/BAO/UFGroup.php +++ b/CRM/Core/BAO/UFGroup.php @@ -906,7 +906,7 @@ class CRM_Core_BAO_UFGroup extends CRM_Core_DAO_UFGroup { $config = CRM_Core_Config::singleton(); - $locationTypes = CRM_Core_PseudoConstant::locationType(); + $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); $imProviders = CRM_Core_PseudoConstant::IMProvider(); $websiteTypes = CRM_Core_PseudoConstant::websiteType(); diff --git a/CRM/Core/Payment/BaseIPN.php b/CRM/Core/Payment/BaseIPN.php index cf001e435e..281419415c 100644 --- a/CRM/Core/Payment/BaseIPN.php +++ b/CRM/Core/Payment/BaseIPN.php @@ -549,7 +549,7 @@ LIMIT 1;"; function getBillingID(&$ids) { // get the billing location type - $locationTypes = CRM_Core_PseudoConstant::locationType(); + $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); // CRM-8108 remove the ts around the Billing locationtype //$ids['billing'] = array_search( ts('Billing'), $locationTypes ); $ids['billing'] = array_search('Billing', $locationTypes); @@ -824,4 +824,4 @@ LIMIT 1;"; } } } -} \ No newline at end of file +} diff --git a/CRM/Core/PseudoConstant.php b/CRM/Core/PseudoConstant.php index 224bcf8870..0ae97ec3ec 100644 --- a/CRM/Core/PseudoConstant.php +++ b/CRM/Core/PseudoConstant.php @@ -56,13 +56,6 @@ class CRM_Core_PseudoConstant { */ private static $cache; - /** - * location type - * @var array - * @static - */ - private static $locationType; - /** * location vCard name * @var array @@ -574,26 +567,6 @@ class CRM_Core_PseudoConstant { } } - /** - * Get all location types. - * - * The static array locationType is returned - * - * @access public - * @static - * - * @param boolean $all - get All location types - default is to get only active ones. - * - * @return array - array reference of all location types. - * - */ - public static function &locationType($all = FALSE) { - if (!self::$locationType) { - self::populate(self::$locationType, 'CRM_Core_DAO_LocationType', $all); - } - return self::$locationType; - } - /** * Get all location vCard names. * diff --git a/CRM/Dedupe/Merger.php b/CRM/Dedupe/Merger.php index 59cef93fc7..a42a25323f 100644 --- a/CRM/Dedupe/Merger.php +++ b/CRM/Dedupe/Merger.php @@ -638,7 +638,7 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m 'old_migration_info' => $migrationInfo, 'mode' => $mode, ); - $allLocationTypes = CRM_Core_PseudoConstant::locationType(); + $allLocationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); foreach ($migrationInfo as $key => $val) { if ($val === "null") { @@ -890,7 +890,7 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m } } - $allLocationTypes = CRM_Core_PseudoConstant::locationType(); + $allLocationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); $mainLocBlock = $locBlockIds = array(); $locBlockIds['main'] = $locBlockIds['other'] = array(); diff --git a/CRM/Event/Cart/Form/Cart.php b/CRM/Event/Cart/Form/Cart.php index 66f9cbe422..57442536c3 100644 --- a/CRM/Event/Cart/Form/Cart.php +++ b/CRM/Event/Cart/Form/Cart.php @@ -15,7 +15,7 @@ class CRM_Event_Cart_Form_Cart extends CRM_Core_Form { $this->checkWaitingList(); - $locationTypes = CRM_Core_PseudoConstant::locationType(); + $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); $this->_bltID = array_search('Billing', $locationTypes); $this->assign('bltID', $this->_bltID); diff --git a/CRM/Event/Form/Participant.php b/CRM/Event/Form/Participant.php index 6fe4d260de..6d1bb78913 100644 --- a/CRM/Event/Form/Participant.php +++ b/CRM/Event/Form/Participant.php @@ -288,7 +288,7 @@ class CRM_Event_Form_Participant extends CRM_Contact_Form_Task { } // also check for billing information // get the billing location type - $locationTypes = CRM_Core_PseudoConstant::locationType(); + $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); // CRM-8108 remove ts around Billing location type //$this->_bltID = array_search( ts('Billing'), $locationTypes ); $this->_bltID = array_search('Billing', $locationTypes); diff --git a/CRM/Event/Form/Registration.php b/CRM/Event/Form/Registration.php index 56a1e1acdd..80880c11c7 100644 --- a/CRM/Event/Form/Registration.php +++ b/CRM/Event/Form/Registration.php @@ -429,7 +429,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { $params = array('id' => $this->_eventId); // get the billing location type - $locationTypes = CRM_Core_PseudoConstant::locationType(); + $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); // CRM-8108 remove ts from Billing as the location type can not be translated in CiviCRM! //$this->_bltID = array_search( ts('Billing'), $locationTypes ); diff --git a/CRM/Event/Import/Form/MapField.php b/CRM/Event/Import/Form/MapField.php index d0e42e604d..a3b3842622 100644 --- a/CRM/Event/Import/Form/MapField.php +++ b/CRM/Event/Import/Form/MapField.php @@ -277,7 +277,7 @@ class CRM_Event_Import_Form_MapField extends CRM_Core_Form { foreach ($mapperKeys as $key) { $this->_fieldUsed[$key] = FALSE; } - $this->_location_types = CRM_Core_PseudoConstant::locationType(); + $this->_location_types = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); $sel1 = $this->_mapperFields; $sel2[''] = NULL; diff --git a/CRM/Export/BAO/Export.php b/CRM/Export/BAO/Export.php index f4f73c5986..a6f1b86555 100644 --- a/CRM/Export/BAO/Export.php +++ b/CRM/Export/BAO/Export.php @@ -127,7 +127,7 @@ class CRM_Export_BAO_Export { } if ($fields) { //construct return properties - $locationTypes = CRM_Core_PseudoConstant::locationType(); + $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); $locationTypeFields = array( 'street_address', 'supplemental_address_1', diff --git a/CRM/Logging/Differ.php b/CRM/Logging/Differ.php index 74c6447f1d..61b8dbef14 100644 --- a/CRM/Logging/Differ.php +++ b/CRM/Logging/Differ.php @@ -235,7 +235,7 @@ WHERE log_conn_id = %1 AND '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::locationType(), + '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(), diff --git a/CRM/Member/Form/Membership.php b/CRM/Member/Form/Membership.php index a66dcdfb85..da4e4ad680 100644 --- a/CRM/Member/Form/Membership.php +++ b/CRM/Member/Form/Membership.php @@ -167,7 +167,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { } // also check for billing information // get the billing location type - $locationTypes = CRM_Core_PseudoConstant::locationType(); + $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); // CRM-8108 remove ts around Billing location type //$this->_bltID = array_search( ts('Billing'), $locationTypes ); $this->_bltID = array_search('Billing', $locationTypes); diff --git a/CRM/Member/Form/MembershipRenewal.php b/CRM/Member/Form/MembershipRenewal.php index b9fada68d2..0733b03dee 100644 --- a/CRM/Member/Form/MembershipRenewal.php +++ b/CRM/Member/Form/MembershipRenewal.php @@ -157,7 +157,7 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form { } // also check for billing information // get the billing location type - $locationTypes = CRM_Core_PseudoConstant::locationType(); + $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); // CRM-8108 remove ts around Billing location type //$this->_bltID = array_search( ts('Billing'), $locationTypes ); $this->_bltID = array_search('Billing', $locationTypes); diff --git a/CRM/Member/Import/Form/MapField.php b/CRM/Member/Import/Form/MapField.php index f94f5112be..81ec6ce08e 100644 --- a/CRM/Member/Import/Form/MapField.php +++ b/CRM/Member/Import/Form/MapField.php @@ -293,7 +293,7 @@ class CRM_Member_Import_Form_MapField extends CRM_Core_Form { foreach ($mapperKeys as $key) { $this->_fieldUsed[$key] = FALSE; } - $this->_location_types = CRM_Core_PseudoConstant::locationType(); + $this->_location_types = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); $sel1 = $this->_mapperFields; if (!$this->get('onDuplicate')) { unset($sel1['id']); diff --git a/CRM/Profile/Selector/Listings.php b/CRM/Profile/Selector/Listings.php index a977e7aba0..43cded7c3c 100644 --- a/CRM/Profile/Selector/Listings.php +++ b/CRM/Profile/Selector/Listings.php @@ -309,7 +309,7 @@ class CRM_Profile_Selector_Listings extends CRM_Core_Selector_Base implements CR ), ); - $locationTypes = CRM_Core_PseudoConstant::locationType(); + $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); foreach ($this->_fields as $name => $field) { // skip pseudo fields @@ -497,7 +497,7 @@ class CRM_Profile_Selector_Listings extends CRM_Core_Selector_Base implements CR } $links = self::links($this->_map, $this->_editLink, $this->_linkToUF, $this->_profileIds); - $locationTypes = CRM_Core_PseudoConstant::locationType(); + $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); $names = array(); static $skipFields = array('group', 'tag'); diff --git a/CRM/SMS/Provider.php b/CRM/SMS/Provider.php index f524ec68c0..72c6e1251f 100644 --- a/CRM/SMS/Provider.php +++ b/CRM/SMS/Provider.php @@ -168,7 +168,7 @@ 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::locationType(); + $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); $phoneTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id'); $phoneloc = array_search('Home', $locationTypes); $phonetype = array_search('Mobile', $phoneTypes); diff --git a/CRM/UF/Form/Field.php b/CRM/UF/Form/Field.php index ba6c29b0c9..811173c55e 100644 --- a/CRM/UF/Form/Field.php +++ b/CRM/UF/Form/Field.php @@ -280,7 +280,7 @@ class CRM_UF_Form_Field extends CRM_Core_Form { } $this->assign('noSearchable', $noSearchable); - $this->_location_types = CRM_Core_PseudoConstant::locationType(); + $this->_location_types = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); $defaultLocationType = CRM_Core_BAO_LocationType::getDefault(); /** diff --git a/CRM/UF/Page/Field.php b/CRM/UF/Page/Field.php index 423c386e4b..37e43dbb64 100644 --- a/CRM/UF/Page/Field.php +++ b/CRM/UF/Page/Field.php @@ -130,7 +130,7 @@ class CRM_UF_Page_Field extends CRM_Core_Page { } $locationType = array(); - $locationType = CRM_Core_PseudoConstant::locationType(); + $locationType = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', '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/ProfileEditor.php b/CRM/UF/Page/ProfileEditor.php index fd1dda2f34..f30c8d5dd4 100644 --- a/CRM/UF/Page/ProfileEditor.php +++ b/CRM/UF/Page/ProfileEditor.php @@ -22,7 +22,7 @@ class CRM_UF_Page_ProfileEditor extends CRM_Core_Page { ->addSettingsFactory(function(){ return array( 'PseudoConstant' => array( - 'locationType' => CRM_Core_PseudoConstant::locationType(), + 'locationType' => CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'), 'phoneType' => CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id'), ), 'initialProfileList' => civicrm_api('UFGroup', 'get', array( -- 2.25.1