From ce36a8e06af734c1dfcfb023d5f4e63871cc687b Mon Sep 17 00:00:00 2001 From: Alex Sassmannshausen Date: Wed, 5 Apr 2017 15:03:07 +0200 Subject: [PATCH] Bug 11897: Add documentation for the cron script. * misc/cronjobs/stockrotation.pl: Add documentation. --- misc/cronjobs/stockrotation.pl | 52 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 3 deletions(-) diff --git a/misc/cronjobs/stockrotation.pl b/misc/cronjobs/stockrotation.pl index df1a9c7290..0926b9eb05 100755 --- a/misc/cronjobs/stockrotation.pl +++ b/misc/cronjobs/stockrotation.pl @@ -55,9 +55,55 @@ if they are elible for processing. it should be run from cron like: - stockrotation.pl - -OR- - stockrotation.pl -h + stockrotation.pl --report email --send-email --execute + +Prior to that you can run the script from the command line without the +--execute and --send-email parameters to see what reports the script would +generate in 'production' mode. This is immensely useful for testing, or for +getting to understand how the stockrotation module works: you can set up +different scenarios, and then "query" the system on what it would do. + +Normally you would want to run this script once per day, probably around +midnight-ish to move any stockrotationitems along their rotas and to generate +the email reports for branch libraries. + +Each library will receive a report with "items of interest" for them for +today's rota checks. Each item there will be an item that should, according +to Koha, be located on the shelves of that branch, and which should be picked +up and checked in. The item will either: +- have been placed in transit to their new stage library; +- have been placed in transit to be returned to their current stage library; +- have just been added to a rota and will already be at the correct library; + +In the last case the item will be checked in and no message will pop up. In +the other cases a message will pop up requesting the item be posted to their +new branch. + +=head2 What does the --execute flag do? + +To understand this, you will need to know a little bit about the design of +this script and the stockrotation modules. + +This script operates in 3 phases: first it walks the graph of rotas, stages +and items. For each active rota, it investigates the items in each stage and +determines whether action is required. It does not perform any actions, it +just "sieves" all items on active rotas into "actionable" and "non-actionable" +baskets. We can use these baskets to perform actions against the items, or to +generate reports. + +During the second phase this script then loops through the actionable baskets, +and performs the relevant action (initiate, repatriate, advance) on each item. + +Finally, during the third phase we revisit the original baskets and we compile +reports (for instance per branch email reports). + +When the script is run without the "--execute" flag, we perform phase 1, skip +phase 2 and move straight onto phase 3. + +With the "--execute" flag we also perform the database operations. + +So with or without the flag, the report will look the same (except for the "No +database updates have been performed."). =cut -- 2.11.0