Get TZ Offset from timezone

Remove unnecessary methods
This commit is contained in:
steve-lad 2021-06-13 13:12:37 +02:00
parent bbd811e578
commit 3fee812cc6
2 changed files with 9 additions and 22 deletions

View file

@ -762,9 +762,9 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
case 'sccp_ntp_timezone':
$tz_id = $value;
$TZdata = $this->extconfigs->getextConfig('sccp_timezone_offset', $tz_id);
$TZdata = $this->extconfigs->getextConfig('sccp_timezone', $tz_id);
if (!empty($TZdata)) {
$value = ($TZdata / 60);
$value = $TZdata['offset']/60;
if (!($this->sccpvalues['tzoffset']['data'] == $value)) {
$save_settings[] = array('keyword' => 'tzoffset', 'data' => $value,
'seq' => '98',
@ -774,7 +774,6 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
break;
}
}
if (!empty($save_settings)) {
$this->saveSccpSettings($save_settings);
$this->sccpvalues = $this->dbinterface->get_db_SccpSetting();

View file

@ -30,20 +30,6 @@ class extconfigs
break;
case 'sccpDefaults':
$result = $this->sccpDefaults;
break;
case 'sccp_timezone_offset': // Sccp manafer: 1400 (+ Id) :2007 (+ Id)
if (empty($index)) {
return 0;
}
if (array_key_exists($index, $this->cisco_timezone)) {
$tmp_time = $this->get_cisco_time_zone($index);
return $tmp_time['offset'];
}
$tmp_dt = new \DateTime(null, new \DateTimeZone($index));
$tmp_ofset = $tmp_dt->getOffset();
return $tmp_ofset / 60;
break;
case 'sccp_timezone': // Sccp manager: 1303; server_info: 122
$result = array();
@ -69,15 +55,18 @@ class extconfigs
// Now look for a match in cisco_tz_array based on offset and DST
// First correct offset if we have DST now as cisco offsets are
// based on non dst offsets
$tmp_ofset = $thisTzOffset / 60;
$tmpOffset = $thisTzOffset / 60;
if ($haveDstNow) {
$tmp_ofset = $tmp_ofset - 60;
$tmpOffset = $tmpOffset - 60;
}
foreach ($this->cisco_timezone as $key => $value) {
if (($value['offset'] == $tmp_ofset) and ( $value['daylight'] == $usesDaylight )) {
if (($value['offset'] == $tmpOffset) and ( $value['daylight'] == $usesDaylight )) {
// This code may not be the one typically used, but it has the correct values.
$cisco_code = $key . ' Standard' . (($usesDaylight) ? '/Daylight' : '') . ' Time';
return array('offset' => $tmp_ofset, 'daylight' => ($usesDaylight) ? 'Daylight' : '', 'cisco_code' => $cisco_code);
$this->sccpvalues['tzoffset']['data'] = $tmpOffset;
return array('offset' => $tmpOffset, 'daylight' => ($usesDaylight) ? 'Daylight' : '', 'cisco_code' => $cisco_code);
break;
}
}
@ -357,7 +346,6 @@ class extconfigs
}
}
$dst = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/core/functions.inc/drivers/Sccp.class.php';
if (!file_exists($dst) || $sccp_driver_replace == 'yes') {
$src_path = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/conf/' . basename($dst) . '.v' . $db_vars['sccp_compatible']['data'];