Merge branch '2016.11-develop' into 2017.02
[tine20] / tine20 / Timetracker / js / TimesheetEditDialog.js
index 82562fa..84da88a 100644 (file)
@@ -97,13 +97,17 @@ Tine.Timetracker.TimesheetEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog
             this.getForm().findField('billed_in').setDisabled(! (grants.adminGrant || manageRight));
         }
 
-        if (timeaccount) {
+        if (timeaccount && timeaccount.data) {
             notBillable = notBillable || timeaccount.data.is_billable == "0" || timeaccount.get('is_billable') == "0";
             
             // clearable depends on timeaccount is_billable as well (changed by ps / 2009-09-01, behaviour was inconsistent)
             notClearable = notClearable || timeaccount.data.is_billable == "0" || timeaccount.get('is_billable') == "0";
+
+            if (timeaccount.data.is_billable == "0" || timeaccount.get('is_billable') == "0") {
+                this.getForm().findField('is_billable').setValue(false);
+            }
         }
-        
+
         this.getForm().findField('is_billable').setDisabled(notBillable);
         this.getForm().findField('is_cleared').setDisabled(notClearable);