Changeset:
27d0fde3ea6d
https://sourceforge.net/p/mrbs/hg-code/ci/27d0fde3ea6dce7e7e80943b783f6247b285a3ae
Author:
Campbell Morrison <[email protected]>
Date:
Thu Sep 29 10:51:13 2016 +0100
Log message:
Changed the error handling following a call to sql_query1() in
edit_entry_handler.php as a fatal db error is no longer the right action.
diffstat:
web/edit_entry_handler.php | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diffs (34 lines):
diff -r c5d0af9e9124 -r 27d0fde3ea6d web/edit_entry_handler.php
--- a/web/edit_entry_handler.php Thu Sep 29 10:14:41 2016 +0100
+++ b/web/edit_entry_handler.php Thu Sep 29 10:51:13 2016 +0100
@@ -417,7 +417,13 @@
$target_room = sql_query1("SELECT room_id FROM $tbl_entry WHERE id=? LIMIT
1", array($id));
if ($target_room < 0)
{
- fatal_error(FALSE, get_vocab("fatal_db_error"));
+ // Ideally we should give more feedback to the user when this happens, or
+ // even lock the entry once a user starts to edit it.
+ $message = "Tried to edit an entry that no longer exists - probably
because " .
+ "somebody else has deleted it in the meantime.";
+ trigger_error($message, E_USER_NOTICE);
+ header("Location: $returl");
+ exit;
}
}
else
@@ -561,7 +567,6 @@
$year = $start_year;
}
-
// Set up the return URL. As the user has tried to book a particular room
and a particular
// day, we must consider these to be the new "sticky room" and "sticky day",
so modify the
// return URL accordingly.
@@ -593,6 +598,7 @@
$returl = $returl_base[0];
}
+
// If we haven't been given a sensible date then get out of here and don't try
and make a booking
if (!isset($start_day) || !isset($start_month) || !isset($start_year) ||
!checkdate($start_month, $start_day, $start_year))
{
------------------------------------------------------------------------------
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits