diff --git a/app/devices/app_config.php b/app/devices/app_config.php index 363f82d74a..d8f6591886 100644 --- a/app/devices/app_config.php +++ b/app/devices/app_config.php @@ -399,6 +399,10 @@ $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Select the type.'; $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'device_key_vendor'; + $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the vendor.'; + $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = 'device_key_type'; $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Select the type.'; diff --git a/app/devices/app_defaults.php b/app/devices/app_defaults.php index bae76fc722..e9ef963768 100644 --- a/app/devices/app_defaults.php +++ b/app/devices/app_defaults.php @@ -24,14 +24,31 @@ Mark J Crane */ -//set all lines to enabled (true) where null or empty string + if ($domains_processed == 1) { - $sql = "update v_device_lines set "; - $sql .= "enabled = 'true' "; - $sql .= "where enabled is null "; - $sql .= "or enabled = '' "; - $db->exec(check_sql($sql)); - unset($sql); + //set all lines to enabled (true) where null or empty string + $sql = "update v_device_lines set "; + $sql .= "enabled = 'true' "; + $sql .= "where enabled is null "; + $sql .= "or enabled = '' "; + $db->exec(check_sql($sql)); + unset($sql); + + //set the device key vendor + $sql = "select * from v_device_keys as k, v_devices as d "; + $sql .= "where d.device_uuid = k.device_uuid "; + $sql .= "and k.device_uuid is not null "; + $sql .= "and k.device_key_vendor is null "; + $s = $db->prepare($sql); + $s->execute(); + $device_keys = $s->fetchAll(PDO::FETCH_ASSOC); + foreach ($device_keys as &$row) { + $sql = "update v_device_lines "; + $sql .= "set device_key_vendor = '".$row["device_vendor"]."' "; + $sql .= "where device_key_uuid = '".$row["device_key_uuid"]."';\n "; + $db->exec(check_sql($sql)); + } + unset($device_keys, $sql); } ?> \ No newline at end of file diff --git a/app/devices/device_edit.php b/app/devices/device_edit.php index 0a5fa61bb8..0d28895d1e 100644 --- a/app/devices/device_edit.php +++ b/app/devices/device_edit.php @@ -835,17 +835,23 @@ require_once "resources/require.php"; echo " \n"; echo "\n"; - echo "\n"; + echo "\n"; //echo " \n"; + if (strlen($row['device_key_vendor']) > 0) { + $device_key_vendor = $row['device_key_vendor']; + } + else { + $device_key_vendor = $device_vendor; + } ?> - + - "; } + if (strtolower($device_vendor) == "aastra" || strlen($device_vendor) == 0 || strlen($device_username) > 0) { + if (strlen($device_vendor) == 0 || strlen($device_username) > 0) { echo ""; } ?> @@ -854,16 +860,16 @@ require_once "resources/require.php"; "; } } - if (strtolower($device_vendor) == "cisco" || strlen($device_vendor) == 0) { - if (strlen($device_vendor) == 0) { echo ""; } + if (strtolower($device_vendor) == "cisco" || strlen($device_vendor) == 0 || strlen($device_username) > 0) { + if (strlen($device_vendor) == 0 || strlen($device_username) > 0) { echo ""; } ?> "; } } - if (strtolower($device_vendor) == "grandstream" || strlen($device_vendor) == 0) { - if (strlen($device_vendor) == 0) { echo ""; } + if (strtolower($device_vendor) == "grandstream" || strlen($device_vendor) == 0 || strlen($device_username) > 0) { + if (strlen($device_vendor) == 0 || strlen($device_username) > 0) { echo ""; } ?> @@ -882,8 +888,8 @@ require_once "resources/require.php"; "; } } - if (strtolower($device_vendor) == "polycom" || strlen($device_vendor) == 0) { - if (strlen($device_vendor) == 0) { echo ""; } + if (strtolower($device_vendor) == "polycom" || strlen($device_vendor) == 0 || strlen($device_username) > 0) { + if (strlen($device_vendor) == 0 || strlen($device_username) > 0) { echo ""; } ?> @@ -891,8 +897,8 @@ require_once "resources/require.php"; "; } } - if (strtolower($device_vendor) == "snom" || strlen($device_vendor) == 0) { - if (strlen($device_vendor) == 0) { echo ""; } + if (strtolower($device_vendor) == "snom" || strlen($device_vendor) == 0 || strlen($device_username) > 0) { + if (strlen($device_vendor) == 0 || strlen($device_username) > 0) { echo ""; } ?> @@ -919,8 +925,8 @@ require_once "resources/require.php"; "; } } - if (strtolower($device_vendor) == "yealink" || strlen($device_vendor) == 0) { - if (strlen($device_vendor) == 0) { echo ""; } + if (strtolower($device_vendor) == "yealink" || strlen($device_vendor) == 0 || strlen($device_username) > 0) { + if (strlen($device_vendor) == 0 || strlen($device_username) > 0) { echo ""; } ?> diff --git a/app/devices/device_profile_edit.php b/app/devices/device_profile_edit.php index dc4582ca43..98f400c46a 100644 --- a/app/devices/device_profile_edit.php +++ b/app/devices/device_profile_edit.php @@ -371,12 +371,18 @@ require_once "resources/require.php"; echo " \n"; echo "\n"; - echo "\n"; + echo "\n"; + if (strlen($row['device_key_vendor']) > 0) { + $device_key_vendor = $row['device_key_vendor']; + } + else { + $device_key_vendor = $device_vendor; + } ?> - + - db->prepare(check_sql($sql)); $prep_statement->execute();