@@ -, +, @@ --- Koha/Objects.pm | 11 + Koha/Virtualshelf.pm | 16 +- Koha/Virtualshelves.pm | 24 +- .../virtualshelves/tables/shelves_results.tt | 2 + .../opac-tmpl/bootstrap/en/includes/masthead.inc | 14 +- .../opac-tmpl/bootstrap/en/includes/usermenu.inc | 2 +- .../opac-tmpl/bootstrap/en/modules/opac-detail.tt | 4 +- .../bootstrap/en/modules/opac-downloadshelf.tt | 16 +- .../bootstrap/en/modules/opac-sendshelfform.tt | 6 +- .../bootstrap/en/modules/opac-shareshelf.tt | 6 +- .../bootstrap/en/modules/opac-shelves-rss.tt | 6 +- .../opac-tmpl/bootstrap/en/modules/opac-shelves.tt | 638 +++++++++------------ opac/opac-downloadshelf.pl | 18 +- opac/opac-shelves.pl | 314 +++++++++- t/db_dependent/Virtualshelves.t | 76 ++- 15 files changed, 719 insertions(+), 434 deletions(-) --- a/Koha/Objects.pm +++ a/Koha/Objects.pm @@ -126,6 +126,17 @@ sub count { return $self->_resultset()->count($params); } +=head3 Koha::Objects->pager(); + +my $pager = Koha::Objects->pager; + +=cut + +sub pager { + my ( $self ) = @_; + return $self->_resultset->pager; +} + =head3 Koha::Objects->next(); my $object = Koha::Objects->next(); --- a/Koha/Virtualshelf.pm +++ a/Koha/Virtualshelf.pm @@ -101,12 +101,14 @@ sub is_shelfname_valid { sub get_shares { my ( $self ) = @_; - return $self->{_result}->virtualshelfshares; + my $shares = $self->{_result}->virtualshelfshares; + return $shares; } sub get_contents { my ( $self ) = @_; - return $self->{_result}->virtualshelfcontents; + my $contents = $self->{_result}->virtualshelfcontents; + return $contents; } sub share { @@ -132,6 +134,16 @@ sub is_shared { )->count; } +sub is_shared_with { + my ( $self, $borrowernumber ) = @_; + return unless $borrowernumber; + return $self->get_shares->search( + { + borrowernumber => $borrowernumber, + } + )->count; +} + sub remove_share { my ( $self, $borrowernumber ) = @_; my $shelves = Koha::Virtualshelfshares->search( --- a/Koha/Virtualshelves.pm +++ a/Koha/Virtualshelves.pm @@ -41,24 +41,23 @@ Koha::Virtualshelf - Koha Virtualshelf Object class sub get_private_shelves { my ( $self, $params ) = @_; - my $limit = $params->{limit}; - my $offset = $params->{offset} || 0; - my $borrowernumber = $params->{borrowernumber}; + my $page = $params->{page}; + my $rows = $params->{rows}; + my $borrowernumber = $params->{borrowernumber} || 0; $self->search( { - 'virtualshelfshares.borrowernumber' => $borrowernumber, category => 1, -or => { - 'virtualshelfshares.owner' => $borrowernumber, - 'virtualshelves.borrowernumber' => $borrowernumber, + 'virtualshelfshares.borrowernumber' => $borrowernumber, + 'me.owner' => $borrowernumber, } }, { - join => ['borrowers', 'virtualshelfcontents', 'virtualshelfshares' ], + join => [ 'virtualshelfshares' ], group_by => 'shelfnumber', order_by => 'shelfname', - limit => "$limit,$offset", + ( ( $page and $rows ) ? ( page => $page, rows => $rows ) : () ), } ); } @@ -66,18 +65,17 @@ sub get_private_shelves { sub get_public_shelves { my ( $self, $params ) = @_; - my $limit = $params->{limit}; - my $offset = $params->{offset} || 0; + my $page = $params->{page}; + my $rows = $params->{rows}; $self->search( { - category => 1, + category => 2, }, { - join => [ 'virtualshelfcontents' ], group_by => 'shelfnumber', order_by => 'shelfname', - limit => "$limit,$offset", + ( ( $page and $rows ) ? ( page => $page, rows => $rows ) : () ), } ); } --- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/tables/shelves_results.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/tables/shelves_results.tt @@ -36,6 +36,7 @@ [%~ action_block = action_block _ '' ~%] [%~ action_block = action_block _ '' ~%] [%~ action_block = action_block _ '' ~%] + [%~ action_block = action_block _ '' ~%] [%~ action_block = action_block _ '' ~%] [%~ action_block = action_block _ '' ~%] [%~ END ~%] @@ -46,6 +47,7 @@ [%~ action_block = action_block _ '' ~%] [%~ action_block = action_block _ '' ~%] [%~ action_block = action_block _ '' ~%] + [%~ action_block = action_block _ '' ~%] [%~ action_block = action_block _ '' ~%] [%~ action_block = action_block _ '' ~%] [%~ END ~%] --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc +++ a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc @@ -38,26 +38,26 @@ Lists
Your download should begin automatically.
The list was sent to: [% email %]
You do not have permission to send this list.
You will receive an email notification if someone accepts your share within two weeks.
[% END %] - +