adasd
All checks were successful
Deploy / deploy-production (push) Has been skipped
Deploy / deploy-staging (push) Successful in 5s

This commit is contained in:
2026-05-09 01:47:22 +02:00
parent de99f21332
commit c6642c0ef5
5 changed files with 302 additions and 40 deletions

View File

@@ -48,6 +48,17 @@ foreach ($fields as $field) {
}
$isFxRatesSetup = $moduleName === 'fx-rates';
$current = modules()->settings($moduleName);
$runtimeSettingsEnabled = modules()->hasFunction($moduleName, 'runtime_settings');
if ($runtimeSettingsEnabled) {
try {
$runtimeSettings = module_fn($moduleName, 'runtime_settings');
if (is_array($runtimeSettings)) {
$current = array_replace_recursive($current, $runtimeSettings);
}
} catch (\Throwable $e) {
$error = $e->getMessage();
}
}
$intervalTaskStatuses = [];
$cronTaskDefinitions = modules()->cronTasks($moduleName);
$cronTaskStatuses = [];
@@ -405,15 +416,23 @@ $renderField = function (array $field) use (&$current, $getNested, $driverOption
$type = (string)($field['type'] ?? 'text');
$required = !empty($field['required']);
$help = (string)($field['help'] ?? $field['description'] ?? '');
$options = is_array($field['options'] ?? null) ? $field['options'] : [];
$postKey = str_replace('.', '_', $name);
$value = '';
if ($name === 'kea_auto_init') {
$value = !empty($current[$name]) ? '1' : '0';
} elseif (str_contains($name, '.')) {
$value = (string)($getNested($current, $name) ?? '');
$value = $getNested($current, $name);
} else {
$value = (string)($current[$name] ?? '');
$value = $current[$name] ?? '';
}
if (is_array($value)) {
$value = $type === 'multiselect'
? array_values(array_map('strval', $value))
: implode(', ', array_values(array_map('strval', $value)));
} else {
$value = (string) $value;
}
?>
<label class="setup-field muted">
@@ -425,6 +444,38 @@ $renderField = function (array $field) use (&$current, $getNested, $driverOption
<option value="<?= e($driver) ?>" <?= $value === $driver ? 'selected' : '' ?>><?= e($driverLabel) ?></option>
<?php endforeach; ?>
</select>
<?php elseif ($type === 'select' && $options !== []): ?>
<select name="<?= e($postKey) ?>" <?= $required ? 'required' : '' ?>>
<option value="">Bitte waehlen</option>
<?php foreach ($options as $optionValue => $optionLabel): ?>
<?php
if (is_int($optionValue) && is_array($optionLabel)) {
$optionValue = (string) ($optionLabel['value'] ?? '');
$optionLabel = (string) ($optionLabel['label'] ?? $optionValue);
} else {
$optionValue = (string) $optionValue;
$optionLabel = (string) $optionLabel;
}
?>
<option value="<?= e($optionValue) ?>" <?= $value === $optionValue ? 'selected' : '' ?>><?= e($optionLabel) ?></option>
<?php endforeach; ?>
</select>
<?php elseif ($type === 'multiselect' && $options !== []): ?>
<?php $selectedValues = is_array($value) ? $value : []; ?>
<select name="<?= e($postKey) ?>[]" multiple size="<?= e((string) min(8, max(4, count($options)))) ?>" <?= $required ? 'required' : '' ?>>
<?php foreach ($options as $optionValue => $optionLabel): ?>
<?php
if (is_int($optionValue) && is_array($optionLabel)) {
$optionValue = (string) ($optionLabel['value'] ?? '');
$optionLabel = (string) ($optionLabel['label'] ?? $optionValue);
} else {
$optionValue = (string) $optionValue;
$optionLabel = (string) $optionLabel;
}
?>
<option value="<?= e($optionValue) ?>" <?= in_array($optionValue, $selectedValues, true) ? 'selected' : '' ?>><?= e($optionLabel) ?></option>
<?php endforeach; ?>
</select>
<?php elseif ($type === 'textarea'): ?>
<textarea name="<?= e($postKey) ?>" rows="3" <?= $required ? 'required' : '' ?>><?= e($value) ?></textarea>
<?php elseif ($type === 'checkbox'): ?>
@@ -620,9 +671,15 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
'groups' => array_merge($selectedGroups, $manualGroupValues),
]);
}
if ($isFxRatesSetup && modules()->hasFunction($moduleName, 'save_runtime_settings')) {
if (modules()->hasFunction($moduleName, 'save_runtime_settings')) {
module_fn($moduleName, 'save_runtime_settings', $payload);
$current = modules()->settings($moduleName);
if ($runtimeSettingsEnabled) {
$runtimeSettings = module_fn($moduleName, 'runtime_settings');
if (is_array($runtimeSettings)) {
$current = array_replace_recursive($current, $runtimeSettings);
}
}
}
$refreshSchedulerState();
if ($submittedSetupSection === 'general' && array_key_exists('debug_enabled', $payload) && empty($payload['debug_enabled'])) {