Browse Source

Bug 14708: The patron set as the anonymous patron should not be deletable.

Right now it's possible to delete the anonymous patron at any time. When this happens the system will break just as if anonymouspatron was unset but patrons still have an "always anonymize" privacy setting.

This issue occurs more frequently than one would expect.

We should make it so that the patron set in AnonymousPatron is not deletable.

Test Plan:
1) Apply this patch
2) Set a patron to by AnonymousPatron
3) Attempt to delete that patron from the members toolbar
4) Note the error message!

Signed-off-by: Devinim <kohadevinim@devinim.com.tr>

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
20.11.x
Kyle Hall 2 years ago
committed by Jonathan Druart
parent
commit
c1af56eb54
  1. 4
      koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
  2. 7
      members/deletemem.pl

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

@ -51,6 +51,10 @@
<h3>Unable to delete patrons from other libraries with current settings</h3>
<p>Insufficient privileges.</p>
[% END %]
[% IF ( error == 'CANT_DELETE_ANONYMOUS_PATRON' ) %]
<h3>Unable to delete patron that is set as AnonymousPatron</h3>
<p>This patron cannot be deleted while set as AnonymousPatron in the system preferences.</p>
[% END %]
[% IF ( error == 'CANT_DELETE' ) %]
<h3>Unable to delete patron</h3>
<p>Insufficient privileges.</p>

7
members/deletemem.pl

@ -83,6 +83,13 @@ if (C4::Context->preference("IndependentBranches")) {
}
}
if ( my $anonymous_patron = C4::Context->preference("AnonymousPatron") ) {
if ( $patron->id eq $anonymous_patron ) {
print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$member&error=CANT_DELETE_ANONYMOUS_PATRON");
exit 0; # Exit without error
}
}
my $op = $input->param('op') || 'delete_confirm';
my $dbh = C4::Context->dbh;
my $is_guarantor = $patron->guarantee_relationships->count;

Loading…
Cancel
Save