Bug 19466: Warn about conflicting settings of autoMemberNum and BorrowerMandatoryField for cardnumber

Changes the appearance of the cardnumber entry field in memberentrygen.tt
The "Leave empty for autocalc" message has been moved to the hint div
under the input field. If AutoMemberNum and BorrowerMandatoryField
interfere with each other, the auto calc hint is replace by a warning
telling the user that auto calc has been disabled.

Cardnumber should now correctly appear as mandatory if marked as such
in BorrowerMandatoryField.

Test plan:
0] Apply patch
1} Disable AutoMemberNum, remove cardnumber from BorrowerMandatoryField
2) Edit or create a patron, scroll down to cardnumber input field
    Hint is some form of "Cardnumber must be this long"
    Cardnumber input is not marked as required
    There is no mention of auto calc

3> Enable AutoMemberNum
    Hint includes "Leave empty for auto calc" message

4~ Add cardnumber to BorrowerMandatoryField
    Hint warns you that your sysprefs are conflicting.
    Cardnumber input is marked as required

5: Disable AutoMemberNum
    Hint is some form of "Cardnumber must be this long"
    Cardnumber input is marked as required

Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
David Bourgault 2017-12-21 10:20:48 -05:00 committed by Jonathan Druart
parent a845188c7d
commit 8df9ba7ec5

View file

@ -653,33 +653,39 @@ $(document).ready(function() {
<legend id="library_management_lgd">Library management</legend><ol>
[% UNLESS nocardnumber %]
<li>
[% IF mandatorycardnumber and not autoMemberNum %]
[% IF mandatorycardnumber %]
<label for="cardnumber" class="required">
[% ELSE %]
<label for="cardnumber" class="validated">
[% END %]
[% IF autoMemberNum %]
Card number<br>(<u>leave blank for auto calc during registration</u>): </label>
[% ELSE %]
Card number: </label>
[% END %]
Card number: </label>
<!-- NOTE: div.hint closing tag isn't on the same line -->
[% IF minlength_cardnumber == maxlength_cardnumber %]
<input type="text" id="cardnumber" name="cardnumber" size="20" value="[% cardnumber | html %]" minlength="[% minlength_cardnumber %]" maxlength="[% maxlength_cardnumber %]" />
[% IF mandatorycardnumber and not autoMemberNum %]<span class="required">Required</span>[% END %]<span id="cn_max" class="required">Card number must not be more than [% maxlength_cardnumber %] characters.</span>
<div class="hint">Card number must be exactly [% minlength_cardnumber %] characters.</div>
[% IF mandatorycardnumber %]<span class="required">Required</span>[% END %]<span id="cn_max" class="required">Card number must not be more than [% maxlength_cardnumber %] characters.</span>
<div class="hint">Card number must be exactly [% minlength_cardnumber %] characters.
[% ELSIF minlength_cardnumber && maxlength_cardnumber %]
<input type="text" id="cardnumber" name="cardnumber" size="20" value="[% cardnumber | html %]" minlength="[% minlength_cardnumber %]" maxlength="[% maxlength_cardnumber %]" />
[% IF mandatorycardnumber and not autoMemberNum %]<span class="required">Required</span>[% END %]<span id="cn_max" class="required">Card number must not be more than [% maxlength_cardnumber %] characters.</span>
<div class="hint">Card number must be between [% minlength_cardnumber %] and [% maxlength_cardnumber %] characters.</div>
[% IF mandatorycardnumber %]<span class="required">Required</span>[% END %]<span id="cn_max" class="required">Card number must not be more than [% maxlength_cardnumber %] characters.</span>
<div class="hint">Card number must be between [% minlength_cardnumber %] and [% maxlength_cardnumber %] characters.
[% ELSIF maxlength_cardnumber %]
<input type="text" id="cardnumber" name="cardnumber" size="20" value="[% cardnumber | html %]" maxlength="[% maxlength_cardnumber %]" />
[% IF mandatorycardnumber and not autoMemberNum %]<span class="required">Required</span>[% END %]<span id="cn_max" class="required">Card number must not be more than [% maxlength_cardnumber %] characters.</span>
<div class="hint">Card number can be up to [% maxlength_cardnumber %] characters.</div>
[% IF mandatorycardnumber %]<span class="required">Required</span>[% END %]<span id="cn_max" class="required">Card number must not be more than [% maxlength_cardnumber %] characters.</span>
<div class="hint">Card number can be up to [% maxlength_cardnumber %] characters.
[% ELSE %]
<input type="text" id="cardnumber" name="cardnumber" size="20" value="[% cardnumber | html %]" />
[% IF mandatorycardnumber and not autoMemberNum %]<span class="required">Required</span>[% END %]
<div class="hint">There is no minimum or maximum character length.</div>
[% IF mandatorycardnumber %]<span class="required">Required</span>[% END %]
<div class="hint">There is no minimum or maximum character length.
[% END %]
[% IF autoMemberNum %]
[% IF mandatorycardnumber %]
<br/><span class="error">AutoMemberNum is set to enabled, but cardnumber is marked as mandatory in BorrowerMandatoryField: auto calc has been disabled.</span>
[% ELSE %]
<br/>Leave empty for auto calc during registration
[% END %]
[% END %]
</div><!--/hint div -->
</li>
[% END %]
[% UNLESS nobranchcode %]