From 36d80c4007dfee8544137df8761cd8e797fbd18e Mon Sep 17 00:00:00 2001 From: Garry Collum Date: Sat, 21 Jan 2012 13:37:19 -0500 Subject: [PATCH] [Signed Off] Bug 7318: Fixes category display in patroncards Patron Search results. Content-Type: text/plain; charset="utf-8" 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 Confirm this patch fixes the display issue. Passes prove xt --- .../prog/en/modules/patroncards/members-search.tt | 2 +- patroncards/members-search.pl | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/members-search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/members-search.tt index 4d651b7..cbd1db5 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/members-search.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/members-search.tt @@ -114,7 +114,7 @@ function add_item(borrowernum,batch_id,type_id){ [% resultsloo.cardnumber %] [% resultsloo.surname %], [% resultsloo.firstname %]
[% resultsloo.address %][% IF ( resultsloo.address2 ) %]
[% resultsloo.address2 %][% END %][% IF ( resultsloo.city ) %]
[% resultsloo.city %][% END %] - [% resultsloo.category_description %] ([% resultsloo.category_type %]) + [% resultsloo.category_description %] ([% resultsloo.categorycode %]) [% resultsloo.branchcode %] [% resultsloo.dateexpiry %] [% resultsloo.borrowernotes %] diff --git a/patroncards/members-search.pl b/patroncards/members-search.pl index dfa0462..6c27095 100755 --- a/patroncards/members-search.pl +++ b/patroncards/members-search.pl @@ -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'}, -- 1.7.5.4