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 <michaela.sieber@kit.edu>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit b5de15c4b8)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 61b9002848)
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
This commit is contained in:
Jonathan Druart 2023-05-10 13:53:20 +02:00 committed by Pedro Amorim
parent 8a69164c5b
commit efe0faccdc

View file

@ -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'
};