Bug 31420: Managing funds: Labels of statistic fields overlap with pull downs
[koha-ffzg.git] / tools / upload.pl
index afb7c51..509e99b 100755 (executable)
@@ -21,8 +21,8 @@ use Modern::Perl;
 use CGI qw/-utf8/;
 use JSON;
 
-use C4::Auth;
-use C4::Output;
+use C4::Auth qw( get_template_and_user );
+use C4::Output qw( output_html_with_http_headers );
 use Koha::UploadedFiles;
 
 use constant ERR_READING     => 'UPLERR_FILE_NOT_READ';
@@ -36,12 +36,12 @@ 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 $browsecategory = $input->param('browsecategory');
 
 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
     {   template_name   => "tools/upload.tt",
         query           => $input,
         type            => "intranet",
-        authnotrequired => 0,
         flagsrequired   => { tools => 'upload_general_files' },
     }
 );
@@ -59,6 +59,23 @@ if ( $op eq 'new' ) {
     );
     output_html_with_http_headers $input, $cookie, $template->output;
 
+} elsif ( $op eq 'browse' ) {
+    my $uploads;
+    if ($browsecategory){
+        $uploads = Koha::UploadedFiles->search({
+            uploadcategorycode => $browsecategory,
+            $plugin? ( public => 1 ): (),
+        })->unblessed;
+    }
+
+    $template->param(
+        mode           => 'report',
+        msg            => $msg,
+        uploads        => $uploads,
+        browsecategory => $browsecategory,
+    );
+    output_html_with_http_headers $input, $cookie, $template->output;
+
 } elsif ( $op eq 'search' ) {
     my $uploads;
     if( $id ) { # might be a comma separated list