From 4ea34927a016720393175d0d41ac476261e9cec6 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Wed, 16 Sep 2015 14:06:59 +0200 Subject: [PATCH] Bug 14321: [QA Follow-up] Perltidy upload.pl Content-Type: text/plain; charset=utf-8 Run perltidy -pro=xt/perltidyrc on tools/upload.pl. No other changes. Signed-off-by: Marcel de Rooy --- tools/upload.pl | 63 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/tools/upload.pl b/tools/upload.pl index 47c28f5..5d9c8e7 100755 --- a/tools/upload.pl +++ b/tools/upload.pl @@ -25,13 +25,13 @@ use C4::Auth; use C4::Output; use Koha::Upload; -my $input = CGI::->new; -my $op = $input->param('op') // 'new'; +my $input = CGI::->new; +my $op = $input->param('op') // 'new'; my $plugin = $input->param('plugin'); -my $index = $input->param('index'); # MARC editor input field id -my $term = $input->param('term'); -my $id = $input->param('id'); -my $msg = $input->param('msg'); +my $index = $input->param('index'); # MARC editor input field id +my $term = $input->param('term'); +my $id = $input->param('id'); +my $msg = $input->param('msg'); my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { template_name => "tools/upload.tt", @@ -47,50 +47,53 @@ $template->param( index => $index, ); -my $upar = $plugin? { public => 1 }: {}; -if( $op eq 'new' ) { +my $upar = $plugin ? { public => 1 } : {}; +if ( $op eq 'new' ) { $template->param( - mode => 'new', + mode => 'new', uploadcategories => Koha::Upload->getCategories, ); output_html_with_http_headers $input, $cookie, $template->output; -} elsif( $op eq 'search' ) { - my $h = $id? { id => $id }: { term => $term }; - my @uploads = Koha::Upload->new( $upar )->get( $h ); +} elsif ( $op eq 'search' ) { + my $h = $id ? { id => $id } : { term => $term }; + my @uploads = Koha::Upload->new($upar)->get($h); $template->param( - mode => 'report', - msg => $msg, + mode => 'report', + msg => $msg, uploads => \@uploads, ); output_html_with_http_headers $input, $cookie, $template->output; -} elsif( $op eq 'delete' ) { +} elsif ( $op eq 'delete' ) { + # delete only takes the id parameter - my $upl = Koha::Upload->new( $upar ); - my ( $fn ) = $upl->delete({ id => $id }); + my $upl = Koha::Upload->new($upar); + my ($fn) = $upl->delete( { id => $id } ); my $e = $upl->err; - my $msg = $fn? JSON::to_json({ $fn => 6 }): - $e? JSON::to_json( $e ): undef; + my $msg = + $fn ? JSON::to_json( { $fn => 6 } ) + : $e ? JSON::to_json($e) + : undef; $template->param( - mode => 'deleted', - msg => $msg, + mode => 'deleted', + msg => $msg, uploadcategories => $upl->getCategories, ); output_html_with_http_headers $input, $cookie, $template->output; -} elsif( $op eq 'download' ) { - my $upl = Koha::Upload->new( $upar ); - my $rec = $upl->get({ id => $id, filehandle => 1 }); - my $fh = $rec->{fh}; - if( !$rec || !$fh ) { +} elsif ( $op eq 'download' ) { + my $upl = Koha::Upload->new($upar); + my $rec = $upl->get( { id => $id, filehandle => 1 } ); + my $fh = $rec->{fh}; + if ( !$rec || !$fh ) { $template->param( - mode => 'new', - msg => JSON::to_json({ $id => 5 }), + mode => 'new', + msg => JSON::to_json( { $id => 5 } ), uploadcategories => $upl->getCategories, ); output_html_with_http_headers $input, $cookie, $template->output; } else { my @hdr = $upl->httpheaders( $rec->{name} ); - print Encode::encode_utf8( $input->header( @hdr ) ); - while( <$fh> ) { + print Encode::encode_utf8( $input->header(@hdr) ); + while (<$fh>) { print $_; } $fh->close; -- 1.7.10.4