Bug 17600: Standardize our EXPORT_OK
[koha-ffzg.git] / opac / opac-addbybiblionumber.pl
index 9227fa0..176a1c4 100755 (executable)
 use Modern::Perl;
 
 use CGI qw ( -utf8 );
-use C4::Biblio;
-use C4::Output;
-use C4::Auth;
+use C4::Output qw( output_html_with_http_headers );
+use C4::Auth qw( get_template_and_user );
 
+use Koha::Biblios;
 use Koha::Virtualshelves;
 
-my $query           = new CGI;
+my $query           = CGI->new;
 my @biblionumbers   = $query->multi_param('biblionumber');
 my $selectedshelf   = $query->param('selectedshelf');
 my $newshelf        = $query->param('newshelf');
@@ -51,7 +51,6 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
     {   template_name   => "opac-addbybiblionumber.tt",
         query           => $query,
         type            => "opac",
-        authnotrequired => 0,
     }
 );
 
@@ -107,25 +106,26 @@ if ($newvirtualshelf) {
         my $private_shelves = Koha::Virtualshelves->search(
             {   category => 1,
                 owner    => $loggedinuser,
+                allow_change_from_owner => 1,
             },
             { order_by => 'shelfname' }
         );
         my $shelves_shared_with_me = Koha::Virtualshelves->search(
             {   category                            => 1,
                 'virtualshelfshares.borrowernumber' => $loggedinuser,
-                -or                                 => {
-                    allow_add => 1,
-                    owner     => $loggedinuser,
-                }
+                allow_change_from_others            => 1,
             },
             { join => 'virtualshelfshares', }
         );
         my $public_shelves = Koha::Virtualshelves->search(
             {   category => 2,
-                -or      => {
-                    allow_add => 1,
-                    owner     => $loggedinuser,
-                }
+                -or      => [
+                    -and => {
+                        allow_change_from_owner => 1,
+                        owner     => $loggedinuser,
+                    },
+                    allow_change_from_others => 1,
+                ],
             },
             { order_by => 'shelfname' }
         );
@@ -141,12 +141,16 @@ if ($newvirtualshelf) {
 
 if ($authorized) {
     for my $biblionumber (@biblionumbers) {
-        my $data = GetBiblioData($biblionumber);
+        my $biblio = Koha::Biblios->find( $biblionumber );
         push(
             @biblios,
             {   biblionumber => $biblionumber,
-                title        => $data->{'title'},
-                author       => $data->{'author'},
+                title        => $biblio->title,
+                subtitle     => $biblio->subtitle,
+                medium       => $biblio->medium,
+                part_number  => $biblio->part_number,
+                part_name    => $biblio->part_name,
+                author       => $biblio->author,
             }
         );
     }
@@ -162,4 +166,4 @@ if ($authorized) {
     );
 }
 $template->param( authorized => $authorized, errcode => $errcode, );
-output_html_with_http_headers $query, $cookie, $template->output;
+output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };