Bug 30914 - cleanup_database.pl --transfers --old-reserves --confirm does not work
Summary: cleanup_database.pl --transfers --old-reserves --confirm does not work
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Command-line Utilities (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low major (vote)
Assignee: Jonathan Druart
QA Contact: Katrin Fischer
URL:
Keywords:
Depends on: 24153
Blocks:
  Show dependency treegraph
 
Reported: 2022-06-07 07:22 UTC by Andreas Jonsson
Modified: 2023-06-08 22:26 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.11.00, 22.05.03, 21.11.11, 21.05.18


Attachments
Bug 30914: (24153 follow-up) Fix cleanup_database.pl --transfers --old-reserves (1.49 KB, patch)
2022-06-07 12:13 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 30914: (24153 follow-up) Fix cleanup_database.pl --transfers --old-reserves (1.55 KB, patch)
2022-06-08 07:04 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 30914: (24153 follow-up) Fix cleanup_database.pl --transfers --old-reserves (1.61 KB, patch)
2022-06-12 11:18 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Jonsson 2022-06-07 07:22:41 UTC
When the --confirm flag was added for bug 24153 the same mistake was made twice - 'delete if $verbose' instead of 'delete if $confirm': 


if ($pOldReserves) {
    print "Purging old reserves older than $pOldReserves days.\n" if $verbose;
    my $old_reserves = Koha::Old::Holds->filter_by_last_update( { days => $pOldReserves } );
    my $count = $old_reserves->count;
    $old_reserves->delete if $verbose;
    say sprintf "Done with purging %d old reserves.", $count if $verbose;
}

if ($pTransfers) {
    print "Purging arrived item transfers older than $pTransfers days.\n" if $verbose;
    my $transfers = Koha::Item::Transfers->filter_by_last_update(
        {
            timestamp_column_name => 'datearrived',
            days => $pTransfers,
        }
    );
    my $count = $transfers->count;
    $transfers->delete if $verbose;
    say sprintf "Done with purging %d transfers.", $count if $verbose;
}
Comment 1 Jonathan Druart 2022-06-07 12:13:18 UTC
Created attachment 135756 [details] [review]
Bug 30914: (24153 follow-up) Fix cleanup_database.pl --transfers --old-reserves

Silly mistake, 'delete if verbose' must be 'delete if confirm'

Test plan:
Try the cleanup_database.pl script to delete transfers and old issues.
Using --transfers --old-reserves and the --confirm flag the entries must be
removed
Comment 2 Jonathan Druart 2022-06-07 12:13:35 UTC
Oops, sorry about that!
Comment 3 Fridolin Somers 2022-06-08 07:04:57 UTC
Created attachment 135789 [details] [review]
Bug 30914: (24153 follow-up) Fix cleanup_database.pl --transfers --old-reserves

Silly mistake, 'delete if verbose' must be 'delete if confirm'

Test plan:
Try the cleanup_database.pl script to delete transfers and old issues.
Using --transfers --old-reserves and the --confirm flag the entries must be
removed

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Comment 4 Katrin Fischer 2022-06-12 11:18:38 UTC
Created attachment 135969 [details] [review]
Bug 30914: (24153 follow-up) Fix cleanup_database.pl --transfers --old-reserves

Silly mistake, 'delete if verbose' must be 'delete if confirm'

Test plan:
Try the cleanup_database.pl script to delete transfers and old issues.
Using --transfers --old-reserves and the --confirm flag the entries must be
removed

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 5 Tomás Cohen Arazi 2022-06-13 13:38:37 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 6 Lucas Gass 2022-07-13 19:28:52 UTC
Backported to 22.05.x for 22.05.03
Comment 7 Arthur Suzuki 2022-08-12 08:13:37 UTC
pushed to 21.11.x for 21.11.11
Comment 8 Victor Grousset/tuxayo 2022-08-17 22:44:59 UTC
Backported: Pushed to 21.05.x branch for 21.05.18

Nothing to document, marking resolved.