From 3ad8aa98ad74cccdf449fad9953e25545ad00b00 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 10 May 2013 10:55:19 -0400 Subject: [PATCH] Bug 9203 [Incomplete] limit pull down broken when adding biblio to subscription Content-Type: text/plain; charset="utf-8" When creating a subscription, if you use "Search for Biblio" link to search for an existing record the popup has a broken item type selection option. This broke when it became possible to add multiple values to the AdvancedSearchTypes system preference. This patch uses code from opac-search.pl as a template for enabling handling of multiple search limiters when buliding the search form. HOWEVER, I'm not sure how to amend the search process to handle multiple limiters. I would be grateful if someone could take it over from here or walk me through the process. --- .../en/modules/serials/subscription-bib-search.tt | 18 ++++- serials/subscription-bib-search.pl | 78 ++++++++++---------- 2 files changed, 54 insertions(+), 42 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-bib-search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-bib-search.tt index f78d5e0..b84015d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-bib-search.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-bib-search.tt @@ -18,12 +18,20 @@
  1. - + +[% FOREACH advancedsearchesloo IN advancedsearchesloop %] -
  2. - - [% FOREACH itemtypeloo IN itemtypeloop %] + [% FOREACH itemtypeloo IN advancedsearchesloo.code_loop %] @@ -31,6 +39,8 @@
  3. +[% END %] +
diff --git a/serials/subscription-bib-search.pl b/serials/subscription-bib-search.pl index 95e4aa7..773de23 100755 --- a/serials/subscription-bib-search.pl +++ b/serials/subscription-bib-search.pl @@ -199,51 +199,53 @@ else { authnotrequired => 0, flagsrequired => {catalogue => 1, serials => '*'}, debug => 1, - }); - # load the itemtypes + }); + # load the Type stuff my $itemtypes = GetItemTypes; - my @itemtypesloop; - if (!$advanced_search_types or $advanced_search_types eq 'itemtypes') { - # load the itemtypes - my $itemtypes = GetItemTypes; - my $selected=1; - my $cnt; - foreach my $thisitemtype ( sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'} } keys %$itemtypes ) { - my %row =( - code => $thisitemtype, - selected => $selected, - description => $itemtypes->{$thisitemtype}->{'description'}, - ); - $selected = 0 if ($selected) ; - push @itemtypesloop, \%row; - } - - - } else { - my $advsearchtypes = GetAuthorisedValues($advanced_search_types); - my $cnt; - my $selected=1; - for my $thisitemtype (sort {$a->{'lib'} cmp $b->{'lib'}} @$advsearchtypes) { - my %row =( - number=>$cnt++, - ccl => $advanced_search_types, - code => $thisitemtype->{authorised_value}, - selected => $selected, - description => $thisitemtype->{'lib'}, - count5 => $cnt % 4, - imageurl=> getitemtypeimagelocation( 'intranet', $thisitemtype->{'imageurl'} ), - ); - push @itemtypesloop, \%row; - } + my @advancedsearchesloop; + my $selected=1; + + my $advanced_search_types = C4::Context->preference("AdvancedSearchTypes") || "itemtypes"; + my @advanced_search_types = split(/\|/, $advanced_search_types); + + foreach my $advanced_srch_type (@advanced_search_types) { + if ($advanced_srch_type eq 'itemtypes') { + # itemtype is a special case, since it's not defined in authorized values + my @itypesloop; + foreach my $thisitemtype ( sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'} } keys %$itemtypes ) { + my %row =( + code => $thisitemtype, + selected => $selected, + description => $itemtypes->{$thisitemtype}->{'description'}, + ); + $selected = 0 if ($selected); + push @itypesloop, \%row; + } + my %search_code = ( advanced_search_type => $advanced_srch_type, + code_loop => \@itypesloop ); + push @advancedsearchesloop, \%search_code; + } else { + # covers all the other cases: non-itemtype authorized values + my $advsearchtypes = GetAuthorisedValues($advanced_srch_type); + my @authvalueloop; + for my $thisitemtype (@$advsearchtypes) { + my %row =( + code => $thisitemtype->{authorised_value}, + description => $thisitemtype->{'lib_opac'} || $thisitemtype->{'lib'}, + ); + push @authvalueloop, \%row; + } + my %search_code = ( advanced_search_type => $advanced_srch_type, + code_loop => \@authvalueloop ); + push @advancedsearchesloop, \%search_code; + } } - - if ($op eq "do_search") { $template->param("no_query" => 1); } else { $template->param("no_query" => 0); } - $template->param(itemtypeloop => \@itemtypesloop); +$template->param(advancedsearchesloop => \@advancedsearchesloop); } # Print the page output_html_with_http_headers $input, $cookie, $template->output; -- 1.7.9.5