From d90b080913dce02601e8e9c4332e673a5682695d Mon Sep 17 00:00:00 2001 From: koldoa Date: Thu, 22 Oct 2015 10:45:57 +0200 Subject: [PATCH 1/4] Ability to order the time conditions --- app/time_conditions/time_condition_edit.php | 40 ++++++++++++++++++--- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/app/time_conditions/time_condition_edit.php b/app/time_conditions/time_condition_edit.php index 42d7b79a62..87187997f4 100644 --- a/app/time_conditions/time_condition_edit.php +++ b/app/time_conditions/time_condition_edit.php @@ -70,6 +70,8 @@ require_once "resources/header.php"; $dialplan_enabled = check_str($_POST["dialplan_enabled"]); $dialplan_description = check_str($_POST["dialplan_description"]); + + } if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { @@ -248,7 +250,17 @@ require_once "resources/header.php"; $is_preset = (in_array($group_id, $_REQUEST['preset'])) ? true : false; //set group and order number - $dialplan_detail_group = $group_id; + + $dialplan_detail_group_user = check_str($_POST["group_$group_id"]); + + if($dialplan_detail_group_user!='') { + $dialplan_detail_group = $dialplan_detail_group_user; + } else { + $dialplan_detail_group = $group_id; + } + + + $dialplan_detail_order = 0; foreach ($conditions as $cond_num => $cond_var) { @@ -291,6 +303,7 @@ require_once "resources/header.php"; } //add condition to query string + $dialplan_detail_order += 10; $sql .= ", ( "; $sql .= "'".$domain_uuid."', "; @@ -332,7 +345,7 @@ require_once "resources/header.php"; if ($is_preset) { foreach ($_REQUEST['preset'] as $preset_number => $preset_group_id) { if ($group_id == $preset_group_id) { - foreach ($available_presets[$preset_number] as $available_preset_name => $meh) { + foreach ($available_presets[$preset_number] as $available_preset_name => $meh) { $dialplan_detail_order += 10; $sql .= ", ( "; $sql .= "'".$domain_uuid."', "; @@ -361,6 +374,11 @@ require_once "resources/header.php"; $dialplan_action_app = $dialplan_action; $dialplan_action_data = ''; } + + + + + //add group action to query $dialplan_detail_order += 10; @@ -423,11 +441,11 @@ require_once "resources/header.php"; } //execute query - if ($conditions_exist) { + if ($conditions_exist) { $db->exec(check_sql($sql)); unset($sql); } - + //commit the atomic transaction $count = $db->exec("COMMIT;"); //returns affected rows @@ -505,6 +523,7 @@ require_once "resources/header.php"; $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); $result_count = count($result); + unset ($prep_statement, $sql); //load current conditions into array (combined by group), and retrieve action and anti-action @@ -833,7 +852,7 @@ function add_custom_condition($destination, $group_id, $dialplan_action = '') { global $text, $v_link_label_add; echo "\n"; echo "\n"; - echo " ".$text['label-settings']; + echo " ".$text['label-settings']; echo "\n"; echo "\n"; echo " \n"; @@ -846,12 +865,23 @@ function add_custom_condition($destination, $group_id, $dialplan_action = '') { echo " "; echo " "; echo " "; + echo " "; + echo " \n"; + echo " "; echo " "; echo " "; echo " "; + echo " \n"; + echo " "; + + echo " "; + echo " \n"; + echo " "; + + echo "
".$text['label-destination']."
"; //$destination = new destinations; echo $destination->select('dialplan', 'dialplan_action['.$group_id.']', $dialplan_action); echo "
".$text['label-group']."
"; echo "
"; echo " ".$text['description-settings']; From a4e64efa7f3f06404c6cbec26dcec2c7222bceaf Mon Sep 17 00:00:00 2001 From: koldoa Date: Thu, 22 Oct 2015 10:54:19 +0200 Subject: [PATCH 2/4] Formatting --- app/time_conditions/time_condition_edit.php | 22 +++++---------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/app/time_conditions/time_condition_edit.php b/app/time_conditions/time_condition_edit.php index 87187997f4..4a653791f3 100644 --- a/app/time_conditions/time_condition_edit.php +++ b/app/time_conditions/time_condition_edit.php @@ -70,8 +70,6 @@ require_once "resources/header.php"; $dialplan_enabled = check_str($_POST["dialplan_enabled"]); $dialplan_description = check_str($_POST["dialplan_description"]); - - } if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { @@ -252,15 +250,12 @@ require_once "resources/header.php"; //set group and order number $dialplan_detail_group_user = check_str($_POST["group_$group_id"]); - if($dialplan_detail_group_user!='') { $dialplan_detail_group = $dialplan_detail_group_user; } else { $dialplan_detail_group = $group_id; - } - - - + } + $dialplan_detail_order = 0; foreach ($conditions as $cond_num => $cond_var) { @@ -303,7 +298,6 @@ require_once "resources/header.php"; } //add condition to query string - $dialplan_detail_order += 10; $sql .= ", ( "; $sql .= "'".$domain_uuid."', "; @@ -374,11 +368,6 @@ require_once "resources/header.php"; $dialplan_action_app = $dialplan_action; $dialplan_action_data = ''; } - - - - - //add group action to query $dialplan_detail_order += 10; @@ -441,11 +430,11 @@ require_once "resources/header.php"; } //execute query - if ($conditions_exist) { + if ($conditions_exist) { $db->exec(check_sql($sql)); unset($sql); } - + //commit the atomic transaction $count = $db->exec("COMMIT;"); //returns affected rows @@ -523,7 +512,6 @@ require_once "resources/header.php"; $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); $result_count = count($result); - unset ($prep_statement, $sql); //load current conditions into array (combined by group), and retrieve action and anti-action @@ -852,7 +840,7 @@ function add_custom_condition($destination, $group_id, $dialplan_action = '') { global $text, $v_link_label_add; echo "\n"; echo "\n"; - echo " ".$text['label-settings']; + echo " ".$text['label-settings']; echo "\n"; echo "\n"; echo " \n"; From bfbe3abdc3596c4b3b0599a1896b7baf82a3bd00 Mon Sep 17 00:00:00 2001 From: koldoa Date: Thu, 22 Oct 2015 10:58:45 +0200 Subject: [PATCH 3/4] More Formatting --- app/time_conditions/time_condition_edit.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/time_conditions/time_condition_edit.php b/app/time_conditions/time_condition_edit.php index 4a653791f3..d7292e775c 100644 --- a/app/time_conditions/time_condition_edit.php +++ b/app/time_conditions/time_condition_edit.php @@ -339,7 +339,7 @@ require_once "resources/header.php"; if ($is_preset) { foreach ($_REQUEST['preset'] as $preset_number => $preset_group_id) { if ($group_id == $preset_group_id) { - foreach ($available_presets[$preset_number] as $available_preset_name => $meh) { + foreach ($available_presets[$preset_number] as $available_preset_name => $meh) { $dialplan_detail_order += 10; $sql .= ", ( "; $sql .= "'".$domain_uuid."', "; @@ -840,7 +840,7 @@ function add_custom_condition($destination, $group_id, $dialplan_action = '') { global $text, $v_link_label_add; echo "\n"; echo "\n"; echo "
\n"; - echo " ".$text['label-settings']; + echo " ".$text['label-settings']; echo "\n"; echo " \n"; From e519a4fd94e32f4e5fff10ca832631d6240238f5 Mon Sep 17 00:00:00 2001 From: koldoa Date: Thu, 22 Oct 2015 10:59:50 +0200 Subject: [PATCH 4/4] Languages updates --- app/time_conditions/app_languages.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/app/time_conditions/app_languages.php b/app/time_conditions/app_languages.php index 402e6a4027..91dbe32ace 100644 --- a/app/time_conditions/app_languages.php +++ b/app/time_conditions/app_languages.php @@ -583,6 +583,28 @@ $text['label-alternate-destination']['uk'] = ""; $text['label-alternate-destination']['de-at'] = "Alternatives Ziel"; $text['label-alternate-destination']['he'] = ""; +$text['label-group']['en-us'] = "Group"; +$text['label-group']['es-cl'] = "Grupo"; +$text['label-group']['pt-pt'] = ""; +$text['label-group']['fr-fr'] = ""; +$text['label-group']['pt-br'] = ""; +$text['label-group']['pl'] = ""; +$text['label-group']['sv-se'] = ""; +$text['label-group']['uk'] = ""; +$text['label-group']['de-at'] = ""; +$text['label-group']['he'] = ""; + +$text['label-destination']['en-us'] = "Destination"; +$text['label-destination']['es-cl'] = "Destino"; +$text['label-destination']['pt-pt'] = "Destino"; +$text['label-destination']['fr-fr'] = "Destination"; +$text['label-destination']['pt-br'] = ""; +$text['label-destination']['pl'] = "Destynacja"; +$text['label-destination']['sv-se'] = "Destination"; +$text['label-destination']['uk'] = ""; +$text['label-destination']['de-at'] = "Ziel"; +$text['label-destination']['he'] = ""; + $text['header-time_conditions']['en-us'] = "Time Conditions"; $text['header-time_conditions']['es-cl'] = "Condiciones de Tiempo"; $text['header-time_conditions']['pt-pt'] = "Condições Temporais";