WIP Fix formshow prefix logic for IS
Currently only fixed for IS FormShow was adding the prefix to the full child name, making a useless result. Need to remove form_prefix from childname to return to db values
This commit is contained in:
parent
815b7dbd2a
commit
b420f35ad2
|
@ -565,7 +565,6 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveSccpDevice($get_settings, $validateonly = false) {
|
function saveSccpDevice($get_settings, $validateonly = false) {
|
||||||
dbug('Settings', $get_settings);
|
|
||||||
$hdr_prefix = 'sccp_hw_';
|
$hdr_prefix = 'sccp_hw_';
|
||||||
$hdr_arprefix = 'sccp_hw-ar_';
|
$hdr_arprefix = 'sccp_hw-ar_';
|
||||||
$hdr_vendPrefix = 'sccp_hw_vendorconfig';
|
$hdr_vendPrefix = 'sccp_hw_vendorconfig';
|
||||||
|
|
|
@ -24,6 +24,9 @@ if (!empty($_REQUEST['new_id'])) {
|
||||||
if (!empty($_REQUEST['addon'])) {
|
if (!empty($_REQUEST['addon'])) {
|
||||||
$def_val['addon'] = array("keyword" => 'type', "data" => $_REQUEST['addon'], "seq" => "99");
|
$def_val['addon'] = array("keyword" => 'type', "data" => $_REQUEST['addon'], "seq" => "99");
|
||||||
}
|
}
|
||||||
|
// TODO Default values should be used to populate this device
|
||||||
|
// Currently these are read from sccpgeneral.xml
|
||||||
|
// Need to get these from the db as defaults may have changed.
|
||||||
}
|
}
|
||||||
|
|
||||||
// Editing an existing Device
|
// Editing an existing Device
|
||||||
|
@ -31,7 +34,6 @@ if (!empty($_REQUEST['id'])) {
|
||||||
$dev_id = $_REQUEST['id'];
|
$dev_id = $_REQUEST['id'];
|
||||||
$dev_new = $dev_id;
|
$dev_new = $dev_id;
|
||||||
$db_res = $this->dbinterface->HWextension_db_SccpTableData('get_sccpdevice_byid', array("id" => $dev_id));
|
$db_res = $this->dbinterface->HWextension_db_SccpTableData('get_sccpdevice_byid', array("id" => $dev_id));
|
||||||
dbug('db_res', $db_res);
|
|
||||||
foreach ($db_res as $key => $val) {
|
foreach ($db_res as $key => $val) {
|
||||||
if (!empty($val)) {
|
if (!empty($val)) {
|
||||||
switch ($key) {
|
switch ($key) {
|
||||||
|
@ -67,34 +69,11 @@ if (!empty($_REQUEST['id'])) {
|
||||||
// $val = after('/', $val);
|
// $val = after('/', $val);
|
||||||
// break;
|
// break;
|
||||||
}
|
}
|
||||||
$translateFieldArray = array('_logserver' => 'vendorconfig_logserver',
|
|
||||||
'_daysdisplaynotactive' => 'vendorconfig_daysdisplaynotactive',
|
|
||||||
'_displayontime' => 'vendorconfig_displayontime',
|
|
||||||
'_displayonduration' => 'vendorconfig_displayonduration',
|
|
||||||
'_displayidletimeout' => 'vendorconfig_displayidletimeout',
|
|
||||||
'_settingsaccess' => 'vendorconfig_settingsaccess',
|
|
||||||
'_videocapability' => 'vendorconfig_videocapability',
|
|
||||||
'_webaccess' => 'vendorconfig_webaccess',
|
|
||||||
'_webadmin' => 'vendorconfig_webadmin',
|
|
||||||
'_pcport' => 'vendorconfig_pcport',
|
|
||||||
'_spantopcport' => 'vendorconfig_spantopcport',
|
|
||||||
'_voicevlanaccess' => 'vendorconfig_voicevlanaccess',
|
|
||||||
'_enablecdpswport' => 'vendorconfig_enablecdpswport',
|
|
||||||
'_enablecdppcport' => 'vendorconfig_enablecdppcport',
|
|
||||||
'_enablelldpswport' => 'vendorconfig_enablelldpswport',
|
|
||||||
'_enablelldppcport' => 'vendorconfig_enablelldppcport'
|
|
||||||
);
|
|
||||||
if (array_key_exists($key,$translateFieldArray)) {
|
|
||||||
$def_val[$translateFieldArray[$key]] = array("keyword" => $translateFieldArray[$key], "data" => $val, "seq" => "99");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$def_val[$key] = array("keyword" => $key, "data" => $val, "seq" => "99");
|
$def_val[$key] = array("keyword" => $key, "data" => $val, "seq" => "99");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dbug('def_value', $def_val);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
//print_r($db_res);
|
|
||||||
|
|
||||||
if (!empty($device_warning)) {
|
if (!empty($device_warning)) {
|
||||||
?>
|
?>
|
||||||
|
@ -142,7 +121,7 @@ if (!empty($device_warning)) {
|
||||||
echo $this->showGroup('sccp_hw_dev_softkey', 1, 'sccp_hw', $def_val);
|
echo $this->showGroup('sccp_hw_dev_softkey', 1, 'sccp_hw', $def_val);
|
||||||
// echo $this->showGroup('sccp_hw_dev_pickup', 1, 'sccp_hw', $def_val); This are line properties and does not exist!
|
// echo $this->showGroup('sccp_hw_dev_pickup', 1, 'sccp_hw', $def_val); This are line properties and does not exist!
|
||||||
echo $this->showGroup('sccp_hw_dev_conference', 1, 'sccp_hw', $def_val);
|
echo $this->showGroup('sccp_hw_dev_conference', 1, 'sccp_hw', $def_val);
|
||||||
echo $this->showGroup('sccp_dev_vendor_conf', 1, 'sccp_hw', $def_val, true);
|
echo $this->showGroup('sccp_dev_vendor_conf', 1, 'vendorconfig', $def_val, true);
|
||||||
echo $this->showGroup('sccp_hw_dev_network', 1, 'sccp_hw', $def_val);
|
echo $this->showGroup('sccp_hw_dev_network', 1, 'sccp_hw', $def_val);
|
||||||
?>
|
?>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -18,11 +18,15 @@
|
||||||
* Help elemen HLP - Help Element
|
* Help elemen HLP - Help Element
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// This will not work if the field already has the underscore
|
||||||
$npref = $form_prefix.'_';
|
$npref = $form_prefix.'_';
|
||||||
$napref = $form_prefix.'-ar_';
|
$napref = $form_prefix.'-ar_';
|
||||||
if (empty($form_prefix)) {
|
if (empty($form_prefix)) {
|
||||||
$npref = "sccp_";
|
$npref = "sccp_";
|
||||||
$napref ="sccp-ar_";
|
$napref ="sccp-ar_";
|
||||||
|
} elseif ($form_prefix == 'vendorconfig') {
|
||||||
|
$npref = 'vendorconfig';
|
||||||
|
$napref = 'vendorconfig-ar';
|
||||||
}
|
}
|
||||||
$day_format = array("D.M.Y", "D.M.YA", "Y.M.D", "YA.M.D", "M-D-Y", "M-D-YA", "D-M-Y", "D-M-YA", "Y-M-D", "YA-M-D", "M/D/Y", "M/D/YA",
|
$day_format = array("D.M.Y", "D.M.YA", "Y.M.D", "YA.M.D", "M-D-Y", "M-D-YA", "D-M-Y", "D-M-YA", "Y-M-D", "YA-M-D", "M/D/Y", "M/D/YA",
|
||||||
"D/M/Y", "D/M/YA", "Y/M/D", "YA/M/D", "M/D/Y", "M/D/YA");
|
"D/M/Y", "D/M/YA", "Y/M/D", "YA/M/D", "M/D/Y", "M/D/YA");
|
||||||
|
@ -328,7 +332,8 @@ foreach ($items as $child) {
|
||||||
|
|
||||||
if ($child['type'] == 'IS') {
|
if ($child['type'] == 'IS') {
|
||||||
$res_n = (string)$child->name;
|
$res_n = (string)$child->name;
|
||||||
$res_id = $npref.$child->name;
|
$res_id = $npref.$res_n;
|
||||||
|
$res_ext = str_replace($npref,'',$res_n);
|
||||||
if (!empty($metainfo[$res_n])) {
|
if (!empty($metainfo[$res_n])) {
|
||||||
if ($child->meta_help == '1' || $child->help == 'Help!') {
|
if ($child->meta_help == '1' || $child->help == 'Help!') {
|
||||||
$child->help = $metainfo[$res_n]['Description'];
|
$child->help = $metainfo[$res_n]['Description'];
|
||||||
|
@ -361,9 +366,9 @@ foreach ($items as $child) {
|
||||||
if (!empty($child->value)) {
|
if (!empty($child->value)) {
|
||||||
$res_v = (string)$child->value;
|
$res_v = (string)$child->value;
|
||||||
}
|
}
|
||||||
if (!empty($fvalues[$res_n])) {
|
if (!empty($fvalues[$res_ext])) {
|
||||||
if (($fvalues[$res_n]['data'] != '') ) {
|
if (($fvalues[$res_ext]['data'] != '') ) {
|
||||||
$res_v = (string)$fvalues[$res_n]['data'];
|
$res_v = (string)$fvalues[$res_ext]['data'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!empty($child->option_hide)) {
|
if (!empty($child->option_hide)) {
|
||||||
|
|
|
@ -17,34 +17,12 @@
|
||||||
$defaultVal = array();
|
$defaultVal = array();
|
||||||
$sccpDeviceDesc = $this->dbinterface->HWextension_db_SccpTableData('get_columns_sccpdevice');
|
$sccpDeviceDesc = $this->dbinterface->HWextension_db_SccpTableData('get_columns_sccpdevice');
|
||||||
|
|
||||||
$translateFieldArray = array('_logserver' => 'vendorconfig_logserver',
|
|
||||||
'_daysdisplaynotactive' => 'vendorconfig_daysdisplaynotactive',
|
|
||||||
'_displayontime' => 'vendorconfig_displayontime',
|
|
||||||
'_displayonduration' => 'vendorconfig_displayonduration',
|
|
||||||
'_displayidletimeout' => 'vendorconfig_displayidletimeout',
|
|
||||||
'_settingsaccess' => 'vendorconfig_settingsaccess',
|
|
||||||
'_videocapability' => 'vendorconfig_videocapability',
|
|
||||||
'_webaccess' => 'vendorconfig_webaccess',
|
|
||||||
'_webadmin' => 'vendorconfig_webadmin',
|
|
||||||
'_pcport' => 'vendorconfig_pcport',
|
|
||||||
'_spantopcport' => 'vendorconfig_spantopcport',
|
|
||||||
'_voicevlanaccess' => 'vendorconfig_voicevlanaccess',
|
|
||||||
'_enablecdpswport' => 'vendorconfig_enablecdpswport',
|
|
||||||
'_enablecdppcport' => 'vendorconfig_enablecdppcport',
|
|
||||||
'_enablelldpswport' => 'vendorconfig_enablelldpswport',
|
|
||||||
'_enablelldppcport' => 'vendorconfig_enablelldppcport'
|
|
||||||
);
|
|
||||||
|
|
||||||
foreach ($sccpDeviceDesc as $data) {
|
foreach ($sccpDeviceDesc as $data) {
|
||||||
$key = (string) $data['Field'];
|
$key = (string) $data['Field'];
|
||||||
if (array_key_exists($key, $translateFieldArray)) {
|
$defaultVal[$key] = array("keyword" => $key, "data" => $data['Default'], "seq" => "99");
|
||||||
$defaultVal[$translateFieldArray[$key]] = array("keyword" => $translateFieldArray[$key], "data" => $data['Default'], "seq" => "99");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo $this->showGroup('sccp_srst', 1);
|
echo $this->showGroup('sccp_srst', 1);
|
||||||
echo $this->showGroup('sccp_dev_vendor_conf', 1,'sccp',$defaultVal,false);
|
echo $this->showGroup('sccp_dev_vendor_conf', 1,'vendorconfig',$defaultVal,false);
|
||||||
// echo $this->showGroup('sccp_dev_time',1);
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
</form>
|
</form>
|
||||||
|
|
Loading…
Reference in a new issue