staging import - enhance record overlay behavior
authorGalen Charlton <galen.charlton@liblime.com>
Wed, 30 Apr 2008 20:45:44 +0000 (15:45 -0500)
committerJoshua Ferraro <jmf@liblime.com>
Thu, 1 May 2008 02:58:46 +0000 (21:58 -0500)
commit438ed2333787a37101ce5476dbd656005ab17537
tree8ae92a14458c6acc53235f597eeb04debffb6225
parentaad276c3cd88a25cfb229fe140ac8cf27c56b17d
staging import - enhance record overlay behavior

Enhanced the ability of catalogers to specify how
bib and item records should be added, replaced, or
ignored during a staging import.

When an import batch of bib records is staged and commit,
the user can now explicitly specify what should occur
when an incoming bib record has, or does not have, a match
with a record already in the database.  The options are:

if match found (overlay_action):
  create_new (just add the incoming record)
  replace (replace the matched record with the incoming one)
  use_template (option not implemented)
  ignore (do nothing with the incoming bib; however, the
          items attached to it may still be processed
           based on the item action)

if no match is found (nomatch_action):
  create_new (just add the incoming record)
  ignore (do nothing with the incoming bib; in this
          case, any items attached to it will be
          ignored since there will be nothing to
          attach them to)

The following options for handling items embedded in the
bib record are now available:

  always_add (add the items to the new or replaced bib)
  add_only_if_match (add the items only if the incoming bib
                     matches an existing bib)
  add_only_if_add (add the items only if the incoming bib
                   does *not* match an existing bib)
  ignore (ignore the items entirely)

With these changes, it is now possible to support the following use cases:

[1] A library joining an existing Koha database wishes to add their
    items to existing bib records if they match, but does not want
    to overlay the bib records themselves.
[2] A library wants to load a file of records, but only handle
    the new ones, not ones that are already in the database.
[3] A library wants to load a file of records, but only
    handle the ones that match existing records (e.g., if
    the records are coming back from an authority control vendor).

Documentation changes:

* See description above; also, screenshots of the 'stage MARC records
for import' and 'manage staged MARC records' should be updated.

Test cases:

* Added test cases to exercise staging and committing import batches.

UI changes:

* The pages for staging and managing import batches now have
  controls for setting the overlay action, action if no match,
  and item action separately.
* in the manage import batch tool, user is notified when they
  change overlay action, no-match action, and item action
* HTML for manage import batch tool now uses fieldsets

Database changes (DB rev 076):

* added import_batches.item_action
* added import_batches.nomatch_action
* added 'ignore' as a valid value for import_batches.overlay_action
* added 'ignored' as a valid value for import_records.status
* added 'status' as a valid value for import_items.status

API changes:

* new accessor routines for C4::ImportBatch

    GetImportBatchNoMatchAction
    SetImportBatchNoMatchAction
    GetImportBatchItemAction
    SetImportBatchItemAction

* new internal functions for C4::ImportBatch to
  determine how a given bib and item are to be
  processed, based on overlay_action, nomatch_action,
  and item_action:

    _get_commit_action
    _get_revert_action

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
14 files changed:
C4/ImportBatch.pm
installer/data/mysql/kohastructure.sql
installer/data/mysql/updatedatabase.pl
koha-tmpl/intranet-tmpl/prog/en/includes/tools-item-action.inc [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/en/includes/tools-nomatch-action.inc [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/en/includes/tools-overlay-action.inc [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tmpl
koha-tmpl/intranet-tmpl/prog/en/modules/tools/stage-marc-import.tmpl
kohaversion.pl
misc/stage_biblios_file.pl
t/lib/KohaTest/ImportBatch.pm [new file with mode: 0644]
t/lib/KohaTest/ImportBatch/BatchStageCommitRevert.pm [new file with mode: 0644]
tools/manage-marc-import.pl
tools/stage-marc-import.pl