From cf1aad072c50c4ad2fa2d53fcc6a94ac5b5c8936 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Mon, 6 Jun 2022 18:11:13 -0600 Subject: [PATCH] Found a more efficient way to force lower case on boolean values. Helpful for supporting multiple databases. Make the import safer for users where the value is expected in lower case. Best solution for PostgreSQL is boolean data type but that would still not be a good solution for alternative databases. --- app/voicemails/voicemail_imports.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/app/voicemails/voicemail_imports.php b/app/voicemails/voicemail_imports.php index 66c88ebf34..9b03d21d84 100644 --- a/app/voicemails/voicemail_imports.php +++ b/app/voicemails/voicemail_imports.php @@ -276,17 +276,16 @@ $result[$key] = preg_replace('{\D}', '', $result[$key]); } + //set the voicemail_local_after_email, voicemail_tutorial, and voicemail_enabled to lower case + if ($field_name == 'voicemail_local_after_email' || $field_name == 'voicemail_tutorial' || $field_name == 'voicemail_enabled') { + $result[$key] = strtolower($result[$key]); + } + //build the data array if (strlen($table_name) > 0) { if (strlen($parent) == 0) { $array[$table_name][$row_id]['domain_uuid'] = $domain_uuid; - if ($field_name == 'voicemail_local_after_email' || $field_name == 'voicemail_tutorial' || $field_name == 'voicemail_enabled') { - $field_value = strtolower($result[$key]); - } - else { - $field_value = $result[$key]; - } - $array[$table_name][$row_id][$field_name] = $field_value; + $array[$table_name][$row_id][$field_name] = $result[$key]; } else { $array[$parent][$row_id][$table_name][$y]['domain_uuid'] = $domain_uuid;