From eaa96772926abe032ace46602d0b34c3a780b9c2 Mon Sep 17 00:00:00 2001 From: tonnesen Date: Tue, 23 Jan 2001 23:48:54 +0000 Subject: [PATCH] Changes to web circulation module: rudimentary returns module, arbitrary due date for issues, flag info displayed, overdue books are displayed in red. --- C4/Circulation/Circ2.pm | 3 + circ/circulation.pl | 227 ++++++++++++++++++++++++++++++---------- 2 files changed, 173 insertions(+), 57 deletions(-) diff --git a/C4/Circulation/Circ2.pm b/C4/Circulation/Circ2.pm index b5555ed76b..a544d2e72e 100755 --- a/C4/Circulation/Circ2.pm +++ b/C4/Circulation/Circ2.pm @@ -279,6 +279,9 @@ sub issuebook { my $datedue=time+($loanlength)*86400; my @datearr = localtime($datedue); $dateduef = (1900+$datearr[5])."-".($datearr[4]+1)."-".$datearr[3]; + if ($env->{'datedue'}) { + $dateduef=$env->{'datedue'}; + } my $sth=$dbh->prepare("insert into issues (borrowernumber, itemnumber, date_due, branchcode) values ($patroninformation->{'borrowernumber'}, $iteminformation->{'itemnumber'}, '$dateduef', '$env->{'branchcode'}')"); $sth->execute; $sth->finish; diff --git a/circ/circulation.pl b/circ/circulation.pl index baf2000bec..754cf46dfc 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -35,10 +35,58 @@ print << "EOF"; EOF } + +sub returns { + if (my $barcode=$query->param('barcode')) { + print "Returning $barcode
\n"; + my ($iteminformation, $borrower, $messages, $overduecharge) = returnbook(\%env, $barcode); + if ($borrower) { + print "Borrowed by $borrower->{'title'} $borrower->{'firstname'} $borrower->{'surname'}

\n"; + } else { + print "Not loaned out.\n"; + } + } + print << "EOF"; +

+ + + +
Enter Book Barcode
Item Barcode:
+ +
+EOF +} + sub issues { if (my $borrnumber=$query->param('borrnumber')) { my ($borrower, $flags) = getpatroninformation(\%env,$borrnumber,0); + my $year=$query->param('year'); + my $month=$query->param('month'); + my $day=$query->param('day'); if (my $barcode=$query->param('barcode')) { + my $invalidduedate=0; + $env{'datedue'}=''; + if (($year eq 0) && ($month eq 0) && ($year eq 0)) { + $env{'datedue'}=''; + } else { + if (($year eq 0) || ($month eq 0) || ($year eq 0)) { + print "Invalid Due Date Specified. Book was not issued.

\n"; + $invalidduedate=1; + } else { + if (($day>30) && (($month==4) || ($month==6) || ($month==9) || ($month==11))) { + print "Invalid Due Date Specified. Book was not issued.

\n"; + $invalidduedate=1; + } elsif (($day>29) && ($month==2)) { + print "Invalid Due Date Specified. Book was not issued.

\n"; + $invalidduedate=1; + } elsif (($day>28) && (($year%4) && ((!($year%100) || ($year%400))))) { + print "Invalid Due Date Specified. Book was not issued.

\n"; + $invalidduedate=1; + } else { + $env{'datedue'}="$year-$month-$day"; + } + } + } my %responses; foreach (sort $query->param) { if ($_ =~ /response-(\d*)/) { @@ -48,65 +96,90 @@ sub issues { if (my $qnumber=$query->param('questionnumber')) { $responses{$qnumber}=$query->param('answer'); } - my ($iteminformation, $duedate, $rejected, $question, $questionnumber, $defaultanswer) = issuebook(\%env, $borrower, $barcode, \%responses); - if ($rejected) { - if ($rejected == -1) { - } else { - print "Error issuing book: $rejected
\n"; + unless ($invalidduedate) { + my ($iteminformation, $duedate, $rejected, $question, $questionnumber, $defaultanswer) = issuebook(\%env, $borrower, $barcode, \%responses); + if ($rejected) { + if ($rejected == -1) { + } else { + print "Error issuing book: $rejected
\n"; + } } - } - my $responsesform=''; - foreach (keys %responses) { - $responsesform.="\n"; - } - if ($question) { - print << "EOF"; - - - + my $responsesform=''; + foreach (keys %responses) { + $responsesform.="\n"; + } + if ($question) { + my $stickyduedate=$query->param('stickyduedate'); + print << "EOF"; +
Issuing Question
- Attempting to issue $iteminformation->{'title'} by $iteminformation->{'author'} to $borrower->{'firstname'} $borrower->{'surname'}. -
- $question -
+ + - -
Issuing Question
+ Attempting to issue $iteminformation->{'title'} by $iteminformation->{'author'} to $borrower->{'firstname'} $borrower->{'surname'}. +
+ $question +
- - - - -
-
- - - - - $responsesform - - -
-
-
- - - - - $responsesform - - -
-
-
+ + + + + +
+
+ + + + + + + + + $responsesform + + +
+
+
+ + + + + + + + + $responsesform + + +
+
+ + EOF - return; + return; + } } } my $issueid=$query->param('issueid'); ($issueid) || ($issueid=int(rand()*1000000000)); my $flag=''; my $flagtext=''; + my $flaginfotext=''; foreach $flag (sort keys %$flags) { - $flagtext.="$flag "; + if ($flags->{$flag}->{'noissues'}) { + $flagtext.="$flag "; + } else { + $flagtext.="$flag "; + } + $flags->{$flag}->{'message'}=~s/\n/
/g; + if ($flags->{$flag}->{'noissues'}) { + $flaginfotext.="$flag$flags->{$flag}->{'message'}\n"; + } else { + $flaginfotext.="$flag$flags->{$flag}->{'message'}\n"; + } + } + if ($flaginfotext) { + $flaginfotext="$flaginfotext
Patron Flags
\n"; } $env{'nottodaysissues'}=1; my ($borrowerissues) = currentissues(\%env, $borrower); @@ -132,19 +205,57 @@ EOF my $bookissue=$today->{$_}; $todaysissues.="$bookissue->{'date_due'}$bookissue->{'barcode'}$bookissue->{'title'}$bookissue->{'author'}$bookissue->{'dewey'} $bookissue->{'subclass'}\n"; } + for ($i=1; $i<32; $i++) { + my $selected=''; + if (($query->param('stickyduedate')) && ($day==$i)) { + $selected='selected'; + } + $dayoptions.="

- - -
- - - +
Enter Book Barcode
Item Barcode:
+ +
Enter Book Barcode
+ + + +
Item Barcode:
+ + + +
+ Sticky Due Date +
+
+ + +
+
Patron Information
@@ -158,7 +269,7 @@ EOF
- + $todaysissues
Today's Issues
Issues Today
Due DateBar CodeTitleAuthorClass
@@ -174,6 +285,8 @@ EOF
+

+$flaginfotext EOF } else { if (my $findborrower=$query->param('findborrower')) { @@ -201,11 +314,11 @@ EOF print << "EOF";

Issues Module

-
Enter borrower card number
or partial last name
+
EOF } -- 2.39.5