Bugzilla – Attachment 60705 Details for
Bug 16966
Koha::Patrons - Move GetBorrowersWithIssuesHistoryOlderThan to search_patrons_to_anonymise
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16966: The method should return a Koha::Patrons object
Bug-16966-The-method-should-return-a-KohaPatrons-o.patch (text/plain), 2.52 KB, created by
Marcel de Rooy
on 2017-02-27 12:45:52 UTC
(
hide
)
Description:
Bug 16966: The method should return a Koha::Patrons object
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2017-02-27 12:45:52 UTC
Size:
2.52 KB
patch
obsolete
>From 6c57dfc71248a5b664c38049ec5be8c29d25a6d7 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 20 Dec 2016 12:15:10 +0100 >Subject: [PATCH] Bug 16966: The method should return a Koha::Patrons object >Content-Type: text/plain; charset=utf-8 > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > Koha/Patrons.pm | 2 +- > t/db_dependent/Koha/Patrons.t | 8 ++++++-- > 2 files changed, 7 insertions(+), 3 deletions(-) > >diff --git a/Koha/Patrons.pm b/Koha/Patrons.pm >index 60e1a2c..8430d16 100644 >--- a/Koha/Patrons.pm >+++ b/Koha/Patrons.pm >@@ -199,7 +199,7 @@ sub search_patrons_to_anonymise { > : undef; > > my $dtf = Koha::Database->new->schema->storage->datetime_parser; >- my $rs = $class->search( >+ my $rs = $class->_resultset->search( > { returndate => { '<' => $dtf->format_datetime($older_than_date), }, > 'old_issues.borrowernumber' => { 'not' => undef }, > privacy => { '<>' => 0 }, # Keep forever >diff --git a/t/db_dependent/Koha/Patrons.t b/t/db_dependent/Koha/Patrons.t >index 2de5877..04f4565 100644 >--- a/t/db_dependent/Koha/Patrons.t >+++ b/t/db_dependent/Koha/Patrons.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 20; >+use Test::More tests => 21; > use Test::Warn; > use DateTime; > >@@ -688,7 +688,7 @@ subtest 'search_patrons_to_anonymise & anonymise_issue_history' => sub { > t::lib::Mocks::mock_preference( 'AnonymousPatron', $anonymous->{borrowernumber} ); > > subtest 'patron privacy is 1 (default)' => sub { >- plan tests => 3; >+ plan tests => 4; > > t::lib::Mocks::mock_preference('IndependentBranches', 0); > my $patron = $builder->build( >@@ -715,6 +715,10 @@ subtest 'search_patrons_to_anonymise & anonymise_issue_history' => sub { > > my ( $returned, undef, undef ) = C4::Circulation::AddReturn( $item->{barcode}, undef, undef, undef, '2010-10-10' ); > is( $returned, 1, 'The item should have been returned' ); >+ >+ my $patron_to_anonymise = Koha::Patrons->search_patrons_to_anonymise( '2010-10-11' )->search( { 'me.borrowernumber' => $patron->{borrowernumber} } )->next; >+ is( ref($patron_to_anonymise), 'Koha::Patron', 'search_patrons_to_anonymise should return Koha::Patrons' ); >+ > my $rows_affected = Koha::Patrons->search_patrons_to_anonymise( '2010-10-11')->anonymise_issue_history('2010-10-11'); > ok( $rows_affected > 0, 'AnonymiseIssueHistory should affect at least 1 row' ); > >-- >2.1.4
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 16966
:
53658
|
53659
|
53660
|
53661
|
56376
|
56377
|
56378
|
56379
|
56639
|
56640
|
56641
|
56642
|
57170
|
57171
|
57172
|
57885
|
57886
|
57887
|
57924
|
57925
|
57926
|
58282
|
58283
|
58284
|
58285
|
58286
|
60377
|
60378
|
60379
|
60380
|
60381
|
60382
|
60648
|
60649
|
60650
|
60651
|
60652
|
60653
|
60701
|
60702
|
60703
|
60704
| 60705 |
60706
|
60707
|
60708
|
60709