From a9d03af6dc720b18f460471e0a1081e2b976d949 Mon Sep 17 00:00:00 2001 From: Ryan Higgins Date: Thu, 27 Dec 2007 16:47:25 -0600 Subject: [PATCH] adding 'exempt fine on return' option. Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- C4/Circulation.pm | 26 ++++++++++--------- circ/returns.pl | 7 +++-- .../data/mysql/en/mandatory/sysprefs.sql | 2 +- .../prog/en/css/staff-global.css | 5 ++++ .../prog/en/modules/circ/returns.tmpl | 15 ++++++++--- 5 files changed, 37 insertions(+), 18 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 156158ab4f..eebbe41334 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1079,12 +1079,13 @@ warn "in get loan lenght $borrowertype $itemtype $branchcode "; =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: @@ -1127,7 +1128,7 @@ patron who last borrowed the book. =cut sub AddReturn { - my ( $barcode, $branch ) = @_; + my ( $barcode, $branch, $exemptfine ) = @_; my $dbh = C4::Context->dbh; my $messages; my $doreturn = 1; @@ -1233,7 +1234,7 @@ sub AddReturn { } # 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 @@ -1275,7 +1276,7 @@ sub AddReturn { =head2 FixOverduesOnReturn - &FixOverduesOnReturn($brn,$itm); + &FixOverduesOnReturn($brn,$itm, $exemptfine); C<$brn> borrowernumber @@ -1286,7 +1287,7 @@ internal function, called only by AddReturn =cut sub FixOverduesOnReturn { - my ( $borrowernumber, $item ) = @_; + my ( $borrowernumber, $item, $exemptfine ) = @_; my $dbh = C4::Context->dbh; # check for overdue fine @@ -1297,14 +1298,15 @@ sub FixOverduesOnReturn { $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; } diff --git a/circ/returns.pl b/circ/returns.pl index 4dea59f42f..b728496ac0 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -59,7 +59,7 @@ my $printers = GetPrinters(); #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..... # @@ -153,6 +153,7 @@ my $returned = 0; my $messages; my $issueinformation; my $barcode = $query->param('barcode'); +my $exemptfine = $query->param('exemptfine'); my $dotransfer = $query->param('dotransfer'); if ($dotransfer){ @@ -170,7 +171,7 @@ if ($barcode) { # 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( @@ -544,6 +545,8 @@ $template->param( branchname => $branches->{C4::Context->userenv->{'branch'}}->{'branchname'}, printer => $printer, errmsgloop => \@errmsgloop, + exemptfine => $exemptfine, + overduecharges => $overduecharges, ); # actually print the page! diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql index 7d87a801b1..d6c39c2033 100644 --- a/installer/data/mysql/en/mandatory/sysprefs.sql +++ b/installer/data/mysql/en/mandatory/sysprefs.sql @@ -148,7 +148,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES 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'); diff --git a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css index f023494275..8fdcb4ac92 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css +++ b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css @@ -903,6 +903,11 @@ div.error { margin : 1em; } +input.alert { + background-color : #FFFF99; + border-color: #900; +} + ol.bibliodetails { float: left; margin : 0 0 1em 1em; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tmpl index d1088b91c3..33d48279b0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tmpl @@ -205,15 +205,24 @@ - -
+ +
+
Check In - + +onfocus="if(this.form.exemptcheck.checked == true) {this.className='alert'} else {this.className='focus'};" onblur="this.className='unfocus'" /> + " value="" /> " value="" /> " value="" /> + + checked 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;" /> +
-- 2.39.5