fixes linenumber generation when adding line to phone
authorPhilipp Schüle <p.schuele@metaways.de>
Wed, 17 Aug 2016 10:38:23 +0000 (12:38 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Wed, 17 Aug 2016 13:12:50 +0000 (15:12 +0200)
Change-Id: Ifd8840200722573e422893df9ec7529e1db26ebb
Reviewed-on: http://gerrit.tine20.com/customers/3444
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Voipmanager/Model/Snom/Line.php
tine20/Voipmanager/js/Snom/LineGridPanel.js

index 0aa3a47..b993fae 100644 (file)
@@ -50,7 +50,7 @@ class Voipmanager_Model_Snom_Line extends Tinebase_Record_Abstract
      * @var array
      */
     protected $_validators = array(
-        'id'                 => array(Zend_Filter_Input::ALLOW_EMPTY => true, Zend_Filter_Input::DEFAULT_VALUE => NULL),
+        'id'                => array(Zend_Filter_Input::ALLOW_EMPTY => true, Zend_Filter_Input::DEFAULT_VALUE => NULL),
         'snomphone_id'      => array(Zend_Filter_Input::ALLOW_EMPTY => true),
         'asteriskline_id'   => array(Zend_Filter_Input::ALLOW_EMPTY => true),
         'linenumber'        => array(Zend_Filter_Input::ALLOW_EMPTY => false, 'presence' => 'required'),
index b98ba87..8cc8a49 100644 (file)
@@ -185,6 +185,11 @@ Tine.Voipmanager.LineGridPanel = Ext.extend(Tine.widgets.grid.PickerGridPanel, {
             if (line.data.asteriskline_id.id == recordToAdd.data.id) {
                 found = true;
             }
+            if (line.get('linenumber') == record.get('linenumber')) {
+                // use next linenumber
+                // TODO should be improved, maybe server should decide which (free) linenumber should be used
+                record.set('linenumber', line.get('linenumber') + 1);
+            }
         }, this);
         
         if (! found) {