From f362dd3a2fa48fbb90df7913dd45623db8705920 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. Signed-off-by: Martin Renvoize Signed-off-by: Julian Maurice --- admin/additional-fields.pl | 5 ++++- .../prog/en/modules/admin/additional-fields.tt | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/admin/additional-fields.pl b/admin/additional-fields.pl index dcc26ae02f..11bf70814c 100755 --- a/admin/additional-fields.pl +++ b/admin/additional-fields.pl @@ -53,6 +53,7 @@ if ( $op eq 'cud-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; my $set_fields = { @@ -60,6 +61,7 @@ if ( $op eq 'cud-add' ) { marcfield => $marcfield, marcfield_mode => $marcfield_mode, searchable => $searchable, + repeatable => $repeatable, }; $set_fields->{authorised_value_category} = $authorised_value_category if $authorised_value_category; @@ -80,6 +82,7 @@ if ( $op eq 'cud-add' ) { marcfield => $marcfield, marcfield_mode => $marcfield_mode, searchable => $searchable, + repeatable => $repeatable, }; $set_fields->{authorised_value_category} = $authorised_value_category if $authorised_value_category; @@ -137,4 +140,4 @@ $template->param( messages => \@messages, ); -output_html_with_http_headers $input, $cookie, $template->output; +output_html_with_http_headers $input, $cookie, $template->output; \ No newline at end of file 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 c42c266505..22499ca66a 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 @@ -156,6 +156,7 @@ [% IF show_searchable %] Searchable [% END %] + Repeatable Actions @@ -178,6 +179,9 @@ [% IF field.searchable %]Yes[% ELSE %]No[% END %] [% END %] + + [% IF field.repeatable %]Yes[% ELSE %]No[% END %] + Edit Delete @@ -212,6 +216,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 %]
  • @@ -299,6 +311,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.39.2