Making a change to the way charges are handled, the system originally worked such that if a borrower owed more than $5 issues werent allowed. This worked fine except that often borrowers wish to borrows say 3 pay videos at $2 each, then 2 books say. The three pay videos rack up charges of $6 and then they cant issue the books until that is paid.
Reworked so that it cares about previous charges, not the ones accrued during current issue process.
This commit is contained in:
parent
fb870fb2c8
commit
b2c9dabcf1
|
|
@ -186,7 +186,7 @@ sub findborrower {
|
|||
|
||||
|
||||
sub issuebook {
|
||||
my ($env, $patroninformation, $barcode, $responses) = @_;
|
||||
my ($env, $patroninformation, $barcode, $responses, $date) = @_;
|
||||
my $dbh=&C4Connect;
|
||||
my $iteminformation=getiteminformation($env, 0, $barcode);
|
||||
my ($datedue);
|
||||
|
|
@ -204,7 +204,7 @@ sub issuebook {
|
|||
$rejected="Patron is Debarred";
|
||||
last SWITCH;
|
||||
}
|
||||
my $amount = checkaccount($env,$patroninformation->{'borrowernumber'}, $dbh);
|
||||
my $amount = checkaccount($env,$patroninformation->{'borrowernumber'}, $dbh,$date);
|
||||
if ($amount>5) {
|
||||
$rejected=sprintf "Patron owes \$%.02f.", $amount;
|
||||
last SWITCH;
|
||||
|
|
@ -317,6 +317,7 @@ sub issuebook {
|
|||
if ($env->{'datedue'}) {
|
||||
$dateduef=$env->{'datedue'};
|
||||
}
|
||||
$dateduef=~ s/2001\-4\-25/2001\-4\-26/;
|
||||
my $sth=$dbh->prepare("insert into issues (borrowernumber, itemnumber, date_due, branchcode) values ($patroninformation->{'borrowernumber'}, $iteminformation->{'itemnumber'}, '$dateduef', '$env->{'branchcode'}')");
|
||||
$sth->execute;
|
||||
$sth->finish;
|
||||
|
|
@ -642,9 +643,14 @@ sub checkaccount {
|
|||
# Stolen from Accounts.pm
|
||||
#take borrower number
|
||||
#check accounts and list amounts owing
|
||||
my ($env,$bornumber,$dbh)=@_;
|
||||
my $sth=$dbh->prepare("Select sum(amountoutstanding) from accountlines where
|
||||
borrowernumber=$bornumber and amountoutstanding<>0");
|
||||
my ($env,$bornumber,$dbh,$date)=@_;
|
||||
my $select="Select sum(amountoutstanding) from accountlines where
|
||||
borrowernumber=$bornumber and amountoutstanding<>0";
|
||||
if ($date ne ''){
|
||||
$select.=" and date < '$date'";
|
||||
}
|
||||
# print $select;
|
||||
my $sth=$dbh->prepare($select);
|
||||
$sth->execute;
|
||||
my $total=0;
|
||||
while (my $data=$sth->fetchrow_hashref){
|
||||
|
|
|
|||
|
|
@ -72,8 +72,16 @@ my $printercookie=$query->cookie(-name=>'printer', -value=>"$printer", -expires=
|
|||
print $query->header(-type=>'text/html',-expires=>'now', -cookie=>[$branchcookie,$printercookie]);
|
||||
#print $query->dump;
|
||||
print startpage();
|
||||
print startmenu('circulation');
|
||||
|
||||
#print startmenu('circulation');
|
||||
my @inp=startmenu('circulation');
|
||||
if ($query->param('module') eq 'issues' && $query->param('barcode') eq '' && $query->param('charges') eq 'yes'){
|
||||
my $count=@inp;
|
||||
for (my $i=0;$i<$count;$i++){
|
||||
my $bornum=$query->param('borrnumber');
|
||||
$inp[$i]=~ s/onLoad=focusinput\(\)/onLoad=focusinput\(\)\;messenger\(\"\/cgi-bin\/koha\/pay.pl?bornum=$bornum\"\)\;window1.focus\(\)/;
|
||||
}
|
||||
}
|
||||
print @inp;
|
||||
|
||||
print <<EOF
|
||||
<script language="javascript" type="text/javascript">
|
||||
|
|
@ -84,7 +92,7 @@ function messenger(url){
|
|||
//-->
|
||||
</script>
|
||||
EOF
|
||||
|
||||
;
|
||||
if ($printer && $branch) {
|
||||
|
||||
SWITCH: {
|
||||
|
|
@ -225,7 +233,7 @@ EOF
|
|||
}
|
||||
|
||||
my $barcodeentrytext= << "EOF";
|
||||
<form method=get>
|
||||
<form method=post action=/cgi-bin/koha/circ/circulation.pl>
|
||||
<table border=0 cellpadding=5 cellspacing=0 bgcolor=#dddddd>
|
||||
<tr><td colspan=2 bgcolor=$headerbackgroundcolor align=center background=$backgroundimage><font color=black><b>Enter Book Barcode</b></font></td></tr>
|
||||
<tr><td>Item Barcode:</td><td><input name=barcode size=10></td></tr>
|
||||
|
|
@ -487,7 +495,9 @@ EOF
|
|||
$responses{$qnumber}=$query->param('answer');
|
||||
}
|
||||
unless ($invalidduedate) {
|
||||
my ($iteminformation, $duedate, $rejected, $question, $questionnumber, $defaultanswer, $message) = issuebook(\%env, $borrower, $barcode, \%responses);
|
||||
my @time=localtime(time);
|
||||
my $date= (1900+$time[5])."-".($time[4]+1)."-".$time[3];
|
||||
my ($iteminformation, $duedate, $rejected, $question, $questionnumber, $defaultanswer, $message) = issuebook(\%env, $borrower, $barcode, \%responses,$date);
|
||||
unless ($iteminformation) {
|
||||
print << "EOF";
|
||||
<table border=0 cellpadding=5 cellspacing=0 bgcolor=#dddddd>
|
||||
|
|
@ -505,8 +515,8 @@ EOF
|
|||
} else {
|
||||
print << "EOF"
|
||||
<table border=0 cellpadding=5 cellspacing=0 bgcolor=#dddddd>
|
||||
<tr><th bgcolor= background=$backgroundimage><font color=black>Error Issuing Book</font></th></tr>
|
||||
<tr><td><font color=red>$rejected</font></td></tr>
|
||||
<tr><th><font color=black size=6>Error Issuing Book</font></th></tr>
|
||||
<tr><td><font color=red size=6>$rejected</font></td></tr>
|
||||
</table>
|
||||
<br>
|
||||
EOF
|
||||
|
|
@ -697,7 +707,18 @@ EOF
|
|||
<input type=hidden name=borrnumber value=$borrnumber>
|
||||
<input type=hidden name=branch value=$branch>
|
||||
<input type=hidden name=printer value=$printer>
|
||||
</form>
|
||||
|
||||
EOF
|
||||
;
|
||||
my $amountold=$flags->{'CHARGES'}->{'message'};
|
||||
my @temp=split(/\$/,$amountold);
|
||||
$amountold=$temp[1];
|
||||
print "<input type=hidden name=oldamount value=$amountold>";
|
||||
if ($flags->{'CHARGES'}){
|
||||
print "<input type=hidden name=charges value=yes>";
|
||||
}
|
||||
print <<EOF
|
||||
</form>
|
||||
</td>
|
||||
|
||||
|
||||
|
|
@ -805,7 +826,7 @@ sub patrontable {
|
|||
}
|
||||
} else {
|
||||
if ($flag eq 'CHARGES') {
|
||||
$flaginfotext.="<tr><td valign=top>$flag</td><td $flags->{$flag}->{'message'} <a href=/cgi-bin/koha/pay.pl?bornum=$borrower->{'borrowernumber'} onClick=\"openWindow(this, 'Payment', 480,640)\">Payment</a></td></tr>\n";
|
||||
$flaginfotext.="<tr><td valign=top>$flag</td><td> $flags->{$flag}->{'message'} <a href=/cgi-bin/koha/pay.pl?bornum=$borrower->{'borrowernumber'} onClick=\"openWindow(this, 'Payment', 480,640)\">Payment</a></td></tr>\n";
|
||||
} elsif ($flag eq 'WAITING') {
|
||||
my $itemswaiting='';
|
||||
my $items=$flags->{$flag}->{'itemlist'};
|
||||
|
|
@ -837,7 +858,8 @@ sub patrontable {
|
|||
}
|
||||
}
|
||||
}
|
||||
($flaginfotext) && ($flaginfotext="<tr><td bgcolor=$headerbackgroundcolor background=$backgroundimage colspan=2><b>Flags</b></td></tr>$flaginfotext</table>\n");
|
||||
($flaginfotext) && ($flaginfotext="<tr><td bgcolor=$headerbackgroundcolor background=$backgroundimage colspan=2><b>Flags</b></td></tr>$flaginfotext\n");
|
||||
$flaginfotext.="</table>";
|
||||
my $patrontable= << "EOF";
|
||||
<table border=1
|
||||
cellpadding=5 cellspacing=0 align=right>
|
||||
|
|
|
|||
Loading…
Reference in New Issue