Lines 18-24
Link Here
|
18 |
|
18 |
|
19 |
use Modern::Perl; |
19 |
use Modern::Perl; |
20 |
|
20 |
|
21 |
use Test::More tests => 4; |
21 |
use Test::More tests => 5; |
22 |
|
22 |
|
23 |
use C4::Context; |
23 |
use C4::Context; |
24 |
use C4::Circulation; |
24 |
use C4::Circulation; |
Lines 56-64
t::lib::Mocks::mock_preference( 'AnonymousPatron', $anonymous->{borrowernumber}
Link Here
|
56 |
|
56 |
|
57 |
subtest 'patron privacy is 1 (default)' => sub { |
57 |
subtest 'patron privacy is 1 (default)' => sub { |
58 |
plan tests => 4; |
58 |
plan tests => 4; |
|
|
59 |
t::lib::Mocks::mock_preference('IndependentBranches', 0); |
59 |
my $patron = $builder->build( |
60 |
my $patron = $builder->build( |
60 |
{ source => 'Borrower', |
61 |
{ source => 'Borrower', |
61 |
value => { privacy => 1, } |
62 |
value => { privacy => 1, branchcode => $userenv_patron->{branchcode} } |
62 |
} |
63 |
} |
63 |
); |
64 |
); |
64 |
my $item = $builder->build( |
65 |
my $item = $builder->build( |
Lines 94-103
subtest 'patron privacy is 1 (default)' => sub {
Link Here
|
94 |
|
95 |
|
95 |
subtest 'patron privacy is 0 (forever)' => sub { |
96 |
subtest 'patron privacy is 0 (forever)' => sub { |
96 |
plan tests => 3; |
97 |
plan tests => 3; |
|
|
98 |
t::lib::Mocks::mock_preference('IndependentBranches', 0); |
97 |
|
99 |
|
98 |
my $patron = $builder->build( |
100 |
my $patron = $builder->build( |
99 |
{ source => 'Borrower', |
101 |
{ source => 'Borrower', |
100 |
value => { privacy => 0, } |
102 |
value => { privacy => 0, branchcode => $userenv_patron->{branchcode} } |
101 |
} |
103 |
} |
102 |
); |
104 |
); |
103 |
my $item = $builder->build( |
105 |
my $item = $builder->build( |
Lines 133-141
t::lib::Mocks::mock_preference( 'AnonymousPatron', '' );
Link Here
|
133 |
|
135 |
|
134 |
subtest 'AnonymousPatron is not defined' => sub { |
136 |
subtest 'AnonymousPatron is not defined' => sub { |
135 |
plan tests => 4; |
137 |
plan tests => 4; |
|
|
138 |
t::lib::Mocks::mock_preference('IndependentBranches', 0); |
136 |
my $patron = $builder->build( |
139 |
my $patron = $builder->build( |
137 |
{ source => 'Borrower', |
140 |
{ source => 'Borrower', |
138 |
value => { privacy => 1, } |
141 |
value => { privacy => 1, branchcode => $userenv_patron->{branchcode} } |
139 |
} |
142 |
} |
140 |
); |
143 |
); |
141 |
my $item = $builder->build( |
144 |
my $item = $builder->build( |
Lines 168-173
subtest 'AnonymousPatron is not defined' => sub {
Link Here
|
168 |
is( $borrowernumber_used_to_anonymised, undef, 'With AnonymousPatron is not defined, the issue should have been anonymised anyway' ); |
171 |
is( $borrowernumber_used_to_anonymised, undef, 'With AnonymousPatron is not defined, the issue should have been anonymised anyway' ); |
169 |
}; |
172 |
}; |
170 |
|
173 |
|
|
|
174 |
subtest 'Logged in librarian is not superlibrarian & IndependentBranches' => sub { |
175 |
plan tests => 1; |
176 |
t::lib::Mocks::mock_preference('IndependentBranches', 1); |
177 |
my $patron = $builder->build( |
178 |
{ source => 'Borrower', |
179 |
value => { privacy => 1 } # Another branchcode than the logged in librarian |
180 |
} |
181 |
); |
182 |
my $item = $builder->build( |
183 |
{ source => 'Item', |
184 |
value => { |
185 |
itemlost => 0, |
186 |
withdrawn => 0, |
187 |
}, |
188 |
} |
189 |
); |
190 |
my $issue = $builder->build( |
191 |
{ source => 'Issue', |
192 |
value => { |
193 |
borrowernumber => $patron->{borrowernumber}, |
194 |
itemnumber => $item->{itemnumber}, |
195 |
}, |
196 |
} |
197 |
); |
198 |
|
199 |
my ( $returned, undef, undef ) = C4::Circulation::AddReturn( $item->{barcode}, undef, undef, undef, '2010-10-10' ); |
200 |
my $patrons_to_anonymise = C4::Members::GetBorrowersWithIssuesHistoryOlderThan( '2010-10-11' ); |
201 |
my ( $rows_affected, $err ) = C4::Circulation::AnonymiseIssueHistory('2010-10-11'); |
202 |
is( scalar(@$patrons_to_anonymise), $rows_affected, , 'AnonymiseIssueHistory should affect at least 1 row' ); |
203 |
}; |
204 |
|
171 |
subtest 'Test StoreLastBorrower' => sub { |
205 |
subtest 'Test StoreLastBorrower' => sub { |
172 |
plan tests => 6; |
206 |
plan tests => 6; |
173 |
|
207 |
|
174 |
- |
|
|