add shift delete model
This commit is contained in:
parent
d26f8aa12c
commit
b75700ee1b
|
@ -1,5 +1,19 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a shift by its external id.
|
||||||
|
*/
|
||||||
|
function Shift_delete_by_psid($shift_psid) {
|
||||||
|
return sql_query("DELETE FROM `Shifts` WHERE `PSID`=" . sql_escape($shift_psid));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a shift.
|
||||||
|
*/
|
||||||
|
function Shift_delete($shift_id) {
|
||||||
|
return sql_query("DELETE FROM `Shifts` WHERE `SID`=" . sql_escape($shift_id));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update a shift.
|
* Update a shift.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -129,8 +129,11 @@ function admin_import() {
|
||||||
engelsystem_error('Unable to update shift.');
|
engelsystem_error('Unable to update shift.');
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($events_deleted as $event)
|
foreach ($events_deleted as $event) {
|
||||||
sql_query("DELETE FROM `Shifts` WHERE `PSID`=" . sql_escape($event['PSID']) . " LIMIT 1");
|
$result = Shift_delete_by_psid($event['PSID']);
|
||||||
|
if ($result === false)
|
||||||
|
engelsystem_error('Unable to delete shift.');
|
||||||
|
}
|
||||||
|
|
||||||
engelsystem_log("Pentabarf import done");
|
engelsystem_log("Pentabarf import done");
|
||||||
|
|
||||||
|
|
|
@ -178,8 +178,9 @@ function user_shifts() {
|
||||||
|
|
||||||
// Schicht löschen bestätigt
|
// Schicht löschen bestätigt
|
||||||
if (isset($_REQUEST['delete'])) {
|
if (isset($_REQUEST['delete'])) {
|
||||||
sql_query("DELETE FROM `NeededAngelTypes` WHERE `shift_id`=" . sql_escape($shift_id));
|
$result = Shift_delete($shift_id);
|
||||||
sql_query("DELETE FROM `Shifts` WHERE `SID`=" . sql_escape($shift_id) . " LIMIT 1");
|
if ($result === false)
|
||||||
|
engelsystem_error('Unable to delete shift.');
|
||||||
|
|
||||||
engelsystem_log("Deleted shift " . $shift['name'] . " from " . date("y-m-d H:i", $shift['start']) . " to " . date("y-m-d H:i", $shift['end']));
|
engelsystem_log("Deleted shift " . $shift['name'] . " from " . date("y-m-d H:i", $shift['start']) . " to " . date("y-m-d H:i", $shift['end']));
|
||||||
success(_("Shift deleted."));
|
success(_("Shift deleted."));
|
||||||
|
|
Loading…
Reference in New Issue