-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcheckout.php
More file actions
100 lines (74 loc) · 2.43 KB
/
Copy pathcheckout.php
File metadata and controls
100 lines (74 loc) · 2.43 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?php
session_start();
require_once("config/config.inc.php");
require_once("config/strings.inc.php");
require_once("includes/Database.php");
require_once("load.php");
require_once("includes/load_hours_data.php");
require_once("includes/load_rooms.php");
require_once("includes/error_checking.php");
require_once("includes/verify_access.php");
restrict_access($db,array("staff","admin"));
$reservation_id = $_GET['reservation_id'];
$room_id = $_GET['room_id'];
$checkout_key_barcode = $_GET['checkout_key_barcode'];
if(isset($_GET['user_id']))
$user = get_user_by_id($user_id);
// KEY CHECKOUT
if(isset($_GET['reservation_id']) && isset($_GET['room_id']) && isset($_GET['checkout_key_barcode']))
{
// TODO: check to make sure key hasn't already been checked out (reload issue)
$checkout_result = checkout_key($_GET['reservation_id'],$_GET['room_id'],$_GET['checkout_key_barcode']);
//pr($checkout_result);
// reload user
$user = get_user_by_id($_GET['user_id']);
//pr($user);
if(!is_array($checkout_result))
{
if(isset($_GET['referrer']) && strcmp($_GET['referrer'],''))
{
header("location: ".$_GET['referrer']);
exit();
}
else
{
header("location: user_details.php?user_id=$user->id");
exit();
}
}
$message = implode("<br>",$checkout_result);
}
require_once("includes/header.php");
$reservations = load_reservations(array('id'=>$reservation_id,'status'=>'Scheduled','active'=>'1'));
if(count($reservations) > 1)
{
// error, more than one reservation with the same reservation id
}
else if(count($reservations) < 1)
{
// error, reservation not found
}
else
{
foreach($reservations as $reservation)
break;
//pr($reservation);
$room = $reservation->room;
$user = get_user_by_id($reservation->user_id);
print("<div id='PageTitle'>Checkout Key for Room $room->room_number</div>\n");
print("<div class='breadcrumb'><a href='http://library.pdx.edu'>Home</a> » <a href='index.php'>Reserve a Study Room</a> » Manage Rooms</div>\n");
print("<br>\n");
display_error($message);
if(!strcmp($reservation->status,'Checked Out'))
{
print("<h3>Room Currently Checked Out</h3>\n");
}
else
{
print_checkout_form($reservation);
}
print("<br><br>\n");
print("<a style='margin-left:30px;' href='reservation_calendar.php'>Back to the Calendar</a> | <a href='user_details.php?search=$user->patron_id'>User Details for $user->first_name $user->last_name</a><br>\n");
}
require_once("includes/footer.php");
?>