From 65a29f6ac26932a1330c13db6ee6e8aa8d9e5f8f Mon Sep 17 00:00:00 2001 From: Ayoub Glizi-Vicioso Date: Tue, 3 Mar 2026 17:17:57 -0500 Subject: [PATCH] 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; --- misc/cronjobs/cleanup_database.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/cronjobs/cleanup_database.pl b/misc/cronjobs/cleanup_database.pl index 771846adfc..1ebc47df3d 100755 --- a/misc/cronjobs/cleanup_database.pl +++ b/misc/cronjobs/cleanup_database.pl @@ -221,7 +221,7 @@ GetOptions( 'pseudo-transactions:i' => \$pPseudoTransactions, 'pseudo-transactions-from:s' => \$pPseudoTransactionsFrom, 'pseudo-transactions-to:s' => \$pPseudoTransactionsTo, - 'labels' => \$labels, + 'labels:i' => \$labels, 'cards' => \$cards, 'return-claims' => \$return_claims, 'jobs-type:s' => \@jobs_types, -- 2.53.0