Bug 26141: Remove duplicated code from search.pl

commit 417553a9e4
  Bug 12478: starting to add search to staff client

This commit added code related to the itemtypes to the advanced search, but this code already existed.

The weird bit is:
$template->param(advancedsearchesloop => \@advancedsearchesloop);
my $types = C4::Context->preference("AdvancedSearchTypes") || "itemtypes";
my $advancedsearchesloop = prepare_adv_search_types($types);
$template->param(advancedsearchesloop => $advancedsearchesloop);

We are passing twice advancedsearchesloop to the template.

Test plan (for QA):
Review the changes and confirm that we can safely remove this code

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit a51a4f117d)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2020-08-05 09:57:56 +02:00 committed by Lucas Gass
parent c98a283d11
commit f132aa4b30
1 changed files with 0 additions and 46 deletions

View File

@ -237,52 +237,6 @@ $template->param(
);
# load the Type stuff
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
# the index parameter is different for item-level itemtypes
my $itype_or_itemtype = (C4::Context->preference("item-level_itypes"))?'itype':'itemtype';
my @advancedsearchesloop;
my $cnt;
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) {
$advanced_srch_type =~ s/^\s*//;
$advanced_srch_type =~ s/\s*$//;
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}->{translated_description} cmp $itemtypes->{$b}->{translated_description} } keys %$itemtypes ) {
my %row =( number=>$cnt++,
ccl => "$itype_or_itemtype,phr",
code => $thisitemtype,
description => $itemtypes->{$thisitemtype}->{translated_description},
imageurl=> getitemtypeimagelocation( 'intranet', $itemtypes->{$thisitemtype}->{'imageurl'} ),
);
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 =(
number=>$cnt++,
ccl => $advanced_srch_type,
code => $thisitemtype->{authorised_value},
description => $thisitemtype->{'lib'},
imageurl => getitemtypeimagelocation( 'intranet', $thisitemtype->{'imageurl'} ),
);
push @authvalueloop, \%row;
}
my %search_code = ( advanced_search_type => $advanced_srch_type,
code_loop => \@authvalueloop );
push @advancedsearchesloop, \%search_code;
}
}
$template->param(advancedsearchesloop => \@advancedsearchesloop);
my $types = C4::Context->preference("AdvancedSearchTypes") || "itemtypes";
my $advancedsearchesloop = prepare_adv_search_types($types);
$template->param(advancedsearchesloop => $advancedsearchesloop);