From edda47a42b3a83183fe73b4fb79b4fe53eed3786 Mon Sep 17 00:00:00 2001 From: Maryse Simard Date: Thu, 1 Oct 2020 23:53:17 -0400 Subject: [PATCH] Bug 26598: Display guarantee's fines on guarantor's details page A new tab is added to the details page of a patron to show, in a table, the fines of the patron's guarantees. A warning appears in the "Guarantees" section of the patron to make it obvious that fines exists. To test: 1) Apply patch 2) Choose a patron that has guarantees and navigate to the patron's details page 3) If the guarantees don't have any fines, the display should be unchanged 4) Add fines to the guarantee 5) Go back to the guarantor's details page => A warning should appear in the "Guarantees" section with the total due 6) Clicking on the link accompanying the warning focuses on the new "Guarantees' fines" tab containing a table of all guarantee's and their fines. Signed-off-by: David Nind Signed-off-by: Martin Renvoize --- .../prog/en/modules/members/moremember.tt | 44 +++++++++++++++++++ members/moremember.pl | 5 +++ 2 files changed, 49 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt index 2dda38be50..9a054bec20 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -197,6 +197,13 @@
  • Guarantees:
      + [% IF guarantees_fines and guarantees_fines > 0 %] +
    • + Charges: + Patron's guarantees collectively owe [% guarantees_fines | $Price %]. + See all charges. +
    • + [% END %] [% FOREACH guarantee IN guarantees %] [% IF logged_in_user.can_see_patron_infos( guarantee ) %]
    • [% guarantee.firstname | html %] [% guarantee.surname | html %]
    • @@ -652,6 +659,11 @@ Charges ([% fines | $Price %]) [% END %] + [% IF ( guarantees_fines ) %] +
    • + Guarantees' charges ([% guarantees_fines | $Price %]) +
    • + [% END %] [% IF ( CAN_user_circulate_circulate_remaining_permissions ) %]
    • Holds ([% holds_count || 0 | html %]) @@ -726,6 +738,33 @@ [% END %] + [% IF ( guarantees_fines ) %] +
      + + + + + + + + [% FOREACH guarantee IN guarantees %] + + + [% IF logged_in_user.can_see_patron_infos( guarantee ) %] + + [% ELSE %] + + [% END %] + + [% END %] + + + + +
      GuaranteeAmount outstanding
      [% INCLUDE 'patron-title.inc' patron=guarantee hide_patron_infos_if_needed=1 %][% guarantee.account.balance | $Price %]-
      Total due[% guarantees_fines | $Price %]
      +
      + [% END %] + [% IF CAN_user_clubs && ( enrollments.count || enrollable.count ) %]
      Loading... @@ -903,6 +942,11 @@ $("#view_restrictions").on("click",function(){ $('#debarments-tab-link').click(); }); + + $("#view-guarantees-finesandcharges").on("click",function(){ + $('#guarantees-finestab a').click(); + }); + }); function uncheck_sibling(me){ nodename=me.getAttribute("name"); diff --git a/members/moremember.pl b/members/moremember.pl index 0523d02831..ebfad3df82 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -117,6 +117,11 @@ $template->param( my $relatives_issues_count = Koha::Checkouts->count({ borrowernumber => \@relatives }); +if ( @guarantees ) { + my $total_amount = $patron->relationships_debt({ include_guarantors => 0, only_this_guarantor => 1, include_this_patron => 1 }); + $template->param( guarantees_fines => $total_amount ); +} + # Calculate and display patron's age if ( !$patron->is_valid_age ) { $template->param( age_limitations => 1 ); -- 2.25.1