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

(-)a/C4/VirtualShelves/Page.pm (-22 / +11 lines)
Lines 75-88 sub shelfpage { Link Here
75
    my ( $shelflimit, $shelfoffset, $shelveslimit, $shelvesoffset );
75
    my ( $shelflimit, $shelfoffset, $shelveslimit, $shelvesoffset );
76
    my $marcflavour = C4::Context->preference("marcflavour");
76
    my $marcflavour = C4::Context->preference("marcflavour");
77
77
78
    # get biblionumbers stored in the cart
79
    my @cart_list;
80
    my $cart_cookie = ( $type eq 'opac' ? "bib_list" : "intranet_bib_list" );
81
    if($query->cookie($cart_cookie)){
82
        my $cart_list = $query->cookie($cart_cookie);
83
        @cart_list = split(/\//, $cart_list);
84
    }
85
86
    $shelflimit = ( $type eq 'opac' ? C4::Context->preference('OPACnumSearchResults') : C4::Context->preference('numSearchResults') );
78
    $shelflimit = ( $type eq 'opac' ? C4::Context->preference('OPACnumSearchResults') : C4::Context->preference('numSearchResults') );
87
    $shelflimit = $shelflimit || ShelvesMax('MGRPAGE');
79
    $shelflimit = $shelflimit || ShelvesMax('MGRPAGE');
88
    $shelfoffset   = ( $itemoff - 1 ) * $shelflimit;     # Sets the offset to begin retrieving items at
80
    $shelfoffset   = ( $itemoff - 1 ) * $shelflimit;     # Sets the offset to begin retrieving items at
Lines 93-103 sub shelfpage { Link Here
93
    my $shelflist = GetShelves( $category, $shelveslimit, $shelvesoffset, $loggedinuser );
85
    my $shelflist = GetShelves( $category, $shelveslimit, $shelvesoffset, $loggedinuser );
94
    my $totshelves = C4::VirtualShelves::GetShelfCount( $loggedinuser, $category );
86
    my $totshelves = C4::VirtualShelves::GetShelfCount( $loggedinuser, $category );
95
87
96
    #Get a list of private shelves for possible deletion. Only do this when we've defaulted to public shelves
97
    my ( $privshelflist, $privtotshelves );
98
    if ( $category == 2 ) {
99
        ( $privshelflist, $privtotshelves ) = GetShelves( 1, $shelveslimit, $shelvesoffset, $loggedinuser );
100
    }
101
    my $op = $query->param('op');
88
    my $op = $query->param('op');
102
89
103
    # the format of this is unindented for ease of diff comparison to the old script
90
    # the format of this is unindented for ease of diff comparison to the old script
Lines 260-265 sub shelfpage { Link Here
260
                    direction => $direction,
247
                    direction => $direction,
261
                );
248
                );
262
                ( $items, $totitems ) = GetShelfContents( $shelfnumber, $shelflimit, $shelfoffset, $sortfield, $direction );
249
                ( $items, $totitems ) = GetShelfContents( $shelfnumber, $shelflimit, $shelfoffset, $sortfield, $direction );
250
251
                # get biblionumbers stored in the cart
252
                # Note that it's not use at the intranet
253
                my @cart_list;
254
                my $cart_cookie = ( $type eq 'opac' ? "bib_list" : "intranet_bib_list" );
255
                if($query->cookie($cart_cookie)){
256
                    my $cart_list = $query->cookie($cart_cookie);
257
                    @cart_list = split(/\//, $cart_list);
258
                }
259
263
                for my $this_item (@$items) {
260
                for my $this_item (@$items) {
264
                    my $biblionumber = $this_item->{'biblionumber'};
261
                    my $biblionumber = $this_item->{'biblionumber'};
265
                    my $record = GetMarcBiblio($biblionumber);
262
                    my $record = GetMarcBiblio($biblionumber);
Lines 366-372 sub shelfpage { Link Here
366
                /(DEL|REMSHR)-(\d+)/ or next;
363
                /(DEL|REMSHR)-(\d+)/ or next;
367
                $delflag = 1;
364
                $delflag = 1;
368
                my $number = $2;
365
                my $number = $2;
369
                unless ( defined $shelflist->{$number} || defined $privshelflist->{$number} ) {
366
                unless ( defined $shelflist->{$number} ) {
370
                    push( @paramsloop, { unrecognized => $number } );
367
                    push( @paramsloop, { unrecognized => $number } );
371
                    last;
368
                    last;
372
                }
369
                }
Lines 374-380 sub shelfpage { Link Here
374
                if(/REMSHR/) {
371
                if(/REMSHR/) {
375
                    RemoveShare($loggedinuser, $number);
372
                    RemoveShare($loggedinuser, $number);
376
                    delete $shelflist->{$number} if exists $shelflist->{$number};
373
                    delete $shelflist->{$number} if exists $shelflist->{$number};
377
                    delete $privshelflist->{$number} if exists $privshelflist->{$number};
378
                    $stay=0;
374
                    $stay=0;
379
                    next;
375
                    next;
380
                }
376
                }
Lines 390-398 sub shelfpage { Link Here
390
                        if ( defined $shelflist->{$number} ) {
386
                        if ( defined $shelflist->{$number} ) {
391
                            push( @paramsloop, { need_confirm => $shelflist->{$number}->{shelfname}, count => $totshelves, single => ($totshelves eq 1 ? 1:0) } );
387
                            push( @paramsloop, { need_confirm => $shelflist->{$number}->{shelfname}, count => $totshelves, single => ($totshelves eq 1 ? 1:0) } );
392
                            $shelflist->{$number}->{confirm} = $number;
388
                            $shelflist->{$number}->{confirm} = $number;
393
                        } else {
394
                            push( @paramsloop, { need_confirm => $privshelflist->{$number}->{shelfname}, count => $totshelves } );
395
                            $privshelflist->{$number}->{confirm} = $number;
396
                        }
389
                        }
397
                        $stay = 0;
390
                        $stay = 0;
398
                        next;
391
                        next;
Lines 402-410 sub shelfpage { Link Here
402
                if ( defined $shelflist->{$number} ) {
395
                if ( defined $shelflist->{$number} ) {
403
                    $name = $shelflist->{$number}->{'shelfname'};
396
                    $name = $shelflist->{$number}->{'shelfname'};
404
                    delete $shelflist->{$number};
397
                    delete $shelflist->{$number};
405
                } else {
406
                    $name = $privshelflist->{$number}->{'shelfname'};
407
                    delete $privshelflist->{$number};
408
                }
398
                }
409
                unless ( DelShelf($number) ) {
399
                unless ( DelShelf($number) ) {
410
                    push( @paramsloop, { delete_fail => $name } );
400
                    push( @paramsloop, { delete_fail => $name } );
411
- 

Return to bug 13418