From 9659ad969355bed1db7d0baa48bd0c0e7604c795 Mon Sep 17 00:00:00 2001 From: Andrew Date: Fri, 20 Sep 2019 18:18:13 +0000 Subject: [PATCH] Bug 14697: Show an item has unresolved claims on checkin Signed-off-by: Andrew Fuerste-Henry Signed-off-by: Lisette Scheer --- C4/Circulation.pm | 14 ++++++++++++++ Koha/Checkouts/ReturnClaim.pm | 12 ++++++++++++ circ/returns.pl | 4 +++- .../prog/en/modules/circ/returns.tt | 19 +++++++++++++++++++ 4 files changed, 48 insertions(+), 1 deletion(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index e346e2dfd6..ca870377aa 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -60,6 +60,7 @@ use Koha::Account::Offsets; use Koha::Config::SysPrefs; use Koha::Charges::Fees; use Koha::Util::SystemPreferences; +use Koha::Checkouts::ReturnClaims; use Carp; use List::MoreUtils qw( uniq any ); use Scalar::Util qw( looks_like_number ); @@ -2120,6 +2121,19 @@ sub AddReturn { } } + if ( C4::Context->preference('ClaimReturnedLostValue') ) { + my $claims = Koha::Checkouts::ReturnClaims->search( + { + itemnumber => $item->id, + resolution => undef, + } + ); + + if ( $claims->count ) { + $messages->{ReturnClaims} = $claims; + } + } + return ( $doreturn, $messages, $issue, ( $patron ? $patron->unblessed : {} )); } diff --git a/Koha/Checkouts/ReturnClaim.pm b/Koha/Checkouts/ReturnClaim.pm index 3fff2e6608..de014bd627 100644 --- a/Koha/Checkouts/ReturnClaim.pm +++ b/Koha/Checkouts/ReturnClaim.pm @@ -23,6 +23,7 @@ use base qw(Koha::Object); use Koha::Checkouts; use Koha::Old::Checkouts; +use Koha::Patrons; =head1 NAME @@ -48,6 +49,17 @@ sub checkout { return Koha::Old::Checkout->_new_from_dbic( $old_issue ) if $old_issue; } +=head3 patron + +=cut + +sub patron { + my ( $self ) = @_; + + my $borrower = $self->_result->borrowernumber; + return Koha::Patron->_new_from_dbic( $borrower ) if $borrower; +} + =head3 _type =cut diff --git a/circ/returns.pl b/circ/returns.pl index 657229a10e..35872d1e5b 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -542,7 +542,9 @@ foreach my $code ( keys %$messages ) { elsif ( $code eq 'DataCorrupted' ) { $err{data_corrupted} = 1; } - else { + elsif ( $code eq 'ReturnClaims' ) { + $template->param( ReturnClaims => $messages->{ReturnClaims} ); + } else { die "Unknown error code $code"; # note we need all the (empty) elsif's above, or we die. # This forces the issue of staying in sync w/ Circulation.pm } 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 42d7a19089..98cd097937 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt @@ -166,6 +166,25 @@ [% END %] + + [% IF ( ReturnClaims ) %] +
+

+ This item has been claimed as returned by: + +

+
+ [% END %] + [% IF ( waiting_holds ) %]
-- 2.20.1 (Apple Git-117)