0009502: New unexcused sickness days aren't bookable as vacation days
authorAlexander Stintzing <a.stintzing@metaways.de>
Thu, 9 Jan 2014 14:30:24 +0000 (15:30 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Wed, 15 Jan 2014 17:28:52 +0000 (18:28 +0100)
When creating unexcused sickness days and trying to book
them as vacation days in one step, the panel breaks.

https://forge.tine20.org/mantisbt/view.php?id=9502

Change-Id: Id3c19d6a3128b33fad9bf876037cbd23d2114210
Reviewed-on: https://gerrit.tine20.org/tine20/2706
Tested-by: jenkins user
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
Tested-by: Philipp Schüle <p.schuele@metaways.de>
tine20/HumanResources/js/FreeTimeGridPanel.js

index 3857864..9301bed 100644 (file)
@@ -96,18 +96,16 @@ Tine.HumanResources.FreeTimeGridPanel = Ext.extend(Tine.widgets.grid.GridPanel,
      */
     onBookSicknessAsVacation: function(grid, e) {
         var record = this.getGrid().getSelectionModel().getSelections()[0];
-        
+
         // check if enough vacation days are available
-        var year = record.get('year');
-            
         var request = Ext.Ajax.request({
             url : 'index.php',
             params : { 
                 method : 'HumanResources.getFeastAndFreeDays',
                 _employeeId: record.get('employee_id'),
-                _year: null
+                _year: parseInt(record.get('firstday_date').format('Y'))
                 _freeTimeId: null,
-                _accountId: record.get('account_id').id
+                _accountId: record.get('account_id') ? record.get('account_id').id : null
             },
             success : function(_result, _request) {
                 var response = Ext.decode(_result.responseText);