From 47e5de9911cb1fac9608cb8c50c5a5003975cc29 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Fri, 13 Oct 2023 10:00:22 +0000 Subject: [PATCH] Bug 35044: Admin: New additional fields 'repeatable' field There is now a new 'repeatable' checkbox when configuring (adding or editing) an additional field for a specific table. It is also displayed in a column in the additional fields panel for a given tablename. MARC fields are not allowed to be repeatable. --- admin/additional-fields.pl | 3 +++ .../prog/en/modules/admin/additional-fields.tt | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/admin/additional-fields.pl b/admin/additional-fields.pl index 5e6b1e32d7..8de0f70848 100755 --- a/admin/additional-fields.pl +++ b/admin/additional-fields.pl @@ -53,6 +53,7 @@ if ( $op eq 'add' ) { my $marcfield = $input->param('marcfield') // q{}; my $marcfield_mode = $input->param('marcfield_mode') // 'get'; my $searchable = $input->param('searchable') ? 1 : 0; + my $repeatable = $input->param('repeatable') ? 1 : 0; if ( $field_id and $name ) { my $updated = 0; eval { @@ -63,6 +64,7 @@ if ( $op eq 'add' ) { marcfield => $marcfield, marcfield_mode => $marcfield_mode, searchable => $searchable, + repeatable => $repeatable, }); $updated = $af->store ? 1 : 0; }; @@ -80,6 +82,7 @@ if ( $op eq 'add' ) { marcfield => $marcfield, marcfield_mode => $marcfield_mode, searchable => $searchable, + repeatable => $repeatable, }); $inserted = $af->store ? 1 : 0; }; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/additional-fields.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/additional-fields.tt index a569c43fc8..23a939e1f7 100755 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/additional-fields.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/additional-fields.tt @@ -155,6 +155,7 @@ [% IF show_searchable %] Searchable [% END %] + Repeatable Actions @@ -177,6 +178,9 @@ [% IF field.searchable %]Yes[% ELSE %]No[% END %] [% END %] + + [% IF field.repeatable %]Yes[% ELSE %]No[% END %] + Edit Delete @@ -210,6 +214,14 @@ [% PROCESS options_for_authorised_value_categories authorised_value_categories = AuthorisedValues.GetCategories({selected => field.authorised_value_category}) %] +
  • + + [% IF field.repeatable %] + + [% ELSE %] + + [% END %] +
  • [% IF show_marcfield %]
  • @@ -297,6 +309,12 @@ alert(_("You cannot select an authorised value category and a MARC field") ); return false; } + } $("#repeatable").prop('checked') == true + if ( $("#marcfield").length && $("#repeatable").length) { + if ( $("#marcfield").val().length > 0 && $("#repeatable").prop('checked') == true ) { + alert(_("You cannot set a MARC field as repeatable") ); + return false; + } } return true; }); -- 2.30.2