|
Lines 78-83
BEGIN {
Link Here
|
| 78 |
SetImportRecordOverlayStatus |
78 |
SetImportRecordOverlayStatus |
| 79 |
GetImportRecordStatus |
79 |
GetImportRecordStatus |
| 80 |
SetImportRecordStatus |
80 |
SetImportRecordStatus |
|
|
81 |
SetMatchedBiblionumber |
| 81 |
GetImportRecordMatches |
82 |
GetImportRecordMatches |
| 82 |
SetImportRecordMatches |
83 |
SetImportRecordMatches |
| 83 |
); |
84 |
); |
|
Lines 631-637
sub BatchCommitRecords {
Link Here
|
| 631 |
if ($record_type eq 'biblio') { |
632 |
if ($record_type eq 'biblio') { |
| 632 |
my $biblioitemnumber; |
633 |
my $biblioitemnumber; |
| 633 |
($recordid, $biblioitemnumber) = AddBiblio($marc_record, $framework); |
634 |
($recordid, $biblioitemnumber) = AddBiblio($marc_record, $framework); |
| 634 |
$query = "UPDATE import_biblios SET matched_biblionumber = ? WHERE import_record_id = ?"; |
635 |
$query = "UPDATE import_biblios SET matched_biblionumber = ? WHERE import_record_id = ?"; # FIXME call SetMatchedBiblionumber instead |
| 635 |
if ($item_result eq 'create_new' || $item_result eq 'replace') { |
636 |
if ($item_result eq 'create_new' || $item_result eq 'replace') { |
| 636 |
my ($bib_items_added, $bib_items_replaced, $bib_items_errored) = BatchCommitItems($rowref->{'import_record_id'}, $recordid, $item_result); |
637 |
my ($bib_items_added, $bib_items_replaced, $bib_items_errored) = BatchCommitItems($rowref->{'import_record_id'}, $recordid, $item_result); |
| 637 |
$num_items_added += $bib_items_added; |
638 |
$num_items_added += $bib_items_added; |
|
Lines 664-670
sub BatchCommitRecords {
Link Here
|
| 664 |
$oldxml = $old_marc->as_xml($marc_type); |
665 |
$oldxml = $old_marc->as_xml($marc_type); |
| 665 |
|
666 |
|
| 666 |
ModBiblio($marc_record, $recordid, $oldbiblio->frameworkcode); |
667 |
ModBiblio($marc_record, $recordid, $oldbiblio->frameworkcode); |
| 667 |
$query = "UPDATE import_biblios SET matched_biblionumber = ? WHERE import_record_id = ?"; |
668 |
$query = "UPDATE import_biblios SET matched_biblionumber = ? WHERE import_record_id = ?"; # FIXME call SetMatchedBiblionumber instead |
| 668 |
|
669 |
|
| 669 |
if ($item_result eq 'create_new' || $item_result eq 'replace') { |
670 |
if ($item_result eq 'create_new' || $item_result eq 'replace') { |
| 670 |
my ($bib_items_added, $bib_items_replaced, $bib_items_errored) = BatchCommitItems($rowref->{'import_record_id'}, $recordid, $item_result); |
671 |
my ($bib_items_added, $bib_items_replaced, $bib_items_errored) = BatchCommitItems($rowref->{'import_record_id'}, $recordid, $item_result); |
|
Lines 697-703
sub BatchCommitRecords {
Link Here
|
| 697 |
$num_items_errored += $bib_items_errored; |
698 |
$num_items_errored += $bib_items_errored; |
| 698 |
# still need to record the matched biblionumber so that the |
699 |
# still need to record the matched biblionumber so that the |
| 699 |
# items can be reverted |
700 |
# items can be reverted |
| 700 |
my $sth2 = $dbh->prepare_cached("UPDATE import_biblios SET matched_biblionumber = ? WHERE import_record_id = ?"); |
701 |
my $sth2 = $dbh->prepare_cached("UPDATE import_biblios SET matched_biblionumber = ? WHERE import_record_id = ?"); # FIXME call SetMatchedBiblionumber instead |
| 701 |
$sth2->execute($recordid, $rowref->{'import_record_id'}); |
702 |
$sth2->execute($recordid, $rowref->{'import_record_id'}); |
| 702 |
SetImportRecordOverlayStatus($rowref->{'import_record_id'}, 'match_applied'); |
703 |
SetImportRecordOverlayStatus($rowref->{'import_record_id'}, 'match_applied'); |
| 703 |
} |
704 |
} |
|
Lines 881-887
sub BatchRevertRecords {
Link Here
|
| 881 |
my $query; |
882 |
my $query; |
| 882 |
if ($record_type eq 'biblio') { |
883 |
if ($record_type eq 'biblio') { |
| 883 |
# remove matched_biblionumber only if there is no 'imported' item left |
884 |
# remove matched_biblionumber only if there is no 'imported' item left |
| 884 |
$query = "UPDATE import_biblios SET matched_biblionumber = NULL WHERE import_record_id = ?"; |
885 |
$query = "UPDATE import_biblios SET matched_biblionumber = NULL WHERE import_record_id = ?"; # FIXME Remove me |
| 885 |
$query = "UPDATE import_biblios SET matched_biblionumber = NULL WHERE import_record_id = ? AND NOT EXISTS (SELECT * FROM import_items WHERE import_items.import_record_id=import_biblios.import_record_id and status='imported')"; |
886 |
$query = "UPDATE import_biblios SET matched_biblionumber = NULL WHERE import_record_id = ? AND NOT EXISTS (SELECT * FROM import_items WHERE import_items.import_record_id=import_biblios.import_record_id and status='imported')"; |
| 886 |
} else { |
887 |
} else { |
| 887 |
$query = "UPDATE import_auths SET matched_authid = NULL WHERE import_record_id = ?"; |
888 |
$query = "UPDATE import_auths SET matched_authid = NULL WHERE import_record_id = ?"; |
|
Lines 1219-1224
sub SetImportBatchStatus {
Link Here
|
| 1219 |
|
1220 |
|
| 1220 |
} |
1221 |
} |
| 1221 |
|
1222 |
|
|
|
1223 |
=head2 SetMatchedBiblionumber |
| 1224 |
|
| 1225 |
SetMatchedBiblionumber($batch_id, $biblionumber); |
| 1226 |
|
| 1227 |
=cut |
| 1228 |
|
| 1229 |
sub SetMatchedBiblionumber { |
| 1230 |
my ($import_record_id, $biblionumber) = @_; |
| 1231 |
|
| 1232 |
my $dbh = C4::Context->dbh; |
| 1233 |
$dbh->do( |
| 1234 |
q|UPDATE import_biblios SET matched_biblionumber = ? WHERE import_record_id = ?|, |
| 1235 |
undef, $biblionumber, $import_record_id |
| 1236 |
); |
| 1237 |
} |
| 1238 |
|
| 1222 |
=head2 GetImportBatchOverlayAction |
1239 |
=head2 GetImportBatchOverlayAction |
| 1223 |
|
1240 |
|
| 1224 |
my $overlay_action = GetImportBatchOverlayAction($batch_id); |
1241 |
my $overlay_action = GetImportBatchOverlayAction($batch_id); |