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

(-)a/C4/AuthoritiesMarc.pm (-10 / +11 lines)
Lines 878-889 sub BuildSummary { Link Here
878
    my ($record,$authid,$authtypecode)=@_;
878
    my ($record,$authid,$authtypecode)=@_;
879
    my $dbh=C4::Context->dbh;
879
    my $dbh=C4::Context->dbh;
880
    my %summary;
880
    my %summary;
881
    my $summary_template;
881
    # handle $authtypecode is NULL or eq ""
882
    # handle $authtypecode is NULL or eq ""
882
    if ($authtypecode) {
883
    if ($authtypecode) {
883
        my $authref = GetAuthType($authtypecode);
884
        my $authref = GetAuthType($authtypecode);
884
        $summary{authtypecode} = $authref->{authtypecode};
885
        $summary{authtypecode} = $authref->{authtypecode};
885
        $summary{type} = $authref->{authtypetext};
886
        $summary{type} = $authref->{authtypetext};
886
        $summary{summary} = $authref->{summary};
887
        $summary_template = $authref->{summary};
887
    }
888
    }
888
    my $marc21subfields = 'abcdfghjklmnopqrstuvxyz68';
889
    my $marc21subfields = 'abcdfghjklmnopqrstuvxyz68';
889
    my %marc21controlrefs = ( 'a' => 'earlier',
890
    my %marc21controlrefs = ( 'a' => 'earlier',
Lines 916-929 sub BuildSummary { Link Here
916
#         suit the MARC21 version, so for now the "templating"
917
#         suit the MARC21 version, so for now the "templating"
917
#         feature will be enabled only for UNIMARC for backwards
918
#         feature will be enabled only for UNIMARC for backwards
918
#         compatibility.
919
#         compatibility.
919
    if ($summary{summary} and C4::Context->preference('marcflavour') eq 'UNIMARC') {
920
    if ($summary_template and C4::Context->preference('marcflavour') eq 'UNIMARC') {
920
        my @fields = $record->fields();
921
        my @fields = $record->fields();
921
#             $reported_tag = '$9'.$result[$counter];
922
#             $reported_tag = '$9'.$result[$counter];
922
        my @stringssummary;
923
        my @repets;
923
        foreach my $field (@fields) {
924
        foreach my $field (@fields) {
924
            my $tag = $field->tag();
925
            my $tag = $field->tag();
925
            my $tagvalue = $field->as_string();
926
            my $tagvalue = $field->as_string();
926
            my $localsummary= $summary{summary};
927
            my $localsummary= $summary_template;
927
            $localsummary =~ s/\[(.?.?.?.?)$tag\*(.*?)\]/$1$tagvalue$2\[$1$tag$2\]/g;
928
            $localsummary =~ s/\[(.?.?.?.?)$tag\*(.*?)\]/$1$tagvalue$2\[$1$tag$2\]/g;
928
            if ($tag<10) {
929
            if ($tag<10) {
929
                if ($tag eq '001') {
930
                if ($tag eq '001') {
Lines 938-950 sub BuildSummary { Link Here
938
                    $localsummary =~ s/\[(.?.?.?.?)$tagsubf(.*?)\]/$1$subfieldvalue$2\[$1$tagsubf$2\]/g;
939
                    $localsummary =~ s/\[(.?.?.?.?)$tagsubf(.*?)\]/$1$subfieldvalue$2\[$1$tagsubf$2\]/g;
939
                }
940
                }
940
            }
941
            }
941
            push @stringssummary, $localsummary if ($localsummary ne $summary{summary});
942
            if ($localsummary ne $summary_template) {
943
                $localsummary =~ s/\[(.*?)\]//g;
944
                $localsummary =~ s/\n/<br>/g;
945
                push @repets, $localsummary;
946
            }
942
        }
947
        }
943
        my $resultstring;
948
        $summary{repets} = \@repets;
944
        $resultstring = join(" -- ",@stringssummary);
945
        $resultstring =~ s/\[(.*?)\]//g;
946
        $resultstring =~ s/\n/<br>/g;
947
        $summary{summary}      =  $resultstring;
948
    }
949
    }
949
    my @authorized;
950
    my @authorized;
950
    my @notes;
951
    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 32-49 Link Here
32
    [% END %]
32
    [% END %]
33
[% END %]
33
[% END %]
34
[% BLOCK authresult %]
34
[% BLOCK authresult %]
35
    [% IF ( summary.summary ) %][% summary.summary | html %]:[% END %]
35
    <div class="authres_repet">
36
      [% FOREACH repet IN summary.repets %]
37
        <span>[% repet | html %]</span>
38
        [% UNLESS loop.last %] | [% END %]
39
      [% END %]
40
    </div>
36
    [% UNLESS ( summary.summaryonly ) %]
41
    [% UNLESS ( summary.summaryonly ) %]
37
        <div class="authorizedheading">
42
        <div class="authorizedheading">
38
          [% FOREACH authorize IN summary.authorized %]
43
          [% FOREACH authorize IN summary.authorized %]
39
            <span class="authorizedheading">[% authorize.heading | html %]</span>
44
            <span class="authorizedheading">[% authorize.heading | html %]</span>
45
            [% UNLESS loop.last %] | [% END %]
40
          [% END %]
46
          [% END %]
41
        </div>
47
        </div>
42
        [% IF ( marcflavour == 'UNIMARC' ) %]
48
        [% IF ( marcflavour == 'UNIMARC' ) %]
43
            [% IF summary.notes %]
49
            [% IF summary.notes %]
44
             <div class="authres_notes">
50
             <div class="authres_notes">
45
             [% FOREACH note IN summary.notes %]
51
             [% FOREACH note IN summary.notes %]
46
               [% note.note | html %]</span>
52
               <span>[% note.note | html %]</span>
47
             [% END %]
53
             [% END %]
48
             </div>
54
             </div>
49
            [% END %]
55
            [% END %]
50
- 

Return to bug 7442