From 2a343c251adf63b8d4d53b4c8363a92ff4615634 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Sun, 5 May 2019 09:42:45 -0500 Subject: [PATCH] Bug 10910: Add a warning when deleting a patron with pending suggestions --- koha-tmpl/intranet-tmpl/prog/en/modules/members/deletemem.tt | 3 +++ members/deletemem.pl | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/deletemem.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/deletemem.tt index f17df687d4..57273813f7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/deletemem.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/deletemem.tt @@ -38,6 +38,9 @@ [%# TODO add "patron does not exist" unless patron %]

Are you sure you want to delete the patron [% patron.firstname | html %] [% patron.surname | html %]? This cannot be undone.

+ [% IF pending_suggestions > 0 %] +

Note that this patron has [% pending_suggestions %] pending suggestions.

+ [% END %]
diff --git a/members/deletemem.pl b/members/deletemem.pl index 3d8712ede7..66b3680a62 100755 --- a/members/deletemem.pl +++ b/members/deletemem.pl @@ -28,6 +28,7 @@ use C4::Context; use C4::Output; use C4::Auth; use C4::Members; +use C4::Suggestions qw( SearchSuggestion ); use Koha::Patrons; use Koha::Token; use Koha::Patron::Categories; @@ -100,6 +101,14 @@ if ( $op eq 'delete_confirm' or $countissues > 0 or $charges or $is_guarantor ) $template->param(guarantees => 1); } + # Add warning if patron has pending suggestions + $template->param( + pending_suggestions => scalar @{ + C4::Suggestions::SearchSuggestion( + { suggestedby => $member, STATUS => 'ASKED' } + ) + } + ); # This is silly written but reflect the same conditions as above if ( not $countissues > 0 and not $charges and not $is_guarantor ) { $template->param( -- 2.11.0