From c67c8cd4c2fd3e307725051a54df896ae53649d3 Mon Sep 17 00:00:00 2001 From: fusionate Date: Mon, 30 Nov 2020 14:15:57 -0700 Subject: [PATCH] Destination Select - Dynamic: Clear session array on add/toggle/delete of a destination type record. --- app/bridges/bridge_edit.php | 5 +++++ app/bridges/resources/classes/bridges.php | 10 ++++++++++ app/call_centers/call_center_queue_edit.php | 5 +++++ app/call_centers/resources/classes/call_center.php | 5 +++++ app/call_flows/call_flow_edit.php | 5 +++++ app/call_flows/resources/classes/call_flows.php | 10 ++++++++++ app/conference_centers/conference_center_edit.php | 5 +++++ .../resources/classes/conference_centers.php | 10 ++++++++++ app/conferences/conference_edit.php | 5 +++++ app/conferences/resources/classes/conferences.php | 10 ++++++++++ .../resources/classes/destinations.php | 11 +++++------ app/dialplans/dialplan_edit.php | 5 +++++ app/dialplans/resources/classes/dialplan.php | 14 ++++++++++++++ app/extensions/extension_edit.php | 6 ++++++ app/extensions/resources/classes/extension.php | 10 ++++++++++ app/fax/fax_edit.php | 6 ++++++ app/fax/resources/classes/fax.php | 5 +++++ app/ivr_menus/ivr_menu_edit.php | 6 ++++++ app/ivr_menus/resources/classes/ivr_menu.php | 10 ++++++++++ app/phrases/phrase_edit.php | 10 ++++++++++ app/phrases/phrases.php | 6 +++--- app/phrases/resources/classes/phrases.php | 10 ++++++++++ app/recordings/recordings.php | 5 +++++ .../resources/classes/switch_recordings.php | 5 +++++ app/ring_groups/resources/classes/ring_groups.php | 10 ++++++++++ app/ring_groups/ring_group_edit.php | 5 +++++ .../resources/classes/time_conditions.php | 10 ++++++++++ app/time_conditions/time_condition_edit.php | 5 +++++ app/voicemails/resources/classes/voicemail.php | 10 ++++++++++ app/voicemails/voicemail_edit.php | 5 +++++ 30 files changed, 215 insertions(+), 9 deletions(-) diff --git a/app/bridges/bridge_edit.php b/app/bridges/bridge_edit.php index a3e2b89218..49f2a7483d 100644 --- a/app/bridges/bridge_edit.php +++ b/app/bridges/bridge_edit.php @@ -124,6 +124,11 @@ $database->save($array); $message = $database->message; + //clear the destinations session array + if (isset($_SESSION['destinations']['array'])) { + unset($_SESSION['destinations']['array']); + } + //redirect the user if (isset($action)) { if ($action == "add") { diff --git a/app/bridges/resources/classes/bridges.php b/app/bridges/resources/classes/bridges.php index 5254fe7d7b..f7797092e6 100644 --- a/app/bridges/resources/classes/bridges.php +++ b/app/bridges/resources/classes/bridges.php @@ -106,6 +106,11 @@ if (!class_exists('bridges')) { $database->delete($array); unset($array); + //clear the destinations session array + if (isset($_SESSION['destinations']['array'])) { + unset($_SESSION['destinations']['array']); + } + //set message message::add($text['message-delete']); } @@ -174,6 +179,11 @@ if (!class_exists('bridges')) { $database->save($array); unset($array); + //clear the destinations session array + if (isset($_SESSION['destinations']['array'])) { + unset($_SESSION['destinations']['array']); + } + //set message message::add($text['message-toggle']); } diff --git a/app/call_centers/call_center_queue_edit.php b/app/call_centers/call_center_queue_edit.php index 9d0a64eaf0..7889f1032f 100644 --- a/app/call_centers/call_center_queue_edit.php +++ b/app/call_centers/call_center_queue_edit.php @@ -379,6 +379,11 @@ $cache = new cache; $cache->delete("dialplan:".$_SESSION["domain_name"]); + //clear the destinations session array + if (isset($_SESSION['destinations']['array'])) { + unset($_SESSION['destinations']['array']); + } + //redirect the user if (isset($action)) { if ($action == "add") { diff --git a/app/call_centers/resources/classes/call_center.php b/app/call_centers/resources/classes/call_center.php index 4f62248265..bd9887cce9 100644 --- a/app/call_centers/resources/classes/call_center.php +++ b/app/call_centers/resources/classes/call_center.php @@ -369,6 +369,11 @@ $cache->delete("dialplan:".$_SESSION["domain_name"]); remove_config_from_cache('configuration:callcenter.conf'); + //clear the destinations session array + if (isset($_SESSION['destinations']['array'])) { + unset($_SESSION['destinations']['array']); + } + //synchronize configuration save_call_center_xml(); diff --git a/app/call_flows/call_flow_edit.php b/app/call_flows/call_flow_edit.php index c507527df7..d7b4cc6f21 100644 --- a/app/call_flows/call_flow_edit.php +++ b/app/call_flows/call_flow_edit.php @@ -255,6 +255,11 @@ $cache = new cache; $cache->delete("dialplan:".$call_flow_context); + //clear the destinations session array + if (isset($_SESSION['destinations']['array'])) { + unset($_SESSION['destinations']['array']); + } + //redirect the user if (isset($action)) { if ($action == "add") { diff --git a/app/call_flows/resources/classes/call_flows.php b/app/call_flows/resources/classes/call_flows.php index 2bb4d87647..cff8c934f0 100644 --- a/app/call_flows/resources/classes/call_flows.php +++ b/app/call_flows/resources/classes/call_flows.php @@ -158,6 +158,11 @@ if (!class_exists('call_flows')) { } } + //clear the destinations session array + if (isset($_SESSION['destinations']['array'])) { + unset($_SESSION['destinations']['array']); + } + //set message message::add($text['message-delete']); } @@ -250,6 +255,11 @@ if (!class_exists('call_flows')) { } } + //clear the destinations session array + if (isset($_SESSION['destinations']['array'])) { + unset($_SESSION['destinations']['array']); + } + //set message message::add($text['message-toggle']); } diff --git a/app/conference_centers/conference_center_edit.php b/app/conference_centers/conference_center_edit.php index 468910f612..fe8b29769e 100644 --- a/app/conference_centers/conference_center_edit.php +++ b/app/conference_centers/conference_center_edit.php @@ -185,6 +185,11 @@ $cache = new cache; $cache->delete("dialplan:".$_SESSION["domain_name"]); + //clear the destinations session array + if (isset($_SESSION['destinations']['array'])) { + unset($_SESSION['destinations']['array']); + } + //redirect the user if (isset($action)) { if ($action == "add") { diff --git a/app/conference_centers/resources/classes/conference_centers.php b/app/conference_centers/resources/classes/conference_centers.php index 7943fc08ef..ed6b316039 100644 --- a/app/conference_centers/resources/classes/conference_centers.php +++ b/app/conference_centers/resources/classes/conference_centers.php @@ -375,6 +375,11 @@ if (!class_exists('conference_centers')) { $cache = new cache; $cache->delete("dialplan:".$_SESSION["domain_name"]); + //clear the destinations session array + if (isset($_SESSION['destinations']['array'])) { + unset($_SESSION['destinations']['array']); + } + //apply settings reminder $_SESSION["reload_xml"] = true; @@ -606,6 +611,11 @@ if (!class_exists('conference_centers')) { $cache = new cache; $cache->delete("dialplan:".$_SESSION["domain_name"]); + //clear the destinations session array + if (isset($_SESSION['destinations']['array'])) { + unset($_SESSION['destinations']['array']); + } + //set message message::add($text['message-toggle']); diff --git a/app/conferences/conference_edit.php b/app/conferences/conference_edit.php index c87d4ea371..0e12346361 100644 --- a/app/conferences/conference_edit.php +++ b/app/conferences/conference_edit.php @@ -243,6 +243,11 @@ $cache = new cache; $cache->delete("dialplan:".$_SESSION["domain_name"]); + //clear the destinations session array + if (isset($_SESSION['destinations']['array'])) { + unset($_SESSION['destinations']['array']); + } + //redirect the browser header("Location: conferences.php"); exit; diff --git a/app/conferences/resources/classes/conferences.php b/app/conferences/resources/classes/conferences.php index 570ee92dca..38ce49cd9e 100644 --- a/app/conferences/resources/classes/conferences.php +++ b/app/conferences/resources/classes/conferences.php @@ -143,6 +143,11 @@ if (!class_exists('conferences')) { $cache = new cache; $cache->delete("dialplan:".$_SESSION["domain_name"]); + //clear the destinations session array + if (isset($_SESSION['destinations']['array'])) { + unset($_SESSION['destinations']['array']); + } + //set message message::add($text['message-delete']); @@ -229,6 +234,11 @@ if (!class_exists('conferences')) { $cache = new cache; $cache->delete("dialplan:".$_SESSION["domain_name"]); + //clear the destinations session array + if (isset($_SESSION['destinations']['array'])) { + unset($_SESSION['destinations']['array']); + } + //set message message::add($text['message-toggle']); } diff --git a/app/destinations/resources/classes/destinations.php b/app/destinations/resources/classes/destinations.php index f103dd8812..4521f445b3 100644 --- a/app/destinations/resources/classes/destinations.php +++ b/app/destinations/resources/classes/destinations.php @@ -457,13 +457,12 @@ if (!class_exists('destinations')) { //get the destinations $destination = new destinations; - if (!isset($_SESSION['destinations'][$destination_type])) { - unset($_SESSION['destinations'][$destination_type]); - $_SESSION['destinations'][$destination_type] = $destination->get($destination_type); + if (!isset($_SESSION['destinations']['array'][$destination_type])) { + $_SESSION['destinations']['array'][$destination_type] = $destination->get($destination_type); } //get the destination label - foreach($_SESSION['destinations'][$destination_type] as $key => $value) { + foreach($_SESSION['destinations']['array'][$destination_type] as $key => $value) { foreach($value as $k => $row) { if ($destination_value == $row['destination']) { $destination_key = $key; @@ -479,7 +478,7 @@ if (!class_exists('destinations')) { //build the destination select list in html $response .= " \n"; $response .= "