From fbe94b03147dcb79010a29d86936473f5576721c Mon Sep 17 00:00:00 2001 From: Galen Charlton 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 Signed-off-by: Chris Cormack Signed-off-by: Paul Poulain (cherry picked from commit 18e06ecf0bfeeefd08575d0512891bea52bc1bde) Signed-off-by: Chris Nighswonger --- circ/overdue.pl | 17 ++++++++++------- .../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 e755b12e16..e59961a302 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, @@ -282,11 +283,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); @@ -315,7 +317,8 @@ if ($noreport) { itemnum => $data->{itemnumber}, issuedate => format_date($data->{issuedate}), 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 eb0540ebb7..e196399bfa 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 @@ [% FOREACH overdueloo IN overdueloop %] [% overdueloo.duedate %] - [% overdueloo.name %] + [% overdueloo.surname %] [% overdueloo.firstname %] [% IF ( overdueloo.email ) %][email][% END %] [% IF ( overdueloo.phone ) %]([% overdueloo.phone %])[% ELSIF ( overdueloo.mobile ) %]([% overdueloo.mobile %])[% ELSIF ( overdueloo.phonepro ) %]([% overdueloo.phonepro %])[% END %] [% overdueloo.branchcode %] -- 2.39.5