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

(-)a/C4/VirtualShelves/Page.pm (-2 / +15 lines)
Lines 90-96 sub shelfpage { Link Here
90
90
91
    # getting the Shelves list
91
    # getting the Shelves list
92
    my $category = ( ( $displaymode eq 'privateshelves' ) ? 1 : 2 );
92
    my $category = ( ( $displaymode eq 'privateshelves' ) ? 1 : 2 );
93
    my $shelflist = GetShelves( $category, $shelveslimit, $shelvesoffset, $loggedinuser );
93
94
    my $shelflist;
95
    if ( $category == 2 ) {
96
        $shelflist = Koha::Virtualshelves->get_public_shelves({ limit => $shelveslimit, offset => $shelvesoffset });
97
    } else {
98
        $shelflist = Koha::Virtualshelves->get_private_shelves({ limit => $shelveslimit, offset => $shelvesoffset, borrowernumber => $loggedinuser });
99
    }
94
    my $totshelves = C4::VirtualShelves::GetShelfCount( $loggedinuser, $category );
100
    my $totshelves = C4::VirtualShelves::GetShelfCount( $loggedinuser, $category );
95
101
96
    my $op = $query->param('op');
102
    my $op = $query->param('op');
Lines 443-449 sub shelfpage { Link Here
443
    my $numberCanManage = 0;
449
    my $numberCanManage = 0;
444
450
445
    # rebuild shelflist in case a shelf has been added
451
    # rebuild shelflist in case a shelf has been added
446
    $shelflist = GetShelves( $category, $shelveslimit, $shelvesoffset, $loggedinuser ) unless $delflag;
452
    unless ( $delflag ) {
453
        if ( $category == 2 ) {
454
            $shelflist = Koha::Virtualshelves->get_public_shelves({ limit => $shelveslimit, offset => $shelvesoffset });
455
        } else {
456
            $shelflist = Koha::Virtualshelves->get_private_shelves({ limit => $shelveslimit, offset => $shelvesoffset, borrowernumber => $loggedinuser });
457
        }
458
    }
459
447
    $totshelves = C4::VirtualShelves::GetShelfCount( $loggedinuser, $category ) unless $delflag;
460
    $totshelves = C4::VirtualShelves::GetShelfCount( $loggedinuser, $category ) unless $delflag;
448
    foreach my $element ( sort { lc( $shelflist->{$a}->{'shelfname'} ) cmp lc( $shelflist->{$b}->{'shelfname'} ) } keys %$shelflist ) {
461
    foreach my $element ( sort { lc( $shelflist->{$a}->{'shelfname'} ) cmp lc( $shelflist->{$b}->{'shelfname'} ) } keys %$shelflist ) {
449
        my %line;
462
        my %line;
(-)a/Koha/Virtualshelves.pm (+43 lines)
Lines 39-44 Koha::Virtualshelf - Koha Virtualshelf Object class Link Here
39
39
40
=cut
40
=cut
41
41
42
sub get_private_shelves {
43
    my ( $self, $params ) = @_;
44
    my $limit = $params->{limit};
45
    my $offset = $params->{offset} || 0;
46
    my $borrowernumber = $params->{borrowernumber};
47
48
    $self->search(
49
        {
50
            'virtualshelfshares.borrowernumber' => $borrowernumber,
51
            category => 1,
52
            -or => {
53
                'virtualshelfshares.owner' => $borrowernumber,
54
                'virtualshelves.borrowernumber' => $borrowernumber,
55
            }
56
        },
57
        {
58
            join => ['borrowers', 'virtualshelfcontents', 'virtualshelfshares' ],
59
            group_by => 'shelfnumber',
60
            order_by => 'shelfname',
61
            limit => "$limit,$offset",
62
        }
63
    );
64
}
65
66
67
sub get_public_shelves {
68
    my ( $self, $params ) = @_;
69
    my $limit = $params->{limit};
70
    my $offset = $params->{offset} || 0;
71
72
    $self->search(
73
        {
74
            category => 1,
75
        },
76
        {
77
            join => [ 'virtualshelfcontents' ],
78
            group_by => 'shelfnumber',
79
            order_by => 'shelfname',
80
            limit => "$limit,$offset",
81
        }
82
    );
83
}
84
42
sub type {
85
sub type {
43
    return 'Virtualshelve';
86
    return 'Virtualshelve';
44
}
87
}
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt (-4 / +3 lines)
Lines 115-121 Link Here
115
                            [% IF ( paramsloo.need_confirm ) %]
115
                            [% IF ( paramsloo.need_confirm ) %]
116
                              <div class="alert">
116
                              <div class="alert">
117
                                The list <i>[% paramsloo.need_confirm %]</i> is not empty.
117
                                The list <i>[% paramsloo.need_confirm %]</i> is not empty.
118
                                <br />It has <b>[% paramsloo.count %]</b> [% IF ( paramsloo.single ) %]entry[% ELSE %]entries[% END %].
118
                                <br />It has <b>[% paramsloo.count %]</b> [% IF paramsloo.count == 1 %]entry[% ELSE %]entries[% END %].
119
                                <br />Use the "Confirm" button below to confirm deletion.
119
                                <br />Use the "Confirm" button below to confirm deletion.
120
                             </div>
120
                             </div>
121
                            [% END %]
121
                            [% END %]
Lines 642-648 Link Here
642
                                                            [% FOREACH shelveslooppri IN shelveslooppriv %]
642
                                                            [% FOREACH shelveslooppri IN shelveslooppriv %]
643
                                                                <tr>
643
                                                                <tr>
644
                                                                    <td><a href="/cgi-bin/koha/opac-shelves.pl?display=privateshelves&amp;viewshelf=[% shelveslooppri.shelf %]&amp;sortfield=[% shelveslooppri.sortfield %]">[% shelveslooppri.shelfname |html %]</a></td>
644
                                                                    <td><a href="/cgi-bin/koha/opac-shelves.pl?display=privateshelves&amp;viewshelf=[% shelveslooppri.shelf %]&amp;sortfield=[% shelveslooppri.sortfield %]">[% shelveslooppri.shelfname |html %]</a></td>
645
                                                                    <td>[% IF ( shelveslooppri.count ) %][% shelveslooppri.count %] [% IF ( shelveslooppri.single ) %]item[% ELSE %]items[% END %][% ELSE %]Empty[% END %]</td>
645
                                                                    <td>[% IF ( shelveslooppri.count ) %][% shelveslooppri.count %] [% IF shelveslooppri.count == 1 %]item[% ELSE %]items[% END %][% ELSE %]Empty[% END %]</td>
646
                                                                    <td>
646
                                                                    <td>
647
                                                                        [% IF ( shelveslooppri.viewcategory1 ) %][% IF !shelveslooppri.shares %]Private[% ELSE %]Shared[% END %][% END %]
647
                                                                        [% IF ( shelveslooppri.viewcategory1 ) %][% IF !shelveslooppri.shares %]Private[% ELSE %]Shared[% END %][% END %]
648
                                                                    </td>
648
                                                                    </td>
Lines 716-722 Link Here
716
                                                [% FOREACH shelvesloo IN shelvesloop %]
716
                                                [% FOREACH shelvesloo IN shelvesloop %]
717
                                                    <tr>
717
                                                    <tr>
718
                                                        <td><a class="title" href="/cgi-bin/koha/opac-shelves.pl?viewshelf=[% shelvesloo.shelf %]&amp;sortfield=[% shelvesloo.sortfield %]">[% shelvesloo.shelfname |html %]</a></td>
718
                                                        <td><a class="title" href="/cgi-bin/koha/opac-shelves.pl?viewshelf=[% shelvesloo.shelf %]&amp;sortfield=[% shelvesloo.sortfield %]">[% shelvesloo.shelfname |html %]</a></td>
719
                                                        <td>[% shelvesloo.count %] [% IF ( shelvesloo.single ) %]item[% ELSE %]item(s)[% END %]</td>
719
                                                        <td>[% shelvesloo.count %] [% IF shelvesloo.count == 1 %]item[% ELSE %]item(s)[% END %]</td>
720
                                                        <td>
720
                                                        <td>
721
                                                            [% IF ( shelvesloo.viewcategory2 ) %]Public[% END %]
721
                                                            [% IF ( shelvesloo.viewcategory2 ) %]Public[% END %]
722
                                                        </td>
722
                                                        </td>
723
- 

Return to bug 14544