4 use C4::Circulation::Circ2;
13 print startmenu('catalogue');
17 <a href=circulation.pl?module=issues>Issues</a> |
18 <a href=circulation.pl?module=returns>Returns</a>
23 if ($query->param('module') eq 'issues') { issues(); last SWITCH; }
24 if ($query->param('module') eq 'returns') { returns(); last SWITCH; }
33 <a href=circulation.pl?module=issues>Issues</a>
34 <a href=circulation.pl?module=returns>Returns</a>
40 if (my $barcode=$query->param('barcode')) {
41 print "Returning $barcode<br>\n";
42 my ($iteminformation, $borrower, $messages, $overduecharge) = returnbook(\%env, $barcode);
44 print "Borrowed by $borrower->{'title'} $borrower->{'firstname'} $borrower->{'surname'}<p>\n";
46 print "Not loaned out.\n";
50 <form method=post name=barcode>
51 <table border=3 bgcolor=#dddddd>
52 <tr><td colspan=2 bgcolor=black><font color=white><b>Enter Book Barcode</b></font></td></tr>
53 <tr><td>Item Barcode:</td><td><input name=barcode size=10></td></tr>
55 <input type=hidden name=module value=returns>
61 if (my $borrnumber=$query->param('borrnumber')) {
62 my ($borrower, $flags) = getpatroninformation(\%env,$borrnumber,0);
63 my $year=$query->param('year');
64 my $month=$query->param('month');
65 my $day=$query->param('day');
66 if (my $barcode=$query->param('barcode')) {
69 if (($year eq 0) && ($month eq 0) && ($year eq 0)) {
72 if (($year eq 0) || ($month eq 0) || ($year eq 0)) {
73 print "Invalid Due Date Specified. Book was not issued.<p>\n";
76 if (($day>30) && (($month==4) || ($month==6) || ($month==9) || ($month==11))) {
77 print "Invalid Due Date Specified. Book was not issued.<p>\n";
79 } elsif (($day>29) && ($month==2)) {
80 print "Invalid Due Date Specified. Book was not issued.<p>\n";
82 } elsif (($day>28) && (($year%4) && ((!($year%100) || ($year%400))))) {
83 print "Invalid Due Date Specified. Book was not issued.<p>\n";
86 $env{'datedue'}="$year-$month-$day";
91 foreach (sort $query->param) {
92 if ($_ =~ /response-(\d*)/) {
93 $responses{$1}=$query->param($_);
96 if (my $qnumber=$query->param('questionnumber')) {
97 $responses{$qnumber}=$query->param('answer');
99 unless ($invalidduedate) {
100 my ($iteminformation, $duedate, $rejected, $question, $questionnumber, $defaultanswer) = issuebook(\%env, $borrower, $barcode, \%responses);
102 if ($rejected == -1) {
104 print "Error issuing book: $rejected<br>\n";
107 my $responsesform='';
108 foreach (keys %responses) {
109 $responsesform.="<input type=hidden name=response-$_ value=$responses{$_}>\n";
112 my $stickyduedate=$query->param('stickyduedate');
114 <table border=1 bgcolor=#dddddd>
115 <tr><th bgcolor=black><font color=white><b>Issuing Question</b></font></td></tr>
117 Attempting to issue $iteminformation->{'title'} by $iteminformation->{'author'} to $borrower->{'firstname'} $borrower->{'surname'}.
122 <tr><td align=center>
126 <input type=hidden name=module value=issues>
127 <input type=hidden name=borrnumber value=$borrnumber>
128 <input type=hidden name=barcode value=$barcode>
129 <input type=hidden name=questionnumber value=$questionnumber>
130 <input type=hidden name=day value=$day>
131 <input type=hidden name=month value=$month>
132 <input type=hidden name=year value=$year>
133 <input type=hidden name=stickyduedate value=$stickyduedate>
135 <input type=hidden name=answer value=Y>
136 <input type=submit value=Yes>
141 <input type=hidden name=module value=issues>
142 <input type=hidden name=borrnumber value=$borrnumber>
143 <input type=hidden name=barcode value=$barcode>
144 <input type=hidden name=questionnumber value=$questionnumber>
145 <input type=hidden name=day value=$day>
146 <input type=hidden name=month value=$month>
147 <input type=hidden name=year value=$year>
148 <input type=hidden name=stickyduedate value=$stickyduedate>
150 <input type=hidden name=answer value=N>
151 <input type=submit value=No>
163 my $issueid=$query->param('issueid');
164 ($issueid) || ($issueid=int(rand()*1000000000));
168 foreach $flag (sort keys %$flags) {
169 if ($flags->{$flag}->{'noissues'}) {
170 $flagtext.="<font color=red>$flag</font> ";
174 $flags->{$flag}->{'message'}=~s/\n/<br>/g;
175 if ($flags->{$flag}->{'noissues'}) {
176 $flaginfotext.="<tr><td bgcolor=red><font color=white><b>$flag</b></font></td><td bgcolor=red><font color=white><b>$flags->{$flag}->{'message'}</b></font></td></tr>\n";
178 $flaginfotext.="<tr><td>$flag</td><td>$flags->{$flag}->{'message'}</td></tr>\n";
182 $flaginfotext="<table border=1 width=70%><tr><th bgcolor=black colspan=2><font color=white>Patron Flags</font></th></tr>$flaginfotext</table>\n";
184 $env{'nottodaysissues'}=1;
185 my ($borrowerissues) = currentissues(\%env, $borrower);
186 $env{'nottodaysissues'}=0;
187 $env{'todaysissues'}=1;
188 my ($today) = currentissues(\%env, $borrower);
189 $env{'todaysissues'}=0;
191 my @datearr = localtime(time());
192 my $todaysdate = (1900+$datearr[5]).sprintf ("%0.2d", ($datearr[4]+1)).sprintf ("%0.2d", $datearr[3]);
193 foreach (sort keys %$borrowerissues) {
194 my $bookissue=$borrowerissues->{$_};
196 my $datedue=$bookissue->{'date_due'};
198 if ($datedue < $todaysdate) {
199 $bgcolor="bgcolor=red";
201 $previssues.="<tr $bgcolor><td>$bookissue->{'date_due'}</td><td>$bookissue->{'barcode'}</td><td>$bookissue->{'title'}</td><td>$bookissue->{'author'}</td><td>$bookissue->{'dewey'} $bookissue->{'subclass'}</td></tr>\n";
204 foreach (sort keys %$today) {
205 my $bookissue=$today->{$_};
206 $todaysissues.="<tr><td>$bookissue->{'date_due'}</td><td>$bookissue->{'barcode'}</td><td>$bookissue->{'title'}</td><td>$bookissue->{'author'}</td><td>$bookissue->{'dewey'} $bookissue->{'subclass'}</td></tr>\n";
208 for ($i=1; $i<32; $i++) {
210 if (($query->param('stickyduedate')) && ($day==$i)) {
211 $selected='selected';
213 $dayoptions.="<option value=$i $selected>$i";
216 foreach (('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December')) {
218 if (($query->param('stickyduedate')) && ($month==$counter)) {
219 $selected='selected';
221 $monthoptions.="<option value=$counter $selected>$_";
224 for ($i=$datearr[5]+1900; $i<$datearr[5]+1905; $i++) {
226 if (($query->param('stickyduedate')) && ($year==$i)) {
227 $selected='selected';
229 $yearoptions.="<option value=$i $selected>$i";
233 ($query->param('stickyduedate')) && ($selected='checked');
236 <table border=0 cellpadding=5>
239 <table border=1 bgcolor=#dddddd>
240 <tr><td bgcolor=black><font color=white><b>Enter Book Barcode</b></font></td></tr>
242 <table border=0 bgcolor=#dddddd>
243 <tr><td>Item Barcode:</td><td><input name=barcode size=10></td><td><input type=submit value=Issue></tr>
244 <tr><td colspan=3 align=center>
245 <select name=day><option value=0>Day$dayoptions</select>
246 <select name=month><option value=0>Month$monthoptions</select>
247 <select name=year><option value=0>Year$yearoptions</select>
249 <input type=checkbox name=stickyduedate $selected> Sticky Due Date
254 <input type=hidden name=module value=issues>
255 <input type=hidden name=borrnumber value=$borrnumber>
258 <td align=right valign=top>
259 <table border=1 bgcolor=#dddddd>
260 <tr><th bgcolor=black><font color=white><b>Patron Information</b></font></td></tr>
262 $borrower->{'cardnumber'} $borrower->{'surname'}, $borrower->{'title'} $borrower->{'firstname'}<br>
263 $borrower->{'streetaddress'} $borrower->{'city'}<br>
264 $borrower->{'categorycode'} $flagtext
270 <td colspan=2 align=center>
271 <table border=1 width=100% bgcolor=#dddddd>
272 <tr><th colspan=5 bgcolor=black><font color=white><b>Issues Today</b></font></th></tr>
273 <tr><th>Due Date</th><th>Bar Code</th><th>Title</th><th>Author</th><th>Class</th></tr>
279 <td colspan=2 align=center>
280 <table border=1 width=100% bgcolor=#dddddd>
281 <tr><th colspan=5 bgcolor=black><font color=white><b>Previous Issues</b></font></th></tr>
282 <tr><th>Due Date</th><th>Bar Code</th><th>Title</th><th>Author</th><th>Class</th></tr>
292 if (my $findborrower=$query->param('findborrower')) {
293 my ($borrowers, $flags) = findborrower(\%env, $findborrower);
294 print "<form method=get>\n";
295 print "<input type=hidden name=module value=issues>\n";
296 my @borrowers=@$borrowers;
297 if ($#borrowers == 0) {
298 $query->param('borrnumber', $borrowers[0]->{'borrowernumber'});
302 print "<table border=1 cellpadding=5 bgcolor=#dddddd>";
303 print "<tr><th bgcolor=black><font color=white><b>Select a borrower</b></font></th></tr>\n";
304 print "<tr><td align=center>\n";
305 print "<select name=borrnumber size=7>\n";
306 foreach (sort {$a->{'surname'}.$a->{'firstname'} cmp $b->{'surname'}.$b->{'firstname'}} @$borrowers) {
307 print "<option value=$_->{'borrowernumber'}>$_->{'surname'}, $_->{'firstname'} ($_->{'cardnumber'})\n";
309 print "</select><br>";
310 print "<input type=submit>\n";
311 print "</td></tr></table>\n";
315 <h1>Issues Module</h1>
317 <table border=1 bgcolor=#dddddd>
318 <tr><th bgcolor=black><font color=white><b>Enter borrower card number<br> or partial last name</b></font></td></tr>
319 <tr><td><input name=findborrower></td></tr>
321 <input type=hidden name=module value=issues>