Bugzilla – Attachment 85783 Details for
Bug 14708
The patron set as the anonymous patron should not be deletable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14708: The patron set as the anonymous patron should not be deletable.
Bug-14708-The-patron-set-as-the-anonymous-patron-s.patch (text/plain), 3.63 KB, created by
Kyle M Hall (khall)
on 2019-02-27 15:26:52 UTC
(
hide
)
Description:
Bug 14708: The patron set as the anonymous patron should not be deletable.
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2019-02-27 15:26:52 UTC
Size:
3.63 KB
patch
obsolete
>From dfb3c9d2b19034d31f36c37b41d29f715c63c393 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Wed, 27 Feb 2019 06:59:08 -0500 >Subject: [PATCH] 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! >--- > .../intranet-tmpl/prog/en/modules/members/moremember.tt | 4 ++++ > members/deletemem.pl | 7 +++++++ > misc/cronjobs/delete_patrons.pl | 9 ++++++++- > 3 files changed, 19 insertions(+), 1 deletion(-) > >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 45277f61ed..a2daa3d2d6 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -54,6 +54,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> >diff --git a/members/deletemem.pl b/members/deletemem.pl >index 3d8712ede7..7b8636202b 100755 >--- a/members/deletemem.pl >+++ b/members/deletemem.pl >@@ -82,6 +82,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 = $dbh->selectrow_array("SELECT COUNT(*) FROM borrowers WHERE guarantorid=?", undef, $member); >diff --git a/misc/cronjobs/delete_patrons.pl b/misc/cronjobs/delete_patrons.pl >index cb59465df4..161e61c173 100755 >--- a/misc/cronjobs/delete_patrons.pl >+++ b/misc/cronjobs/delete_patrons.pl >@@ -59,7 +59,7 @@ unless ($confirm) { > } > > say scalar(@$members) . " patrons to delete"; >- >+my $anonymous_patron = C4::Context->preference("AnonymousPatron"); > my $deleted = 0; > for my $member (@$members) { > print "Trying to delete patron $member->{borrowernumber}... " >@@ -76,6 +76,13 @@ for my $member (@$members) { > next; > } > >+ if ( $anonymous_patron ) { >+ if ( $patron->id eq $anonymous_patron ) { >+ say "Failed to delete patron $borrowernumber: patron is AnonymousPatron"; >+ next; >+ } >+ } >+ > if ( $confirm ) { > my $deleted = eval { $patron->move_to_deleted; }; > if ($@ or not $deleted) { >-- >2.17.2 (Apple Git-113)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 14708
:
85766
|
85770
|
85783
|
85789
|
103026
|
103027
|
103028
|
103922
|
105024
|
105025
|
105026
|
105027
|
105028
|
105029
|
105184
|
105185
|
105186
|
105187
|
105188
|
105189
|
112830
|
112831
|
112922
|
113121