# open template
my ($template, $loggedinuser, $cookie)
- = get_template_and_user({template_name => "admin/marctagstructure.tmpl",
+ = get_template_and_user({template_name => "admin/marctagstructure.tt",
query => $input,
type => "intranet",
authnotrequired => 0,
$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);
$template->param('use_heading_flags_p' => 1);
$template->param(liblibrarian => $data->{'liblibrarian'},
libopac => $data->{'libopac'},
- repeatable => CGI::checkbox(-name=>'repeatable',
- -checked=> $data->{'repeatable'}?'checked':'',
- -value=> 1,
- -label => '',
- -id=> 'repeatable'),
- mandatory => CGI::checkbox(-name => 'mandatory',
- -checked => $data->{'mandatory'}?'checked':'',
- -value => 1,
- -label => '',
- -id => 'mandatory'),
+ repeatable => $data->{'repeatable'},
+ mandatory => $data->{'mandatory'},
authorised_value => $authorised_value,
frameworkcode => $frameworkcode,
); # FIXME: move checkboxes to presentation layer
my $repeatable = $input->param('repeatable') ? 1 : 0;
my $mandatory = $input->param('mandatory') ? 1 : 0;
my $authorised_value = $input->param('authorised_value');
- unless (C4::Context->config('demo') == 1) {
+ unless (C4::Context->config('demo')) {
if ($input->param('modif')) {
$sth = $dbh->prepare(
"UPDATE marc_tag_structure SET liblibrarian=? ,libopac=? ,repeatable=? ,mandatory=? ,authorised_value=? WHERE frameworkcode=? AND tagfield=?"
################## DELETE_CONFIRMED ##################################
# called by delete_confirm, used to effectively confirm deletion of data in DB
} elsif ($op eq 'delete_confirmed') {
- unless (C4::Context->config('demo') == 1) {
+ unless (C4::Context->config('demo')) {
my $sth1 = $dbh->prepare("DELETE FROM marc_tag_structure WHERE tagfield=? AND frameworkcode=?");
my $sth2 = $dbh->prepare("DELETE FROM marc_subfield_structure WHERE tagfield=? AND frameworkcode=?");
$sth1->execute($searchfield, $frameworkcode);