From 9d44ba8b29e645dad3827b78f21567cdc7cd0cdc Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 16 Feb 2018 12:01:36 +0100 Subject: [PATCH] Bug 20227: Check for categorycode in default_borrower_circ_rules Fixes silent crash when adding the same category twice. DBD::mysql::st execute failed: Duplicate entry 'ST' for key 'PRIMARY' [for Statement " INSERT INTO default_borrower_circ_rules (categorycode, maxissueqty, maxonsiteissueqty, max_holds) VALUES (?, ?, ?, ?) " with ParamValues: 0="ST", 1=undef, 2=undef, 3="3"] at /usr/share/koha/devclone/admin/smart-rules.pl line 309. (Line number affected by bug 15524.) Very trivial solution. Signed-off-by: Marcel de Rooy Signed-off-by: Jonathan Druart (cherry picked from commit 490f473a7815854893a0b2a38366c95af345a543) Signed-off-by: Fridolin Somers --- admin/smart-rules.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl index 6a55b7bde4..485061be6a 100755 --- a/admin/smart-rules.pl +++ b/admin/smart-rules.pl @@ -297,7 +297,7 @@ elsif ($op eq "add-branch-cat") { maxonsiteissueqty = ? WHERE categorycode = ? |); - $sth_search->execute($branch); + $sth_search->execute($categorycode); my $res = $sth_search->fetchrow_hashref(); if ($res->{total}) { $sth_update->execute($maxissueqty, $maxonsiteissueqty, $categorycode); -- 2.39.5