From f422dcae9f4419bfcf54c168078c9ff9d6986f5b Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Wed, 17 Oct 2012 00:34:38 +0000 Subject: [PATCH] Fix a bug where spaces can cause problems with the IVR Menu. Remove the space and replace it with a dash. When displaying back to the user replace the dash with a space to make it look nicer. --- app/ivr_menu/v_ivr_menu.php | 3 ++- app/ivr_menu/v_ivr_menu_edit.php | 39 ++++++++++++++++++-------------- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/app/ivr_menu/v_ivr_menu.php b/app/ivr_menu/v_ivr_menu.php index 1f4a9caf56..5a11c61704 100644 --- a/app/ivr_menu/v_ivr_menu.php +++ b/app/ivr_menu/v_ivr_menu.php @@ -119,8 +119,9 @@ require_once "includes/paging.php"; if ($result_count > 0) { foreach($result as $row) { + $ivr_menu_name = str_replace("-", " ", $row['ivr_menu_name']); echo "\n"; - echo " ".$row['ivr_menu_name']."\n"; + echo " ".$ivr_menu_name."\n"; echo " ".$row['ivr_menu_extension']." \n"; echo " ".$row['ivr_menu_direct_dial']."\n"; echo " ".$row['ivr_menu_enabled']."\n"; diff --git a/app/ivr_menu/v_ivr_menu_edit.php b/app/ivr_menu/v_ivr_menu_edit.php index dc46608c7b..d56cfa4f67 100644 --- a/app/ivr_menu/v_ivr_menu_edit.php +++ b/app/ivr_menu/v_ivr_menu_edit.php @@ -166,6 +166,9 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { return; } + //replace the space with a dash + $ivr_menu_name = str_replace(" ", "-", $ivr_menu_name); + //add or update the database if ($_POST["persistformvar"] != "true") { //prepare the object @@ -273,10 +276,12 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $ivr_menu_enabled = $row["ivr_menu_enabled"]; $ivr_menu_description = $row["ivr_menu_description"]; + //replace the dash with a space + $ivr_menu_name = str_replace("-", " ", $ivr_menu_name); + if (strlen($ivr_menu_exit_app) > 0) { $ivr_menu_exit_action = $ivr_menu_exit_app.":".$ivr_menu_exit_data; } - break; //limit to 1 row } unset ($prep_statement); } @@ -526,22 +531,22 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; } //sounds - //$dir_path = $_SESSION['switch']['sounds']['dir']; - //recur_sounds_dir($_SESSION['switch']['sounds']['dir']); - //echo "\n"; - //foreach ($dir_array as $key => $value) { - // if (strlen($value) > 0) { - // $tmp_dir = "\$\${sounds_dir}/\${default_language}/\${default_dialect}/\${default_voice}"; - // if ($ivr_menu_greet_short == $tmp_dir.'/'.$key) { - // $tmp_selected = true; - // echo " \n"; - // } - // else { - // echo " \n"; - // } - // } - //} - //echo "\n"; + $dir_path = $_SESSION['switch']['sounds']['dir']; + recur_sounds_dir($_SESSION['switch']['sounds']['dir']); + echo "\n"; + foreach ($dir_array as $key => $value) { + if (strlen($value) > 0) { + $tmp_dir = "\$\${sounds_dir}/\${default_language}/\${default_dialect}/\${default_voice}"; + if ($ivr_menu_greet_short == $tmp_dir.'/'.$key) { + $tmp_selected = true; + echo " \n"; + } + else { + echo " \n"; + } + } + } + echo "\n"; //select if (if_group("superadmin")) { if (!$tmp_selected) {