BatchFindBibDuplicates
BatchCommitBibRecords
BatchRevertBibRecords
+ CleanBatch
GetAllImportBatches
GetImportBatchRangeDesc
$num_items_deleted += BatchRevertItems($rowref->{'import_record_id'}, $rowref->{'matched_biblionumber'});
SetImportRecordStatus($rowref->{'import_record_id'}, 'reverted');
}
+ my $sth2 = $dbh->prepare_cached("UPDATE import_biblios SET matched_biblionumber = NULL WHERE import_record_id = ?");
+ $sth2->execute($rowref->{'import_record_id'});
}
$sth->finish();
return $num_items_deleted;
}
+=head2 CleanBatch
+
+=over 4
+
+CleanBatch($batch_id)
+
+=back
+
+Deletes all staged records from the import batch
+and sets the status of the batch to 'cleaned'. Note
+that deleting a stage record does *not* affect
+any record that has been committed to the database.
+
+=cut
+
+sub CleanBatch {
+ my $batch_id = shift;
+ return unless defined $batch_id;
+
+ C4::Context->dbh->do('DELETE FROM import_records WHERE import_batch_id = ?', {}, $batch_id);
+ SetImportBatchStatus($batch_id, 'cleaned');
+}
+
=head2 GetAllImportBatches
=over 4
my $dbh = C4::Context->dbh;
my $sth = $dbh->prepare_cached("SELECT title, author, isbn, issn, import_record_id, record_sequence,
- status, overlay_status
+ matched_biblionumber, status, overlay_status
FROM import_records
JOIN import_biblios USING (import_record_id)
WHERE import_batch_id = ?
my ($batch_id) = @_;
my $dbh = C4::Context->dbh;
- my $sth = $dbh->prepare("SELECT import_status FROM import_batches WHERE batch_id = ?");
+ my $sth = $dbh->prepare("SELECT import_status FROM import_batches WHERE import_batch_id = ?");
$sth->execute($batch_id);
my ($status) = $sth->fetchrow_array();
$sth->finish();
- return;
+ return $status;
}
-
=head2 SetImportBatchStatus
=over 4