From 0e44b31e1a9e34ccc7b4f7b1ade1882d86639c29 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 15 Sep 2014 07:46:05 -0400 Subject: [PATCH] [SIGNED-OFF] Bug 12892 - Holds Waiting: not showing from check out screen Content-Type: text/plain; charset="utf-8" When a patron has holds waiting to be pick up, they used to show in the check out screen. These notifications are no longer showing in 3.16. Test Plan: 1) Apply this patch 2) Create a hold, set to waiting 3) Browse to circulation.pl for that patron 4) Note you see the list of waiting holds 5) Switch you logged in branch to a different branch 6) Note the "Waiting at" line is no longer emphasized. Signed-off-by: Owen Leonard --- 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 diff --git a/Koha/Schema/Result/Reserve.pm b/Koha/Schema/Result/Reserve.pm index 16f951b..6041d52 100644 --- a/Koha/Schema/Result/Reserve.pm +++ b/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; diff --git a/Koha/Schema/ResultSet/Reserve.pm b/Koha/Schema/ResultSet/Reserve.pm new file mode 100644 index 0000000..e656f88 --- /dev/null +++ b/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; diff --git a/circ/circulation.pl b/circ/circulation.pl index c766e88..f3cbe1d 100755 --- a/circ/circulation.pl +++ b/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' ); } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index 9734c0f..9a99c59 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/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 %] -
    -
  • [% WaitingReserveLoo.title |html %] ([% WaitingReserveLoo.itemtype %]), [% IF ( WaitingReserveLoo.author ) %]by [% WaitingReserveLoo.author %][% END %] [% IF ( WaitingReserveLoo.itemcallnumber ) %][[% WaitingReserveLoo.itemcallnumber %]] [% END %]Hold placed on [% WaitingReserveLoo.reservedate %]. - [% IF ( WaitingReserveLoo.waitingat ) %] -
    [% IF ( WaitingReserveLoo.waitinghere ) %][% ELSE %][% END %]Waiting at [% WaitingReserveLoo.waitingat %] - [% END %] -
  • -
- [% END %] -
- [% END %] + [% IF ( WaitingHolds ) %] +
+

Holds waiting:

+ [% FOREACH w IN WaitingHolds %] +
    +
  • + [% w.biblio.title | html %] + ([% w.item.effective_itemtype %]), + [% IF ( w.biblio.author ) %] by [% w.biblio.author | html %] [% END %] + [% IF ( w.item.itemcallnumber ) %] [[% w.item.itemcallnumber %]] [% END %] + Hold placed on [% w.reservedate | $KohaDates %]. + +
    + [% IF ( w.branch.branchcode == Branches.GetLoggedInBranchcode() ) %][% ELSE %][% END %] + Waiting at [% w.branch.branchname %] + +
  • +
+ [% END %] +
+ [% END %] + [% IF ( notes ) %]

Notes:

-- 1.7.9.5