fix: per_type is DB-only, main form save never touches it
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
3c79fac8d7
commit
ae5b7266d4
+3
-17
@@ -540,24 +540,10 @@ $routes = [
|
|||||||
$geminiModel = trim($_POST['gemini_model'] ?? '');
|
$geminiModel = trim($_POST['gemini_model'] ?? '');
|
||||||
if ($geminiModel !== '') $config['gemini_model'] = $geminiModel;
|
if ($geminiModel !== '') $config['gemini_model'] = $geminiModel;
|
||||||
|
|
||||||
// Per-category menus — base on DB value so form size limits can't wipe it
|
// per_type is managed exclusively via /admin/bot-config/save-per-type — copy as-is from DB
|
||||||
$perTypeMenus = $_POST['per_type_menu'] ?? [];
|
if (isset($existingConfig['per_type'])) {
|
||||||
$dbPerType = $existingConfig['per_type'] ?? [];
|
$config['per_type'] = $existingConfig['per_type'];
|
||||||
$perType = (is_array($dbPerType) && $dbPerType !== [] && !isset($dbPerType[0])) ? $dbPerType : [];
|
|
||||||
if (!empty($perTypeMenus)) {
|
|
||||||
// POST has per_type data — apply it on top of DB value
|
|
||||||
foreach ([1, 2, 3] as $cat) {
|
|
||||||
$mk = trim($perTypeMenus[$cat] ?? '');
|
|
||||||
$key = (string)$cat;
|
|
||||||
if ($mk !== '') {
|
|
||||||
$perType[$key] = array_merge($perType[$key] ?? [], ['greeting_menu' => $mk]);
|
|
||||||
} else {
|
|
||||||
unset($perType[$key]['greeting_menu']);
|
|
||||||
if (empty($perType[$key])) unset($perType[$key]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$config['per_type'] = empty($perType) ? new stdClass() : $perType;
|
|
||||||
|
|
||||||
// General
|
// General
|
||||||
$greeting = trim($_POST['greeting'] ?? '');
|
$greeting = trim($_POST['greeting'] ?? '');
|
||||||
|
|||||||
Reference in New Issue
Block a user