diff --git a/assets/js/sccp_manager.js b/assets/js/sccp_manager.js
index ef3ccb7..6c3b326 100644
--- a/assets/js/sccp_manager.js
+++ b/assets/js/sccp_manager.js
@@ -281,7 +281,8 @@ $(document).ready(function () {
});
// Form.adddevice
$('.hw_select').change(function (e) {
-// console.log('HwSelect');
+ // data-val contains the number of buttons for this type
+ // data-id contains the max number of addons (1 = 0, 3 = 2)
var type_id = $('#sccp_hw_type').find(':selected').data('id');
var btn_dev = $('#sccp_hw_type').find(':selected').data('val');
if (type_id === 1) {
@@ -290,17 +291,26 @@ $(document).ready(function () {
}
$('#sccp_hw_addon').attr("disabled", "disabled");
} else {
- $('#sccp_hw_addon').removeAttr('disabled');
+ $('#sccp_hw_addon').prop('disabled',false);
+ }
+ // when edit, btn_dev is undefined as no select, so send btn_dev with page
+ if (btn_dev == null) {
+ var btn_dev = $('#devButtonCnt').val();
}
-
var btn_add = $('#sccp_hw_addon').find(':selected').data('val');
- $('#buttonscount').attr('value',btn_dev + btn_add);
+ // btn_add is empty if none selected
+ if ((btn_add == null) || (btn_add == '')) {
+ var btn_add = 0;
+ }
+ var totButtons = parseInt(btn_dev, 10) + parseInt(btn_add, 10);
+ $('#buttonscount').attr('value', totButtons);
$('.line_button').each(function () {
- if ($(this).data('id') < btn_dev + btn_add) {
+ if ($(this).data('id') < totButtons) {
$(this).removeClass('hidden');
- $(this).removeAttr('hidden')
+ $(this).removeAttr('hidden');
} else {
$(this).addClass('hidden');
+ $(this).attr('hidden', true);
}
});
});
diff --git a/conf/sccpgeneral.xml.v433 b/conf/sccpgeneral.xml.v433
index 3a1d5c9..48e3d92 100644
--- a/conf/sccpgeneral.xml.v433
+++ b/conf/sccpgeneral.xml.v433
@@ -1298,13 +1298,12 @@ and open the template in the editor. Base Version before all crash :-)
The type of phone: 7911, 7940, 7960, etc. Important note: the 'G' models are handled as the base model (e.g., 7962G is handled as 7962). In the Display mode, this field is read-only because the MAC address and the model number are a pair.
-
+
-
- addon
- NONE
- sccp-custom
-
+ addon
+ NONE
+
+ hw_select form-controlAddon: Addons are model specific and only work with certain base phones. This phone model is identified as being a phone that does not accept sidecars. Update devmodel if this is not correct.
diff --git a/sccpManClasses/formcreate.class.php b/sccpManClasses/formcreate.class.php
index e1ac17e..184805a 100644
--- a/sccpManClasses/formcreate.class.php
+++ b/sccpManClasses/formcreate.class.php
@@ -759,7 +759,7 @@ class formcreate
break;
case 'SDE':
$extension_list = \FreePBX::Sccp_manager()->dbinterface->getDb_model_info('extension', 'model');
- $extension_list[]=array( 'model' => 'NONE', 'vendor' => 'CISCO', 'dns' => '0');
+ $extension_list[] = array( 'model' => 'NONE', 'vendor' => 'CISCO', 'dns' => '0');
foreach ($extension_list as &$data) {
$d_name = explode(';', $data['model']);
if (is_array($d_name) && (count($d_name) > 1)) {
diff --git a/views/form.buttons.php b/views/form.buttons.php
index 15fc7a4..48e224a 100644
--- a/views/form.buttons.php
+++ b/views/form.buttons.php
@@ -31,30 +31,30 @@ $hint_list = $this->getHintInformation(true, array('context'=>'park-hints')) ;
// print_r($hint_list);
$line_id =0;
-$max_buttons =56; //Don't know hardware type so et a maximum. On save, this is set to actual max buttons
+$max_buttons =56; //Don't know hardware type so set a maximum. On save, this is set to actual max buttons
$show_buttons =1;
//print_r($hint_list);
if (!empty($_REQUEST['id'])) {
$dev_id = $_REQUEST['id'];
$db_buttons = $this->dbinterface->getSccpDeviceTableData('get_sccpdevice_buttons', array("id" => $dev_id));
$db_device = $this->dbinterface->getSccpDeviceTableData('get_sccpdevice_byid', array("id" => $dev_id));
- $max_buttons = $db_device['buttons'];
+ $show_buttons = $db_device['buttons'];
if (!empty($db_device['addon_buttons'])) {
- $max_buttons += $db_device['addon_buttons'];
+ $show_buttons += $db_device['addon_buttons'];
}
- $show_buttons = $max_buttons;
+ //$show_buttons = $max_buttons;
}
if (!empty($_REQUEST['new_id'])) {
$val = $_REQUEST['type'];
$dev_schema = $this-> getSccpModelInformation('byid', false, "all", array('model' =>$val));
// $db_device = $this->dbinterface->getSccpDeviceTableData('get_sccpdevice_byid', array("id" => $val));
- $max_buttons = $dev_schema[0]['buttons'];
+ $show_buttons = $dev_schema[0]['buttons'];
if (!empty($_REQUEST['addon'])) {
$val = $_REQUEST['addon'];
$dev_schema = $this-> getSccpModelInformation('byid', false, "all", array('model' =>$val));
- $max_buttons += $dev_schema[0]['buttons'];
+ $show_buttons += $dev_schema[0]['buttons'];
}
- $show_buttons = $max_buttons;
+ //$show_buttons = $max_buttons;
}
if (!empty($_REQUEST['ru_id'])) {
$dev_id = $_REQUEST['ru_id'];
@@ -67,7 +67,8 @@ if (!empty($_REQUEST['ru_id'])) {