diff --git a/app/time_conditions/time_condition_edit.php b/app/time_conditions/time_condition_edit.php index 3d439cc90e..4fdca15879 100644 --- a/app/time_conditions/time_condition_edit.php +++ b/app/time_conditions/time_condition_edit.php @@ -332,9 +332,15 @@ require_once "resources/header.php"; } //parse group app and data - $dialplan_action_array = explode(":", $dialplan_action); - $dialplan_action_app = array_shift($dialplan_action_array); - $dialplan_action_data = join(':', $dialplan_action_array); + if (substr_count($dialplan_action, ":") > 0) { + $dialplan_action_array = explode(":", $dialplan_action); + $dialplan_action_app = array_shift($dialplan_action_array); + $dialplan_action_data = join(':', $dialplan_action_array); + } + else { + $dialplan_action_app = $dialplan_action; + $dialplan_action_data = ''; + } //add group action to query $dialplan_detail_order += 10; @@ -473,10 +479,10 @@ require_once "resources/header.php"; foreach ($result as $row) { if ($row['dialplan_detail_tag'] == 'action') { if ($row['dialplan_detail_group'] == '999') { - $dialplan_anti_action = $row['dialplan_detail_type'].':'.$row['dialplan_detail_data']; + $dialplan_anti_action = $row['dialplan_detail_type'].(($row['dialplan_detail_data'] != '') ? ':'.$row['dialplan_detail_data'] : null); } else { - $dialplan_actions[$row['dialplan_detail_group']] = $row['dialplan_detail_type'].':'.$row['dialplan_detail_data']; + $dialplan_actions[$row['dialplan_detail_group']] = $row['dialplan_detail_type'].(($row['dialplan_detail_data'] != '') ? ':'.$row['dialplan_detail_data'] : null); } } else if ($row['dialplan_detail_tag'] == 'condition') { @@ -774,7 +780,7 @@ function add_custom_condition($group_id, $dialplan_action = '') { echo " "; echo " "; echo " "; - switch_select_destination("dialplan", $text['label-select_destination'], "dialplan_action[".$group_id."]", $dialplan_action, 'width: 300px;', ''); + switch_select_destination("dialplan", '', "dialplan_action[".$group_id."]", $dialplan_action, 'width: 300px;', ''); echo " "; echo " "; echo " "; @@ -931,7 +937,7 @@ echo "\n"; echo " ".$text['label-alternate-destination']."\n"; echo "\n"; echo "\n"; -switch_select_destination("dialplan", $dialplan_anti_action, "dialplan_anti_action", $dialplan_anti_action, 'width: 300px;', ''); + switch_select_destination("dialplan", ' ', "dialplan_anti_action", $dialplan_anti_action, 'width: 300px;', ''); echo "
\n"; echo "\n"; echo "\n"; diff --git a/resources/switch.php b/resources/switch.php index 013c3ced1e..0ca21ca9bf 100644 --- a/resources/switch.php +++ b/resources/switch.php @@ -394,7 +394,7 @@ function ListFiles($dir) { function switch_select_destination($select_type, $select_label, $select_name, $select_value, $select_style, $action='') { //select_type can be ivr, dialplan, call_center_contact or bridge - global $config, $db, $domain_uuid; + global $text, $config, $db, $domain_uuid; //remove special characters from the name $select_id = str_replace("]", "", $select_name); @@ -439,40 +439,34 @@ function switch_select_destination($select_type, $select_label, $select_name, $s //default selection found to false $selection_found = false; - if (if_group("superadmin")) { - echo " \n"; + + //display a default select label (specified explicitly or from the language file) if no selected value is passed in + if ($select_value == '') { + if ($select_label != '') { + $options[] = ""; + $options[] = ""; } - if ($select_type == "dialplan") { - echo " \n"; + else if ($select_label == '' && $text['label-select_destination'] != '') { + $options[] = ""; + $options[] = ""; + } + else { + $options[] = ""; } } - } - else { - echo " \n"; + //output options + if (sizeof($options)>0) { + echo implode("\n",$options); + } + + echo " \n"; if (if_group("superadmin")) { echo ""; }