diff options
author | Jannik Schönartz | 2017-02-21 18:50:16 +0100 |
---|---|---|
committer | Jannik Schönartz | 2017-02-21 18:50:16 +0100 |
commit | cde94f4890eaa96b82e726dbd938bba841ff1df6 (patch) | |
tree | 1a9f739b253393ff67e18805f6a965635d968fdd /modules-available | |
parent | Database: Changed login/passwd to credentials. install.php needs to be executed. (diff) | |
download | slx-admin-cde94f4890eaa96b82e726dbd938bba841ff1df6.tar.gz slx-admin-cde94f4890eaa96b82e726dbd938bba841ff1df6.tar.xz slx-admin-cde94f4890eaa96b82e726dbd938bba841ff1df6.zip |
API: Fixed a bug where parent locations werent added if the location didn't had an database entry.
Diffstat (limited to 'modules-available')
-rw-r--r-- | modules-available/locationinfo/api.inc.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/modules-available/locationinfo/api.inc.php b/modules-available/locationinfo/api.inc.php index 4b3a0462..8a8c01fd 100644 --- a/modules-available/locationinfo/api.inc.php +++ b/modules-available/locationinfo/api.inc.php @@ -309,13 +309,20 @@ function getOpeningTime($idList) { // Execute query. $dbquery = Database::simpleQuery($query); $dbresult = array(); - + $handledIds = array(); while($dbdata=$dbquery->fetch(PDO::FETCH_ASSOC)) { $data['id'] = $dbdata['locationid']; $data['openingtime'] = json_decode($dbdata['openingtime'], true); + $handledIds[] = $data['id']; $dbresult[] = $data; } $finalArray = array(); + $idList = array_diff($idList, $handledIds); + foreach ($idList as $id) { + $data['id'] = $id; + $data['openingtime'] = array(); + $dbresult[] = $data; + } // Go through the db entrys [id] = id; [openingtime] = e.g. [{"days":["Saturday","Sunday"],"openingtime":"12:32","closingtime":"14:35"}] foreach($dbresult as $entry) { |