[Patches] [PATCH] bug 7198: show patron name in overdue list even if name

koha-patchbot at kohaaloha.com koha-patchbot at kohaaloha.com
Sat Nov 12 19:40:02 NZDT 2011


From: Galen Charlton <gmc at esilibrary.com>
Date: Tue, 8 Nov 2011 20:44:25 -0500
Subject: [PATCH] bug 7198: show patron name in overdue list even if name
 column is null

If the surname or firstname of a patron is NULL, the MySQL concat()
function (properly) returns NULL, leading to the patron name not
displaying in the overdue report.

Signed-off-by: Galen Charlton <gmc at esilibrary.com>
Signed-off-by: Chris Cormack <chrisc at catalyst.net.nz>
---
 circ/overdue.pl                                    |   17 ++++++++++-------
 .../intranet-tmpl/prog/en/modules/circ/overdue.tt  |    2 +-
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/circ/overdue.pl b/circ/overdue.pl
index dc15e8b..85e645b 100755
--- a/circ/overdue.pl
+++ b/circ/overdue.pl
@@ -236,7 +236,8 @@ if ($noreport) {
 
     my $strsth="SELECT date_due,
         borrowers.title as borrowertitle,
-        concat(surname,' ', firstname) as borrower, 
+        borrowers.surname,
+        borrowers.firstname,
         borrowers.streetnumber,
         borrowers.streettype, 
         borrowers.address,
@@ -281,11 +282,12 @@ if ($noreport) {
     $strsth =~ s/WHERE 1=1/WHERE 1=1 AND borrowers.borrowernumber IN ($bnlist)/ if $bnlist;
     $strsth =~ s/WHERE 1=1/WHERE 0=1/ if $have_pattr_filter_data  && !$bnlist;  # no match if no borrowers matched patron attrs
     $strsth.=" ORDER BY " . (
-        ($order eq "borrower" or $order eq "borrower desc") ? "$order, date_due"                 : 
-        ($order eq "title"    or $order eq    "title desc") ? "$order, date_due, borrower"       :
-        ($order eq "barcode"  or $order eq  "barcode desc") ? "items.$order, date_due, borrower" :
-                                ($order eq "date_due desc") ? "date_due DESC, borrower"          :
-                                                            "date_due, borrower"  # default sort order
+        ($order eq "borrower")                              ? "surname, firstname, date_due"               : 
+        ($order eq "borrower desc")                         ? "surname desc, firstname desc, date_due"     : 
+        ($order eq "title"    or $order eq    "title desc") ? "$order, date_due, surname, firstname"       :
+        ($order eq "barcode"  or $order eq  "barcode desc") ? "items.$order, date_due, surname, firstname" :
+                                ($order eq "date_due desc") ? "date_due DESC, surname, firstname"          :
+                                                            "date_due, surname, firstname"  # default sort order
     );
     $template->param(sql=>$strsth);
     my $sth=$dbh->prepare($strsth);
@@ -313,7 +315,8 @@ if ($noreport) {
             barcode                => $data->{barcode},
             itemnum                => $data->{itemnumber},
             borrowertitle          => $data->{borrowertitle},
-            name                   => $data->{borrower},
+            surname                => $data->{surname},
+            firstname              => $data->{firstname},
             streetnumber           => $data->{streetnumber},                   
             streettype             => $data->{streettype},                     
             address                => $data->{address},                        
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt
index eb0540e..e196399 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt
@@ -116,7 +116,7 @@
 <tbody>[% FOREACH overdueloo IN overdueloop %]
     <tr>
         <td>[% overdueloo.duedate %]</td>
-        <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% overdueloo.borrowernumber %]">[% overdueloo.name %]</a>
+        <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% overdueloo.borrowernumber %]">[% overdueloo.surname %] [% overdueloo.firstname %]</a>
         [% IF ( overdueloo.email ) %][<a href="mailto:[% overdueloo.email %]?subject=Overdue: [% overdueloo.title |html %]">email</a>][% END %]
         [% IF ( overdueloo.phone ) %]([% overdueloo.phone %])[% ELSIF ( overdueloo.mobile ) %]([% overdueloo.mobile %])[% ELSIF ( overdueloo.phonepro ) %]([% overdueloo.phonepro %])[% END %]</td>
         <td>[% overdueloo.branchcode %]</td>
-- 
1.7.5.4


More information about the Patches mailing list