$sth->execute($searchfield,$frameworkcode);
$data=$sth->fetchrow_hashref;
}
- my $sth = $dbh->prepare("select distinct category from authorised_values");
- $sth->execute;
- my @authorised_values;
- push @authorised_values,"";
- while ((my $category) = $sth->fetchrow_array) {
- push @authorised_values, $category;
- }
- my $authorised_value = CGI::scrolling_list(-name=>'authorised_value',
- -values=> \@authorised_values,
- -size=>1,
- -id=>"authorised_value",
- -multiple=>0,
- -default => $data->{'authorised_value'},
- );
+
+ my @authorised_values = @{C4::Koha::GetAuthorisedValueCategories()}; # function returns array ref, dereferencing
+ unshift @authorised_values, ""; # put empty value first
+ my $authorised_value = {
+ values => \@authorised_values,
+ default => $data->{'authorised_value'},
+ };
if ($searchfield) {
$template->param(searchfield => $searchfield);
<input type="checkbox" name="mandatory" id="mandatory" value="1" />
[% END %]
</li>
- <li><label for="authorised_value">Authorized value: </label>[% authorised_value %] (if you select a value here, the indicators will be limited to the authorized value list)</li>
+ <li><label for="authorised_value">Authorized value: </label>
+ <select name="authorised_value" id="authorised_value" size="1">
+ [% FOREACH value IN authorised_value.values %]
+ [% IF ( value == authorised_value.default ) %]
+ <option value="[% value %]" selected="selected">[% value %]</option>
+ [% ELSE %]
+ <option value="[% value %]">[% value %]</option>
+ [% END %]
+ [% END %]
+ </select>
+ (if you select a value here, the indicators will be limited to the authorized value list)</li>
</ol></fieldset>
<fieldset class="action">
<input type="submit" value="Save changes" />