Bug 30588: (QA follow-up) Adjust flags for two_factor_auth.pl
[koha-ffzg.git] / virtualshelves / addbybiblionumber.pl
index 210e153..ff0ef50 100755 (executable)
@@ -44,9 +44,9 @@ addbybiblionumber.pl
     if this parameter exists, then it must be equals to the name of the shelf
     to add.
 
     if this parameter exists, then it must be equals to the name of the shelf
     to add.
 
-=item category
+=item public
 
 
-    if this script has to add a shelf, it add one with this category.
+    if this script has to add a shelf, it adds one with this 'public' setting.
 
 =item newshelf
 
 
 =item newshelf
 
@@ -59,17 +59,17 @@ addbybiblionumber.pl
 use Modern::Perl;
 
 use CGI qw ( -utf8 );
 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;
 
 use Koha::Virtualshelves;
 
-my $query           = new CGI;
+my $query           = CGI->new;
 my $shelfnumber     = $query->param('shelfnumber');
 my $newvirtualshelf = $query->param('newvirtualshelf');
 my $newshelf        = $query->param('newshelf');
 my $shelfnumber     = $query->param('shelfnumber');
 my $newvirtualshelf = $query->param('newvirtualshelf');
 my $newshelf        = $query->param('newshelf');
-my $category        = $query->param('category');
+my $public          = $query->param('public');
 my $sortfield       = $query->param('sortfield');
 my $confirmed       = $query->param('confirmed') || 0;
 my ( $errcode, $authorized ) = ( 0, 1 );
 my $sortfield       = $query->param('sortfield');
 my $confirmed       = $query->param('confirmed') || 0;
 my ( $errcode, $authorized ) = ( 0, 1 );
@@ -86,7 +86,6 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
     {   template_name   => "virtualshelves/addbybiblionumber.tt",
         query           => $query,
         type            => "intranet",
     {   template_name   => "virtualshelves/addbybiblionumber.tt",
         query           => $query,
         type            => "intranet",
-        authnotrequired => 0,
         flagsrequired   => { catalogue => 1 },
     }
 );
         flagsrequired   => { catalogue => 1 },
     }
 );
@@ -96,7 +95,7 @@ if ($newvirtualshelf) {
         Koha::Virtualshelf->new(
             {
                 shelfname => $newvirtualshelf,
         Koha::Virtualshelf->new(
             {
                 shelfname => $newvirtualshelf,
-                category  => $category,
+                public    => $public,
                 sortfield => $sortfield,
                 owner     => $loggedinuser,
             }
                 sortfield => $sortfield,
                 owner     => $loggedinuser,
             }
@@ -150,21 +149,21 @@ if ($newvirtualshelf) {
 
 } else {
     my $private_shelves = Koha::Virtualshelves->search(
 
 } else {
     my $private_shelves = Koha::Virtualshelves->search(
-        {   category => 1,
-            owner    => $loggedinuser,
+        {   public                  => 0,
+            owner                   => $loggedinuser,
             allow_change_from_owner => 1,
         },
         { order_by => 'shelfname' }
     );
     my $shelves_shared_with_me = Koha::Virtualshelves->search(
             allow_change_from_owner => 1,
         },
         { order_by => 'shelfname' }
     );
     my $shelves_shared_with_me = Koha::Virtualshelves->search(
-        {   category                            => 1,
+        {   public                              => 0,
             'virtualshelfshares.borrowernumber' => $loggedinuser,
             allow_change_from_others            => 1,
         },
         { join => 'virtualshelfshares', }
     );
     my $public_shelves = Koha::Virtualshelves->search(
             'virtualshelfshares.borrowernumber' => $loggedinuser,
             allow_change_from_others            => 1,
         },
         { join => 'virtualshelfshares', }
     );
     my $public_shelves = Koha::Virtualshelves->search(
-        {   category => 2,
+        {   public   => 1,
             -or      => [
                 -and => {
                     allow_change_from_owner => 1,
             -or      => [
                 -and => {
                     allow_change_from_owner => 1,
@@ -185,12 +184,12 @@ if ($newvirtualshelf) {
 
 my @biblios;
 for my $biblionumber (@biblionumbers) {
 
 my @biblios;
 for my $biblionumber (@biblionumbers) {
-    my $data = GetBiblioData($biblionumber);
+    my $biblio = Koha::Biblios->find( $biblionumber );
     push(
         @biblios,
         {   biblionumber => $biblionumber,
     push(
         @biblios,
         {   biblionumber => $biblionumber,
-            title        => $data->{'title'},
-            author       => $data->{'author'},
+            title        => $biblio->title,
+            author       => $biblio->author,
         }
     );
 }
         }
     );
 }