forked from pdxlibrary/LibRooms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lost_key.php
60 lines (43 loc) · 1.56 KB
/
lost_key.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
session_start();
require_once("config/config.inc.php");
require_once("includes/Database.php");
require_once("includes/email_communication.php");
require_once("load.php");
require_once("includes/verify_access.php");
restrict_access($db,array("staff","admin"));
$key_barcode = $_GET['key_barcode'];
$reservations = get_reservation_for_checked_out_key($key_barcode);
$page_title = "Lost Key";
require_once("includes/header.php");
print("<div id='PageTitle'>$page_title</div>\n");
print("<div class='breadcrumb'><a href='http://library.pdx.edu'>Home</a> » <a href='index.php'>Reserve a Study Room</a> » $page_title</div>\n");
print("<br>\n");
if(count($reservations) == 0)
{
display_error("Associated reservation could not be found for key [$key_barcode]",$_GET);
exit();
}
else if(count($reservations) > 1)
{
display_error("Multiple reservations for the same key checkout [$key_barcode]",$reservations);
exit();
}
else
{
foreach($reservations as $reservation)
break;
// assign lost key fine to reservation
assign_fine($reservation->id,FINE_LOST_KEY,"Lost key fine");
// assign lost key processing fee to reservation
assign_fine($reservation->id,LOST_KEY_PROCESSING_FEE,"Lost key processing fee");
// change reservation to completed status
update_reservation_status($reservation->id,"Completed");
// set key status as lost
update_key_status($key_barcode,"Lost");
// send email notice to user
lost_key_email($db,$reservation->id);
print("<h2>Key [$key_barcode] successfully reported lost</h2>\n");
}
require_once("includes/footer.php");
?>