Bugzilla – Attachment 107820 Details for
Bug 26141
Duplicated code in search.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26141: Remove duplicated code from search.pl
Bug-26141-Remove-duplicated-code-from-searchpl.patch (text/plain), 3.59 KB, created by
Jonathan Druart
on 2020-08-05 07:59:27 UTC
(
hide
)
Description:
Bug 26141: Remove duplicated code from search.pl
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-08-05 07:59:27 UTC
Size:
3.59 KB
patch
obsolete
>From 6e5e78353fda26849ef504935719c7d4f96e5467 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 5 Aug 2020 09:57:56 +0200 >Subject: [PATCH] Bug 26141: Remove duplicated code from search.pl > >commit 417553a9e47bf31f4cb785162e3dced856a2ac2a > 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 >--- > catalogue/search.pl | 46 --------------------------------------------- > 1 file changed, 46 deletions(-) > >diff --git a/catalogue/search.pl b/catalogue/search.pl >index 6e5d929413..1fd012d8df 100755 >--- a/catalogue/search.pl >+++ b/catalogue/search.pl >@@ -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); >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 26141
:
107820
|
107828