mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
Add device key vendor to assign a key to a vendor.
This commit is contained in:
@@ -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.';
|
||||
|
||||
@@ -24,14 +24,31 @@
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
//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);
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -835,17 +835,23 @@ require_once "resources/require.php";
|
||||
echo " </select>\n";
|
||||
echo "</td>\n";
|
||||
|
||||
echo "<td align='left'>\n";
|
||||
echo "<td align='left' nowrap='nowrap'>\n";
|
||||
//echo " <input class='formfld' type='text' name='device_keys[".$x."][device_key_type]' style='width: 120px;' maxlength='255' value=\"$row['device_key_type']\">\n";
|
||||
if (strlen($row['device_key_vendor']) > 0) {
|
||||
$device_key_vendor = $row['device_key_vendor'];
|
||||
}
|
||||
else {
|
||||
$device_key_vendor = $device_vendor;
|
||||
}
|
||||
?>
|
||||
|
||||
<input class='formfld' type='hidden' id='key_vendor_<?php echo $x; ?>' name='device_keys[<?php echo $x; ?>][device_key_vendor]' value="<?php echo $device_key_vendor; ?>">
|
||||
<?php $selected = "selected='selected'"; ?>
|
||||
<?php $found = false; ?>
|
||||
<select class='formfld' name='device_keys[<?php echo $x; ?>][device_key_type]'>
|
||||
<select class='formfld' name='device_keys[<?php echo $x; ?>][device_key_type]' id='key_type_<?php echo $x; ?>' onchange="document.getElementById('key_vendor_<?php echo $x; ?>').value=document.getElementById('key_type_<?php echo $x; ?>').options[document.getElementById('key_type_<?php echo $x; ?>').selectedIndex].parentNode.label.toLowerCase();" >
|
||||
<option value=''></option>
|
||||
<?php
|
||||
if (strtolower($device_vendor) == "aastra" || strlen($device_vendor) == 0) {
|
||||
if (strlen($device_vendor) == 0) { echo "<optgroup label='Aastra'>"; }
|
||||
if (strtolower($device_vendor) == "aastra" || strlen($device_vendor) == 0 || strlen($device_username) > 0) {
|
||||
if (strlen($device_vendor) == 0 || strlen($device_username) > 0) { echo "<optgroup label='Aastra'>"; }
|
||||
?>
|
||||
<option value='blf' <?php if ($row['device_key_type'] == "blf") { echo $selected;$found=true; } ?>><?php echo $text['label-blf'] ?></option>
|
||||
<option value='blfxfer' <?php if ($row['device_key_type'] == "blfxfer") { echo $selected;$found=true; } ?>><?php echo $text['label-blf_xfer'] ?></option>
|
||||
@@ -854,16 +860,16 @@ require_once "resources/require.php";
|
||||
<?php
|
||||
if (strlen($device_vendor) == 0) { echo "</optgroup>"; }
|
||||
}
|
||||
if (strtolower($device_vendor) == "cisco" || strlen($device_vendor) == 0) {
|
||||
if (strlen($device_vendor) == 0) { echo "<optgroup label='Cisco'>"; }
|
||||
if (strtolower($device_vendor) == "cisco" || strlen($device_vendor) == 0 || strlen($device_username) > 0) {
|
||||
if (strlen($device_vendor) == 0 || strlen($device_username) > 0) { echo "<optgroup label='Cisco'>"; }
|
||||
?>
|
||||
<option value='line' <?php if ($row['device_key_type'] == "line") { echo $selected;$found=true; } ?>><?php echo $text['label-line'] ?></option>
|
||||
<option value='disabled' <?php if ($row['device_key_type'] == "disabled") { echo $selected;$found=true; } ?>><?php echo $text['label-disabled'] ?></option>
|
||||
<?php
|
||||
if (strlen($device_vendor) == 0) { echo "</optgroup>"; }
|
||||
}
|
||||
if (strtolower($device_vendor) == "grandstream" || strlen($device_vendor) == 0) {
|
||||
if (strlen($device_vendor) == 0) { echo "<optgroup label='Grandstream'>"; }
|
||||
if (strtolower($device_vendor) == "grandstream" || strlen($device_vendor) == 0 || strlen($device_username) > 0) {
|
||||
if (strlen($device_vendor) == 0 || strlen($device_username) > 0) { echo "<optgroup label='Grandstream'>"; }
|
||||
?>
|
||||
<option value='line' <?php if ($row['device_key_type'] == "line") { echo $selected;$found=true; } ?>><?php echo $text['label-line'] ?></option>
|
||||
<option value='shared line' <?php if ($row['device_key_type'] == "shared line") { echo $selected;$found=true; } ?>><?php echo $text['label-shared_line'] ?></option>
|
||||
@@ -882,8 +888,8 @@ require_once "resources/require.php";
|
||||
<?php
|
||||
if (strlen($device_vendor) == 0) { echo "</optgroup>"; }
|
||||
}
|
||||
if (strtolower($device_vendor) == "polycom" || strlen($device_vendor) == 0) {
|
||||
if (strlen($device_vendor) == 0) { echo "<optgroup label='Polycom'>"; }
|
||||
if (strtolower($device_vendor) == "polycom" || strlen($device_vendor) == 0 || strlen($device_username) > 0) {
|
||||
if (strlen($device_vendor) == 0 || strlen($device_username) > 0) { echo "<optgroup label='Polycom'>"; }
|
||||
?>
|
||||
<option value='line' <?php if ($row['device_key_type'] == "line") { echo $selected;$found=true; } ?>><?php echo $text['label-line'] ?></option>
|
||||
<option value='automata' <?php if ($row['device_key_type'] == "automata") { echo $selected;$found=true; } ?>><?php echo $text['label-automata'] ?></option>
|
||||
@@ -891,8 +897,8 @@ require_once "resources/require.php";
|
||||
<?php
|
||||
if (strlen($device_vendor) == 0) { echo "</optgroup>"; }
|
||||
}
|
||||
if (strtolower($device_vendor) == "snom" || strlen($device_vendor) == 0) {
|
||||
if (strlen($device_vendor) == 0) { echo "<optgroup label='Snom'>"; }
|
||||
if (strtolower($device_vendor) == "snom" || strlen($device_vendor) == 0 || strlen($device_username) > 0) {
|
||||
if (strlen($device_vendor) == 0 || strlen($device_username) > 0) { echo "<optgroup label='Snom'>"; }
|
||||
?>
|
||||
<option value='none' <?php if ($row['device_key_type'] == "none") { echo $selected;$found=true; } ?>><?php echo $text['label-none'] ?></option>
|
||||
<option value='url' <?php if ($row['device_key_type'] == "url") { echo $selected;$found=true; } ?>><?php echo $text['label-action_url'] ?></option>
|
||||
@@ -919,8 +925,8 @@ require_once "resources/require.php";
|
||||
<?php
|
||||
if (strlen($device_vendor) == 0) { echo "</optgroup>"; }
|
||||
}
|
||||
if (strtolower($device_vendor) == "yealink" || strlen($device_vendor) == 0) {
|
||||
if (strlen($device_vendor) == 0) { echo "<optgroup label='Yealink'>"; }
|
||||
if (strtolower($device_vendor) == "yealink" || strlen($device_vendor) == 0 || strlen($device_username) > 0) {
|
||||
if (strlen($device_vendor) == 0 || strlen($device_username) > 0) { echo "<optgroup label='Yealink'>"; }
|
||||
?>
|
||||
<option value='0' <?php if ($row['device_key_type'] == "0") { echo $selected;$found=true; } ?>><?php echo $text['label-na'] ?></option>
|
||||
<option value='15' <?php if ($row['device_key_type'] == "15") { echo $selected;$found=true; } ?>><?php echo $text['label-line'] ?></option>
|
||||
|
||||
@@ -371,12 +371,18 @@ require_once "resources/require.php";
|
||||
echo " </select>\n";
|
||||
echo "</td>\n";
|
||||
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo "<td class='vtable' align='left' nowrap='nowrap'>\n";
|
||||
if (strlen($row['device_key_vendor']) > 0) {
|
||||
$device_key_vendor = $row['device_key_vendor'];
|
||||
}
|
||||
else {
|
||||
$device_key_vendor = $device_vendor;
|
||||
}
|
||||
?>
|
||||
|
||||
<input class='formfld' type='hidden' id='key_vendor_<?php echo $x; ?>' name='device_keys[<?php echo $x; ?>][device_key_vendor]' value="<?php echo $device_key_vendor; ?>">
|
||||
<?php $selected = "selected='selected'"; ?>
|
||||
<?php $found = false; ?>
|
||||
<select class='formfld' style='width:80px;' name='device_keys[<?php echo $x; ?>][device_key_type]'>
|
||||
<select class='formfld' style='width:80px;' name='device_keys[<?php echo $x; ?>][device_key_type]' id='key_type_<?php echo $x; ?>' onchange="document.getElementById('key_vendor_<?php echo $x; ?>').value=document.getElementById('key_type_<?php echo $x; ?>').options[document.getElementById('key_type_<?php echo $x; ?>').selectedIndex].parentNode.label.toLowerCase();">
|
||||
<option value=''></option>
|
||||
<?php
|
||||
if (strtolower($device_vendor) == "aastra" || strlen($device_vendor) == 0) {
|
||||
|
||||
@@ -466,7 +466,7 @@ include "root.php";
|
||||
$sql .= "or device_profile_uuid = '".$device_profile_uuid."' ";
|
||||
}
|
||||
$sql .= ") ";
|
||||
//$sql .= "AND domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "AND (device_key_vendor = '".$device_vendor."' or device_key_vendor is null) ";
|
||||
$sql .= "ORDER BY device_key_category asc, device_key_id asc, device_uuid desc";
|
||||
$prep_statement = $this->db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
|
||||
Reference in New Issue
Block a user