QuellCode/CentronERP war nur als Gitlink (Submodul-Referenz auf 79c1142) getrackt, ohne .gitmodules und ohne erreichbares Remote. Der Untersuchungsgegenstand der Versuchsreihe war damit nicht reproduzierbar gesichert: Ein Klon haette ein leeres Verzeichnis erhalten, und die Belege der 3.287 Anforderungen waeren nicht ueberpruefbar gewesen. Umstellung: - Historie nach c:\DEV\CentronERP_git_snapshot_79c1142 ausgelagert (vollstaendig lesbar, enthaelt 79c1142 und Vorgaenger 89ccfd6) - Gitlink aus dem Index entfernt - Dateiinhalt aufgenommen: 24.557 Dateien, rund 333 MB Die verschachtelte .gitignore der Codebasis gilt weiter, Build-Artefakte bleiben ausgeschlossen. Details in Versuche/Versuch_01/_Codebasis-Nachweis.md
29 KiB
Automatic Helpdesk Creation Templates
Feature Branch: ral/T-162548-vorlage-autom-ticket-erstellung
Implementation Date: 2026-02-12
Status: ✅ Completed
Overview
This feature implements a comprehensive template system for automatic helpdesk ticket creation from orders. Users can now create, save, and manage multiple preset configurations for ticket creation, with one template designated as the standard default.
Table of Contents
- Features
- User Interface
- Technical Implementation
- Database Schema
- Architecture
- Usage Guide
- Configuration
Features
Core Functionality
- ✅ Template Management: Create, save, load, update, and delete ticket creation templates
- ✅ Standard Template: Designate one template as the standard (only one at a time)
- ✅ Auto-Load: Automatically load the last selected template when opening the UI
- ✅ Template Persistence: Selected template is saved and restored across sessions
- ✅ Field Preservation: Form fields remain unchanged during template operations
- ✅ Visual Indicators: Standard templates are displayed in bold with a checkmark icon
- ✅ Template Updates: Automatically update templates when saving settings
New Fields Added
- Category (Kategorie): Main category for helpdesk tickets
- CreateSeparateTicketsMode: Choice between Single, Group, or Custom ticket creation
- OpenAfterwards: Whether to open tickets after creation
- CreateTicketForAll: Create tickets for all order positions or only those without tickets
User Interface
Template Dropdown
Location: Belege → Einstellungen → Bestellung → Automatische Helpdeskfallerstellung → Vorlagen
Components:
- ComboBox with template selection (shows "Keine Vorlage ausgewählt" when none selected)
- Standard templates display with:
- ✓ Checkmark icon
- Bold text
Actions:
- Three action buttons:
- Als Vorlage speichern: Save current form values as a new template
- Als Standard setzen: Set selected template as the standard
- Vorlage löschen: Delete selected template
Template Workflow
┌─────────────────────────────────────────────────────────────┐
│ 1. User opens UI │
│ → Last selected template is loaded (if exists) │
│ → Or standard template is shown (if no previous selection)│
└─────────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────────┐
│ 2. User selects a template │
│ → All form fields are populated with template values │
└─────────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────────┐
│ 3. User modifies fields │
│ → Form values change │
└─────────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────────┐
│ 4. User clicks "Speichern" │
│ → ApplicationSettings are saved │
│ → Selected template is updated with new values │
│ → Template selection is persisted │
└─────────────────────────────────────────────────────────────┘
Field Clearing
When "Keine" (none) is selected in the template dropdown:
- All form fields are cleared to default/empty values
- User can manually fill in values
- Clicking "Speichern" saves only to ApplicationSettings (no template update)
Technical Implementation
Backend Components
1. Database Script
File: ScriptMethod11751.cs
Creates the HelpdeskCreationTemplate table with:
- All template configuration fields
- Standard tracking columns (CreatedByI3D, CreatedDate, ChangedByI3D, ChangedDate, IsDeleted, DeletedByI3D, DeletedDate)
- Indexes on
IsStandardandIsDeletedfor performance
ScriptHelpers.AddTableIfNotExists("HelpdeskCreationTemplate",
("Name", "nvarchar(255)", false, null),
("IsStandard", "bit", false, "0"),
("TypeI3D", "int", true, null),
("CategoryI3D", "int", true, null),
// ... additional fields
);
2. Entity Class
File: HelpdeskCreationTemplate.cs
public class HelpdeskCreationTemplate : BaseEntity
{
public virtual string Name { get; set; }
public virtual bool IsStandard { get; set; }
public virtual int? TypeI3D { get; set; }
public virtual int? CategoryI3D { get; set; }
// ... additional properties
}
3. NHibernate Mapping
File: HelpdeskCreationTemplateMaps.cs
FluentNHibernate mapping with proper nullability and column lengths.
4. Data Transfer Object
File: HelpdeskCreationTemplateDTO.cs
[DataContract]
public class HelpdeskCreationTemplateDTO
{
[DataMember]
public int I3D { get; set; }
[DataMember]
public string Name { get; set; }
[DataMember]
public bool IsStandard { get; set; }
// ... additional properties
}
5. Business Logic
File: HelpdeskCreationTemplateBL.cs
Key methods:
GetTemplateByI3D(int i3D): Retrieve template by IDGetAllTemplates(): Get all active templatesGetStandardTemplate(): Get the standard templateSaveTemplate(entity, currentUserI3D): Create or update templateDeleteTemplate(templateI3D, currentUserI3D): Soft delete templateSetStandardTemplate(templateI3D, currentUserI3D): Set as standard (ensures only one)
Business Rules:
- Only one template can be marked as standard at a time
- Cannot delete the standard template
- Soft delete pattern (sets
IsDeleted = true)
6. Web Service Layer
File: HelpdeskCreationTemplateWebServiceBL.cs
Handles DTO ↔ Entity conversion and delegates to BL.
7. Logic Interfaces
Files: ITicketLogic.cs, BLTicketLogic.cs, WSTicketLogic.cs
Added methods:
Task<Result<List<HelpdeskCreationTemplateDTO>>> GetAllHelpdeskCreationTemplates();
Task<Result<HelpdeskCreationTemplateDTO>> GetHelpdeskCreationTemplateByI3D(int templateI3D);
Task<Result<HelpdeskCreationTemplateDTO>> GetStandardHelpdeskCreationTemplate();
Task<Result<HelpdeskCreationTemplateDTO>> SaveHelpdeskCreationTemplate(HelpdeskCreationTemplateDTO template);
Task<Result> DeleteHelpdeskCreationTemplate(int templateI3D);
Task<Result> SetStandardHelpdeskCreationTemplate(int templateI3D);
Frontend Components
1. ViewModel
File: AutoHelpdeskCreationOrderSettingsViewModel.cs
Properties:
public ObservableCollection<HelpdeskCreationTemplateDTO> Templates { get; set; }
public HelpdeskCreationTemplateDTO SelectedTemplate { get; set; }
private bool _isLoadingTemplate; // Flag to prevent unwanted form reloads
Commands:
SaveTemplateCommand: Save current form values as a new templateDeleteTemplateCommand: Delete selected templateSetStandardTemplateCommand: Set selected template as standard
Key Methods:
LoadTemplates(): Load all templates from databaseLoadTemplateIntoForm(template): Populate form fields from templateSaveAsTemplate(name, isStandard): Create new template from form valuesClearAllFields(): Clear all form fields when "Keine" is selectedSaveSettings(settings): Save to ApplicationSettings and update selected template
Important Implementation Details:
-
Field Preservation: Uses
_isLoadingTemplateflag to preventLoadTemplateIntoForm()orClearAllFields()from being called during template operations. -
Template Updates on Save: When saving settings with a template selected, automatically updates the template with current form values.
-
Template Selection Persistence:
- On load: Retrieves saved template ID from ApplicationSettings and selects it
- On save: Persists currently selected template ID
2. View (XAML)
File: AutoHelpdeskCreationOrderSettingsView.xaml
Template Section:
<dxlc:LayoutGroup Header="Vorlagen" View="GroupBox" Orientation="Vertical">
<dxlc:LayoutItem Label="Vorlage: ">
<dxe:ComboBoxEdit ItemsSource="{Binding Templates}"
SelectedItem="{Binding SelectedTemplate}"
DisplayMember="Name"
NullText="(Keine Vorlage ausgewählt)">
<dxe:ComboBoxEdit.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<!-- Checkmark icon for standard template -->
<Image Visibility="{Binding IsStandard, Converter={...}}"/>
<!-- Template name (bold if standard) -->
<TextBlock Text="{Binding Name}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Style.Triggers>
<DataTrigger Binding="{Binding IsStandard}" Value="True">
<Setter Property="FontWeight" Value="Bold"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</StackPanel>
</DataTemplate>
</dxe:ComboBoxEdit.ItemTemplate>
</dxe:ComboBoxEdit>
</dxlc:LayoutItem>
<!-- Action buttons -->
<dxlc:LayoutItem>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<dx:SimpleButton Content="Als Vorlage speichern"
Command="{Binding SaveTemplateCommand}"/>
<dx:SimpleButton Content="Als Standard setzen"
Command="{Binding SetStandardTemplateCommand}"
IsEnabled="{Binding SelectedTemplate, ...}"/>
<dx:SimpleButton Content="Vorlage löschen"
Command="{Binding DeleteTemplateCommand}"
IsEnabled="{Binding SelectedTemplate, ...}"/>
</StackPanel>
</dxlc:LayoutItem>
</dxlc:LayoutGroup>
New Fields Section:
<dxlc:LayoutGroup Header="Aktionen einstellung" View="GroupBox">
<!-- CreateTicketForAll checkbox -->
<dxe:CheckEdit Content="Für jeden Artikel ein Ticket erstellen"
EditValue="{Binding CreateTicketForAll}"/>
<!-- SendEmailToProcessor checkbox -->
<dxe:CheckEdit Content="E-Mail an Bearbeiter"
EditValue="{Binding SendEmailToProcessor}"/>
<!-- OpenAfterwards checkbox -->
<dxe:CheckEdit Content="Tickets nach Erstellung öffnen"
EditValue="{Binding OpenAfterwards}"/>
<!-- CreateSeparateTicketsMode icon selection -->
<dxlc:LayoutItem Label="Ticket einzeln erstellen: ">
<StackPanel Orientation="Horizontal">
<!-- Yes/Single option -->
<dxe:CheckEdit IsChecked="{Binding CreateSeparateTicketsMode,
Converter={StaticResource EnumToBooleanConverter},
ConverterParameter={x:Static createTickets:CreateTicketsMode.Single}}">
<dxe:CheckEdit.Content>
<StackPanel Orientation="Vertical">
<Image Source="{dx:DXImageOffice2013 Image=Apply_32x32.png}"/>
<TextBlock Text="Ja"/>
</StackPanel>
</dxe:CheckEdit.Content>
</dxe:CheckEdit>
<!-- No/Group option -->
<dxe:CheckEdit IsChecked="{Binding CreateSeparateTicketsMode,
Converter={StaticResource EnumToBooleanConverter},
ConverterParameter={x:Static createTickets:CreateTicketsMode.Group}}">
<dxe:CheckEdit.Content>
<StackPanel Orientation="Vertical">
<Image Source="{dx:DXImageOffice2013 Image=Cancel_32x32.png}"/>
<TextBlock Text="Nein"/>
</StackPanel>
</dxe:CheckEdit.Content>
</dxe:CheckEdit>
<!-- Custom option -->
<dxe:CheckEdit IsChecked="{Binding CreateSeparateTicketsMode,
Converter={StaticResource EnumToBooleanConverter},
ConverterParameter={x:Static createTickets:CreateTicketsMode.Custom}}">
<dxe:CheckEdit.Content>
<StackPanel Orientation="Vertical">
<Image Source="{dx:DXImageOffice2013 Image=Properties_32x32.png}"/>
<TextBlock Text="Eigen"/>
</StackPanel>
</dxe:CheckEdit.Content>
</dxe:CheckEdit>
</StackPanel>
</dxlc:LayoutItem>
</dxlc:LayoutGroup>
<dxlc:LayoutGroup Header="Fallbackwerte" View="GroupBox">
<!-- Category dropdown -->
<dxlc:LayoutItem Label="Kategorie: ">
<dxe:ComboBoxEdit ItemsSource="{Binding HelpdeskCategories}"
SelectedItem="{Binding SelectedMainCategory}"
DisplayMember="Name"/>
</dxlc:LayoutItem>
<!-- Existing fields: Type, Bearbeiter, Priorität, etc. -->
</dxlc:LayoutGroup>
ApplicationSettings
New Settings Added
| ID | Name | Type | Description |
|---|---|---|---|
| 10441 | AutomHelpdeskCategoryI3D |
int | Main category I3D for automatic helpdesk creation |
| 10442 | AutomHelpdeskCreateSeparateTicketsMode |
int | Create separate tickets mode (0=Single, 1=Group, 2=Custom) |
| 10443 | AutomHelpdeskOpenAfterwards |
bool | Whether to open tickets after creation |
| 10444 | AutomHelpdeskCreateTicketForAll |
bool | Create tickets for all positions or only those without tickets |
| 10445 | AutomHelpdeskSelectedTemplateI3D |
int | I3D of selected template (0 = no template) |
Files Modified
- ApplicationSettingID.cs: Added enum entries with XML documentation
- ApplicationSettingDefinitions.cs: Added English descriptions
- ReceiptSettingsDTO.cs: Added properties with
[DataMember]attributes - ReceiptWebServiceBL.cs: Added load/save logic in four locations:
- Settings load list
- Settings load logic
- Settings update list
- Settings update logic
Database Schema
Table: HelpdeskCreationTemplate
| Column | Type | Nullable | Description |
|---|---|---|---|
I3D |
int | No | Primary key (IDENTITY) |
Name |
nvarchar(255) | No | Template name |
IsStandard |
bit | No | Whether this is the standard template |
TypeI3D |
int | Yes | Helpdesk type I3D |
CategoryI3D |
int | Yes | Main category I3D |
SubCategory1I3D |
int | Yes | Sub-category 1 I3D |
SubCategory2I3D |
int | Yes | Sub-category 2 I3D |
PriorityI3D |
int | Yes | Priority I3D |
StatusI3D |
int | Yes | Status I3D |
ProcessorI3D |
int | Yes | Processor (Bearbeiter) employee I3D |
ResponsiblePersonI3D |
int | Yes | Responsible person employee I3D |
AdditionalText1 |
nvarchar(max) | Yes | Additional text 1 |
AdditionalText2 |
nvarchar(max) | Yes | Additional text 2 |
SendEmailToProcessor |
bit | No | Send email to processor flag |
CreateTicketForAll |
bit | No | Create ticket for all positions flag |
CreateSeparateTicketsMode |
int | No | Separate tickets mode (0/1/2) |
OpenAfterwards |
bit | No | Open after creation flag |
OnlyInternal |
bit | No | Only internal visibility flag |
CreatedByI3D |
int | Yes | Created by user I3D |
CreatedDate |
datetime2(2) | Yes | Creation timestamp |
ChangedByI3D |
int | Yes | Last modified by user I3D |
ChangedDate |
datetime2(2) | Yes | Last modification timestamp |
IsDeleted |
bit | No | Soft delete flag |
DeletedByI3D |
int | Yes | Deleted by user I3D |
DeletedDate |
datetime2(2) | Yes | Deletion timestamp |
Indexes:
- Primary key on
I3D - Index on
IsStandard(performance optimization for finding standard template) - Index on
IsDeleted(performance optimization for filtering active templates)
Architecture
Layered Architecture
┌─────────────────────────────────────────────────────────────┐
│ WPF UI Layer │
│ AutoHelpdeskCreationOrderSettingsView (XAML) │
│ AutoHelpdeskCreationOrderSettingsViewModel (C#) │
└─────────────────────────────────────────────────────────────┘
↓
ClassContainer.Instance
↓
┌─────────────────────────────────────────────────────────────┐
│ Logic Interface Layer │
│ ITicketLogic (Interface) │
│ ├─ BLTicketLogic (SQL Connection) │
│ └─ WSTicketLogic (REST API Connection) │
└─────────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────────┐
│ Web Service Business Logic │
│ HelpdeskCreationTemplateWebServiceBL │
│ - DTO ↔ Entity conversion │
│ - Delegates to BL │
└─────────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────────┐
│ Business Logic Layer │
│ HelpdeskCreationTemplateBL │
│ - Business rules enforcement │
│ - Data validation │
│ - Standard template management │
└─────────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────────┐
│ Data Access Layer │
│ DAOSession / NHibernate │
│ - HelpdeskCreationTemplateMaps (FluentNHibernate) │
│ - HelpdeskCreationTemplate (Entity) │
└─────────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────────┐
│ Database │
│ SQL Server 2019+ │
│ - HelpdeskCreationTemplate table │
└─────────────────────────────────────────────────────────────┘
Design Patterns Used
- MVVM (Model-View-ViewModel): Separation of UI and business logic
- Result Pattern:
Result<T>for error handling - Repository Pattern: DAO layer with NHibernate
- DTO Pattern: Data transfer between layers
- Command Pattern: DelegateCommand for UI actions
- Soft Delete Pattern:
IsDeletedflag instead of physical deletion - Singleton Pattern: ClassContainer for dependency injection
- Observer Pattern: INotifyPropertyChanged for data binding
Usage Guide
Creating a New Template
- Fill in all desired values in the form
- Click "Als Vorlage speichern"
- Enter a template name
- Choose whether to set it as standard
- Click OK
- Template is saved and automatically selected
Loading a Template
- Select template from dropdown
- All form fields populate with template values
- Modify fields as needed
- Click "Speichern" to save changes (updates both ApplicationSettings AND the template)
Setting a Template as Standard
- Select template from dropdown
- Click "Als Standard setzen"
- Template is marked as standard (only one template can be standard)
- Standard template displays with checkmark icon and bold text
Deleting a Template
- Select template from dropdown
- Click "Vorlage löschen"
- Confirm deletion
- Template is soft-deleted (marked as
IsDeleted = true) - Note: Cannot delete the standard template
Updating a Template
- Select template from dropdown
- Modify form fields
- Click "Speichern" (main save button)
- Template is automatically updated with new values
Clearing Fields
- Select "Keine" from the dropdown
- All form fields are cleared
- Manually enter values
- Click "Speichern" to save only to ApplicationSettings (no template)
Configuration
Dialog Settings
All dialogs use the codebase standard pattern:
// Input dialog
var result = await CentronApplication.Instance.DialogManager.ShowInputDialog(
title,
new InputDialogOptions { ... }
);
// Confirmation dialog
await CentronApplication.Instance.DialogManager.ShowConfirmationDialog(
message,
title
);
// Choice dialog
var choice = await CentronApplication.Instance.DialogManager.ShowDialog(
message,
title,
"Button1",
"Button2"
);
Enum Values
CreateTicketsMode
public enum CreateTicketsMode
{
Single = 0, // Create separate ticket for each position
Group = 1, // Create one ticket for all positions
Custom = 2 // User selects which positions get tickets
}
Testing Scenarios
Test Case 1: First Time User
- Given: User opens settings for the first time
- When: UI loads
- Then: No template selected, fields show ApplicationSettings values
Test Case 2: Saved Template Exists
- Given: User previously selected template ID 5
- When: UI loads
- Then: Template ID 5 is selected in dropdown, fields show ApplicationSettings values
Test Case 3: Saved Template Deleted
- Given: User previously selected template ID 5, but it was deleted
- When: UI loads
- Then: Dropdown shows "Keine", fields show ApplicationSettings values
Test Case 4: Create Template
- Given: User fills form with values
- When: User clicks "Als Vorlage speichern" and enters name
- Then: New template created, automatically selected, fields unchanged
Test Case 5: Update Template
- Given: User has template selected, modifies fields
- When: User clicks "Speichern"
- Then: ApplicationSettings saved, template updated, fields unchanged, template stays selected
Test Case 6: Delete Template
- Given: User has template selected
- When: User clicks "Vorlage löschen" and confirms
- Then: Template soft-deleted, dropdown shows "Keine", fields unchanged
Test Case 7: Set Standard
- Given: User has template selected (not standard)
- When: User clicks "Als Standard setzen"
- Then: Template marked as standard, displays bold with checkmark, fields unchanged
Test Case 8: Clear Fields
- Given: User has template selected with values
- When: User selects "Keine" from dropdown
- Then: All fields cleared, ready for manual entry
Known Limitations
- Standard Template Deletion: Cannot delete a template marked as standard (must set another template as standard first)
- Single Standard: Only one template can be marked as standard at a time
- Soft Delete: Deleted templates remain in database with
IsDeleted = true
Future Enhancements
Potential improvements for future versions:
- Template Export/Import: Export templates to file for sharing between systems
- Template Versioning: Track template changes over time
- User-Specific Templates: Allow users to have private templates
- Template Categories: Organize templates into categories
- Template Permissions: Control who can create/edit/delete templates
- Bulk Template Operations: Apply template to multiple orders at once
- Template Statistics: Track how often each template is used
Migration Notes
Upgrading from Previous Version
- Database: ScriptMethod11751 runs automatically during update
- ApplicationSettings: New settings are auto-created on first access
- Existing Data: All existing automatic ticket creation settings remain intact
- Templates: Start with empty template list (users create as needed)
Rollback Considerations
If rollback is needed:
- ApplicationSettings remain (no data loss)
- HelpdeskCreationTemplate table can be safely dropped
- No impact on existing ticket creation functionality
Support and Troubleshooting
Common Issues
Issue: Template name disappears after saving Solution: Fixed - template now updates in-place without losing reference
Issue: Fields clear when setting template as standard
Solution: Fixed - _isLoadingTemplate flag prevents unwanted clearing
Issue: Cannot update template Solution: Fixed - main "Speichern" button now updates selected template
Issue: Template not loading on UI open Solution: Verify ApplicationSettingID 10445 contains valid template I3D
Debug Tips
- Check
HelpdeskCreationTemplatetable for template data - Verify
ApplicationSettingstable for setting ID 10445 - Check
_isLoadingTemplateflag state during operations - Verify
TemplatesObservableCollection contains templates - Check
SelectedTemplateproperty value
Code Review Checklist
- ✅ Result pattern used consistently
- ✅ Soft delete pattern implemented
- ✅ Standard tracking columns present
- ✅ UTF-8 with BOM encoding for C# files
- ✅ German localization for UI text
- ✅ English descriptions for ApplicationSettings
- ✅ NHibernate mappings correct
- ✅ Business logic in BL layer (not UI)
- ✅ DTO conversion in WebServiceBL
- ✅ Dialog patterns follow codebase standards
- ✅ MVVM pattern properly implemented
- ✅ Commands use DelegateCommand
- ✅ ObservableCollection for data binding
- ✅ Proper disposal of ClassContainer instances
- ✅ Async/await used correctly
- ✅ Error handling with Result pattern
- ✅ No hardcoded strings (use LocalizedStrings)
Related Documentation
- ApplicationSettings Pattern
- Dialog Manager Usage
- MVVM Guidelines
- Database Script Creation
- NHibernate Best Practices
Version History
| Version | Date | Changes |
|---|---|---|
| 1.0.0 | 2026-02-12 | Initial implementation with full template system |
Contributors
- Developer: Implementation of template system and UI
- Code Review: Verified patterns and architecture
- Testing: User acceptance testing
End of Documentation