X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=admin%2Fauthorised_values.pl;h=2130e86819d2a8601febee31468a9fe2e273f18c;hb=b0767f5eb60f087cfd9fbaabb4454fc786e18438;hp=f99454e4047b195a23c1be4d4b876cb5a7e69283;hpb=e53667105d98dde0500323cb9699bf217c2f2508;p=koha-ffzg.git diff --git a/admin/authorised_values.pl b/admin/authorised_values.pl index f99454e404..2130e86819 100755 --- a/admin/authorised_values.pl +++ b/admin/authorised_values.pl @@ -78,10 +78,7 @@ if ($op eq 'add_form') { 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 { @@ -97,8 +94,13 @@ if ($op eq 'add_form') { } 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'); @@ -212,13 +214,15 @@ $template->param( 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 ||= ""; my @avs_by_category = Koha::AuthorisedValues->new->search( { category => $searchfield } )->as_list; my @loop_data = (); @@ -229,7 +233,7 @@ if ( $op eq 'list' ) { $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); @@ -238,7 +242,7 @@ if ( $op eq 'list' ) { $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, ); }