Bug 12760

Summary: add restrictions purge to cleanup_database.pl
Product: Koha Reporter: Fridolin Somers <fridolin.somers>
Component: System AdministrationAssignee: Fridolin Somers <fridolin.somers>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: gmcharlt, kyle.m.hall, tomascohen
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 2720    
Bug Blocks: 13166    
Attachments: Bug 12760 - add restrictions purge to cleanup_database.pl
Bug 12760 - add restrictions purge to cleanup_database.pl (followup 1)
Bug 12760 - add restrictions purge to cleanup_database.pl (followup 2)
Bug 12760 - add restrictions purge to cleanup_database.pl
Bug 12760 - add restrictions purge to cleanup_database.pl (followup 1)
Bug 12760 - add restrictions purge to cleanup_database.pl (followup 2)
[PASSED QA] Bug 12760 - add restrictions purge to cleanup_database.pl
[PASSED QA] Bug 12760 - add restrictions purge to cleanup_database.pl (followup 1)
[PASSED QA] Bug 12760 - add restrictions purge to cleanup_database.pl (followup 2)

Description Fridolin Somers 2014-08-14 12:32:15 UTC
The database cleanup script should have an option to purge expired restrictions (debarments).
Comment 1 Fridolin Somers 2014-08-14 13:13:38 UTC Comment hidden (obsolete)
Comment 2 Fridolin Somers 2014-08-14 13:42:00 UTC Comment hidden (obsolete)
Comment 3 Fridolin Somers 2014-08-14 13:42:11 UTC Comment hidden (obsolete)
Comment 4 Chris Cormack 2014-08-15 02:36:54 UTC Comment hidden (obsolete)
Comment 5 Chris Cormack 2014-08-15 02:37:10 UTC Comment hidden (obsolete)
Comment 6 Chris Cormack 2014-08-15 02:37:38 UTC Comment hidden (obsolete)
Comment 7 Kyle M Hall (khall) 2014-08-15 13:03:09 UTC
Created attachment 30832 [details] [review]
[PASSED QA] Bug 12760 - add restrictions purge to cleanup_database.pl

This patch adds to the database cleanup script an option to purge expired patron restrictions (debarments in code).

Test plan :
- Select a borrower
- Create a restriction with expiration date in the futur
- Create a restriction expired since 7 days
- Create a restriction expired since 14 days
- run "misc/cronjobs/cleanup_database.pl -v --restrictions 14"
=> no restriction is removed for this borrower
- run "misc/cronjobs/cleanup_database.pl -v --restrictions 13"
=> restriction expired since 14 days is removed
- run "misc/cronjobs/cleanup_database.pl -v --restrictions 6"
=> restriction expired since 7 days is removed
- run without argument "misc/cronjobs/cleanup_database.pl"
=> You see help text for restrictions option
- run without days "misc/cronjobs/cleanup_database.pl -v --restrictions"
=> You get a purge on 30 days

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 8 Kyle M Hall (khall) 2014-08-15 13:03:20 UTC
Created attachment 30833 [details] [review]
[PASSED QA] Bug 12760 - add restrictions purge to cleanup_database.pl (followup 1)

Remove unused $query var
Correct redefined $count var

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 9 Kyle M Hall (khall) 2014-08-15 13:03:23 UTC
Created attachment 30834 [details] [review]
[PASSED QA] Bug 12760 - add restrictions purge to cleanup_database.pl (followup 2)

Formatting :
perltidy
use q{} for SQL queries
add use Modern::Perl

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 10 Tomás Cohen Arazi (tcohen) 2014-11-07 14:46:15 UTC
Patches pushed to master.

Thanks!