CRM_Core_DAO::getAttribute('CRM_Contact_DAO_RelationshipType', 'description')
);
-
-
$contactTypes = CRM_Contact_BAO_ContactType::getSelectElements();
// add select for contact type
$values['preferred_communication_method'] = $preffComm;
$values['preferred_communication_method_display'] = CRM_Utils_Array::value('preferred_communication_method_display', $temp);
- CRM_Contact_DAO_Contact::addDisplayEnums($values);
+ $preferredMailingFormat = CRM_Core_SelectValues::pmf();
+ $values['preferred_mail_format'] = $preferredMailingFormat[$contact->preferred_mail_format];
// get preferred languages
if (!empty($contact->preferred_language)) {
CRM_Utils_System::permissionDenied();
CRM_Utils_System::civiExit();
}
- $this->_options = array(ts('Unsupervised'), ts('Supervised'), ts('General'));
+ $this->_options = CRM_Core_SelectValues::getDedupeRuleTypes();
$this->_rgid = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, 0);
$this->_contactType = CRM_Utils_Request::retrieve('contact_type', 'String', $this, FALSE, 0);
if ($this->_rgid) {
$values = $this->exportValues();
//FIXME: Handle logic to replace is_default column by usage
- $used = CRM_Utils_Array::value('used', $values, FALSE);
// reset used column to General (since there can only
// be one 'Supervised' or 'Unsupervised' rule)
- if ($this->_options[$used] != 'General') {
+ if ($values['used'] != 'General') {
$query = "
UPDATE civicrm_dedupe_rule_group
SET used = 'General'
WHERE contact_type = %1
AND used = %2";
- $queryParams = array(1 => array($this->_contactType, 'String'),
+ $queryParams = array(
+ 1 => array($this->_contactType, 'String'),
2 => array($this->_options[$used], 'String'),
);
$rgDao->title = $values['title'];
$rgDao->is_reserved = CRM_Utils_Array::value('is_reserved', $values, FALSE);
- $rgDao->used = $this->_options[$values['used']];
+ $rgDao->used = $values['used'];
$rgDao->contact_type = $this->_contactType;
$rgDao->threshold = $values['threshold'];
$rgDao->save();
$dao->orderBy('contact_type,used ASC');
$dao->find();
+ $dedupeRuleTypes = CRM_Core_SelectValues::getDedupeRuleTypes();
while ($dao->fetch()) {
$ruleGroups[$dao->contact_type][$dao->id] = array();
CRM_Core_DAO::storeValues($dao, $ruleGroups[$dao->contact_type][$dao->id]);
'DedupeRule',
$dao->id
);
- CRM_Dedupe_DAO_RuleGroup::addDisplayEnums($ruleGroups[$dao->contact_type][$dao->id]);
- }
+ $ruleGroups[$dao->contact_type][$dao->id]['used_display'] = $dedupeRuleTypes[$ruleGroups[$dao->contact_type][$dao->id]['used']];
+ }
$this->assign('brows', $ruleGroups);
}
}
+ $contactTypes = CRM_Contact_BAO_ContactType::getSelectElements();
// find all objects
$object->find();
while ($object->fetch()) {
$values[$object->id] = array();
CRM_Core_DAO::storeValues($object, $values[$object->id]);
- CRM_Contact_DAO_RelationshipType::addDisplayEnums($values[$object->id]);
+ if (is_a($object, 'CRM_Contact_DAO_RelationshipType')) {
+ $values[$object->id]['contact_type_a_display'] = $contactTypes[$values[$object->id]['contact_type_a']];
+ $values[$object->id]['contact_type_b_display'] = $contactTypes[$values[$object->id]['contact_type_b']];
+ }
// populate action links
$this->action($object, $action, $values[$object->id], $links, $permission);
}
return $barcodeTypes;
}
+
+ /**
+ * dedupe rule types
+ */
+ static function getDedupeRuleTypes() {
+ static $dedupeRuleTypes = NULL;
+ if (!$dedupeRuleTypes) {
+ $dedupeRuleTypes = array(
+ 'Unsupervised' => ts('Unsupervised'),
+ 'Supervised' => ts('Supervised'),
+ 'General' => ts('General'),
+ );
+ }
+ return $dedupeRuleTypes;
+ }
}
}
$customGroupExtends = CRM_Core_SelectValues::customGroupExtends();
+ $customGroupStyle = CRM_Core_SelectValues::customGroupStyle();
foreach ($customGroup as $key => $array) {
- CRM_Core_DAO_CustomGroup::addDisplayEnums($customGroup[$key]);
+ $customGroup[$key]['style_display'] = $customGroupStyle[$customGroup[$key]['style']];
$customGroup[$key]['extends_display'] = $customGroupExtends[$customGroup[$key]['extends']];
}
$select['group'] = ts('Group(s)');
$select['tag'] = ts('Tag(s)');
+ $visibility = CRM_Core_SelectValues::ufVisibility();
while ($ufFieldBAO->fetch()) {
$ufField[$ufFieldBAO->id] = array();
$phoneType = $locType = '';
CRM_Core_DAO::storeValues($ufFieldBAO, $ufField[$ufFieldBAO->id]);
- CRM_Core_DAO_UFField::addDisplayEnums($ufField[$ufFieldBAO->id]);
+ $ufField[$ufFieldBAO->id]['visibility_display'] = $visibility[$ufFieldBAO->visibility];
$ufField[$ufFieldBAO->id]['label'] = $ufFieldBAO->label;
return self::$_export;
{rdelim}
-{if $table.hasEnum}
-
- /**
- * adds $value['foo_display'] for each $value['foo'] enum from {$table.name}
- *
- * @param array $values (reference) the array up for enhancing
- * @return void
- */
- static function addDisplayEnums(&$values) {ldelim}
- $enumFields =& {$table.className}::getEnums();
- foreach ($enumFields as $enum) {ldelim}
- if (isset($values[$enum])) {ldelim}
- $values[$enum.'_display'] = {$table.className}::tsEnum($enum, $values[$enum]);
- {rdelim}
- {rdelim}
- {rdelim}
-{/if}
-
{rdelim}