View | Details | Raw Unified | Return to bug 11897
Collapse All | Expand All

(-)a/misc/cronjobs/stockrotation.pl (-4 / +49 lines)
Lines 55-63 if they are elible for processing. Link Here
55
55
56
it should be run from cron like:
56
it should be run from cron like:
57
57
58
   stockrotation.pl
58
   stockrotation.pl --report email --send-email --execute
59
   -OR-
59
60
   stockrotation.pl -h
60
Prior to that you can run the script from the command line without the
61
--execute and --send-email parameters to see what reports the script would
62
generate in 'production' mode.  This is immensely useful for testing, or for
63
getting to understand how the stockrotation module works: you can set up
64
different scenarios, and then "query" the system on what it would do.
65
66
Normally you would want to run this script once per day, probably around
67
midnight-ish to move any stockrotationitems along their rotas and to generate
68
the email reports for branch libraries.
69
70
Each library will receive a report with "items of interest" for them for
71
today's rota checks.  Each item there will be an item that should, according
72
to Koha, be located on the shelves of that branch, and which should be picked
73
up and checked in.  The item will either:
74
- have been placed in transit to their new stage library;
75
- have been placed in transit to be returned to their current stage library;
76
- have just been added to a rota and will already be at the correct library;
77
78
In the last case the item will be checked in and no message will pop up.  In
79
the other cases a message will pop up requesting the item be posted to their
80
new branch.
81
82
=head2 What does the --execute flag do?
83
84
To understand this, you will need to know a little bit about the design of
85
this script and the stockrotation modules.
86
87
This script operates in 3 phases: first it walks the graph of rotas, stages
88
and items.  For each active rota, it investigates the items in each stage and
89
determines whether action is required.  It does not perform any actions, it
90
just "sieves" all items on active rotas into "actionable" and "non-actionable"
91
baskets.  We can use these baskets to perform actions against the items, or to
92
generate reports.
93
94
During the second phase this script then loops through the actionable baskets,
95
and performs the relevant action (initiate, repatriate, advance) on each item.
96
97
Finally, during the third phase we revisit the original baskets and we compile
98
reports (for instance per branch email reports).
99
100
When the script is run without the "--execute" flag, we perform phase 1, skip
101
phase 2 and move straight onto phase 3.
102
103
With the "--execute" flag we also perform the database operations.
104
105
So with or without the flag, the report will look the same (except for the "No
106
database updates have been performed.").
61
107
62
=cut
108
=cut
63
109
64
- 

Return to bug 11897