This page is intended as a brief overview of serials planning code in Koha 3.x , aimed at developers.
Notes:
This table is a partial implementation of a proper link between serial records and item records.
Earlier Koha implementation used serial.itemnumber as a varchar list of items.
serialitems currently is constrained to 1-1, with the expectation that it will be expanded to allow 1-n (serial-item) in the future.
Currently planning for a given serial issue is based on the current 'expected' issue (serial.status == 1 ).
Creation of a new planned issue is triggered by the transition of an existing serial record from status == 1 to status == 2.
Chronology is caluculated from the last entry in the serials table ( the one that just triggered the new issue, by changing status from 1 (expected) to 2 (arrived).
Enumeration is calculated from the subscription table, and cannot be affected by editing serial records.
Here we create a third order enumeration subscription, shown in the screenshot
Note: the screenshot shows an edit of the original subscription, which is reflected in the values of lastvalue1, etc. below.
A screenshot of the original subscription entry would have shown the first publication date ...
Since it's an edit, we show the first issue publication date, and the next issue's planned date.
If this screenshot were from an _add_ operation instead of _edit_ on subscription_add, we would not see
this difference.
This results in the following subscription entry...
mysql> select periodicity P,numberingmethod , add1 ADD_X, every1 EA_X,whenmorethan1 ROLL_X, setto1 RST_X, add2 ADD_Y, every2 EA_Y, whenmorethan2 ROLL_Y , setto2 RST_Y ,add3 ADD_Z, every3 EA_Z , whenmorethan3 ROLL_Z, setto3 RST_Z
P | numberingmethod | ADD_X | EA_X | ROLL_X | RST_X | ADD_Y | EA_Y | ROLL_Y | RST_Y | ADD_Z | EA_Z | ROLL_Z | RST_Z |
5 | x={X} y={Y} z={Z} | 1 | 12 | 9999999 | 0 | 1 | 3 | 4 | 1 | 1 | 1 | 3 | 1 |
Here's what happens to the innerloops and lastvalues as we receive a year's worth of issues
innerloop_X | innerloop_Y | innerloop_Z | lastvalue_X | lastvalue_Y | lastvalue_Z |
0 | 0 | 0 | 1 | 1 | 1 |
1 | 1 | 0 | 1 | 1 | 2 |
2 | 2 | 0 | 1 | 1 | 3 |
3 | 0 | 0 | 1 | 2 | 1 |
4 | 1 | 0 | 1 | 2 | 2 |
5 | 2 | 0 | 1 | 2 | 3 |
6 | 0 | 0 | 1 | 3 | 1 |
7 | 1 | 0 | 1 | 3 | 2 |
8 | 2 | 0 | 1 | 3 | 3 |
9 | 0 | 0 | 1 | 4 | 1 |
10 | 1 | 0 | 1 | 4 | 2 |
11 | 2 | 0 | 1 | 4 | 3 |
0 | 0 | 0 | 2 | 1 | 1 |
And here's what the serials table looks like
mysql> select serialseq, planneddate, publisheddate from serial where subscriptionid=26;
serialseq | planneddate | publisheddate |
x=1 y=1 z=1 | 2008-01-01 | 2008-01-01 |
x=1 y=1 z=2 | 2008-02-01 | 2008-02-01 |
x=1 y=1 z=3 | 2008-03-01 | 2008-03-01 |
x=1 y=2 z=1 | 2008-04-01 | 2008-04-01 |
x=1 y=2 z=2 | 2008-05-01 | 2008-05-01 |
x=1 y=2 z=3 | 2008-06-01 | 2008-06-01 |
x=1 y=3 z=1 | 2008-07-01 | 2008-07-01 |
x=1 y=3 z=2 | 2008-08-01 | 2008-08-01 |
x=1 y=3 z=3 | 2008-09-01 | 2008-09-01 |
x=1 y=4 z=1 | 2008-10-01 | 2008-10-01 |
x=1 y=4 z=2 | 2008-11-01 | 2008-11-01 |
x=1 y=4 z=3 | 2008-12-01 | 2008-12-01 |
x=2 y=1 z=1 | 2009-01-01 | 2009-01-01 |