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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-idref.tt (-3 / +5 lines)
Lines 27-35 Link Here
27
          <div class="docs">
27
          <div class="docs">
28
            <table>
28
            <table>
29
              <thead>
29
              <thead>
30
                <th>Citation</th>
30
                <tr>
31
                <th>Koha</th>
31
                  <th>Citation</th>
32
                <th>Sudoc</th>
32
                  <th>Koha</th>
33
                  <th>Sudoc</th>
34
                </tr>
33
              </thead>
35
              </thead>
34
              <tbody>
36
              <tbody>
35
                [% FOREACH doc IN role.docs %]
37
                [% FOREACH doc IN role.docs %]
(-)a/opac/opac-idref.pl (-26 / +17 lines)
Lines 42-47 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
42
42
43
my $ua = LWP::UserAgent->new;
43
my $ua = LWP::UserAgent->new;
44
44
45
# See http://documentation.abes.fr/aideidrefdeveloppeur/index.html#MicroWebBiblio
45
my $base = 'http://www.idref.fr/services/biblio/';
46
my $base = 'http://www.idref.fr/services/biblio/';
46
my $unimarc3 = $cgi->param('unimarc3');
47
my $unimarc3 = $cgi->param('unimarc3');
47
48
Lines 60-95 if ( not $response->is_success) { Link Here
60
my $content = Encode::decode("utf8", $response->content);
61
my $content = Encode::decode("utf8", $response->content);
61
my $json = from_json( $content );
62
my $json = from_json( $content );
62
my $r;
63
my $r;
63
my $role_name;
64
my @unimarc3;
64
my @unimarc3;
65
my @results = ref $json->{sudoc}{result} eq "ARRAY"
65
my @results = ref $json->{sudoc}{result} eq "ARRAY"
66
            ? @{ $json->{sudoc}{result} }
66
            ? @{ $json->{sudoc}{result} }
67
            : ($json->{sudoc}{result});
67
            : ($json->{sudoc}{result});
68
68
69
for my $role_node ( @results ) {
69
for my $result (@results) {
70
    while ( my ( $k, $v ) = each %$role_node ) {
70
    my $role_node = $result->{'role'};
71
        next unless $k eq "role";
71
    my @roles =
72
        my $role_name;
72
      ref $role_node eq "ARRAY"
73
        my $count = 0;
73
      ? @$role_node
74
        my $role_data = {};
74
      : ($role_node);
75
        my @nodes = ref $v eq "ARRAY"
75
    for my $role (@roles) {
76
                    ? @$v
76
        my @docs = ref $role->{doc} eq "ARRAY"
77
                    : ($v);
77
            ? @{ $role->{doc} }
78
        for my $node ( @nodes ) {
78
            : $role->{doc};
79
            while ( ( $k, $v ) = each %$node ) {
79
        push @$r,
80
                if ( $k eq 'roleName' ) {
80
          {
81
                    $role_name = $v;
81
            role_name => $role->{roleName},
82
                    $role_data->{role_name} = $role_name;
82
            count     => $role->{count},
83
                }
83
            docs      => \@docs,
84
                elsif ( $k eq 'count' ) {
84
          };
85
                    $role_data->{count} = $v;
86
                }
87
                elsif ( $k eq 'doc' ) {
88
                    push @{ $role_data->{docs} }, $v;
89
                }
90
            }
91
        }
92
        push @$r, $role_data;
93
    }
85
    }
94
}
86
}
95
87
96
- 

Return to bug 19640