Make occurrence market fields read-only
This commit is contained in:
1 parent
78cc6390f7
commit
95c42b342b
2 files changed
+3
-13
No files matched your search
@@ -66,13 +66,6 @@ if ($requestMethod === 'POST') {
|
||||
} elseif ($scope === 'day') {
|
||||
market_management_update_day($pdo, $id, $fields);
|
||||
} elseif (in_array($scope, ['occurrence', 'status', 'overview', 'participation', 'infrastructure', 'travel', 'notes'], true)) {
|
||||
$marketFields = [];
|
||||
foreach (['market_name', 'category_id', 'website_url'] as $marketField) {
|
||||
if (array_key_exists($marketField, $fields)) {
|
||||
$marketFields[$marketField === 'market_name' ? 'name' : $marketField] = $fields[$marketField];
|
||||
unset($fields[$marketField]);
|
||||
}
|
||||
}
|
||||
$contactFields = [];
|
||||
foreach (['contact_email', 'contact_phone'] as $contactField) {
|
||||
if (array_key_exists($contactField, $fields)) {
|
||||
@@ -81,12 +74,9 @@ if ($requestMethod === 'POST') {
|
||||
}
|
||||
}
|
||||
$existingOccurrence = null;
|
||||
if ($marketFields !== [] || $contactFields !== [] || array_key_exists('organization_contact_id', $fields) || array_key_exists('contact_person_id', $fields)) {
|
||||
if ($contactFields !== [] || array_key_exists('organization_contact_id', $fields) || array_key_exists('contact_person_id', $fields)) {
|
||||
$existingOccurrence = market_management_get_occurrence($pdo, $id, true);
|
||||
}
|
||||
if ($marketFields !== []) {
|
||||
market_management_update_market($pdo, (int) ($existingOccurrence['market_definition_id'] ?? 0), $marketFields);
|
||||
}
|
||||
if ($contactFields !== []) {
|
||||
$submittedContactId = trim((string) ($fields['contact_person_id'] ?? ''));
|
||||
$contactId = (int) ($submittedContactId !== '' ? $submittedContactId : ($existingOccurrence['contact_person_id'] ?? 0));
|
||||
|
||||
Reference in new issue
Block a user