From 93791243a81c38fe141dd88cd67b1baa423a535e Mon Sep 17 00:00:00 2001 From: Rafal Kopaczka Date: Mon, 9 Mar 2015 14:30:30 +0100 Subject: [PATCH] [PATCH] Bug 9481 - charge not showing fines On 'Check out' and 'Details'. When looking at the patron record or the checkout screen the checkout summary is now showing 0 for all the Charges even if the item was overdue and has accrued fines. Removed unused(?) footer values in checkouts-table-footer.inc To test: 1/ Check out items with past due date 2/ Run fines.pl script (ensure finesMode is set to Calculate and Charge) 3/ Verify on Fines->Pay Fines screen that fines where calculated correct. 4/ Go to Patron record, charge column on Details and Check out screen should be 0 or rental charge amount only. But total amount row display right number, same as in pay fines screen. 4/ Apply patch. 5/ Now charges on display and check out screen shows all outstanding fees for each item. --- .../prog/en/includes/checkouts-table-footer.inc | 5 +++-- .../prog/en/includes/checkouts-table.inc | 1 + koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js | 17 ++++++++++++++++- svc/checkouts | 3 +++ 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table-footer.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table-footer.inc index 3f8db22..dcc5ffc 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table-footer.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table-footer.inc @@ -1,8 +1,9 @@ Totals: - [% totaldue %] - [% totalprice %] + [% totaldue %] + [% finetotal %] + [% totalprice %]

diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc index c471c46..dcc0079 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc @@ -19,6 +19,7 @@ Checked out from Call no Charge + Fine Price Renew

select all | none

Check in

select all | none

diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js index 65cf43d..4544452 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js @@ -273,6 +273,12 @@ $(document).ready(function() { }, { "mDataProp": function ( oObj ) { + if ( ! oObj.fine ) oObj.fine = 0; + return parseFloat(oObj.fine).toFixed(2); + } + }, + { + "mDataProp": function ( oObj ) { if ( ! oObj.price ) oObj.price = 0; return parseFloat(oObj.price).toFixed(2); } @@ -376,14 +382,17 @@ $(document).ready(function() { ], "fnFooterCallback": function ( nRow, aaData, iStart, iEnd, aiDisplay ) { var total_charge = 0; + var total_fine = 0; var total_price = 0; for ( var i=0; i < aaData.length; i++ ) { total_charge += aaData[i]['charge'] * 1; + total_fine += aaData[i]['fine'] * 1; total_price += aaData[i]['price'] * 1; } var nCells = nRow.getElementsByTagName('td'); nCells[1].innerHTML = total_charge.toFixed(2); - nCells[2].innerHTML = total_price.toFixed(2); + nCells[2].innerHTML = total_fine.toFixed(2); + nCells[3].innerHTML = total_price.toFixed(2); }, "bPaginate": false, "bProcessing": true, @@ -508,6 +517,12 @@ $(document).ready(function() { }, { "mDataProp": function ( oObj ) { + if ( ! oObj.fine ) oObj.fine = 0; + return parseFloat(oObj.fine).toFixed(2); + } + }, + { + "mDataProp": function ( oObj ) { if ( ! oObj.price ) oObj.price = 0; return parseFloat(oObj.price).toFixed(2); } diff --git a/svc/checkouts b/svc/checkouts index 51fd861..cfd42dc 100755 --- a/svc/checkouts +++ b/svc/checkouts @@ -27,6 +27,7 @@ use C4::Auth qw(check_cookie_auth); use C4::Biblio qw(GetMarcBiblio GetFrameworkCode GetRecordValue ); use C4::Circulation qw(GetIssuingCharges CanBookBeRenewed GetRenewCount GetSoonestRenewDate); use C4::Koha qw(GetAuthorisedValueByCode); +use C4::Overdues qw(GetFine); use C4::Context; use Koha::DateUtils; @@ -126,6 +127,7 @@ my @checkouts_today; my @checkouts_previous; while ( my $c = $sth->fetchrow_hashref() ) { my ($charge) = GetIssuingCharges( $c->{itemnumber}, $c->{borrowernumber} ); + my $fine = GetFine( $c->{itemnumber}, $c->{borrowernumber} ); my ( $can_renew, $can_renew_error ) = CanBookBeRenewed( $c->{borrowernumber}, $c->{itemnumber} ); @@ -154,6 +156,7 @@ while ( my $c = $sth->fetchrow_hashref() ) { branchname => $c->{branchname}, itemcallnumber => $c->{itemcallnumber} || q{}, charge => $charge, + fine => $fine, price => $c->{replacementprice} || q{}, can_renew => $can_renew, can_renew_error => $can_renew_error, -- 1.7.10.4