#891: AuftragDO.kt

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

Type: JPA @Entity — Domain Object

Package: org.projectforge.business.fibu

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

520 lines · 354 code · 105 comments · 61 blank

The primary domain entity representing an order (Auftrag) or quote (Angebot) in ProjectForge's order book module. A quote may be rejected or replaced — it does not necessarily become an actual order. All fields are historized, so changes capture valuable information such as the commissioning history (e.g., LOI on 2022-03-05 by Mr. Müller, written confirmation on 2022-04-04 by procurement). Mapped to database table t_fibu_auftrag.

Database Table

Tablet_fibu_auftrag
Unique Constraintnummer (order number)
Indexes8 indexes on FK columns (contact_person, projectmanager, headofbusinessmanager, salesmanager, kunde, projekt)

Entity Relationships

RelationTypeTargetFetch
positionen@OneToMany (ordered)AuftragsPositionDOLAZY
paymentSchedules@OneToMany (ordered)PaymentScheduleDOLAZY
contactPerson@ManyToOnePFUserDOLAZY
kunde@ManyToOneKundeDOLAZY
projekt@ManyToOneProjektDOLAZY
projectManager@ManyToOnePFUserDOLAZY
headOfBusinessManager@ManyToOnePFUserDOLAZY
salesManager@ManyToOnePFUserDOLAZY

Core Properties

PropertyTypeDB ColumnDescription
nummerInt?nummer (non-null)Unique, auto-incrementing order number
referenzString?referenz (255)Legacy order numbers or customer references
statusAuftragsStatus?status (30)Order status (enum, stored as string)
titelString?titel (1000)Order title
kundeTextString?kunde_text (1000)Free-text customer name (fallback if no KundeDO)
bemerkungString?bemerkung (4000)General comment
statusBeschreibungString?status_beschreibung (4000)Status description
angebotsDatumLocalDate?angebots_datumQuote date
erfassungsDatumLocalDate?erfassungs_datumCreation/recording date
entscheidungsDatumLocalDate?entscheidungs_datumDecision date
bindungsFristLocalDate?bindungs_fristBinding deadline
beauftragungsDatumLocalDate?beauftragungs_datumCommissioning date
beauftragungsBeschreibungString?beauftragungs_beschreibung (4000)Who commissioned when and how
periodOfPerformanceBeginLocalDate?period_of_performance_beginStart of performance period
periodOfPerformanceEndLocalDate?period_of_performance_endEnd of performance period
probabilityOfOccurrenceInt?probability_of_occurrenceProbability of occurrence (forecast)
forecastTypeAuftragForecastType?forecast_type (20)Forecast distribution type (default: FOLLOWING_MONTH)
uiStatusAsXmlString?ui_status_as_xml (10000)Serialized UI state (marked @NoHistory)

Attachment Support

Implements AttachmentsInfo with fields: attachmentsNames, attachmentsIds, attachmentsCounter, attachmentsSize, attachmentsLastUserAction. All marked @NoHistory.

Computed / Transient Properties

PropertyTypeDescription
displayNameStringFormat: "<nummer>: <titel>"
nummerAsStringStringnummer as string for Hibernate Search auto-complete
projektKundeAsStringStringFormatted project/customer string
kundeAsStringStringFormatted customer string (with free-text fallback)
projektAsStringStringAlias for projektKundeAsString
assignedPersonsStringSemicolon-separated list of project manager, head of business, sales manager, contact person
positionenExcludingDeletedListFiltered list excluding soft-deleted positions
paymentSchedulesExcludingDeletedListFiltered list excluding soft-deleted payment schedules
infoOrderInfoCached order calculations (must be set via AuftragsCache.setOrderInfo)
statusAsStringString?"FAKTURIERT" if fully invoiced, otherwise localized status

Deprecated Computed Properties

Delegated to info.* equivalents:

Collection Management Methods

Named Queries

NameQuery
AuftragDO_SelectMinMaxDateselect min(angebotsDatum), max(angebotsDatum) from AuftragDO
AuftragDO_FindByNummerfrom AuftragDO where nummer=:nummer
AuftragDO_FindOtherByNummerfrom AuftragDO where nummer=:nummer and id!=:id

Git History

868d6abb7 2025 -> 2026
49b1d6b8d Forecast and orderbook: forecast-Type for orders/positions added (current month or following month)
4550ccc8a MonthlyEmployeeReport: show weekly net and gross hours. Fix select in AuftragDao.positionen.status
63081666f Source file headers: 2024-> 2025.
0237d5eba Json serialization refactored: IdOnlySerializer and IdsOnlySerializer introduced.
a35971f85 Issues from last pull request resolved.
42dc9fa16 Orders: ordered -> commissioned.
91f087e17 AuftragsPositionFormComponent: search for order numbers fixed.
(100+ commits total, spanning migration to Long IDs, LAZY loading, Kotlin conversion, Hibernate Search updates, etc.)