From a1533359f843893b5604f21f2cecf6facddf6cfb Mon Sep 17 00:00:00 2001 From: Paul Poulain Date: Thu, 2 Feb 2012 10:17:43 +0100 Subject: [PATCH] Bug 6933 follow-up, perltyding new script list.pl --- tags/list.pl | 76 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 44 insertions(+), 32 deletions(-) diff --git a/tags/list.pl b/tags/list.pl index 7b16ce5052..6a363ac112 100755 --- a/tags/list.pl +++ b/tags/list.pl @@ -30,7 +30,8 @@ use C4::Koha; use C4::Tags 0.03 qw(get_tags remove_tag get_tag_rows); use C4::Output; -my $needed_flags = { tools => 'moderate_tags' }; # FIXME: replace when more specific permission is created. +my $needed_flags = { tools => 'moderate_tags' +}; # FIXME: replace when more specific permission is created. my $query = CGI->new; my $op = $query->param('op') || ''; @@ -38,44 +39,55 @@ my $biblionumber = $query->param('biblionumber'); my $tag = $query->param('tag'); my $tag_id = $query->param('tag_id'); -my ($template, $borrowernumber, $cookie) = get_template_and_user({ - template_name => "tags/list.tmpl", - query => $query, - type => "intranet", - debug => 1, +my ( $template, $borrowernumber, $cookie ) = get_template_and_user( + { + template_name => "tags/list.tmpl", + query => $query, + type => "intranet", + debug => 1, authnotrequired => 0, - flagsrequired => $needed_flags, -}); + flagsrequired => $needed_flags, + } +); -if( $op eq "del" ){ - remove_tag($tag_id); - print $query->redirect("/cgi-bin/koha/tags/list.pl?tag=$tag"); -} else { +if ( $op eq "del" ) { + remove_tag($tag_id); + print $query->redirect("/cgi-bin/koha/tags/list.pl?tag=$tag"); +} +else { -my $marcflavour = C4::Context->preference('marcflavour'); -my @results; + my $marcflavour = C4::Context->preference('marcflavour'); + my @results; -if ($tag) { - my $taglist = get_tag_rows({term=>$tag}); + if ($tag) { + my $taglist = get_tag_rows( { term => $tag } ); for ( @{$taglist} ) { - my $dat = &GetBiblioData($_->{biblionumber}); - my $record = &GetMarcBiblio($_->{biblionumber}); - $dat->{'subtitle'} = GetRecordValue('subtitle', $record, GetFrameworkCode($_->{biblionumber})); - my @items = GetItemsInfo( $_->{biblionumber} ); - $dat->{biblionumber} = $_->{biblionumber}; - $dat->{tag_id} = $_->{tag_id}; - $dat->{items} = \@items; - $dat->{TagLoop} = get_tags({biblionumber=>$_->{biblionumber}, 'sort'=>'-weight',limit=>10 }); - push( @results, $dat ); - } + my $dat = &GetBiblioData( $_->{biblionumber} ); + my $record = &GetMarcBiblio( $_->{biblionumber} ); + $dat->{'subtitle'} = + GetRecordValue( 'subtitle', $record, + GetFrameworkCode( $_->{biblionumber} ) ); + my @items = GetItemsInfo( $_->{biblionumber} ); + $dat->{biblionumber} = $_->{biblionumber}; + $dat->{tag_id} = $_->{tag_id}; + $dat->{items} = \@items; + $dat->{TagLoop} = get_tags( + { + biblionumber => $_->{biblionumber}, + 'sort' => '-weight', + limit => 10 + } + ); + push( @results, $dat ); + } -my $resultsarray = \@results; + my $resultsarray = \@results; -$template->param( - tag => $tag, - titles => $resultsarray, -); -} + $template->param( + tag => $tag, + titles => $resultsarray, + ); + } } output_html_with_http_headers $query, $cookie, $template->output; -- 2.39.5