Merge pull request #5775 from winsock/device_import_mac_address_normalize

Fix device MAC address imports not normalizing.

# Context
MAC addresses were not being normalized when importing CSV files. If it is not normalized you can get a not found error when provisioning since that is checking the database with a normalized MAC address

# Overview
- Use the same normalization done in device_edit.php in device_imports.php
This commit is contained in:
FusionPBX 2021-03-06 09:55:56 -07:00 committed by GitHub
commit 44300f81e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -291,6 +291,12 @@
$result[$key] = preg_replace('{\D}', '', $result[$key]);
}
//normalize the MAC address
if ($field_name == "device_mac_address") {
$result[$key] = strtolower($result[$key]);
$result[$key] = preg_replace('#[^a-fA-F0-9./]#', '', $result[$key]);
}
//build the data array
if (strlen($table_name) > 0) {
if (strlen($parent) == 0) {