From f4fa7f5d33fdaf8022df4dfe6b8b9f4b899c61a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20H=C3=A4usler?= Date: Sun, 7 Dec 2014 19:46:56 +0100 Subject: [PATCH 1/2] union shift update model --- includes/model/Shifts_model.php | 14 +++++++------- 1 file 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); } /** From a4a4a0aecc789bde93b9f1e06f3a51de7c5e1baf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20H=C3=A4usler?= Date: Sun, 7 Dec 2014 19:47:36 +0100 Subject: [PATCH 2/2] fix missing ; --- includes/mailer/shifts_mailer.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/mailer/shifts_mailer.php b/includes/mailer/shifts_mailer.php index 347b2887..c9d20976 100644 --- a/includes/mailer/shifts_mailer.php +++ b/includes/mailer/shifts_mailer.php @@ -72,7 +72,7 @@ function mail_shift_assign($user, $shift) { if ($user["email_shiftinfo"]) { $room = Room($shift["RID"]); - $message = _("You have been assigned to a Shift:") . "\n" + $message = _("You have been assigned to a Shift:") . "\n"; $message .= $shift["name"] . "\n"; $message .= date("y-m-d H:i", $shift["start"]) . " - " . date("H:i", $shift["end"]) . "\n"; $message .= $room["Name"] . "\n"; @@ -85,7 +85,7 @@ function mail_shift_removed($user, $shift) { if ($user["email_shiftinfo"]) { $room = Room($shift["RID"]); - $message = _("You have been removed from a Shift:") . "\n" + $message = _("You have been removed from a Shift:") . "\n"; $message .= $shift["name"] . "\n"; $message .= date("y-m-d H:i", $shift["start"]) . " - " . date("H:i", $shift["end"]) . "\n"; $message .= $room["Name"] . "\n";