<<

NAME

create_koc_db.pl - create a database file for the offline circulation tool

SYNOPSIS

create_koc_db.pl

 Options:
   -help                          brief help message
   -man                           full documentation

OPTIONS

--help

Print a brief help message and exits.

--man

Prints the manual page and exits.

--file

The filename that we should use for the database file that we produce. Defaults to "borrowers.db"

--force

Forcefully overwrite any existing db file. Defaults to false, so program will terminate prematurely if the file already exists.

--sqlite2

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.

--sqlite3

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.

DESCRIPTION

This script generates a sqlite database file full of patron and holdings data that can be used by an offline circulation tool.

USAGE EXAMPLES

This program could be run from cron to occasionally refresh the offline circulation database. For instance:

0 0 * * * create_koc_db.pl

SEE ALSO

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.

INTERNAL METHODS

verify_dbd_sqlite

Since DBD::SQLite is a new prerequisite and an optional one, let's make sure we have a new enough version of it.

prepare_file_for_writing

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_borrowers_table

Create sqlite borrowers table to mirror the koha borrowers table structure

populate_borrowers_table

Import the data from the koha.borrowers table into our sqlite table

add_fines_to_borrowers_table

Import the fines from koha.accountlines into the sqlite db

create_issue_table

Create sqlite issues table with minimal information needed from koha tables issues, items, biblio, biblioitems

populate_issues_table

Import open issues from the koha database

get_columns_of_table

pass in the name of a database table.

returns list of column names in that table.

get_columns_and_types_of_table

pass in the name of a database table

returns a hash of column names to their types.

get_columns_for_issues_table

This sub returns a hashref where the keys are all the fields in the given tables, and the data is the field's type

<<