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

(-)a/C4/Biblio.pm (+6 lines)
Lines 1917-1925 sub GetMarcAuthors { Link Here
1917
        }
1917
        }
1918
1918
1919
        # other subfields
1919
        # other subfields
1920
        my $unimarc3;
1920
        for my $authors_subfield (@subfields) {
1921
        for my $authors_subfield (@subfields) {
1921
            next if ( $authors_subfield->[0] eq '9' );
1922
            next if ( $authors_subfield->[0] eq '9' );
1922
1923
1924
            # unimarc3 contains the $3 of the author for UNIMARC.
1925
            # For french academic libraries, it's the "ppn", and it's required for idref webservice
1926
            $unimarc3 = $authors_subfield->[1] if $marcflavour eq 'UNIMARC' and $authors_subfield->[0] =~ /3/;
1927
1923
            # don't load unimarc subfields 3, 5
1928
            # don't load unimarc subfields 3, 5
1924
            next if ( $marcflavour eq 'UNIMARC' and ( $authors_subfield->[0] =~ /3|5/ ) );
1929
            next if ( $marcflavour eq 'UNIMARC' and ( $authors_subfield->[0] =~ /3|5/ ) );
1925
1930
Lines 1955-1960 sub GetMarcAuthors { Link Here
1955
        push @marcauthors, {
1960
        push @marcauthors, {
1956
            MARCAUTHOR_SUBFIELDS_LOOP => \@subfields_loop,
1961
            MARCAUTHOR_SUBFIELDS_LOOP => \@subfields_loop,
1957
            authoritylink => $subfield9,
1962
            authoritylink => $subfield9,
1963
            unimarc3 => $unimarc3
1958
        };
1964
        };
1959
    }
1965
    }
1960
    return \@marcauthors;
1966
    return \@marcauthors;
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt (+4 lines)
Lines 25-30 Link Here
25
[% IF ( OpacStarRatings != 'disable' ) %]
25
[% IF ( OpacStarRatings != 'disable' ) %]
26
    [% BLOCK cssinclude %]<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/jquery.rating.css" />[% END %]
26
    [% BLOCK cssinclude %]<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/jquery.rating.css" />[% END %]
27
[% END %]
27
[% END %]
28
[% INCLUDE greybox.inc %]
28
</head>
29
</head>
29
<body id="opac-detail" class="scrollto">
30
<body id="opac-detail" class="scrollto">
30
[% INCLUDE 'masthead.inc' %]
31
[% INCLUDE 'masthead.inc' %]
Lines 160-165 Link Here
160
                                    [% IF (MARCAUTHOR.authoritylink) %]
161
                                    [% IF (MARCAUTHOR.authoritylink) %]
161
                                        <a class='authlink' href="/cgi-bin/koha/opac-authoritiesdetail.pl?authid=[% MARCAUTHOR.authoritylink %]"><img style="vertical-align:middle" height="15" width="15" src="[% interface %]/[% theme %]/images/filefind.png"></a>
162
                                        <a class='authlink' href="/cgi-bin/koha/opac-authoritiesdetail.pl?authid=[% MARCAUTHOR.authoritylink %]"><img style="vertical-align:middle" height="15" width="15" src="[% interface %]/[% theme %]/images/filefind.png"></a>
162
                                    [% END %]
163
                                    [% END %]
164
                                    [% IF IDREF and MARCAUTHOR.unimarc3 %]
165
                                        <a href="/cgi-bin/koha/opac-idref.pl?unimarc3=[% MARCAUTHOR.unimarc3 %]" title="IdRef" rel="gb_page_center[600,500]">IdRef</a>
166
                                    [% END %]
163
                                    [% UNLESS ( loop.last ) %]|[% END %]
167
                                    [% UNLESS ( loop.last ) %]|[% END %]
164
                                [% END # /FOREACH MARCAUTHORS %]
168
                                [% END # /FOREACH MARCAUTHORS %]
165
                            </div>
169
                            </div>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-idref.tt (+74 lines)
Line 0 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo; Your search IDREF for ppn [% unimarc3 %]</title>
3
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4
[% INCLUDE 'doc-head-close.inc' %]
5
[% BLOCK cssinclude %]
6
  <style type="text/css">
7
    ul.ui-tabs-nav li a, ul.ui-tabs-nav li span.a  { padding:0.6em 1em; }
8
    #idref h2.role {
9
        background-color: #DDDEEE;
10
        cursor: pointer;
11
    }
12
    #idref table {
13
        margin: 0;
14
    }
15
  </style>
16
[% END %]
17
18
</head>
19
<body>
20
<div id="idref">
21
  [% IF error %]
22
    This ppn is not found on the idref service.
23
  [% ELSE %]
24
    [% FOREACH role IN content %]
25
      <div>
26
        <h2 class="role" title="Click to expand this role">[% role.role_name %] ([% role.count %])</h2>
27
          <div class="docs">
28
            <table>
29
              <thead>
30
                <th>Citation</th>
31
                <th>Koha</th>
32
                <th>Sudoc</th>
33
              </thead>
34
              <tbody>
35
                [% FOREACH doc IN role.docs %]
36
                  <tr>
37
                    <td>[% doc.citation %]</td>
38
                    <td><a href="/cgi-bin/koha/opac-search.pl?q=ident:[% doc.ppn %]" target="_blank">Koha</a></td>
39
                    <td><a href="http://www.sudoc.fr/[% doc.ppn %]" target="_blank">Sudoc</a></td>
40
                  </tr>
41
                [% END %]
42
              </tbody>
43
            </table>
44
          </div>
45
      </div>
46
    [% END %]
47
  [% END %]
48
</div>
49
[% BLOCK jsinclude %]
50
[% INCLUDE 'datatables.inc' %]
51
<script type="text/javascript">
52
  $(document).ready(function (){
53
      $("table").dataTable($.extend(true, {}, dataTablesDefaults, {
54
          'bFilter': false,
55
          'aoColumnDefs': [
56
              { 'aTargets': [-1, -2], 'bSortable': false }
57
          ],
58
      }));
59
60
      $(".role").click(function(){
61
          var docs_node = $(this).parent().find("div.docs");
62
          if ( $(docs_node).is(":visible") ) {
63
              $(".docs").hide();
64
          } else {
65
              $(".docs").hide();
66
              docs_node.show();
67
          }
68
      });
69
      $(".docs").hide();
70
  });
71
</script>
72
[% END %]
73
74
[% INCLUDE 'opac-bottom.inc' is_popup=1%]
(-)a/opac/opac-detail.pl (+13 lines)
Lines 1031-1036 if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){ Link Here
1031
    $template->param('OPACSearchForTitleIn' => $search_for_title);
1031
    $template->param('OPACSearchForTitleIn' => $search_for_title);
1032
}
1032
}
1033
1033
1034
#IDREF
1035
if ( C4::Context->preference("IDREF") ) {
1036
    # If the record comes from the SUDOC
1037
    if ( $record->field('009') ) {
1038
        my $unimarc3 = $record->field("009")->data;
1039
        if ( $unimarc3 =~ /^\d+$/ ) {
1040
            $template->param(
1041
                IDREF => 1,
1042
            );
1043
        }
1044
    }
1045
}
1046
1034
# We try to select the best default tab to show, according to what
1047
# We try to select the best default tab to show, according to what
1035
# the user wants, and what's available for display
1048
# the user wants, and what's available for display
1036
my $opac_serial_default = C4::Context->preference('opacSerialDefaultTab');
1049
my $opac_serial_default = C4::Context->preference('opacSerialDefaultTab');
(-)a/opac/opac-idref.pl (-1 / +102 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
# This file is part of Koha.
4
#
5
# Copyright (C) 2014 BibLibre
6
#
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# Koha is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
20
use Modern::Perl;
21
22
use CGI;
23
use LWP::UserAgent;
24
use HTTP::Request::Common;
25
use JSON;
26
use Encode;
27
28
use C4::Auth;
29
use C4::Context;
30
use C4::Search;
31
use C4::Output;
32
33
my $cgi = new CGI;
34
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
35
    {
36
        template_name   => "opac-idref.tt",
37
        query           => $cgi,
38
        type            => "opac",
39
        authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ),
40
        flagsrequired   => { borrow => 1 },
41
    }
42
);
43
44
my $ua = LWP::UserAgent->new;
45
46
my $base = 'http://www.idref.fr/services/biblio/';
47
my $unimarc3 = $cgi->param('unimarc3');
48
49
my $request = HTTP::Request->new(
50
    'GET',
51
    $base . $unimarc3 . ".json",
52
);
53
$request->protocol('HTTP/1.1');
54
my $response = $ua->request($request);
55
if ( not $response->is_success) {
56
    $template->param(error => $base.$unimarc3.'.json');
57
    output_html_with_http_headers $cgi, $cookie, $template->output;
58
    exit;
59
}
60
61
my $content = Encode::decode("utf8", $response->content);
62
my $json = from_json( $content );
63
my $r;
64
my $role_name;
65
my @unimarc3;
66
my @results = ref $json->{sudoc}{result} eq "ARRAY"
67
            ? @{ $json->{sudoc}{result} }
68
            : ($json->{sudoc}{result});
69
70
for my $role_node ( @results ) {
71
    while ( my ( $k, $v ) = each %$role_node ) {
72
        next unless $k eq "role";
73
        my $role_name;
74
        my $count = 0;
75
        my $role_data = {};
76
        my @nodes = ref $v eq "ARRAY"
77
                    ? @$v
78
                    : ($v);
79
        for my $node ( @nodes ) {
80
            while ( ( $k, $v ) = each %$node ) {
81
                if ( $k eq 'roleName' ) {
82
                    $role_name = $v;
83
                    $role_data->{role_name} = $role_name;
84
                }
85
                elsif ( $k eq 'count' ) {
86
                    $role_data->{count} = $v;
87
                }
88
                elsif ( $k eq 'doc' ) {
89
                    push @{ $role_data->{docs} }, $v;
90
                }
91
            }
92
        }
93
        push @$r, $role_data;
94
    }
95
}
96
97
$template->param(
98
    content => $r,
99
    unimarc3 => $unimarc3,
100
);
101
102
output_html_with_http_headers $cgi, $cookie, $template->output;

Return to bug 8992