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

(-)a/C4/AuthoritiesMarc.pm (-10 / +11 lines)
Lines 876-887 sub BuildSummary { Link Here
876
    my ($record,$authid,$authtypecode)=@_;
876
    my ($record,$authid,$authtypecode)=@_;
877
    my $dbh=C4::Context->dbh;
877
    my $dbh=C4::Context->dbh;
878
    my %summary;
878
    my %summary;
879
    my $summary_template;
879
    # handle $authtypecode is NULL or eq ""
880
    # handle $authtypecode is NULL or eq ""
880
    if ($authtypecode) {
881
    if ($authtypecode) {
881
        my $authref = GetAuthType($authtypecode);
882
        my $authref = GetAuthType($authtypecode);
882
        $summary{authtypecode} = $authref->{authtypecode};
883
        $summary{authtypecode} = $authref->{authtypecode};
883
        $summary{type} = $authref->{authtypetext};
884
        $summary{type} = $authref->{authtypetext};
884
        $summary{summary} = $authref->{summary};
885
        $summary_template = $authref->{summary};
885
    }
886
    }
886
    my $marc21subfields = 'abcdfghjklmnopqrstuvxyz68';
887
    my $marc21subfields = 'abcdfghjklmnopqrstuvxyz68';
887
    my %marc21controlrefs = ( 'a' => 'earlier',
888
    my %marc21controlrefs = ( 'a' => 'earlier',
Lines 914-927 sub BuildSummary { Link Here
914
#         suit the MARC21 version, so for now the "templating"
915
#         suit the MARC21 version, so for now the "templating"
915
#         feature will be enabled only for UNIMARC for backwards
916
#         feature will be enabled only for UNIMARC for backwards
916
#         compatibility.
917
#         compatibility.
917
    if ($summary{summary} and C4::Context->preference('marcflavour') eq 'UNIMARC') {
918
    if ($summary_template and C4::Context->preference('marcflavour') eq 'UNIMARC') {
918
        my @fields = $record->fields();
919
        my @fields = $record->fields();
919
#             $reported_tag = '$9'.$result[$counter];
920
#             $reported_tag = '$9'.$result[$counter];
920
        my @stringssummary;
921
        my @repets;
921
        foreach my $field (@fields) {
922
        foreach my $field (@fields) {
922
            my $tag = $field->tag();
923
            my $tag = $field->tag();
923
            my $tagvalue = $field->as_string();
924
            my $tagvalue = $field->as_string();
924
            my $localsummary= $summary{summary};
925
            my $localsummary= $summary_template;
925
            $localsummary =~ s/\[(.?.?.?.?)$tag\*(.*?)\]/$1$tagvalue$2\[$1$tag$2\]/g;
926
            $localsummary =~ s/\[(.?.?.?.?)$tag\*(.*?)\]/$1$tagvalue$2\[$1$tag$2\]/g;
926
            if ($tag<10) {
927
            if ($tag<10) {
927
                if ($tag eq '001') {
928
                if ($tag eq '001') {
Lines 936-948 sub BuildSummary { Link Here
936
                    $localsummary =~ s/\[(.?.?.?.?)$tagsubf(.*?)\]/$1$subfieldvalue$2\[$1$tagsubf$2\]/g;
937
                    $localsummary =~ s/\[(.?.?.?.?)$tagsubf(.*?)\]/$1$subfieldvalue$2\[$1$tagsubf$2\]/g;
937
                }
938
                }
938
            }
939
            }
939
            push @stringssummary, $localsummary if ($localsummary ne $summary{summary});
940
            if ($localsummary ne $summary_template) {
941
                $localsummary =~ s/\[(.*?)\]//g;
942
                $localsummary =~ s/\n/<br>/g;
943
                push @repets, $localsummary;
944
            }
940
        }
945
        }
941
        my $resultstring;
946
        $summary{repets} = \@repets;
942
        $resultstring = join(" -- ",@stringssummary);
943
        $resultstring =~ s/\[(.*?)\]//g;
944
        $resultstring =~ s/\n/<br>/g;
945
        $summary{summary}      =  $resultstring;
946
    }
947
    }
947
    my @authorized;
948
    my @authorized;
948
    my @notes;
949
    my @notes;
(-)a/authorities/auth_finder.pl (-13 lines)
Lines 72-90 if ( $op eq "do_search" ) { Link Here
72
        $startfrom * $resultsperpage,
72
        $startfrom * $resultsperpage,
73
        $resultsperpage, $authtypecode, $orderby);
73
        $resultsperpage, $authtypecode, $orderby);
74
74
75
    # If an authority heading is repeated, add an arrayref to those repetions
76
    # First heading -- Second heading
77
    for my $heading ( @$results ) {
78
        my @repets = split / -- /, $heading->{summary};
79
        if ( @repets > 1 ) {
80
            my @repets_loop;
81
            for (my $i = 0; $i < @repets; $i++) {
82
                push @repets_loop,
83
                    { index => $index, repet => $i+1, value => $repets[$i] };
84
            }
85
            $heading->{repets} = \@repets_loop;
86
        }
87
    }
88
    # multi page display gestion
75
    # multi page display gestion
89
    my $displaynext = 0;
76
    my $displaynext = 0;
90
    my $displayprev = $startfrom;
77
    my $displayprev = $startfrom;
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-search-results.inc (-2 / +8 lines)
Lines 29-46 Link Here
29
    [% END %]
29
    [% END %]
30
[% END %]
30
[% END %]
31
[% BLOCK authresult %]
31
[% BLOCK authresult %]
32
    [% IF ( summary.summary ) %][% summary.summary | html %]:[% END %]
32
    <div class="authres_repet">
33
      [% FOREACH repet IN summary.repets %]
34
        <span>[% repet | html %]</span>
35
        [% UNLESS loop.last %] | [% END %]
36
      [% END %]
37
    </div>
33
    [% UNLESS ( summary.summaryonly ) %]
38
    [% UNLESS ( summary.summaryonly ) %]
34
        <div class="authorizedheading">
39
        <div class="authorizedheading">
35
        [% FOREACH authorize IN summary.authorized %]
40
        [% FOREACH authorize IN summary.authorized %]
36
          <span class="authorizedheading">[% authorize.heading | html %]</span>
41
          <span class="authorizedheading">[% authorize.heading | html %]</span>
42
          [% UNLESS loop.last %] | [% END %]
37
        [% END %]
43
        [% END %]
38
        </div>
44
        </div>
39
        [% IF ( marcflavour == 'UNIMARC' ) %]
45
        [% IF ( marcflavour == 'UNIMARC' ) %]
40
          [% IF summary.notes %]
46
          [% IF summary.notes %]
41
           <div class="authres_notes">
47
           <div class="authres_notes">
42
           [% FOREACH note IN summary.notes %]
48
           [% FOREACH note IN summary.notes %]
43
             [% note.note | html %]</span>
49
             <span>[% note.note | html %]</span>
44
           [% END %]
50
           [% END %]
45
           </div>
51
           </div>
46
          [% END %]
52
          [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist-auth.tt (-3 / +3 lines)
Lines 73-81 function doauth(authid, index, repet) Link Here
73
                        <td>[% PROCESS authresult summary=resul.summary %]</td>
73
                        <td>[% PROCESS authresult summary=resul.summary %]</td>
74
                        <td>[% resul.used %] times</td>
74
                        <td>[% resul.used %] times</td>
75
                        <td>
75
                        <td>
76
                          [% IF resul.repets %]
76
                          [% IF resul.summary && resul.summary.repets && resul.summary.repets.size > 1 %]
77
                            [% FOREACH repet IN resul.repets %]
77
                            [% FOREACH repet IN resul.summary.repets %]
78
                            <a href="javascript:doauth('[% resul.authid %]', '[% repet.index %]', '[% repet.repet %]')" title="[% repet.value %]">[% repet.repet %]</a>
78
                            <a href="javascript:doauth('[% resul.authid %]', '[% index %]', '[% loop.count %]')" title="[% repet | html %]">[% loop.count %]</a>
79
                            [% END %]
79
                            [% END %]
80
                          [% ELSE %]
80
                          [% ELSE %]
81
                            <a href="javascript:doauth('[% resul.authid %]', '[% index %]', '')">choose</a>
81
                            <a href="javascript:doauth('[% resul.authid %]', '[% index %]', '')">choose</a>
(-)a/koha-tmpl/opac-tmpl/prog/en/includes/authorities-search-results.inc (-3 / +8 lines)
Lines 29-46 Link Here
29
    [% END %]
29
    [% END %]
30
[% END %]
30
[% END %]
31
[% BLOCK authresult %]
31
[% BLOCK authresult %]
32
    [% IF ( summary.summary ) %][% summary.summary | html %]:[% END %]
32
    <div class="authres_repet">
33
      [% FOREACH repet IN summary.repets %]
34
        <span>[% repet | html %]</span>
35
        [% UNLESS loop.last %] | [% END %]
36
      [% END %]
37
    </div>
33
    [% UNLESS ( summary.summaryonly ) %]
38
    [% UNLESS ( summary.summaryonly ) %]
34
        <div class="authorizedheading">
39
        <div class="authorizedheading">
35
          [% FOREACH authorize IN summary.authorized %]
40
          [% FOREACH authorize IN summary.authorized %]
36
            <span class="authorizedheading">[% authorize.heading | html %]</span>
41
            <span class="authorizedheading">[% authorize.heading | html %]</span>
42
            [% UNLESS loop.last %] | [% END %]
37
          [% END %]
43
          [% END %]
38
        </div>
44
        </div>
39
        [% IF ( marcflavour == 'UNIMARC' ) %]
45
        [% IF ( marcflavour == 'UNIMARC' ) %]
40
            [% IF summary.notes %]
46
            [% IF summary.notes %]
41
             <div class="authres_notes">
47
             <div class="authres_notes">
42
             [% FOREACH note IN summary.notes %]
48
             [% FOREACH note IN summary.notes %]
43
               [% note.note | html %]</span>
49
               <span>[% note.note | html %]</span>
44
             [% END %]
50
             [% END %]
45
             </div>
51
             </div>
46
            [% END %]
52
            [% END %]
47
- 

Return to bug 7442