summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authormsquare <msquare@notrademark.de>2017-07-28 18:50:00 +0200
committermsquare <msquare@notrademark.de>2017-07-28 18:50:00 +0200
commit5794c4cab8f6ef0529dfc51343b5ec78b134fb2a (patch)
tree02651ade8969f2e1cb0c75e0fc9a91cac08f8121 /includes
parent144b453bc6b594ea16838a006eb20b04e5b5ec19 (diff)
clear delete queries from false resuls
Diffstat (limited to 'includes')
-rw-r--r--includes/controller/shift_entries_controller.php5
-rw-r--r--includes/controller/shifttypes_controller.php5
-rw-r--r--includes/controller/user_angeltypes_controller.php5
-rw-r--r--includes/controller/users_controller.php5
-rw-r--r--includes/model/AngelType_model.php7
-rw-r--r--includes/model/NeededAngelTypes_model.php6
-rw-r--r--includes/model/Room_model.php3
-rw-r--r--includes/model/ShiftEntry_model.php3
-rw-r--r--includes/model/ShiftTypes_model.php3
-rw-r--r--includes/model/Shifts_model.php14
-rw-r--r--includes/model/UserAngelTypes_model.php10
-rw-r--r--includes/model/UserDriverLicenses_model.php7
-rw-r--r--includes/model/User_model.php3
-rw-r--r--includes/pages/admin_import.php5
-rw-r--r--includes/pages/admin_rooms.php4
-rw-r--r--includes/pages/user_myshifts.php6
16 files changed, 17 insertions, 74 deletions
diff --git a/includes/controller/shift_entries_controller.php b/includes/controller/shift_entries_controller.php
index 54c57332..03d7a27f 100644
--- a/includes/controller/shift_entries_controller.php
+++ b/includes/controller/shift_entries_controller.php
@@ -269,10 +269,7 @@ function shift_entry_delete_controller()
redirect(page_link_to('user_shifts'));
}
- $result = ShiftEntry_delete($entry_id);
- if ($result === false) {
- engelsystem_error('Unable to delete shift entry.');
- }
+ ShiftEntry_delete($entry_id);
engelsystem_log(
'Deleted ' . User_Nick_render($shift_entry_source) . '\'s shift: ' . $shift_entry_source['name']
diff --git a/includes/controller/shifttypes_controller.php b/includes/controller/shifttypes_controller.php
index 790bbb56..f4791511 100644
--- a/includes/controller/shifttypes_controller.php
+++ b/includes/controller/shifttypes_controller.php
@@ -28,10 +28,7 @@ function shifttype_delete_controller()
}
if ($request->has('confirmed')) {
- $result = ShiftType_delete($shifttype['id']);
- if (empty($result)) {
- engelsystem_error('Unable to delete shifttype.');
- }
+ ShiftType_delete($shifttype['id']);
engelsystem_log('Deleted shifttype ' . $shifttype['name']);
success(sprintf(_('Shifttype %s deleted.'), $shifttype['name']));
diff --git a/includes/controller/user_angeltypes_controller.php b/includes/controller/user_angeltypes_controller.php
index 41185552..ab16139a 100644
--- a/includes/controller/user_angeltypes_controller.php
+++ b/includes/controller/user_angeltypes_controller.php
@@ -215,10 +215,7 @@ function user_angeltype_delete_controller()
}
if ($request->has('confirmed')) {
- $result = UserAngelType_delete($user_angeltype);
- if ($result === false) {
- engelsystem_error('Unable to delete user angeltype.');
- }
+ UserAngelType_delete($user_angeltype);
$success_message = sprintf(_('User %s removed from %s.'), User_Nick_render($user_source), $angeltype['name']);
engelsystem_log($success_message);
diff --git a/includes/controller/users_controller.php b/includes/controller/users_controller.php
index f441c8af..05b97716 100644
--- a/includes/controller/users_controller.php
+++ b/includes/controller/users_controller.php
@@ -76,10 +76,7 @@ function user_delete_controller()
}
if ($valid) {
- $result = User_delete($user_source['UID']);
- if ($result === false) {
- engelsystem_error('Unable to delete user.');
- }
+ User_delete($user_source['UID']);
mail_user_delete($user_source);
success(_('User deleted.'));
diff --git a/includes/model/AngelType_model.php b/includes/model/AngelType_model.php
index af213432..b9238467 100644
--- a/includes/model/AngelType_model.php
+++ b/includes/model/AngelType_model.php
@@ -77,20 +77,15 @@ function AngelType_contact_info($angeltype)
* Delete an Angeltype.
*
* @param array $angeltype
- * @return bool
*/
function AngelType_delete($angeltype)
{
- $result = DB::delete('
+ DB::delete('
DELETE FROM `AngelTypes`
WHERE `id`=?
LIMIT 1
', [$angeltype['id']]);
- if (is_null($result)) {
- engelsystem_error('Unable to delete angeltype.');
- }
engelsystem_log('Deleted angeltype: ' . AngelType_name_render($angeltype));
- return true;
}
/**
diff --git a/includes/model/NeededAngelTypes_model.php b/includes/model/NeededAngelTypes_model.php
index e77c715f..981c100a 100644
--- a/includes/model/NeededAngelTypes_model.php
+++ b/includes/model/NeededAngelTypes_model.php
@@ -35,22 +35,20 @@ function NeededAngelType_add($shift_id, $angeltype_id, $room_id, $count)
* Deletes all needed angel types from given shift.
*
* @param int $shift_id id of the shift
- * @return int count of affected rows
*/
function NeededAngelTypes_delete_by_shift($shift_id)
{
- return (int)DB::delete('DELETE FROM `NeededAngelTypes` WHERE `shift_id` = ?', [$shift_id]);
+ DB::delete('DELETE FROM `NeededAngelTypes` WHERE `shift_id` = ?', [$shift_id]);
}
/**
* Deletes all needed angel types from given room.
*
* @param int $room_id id of the room
- * @return int count of affected rows
*/
function NeededAngelTypes_delete_by_room($room_id)
{
- return (int)DB::delete(
+ DB::delete(
'DELETE FROM `NeededAngelTypes` WHERE `room_id` = ?',
[$room_id]
);
diff --git a/includes/model/Room_model.php b/includes/model/Room_model.php
index fdd9dddc..d76e6036 100644
--- a/includes/model/Room_model.php
+++ b/includes/model/Room_model.php
@@ -17,11 +17,10 @@ function Rooms($show_all = false)
* Delete a room
*
* @param int $room_id
- * @return bool
*/
function Room_delete($room_id)
{
- return DB::delete('DELETE FROM `Room` WHERE `RID` = ?', [$room_id]);
+ DB::delete('DELETE FROM `Room` WHERE `RID` = ?', [$room_id]);
}
/**
diff --git a/includes/model/ShiftEntry_model.php b/includes/model/ShiftEntry_model.php
index 3a282efc..bca63774 100644
--- a/includes/model/ShiftEntry_model.php
+++ b/includes/model/ShiftEntry_model.php
@@ -143,13 +143,12 @@ function ShiftEntry($shift_entry_id)
* Delete a shift entry.
*
* @param int $shift_entry_id
- * @return bool
*/
function ShiftEntry_delete($shift_entry_id)
{
$shift_entry = ShiftEntry($shift_entry_id);
mail_shift_removed(User($shift_entry['UID']), Shift($shift_entry['SID']));
- return DB::delete('DELETE FROM `ShiftEntry` WHERE `id` = ?', [$shift_entry_id]);
+ DB::delete('DELETE FROM `ShiftEntry` WHERE `id` = ?', [$shift_entry_id]);
}
/**
diff --git a/includes/model/ShiftTypes_model.php b/includes/model/ShiftTypes_model.php
index 12fe38be..d6efe117 100644
--- a/includes/model/ShiftTypes_model.php
+++ b/includes/model/ShiftTypes_model.php
@@ -6,11 +6,10 @@ use Engelsystem\Database\DB;
* Delete a shift type.
*
* @param int $shifttype_id
- * @return bool
*/
function ShiftType_delete($shifttype_id)
{
- return DB::delete('DELETE FROM `ShiftTypes` WHERE `id`=?', [$shifttype_id]);
+ DB::delete('DELETE FROM `ShiftTypes` WHERE `id`=?', [$shifttype_id]);
}
/**
diff --git a/includes/model/Shifts_model.php b/includes/model/Shifts_model.php
index 6e69fe35..2288e3cc 100644
--- a/includes/model/Shifts_model.php
+++ b/includes/model/Shifts_model.php
@@ -402,34 +402,22 @@ function Shift_signup_allowed(
* Delete a shift by its external id.
*
* @param int $shift_psid
- * @return bool
*/
function Shift_delete_by_psid($shift_psid)
{
DB::delete('DELETE FROM `Shifts` WHERE `PSID`=?', [$shift_psid]);
-
- if (DB::getStm()->errorCode() != '00000') {
- return false;
- }
-
- return true;
}
/**
* Delete a shift.
*
* @param int $shift_id
- * @return bool
*/
function Shift_delete($shift_id)
{
mail_shift_delete(Shift($shift_id));
- $result = DB::delete('DELETE FROM `Shifts` WHERE `SID`=?', [$shift_id]);
- if (DB::getStm()->errorCode() != '00000') {
- engelsystem_error('Unable to delete shift.');
- }
- return $result;
+ DB::delete('DELETE FROM `Shifts` WHERE `SID`=?', [$shift_id]);
}
/**
diff --git a/includes/model/UserAngelTypes_model.php b/includes/model/UserAngelTypes_model.php
index f8277fd9..43bd23bc 100644
--- a/includes/model/UserAngelTypes_model.php
+++ b/includes/model/UserAngelTypes_model.php
@@ -125,7 +125,6 @@ function UserAngelType_update($user_angeltype_id, $supporter)
* Delete all unconfirmed UserAngelTypes for given Angeltype.
*
* @param int $angeltype_id
- * @return bool
*/
function UserAngelTypes_delete_all($angeltype_id)
{
@@ -134,12 +133,6 @@ function UserAngelTypes_delete_all($angeltype_id)
WHERE `angeltype_id`=?
AND `confirm_user_id` IS NULL
', [$angeltype_id]);
-
- if (DB::getStm()->errorCode() != '00000') {
- engelsystem_error('Unable to delete all unconfirmed users.');
- }
-
- return true;
}
/**
@@ -178,11 +171,10 @@ function UserAngelType_confirm($user_angeltype_id, $confirm_user)
* Delete an UserAngelType.
*
* @param array $user_angeltype
- * @return bool
*/
function UserAngelType_delete($user_angeltype)
{
- return (bool)DB::delete('
+ DB::delete('
DELETE FROM `UserAngelTypes`
WHERE `id`=?
LIMIT 1', [$user_angeltype['id']]);
diff --git a/includes/model/UserDriverLicenses_model.php b/includes/model/UserDriverLicenses_model.php
index ee93ac95..bc9b6516 100644
--- a/includes/model/UserDriverLicenses_model.php
+++ b/includes/model/UserDriverLicenses_model.php
@@ -132,13 +132,8 @@ function UserDriverLicenses_update($user_driver_license)
* Delete a user's driver license entry
*
* @param int $user_id
- * @return bool
*/
function UserDriverLicenses_delete($user_id)
{
- $result = DB::delete('DELETE FROM `UserDriverLicenses` WHERE `user_id`=?', [$user_id]);
- if (DB::getStm()->errorCode() != '00000') {
- engelsystem_error('Unable to remove user driver license information');
- }
- return $result;
+ DB::delete('DELETE FROM `UserDriverLicenses` WHERE `user_id`=?', [$user_id]);
}
diff --git a/includes/model/User_model.php b/includes/model/User_model.php
index 9f767b74..adf81393 100644
--- a/includes/model/User_model.php
+++ b/includes/model/User_model.php
@@ -11,13 +11,10 @@ use Engelsystem\ValidationResult;
* Delete a user
*
* @param int $user_id
- * @return bool
*/
function User_delete($user_id)
{
DB::delete('DELETE FROM `User` WHERE `UID`=?', [$user_id]);
-
- return DB::getStm()->errorCode() == '00000';
}
/**
diff --git a/includes/pages/admin_import.php b/includes/pages/admin_import.php
index 959a9d2e..506a9dbe 100644
--- a/includes/pages/admin_import.php
+++ b/includes/pages/admin_import.php
@@ -279,10 +279,7 @@ function admin_import()
}
foreach ($events_deleted as $event) {
- $result = Shift_delete_by_psid($event['PSID']);
- if ($result === false) {
- engelsystem_error('Unable to delete shift.');
- }
+ Shift_delete_by_psid($event['PSID']);
}
engelsystem_log('Frab import done');
diff --git a/includes/pages/admin_rooms.php b/includes/pages/admin_rooms.php
index ad8eab83..d49db707 100644
--- a/includes/pages/admin_rooms.php
+++ b/includes/pages/admin_rooms.php
@@ -209,9 +209,7 @@ function admin_rooms()
]);
} elseif ($request->input('show') == 'delete') {
if ($request->has('ack')) {
- if (!Room_delete($room_id)) {
- engelsystem_error('Unable to delete room.');
- }
+ Room_delete($room_id);
engelsystem_log('Room deleted: ' . $name);
success(sprintf(_('Room %s deleted.'), $name));
diff --git a/includes/pages/user_myshifts.php b/includes/pages/user_myshifts.php
index 94116fc9..a10e6f82 100644
--- a/includes/pages/user_myshifts.php
+++ b/includes/pages/user_myshifts.php
@@ -145,10 +145,8 @@ function user_myshifts()
($shift['start'] > time() + config('last_unsubscribe') * 3600)
|| in_array('user_shifts_admin', $privileges)
) {
- $result = ShiftEntry_delete($user_id);
- if ($result === false) {
- engelsystem_error('Unable to delete shift entry.');
- }
+ ShiftEntry_delete($user_id);
+
$room = Room($shift['RID']);
$angeltype = AngelType($shift['TID']);
$shifttype = ShiftType($shift['shifttype_id']);