Lines 401-420
sub ModBiblio {
Link Here
|
401 |
return 0; |
401 |
return 0; |
402 |
} |
402 |
} |
403 |
|
403 |
|
404 |
if ( C4::Context->preference("CataloguingLog") ) { |
|
|
405 |
my $biblio = Koha::Biblios->find($biblionumber); |
406 |
my $record; |
407 |
my $decoding_error = ""; |
408 |
eval { $record = $biblio->metadata->record }; |
409 |
if ($@) { |
410 |
my $exception = $@; |
411 |
$exception->rethrow unless ( $exception->isa('Koha::Exceptions::Metadata::Invalid') ); |
412 |
$decoding_error = "There was an error with this bibliographic record: " . $exception; |
413 |
$record = $biblio->metadata->record_strip_nonxml; |
414 |
} |
415 |
logaction( "CATALOGUING", "MODIFY", $biblionumber, "biblio $decoding_error BEFORE=>" . $record->as_formatted ); |
416 |
} |
417 |
|
418 |
if ( !$options->{disable_autolink} && C4::Context->preference('AutoLinkBiblios') ) { |
404 |
if ( !$options->{disable_autolink} && C4::Context->preference('AutoLinkBiblios') ) { |
419 |
BiblioAutoLink( $record, $frameworkcode ); |
405 |
BiblioAutoLink( $record, $frameworkcode ); |
420 |
} |
406 |
} |
Lines 465-491
sub ModBiblio {
Link Here
|
465 |
# update MARC subfield that stores biblioitems.cn_sort |
451 |
# update MARC subfield that stores biblioitems.cn_sort |
466 |
_koha_marc_update_biblioitem_cn_sort( $record, $oldbiblio, $frameworkcode ); |
452 |
_koha_marc_update_biblioitem_cn_sort( $record, $oldbiblio, $frameworkcode ); |
467 |
|
453 |
|
468 |
# update the MARC record (that now contains biblio and items) with the new record data |
454 |
my $schema = Koha::Database->schema; |
469 |
ModBiblioMarc( $record, $biblionumber, $mod_biblio_marc_options ); |
455 |
my $result = 0; |
|
|
456 |
$schema->txn_do( |
457 |
sub { |
470 |
|
458 |
|
471 |
# modify the other koha tables |
459 |
my $biblio = Koha::Biblios->find($biblionumber); |
472 |
_koha_modify_biblio( $dbh, $oldbiblio, $frameworkcode ); |
460 |
my $orig_rec; |
473 |
_koha_modify_biblioitem_nonmarc( $dbh, $oldbiblio ); |
461 |
my $decoding_error = ""; |
|
|
462 |
eval { $orig_rec = $biblio->metadata->record }; |
463 |
if ($@) { |
464 |
my $exception = $@; |
465 |
$exception->rethrow unless ( $exception->isa('Koha::Exceptions::Metadata::Invalid') ); |
466 |
$decoding_error = "There was an error with this bibliographic record: " . $exception; |
467 |
$orig_rec = $biblio->metadata->record_strip_nonxml; |
468 |
} |
469 |
if ( $orig_rec->field('005')->as_string eq $record->field('005')->as_string ) { |
474 |
|
470 |
|
475 |
_after_biblio_action_hooks({ action => 'modify', biblio_id => $biblionumber }); |
471 |
if ( C4::Context->preference("CataloguingLog") ) { |
|
|
472 |
logaction( |
473 |
"CATALOGUING", "MODIFY", $biblionumber, |
474 |
"biblio $decoding_error BEFORE=>" . $orig_rec->as_formatted |
475 |
); |
476 |
} |
476 |
|
477 |
|
477 |
# update OAI-PMH sets |
478 |
# update the MARC record (that now contains biblio and items) with the new record data |
478 |
if(C4::Context->preference("OAI-PMH:AutoUpdateSets")) { |
479 |
ModBiblioMarc( $record, $biblionumber, $mod_biblio_marc_options ); |
479 |
C4::OAI::Sets::UpdateOAISetsBiblio($biblionumber, $record); |
|
|
480 |
} |
481 |
|
480 |
|
482 |
Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue( |
481 |
# modify the other koha tables |
483 |
{ |
482 |
_koha_modify_biblio( $dbh, $oldbiblio, $frameworkcode ); |
484 |
biblio_ids => [ $biblionumber ] |
483 |
_koha_modify_biblioitem_nonmarc( $dbh, $oldbiblio ); |
|
|
484 |
|
485 |
_after_biblio_action_hooks( { action => 'modify', biblio_id => $biblionumber } ); |
486 |
|
487 |
# update OAI-PMH sets |
488 |
if ( C4::Context->preference("OAI-PMH:AutoUpdateSets") ) { |
489 |
C4::OAI::Sets::UpdateOAISetsBiblio( $biblionumber, $record ); |
490 |
} |
491 |
|
492 |
Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue( { biblio_ids => [$biblionumber] } ) |
493 |
unless $options->{skip_holds_queue} |
494 |
or !C4::Context->preference('RealTimeHoldsQueue'); |
495 |
|
496 |
$result = 1; |
497 |
|
498 |
} else { |
499 |
$result = -1; |
500 |
} |
485 |
} |
501 |
} |
486 |
) unless $options->{skip_holds_queue} or !C4::Context->preference('RealTimeHoldsQueue'); |
502 |
); |
487 |
|
503 |
|
488 |
return 1; |
504 |
return $result; |
489 |
} |
505 |
} |
490 |
|
506 |
|
491 |
=head2 _strip_item_fields |
507 |
=head2 _strip_item_fields |