Lines 33-39
my $selectedshelf = $query->param('selectedshelf');
Link Here
|
33 |
my $newshelf = $query->param('newshelf'); |
33 |
my $newshelf = $query->param('newshelf'); |
34 |
my $shelfnumber = $query->param('shelfnumber'); |
34 |
my $shelfnumber = $query->param('shelfnumber'); |
35 |
my $newvirtualshelf = $query->param('newvirtualshelf'); |
35 |
my $newvirtualshelf = $query->param('newvirtualshelf'); |
36 |
my $category = $query->param('category'); |
36 |
my $public = $query->param('public'); |
37 |
my ( $errcode, $authorized ) = ( 0, 1 ); |
37 |
my ( $errcode, $authorized ) = ( 0, 1 ); |
38 |
my @biblios; |
38 |
my @biblios; |
39 |
|
39 |
|
Lines 56-65
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
Link Here
|
56 |
|
56 |
|
57 |
if ($newvirtualshelf) { |
57 |
if ($newvirtualshelf) { |
58 |
if ($loggedinuser > 0 |
58 |
if ($loggedinuser > 0 |
59 |
and ( $category == 1 |
59 |
and ( !$public |
60 |
or $category == 2 and $loggedinuser > 0 && C4::Context->preference('OpacAllowPublicListCreation') ) |
60 |
or $public and $loggedinuser > 0 && C4::Context->preference('OpacAllowPublicListCreation') ) |
61 |
) { |
61 |
) { |
62 |
my $shelf = eval { Koha::Virtualshelf->new( { shelfname => $newvirtualshelf, category => $category, owner => $loggedinuser, } )->store; }; |
62 |
my $shelf = eval { Koha::Virtualshelf->new( { shelfname => $newvirtualshelf, public => $public, owner => $loggedinuser, } )->store; }; |
63 |
if ( $@ or not $shelf ) { |
63 |
if ( $@ or not $shelf ) { |
64 |
$errcode = 1; |
64 |
$errcode = 1; |
65 |
$authorized = 0; |
65 |
$authorized = 0; |
Lines 104-124
if ($newvirtualshelf) {
Link Here
|
104 |
} else { |
104 |
} else { |
105 |
if ( $loggedinuser > 0 ) { |
105 |
if ( $loggedinuser > 0 ) { |
106 |
my $private_shelves = Koha::Virtualshelves->search( |
106 |
my $private_shelves = Koha::Virtualshelves->search( |
107 |
{ category => 1, |
107 |
{ public => 0, |
108 |
owner => $loggedinuser, |
108 |
owner => $loggedinuser, |
109 |
allow_change_from_owner => 1, |
109 |
allow_change_from_owner => 1, |
110 |
}, |
110 |
}, |
111 |
{ order_by => 'shelfname' } |
111 |
{ order_by => 'shelfname' } |
112 |
); |
112 |
); |
113 |
my $shelves_shared_with_me = Koha::Virtualshelves->search( |
113 |
my $shelves_shared_with_me = Koha::Virtualshelves->search( |
114 |
{ category => 1, |
114 |
{ public => 0, |
115 |
'virtualshelfshares.borrowernumber' => $loggedinuser, |
115 |
'virtualshelfshares.borrowernumber' => $loggedinuser, |
116 |
allow_change_from_others => 1, |
116 |
allow_change_from_others => 1, |
117 |
}, |
117 |
}, |
118 |
{ join => 'virtualshelfshares', } |
118 |
{ join => 'virtualshelfshares', } |
119 |
); |
119 |
); |
120 |
my $public_shelves = Koha::Virtualshelves->search( |
120 |
my $public_shelves = Koha::Virtualshelves->search( |
121 |
{ category => 2, |
121 |
{ public => 1, |
122 |
-or => [ |
122 |
-or => [ |
123 |
-and => { |
123 |
-and => { |
124 |
allow_change_from_owner => 1, |
124 |
allow_change_from_owner => 1, |