Bug 16493: [QA Followup] Restore title and author match as an option, make it the...
authorKyle M Hall <kyle@bywatersolutions.com>
Wed, 8 Jun 2016 10:53:25 +0000 (10:53 +0000)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 4 Nov 2016 14:08:12 +0000 (14:08 +0000)
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
acqui/addorderiso2709.pl
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt

index adcf507..74ea8e2 100755 (executable)
@@ -31,6 +31,7 @@ use C4::Auth;
 use C4::Output;
 use C4::ImportBatch;
 use C4::Matcher;
+use C4::Search qw/FindDuplicate/;
 use C4::Acquisition;
 use C4::Biblio;
 use C4::Items;
@@ -139,7 +140,7 @@ if ($op eq ""){
     my @discount = $input->multi_param('discount');
     my @sort1 = $input->multi_param('sort1');
     my @sort2 = $input->multi_param('sort2');
-    my $matcher_id = $input->multi_param('matcher_id');
+    my $matcher_id = $input->param('matcher_id');
     my $active_currency = Koha::Acquisition::Currencies->get_active;
     for my $biblio (@$biblios){
         # Check if this import_record_id was selected
@@ -158,13 +159,18 @@ if ($op eq ""){
         # 1st insert the biblio, or find it through matcher
         unless ( $biblionumber ) {
             if ($matcher_id) {
-                my $matcher = C4::Matcher->fetch($matcher_id);
-                my @matches = $matcher->get_matches( $marcrecord, my $max_matches = 1 );
-                if ( @matches ) {
-                    $duplinbatch = $import_batch_id;
-                    next;
+                if ( $matcher_id eq '_TITLE_AUTHOR_' ) {
+                    $duplinbatch = $import_batch_id if FindDuplicate($marcrecord);
                 }
+                else {
+                    my $matcher = C4::Matcher->fetch($matcher_id);
+                    my @matches = $matcher->get_matches( $marcrecord, my $max_matches = 1 );
+                    $duplinbatch = $import_batch_id if @matches;
+                }
+
+                next if $duplinbatch;
             }
+
             # add the biblio
             my $bibitemnum;
 
index 63425a7..acf84e1 100644 (file)
                             <span>
                                 <label for="matcher_id">Matching:</label>
                                     <select name="matcher_id" id="matcher_id">
+                                        <option value="_TITLE_AUTHOR_">Title and author</option>
                                         <option value="">Do not look for matching records</option>
                                         [% FOREACH available_matcher IN available_matchers %]
                                             [% IF ( available_matcher.code == current_matcher_code ) %]