summaryrefslogtreecommitdiffstats
path: root/modules-available/locations/install.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2021-03-19 13:54:22 +0100
committerSimon Rettberg2021-03-19 13:54:22 +0100
commit4c0862efe57fbdaa51a69c8dc39f6fc4ae45fa20 (patch)
treecf5d472d2bea7a4ba43339bf892db6dad710e51c /modules-available/locations/install.inc.php
parent[locations] Add permission for openingtimes (diff)
downloadslx-admin-4c0862efe57fbdaa51a69c8dc39f6fc4ae45fa20.tar.gz
slx-admin-4c0862efe57fbdaa51a69c8dc39f6fc4ae45fa20.tar.xz
slx-admin-4c0862efe57fbdaa51a69c8dc39f6fc4ae45fa20.zip
[locations/rebootcontrol] Inherit openingtimes for WOL/shutdown
The opening times schedule is now inherited to child locations, so it's easy to toggle WOL or shutdown for individual rooms in a building, where you only have to set the opening times once for the entire building. As of now, WOL and shutdown settings are *not* inherited to child locations, as I'm not sure if you always want to inherit those by default. Closes #3710
Diffstat (limited to 'modules-available/locations/install.inc.php')
-rw-r--r--modules-available/locations/install.inc.php7
1 files changed, 5 insertions, 2 deletions
diff --git a/modules-available/locations/install.inc.php b/modules-available/locations/install.inc.php
index c5fd9688..46a6544c 100644
--- a/modules-available/locations/install.inc.php
+++ b/modules-available/locations/install.inc.php
@@ -15,7 +15,7 @@ $res[] = tableCreate('location', '
`locationid` INT(11) NOT NULL AUTO_INCREMENT,
`parentlocationid` INT(11) NOT NULL,
`locationname` VARCHAR(100) NOT NULL,
- `openingtime` BLOB,
+ `openingtime` BLOB DEFAULT NULL,
PRIMARY KEY (`locationid`),
KEY `locationname` (`locationname`),
KEY `parentlocationid` (`parentlocationid`)
@@ -40,7 +40,7 @@ $res[] = tableAddConstraint('setting_location', 'locationid', 'location', 'locat
// 2020-07-14 Add openingtime column to location table, then migrate data and delete the column from locationinfo
if (!tableHasColumn('location', 'openingtime')) {
- if (Database::exec("ALTER TABLE location ADD openingtime BLOB") === false) {
+ if (Database::exec("ALTER TABLE location ADD openingtime BLOB DEFAULT NULL") === false) {
finalResponse(UPDATE_FAILED, 'Could not create openingtime column');
}
$res[] = UPDATE_DONE;
@@ -60,5 +60,8 @@ if (tableHasColumn('locationinfo_locationconfig', 'openingtime')) {
$res[] = UPDATE_DONE;
}
+// 2021-03-19: Fix this. No idea how this came to be, maybe during dev only? But better be safe...
+Database::exec("UPDATE location SET openingtime = NULL WHERE openingtime = ''");
+
// Create response for browser
responseFromArray($res);