union shift update model

This commit is contained in:
Philip Häusler 2014-12-07 19:46:56 +01:00
parent 07b9de84c5
commit f4fa7f5d33
1 changed files with 7 additions and 7 deletions

View File

@ -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);
}
/**