Bug 16966: The method should return a Koha::Patrons object
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
parent
ce55b02446
commit
e8d34c2bdd
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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' );
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue