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

Commit

Permalink
fix(HumanResources): edit timesheet if series had pause
Browse files Browse the repository at this point in the history
  • Loading branch information
corneliusweiss committed Apr 29, 2022
1 parent e517ad4 commit 1792f9a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tine20/HumanResources/js/AttendanceRecorder.js
Expand Up @@ -311,9 +311,10 @@ const attendanceRecorder = Ext.extend(Ext.Button, {
// records per timeaccount
records = _.sortBy(records);
const top = _.last(records);
const bottom = _.first(records);
const timeAccountId = _.get(_.compact(_.uniq(_.map(records, `xprops.${META_DATA}.Timetracker_Model_Timeaccount`))), [0]);
const record = this.menu.timeAccountPickerGrid.store.getById(timeAccountId);
record.set('xprops', Object.assign(record.get('xprops') || {}, { HumanResources_Model_AttendanceRecord: { top, records,
record.set('xprops', Object.assign(record.get('xprops') || {}, { HumanResources_Model_AttendanceRecord: { top, bottom, records,
type: _.get(top, FLD_TYPE, TYPE_CLOCK_OUT),
}}));
});
Expand Down Expand Up @@ -405,7 +406,7 @@ const attendanceRecorder = Ext.extend(Ext.Button, {
if (el) {
const row = this.menu.timeAccountPickerGrid.view.findRowIndex(el);
const timeAccount = this.menu.timeAccountPickerGrid.store.getAt(row);
const timesheet = _.get(timeAccount, `data.xprops.HumanResources_Model_AttendanceRecord.top.xprops.metaData.Timetracker_Model_Timesheet`);
const timesheet = _.get(timeAccount, `data.xprops.HumanResources_Model_AttendanceRecord.bottom.xprops.metaData.Timetracker_Model_Timesheet`);
const action = el.dataset.action;
const multiStart = e.ctrlKey || e.shiftKey;

Expand All @@ -416,7 +417,7 @@ const attendanceRecorder = Ext.extend(Ext.Button, {

let result;
const openTimesheet = (timeAccount) => {
const timesheet = _.get(timeAccount, `data.xprops.HumanResources_Model_AttendanceRecord.top.xprops.metaData.Timetracker_Model_Timesheet`);
const timesheet = _.get(timeAccount, `data.xprops.HumanResources_Model_AttendanceRecord.bottom.xprops.metaData.Timetracker_Model_Timesheet`);
Tine.Timetracker.TimesheetEditDialog.openWindow({
record: timesheet,
contentPanelConstructorInterceptor: async (config) => {
Expand Down

0 comments on commit 1792f9a

Please sign in to comment.