Schablonenkomposition: Basisprozess external.booking mit Platz für Finanz- und Dokumentenschablonen
Vier Schablonen (Eigenes/Portal-Inkasso, Eigene/Externe Vertragsdokumentation) in app/Process/Templates, TemplateComposer prüft Ergebnisse, Verantwortlichkeiten, Ausschlüsse und harte Modulabhängigkeiten. Der Plan friert die Schablonenversionen ein. A3–A5 bleiben als Voreinstellungen; die vierte Kombination (eigenes Inkasso + externe Unterlagen) ist darstellbar. Konfigurator-Logik und ConfigureChannelProcess kennen die Schablonenwahl. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
381720763c
commit
e95ba4f986
24 files changed
+1666
-37
No files matched your search
@@ -7,6 +7,7 @@
|
||||
use App\Models\Channel;
|
||||
use App\Process\ChannelCapabilities;
|
||||
use App\Process\ChannelProcessConfiguration;
|
||||
use App\Process\ProcessCatalogue;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
|
||||
@@ -23,10 +24,10 @@ class ConfigureChannelProcess
|
||||
{
|
||||
public const HISTORY_LIMIT = 20;
|
||||
|
||||
public function __construct(private ChannelProcessConfiguration $configuration, private ChannelCapabilities $capabilities) {}
|
||||
public function __construct(private ChannelProcessConfiguration $configuration, private ChannelCapabilities $capabilities, private ProcessCatalogue $catalogue) {}
|
||||
|
||||
/**
|
||||
* @param array{model: string, variant?: string, steps?: array<string, array{on?: bool}>, settings?: array<string, mixed>, capabilities?: array<string, bool|string|null>} $draft
|
||||
* @param array{model: string, variant?: string, steps?: array<string, array{on?: bool}>, settings?: array<string, mixed>, templates?: array<string, string>, capabilities?: array<string, bool|string|null>} $draft
|
||||
* @param bool $acknowledgeConflicts the landlord confirmed that stored settings the model overrides are removed
|
||||
*
|
||||
* @throws ValidationException
|
||||
@@ -38,7 +39,7 @@ public function handle(Channel $channel, IntakeKind $intake, array $draft, ?stri
|
||||
throw ValidationException::withMessages(['process' => $problems]);
|
||||
}
|
||||
|
||||
$conflicts = $this->configuration->conflicts($channel, $intake, (string) $draft['model']);
|
||||
$conflicts = $this->configuration->conflicts($channel, $intake, (string) $draft['model'], (array) ($draft['templates'] ?? []));
|
||||
if ($conflicts !== [] && ! $acknowledgeConflicts) {
|
||||
throw ValidationException::withMessages(['process' => [
|
||||
'Bisherige Einstellungen widersprechen dem gewählten Modell und würden still überstimmt. Bitte ausdrücklich bestätigen, dass sie entfernt werden:',
|
||||
@@ -71,11 +72,19 @@ public function handle(Channel $channel, IntakeKind $intake, array $draft, ?stri
|
||||
}
|
||||
}
|
||||
|
||||
// A model with slots always stores its explicit template choice (keys; the version is frozen with each new case).
|
||||
$model = $this->catalogue->model((string) $draft['model']);
|
||||
$templates = array_map(fn (string $reference): string => explode('@', $reference)[0], $this->configuration->templatesOf($model, $draft));
|
||||
if ($model->slots() === []) {
|
||||
$templates = [];
|
||||
}
|
||||
|
||||
$overrides[$intake->value] = [
|
||||
...$settings,
|
||||
'model' => $draft['model'],
|
||||
'variant' => $draft['variant'] ?? 'standard',
|
||||
'steps' => $steps,
|
||||
'templates' => $templates,
|
||||
'configured_at' => now()->toIso8601String(),
|
||||
'configured_by' => $by,
|
||||
];
|
||||
@@ -88,7 +97,7 @@ public function handle(Channel $channel, IntakeKind $intake, array $draft, ?stri
|
||||
$changes = $confirmed['changes'];
|
||||
}
|
||||
$channelSettings['process_history'] = array_slice([...(array) ($channelSettings['process_history'] ?? []), [
|
||||
'at' => now()->toIso8601String(), 'by' => $by, 'intake' => $intake->value, 'model' => $draft['model'], 'variant' => $draft['variant'] ?? 'standard',
|
||||
'at' => now()->toIso8601String(), 'by' => $by, 'intake' => $intake->value, 'model' => $draft['model'], 'variant' => $draft['variant'] ?? 'standard', 'templates' => $templates,
|
||||
'capabilities' => $changes, 'removed_settings' => array_map(fn (array $conflict): string => $conflict['text'], $conflicts),
|
||||
]], -self::HISTORY_LIMIT);
|
||||
|
||||
|
||||
Reference in new issue
Block a user