From 85f9927cdc7e594f7faa6dd593cceda67fbb5d92 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 dce77eaaf7..77a52cb14e 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -57,6 +57,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 ); @@ -2024,6 +2025,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 c2f20efd91..2e04fdf9de 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; @@ -184,6 +185,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; @@ -358,6 +364,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 . @@ -473,6 +480,24 @@ if ( $messages->{'ResFound'}) { ); } +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 ) { @@ -505,6 +530,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 74b24f6e55..1e87cc39ef 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt @@ -506,6 +506,72 @@ [% END %] + + + [% IF ( recalled ) %] + + + [% END %] [% END %] [% IF ( errmsgloop ) %] -- 2.11.0