From 5b0eb14848a4e6891d7da5d8d1111794639e30c1 Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Sat, 13 Sep 2014 10:01:41 +0000 Subject: [PATCH] Prevent saving an empty call forward destination --- app/calls/resources/classes/call_forward.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/calls/resources/classes/call_forward.php b/app/calls/resources/classes/call_forward.php index 6ac8744ff0..710678217a 100644 --- a/app/calls/resources/classes/call_forward.php +++ b/app/calls/resources/classes/call_forward.php @@ -90,9 +90,16 @@ include "root.php"; //update the extension $sql = "update v_extensions set "; - $sql .= "forward_all_destination = '$this->forward_all_destination', "; - $sql .= "dial_string = '".$this->dial_string."', "; - $sql .= "forward_all_enabled = '$this->forward_all_enabled' "; + if (strlen($this->forward_all_destination) == 0 || $this->forward_all_enabled == "false") { + $sql .= "forward_all_destination = null, "; + $sql .= "dial_string = null, "; + $sql .= "forward_all_enabled = false "; + } + else { + $sql .= "forward_all_destination = '$this->forward_all_destination', "; + $sql .= "dial_string = '".$this->dial_string."', "; + $sql .= "forward_all_enabled = 'true' "; + } $sql .= "where domain_uuid = '$this->domain_uuid' "; $sql .= "and extension_uuid = '$this->extension_uuid' "; if ($this->debug) {