View | Details | Raw Unified | Return to bug 18400
Collapse All | Expand All

(-)a/opac/opac-search.pl (-7 / +4 lines)
Lines 224-236 $template->param(search_languages_loop => $languages_limit_loop,); Link Here
224
my $itemtypes = GetItemTypesCategorized;
224
my $itemtypes = GetItemTypesCategorized;
225
# add translated_description to itemtypes
225
# add translated_description to itemtypes
226
foreach my $itemtype ( keys %{$itemtypes} ) {
226
foreach my $itemtype ( keys %{$itemtypes} ) {
227
    # Itemtypes search categories don't have (yet) translated descriptions, they are auth values
227
    # Itemtypes search categories don't have (yet) translated descriptions, they are auth values (and could still have no descriptions too BZ 18400)
228
    my $translated_description = getitemtypeinfo( $itemtype, 'opac' )->{translated_description};
228
    my $translated_description = getitemtypeinfo( $itemtype, 'opac' )->{translated_description};
229
    $itemtypes->{$itemtype}->{translated_description} =
229
    $itemtypes->{$itemtype}->{translated_description} = $translated_description || $itemtypes->{$itemtype}->{description} || q{};
230
            ( $translated_description ) ? $translated_description : $itemtypes->{$itemtype}->{description};
231
}
230
}
232
my $itemtypes_copy = { %$itemtypes }; #Sometime itemtypes can be corrupted in advanced_srch_type loop
231
233
                                      #Making a copy ensure it is clean
234
# the index parameter is different for item-level itemtypes
232
# the index parameter is different for item-level itemtypes
235
my $itype_or_itemtype = (C4::Context->preference("item-level_itypes"))?'itype':'itemtype';
233
my $itype_or_itemtype = (C4::Context->preference("item-level_itypes"))?'itype':'itemtype';
236
my @advancedsearchesloop;
234
my @advancedsearchesloop;
Lines 250-262 if ( $yaml =~ /\S/ ) { Link Here
250
    }
248
    }
251
}
249
}
252
250
251
my @sorted_itemtypes = sort { $itemtypes->{$a}->{translated_description} cmp $itemtypes->{$b}->{translated_description} } keys %$itemtypes;
253
foreach my $advanced_srch_type (@advanced_search_types) {
252
foreach my $advanced_srch_type (@advanced_search_types) {
254
    $advanced_srch_type =~ s/^\s*//;
253
    $advanced_srch_type =~ s/^\s*//;
255
    $advanced_srch_type =~ s/\s*$//;
254
    $advanced_srch_type =~ s/\s*$//;
256
   if ($advanced_srch_type eq 'itemtypes') {
255
   if ($advanced_srch_type eq 'itemtypes') {
257
   # itemtype is a special case, since it's not defined in authorized values
256
   # itemtype is a special case, since it's not defined in authorized values
258
        my @itypesloop;
257
        my @itypesloop;
259
        my @sorted_itemtypes = ( sort {$itemtypes->{$a}->{translated_description} cmp $itemtypes->{$b}->{translated_description} } keys %$itemtypes_copy );
260
        foreach my $thisitemtype ( @sorted_itemtypes ) {
258
        foreach my $thisitemtype ( @sorted_itemtypes ) {
261
            next if $hidingrules->{itype} && any { $_ eq $thisitemtype } @{$hidingrules->{itype}};
259
            next if $hidingrules->{itype} && any { $_ eq $thisitemtype } @{$hidingrules->{itype}};
262
            next if $hidingrules->{itemtype} && any { $_ eq $thisitemtype } @{$hidingrules->{itemtype}};
260
            next if $hidingrules->{itemtype} && any { $_ eq $thisitemtype } @{$hidingrules->{itemtype}};
263
- 

Return to bug 18400