#890: AuftragAndRechnungDaoHelper.kt

projectforge-business/src/main/kotlin/org/projectforge/business/fibu/AuftragAndRechnungDaoHelper.kt

Type: Utility object (Kotlin object)

Package: org.projectforge.business.fibu

Full path: projectforge-business/src/main/kotlin/org/projectforge/business/fibu/AuftragAndRechnungDaoHelper.kt

129 lines · 98 code · 23 comments · 8 blank

Shared utility object providing database filter criteria builders and validation logic used by both AuftragDao (orders) and RechnungDao (invoices). Centralizes common patterns like period-of-performance filtering, date range query construction, and invoice save-time validation (maturity calculation, payment date/amount consistency).

Public Methods

createCriterionForPeriodOfPerformance(myFilter)

Returns: Optional<DBPredicate>

Builds a predicate for filtering by period of performance overlap. Uses the filter's periodOfPerformanceStartDate and periodOfPerformanceEndDate. The logic checks for overlapping date ranges:

createQueryFilterWithDateRestriction(myFilter)

Returns: QueryFilter

Creates a QueryFilter from a RechnungFilter, adding date range constraints on the "datum" field (invoice date). Supports from-date, to-date, or both-range using between, ge, and le operators.

onSaveOrModify(rechnung)

Parameter: AbstractRechnungDO

Master validation method called before persisting any invoice. Delegates to three private helpers:

Design Notes

Git History

868d6abb7 2025 -> 2026
f4540acfa WIP: Import of creditor invoices
63081666f Source file headers: 2024-> 2025.
cec9dd314 Invoices: discountMaturity fixed
b6092df09 Copyright 2023 -> 2024
ab45d51fa Copyright 2001-2022 -> 2001-2023.
5f7ef41b8 Copyright 2021 -> 2022
a7fceb731 Some compiler warnings fixed.
db3b02da7 UserException moved from business to common package
ceb63e8a1 Source code header: (C) 2001-2021.
a0232cdba Code warnings.
b209e00ba PFDay.from -> from, fromOrNow, fromOrNull, PFDateTime.from -> from, fromOrNow, fromOrNull
611b20d4e WIP: java.sql.Date -> LocalDate.
7c1c48782 Replacing more instance of java.sql.Date with java.time.LocalDate
78b436d9e Replace instances of java.util.date and java.sql.Date with java.time.LocalDate
7c79f1922 Copyright of source header -> 2020.
a1c287b49 Week of year is now globally the same (independant from user's locale)
61b23c3fd DateHelper methods removed (replaced by PFDay/PFDateTime).