From f36df2b810d0d83e6fbcc07819dc9cb3a9919290 Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Sat, 28 Jul 2012 03:21:49 +0000 Subject: [PATCH] Fix a bug in hunt group call forward and some code cleanup. --- app/hunt_group/v_hunt_group_call_forward.php | 11 +++-------- app/hunt_group/v_hunt_group_call_forward_edit.php | 14 +++++++------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/app/hunt_group/v_hunt_group_call_forward.php b/app/hunt_group/v_hunt_group_call_forward.php index 7e1dae82c1..b8ae6149b2 100644 --- a/app/hunt_group/v_hunt_group_call_forward.php +++ b/app/hunt_group/v_hunt_group_call_forward.php @@ -52,8 +52,7 @@ if (permission_exists('hunt_group_call_forward')) { echo "
"; } - $sql = ""; - $sql .= "select * from v_hunt_groups "; + $sql = "select * from v_hunt_groups "; $sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "and hunt_group_type <> 'dnd' "; $sql .= "and hunt_group_type <> 'call_forward' "; @@ -90,10 +89,7 @@ if (permission_exists('hunt_group_call_forward')) { echo "\n"; } - if ($result_count == 0) { - //no results - } - else { //received results + if ($result_count > 0) { foreach($result as $row) { echo "\n"; echo " ".$row['hunt_group_extension']."\n"; @@ -103,9 +99,8 @@ if (permission_exists('hunt_group_call_forward')) { echo " ".$row['hunt_group_description']." \n"; echo "\n"; if ($c==0) { $c=1; } else { $c=0; } - } //end foreach + } unset($sql, $result, $row_count); - } //end if results if ($is_included == "true" && $result_count == 0) { diff --git a/app/hunt_group/v_hunt_group_call_forward_edit.php b/app/hunt_group/v_hunt_group_call_forward_edit.php index 004d92edd7..92929379aa 100644 --- a/app/hunt_group/v_hunt_group_call_forward_edit.php +++ b/app/hunt_group/v_hunt_group_call_forward_edit.php @@ -61,8 +61,7 @@ function destination_select($select_name, $select_value, $select_default) { $hunt_group_uuid = $_REQUEST["id"]; //hunt_group information used to determine if this is an add or an update - $sql = ""; - $sql .= "select * from v_hunt_groups "; + $sql = "select * from v_hunt_groups "; $sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "and hunt_group_uuid = '$hunt_group_uuid' "; if (!(permission_exists('hunt_group_add') || permission_exists('hunt_group_edit'))) { @@ -303,8 +302,10 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $db->exec(check_sql($sql)); //insert the v_hunt_group_destinations + $hunt_group_destination_uuid = uuid(); $sql = "insert into v_hunt_group_destinations "; $sql .= "("; + $sql .= "hunt_group_destination_uuid, "; $sql .= "domain_uuid, "; $sql .= "hunt_group_uuid, "; $sql .= "destination_data, "; @@ -317,6 +318,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $sql .= ")"; $sql .= "values "; $sql .= "("; + $sql .= "'$hunt_group_destination_uuid', "; $sql .= "'$domain_uuid', "; $sql .= "'$call_forward_uuid', "; $sql .= "'$destination_data', "; @@ -339,7 +341,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //redirect the user require_once "includes/header.php"; - echo "\n"; + echo "\n"; echo "
\n"; echo "Update Complete
\n"; echo "
\n"; @@ -351,8 +353,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { require_once "includes/header.php"; //pre-populate the form - $sql = ""; - $sql .= "select * from v_hunt_groups "; + $sql = "select * from v_hunt_groups "; $sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "and hunt_group_type = 'call_forward' "; $sql .= "and hunt_group_extension = '$hunt_group_extension' "; @@ -382,8 +383,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { } if ($row["hunt_group_type"] == 'call_forward') { - $sql = ""; - $sql .= "select * from v_hunt_group_destinations "; + $sql = "select * from v_hunt_group_destinations "; $sql .= "where hunt_group_uuid = '$hunt_group_uuid' "; $prep_statement_2 = $db->prepare(check_sql($sql)); $prep_statement_2->execute();