| Summary: | Cleanup database --labels deletes labels over 1 day old regardless of passed value | ||
|---|---|---|---|
| Product: | Koha | Reporter: | Caroline Cyr La Rose <caroline.cyr-la-rose> |
| Component: | Command-line Utilities | Assignee: | Bugs List <koha-bugs> |
| Status: | NEW --- | QA Contact: | Testopia <testopia> |
| Severity: | enhancement | ||
| Priority: | P5 - low | CC: | philippe.blouin, robin |
| Version: | Main | ||
| Hardware: | All | ||
| OS: | All | ||
| GIT URL: | Initiative type: | --- | |
| Sponsorship status: | --- | Comma delimited list of Sponsors: | |
| Crowdfunding goal: | 0 | Patch complexity: | --- |
| Documentation contact: | Documentation submission: | ||
| Text to go in the release notes: | Version(s) released in: | ||
| Circulation function: | |||
Oops, I forgot the command for step 3 ./misc/cronjobs/cleanup_database.pl --labels 15 --confirm --verbose |
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. :(