[Koha-patches] [PATCH] Bug 2930 - Put other name on checkout screen

Owen Leonard oleonard at myacpl.org
Thu Aug 23 15:24:16 CEST 2012


This patch adds other name to the include which is used
to display patron names and adds this include in several
places where it can be used in place of direct output.

The patron-title include has been modified to handle the
two possible variable scopes throughout patron-related
templates. This is a hack similar to having both
circ-menu.tt and circ-menu.inc, but keeping both in the
same file.

Changes to some scripts were necessary to make the
othernames variable available to the include.

This patch also corrects some <title> tags and fixes
some incorrect capitalization (see Bug 2780).

To test, view each of the pages affected by these
template changes and confirm that the patron's name
displays correctly, including their "other name."
---
 .../intranet-tmpl/prog/en/includes/circ-menu.tt    |    2 +-
 .../prog/en/includes/patron-title.inc              |   21 ++++++++++++++------
 .../prog/en/modules/members/mancredit.tt           |    4 ++--
 .../prog/en/modules/members/maninvoice.tt          |    6 +++---
 .../prog/en/modules/members/member-flags.tt        |    6 +++---
 .../prog/en/modules/members/moremember-brief.tt    |    4 +---
 .../prog/en/modules/members/moremember-print.tt    |    4 ++--
 .../prog/en/modules/members/moremember-receipt.tt  |    2 +-
 .../prog/en/modules/members/moremember.tt          |    5 ++---
 .../intranet-tmpl/prog/en/modules/members/pay.tt   |    4 ++--
 .../prog/en/modules/members/paycollect.tt          |    4 ++--
 .../prog/en/modules/members/routing-lists.tt       |    4 ++--
 members/mancredit.pl                               |    1 +
 members/maninvoice.pl                              |    1 +
 members/member-flags.pl                            |    1 +
 members/routing-lists.pl                           |    1 +
 16 files changed, 40 insertions(+), 30 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.tt b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.tt
index ced2858..6fe10d4 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.tt
@@ -1,7 +1,7 @@
 [%# duplicates circ-menu.inc but assumes all borrower attributes are in a borrower variable rather than
 in the global namespace %]
 [% IF borrower %]
-<div class="patroninfo"><h5>[% borrower.firstname %] [% borrower.surname %] ([% borrower.cardnumber %])</h5>
+<div class="patroninfo"><h5>[% INCLUDE 'patron-title.inc' %]</h5>
 <!--[if IE 6]>
 <style type="tex/css">img { width: expression(this.width > 140 ? 140: true);
 }</style>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-title.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-title.inc
index d07a449..fb77341 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-title.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-title.inc
@@ -1,6 +1,15 @@
-[% IF category_type == 'I' %]
-    [% surname %] [% IF othernames %] ([% othernames %]) [% END %]
-[% ELSE %]
-    [% firstname %] [% surname %]
-[% END %]
-([% cardnumber %])
+[% IF ( borrower.borrowernumber ) %]
+    [% IF borrower.category_type == 'I' %]
+        [% borrower.surname %] [% IF borrower.othernames %] ([% borrower.othernames %]) [% END %]
+    [% ELSE %]
+        [% borrower.firstname %] [% IF borrower.othernames %] ([% borrower.othernames %]) [% END %] [% borrower.surname %]
+    [% END %]
+    ([% borrower.cardnumber %])
+[% ELSIF ( borrowernumber ) %]
+    [% IF category_type == 'I' %]
+        [% surname %] [% IF othernames %] ([% othernames %]) [% END %]
+    [% ELSE %]
+        [% firstname %] [% IF othernames %] ([% othernames %]) [% END %] [% surname %]
+    [% END %]
+    ([% cardnumber %])
+[% END %]
\ No newline at end of file
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tt
index 8b71856..5482e4f 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tt
@@ -1,5 +1,5 @@
 [% INCLUDE 'doc-head-open.inc' %]
-<title>Koha &rsaquo; Borrowers &rsaquo; Create manual credit</title>
+<title>Koha &rsaquo; Patrons &rsaquo; [% INCLUDE 'patron-title.inc' %] &rsaquo; Create manual credit</title>
 [% INCLUDE 'doc-head-close.inc' %]
 <script type="text/javascript">
 //<![CDATA[
@@ -13,7 +13,7 @@ $(document).ready(function(){
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'patron-search.inc' %]
 
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>  &rsaquo; Manual credit</div>
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a> &rsaquo; <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">[% INCLUDE 'patron-title.inc' %]</a> &rsaquo; Manual credit</div>
 
 <div id="doc3" class="yui-t2">
    
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt
index 217882e..a0dcf9a 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt
@@ -1,5 +1,5 @@
 [% INCLUDE 'doc-head-open.inc' %]
-<title>Koha &rsaquo; Borrowers &rsaquo; Create manual invoice</title>
+<title>Koha &rsaquo; Patrons &rsaquo; [% INCLUDE 'patron-title.inc' %] &rsaquo; Create manual invoice</title>
 [% INCLUDE 'doc-head-close.inc' %]
 <script type="text/javascript">
 //<![CDATA[
@@ -13,7 +13,7 @@ $(document).ready(function(){
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'patron-search.inc' %]
 
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>  &rsaquo; Manual Invoice</div>
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a> &rsaquo; <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">[% INCLUDE 'patron-title.inc' %]</a> &rsaquo; Manual invoice</div>
 
 <div id="doc3" class="yui-t2">
    
@@ -39,7 +39,7 @@ $(document).ready(function(){
 [% ELSE %]
 <form action="/cgi-bin/koha/members/maninvoice.pl" method="post"><input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrowernumber %]" />
 	<fieldset class="rows">
-	<legend>Manual Invoice</legend>
+    <legend>Manual invoice</legend>
 	<ol>
       <li>
 <script type="text/javascript">
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-flags.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-flags.tt
index aa1eebd..9fc1780 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-flags.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-flags.tt
@@ -1,5 +1,5 @@
 [% INCLUDE 'doc-head-open.inc' %]
-<title>Koha &rsaquo; Patrons &rsaquo; Set privileges for [% surname %], [% firstname %]</title>
+<title>Koha &rsaquo; Patrons &rsaquo; Set privileges for [% INCLUDE 'patron-title.inc' %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/treeview/jquery.treeview.css"/>
 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.treeview.pack.js"></script>
@@ -72,7 +72,7 @@
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'patron-search.inc' %]
 
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>  &rsaquo; Set privileges for [% surname %], [% firstname %]</div>
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>  &rsaquo; Set privileges for [% INCLUDE 'patron-title.inc' %]</div>
 
 <div id="doc3" class="yui-t2">
    
@@ -84,7 +84,7 @@
 <form method="post" action="/cgi-bin/koha/members/member-flags.pl">
     <input type="hidden" name="member" id="borrowernumber" value="[% borrowernumber %]" />
     <input type="hidden" name="newflags" value="1" />
-    <h1>Set Privileges for [% surname %], [% firstname %]</h1>
+    <h1>Set Privileges for [% INCLUDE 'patron-title.inc' %]</h1>
     <!-- <ul id="permissionstree"><li class="root">All privileges<ul> -->
     <ul id="permissionstree" class="treeview-grey">
         <!-- <li class="folder-close">One level down<ul> -->
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-brief.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-brief.tt
index efe7f20..a44f52e 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-brief.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-brief.tt
@@ -9,13 +9,11 @@
 <div id="custom-doc" class="yui-t7">
    <div id="bd">
 	<h3>[% UNLESS ( I ) %]
-   [% title %] [% firstname %] [% END %] [% surname %] ([% cardnumber %])</h3>
+   [% INCLUDE 'patron-title.inc' %]</h3>
 <div class="yui-g">
 <div class="yui-u first">
 	<div id="patron-information" style="padding: .5em;">
 
-     [% UNLESS ( I ) %][% IF ( othernames ) %]&ldquo;[% othernames %]&rdquo;[% END %]
-
 	<p class="address">[% streetnumber %]
         [% IF ( roaddetails ) %]
          [% roaddetails %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-print.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-print.tt
index d3e5b49..f1c90a8 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-print.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-print.tt
@@ -1,5 +1,5 @@
 [% INCLUDE 'doc-head-open.inc' %]
-<title>Summary for [% firstname %] [% surname %] ([% cardnumber %])</title>
+<title>Summary for [% INCLUDE 'patron-title.inc' %]</title>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <link rel="shortcut icon" href="[% IF ( IntranetFavicon ) %][% IntranetFavicon %][% ELSE %][% themelang %]/includes/favicon.ico[% END %]" type="image/x-icon" />
 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/print.css" />
@@ -16,7 +16,7 @@
 
 <div id="main">
 
-<h3><a href="/cgi-bin/koha/circ/circulation.pl?findborrower=[% cardnumber %]">Account summary: [% firstname %] [% surname %] ([% cardnumber %])</a></h3>
+<h3><a href="/cgi-bin/koha/circ/circulation.pl?findborrower=[% cardnumber %]">Account summary: [% INCLUDE 'patron-title.inc' %]</a></h3>
 
 <ul><li>[% address %]<br />[% address2 %]</li><li>[% city %], [% zipcode %]</li>
 <li>[% IF ( phone ) %][% phone %][% ELSE %](no phone number on file)[% END %]</li>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-receipt.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-receipt.tt
index 71fdc35..107ebf5 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-receipt.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-receipt.tt
@@ -17,7 +17,7 @@
 
 <h3>[% LibraryName %]</h3>
 [% IF ( branchname ) %][% branchname %]<br />[% END %]
-Checked out to [% firstname %] [% surname %] <br />
+Checked out to [% INCLUDE 'patron-title.inc' %] <br />
 (<a href="/cgi-bin/koha/circ/circulation.pl?findborrower=[% cardnumber %]">[% cardnumber %]</a>)<br />
 
 [% todaysdate %]<br />
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
index b6df1b3..9b38c1c 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
@@ -180,12 +180,11 @@ function validate1(date) {
     </ul>
     [% END %]
 
-<h3>[% UNLESS ( I ) %]
-   [% title %] [% firstname %] [% END %] [% surname %] ([% cardnumber %])</h3>
+<h3>[% INCLUDE 'patron-title.inc' %]</h3>
  <div class="yui-u first">
 <div id="patron-information" style="padding : .5em;">
 
-     [% UNLESS ( I ) %][% IF ( othernames ) %]&ldquo;[% othernames %]&rdquo;[% END %]
+     [% UNLESS ( I ) %]
 
 <p class="address">[% streetnumber %]
         [% IF ( roaddetails ) %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt
index 4c1b362..2a6caf1 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt
@@ -1,5 +1,5 @@
 [% INCLUDE 'doc-head-open.inc' %]
-<title>Koha &rsaquo; Patrons &rsaquo; Pay Fines for  [% borrower.firstname %] [% borrower.surname %]</title>
+<title>Koha &rsaquo; Patrons &rsaquo; Pay fines for  [% INCLUDE 'patron-title.inc' %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
 <script type= "text/javascript">
 //<![CDATA[
@@ -18,7 +18,7 @@
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'patron-search.inc' %]
 
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>  &rsaquo; Pay fines for [% borrower.firstname %] [% borrower.surname %]</div>
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>  &rsaquo; Pay fines for [% INCLUDE 'patron-title.inc' %]</div>
 
 <div id="doc3" class="yui-t2">
    
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt
index 3461e8a..ced5841 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt
@@ -1,5 +1,5 @@
 [% INCLUDE 'doc-head-open.inc' %]
-<title>Koha &rsaquo; Patrons &rsaquo; Collect fine payment for  [% borrower.firstname %] [% borrower.surname %]</title>
+<title>Koha &rsaquo; Patrons &rsaquo; Collect fine payment for  [% INCLUDE 'patron-title.inc' %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
 <script type= "text/javascript">
 //<![CDATA[
@@ -57,7 +57,7 @@ function moneyFormat(textObj) {
 <body id="pat_paycollect" class="pat">
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'patron-search.inc' %]
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>  &rsaquo; <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% borrower.borrowernumber %]">Pay fines for [% borrower.firstname %] [% borrower.surname %]</a> &rsaquo; [% IF ( pay_individual ) %]Pay an individual fine[% ELSIF ( writeoff_individual ) %]Write off an individual fine[% ELSE %][% IF ( selected_accts ) %]Pay an amount toward selected fines[% ELSE %]Pay an amount toward all fines[% END %][% END %]</div>
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>  &rsaquo; <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% borrower.borrowernumber %]">Pay fines for [% INCLUDE 'patron-title.inc' %]</a> &rsaquo; [% IF ( pay_individual ) %]Pay an individual fine[% ELSIF ( writeoff_individual ) %]Write off an individual fine[% ELSE %][% IF ( selected_accts ) %]Pay an amount toward selected fines[% ELSE %]Pay an amount toward all fines[% END %][% END %]</div>
 
 <div id="doc3" class="yui-t2">
 
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/routing-lists.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/routing-lists.tt
index 04876dc..e175566 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/routing-lists.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/routing-lists.tt
@@ -1,12 +1,12 @@
 [% INCLUDE 'doc-head-open.inc' %]
-<title>Subscription Routing Lists for [% INCLUDE 'patron-title.inc' %]</title>
+<title>Koha &rsaquo; Patrons &rsaquo; Subscription routing lists for [% INCLUDE 'patron-title.inc' %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
 </head>
 <body>
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'patron-search.inc' %]
 
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>  &rsaquo; Subscription Routing Lists for [% INCLUDE 'patron-title.inc' %]</div>
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>  &rsaquo; Subscription routing lists for [% INCLUDE 'patron-title.inc' %]</div>
 
 <div id="doc3" class="yui-t2">
     <div id="bd">
diff --git a/members/mancredit.pl b/members/mancredit.pl
index 88200d0..7cabaed 100755
--- a/members/mancredit.pl
+++ b/members/mancredit.pl
@@ -91,6 +91,7 @@ if (C4::Context->preference('ExtendedPatronAttributes')) {
         borrowernumber => $borrowernumber,
         firstname => $data->{'firstname'},
         surname  => $data->{'surname'},
+        othernames => $data->{'othernames'},
 		    cardnumber => $data->{'cardnumber'},
 		    categorycode => $data->{'categorycode'},
 		    category_type => $data->{'category_type'},
diff --git a/members/maninvoice.pl b/members/maninvoice.pl
index f1c572c..a83a684 100755
--- a/members/maninvoice.pl
+++ b/members/maninvoice.pl
@@ -118,6 +118,7 @@ if (C4::Context->preference('ExtendedPatronAttributes')) {
                 borrowernumber => $borrowernumber,
 		firstname => $data->{'firstname'},
                 surname  => $data->{'surname'},
+        othernames => $data->{'othernames'},
 		cardnumber => $data->{'cardnumber'},
 		categorycode => $data->{'categorycode'},
 		category_type => $data->{'category_type'},
diff --git a/members/member-flags.pl b/members/member-flags.pl
index ca8c9d0..1cc549b 100755
--- a/members/member-flags.pl
+++ b/members/member-flags.pl
@@ -176,6 +176,7 @@ $template->param(
     cardnumber => $bor->{'cardnumber'},
 		surname => $bor->{'surname'},
 		firstname => $bor->{'firstname'},
+        othernames => $bor->{'othernames'},
 		categorycode => $bor->{'categorycode'},
 		category_type => $bor->{'category_type'},
 		categoryname => $bor->{'description'},
diff --git a/members/routing-lists.pl b/members/routing-lists.pl
index 25b0f85..ed81aac 100755
--- a/members/routing-lists.pl
+++ b/members/routing-lists.pl
@@ -113,6 +113,7 @@ $template->param(
     branchname        => GetBranchName($borrower->{'branchcode'}),
     firstname         => $borrower->{'firstname'},
     surname           => $borrower->{'surname'},
+    othernames        => $borrower->{'othernames'},
     categorycode      => $borrower->{'categorycode'},
     categoryname      => $borrower->{description},
     address           => $address,
-- 
1.7.9.5



More information about the Koha-patches mailing list