Bug fixes

Correct SQL statement
Correct Message Handler
Correct Message interpreter
This commit is contained in:
steve-lad 2021-03-17 09:48:20 +01:00 committed by Diederik de Groot
parent e1c6a1d39b
commit 31ac0746ba
No known key found for this signature in database
GPG key ID: AFA728250A1BECD6
7 changed files with 14 additions and 9 deletions

View file

@ -747,7 +747,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
$this->srvinterface->sccpDeviceReset($idv);
}
}
return array('status' => true, 'table_reload' => true, 'message' => 'HW is Delete ! ');
return array('status' => true, 'table_reload' => true, 'message' => 'Hardware device has been deleted! ');
}
break;
case 'create_hw_tftp':

View file

@ -402,7 +402,7 @@ class SCCPDeviceRestartAction extends ActionMessage
public function __construct($DeviceName, $Type = "restart")
{
parent::__construct('SCCPDeviceRestart');
$this->setResponseHandler("SCCPGeneric");
$this->setResponseHandler("Generic");
if (empty($Type)) {
$Type = "restart";
}

View file

@ -19,8 +19,10 @@ abstract class Response extends IncomingMessage
public function __construct($rawContent)
{
parent::__construct($rawContent);
$this->_events = array();
// this logic is false - even if we have an error, we will not get anymore data, so is completed.
$this->_completed = $this->isSuccess();
}
@ -98,9 +100,13 @@ class Generic_Response extends Response
{
public function __construct($rawContent)
{
// Only used for self contained responses.
parent::__construct($rawContent);
// add dummy closing event
$this->_events['ClosingEvent'] = new ResponseComplete_Event($rawContent);
$this->_completed = true;
$this->eventListIsCompleted = true;
}
}
@ -250,7 +256,7 @@ class SCCPGeneric_Response extends Response
if (empty($_rawtable)) { return $result;}
foreach ($_rawtable as $_row) {
$all_key_ok = true;
// No need to test if $_fkey is arrray as array required
// No need to test if $_fkey is array as array required
foreach ($_fkey as $_fid) {
if (empty($_row[$_fid])) {
$all_key_ok = false;

View file

@ -387,10 +387,7 @@ class aminterface
$result = array();
if ($this->_connect_state) {
$_action = new \FreePBX\modules\Sccp_manager\aminterface\SCCPShowDevicesAction();
$_res = $this->send($_action)->getResult();
foreach ($_res as $key => $value) {
$result[$key]['name'] = $key;
}
$result = $this->send($_action)->getResult();
}
return $result;
}

View file

@ -308,7 +308,7 @@ class dbinterface
$stmt = $dbh->prepare('UPDATE ' . $table_name . ' SET ' . $sql_var . ' WHERE ' . $sql_key);
break;
case 'replace':
$stmt = $dbh->prepare('REPLACE INTO ' . $table_name . ' VALUES ' . $sql_var);
$stmt = $dbh->prepare('REPLACE INTO ' . $table_name . ' SET ' . $sql_var);
break;
// no default mode - must be explicit.
}

View file

@ -413,7 +413,7 @@ class extconfigs
return $base_config;
}
// Type declaration in below function is incompatible with PHP 5
public function validate_RealTime( string $connector )
{
// This method only checks that asterisk is correctly configured for Realtime

View file

@ -86,6 +86,8 @@ if (empty($ast_realtime)) {
}
$info['RealTime'] = array('Version' => $rt_sccp, 'about' => $rt_info);
}
// There are potential issues with string Type Declarations in PHP 5.
$info['PHP'] = array('Version' => phpversion(), 'about' => version_compare(phpversion(), '7.0.0', '>' ) ? 'OK' : 'PHP 7 Preferred - Please upgrade if possible');
if (empty($conf_realtime)) {
$info['ConfigsRealTime'] = array('Version' => 'Error', 'about' => '<div class="alert signature alert-danger"> Realtime configuration was not found</div>');