Bug 32336: (QA follow-up) Use $metadata->schema
[srvgit] / virtualshelves / addbybiblionumber.pl
index a60c88f..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.
 
-=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
 
@@ -59,18 +59,17 @@ addbybiblionumber.pl
 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 $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 );
@@ -87,7 +86,6 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
     {   template_name   => "virtualshelves/addbybiblionumber.tt",
         query           => $query,
         type            => "intranet",
-        authnotrequired => 0,
         flagsrequired   => { catalogue => 1 },
     }
 );
@@ -97,7 +95,7 @@ if ($newvirtualshelf) {
         Koha::Virtualshelf->new(
             {
                 shelfname => $newvirtualshelf,
-                category  => $category,
+                public    => $public,
                 sortfield => $sortfield,
                 owner     => $loggedinuser,
             }
@@ -151,21 +149,21 @@ if ($newvirtualshelf) {
 
 } 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(
-        {   category                            => 1,
+        {   public                              => 0,
             '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,