Fix issue #47 - Defaults toggling with repeated saves
Remove unused group from server.settings.php Correct testing for use of system defaults Correct application of system defaults ToDo:Numeric values are not being saved, or do not revert to defaults when button clicked
This commit is contained in:
parent
03206f8384
commit
c473c62ada
|
@ -1148,7 +1148,6 @@ function cleanUpSccpSettings() {
|
||||||
unset($settingsFromDb[$key]);
|
unset($settingsFromDb[$key]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dbug($sysConfiguration);
|
|
||||||
$sysConfiguration[$key]['DefaultValue'] = ($sysConfiguration[$key]['DefaultValue'] == '(null)') ? '' : $sysConfiguration[$key]['DefaultValue'];
|
$sysConfiguration[$key]['DefaultValue'] = ($sysConfiguration[$key]['DefaultValue'] == '(null)') ? '' : $sysConfiguration[$key]['DefaultValue'];
|
||||||
if (array_key_exists($key,$settingsFromDb)) {
|
if (array_key_exists($key,$settingsFromDb)) {
|
||||||
// Preserve sequence and type
|
// Preserve sequence and type
|
||||||
|
@ -1157,7 +1156,6 @@ function cleanUpSccpSettings() {
|
||||||
$settingsFromDb[$key] = array('keyword' => $key, 'seq' => 0, 'type' => 0, 'data' => '', 'systemdefault' => $sysConfiguration[$key]['DefaultValue']);
|
$settingsFromDb[$key] = array('keyword' => $key, 'seq' => 0, 'type' => 0, 'data' => '', 'systemdefault' => $sysConfiguration[$key]['DefaultValue']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dbug($settingsFromDb);
|
|
||||||
// Override certain chan-sccp defaults as they are based on a non-FreePbx system
|
// Override certain chan-sccp defaults as they are based on a non-FreePbx system
|
||||||
$settingsFromDb['context']['systemdefault'] = 'from-internal';
|
$settingsFromDb['context']['systemdefault'] = 'from-internal';
|
||||||
$settingsFromDb['directed_pickup']['systemdefault'] = 'no';
|
$settingsFromDb['directed_pickup']['systemdefault'] = 'no';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<module>
|
<module>
|
||||||
<rawname>sccp_manager</rawname>
|
<rawname>sccp_manager</rawname>
|
||||||
<name>SCCP Manager</name>
|
<name>SCCP Manager</name>
|
||||||
<version>14.3.0.19</version>
|
<version>14.3.0.21</version>
|
||||||
<type>setup</type>
|
<type>setup</type>
|
||||||
<category>SCCP Connectivity</category>
|
<category>SCCP Connectivity</category>
|
||||||
<publisher>Steve Lad, Alex GP</publisher>
|
<publisher>Steve Lad, Alex GP</publisher>
|
||||||
|
|
|
@ -218,7 +218,6 @@ class Sccp extends \FreePBX\modules\Core\Driver {
|
||||||
public function getDefaultDeviceSettings($id, $displayname, &$flag) {
|
public function getDefaultDeviceSettings($id, $displayname, &$flag) {
|
||||||
// FreePBX required method
|
// FreePBX required method
|
||||||
$settings = array();
|
$settings = array();
|
||||||
dbug($this->line_defaults);
|
|
||||||
$settingsFields = array('mailbox', 'incominglimit', 'context', 'directed_pickup_context', 'callgroup', 'pickupgroup', 'namedcallgroup',
|
$settingsFields = array('mailbox', 'incominglimit', 'context', 'directed_pickup_context', 'callgroup', 'pickupgroup', 'namedcallgroup',
|
||||||
'namedpickupgroup', 'adhocNumber', 'secondary_dialtone_digits', 'secondary_dialtone_tone', 'directed_pickup', 'pickup_modeanswer',
|
'namedpickupgroup', 'adhocNumber', 'secondary_dialtone_digits', 'secondary_dialtone_tone', 'directed_pickup', 'pickup_modeanswer',
|
||||||
'transfer', 'echocancel', 'dnd', 'silencesuppression', 'musicclass', 'pin', 'allow', 'disallow');
|
'transfer', 'echocancel', 'dnd', 'silencesuppression', 'musicclass', 'pin', 'allow', 'disallow');
|
||||||
|
|
|
@ -45,11 +45,10 @@ class formcreate
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
if (!empty($sccp_defaults[$shortId]['systemdefault'])) {
|
if (!empty($sccp_defaults[$shortId]['systemdefault'])) {
|
||||||
// There is a system default, so add button to customise or reset
|
// There is a system default, so add button to customise or reset
|
||||||
// the closing } is after the code to include the button at line ~498
|
//-- Start include of defaults button --
|
||||||
|
echo "<div class=col-md-3>";
|
||||||
//-- Start include of defaults button --
|
}
|
||||||
echo "<div class=col-md-3>";
|
|
||||||
|
|
||||||
// Can have multiple inputs for a field which are displayed with a separator
|
// Can have multiple inputs for a field which are displayed with a separator
|
||||||
foreach ($child->xpath('input') as $value) {
|
foreach ($child->xpath('input') as $value) {
|
||||||
|
@ -57,16 +56,11 @@ class formcreate
|
||||||
$res_name = $npref . $res_n;
|
$res_name = $npref . $res_n;
|
||||||
//if (!empty($fvalues[$res_n])) {
|
//if (!empty($fvalues[$res_n])) {
|
||||||
$value->value = $fvalues[$res_n]['data'];
|
$value->value = $fvalues[$res_n]['data'];
|
||||||
if (!empty($fvalues[$res_n]['data'])) {
|
if (!empty($fvalues[$res_n]['data'])) {
|
||||||
if (!empty($sccp_defaults[$res_n]['systemdefault']) && ($sccp_defaults[$res_n]['systemdefault'] != $fvalues[$res_n]['data'])) {
|
if ($sccp_defaults[$res_n]['systemdefault'] != $fvalues[$res_n]['data']) {
|
||||||
$usingSysDefaults = false;
|
$usingSysDefaults = false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//}
|
}
|
||||||
// Default to chan-sccp defaults, not xml defaults.
|
|
||||||
//if (empty($value->value)) {
|
|
||||||
//$value->value = $sccp_defaults[$res_n]['systemdefault'];
|
|
||||||
//}
|
|
||||||
if (empty($value->type)) {
|
if (empty($value->type)) {
|
||||||
$value->type = 'text';
|
$value->type = 'text';
|
||||||
}
|
}
|
||||||
|
@ -83,6 +77,8 @@ class formcreate
|
||||||
echo $value->value;
|
echo $value->value;
|
||||||
$i ++;
|
$i ++;
|
||||||
}
|
}
|
||||||
|
if (!empty($sccp_defaults[$shortId]['systemdefault'])) {
|
||||||
|
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
|
@ -123,8 +119,8 @@ class formcreate
|
||||||
|
|
||||||
<!-- Finish include of defaults button -->
|
<!-- Finish include of defaults button -->
|
||||||
<?php
|
<?php
|
||||||
// Close the conditional include of the defaults button opened at line ~425
|
// Close the conditional include of the defaults button opened at line ~47
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
|
@ -146,7 +142,8 @@ class formcreate
|
||||||
if (empty($value->value)) {
|
if (empty($value->value)) {
|
||||||
$value->value = $sccp_defaults[$res_n]['systemdefault'];
|
$value->value = $sccp_defaults[$res_n]['systemdefault'];
|
||||||
}
|
}
|
||||||
if (!$usingSysDefaults) {
|
if ($usingSysDefaults) {
|
||||||
|
// using system defaults
|
||||||
$value->value = $sccp_defaults[$res_n]['systemdefault'];
|
$value->value = $sccp_defaults[$res_n]['systemdefault'];
|
||||||
}
|
}
|
||||||
if (empty($value->type)) {
|
if (empty($value->type)) {
|
||||||
|
@ -373,17 +370,15 @@ class formcreate
|
||||||
$res_v = (string)$fvalues[$res_n]['data'];
|
$res_v = (string)$fvalues[$res_n]['data'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($sccp_defaults[$res_n]['systemdefault'] != $res_v) {
|
||||||
|
$usingSysDefaults = false;
|
||||||
|
}
|
||||||
if (!empty($sccp_defaults[$res_n]['systemdefault'])) {
|
if (!empty($sccp_defaults[$res_n]['systemdefault'])) {
|
||||||
// There is a system default, so add button to customise or reset
|
// There is a system default, so add button to customise or reset
|
||||||
// the closing } is after the code to include the button at line ~498
|
// the closing } is after the code to include the button at line ~438
|
||||||
|
|
||||||
//-- Start include of defaults button --
|
//-- Start include of defaults button --
|
||||||
echo "<div class='col-md-3'>";
|
echo "<div class='col-md-3'>";
|
||||||
|
|
||||||
if (!empty($sccp_defaults[$res_n]['systemdefault']) && ($sccp_defaults[$res_n]['systemdefault'] != $res_v)) {
|
|
||||||
$usingSysDefaults = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Output current value
|
// Output current value
|
||||||
echo $res_v;
|
echo $res_v;
|
||||||
?>
|
?>
|
||||||
|
@ -427,7 +422,7 @@ class formcreate
|
||||||
</div>
|
</div>
|
||||||
<!-- Finish include of defaults button -->
|
<!-- Finish include of defaults button -->
|
||||||
<?php
|
<?php
|
||||||
// Close the conditional include of the defaults button opened at line ~425
|
// Close the conditional include of the defaults button opened at line ~385
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
@ -437,7 +432,7 @@ class formcreate
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$opt_hide = '';
|
$opt_hide = '';
|
||||||
|
|
||||||
if (!$usingSysDefaults) {
|
if ($usingSysDefaults) {
|
||||||
$res_v = $sccp_defaults[$res_n]['systemdefault'];
|
$res_v = $sccp_defaults[$res_n]['systemdefault'];
|
||||||
}
|
}
|
||||||
if (!empty($child->option_hide)) {
|
if (!empty($child->option_hide)) {
|
||||||
|
@ -449,8 +444,6 @@ class formcreate
|
||||||
}
|
}
|
||||||
$opt_hide .= ' data-vshow="'.$child->option_show.'" data-clshow="'.$child->option_show['class'].'" ';
|
$opt_hide .= ' data-vshow="'.$child->option_show.'" data-clshow="'.$child->option_show['class'].'" ';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
foreach ($child->xpath('button') as $value) {
|
foreach ($child->xpath('button') as $value) {
|
||||||
$opt_disabled = '';
|
$opt_disabled = '';
|
||||||
if (in_array($value, $disabledButtons )) {
|
if (in_array($value, $disabledButtons )) {
|
||||||
|
@ -458,11 +451,11 @@ class formcreate
|
||||||
}
|
}
|
||||||
$val_check = strtolower((string)$value[@value]);
|
$val_check = strtolower((string)$value[@value]);
|
||||||
if ($val_check == strtolower($res_v)) {
|
if ($val_check == strtolower($res_v)) {
|
||||||
$val_check = " checked";
|
$val_check = "checked";
|
||||||
} else {
|
} else {
|
||||||
if ($val_check == '' || $val_check == 'none' ) {
|
if ($val_check == '' || $val_check == 'none' ) {
|
||||||
if (strtolower($res_v) == 'none' || $res_v == '' ) {
|
if (strtolower($res_v) == 'none' || $res_v == '' ) {
|
||||||
$val_check = " checked";
|
$val_check = "checked";
|
||||||
} else {$val_check = "";}
|
} else {$val_check = "";}
|
||||||
} else {$val_check = "";}
|
} else {$val_check = "";}
|
||||||
}
|
}
|
||||||
|
|
|
@ -505,7 +505,6 @@ trait ajaxHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$extSettings = $this->extconfigs->updateTftpStructure(array_merge($this->sccpvalues, $save_settings));
|
$extSettings = $this->extconfigs->updateTftpStructure(array_merge($this->sccpvalues, $save_settings));
|
||||||
$save_settings = array_merge($save_settings, $extSettings);
|
$save_settings = array_merge($save_settings, $extSettings);
|
||||||
if (!empty($save_settings)) {
|
if (!empty($save_settings)) {
|
||||||
|
|
|
@ -48,7 +48,6 @@ if ($h_show==1) {
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($items as $child) {
|
foreach ($items as $child) {
|
||||||
$disabledButtons = array();
|
$disabledButtons = array();
|
||||||
if (empty($child->help)) {
|
if (empty($child->help)) {
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
$def_val_device = $this->getTableDefaults('sccpdevice');
|
$def_val_device = $this->getTableDefaults('sccpdevice');
|
||||||
|
|
||||||
echo $this->showGroup('sccp_general', 1);
|
echo $this->showGroup('sccp_general', 1);
|
||||||
echo $this->showGroup('sccp_dev_time_s', 1);
|
|
||||||
echo $this->showGroup('sccp_net', 1);
|
echo $this->showGroup('sccp_net', 1);
|
||||||
echo $this->showGroup('sccp_lang', 1);
|
echo $this->showGroup('sccp_lang', 1);
|
||||||
echo $this->showGroup('sccp_extpath_config', 1);
|
echo $this->showGroup('sccp_extpath_config', 1);
|
||||||
|
|
Loading…
Reference in a new issue