Browse Source

Bug 10910: Add a warning when deleting a patron with pending suggestions

Test plan:
From the OPAC, add a suggestion
From the staff interface, try to delete the patron who created the
suggestion
=> You get a warning message

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
20.11.x
Jonathan Druart 5 years ago
parent
commit
85c1537bd7
  1. 4
      koha-tmpl/intranet-tmpl/prog/en/modules/members/deletemem.tt
  2. 10
      members/deletemem.pl

4
koha-tmpl/intranet-tmpl/prog/en/modules/members/deletemem.tt

@ -48,7 +48,9 @@
<ul>
[% END %]
<h3>Are you sure you want to delete the patron [% patron.firstname | html %] [% patron.surname | html %]? This cannot be undone.</h3>
[% IF pending_suggestions > 0 %]
<h3>Note that this patron has [% pending_suggestions %] pending suggestions.</h3>
[% END %]
<form action="/cgi-bin/koha/members/deletemem.pl">
<input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
<input type="hidden" name="member" value="[% patron.borrowernumber | html %]"/>

10
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;
@ -102,6 +103,15 @@ if ( $op eq 'delete_confirm' or $countissues > 0 or $debits or $is_guarantor ) {
op => 'delete_confirm',
csrf_token => Koha::Token->new->generate_csrf({ session_id => scalar $input->cookie('CGISESSID') }),
);
# Add warning if patron has pending suggestions
$template->param(
pending_suggestions => scalar @{
C4::Suggestions::SearchSuggestion(
{ suggestedby => $member, STATUS => 'ASKED' }
)
}
);
} elsif ( $op eq 'delete_confirmed' ) {
output_and_exit( $input, $cookie, $template, 'wrong_csrf_token' )
unless Koha::Token->new->check_csrf( {

Loading…
Cancel
Save