Bugzilla – Attachment 21766 Details for
Bug 10419
There is no cronjob script for deleting patrons
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] Bug 10419: Patrons with fines should not be deleted
SIGNED-OFF-Bug-10419-Patrons-with-fines-should-not.patch (text/plain), 2.81 KB, created by
Bernardo Gonzalez Kriegel
on 2013-10-03 14:14:50 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 10419: Patrons with fines should not be deleted
Filename:
MIME Type:
Creator:
Bernardo Gonzalez Kriegel
Created:
2013-10-03 14:14:50 UTC
Size:
2.81 KB
patch
obsolete
>From cfc169a0dbd2259e753f3297842fcb2879b575cd Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Mon, 30 Sep 2013 14:14:15 +0200 >Subject: [PATCH] [SIGNED-OFF] Bug 10419: Patrons with fines should not be > deleted > >Test plan: >- add a fine for a patron >- verify the script does not delete this patron. > >Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> >Works, script do not delete a patron with fines. >No koha-qa errors with all patches applied > >Test >1) Added a fine to a patron >2) run script >3) reports condition >Trying to delete patron 5... Failed to delete patron 5: patron has 10.00 in fines >4) Patron is not deleted >--- > misc/cronjobs/delete_patrons.pl | 24 ++++++++++++++++++------ > 1 file changed, 18 insertions(+), 6 deletions(-) > >diff --git a/misc/cronjobs/delete_patrons.pl b/misc/cronjobs/delete_patrons.pl >index cc47b7a..3be8167 100755 >--- a/misc/cronjobs/delete_patrons.pl >+++ b/misc/cronjobs/delete_patrons.pl >@@ -57,37 +57,49 @@ $dbh->{RaiseError} = 1; > $dbh->{PrintError} = 0; > > $dbh->{AutoCommit} = 0; # use transactions to avoid partial deletes >+my $deleted = 0; > for my $member (@$members) { > print "Trying to delete patron $member->{borrowernumber}... " > if $verbose; >+ >+ my $borrowernumber = $member->{borrowernumber}; >+ my $flags = C4::Members::patronflags( $member ); >+ if ( my $charges = $flags->{CHARGES}{amount} ) { >+ say "Failed to delete patron $borrowernumber: patron has $charges in fines"; >+ next; >+ } >+ > eval { >- C4::Members::MoveMemberToDeleted( $member->{borrowernumber} ) >+ C4::Members::MoveMemberToDeleted( $borrowernumber ) > if $confirm; > }; > if ($@) { >- say "Failed to delete patron $member->{borrowernumber}, cannot move it: ($@)"; >+ say "Failed to delete patron $borrowernumber, cannot move it: ($@)"; > $dbh->rollback; > next; > } > eval { >- C4::VirtualShelves::HandleDelBorrower( $member->{borrowernumber} ) >+ C4::VirtualShelves::HandleDelBorrower( $borrowernumber ) > if $confirm; > }; > if ($@) { >- say "Failed to delete patron $member->{borrowernumber}, error handling its lists: ($@)"; >+ say "Failed to delete patron $borrowernumber, error handling its lists: ($@)"; > $dbh->rollback; > next; > } >- eval { C4::Members::DelMember( $member->{borrowernumber} ) if $confirm; }; >+ eval { C4::Members::DelMember( $borrowernumber ) if $confirm; }; > if ($@) { >- say "Failed to delete patron $member->{borrowernumber}: $@)"; >+ say "Failed to delete patron $borrowernumber: $@)"; > $dbh->rollback; > next; > } > $dbh->commit; >+ $deleted++; > say "OK" if $verbose; > } > >+say "$deleted patrons deleted"; >+ > =head1 NAME > > delete_patrons - This script deletes patrons >-- >1.7.9.5
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 10419
:
18677
|
18725
|
18743
|
18754
|
18990
|
19635
|
19651
|
20112
|
20113
|
20114
|
20115
|
20133
|
20134
|
20135
|
20136
|
20137
|
20138
|
20294
|
20295
|
20296
|
20297
|
21658
|
21765
|
21766
|
21773
|
21774
|
21780
|
21781
|
21782
|
21783
|
21784
|
21785
|
21786
|
21787