Bug 7318: Fixes category display in patroncards Patron Search results.

Category description and type were not being sent to the template.  This patch fixes that issue, which also fixes the display.  The display was showing 'Category Description (category type)'.  It now displays 'Category Description (category code) to be consistent with the search label.

This patch also assigns an empty string to $member to get rid of some 'uninitialized' errors in the logs.

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Confirm this patch fixes the display issue.
Passes prove xt

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
This commit is contained in:
Garry Collum 2012-01-21 13:37:19 -05:00 committed by Paul Poulain
parent c55c58ee4b
commit cef7c1b40b
2 changed files with 15 additions and 5 deletions

View file

@ -114,7 +114,7 @@ function add_item(borrowernum,batch_id,type_id){
<td> <input type="checkbox" name="borrowernumber" id="patron[% resultsloo.borrowernumber %]" value="[% resultsloo.borrowernumber %]" /> </td>
<td>[% resultsloo.cardnumber %]</td>
<td style="white-space: nowrap;"><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% resultsloo.borrowernumber %]">[% resultsloo.surname %], [% resultsloo.firstname %]</a> <br /> [% resultsloo.address %][% IF ( resultsloo.address2 ) %]<br />[% resultsloo.address2 %][% END %][% IF ( resultsloo.city ) %]<br />[% resultsloo.city %][% END %]</td>
<td>[% resultsloo.category_description %] ([% resultsloo.category_type %])</td>
<td>[% resultsloo.category_description %] ([% resultsloo.categorycode %])</td>
<td>[% resultsloo.branchcode %]</td>
<td>[% resultsloo.dateexpiry %]</td>
<td>[% resultsloo.borrowernotes %]</td>

View file

@ -33,9 +33,20 @@ my $batch_id = $cgi->param('batch_id') || 0;
my $startfrom = $cgi->param('startfrom')||1;
my $resultsperpage = $cgi->param('resultsperpage')||C4::Context->preference("PatronsPerPage")||20;
my $category = $cgi->param('category') || undef;
my $member = $cgi->param('member') || undef;
my $member = $cgi->param('member') || '';
my $orderby = $cgi->param('orderby') || undef;
my @categories=C4::Category->all;
my %categories_display;
foreach my $category (@categories) {
my $hash={
category_description=>$$category{description},
category_type=>$$category{category_type}
};
$categories_display{$$category{categorycode}} = $hash;
}
my ($template, $loggedinuser, $cookie) = get_template_and_user({
template_name => "patroncards/members-search.tmpl",
query => $cgi,
@ -49,7 +60,7 @@ $member =~ s/,//g; #remove any commas from search string
$member =~ s/\*/%/g;
if ($member || $category) {
my $results = $category ? Search({''=>$member, category_type=>$category}, $orderby)
my $results = $category ? Search({''=>$member, categorycode=>$category}, $orderby)
: Search($member, $orderby);
my $count = $results ? @$results : 0;
@ -60,13 +71,12 @@ if ($member || $category) {
my ($od,$issue,$fines) = GetMemberIssuesAndFines($results->[$i]{'borrowernumber'});
my %row = (
count => $i + 1,
%{$categories_display{$results->[$i]{categorycode}}},
borrowernumber => $results->[$i]{'borrowernumber'},
cardnumber => $results->[$i]{'cardnumber'},
surname => $results->[$i]{'surname'},
firstname => $results->[$i]{'firstname'},
categorycode => $results->[$i]{'categorycode'},
category_type => $results->[$i]{'category_type'},
category_description => $results->[$i]{'description'},
address => $results->[$i]{'address'},
address2 => $results->[$i]{'address2'},
city => $results->[$i]{'city'},