Allow stage_biblios_file to take matcher id as parameter.
authorRyan Higgins <rch@balrog.liblime.com>
Thu, 7 Feb 2008 18:59:04 +0000 (12:59 -0600)
committerJoshua Ferraro <jmf@liblime.com>
Fri, 8 Feb 2008 12:07:49 +0000 (06:07 -0600)
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
misc/stage_biblios_file.pl
tools/manage-marc-import.pl

index a692748..671bc86 100755 (executable)
@@ -24,7 +24,7 @@ my $want_help = 0;
 
 my $result = GetOptions(
     'file:s'        => \$input_file,
-    'match-bibs'    => \$match_bibs,
+    'match-bibs:s'    => \$match_bibs,
     'add-items'     => \$add_items,
     'comment:s'     => \$batch_comment,
     'h|help'        => \$want_help
@@ -70,11 +70,16 @@ sub process_batch {
 
     my $num_with_matches = 0;
     if ($match_bibs) {
-        my $matcher = C4::Matcher->new('biblio');
-        $matcher->add_simple_matchpoint('isbn', 1000, '020', 'a', -1, 0, '');
-        $matcher->add_simple_required_check('245', 'a', -1, 0, '', 
+       my $matcher = C4::Matcher->fetch($match_bibs) ;
+       if( ! defined $matcher) {
+               $matcher = C4::Matcher->new('biblio');
+               $matcher->add_simple_matchpoint('isbn', 1000, '020', 'a', -1, 0, '');
+               $matcher->add_simple_required_check('245', 'a', -1, 0, '', 
                                             '245', 'a', -1, 0, '');
-        print "... looking for matches with records already in database\n";
+     } else {
+                SetImportBatchMatcher($batch_id, $match_bibs);
+       }
+       print "... looking for matches with records already in database\n";
         $num_with_matches = BatchFindBibDuplicates($batch_id, $matcher, 10, 100, \&print_progress_and_commit);
         print "... finished looking for matches\n";
     }
@@ -125,9 +130,11 @@ records into the main Koha database.
 
 Parameters:
     --file <file_name>      name of input MARC bib file
-    --match-bibs            use this option to match bibs
+    --match-bibs <match_id> use this option to match bibs
                             in the file with bibs already in 
                             the database for future overlay.
+                           If <match_id> isn't defined, a default 
+                           MARC21 ISBN & title match rule will be applied.
     --add-items             use this option to specify that
                             item data is embedded in the MARC
                             bibs and should be parsed.
index 3a7bd4e..ec55233 100755 (executable)
@@ -44,7 +44,7 @@ my $import_batch_id = $input->param('import_batch_id');
 
 # record list displays
 my $offset = $input->param('offset') || 0;
-my $results_per_page = $input->param('results_per_page') || 10
+my $results_per_page = $input->param('results_per_page') || 25
 
 my ($template, $loggedinuser, $cookie)
     = get_template_and_user({template_name => "tools/manage-marc-import.tmpl",