From 241032230da86f4d87e4f616aca5e17cf214cfd5 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 18 Oct 2018 19:27:21 -0300 Subject: [PATCH] Bug 21606: [sql_modes] Fix matching rules insert Fix: Incorrect integer value: '' for column 'offset' Incorrect integer value: '' for column 'score' Test plan: Add/edit matching rules Signed-off-by: Marcel de Rooy Signed-off-by: Nick Clemens (cherry picked from commit 32c4dbfd6814f01ae2b430e88f13b89bd374f34f) Signed-off-by: Martin Renvoize --- C4/Matcher.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/C4/Matcher.pm b/C4/Matcher.pm index 7209511d76..4843d98c24 100644 --- a/C4/Matcher.pm +++ b/C4/Matcher.pm @@ -331,7 +331,7 @@ sub _store_matchpoint { my $matcher_id = $self->{'id'}; $sth = $dbh->prepare_cached("INSERT INTO matchpoints (matcher_id, search_index, score) VALUES (?, ?, ?)"); - $sth->execute($matcher_id, $matchpoint->{'index'}, $matchpoint->{'score'}); + $sth->execute($matcher_id, $matchpoint->{'index'}, $matchpoint->{'score'}||0); my $matchpoint_id = $dbh->{'mysql_insertid'}; my $seqnum = 0; foreach my $component (@{ $matchpoint->{'components'} }) { @@ -343,7 +343,7 @@ sub _store_matchpoint { $sth->bind_param(2, $seqnum); $sth->bind_param(3, $component->{'tag'}); $sth->bind_param(4, join "", sort keys %{ $component->{'subfields'} }); - $sth->bind_param(5, $component->{'offset'}); + $sth->bind_param(5, $component->{'offset'}||0); $sth->bind_param(6, $component->{'length'}); $sth->execute(); my $matchpoint_component_id = $dbh->{'mysql_insertid'}; -- 2.39.5