diff --git a/app/Domains/CostUnit/Actions/ChangeCostUnitDetails/ChangeCostUnitDetailsCommand.php b/app/Domains/CostUnit/Actions/ChangeCostUnitDetails/ChangeCostUnitDetailsCommand.php
index 341b025..b687759 100644
--- a/app/Domains/CostUnit/Actions/ChangeCostUnitDetails/ChangeCostUnitDetailsCommand.php
+++ b/app/Domains/CostUnit/Actions/ChangeCostUnitDetails/ChangeCostUnitDetailsCommand.php
@@ -14,7 +14,7 @@ class ChangeCostUnitDetailsCommand {
$this->request->costUnit->distance_allowance = $this->request->distanceAllowance->getAmount();
$this->request->costUnit->mail_on_new = $this->request->mailOnNew;
- $this->request->costUnit->billing_deadline = $this->request->billingDeadline;
+ $this->request->costUnit->billing_deadline = $this->request->billingDeadline?->format('Y-m-d');
$response->success = $this->request->costUnit->save();
return $response;
diff --git a/app/Domains/CostUnit/Actions/CreateCostUnit/CreateCostUnitCommand.php b/app/Domains/CostUnit/Actions/CreateCostUnit/CreateCostUnitCommand.php
index 93129f5..ea7617a 100644
--- a/app/Domains/CostUnit/Actions/CreateCostUnit/CreateCostUnitCommand.php
+++ b/app/Domains/CostUnit/Actions/CreateCostUnit/CreateCostUnitCommand.php
@@ -17,7 +17,7 @@ class CreateCostUnitCommand {
'name' => $this->request->name,
'tenant' => currentTenant()->slug,
'type' => $this->request->type,
- 'billing_deadline' => $this->request->billingDeadline,
+ 'billing_deadline' => $this->request->billingDeadline?->format('Y-m-d'),
'distance_allowance' => $this->request->distanceAllowance->getAmount(),
'mail_on_new' => $this->request->mailOnNew,
'allow_new' => true,
diff --git a/app/Domains/CostUnit/Controllers/EditController.php b/app/Domains/CostUnit/Controllers/EditController.php
index 9bc5192..e3605ce 100644
--- a/app/Domains/CostUnit/Controllers/EditController.php
+++ b/app/Domains/CostUnit/Controllers/EditController.php
@@ -37,7 +37,10 @@ class EditController extends CommonController{
$saveParams = $request->get('formData');
$distanceAllowance = Amount::fromString($saveParams['distanceAllowance']);
- $billingDeadline = isset($saveParams['billingDeadline']) ? \DateTime::createFromFormat('Y-m-d', $saveParams['billingDeadline']) : null;
+ $rawBillingDeadline = $saveParams['billingDeadline'] ?? null;
+ $billingDeadline = !empty($rawBillingDeadline)
+ ? (\DateTime::createFromFormat('!Y-m-d', $rawBillingDeadline) ?: null)
+ : null;
$request = new ChangeCostUnitDetailsRequest($costUnit, $distanceAllowance, $saveParams['mailOnNew'], $billingDeadline);
$command = new ChangeCostUnitDetailsCommand($request);
diff --git a/app/Domains/Invoice/Controllers/SaveInvoiceController.php b/app/Domains/Invoice/Controllers/SaveInvoiceController.php
index 649958d..df1c8e8 100644
--- a/app/Domains/Invoice/Controllers/SaveInvoiceController.php
+++ b/app/Domains/Invoice/Controllers/SaveInvoiceController.php
@@ -26,6 +26,18 @@ class SaveInvoiceController extends CommonController
]);
}
+ // Sicherheitsnetz hinter der Oberfläche: Wer gereist ist, steht im Zahlungsgrund auf Beleg und EüR und
+ // ist bei Fahrtkosten Pflicht. Geprüft wird hier und nicht im Command, weil auch Abrechnungskorrekturen
+ // durch den Command laufen -- sie bringen ihren Zahlungsgrund mit, aber keine Personen. Und vor dem
+ // Upload, damit eine abgelehnte Einreichung keinen verwaisten Beleg hinterlässt.
+ if ($invoiceType === InvoiceType::INVOICE_TYPE_TRAVELLING
+ && Validator::make($request->all(), ['travellers' => 'required|string'])->fails()) {
+ return response()->json([
+ 'status' => 'error',
+ 'message' => 'Bitte gib an, welche Personen gereist sind.'
+ ]);
+ }
+
$uploadedFile = null;
if (null !== $request->file('receipt')) {
$maxFileSize = env('MAX_INVOICE_FILE_SIZE', 16);
diff --git a/app/Domains/Invoice/Views/Partials/newInvoice/travel-expense-accounting.vue b/app/Domains/Invoice/Views/Partials/newInvoice/travel-expense-accounting.vue
index 1438c33..78b3029 100644
--- a/app/Domains/Invoice/Views/Partials/newInvoice/travel-expense-accounting.vue
+++ b/app/Domains/Invoice/Views/Partials/newInvoice/travel-expense-accounting.vue
@@ -41,10 +41,11 @@ const travelReasonComplete = computed(() =>
/**
* Wer gereist ist, steht später als Zahlungsgrund in der Belegliste, auf der EüR und auf dem Beleg. Wer
* den Beleg einreicht, war meist selbst dabei -- deshalb der eigene Name als Vorschlag. Ohne Login
- * bleibt das Feld leer, und es hält den Ablauf auch dann nicht auf: Ein Name ist eine Hilfe, keine
- * Bedingung.
+ * bleibt das Feld leer; weiter geht es erst, wenn jemand eingetragen ist -- wie beim Reisegrund.
*/
const travellers = ref(data.userName || '');
+
+const travellersComplete = computed(() => travellers.value.trim() !== '');
const have_receipt = ref('')
const amount = ref(0.00);
const invoiceType = ref(null);
@@ -121,7 +122,7 @@ function handleFileChange(event) {
/>