View | Details | Raw Unified | Return to bug 28959
Collapse All | Expand All

(-)a/C4/Auth.pm (-4 / +4 lines)
Lines 287-298 sub get_template_and_user { Link Here
287
            my $some_private_shelves = Koha::Virtualshelves->get_some_shelves(
287
            my $some_private_shelves = Koha::Virtualshelves->get_some_shelves(
288
                {
288
                {
289
                    borrowernumber => $borrowernumber,
289
                    borrowernumber => $borrowernumber,
290
                    category       => 1,
290
                    public         => 0,
291
                }
291
                }
292
            );
292
            );
293
            my $some_public_shelves = Koha::Virtualshelves->get_some_shelves(
293
            my $some_public_shelves = Koha::Virtualshelves->get_some_shelves(
294
                {
294
                {
295
                    category       => 2,
295
                    public => 1,
296
                }
296
                }
297
            );
297
            );
298
            $template->param(
298
            $template->param(
Lines 431-437 sub get_template_and_user { Link Here
431
            require Koha::Virtualshelves;
431
            require Koha::Virtualshelves;
432
            my $some_public_shelves = Koha::Virtualshelves->get_some_shelves(
432
            my $some_public_shelves = Koha::Virtualshelves->get_some_shelves(
433
                {
433
                {
434
                    category       => 2,
434
                    public => 1,
435
                }
435
                }
436
            );
436
            );
437
            $template->param(
437
            $template->param(
Lines 1329-1335 sub checkauth { Link Here
1329
        require Koha::Virtualshelves;
1329
        require Koha::Virtualshelves;
1330
        my $some_public_shelves = Koha::Virtualshelves->get_some_shelves(
1330
        my $some_public_shelves = Koha::Virtualshelves->get_some_shelves(
1331
            {
1331
            {
1332
                category       => 2,
1332
                public => 1,
1333
            }
1333
            }
1334
        );
1334
        );
1335
        $template->param(
1335
        $template->param(
(-)a/Koha/BackgroundJob/BatchUpdateBiblio.pm (-2 / +4 lines)
Lines 156-165 sub additional_report { Link Here
156
    my $loggedinuser = C4::Context->userenv ? C4::Context->userenv->{'number'} : undef;
156
    my $loggedinuser = C4::Context->userenv ? C4::Context->userenv->{'number'} : undef;
157
    return {
157
    return {
158
        lists => scalar Koha::Virtualshelves->search(
158
        lists => scalar Koha::Virtualshelves->search(
159
            [ { category => 1, owner => $loggedinuser }, { category => 2 } ]
159
            [
160
                { public => 0, owner => $loggedinuser },
161
                { public => 1 }
162
            ]
160
        ),
163
        ),
161
    };
164
    };
162
163
}
165
}
164
166
165
1;
167
1;
(-)a/catalogue/ISBDdetail.pl (-2 / +2 lines)
Lines 152-165 my $some_private_shelves = Koha::Virtualshelves->get_some_shelves( Link Here
152
    {
152
    {
153
        borrowernumber => $loggedinuser,
153
        borrowernumber => $loggedinuser,
154
        add_allowed    => 1,
154
        add_allowed    => 1,
155
        category       => 1,
155
        public         => 0,
156
    }
156
    }
157
);
157
);
158
my $some_public_shelves = Koha::Virtualshelves->get_some_shelves(
158
my $some_public_shelves = Koha::Virtualshelves->get_some_shelves(
159
    {
159
    {
160
        borrowernumber => $loggedinuser,
160
        borrowernumber => $loggedinuser,
161
        add_allowed    => 1,
161
        add_allowed    => 1,
162
        category       => 2,
162
        public         => 1,
163
    }
163
    }
164
);
164
);
165
165
(-)a/catalogue/MARCdetail.pl (-2 / +2 lines)
Lines 344-357 my $some_private_shelves = Koha::Virtualshelves->get_some_shelves( Link Here
344
    {
344
    {
345
        borrowernumber => $loggedinuser,
345
        borrowernumber => $loggedinuser,
346
        add_allowed    => 1,
346
        add_allowed    => 1,
347
        category       => 1,
347
        public         => 0,
348
    }
348
    }
349
);
349
);
350
my $some_public_shelves = Koha::Virtualshelves->get_some_shelves(
350
my $some_public_shelves = Koha::Virtualshelves->get_some_shelves(
351
    {
351
    {
352
        borrowernumber => $loggedinuser,
352
        borrowernumber => $loggedinuser,
353
        add_allowed    => 1,
353
        add_allowed    => 1,
354
        category       => 2,
354
        public         => 1,
355
    }
355
    }
356
);
356
);
357
357
(-)a/catalogue/detail.pl (-2 / +2 lines)
Lines 434-447 my $some_private_shelves = Koha::Virtualshelves->get_some_shelves( Link Here
434
    {
434
    {
435
        borrowernumber => $borrowernumber,
435
        borrowernumber => $borrowernumber,
436
        add_allowed    => 1,
436
        add_allowed    => 1,
437
        category       => 1,
437
        public         => 0,
438
    }
438
    }
439
);
439
);
440
my $some_public_shelves = Koha::Virtualshelves->get_some_shelves(
440
my $some_public_shelves = Koha::Virtualshelves->get_some_shelves(
441
    {
441
    {
442
        borrowernumber => $borrowernumber,
442
        borrowernumber => $borrowernumber,
443
        add_allowed    => 1,
443
        add_allowed    => 1,
444
        category       => 2,
444
        public         => 1,
445
    }
445
    }
446
);
446
);
447
447
(-)a/catalogue/labeledMARCdetail.pl (-2 / +2 lines)
Lines 138-151 my $some_private_shelves = Koha::Virtualshelves->get_some_shelves( Link Here
138
    {
138
    {
139
        borrowernumber => $loggedinuser,
139
        borrowernumber => $loggedinuser,
140
        add_allowed    => 1,
140
        add_allowed    => 1,
141
        category       => 1,
141
        public         => 0,
142
    }
142
    }
143
);
143
);
144
my $some_public_shelves = Koha::Virtualshelves->get_some_shelves(
144
my $some_public_shelves = Koha::Virtualshelves->get_some_shelves(
145
    {
145
    {
146
        borrowernumber => $loggedinuser,
146
        borrowernumber => $loggedinuser,
147
        add_allowed    => 1,
147
        add_allowed    => 1,
148
        category       => 2,
148
        public         => 1,
149
    }
149
    }
150
);
150
);
151
151
(-)a/catalogue/moredetail.pl (-2 / +2 lines)
Lines 278-291 my $some_private_shelves = Koha::Virtualshelves->get_some_shelves( Link Here
278
    {
278
    {
279
        borrowernumber => $loggedinuser,
279
        borrowernumber => $loggedinuser,
280
        add_allowed    => 1,
280
        add_allowed    => 1,
281
        category       => 1,
281
        public         => 0,
282
    }
282
    }
283
);
283
);
284
my $some_public_shelves = Koha::Virtualshelves->get_some_shelves(
284
my $some_public_shelves = Koha::Virtualshelves->get_some_shelves(
285
    {
285
    {
286
        borrowernumber => $loggedinuser,
286
        borrowernumber => $loggedinuser,
287
        add_allowed    => 1,
287
        add_allowed    => 1,
288
        category       => 2,
288
        public         => 1,
289
    }
289
    }
290
);
290
);
291
291
(-)a/catalogue/search.pl (-2 / +2 lines)
Lines 683-696 my $some_private_shelves = Koha::Virtualshelves->get_some_shelves( Link Here
683
    {
683
    {
684
        borrowernumber => $borrowernumber,
684
        borrowernumber => $borrowernumber,
685
        add_allowed    => 1,
685
        add_allowed    => 1,
686
        category       => 1,
686
        public         => 0,
687
    }
687
    }
688
);
688
);
689
my $some_public_shelves = Koha::Virtualshelves->get_some_shelves(
689
my $some_public_shelves = Koha::Virtualshelves->get_some_shelves(
690
    {
690
    {
691
        borrowernumber => $borrowernumber,
691
        borrowernumber => $borrowernumber,
692
        add_allowed    => 1,
692
        add_allowed    => 1,
693
        category       => 2,
693
        public         => 1,
694
    }
694
    }
695
);
695
);
696
696
(-)a/opac/opac-addbybiblionumber.pl (-7 / +7 lines)
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,
(-)a/opac/opac-detail.pl (-1 / +1 lines)
Lines 924-930 if (C4::Context->preference("virtualshelves") ) { Link Here
924
    my $shelves = Koha::Virtualshelves->search(
924
    my $shelves = Koha::Virtualshelves->search(
925
        {
925
        {
926
            biblionumber => $biblionumber,
926
            biblionumber => $biblionumber,
927
            category => 2,
927
            public       => 1,
928
        },
928
        },
929
        {
929
        {
930
            join => 'virtualshelfcontents',
930
            join => 'virtualshelfcontents',
(-)a/opac/opac-search.pl (-3 / +2 lines)
Lines 854-867 my $some_private_shelves = Koha::Virtualshelves->get_some_shelves( Link Here
854
    {
854
    {
855
        borrowernumber => $borrowernumber,
855
        borrowernumber => $borrowernumber,
856
        add_allowed    => 1,
856
        add_allowed    => 1,
857
        category       => 1,
857
        public         => 0,
858
    }
858
    }
859
);
859
);
860
my $some_public_shelves = Koha::Virtualshelves->get_some_shelves(
860
my $some_public_shelves = Koha::Virtualshelves->get_some_shelves(
861
    {
861
    {
862
        borrowernumber => $borrowernumber,
862
        borrowernumber => $borrowernumber,
863
        add_allowed    => 1,
863
        add_allowed    => 1,
864
        category       => 2,
864
        public         => 1,
865
    }
865
    }
866
);
866
);
867
867
868
- 

Return to bug 28959