Lines 23-28
use Modern::Perl;
Link Here
|
23 |
use Koha::SearchEngine; |
23 |
use Koha::SearchEngine; |
24 |
use Koha::SearchEngine::Search; |
24 |
use Koha::SearchEngine::Search; |
25 |
use Koha::SearchEngine::QueryBuilder; |
25 |
use Koha::SearchEngine::QueryBuilder; |
|
|
26 |
use Koha::Logger; |
26 |
use Koha::Util::Normalize qw( |
27 |
use Koha::Util::Normalize qw( |
27 |
ISBN |
28 |
ISBN |
28 |
legacy_default |
29 |
legacy_default |
Lines 796-801
sub dump {
Link Here
|
796 |
return $result; |
797 |
return $result; |
797 |
} |
798 |
} |
798 |
|
799 |
|
|
|
800 |
sub _passes_required_check { |
801 |
my ( $s, $t, $op ) = @_; |
802 |
|
803 |
if ( $op eq 'eq' ) { |
804 |
return $s eq $t; |
805 |
} |
806 |
|
807 |
if ( $op eq 'ne' ) { |
808 |
return $s ne $t; |
809 |
} |
810 |
|
811 |
Koha::Logger->get->error( "Unknown match control operator: '$op'!" ); |
812 |
return 0; |
813 |
} |
814 |
|
799 |
sub _passes_required_checks { |
815 |
sub _passes_required_checks { |
800 |
my ($source_record, $target_record, $matchchecks) = @_; |
816 |
my ($source_record, $target_record, $matchchecks) = @_; |
801 |
|
817 |
|
Lines 805-811
sub _passes_required_checks {
Link Here
|
805 |
foreach my $matchcheck (@{ $matchchecks }) { |
821 |
foreach my $matchcheck (@{ $matchchecks }) { |
806 |
my $source_key = join "", _get_match_keys($source_record, $matchcheck->{'source_matchpoint'}); |
822 |
my $source_key = join "", _get_match_keys($source_record, $matchcheck->{'source_matchpoint'}); |
807 |
my $target_key = join "", _get_match_keys($target_record, $matchcheck->{'target_matchpoint'}); |
823 |
my $target_key = join "", _get_match_keys($target_record, $matchcheck->{'target_matchpoint'}); |
808 |
return 0 unless $source_key eq $target_key; |
824 |
return 0 unless _passes_required_check( $source_key, $target_key, $matchcheck->{'operator'} ); |
809 |
} |
825 |
} |
810 |
return 1; |
826 |
return 1; |
811 |
} |
827 |
} |
Lines 834-839
sub _get_match_keys {
Link Here
|
834 |
my @keys = (); |
850 |
my @keys = (); |
835 |
for (my $i = 0; $i <= $#{ $matchpoint->{'components'} }; $i++) { |
851 |
for (my $i = 0; $i <= $#{ $matchpoint->{'components'} }; $i++) { |
836 |
my $component = $matchpoint->{'components'}->[$i]; |
852 |
my $component = $matchpoint->{'components'}->[$i]; |
|
|
853 |
if ( defined $component->{'type'} && $component->{'type'} eq 'constant' ) { |
854 |
push @keys, $component->{'constant'}; |
855 |
next; |
856 |
} |
837 |
my $j = -1; |
857 |
my $j = -1; |
838 |
|
858 |
|
839 |
my @fields = (); |
859 |
my @fields = (); |