- my $h = $id ? { id => $id } : { term => $term };
- my @uploads = Koha::Upload->new($upar)->get($h);
+ my $uploads;
+ if( $id ) { # might be a comma separated list
+ my @id = split /,/, $id;
+ foreach my $recid (@id) {
+ my $rec = Koha::UploadedFiles->find( $recid );
+ push @$uploads, $rec->unblessed
+ if $rec && ( $rec->public || !$plugin );
+ # Do not show private uploads in the plugin mode (:editor)
+ }
+ } else {
+ $uploads = Koha::UploadedFiles->search_term({
+ term => $term,
+ $plugin? (): ( include_private => 1 ),
+ })->unblessed;
+ }
+