[Koha] anonymize circulation history
Galen Charlton
galen.charlton at liblime.com
Fri May 8 08:28:35 NZST 2009
Hi Rachel,
2009/5/7 Rachel Hollis <Rachel.Hollis at stevenshenager.edu>:
> 4. Affected items checked-in are “not checked out” - they cannot be returned
> so are forever overdue? is this because they are separated from patron data?
Yes. There is a way to get rid of them, which will require use of
SQL. With this sort of SQL update, it a good idea (nay, required!) to
do a complete backup beforehand, perform the update outside of normal
library hours, check the results right away, and be prepared to
restore from backup.
The process would looks like this:
1. Do your backup.
2. Find out exactly how many loans are now ghosts:
SELECT COUNT(*)
FROM issues
WHERE borrowernumber IS NULL;
2. Copy those loans that were incorrectly anonymized to the issue
history table using the following SQL:
INSERT INTO old_issues
SELECT * FROM issues
WHERE borrowernumber IS NULL;
3. Actually delete those ghost loans:
DELETE FROM issues
WHERE borrowernumber IS NULL;
4. Clear the item record's copy of the due date:
UPDATE items
SET onloan = null
WHERE itemnumber NOT IN (SELECT itemnumber FROM issues);
After you do this, those items will no longer be on loan. Because of
how Koha stores item information, and specifically the due date, you
may see a couple spots, probably in search results, where it appears
that the item still has a due date, but that won't prevent the item
from circulating.
This procedure will *most likely* allow these items to be circulated
again, although without a backup it is impossible to restore the
original borrowernumbers. Although I try not to overburden messages
with disclaimers, one definitely applies here: although I am happy to
answer further questions, actually running the update you would do at
your own risk - please be sure that your are certain that you can
backup and restore your database before trying this.
A fix for the underlying bug (null borrower numbers in the issues
table) is being worked on.
Regards,
Galen
--
Galen Charlton
VP, Research & Development, LibLime
galen.charlton at liblime.com
p: 1-888-564-2457 x709
skype: gmcharlt
More information about the Koha
mailing list