From 54bf6607087eee9349a23b74b659bdf3d00afbb9 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Fri, 24 Nov 2017 00:25:56 +0000 Subject: [PATCH] Bug 19532: Recall pop up when checking in an item When checking in an item on the staff side, the staff member will see a pop up if there is a recall attached to that item. From here, they can confirm the recall, setting the status to 'Waiting' and updating the waitingdate. The item will still be checked in. Signed-off-by: Nick Clemens --- C4/Circulation.pm | 8 +++ circ/returns.pl | 31 ++++++++++ .../intranet-tmpl/prog/en/modules/circ/returns.tt | 66 ++++++++++++++++++++++ 3 files changed, 105 insertions(+) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index d583e53..100a965 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -56,6 +56,7 @@ use Koha::RefundLostItemFeeRule; use Koha::RefundLostItemFeeRules; use Koha::Account::Lines; use Koha::Account::Offsets; +use Koha::Recalls; use Carp; use List::MoreUtils qw( uniq ); use Scalar::Util qw( looks_like_number ); @@ -2017,6 +2018,13 @@ sub AddReturn { $messages->{'ResFound'} = $resrec; } + # find recalls..... + my $recall = Koha::Recalls->find({ itemnumber => $item->{'itemnumber'} }); + if (defined $recall){ + $messages->{'RecallFound'} = 1; + $messages->{'Recall'} = $recall; + } + # Record the fact that this book was returned. UpdateStats({ branch => $branch, diff --git a/circ/returns.pl b/circ/returns.pl index 162f8fd..6b9b832 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -52,6 +52,7 @@ use Koha::BiblioFrameworks; use Koha::Holds; use Koha::Items; use Koha::Patrons; +use Koha::Recalls; my $query = new CGI; @@ -183,6 +184,11 @@ if ( $query->param('reserve_id') ) { } } +if ( $query->param('recall_id') ){ + my $recall = Koha::Recalls->find(scalar $query->param('recall_id')); + $recall->update({ status => 'W', waitingdate => dt_from_string() }); +} + my $borrower; my $returned = 0; my $messages; @@ -357,6 +363,7 @@ $template->param( inputloop => \@inputloop ); my $found = 0; my $waiting = 0; my $reserved = 0; +my $recalled = 0; # new op dev : we check if the document must be returned to his homebranch directly, # if the document is transfered, we have warning message . @@ -445,6 +452,24 @@ if ( $messages->{'ResFound'}) { } # else { ; } # error? } +if ( $messages->{'RecallFound'} ){ + my $recall = $messages->{'Recall'}; + my $patron = Koha::Patrons->find( $recall->borrowernumber ); + $template->param( + patron => $patron, + found => 1, + recalled => 1, + recall => $recall, + address => $patron->address, + address2 => $patron->address2, + streetnumber => $patron->streetnumber, + city => $patron->city, + zipcode => $patron->zipcode, + state => $patron->state, + country => $patron->country, + ); +} + # Error Messages my @errmsgloop; foreach my $code ( keys %$messages ) { @@ -477,6 +502,12 @@ foreach my $code ( keys %$messages ) { elsif ( $code eq 'WasTransfered' ) { ; # FIXME... anything to do here? } + elsif ( $code eq 'RecallFound' ) { + ; + } + elsif ( $code eq 'Recall' ) { + ; + } elsif ( $code eq 'withdrawn' ) { $err{withdrawn} = 1; $exit_required_p = 1 if C4::Context->preference("BlockReturnOfWithdrawnItems"); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt index f18ea69..c2205ce 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt @@ -456,6 +456,72 @@ [% END %] + + + [% IF ( recalled ) %] + + + [% END %] [% END %] [% IF ( errmsgloop ) %] -- 2.1.4