Lines 154-164
sub search_patrons_to_anonymise {
Link Here
|
154 |
( C4::Context->preference('IndependentBranches') && C4::Context->userenv && !C4::Context->IsSuperLibrarian() && C4::Context->userenv->{branch} ) |
154 |
( C4::Context->preference('IndependentBranches') && C4::Context->userenv && !C4::Context->IsSuperLibrarian() && C4::Context->userenv->{branch} ) |
155 |
? C4::Context->userenv->{branch} |
155 |
? C4::Context->userenv->{branch} |
156 |
: undef; |
156 |
: undef; |
|
|
157 |
my $anonymous_patron = C4::Context->preference('AnonymousPatron') || undef; |
157 |
|
158 |
|
158 |
my $dtf = Koha::Database->new->schema->storage->datetime_parser; |
159 |
my $dtf = Koha::Database->new->schema->storage->datetime_parser; |
159 |
my $rs = $class->_resultset->search( |
160 |
my $rs = $class->_resultset->search( |
160 |
{ returndate => { '<' => $dtf->format_datetime($older_than_date), }, |
161 |
{ |
161 |
'old_issues.borrowernumber' => { 'not' => undef }, |
162 |
returndate => { '<' => $dtf->format_datetime($older_than_date), }, |
|
|
163 |
'old_issues.borrowernumber' => { 'not' => [ undef, ( $anonymous_patron ? $anonymous_patron : () )]}, |
162 |
privacy => { '<>' => 0 }, # Keep forever |
164 |
privacy => { '<>' => 0 }, # Keep forever |
163 |
( $library ? ( 'old_issues.branchcode' => $library ) : () ), |
165 |
( $library ? ( 'old_issues.branchcode' => $library ) : () ), |
164 |
}, |
166 |
}, |
165 |
- |
|
|