[Koha] importing issues into Koha

Gavin McCullagh gmccullagh at gmail.com
Sun Aug 6 03:22:38 NZST 2006


Hi,

in helping a group to migrate from Alice/Oasis to Koha, I've been asked to
automatically import the current loans into Koha.

I haven't noticed any scripts to achieve this so I'm having a bash at it
here in perl.  I'm currently figuring out how exactly the data maps between
the two systems.  I wonder if I could ask one or two questions about the
Koha database.

I gather the data I need to create is in the "issues" table which looks
like this:

+-----------------+---------------+------+-----+---------+-------+
| Field           | Type          | Null | Key | Default | Extra |
+-----------------+---------------+------+-----+---------+-------+
| borrowernumber  | int(11)       |      | MUL | 0       |       |
| itemnumber      | int(11)       |      | MUL | 0       |       |
| date_due        | date          | YES  |     | NULL    |       |
| branchcode      | char(4)       | YES  |     | NULL    |       |
| issuingbranch   | char(18)      | YES  |     | NULL    |       |
| returndate      | date          | YES  |     | NULL    |       |
| lastreneweddate | date          | YES  |     | NULL    |       |
| return          | char(4)       | YES  |     | NULL    |       |
| renewals        | tinyint(4)    | YES  |     | NULL    |       |
| timestamp       | timestamp(14) | YES  |     | NULL    |       |
+-----------------+---------------+------+-----+---------+-------+

 - The borrowernumber and itemnumber obviously relate to the primary keys
   in items and borrowers.

 - Do all loans stay in this table indefinitely even after they are
   returned? ie is this where the loan history is kept?

 - In terms of the dates, it looks like "date_due" is the current due date
   (duh!), "returndate" must then be the date the book is returned -- NULL
   initially, lastreneweddate is the date of last renewal.  If this is so,
   do you store the date the book was first lent or not?  Also, do you
   store the "renew history" of a given loan and where?

 - Do I guess correctly that there a single entry in this table per loan,
   not one for the initial loan and one for every renewal?

 - What exactly goes in the "return" field?

 - Is "renewals" an integer count of the number of times this particular
   loan has been renewed?

 - Should the timestamp be updated every time any record is changed or at
   record creation?

 - If I wanted statistics of how many loans/renewals were given out on a
   given day some time ago, could I do this?  It appears not.


I've looked over the wiki but i can't find this stuff directly.  I'm happy
wo wikifi an "issues table" page based on answers so that this info will be
more easily available.  Same for borrowers which I've already been over.
Only if people thing this is a good idea of course.  I guess it might
complement:

	http://wiki.koha.org/doku.php?id=en:development:dbschema

Many thanks,
Gavin




More information about the Koha mailing list