Discussion:
[Koha] Exclude users from search (check out)
Paul Hoffman
2018-09-25 14:11:40 UTC
Permalink
we use Koha in our school and therefor many students get enrolled each
year, but also many students leave the school every year. Every year we
have more and more users, that are not at school anymore, but they still
exist in Koha. If we want to checkout books and search for the right
user we have many similar names over the years, sometimes the same
firstname and lastname.
Is it possible to deactivate users so they are excluded from the search
result (checkout)? I don't want to delete them because we will loose the
circulation data.
I think you'd have to modify the source code, but if you want to go down
that path then look for the call to
C4::Utils::DataTables::Members::search in the file
intranet/cgi-bin/circ/circulation.pl (lines 242-248 in our install).
Immediately after the following line, which sets the variable
$borrowers, add some code that discards elements in @$borrowers (i.e.,
that discards patrons) with an expiration date (too far) in the past.
Something like this (totally untested!):

my $borrowers = $results->{patrons};
# ------------------------ Add these lines ------------------------
use POSIX qw(strftime);
# Omit if expired more than 30 days ago (not taking possible
# daylight saving time transitions into account!)
my $cutoff = strftime('%Y-%m-%d', localtime(time - 30*86400));
# ^^^^^^^^^^ Or maybe '%Y%m%d'?
@$borrowers = grep { $_->{dateexpiry} gt $cutoff } @$borrowers;
# -----------------------------------------------------------------

However, what circulation data exactly do you want to preserve -- data
on fines that you're still hoping will be paid? I assume when purging
patron you can skip anyone with outstanding fees, so you'd get rid of
the vast majority(?) of old, crufty patrons but leave the ones you care
about.

Paul.
--
Paul Hoffman <***@flo.org>
Software Services Manager
Fenway Library Organization
550 Huntington Ave.
Boston, MA 02115
(617) 442-2384
_______________________________________________
Koha mailing list http://koha-community.org
***@lists.katipo.co.nz
https://lists.katipo.co.nz/mailman/listi
Owen Leonard
2018-09-25 15:17:22 UTC
Permalink
Is it possible to deactivate users so they are excluded from the search
result (checkout)? I don't want to delete them because we will loose the
circulation data.
What circulation data are you trying to retain? It may not be the case
that deleting patrons will be a problem.

-- Owen
--
Web Developer
Athens County Public Libraries
https://www.myacpl.org
_______________________________________________
Koha mailing list http://koha-community.org
***@lists.katipo.co.nz
https://lists.katipo.co.nz/mai
Katrin Fischer
2018-09-26 04:57:28 UTC
Permalink
Hi,

when a patron is deleted the borrowernumber in old_issues is set to NULL
and the entries in statistics are kept, so the entries will still be
there, only not linked to an existing patron.

For data privacy reasons you should not keep patron records
indefinitely. It's possible to delete expired patron accounts regularly
using the delete_patrons.pl cronjob or do it manually using the batch
patron deletion/anonymization tool.

Maybe run some tests with a test patron to see how deleting affects your
data?

Hope that helps,

Katrin
Post by Owen Leonard
What circulation data are you trying to retain? It may not be the case
that deleting patrons will be a problem.
e.g. Checkout history.
Regards
_______________________________________________
Koha mailing list http://koha-community.org
https://lists.katipo.co.nz/mailman/listinfo/koha
_______________________________________________
Koha mailing list http://koha-community.org
***@lists.katipo.co.n

Loading...