From adc3772204f3c9d5f95866c1e4b90d81198671fc Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Wed, 8 Sep 2021 16:44:16 -0300 Subject: [PATCH] Bug 28959: (follow-up) Adjust all places in which 'category' was used MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Tomas Cohen Arazi Signed-off-by: David Nind Signed-off-by: Joonas Kylmälä Signed-off-by: Jonathan Druart --- C4/Auth.pm | 8 ++++---- Koha/BackgroundJob/BatchUpdateBiblio.pm | 6 ++++-- catalogue/ISBDdetail.pl | 4 ++-- catalogue/MARCdetail.pl | 4 ++-- catalogue/detail.pl | 4 ++-- catalogue/labeledMARCdetail.pl | 4 ++-- catalogue/moredetail.pl | 4 ++-- catalogue/search.pl | 4 ++-- opac/opac-addbybiblionumber.pl | 14 +++++++------- opac/opac-detail.pl | 2 +- opac/opac-search.pl | 4 ++-- 11 files changed, 30 insertions(+), 28 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index a9bd7fe365..d6cd32d3eb 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -287,12 +287,12 @@ sub get_template_and_user { my $some_private_shelves = Koha::Virtualshelves->get_some_shelves( { borrowernumber => $borrowernumber, - category => 1, + public => 0, } ); my $some_public_shelves = Koha::Virtualshelves->get_some_shelves( { - category => 2, + public => 1, } ); $template->param( @@ -431,7 +431,7 @@ sub get_template_and_user { require Koha::Virtualshelves; my $some_public_shelves = Koha::Virtualshelves->get_some_shelves( { - category => 2, + public => 1, } ); $template->param( @@ -1329,7 +1329,7 @@ sub checkauth { require Koha::Virtualshelves; my $some_public_shelves = Koha::Virtualshelves->get_some_shelves( { - category => 2, + public => 1, } ); $template->param( diff --git a/Koha/BackgroundJob/BatchUpdateBiblio.pm b/Koha/BackgroundJob/BatchUpdateBiblio.pm index 013fecbb1a..8ab1000837 100644 --- a/Koha/BackgroundJob/BatchUpdateBiblio.pm +++ b/Koha/BackgroundJob/BatchUpdateBiblio.pm @@ -156,10 +156,12 @@ sub additional_report { my $loggedinuser = C4::Context->userenv ? C4::Context->userenv->{'number'} : undef; return { lists => scalar Koha::Virtualshelves->search( - [ { category => 1, owner => $loggedinuser }, { category => 2 } ] + [ + { public => 0, owner => $loggedinuser }, + { public => 1 } + ] ), }; - } 1; diff --git a/catalogue/ISBDdetail.pl b/catalogue/ISBDdetail.pl index 969aca17a0..d991d3e799 100755 --- a/catalogue/ISBDdetail.pl +++ b/catalogue/ISBDdetail.pl @@ -152,14 +152,14 @@ my $some_private_shelves = Koha::Virtualshelves->get_some_shelves( { borrowernumber => $loggedinuser, add_allowed => 1, - category => 1, + public => 0, } ); my $some_public_shelves = Koha::Virtualshelves->get_some_shelves( { borrowernumber => $loggedinuser, add_allowed => 1, - category => 2, + public => 1, } ); diff --git a/catalogue/MARCdetail.pl b/catalogue/MARCdetail.pl index 7ddbbd40dd..4ff6a03c54 100755 --- a/catalogue/MARCdetail.pl +++ b/catalogue/MARCdetail.pl @@ -344,14 +344,14 @@ my $some_private_shelves = Koha::Virtualshelves->get_some_shelves( { borrowernumber => $loggedinuser, add_allowed => 1, - category => 1, + public => 0, } ); my $some_public_shelves = Koha::Virtualshelves->get_some_shelves( { borrowernumber => $loggedinuser, add_allowed => 1, - category => 2, + public => 1, } ); diff --git a/catalogue/detail.pl b/catalogue/detail.pl index 0c2bc884d2..f5d9582da9 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -434,14 +434,14 @@ my $some_private_shelves = Koha::Virtualshelves->get_some_shelves( { borrowernumber => $borrowernumber, add_allowed => 1, - category => 1, + public => 0, } ); my $some_public_shelves = Koha::Virtualshelves->get_some_shelves( { borrowernumber => $borrowernumber, add_allowed => 1, - category => 2, + public => 1, } ); diff --git a/catalogue/labeledMARCdetail.pl b/catalogue/labeledMARCdetail.pl index a8f33a674f..785c292154 100755 --- a/catalogue/labeledMARCdetail.pl +++ b/catalogue/labeledMARCdetail.pl @@ -138,14 +138,14 @@ my $some_private_shelves = Koha::Virtualshelves->get_some_shelves( { borrowernumber => $loggedinuser, add_allowed => 1, - category => 1, + public => 0, } ); my $some_public_shelves = Koha::Virtualshelves->get_some_shelves( { borrowernumber => $loggedinuser, add_allowed => 1, - category => 2, + public => 1, } ); diff --git a/catalogue/moredetail.pl b/catalogue/moredetail.pl index e033a2105b..cff2460a27 100755 --- a/catalogue/moredetail.pl +++ b/catalogue/moredetail.pl @@ -278,14 +278,14 @@ my $some_private_shelves = Koha::Virtualshelves->get_some_shelves( { borrowernumber => $loggedinuser, add_allowed => 1, - category => 1, + public => 0, } ); my $some_public_shelves = Koha::Virtualshelves->get_some_shelves( { borrowernumber => $loggedinuser, add_allowed => 1, - category => 2, + public => 1, } ); diff --git a/catalogue/search.pl b/catalogue/search.pl index c0063a1b40..5da9c063f3 100755 --- a/catalogue/search.pl +++ b/catalogue/search.pl @@ -683,14 +683,14 @@ my $some_private_shelves = Koha::Virtualshelves->get_some_shelves( { borrowernumber => $borrowernumber, add_allowed => 1, - category => 1, + public => 0, } ); my $some_public_shelves = Koha::Virtualshelves->get_some_shelves( { borrowernumber => $borrowernumber, add_allowed => 1, - category => 2, + public => 1, } ); diff --git a/opac/opac-addbybiblionumber.pl b/opac/opac-addbybiblionumber.pl index 176a1c4fd2..7dfe42cc14 100755 --- a/opac/opac-addbybiblionumber.pl +++ b/opac/opac-addbybiblionumber.pl @@ -33,7 +33,7 @@ my $selectedshelf = $query->param('selectedshelf'); my $newshelf = $query->param('newshelf'); my $shelfnumber = $query->param('shelfnumber'); my $newvirtualshelf = $query->param('newvirtualshelf'); -my $category = $query->param('category'); +my $public = $query->param('public'); my ( $errcode, $authorized ) = ( 0, 1 ); my @biblios; @@ -56,10 +56,10 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( if ($newvirtualshelf) { if ($loggedinuser > 0 - and ( $category == 1 - or $category == 2 and $loggedinuser > 0 && C4::Context->preference('OpacAllowPublicListCreation') ) + and ( !$public + or $public and $loggedinuser > 0 && C4::Context->preference('OpacAllowPublicListCreation') ) ) { - my $shelf = eval { Koha::Virtualshelf->new( { shelfname => $newvirtualshelf, category => $category, owner => $loggedinuser, } )->store; }; + my $shelf = eval { Koha::Virtualshelf->new( { shelfname => $newvirtualshelf, public => $public, owner => $loggedinuser, } )->store; }; if ( $@ or not $shelf ) { $errcode = 1; $authorized = 0; @@ -104,21 +104,21 @@ if ($newvirtualshelf) { } else { if ( $loggedinuser > 0 ) { my $private_shelves = Koha::Virtualshelves->search( - { category => 1, + { 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, diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 73ea3b46a0..69b791e1d5 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -924,7 +924,7 @@ if (C4::Context->preference("virtualshelves") ) { my $shelves = Koha::Virtualshelves->search( { biblionumber => $biblionumber, - category => 2, + public => 1, }, { join => 'virtualshelfcontents', diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 22e97da817..8f93d68984 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -854,14 +854,14 @@ my $some_private_shelves = Koha::Virtualshelves->get_some_shelves( { borrowernumber => $borrowernumber, add_allowed => 1, - category => 1, + public => 0, } ); my $some_public_shelves = Koha::Virtualshelves->get_some_shelves( { borrowernumber => $borrowernumber, add_allowed => 1, - category => 2, + public => 1, } ); -- 2.39.5