diff --git a/app/extensions/app_config.php b/app/extensions/app_config.php index 8a703c9c5c..e66d930253 100644 --- a/app/extensions/app_config.php +++ b/app/extensions/app_config.php @@ -25,10 +25,11 @@ $apps[$x]['destinations'][$y]['type'] = "sql"; $apps[$x]['destinations'][$y]['label'] = "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]['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']['destination'] = "extension"; + $apps[$x]['destinations'][$y]['field']['destination'] = "number_alias,extension"; $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']['dialplan'] = "transfer:\${destination} XML \${context}"; diff --git a/resources/classes/destinations.php b/resources/classes/destinations.php index 3f8bff2970..316df075e3 100644 --- a/resources/classes/destinations.php +++ b/resources/classes/destinations.php @@ -203,13 +203,31 @@ class destinations { } } else { - $select_value = str_replace("\${".$key."}", $data[$key], $select_value); - if (strlen($data['label']) == 0) { - $select_label = str_replace("\${".$key."}", $data[$key], $select_label); + if (strpos($value,',') !== false) { + $keys = explode(",", $value); + 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 { - $label = $data['label']; - $select_label = str_replace("\${".$key."}", $text2['option-'.$label], $select_label); + $select_value = str_replace("\${".$key."}", $data[$key], $select_value); + 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); + } } } }