From 44a0a1a6e6ebf09b0369d22e6ed397877fbaef63 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. --- admin/restrictions.pl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/admin/restrictions.pl b/admin/restrictions.pl index 06812c0bfae..ab0c384212d 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.25.1