if ( $av ) {
$template->param(
category_name => $av->category,
- authorised_value => $av->authorised_value,
- lib => $av->lib,
- lib_opac => $av->lib_opac,
- id => $av->id,
+ av => $av,
imagesets => C4::Koha::getImageSets( checked => $av->imageurl ),
);
} else {
} elsif ($op eq 'add') {
my $new_authorised_value = $input->param('authorised_value');
my $new_category = $input->param('category');
- my $imageurl = $input->param( 'imageurl' ) || '';
- $imageurl = '' if $imageurl =~ /removeImage/;
+ my $image = $input->param( 'image' ) || '';
+ my $imageurl =
+ $image eq 'removeImage' ? ''
+ : (
+ $image eq 'remoteImage' ? $input->param('remoteImage')
+ : $image
+ );
my $duplicate_entry = 0;
my @branches = grep { $_ ne q{} } $input->multi_param('branches');
if ( $op eq 'list' ) {
# build categories list
- my @categories = Koha::AuthorisedValueCategories->search({ category_name => { -not_in => ['', 'branches', 'itemtypes', 'cn_source']}}, { order_by => ['category_name'] } )->as_list;
- my @category_list;
- for my $category ( @categories ) {
- push( @category_list, $category->category_name );
- }
+ my @category_names = Koha::AuthorisedValueCategories->search(
+ {
+ category_name =>
+ { -not_in => [ '', 'branches', 'itemtypes', 'cn_source' ] }
+ },
+ { order_by => ['category_name'] }
+ )->get_column('category_name');
- $searchfield ||= $category_list[0];
+ $searchfield ||= $category_names[0];
my @avs_by_category = Koha::AuthorisedValues->new->search( { category => $searchfield } )->as_list;
my @loop_data = ();
$row_data{authorised_value} = $av->authorised_value;
$row_data{lib} = $av->lib;
$row_data{lib_opac} = $av->lib_opac;
- $row_data{imageurl} = getitemtypeimagelocation( 'intranet', $av->imageurl );
+ $row_data{image} = getitemtypeimagelocation( 'intranet', $av->imageurl );
$row_data{branches} = $av->library_limits ? $av->library_limits->as_list : [];
$row_data{id} = $av->id;
push(@loop_data, \%row_data);
$template->param(
loop => \@loop_data,
category => Koha::AuthorisedValueCategories->find($searchfield), # TODO Move this up and add a Koha::AVC->authorised_values method to replace call for avs_by_category
- categories => \@category_list,
+ category_names => \@category_names,
);
}