From 0dbd231e88fd5759a2425b8bfc065111d87c2140 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 21 Dec 2023 09:45:26 +0000 Subject: [PATCH] Bug 35625: Prevent deletion at controller --- admin/additional-fields.pl | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/admin/additional-fields.pl b/admin/additional-fields.pl index 11bf70814c4..d07fbd3db3b 100755 --- a/admin/additional-fields.pl +++ b/admin/additional-fields.pl @@ -67,8 +67,10 @@ if ( $op eq 'cud-add' ) { eval { my $af = Koha::AdditionalFields->find($field_id); - $af->set($set_fields); - $updated = $af->store ? 1 : 0; + if ( !$af->is_system ) { + $af->set($set_fields); + $updated = $af->store ? 1 : 0; + } }; push @messages, { code => 'cud-update', @@ -107,7 +109,9 @@ if ( $op eq 'cud-delete' ) { my $deleted = 0; eval { my $af = Koha::AdditionalFields->find($field_id); - $deleted = $af->delete; + if ( !$af->is_system ) { + $deleted = $af->delete; + } }; push @messages, { code => 'cud-delete', @@ -140,4 +144,4 @@ $template->param( messages => \@messages, ); -output_html_with_http_headers $input, $cookie, $template->output; \ No newline at end of file +output_html_with_http_headers $input, $cookie, $template->output; -- 2.47.0