[Koha] Checkout limit by household

Mark Alexander marka at pobox.com
Sat Jan 21 08:56:42 NZDT 2017


Our library (running Mandarin currently) has a limit of two DVDs
per household.  Mandarin doesn't enforce this limit; the librarian
knows pretty much everybody in this little town and has the data
in her head.  But we volunteers don't have that brainpower.

I have been working on a Koha upgrade for our library for some months,
and am pretty close to having everything working.  But this household
limit has me a bit stumped.  For one thing, our patron database is a
bit inconsistent, so if we define "household" as being "all borrowers
with the same address", we're in trouble because the same address
might be spelled several different ways.  (For example, Route can be
RT or RTE or Rte. or Rt. or Rt)

But leaving aside the consistency problem, Koha doesn't seem to have
a way to do this kind of check.  I can cobble together some SQL that
looks like this:

  select count(issue_id) from issues
    left join borrowers on issues.borrowernumber = borrowers.borrowernumber
    left join items on issues.itemnumber = items.itemnumber
    where borrowers.address = '123 Main Street'
    and city = 'Podunk'
    and state = 'VT'
    and items.itype = 'DVD';

and then check this result against configurable checkout limits for
particular item types.  This sounds like a fair amount of work in the
Koha codebase itself, so I was wondering if anybody else had looked
into this and had other ideas.


More information about the Koha mailing list