diff --git a/app/voicemails/voicemail_edit.php b/app/voicemails/voicemail_edit.php index 5cc4e6ff4b..1908a4934c 100644 --- a/app/voicemails/voicemail_edit.php +++ b/app/voicemails/voicemail_edit.php @@ -141,9 +141,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { $sql .= "voicemail_uuid, "; $sql .= "voicemail_id, "; $sql .= "voicemail_password, "; - if (strlen($greeting_id) > 0) { - $sql .= "greeting_id, "; - } + $sql .= "greeting_id, "; $sql .= "voicemail_mail_to, "; $sql .= "voicemail_file, "; $sql .= "voicemail_local_after_email, "; @@ -156,9 +154,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { $sql .= "'".uuid()."', "; $sql .= "'".$voicemail_id."', "; $sql .= "'".$voicemail_password."', "; - if (strlen($greeting_id) > 0) { - $sql .= "'".$greeting_id."', "; - } + $sql .= (($greeting_id != '') ? "'".$greeting_id."'" : 'null').", "; $sql .= "'".$voicemail_mail_to."', "; $sql .= "'".$voicemail_file."', "; $sql .= "'".$voicemail_local_after_email."', "; @@ -175,12 +171,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { $sql = "update v_voicemails set "; $sql .= "voicemail_id = '".$voicemail_id."', "; $sql .= "voicemail_password = '".$voicemail_password."', "; - if (strlen($greeting_id) > 0) { - $sql .= "greeting_id = '".$greeting_id."', "; - } - else { - $sql .= "greeting_id = null, "; - } + $sql .= "greeting_id = ".(($greeting_id != '') ? "'".$greeting_id."'" : 'null').", "; $sql .= "voicemail_mail_to = '".$voicemail_mail_to."', "; $sql .= "voicemail_file = '".$voicemail_file."', "; $sql .= "voicemail_local_after_email = '".$voicemail_local_after_email."', "; @@ -294,6 +285,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $greetings = $prep_statement->fetchAll(PDO::FETCH_NAMED); + echo "
".print_r($greetings, true)."