Bugzilla – Attachment 172005 Details for
Bug 37844
Remove C4::Members::DeleteUnverifiedOpacRegistrations
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37844: Remove C4::Members::DeleteUnverifiedOpacRegistrations
Bug-37844-Remove-C4MembersDeleteUnverifiedOpacRegi.patch (text/plain), 4.68 KB, created by
Kyle M Hall (khall)
on 2024-09-26 18:29:39 UTC
(
hide
)
Description:
Bug 37844: Remove C4::Members::DeleteUnverifiedOpacRegistrations
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2024-09-26 18:29:39 UTC
Size:
4.68 KB
patch
obsolete
>From a1da398d0759601e29b98382aabb3b28e7cc2482 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 5 Sep 2024 16:52:38 +0200 >Subject: [PATCH] Bug 37844: Remove > C4::Members::DeleteUnverifiedOpacRegistrations > >This patch removes the subroutine >C4::Members::DeleteUnverifiedOpacRegistrations and use the >Koha::Objects->filter_by_last_update method that is used for the other >flag in this script. > >Test plan: >Confirm that --del-unv-selfreg works the same before and after this >patch applied > >Signed-off-by: Sukhmandeep Benipal <sukhmandeep.benipal@inLibro.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > C4/Members.pm | 18 ------------------ > misc/cronjobs/cleanup_database.pl | 19 ++++++++++--------- > t/db_dependent/Members.t | 15 ++------------- > 3 files changed, 12 insertions(+), 40 deletions(-) > >diff --git a/C4/Members.pm b/C4/Members.pm >index 1d93b49fa10..4d37b33ad2e 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -46,7 +46,6 @@ BEGIN { > > IssueSlip > >- DeleteUnverifiedOpacRegistrations > DeleteExpiredOpacRegistrations > ); > } >@@ -524,23 +523,6 @@ sub DeleteExpiredOpacRegistrations { > return $cnt; > } > >-=head2 DeleteUnverifiedOpacRegistrations >- >- Delete all unverified self registrations in borrower_modifications, >- older than the specified number of days. >- >-=cut >- >-sub DeleteUnverifiedOpacRegistrations { >- my ( $days ) = @_; >- my $dbh = C4::Context->dbh; >- my $sql=qq| >-DELETE FROM borrower_modifications >-WHERE borrowernumber = 0 AND DATEDIFF( NOW(), timestamp ) > ?|; >- my $cnt=$dbh->do($sql, undef, ($days) ); >- return $cnt eq '0E0'? 0: $cnt; >-} >- > END { } # module clean-up code here (global destructor) > > 1; >diff --git a/misc/cronjobs/cleanup_database.pl b/misc/cronjobs/cleanup_database.pl >index 01930181294..526900c86f0 100755 >--- a/misc/cronjobs/cleanup_database.pl >+++ b/misc/cronjobs/cleanup_database.pl >@@ -522,11 +522,17 @@ if ($pExpSelfReg) { > say "self-registered borrowers may be deleted"; > } > } >+ > if ($pUnvSelfReg) { >- if ($confirm) { >- DeleteUnverifiedSelfRegs($pUnvSelfReg); >- } elsif ($verbose) { >- say "unverified self-registrations may be deleted"; >+ my $opac_registrations = >+ Koha::Patron::Modifications->search( { borrowernumber => 0 } ) >+ ->filter_by_last_update( { days => $pUnvSelfReg } ); >+ my $count = $opac_registrations->count; >+ $opac_registrations->delete if $confirm; >+ if ($verbose) { >+ say $confirm >+ ? sprintf( "Done with removing %d unverified self-registrations", $count ) >+ : sprintf( "%d unverified self-registrations would have been removed", $count ); > } > } > >@@ -907,11 +913,6 @@ sub DeleteExpiredSelfRegs { > print "Removed $cnt expired self-registered borrowers\n" if $verbose; > } > >-sub DeleteUnverifiedSelfRegs { >- my $cnt = C4::Members::DeleteUnverifiedOpacRegistrations( $_[0] ); >- print "Removed $cnt unverified self-registrations\n" if $verbose; >-} >- > sub DeleteSpecialHolidays { > my ($days) = @_; > >diff --git a/t/db_dependent/Members.t b/t/db_dependent/Members.t >index 70f4403cd5d..26327b35fe4 100755 >--- a/t/db_dependent/Members.t >+++ b/t/db_dependent/Members.t >@@ -33,7 +33,7 @@ use t::lib::Mocks; > use t::lib::TestBuilder; > > BEGIN { >- use_ok('C4::Members', qw( GetBorrowersToExpunge DeleteUnverifiedOpacRegistrations DeleteExpiredOpacRegistrations )); >+ use_ok('C4::Members', qw( GetBorrowersToExpunge DeleteExpiredOpacRegistrations )); > } > > my $schema = Koha::Database->schema; >@@ -389,18 +389,7 @@ $borrower = Koha::Patrons->find( $borrowernumber )->unblessed; > ok( $borrower->{userid}, 'A userid should have been generated correctly' ); > > subtest 'purgeSelfRegistration' => sub { >- plan tests => 8; >- >- #purge unverified >- my $d=360; >- C4::Members::DeleteUnverifiedOpacRegistrations($d); >- foreach(1..3) { >- $dbh->do("INSERT INTO borrower_modifications (timestamp, borrowernumber, verification_token, changed_fields) VALUES ('2014-01-01 01:02:03',0,?,'firstname,surname')", undef, (scalar localtime)."_$_"); >- } >- # Add a record with a borrowernumber which should not be deleted by DeleteUnverifiedOpacRegistrations >- # NOTE: We are using the borrowernumber from the last test outside this subtest >- $dbh->do( "INSERT INTO borrower_modifications (timestamp, borrowernumber, verification_token, changed_fields) VALUES ('2014-01-01 01:02:03', ?, '', 'firstname,surname' )", undef, $borrowernumber ); >- is( C4::Members::DeleteUnverifiedOpacRegistrations($d), 3, 'Test for DeleteUnverifiedOpacRegistrations' ); >+ plan tests => 7; > > #purge members in temporary category > my $c= 'XYZ'; >-- >2.39.2
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 37844
:
171079
|
171204
|
172002
| 172005