Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

Commit

Permalink
fix(Timetracker/js): prevent factor calculation in multi edit mode
Browse files Browse the repository at this point in the history
Change-Id: Ic7a4c5faba447935b5c18d50c5b8864a669f57b8
  • Loading branch information
ccheng-dev committed May 19, 2021
1 parent f51baf4 commit de9d20c
Showing 1 changed file with 21 additions and 14 deletions.
35 changes: 21 additions & 14 deletions tine20/Timetracker/js/TimesheetEditDialog.js
Expand Up @@ -203,25 +203,30 @@ Tine.Timetracker.TimesheetEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog
},

calculateAccountingTime: function() {
var factor = this.getForm().findField('accounting_time_factor').getValue(),
duration = this.getForm().findField('duration').getValue(),
accountingTime = Math.round(factor * duration);
if (factor != this.factor) {
this.factor = factor;
this.factorChanged = true;
if (!this.useMultiple) {
var factor = this.getForm().findField('accounting_time_factor').getValue(),
duration = this.getForm().findField('duration').getValue(),
accountingTime = Math.round(factor * duration);
if (factor != this.factor) {
this.factor = factor;
this.factorChanged = true;
}
this.getForm().findField('accounting_time').setValue(accountingTime);
}
this.getForm().findField('accounting_time').setValue(accountingTime);
},

calculateFactor: function() {
var duration = this.getForm().findField('duration').getValue(),
accountingTime = this.getForm().findField('accounting_time').getValue(),
factor = accountingTime / duration;
if (factor != this.factor) {
this.factor = factor;
this.factorChanged = true;
if (!this.useMultiple) {
var duration = this.getForm().findField('duration').getValue(),
accountingTime = this.getForm().findField('accounting_time').getValue(),
factor = accountingTime / duration;
if (factor != this.factor) {
this.factor = factor;
this.factorChanged = true;
}

this.getForm().findField('accounting_time_factor').setValue(factor);
}
this.getForm().findField('accounting_time_factor').setValue(factor);
},

onCheckBillable: function(field, checked) {
Expand Down Expand Up @@ -414,6 +419,7 @@ Tine.Timetracker.TimesheetEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog
check: this.onCheckBillable
}}),
fieldManager('accounting_time_factor', {
disabled: this.useMultiple,
columnWidth: .1,
decimalSeparator: ',',
fieldLabel: this.app.i18n._('Factor'),
Expand All @@ -422,6 +428,7 @@ Tine.Timetracker.TimesheetEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog
change: this.calculateAccountingTime
}}),
fieldManager('accounting_time', {
disabled: this.useMultiple,
fieldLabel: this.app.i18n._('Accounting time'),
listeners: {
scope: this,
Expand Down

0 comments on commit de9d20c

Please sign in to comment.