From a0b7a8df1c82be4b82897787bb3cc5bd43500f00 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 15 Sep 2014 07:46:05 -0400 Subject: [PATCH] Bug 12892 - Holds Waiting: not showing from check out screen 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. --- Koha/Schema/Result/Reserve.pm | 12 ++++++ Koha/Schema/ResultSet/Reserve.pm | 23 ++++++++++++ circ/circulation.pl | 6 ++- .../prog/en/modules/circ/circulation.tt | 37 ++++++++++++------- 4 files changed, 62 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..dc7324f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -1,4 +1,5 @@ [% USE Branches %] +[% USE EncodeUTF8 %] [% USE KohaDates %] [% IF ( export_remove_fields OR export_with_csv_profile ) %] [% SET exports_enabled = 1 %] @@ -596,20 +597,28 @@ No patron matched [% message %] - [% IF ( WaitingReserveLoop ) %] -
-

Holds waiting:

- [% FOREACH WaitingReserveLoo IN WaitingReserveLoop %] - - [% 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 | $EncodeUTF8 %] + +
  • +
+ [% END %] +
+ [% END %] + [% IF ( notes ) %]

Notes:

-- 1.7.2.5