Database request modifications and page improvements
Add device to extensions page - permits to see unassigned lines and shared lines easily Reformat status to centred change 'replace' in sccp class to only 'insert on duplicate key' (UPSET equivalent) Change request in phoneGrid to left join to show all lines, even unassigned to a device
This commit is contained in:
parent
a4aa4eb03b
commit
3475efc2c6
|
@ -155,25 +155,16 @@ class Sccp extends \FreePBX\modules\Core\Driver {
|
|||
}
|
||||
}
|
||||
|
||||
$sqlCol = 'name';
|
||||
$sqlVal = "'{$id}'";
|
||||
// only store values that have been set; if need to display a default, must show in page.
|
||||
$sqlSet = "name='{$id}'";
|
||||
foreach($this->data_fld as $key => $val) {
|
||||
if (isset($settings[$val]['value'])){
|
||||
$sqlCol .= ", {$key}";
|
||||
$sqlVal .= ", '{$settings[$val]['value']}'";
|
||||
} else {
|
||||
if (array_key_exists($key, $this->line_defaults)) {
|
||||
$sqlCol .= ", {$key}";
|
||||
if (!empty($this->line_defaults[$key])) {
|
||||
$sqlVal .= ", '{$this->line_defaults[$key]}'";
|
||||
} else {
|
||||
$sqlVal .= NULL;
|
||||
if (!empty($settings[$val]['value'])) {
|
||||
$sqlSet .= ", {$key}='{$settings[$val]['value']}'";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$sql = "REPLACE INTO sccpline ( {$sqlCol} ) VALUES ( {$sqlVal} )";
|
||||
$sth = $this->database->prepare($sql);
|
||||
|
||||
$stmt = "INSERT INTO sccpline SET {$sqlSet} ON DUPLICATE KEY UPDATE {$sqlSet}";
|
||||
$sth = $this->database->prepare($stmt);
|
||||
$sth->execute();
|
||||
/*
|
||||
If called from SCCP Phone, redirect to SCCP Phone page on submit.
|
||||
|
|
|
@ -47,8 +47,6 @@ class dbinterface
|
|||
public function getSccpDeviceTableData($dataid, $data = array())
|
||||
{
|
||||
// $stmt is a single row fetch, $stmts is a fetchAll.
|
||||
dbug($dataid);
|
||||
dbug($data);
|
||||
$stmt = '';
|
||||
$stmts = '';
|
||||
if ($dataid == '') {
|
||||
|
@ -58,7 +56,7 @@ class dbinterface
|
|||
case 'extGrid':
|
||||
// only called by getExtensionGrid from hardware.extension.php view
|
||||
$stmts = $this->db->prepare('SELECT sccpline.name, sccpline.label, sccpbuttonconfig.ref as mac
|
||||
FROM sccpline INNER JOIN sccpbuttonconfig ON sccpline.name=sccpbuttonconfig.name');
|
||||
FROM sccpline LEFT JOIN sccpbuttonconfig ON sccpline.name=sccpbuttonconfig.name ORDER BY sccpline.name');
|
||||
break;
|
||||
case 'SccpExtension':
|
||||
if (empty($data['name'])) {
|
||||
|
|
|
@ -294,9 +294,7 @@ trait ajaxHelper {
|
|||
if (empty($lineList)) {
|
||||
return array();
|
||||
}
|
||||
dbug($lineList);
|
||||
$activeDevices = $this->aminterface->sccp_get_active_device();
|
||||
dbug($activeDevices);
|
||||
if (!empty($activeDevices)) {
|
||||
foreach ($lineList as $key => $lineArr) {
|
||||
if (isset($activeDevices[$lineArr['mac']])) {
|
||||
|
|
|
@ -23,9 +23,9 @@ if (!empty($this->sccpvalues['system_rouminguser'])) {
|
|||
<table data-cookie="true" data-cookie-id-table="sccp-extension-table" data-url="ajax.php?module=sccp_manager&command=getExtensionGrid&type=extGrid" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-sip" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped ext-list-sccp" id="table-sccp-extension" data-id="name">
|
||||
<thead>
|
||||
<tr>
|
||||
<!-- <th data-checkbox="true"></th> -->
|
||||
<th data-sortable="true" data-field="name"><?php echo _('Extension') ?></th>
|
||||
<th data-sortable="true" data-field="label"><?php echo _('Display Name') ?></th>
|
||||
<th data-sortable="true" data-field="mac"><?php echo _('Device') ?></th>
|
||||
<th data-sortable="true" data-field="line_status" class="text-center"><?php echo _('Status | Active') ?></th>
|
||||
<th data-field="actions" data-formatter="DispayPhoneActionsKeyFormatter"><?php echo _('Actions') ?></th>
|
||||
</tr>
|
||||
|
|
Loading…
Reference in a new issue