Lines 716-725
subtest 'search_patrons_to_anonymise & anonymise_issue_history' => sub {
Link Here
|
716 |
my ( $returned, undef, undef ) = C4::Circulation::AddReturn( $item->{barcode}, undef, undef, undef, '2010-10-10' ); |
716 |
my ( $returned, undef, undef ) = C4::Circulation::AddReturn( $item->{barcode}, undef, undef, undef, '2010-10-10' ); |
717 |
is( $returned, 1, 'The item should have been returned' ); |
717 |
is( $returned, 1, 'The item should have been returned' ); |
718 |
|
718 |
|
719 |
my $patrons_to_anonymise = Koha::Patrons->search_patrons_to_anonymise( '2010-10-11' )->search( { 'me.borrowernumber' => $patron->{borrowernumber} } ); |
719 |
my $patrons_to_anonymise = Koha::Patrons->search_patrons_to_anonymise( { before => '2010-10-11' } )->search( { 'me.borrowernumber' => $patron->{borrowernumber} } ); |
720 |
is( ref($patrons_to_anonymise), 'Koha::Patrons', 'search_patrons_to_anonymise should return Koha::Patrons' ); |
720 |
is( ref($patrons_to_anonymise), 'Koha::Patrons', 'search_patrons_to_anonymise should return Koha::Patrons' ); |
721 |
|
721 |
|
722 |
my $rows_affected = Koha::Patrons->search_patrons_to_anonymise( '2010-10-11')->anonymise_issue_history('2010-10-11'); |
722 |
my $rows_affected = Koha::Patrons->search_patrons_to_anonymise( { before => '2010-10-11' } )->anonymise_issue_history( { before => '2010-10-11' } ); |
723 |
ok( $rows_affected > 0, 'AnonymiseIssueHistory should affect at least 1 row' ); |
723 |
ok( $rows_affected > 0, 'AnonymiseIssueHistory should affect at least 1 row' ); |
724 |
|
724 |
|
725 |
my $dbh = C4::Context->dbh; |
725 |
my $dbh = C4::Context->dbh; |
Lines 758-764
subtest 'search_patrons_to_anonymise & anonymise_issue_history' => sub {
Link Here
|
758 |
|
758 |
|
759 |
my ( $returned, undef, undef ) = C4::Circulation::AddReturn( $item->{barcode}, undef, undef, undef, '2010-10-10' ); |
759 |
my ( $returned, undef, undef ) = C4::Circulation::AddReturn( $item->{barcode}, undef, undef, undef, '2010-10-10' ); |
760 |
is( $returned, 1, 'The item should have been returned' ); |
760 |
is( $returned, 1, 'The item should have been returned' ); |
761 |
my $rows_affected = Koha::Patrons->search_patrons_to_anonymise( '2010-10-11')->anonymise_issue_history('2010-10-11'); |
761 |
my $rows_affected = Koha::Patrons->search_patrons_to_anonymise( { before => '2010-10-11' } )->anonymise_issue_history( { before => '2010-10-11' } ); |
762 |
ok( $rows_affected > 0, 'AnonymiseIssueHistory should not return any error if success' ); |
762 |
ok( $rows_affected > 0, 'AnonymiseIssueHistory should not return any error if success' ); |
763 |
|
763 |
|
764 |
my $dbh = C4::Context->dbh; |
764 |
my $dbh = C4::Context->dbh; |
Lines 799-805
subtest 'search_patrons_to_anonymise & anonymise_issue_history' => sub {
Link Here
|
799 |
|
799 |
|
800 |
my ( $returned, undef, undef ) = C4::Circulation::AddReturn( $item->{barcode}, undef, undef, undef, '2010-10-10' ); |
800 |
my ( $returned, undef, undef ) = C4::Circulation::AddReturn( $item->{barcode}, undef, undef, undef, '2010-10-10' ); |
801 |
is( $returned, 1, 'The item should have been returned' ); |
801 |
is( $returned, 1, 'The item should have been returned' ); |
802 |
my $rows_affected = Koha::Patrons->search_patrons_to_anonymise( '2010-10-11')->anonymise_issue_history('2010-10-11'); |
802 |
my $rows_affected = Koha::Patrons->search_patrons_to_anonymise( { before => '2010-10-11' } )->anonymise_issue_history( { before => '2010-10-11' } ); |
803 |
ok( $rows_affected > 0, 'AnonymiseIssueHistory should affect at least 1 row' ); |
803 |
ok( $rows_affected > 0, 'AnonymiseIssueHistory should affect at least 1 row' ); |
804 |
|
804 |
|
805 |
my $dbh = C4::Context->dbh; |
805 |
my $dbh = C4::Context->dbh; |
Lines 836-842
subtest 'search_patrons_to_anonymise & anonymise_issue_history' => sub {
Link Here
|
836 |
); |
836 |
); |
837 |
|
837 |
|
838 |
my ( $returned, undef, undef ) = C4::Circulation::AddReturn( $item->{barcode}, undef, undef, undef, '2010-10-10' ); |
838 |
my ( $returned, undef, undef ) = C4::Circulation::AddReturn( $item->{barcode}, undef, undef, undef, '2010-10-10' ); |
839 |
is( Koha::Patrons->search_patrons_to_anonymise( '2010-10-11')->count, 0 ); |
839 |
is( Koha::Patrons->search_patrons_to_anonymise( { before => '2010-10-11' } )->count, 0 ); |
840 |
Koha::Patrons->find( $patron->{borrowernumber})->delete; |
840 |
Koha::Patrons->find( $patron->{borrowernumber})->delete; |
841 |
}; |
841 |
}; |
842 |
|
842 |
|