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.
This commit is contained in:
FusionPBX 2022-06-06 18:11:13 -06:00 committed by GitHub
parent e0866eba32
commit cf1aad072c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 7 deletions

View File

@ -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;