From a08a5d1698febd214d33103ff15eac33aaf98682 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 17 May 2019 09:30:02 -0500 Subject: [PATCH] Bug 22844: Make the attribute mandatory when editing a patron Note: I am not confident with this patch, I think it's not polished. I will not have time to improve it to make it ready for 19.05.00 1. Conflict with bug 20443 (which would have make this change way much easier!) 2. It does not work :) You will be able to submit the memberentry form even if the patron attribute is marked as mandatory (??) 3. What about the OPAC? 4. What about repeatable fields? We certainly will need JS code here 5. What about the "Quick add" feature? (I had trouble in the past to not introduce regression when we played with this template...) Do not forget to run updatedatabase.pl and regenerate DBIC schema if you want to play with this patchset. Signed-off-by: David Nind Bug 22844: (follow-up) Make the attribute mandatory when editing a patron Previous patch forgot the most important, adding the required attribute to the select/textarea Signed-off-by: David Nind Signed-off-by: Kyle M Hall Signed-off-by: Victor Grousset/tuxayo Signed-off-by: Katrin Fischer --- .../prog/en/modules/members/memberentrygen.tt | 19 +++++++++++++++---- members/memberentry.pl | 1 + 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt index 9ff3b1a8e7..0014a0f612 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -1367,11 +1367,17 @@ legend:hover { [% END %] [% FOREACH patron_attribute IN pa_loo.items %]
  • - + [% IF patron_attribute.mandatory %] + + [% ELSE %] + + [% END %] [% IF ( patron_attribute.use_dropdown ) %] - + [% ELSE %] + [% ELSE %] + [% IF patron_attribute.mandatory %] + + [% ELSE %] + [% END %] [% END # /IF ( patron_attribute.use_dropdown ) %] Clear [% IF ( patron_attribute.repeatable ) %] New [% END %] + [% IF patron_attribute.mandatory %]Required[% END %]
  • [% END # /FOREACH patron_attribute %] [% IF pa_loo.class %][% END %] diff --git a/members/memberentry.pl b/members/memberentry.pl index ec6c08c4c5..985a96446c 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -913,6 +913,7 @@ sub patron_attributes_form { repeatable => $attr_type->repeatable(), category => $attr_type->authorised_value_category(), category_code => $attr_type->category_code(), + mandatory => $attr_type->mandatory(), }; if (exists $attr_hash{$attr_type->code()}) { foreach my $attr (@{ $attr_hash{$attr_type->code()} }) { -- 2.11.0