From d4b18bc671b444bcee254546bedbfc3e64590983 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 These patches add a new warning for unresolved claims that are larger than the number set by the new 'UnresolvedClaimReturnedWarningThreshold' system preference. To test: 1) Apply patch, updatedatabase, restart_all 2) In Administration->system preferences, search for 'UnresolvedClaimReturnedWarningThreshold' and set this to '1' 3) Now search for 'ClaimReturnedLostValue' and set this to 'Lost' 4) Checkout some items for a patron 5) On the patron's checkout page, claim both these items as returned. 6) In the attention box, you should now see a 'Unresolved return claims: Patron has 2 unresolved RETURN CLAIMS'. 7) Visit patron details page, ensure the attention and message show up there as well. 8) Resolve one of these claims. Note that the message should disappear, as we set the sys pref to '1'. Signed-off-by: Eric Garcia Signed-off-by: Marion Durand --- 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 fd7cf85fc2..d38b87a0bc 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -1684,6 +1684,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 39a9c0ecc6..f6d12604f4 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

    [% IF ( has_modifications ) %] @@ -117,6 +120,18 @@
  • Return claims: Patron has [% return_claims.count | html %] RETURN CLAIMS
  • [% END %] + [% IF unresolved_return_claims.count > UnresolvedClaimReturnedWarningThreshold %] + [% IF unresolved_return_claims.count > 1 %] +
  • + Unresolved return claims: Patron has [% unresolved_return_claims.count | html %] unresolved RETURN CLAIMS +
  • + [% ELSE %] +
  • + Unresolved return claims: Patron has [% unresolved_return_claims.count | html %] unresolved RETURN CLAIM +
  • + [% END %] + [% END %] + [% IF age_limitations %]
  • Patron's age is incorrect for their category. -- 2.39.5