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

(-)a/authorities/auth_finder.pl (-7 / +26 lines)
Lines 72-85 if ( $op eq "do_search" ) { Link Here
72
        $resultsperpage, $authtypecode, $orderby);
72
        $resultsperpage, $authtypecode, $orderby);
73
73
74
    # If an authority heading is repeated, add an arrayref to those repetions
74
    # If an authority heading is repeated, add an arrayref to those repetions
75
    # First heading -- Second heading
76
    for my $heading ( @$results ) {
75
    for my $heading ( @$results ) {
77
        my @repets = split / -- /, $heading->{summary};
76
        my @repets_loop;
78
        if ( @repets > 1 ) {
77
        if ( C4::Context->preference("marcflavour") eq "UNIMARC" ) {
79
            my @repets_loop;
78
            my $record = GetAuthority($heading->{'authid'});
80
            for (my $i = 0; $i < @repets; $i++) {
79
            my $auth_name = '';     # will be displayed in the link tooltip
80
            my $cpt = 0;
81
            foreach my $field ($record->field('200')) {
82
                $auth_name = $field->subfield('a');
83
                if ($field->subfield('b')) { $auth_name .= ', ' . $field->subfield('b') }
84
                $cpt++;
81
                push @repets_loop,
85
                push @repets_loop,
82
                    { index => $index, repet => $i+1, value => $repets[$i] };
86
                        { index => $index, repet => $cpt, value => $auth_name };
87
            }
88
            if ( $cpt < 2 ) {
89
                undef @repets_loop;
90
            }
91
            else {
92
                $heading->{repets} = \@repets_loop;
93
            }
94
        }
95
        else {
96
            my @repets = split / -- /, $heading->{summary};
97
            if ( @repets > 1 ) {
98
                my @repets_loop;
99
                for (my $i = 0; $i < @repets; $i++) {
100
                    push @repets_loop,
101
                        { index => $index, repet => $i+1, value => $repets[$i] };
102
                }
83
            }
103
            }
84
            $heading->{repets} = \@repets_loop;
104
            $heading->{repets} = \@repets_loop;
85
        }
105
        }
86
- 

Return to bug 7442