Bug 12166: Improve display of Reserve charges in patron account
authorOwen Leonard <oleonard@myacpl.org>
Thu, 4 Apr 2019 15:44:30 +0000 (15:44 +0000)
committerNick Clemens <nick@bywatersolutions.com>
Thu, 11 Apr 2019 12:16:19 +0000 (12:16 +0000)
This patch makes changes to the way hold fees are recorded and displayed
in the OPAC and staff client:

 - No English strings should be stored in the accountline description.
 - The accounttype code should be used to display what kind of charge it
   is.

To test, apply the patch and go to the staff client:

 - Configure a patron category to have a hold fee.
 - Place one or more holds for a patron in that category.
 - On the patron's record, view Accounting -> Make a payment
   - There should be a separate column for "Account type" showing "Hold
     fee" for the hold charges.
   - There should be no "Res" or "Reserve Charge" text in the
     description column--just the title.
 - Switch to the "Transactions" tab. The display should be similar.
 - In the OPAC, log in as a patron who has hold fees on their account.
   - View the "your fines" page to confirm that the information is
     displayed correctly there as well.

 - Place a hold for a patron who incurs hold charges.
 - Log in to the self-checkout module as that patron and check out an
   item which will fulfill that hold.
 - The correct fine information should be saved to accountlines: A "Res"
   type with a description consisting only of the title.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

C4/Reserves.pm
koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc
koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt
koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt
koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc
opac/sco/sco-main.pl

index 2273618..e263375 100644 (file)
@@ -571,7 +571,7 @@ sub ChargeReserveFee {
     Koha::Account->new( { patron_id => $borrowernumber } )->add_debit(
         {
             amount       => $fee,
-            description  => "Reserve Charge - " . $title,
+            description  => $title,
             note         => undef,
             user_id      => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef,
             library_id   => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef,
index cf38823..28f5f94 100644 (file)
@@ -21,6 +21,7 @@
         [%- CASE 'WO'    -%]<span>Writeoff</span>
         [%- CASE 'C'     -%]<span>Credit</span>
         [%- CASE 'CR'    -%]<span>Credit</span>
+        [%- CASE 'Res'   -%]<span>Hold fee</span>
         [%- CASE         -%][% account.accounttype | html %]
     [%- END -%]
 [%- END -%]
index 22b796e..ceeccad 100644 (file)
@@ -44,6 +44,7 @@
     <thead>
       <tr>
           <th class="title-string">Date</th>
+          <th>Account type</th>
           <th>Description of charges</th>
           <th>Barcode</th>
           <th>Due date</th>
 
    <tr>
    <td><span title="[% account.date | html %]">[% account.date |$KohaDates %]</span></td>
+        <td>[% PROCESS account_type_description account=account %]</td>
       <td>
-        [% PROCESS account_type_description account=account %]
-        [%- IF account.payment_type %], [% AuthorisedValues.GetByCode('PAYMENT_TYPE', account.payment_type) | html %][% END %]
-        [%- IF account.description %], [% account.description | html %][% END %]
+        [%- IF account.payment_type %][% AuthorisedValues.GetByCode('PAYMENT_TYPE', account.payment_type) | html %][% END %]
+        [%- IF account.description %][% account.description | html %][% END %]
         &nbsp;[% IF ( account.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% account.item.biblionumber | uri %]&amp;itemnumber=[% account.itemnumber | uri %]">[% account.item.biblio.title | html %]</a>[% END %]</td>
       <td>[% IF ( account.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% account.itemnumber | uri %]&amp;biblionumber=[% account.item.biblionumber | uri %]#item[% account.itemnumber | uri %]">[% account.item.barcode | html %]</a>[% END %]</td>
       <td>[% IF ( account.issue_id ) %][% account.checkout.date_due | $KohaDates as_due_date => 1 %][% END %]</td>
@@ -89,7 +90,7 @@
   [% END %]
 <tfoot>
   <tr>
-    <td colspan="8">Total due</td>
+    <td colspan="9">Total due</td>
     [% IF ( totalcredit ) %]
         <td class="credit" style="text-align: right;">[% total | $Price %]</td>
     [% ELSE %]
index 7afd743..9d737bf 100644 (file)
@@ -7,6 +7,7 @@
 [% USE ColumnsSettings %]
 [% USE KohaDates %]
 [% SET footerjs = 1 %]
+[% PROCESS 'accounts.inc' %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Patrons &rsaquo; Make a payment for  [% patron.firstname | html %] [% patron.surname | html %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
 <tr>
     <th class="NoSort">&nbsp;</th>
     <th class="NoSort">Actions</th>
+    <th>Account type</th>
     <th>Description</th>
     <th class="title-string">Date</th>
     <th>Barcode</th>
     <th>Due date</th>
     <th>Return date</th>
     <th class="NoSort">Payment note</th>
-    <th>Account type</th>
     <th>Amount</th>
     <th>Amount outstanding</th>
 </tr>
     <input type="hidden" name="borrowernumber[% line.accountlines_id | html %]" value="[% line.borrowernumber | html %]" />
     </td>
     <td>
-        [% SWITCH line.accounttype %]
-          [% CASE 'Pay' %]Payment, thanks
-          [% CASE 'Pay00' %]Payment, thanks (cash via SIP2)
-          [% CASE 'Pay01' %]Payment, thanks (VISA via SIP2)
-          [% CASE 'Pay02' %]Payment, thanks (credit card via SIP2)
-          [% CASE 'N' %]New card
-          [% CASE 'F' %]Fine
-          [% CASE 'A' %]Account management fee
-          [% CASE 'M' %]Sundry
-          [% CASE 'L' %]Lost item
-          [% CASE 'W' %]Writeoff
-          [% CASE 'FU' %]Accruing fine
-          [% CASE 'HE' %]Hold waiting too long
-          [% CASE 'Rent' %]Rental fee
-          [% CASE 'FOR' %]Forgiven
-          [% CASE 'LR' %]Lost item fee refund
-          [% CASE 'PF' %]Processing fee
-          [% CASE 'PAY' %]Payment
-          [% CASE 'WO' %]Writeoff
-          [% CASE 'C' %]Credit
-          [% CASE 'CR' %]Credit
-          [% CASE %][% line.accounttype | html %]
-        [%- END -%]
-        [%- IF line.description %], [% line.description | html %][% END %]
+        [% PROCESS account_type_description account=line %]
+    </td>
+    <td>
+        [%- IF line.description %][% line.description | html %][% END %]
         [% IF line.itemnumber %]([% line.item.biblio.title | html %])[% END %]
     </td>
     <td>
         <a href="#" class="add-note" data-accountlines_id="[% line.accountlines_id | html %]"><i class="fa fa-plus"></i> Add note</a>
         <span class="payment_note" id="payment_note_[% line.accountlines_id | html %]" style="display:none"><input type="text" size="10" name="payment_note_[% line.accountlines_id | html %]" value="" /> <a href="#" class="cancel-note"><i class="fa fa-remove"></i></a></span>
     </td>
-    <td>[% line.accounttype | html %]</td>
     <td class="debit" style="text-align: right;">[% line.amount | $Price %]</td>
     <td class="debit" style="text-align: right;">[% line.amountoutstanding | $Price %]</td>
 </tr>
index a73da77..68619d9 100644 (file)
@@ -8,6 +8,7 @@
                 [% IF ENABLE_OPAC_PAYMENTS %]<th>&nbsp;</th>[% END %]
                 <th class="title-string">Date</th>
                 <th>Description</th>
+                <th>Type</th>
                 <th>Fine amount</th>
                 <th>Amount outstanding</th>
             </tr>
                         [% CASE 'WO' %]Writeoff
                         [% CASE 'C' %]Credit
                         [% CASE 'CR' %]Credit
+                        [%-CASE 'Res' %]Hold fee
                         [% CASE %][% ACCOUNT_LINE.accounttype | html %]
                         [%- END -%]
-                        [%- IF ACCOUNT_LINE.payment_type %], [% AuthorisedValues.GetByCode('PAYMENT_TYPE', ACCOUNT_LINE.payment_type, 1) | html %][% END %]
-                        [%- IF ACCOUNT_LINE.description %], [% ACCOUNT_LINE.description | html %][% END %]
+                    </td>
+                    <td>
+                        [%- IF ACCOUNT_LINE.payment_type %][% AuthorisedValues.GetByCode('PAYMENT_TYPE', ACCOUNT_LINE.payment_type, 1) | html %][% END %]
+                        [%- IF ACCOUNT_LINE.description %][% ACCOUNT_LINE.description | html %][% END %]
                         [% IF ACCOUNT_LINE.title %]([% ACCOUNT_LINE.title | html %])[% END %]
                     </td>
                     [% IF ( ACCOUNT_LINE.amountcredit ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% ACCOUNT_LINE.amount | $Price %]</td>
@@ -63,9 +67,9 @@
         <tfoot>
             <tr>
                 [%- IF ENABLE_OPAC_PAYMENTS -%]
-                    [%- SET COLSPAN = 4 -%]
+                    [%- SET COLSPAN = 5 -%]
                 [%- ELSE -%]
-                    [%- SET COLSPAN = 3 -%]
+                    [%- SET COLSPAN = 4 -%]
                 [%- END -%]
                 <th class="sum" colspan="[% COLSPAN | html %]">Total due</th>
                 <td class="sum">[% total | $Price %]</td>
index a303524..298eb4e 100755 (executable)
@@ -236,7 +236,7 @@ elsif ( $patron && ( $op eq 'checkout' || $op eq 'renew' ) ) {
                         {
                             borrowernumber => $borrower->{borrowernumber},
                             accounttype    => 'Res',
-                            description    => 'Reserve Charge - ' . $item->biblio->title,
+                            description    => $item->biblio->title,
                             date           => $dtf->format_date(dt_from_string)
                         }
                       )->count,