Patch implements HidePatronName system preference for 'Checkout status'
on moredetail (tab items from staff detail page).

Also adds some new 'if' statements, so 'Serial enumeration' and 'Paid for?' are
only shown when they are not empty.

Silences warns in the logs.

To test:
- Toggle system preference for an issued item and check name/cardnumber
are displayed correctly.
- Check serial enumeration and Paid for? show when not empty.
---
 catalogue/moredetail.pl                            |   12 ++++++++
 .../prog/en/modules/catalogue/moredetail.tt        |   28 +++++++++++++++----
 2 files changed, 34 insertions(+), 6 deletions(-)

diff --git a/catalogue/moredetail.pl b/catalogue/moredetail.pl
index 9d5465b..ca7d13c 100755
--- a/catalogue/moredetail.pl
+++ b/catalogue/moredetail.pl
@@ -62,6 +62,8 @@ if($query->cookie("holdfor")){
     );
 }
 
+my $hidepatronname = C4::Context->preference("HidePatronName");
+
 # get variables
 
 my $biblionumber=$query->param('biblionumber');
@@ -172,6 +174,15 @@ foreach my $item (@items){
     } else {
         $item->{'issue'}= 0;
     }
+
+    unless ($hidepatronname) {
+        if ( $item->{'borrowernumber'} ) {
+            my $curr_borrower = GetMember('borrowernumber' => 
$item->{'borrowernumber'} );
+            $item->{borrowerfirstname} = $curr_borrower->{'firstname'};
+            $item->{borrowersurname} = $curr_borrower->{'surname'};
+        }
+    }
+
 }
 $template->param(count => $data->{'count'},
        subscriptionsnumber => $subscriptionsnumber,
@@ -188,6 +199,7 @@ $template->param(
     itemnumber          => $itemnumber,
     z3950_search_params => 
C4::Search::z3950_search_args(GetBiblioData($biblionumber)),
     subtitle            => $subtitle,
+    hidepatronname      => $hidepatronname,
 );
 $template->param(ONLY_ONE => 1) if ( $itemnumber && $showncount != @items );
 
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt 
b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt
index dce6872..d4efe7d 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt
@@ -69,7 +69,23 @@
 
             <ol class="bibliodetails">
             <li><span class="label">Current location:</span> [% 
ITEM_DAT.holdingbranchname %]&nbsp;</li>
-            <li><span class="label">Checkout status:</span> [% IF ( 
ITEM_DAT.issue ) %]Checked out to <a 
href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% 
ITEM_DAT.borrowernumber %]">[% ITEM_DAT.cardnumber %]</a>[% IF ( 
ITEM_DAT.lastreneweddate ) %], Last renewed [% ITEM_DAT.lastreneweddate | 
$KohaDates %][% END %], Due back on [% ITEM_DAT.datedue | $KohaDates %][% ELSE 
%]Not checked out [% END %]</li>
+            <li><span class="label">Checkout status:</span> 
+            [% IF ( ITEM_DAT.issue ) %]Checked out to
+                [% IF ( hidepatronname ) %]
+                        <a 
href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% 
ITEM_DAT.borrowernumber %]">[% ITEM_DAT.cardnumber %]</a>,
+                    [% ELSE %]
+                        <a 
href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% 
ITEM_DAT.borrowernumber %]">[% ITEM_DAT.borrowerfirstname %] [% 
ITEM_DAT.borrowersurname %]</a>,
+                [% END %]
+                [% IF ( ITEM_DAT.lastreneweddate ) %]
+                    Last renewed [% ITEM_DAT.lastreneweddate | $KohaDates %],
+                [% END %]
+                [% IF ( ITEM_DAT.datedue ) %]
+                    Due back on [% ITEM_DAT.datedue | $KohaDates %]
+                [% ELSE %]
+                    Not checked out 
+                [% END %]
+            [% END %]
+            </li>
             <li><span class="label">Current renewals:</span> [% 
ITEM_DAT.renewals %]&nbsp;</li>
             [% IF ( ITEM_DAT.itemlostloop ) %]
                 <li><span class="label">Lost status:</span>
@@ -183,14 +199,14 @@
 
                 <li><span class="label">Total checkouts:</span>[% IF ( 
ITEM_DAT.issues ) %][% ITEM_DAT.issues %][% ELSE %]0[% END %]  (<a 
href="/cgi-bin/koha/circ/bookcount.pl?&amp;biblionumber=[% 
ITEM_DAT.biblionumber %]&amp;bi=[% ITEM_DAT.biblioitemnumber %]&amp;itm=[% 
ITEM_DAT.itemnumber %]">View item's checkout history</a>)</li>
 
-                <li><span class="label">Last seen:</span> [% 
ITEM_DAT.datelastseen | $KohaDates %]&nbsp;</li>
-                <li><span class="label">Last borrowed:</span> [% 
ITEM_DAT.datelastborrowed | $KohaDates %]&nbsp;</li>
+                <li><span class="label">Last seen:</span>[% IF ( 
ITEM_DAT.datelastseen ) %][% ITEM_DAT.datelastseen | $KohaDates %] [%END 
%]&nbsp;</li>
+                <li><span class="label">Last borrowed:</span>[% IF 
(ITEM_DAT.datelastborrowed ) %][% ITEM_DAT.datelastborrowed | $KohaDates %][% 
END %]&nbsp;</li>
                 [% IF ( ITEM_DAT.card0 ) %]<li><span class="label">Last 
borrower:</span> <a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% 
ITEM_DAT.borrower0 %]">[% ITEM_DAT.card0 %]</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 %]">[% ITEM_DAT.card1 %]</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 %]">[% ITEM_DAT.card2 %]</a>&nbsp;</li>[% END %]
-                <li><span class="label">Paid for?:</span> [% ITEM_DAT.paidfor 
%]&nbsp;</li>
-            <li><span class="label">Serial enumeration:</span> [% 
ITEM_DAT.enumchron %]&nbsp;</li>
-            <li><span class="label">Public note:</span>
+                [% IF ( ITEM_DAT.paidfor ) %]<li><span class="label">Paid 
for?:</span> [% ITEM_DAT.paidfor %]&nbsp;</li>[% END %]
+                [% IF ( ITEM_DAT.enumchron ) %]<li><span class="label">Serial 
enumeration:</span> [% ITEM_DAT.enumchron %]&nbsp;</li>[% END %]
+                <li><span class="label">Public note:</span>
                 [% IF ( CAN_user_editcatalogue_edit_items ) %]
                 <form class="inline" action="updateitem.pl" 
method="post"><input type="hidden" name="biblionumber" value="[% 
ITEM_DAT.biblionumber %]" />
                     <input type="hidden" name="biblioitemnumber" value="[% 
ITEM_DAT.biblioitemnumber %]" /><input type="hidden" name="itemnumber" 
value="[% ITEM_DAT.itemnumber %]" />
-- 
1.7.5.4

_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to