Bug 25146

Summary: Move reconcile_balances.pl script into maintenance directory
Product: Koha Reporter: Kelly McElligott <kelly>
Component: Command-line UtilitiesAssignee: Bugs List <koha-bugs>
Status: BLOCKED --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: robin, tomascohen
Version: 19.05   
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: 21915, 25148    
Bug Blocks:    
Attachments: Bug 25146: Move reconcile_balances.pl script into maintenance directory
Bug 25146: Move reconcile_balances.pl script into maintenance directory

Description Kelly McElligott 2020-04-14 18:55:07 UTC
The reconcile balance cron was introduced to handle the patrons accounting where debits and credits were out of line.  After this cron was introduced, a system preference, AccountAutoReconcile, was created to allow libraries to reconcile patron balances automatically as they happened. I would argue that this cron can be eliminated as the system preference can do the same thing and it gives control to the library through the staff client vs a cron.
Comment 1 Katrin Fischer 2020-04-14 19:21:03 UTC
I am not sure if the cron would still be useful for people updating from earlier versions - allowing a 'clean-up' of data created before the pref was added. 
We could discuss moving it into a different directory then maybe - (maintenance?)
Adding Tomas as the original author and linking to the original bug.
Comment 2 Tomás Cohen Arazi (tcohen) 2020-04-14 19:53:48 UTC
I agree this shouldn't be a cronjob anymore. This should belong to the maintenance scripts collection (even if AutoReconcile is on, there is no other tool that traverses all patrons and calls the reconcile_balance method on their behalf).

For that reason, I would keep it, not as a cronjob, but keep it.
Comment 3 Katrin Fischer 2020-04-14 22:34:30 UTC
I have tried to patch this, but running the script, I get a fatal error:
SQL::Abstract::puke(): [SQL::Abstract::__ANON__] Fatal: SQL::Abstract before v1.75 used to generate incorrect SQL when the -IN operator was given an undef-containing list: !!!AUDIT YOUR CODE AND DATA!!! (the upcoming Data::Query-based version of SQL::Abstract will emit the logically correct SQL instead of raising this exception) at /home/vagrant/kohaclone/Koha/Objects.pm line 210

Tomas, can you help?
Comment 4 Katrin Fischer 2020-04-14 22:36:42 UTC
Created attachment 102954 [details] [review]
Bug 25146: Move reconcile_balances.pl script into maintenance directory

This moves the reconcile_balances.pl script from the cronjobs
to the maintenance directory. It's still useful if you want
to start using AccountAutoReconcile to clean your data up
at the beginning, but is not supposed to run regularly in cron.

To test:
- Verify the file has been moved
- Run the script and verify it still works
Comment 5 Katrin Fischer 2020-04-14 22:39:03 UTC
Created attachment 102955 [details] [review]
Bug 25146: Move reconcile_balances.pl script into maintenance directory

This moves the reconcile_balances.pl script from the cronjobs
to the maintenance directory. It's still useful if you want
to start using AccountAutoReconcile to clean your data up
at the beginning, but is not supposed to run regularly in cron.

To test:
- Verify the file has been moved
- Run the script and verify it still works