summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorPhilip Häusler <msquare@notrademark.de>2014-12-07 19:46:56 +0100
committerPhilip Häusler <msquare@notrademark.de>2014-12-07 19:47:02 +0100
commitf4fa7f5d33fdaf8022df4dfe6b8b9f4b899c61a3 (patch)
treefae0c44ffaf17e98ae9dcc057822b89a4dbf8f0c /includes
parent07b9de84c5c28631173c848fe701f4cd9468ba81 (diff)
union shift update model
Diffstat (limited to 'includes')
-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);
}
/**