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

(-)a/C4/AuthoritiesMarc.pm (-1 / +30 lines)
Lines 63-68 BEGIN { Link Here
63
    	&FindDuplicateAuthority
63
    	&FindDuplicateAuthority
64
64
65
        &GuessAuthTypeCode
65
        &GuessAuthTypeCode
66
        &RetrieveAuthTypeFromAuthority008
66
        &GuessAuthId
67
        &GuessAuthId
67
 	);
68
 	);
68
}
69
}
Lines 331-337 Get the record and tries to guess the adequate authtypecode from its content. Link Here
331
sub GuessAuthTypeCode {
332
sub GuessAuthTypeCode {
332
    my ($record, $heading_fields) = @_;
333
    my ($record, $heading_fields) = @_;
333
    return unless defined $record;
334
    return unless defined $record;
334
    return '' if C4::Preferences('UseAuthority008AsAuthType');
335
    return '' if C4::Context->preference('UseAuthority008AsAuthType');
335
    $heading_fields //= {
336
    $heading_fields //= {
336
    "MARC21"=>{
337
    "MARC21"=>{
337
        '100'=>{authtypecode=>'PERSO_NAME'},
338
        '100'=>{authtypecode=>'PERSO_NAME'},
Lines 396-401 sub GuessAuthTypeCode { Link Here
396
    return;
397
    return;
397
}
398
}
398
399
400
=head2 RetrieveAuthTypeFromAuthority008
401
402
   my $type = RetrieveAuthTypeFromAuthority008
403
404
If the UseAuthority008AsAuthType syspref is enabled then retrieve the multiple authority types from the authority 008 positions 14-16
405
406
=cut
407
408
sub RetrieveAuthTypeFromAuthority008 {
409
410
    my ($record) = @_;
411
    return unless ($record && $record->field('008'));
412
413
    my $name = 0;
414
    my $subject= 0;
415
    my $series = 0;
416
    my $pos14 = substr($record->field('008')->data, 14, 1);
417
    my $pos15 = substr($record->field('008')->data, 15, 1);
418
    my $pos16 = substr($record->field('008')->data, 16, 1);
419
420
    $name = 1 if $pos14 eq 'a';
421
    $subject= 1 if $pos15 eq 'a';
422
    $series = 1 if $pos16 eq 'a';
423
424
    my %authtypes = ( 'name' => $name, 'subject' => $subject, 'series' => $series);
425
    return \%authtypes;
426
}
427
399
=head2 GuessAuthId
428
=head2 GuessAuthId
400
429
401
  my $authtid = GuessAuthId($record);
430
  my $authtid = GuessAuthId($record);
(-)a/authorities/detail.pl (-2 / +10 lines)
Lines 45-50 use C4::Output; Link Here
45
use CGI qw ( -utf8 );
45
use CGI qw ( -utf8 );
46
use MARC::Record;
46
use MARC::Record;
47
use C4::Koha;
47
use C4::Koha;
48
use C4::AuthoritiesMarc;
48
use Koha::Authorities;
49
use Koha::Authorities;
49
50
50
use Koha::Authority::Types;
51
use Koha::Authority::Types;
Lines 225-236 my $servers = Koha::Z3950Servers->search( Link Here
225
    },
226
    },
226
);
227
);
227
228
228
my $type = $authority_types->find($authtypecode);
229
my $type;
230
if (C4::Context->preference('UseAuthority008AsAuthType')) {
231
    $type = RetrieveAuthTypeFromAuthority008($record) if $record;
232
    $template->param(authtypetext => $type);
233
} else {
234
    $type = $authority_types->find($authtypecode);
235
    $template->param(authtypetext => $type ? $type->authtypetext: "");
236
}
237
229
$template->param(
238
$template->param(
230
    authid          => $authid,
239
    authid          => $authid,
231
    count           => $count,
240
    count           => $count,
232
    biblio_fields   => $biblio_fields,
241
    biblio_fields   => $biblio_fields,
233
    authtypetext    => $type ? $type->authtypetext: "",
234
    authtypecode    => $authtypecode,
242
    authtypecode    => $authtypecode,
235
    authority_types => $authority_types,
243
    authority_types => $authority_types,
236
    csrf_token      => Koha::Token->new->generate_csrf({ session_id => scalar $query->cookie('CGISESSID') }),
244
    csrf_token      => Koha::Token->new->generate_csrf({ session_id => scalar $query->cookie('CGISESSID') }),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/detail.tt (-2 / +6 lines)
Lines 1-4 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE Koha %]
2
[% USE Asset %]
3
[% USE Asset %]
3
[% SET footerjs = 1 %]
4
[% SET footerjs = 1 %]
4
[% PROCESS 'authorities.inc' %]
5
[% PROCESS 'authorities.inc' %]
Lines 40-46 Link Here
40
[% IF ( unknownauthid ) %]
41
[% IF ( unknownauthid ) %]
41
    <div class="dialog message">The authority record you requested does not exist ([% errauthid | html %]).</div>
42
    <div class="dialog message">The authority record you requested does not exist ([% errauthid | html %]).</div>
42
[% ELSE %]
43
[% ELSE %]
43
<h1>Authority #[% authid | html %] ([% authtypetext | html %])</h1>
44
[% IF Koha.Preference('UseAuthority008AsAuthType') %]
45
<h1>Authority #[% authid | html %] (Available for use as a [% type.name | html %] [% type.subject | html %] [% type.series | html %]) </h1>
46
[% ELSE %]
47
    <h1>Authority #[% authid | html %] ([% authtypetext | html %])</h1>
48
[% END %]
44
49
45
<div id="action">
50
<div id="action">
46
    [% IF count %]
51
    [% IF count %]
47
- 

Return to bug 26079