CIRCULATION : the big rewrite...

This 1st commit reorders deeply the circulation module.
The goal is to :
* have something 100% templated/translatable.
* have something easy to read & modify, to say to customers/users : you can define your circulation rules as you want if you accept to look in C4/Circ/Circ2.pm

The circulation now works :
1=> ask for the borrower barcode (as previously)
2=> ask for the item barcode.
3=> check "canbookbeissued". This new sub returns 2 arrays :
- IMPOSSIBLE : if something is here, then the issue is not possible and is not done.
- TOBECONFIRMED : if something is here, then the issue can be donc if the user confirms it.
4=> if TOBECONFIRMED is set : ask for confirmation, loop. if neither  are set or confirmation flag is set (2nd pass of the loop), then issue.

The IMPOSSIBLE & TOBECONFIRMED hashs contains :
* the reason of the line. always in capitals, with words separated by _ : BARCODE_UNKNOWN, DEBTS ... as key of the hash
* more information, as value of the hash ( TOBECONFIRMED{ALREADY_ISSUED} = "previous_borrower_name", for example)

This commit :
* compiles
* works on certain situations, not on other
* does NOT issue (the line is # )
* does not check issuing rules depending of # of books allowed / already issued

The next step is :
- check issuing rule.
- extend issuing rule to have a 3D array : for each branch / itemtype / borrowertype = issuing number and issuing length.
This commit is contained in:
tipaul 2004-05-03 09:02:12 +00:00
parent 975f7c53ac
commit 21a379acda
4 changed files with 565 additions and 467 deletions

View file

@ -34,6 +34,7 @@ use C4::Context;
use C4::Stats;
use C4::Reserves2;
use C4::Koha;
use C4::Accounts;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
@ -63,19 +64,19 @@ Also deals with stocktaking.
@ISA = qw(Exporter);
@EXPORT = qw(&getpatroninformation
&currentissues &getissues &getiteminformation
&issuebook &returnbook &find_reserves &transferbook &decode
&calc_charges &listitemsforinventory &itemseen);
&canbookbeissued &issuebook &returnbook &find_reserves &transferbook &decode
&calc_charges &listitemsforinventory &itemseen &fixdate);
# &getbranches &getprinters &getbranch &getprinter => moved to C4::Koha.pm
=item itemseen
&itemseen($itemnum)
Mark item as seen. Is called when an item is issued, returned or manually marked during inventory/stocktaking
C<$itemnum> is the item number
=back
=cut
sub itemseen {
my ($itemnum) = @_;
my $dbh = C4::Context->dbh;
@ -99,10 +100,10 @@ sub listitemsforinventory {
}
return \@results;
}
=item getpatroninformation
($borrower, $flags) = &getpatroninformation($env, $borrowernumber,
$cardnumber);
($borrower, $flags) = &getpatroninformation($env, $borrowernumber, $cardnumber);
Looks up a patron and returns information about him or her. If
C<$borrowernumber> is true (nonzero), C<&getpatroninformation> looks
@ -113,17 +114,12 @@ C<$env> is effectively ignored, but should be a reference-to-hash.
C<$borrower> is a reference-to-hash whose keys are the fields of the
borrowers table in the Koha database. In addition,
C<$borrower-E<gt>{flags}> is the same as C<$flags>.
C<$borrower-E<gt>{flags}> is a hash giving more detailed information
about the patron. Its keys act as flags :
C<$flags> is a reference-to-hash giving more detailed information
about the patron. Its keys act as flags: if they are set, then the key
is a reference-to-hash that gives further details:
if (exists($flags->{LOST}))
{
# Patron's card was reported lost
print $flags->{LOST}{message}, "\n";
}
if $borrower->{flags}->{LOST} {
# Patron's card was reported lost
}
Each flag has a C<message> key, giving a human-readable explanation of
the flag. If the state of a flag means that the patron should not be
@ -178,6 +174,7 @@ fields from the reserves table of the Koha database.
=back
=cut
#'
sub getpatroninformation {
# returns
@ -201,7 +198,7 @@ sub getpatroninformation {
$borrower->{'amountoutstanding'} = $amount;
my $flags = patronflags($env, $borrower, $dbh);
my $accessflagshash;
$sth=$dbh->prepare("select bit,flag from userflags");
$sth->execute;
while (my ($bit, $flag) = $sth->fetchrow) {
@ -211,7 +208,8 @@ sub getpatroninformation {
}
$sth->finish;
$borrower->{'flags'}=$flags;
return ($borrower, $flags, $accessflagshash);
$borrower->{'authflags'} = $accessflagshash;
return ($borrower); #, $flags, $accessflagshash);
}
=item decode
@ -222,6 +220,7 @@ Decodes a segment of a string emitted by a CueCat barcode scanner and
returns it.
=cut
#'
# FIXME - At least, I'm pretty sure this is for decoding CueCat stuff.
sub decode {
@ -284,6 +283,7 @@ True if the item may not be borrowed.
=back
=cut
#'
sub getiteminformation {
# returns a hash of item information given either the itemnumber or the barcode
@ -399,6 +399,7 @@ succeeded. The value should be ignored.
=back
=cut
#'
# FIXME - This function tries to do too much, and its API is clumsy.
# If it didn't also return books, it could be used to change the home
@ -481,6 +482,189 @@ sub dotransfer {
return;
}
# check if a book can be issued.
# returns an array with errors if any
sub canbookbeissued {
my ($env,$borrower,$barcode,$year,$month,$day) = @_;
warn "CHECKING CANBEISSUED for $borrower->{'borrowernumber'}, $barcode";
my %needsconfirmation; # filled with problems that needs confirmations
my %issuingimpossible; # filled with problems that causes the issue to be IMPOSSIBLE
# my ($borrower, $flags) = &getpatroninformation($env, $borrowernumber, 0);
my $iteminformation = getiteminformation($env, 0, $barcode);
my $dbh = C4::Context->dbh;
#
# DUE DATE is OK ?
#
my ($duedate, $invalidduedate) = fixdate($year, $month, $day);
$issuingimpossible{INVALID_DATE} = 1 if ($invalidduedate);
#
# BORROWER STATUS
#
if ($borrower->{flags}->{'gonenoaddress'}) {
$issuingimpossible{GNA} = 1;
}
if ($borrower->{flags}->{'lost'}) {
$issuingimpossible{CARD_LOST} = 1;
}
if ($borrower->{flags}->{'debarred'}) {
$issuingimpossible{DEBARRED} = 1;
}
#
# BORROWER STATUS
#
# DEBTS
my $amount = checkaccount($env,$borrower->{'borrowernumber'}, $dbh,$duedate);
if ($amount >0) {
$needsconfirmation{DEBT} = $amount;
}
#
# ITEM CHECKING
#
unless ($iteminformation) {
$issuingimpossible{UNKNOWN_BARCODE} = 1;
}
if ($iteminformation->{'notforloan'} == 1) {
$issuingimpossible{NOT_FOR_LOAN} = 1;
}
if ($iteminformation->{'itemtype'} eq 'REF') {
$issuingimpossible{NOT_FOR_LOAN} = 1;
}
if ($iteminformation->{'wthdrawn'} == 1) {
$issuingimpossible{WTHDRAWN} = 1;
}
if ($iteminformation->{'restricted'} == 1) {
$issuingimpossible{RESTRICTED} = 1;
}
#
# CHECK IF BOOK ALREADY ISSUED TO THIS BORROWER
#
my ($currentborrower) = currentborrower($iteminformation->{'itemnumber'});
warn "current borrower for $iteminformation->{'itemnumber'} : $currentborrower";
if ($currentborrower eq $borrower->{'borrowernumber'}) {
# Already issued to current borrower. Ask whether the loan should
# be renewed.
my ($renewstatus) = renewstatus($env,$dbh,$borrower->{'borrowernumber'}, $iteminformation->{'itemnumber'});
if ($renewstatus == 0) { # no more renewals allowed
$issuingimpossible{NO_MORE_RENEWALS} = 1;
} else {
$needsconfirmation{RENEW_ISSUE} = 1;
}
} elsif ($currentborrower) {
# issued to someone else
$needsconfirmation{ISSUED_TO_ANOTHER} = 1;
}
# See if the item is on reserve.
my ($restype, $res) = CheckReserves($iteminformation->{'itemnumber'});
if ($restype) {
my $resbor = $res->{'borrowernumber'};
if ($resbor ne $borrower->{'borrowernumber'} && $restype eq "Waiting") {
# The item is on reserve and waiting, but has been
# reserved by some other patron.
my ($resborrower, $flags)=getpatroninformation($env, $resbor,0);
my $branches = getbranches();
my $branchname = $branches->{$res->{'branchcode'}}->{'branchname'};
$needsconfirmation{RESERVE_WAITING} = "$resborrower->{'firstname'} $resborrower->{'surname'} ($resborrower->{'cardnumber'}, $branchname)";
} elsif ($restype eq "Reserved") {
# The item is on reserve for someone else.
my ($resborrower, $flags)=getpatroninformation($env, $resbor,0);
my $branches = getbranches();
my $branchname = $branches->{$res->{'branchcode'}}->{'branchname'};
$needsconfirmation{RESERVED} = "$res->{'reservedate'} : $resborrower->{'firstname'} $resborrower->{'surname'} ($resborrower->{'cardnumber'})";
}
}
return(\%issuingimpossible,\%needsconfirmation);
}
#
# issuing book. We already have checked it can be issued, so, just issue it !
#
sub issuebook {
my ($env,$borrower,$barcode,$date) = @_;
warn "1";
my $dbh = C4::Context->dbh;
# my ($borrower, $flags) = &getpatroninformation($env, $borrowernumber, 0);
my $iteminformation = getiteminformation($env, 0, $barcode);
warn "B : ".$borrower->{borrowernumber}." / I : ".$iteminformation->{'itemnumber'};
#
# check if we just renew the issue.
#
my ($currentborrower) = currentborrower($iteminformation->{'itemnumber'});
if ($currentborrower eq $borrower->{'borrowernumber'}) {
warn "2";
my ($charge,$itemtype) = calc_charges($env, $dbh, $iteminformation->{'itemnumber'}, $borrower->{'borrowernumber'});
if ($charge > 0) {
createcharge($env, $dbh, $iteminformation->{'itemnumber'}, $borrower->{'borrowernumber'}, $charge);
$iteminformation->{'charge'} = $charge;
}
&UpdateStats($env,$env->{'branchcode'},'renew',$charge,'',$iteminformation->{'itemnumber'},$iteminformation->{'itemtype'},$borrower->{'borrowernumber'});
renewbook($env,$dbh, $borrower->{'borrowernumber'}, $iteminformation->{'itemnumber'});
} else {
#
# NOT a renewal
#
if ($currentborrower ne '') {
warn "3";
# This book is currently on loan, but not to the person
# who wants to borrow it now. mark it returned before issuing to the new borrower
returnbook($iteminformation->{'barcode'}, $env->{'branchcode'});
}
warn "4";
# See if the item is on reserve.
my ($restype, $res) = CheckReserves($iteminformation->{'itemnumber'});
if ($restype) {
warn "5";
my $resbor = $res->{'borrowernumber'};
if ($resbor eq $borrower->{'borrowernumber'}) {
# The item is on reserve to the current patron
FillReserve($res);
} elsif ($restype eq "Waiting") {
# The item is on reserve and waiting, but has been
# reserved by some other patron.
my ($resborrower, $flags)=getpatroninformation($env, $resbor,0);
my $branches = getbranches();
my $branchname = $branches->{$res->{'branchcode'}}->{'branchname'};
CancelReserve(0, $res->{'itemnumber'}, $res->{'borrowernumber'});
} elsif ($restype eq "Reserved") {
# The item is on reserve for someone else.
my ($resborrower, $flags)=getpatroninformation($env, $resbor,0);
my $branches = getbranches();
my $branchname = $branches->{$res->{'branchcode'}}->{'branchname'};
my $tobrcd = ReserveWaiting($res->{'itemnumber'}, $res->{'borrowernumber'});
transferbook($tobrcd,$barcode, 1);
}
}
# Record in the database the fact that the book was issued.
my $sth=$dbh->prepare("insert into issues (borrowernumber, itemnumber, date_due, branchcode) values (?,?,?,?)");
my $loanlength = $iteminformation->{loanlength} || 21;
my $datedue=time+($loanlength)*86400;
my @datearr = localtime($datedue);
my $dateduef = (1900+$datearr[5])."-".($datearr[4]+1)."-".$datearr[3];
if ($env->{'datedue'}) {
$dateduef=$env->{'datedue'};
}
$sth->execute($borrower->{'borrowernumber'}, $iteminformation->{'itemnumber'}, $dateduef, $env->{'branchcode'});
$sth->finish;
$iteminformation->{'issues'}++;
$sth=$dbh->prepare("update items set issues=? where itemnumber=?");
$sth->execute($iteminformation->{'issues'},$iteminformation->{'itemnumber'});
$sth->finish;
&itemseen($iteminformation->{'itemnumber'});
# If it costs to borrow this book, charge it to the patron's account.
my ($charge,$itemtype)=calc_charges($env, $dbh, $iteminformation->{'itemnumber'}, $borrower->{'borrowernumber'});
if ($charge > 0) {
createcharge($env, $dbh, $iteminformation->{'itemnumber'}, $borrower->{'borrowernumber'}, $charge);
$iteminformation->{'charge'}=$charge;
}
# Record the fact that this book was issued.
&UpdateStats($env,$env->{'branchcode'},'issue',$charge,'',$iteminformation->{'itemnumber'},$iteminformation->{'itemtype'},$borrower->{'borrowernumber'});
}
}
=item issuebook
($iteminformation, $datedue, $rejected, $question, $questionnumber,
@ -561,6 +745,7 @@ C<$message>, if defined, is an additional information message, e.g., a
rental fee notice.
=cut
#'
# FIXME - The business with $responses is absurd. For one thing, these
# questions should have names, not numbers. For another, it'd be
@ -584,7 +769,7 @@ rental fee notice.
# Is it this function's place to decide the default answer to the
# various questions? Why not document the various problems and allow
# the caller to decide?
sub issuebook {
sub issuebook2 {
my ($env, $patroninformation, $barcode, $responses, $date) = @_;
my $dbh = C4::Context->dbh;
my $iteminformation = getiteminformation($env, 0, $barcode);
@ -860,6 +1045,7 @@ C<$borrower> is a reference-to-hash, giving information about the
patron who last borrowed the book.
=cut
#'
# FIXME - This API is bogus. There's no need to return $borrower and
# $iteminformation; the caller can ask about those separately, if it
@ -1271,6 +1457,7 @@ the fields of the biblio, biblioitems, items, and issues fields of the
Koha database for that particular item.
=cut
#'
sub currentissues {
# New subroutine for Circ2.pm
@ -1443,39 +1630,6 @@ sub checkwaiting {
return ($cnt,\@itemswaiting);
}
# Not exported
# FIXME - This is nearly-identical to &C4::Accounts::checkaccount
sub checkaccount {
# Stolen from Accounts.pm
#take borrower number
#check accounts and list amounts owing
my ($env,$bornumber,$dbh,$date)=@_;
my $select="SELECT SUM(amountoutstanding) AS total
FROM accountlines
WHERE borrowernumber = ?
AND amountoutstanding<>0";
my @bind = ($bornumber);
if ($date ne ''){
$select.=" AND date < ?";
push(@bind,$date);
}
# print $select;
my $sth=$dbh->prepare($select);
$sth->execute(@bind);
my $data=$sth->fetchrow_hashref;
my $total = $data->{'total'};
$sth->finish;
# output(1,2,"borrower owes $total");
#if ($total > 0){
# # output(1,2,"borrower owes $total");
# if ($total > 5){
# reconcileaccount($env,$dbh,$bornumber,$total);
# }
#}
# pause();
return($total);
}
# FIXME - This is identical to &C4::Circulation::Renewals::renewstatus.
# Pick one and stick with it.
sub renewstatus {
@ -1702,6 +1856,30 @@ sub find_reserves {
return ($resfound,$lastrec);
}
sub fixdate {
my ($year, $month, $day) = @_;
my $invalidduedate;
my $date;
if (($year eq 0) && ($month eq 0) && ($year eq 0)) {
# $env{'datedue'}='';
} else {
if (($year eq 0) || ($month eq 0) || ($year eq 0)) {
$invalidduedate=1;
} else {
if (($day>30) && (($month==4) || ($month==6) || ($month==9) || ($month==11))) {
$invalidduedate = 1;
} elsif (($day > 29) && ($month == 2)) {
$invalidduedate=1;
} elsif (($month == 2) && ($day > 28) && (($year%4) && ((!($year%100) || ($year%400))))) {
$invalidduedate=1;
} else {
$date="$year-$month-$day";
}
}
}
return ($date, $invalidduedate);
}
1;
__END__

View file

@ -35,9 +35,10 @@ use C4::Koha;
use HTML::Template;
use C4::Date;
#
# PARAMETERS READING
#
my $query=new CGI;
#my ($loggedinuser, $sessioncookie, $sessionID) = checkauth
# ($query, 0, { circulate => 1 });
my ($template, $loggedinuser, $cookie) = get_template_and_user
({
@ -47,18 +48,21 @@ my ($template, $loggedinuser, $cookie) = get_template_and_user
authnotrequired => 0,
flagsrequired => { circulate => 1 },
});
my %env;
my $linecolor1='#ffffcc';
my $linecolor2='white';
my $branches = getbranches();
my $printers = getprinters(\%env);
my $printers = getprinters();
my $branch = getbranch($query, $branches);
my $printer = getprinter($query, $printers);
my $findborrower = $query->param('findborrower');
my $borrowernumber = $query->param('borrnumber');
my $print=$query->param('print');
my $barcode = $query->param('barcode');
my $year=$query->param('year');
my $month=$query->param('month');
my $day=$query->param('day');
my $stickyduedate=$query->param('stickyduedate');
my $issueconfirmed = $query->param('issueconfirmed');
#set up cookie.....
my $branchcookie;
@ -68,6 +72,7 @@ if ($query->param('setcookies')) {
$printercookie = $query->cookie(-name=>'printer', -value=>"$printer", -expires=>'+1y');
}
my %env; # env is used as an "environment" variable. Could be dropped probably...
$env{'branchcode'}=$branch;
$env{'printer'}=$printer;
$env{'queue'}=$printer;
@ -75,19 +80,25 @@ $env{'queue'}=$printer;
my @datearr = localtime(time());
# FIXME - Could just use POSIX::strftime("%Y%m%d", localtime);
my $todaysdate = (1900+$datearr[5]).sprintf ("%0.2d", ($datearr[4]+1)).sprintf ("%0.2d", ($datearr[3]));
#warn $todaysdate;
# get the borrower information.....
my $borrower;
if ($borrowernumber) {
$borrower = getpatroninformation(\%env,$borrowernumber,0);
}
my $message;
my $borrowerslist;
# my $message;
#
# STEP 2 : FIND BORROWER
# if there is a list of find borrowers....
my $findborrower = $query->param('findborrower');
#
my $borrowerslist;
if ($findborrower) {
my ($count,$borrowers)=BornameSearch(\%env,$findborrower,'web');
my @borrowers=@$borrowers;
if ($#borrowers == -1) {
$query->param('findborrower', '');
$message = "'$findborrower'";
} elsif ($#borrowers == 0) {
$query->param('borrnumber', $borrowers[0]->{'borrowernumber'});
$query->param('barcode','');
@ -96,114 +107,56 @@ if ($findborrower) {
}
}
my $borrowernumber = $query->param('borrnumber');
my $bornum = $query->param('borrnumber');
#
# STEP 3 : ISSUING
#
#
# check and see if we should print
my $print=$query->param('print');
my $barcode = $query->param('barcode');
if ($barcode eq '' && $print eq 'maybe'){
$print = 'yes';
}
if ($print eq 'yes' && $borrowernumber ne ''){
printslip(\%env,$borrowernumber);
$query->param('borrnumber','');
$borrowernumber='';
}
# if ($barcode eq '' && $print eq 'maybe'){
# $print = 'yes';
# }
# if ($print eq 'yes' && $borrowernumber ne ''){
# printslip(\%env,$borrowernumber);
# $query->param('borrnumber','');
# $borrowernumber='';
# }
# get the borrower information.....
my $borrower;
my $flags;
if ($borrowernumber) {
($borrower, $flags) = getpatroninformation(\%env,$borrowernumber,0);
}
# get the responses to any questions.....
my %responses;
foreach (sort $query->param) {
if ($_ =~ /response-(\d*)/) {
$responses{$1} = $query->param($_);
}
}
if (my $qnumber = $query->param('questionnumber')) {
$responses{$qnumber} = $query->param('answer');
}
my ($iteminformation, $duedate, $rejected, $question, $questionnumber, $defaultanswer);
my $year=$query->param('year');
my $month=$query->param('month');
my $day=$query->param('day');
# if the barcode is set
if ($barcode) {
$barcode = cuecatbarcodedecode($barcode);
my ($datedue, $invalidduedate) = fixdate($year, $month, $day);
unless ($invalidduedate) {
$env{'datedue'}=$datedue;
my @time=localtime(time);
my $date= (1900+$time[5])."-".($time[4]+1)."-".$time[3];
($iteminformation, $duedate, $rejected, $question, $questionnumber, $defaultanswer, $message)
= issuebook(\%env, $borrower, $barcode, \%responses, $date);
}
# unless ($invalidduedate) {
my ($error, $question) = canbookbeissued(\%env, $borrower, $barcode, $year, $month, $day);
my $noerror=1;
my $noquestion = 1;
foreach my $impossible (keys %$error) {
warn "Impossible : $impossible : ";#.%$error->{$impossible};
$template->param($impossible => 1,
IMPOSSIBLE => 1);
$noerror = 0;
}
foreach my $needsconfirmation (keys %$question) {
warn "needsconfirmation : $needsconfirmation : "; #.%$error->{$needsconfirmation};
$template->param($needsconfirmation => 1,
NEEDSCONFIRMATION => 1);
$noquestion = 0;
}
if ($noerror && ($noquestion || $issueconfirmed)) {
warn "NO ERROR";
# issuebook(\%env, $borrower, $barcode, $datedue);
}
# }
}
# reload the borrower info for the sake of reseting the flags.....
if ($borrowernumber) {
($borrower, $flags) = getpatroninformation(\%env,$borrowernumber,0);
$borrower = getpatroninformation(\%env,$borrowernumber,0);
}
##################################################################################
# HTML code....
my %responseform;
my @responsearray;
foreach (keys %responses) {
# $responsesform.="<input type=hidden name=response-$_ value=$responses{$_}>\n";
$responseform{'name'}=$_;
$responseform{'value'}=$responses{$_};
push @responsearray,\%responseform;
}
my $questionform;
my $stickyduedate;
if ($question) {
$stickyduedate=$query->param('stickyduedate');
}
# Barcode entry box, with hidden inputs attached....
# FIXME - How can we move this HTML into the template? Can we create
# arrays of the months, dates, etc and use <TMPL_LOOP> in the template to
# output the data that's getting built here?
my $counter = 1;
my $dayoptions = '';
my $monthoptions = '';
my $yearoptions = '';
for (my $i=1; $i<32; $i++) {
my $selected='';
if (($query->param('stickyduedate')) && ($day==$i)) {
$selected='selected';
}
$dayoptions.="<option value=$i $selected>$i";
}
foreach (('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec')) {
my $selected='';
if (($query->param('stickyduedate')) && ($month==$counter)) {
$selected='selected';
}
$monthoptions.="<option value=$counter $selected>$_";
$counter++;
}
for (my $i=$datearr[5]+1900; $i<$datearr[5]+1905; $i++) {
my $selected='';
if (($query->param('stickyduedate')) && ($year==$i)) {
$selected='selected';
}
$yearoptions.="<option value=$i $selected>$i";
}
my $selected='';
($query->param('stickyduedate')) && ($selected='checked');
# BUILD HTML
# make the issued books table.....
my $todaysissues='';
@ -211,75 +164,78 @@ my $previssues='';
my @realtodayissues;
my @realprevissues;
my $allowborrow;
my $hash;
if ($borrower) {
($borrower, $flags,$hash) = getpatroninformation(\%env,$borrowernumber,0);
$allowborrow= $hash->{'borrow'};
my @todaysissues;
my @previousissues;
my $issueslist = getissues($borrower);
foreach my $it (keys %$issueslist) {
my $issuedate = $issueslist->{$it}->{'timestamp'};
$issuedate = substr($issuedate, 0, 8);
if ($todaysdate == $issuedate) {
push @todaysissues, $issueslist->{$it};
} else {
push @previousissues, $issueslist->{$it};
}
# get each issue of the borrower & separate them in todayissues & previous issues
my @todaysissues;
my @previousissues;
my $issueslist = getissues($borrower);
# split in 2 arrays for today & previous
foreach my $it (keys %$issueslist) {
my $issuedate = $issueslist->{$it}->{'timestamp'};
$issuedate = substr($issuedate, 0, 8);
if ($todaysdate == $issuedate) {
push @todaysissues, $issueslist->{$it};
} else {
push @previousissues, $issueslist->{$it};
}
}
my $tcolor = '';
my $pcolor = '';
my $od = '';
my $od; # overdues
my $togglecolor;
# parses today & build Template array
foreach my $book (sort {$b->{'timestamp'} <=> $a->{'timestamp'}} @todaysissues){
my $dd = $book->{'date_due'};
my $datedue = $book->{'date_due'};
$dd=format_date($dd);
$datedue=~s/-//g;
if ($datedue < $todaysdate) {
$od = 'true';
$dd="$dd\n";
$od = 1;
} else {
$od=0;
}
($tcolor eq $linecolor1) ? ($tcolor=$linecolor2) : ($tcolor=$linecolor1);
$book->{'od'}=$od;
$book->{'dd'}=$dd;
$book->{'tcolor'}=$tcolor;
if ($book->{'author'} eq ''){
$book->{'author'}=' ';
$book->{'tcolor'}=$togglecolor;
if ($togglecolor) {
$togglecolor=0;
} else {
$togglecolor=1;
}
if ($book->{'author'} eq ''){
$book->{'author'}=' ';
}
push @realtodayissues,$book;
}
# FIXME - For small and private libraries, it'd be nice if this
# table included a "Return" link next to each book, so that you
# don't have to remember the book's bar code and type it in on the
# "Returns" page.
# This is in the template now, so its possible for a small library to make that link in their
# template
# parses previous & build Template array
foreach my $book (sort {$a->{'date_due'} cmp $b->{'date_due'}} @previousissues){
my $dd = $book->{'date_due'};
my $datedue = $book->{'date_due'};
$dd=format_date($dd);
my $pcolor = '';
my $od = '';
$datedue=~s/-//g;
if ($datedue < $todaysdate) {
$od = 'true';
$dd="$dd\n";
my $dd = $book->{'date_due'};
my $datedue = $book->{'date_due'};
$dd=format_date($dd);
my $pcolor = '';
my $od = '';
$datedue=~s/-//g;
if ($datedue < $todaysdate) {
$od = 1;
} else {
$od = 0;
}
$book->{'tcolor'}=$togglecolor;
if ($togglecolor) {
$togglecolor=0;
} else {
$togglecolor=1;
}
$book->{'dd'}=$dd;
$book->{'od'}=$od;
$book->{'tcolor'}=$pcolor;
if ($book->{'author'} eq ''){
$book->{'author'}=' ';
}
push @realprevissues,$book
}
($pcolor eq $linecolor1) ? ($pcolor=$linecolor2) : ($pcolor=$linecolor1);
$book->{'dd'}=$dd;
$book->{'od'}=$od;
$book->{'tcolor'}=$pcolor;
if ($book->{'author'} eq ''){
$book->{'author'}=' ';
}
push @realprevissues,$book
}
}
my @values;
my %labels;
my $CGIselectborrower;
@ -297,7 +253,7 @@ if ($borrowerslist) {
#title
my ($patrontable, $flaginfotable) = patrontable($borrower);
my $amountold=$flags->{'CHARGES'}->{'message'};
my $amountold=$borrower->{flags}->{'CHARGES'}->{'message'};
my @temp=split(/\$/,$amountold);
$amountold=$temp[1];
$template->param(
@ -308,11 +264,8 @@ $template->param(
printer => $printer,
branchname => $branches->{$branch}->{'branchname'},
printername => $printers->{$printer}->{'printername'},
allowborrow =>$allowborrow,
#question form
question => $question,
title => $iteminformation->{'title'},
author => $iteminformation->{'author'},
# title => $iteminformation->{'title'},
# author => $iteminformation->{'author'},
firstname => $borrower->{'firstname'},
surname => $borrower->{'surname'},
categorycode => $borrower->{'categorycode'},
@ -320,25 +273,25 @@ $template->param(
city => $borrower->{'city'},
phone => $borrower->{'phone'},
cardnumber => $borrower->{'cardnumber'},
question => $question,
barcode => $barcode,
questionnumber => $questionnumber,
dayoptions => $dayoptions,
monthoptions => $monthoptions,
yearoptions => $yearoptions,
stickyduedate => $stickyduedate,
rejected => $rejected,
message => $message,
CGIselectborrower => $CGIselectborrower,
amountold => $amountold,
barcode => $barcode,
stickyduedate => $stickyduedate,
CGIselectborrower => $CGIselectborrower,
todayissues => \@realtodayissues,
previssues => \@realprevissues,
responseloop => \@responsearray,
month=>$month,
day=>$day,
year=>$year
);
# set return date if stickyduedate
if ($stickyduedate) {
my $t_year = "year".$year;
my $t_month = "month".$month;
my $t_day = "day".$day;
$template->param(
$t_year => 1,
$t_month => 1,
$t_day => 1,
);
}
if ($branchcookie) {
$cookie=[$cookie, $branchcookie, $printercookie];
@ -361,37 +314,6 @@ sub cuecatbarcodedecode {
}
}
sub fixdate {
my ($year, $month, $day) = @_;
my $invalidduedate;
my $date;
if (($year eq 0) && ($month eq 0) && ($year eq 0)) {
$env{'datedue'}='';
} else {
# FIXME - Can we set two flags here, one that says 'invalidduedate', so that
# the template can check for it, and then one for a particular message?
# Ex: <TMPL_IF NAME="invalidduedate"> <TMPL_IF NAME="daysinFeb">
# Invalid Due Date Specified. Book was not issued. Never that many days
# in February! </TMPL_IF> </TMPL_IF>
if (($year eq 0) || ($month eq 0) || ($year eq 0)) {
$invalidduedate="Invalid Due Date Specified. Book was not issued.<p>\n";
} else {
if (($day>30) && (($month==4) || ($month==6) || ($month==9) || ($month==11))) {
$invalidduedate = "Invalid Due Date Specified. Book was not issued. Only 30 days in $month month.<p>\n";
} elsif (($day > 29) && ($month == 2)) {
$invalidduedate="Invalid Due Date Specified. Book was not issued. Never that many days in February!<p>\n";
} elsif (($month == 2) && ($day > 28) && (($year%4) && ((!($year%100) || ($year%400))))) {
$invalidduedate="Invalid Due Date Specified. Book was not issued. $year is not a leap year.<p>\n";
} else {
$date="$year-$month-$day";
}
}
}
return ($date, $invalidduedate);
}
sub patrontable {
my ($borrower) = @_;
@ -402,9 +324,6 @@ sub patrontable {
my $flag;
my $color='';
foreach $flag (sort keys %$flags) {
warn $flag;
# my @itemswaiting='';
($color eq $linecolor1) ? ($color=$linecolor2) : ($color=$linecolor1);
$flags->{$flag}->{'message'}=~s/\n/<br>/g;
if ($flags->{$flag}->{'noissues'}) {
$template->param(
@ -465,7 +384,7 @@ sub patrontable {
my $color=$currentcolor;
my @itemswaiting;
foreach my $item (@$items) {
($color eq $linecolor1) ? ($color=$linecolor2) : ($color=$linecolor1);
# ($color eq $linecolor1) ? ($color=$linecolor2) : ($color=$linecolor1);
my ($iteminformation) = getiteminformation(\%env, $item->{'itemnumber'}, 0);
push @itemswaiting, $iteminformation;
}
@ -485,40 +404,6 @@ sub patrontable {
return($patrontable, $flaginfotext);
}
# FIXME - This clashes with &C4::Print::printslip
sub printslip {
my ($env,$borrowernumber)=@_;
my ($borrower, $flags) = getpatroninformation($env,$borrowernumber,0);
$env->{'todaysissues'}=1;
my ($borrowerissues) = currentissues($env, $borrower);
$env->{'nottodaysissues'}=1;
$env->{'todaysissues'}=0;
my ($borroweriss2)=currentissues($env, $borrower);
$env->{'nottodaysissues'}=0;
my $i=0;
my @issues;
foreach (sort {$a <=> $b} keys %$borrowerissues) {
$issues[$i]=$borrowerissues->{$_};
my $dd=$issues[$i]->{'date_due'};
#convert to nz style dates
#this should be set with some kinda config variable
my @tempdate=split(/-/,$dd);
$issues[$i]->{'date_due'}="$tempdate[2]/$tempdate[1]/$tempdate[0]";
$i++;
}
foreach (sort {$a <=> $b} keys %$borroweriss2) {
$issues[$i]=$borroweriss2->{$_};
my $dd=$issues[$i]->{'date_due'};
#convert to nz style dates
#this should be set with some kinda config variable
my @tempdate=split(/-/,$dd);
$issues[$i]->{'date_due'}="$tempdate[2]/$tempdate[1]/$tempdate[0]";
$i++;
}
remoteprint($env,\@issues,$borrower);
}
# Local Variables:
# tab-width: 8
# End:

View file

@ -117,7 +117,7 @@ if ( $query->param('resbarcode') ) {
my $name =
$borr->{'surname'} . " " . $borr->{'title'} . " " . $borr->{'firstname'};
my $slip = $query->param('resslip');
printslip( \%env, $slip );
# printslip( \%env, $slip ); #removed by paul
if ( $tobranchcd ne $branch ) {
$template->param(

View file

@ -1,130 +1,75 @@
<!-- TMPL_INCLUDE NAME="circulation-top.inc" -->
<div id="mainbloc">
<h1 class="circulation">Circulation: Issues</h1>
<p>
<b>Branch:</b> <!-- TMPL_VAR name="branchname" -->,
<b>Printer:</b> <!-- TMPL_VAR name="printername" -->
<a href="selectbranchprinter.pl" class="button circulation">Change Settings</a>
</p>
<!-- TMPL_IF name="question" -->
<table>
<tr>
<th>
Issuing Question
</th>
</tr>
<tr>
<td>
Attempting to issue <!-- TMPL_VAR name="title" -->
by <!-- TMPL_VAR name="author" --> to <!-- TMPL_VAR name="firstname" --> <!-- TMPL_VAR name="surname" -->.
<p><!-- TMPL_VAR name="question" --></p>
</td>
</tr>
<tr>
<td align="center">
<table border="0">
<tr>
<td>
<form method="get">
<input type="hidden" name="borrnumber" value="<!-- TMPL_VAR name="borrowernumber" -->">
<input type="hidden" name="barcode" value="<!-- TMPL_VAR name="barcode" -->">
<input type="hidden" name="questionnumber" value="<!-- TMPL_VAR name="questionnumber" -->">
<input type="hidden" name="day" value="<!-- TMPL_VAR name="day" -->">
<input type="hidden" name="month" value="<!-- TMPL_VAR name="month" -->">
<input type="hidden" name="year" value="<!-- TMPL_VAR name="year" -->">
<input type="hidden" name="stickyduedate" value="<!-- TMPL_VAR name="stickyduedate" -->">
<input type="hidden" name="branch" value="<!-- TMPL_VAR name="branch" -->">
<input type="hidden" name="printer" value="<!-- TMPL_VAR name="printer" -->">
<!-- TMPL_LOOP NAME="responseloop" -->
<input type="hidden" name="<!-- TMPL_VAR NAME="name" -->" value="<!-- TMPL_VAR NAME="value" -->">
<!-- /TMPL_LOOP -->
<input type="hidden" name="answer" value="Y">
<input type="submit" value="Yes">
</form>
</td>
<td>
<form method="get">
<input type="hidden" name="borrnumber" value="<!-- TMPL_VAR name="borrowernumber" -->">
<input type="hidden" name="barcode" value="<!-- TMPL_VAR name="barcode" -->">
<input type="hidden" name="questionnumber" value="<!-- TMPL_VAR name="questionnumber" -->">
<input type="hidden" name="day" value="<!-- TMPL_VAR name="day" -->">
<input type="hidden" name="month" value="<!-- TMPL_VAR name="month" -->">
<input type="hidden" name="year" value="<!-- TMPL_VAR name="year" -->">
<input type="hidden" name="stickyduedate" value="<!-- TMPL_VAR name="stickyduedate" -->">
<input type="hidden" name="branch" value="<!-- TMPL_VAR name="branch" -->">
<input type="hidden" name="printer" value="<!-- TMPL_VAR name="printer" -->">
<!-- TMPL_LOOP NAME="responseloop" -->
<input type="hidden" name="<!-- TMPL_VAR NAME="name" -->" value="<!-- TMPL_VAR NAME="value" -->">
<!-- /TMPL_LOOP -->
<input type="hidden" name="answer" value="N">
<input type="submit" value="No">
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<!-- /TMPL_IF -->
<!--
INITIAL BLOC : PARAMETERS & BORROWER INFO
-->
<div id="bloc25">
<h2 class="circulation">Parameters</h2>
<p>
<b>Branch:</b> <!-- TMPL_VAR name="branchname" -->,
<b>Printer:</b> <!-- TMPL_VAR name="printername" -->
<a href="selectbranchprinter.pl" class="button circulation">Change Settings</a>
</p>
<!-- TMPL_IF name="message" -->
<table>
<tr><th>Messages</th></tr>
<tr><td>No borrower matched <!-- TMPL_VAR name="message" --></td></tr>
</table>
<!-- /TMPL_IF -->
<!-- TMPL_IF name="CGIselectborrower" -->
<form method="post" action="/cgi-bin/koha/circ/circulation.pl">
<input type="hidden" name="branch" value="<!-- TMPL_VAR name="branch" -->">
<input type="hidden" name="printer" value="<!-- TMPL_VAR name="printer" -->">
<h2 class="circulation">Select a borrower</h2>
<!-- TMPL_VAR name="CGIselectborrower" -->
<input type="submit" value="OK" class="button circulation">
<!-- TMPL_ELSE -->
<!-- TMPL_IF NAME="borrowernumber" -->
<!-- TMPL_ELSE -->
<table>
<tr>
<th class="circulation">
Enter borrower card number or partial last name
</th>
</tr>
<tr>
<td>
<form method="post" action="/cgi-bin/koha/circ/circulation.pl">
<input name="findborrower">
<input type="hidden" name="branch" value="<!-- TMPL_VAR name="branch" -->">
<input type="hidden" name="printer" value="<!-- TMPL_VAR name="printer" -->">
<input type="submit" value="OK" class="button circulation">
</form>
</td>
</tr>
</table>
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
<!-- TMPL_IF name="borrowernumber" -->
<h2 class="circulation">Borrower information</h2>
<p>
<a href="/cgi-bin/koha/moremember.pl?bornum=<!-- TMPL_VAR name="borrowernumber" -->" onClick="openWindow(this,'Member', 480, 640)">
<!-- TMPL_VAR name="firstname" --> <!-- TMPL_VAR name="surname" -->
</a>
</p>
<p>
<!-- TMPL_VAR name="streetaddress" --> <!-- TMPL_VAR name="city" -->
</p>
<p>
<!-- TMPL_VAR name="phone" -->
</p>
<p>Category: <!-- TMPL_VAR name="categorycode" --></p>
<!-- /TMPL_IF -->
</div>
<!-- TMPL_IF name="rejected" -->
<table border="1" cellpadding="5" cellspacing="0" bgcolor="#dddddd">
<tr><th><font color="black" size="5">Error Issuing Book</font></th></tr>
<tr><td><font color="red" size="5"><!-- TMPL_VAR name="rejected" --></font></td></tr>
</table>
<br>
<!-- /TMPL_IF -->
<!-- TMPL_IF name="message" -->
<table>
<tr><th>Messages</th></tr>
<tr><td>No borrower matched <!-- TMPL_VAR name="message" --></td></tr>
</table>
<!-- /TMPL_IF -->
<!-- TMPL_IF name="CGIselectborrower" -->
<form method="post" action="/cgi-bin/koha/circ/circulation.pl">
<input type="hidden" name="branch" value="<!-- TMPL_VAR name="branch" -->">
<input type="hidden" name="printer" value="<!-- TMPL_VAR name="printer" -->">
<table border="1" cellspacing="0" cellpadding="5" bgcolor="#dddddd">
<tr>
<th background="<!-- TMPL_VAR name="themelang" -->/images/background-mem.gif">
<font color="black"><b>Select a borrower</b></font>
</th>
</tr>
<tr>
<td align="center">
<!-- TMPL_VAR name="CGIselectborrower" -->
<br>
<input type="submit" value="OK" class="button circulation">
</td>
</tr>
</table>
<!-- TMPL_ELSE -->
<!-- TMPL_IF NAME="borrowernumber" -->
<!-- TMPL_ELSE -->
<table>
<tr>
<th class="circulation">
Enter borrower card number or partial last name
</th>
</tr>
<tr>
<td>
<form method="post" action="/cgi-bin/koha/circ/circulation.pl">
<input name="findborrower">
<input type="hidden" name="branch" value="<!-- TMPL_VAR name="branch" -->">
<input type="hidden" name="printer" value="<!-- TMPL_VAR name="printer" -->">
<input type="submit" value="OK" class="button circulation">
</form>
</td>
</tr>
</table>
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
<!--
BARCODE ENTRY
-->
<!-- TMPL_IF name="borrowernumber" -->
<div id="bloc25">
@ -132,9 +77,63 @@
<h2 class="circulation">Enter Book Barcode</h2>
<p>Item Barcode:<input name="barcode" size="10"> <input type="submit" value="Issue" class="button circulation"></p>
<p>
<select name="day"><option value="0">Day<!-- TMPL_VAR name="dayoptions" --></select>
<select name="month"><option value="0">Month<!-- TMPL_VAR name="monthoptions" --></select>
<select name="year"><option value="0">Year<!-- TMPL_VAR name="yearoptions" --></select>
<select name="day">
<option value="0">Day</option>
<option value="1" <!-- TMPL_IF name="day1" -->selected<!-- /TMPL_IF -->>1</option>
<option value="2" <!-- TMPL_IF name="day2" -->selected<!-- /TMPL_IF -->>2</option>
<option value="3" <!-- TMPL_IF name="day3" -->selected<!-- /TMPL_IF -->>3</option>
<option value="4" <!-- TMPL_IF name="day4" -->selected<!-- /TMPL_IF -->>4</option>
<option value="5" <!-- TMPL_IF name="day5" -->selected<!-- /TMPL_IF -->>5</option>
<option value="6" <!-- TMPL_IF name="day6" -->selected<!-- /TMPL_IF -->>6</option>
<option value="7" <!-- TMPL_IF name="day7" -->selected<!-- /TMPL_IF -->>7</option>
<option value="8" <!-- TMPL_IF name="day8" -->selected<!-- /TMPL_IF -->>8</option>
<option value="9" <!-- TMPL_IF name="day9" -->selected<!-- /TMPL_IF -->>9</option>
<option value="10" <!-- TMPL_IF name="day10" -->selected<!-- /TMPL_IF -->>10</option>
<option value="11" <!-- TMPL_IF name="day11" -->selected<!-- /TMPL_IF -->>11</option>
<option value="12" <!-- TMPL_IF name="day12" -->selected<!-- /TMPL_IF -->>12</option>
<option value="13" <!-- TMPL_IF name="day13" -->selected<!-- /TMPL_IF -->>13</option>
<option value="14" <!-- TMPL_IF name="day14" -->selected<!-- /TMPL_IF -->>14</option>
<option value="15" <!-- TMPL_IF name="day15" -->selected<!-- /TMPL_IF -->>15</option>
<option value="16" <!-- TMPL_IF name="day16" -->selected<!-- /TMPL_IF -->>16</option>
<option value="17" <!-- TMPL_IF name="day17" -->selected<!-- /TMPL_IF -->>17</option>
<option value="18" <!-- TMPL_IF name="day18" -->selected<!-- /TMPL_IF -->>18</option>
<option value="19" <!-- TMPL_IF name="day19" -->selected<!-- /TMPL_IF -->>19</option>
<option value="20" <!-- TMPL_IF name="day20" -->selected<!-- /TMPL_IF -->>20</option>
<option value="21" <!-- TMPL_IF name="day21" -->selected<!-- /TMPL_IF -->>21</option>
<option value="22" <!-- TMPL_IF name="day22" -->selected<!-- /TMPL_IF -->>22</option>
<option value="23" <!-- TMPL_IF name="day23" -->selected<!-- /TMPL_IF -->>23</option>
<option value="24" <!-- TMPL_IF name="day24" -->selected<!-- /TMPL_IF -->>24</option>
<option value="25" <!-- TMPL_IF name="day25" -->selected<!-- /TMPL_IF -->>25</option>
<option value="26" <!-- TMPL_IF name="day26" -->selected<!-- /TMPL_IF -->>26</option>
<option value="27" <!-- TMPL_IF name="day27" -->selected<!-- /TMPL_IF -->>27</option>
<option value="28" <!-- TMPL_IF name="day28" -->selected<!-- /TMPL_IF -->>28</option>
<option value="29" <!-- TMPL_IF name="day29" -->selected<!-- /TMPL_IF -->>29</option>
<option value="30" <!-- TMPL_IF name="day30" -->selected<!-- /TMPL_IF -->>30</option>
<option value="31" <!-- TMPL_IF name="day31" -->selected<!-- /TMPL_IF -->>31</option>
</select>
<select name="month">
<option value="0">Month</option>
<option value="1" <!-- TMPL_IF name="month1" -->selected<!-- /TMPL_IF -->>Jan</option>
<option value="2" <!-- TMPL_IF name="month2" -->selected<!-- /TMPL_IF -->>Feb</option>
<option value="3" <!-- TMPL_IF name="month3" -->selected<!-- /TMPL_IF -->>Mar</option>
<option value="4" <!-- TMPL_IF name="month4" -->selected<!-- /TMPL_IF -->>Apr</option>
<option value="5" <!-- TMPL_IF name="month5" -->selected<!-- /TMPL_IF -->>May</option>
<option value="6" <!-- TMPL_IF name="month6" -->selected<!-- /TMPL_IF -->>Jun</option>
<option value="7" <!-- TMPL_IF name="month7" -->selected<!-- /TMPL_IF -->>Jul</option>
<option value="8" <!-- TMPL_IF name="month8" -->selected<!-- /TMPL_IF -->>Aug</option>
<option value="9" <!-- TMPL_IF name="month9" -->selected<!-- /TMPL_IF -->>Sep</option>
<option value="10" <!-- TMPL_IF name="month10" -->selected<!-- /TMPL_IF -->>Oct</option>
<option value="11" <!-- TMPL_IF name="month11" -->selected<!-- /TMPL_IF -->>Nov</option>
<option value="12" <!-- TMPL_IF name="month12" -->selected<!-- /TMPL_IF -->>Dec</option>
</select>
<select name="year">
<option value="0">Year</option>
<option value="2004" <!-- TMPL_IF name="year2004" -->selected<!-- /TMPL_IF -->>2004</option>
<option value="2005" <!-- TMPL_IF name="year2005" -->selected<!-- /TMPL_IF -->>2005</option>
<option value="2006" <!-- TMPL_IF name="year2006" -->selected<!-- /TMPL_IF -->>2006</option>
<option value="2007" <!-- TMPL_IF name="year2007" -->selected<!-- /TMPL_IF -->>2007</option>
<option value="2008" <!-- TMPL_IF name="year2008" -->selected<!-- /TMPL_IF -->>2008</option>
</select>
</p>
<p>
<input type="checkbox" name="stickyduedate" <!-- TMPL_VAR name="selected" -->> Sticky Due Date
@ -149,55 +148,87 @@
</p>
</form>
</div>
<!--
RESULT OF ISSUING REQUEST
-->
<div id="bloc25">
<h2 class="circulation">Borrower information</h2>
<p><a href="/cgi-bin/koha/moremember.pl?bornum=<!-- TMPL_VAR name="borrowernumber" -->" onClick="openWindow(this,'Member', 480, 640)">
<!-- TMPL_VAR name="firstname" --> <!-- TMPL_VAR name="surname" --></a></p>
<p>Category: <!-- TMPL_VAR name="categorycode" --></p>
<!-- TMPL_IF name="noissues" -->
<!-- TMPL_IF NAME="gna" -->
<p class="problem">GNA :Borrower is gone with no address</p>
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="lost" -->
<p class="problem">LOST : Borrower's card is lost</p>
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="dbarred" -->
<p class="problem">DBARRED : Borrower is debarred</p>
<!-- /TMPL_IF -->
<!-- TMPL_IF name="charges" -->
<p class="problem">CHARGES : <a href="/cgi-bin/koha/pay.pl?bornum=<!-- TMPL_VAR name="borrowernumber" -->" onClick="openWindow(this, 'Payment', 480,640)">Payment</a></p>
<!-- TMPL_ELSE -->
<p class="problem"><!-- TMPL_VAR name="flag" --> : <!-- TMPL_VAR name="message" --></p>
<!-- /TMPL_IF -->
<!-- TMPL_ELSE -->
<!-- TMPL_IF name="charges" -->
<p class="problem">CHARGES : <a href="/cgi-bin/koha/pay.pl?bornum=<!-- TMPL_VAR name="borrowernumber" -->" onClick="openWindow(this, 'Payment', 480,640)">Payment</a></p>
<!-- TMPL_IF name="IMPOSSIBLE" -->
<h2 class="problem">Issuing impossible</h2>
<!-- TMPL_IF name="INVALID_DATE" -->
<p class="problem">The due date is invalid</p>
<!-- /TMPL_IF -->
<!-- TMPL_IF name="UNKNOWN_BARCODE" -->
<p class="problem">The barcode is unknown</p>
<!-- /TMPL_IF -->
<!-- TMPL_IF name="NOT_FOR_LOAN" -->
<p class="problem">Item not for loan</p>
<!-- /TMPL_IF -->
<!-- TMPL_IF name="WTHDRAWN" -->
<p class="problem">Item withdrawn</p>
<!-- /TMPL_IF -->
<!-- TMPL_IF name="GNA" -->
<p class="problem">Borrower is gone with no address</p>
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="CARD_LOST" -->
<p class="problem">Borrower's card is lost</p>
<!-- /TMPL_IF -->
<!-- TMPL_IF name="waiting" -->
<p class="problem">WAITING :
<!-- TMPL_LOOP name="itemswaiting" -->
<a href="/cgi-bin/koha/detail.pl?bib=<!-- TMPL_VAR name="biblionumber" -->&amp;type=intra" onClick="openWindow(this, 'Item', 480, 640)"><!-- TMPL_VAR name="barcode" --></a> <!-- TMPL_VAR name="title" --> (<!-- TMPL_VAR name="branchname" -->)<br>
<!-- /TMPL_LOOP -->
</p>
<!-- TMPL_IF NAME="DEBARRED" -->
<p class="problem">Borrower is debarred</p>
<!-- /TMPL_IF -->
<!-- TMPL_IF name="odues" -->
<!-- TMPL_IF name="nonreturns" -->
<p class="problem">ODUES : Yes, See below</p>
<!-- /TMPL_IF -->
<!-- TMPL_IF name="NO_MORE_RENEWALS" -->
<p class="problem">No more renewals possible</p>
<!-- /TMPL_IF -->
<!-- TMPL_IF name="notes" -->
<p class="problem">NOTES : <!-- TMPL_VAR name="notesmsg" --></p>
<br/>
<!-- /TMPL_IF -->
<!-- TMPL_IF name="needsconfirmation" -->
<h2 class="problem">I need confirmation before issuing</h2>
<!-- TMPL_IF name="DEBT" -->
<p>The borrower has debts</p>
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
<!-- TMPL_IF name="RENEW_ISSUE" -->
<p>Not an issue but a renewal</p>
<!-- /TMPL_IF -->
<!-- TMPL_IF name="RESERVE_WAITING" -->
<p>Reserve waiting</p>
<!-- /TMPL_IF -->
<!-- TMPL_IF name="ISSUED_TO_ANOTHER" -->
<p>Item issued to someone else. Return & issue ?</p>
<!-- /TMPL_IF -->
<!-- TMPL_UNLESS name="IMPOSSIBLE" -->
<form method="post">
<input type="hidden" name="barcode" value="<!-- TMPL_VAR name="barcode" -->">
<input type="hidden" name="borrnumber" value="<!-- TMPL_VAR name="borrowernumber">">
<input type="hidden" name="issueconfirmed" value="1">
<input type="submit" value="Confirm issue" class="button circulation">
</form>
<!-- /TMPL_UNLESS -->
<!-- /TMPL_IF -->
<!-- TMPL_IF name="issued" -->
<p>Item issued</p>
<!-- /TMPL_IF -->
</div>
<!-- /TMPL_IF -->
<!--
SUMMARY : TODAY & PREVIOUS ISSUES
-->
<!-- TMPL_IF name="todayissues" -->
<div id="bloc25">
<h2 class="circulation">Todays Issues</h2>
<table>
<tr>
<th>Due Date</th><th>Bar Code</th><th>Title</th><th>Author</th><th>Class</th>
<th class="circulation">Due Date</th>
<th class="circulation">Bar Code</th>
<th class="circulation">Title</th>
<th class="circulation">Author</th>
<th class="circulation">Class</th>
</tr>
<!-- TMPL_LOOP name="todayissues" -->
<tr>
@ -225,7 +256,11 @@
<h2 class="circulation">Previous Issues</h2>
<table>
<tr>
<th>Due Date</th><th>Bar Code</th><th>Title</th><th>Author</th><th>Class</th>
<th class="circulation">Due Date</th>
<th class="circulation">Bar Code</th>
<th class="circulation">Title</th>
<th class="circulation">Author</th>
<th class="circulation">Class</th>
</tr>
<!-- TMPL_LOOP name="previssues" -->
<tr>