Reversions and corrections to previous commit

Restore saveSccpSettings to Sccp_Manager construct (deleted in error)
Initialise ntp_timezone without check (may have been changed externally)
Load xml data in ShowGroup instead of construct.
This commit is contained in:
steve-lad 2021-06-24 10:59:00 +02:00
parent ff1c451fe1
commit e841c7cb40
3 changed files with 15 additions and 8 deletions

View file

@ -143,6 +143,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
$this->initializeSccpPath(); //Set required Paths
$this->updateTimeZone(); // Get timezone from FreePBX
$this->initTftpLang();
$this->saveSccpSettings();
}
/*
@ -153,6 +154,10 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
if (empty($form_values)) {
$form_values = $this->sccpvalues;
}
// load xml data - moved from Construct to simplify Construct
$xml_vars = __DIR__ . '/conf/sccpgeneral.xml.v433';
$this->xml_data = simplexml_load_file($xml_vars);
if ((array) $this->xml_data) {
foreach ($this->xml_data->xpath('//page_group[@name="' . $group_name . '"]') as $item) {
$htmlret = load_view(__DIR__ . '/views/formShow.php', array(
@ -176,9 +181,13 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
*/
public function updateTimeZone() {
// Check timezone has not been changed in FreePBX and update if has
if ($this->sccpvalues['ntp_timezone'] != \date_default_timezone_get()) {
$this->sccpvalues['ntp_timezone'] = array('keyword' => 'ntp_timezone', 'seq'=>95, 'type' => 2, 'data' => \date_default_timezone_get());
// Get latest FreePBX time $timeZoneOffsetList
$freepbxTZ = \date_default_timezone_get();
$this->sccpvalues['ntp_timezone'] = array('keyword' => 'ntp_timezone', 'seq'=>95, 'type' => 2, 'data' => $freepbxTZ);
$TZdata = $this->extconfigs->getExtConfig('sccp_timezone', $freepbxTZ);
if (!empty($TZdata)) {
$value = $TZdata['offset']/60; // TODO: Is this correct (storing in hours not minutes)
$this->sccpvalues['tzoffset'] = array('keyword' => 'tzoffset', 'seq'=>98, 'type' => 2, 'data' => $value);
}
}
@ -932,7 +941,6 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
function getDialPlan($get_file) {
$file = $this->sccppath["tftp_dialplan"] . '/' . $get_file . '.xml';
if (file_exists($file)) {
// $load_xml_data = simplexml_load_file($file);
$fileContents = file_get_contents($file);
$fileContents = str_replace(array("\n", "\r", "\t"), '', $fileContents);

View file

@ -448,7 +448,7 @@ trait ajaxHelper {
'keyword' => $this->sccpvalues[$key]['keyword'],
'data' => $value,
'seq' => $this->sccpvalues[$key]['seq'],
'type' => $this->sccpvalues[$key1]['type']
'type' => $this->sccpvalues[$key]['type']
);
}
}

View file

@ -1,5 +1,4 @@
<div class="element-container"> <div class="row"> <div class="form-group">
<div class="col-md-3"> <label class="control-label" for="ERROR">Error Load form config </label>
<div class="element-container"> <div class="row"> <div class="form-group">
<div class="col-md-3"> <label class="control-label" for="ERROR">Error loadinging form configuration </label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="ERROR"></i>
</div></div></div></div>