@@ -, +, @@ --- Koha/Schema/Result/Reserve.pm | 12 ++++++ Koha/Schema/ResultSet/Reserve.pm | 23 ++++++++++++ circ/circulation.pl | 6 ++- .../prog/en/modules/circ/circulation.tt | 36 ++++++++++++-------- 4 files changed, 61 insertions(+), 16 deletions(-) create mode 100644 Koha/Schema/ResultSet/Reserve.pm --- a/Koha/Schema/Result/Reserve.pm +++ a/Koha/Schema/Result/Reserve.pm @@ -313,4 +313,16 @@ __PACKAGE__->belongs_to( }, ); +__PACKAGE__->belongs_to( + "branch", + "Koha::Schema::Result::Branch", + { branchcode => "branchcode" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "CASCADE", + on_update => "CASCADE", + }, +); + 1; --- a/Koha/Schema/ResultSet/Reserve.pm +++ a/Koha/Schema/ResultSet/Reserve.pm @@ -0,0 +1,23 @@ +package Koha::Schema::ResultSet::Reserve; + +use Modern::Perl; + +use Carp; + +use base 'DBIx::Class::ResultSet'; + +sub GetWaiting { + my ( $self, $params ) = @_; + + my $borrowernumber = $params->{borrowernumber}; + croak("No borrowernumber passed in to Koha::Schema::ResultSet::Reserve::GetWaiting") unless $borrowernumber; + + return $self->search( + { + borrowernumber => $borrowernumber, + found => 'W', + } + ); +} + +1; --- a/circ/circulation.pl +++ a/circ/circulation.pl @@ -362,9 +362,11 @@ if ($borrowernumber) { # BUILD HTML # show all reserves of this borrower, and the position of the reservation .... if ($borrowernumber) { + my $holds_rs = Koha::Database->new()->schema()->resultset('Reserve'); $template->param( - holds_count => Koha::Database->new()->schema()->resultset('Reserve') - ->count( { borrowernumber => $borrowernumber } ) ); + holds_count => $holds_rs->count( { borrowernumber => $borrowernumber } ), + WaitingHolds => $holds_rs->GetWaiting( { borrowernumber => $borrowernumber } ) + ); $template->param( adultborrower => 1 ) if ( $borrower->{'category_type'} eq 'A' ); } --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -596,20 +596,28 @@ No patron matched [% message %] - [% IF ( WaitingReserveLoop ) %] -
-

Holds waiting:

- [% FOREACH WaitingReserveLoo IN WaitingReserveLoop %] - - [% END %] -
- [% END %] + [% IF ( WaitingHolds ) %] +
+

Holds waiting:

+ [% FOREACH w IN WaitingHolds %] + + [% END %] +
+ [% END %] + [% IF ( notes ) %]

Notes:

--