Bug 15543: Use another notice in membership_expiry.pl
commit52d30fba7b469c8f879a22af6cb9b0c5643f81ae
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Mon, 18 Jan 2016 10:48:14 +0000 (18 11:48 +0100)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 29 Apr 2016 16:58:58 +0000 (29 16:58 +0000)
tree654d6aa109119f7bcde8e9a2591be29ac55aa9ca
parent51be8ecd9d7a1d260fd2b1788cb6d54d8da53f31
Bug 15543: Use another notice in membership_expiry.pl

This patch adds a letter parameter to the cron job membership_expiry.
It is used to substitute the default notice by another one.
This could be handy if you e.g. send a reminder after the first notice.
In any case, it allows for more flexibility.

Apart from this new parameter, this patch removes the sub parse_letter from
the code. The call to GetPreparedLetter is moved to the for loop and the
call to getletter is removed (no longer needed). If there is no letter
found, the Letter module already warns you. So we just exit the loop.

Test plan:
[1] Run membership_expiry.pl -c -n -v -let NOT_EXIST
    Check if you see a warning (coming from Letters.pm)
[2] Check if you have some soon expiring patrons or add before/after
    parameter to include some.
    Run membership_expiry.pl -c -n -v [-before ?] [-after ?]
[3] Create a new notice MEMBERSHIP2. Copy the text from the original notice
    and make some adjustments.
[4] Run membership_expiry.pl -c -v -let MEMBERSHIP2 [-before ?] [-after ?].
    Be aware that this call generates email messages.
    Verify that the email contained the adjusted text.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
On top of Bug 14834
Work as described, tested using '-n' to see messages on terminal, e.g.
membership_expiry.pl -v -n -c -before 3 -branch BC -after 2 --letter MEMEXP2
No errors

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
misc/cronjobs/membership_expiry.pl