<<

NAME

C4::ImportBatch - manage batches of imported MARC records

SYNOPSIS

use C4::ImportBatch;

FUNCTIONS

GetZ3950BatchId

  my $batchid = GetZ3950BatchId($z3950server);

Retrieves the ID of the import batch for the Z39.50 reservoir for the given target. If necessary, creates the import batch.

GetWebserviceBatchId

  my $batchid = GetWebserviceBatchId();

Retrieves the ID of the import batch for webservice. If necessary, creates the import batch.

GetImportRecordMarc

  my ($marcblob, $encoding) = GetImportRecordMarc($import_record_id);

AddImportBatch

  my $batch_id = AddImportBatch($params_hash);

GetImportBatch

  my $row = GetImportBatch($batch_id);

Retrieve a hashref of an import_batches row.

AddBiblioToBatch

  my $import_record_id = AddBiblioToBatch($batch_id, $record_sequence, 
                $marc_record, $encoding, $update_counts);

AddAuthToBatch

  my $import_record_id = AddAuthToBatch($batch_id, $record_sequence,
                $marc_record, $encoding, $update_counts, [$marc_type]);

BatchStageMarcRecords

( $batch_id, $num_records, $num_items, @invalid_records ) = BatchStageMarcRecords( $record_type, $encoding, $marc_records, $file_name, $marc_modification_template, $comments, $branch_code, $parse_items, $leave_as_staging, $progress_interval, $progress_callback );

AddItemsToImportBiblio

  my @import_items_ids = AddItemsToImportBiblio($batch_id, 
                $import_record_id, $marc_record, $update_counts);

BatchFindDuplicates

  my $num_with_matches = BatchFindDuplicates($batch_id, $matcher,
             $max_matches, $progress_interval, $progress_callback);

Goes through the records loaded in the batch and attempts to find duplicates for each one. Sets the matching status of each record to "no_match" or "auto_match" as appropriate.

The $max_matches parameter is optional; if it is not supplied, it defaults to 10.

The $progress_interval and $progress_callback parameters are optional; if both are supplied, the sub referred to by $progress_callback will be invoked every $progress_interval records using the number of records processed as the singular argument.

BatchCommitRecords

  Takes a hashref containing params for committing the batch - optional parameters 'progress_interval' and
  'progress_callback' will define code called every X records.

  my ($num_added, $num_updated, $num_items_added, $num_items_replaced, $num_items_errored, $num_ignored) =
        BatchCommitRecords({
            batch_id  => $batch_id,
            framework => $framework,
            overlay_framework => $overlay_framework,
            progress_interval => $progress_interval,
            progress_callback => $progress_callback,
        });

_batchCommitItems

  ($num_items_added, $num_items_errored) = 
         _batchCommitItems($import_record_id, $biblionumber, [$action, $biblioitemnumber]);

Private function for batch committing item changes. We do not trigger a re-index here, that is left to the caller.

BatchRevertRecords

  my ($num_deleted, $num_errors, $num_reverted, $num_items_deleted, 
      $num_ignored) = BatchRevertRecords($batch_id);

BatchRevertItems

  my $num_items_deleted = BatchRevertItems($import_record_id, $biblionumber);

CleanBatch

  CleanBatch($batch_id)

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.

DeleteBatch

  DeleteBatch($batch_id)

Deletes the record from the database. This can only be done once the batch has been cleaned.

GetAllImportBatches

  my $results = GetAllImportBatches();

Returns a references to an array of hash references corresponding to all import_batches rows (of batch_type 'batch'), sorted in ascending order by import_batch_id.

GetStagedWebserviceBatches

  my $batch_ids = GetStagedWebserviceBatches();

Returns a references to an array of batch id's of batch_type 'webservice' that are not imported

GetImportBatchRangeDesc

  my $results = GetImportBatchRangeDesc($offset, $results_per_group);

Returns a reference to an array of hash references corresponding to import_batches rows (sorted in descending order by import_batch_id) start at the given offset.

GetItemNumbersFromImportBatch

  my @itemsnos = GetItemNumbersFromImportBatch($batch_id);

GetNumberOfImportBatches

  my $count = GetNumberOfImportBatches();

GetImportBiblios

  my $results = GetImportBiblios($importid);

GetImportRecordsRange

  my $results = GetImportRecordsRange($batch_id, $offset, $results_per_group);

Returns a reference to an array of hash references corresponding to import_biblios/import_auths/import_records rows for a given batch starting at the given offset.

GetBestRecordMatch

  my $record_id = GetBestRecordMatch($import_record_id);

GetImportBatchStatus

  my $status = GetImportBatchStatus($batch_id);

SetImportBatchStatus

  SetImportBatchStatus($batch_id, $new_status);

SetMatchedBiblionumber

  SetMatchedBiblionumber($import_record_id, $biblionumber);

GetImportBatchOverlayAction

  my $overlay_action = GetImportBatchOverlayAction($batch_id);

SetImportBatchOverlayAction

  SetImportBatchOverlayAction($batch_id, $new_overlay_action);

GetImportBatchNoMatchAction

  my $nomatch_action = GetImportBatchNoMatchAction($batch_id);

SetImportBatchNoMatchAction

  SetImportBatchNoMatchAction($batch_id, $new_nomatch_action);

GetImportBatchItemAction

  my $item_action = GetImportBatchItemAction($batch_id);

SetImportBatchItemAction

  SetImportBatchItemAction($batch_id, $new_item_action);

GetImportBatchMatcher

  my $matcher_id = GetImportBatchMatcher($batch_id);

SetImportBatchMatcher

  SetImportBatchMatcher($batch_id, $new_matcher_id);

GetImportRecordOverlayStatus

  my $overlay_status = GetImportRecordOverlayStatus($import_record_id);

SetImportRecordOverlayStatus

  SetImportRecordOverlayStatus($import_record_id, $new_overlay_status);

GetImportRecordStatus

  my $status = GetImportRecordStatus($import_record_id);

SetImportRecordStatus

  SetImportRecordStatus($import_record_id, $new_status);

GetImportRecordMatches

  my $results = GetImportRecordMatches($import_record_id, $best_only);

SetImportRecordMatches

  SetImportRecordMatches($import_record_id, @matches);

RecordsFromISO2709File

    my ($errors, $records) = C4::ImportBatch::RecordsFromISO2709File($input_file, $record_type, $encoding);

Reads ISO2709 binary porridge from the given file and creates MARC::Record-objects out of it.

@PARAM1, String, absolute path to the ISO2709 file. @PARAM2, String, see stage_file.pl @PARAM3, String, should be utf8

Returns two array refs.

RecordsFromMARCXMLFile

    my ($errors, $records) = C4::ImportBatch::RecordsFromMARCXMLFile($input_file, $encoding);

Creates MARC::Record-objects out of the given MARCXML-file.

@PARAM1, String, absolute path to the MARCXML file. @PARAM2, String, should be utf8

Returns two array refs.

RecordsFromMarcPlugin

    Converts text of input_file into array of MARC records with to_marc plugin

AUTHOR

Koha Development Team <http://koha-community.org/>

Galen Charlton <galen.charlton@liblime.com>

<<