Update device_dashboard.php

If the device_uuid does not have a value then get it.
This commit is contained in:
FusionPBX
2016-07-30 10:25:34 -06:00
committed by GitHub
parent 2b595bf2bc
commit 506483fcfa

View File

@@ -112,13 +112,24 @@
}
}
//sql update
//sql add or update
if (strlen($device_key_uuid) == 0) {
if (permission_exists('device_key_add') && strlen($device_key_type) > 0 && strlen($device_key_value) > 0) {
//create the primary keys
$device_key_uuid = uuid();
//if the device_uuid is not in the array then get the device_uuid from the database
if (strlen($device_uuid) == 0) {
$sql = "SELECT device_uuid, device_profile_uuid FROM v_devices ";
$sql .= "WHERE device_user_uuid = '".$_SESSION['user_uuid']."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_NAMED);
$device_uuid = $row['device_uuid'];
unset($row);
}
//insert the keys
$sql = "insert into v_device_keys ";
$sql .= "(";
@@ -145,7 +156,6 @@
$sql .= "'".$device_key_category."', ";
$sql .= "'".$device_key_vendor."' ";
$sql .= ");";
//echo $sql;
//action add or update
$action = "add";