[Bug 41967] New: Cleanup database --labels deletes labels over 1 day old regardless of passed value
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41967 Bug ID: 41967 Summary: Cleanup database --labels deletes labels over 1 day old regardless of passed value Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Command-line Utilities Assignee: koha-bugs@lists.koha-community.org Reporter: caroline.cyr-la-rose@inlibro.com QA Contact: testopia@bugs.koha-community.org CC: robin@catalyst.net.nz A client noticed that their label batches were always deleted, even though our serverwide cron says to delete label batches over 30 days old. I noticed it does the same on main. To test you have to manipulate data a little bit : 1. Create two label batches 1.1. Go to Cataloging > Label creator > New > Label batch 1.2. Add barcodes in "Add by barcodes or itemnumbers" If using KTD, you can use the following barcodes 39999000010114 39999000010138 39999000010152 1.3. Click "Add items" 1.4. Redo steps 1.1 to 1.3 for the second batch (it can have the same barcodes, it doesn't really matter) 2. Manipulate the timestamps in the DB so that they are ~30 days ago and ~5 days ago * If using KTD access the database with `ktd --dbshell` (if outside the shell) or `koha-mysql kohadev` (if already inside the shell) UPDATE creator_batches SET timestamp = DATE_SUB(NOW(), INTERVAL 30 DAY) WHERE batch_id = '1'; UPDATE creator_batches SET timestamp = DATE_SUB(NOW(), INTERVAL 5 DAY) WHERE batch_id = '2'; * If necessary, change the label batch ids. If using a fresh KTD, the batches should be 1 and 2. ==> You should have 6 entries in creator_batches, 3 with a timestamp 30 days ago and 3 with a timestamp 5 days ago. 3. Run cleanup_database with --labels set to 15 days and verbose option (and confirm option) ==> The output says "Purging item label batches last added to more than 1 days ago. Done with purging 6 item label batches last added to more than 1 days ago." ==> Nothing left in creator_batches even though one set was less than 15 days old. :( -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41967 Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |philippe.blouin@inlibro.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41967 --- Comment #1 from Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> --- Oops, I forgot the command for step 3 ./misc/cronjobs/cleanup_database.pl --labels 15 --confirm --verbose -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41967 Ayoub Glizi-Vicioso <ayoub.glizi-vicioso@inLibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41967 --- Comment #2 from Ayoub Glizi-Vicioso <ayoub.glizi-vicioso@inLibro.com> --- Created attachment 194415 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=194415&action=edit Bug 41967: Ensure --labels argument accepts an integer in cleanup_database.pl Test plan : 1. Initial Setup: a) Go to Cataloging > Label creator > New > Label batch b) Create two different batches (Batch 1 and Batch 2) using the 'Add by barcodes or itemnumbers' option. If using **KTD** you can use those barcodes for the two batches: 39999000010114 39999000010138 39999000010152 else you will need to create your own records with items and enter their barcodes. c) In your terminal (in a ktd --shell), set the timestamps manually: --OPTION A (KTD users): ktd --shell koha-mysql kohadev --OPTION B: Access your database Then: UPDATE creator_batches SET timestamp = DATE_SUB(NOW(), INTERVAL 30 DAY) WHERE batch_id = '1'; UPDATE creator_batches SET timestamp = DATE_SUB(NOW(), INTERVAL 5 DAY) WHERE batch_id = '2'; Note: your batch_id may differ. 2. Before Applying the Patch: a) Run the following cleanup script: ./misc/cronjobs/cleanup_database.pl --labels 15 --confirm --verbose b) Check that the console output says: "Purging ... more than 1 days ago" c) Check database and notice that it is now empty, even though one set was less than 15 days old. SELECT * FROM creator_batches; 3. Apply The Patch 4. After Applying The Patch: a) Redo step 1 (Initial Setup). b) Run again the following cleanup script: ./misc/cronjobs/cleanup_database.pl --labels 15 --confirm --verbose c) Check that the console output says: "Purging ... more than 15 days ago" d) Batch 1 is deleted, but Batch 2 (5 days old) is STILL PRESENT. Success! SELECT * FROM creator_batches; -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41967 --- Comment #3 from Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> --- Works for me! But I can't sign off bc I work with Ayoub -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41967 --- Comment #4 from Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> --- Additional test I tried : After changing the dates, I added another barcode to batch 1. Now none of the batches should be deleted because the batch that was initially old enough was modified less than 15 days ago. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41967 Gretchen Maxeiner <maxeinergl@gcc.edu> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |maxeinergl@gcc.edu -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41967 Ayoub Glizi-Vicioso <ayoub.glizi-vicioso@inLibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #194415|0 |1 is obsolete| | --- Comment #5 from Ayoub Glizi-Vicioso <ayoub.glizi-vicioso@inLibro.com> --- Created attachment 194550 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=194550&action=edit Bug 41967: Ensure --labels argument accepts an integer in cleanup_database.pl Test plan : 1. Initial Setup: a) Go to Cataloging > Label creator > New > Label batch b) Create two different batches (Batch 1 and Batch 2) using the 'Add by barcodes or itemnumbers' option. If using **KTD** you can use those barcodes for the two batches: 39999000010114 39999000010138 39999000010152 else you will need to create your own records with items and enter their barcodes. c) In your terminal (in a ktd --shell), set the timestamps manually: --OPTION A (KTD users): ktd --shell koha-mysql kohadev --OPTION B: Access your database Then: UPDATE creator_batches SET timestamp = DATE_SUB(NOW(), INTERVAL 30 DAY) WHERE batch_id = '1'; UPDATE creator_batches SET timestamp = DATE_SUB(NOW(), INTERVAL 5 DAY) WHERE batch_id = '2'; Note: your batch_id may differ. 2. Before Applying the Patch: a) Run the following cleanup script: ./misc/cronjobs/cleanup_database.pl --labels 15 --confirm --verbose b) Check that the console output says: "Purging ... more than 1 days ago" c) Check database and notice that it is now empty, even though one set was less than 15 days old. SELECT * FROM creator_batches; 3. Apply The Patch 4. After Applying The Patch: a) Redo step 1 (Initial Setup). b) Run again the following cleanup script: ./misc/cronjobs/cleanup_database.pl --labels 15 --confirm --verbose c) Check that the console output says: "Purging ... more than 15 days ago" d) Batch 1 is deleted, but Batch 2 (5 days old) is STILL PRESENT. Success! SELECT * FROM creator_batches; -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41967 --- Comment #6 from Ayoub Glizi-Vicioso <ayoub.glizi-vicioso@inLibro.com> --- Created attachment 194551 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=194551&action=edit Bug 41967: Ensure --cards argument accepts an integer in cleanup_database.pl Test plan (for --cards arguments) : 1. Initial Setup: a) Go to Tools > Patron card creator > New > Card batch b) Create two different batches (Batch 1 and Batch 2) using the 'Add by borrowernumber(s):' option. If using **KTD** you can use the following borrowernumbers for both batches: 15 29 47 else you will need to create your own patrons and enter their borrowernumber. c) In your terminal, set the timestamps manually: --OPTION A (KTD users): ktd --shell koha-mysql kohadev --OPTION B: Access your database Then: UPDATE creator_batches SET timestamp = DATE_SUB(NOW(), INTERVAL 30 DAY) WHERE batch_id = '1'; UPDATE creator_batches SET timestamp = DATE_SUB(NOW(), INTERVAL 5 DAY) WHERE batch_id = '2'; Note: your batch_id may differ. 2. Before Applying the Patch: a) Run the following cleanup script: ./misc/cronjobs/cleanup_database.pl --cards 15 --confirm --verbose b) Check that the console output says: "Purging ... more than 1 days ago" c) Check database and notice that it is now empty, even though one set was less than 15 days old. SELECT * FROM creator_batches; 3. Apply The Patch 4. After Applying The Patch: a) Redo step 1 (Initial Setup). b) Run again the following cleanup script: ./misc/cronjobs/cleanup_database.pl --cards 15 --confirm --verbose c) Check that the console output says: "Purging ... more than 15 days ago" d) Batch 1 is deleted, but Batch 2 (5 days old) is STILL PRESENT. Success! SELECT * FROM creator_batches; -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41967 Ayoub Glizi-Vicioso <ayoub.glizi-vicioso@inLibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ayoub.glizi-vicioso@inLibro | |.com --- Comment #7 from Ayoub Glizi-Vicioso <ayoub.glizi-vicioso@inLibro.com> --- Note: I have provided two separate test plans to cover both arguments modified by this bug: Test Plan 1: Focuses on the --labels argument. Test Plan 2: Focuses on the --cards argument. With this patch, the script ("cleanup_database.pl") uses the actual number of days provided instead of defaulting to 1. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41967 Ayoub Glizi-Vicioso <ayoub.glizi-vicioso@inLibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Cleanup database --labels |cleanup_database.pl ignores |deletes labels over 1 day |integer values for --labels |old regardless of passed |and --cards and defaults to |value |1 day -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41967 --- Comment #8 from Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> --- I tested the cards section. Before the patch, the cleanup_database.pl for --cards 15 doesn't work at all. It returns Purging card creator batches last added to more than 1 days ago. Use of uninitialized value $labels in sprintf at ./misc/cronjobs/cleanup_database.pl line 776. Done with purging 0 card creator batches last added to more than 0 days ago. And when I query my database, my 6 entries are still there. After the patch, it's OK. :) So nothing wrong with the patch, it's maybe just the test plan that needs adjusting (in step 2) 2. Before Applying the Patch: a) Run the following cleanup script: ./misc/cronjobs/cleanup_database.pl --cards 15 --confirm --verbose --> Error in console output --> Nothing is deleted even though one batch was older than 15 days SELECT * FROM creator_batches; -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41967 --- Comment #9 from Ayoub Glizi-Vicioso <ayoub.glizi-vicioso@inLibro.com> --- You are correct! The original test plan for Step 2 was wrong. Before the patch, the script fails to delete anything because of the sprintf error. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41967 Ayoub Glizi-Vicioso <ayoub.glizi-vicioso@inLibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #194550|0 |1 is obsolete| | --- Comment #10 from Ayoub Glizi-Vicioso <ayoub.glizi-vicioso@inLibro.com> --- Created attachment 194564 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=194564&action=edit Bug 41967: Ensure --labels argument accepts an integer in cleanup_database.pl Test plan : 1. Initial Setup: a) Go to Cataloging > Label creator > New > Label batch b) Create two different batches (Batch 1 and Batch 2) using the 'Add by barcodes or itemnumbers' option. If using **KTD** you can use those barcodes for the two batches: 39999000010114 39999000010138 39999000010152 else you will need to create your own records with items and enter their barcodes. c) In your terminal (in a ktd --shell), set the timestamps manually: --OPTION A (KTD users): ktd --shell koha-mysql kohadev --OPTION B: Access your database Then: UPDATE creator_batches SET timestamp = DATE_SUB(NOW(), INTERVAL 30 DAY) WHERE batch_id = '1'; UPDATE creator_batches SET timestamp = DATE_SUB(NOW(), INTERVAL 5 DAY) WHERE batch_id = '2'; Note: your batch_id may differ. 2. Before Applying the Patch: a) Run the following cleanup script: ./misc/cronjobs/cleanup_database.pl --labels 15 --confirm --verbose b) Check that the console output says: "Purging ... more than 1 days ago" c) Check database and notice that it is now empty, even though one set was less than 15 days old. SELECT * FROM creator_batches; 3. Apply The Patch 4. After Applying The Patch: a) Redo step 1 (Initial Setup). b) Run again the following cleanup script: ./misc/cronjobs/cleanup_database.pl --labels 15 --confirm --verbose c) Check that the console output says: "Purging ... more than 15 days ago" d) Batch 1 is deleted, but Batch 2 (5 days old) is STILL PRESENT. Success! SELECT * FROM creator_batches; -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41967 Ayoub Glizi-Vicioso <ayoub.glizi-vicioso@inLibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #194551|0 |1 is obsolete| | --- Comment #11 from Ayoub Glizi-Vicioso <ayoub.glizi-vicioso@inLibro.com> --- Created attachment 194565 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=194565&action=edit Bug 41967: Ensure --cards argument accepts an integer in cleanup_database.pl Test plan (for --cards arguments) : 1. Initial Setup: a) Go to Tools > Patron card creator > New > Card batch b) Create two different batches (Batch 1 and Batch 2) using the 'Add by borrowernumber(s):' option. If using **KTD** you can use the following borrowernumbers for both batches: 15 29 47 else you will need to create your own patrons and enter their borrowernumber. c) In your terminal, set the timestamps manually: --OPTION A (KTD users): ktd --shell koha-mysql kohadev --OPTION B: Access your database Then: UPDATE creator_batches SET timestamp = DATE_SUB(NOW(), INTERVAL 30 DAY) WHERE batch_id = '1'; UPDATE creator_batches SET timestamp = DATE_SUB(NOW(), INTERVAL 5 DAY) WHERE batch_id = '2'; Note: your batch_id may differ. 2. Before Applying the Patch: a) Run the following cleanup script: ./misc/cronjobs/cleanup_database.pl --cards 15 --confirm --verbose b) Error in console output c) Nothing is deleted even though one batch was older than 15 days SELECT * FROM creator_batches; 3. Apply The Patch 4. After Applying The Patch: a) Redo step 1 (Initial Setup). b) Run again the following cleanup script: ./misc/cronjobs/cleanup_database.pl --cards 15 --confirm --verbose c) Check that the console output says: "Purging ... more than 15 days ago" d) Batch 1 is deleted, but Batch 2 (5 days old) is STILL PRESENT. Success! SELECT * FROM creator_batches; -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41967 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41967 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #194564|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41967 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #194565|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41967 --- Comment #12 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 196130 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=196130&action=edit Bug 41967: Ensure --labels argument accepts an integer in cleanup_database.pl Test plan : 1. Initial Setup: a) Go to Cataloging > Label creator > New > Label batch b) Create two different batches (Batch 1 and Batch 2) using the 'Add by barcodes or itemnumbers' option. If using **KTD** you can use those barcodes for the two batches: 39999000010114 39999000010138 39999000010152 else you will need to create your own records with items and enter their barcodes. c) In your terminal (in a ktd --shell), set the timestamps manually: --OPTION A (KTD users): ktd --shell koha-mysql kohadev --OPTION B: Access your database Then: UPDATE creator_batches SET timestamp = DATE_SUB(NOW(), INTERVAL 30 DAY) WHERE batch_id = '1'; UPDATE creator_batches SET timestamp = DATE_SUB(NOW(), INTERVAL 5 DAY) WHERE batch_id = '2'; Note: your batch_id may differ. 2. Before Applying the Patch: a) Run the following cleanup script: ./misc/cronjobs/cleanup_database.pl --labels 15 --confirm --verbose b) Check that the console output says: "Purging ... more than 1 days ago" c) Check database and notice that it is now empty, even though one set was less than 15 days old. SELECT * FROM creator_batches; 3. Apply The Patch 4. After Applying The Patch: a) Redo step 1 (Initial Setup). b) Run again the following cleanup script: ./misc/cronjobs/cleanup_database.pl --labels 15 --confirm --verbose c) Check that the console output says: "Purging ... more than 15 days ago" d) Batch 1 is deleted, but Batch 2 (5 days old) is STILL PRESENT. Success! SELECT * FROM creator_batches; Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41967 --- Comment #13 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 196131 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=196131&action=edit Bug 41967: Ensure --cards argument accepts an integer in cleanup_database.pl Test plan (for --cards arguments) : 1. Initial Setup: a) Go to Tools > Patron card creator > New > Card batch b) Create two different batches (Batch 1 and Batch 2) using the 'Add by borrowernumber(s):' option. If using **KTD** you can use the following borrowernumbers for both batches: 15 29 47 else you will need to create your own patrons and enter their borrowernumber. c) In your terminal, set the timestamps manually: --OPTION A (KTD users): ktd --shell koha-mysql kohadev --OPTION B: Access your database Then: UPDATE creator_batches SET timestamp = DATE_SUB(NOW(), INTERVAL 30 DAY) WHERE batch_id = '1'; UPDATE creator_batches SET timestamp = DATE_SUB(NOW(), INTERVAL 5 DAY) WHERE batch_id = '2'; Note: your batch_id may differ. 2. Before Applying the Patch: a) Run the following cleanup script: ./misc/cronjobs/cleanup_database.pl --cards 15 --confirm --verbose b) Error in console output c) Nothing is deleted even though one batch was older than 15 days SELECT * FROM creator_batches; 3. Apply The Patch 4. After Applying The Patch: a) Redo step 1 (Initial Setup). b) Run again the following cleanup script: ./misc/cronjobs/cleanup_database.pl --cards 15 --confirm --verbose c) Check that the console output says: "Purging ... more than 15 days ago" d) Batch 1 is deleted, but Batch 2 (5 days old) is STILL PRESENT. Success! SELECT * FROM creator_batches; Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41967 Thomas Klausner <domm@plix.at> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |domm@plix.at QA Contact|testopia@bugs.koha-communit |domm@plix.at |y.org | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41967 Thomas Klausner <domm@plix.at> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA --- Comment #14 from Thomas Klausner <domm@plix.at> --- Everything worked like described in the test plan! -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41967 Thomas Klausner <domm@plix.at> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #196130|0 |1 is obsolete| | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41967 Thomas Klausner <domm@plix.at> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #196131|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41967 --- Comment #15 from Thomas Klausner <domm@plix.at> --- Created attachment 196221 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=196221&action=edit Bug 41967: Ensure --labels argument accepts an integer in cleanup_database.pl Test plan : 1. Initial Setup: a) Go to Cataloging > Label creator > New > Label batch b) Create two different batches (Batch 1 and Batch 2) using the 'Add by barcodes or itemnumbers' option. If using **KTD** you can use those barcodes for the two batches: 39999000010114 39999000010138 39999000010152 else you will need to create your own records with items and enter their barcodes. c) In your terminal (in a ktd --shell), set the timestamps manually: --OPTION A (KTD users): ktd --shell koha-mysql kohadev --OPTION B: Access your database Then: UPDATE creator_batches SET timestamp = DATE_SUB(NOW(), INTERVAL 30 DAY) WHERE batch_id = '1'; UPDATE creator_batches SET timestamp = DATE_SUB(NOW(), INTERVAL 5 DAY) WHERE batch_id = '2'; Note: your batch_id may differ. 2. Before Applying the Patch: a) Run the following cleanup script: ./misc/cronjobs/cleanup_database.pl --labels 15 --confirm --verbose b) Check that the console output says: "Purging ... more than 1 days ago" c) Check database and notice that it is now empty, even though one set was less than 15 days old. SELECT * FROM creator_batches; 3. Apply The Patch 4. After Applying The Patch: a) Redo step 1 (Initial Setup). b) Run again the following cleanup script: ./misc/cronjobs/cleanup_database.pl --labels 15 --confirm --verbose c) Check that the console output says: "Purging ... more than 15 days ago" d) Batch 1 is deleted, but Batch 2 (5 days old) is STILL PRESENT. Success! SELECT * FROM creator_batches; Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Thomas Klausner <domm@plix.at> -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41967 --- Comment #16 from Thomas Klausner <domm@plix.at> --- Created attachment 196222 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=196222&action=edit Bug 41967: Ensure --cards argument accepts an integer in cleanup_database.pl Test plan (for --cards arguments) : 1. Initial Setup: a) Go to Tools > Patron card creator > New > Card batch b) Create two different batches (Batch 1 and Batch 2) using the 'Add by borrowernumber(s):' option. If using **KTD** you can use the following borrowernumbers for both batches: 15 29 47 else you will need to create your own patrons and enter their borrowernumber. c) In your terminal, set the timestamps manually: --OPTION A (KTD users): ktd --shell koha-mysql kohadev --OPTION B: Access your database Then: UPDATE creator_batches SET timestamp = DATE_SUB(NOW(), INTERVAL 30 DAY) WHERE batch_id = '1'; UPDATE creator_batches SET timestamp = DATE_SUB(NOW(), INTERVAL 5 DAY) WHERE batch_id = '2'; Note: your batch_id may differ. 2. Before Applying the Patch: a) Run the following cleanup script: ./misc/cronjobs/cleanup_database.pl --cards 15 --confirm --verbose b) Error in console output c) Nothing is deleted even though one batch was older than 15 days SELECT * FROM creator_batches; 3. Apply The Patch 4. After Applying The Patch: a) Redo step 1 (Initial Setup). b) Run again the following cleanup script: ./misc/cronjobs/cleanup_database.pl --cards 15 --confirm --verbose c) Check that the console output says: "Purging ... more than 15 days ago" d) Batch 1 is deleted, but Batch 2 (5 days old) is STILL PRESENT. Success! SELECT * FROM creator_batches; Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Thomas Klausner <domm@plix.at> -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41967 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrew@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41967 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|enhancement |normal --- Comment #17 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Marking this a bug rather than enhancement -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41967 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lucas@bywatersolutions.com --- Comment #18 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Please set assignee -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41967 Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |ayoub.glizi-vicioso@inLibro |ity.org |.com -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41967 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |26.05.00 released in| | Status|Passed QA |Pushed to main -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41967 --- Comment #19 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Nice work everyone! Pushed to main for 26.05 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41967 --- Comment #20 from Gretchen Maxeiner <maxeinergl@gcc.edu> --- Could this one be backported to 25.11 to restore this cron function where it is broken? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41967 Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the| |This fixes a bug in the release notes| |cleanup_database.pl script | |to delete label batches and | |patron card batches older | |than X days. Before this | |fix, if the --labels or | |--cards argument was passed | |in the cronjob, all batches | |older than 1 day were | |deleted, regardless of the | |value passed in the | |argument. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41967 Jacob O'Mara <jacob.omara@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|26.05.00 |26.05.00,25.11.05 released in| | Status|Pushed to main |Pushed to stable -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41967 --- Comment #21 from Jacob O'Mara <jacob.omara@openfifth.co.uk> --- Thanks all, pushed to 25.11.x -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org