summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Favre <gnomus@gnomus.de>2014-12-07 19:49:31 +0100
committerFelix Favre <gnomus@gnomus.de>2014-12-07 19:49:31 +0100
commitf199c1f08abb2e545b3a736e3546c81013da3900 (patch)
tree2b3218174d90636a265b46de9b18d9d0f87e14af
parenta3718cca527b867e582cfb6f3a5747a802f8c1a0 (diff)
parenta4a4a0aecc789bde93b9f1e06f3a51de7c5e1baf (diff)
Merge branch 'master' of github.com:engelsystem/engelsystem
-rw-r--r--includes/model/Shifts_model.php14
1 files changed, 7 insertions, 7 deletions
diff --git a/includes/model/Shifts_model.php b/includes/model/Shifts_model.php
index 43ff0c91..11309e11 100644
--- a/includes/model/Shifts_model.php
+++ b/includes/model/Shifts_model.php
@@ -39,13 +39,13 @@ function Shift_update($shift) {
* Update a shift by its external id.
*/
function Shift_update_by_psid($shift) {
- return sql_query("UPDATE `Shifts` SET
- `start`=" . sql_escape($shift['start']) . ",
- `end`=" . sql_escape($shift['end']) . ",
- `RID`=" . sql_escape($shift['RID']) . ",
- `name`=" . sql_null($shift['name']) . ",
- `URL`=" . sql_null($shift['URL']) . "
- WHERE `PSID`=" . sql_escape($shift['PSID']));
+ $shift_source = sql_select("SELECT `SID` FROM `Shifts` WHERE `PSID`=" . $shift['PSID']);
+ if ($shift_source === false)
+ return false;
+ if (count($shift_source) == 0)
+ return null;
+ $shift['SID'] = $shift_source['SID'];
+ return Shift_update($shift);
}
/**