diff --git a/app/time_conditions/time_condition_edit.php b/app/time_conditions/time_condition_edit.php index f47c41a75a..0c05178950 100644 --- a/app/time_conditions/time_condition_edit.php +++ b/app/time_conditions/time_condition_edit.php @@ -135,7 +135,7 @@ $dialplan_context = $row["dialplan_context"]; } unset($sql, $parameters, $row); - + } } @@ -515,10 +515,8 @@ } //redirect the browser - if (is_uuid($dialplan_uuid)) { - header("Location: time_condition_edit.php?id=".$dialplan_uuid.($app_uuid != '' ? "&app_uuid=".$app_uuid : null)); - exit; - } + header("Location: time_condition_edit.php?id=".$dialplan_uuid.($app_uuid != '' ? "&app_uuid=".$app_uuid : null)); + exit; } @@ -559,7 +557,7 @@ $sql .= " ) "; $sql .= " or ( "; $sql .= " dialplan_detail_tag = 'action' "; - //$sql .= " and dialplan_detail_data not like 'preset=%' "; + $sql .= " and dialplan_detail_data not like 'preset=%' "; $sql .= " ) "; $sql .= ") "; $sql .= "order by dialplan_detail_group asc, dialplan_detail_order asc"; @@ -586,25 +584,25 @@ } } - //find the selected presets - if (is_array($available_presets)) { - foreach ($available_presets as $preset_number => &$preset) { - if (is_array($preset)) { - foreach ($preset as $preset_name => $preset_variables) { - $preset_checked[$preset_name] = 'false'; - if (is_array($dialplan_details)) { - foreach ($dialplan_details as $row) { - if ($row['dialplan_detail_tag'] == 'action') { - if ($row['dialplan_detail_data'] == 'preset='.$preset_name) { - $preset_checked[$preset_name] = 'true'; - } - } - } - } - } - } - } - } +// //find the selected presets +// if (is_array($available_presets)) { +// foreach ($available_presets as $preset_number => &$preset) { +// if (is_array($preset)) { +// foreach ($preset as $preset_name => $preset_variables) { +// $preset_checked[$preset_name] = 'false'; +// if (is_array($dialplan_details)) { +// foreach ($dialplan_details as $row) { +// if ($row['dialplan_detail_tag'] == 'action') { +// if ($row['dialplan_detail_data'] == 'preset='.$preset_name) { +// $preset_checked[$preset_name] = 'true'; +// } +// } +// } +// } +// } +// } +// } +// } //loop through available presets (if any) if (is_array($available_presets)) { @@ -623,7 +621,7 @@ } //if all preset variables found, then condition is a preset if ($matches == sizeof($preset_variables)) { - + $current_presets[$preset_number] = $group_id; } } @@ -1054,7 +1052,8 @@ if ($action == 'update') { foreach ($available_presets as $preset_number => $preset) { if (is_array($preset)) { foreach ($preset as $preset_name => $preset_variables) { - $checked = (is_array($current_presets) && $preset_checked[$preset_name] == 'true') ? "checked='checked'" : null; + $checked = (is_array($current_presets) && $current_presets[$preset_number] != '') ? "checked='checked'" : null; +// $checked = (is_array($current_presets) && $preset_checked[$preset_name] == 'true') ? "checked='checked'" : null; $preset_group_id = ($checked) ? $current_presets[$preset_number] : $preset_group_id = $preset_number * 5 + 100; if (strlen($text['label-preset_'.$preset_name]) > 0) { @@ -1083,7 +1082,7 @@ if ($action == 'update') { echo " "; echo "
"; echo ""; -/*****/ + if ($action == 'update' && is_array($current_presets) && $current_presets[$preset_number] != '') { //add (potentially customized) preset conditions and populate if (is_array($current_conditions[$preset_group_id])) { @@ -1141,7 +1140,7 @@ if ($action == 'update') { } } } -/**/ + } } } @@ -1266,4 +1265,4 @@ if ($action == 'update') { //include the footer require_once "resources/footer.php"; -?> +?> \ No newline at end of file