Bug 9481 - charge not showing fines On 'Check out' and 'Details'.
authorRafal Kopaczka <rkk0@poczta.onet.pl>
Mon, 9 Mar 2015 13:30:30 +0000 (14:30 +0100)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Tue, 31 Mar 2015 17:13:53 +0000 (14:13 -0300)
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.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table-footer.inc
koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc
koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js
svc/checkouts

index 3f8db22..dcc5ffc 100644 (file)
@@ -1,8 +1,9 @@
 <tfoot>
        <tr>
         <td colspan="9" style="text-align: right; font-weight:bold;">Totals:</td>
-               <td>[% totaldue %]</td>
-               <td>[% totalprice %]</td>
+        <td>[% totaldue %]</td>
+        <td>[% finetotal %]</td>
+        <td>[% totalprice %]</td>
                 <td colspan="3"><div class="date-select">
             <p><label for="newduedate">Renewal due date:</label> <input type="text" size="12" id="newduedate" name="newduedate" value="[% newduedate %]" readonly="readonly" />
 </p>
index c471c46..dcc0079 100644 (file)
@@ -19,6 +19,7 @@
                         <th scope="col">Checked out from</th>
                         <th scope="col">Call no</th>
                         <th scope="col">Charge</th>
+                        <th scope="col">Fine</th>
                         <th scope="col">Price</th>
                         <th scope="col">Renew <p class="column-tool"><a href="#" id="CheckAllRenewals">select all</a> | <a href="#" id="UncheckAllRenewals">none</a></p></th>
                         <th scope="col">Check in <p class="column-tool"><a href="#" id="CheckAllCheckins">select all</a> | <a href="#" id="UncheckAllCheckins">none</a></p></th>
index e8f6f44..a7f86d0 100644 (file)
@@ -271,6 +271,12 @@ $(document).ready(function() {
                         return parseFloat(oObj.charge).toFixed(2);
                     }
                 },
+                {
+                    "mDataProp": function ( oObj ) {
+                        if ( ! oObj.fine ) oObj.fine = 0;
+                        return parseFloat(oObj.fine).toFixed(2);
+                    }
+                },
                 {
                     "mDataProp": function ( oObj ) {
                         if ( ! oObj.price ) oObj.price = 0;
@@ -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,
@@ -506,6 +515,12 @@ $(document).ready(function() {
                             return parseFloat(oObj.charge).toFixed(2);
                         }
                     },
+                    {
+                        "mDataProp": function ( oObj ) {
+                            if ( ! oObj.fine ) oObj.fine = 0;
+                            return parseFloat(oObj.fine).toFixed(2);
+                        }
+                    },
                     {
                         "mDataProp": function ( oObj ) {
                             if ( ! oObj.price ) oObj.price = 0;
index 51fd861..cfd42dc 100755 (executable)
@@ -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,