Set device vendor

Get the device vendor from the template name if the template was provided otherwise use the get_vendor method using the MAC address
This commit is contained in:
FusionPBX 2021-07-23 11:56:19 -06:00 committed by GitHub
parent 0445361ad1
commit d682ff01d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 0 deletions

View File

@ -500,10 +500,23 @@
if (is_array($device_mac_addresses) && @sizeof($device_mac_addresses) != 0) {
foreach ($device_mac_addresses as $d => $device_mac_address) {
if (is_mac($device_mac_address)) {
//get the device vendor
if (isset($device_templates[$d])) {
//use the the template to get the vendor
$template_array = explode("/", $device_templates[$d]);
$device_vendor = $template_array[0];
}
else {
//use the mac address to get the vendor
$device_vendor = device::get_vendor($device_mac_address);
}
//build the devices array
$array["devices"][$j]["device_uuid"] = $device_uuids[$d];
$array["devices"][$j]["domain_uuid"] = $_SESSION['domain_uuid'];
$array["devices"][$j]["device_mac_address"] = $device_mac_address;
$array["devices"][$j]["device_label"] = $extension;
$array["devices"][$j]["device_vendor"] = $device_vendor;
if (strlen($device_templates[$d]) > 0) {
$array["devices"][$j]["device_template"] = $device_templates[$d];
}