|
Lines 705-711
sub AddAuthority {
Link Here
|
| 705 |
|
705 |
|
| 706 |
my $heading = $authority->heading_object( { record => $record } ); |
706 |
my $heading = $authority->heading_object( { record => $record } ); |
| 707 |
|
707 |
|
| 708 |
my $origincode = CalculateOriginCode($record, $authtypecode); |
708 |
my $origincode = CalculateOriginCode( $record, $authtypecode ); |
| 709 |
|
709 |
|
| 710 |
# Update |
710 |
# Update |
| 711 |
$authority->update( |
711 |
$authority->update( |
|
Lines 1284-1302
sub GetAuthorizedHeading {
Link Here
|
| 1284 |
=cut |
1284 |
=cut |
| 1285 |
|
1285 |
|
| 1286 |
sub CalculateOriginCode { |
1286 |
sub CalculateOriginCode { |
| 1287 |
my ($record, $authtypecode) = @_; |
1287 |
my ( $record, $authtypecode ) = @_; |
| 1288 |
|
1288 |
|
| 1289 |
my ($tagfield, $tagsubfield) = GetAuthMARCFromKohaField('auth_header.origincode', $authtypecode); |
1289 |
my ( $tagfield, $tagsubfield ) = GetAuthMARCFromKohaField( 'auth_header.origincode', $authtypecode ); |
| 1290 |
if (not(defined($tagfield) && defined($tagsubfield)) || not($record->subfield($tagfield, $tagsubfield))) { |
1290 |
if ( not( defined($tagfield) && defined($tagsubfield) ) || not( $record->subfield( $tagfield, $tagsubfield ) ) ) { |
| 1291 |
if (C4::Context->preference('marcflavour') eq 'MARC21') { |
1291 |
if ( C4::Context->preference('marcflavour') eq 'MARC21' ) { |
| 1292 |
return $record->subfield('040', 'c') || $record->subfield('040', 'a') || $record->subfield('024', '2') || $record->field('003') || ''; |
1292 |
return |
| 1293 |
} |
1293 |
$record->subfield( '040', 'c' ) |
| 1294 |
else { |
1294 |
|| $record->subfield( '040', 'a' ) |
| 1295 |
warn "KohaToMARCMapping for 'auth_header.origincode' not set for '".C4::Context->preference('marcflavour')."' and don't know what fallbacks to use."; |
1295 |
|| $record->subfield( '024', '2' ) |
|
|
1296 |
|| $record->field('003') |
| 1297 |
|| ''; |
| 1298 |
} else { |
| 1299 |
warn "KohaToMARCMapping for 'auth_header.origincode' not set for '" |
| 1300 |
. C4::Context->preference('marcflavour') |
| 1301 |
. "' and don't know what fallbacks to use."; |
| 1296 |
return ''; |
1302 |
return ''; |
| 1297 |
} |
1303 |
} |
| 1298 |
} |
1304 |
} |
| 1299 |
return $record->subfield($tagfield, $tagsubfield); |
1305 |
return $record->subfield( $tagfield, $tagsubfield ); |
| 1300 |
} |
1306 |
} |
| 1301 |
|
1307 |
|
| 1302 |
=head2 CompareFieldWithAuthority |
1308 |
=head2 CompareFieldWithAuthority |