Give precedence to number_alias over extension in destinations class that generates the destination select list.

This commit is contained in:
markjcrane 2015-08-15 21:49:27 -06:00
parent 47921ff596
commit 74804cea64
2 changed files with 26 additions and 7 deletions

View File

@ -25,10 +25,11 @@
$apps[$x]['destinations'][$y]['type'] = "sql"; $apps[$x]['destinations'][$y]['type'] = "sql";
$apps[$x]['destinations'][$y]['label'] = "extensions"; $apps[$x]['destinations'][$y]['label'] = "extensions";
$apps[$x]['destinations'][$y]['name'] = "extensions"; $apps[$x]['destinations'][$y]['name'] = "extensions";
$apps[$x]['destinations'][$y]['sql'] = "select extension, number_alias, user_context as context, description from v_extensions ";
$apps[$x]['destinations'][$y]['where'] = "where domain_uuid = '\${domain_uuid}' and enabled = 'true' "; $apps[$x]['destinations'][$y]['where'] = "where domain_uuid = '\${domain_uuid}' and enabled = 'true' ";
$apps[$x]['destinations'][$y]['order_by'] = "extension asc"; $apps[$x]['destinations'][$y]['order_by'] = "number_alias, extension asc";
$apps[$x]['destinations'][$y]['field']['context'] = "user_context"; $apps[$x]['destinations'][$y]['field']['context'] = "user_context";
$apps[$x]['destinations'][$y]['field']['destination'] = "extension"; $apps[$x]['destinations'][$y]['field']['destination'] = "number_alias,extension";
$apps[$x]['destinations'][$y]['field']['description'] = "description"; $apps[$x]['destinations'][$y]['field']['description'] = "description";
$apps[$x]['destinations'][$y]['select_value']['user_contact'] = "user/\${destination}@\${domain_name}"; $apps[$x]['destinations'][$y]['select_value']['user_contact'] = "user/\${destination}@\${domain_name}";
$apps[$x]['destinations'][$y]['select_value']['dialplan'] = "transfer:\${destination} XML \${context}"; $apps[$x]['destinations'][$y]['select_value']['dialplan'] = "transfer:\${destination} XML \${context}";

View File

@ -203,13 +203,31 @@ class destinations {
} }
} }
else { else {
$select_value = str_replace("\${".$key."}", $data[$key], $select_value); if (strpos($value,',') !== false) {
if (strlen($data['label']) == 0) { $keys = explode(",", $value);
$select_label = str_replace("\${".$key."}", $data[$key], $select_label); foreach ($keys as $k) {
if (strlen($data[$k]) > 0) {
$select_value = str_replace("\${".$key."}", $data[$k], $select_value);
if (strlen($data['label']) == 0) {
$select_label = str_replace("\${".$key."}", $data[$k], $select_label);
}
else {
$label = $data['label'];
$select_label = str_replace("\${".$key."}", $text2['option-'.$label]."215", $select_label);
}
}
}
} }
else { else {
$label = $data['label']; $select_value = str_replace("\${".$key."}", $data[$key], $select_value);
$select_label = str_replace("\${".$key."}", $text2['option-'.$label], $select_label); if (strlen($data['label']) == 0) {
$select_label = str_replace("\${".$key."}", $data[$key], $select_label);
}
else {
$label = $data['label'];
$select_label = str_replace("\${".$key."}", $text2['option-'.$label], $select_label);
}
} }
} }
} }