Browse Source

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 <david@davidnind.com>

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 <david@davidnind.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
20.11.x
Jonathan Druart 5 years ago
parent
commit
810972db7a
  1. 19
      koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
  2. 1
      members/memberentry.pl

19
koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt

@ -1367,11 +1367,17 @@ legend:hover {
[% END %]
[% FOREACH patron_attribute IN pa_loo.items %]
<li data-category_code="[% patron_attribute.category_code | html %]">
<label for="[% patron_attribute.form_id | html %]">
[% patron_attribute.description | html %]:
</label>
[% IF patron_attribute.mandatory %]
<label for="[% patron_attribute.form_id | html %]" class="required" required="required">[% patron_attribute.description | html %]: </label>
[% ELSE %]
<label for="[% patron_attribute.form_id | html %]">[% patron_attribute.description | html %]: </label>
[% END %]
[% IF ( patron_attribute.use_dropdown ) %]
<select id="[% patron_attribute.form_id | html %]" name="[% patron_attribute.form_id | html %]">
[% IF patron_attribute.mandatory %]
<select id="[% patron_attribute.form_id | html %]" name="[% patron_attribute.form_id | html %]" required="required">
[% ELSE %]
<select id="[% patron_attribute.form_id | html %]" name="[% patron_attribute.form_id | html %]">
[% END %]
<option value=""></option>
[% FOREACH auth_val_loo IN patron_attribute.auth_val_loop %]
[% IF auth_val_loo.authorised_value == patron_attribute.value %]
@ -1386,13 +1392,18 @@ legend:hover {
[% END %]
</select>
[% ELSE %]
[% IF patron_attribute.mandatory %]
<textarea rows="2" cols="30" id="[% patron_attribute.form_id | html %]" name="[% patron_attribute.form_id | html %]" required="required">[% patron_attribute.value | html %]</textarea>
[% ELSE %]
<textarea rows="2" cols="30" id="[% patron_attribute.form_id | html %]" name="[% patron_attribute.form_id | html %]">[% patron_attribute.value | html %]</textarea>
[% END %]
[% END # /IF ( patron_attribute.use_dropdown ) %]
<input type="hidden" id="[% patron_attribute.form_id | html %]_code" name="[% patron_attribute.form_id | html %]_code" value="[% patron_attribute.code | html %]" />
<a href="#" class="clear_attribute"><i class="fa fa-fw fa-trash"></i> Clear</a>
[% IF ( patron_attribute.repeatable ) %]
<a href="#" class="clone_attribute"><i class="fa fa-fw fa-plus"></i> New</a>
[% END %]
[% IF patron_attribute.mandatory %]<span class="required">Required</span>[% END %]
</li>
[% END # /FOREACH patron_attribute %]
[% IF pa_loo.class %]</fieldset>[% END %]

1
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()} }) {

Loading…
Cancel
Save