Bug 28588: (follow-up) Make the API use the new method
[koha-ffzg.git] / Koha / Patrons.pm
index b826c44..616fefa 100644 (file)
@@ -195,10 +195,7 @@ sub anonymise_issue_history {
         }
         );
         my $anonymous_patron = C4::Context->preference('AnonymousPatron') || undef;
-        $nb_rows += $old_issues_to_anonymise->update( {
-            'old_issues.borrowernumber' => $anonymous_patron,
-            'old_issues.issuer'         => $anonymous_patron
-        } );
+        $nb_rows += $old_issues_to_anonymise->update( { 'old_issues.borrowernumber' => $anonymous_patron } );
     }
     return $nb_rows;
 }
@@ -236,6 +233,26 @@ sub delete {
     return $patrons_deleted;
 }
 
+=head3 filter_by_expiration_date
+
+    Koha::Patrons->filter_by_expiration_date{{ days => $x });
+
+    Returns set of Koha patron objects expired $x days.
+
+=cut
+
+sub filter_by_expiration_date {
+    my ( $class, $params ) = @_;
+
+    return $class->filter_by_last_update(
+        {
+            timestamp_column_name => 'dateexpiry',
+            days                  => $params->{days} || 0,
+            days_inclusive        => 1,
+        }
+    );
+}
+
 =head3 search_unsubscribed
 
     Koha::Patrons->search_unsubscribed;