Main Koha release repository https://koha-community.org
Find a file
Jonathan Druart 0f4a831344 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>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-03-30 13:43:48 -03:00
acqui Bug 13601: Fix special case in basket.pl 2015-03-30 13:40:03 -03:00
admin Bug 5786 [QA Followup] 2015-03-25 10:33:31 -03:00
authorities Bug 11961 - This patch fix the QA critical error, fix the capitalization and the UNIMARC support. 2015-01-24 18:19:10 -03:00
basket Bug 13343: Embed items when send a basket/shelf 2015-02-12 15:33:11 -03:00
C4 Bug 13601: get rid of DateTime::Format::DateParse 2015-03-30 13:40:00 -03:00
catalogue Bug 11430: Intranet changes 2015-03-11 15:02:42 -03:00
cataloguing Bug 13648: OPAC = hidden removes pull down from edit item form 2015-03-15 08:42:09 -03:00
circ Bug 13892: Make ysearch.pl not using C4::Members::Search 2015-03-30 12:25:56 -03:00
course_reserves Bug 13818 - Editing and saving a course reserve displays the add item form 2015-03-25 11:25:26 -03:00
debian Bug 4847: Remove the python dependency for package builds 2015-03-25 11:22:49 -03:00
docs Bug 7143: Add "developer" for all devs 2015-03-07 22:01:48 +01:00
errors Bug 11944: use CGI( -utf8 ) everywhere 2015-01-13 13:07:21 -03:00
etc Bug 12948: Use word indexing for language (MARC21) 2015-02-20 11:51:59 -03:00
install_misc GRS-1 deprecation leftover used by jenkins 2015-01-13 15:30:31 -03:00
installer Bug 13855 - Fastadd framework has 2x 100$c, missing 100$a 2015-03-30 13:37:34 -03:00
Koha Bug 13601: The fallback regex should contain the time part 2015-03-30 13:40:07 -03:00
koha-tmpl Bug 10773 - add help for *_description fields 2015-03-30 13:22:41 -03:00
labels Bug 11944: use CGI( -utf8 ) everywhere 2015-01-13 13:07:21 -03:00
members Bug 13021: Reintroduce the name column for guarantor search 2015-03-19 14:19:40 -03:00
misc Bug 11120: FIX the --date option for overdue_notices cronjob 2015-03-30 13:43:48 -03:00
offline_circ Bug 11944: use CGI( -utf8 ) everywhere 2015-01-13 13:07:21 -03:00
opac Bug 5786: Correction: Removed erroneous holdability check from opac-search.pl 2015-03-30 13:14:14 -03:00
OpenILS Bug 9239 QA follow-up: remove stray debug code 2013-03-16 21:32:34 -04:00
patron_lists Bug 11944: use CGI( -utf8 ) everywhere 2015-01-13 13:07:21 -03:00
patroncards Bug 13189 - Patron card creator patron search browse by last name broken by extended attributes 2015-02-12 15:35:07 -03:00
plugins Bug 11944: use CGI( -utf8 ) everywhere 2015-01-13 13:07:21 -03:00
reports Bug 13748: Acquisition wizard: some strings not translatable 2015-03-19 14:02:36 -03:00
reserve Bug 13894: Fix if the search returns only 1 result 2015-03-30 12:56:57 -03:00
reviews Bug 11944: use CGI( -utf8 ) everywhere 2015-01-13 13:07:21 -03:00
rotating_collections Bug 11944: use CGI( -utf8 ) everywhere 2015-01-13 13:07:21 -03:00
selenium Adding selenium tests for filterMembers 2009-09-30 11:30:37 +02:00
serials Bug 11944: use CGI( -utf8 ) everywhere 2015-01-13 13:07:21 -03:00
services Bug 11944: use CGI( -utf8 ) everywhere 2015-01-13 13:07:21 -03:00
skel Bug 11078: Add locking to rebuild_zebra 2014-02-28 22:21:41 +00:00
sms Bug 11944: use CGI( -utf8 ) everywhere 2015-01-13 13:07:21 -03:00
suggestion Bug 13731: Suggestions reason does not save on updating the status 2015-03-02 15:47:24 +01:00
svc Bug 13801: svc/bib - Set charset to utf-8 on printing header 2015-03-25 11:28:03 -03:00
t Bug 13601: The fallback regex should contain the time part 2015-03-30 13:40:07 -03:00
tags Bug 11944: use CGI( -utf8 ) everywhere 2015-01-13 13:07:21 -03:00
test Bug 11944: use CGI( -utf8 ) everywhere 2015-01-13 13:07:21 -03:00
tmp/modified_authorities changing DO_NOT_REMOVE to README.txt 2007-10-21 19:14:41 -05:00
tools Bug 12648: Link patrons to an order 2015-03-11 11:47:30 -03:00
virtualshelves Bug 13343: Embed items when send a basket/shelf 2015-02-12 15:33:11 -03:00
xt Bug 13199: follow up to fix Licence and some koha-qa errors 2014-11-20 09:47:54 -03:00
.editorconfig Bug 12545: Add EditorConfig.org file to the source tree 2014-08-22 11:07:45 -03:00
.htaccess Fix file permissions: if it is not a script, it should not be executable. 2010-04-16 00:40:34 -04:00
.mailmap Bug 13314: Follow-up for m.de.rooy in .mailmap 2014-11-26 11:16:18 -03:00
about.pl Bug 13404 [QA Followup] 2015-02-09 13:42:32 -03:00
changelanguage.pl Bug 11944: use CGI( -utf8 ) everywhere 2015-01-13 13:07:21 -03:00
edithelp.pl Bug 11944: use CGI( -utf8 ) everywhere 2015-01-13 13:07:21 -03:00
fix-perl-path.PL installer: improvements to fix-path-perl.PL on Win32 2007-12-20 19:20:12 -06:00
help.pl Bug 11944: use CGI( -utf8 ) everywhere 2015-01-13 13:07:21 -03:00
INSTALL Bug 7759, update of install files to use background indexing (and some whitespace tidy) 2012-04-20 16:11:52 +02:00
install-CPAN.pl Bug 5370: Fix all the references to koha.org 2010-11-08 09:41:49 +13:00
INSTALL.debian Bug 8092 follow-up: Add optional dependency on CHI 2012-06-09 13:08:18 +02:00
INSTALL.fedora7 Bug 11757: remove dependency on POE 2014-02-15 01:38:15 +00:00
INSTALL.opensuse Bug 11757: remove dependency on POE 2014-02-15 01:38:15 +00:00
INSTALL.ubuntu Bug 7764: (follow-up) editorial tweaks 2013-10-04 16:27:55 +00:00
koha_perl_deps.pl bug 10548: fix count of missing required dependencies by koha_perl_deps.pl 2013-07-11 14:03:32 +00:00
kohaversion.pl Bug 5786: DBRev 3.19.00.017 2015-03-25 10:33:44 -03:00
LICENSE Bug 9440 - update Koha's LICENSE file from GPL2 to GPL3 2013-02-12 08:52:10 -05:00
mainpage.pl Bug 11944: use CGI( -utf8 ) everywhere 2015-01-13 13:07:21 -03:00
Makefile.PL Bug 13586: Remove some other occurrences 2015-03-19 14:15:07 -03:00
MANIFEST.SKIP Bug 9546 : Updating make manifest tardist 2013-02-06 23:54:46 -05:00
README Bug 9440 - update Koha's LICENSE file from GPL2 to GPL3 2013-02-12 08:52:10 -05:00
README.robots Bug 6411 add another example to README.robots 2011-07-05 14:48:05 +12:00
rewrite-config.PL Bug 12031: [QA Follow-up] Undefined routine and change to koha-conf.xml 2014-10-27 10:38:11 -03:00

Koha is a free software integrated library system.

Koha is distributed under the GNU GPL version 3 or later.
Please read the file LICENSE for more details.

To install or upgrade Koha, please see the INSTALL file appropriate
to your platform.

Report bugs at http://bugs.koha-community.org/

Visit the Koha Project website at http://www.koha-community.org/