From cef7c1b40b403c4bcf0c02b13b60d704e4c8cd83 Mon Sep 17 00:00:00 2001 From: Garry Collum Date: Sat, 21 Jan 2012 13:37:19 -0500 Subject: [PATCH] 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 Confirm this patch fixes the display issue. Passes prove xt Signed-off-by: Paul Poulain --- .../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 4d651b75db..cbd1db5223 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 dfa0462340..6c27095377 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'}, -- 2.39.5