[Koha-patches] [PATCH] patron cleaning - do not delete staff borrowers

Galen Charlton galen.charlton at liblime.com
Tue May 13 17:56:49 CEST 2008


Adjusted C4::Members::GetBorrowersWhoHaveNotBorrowedSince so
that staff member records are not selected for deletion.

This functionality change is motivated by the consideration
that a staff member who is authorized to operate Koha is
not necessarily a prolific user of the library's services.
If a batch purge job for inactive staff records is really need,
it should be a separate tool.
---
 C4/Members.pm |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/C4/Members.pm b/C4/Members.pm
index 41e92dc..226308f 100644
--- a/C4/Members.pm
+++ b/C4/Members.pm
@@ -1856,11 +1856,13 @@ sub GetBorrowersWhoHaveNotBorrowedSince {
     my $query = "
         SELECT borrowers.borrowernumber,max(issues.timestamp) as latestissue
         FROM   borrowers
-          LEFT JOIN issues ON borrowers.borrowernumber = issues.borrowernumber
+        JOIN   categories USING (categorycode)
+        LEFT JOIN issues ON borrowers.borrowernumber = issues.borrowernumber
+        WHERE  category_type <> 'S'
    ";
     my @query_params;
     if ($filterbranch && $filterbranch ne ""){ 
-        $query.=" WHERE borrowers.branchcode= ?";
+        $query.=" AND borrowers.branchcode= ?";
         push @query_params,$filterbranch;
     }    
     $query.=" GROUP BY borrowers.borrowernumber";
-- 
1.5.5.rc0.16.g02b00




More information about the Koha-patches mailing list