diff --git a/Koha/Objects.pm b/Koha/Objects.pm index 1ff91cb468..27406cf2d9 100644 --- a/Koha/Objects.pm +++ b/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(); diff --git a/Koha/Virtualshelf.pm b/Koha/Virtualshelf.pm index 3cd257c00c..d80f2490a0 100644 --- a/Koha/Virtualshelf.pm +++ b/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( diff --git a/Koha/Virtualshelves.pm b/Koha/Virtualshelves.pm index 98f9d40977..65b068059b 100644 --- a/Koha/Virtualshelves.pm +++ b/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 ) : () ), } ); } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/tables/shelves_results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/tables/shelves_results.tt index 08d75a6868..0304dbe83d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/tables/shelves_results.tt +++ b/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 ~%] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc index e034009480..0f5d1ea064 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc +++ b/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 %] - +