From c687f20bea9bd7977390ae3eff2877c81f97f4b2 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Mon, 8 Nov 2021 17:27:03 +0000 Subject: [PATCH] Bug 26296: (follow-up) Make sure title remains mandatory This patch adds a flag to the OPAC preferences file marking suggestion title as mandatory OPACSuggestionMandatoryFields and excluded from OPACSuggestionUnwantedFields. The patch also modifies the markup around required fields in the OPAC suggestion form to comply with changes made in Bug 27668 to mandatory field styling. To test, apply the patch and restart services. - Test the OPACSuggestionMandatoryFields preference. In the modal, "title" should be checked and the label in red. It should not be possible to uncheck the checkbox. - Test that the "Select all" and "Clear all" links don't affect the "title" checkbox. - Confirm that your selections are still saved correctly. - Test the OPACSuggestionUnwantedFields preference. In the modal, "title" should be unchecked and disabled. - Test that the "Select all" and "Clear all" links don't affect the "title" checkbox. - Confirm that your selections are saved correctly. --- admin/preferences.pl | 1 + .../prog/en/modules/admin/preferences.tt | 2 +- .../en/modules/admin/preferences/opac.pref | 2 ++ .../admin/preferences/suggestions.json | 1 + .../prog/js/pages/preferences.js | 18 +++++++++++--- .../bootstrap/en/modules/opac-suggestions.tt | 24 +++++++++---------- 6 files changed, 32 insertions(+), 16 deletions(-) diff --git a/admin/preferences.pl b/admin/preferences.pl index 9e697a6a03..f405419999 100755 --- a/admin/preferences.pl +++ b/admin/preferences.pl @@ -62,6 +62,7 @@ sub _get_chunk { if( $options{'type'} && $options{'type'} eq 'modalselect' ){ $chunk->{'source'} = $options{'source'}; $chunk->{'exclusions'} = $options{'exclusions'} // ""; + $chunk->{'required'} = $options{'required'} // ""; $chunk->{'type'} = 'modalselect'; } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt index 5f52994d3f..6842a59b13 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt @@ -130,7 +130,7 @@ [% END %] [% ELSIF ( CHUNK.type_modalselect ) %] - + [% ELSIF ( CHUNK.type_multiple ) %] - Required +
Required
[% ELSE %] @@ -90,7 +90,7 @@ [% IF ( author_required ) %] - Required +
Required
[% ELSE %] @@ -103,7 +103,7 @@ [% IF ( copyrightdate_required ) %] - Required +
Required
[% ELSE %] @@ -116,7 +116,7 @@ [% IF ( isbn_required ) %] - Required +
Required
[% ELSE %] @@ -128,7 +128,7 @@ [% IF ( publishercode_required ) %] - Required +
Required
[% ELSE %] @@ -140,7 +140,7 @@ [% IF ( collectiontitle_required ) %] - Required +
Required
[% ELSE %] @@ -152,7 +152,7 @@ [% IF ( place_required ) %] - Required +
Required
[% ELSE %] @@ -164,7 +164,7 @@ [% IF ( quantity_required ) %] - Required +
Required
[% ELSE %] @@ -176,7 +176,7 @@ [% IF ( itemtype_required ) %] [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20, required = 1, blank = 1 %] - Required +
Required
[% ELSE %] [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20, blank = 1 %] @@ -190,7 +190,7 @@ - Required +
Required
[% ELSE %] - Required +
Required
[% ELSE %] - Required +
Required
[% ELSE %] -- 2.20.1