$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');
}
}
$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);
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;
'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);
}
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;
'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);
}
$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');
}
}
$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);
$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');
}
}
$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);
$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');
}
}
$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);
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)) {
$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');
}
}
$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);