diff options
author | Simon Rettberg | 2017-04-07 14:47:44 +0200 |
---|---|---|
committer | Simon Rettberg | 2017-04-07 14:47:44 +0200 |
commit | 016ebfe0affc86e14115afe34d415bc58f9164b3 (patch) | |
tree | 647d7ae8108868ed3d21229820892aa53ae4c7a4 /modules-available/statistics | |
parent | Merge branch 'statistics_reporting' (diff) | |
download | slx-admin-016ebfe0affc86e14115afe34d415bc58f9164b3.tar.gz slx-admin-016ebfe0affc86e14115afe34d415bc58f9164b3.tar.xz slx-admin-016ebfe0affc86e14115afe34d415bc58f9164b3.zip |
[statistics] Better errormsg in install, link to projectors added
Diffstat (limited to 'modules-available/statistics')
-rw-r--r-- | modules-available/statistics/install.inc.php | 15 | ||||
-rw-r--r-- | modules-available/statistics/templates/machine-main.html | 2 |
2 files changed, 11 insertions, 6 deletions
diff --git a/modules-available/statistics/install.inc.php b/modules-available/statistics/install.inc.php index 5d8ce1bc..79346f99 100644 --- a/modules-available/statistics/install.inc.php +++ b/modules-available/statistics/install.inc.php @@ -201,16 +201,21 @@ if ($addTrigger) { } if ($machineHwCreate === UPDATE_DONE) { - $ret = true; $ret = Database::exec('ALTER TABLE `machine_x_hw` ADD CONSTRAINT `machine_x_hw_ibfk_1` FOREIGN KEY (`hwid`) REFERENCES `statistic_hw` (`hwid`) ON DELETE CASCADE, - ADD CONSTRAINT `machine_x_hw_ibfk_2` FOREIGN KEY (`machineuuid`) REFERENCES `machine` (`machineuuid`) ON DELETE CASCADE') && $ret; + ADD CONSTRAINT `machine_x_hw_ibfk_2` FOREIGN KEY (`machineuuid`) REFERENCES `machine` (`machineuuid`) ON DELETE CASCADE'); + if ($ret === false) { + finalResponse(UPDATE_FAILED, 'Adding constraints to machine_x_hw failed: ' . Database::lastError()); + } $ret = Database::exec('ALTER TABLE `machine_x_hw_prop` - ADD CONSTRAINT `machine_x_hw_prop_ibfk_1` FOREIGN KEY (`machinehwid`) REFERENCES `machine_x_hw` (`machinehwid`) ON DELETE CASCADE') && $ret; + ADD CONSTRAINT `machine_x_hw_prop_ibfk_1` FOREIGN KEY (`machinehwid`) REFERENCES `machine_x_hw` (`machinehwid`) ON DELETE CASCADE'); + if ($ret === false) { + finalResponse(UPDATE_FAILED, 'Adding constraint to machine_x_hw_prop failed: ' . Database::lastError()); + } $ret = Database::exec('ALTER TABLE `statistic_hw_prop` - ADD CONSTRAINT `statistic_hw_prop_ibfk_1` FOREIGN KEY (`hwid`) REFERENCES `statistic_hw` (`hwid`) ON DELETE CASCADE') && $ret; + ADD CONSTRAINT `statistic_hw_prop_ibfk_1` FOREIGN KEY (`hwid`) REFERENCES `statistic_hw` (`hwid`) ON DELETE CASCADE'); if ($ret === false) { - finalResponse(UPDATE_FAILED, 'Adding foreign key machineuuid to hardware* failed: ' . Database::lastError()); + finalResponse(UPDATE_FAILED, 'Adding constraint to statistic_hw_prop failed: ' . Database::lastError()); } } diff --git a/modules-available/statistics/templates/machine-main.html b/modules-available/statistics/templates/machine-main.html index 56454e78..bdc51167 100644 --- a/modules-available/statistics/templates/machine-main.html +++ b/modules-available/statistics/templates/machine-main.html @@ -145,7 +145,7 @@ <div class="small"> <div class="pull-right btn-group btn-group-xs"> {{#projector}} - <span class="btn btn-default">{{lang_projector}}</span> + <a href="?do=statistics&show=projectors" class="btn btn-default">{{lang_projector}}</a> <button form="delprojector" type="submit" name="hwid" value="{{hwid}}" class="btn btn-danger"><span class="glyphicon glyphicon-remove"></span></button> {{/projector}} |