From 6992687eaaae532c16bce5f967f79a8fc15a4c72 Mon Sep 17 00:00:00 2001 From: Sam Lau Date: Tue, 9 Jul 2024 17:27:57 +0000 Subject: [PATCH] Bug 25733: Add warning for unresolved claims --- Koha/Patron.pm | 16 ++++++++++++++++ .../prog/en/includes/patron_messages.inc | 17 ++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/Koha/Patron.pm b/Koha/Patron.pm index 1691c9d25b..861306bffb 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -1627,6 +1627,22 @@ sub return_claims { return Koha::Checkouts::ReturnClaims->_new_from_dbic( $return_claims ); } +=head3 unresolved_return_claims + + my $unresolved_return_claims = $patron->unresolved_return_claims; + +Returns all unresolved return claims associated with this patron. + +=cut + +sub unresolved_return_claims { + my ($self) = @_; + my $unresolved_return_claims = $self->_result->return_claims_borrowernumbers->search( + { resolution => undef }, + ); + return Koha::Checkouts::ReturnClaims->_new_from_dbic($unresolved_return_claims); +} + =head3 notice_email_address my $email = $patron->notice_email_address; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc index 666d07ad0f..27d45e856e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc @@ -2,10 +2,13 @@ [% USE Branches %] [% USE Categories %] [% SET ClaimReturnedWarningThreshold = Koha.Preference('ClaimReturnedWarningThreshold') %] +[% SET UnresolvedClaimReturnedWarningThreshold = Koha.Preference('UnresolvedClaimReturnedWarningThreshold') %] + [% SET return_claims = patron.return_claims %] +[% SET unresolved_return_claims = patron.unresolved_return_claims %] [% SET logged_in_branchcode = Branches.GetLoggedInBranchcode() %] -[% IF ( has_modifications || warndeparture || returnbeforeexpiry || expired || patron.gonenoaddress || patron.lost || userdebarred || odues || ( return_claims.count > ClaimReturnedWarningThreshold ) || age_limitations || limited_category || charges || charges_guarantors_guarantees || charges_guarantees || credits ) %] +[% IF ( has_modifications || warndeparture || returnbeforeexpiry || expired || patron.gonenoaddress || patron.lost || userdebarred || odues || ( return_claims.count > ClaimReturnedWarningThreshold ) || ( unresolved_return_claims.count > UnresolvedClaimReturnedWarningThreshold ) || age_limitations || limited_category || charges || charges_guarantors_guarantees || charges_guarantees || credits ) %]

Attention