</li>
<li>
- <label for="guarantor_relationship">Relationship: </label>
- <select class="new_guarantor_relationship" name="new_guarantor_relationship">
+ [% UNLESS empty_relationship_allowed %]
+ <label for="guarantor_relationship" class="required">Relationship: </label>
+ <select class="new_guarantor_relationship" name="new_guarantor_relationship" required="required">
+ [% ELSE %]
+ <label for="guarantor_relationship">Relationship: </label>
+ <select class="new_guarantor_relationship" name="new_guarantor_relationship">
+ [% END %]
+ <option value="" selected>Empty option</option>
[% FOREACH pr IN possible_relationships.split('\|') %]
- <option value="[% pr | html %]">[% pr | html %]</option>
+ [% IF pr != "" %]
+ <option value="[% pr | html %]">[% pr | html %]</option>
+ [% END %]
[% END %]
</select>
+ [% UNLESS empty_relationship_allowed %]
+ <span class="required">Required</span>
+ [% END %]
</li>
<li>
</li>
<li>
- <label for="guarantor_relationship">Relationship: </label>
- <select class="new_guarantor_relationship" name="new_guarantor_relationship">
+ [% UNLESS empty_relationship_allowed %]
+ <label for="guarantor_relationship" class="required">Relationship: </label>
+ <select class="new_guarantor_relationship" name="new_guarantor_relationship" required="required">
+ [% ELSE %]
+ <label for="guarantor_relationship">Relationship: </label>
+ <select class="new_guarantor_relationship" name="new_guarantor_relationship">
+ [% END %]
+ <option value="" selected></option>
[% FOREACH pr IN possible_relationships.split('\|') %]
- <option value="[% pr | html %]">[% pr | html %]</option>
+ [% IF pr != "" %]
+ <option value="[% pr | html %]">[% pr | html %]</option>
+ [% END %]
[% END %]
</select>
+ [% UNLESS empty_relationship_allowed %]
+ <span class="required">Required</span>
+ [% END %]
</li>
<li>
## Deal with guarantor stuff
$template->param( relationships => scalar $patron->guarantor_relationships ) if $patron;
+my @relations = split /,|\|/, C4::Context->preference('borrowerRelationship');
+my $empty_relationship_allowed = grep {$_ eq ""} @relations;
+$template->param( empty_relationship_allowed => $empty_relationship_allowed );
+
my $guarantor_id = $input->param('guarantor_id');
my $guarantor = undef;
$guarantor = Koha::Patrons->find( $guarantor_id ) if $guarantor_id;