From: eileen Date: Mon, 15 Jan 2018 23:22:41 +0000 (+1300) Subject: CRM-21660 Remove use of deprecated function on mapping_type X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=95f52e3b3a921b0bb282d7f287b9cafc3d02dbb3;p=civicrm-core.git CRM-21660 Remove use of deprecated function on mapping_type --- diff --git a/CRM/Activity/Import/Form/MapField.php b/CRM/Activity/Import/Form/MapField.php index 752e4a9607..488970061a 100644 --- a/CRM/Activity/Import/Form/MapField.php +++ b/CRM/Activity/Import/Form/MapField.php @@ -339,8 +339,7 @@ class CRM_Activity_Import_Form_MapField extends CRM_Import_Form_MapField { $errors['saveMappingName'] = ts('Name is required to save Import Mapping'); } else { - $mappingTypeId = CRM_Core_OptionGroup::getValue('mapping_type', 'Import Activity', 'name'); - if (CRM_Core_BAO_Mapping::checkMapping($nameField, $mappingTypeId)) { + if (CRM_Core_BAO_Mapping::checkMapping($nameField, CRM_Core_PseudoConstant::getKey('CRM_Core_BAO_Mapping', 'mapping_type_id', 'Import Activity'))) { $errors['saveMappingName'] = ts('Duplicate Import Mapping Name'); } } @@ -441,10 +440,7 @@ class CRM_Activity_Import_Form_MapField extends CRM_Import_Form_MapField { $mappingParams = array( 'name' => $params['saveMappingName'], 'description' => $params['saveMappingDesc'], - 'mapping_type_id' => CRM_Core_OptionGroup::getValue('mapping_type', - 'Import Activity', - 'name' - ), + 'mapping_type_id' => CRM_Core_PseudoConstant::getKey('CRM_Core_BAO_Mapping', 'mapping_type_id', 'Import Activity'), ); $saveMapping = CRM_Core_BAO_Mapping::add($mappingParams); diff --git a/CRM/Contact/BAO/Group.php b/CRM/Contact/BAO/Group.php index d513ba2605..9aa7704fb6 100644 --- a/CRM/Contact/BAO/Group.php +++ b/CRM/Contact/BAO/Group.php @@ -673,10 +673,7 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group { if (!$ssId) { //save record in mapping table $mappingParams = array( - 'mapping_type_id' => CRM_Core_OptionGroup::getValue('mapping_type', - 'Search Builder', - 'name' - ), + 'mapping_type_id' => CRM_Core_PseudoConstant::getKey('CRM_Core_BAO_Mapping', 'mapping_type_id', 'Search Builder'), ); $mapping = CRM_Core_BAO_Mapping::add($mappingParams); $mappingId = $mapping->id; @@ -731,10 +728,7 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group { 'id' => $mappingId, 'name' => CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Group', $smartGroupId, 'name', 'id'), 'description' => CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Group', $smartGroupId, 'description', 'id'), - 'mapping_type_id' => CRM_Core_OptionGroup::getValue('mapping_type', - 'Search Builder', - 'name' - ), + 'mapping_type_id' => CRM_Core_PseudoConstant::getKey('CRM_Core_BAO_Mapping', 'mapping_type_id', 'Search Builder'), ); CRM_Core_BAO_Mapping::add($mappingParams); } diff --git a/CRM/Contact/Form/Task/SaveSearch.php b/CRM/Contact/Form/Task/SaveSearch.php index bff3f0d129..54be7e0d02 100644 --- a/CRM/Contact/Form/Task/SaveSearch.php +++ b/CRM/Contact/Form/Task/SaveSearch.php @@ -158,10 +158,7 @@ class CRM_Contact_Form_Task_SaveSearch extends CRM_Contact_Form_Task { if (!$this->_id) { //save record in mapping table $mappingParams = array( - 'mapping_type_id' => CRM_Core_OptionGroup::getValue('mapping_type', - 'Search Builder', - 'name' - ), + 'mapping_type_id' => CRM_Core_PseudoConstant::getKey('CRM_Core_BAO_Mapping', 'mapping_type_id', 'Search Builder'), ); $mapping = CRM_Core_BAO_Mapping::add($mappingParams); $mappingId = $mapping->id; @@ -240,10 +237,7 @@ class CRM_Contact_Form_Task_SaveSearch extends CRM_Contact_Form_Task { 'id' => $mappingId, 'name' => CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Group', $group->id, 'name', 'id'), 'description' => CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Group', $group->id, 'description', 'id'), - 'mapping_type_id' => CRM_Core_OptionGroup::getValue('mapping_type', - 'Search Builder', - 'name' - ), + 'mapping_type_id' => CRM_Core_PseudoConstant::getKey('CRM_Core_BAO_Mapping', 'mapping_type_id', 'Search Builder'), ); CRM_Core_BAO_Mapping::add($mappingParams); } diff --git a/CRM/Contribute/Import/Form/MapField.php b/CRM/Contribute/Import/Form/MapField.php index 8421712d4d..d9c6de574d 100644 --- a/CRM/Contribute/Import/Form/MapField.php +++ b/CRM/Contribute/Import/Form/MapField.php @@ -421,8 +421,7 @@ class CRM_Contribute_Import_Form_MapField extends CRM_Import_Form_MapField { $errors['saveMappingName'] = ts('Name is required to save Import Mapping'); } else { - $mappingTypeId = CRM_Core_OptionGroup::getValue('mapping_type', 'Import Contribution', 'name'); - if (CRM_Core_BAO_Mapping::checkMapping($nameField, $mappingTypeId)) { + if (CRM_Core_BAO_Mapping::checkMapping($nameField, CRM_Core_PseudoConstant::getKey('CRM_Core_BAO_Mapping', 'mapping_type_id', 'Import Contribution'))) { $errors['saveMappingName'] = ts('Duplicate Import Contribution Mapping Name'); } } @@ -526,10 +525,7 @@ class CRM_Contribute_Import_Form_MapField extends CRM_Import_Form_MapField { $mappingParams = array( 'name' => $params['saveMappingName'], 'description' => $params['saveMappingDesc'], - 'mapping_type_id' => CRM_Core_OptionGroup::getValue('mapping_type', - 'Import Contribution', - 'name' - ), + 'mapping_type_id' => CRM_Core_PseudoConstant::getKey('CRM_Core_BAO_Mapping', 'mapping_type_id', 'Import Contribution'), ); $saveMapping = CRM_Core_BAO_Mapping::add($mappingParams); diff --git a/CRM/Custom/Import/Form/MapField.php b/CRM/Custom/Import/Form/MapField.php index d68aa95a36..abc0138c04 100644 --- a/CRM/Custom/Import/Form/MapField.php +++ b/CRM/Custom/Import/Form/MapField.php @@ -88,8 +88,7 @@ class CRM_Custom_Import_Form_MapField extends CRM_Contact_Import_Form_MapField { $errors['saveMappingName'] = ts('Name is required to save Import Mapping'); } else { - $mappingTypeId = CRM_Core_OptionGroup::getValue('mapping_type', 'Import Multi value custom data', 'name'); - if (CRM_Core_BAO_Mapping::checkMapping($nameField, $mappingTypeId)) { + if (CRM_Core_BAO_Mapping::checkMapping($nameField, CRM_Core_PseudoConstant::getKey('CRM_Core_BAO_Mapping', 'mapping_type_id', 'Import Multi value custom data'))) { $errors['saveMappingName'] = ts('Duplicate ' . $self->_mappingType . 'Mapping Name'); } } @@ -187,10 +186,7 @@ class CRM_Custom_Import_Form_MapField extends CRM_Contact_Import_Form_MapField { $mappingParams = array( 'name' => $params['saveMappingName'], 'description' => $params['saveMappingDesc'], - 'mapping_type_id' => CRM_Core_OptionGroup::getValue('mapping_type', - $this->_mappingType, - 'name' - ), + 'mapping_type_id' => CRM_Core_PseudoConstant::getKey('CRM_Core_BAO_Mapping', 'mapping_type_id', $this->_mappingType), ); $saveMapping = CRM_Core_BAO_Mapping::add($mappingParams); diff --git a/CRM/Event/Import/Form/MapField.php b/CRM/Event/Import/Form/MapField.php index 2f63420270..0751cbe0a6 100644 --- a/CRM/Event/Import/Form/MapField.php +++ b/CRM/Event/Import/Form/MapField.php @@ -362,8 +362,7 @@ class CRM_Event_Import_Form_MapField extends CRM_Import_Form_MapField { $errors['saveMappingName'] = ts('Name is required to save Import Mapping'); } else { - $mappingTypeId = CRM_Core_OptionGroup::getValue('mapping_type', 'Import Participant', 'name'); - if (CRM_Core_BAO_Mapping::checkMapping($nameField, $mappingTypeId)) { + if (CRM_Core_BAO_Mapping::checkMapping($nameField, CRM_Core_PseudoConstant::getKey('CRM_Core_BAO_Mapping', 'mapping_type_id', 'Import Participant'))) { $errors['saveMappingName'] = ts('Duplicate Import Participant Mapping Name'); } } @@ -461,10 +460,7 @@ class CRM_Event_Import_Form_MapField extends CRM_Import_Form_MapField { $mappingParams = array( 'name' => $params['saveMappingName'], 'description' => $params['saveMappingDesc'], - 'mapping_type_id' => CRM_Core_OptionGroup::getValue('mapping_type', - 'Import Participant', - 'name' - ), + 'mapping_type_id' => CRM_Core_PseudoConstant::getKey('CRM_Core_BAO_Mapping', 'mapping_type_id', 'Import Participant'), ); $saveMapping = CRM_Core_BAO_Mapping::add($mappingParams); diff --git a/CRM/Export/Form/Select.php b/CRM/Export/Form/Select.php index fdf563e372..e5ee25856f 100644 --- a/CRM/Export/Form/Select.php +++ b/CRM/Export/Form/Select.php @@ -471,8 +471,7 @@ FROM {$this->_componentTable} break; } - $mappingTypeId = CRM_Core_OptionGroup::getValue('mapping_type', $exportType, 'name'); - $this->set('mappingTypeId', $mappingTypeId); + $this->set('mappingTypeId', CRM_Core_PseudoConstant::getKey('CRM_Core_BAO_Mapping', 'mapping_type_id', $exportType)); $mappings = CRM_Core_BAO_Mapping::getMappings($exportType); if (!empty($mappings)) { diff --git a/CRM/Member/Import/Form/MapField.php b/CRM/Member/Import/Form/MapField.php index bfab1fddde..a48eb20700 100644 --- a/CRM/Member/Import/Form/MapField.php +++ b/CRM/Member/Import/Form/MapField.php @@ -383,9 +383,7 @@ class CRM_Member_Import_Form_MapField extends CRM_Import_Form_MapField { $errors['saveMappingName'] = ts('Name is required to save Import Mapping'); } else { - $mappingTypeId = CRM_Core_OptionGroup::getValue('mapping_type', 'Import Membership', 'name'); - - if (CRM_Core_BAO_Mapping::checkMapping($nameField, $mappingTypeId)) { + if (CRM_Core_BAO_Mapping::checkMapping($nameField, CRM_Core_PseudoConstant::getKey('CRM_Core_BAO_Mapping', 'mapping_type_id', 'Import Membership'))) { $errors['saveMappingName'] = ts('Duplicate Import Membership Mapping Name'); } } @@ -487,10 +485,7 @@ class CRM_Member_Import_Form_MapField extends CRM_Import_Form_MapField { $mappingParams = array( 'name' => $params['saveMappingName'], 'description' => $params['saveMappingDesc'], - 'mapping_type_id' => CRM_Core_OptionGroup::getValue('mapping_type', - 'Import Membership', - 'name' - ), + 'mapping_type_id' => CRM_Core_PseudoConstant::getKey('CRM_Core_BAO_Mapping', 'mapping_type_id', 'Import Membership'), ); $saveMapping = CRM_Core_BAO_Mapping::add($mappingParams);