It would be very helpful if the cleanup_database.pl script had the ability to delete holidays from the special_holidays table there were older than a given number of days in the past.
Created attachment 52081 [details] [review] Bug 16672 - Add ability to remove expired holidays from special_holidays It would be very helpful if the cleanup_database.pl script had the ability to delete holidays from the special_holidays table there were older than a given number of days in the past. Test Plan: 1) Apply this patch 2) Create some unique holidays in the past of varying ages 3) Test the new switch '--unique-holidays DAYS' for cleanup_database.pl 4) Verify only holidays older then the specified number of days are removed NOTE: The language 'unique holdays' is used in the interface to match it's use in the staff web interface.
Inserted 3 entries using the following on June 7th 2016: INSERT INTO special_holidays(branchcode, day, month, year, isexception, description) VALUES ('FFL', 1, 6, 2016, 1, 'description1'), ('FFL', 2, 6, 2016, 1, 'description2'), ('FFL', 3, 6, 2016, 1, 'description3'); Ran cleanup_database using the new switch: # perl misc/cronjobs/cleanup_database.pl --unique-holidays 5 Only 2 entries were remaining in table `special_holidays`. Then ran the same switch with the verbose flag # perl misc/cronjobs/cleanup_database.pl --unique-holidays 4 --verbose Removed 1 unqiue holidays One entry was left in table `special_holidays`. This patch works as expected.
The script accepts negative numbers, is it expected?
Created attachment 52342 [details] [review] Bug 16672 [QA Followup] - Convert negative days to positive days
(In reply to Jonathan Druart from comment #3) > The script accepts negative numbers, is it expected? That seems like inadvisable behavior. I can't imagine needing to automatically delete holidays in the future! I can imagine the thought process of thinking about days in the past as a negative number. I've added a following that simply makes it so a days of 20 or -20 would both remove holidays older than 20 days in the past.
Created attachment 52353 [details] [review] Bug 16672 - Add ability to remove expired holidays from special_holidays It would be very helpful if the cleanup_database.pl script had the ability to delete holidays from the special_holidays table there were older than a given number of days in the past. Test Plan: 1) Apply this patch 2) Create some unique holidays in the past of varying ages 3) Test the new switch '--unique-holidays DAYS' for cleanup_database.pl 4) Verify only holidays older then the specified number of days are removed NOTE: The language 'unique holdays' is used in the interface to match it's use in the staff web interface. Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 52354 [details] [review] Bug 16672 [QA Followup] - Convert negative days to positive days Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 52355 [details] [review] Bug 16672: Fix typo unqiue vs unique Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Pushed to master for Koha 16.11, thanks for the followup Jonathan!
*** Bug 13409 has been marked as a duplicate of this bug. ***