Fix Fill Phone status column
Add db query to include mac to allow join with ami active device data Change output fields
This commit is contained in:
parent
65f3a6cd37
commit
97c1395eb1
|
@ -47,12 +47,19 @@ 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 == '') {
|
||||
return false;
|
||||
}
|
||||
switch ($dataid) {
|
||||
case 'sccp':
|
||||
// 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');
|
||||
break;
|
||||
case 'SccpExtension':
|
||||
if (empty($data['name'])) {
|
||||
$stmts = $this->db->prepare('SELECT * FROM sccpline ORDER BY name');
|
||||
|
|
|
@ -290,11 +290,28 @@ trait ajaxHelper {
|
|||
return $result;
|
||||
break;
|
||||
case 'getExtensionGrid':
|
||||
$result = $this->dbinterface->getSccpDeviceTableData('SccpExtension');
|
||||
if (empty($result)) {
|
||||
$lineList = $this->dbinterface->getSccpDeviceTableData($request['type']);
|
||||
if (empty($lineList)) {
|
||||
return array();
|
||||
}
|
||||
return $result;
|
||||
dbug($lineList);
|
||||
$activeDevices = $this->aminterface->sccp_get_active_device();
|
||||
dbug($activeDevices);
|
||||
if (!empty($activeDevices)) {
|
||||
foreach ($lineList as $key => $lineArr) {
|
||||
if (isset($activeDevices[$lineArr['mac']])) {
|
||||
$tpm_info = $activeDevices[$lineArr['mac']];
|
||||
if (!empty($tpm_info)) {
|
||||
$lineList[$key]['line_status'] = $tpm_info['status'];
|
||||
$lineList[$key]['line_status'] .= " | {$tpm_info['act']}";
|
||||
} else {
|
||||
$lineList[$key]['line_status'] = '';
|
||||
$lineList[$key]['line_status'] .= '|';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $lineList;
|
||||
break;
|
||||
case 'getPhoneGrid':
|
||||
$dbDevices = array();
|
||||
|
|
|
@ -26,7 +26,7 @@ if (!empty($this->sccpvalues['system_rouminguser'])) {
|
|||
<!-- <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="line_statustext"><?php echo _('Status') ?></th>
|
||||
<th data-sortable="true" data-field="line_status"><?php echo _('Status | Active') ?></th>
|
||||
<th data-field="actions" data-formatter="DispayPhoneActionsKeyFormatter"><?php echo _('Actions') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
Loading…
Reference in a new issue