Lines 603-609
sub BatchCommitRecords {
Link Here
|
603 |
my $marc_record = MARC::Record->new_from_usmarc($rowref->{'marc'}); |
603 |
my $marc_record = MARC::Record->new_from_usmarc($rowref->{'marc'}); |
604 |
|
604 |
|
605 |
if ($record_type eq 'biblio') { |
605 |
if ($record_type eq 'biblio') { |
606 |
# remove any item tags - rely on BatchCommitItems |
606 |
# remove any item tags - rely on _batchCommitItems |
607 |
($item_tag,$item_subfield) = &GetMarcFromKohaField( "items.itemnumber" ); |
607 |
($item_tag,$item_subfield) = &GetMarcFromKohaField( "items.itemnumber" ); |
608 |
foreach my $item_field ($marc_record->field($item_tag)) { |
608 |
foreach my $item_field ($marc_record->field($item_tag)) { |
609 |
$marc_record->delete_field($item_field); |
609 |
$marc_record->delete_field($item_field); |
Lines 624-630
sub BatchCommitRecords {
Link Here
|
624 |
push @biblio_ids, $recordid; |
624 |
push @biblio_ids, $recordid; |
625 |
$query = "UPDATE import_biblios SET matched_biblionumber = ? WHERE import_record_id = ?"; # FIXME call SetMatchedBiblionumber instead |
625 |
$query = "UPDATE import_biblios SET matched_biblionumber = ? WHERE import_record_id = ?"; # FIXME call SetMatchedBiblionumber instead |
626 |
if ($item_result eq 'create_new' || $item_result eq 'replace') { |
626 |
if ($item_result eq 'create_new' || $item_result eq 'replace') { |
627 |
my ($bib_items_added, $bib_items_replaced, $bib_items_errored) = BatchCommitItems($rowref->{'import_record_id'}, $recordid, $item_result); |
627 |
my ($bib_items_added, $bib_items_replaced, $bib_items_errored) = _batchCommitItems($rowref->{'import_record_id'}, $recordid, $item_result); |
628 |
$num_items_added += $bib_items_added; |
628 |
$num_items_added += $bib_items_added; |
629 |
$num_items_replaced += $bib_items_replaced; |
629 |
$num_items_replaced += $bib_items_replaced; |
630 |
$num_items_errored += $bib_items_errored; |
630 |
$num_items_errored += $bib_items_errored; |
Lines 673-679
sub BatchCommitRecords {
Link Here
|
673 |
$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 |
674 |
|
674 |
|
675 |
if ($item_result eq 'create_new' || $item_result eq 'replace') { |
675 |
if ($item_result eq 'create_new' || $item_result eq 'replace') { |
676 |
my ($bib_items_added, $bib_items_replaced, $bib_items_errored) = BatchCommitItems($rowref->{'import_record_id'}, $recordid, $item_result); |
676 |
my ($bib_items_added, $bib_items_replaced, $bib_items_errored) = _batchCommitItems($rowref->{'import_record_id'}, $recordid, $item_result); |
677 |
$num_items_added += $bib_items_added; |
677 |
$num_items_added += $bib_items_added; |
678 |
$num_items_replaced += $bib_items_replaced; |
678 |
$num_items_replaced += $bib_items_replaced; |
679 |
$num_items_errored += $bib_items_errored; |
679 |
$num_items_errored += $bib_items_errored; |
Lines 696-702
sub BatchCommitRecords {
Link Here
|
696 |
$recordid = $record_match; |
696 |
$recordid = $record_match; |
697 |
$num_ignored++; |
697 |
$num_ignored++; |
698 |
if ($record_type eq 'biblio' and defined $recordid and ( $item_result eq 'create_new' || $item_result eq 'replace' ) ) { |
698 |
if ($record_type eq 'biblio' and defined $recordid and ( $item_result eq 'create_new' || $item_result eq 'replace' ) ) { |
699 |
my ($bib_items_added, $bib_items_replaced, $bib_items_errored) = BatchCommitItems($rowref->{'import_record_id'}, $recordid, $item_result); |
699 |
my ($bib_items_added, $bib_items_replaced, $bib_items_errored) = _batchCommitItems($rowref->{'import_record_id'}, $recordid, $item_result); |
700 |
push @biblio_ids, $recordid if $bib_items_added || $bib_items_replaced; |
700 |
push @biblio_ids, $recordid if $bib_items_added || $bib_items_replaced; |
701 |
$num_items_added += $bib_items_added; |
701 |
$num_items_added += $bib_items_added; |
702 |
$num_items_replaced += $bib_items_replaced; |
702 |
$num_items_replaced += $bib_items_replaced; |
Lines 721-734
sub BatchCommitRecords {
Link Here
|
721 |
return ($num_added, $num_updated, $num_items_added, $num_items_replaced, $num_items_errored, $num_ignored); |
721 |
return ($num_added, $num_updated, $num_items_added, $num_items_replaced, $num_items_errored, $num_ignored); |
722 |
} |
722 |
} |
723 |
|
723 |
|
724 |
=head2 BatchCommitItems |
724 |
=head2 _batchCommitItems |
725 |
|
725 |
|
726 |
($num_items_added, $num_items_errored) = |
726 |
($num_items_added, $num_items_errored) = |
727 |
BatchCommitItems($import_record_id, $biblionumber); |
727 |
_batchCommitItems($import_record_id, $biblionumber); |
|
|
728 |
|
729 |
Private function for batch committing item changes. We do not trigger a re-index here, that is left to the caller. |
728 |
|
730 |
|
729 |
=cut |
731 |
=cut |
730 |
|
732 |
|
731 |
sub BatchCommitItems { |
733 |
sub _batchCommitItems { |
732 |
my ( $import_record_id, $biblionumber, $action ) = @_; |
734 |
my ( $import_record_id, $biblionumber, $action ) = @_; |
733 |
|
735 |
|
734 |
my $dbh = C4::Context->dbh; |
736 |
my $dbh = C4::Context->dbh; |