Allow saving without contact details
This commit is contained in:
1 parent
28784ed6ac
commit
2862d7a6e9
1 file changed
+6
-1
@@ -64,7 +64,12 @@ if ($requestMethod === 'POST') {
|
||||
if ($contactFields !== []) {
|
||||
$submittedContactId = trim((string) ($fields['contact_person_id'] ?? ''));
|
||||
$contactId = (int) ($submittedContactId !== '' ? $submittedContactId : ($existingOccurrence['contact_person_id'] ?? 0));
|
||||
update_contact_details($pdo, $contactId, $contactFields);
|
||||
$hasContactValue = array_reduce($contactFields, static fn (bool $carry, mixed $value): bool => $carry || trim((string) $value) !== '', false);
|
||||
if ($contactId > 0 && ($hasContactValue || $submittedContactId !== '')) {
|
||||
update_contact_details($pdo, $contactId, $contactFields);
|
||||
} elseif ($hasContactValue) {
|
||||
throw new InvalidArgumentException('Für E-Mail oder Telefon muss eine Kontaktperson ausgewählt sein.');
|
||||
}
|
||||
}
|
||||
$organizerFields = [];
|
||||
foreach (['organization_contact_id', 'contact_person_id'] as $organizerField) {
|
||||
|
||||
Reference in new issue
Block a user