Lines 632-638
sub BatchCommitRecords {
Link Here
|
632 |
my $marc_record = MARC::Record->new_from_usmarc($rowref->{'marc'}); |
632 |
my $marc_record = MARC::Record->new_from_usmarc($rowref->{'marc'}); |
633 |
|
633 |
|
634 |
if ($record_type eq 'biblio') { |
634 |
if ($record_type eq 'biblio') { |
635 |
# remove any item tags - rely on BatchCommitItems |
635 |
# remove any item tags - rely on _batchCommitItems |
636 |
($item_tag,$item_subfield) = &GetMarcFromKohaField( "items.itemnumber" ); |
636 |
($item_tag,$item_subfield) = &GetMarcFromKohaField( "items.itemnumber" ); |
637 |
foreach my $item_field ($marc_record->field($item_tag)) { |
637 |
foreach my $item_field ($marc_record->field($item_tag)) { |
638 |
$marc_record->delete_field($item_field); |
638 |
$marc_record->delete_field($item_field); |
Lines 653-659
sub BatchCommitRecords {
Link Here
|
653 |
push @biblio_ids, $recordid; |
653 |
push @biblio_ids, $recordid; |
654 |
$query = "UPDATE import_biblios SET matched_biblionumber = ? WHERE import_record_id = ?"; # FIXME call SetMatchedBiblionumber instead |
654 |
$query = "UPDATE import_biblios SET matched_biblionumber = ? WHERE import_record_id = ?"; # FIXME call SetMatchedBiblionumber instead |
655 |
if ($item_result eq 'create_new' || $item_result eq 'replace') { |
655 |
if ($item_result eq 'create_new' || $item_result eq 'replace') { |
656 |
my ($bib_items_added, $bib_items_replaced, $bib_items_errored) = BatchCommitItems($rowref->{'import_record_id'}, $recordid, $item_result); |
656 |
my ($bib_items_added, $bib_items_replaced, $bib_items_errored) = _batchCommitItems($rowref->{'import_record_id'}, $recordid, $item_result); |
657 |
$num_items_added += $bib_items_added; |
657 |
$num_items_added += $bib_items_added; |
658 |
$num_items_replaced += $bib_items_replaced; |
658 |
$num_items_replaced += $bib_items_replaced; |
659 |
$num_items_errored += $bib_items_errored; |
659 |
$num_items_errored += $bib_items_errored; |
Lines 702-708
sub BatchCommitRecords {
Link Here
|
702 |
$query = "UPDATE import_biblios SET matched_biblionumber = ? WHERE import_record_id = ?"; # FIXME call SetMatchedBiblionumber instead |
702 |
$query = "UPDATE import_biblios SET matched_biblionumber = ? WHERE import_record_id = ?"; # FIXME call SetMatchedBiblionumber instead |
703 |
|
703 |
|
704 |
if ($item_result eq 'create_new' || $item_result eq 'replace') { |
704 |
if ($item_result eq 'create_new' || $item_result eq 'replace') { |
705 |
my ($bib_items_added, $bib_items_replaced, $bib_items_errored) = BatchCommitItems($rowref->{'import_record_id'}, $recordid, $item_result); |
705 |
my ($bib_items_added, $bib_items_replaced, $bib_items_errored) = _batchCommitItems($rowref->{'import_record_id'}, $recordid, $item_result); |
706 |
$num_items_added += $bib_items_added; |
706 |
$num_items_added += $bib_items_added; |
707 |
$num_items_replaced += $bib_items_replaced; |
707 |
$num_items_replaced += $bib_items_replaced; |
708 |
$num_items_errored += $bib_items_errored; |
708 |
$num_items_errored += $bib_items_errored; |
Lines 725-731
sub BatchCommitRecords {
Link Here
|
725 |
$recordid = $record_match; |
725 |
$recordid = $record_match; |
726 |
$num_ignored++; |
726 |
$num_ignored++; |
727 |
if ($record_type eq 'biblio' and defined $recordid and ( $item_result eq 'create_new' || $item_result eq 'replace' ) ) { |
727 |
if ($record_type eq 'biblio' and defined $recordid and ( $item_result eq 'create_new' || $item_result eq 'replace' ) ) { |
728 |
my ($bib_items_added, $bib_items_replaced, $bib_items_errored) = BatchCommitItems($rowref->{'import_record_id'}, $recordid, $item_result); |
728 |
my ($bib_items_added, $bib_items_replaced, $bib_items_errored) = _batchCommitItems($rowref->{'import_record_id'}, $recordid, $item_result); |
729 |
push @biblio_ids, $recordid if $bib_items_added || $bib_items_replaced; |
729 |
push @biblio_ids, $recordid if $bib_items_added || $bib_items_replaced; |
730 |
$num_items_added += $bib_items_added; |
730 |
$num_items_added += $bib_items_added; |
731 |
$num_items_replaced += $bib_items_replaced; |
731 |
$num_items_replaced += $bib_items_replaced; |
Lines 750-763
sub BatchCommitRecords {
Link Here
|
750 |
return ($num_added, $num_updated, $num_items_added, $num_items_replaced, $num_items_errored, $num_ignored); |
750 |
return ($num_added, $num_updated, $num_items_added, $num_items_replaced, $num_items_errored, $num_ignored); |
751 |
} |
751 |
} |
752 |
|
752 |
|
753 |
=head2 BatchCommitItems |
753 |
=head2 _batchCommitItems |
754 |
|
754 |
|
755 |
($num_items_added, $num_items_errored) = |
755 |
($num_items_added, $num_items_errored) = |
756 |
BatchCommitItems($import_record_id, $biblionumber); |
756 |
_batchCommitItems($import_record_id, $biblionumber); |
|
|
757 |
|
758 |
Private function for batch commiting item changes. We do not trigger a re-index here, that is left to the caller. |
757 |
|
759 |
|
758 |
=cut |
760 |
=cut |
759 |
|
761 |
|
760 |
sub BatchCommitItems { |
762 |
sub _batchCommitItems { |
761 |
my ( $import_record_id, $biblionumber, $action ) = @_; |
763 |
my ( $import_record_id, $biblionumber, $action ) = @_; |
762 |
|
764 |
|
763 |
my $dbh = C4::Context->dbh; |
765 |
my $dbh = C4::Context->dbh; |
764 |
- |
|
|