Prevent inserting the a new device if the domain does not exist.

This commit is contained in:
Mark Crane 2014-02-23 00:20:29 +00:00
parent a2ad874acf
commit d28d587860
1 changed files with 33 additions and 31 deletions

View File

@ -162,7 +162,7 @@ include "root.php";
$provision[$key] = $value;
}
//check to see if the mac_address exists in v_devices
//check to see if the mac_address exists in devices
if ($this->mac_exists($mac)) {
//get the device_template
//if (strlen($device_template) == 0) {
@ -259,6 +259,7 @@ include "root.php";
unset($template_list);
//mac address does not exist in the table so add it
if (strlen($domain_uuid) > 0) {
$device_uuid = uuid();
$sql = "INSERT INTO v_devices ";
$sql .= "(";
@ -289,6 +290,7 @@ include "root.php";
$this->db->exec(check_sql($sql));
unset($sql);
}
}
//get the device settings table in the provision category and update the provision array
$sql = "SELECT * FROM v_device_settings ";
@ -357,7 +359,7 @@ include "root.php";
$sip_port = $row['sip_port'];
//set defaults
if (strlen($register_expires) == 0) { $register_expires = "90"; }
if (strlen($register_expires) == 0) { $register_expires = "120"; }
if (strlen($sip_transport) == 0) { $sip_transport = "tcp"; }
if (strlen($sip_port) == 0) {
if ($line_number == "" || $line_number == "1") {