Koha/koha-tmpl/intranet-tmpl/prog/en/includes/av-build-dropbox.inc
Jonathan Druart bc235e72ce Bug 30603: Display Sort1 and Sort2 as free text if no AV exists
Test plan:
Don't define AV for Sort1 and Sort2, edit a patron
=> Should be editable via an input box

Define AVs for Sort1 and Sort2, edit a patron
=> Should see the dropdown

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2022-05-10 23:09:09 -10:00

28 lines
1.3 KiB
HTML

[% USE AuthorisedValues %]
[%# Parameters: %]
[%# name: the name of the select element %]
[%# category: the authorised value category %]
[%# default: the default authorised value to select %]
[%# class: the CSS class of the select element %]
[%# size: the size to use for the input (generated if the authorised value category does not exist). %]
[%# all: add a "All" entry. All and empty should not be used at the same time. %]
[%# empty: add an empty entry. All and empty should not be used at the same time. %]
[% SET avs = AuthorisedValues.GetAuthValueDropbox( category ) %]
[% DEFAULT class = '' size = 20 %]
[% IF avs.count %]
<select id="[% name | html %]" name="[% name | html %]" class="[% class | html %]" >
[% IF all %]<option value="">All</option>[% END %]
[% IF empty %]<option value=""></option>[% END %]
[% FOR av IN avs %]
[% IF av.authorised_value == default %]
<option value="[% av.authorised_value | html %]" selected="selected">[% av.lib | html_entity %]</option>
[% ELSE %]
<option value="[% av.authorised_value | html %]">[% av.lib | html_entity %]</option>
[% END %]
[% END %]
</select>
[% ELSE %]
<input type="text" id="[% name | html %]" name="[% name | html %]" size="[% size | html %]" value="[% default | html_entity %]" class="[% class | html %]" />
[% END %]