Bug 26012: Correctly format "paid for" info on the item details view
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 29 Jul 2020 14:49:14 +0000 (16:49 +0200)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 12 Aug 2020 09:46:37 +0000 (11:46 +0200)
The string is built controller side, which does not let the template
format the info nicely.
We want to display patron's info using patron-title.inc and the date
with the KohaDates plugin

Test plan:
- Make sure there is a replacement cost in the item
- check it out
- Mark it lost
- Pay the lost item fee
- Go to the detail page and look on the items tab for the item
- It will show an entry with "Paid for?" label
The patron's info and date must be correctly formatted

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

catalogue/moredetail.pl
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt

index a736c30..aca1294 100755 (executable)
@@ -211,11 +211,7 @@ foreach my $item (@items){
             if ($payment_offsets->count) {
                 my $patron = $accountline->patron;
                 my $payment_offset = $payment_offsets->next;
-                $item->{paidfor} =
-                    $patron->firstname . " "
-                  . $patron->surname . " "
-                  . $patron->cardnumber . " "
-                  . $payment_offset->created_on;
+                $item->{paidfor} = { patron => $patron, created_on => $payment_offset->created_on };
             }
         }
     }
index 16fb580..0f59a7a 100644 (file)
                 [% IF ( ITEM_DAT.card0 ) %]<li><span class="label">Last borrower:</span> <a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% ITEM_DAT.borrower0 | uri %]">[% ITEM_DAT.card0 | html %]</a>&nbsp;</li>[% END %]
                 [% IF ( ITEM_DAT.card1 ) %]<li><span class="label">Previous borrower:</span> <a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% ITEM_DAT.borrower1 | uri %]">[% ITEM_DAT.card1 | html %]</a>&nbsp;</li>[% END %]
                 [% IF ( ITEM_DAT.card2 ) %]<li><span class="label">Previous borrower:</span> <a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% ITEM_DAT.borrower2 | uri %]">[% ITEM_DAT.card2 | html %]</a>&nbsp;</li>[% END %]
-                [% IF ( ITEM_DAT.paidfor ) %]<li><span class="label">Paid for?:</span> [% ITEM_DAT.paidfor | html %]&nbsp;</li>[% END %]
+                [% IF ( ITEM_DAT.paidfor ) %]<li><span class="label">Paid for?:</span> [% INCLUDE 'patron-title.inc' patron=ITEM_DAT.paidfor.patron hide_patron_infos_if_needed=1 %] on [% ITEM_DAT.paidfor.created_on | $KohaDates %]</li>[% END %]
 
                 [% IF ( ITEM_DAT.enumchron ) %]<li><span class="label">Serial enumeration:</span> [% ITEM_DAT.enumchron | html %]&nbsp;</li>[% END %]