| Summary: | Make deletemem.pl use Koha::Patron->safe_to_delete | ||
|---|---|---|---|
| Product: | Koha | Reporter: | Tomás Cohen Arazi (tcohen) <tomascohen> |
| Component: | Architecture, internals, and plumbing | Assignee: | Tomás Cohen Arazi (tcohen) <tomascohen> |
| Status: | Failed QA --- | QA Contact: | Testopia <testopia> |
| Severity: | enhancement | ||
| Priority: | P5 - low | CC: | david, jonathan.druart, kyle, martin.renvoize |
| Version: | unspecified | ||
| Hardware: | All | ||
| OS: | All | ||
| GIT URL: | Initiative type: | --- | |
| Sponsorship status: | --- | Comma delimited list of Sponsors: | |
| Crowdfunding goal: | 0 | Patch complexity: | --- |
| Documentation contact: | Documentation submission: | ||
| Text to go in the release notes: | Version(s) released in: | ||
| Circulation function: | |||
| Bug Depends on: | 29741 | ||
| Bug Blocks: | |||
| Attachments: | Bug 29742: Make deletemem.pl use Koha::Patron->safe_to_delete | ||
|
Description
Tomás Cohen Arazi (tcohen)
2021-12-20 18:44:05 UTC
Created attachment 128799 [details] [review] Bug 29742: Make deletemem.pl use Koha::Patron->safe_to_delete This patch makes the deletemem.pl controller script reuse the safe_to_delete method introduced by bug 29741. This way, it will use the same logic as the rest of the Koha pieces, like the API. To test: 1. Verify this conditions make deletion be denied: - Has a guarantee - Is the system-defined anonymous patron - Has outstanding debits - Has items checked out 2. Verify that this conditions display relevant information when trying to delete the patron: - Has outstanding credit - Has holds placed - Has pending suggestions 3. Apply this patch 4. Repeat 1 and 2 => SUCCESS: Things didn't change! [*] 5. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Hi Tomás.
After applying the patch (plus a flush_memcached + restart_all) I get this error when deleting a patron with no conditions that should stop the deletion:
Operation "eq": no method found,
left argument in overloaded package Koha::Result::Boolean,
right argument has no overloaded magic at /kohadevbox/koha/members/deletemem.pl line 86
in (eval) at /kohadevbox/koha/members/deletemem.pl line 86
83:
84: my $safe_to_delete = $patron->safe_to_delete;
85:
86: if ( $safe_to_delete eq 'is_anonymous_patron' ) {
87: print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$member&error=CANT_DELETE_ANONYMOUS_PATRON");
88: exit 0; # Exit without error
89: }
in CGI::Compile::ROOT::kohadevbox_koha_members_deletemem_2epl::__ANON__ at /kohadevbox/koha/members/deletemem.pl line 2
1: #!/usr/bin/perl
2:
3: #script to delete items
4: #written 2/5/00
5: #by chris@katipo.co.nz
Show function arguments
in CGI::Compile::ROOT::kohadevbox_koha_members_deletemem_2epl::deletemem_2epl at /usr/share/perl5/CGI/Compile.pm line 151
148: # this is necessary for MSWin32
149: my $orig_warn = $SIG{__WARN__} || sub { warn(@_) };
150: local $SIG{__WARN__} = sub { $orig_warn->(@_) unless $_[0] =~ /^No such signal/ };
151: $code->($self, $data, $path, $dir, \@args)
152: };
153: };
154:
in CGI::Emulate::PSGI::__ANON__ at /usr/share/perl5/CGI/Emulate/PSGI.pm line 30
27: local *STDOUT = $stdout;
28: local *STDERR = $env->{'psgi.errors'};
29:
30: $code->();
31: }
32: }
33:
Show function arguments
in Plack::App::WrapCGI::call at /usr/share/perl5/Plack/App/WrapCGI.pm line 95
92:
93: sub call {
94: my($self, $env) = @_;
95: $self->_app->($env);
96: }
97:
98: 1;
Show function arguments
|