#891: AuftragDO.kt
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
| Table | t_fibu_auftrag |
| Unique Constraint | nummer (order number) |
| Indexes | 8 indexes on FK columns (contact_person, projectmanager, headofbusinessmanager, salesmanager, kunde, projekt) |
Entity Relationships
| Relation | Type | Target | Fetch |
positionen | @OneToMany (ordered) | AuftragsPositionDO | LAZY |
paymentSchedules | @OneToMany (ordered) | PaymentScheduleDO | LAZY |
contactPerson | @ManyToOne | PFUserDO | LAZY |
kunde | @ManyToOne | KundeDO | LAZY |
projekt | @ManyToOne | ProjektDO | LAZY |
projectManager | @ManyToOne | PFUserDO | LAZY |
headOfBusinessManager | @ManyToOne | PFUserDO | LAZY |
salesManager | @ManyToOne | PFUserDO | LAZY |
Core Properties
| Property | Type | DB Column | Description |
nummer | Int? | nummer (non-null) | Unique, auto-incrementing order number |
referenz | String? | referenz (255) | Legacy order numbers or customer references |
status | AuftragsStatus? | status (30) | Order status (enum, stored as string) |
titel | String? | titel (1000) | Order title |
kundeText | String? | kunde_text (1000) | Free-text customer name (fallback if no KundeDO) |
bemerkung | String? | bemerkung (4000) | General comment |
statusBeschreibung | String? | status_beschreibung (4000) | Status description |
angebotsDatum | LocalDate? | angebots_datum | Quote date |
erfassungsDatum | LocalDate? | erfassungs_datum | Creation/recording date |
entscheidungsDatum | LocalDate? | entscheidungs_datum | Decision date |
bindungsFrist | LocalDate? | bindungs_frist | Binding deadline |
beauftragungsDatum | LocalDate? | beauftragungs_datum | Commissioning date |
beauftragungsBeschreibung | String? | beauftragungs_beschreibung (4000) | Who commissioned when and how |
periodOfPerformanceBegin | LocalDate? | period_of_performance_begin | Start of performance period |
periodOfPerformanceEnd | LocalDate? | period_of_performance_end | End of performance period |
probabilityOfOccurrence | Int? | probability_of_occurrence | Probability of occurrence (forecast) |
forecastType | AuftragForecastType? | forecast_type (20) | Forecast distribution type (default: FOLLOWING_MONTH) |
uiStatusAsXml | String? | 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
| Property | Type | Description |
displayName | String | Format: "<nummer>: <titel>" |
nummerAsString | String | nummer as string for Hibernate Search auto-complete |
projektKundeAsString | String | Formatted project/customer string |
kundeAsString | String | Formatted customer string (with free-text fallback) |
projektAsString | String | Alias for projektKundeAsString |
assignedPersons | String | Semicolon-separated list of project manager, head of business, sales manager, contact person |
positionenExcludingDeleted | List | Filtered list excluding soft-deleted positions |
paymentSchedulesExcludingDeleted | List | Filtered list excluding soft-deleted payment schedules |
info | OrderInfo | Cached order calculations (must be set via AuftragsCache.setOrderInfo) |
statusAsString | String? | "FAKTURIERT" if fully invoiced, otherwise localized status |
Deprecated Computed Properties
Delegated to info.* equivalents:
nettoSumme → info.netSum
beauftragtNettoSumme → info.commissionedNetSum
invoicedSum → info.invoicedSum
notYetInvoicedSum → info.notYetInvoicedSum
Collection Management Methods
addPosition(position) — Appends a position with auto-incremented number
getPosition(number) — Finds a position by its number
ensureAndGetPositionen() — Lazily initializes the positions list
addPaymentSchedule(schedule) — Appends a payment schedule with auto-incremented number
getPaymentSchedule(number) — Finds a payment schedule by its number
ensureAndGetPaymentSchedules() — Lazily initializes the payment schedules list
getUiStatus() — Deserializes the UI status from XML (using XmlObjectReader)
Named Queries
| Name | Query |
AuftragDO_SelectMinMaxDate | select min(angebotsDatum), max(angebotsDatum) from AuftragDO |
AuftragDO_FindByNummer | from AuftragDO where nummer=:nummer |
AuftragDO_FindOtherByNummer | from 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.)