Bugzilla – Attachment 166950 Details for
Bug 15536
Additional match check comparison operators
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15536: implement match control check
Bug-15536-implement-match-control-check.patch (text/plain), 2.59 KB, created by
Andreas Jonsson
on 2024-05-21 00:49:20 UTC
(
hide
)
Description:
Bug 15536: implement match control check
Filename:
MIME Type:
Creator:
Andreas Jonsson
Created:
2024-05-21 00:49:20 UTC
Size:
2.59 KB
patch
obsolete
>From 27705ef38be3406c508d0913f852f9df4b2a5454 Mon Sep 17 00:00:00 2001 >From: Andreas Jonsson <andreas.jonsson@kreablo.se> >Date: Tue, 21 May 2024 01:55:05 +0200 >Subject: [PATCH] Bug 15536: implement match control check > >--- > C4/Matcher.pm | 22 +++++++++++++++++++++- > admin/matching-rules.pl | 4 ++-- > 2 files changed, 23 insertions(+), 3 deletions(-) > >diff --git a/C4/Matcher.pm b/C4/Matcher.pm >index 457320354a..16f1895da1 100644 >--- a/C4/Matcher.pm >+++ b/C4/Matcher.pm >@@ -23,6 +23,7 @@ use Modern::Perl; > use Koha::SearchEngine; > use Koha::SearchEngine::Search; > use Koha::SearchEngine::QueryBuilder; >+use Koha::Logger; > use Koha::Util::Normalize qw( > ISBN > legacy_default >@@ -796,6 +797,21 @@ sub dump { > return $result; > } > >+sub _passes_required_check { >+ my ( $s, $t, $op ) = @_; >+ >+ if ( $op eq 'eq' ) { >+ return $s eq $t; >+ } >+ >+ if ( $op eq 'ne' ) { >+ return $s ne $t; >+ } >+ >+ Koha::Logger->get->error( "Unknown match control operator: '$op'!" ); >+ return 0; >+} >+ > sub _passes_required_checks { > my ($source_record, $target_record, $matchchecks) = @_; > >@@ -805,7 +821,7 @@ sub _passes_required_checks { > foreach my $matchcheck (@{ $matchchecks }) { > my $source_key = join "", _get_match_keys($source_record, $matchcheck->{'source_matchpoint'}); > my $target_key = join "", _get_match_keys($target_record, $matchcheck->{'target_matchpoint'}); >- return 0 unless $source_key eq $target_key; >+ return 0 unless _passes_required_check( $source_key, $target_key, $matchcheck->{'operator'} ); > } > return 1; > } >@@ -834,6 +850,10 @@ sub _get_match_keys { > my @keys = (); > for (my $i = 0; $i <= $#{ $matchpoint->{'components'} }; $i++) { > my $component = $matchpoint->{'components'}->[$i]; >+ if ( defined $component->{'type'} && $component->{'type'} eq 'constant' ) { >+ push @keys, $component->{'constant'}; >+ next; >+ } > my $j = -1; > > my @fields = (); >diff --git a/admin/matching-rules.pl b/admin/matching-rules.pl >index 76668659a0..63080875ef 100755 >--- a/admin/matching-rules.pl >+++ b/admin/matching-rules.pl >@@ -146,8 +146,8 @@ sub add_update_matching_rule { > push @$components, $component; > } > } >- >- $matcher->add_required_check($src_components, $tgt_components, $input->param("mc_${mc_num}_operator")); >+ my $operator = $input->param( "mc_${mc_num}_operator" ); >+ $matcher->add_required_check( $src_components, $tgt_components, $operator ); > } > > if (defined $matcher_id and $matcher_id =~ /^\d+/) { >-- >2.39.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 15536
:
166947
|
166948
|
166949
| 166950