From f255a890defd0a8e3b06f8f3a5f4c3a1a1d5202d Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Wed, 18 Jul 2012 22:28:14 +0000 Subject: [PATCH] Ensure that the ivr menu exists in dialplan when the ivr menu is saved. --- includes/classes/switch_ivr_menu.php | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/includes/classes/switch_ivr_menu.php b/includes/classes/switch_ivr_menu.php index a4f062d6a3..effab34c98 100644 --- a/includes/classes/switch_ivr_menu.php +++ b/includes/classes/switch_ivr_menu.php @@ -404,21 +404,16 @@ include "root.php"; $database->fields['dialplan_enabled'] = $this->ivr_menu_enabled; $database->fields['dialplan_description'] = $this->ivr_menu_description; $database->fields['app_uuid'] = $this->app_uuid; - if ($this->dialplan_uuid) { - $database->where[0]['name'] = 'domain_uuid'; - $database->where[0]['value'] = $this->domain_uuid; - $database->where[0]['operator'] = '='; - $database->where[1]['name'] = 'dialplan_uuid'; - $database->where[1]['value'] = $this->dialplan_uuid; - $database->where[1]['operator'] = '='; - $database->update(); - } - else { - $this->dialplan_uuid = uuid(); - $database->fields['domain_uuid'] = $this->domain_uuid; - $database->fields['dialplan_uuid'] = $this->dialplan_uuid; - $database->add(); - } + $database->fields['domain_uuid'] = $this->domain_uuid; + $database->fields['dialplan_uuid'] = $this->dialplan_uuid; + $database->where[0]['name'] = 'domain_uuid'; + $database->where[0]['value'] = $this->domain_uuid; + $database->where[0]['operator'] = '='; + $database->where[1]['name'] = 'dialplan_uuid'; + $database->where[1]['value'] = $this->dialplan_uuid; + $database->where[1]['operator'] = '='; + $database->delete(); + $database->add(); //delete the old dialplan details to prepare for new details $database = new database;