-
Notifications
You must be signed in to change notification settings - Fork 0
/
checkout_edit.php
158 lines (131 loc) · 4.68 KB
/
checkout_edit.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
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<?
include_once(dirname(__FILE__) . "/first.php");
$db->show_search = FALSE;
$record_ID = $query[0];
if(! $accounts->account_record->ID)
{
exit_error("Not Signed In", "You must be signed into perform that action.");
}; // end if
if($accounts->account_record->librarian != "Y" && $accounts->account_record->admin != "Y")
{
exit_error("Access Denied", "Only a librarian can perform that action.");
}; // end if
$submit_caption = "Save Changes";
if($_POST['action'] == $submit_caption)
{
if(count($errors) < 1)
{
$sorting_title = preg_replace("/^(The|A)\s/i", "", $_POST['title']);
$update_sql = "
`out_datetime`='" . mysql_escape_string(stripslashes($_POST['out_datetime'])) . "',
`due_datetime`='" . mysql_escape_string(stripslashes($_POST['due_datetime'])) . "',
`in_datetime`='" . mysql_escape_string(stripslashes($_POST['in_datetime'])) . "',
`lost_datetime`='" . mysql_escape_string(stripslashes($_POST['lost_datetime'])) . "',
`replaced_datetime`='" . mysql_escape_string(stripslashes($_POST['replaced_datetime'])) . "',
`paid_datetime`='" . mysql_escape_string(stripslashes($_POST['paid_datetime'])) . "',
`lost_fee`='" . mysql_escape_string(stripslashes($_POST['lost_fee'])) . "',
";
$sql = "
UPDATE
`" . $db->table_library_checkout . "`
SET
" . $update_sql . $unique_update_sql . "
`duration`='" . date("Y-m-d H:i:s") . "'
WHERE
`ID`='" . mysql_escape_string($record_ID) . "'
";
mysql_query($sql, $mysql->link);
?>
<script language="javascript">
window.opener.location.reload();
window.close();
</script>
<?
exit();
}; // end if
}
else
{
$sql = "
SELECT
*
FROM
`" . $db->table_library_checkout . "`
WHERE
`ID`='" . $record_ID . "'
";
$result = mysql_query($sql, $mysql->link);
if(mysql_num_rows($result) < 1)
{
exit_error("Checkout #" . $item_ID . " not found.", "There are no checkout records matching ID #" . $item_ID);
}; // end if
$record = mysql_fetch_array($result);
foreach($record as $key=>$val)
{
$_POST[$key] = addslashes($val);
}; // end foreach
}; // end if
include_once(dirname(__FILE__) . "/top.php");
if(count($errors) > 0)
{
foreach($errors as $key=>$val)
{
echo $key . "::" . $val . ", ";
}; // end foreach
}; // end if
?>
<form enctype="multipart/form-data" method="post" action="" onsubmit="show_wait_message()">
<table class="edit_table" cellspacing="0" cellpadding="0" border="0">
<tr>
<td class="edit_caption<?= ($errors['out_datetime'] ? " edit_error" : ""); ?>"><nobr>Out Date/Time:</nobr></td>
<td class="edit_value">
<input id="out_datetime" name="out_datetime" type="text" value="<?= htmlspecialchars(stripslashes($_POST['out_datetime'])); ?>" size="32">
</td>
</tr>
<tr>
<td class="edit_caption<?= ($errors['due_datetime'] ? " edit_error" : ""); ?>"><nobr>Due Date/Time:</nobr></td>
<td class="edit_value">
<input id="due_datetime" name="due_datetime" type="text" value="<?= htmlspecialchars(stripslashes($_POST['due_datetime'])); ?>" size="32">
</td>
</tr>
<tr>
<td class="edit_caption<?= ($errors['in_datetime'] ? " edit_error" : ""); ?>"><nobr>In Date/Time:</nobr></td>
<td class="edit_value">
<input id="in_datetime" name="in_datetime" type="text" value="<?= htmlspecialchars(stripslashes($_POST['in_datetime'])); ?>" size="32">
</td>
</tr>
<tr>
<td class="edit_caption<?= ($errors['lost_datetime'] ? " edit_error" : ""); ?>"><nobr>Lost Date/Time:</nobr></td>
<td class="edit_value">
<input id="lost_datetime" name="lost_datetime" type="text" value="<?= htmlspecialchars(stripslashes($_POST['lost_datetime'])); ?>" size="32">
</td>
</tr>
<tr>
<td class="edit_caption<?= ($errors['replaced_datetime'] ? " edit_error" : ""); ?>"><nobr>Replaced Date/Time:</nobr></td>
<td class="edit_value">
<input id="replaced_datetime" name="replaced_datetime" type="text" value="<?= htmlspecialchars(stripslashes($_POST['replaced_datetime'])); ?>" size="32">
</td>
</tr>
<tr>
<td class="edit_caption<?= ($errors['replaced_datetime'] ? " edit_error" : ""); ?>"><nobr>Paid Date/Time:</nobr></td>
<td class="edit_value">
<input id="paid_datetime" name="paid_datetime" type="text" value="<?= htmlspecialchars(stripslashes($_POST['paid_datetime'])); ?>" size="32">
</td>
</tr>
<tr>
<td class="edit_caption<?= ($errors['lost_fee'] ? " edit_error" : ""); ?>"><nobr>Lost Fee:</nobr></td>
<td class="edit_value">
<input id="lost_fee" name="lost_fee" type="text" value="<?= htmlspecialchars(stripslashes($_POST['lost_fee'])); ?>" size="32">
</td>
</tr>
<tr>
<td></td>
<td class="edit_value">
<input type="submit" name="action" value="<?= $submit_caption; ?>">
</td>
</tr>
</table>
</form>
<?
include_once(dirname(__FILE__) . "/bottom.php");
?>