[Bug 11120] New: The date option for the overdue_notices cronjob is broken
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 Bug ID: 11120 Summary: The date option for the overdue_notices cronjob is broken Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Circulation Assignee: koha-bugs@lists.koha-community.org Reporter: jonathan.druart@biblibre.com QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com, kyle.m.hall@gmail.com Bug 7447 introduces the --date option for overdue notices. This option has never worked: the code is waiting for a value but the option is defined as a boolean. The date should be defined as --date:s and the script should correctly manage this option. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Depends on| |7447 Assignee|koha-bugs@lists.koha-commun |jonathan.druart@biblibre.co |ity.org |m Severity|enhancement |normal -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 --- Comment #1 from Jonathan Druart <jonathan.druart@biblibre.com> --- Created attachment 22304 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=22304&action=edit Bug 11120: FIX the --date option for overdue_notices cronjob Bug 7447 introduces the --date option for overdue notices. This option has never worked: the code is waiting for a value but the option is defined as a boolean. This patch fixes the option and change the way to calculate the range of dates. This range is now managed in Perl instead of in the SQL query. To do it in Perl allows to build dates simply using the DateTime and DateTime::Duration modules. To test this patch you should have a DB with a lot of overdues, (I tested on a DB with 512 overdues). A test plan could be: 1/ Dump your message_queue table 2/ Verify the number of overdues in the database before applying the patch: mysql> DELETE FROM message_queue; perl misc/cronjobs/overdue_notices.pl -v -t (the triggered option will generate overdue for today) mysql> SELECT COUNT(*) FROM message_queue; Note this value 2A mysql> DELETE FROM message_queue; perl misc/cronjobs/overdue_notices.pl -v mysql> SELECT COUNT(*) FROM message_queue; Note this value 2B 2/ Apply the patch 4/ Verify the number of overdues generated by the patched script: mysql> DELETE FROM message_queue; perl misc/cronjobs/overdue_notices.pl -v -t mysql> SELECT COUNT(*) FROM message_queue; Note this value 4A mysql> DELETE FROM message_queue; perl misc/cronjobs/overdue_notices.pl -v mysql> SELECT COUNT(*) FROM message_queue; Note this value 4B mysql> DELETE FROM message_queue; # The date should be defined depending your dateformat preference # and should be the date of the current day perl misc/cronjobs/overdue_notices.pl -v -t --date="YYYY-MM-DD" mysql> SELECT COUNT(*) FROM message_queue; Note this value 4C mysql> DELETE FROM message_queue; # The date should be defined depending your dateformat preference # and should be the date of the current day perl misc/cronjobs/overdue_notices.pl -v --date="YYYY-MM-DD" mysql> SELECT COUNT(*) FROM message_queue; Note this value 4D 5/ Compare the values: All values generated with the -t options should be equals. Same for values without the -t options. => 2A == 4A == 4C and 2B == 4B == 4D 6/ Go back to a normal activity for 3 days or manually change the date_due for issues in the DB: mysql> update issues SET date_due = DATE_SUB(date_due, INTERVAL 3 DAY); Do again step 4C and 4D with a date equals to today - 3 days. Values should be the same as 4C and 4D. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 I'm just a bot <gitbot@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |gitbot@bugs.koha-community. | |org When did the bot| |2013-10-30 last check this| | --- Comment #2 from I'm just a bot <gitbot@bugs.koha-community.org> --- Patch applied cleanly, go forth and signoff -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Patch doesn't apply CC| |chris@bigballofwax.co.nz -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Patch doesn't apply |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #22304|0 |1 is obsolete| | --- Comment #3 from Jonathan Druart <jonathan.druart@biblibre.com> --- Created attachment 29465 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=29465&action=edit Bug 11120: FIX the --date option for overdue_notices cronjob Bug 7447 introduces the --date option for overdue notices. This option has never worked: the code is waiting for a value but the option is defined as a boolean. This patch fixes the option and change the way to calculate the range of dates. This range is now managed in Perl instead of in the SQL query. To do it in Perl allows to build dates simply using the DateTime and DateTime::Duration modules. To test this patch you should have a DB with a lot of overdues, (I tested on a DB with 512 overdues). A test plan could be: 1/ Dump your message_queue table 2/ Verify the number of overdues in the database before applying the patch: mysql> DELETE FROM message_queue; perl misc/cronjobs/overdue_notices.pl -v -t (the triggered option will generate overdue for today) mysql> SELECT COUNT(*) FROM message_queue; Note this value 2A mysql> DELETE FROM message_queue; perl misc/cronjobs/overdue_notices.pl -v mysql> SELECT COUNT(*) FROM message_queue; Note this value 2B 2/ Apply the patch 4/ Verify the number of overdues generated by the patched script: mysql> DELETE FROM message_queue; perl misc/cronjobs/overdue_notices.pl -v -t mysql> SELECT COUNT(*) FROM message_queue; Note this value 4A mysql> DELETE FROM message_queue; perl misc/cronjobs/overdue_notices.pl -v mysql> SELECT COUNT(*) FROM message_queue; Note this value 4B mysql> DELETE FROM message_queue; # The date should be defined depending your dateformat preference # and should be the date of the current day perl misc/cronjobs/overdue_notices.pl -v -t --date="YYYY-MM-DD" mysql> SELECT COUNT(*) FROM message_queue; Note this value 4C mysql> DELETE FROM message_queue; # The date should be defined depending your dateformat preference # and should be the date of the current day perl misc/cronjobs/overdue_notices.pl -v --date="YYYY-MM-DD" mysql> SELECT COUNT(*) FROM message_queue; Note this value 4D 5/ Compare the values: All values generated with the -t options should be equals. Same for values without the -t options. => 2A == 4A == 4C and 2B == 4B == 4D 6/ Go back to a normal activity for 3 days or manually change the date_due for issues in the DB: mysql> update issues SET date_due = DATE_SUB(date_due, INTERVAL 3 DAY); Do again step 4C and 4D with a date equals to today - 3 days. Values should be the same as 4C and 4D. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 --- Comment #4 from Jonathan Druart <jonathan.druart@biblibre.com> --- Rebased patch. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |http://bugs.koha-community. | |org/bugzilla3/show_bug.cgi? | |id=12529 -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 Srdjan Jankovic <srdjan@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |srdjan@catalyst.net.nz --- Comment #5 from Srdjan Jankovic <srdjan@catalyst.net.nz> --- This does not seem to apply. Also, $today = dt_from_string; should probably be $today = dt_from_string(); for the sake of readability. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |http://bugs.koha-community. | |org/bugzilla3/show_bug.cgi? | |id=12924 -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 --- Comment #6 from Jonathan Druart <jonathan.druart@biblibre.com> --- I alerted on bug 12529 comment 4 that this patch was very important. Now it does not apply at all and need to be rewrite. I don't plan to rebase this patch. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Patch doesn't apply -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #29465|0 |1 is obsolete| | --- Comment #7 from Chris Cormack <chris@bigballofwax.co.nz> --- Created attachment 33929 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=33929&action=edit Bug 11120: FIX the --date option for overdue_notices cronjob Bug 7447 introduces the --date option for overdue notices. This option has never worked: the code is waiting for a value but the option is defined as a boolean. This patch fixes the option and change the way to calculate the range of dates. This range is now managed in Perl instead of in the SQL query. To do it in Perl allows to build dates simply using the DateTime and DateTime::Duration modules. To test this patch you should have a DB with a lot of overdues, (I tested on a DB with 512 overdues). A test plan could be: 1/ Dump your message_queue table 2/ Verify the number of overdues in the database before applying the patch: mysql> DELETE FROM message_queue; perl misc/cronjobs/overdue_notices.pl -v -t (the triggered option will generate overdue for today) mysql> SELECT COUNT(*) FROM message_queue; Note this value 2A mysql> DELETE FROM message_queue; perl misc/cronjobs/overdue_notices.pl -v mysql> SELECT COUNT(*) FROM message_queue; Note this value 2B 2/ Apply the patch 4/ Verify the number of overdues generated by the patched script: mysql> DELETE FROM message_queue; perl misc/cronjobs/overdue_notices.pl -v -t mysql> SELECT COUNT(*) FROM message_queue; Note this value 4A mysql> DELETE FROM message_queue; perl misc/cronjobs/overdue_notices.pl -v mysql> SELECT COUNT(*) FROM message_queue; Note this value 4B mysql> DELETE FROM message_queue; # The date should be defined depending your dateformat preference # and should be the date of the current day perl misc/cronjobs/overdue_notices.pl -v -t --date="YYYY-MM-DD" mysql> SELECT COUNT(*) FROM message_queue; Note this value 4C mysql> DELETE FROM message_queue; # The date should be defined depending your dateformat preference # and should be the date of the current day perl misc/cronjobs/overdue_notices.pl -v --date="YYYY-MM-DD" mysql> SELECT COUNT(*) FROM message_queue; Note this value 4D 5/ Compare the values: All values generated with the -t options should be equals. Same for values without the -t options. => 2A == 4A == 4C and 2B == 4B == 4D 6/ Go back to a normal activity for 3 days or manually change the date_due for issues in the DB: mysql> update issues SET date_due = DATE_SUB(date_due, INTERVAL 3 DAY); Do again step 4C and 4D with a date equals to today - 3 days. Values should be the same as 4C and 4D. Note - I have reworked this patch, I think it all works but please test very thorougly - Chris C -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Patch doesn't apply |Needs Signoff --- Comment #8 from Chris Cormack <chris@bigballofwax.co.nz> --- I *think* I have reworked this, keeping the functionality, please test. If not let me know and I will try again. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #33929|0 |1 is obsolete| | --- Comment #9 from Jonathan Druart <jonathan.druart@biblibre.com> --- Created attachment 34952 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=34952&action=edit Bug 11120: FIX the --date option for overdue_notices cronjob Bug 7447 introduces the --date option for overdue notices. This option has never worked: the code is waiting for a value but the option is defined as a boolean. This patch fixes the option and change the way to calculate the range of dates. This range is now managed in Perl instead of in the SQL query. To do it in Perl allows to build dates simply using the DateTime and DateTime::Duration modules. To test this patch you should have a DB with a lot of overdues, (I tested on a DB with 512 overdues). A test plan could be: 1/ Dump your message_queue table 2/ Verify the number of overdues in the database before applying the patch: mysql> DELETE FROM message_queue; perl misc/cronjobs/overdue_notices.pl -v -t (the triggered option will generate overdue for today) mysql> SELECT COUNT(*) FROM message_queue; Note this value 2A mysql> DELETE FROM message_queue; perl misc/cronjobs/overdue_notices.pl -v mysql> SELECT COUNT(*) FROM message_queue; Note this value 2B 2/ Apply the patch 4/ Verify the number of overdues generated by the patched script: mysql> DELETE FROM message_queue; perl misc/cronjobs/overdue_notices.pl -v -t mysql> SELECT COUNT(*) FROM message_queue; Note this value 4A mysql> DELETE FROM message_queue; perl misc/cronjobs/overdue_notices.pl -v mysql> SELECT COUNT(*) FROM message_queue; Note this value 4B mysql> DELETE FROM message_queue; # The date should be defined depending your dateformat preference # and should be the date of the current day perl misc/cronjobs/overdue_notices.pl -v -t --date="YYYY-MM-DD" mysql> SELECT COUNT(*) FROM message_queue; Note this value 4C mysql> DELETE FROM message_queue; # The date should be defined depending your dateformat preference # and should be the date of the current day perl misc/cronjobs/overdue_notices.pl -v --date="YYYY-MM-DD" mysql> SELECT COUNT(*) FROM message_queue; Note this value 4D 5/ Compare the values: All values generated with the -t options should be equals. Same for values without the -t options. => 2A == 4A == 4C and 2B == 4B == 4D 6/ Go back to a normal activity for 3 days or manually change the date_due for issues in the DB: mysql> update issues SET date_due = DATE_SUB(date_due, INTERVAL 3 DAY); Do again step 4C and 4D with a date equals to today - 3 days. Values should be the same as 4C and 4D. Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 --- Comment #10 from Jonathan Druart <jonathan.druart@biblibre.com> --- Created attachment 34953 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=34953&action=edit script to populate the DB I use this simple script to insert overdues in the DB. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 --- Comment #11 from Jonathan Druart <jonathan.druart@biblibre.com> --- (In reply to Chris Cormack from comment #8)
I *think* I have reworked this, keeping the functionality, please test. If not let me know and I will try again.
Thank you very much to have resubmitted this patch. I tested it thoroughly and did not find any regression. The --date parameter works as expected. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA Patch complexity|--- |Small patch -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #34952|0 |1 is obsolete| | --- Comment #12 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 34962 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=34962&action=edit [PASSED QA] Bug 11120: FIX the --date option for overdue_notices cronjob Bug 7447 introduces the --date option for overdue notices. This option has never worked: the code is waiting for a value but the option is defined as a boolean. This patch fixes the option and change the way to calculate the range of dates. This range is now managed in Perl instead of in the SQL query. To do it in Perl allows to build dates simply using the DateTime and DateTime::Duration modules. To test this patch you should have a DB with a lot of overdues, (I tested on a DB with 512 overdues). A test plan could be: 1/ Dump your message_queue table 2/ Verify the number of overdues in the database before applying the patch: mysql> DELETE FROM message_queue; perl misc/cronjobs/overdue_notices.pl -v -t (the triggered option will generate overdue for today) mysql> SELECT COUNT(*) FROM message_queue; Note this value 2A mysql> DELETE FROM message_queue; perl misc/cronjobs/overdue_notices.pl -v mysql> SELECT COUNT(*) FROM message_queue; Note this value 2B 2/ Apply the patch 4/ Verify the number of overdues generated by the patched script: mysql> DELETE FROM message_queue; perl misc/cronjobs/overdue_notices.pl -v -t mysql> SELECT COUNT(*) FROM message_queue; Note this value 4A mysql> DELETE FROM message_queue; perl misc/cronjobs/overdue_notices.pl -v mysql> SELECT COUNT(*) FROM message_queue; Note this value 4B mysql> DELETE FROM message_queue; # The date should be defined depending your dateformat preference # and should be the date of the current day perl misc/cronjobs/overdue_notices.pl -v -t --date="YYYY-MM-DD" mysql> SELECT COUNT(*) FROM message_queue; Note this value 4C mysql> DELETE FROM message_queue; # The date should be defined depending your dateformat preference # and should be the date of the current day perl misc/cronjobs/overdue_notices.pl -v --date="YYYY-MM-DD" mysql> SELECT COUNT(*) FROM message_queue; Note this value 4D 5/ Compare the values: All values generated with the -t options should be equals. Same for values without the -t options. => 2A == 4A == 4C and 2B == 4B == 4D 6/ Go back to a normal activity for 3 days or manually change the date_due for issues in the DB: mysql> update issues SET date_due = DATE_SUB(date_due, INTERVAL 3 DAY); Do again step 4C and 4D with a date equals to today - 3 days. Values should be the same as 4C and 4D. Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Tested with my own test data, checked generating overdues with and without the --date option. All worked as expected. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 --- Comment #13 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 34963 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=34963&action=edit Bug 11120: Follow-up: adding a hint about the date format Adding 2 hints about the expected date format to the error message and the help. To test: - Run overdue_notices.pl --date <someinvaliddate> - Run overdue_notices.pl -man - Verify hint about date format shows up -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 --- Comment #14 from Jonathan Druart <jonathan.druart@biblibre.com> --- Comment on attachment 34963 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=34963 Bug 11120: Follow-up: adding a hint about the date format Review of attachment 34963: --> (http://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=11120&attachment=34963) ----------------------------------------------------------------- ::: misc/cronjobs/overdue_notices.pl @@ +364,4 @@
eval { $date_to_run = dt_from_string( $date_input ); }; + die "$date_input is not a valid date, aborting! Use a date in format YYYY-MM-DD."
No, this is wrong. The format depends on the dateformat pref. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |katrin.fischer@bsz-bw.de --- Comment #15 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Well, we can just throw out the second patch, but I am confused. I definitely tested with YYYY-MM-DD as I had been looking for examples in the bug report. And it worked, although my preference is set to mm/dd/yyyy. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #34963|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 --- Comment #16 from Jonathan Druart <jonathan.druart@biblibre.com> --- (In reply to Katrin Fischer from comment #15)
Well, we can just throw out the second patch, but I am confused. I definitely tested with YYYY-MM-DD as I had been looking for examples in the bug report. And it worked, although my preference is set to mm/dd/yyyy.
Yes you are right, it works too. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 --- Comment #17 from Jonathan Druart <jonathan.druart@biblibre.com> --- Comment on attachment 34962 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=34962 [PASSED QA] Bug 11120: FIX the --date option for overdue_notices cronjob Review of attachment 34962: --> (http://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=11120&attachment=34962) ----------------------------------------------------------------- ::: misc/cronjobs/overdue_notices.pl @@ +359,5 @@
} my $date_to_run; +my $date; +if ( $date_input ){ + $date = $dbh->quote($date);
Should be $date = $dbh->quote($date_input); Isn't it? -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 --- Comment #18 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- I think you are right - it's used in the SQL script - but not sure what for? SELECT biblio.*, items.*, issues.*, biblioitems.itemtype, TO_DAYS($date)-TO_DAYS(date_due) AS days_overdue, ... -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Failed QA -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 --- Comment #19 from Jonathan Druart <jonathan.druart@biblibre.com> --- Created attachment 34979 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=34979&action=edit Bug 11120: Follow-up: adding a hint about the date format Adding 2 hints about the expected date format to the error message and the help. To test: - Run overdue_notices.pl --date <someinvaliddate> - Run overdue_notices.pl -man - Verify hint about date format shows up -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 --- Comment #20 from Jonathan Druart <jonathan.druart@biblibre.com> --- Created attachment 34980 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=34980&action=edit Bug 11120: the date input should be in a iso format (YYYY-MM-DD) Note that it cans also accept a date in the same format defined in the dateformat system preference. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 --- Comment #21 from Jonathan Druart <jonathan.druart@biblibre.com> --- Created attachment 34981 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=34981&action=edit Bug 11120: Should this test fail? -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 --- Comment #22 from Jonathan Druart <jonathan.druart@biblibre.com> --- About the last 3 patches: 1/ I reintroduced the Katrin's patch 2/ Try to force the date input format to 'iso' 3/ To me the test should not fail, but I don't have the time at the moment to deep into the DateUtils code. Any idea? -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 --- Comment #23 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Could the problem be similar to what we saw on the patch for the parcels page? -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 --- Comment #24 from Jonathan Druart <jonathan.druart@biblibre.com> --- (In reply to Katrin Fischer from comment #23)
Could the problem be similar to what we saw on the patch for the parcels page?
Yes, actually I noticed this problem for the first time when I worked on this one. I started a discussion on koha-devel this morning [1], it seems that DateTime::Format::DateParse introduces more problems than it is supposed to help. [1] http://lists.koha-community.org/pipermail/koha-devel/2015-January/041095.htm... -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #34981|0 |1 is obsolete| | --- Comment #25 from Jonathan Druart <jonathan.druart@biblibre.com> --- Comment on attachment 34981 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=34981 Bug 11120: Should this test fail? This is fixed by bug 13601. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Signed Off See Also| |http://bugs.koha-community. | |org/bugzilla3/show_bug.cgi? | |id=13601 --- Comment #26 from Jonathan Druart <jonathan.druart@biblibre.com> --- With bug 13601, the wrong date format will be correctly caught. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 Brendan Gallagher <brendan@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 Brendan Gallagher <brendan@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #34962|0 |1 is obsolete| | --- Comment #27 from Brendan Gallagher <brendan@bywatersolutions.com> --- Created attachment 36282 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=36282&action=edit Bug 11120: FIX the --date option for overdue_notices cronjob Bug 7447 introduces the --date option for overdue notices. This option has never worked: the code is waiting for a value but the option is defined as a boolean. This patch fixes the option and change the way to calculate the range of dates. This range is now managed in Perl instead of in the SQL query. To do it in Perl allows to build dates simply using the DateTime and DateTime::Duration modules. To test this patch you should have a DB with a lot of overdues, (I tested on a DB with 512 overdues). A test plan could be: 1/ Dump your message_queue table 2/ Verify the number of overdues in the database before applying the patch: mysql> DELETE FROM message_queue; perl misc/cronjobs/overdue_notices.pl -v -t (the triggered option will generate overdue for today) mysql> SELECT COUNT(*) FROM message_queue; Note this value 2A mysql> DELETE FROM message_queue; perl misc/cronjobs/overdue_notices.pl -v mysql> SELECT COUNT(*) FROM message_queue; Note this value 2B 2/ Apply the patch 4/ Verify the number of overdues generated by the patched script: mysql> DELETE FROM message_queue; perl misc/cronjobs/overdue_notices.pl -v -t mysql> SELECT COUNT(*) FROM message_queue; Note this value 4A mysql> DELETE FROM message_queue; perl misc/cronjobs/overdue_notices.pl -v mysql> SELECT COUNT(*) FROM message_queue; Note this value 4B mysql> DELETE FROM message_queue; # The date should be defined depending your dateformat preference # and should be the date of the current day perl misc/cronjobs/overdue_notices.pl -v -t --date="YYYY-MM-DD" mysql> SELECT COUNT(*) FROM message_queue; Note this value 4C mysql> DELETE FROM message_queue; # The date should be defined depending your dateformat preference # and should be the date of the current day perl misc/cronjobs/overdue_notices.pl -v --date="YYYY-MM-DD" mysql> SELECT COUNT(*) FROM message_queue; Note this value 4D 5/ Compare the values: All values generated with the -t options should be equals. Same for values without the -t options. => 2A == 4A == 4C and 2B == 4B == 4D 6/ Go back to a normal activity for 3 days or manually change the date_due for issues in the DB: mysql> update issues SET date_due = DATE_SUB(date_due, INTERVAL 3 DAY); Do again step 4C and 4D with a date equals to today - 3 days. Values should be the same as 4C and 4D. Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Tested with my own test data, checked generating overdues with and without the --date option. All worked as expected. Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com> I test with 5318 overdues - works -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 Brendan Gallagher <brendan@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #34979|0 |1 is obsolete| | --- Comment #28 from Brendan Gallagher <brendan@bywatersolutions.com> --- Created attachment 36283 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=36283&action=edit Bug 11120: Follow-up: adding a hint about the date format Adding 2 hints about the expected date format to the error message and the help. To test: - Run overdue_notices.pl --date <someinvaliddate> - Run overdue_notices.pl -man - Verify hint about date format shows up Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 Brendan Gallagher <brendan@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #34980|0 |1 is obsolete| | --- Comment #29 from Brendan Gallagher <brendan@bywatersolutions.com> --- Created attachment 36284 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=36284&action=edit Bug 11120: the date input should be in a iso format (YYYY-MM-DD) Note that it cans also accept a date in the same format defined in the dateformat system preference. Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master CC| |tomascohen@gmail.com --- Comment #30 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Patches pushed to master. Thanks Jonathan! -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11120 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Master |Pushed to Stable --- Comment #31 from Chris Cormack <chris@bigballofwax.co.nz> --- Pushed to 3.18.x will be in 3.18.6 -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org