[Bug 11144] New: Switch order of overdues and fines cronjob for packages and in crontab.example
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11144 Bug ID: 11144 Summary: Switch order of overdues and fines cronjob for packages and in crontab.example Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Command-line Utilities Assignee: gmcharlt@gmail.com Reporter: katrin.fischer@bsz-bw.de QA Contact: testopia@bugs.koha-community.org CC: ulrich.kleiber@bsz-bw.de Printing the correct fine in the overdues letters will only work correctly, when the fines.pl cronjob runs before overdue_notices.pl, else the fine is not there when the letter is created and can not be printed. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11144 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff Patch complexity|--- |Trivial patch -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11144 --- Comment #1 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 23300 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=23300&action=edit Bug 11144: Run fines cronjob before overdues cronjob Fines in overdues can only be printed correctly, when they have been already generated when the overdue_notices job is been run. This patch just changes the sequence of both cronjobs putting fines.pl before overdue_notices. Patch changes crontab.example and koha-common.cron.daily for package installations. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11144 --- Comment #2 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- This is a simple patch, but not trivial to test if you want to make sure it works as before. What you could do: Add fines and notices configuration to your installation - Add circulation condition: fine inverval 1, fine 1.50, grace period 0, fines cap 3.00 - Checkout an item with due date yesterday - Add an overdue notice letter that includes <<items.fine>> - Add notice triggers with a delay matching your overdue item - 1 - Make sure finesmode is set to calculate - Make sure patron has right patron category and email address Edit crontab example to make it run not shortly after 1, but more suitable to your testing time. [This is cheating a bit, but not sure how to do this in a better way] Wait until it has run. - Check the fine is there - Check the overdue letter for the fine Before the patch, the fine is not printed. - Update your crontab using the new example - [Change time for it to be run] - Repeat test. Fine should be printed now. For installations using the packages a similar test can be done. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11144 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|gmcharlt@gmail.com |katrin.fischer@bsz-bw.de -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11144 --- Comment #3 from Galen Charlton <gmcharlt@gmail.com> --- Comment on attachment 23300 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=23300 Bug 11144: Run fines cronjob before overdues cronjob Review of attachment 23300: --> (http://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=11144&attachment=23300) ----------------------------------------------------------------- ::: misc/cronjobs/crontab.example @@ +48,5 @@
# FINES +0 1 * * * __KOHA_USER__ $KOHA_CRON_PATH/fines.pl + +# OVERDUE NOTICES +5 1 * * * __KOHA_USER__ $KOHA_CRON_PATH/overdue_notices.pl -t
There's a race condition here if the database is so large that fines.pl needs more than five minutes to run. If that's the case, in theory some overdue notices could include the fine amount while others do not because fines.pl hasn't gotten to those patrons yet. One way to fix this would be to have a single cron entry that first run fines.pl, then overdue_notices.pl. Note that this doesn't affect koha-common.cron.daily since it runs the jobs in order, waiting for each one to finish. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11144 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Failed QA --- Comment #4 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Back to the drawing board... :) -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11144 Marjorie Barry-Vila <marjorie.barry-vila@ccsr.qc.ca> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |marjorie.barry-vila@ccsr.qc | |.ca -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11144 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Switch order of overdues |Fix sequence of cronjobs: |and fines cronjob for |automatic renewal - fines - |packages and in |overdue notices |crontab.example | -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11144 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11144 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #23300|0 |1 is obsolete| | --- Comment #5 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 40044 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=40044&action=edit Bug 11144: Fix sequence of cronjobs: automatic renewal - fines - overdue notices The patch changes the sequence of cronjobs in the crontab example file and in the cron.daily file of the packages. This is why: 1) Renew automatically ... only when we can't renew, we want to 2) Calculate fines ... once the fine are calculated and charged we can print the amount into the 3) Overdue notices Before the change it could happen that you'd charge for an item, that would then be renewed. Or that you'd try to print fine amounts into the overdue notices, when they would only be charged moments later. To test: - configure your system so you have items that should - be charged with fines - renew automatically - configure your crontabs according to the example file or switch the cron.daily in your package installation with the new one - configure your overdue notices so that one should be generated <<items.fine>> - Wait for the cronjobs or schedule them to run earlier - Verify all is well and as it should be -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11144 --- Comment #6 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- A new attempt at this. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11144 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |h.meissner.82@web.de -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11144 --- Comment #7 from M. Tompsett <mtompset@hotmail.com> --- Comment on attachment 40044 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=40044 Bug 11144: Fix sequence of cronjobs: automatic renewal - fines - overdue notices Review of attachment 40044: --> (http://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=11144&attachment=40044) ----------------------------------------------------------------- ::: misc/cronjobs/crontab.example @@ +49,4 @@
# FINES +# OVERDUE NOTICES +# Sequence is important - renew what can be renewed, charge fines for the rest, print fine amount into overdue notices +5 1 * * * __KOHA_USER__ $KOHA_CRON_PATH/automatic_renewals.pl && __KOHA_USER__ $KOHA_CRON_PATH/fines.pl && __KOHA_USER__ $KOHA_CRON_PATH/overdue_notices.pl -t
Not quite. __KOHA_USER__ the first time, sure. But those others seem wrong to me. @@ -86,5 @@
# delete old purchase suggestions weekly. Replace XX with a number to define the age of suggestions to delete. @weekly __KOHA_USER__ $KOHA_CRON_PATH/purge_suggestions.pl --days XX > /dev/null 2>&1 - -# every day at 3AM renew all issues scheduled for automatic renewal -0 3 * * * __KOHA_USER__ $KOHA_CRON_PATH/automatic_renewals.pl
Do we want to shift renewals to 1:05am, or should we shift overdues and fines to 3:00am? I see no reason one way or another. Just wanted to point this out. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11144 M. Tompsett <mtompset@hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Failed QA CC| |mtompset@hotmail.com --- Comment #8 from M. Tompsett <mtompset@hotmail.com> --- The first __KOHA_USER__ tells the OS to run the command as that user. However, the second and third are like trying to run: ls & mtompset ls & mtompset ls. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11144 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11144 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #40044|0 |1 is obsolete| | --- Comment #9 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 40853 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=40853&action=edit Bug 11144: Fix sequence of cronjobs: automatic renewal - fines - overdue notices The patch changes the sequence of cronjobs in the crontab example file and in the cron.daily file of the packages. This is why: 1) Renew automatically ... only when we can't renew, we want to 2) Calculate fines ... once the fine are calculated and charged we can print the amount into the 3) Overdue notices Before the change it could happen that you'd charge for an item, that would then be renewed. Or that you'd try to print fine amounts into the overdue notices, when they would only be charged moments later. To test: - configure your system so you have items that should - be charged with fines - renew automatically - configure your crontabs according to the example file or switch the cron.daily in your package installation with the new one - configure your overdue notices so that one should be generated <<items.fine>> - Wait for the cronjobs or schedule them to run earlier - Verify all is well and as it should be -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11144 --- Comment #10 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Thx for checking Mark, I have uploaded a hopefully fixed patch. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11144 Barton Chittenden <barton@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |http://bugs.koha-community. | |org/bugzilla3/show_bug.cgi? | |id=14886 -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11144 Barton Chittenden <barton@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |http://bugs.koha-community. | |org/bugzilla3/show_bug.cgi? | |id=14887 -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11144 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #40853|0 |1 is obsolete| | --- Comment #11 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 44283 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=44283&action=edit Bug 11144: Fix sequence of cronjobs: automatic renewal - fines - overdue notices The patch changes the sequence of cronjobs in the crontab example file and in the cron.daily file of the packages. This is why: 1) Renew automatically ... only when we can't renew, we want to 2) Calculate fines ... once the fine are calculated and charged we can print the amount into the 3) Overdue notices Before the change it could happen that you'd charge for an item, that would then be renewed. Or that you'd try to print fine amounts into the overdue notices, when they would only be charged moments later. To test: - configure your system so you have items that should - be charged with fines - renew automatically - configure your crontabs according to the example file or switch the cron.daily in your package installation with the new one - configure your overdue notices so that one should be generated <<items.fine>> - Wait for the cronjobs or schedule them to run earlier - Verify all is well and as it should be -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11144 --- Comment #12 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Rebased on current master. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11144 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |major --- Comment #13 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Calculating fines and then renewing an item can make patrons unhappy, updating severity a little bit. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11144 --- Comment #14 from M. Tompsett <mtompset@hotmail.com> --- Comment on attachment 44283 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=44283 Bug 11144: Fix sequence of cronjobs: automatic renewal - fines - overdue notices Review of attachment 44283: --> (http://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=11144&attachment=44283) ----------------------------------------------------------------- ::: misc/cronjobs/crontab.example @@ +48,4 @@
+# AUTOMATIC RENEWAL + FINES + OVERDUE NOTICES +# Sequence is important - renew what can be renewed, charge fines for the rest, print fine amount into overdue notices +5 1 * * * __KOHA_USER__ $KOHA_CRON_PATH/automatic_renewals.pl && $KOHA_CRON_PATH/fines.pl && $KOHA_CRON_PATH/overdue_notices.pl -t
I'm pretty sure you want semi-colons. You want to run them sequentially in this order regardless of the success or failure of script. echo one; false; echo three echo one; true; echo three echo one && false && echo three echo one && true && echo three echo one || false || echo three echo one || true || echo three Only the first two print one and three for both false and true cases -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11144 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |chris@bigballofwax.co.nz --- Comment #15 from Chris Cormack <chris@bigballofwax.co.nz> --- Hmmm or maybe we do want them && Don't put fines on, if the automatic renewals script failed to run, or we will be fining people that we shouldn't A case could be made for it either way What do you think? -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11144 --- Comment #16 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- I think I agree with rangi - better to have it fail early, then to have to clean up all the patron accounts after figuring out what went wrong. What do others think? -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11144 --- Comment #17 from M. Tompsett <mtompset@hotmail.com> --- (In reply to Katrin Fischer from comment #16)
I think I agree with rangi - better to have it fail early, then to have to clean up all the patron accounts after figuring out what went wrong.
What do others think?
My concern is failure to automatically renew would fail to produce overdue notices with &&. "You owe $100 in fines." "But I never got an overdue notice!" (R && F) ; O? The fines won't accidentally charge on automatic renewal failures, but the overdues will run after the automatic renewals. Does this look like a good solution? -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11144 --- Comment #18 from M. Tompsett <mtompset@hotmail.com> --- Comment on attachment 44283 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=44283 Bug 11144: Fix sequence of cronjobs: automatic renewal - fines - overdue notices Review of attachment 44283: --> (http://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=11144&attachment=44283) ----------------------------------------------------------------- ::: debian/koha-common.cron.daily @@ +19,1 @@
koha-foreach --enabled /usr/share/koha/bin/cronjobs/fines.pl
Our discussion does raise a problem with this. This runs the fines regardless of whether the renewals succeed or not. @@ +19,2 @@
koha-foreach --enabled /usr/share/koha/bin/cronjobs/fines.pl +koha-foreach --enabled --email /usr/share/koha/bin/cronjobs/overdue_notices.pl -t
These three lines are the equivalent of semi-colons. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11144 --- Comment #19 from Katrin Fischer <katrin.fischer@bsz-bw.de> ---
My concern is failure to automatically renew would fail to produce overdue notices with &&. "You owe $100 in fines." "But I never got an overdue notice!"
Libraries print the fine amount for each item into the overdue notice - so if you send the overdue notices without generating the fines first, it will list 0,00 or a wrong amount, which is what started this bug report :)
(R && F) ; O? The fines won't accidentally charge on automatic renewal failures, but the overdues will run after the automatic renewals. Does this look like a good solution?
see above I'd also like to point out that we should try and decide something here - I am happy to make the changes, but currently this is really a bug with the sequence being totally wrong. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11144 --- Comment #20 from M. Tompsett <mtompset@hotmail.com> --- So what is really needed is a way to: - automatically renew output => list of failures - generate fines input => list of failures to exclude output => same or larger list of failures - overdues input => same or larger list of failures to exclude output => potentially bigger list of failures - email potentially bigger list of failures to administrator to deal with. If this list of failures could be passed from script to script to script, then semi-colons would work. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11144 --- Comment #21 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Can we have a simple fix first? For your suggestion we'd need to touch a lot of scripts, and also: - Auto-renewal - can be repeated without change for already renewed - fines.pl - can be repeated, without problems - overdue_notices - will generate a new notice if repeated. So you'd have to pass a positive list to avoid sending double notices. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11144 --- Comment #22 from Katrin Fischer <katrin.fischer@bsz-bw.de> ---
- overdue_notices - will generate a new notice if repeated. So you'd have to pass a positive list to avoid sending double notices.
Actually... I don't think that would work. Why is it so bad if they all don't run, if there is really a bigger problem with one of them? That's how it is now and it doesn't seem to be a problem that occurs frequently. We have been running our installations with a changed cronjob sequence since the very beginning (fines before overdues). -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11144 --- Comment #23 from M. Tompsett <mtompset@hotmail.com> --- (In reply to Katrin Fischer from comment #22)
- overdue_notices - will generate a new notice if repeated. So you'd have to pass a positive list to avoid sending double notices.
Actually... I don't think that would work.
Why is it so bad if they all don't run, if there is really a bigger problem with one of them? That's how it is now and it doesn't seem to be a problem that occurs frequently. We have been running our installations with a changed cronjob sequence since the very beginning (fines before overdues).
If overdues don't run, then people don't get emailed reminders, and then they get angry when they have a larger fine to pay. I would rather be reminded with a footnote stating that the amounts may be incorrect if an automatic renewals failed to run, than get hit with a whack load of fines. Tweak the notice and use semi-colons. That's my suggestion, because the current koha-foreach logic is effectively that. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org