Giter VIP home page Giter VIP logo

booknet_report's Introduction

booknet_report

SQL Queries and Shell scripts for generating and sending reports from Koha to Booknet Canada.

Prerequisites

Before you start, contact Booknet Canada, work with them to determine what your System Code will be. This will be a short alphabetic code that represents your library.

Booknet will also provide an FTP server name, username and password.

This script assumes the use Koha running on Debian using packaged koha.

You will also need to know the instance name of your koha installation. It will be one of the entries the list generated by runnig the command

sudo koha-list

on the console of your Koha server.

From this point forward SYSTEMCODE will refer to your booknet system code, and INSTANCE will refer to your Koha instance name.

NOTE: the reports and scripts are assumed to be running early in the morning on the day after the date range in the report. The 'date' mentioned in the report, as well as the embedded dates in the file names are back dated by one day.

Setting up the reports

Copy the contents of branch_data_file.sql and lending_file.sql into new SQL reports. Make sure that you note the report number for each report.

In the branch data report, Change the line that reads

'CHANGEME' AS 'System Code',

Change CHANGEME to SYSTEMCODE

Setting up the shell scripts

There are two shell scripts, ftp_report.siteconfig.sh and ftp_report.sh. These should be placed in the $HOME directory of your koha user. This will be /var/lib/koha/INSTANCE.

Edit ftp_report.siteconfig.sh and change the following lines:

export KOHA_INSTANCE="CHANGEME"
export FILE_TYPE="CHANGEME"  
export FTPSERVER="CHANGEME"
export FTPUSERNAME="CHANGEME"
export FTPPASSWORD="CHANGEME"

KOHA_INSTANCE will match INSTANCE. FILE_TYPE should be csv FTPSERVER, FTPUSERNAME and FTPPASSWORD will be the ftp server, username and password supplied by Booknet Canada.

Because ftp_report.siteconfig.sh contains username and password information, you should restrict the permissions using chmod. It should be owened by the Koha instance user

sudo chown INSTANCE-koha:INSTANCE-koha /var/lib/koha/INSTANCE/ftp_report.siteconfig.sh
sudo chmod 600 /var/lib/koha/INSTANCE/ftp_report.siteconfig.sh

Assuming that the branch data report is report number 20, and the lendig data report is 21, Add the following text to /etc/init.d/koah-INSTANCE. The file may or may not exist; add whatever is missing. The file should be owned by root.

#!/bin/bash
# /etc/cron.d/koha-INSTANCE
# Default cron file for package INSTANCE koha user. Place in /etc/cron.d/
# Do not forget to include INSTANCE-koha username before the command

# m h dom mon dow user command
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
INST=INSTANCE
HOMEDIR=/var/lib/koha/INSTANCE
PERL5LIB=/usr/share/koha/lib
KOHA_CONF=/etc/koha/sites/INSTANCE/koha-conf.xml
KOHA_CRON_PATH=/usr/share/koha/bin/cronjobs

0 1 * * 1 INSTANCE-koha $HOMEDIR/ftp_report.sh 20 BRANCHDATA_SYSTEMCODE
1 1 * * 1 INSTANCE-koha $HOMEDIR/ftp_report.sh 21 LENDINGDATA_SYSTEMCODE

booknet_report's People

Contributors

bartonski avatar

Watchers

Kyle M Hall avatar James Cloos avatar  avatar Wm. Nick Clemens avatar Joy avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.