From a9f39f7930cd5a667b1246e48529e11567a96215 Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Wed, 13 Nov 2013 18:34:11 +0000 Subject: [PATCH] If there the hostname is an empty string set the value to null. --- app/sip_profiles/sip_profile_edit.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/sip_profiles/sip_profile_edit.php b/app/sip_profiles/sip_profile_edit.php index f8d1c1ed59..1e96a21a62 100644 --- a/app/sip_profiles/sip_profile_edit.php +++ b/app/sip_profiles/sip_profile_edit.php @@ -95,7 +95,12 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $sql .= "("; $sql .= "'".uuid()."', "; $sql .= "'$sip_profile_name', "; - $sql .= "'$sip_profile_hostname', "; + if (strlen($sip_profile_hostname) > 0) { + $sql .= "'$sip_profile_hostname', "; + } + else { + $sql .= "null, "; + } $sql .= "'$sip_profile_description' "; $sql .= ")"; $db->exec(check_sql($sql)); @@ -106,7 +111,12 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { if ($action == "update") { $sql = "update v_sip_profiles set "; $sql .= "sip_profile_name = '$sip_profile_name', "; - $sql .= "sip_profile_hostname = '$sip_profile_hostname', "; + if (strlen($sip_profile_hostname) > 0) { + $sql .= "sip_profile_hostname = '$sip_profile_hostname', "; + } + else { + $sql .= "sip_profile_hostname = null, "; + } $sql .= "sip_profile_description = '$sip_profile_description' "; $sql .= "where sip_profile_uuid = '$sip_profile_uuid'"; $db->exec(check_sql($sql));