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

(-)a/Koha/Authority.pm (-1 / +107 lines)
Lines 122-128 Return a list of identifiers of the authors which are in 024$2$a Link Here
122
=cut
122
=cut
123
123
124
sub get_identifiers {
124
sub get_identifiers {
125
    my ( $self, $params ) = @_;
125
    my ( $self ) = @_;
126
126
127
    my $record = $self->record;
127
    my $record = $self->record;
128
128
Lines 137-142 sub get_identifiers { Link Here
137
    return \@identifiers;
137
    return \@identifiers;
138
}
138
}
139
139
140
=head3 get_information
141
142
    my $information = $author->get_information;
143
144
Return a list of information of the authors (syspref OPACAuthorInformation)
145
146
=cut
147
148
sub get_information {
149
    my ($self) = @_;
150
151
    my $record = $self->record;
152
153
    # FIXME UNIMARC not supported yet.
154
    return if C4::Context->preference('marcflavour') eq 'UNIMARC';
155
156
    my $information;
157
    for my $info ( split ',', C4::Context->preference('OPACAuthorInformation') ) {
158
        if ( $info eq 'activity' ) {
159
160
            # activity: Activity (372$a$s$t)
161
            for my $field ( $record->field('372') ) {
162
                my $sf_a = $field->subfield('a');
163
                my $sf_s = $field->subfield('s');
164
                my $sf_t = $field->subfield('t');
165
                push @{ $information->{activity} },
166
                    { field_of_activity => $sf_a, start_period => $sf_s, end_period => $sf_t, };
167
            }
168
        } elsif ( $info eq 'address' ) {
169
170
            # address: Address (371$a$b$d$e)
171
            for my $field ( $record->field('371') ) {
172
                my $sf_a = $field->subfield('a');
173
                my $sf_b = $field->subfield('b');
174
                my $sf_d = $field->subfield('d');
175
                my $sf_e = $field->subfield('e');
176
                push @{ $information->{address} },
177
                    { address => $sf_a, city => $sf_b, country => $sf_d, postal_code => $sf_e, };
178
            }
179
        } elsif ( $info eq 'associated_group' ) {
180
181
            # associated_group: Associated group (373$a$s$t$u$v$0)
182
            for my $field ( $record->field('373') ) {
183
                my $sf_a = $field->subfield('a');
184
                my $sf_s = $field->subfield('s');
185
                my $sf_t = $field->subfield('t');
186
                my $sf_u = $field->subfield('u');
187
                my $sf_v = $field->subfield('v');
188
                my $sf_0 = $field->subfield('0');
189
                push @{ $information->{associated_group} },
190
                    {
191
                    associated_group      => $sf_a, start_period            => $sf_s, end_period => $sf_t, uri => $sf_u,
192
                    source_of_information => $sf_v, authority_record_number => $sf_0,
193
                    };
194
            }
195
        } elsif ( $info eq 'email_address' ) {
196
197
            # email_address: Electronic mail address (371$m)
198
            for my $field ( $record->field('371') ) {
199
                my $sf_m = $field->subfield('m');
200
                push @{ $information->{email_address} }, { email_address => $sf_m, };
201
            }
202
        } elsif ( $info eq 'occupation' ) {
203
204
            # occupation: Occupation (374$a$s$t$u$v$0)
205
            for my $field ( $record->field('374') ) {
206
                my $sf_a = $field->subfield('a');
207
                my $sf_s = $field->subfield('s');
208
                my $sf_t = $field->subfield('t');
209
                my $sf_u = $field->subfield('u');
210
                my $sf_v = $field->subfield('v');
211
                my $sf_0 = $field->subfield('0');
212
                push @{ $information->{occupation} },
213
                    {
214
                    occupation            => $sf_a, start_period            => $sf_s, end_period => $sf_t, uri => $sf_u,
215
                    source_of_information => $sf_v, authority_record_number => $sf_0,
216
                    };
217
            }
218
        } elsif ( $info eq 'place_of_birth' ) {
219
220
            # place_of_birth: Place of birth (370$a)
221
            for my $field ( $record->field('370') ) {
222
                my $sf_a = $field->subfield('a');
223
                push @{ $information->{place_of_birth} }, { place_of_birth => $sf_a, };
224
            }
225
        } elsif ( $info eq 'place_of_death' ) {
226
227
            # place_of_death: Place of death (370$b)
228
            for my $field ( $record->field('370') ) {
229
                my $sf_a = $field->subfield('a');
230
                push @{ $information->{place_of_death} }, { place_of_death => $sf_a, };
231
            }
232
        } elsif ( $info eq 'uri' ) {
233
234
            # uri: URI (371$u)
235
            for my $field ( $record->field('371') ) {
236
                my $sf_u = $field->subfield('u');
237
                push @{ $information->{uri} }, { uri => $sf_u, };
238
            }
239
        }
240
    }
241
242
    return $information;
243
}
244
245
140
=head3 record
246
=head3 record
141
247
142
    my $record = $authority->record()
248
    my $record = $authority->record()
(-)a/installer/data/mysql/atomicupdate/bug_29948.pl (+16 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number => "29948",
5
    description => "Display author information for researchers",
6
    up => sub {
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
        $dbh->do(q{
10
            INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
11
            ('OPACAuthorInformation','0','','Display author information on the OPAC detail page','multiple_sortable')
12
        });
13
14
        say $out "Added new system preference 'OPACAuthorInformation'";
15
    },
16
};
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (+12 lines)
Lines 533-538 OPAC: Link Here
533
            - "identifiers for authors and contributors to the detail pages in the OPAC."
533
            - "identifiers for authors and contributors to the detail pages in the OPAC."
534
            - "This feature requires authorities with 024$2 and 024$a."
534
            - "This feature requires authorities with 024$2 and 024$a."
535
            - "Valid source codes in $2 are currently: orcid, scopus, loop, rid and viaf."
535
            - "Valid source codes in $2 are currently: orcid, scopus, loop, rid and viaf."
536
        -
537
            - "Display the following information for authors and contributors to the detail pages in the OPAC."
538
            - pref: OPACAuthorInformation
539
              multiple:
540
                activity: Activity (372$a$s$t)
541
                address: Address (371$a$b$d$e)
542
                associated_group: Associated group (373$a$s$t$u$v$0)
543
                email_address: Electronic mail address (371$m)
544
                occupation: Occupation (374$a$s$t$u$v$0)
545
                place_of_birth: Place of birth (370$a)
546
                place_of_death: Place of death (370$b)
547
                uri: URI (371$u)
536
        -
548
        -
537
            - "Calculate the amount a patron has 'saved' by using the library based on replacement prices, and display:"
549
            - "Calculate the amount a patron has 'saved' by using the library based on replacement prices, and display:"
538
            - pref: OPACShowSavings
550
            - pref: OPACShowSavings
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/authority-information.inc (+74 lines)
Line 0 Link Here
1
[% FOREACH info IN information %]
2
    [% SWITCH info_type %]
3
    [% CASE 'activity' %]
4
        <li>
5
            <span>
6
                Field of activity: [% info.field_of_activity | html %]
7
                [% IF info.start_period || info.end_period %]
8
                    (
9
                    [%~ IF info.start_period %]from: [% info.start_period | html %][% END %]
10
                    [% IF info.end_period %]until: [% info.end_period | html %][% END ~%]
11
                    )
12
                [% END %]
13
            </span>
14
        </li>
15
    [% CASE 'address' %]
16
        <li>
17
            <span>Address: [% info.address | html %] [% info.postal_code | html %] [% info.city | html %] [% info.country | html %]</span>
18
        </li>
19
    [% CASE 'associated_group' %]
20
        <li>
21
            <span>
22
                Associated group: [% info.associated_group | html %]
23
                [% IF info.start_period || info.end_period %]
24
                    (
25
                    [%~ IF info.start_period %]from: [% info.start_period | html %][% END %]
26
                    [% IF info.end_period %]until: [% info.end_period | html %][% END ~%]
27
                    )
28
                [% END %]
29
                [% IF info.uri %]<p>URI: [% info.uri | html %]</p>[% END %]
30
                [% IF info.source_of_information %]<p>Source of information: [% info.source_of_information | html %]</p> [% END %]
31
                [% IF info.authority_record_number %]<p>Authority record control number or standard number: [% info.authority_record_number | html %]</p>[% END %]
32
            </span>
33
        </li>
34
    [% CASE 'email_address' %]
35
        <li>
36
            <span>
37
                Email address: [% info.email_address | html %]
38
            </span>
39
        </li>
40
    [% CASE 'occupation' %]
41
        <li>
42
            <span>
43
                Occupation: [% info.occupation | html %]
44
                [% IF info.start_period || info.end_period %]
45
                    (
46
                    [%~ IF info.start_period %]from: [% info.start_period | html %][% END %]
47
                    [% IF info.end_period %]until: [% info.end_period | html %][% END ~%]
48
                    )
49
                [% END %]
50
                [% IF info.uri %]<p>URI: [% info.uri | html %]</p>[% END %]
51
                [% IF info.source_of_information %]<p>Source of information: [% info.source_of_information | html %]</p> [% END %]
52
                [% IF info.authority_record_number %]<p>Authority record control number or standard number: [% info.authority_record_number | html %]</p>[% END %]
53
            </span>
54
        </li>
55
    [% CASE 'place_of_birth' %]
56
        <li>
57
            <span>
58
                Place of birth: [% info.place_of_birth | html %]
59
            </span>
60
        </li>
61
    [% CASE 'place_of_death' %]
62
        <li>
63
            <span>
64
                Place of death: [% info.place_of_death | html %]
65
            </span>
66
        </li>
67
    [% CASE 'uri' %]
68
        <li>
69
            <span>
70
                URI: [% info.uri | $raw | html %]
71
            </span>
72
        </li>
73
    [% END %]
74
[% END %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt (-6 / +23 lines)
Lines 493-501 Link Here
493
                            [% END %]
493
                            [% END %]
494
                        [% END %]
494
                        [% END %]
495
495
496
                        [% IF Koha.Preference( 'OPACAuthorIdentifiers' ) && author_identifiers.size %]
496
                        [% IF Koha.Preference( 'OPACAuthorIdentifiers' ) && author_identifiers.size || Koha.Preference( 'OPACAuthorInformation' ) && author_information.size %]
497
                            [% WRAPPER tab_item tabname= "author_identifiers" %]
497
                            [% WRAPPER tab_item tabname= "author_identifiers_info" %]
498
                                <span>Author identifiers</span>
498
                                [% IF Koha.Preference( 'OPACAuthorIdentifiers' ) && author_identifiers.size && Koha.Preference( 'OPACAuthorInformation' ) && author_information.size %]
499
                                    <span>Author identifiers/information</span>
500
                                [% ELSIF Koha.Preference( 'OPACAuthorIdentifiers' ) && author_identifiers.size %]
501
                                    <span>Author identifiers</span>
502
                                [% ELSIF Koha.Preference( 'OPACAuthorInformation' ) && author_information.size %]
503
                                    <span>Author information</span>
504
                                [% END %]
499
                            [% END %]
505
                            [% END %]
500
                        [% END %]
506
                        [% END %]
501
507
Lines 941-948 Link Here
941
                            [% END # /tab_panel#images %]
947
                            [% END # /tab_panel#images %]
942
                        [% END # / IF OPACLocalCoverImages && localimages.size %]
948
                        [% END # / IF OPACLocalCoverImages && localimages.size %]
943
949
944
                        [% IF Koha.Preference( 'OPACAuthorIdentifiers' ) && author_identifiers.size %]
950
                        [% IF Koha.Preference( 'OPACAuthorIdentifiers' ) && author_identifiers.size || Koha.Preference( 'OPACAuthorInformation' ) && author_information.size %]
945
                            [% WRAPPER tab_panel tabname="author_identifiers" %]
951
                            [% WRAPPER tab_panel tabname="author_identifiers_info" %]
952
                                [% FOR author IN author_information %]
953
                                    <div class="author_information">
954
                                        <span class="author_name"><a href="/cgi-bin/koha/opac-authoritiesdetail.pl?authid=[% author.authid | uri %]">[% author.name | html %]</a></span>
955
                                        <ul>
956
                                        [% FOR info IN author.information.keys %]
957
                                            [% PROCESS "authority-information.inc" information => author.information.$info, info_type => info %]
958
                                        [% END %]
959
                                        </ul>
960
                                    </div>
961
                                [% END %]
962
946
                                [% FOR author IN author_identifiers %]
963
                                [% FOR author IN author_identifiers %]
947
                                    <div class="author_identifier">
964
                                    <div class="author_identifier">
948
                                        <span class="author_name"><a href="/cgi-bin/koha/opac-authoritiesdetail.pl?authid=[% author.authid | uri %]">[% author.name | html %]</a></span>
965
                                        <span class="author_name"><a href="/cgi-bin/koha/opac-authoritiesdetail.pl?authid=[% author.authid | uri %]">[% author.name | html %]</a></span>
Lines 953-959 Link Here
953
                                        </ul>
970
                                        </ul>
954
                                    </div>
971
                                    </div>
955
                                [% END %]
972
                                [% END %]
956
                            [% END # /tab_panel#author_identifiers %]
973
                            [% END # /tab_panel#author_identifiers_info %]
957
                        [% END %]
974
                        [% END %]
958
975
959
                        [% IF ( NovelistSelectProfile && NovelistSelectView == 'below' && ( normalized_isbn || normalized_upc ) ) %]
976
                        [% IF ( NovelistSelectProfile && NovelistSelectView == 'below' && ( normalized_isbn || normalized_upc ) ) %]
(-)a/opac/opac-detail.pl (-1 / +18 lines)
Lines 1245-1248 if ( C4::Context->preference('OPACAuthorIdentifiers') ) { Link Here
1245
    $template->param( author_identifiers => \@author_identifiers );
1245
    $template->param( author_identifiers => \@author_identifiers );
1246
}
1246
}
1247
1247
1248
if ( C4::Context->preference('OPACAuthorInformation') ) {
1249
    my @author_information;
1250
    for my $author ( @{ $biblio->get_marc_authors } ) {
1251
        my $authid    = $author->{authoritylink};
1252
        my $authority = Koha::Authorities->find($authid);
1253
        next unless $authority;
1254
        my $information = $authority->get_information;
1255
        next unless $information;
1256
        my ($name) =
1257
          map  { $_->{value} }
1258
          grep { $_->{code} eq 'a' ? $_ : () }
1259
          @{ $author->{MARCAUTHOR_SUBFIELDS_LOOP} };
1260
        push @author_information,
1261
          { authid => $authid, name => $name, information => $information };
1262
    }
1263
    $template->param( author_information => \@author_information );
1264
}
1265
1248
output_html_with_http_headers $query, $cookie, $template->output;
1266
output_html_with_http_headers $query, $cookie, $template->output;
1249
- 

Return to bug 29948