diff --git a/sccpManClasses/Sccp.class.php.v433 b/sccpManClasses/Sccp.class.php.v433 index 89ccb3a..1ebd4b3 100644 --- a/sccpManClasses/Sccp.class.php.v433 +++ b/sccpManClasses/Sccp.class.php.v433 @@ -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. diff --git a/sccpManClasses/dbinterface.class.php b/sccpManClasses/dbinterface.class.php index b8b5077..8664091 100644 --- a/sccpManClasses/dbinterface.class.php +++ b/sccpManClasses/dbinterface.class.php @@ -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'])) { diff --git a/sccpManTraits/ajaxHelper.php b/sccpManTraits/ajaxHelper.php index 938314d..598503e 100644 --- a/sccpManTraits/ajaxHelper.php +++ b/sccpManTraits/ajaxHelper.php @@ -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']])) { diff --git a/views/hardware.extension.php b/views/hardware.extension.php index 2f3b1ea..c261ccb 100644 --- a/views/hardware.extension.php +++ b/views/hardware.extension.php @@ -23,9 +23,9 @@ if (!empty($this->sccpvalues['system_rouminguser'])) { - +