Bug 16493: acq matching on title and author

When you order from a staged file you're getting duplicate warnings that
are inaccurate.  For example, when you order a file of 50 DVDs for
example and they don't have ISBNs they're matching on the books. And
then you have to order them one by one.

This patch replaces the use of FindDuplicates with Koha's match point
system. This means you can select from the same match points defined
and used in the batch record importer, or you can opt to skip matching
altogether!

Test Plan:
1) Import a record with a title, isbn and author.
2) Delete the from the record and stage it again
3) Attempt to add it to a basket via the staged record
4) You should note the gives you the "No records imported" message
5) Apply this patch
6) Create a matcher for ISBN
7) Create a matcher for Author/Title
8) Attempt to add the record to your basket using the ISBN matcher
8) Koha should find no match and import the record to the basket
9) Stage the record again
10) Attempt to add the record to your basket using the Title/Author matcher
11) You should recieve the "No records imported" message.

Signed-off-by: Barbara Fondren <bfondren@roundrocktexas.gov>

Signed-off-by: Nicole C Engard <nengard@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Kyle M Hall 2016-05-11 14:19:41 +00:00
parent 4fd1f3e48e
commit ed932be618
2 changed files with 40 additions and 6 deletions

View File

@ -31,7 +31,6 @@ 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;
@ -140,6 +139,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 $active_currency = Koha::Acquisition::Currencies->get_active;
for my $biblio (@$biblios){
# Check if this import_record_id was selected
@ -157,7 +157,14 @@ if ($op eq ""){
# 1st insert the biblio, or find it through matcher
unless ( $biblionumber ) {
$duplinbatch=$import_batch_id and next if FindDuplicate($marcrecord);
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;
}
}
# add the biblio
my $bibitemnum;

View File

@ -189,10 +189,37 @@
</ul>
<div id="records_to_import">
<span class="checkall"><a id="checkAll" href="#">Check all</a></span>
<span class="uncheckall"><a id="unCheckAll" href="#">Uncheck all</a></span>
<label for="showallbudgets" style="float:none;width:auto;">&nbsp;Show inactive funds:</label>
<input type="checkbox" id="showallbudgets" />
<div id="searchheader">
<div>
<span class="checkall"><a id="checkAll" href="#">Select all</a></span>
|
<span class="uncheckall"><a id="unCheckAll" href="#">Clear all</a></span>
|
<span>
<label for="matcher_id">Matching:</label>
<select name="matcher_id" id="matcher_id">
<option value="">Do not look for matching records</option>
[% FOREACH available_matcher IN available_matchers %]
[% IF ( available_matcher.code == current_matcher_code ) %]
<option value="[% available_matcher.matcher_id %]" selected="selected">
[% available_matcher.code %] ([% available_matcher.description %])
</option>
[% ELSE %]
<option value="[% available_matcher.matcher_id %]">
[% available_matcher.code %] ([% available_matcher.description %])
</option>
[% END %]
[% END %]
</select>
</span>
|
<span>
<label for="showallbudgets" style="float:none;width:auto;">&nbsp;Show inactive funds:</label>
<input type="checkbox" id="showallbudgets" />
</span>
</div>
</div>
<input type="hidden" name="op" value="import_records"/>
<input type="hidden" name="basketno" value="[% basketno %]" />
<input type="hidden" name="booksellerid" value="[% booksellerid %]" />