=head2 AddReturn
($doreturn, $messages, $iteminformation, $borrower) =
- &AddReturn($barcode, $branch);
+ &AddReturn($barcode, $branch, $exemptfine);
Returns a book.
C<$barcode> is the bar code of the book being returned. C<$branch> is
-the code of the branch where the book is being returned.
+the code of the branch where the book is being returned. C<$exemptfine>
+indicates that overdue charges for the item will not be applied.
C<&AddReturn> returns a list of four items:
=cut
sub AddReturn {
- my ( $barcode, $branch ) = @_;
+ my ( $barcode, $branch, $exemptfine ) = @_;
my $dbh = C4::Context->dbh;
my $messages;
my $doreturn = 1;
}
# fix up the overdues in accounts...
FixOverduesOnReturn( $borrower->{'borrowernumber'},
- $iteminformation->{'itemnumber'} );
+ $iteminformation->{'itemnumber'}, $exemptfine );
# find reserves.....
# if we don't have a reserve with the status W, we launch the Checkreserves routine
=head2 FixOverduesOnReturn
- &FixOverduesOnReturn($brn,$itm);
+ &FixOverduesOnReturn($brn,$itm, $exemptfine);
C<$brn> borrowernumber
=cut
sub FixOverduesOnReturn {
- my ( $borrowernumber, $item ) = @_;
+ my ( $borrowernumber, $item, $exemptfine ) = @_;
my $dbh = C4::Context->dbh;
# check for overdue fine
$sth->execute( $borrowernumber, $item );
# alter fine to show that the book has been returned
- if ( my $data = $sth->fetchrow_hashref ) {
- my $usth =
- $dbh->prepare(
-"UPDATE accountlines SET accounttype='F' WHERE (borrowernumber = ?) AND (itemnumber = ?) AND (accountno = ?)"
- );
- $usth->execute( $borrowernumber, $item, $data->{'accountno'} );
+ my $data;
+ if ($data = $sth->fetchrow_hashref) {
+ my $uquery =($exemptfine)? "update accountlines set accounttype='FFOR', amountoutstanding=0":"update accountlines set accounttype='F' ";
+ $uquery .= " where (borrowernumber = ?) and (itemnumber = ?) and (accountno = ?)";
+ my $usth = $dbh->prepare($uquery);
+ $usth->execute($borrowernumber,$item ,$data->{'accountno'});
$usth->finish();
}
+
$sth->finish();
return;
}
#my $branch = C4::Context->userenv?C4::Context->userenv->{'branch'}:"";
my $printer = C4::Context->userenv?C4::Context->userenv->{'branchprinter'}:"";
-
+my $overduecharges = (C4::Context->preference('finesMode') && C4::Context->preference('finesMode') ne 'off');
#
# Some code to handle the error if there is no branch or printer setting.....
#
my $messages;
my $issueinformation;
my $barcode = $query->param('barcode');
+my $exemptfine = $query->param('exemptfine');
my $dotransfer = $query->param('dotransfer');
if ($dotransfer){
# save the return
#
( $returned, $messages, $issueinformation, $borrower ) =
- AddReturn( $barcode, C4::Context->userenv->{'branch'} );
+ AddReturn( $barcode, C4::Context->userenv->{'branch'}, $exemptfine );
# get biblio description
my $biblio = GetBiblioFromItemNumber($issueinformation->{'itemnumber'});
$template->param(
branchname => $branches->{C4::Context->userenv->{'branch'}}->{'branchname'},
printer => $printer,
errmsgloop => \@errmsgloop,
+ exemptfine => $exemptfine,
+ overduecharges => $overduecharges,
);
# actually print the page!
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('emailLibrarianWhenHoldIsPlaced',0,'If ON, emails the librarian whenever a hold is placed',NULL,'YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('holdCancelLength','','Specify how many days before a hold is canceled',NULL,'free');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('libraryAddress','','The address to use for printing receipts, overdues, etc. if different than physical address',NULL,'free');
-INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('finesMode','test','Choose the fines mode, test or production','test|production','Choice');
+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('finesMode','test','Choose the fines mode, \'off\', \'test\' (emails admin report) or \'production\' (accrue overdue fines). Requires accruefines cronjob.','off|test|production','Choice');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('globalDueDate','','If set, allows a global static due date for all checkouts',NULL,'free');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('itemBarcodeInputFilter','','If set, allows specification of a item barcode input filter','cuecat','Choice');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('singleBranchMode',0,'Operate in Single-branch mode, hide branch selection in the OPAC',NULL,'YesNo');
margin : 1em;
}
+input.alert {
+ background-color : #FFFF99;
+ border-color: #900;
+}
+
ol.bibliodetails {
float: left;
margin : 0 0 1em 1em;
<!-- /TMPL_IF -->
</div>
<!-- /TMPL_IF -->
-
- <form method="post" action="/cgi-bin/koha/circ/returns.pl">
+ <div id="exemptfines" class="error" style="display:none;">
+ <p>Fines for returned items are forgiven.</p>
+ </div>
+ <div class="details" >
+ <form method="post" action="/cgi-bin/koha/circ/returns.pl" >
<fieldset><legend>Check In</legend>
- <label for="barcode">Enter item barcode: </label><input name="barcode" id="barcode" size="14" maxlength="14" class="focus" /> <input type="submit" value="Submit" />
+ <label for="barcode">Enter item barcode: </label>
+<input name="barcode" id="barcode" size="14" maxlength="14" class="focus" <!-- TMPL_IF NAME="overduecharges" -->onfocus="if(this.form.exemptcheck.checked == true) {this.className='alert'} else {this.className='focus'};" onblur="this.className='unfocus'" <!-- /TMPL_IF --> />
+ <input type="submit" class="submit" value="Submit" />
<!-- TMPL_LOOP Name="inputloop" -->
<input type="hidden" name="ri-<!-- TMPL_VAR Name="counter" -->" value="<!-- TMPL_VAR Name="barcode" -->" />
<input type="hidden" name="dd-<!-- TMPL_VAR Name="counter" -->" value="<!-- TMPL_VAR Name="duedate" -->" />
<input type="hidden" name="bn-<!-- TMPL_VAR Name="counter" -->" value="<!-- TMPL_VAR Name="borrowernumber" -->" />
<!-- /TMPL_LOOP -->
+ <!-- TMPL_IF NAME="overduecharges" --><label for="exemptfine" <!-- TMPL_IF NAME="exemptfine" --> class="error" <!-- /TMPL_IF -->>Forgive Overdue charges on this item</label>
+ <input type="checkbox" id='exemptcheck' name="exemptfine" value="exemptfine"
+ <!-- TMPL_IF NAME="exemptfine" --> checked <!-- /TMPL_IF --> onchange=" if (this.checked == true) { this.form.barcode.className='alert'; document.getElementById('exemptfines').style.display='block';} else { this.form.barcode.className='unfocus';document.getElementById('exemptfines').style.display='none'; } this.form.barcode.focus(); return false;" />
+<!-- /TMPL_IF -->
</fieldset>
</form>