Lines 34-39
use C4::Items qw( AddItemFromMarc ModItemFromMarc );
Link Here
|
34 |
use C4::Charset qw( MarcToUTF8Record SetUTF8Flag StripNonXmlChars ); |
34 |
use C4::Charset qw( MarcToUTF8Record SetUTF8Flag StripNonXmlChars ); |
35 |
use C4::AuthoritiesMarc qw( AddAuthority GuessAuthTypeCode GetAuthorityXML ModAuthority DelAuthority GetAuthorizedHeading ); |
35 |
use C4::AuthoritiesMarc qw( AddAuthority GuessAuthTypeCode GetAuthorityXML ModAuthority DelAuthority GetAuthorizedHeading ); |
36 |
use C4::MarcModificationTemplates qw( ModifyRecordWithTemplate ); |
36 |
use C4::MarcModificationTemplates qw( ModifyRecordWithTemplate ); |
|
|
37 |
use Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue; |
37 |
use Koha::Items; |
38 |
use Koha::Items; |
38 |
use Koha::SearchEngine; |
39 |
use Koha::SearchEngine; |
39 |
use Koha::SearchEngine::Indexer; |
40 |
use Koha::SearchEngine::Indexer; |
Lines 568-573
sub BatchCommitRecords {
Link Here
|
568 |
|
569 |
|
569 |
my $rec_num = 0; |
570 |
my $rec_num = 0; |
570 |
my @biblio_ids; |
571 |
my @biblio_ids; |
|
|
572 |
my @updated_ids; |
571 |
while (my $rowref = $sth->fetchrow_hashref) { |
573 |
while (my $rowref = $sth->fetchrow_hashref) { |
572 |
$record_type = $rowref->{'record_type'}; |
574 |
$record_type = $rowref->{'record_type'}; |
573 |
|
575 |
|
Lines 662-671
sub BatchCommitRecords {
Link Here
|
662 |
$overlay_framework // $oldbiblio->frameworkcode, |
664 |
$overlay_framework // $oldbiblio->frameworkcode, |
663 |
{ |
665 |
{ |
664 |
overlay_context => $context, |
666 |
overlay_context => $context, |
665 |
skip_record_index => 1 |
667 |
skip_record_index => 1, |
|
|
668 |
skip_holds_queue => 1, |
666 |
} |
669 |
} |
667 |
); |
670 |
); |
668 |
push @biblio_ids, $recordid; |
671 |
push @biblio_ids, $recordid; |
|
|
672 |
push @updated_ids, $recordid; |
669 |
$query = "UPDATE import_biblios SET matched_biblionumber = ? WHERE import_record_id = ?"; # FIXME call SetMatchedBiblionumber instead |
673 |
$query = "UPDATE import_biblios SET matched_biblionumber = ? WHERE import_record_id = ?"; # FIXME call SetMatchedBiblionumber instead |
670 |
|
674 |
|
671 |
if ($item_result eq 'create_new' || $item_result eq 'replace') { |
675 |
if ($item_result eq 'create_new' || $item_result eq 'replace') { |
Lines 717-726
sub BatchCommitRecords {
Link Here
|
717 |
# final commit should be before Elastic background indexing in order to find job data |
721 |
# final commit should be before Elastic background indexing in order to find job data |
718 |
$schema->txn_commit; |
722 |
$schema->txn_commit; |
719 |
|
723 |
|
720 |
if ( @biblio_ids ) { |
724 |
if (@biblio_ids) { |
721 |
my $indexer = Koha::SearchEngine::Indexer->new({ index => $Koha::SearchEngine::BIBLIOS_INDEX }); |
725 |
my $indexer = Koha::SearchEngine::Indexer->new( { index => $Koha::SearchEngine::BIBLIOS_INDEX } ); |
722 |
$indexer->index_records( \@biblio_ids, "specialUpdate", "biblioserver" ); |
726 |
$indexer->index_records( \@biblio_ids, "specialUpdate", "biblioserver" ); |
723 |
} |
727 |
} |
|
|
728 |
Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue( { biblio_ids => \@updated_ids } ) |
729 |
if ( @updated_ids && C4::Context->preference('RealTimeHoldsQueue') ); |
724 |
|
730 |
|
725 |
return ($num_added, $num_updated, $num_items_added, $num_items_replaced, $num_items_errored, $num_ignored); |
731 |
return ($num_added, $num_updated, $num_items_added, $num_items_replaced, $num_items_errored, $num_ignored); |
726 |
} |
732 |
} |
727 |
- |
|
|