#1101: TimesheetDao.kt
projectforge-business/src/main/kotlin/org/projectforge/business/timesheet/TimesheetDao.kt DAO / Timesheet Management, projectforge-business/src/main/kotlin/org/projectforge/business/timesheet/TimesheetDao.kt 784 lines · 596 code · 143 comments · 45 blank
Core DAO for timesheet management extending BaseDao. Implements comprehensive access control: own timesheets vs foreign timesheets (finance group has full access), project managers/HR/controlling can view but with hidden description/location (HIDDEN_FIELD_MARKER). checkTimesheetProtection() validates the protectTimesheetsUntil constraint on ancestor tasks (prevents booking before freeze date). checkTaskBookable() enforces 4 rules: task/ancestors not closed/deleted, no TREE_CLOSED status, no ONLY_LEAFS on parent tasks with children, no order positions in descendant tasks. onInsertOrModify() validates: milliseconds/seconds must be 0, minutes multiple of 5, minimum 60s duration, maximum 14h, time overlap detection (via hasTimeOverlap() in transaction), kost2 validation (must be in task's kost2 list). validateTimeSavingsByAI() ensures unit is set when savings specified, percentage capped at 99%. prepareHibernateSearch() re-initializes lazy user/task references for indexing. Supports configurable tags, location autocompletion, reference autocompletion, and year range queries.
Git History
868d6abb7 2025 -> 2026
bb1e156b1 Claude Code: DynamicButton is disabled while isFetching, TimesheetDao prevents time sheet collisions on multiple button events.
3c439391c Timesheet: recent entries (display of kost2, project and customer) fixed. Timesheet: ai unit is preset by recent entry. Timesheet-Excel-Export: AI-savings added.
6a32032d6 Hibernate.isInitialized(obj) -> HibernateUtils.isFullyInitialized(obj). Some lazy objects of e.g. ManyToOne columns are not fully loaded but Hibernate.isInitialized() returns true.
9fc09ddd4 Bugfix: Autocompletion for locations in timesheet works now again.
1449f4859 WIP: timesavings by AI in timesheets, config param for note added.
cbffabd60 WIP: time savings by AI
63081666f Source file headers: 2024-> 2025.
53b501ab6 Example scripts fixed. TimesheetDO.getDuration() -> TimesheetDO.duration.
5989b32fd BaseDao: mechanism of onChangeLister refactored.
1b50060c3 BaseDao: renamed: get -> find, save -> insert, getList -> select, load -> select
87aaf6a5a Migration stuff in progress... BaseDao refactored (not yet finished) internal* methods renamed.
3aeda5ef5 Big change: all save|update|...InTrans renamed (InTrans removed). PfPesistenceContext as param not needed anymore (ThreadLocal is used instead). (all tests of all packages: OK).
e66d5f5f7 Migration stuff in progress... TaskTree -> Kotlin and runs now in isolated entity manager
67805f2fc ThreadLocalUserContext.user -> ThreadLocalUserContext.loggedInUser (renamed for avoiding mis-understandings in code).
85b4e1175 PfPersistenceService and PfPersistenceContext: query renamed to executeQuery.
b095e6f7d !!!!! Big change of Transaction handling: Re-uses PfPersistenceContext as much as possible (not yet finished). Tests doesn't yet run.
4c04cfd65 MAJOR-CHANGE! Migration of integer id's to Long id's (including fk's etc.)
09effe8bb BaseDao.hasUpdateAccess and hasDeleteAccess accepts now null dbObj's.
2863b30b9 Migration stuff in progress...
5bafe7941 @Repository -> @Service. @Transactional-Annotations removed.
ee7b7fe15 Migration stuff in progress...
0d183e5df Migration stuff in progress...
9d8b94352 Migration stuff in progress...
c25b14e78 Migration stuff in progress...
67ce75fe9 Migration stuff in progress...
e33c8b9c2 Migration stuff in progress...
06828f490 Migration stuff in progress...
b6092df09 Copyright 2023 -> 2024
ab45d51fa Copyright 2001-2022 -> 2001-2023.
73b0be50b org.apache.commons.collections -> org.apache.commons.collections4
38bec971a ThreadLocal -> Kotlin
267283973 PROJECTFORGE-3730: Show validation message for list pages if result list was truncated due to max rows in QueryFilter.
765e7f1af TimesheetDao.massUpdate removed (not needed anymore).
512ffa420 Configuration param: timesheetTag implemented.
fcc633dff Timesheets mass update supports now update of reference field.
5f7ef41b8 Copyright 2021 -> 2022
0ab100d21 Configuration refactored (GlobalConfiguration not needed anymore). SEPA export should now erease unprintable chars.
c0f2b9de0 Tenants functionality removed everywhere (untested).
db3b02da7 UserException moved from business to common package (AccesssException affected). UserException will now be returned as Toast for Rest clients on default. FileSizeChecker WIP.
8c53b07de Nothing real.
d875be4d4 TimesheetDao: Java - Kotlin (!!!! Side effects may occur all over the project!!!!)