From efe0faccdc73c2e94d4aafef47298517af52f98a Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 10 May 2023 13:53:20 +0200 Subject: [PATCH] Bug 33578: Fix controller when editing a restriction type Do not display a warning when we are editing a restriction type and no other types with this description exists. Signed-off-by: Michaela Sieber Signed-off-by: Marcel de Rooy Signed-off-by: Tomas Cohen Arazi (cherry picked from commit b5de15c4b8daccfb80718e82633553f7dbb8b623) Signed-off-by: Martin Renvoize (cherry picked from commit 61b9002848cdb316da6405f615bb4ca746dab26a) Signed-off-by: Pedro Amorim --- admin/restrictions.pl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/admin/restrictions.pl b/admin/restrictions.pl index 06812c0bfa..ab0c384212 100755 --- a/admin/restrictions.pl +++ b/admin/restrictions.pl @@ -58,10 +58,13 @@ if ( $op eq 'add_form') { if ($is_a_modif) { # Check whether another restriction already has this display text - my $dupe = Koha::Patron::Restriction::Types->find({ - display_text => $display_text - }); - if ($dupe) { + my $dupe = Koha::Patron::Restriction::Types->search( + { + code => { '!=' => $code }, + display_text => $display_text, + } + ); + if ($dupe->count) { push @messages, { type => 'error', code => 'duplicate_display_text' }; -- 2.39.5