create_koc_db.pl - create a database file for the offline circulation tool
create_koc_db.pl
Options: -help brief help message -man full documentation
Print a brief help message and exits.
Prints the manual page and exits.
The filename that we should use for the database file that we produce. Defaults to "borrowers.db"
Forcefully overwrite any existing db file. Defaults to false, so program will terminate prematurely if the file already exists.
This option cause the output file to be an SQLite2 database. This is the format that the original offline circ client ( the one written in PHP/Gtk, version < 1.0 ) requires.
This option cause the output file to be an SQLite3 database. This is the format that the new offline circ client ( the one written in C++/Qt4, version >= 1.0 ) requires.
This script generates a sqlite database file full of patron and holdings data that can be used by an offline circulation tool.
This program could be run from cron to occasionally refresh the offline circulation database. For instance:
0 0 * * * create_koc_db.pl
This program was originally created to interact with Kyle Hall's offline circulation tool, which is available from http://kylehall.info/index.php/projects/koha-tools/koha-offline-circulation/, but any similar tool could use the database that is produced.
Since DBD::SQLite is a new prerequisite and an optional one, let's make sure we have a new enough version of it.
pass in the filename that we're considering using for the SQLite db.
returns true if we can use it.
returns false if we can't. For example, if it alredy exists and we don't have --force or don't have permissions to unlink it.
Create sqlite borrowers table to mirror the koha borrowers table structure
Import the data from the koha.borrowers table into our sqlite table
Import the fines from koha.accountlines into the sqlite db
Create sqlite issues table with minimal information needed from koha tables issues, items, biblio, biblioitems
Import open issues from the koha database
pass in the name of a database table.
returns list of column names in that table.
pass in the name of a database table
returns a hash of column names to their types.
This sub returns a hashref where the keys are all the fields in the given tables, and the data is the field's type