summaryrefslogtreecommitdiffstats
path: root/modules-available/serversetup-bwlp-ipxe/page.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2020-01-17 12:54:11 +0100
committerSimon Rettberg2020-01-17 12:54:11 +0100
commit5ce52195fb7240aa3405344a6d7a31858e55c0f7 (patch)
treea82849481ebcadee6a56519ed3716cce8f7d3bdc /modules-available/serversetup-bwlp-ipxe/page.inc.php
parent[sysconfig] Screensaver: Pagereload (lang change) and small ui bugfix (diff)
downloadslx-admin-5ce52195fb7240aa3405344a6d7a31858e55c0f7.tar.gz
slx-admin-5ce52195fb7240aa3405344a6d7a31858e55c0f7.tar.xz
slx-admin-5ce52195fb7240aa3405344a6d7a31858e55c0f7.zip
[serversetup-bwlp-ipxe] Make first menu being added the default
Diffstat (limited to 'modules-available/serversetup-bwlp-ipxe/page.inc.php')
-rw-r--r--modules-available/serversetup-bwlp-ipxe/page.inc.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/modules-available/serversetup-bwlp-ipxe/page.inc.php b/modules-available/serversetup-bwlp-ipxe/page.inc.php
index b3c9917c..511f15f9 100644
--- a/modules-available/serversetup-bwlp-ipxe/page.inc.php
+++ b/modules-available/serversetup-bwlp-ipxe/page.inc.php
@@ -667,7 +667,9 @@ class Page_ServerSetup extends Page
'timeoutms' => abs(Request::post('timeout', 0, 'int') * 1000),
];
if ($id === 0) {
- Database::exec("INSERT INTO serversetup_menu (title, timeoutms, isdefault) VALUES (:title, :timeoutms, 0)", $insertParams);
+ $num = Database::queryFirst("SELECT Count(*) AS cnt FROM serversetup_menu");
+ $insertParams['def'] = ($num['cnt'] == 0) ? 1 : 0;
+ Database::exec("INSERT INTO serversetup_menu (title, timeoutms, isdefault) VALUES (:title, :timeoutms, :def)", $insertParams);
$menu['menuid'] = $id = Database::lastInsertId();
} else {
$menu = Database::queryFirst("SELECT m.menuid