Bug 9988: Refactor the cron script
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Wed, 22 Feb 2017 15:51:58 +0000 (16:51 +0100)
committerKyle M Hall <kyle@bywatersolutions.com>
Thu, 13 Apr 2017 12:53:47 +0000 (08:53 -0400)
commitdea93375dcc147280e93153b0a7e3b90ce66b4a0
tree4a33a102168978ecaca0995c7ed7ea74a2b60475
parentd49e8bd5e22a0b39e5628b24a033badc44a07bba
Bug 9988: Refactor the cron script

The cron job is moved from migration tools to cronjobs. And renamed to
a plural form. The script is now based on Koha objects. It does no longer
include the code to merge one record. This can be done via the interface,
and will be added to a maintenance script on bug 18071. Should not be part
of this cron job.

Adding a cron_cleanup method to MergeRequests; this method is called from
the cron script to reset older entries still marked in progress and to
also remove old processed entries. Tested in a separate unit test.

Test plan:
[1] Run t/db_dependent/Authorities/MergeRequests.t
[2] Set AuthorityMergeLimit to 0. (All merges are postponed.)
[3] Modify an authority linked to a few records.
[4] Delete an authority linked to a few records with batch delete tool.
[5] And select two auth records with linked records.
    Merge these two records with authority/merge.pl.
    Note: Do not select Default. See also bug 17380.
[6] Check the need_merge_authorities table for inserted records.
[7] Run misc/cronjobs/merge_authorities.pl -b and inspect the linked
    records and the record status in need_merge_authorities.

Signed-off-by: Marc VĂ©ron <veron@veron.ch>
Signed-off-by: Jacek Ablewicz <abl@biblos.pk.edu.pl>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Koha/Authority/MergeRequests.pm
misc/cronjobs/merge_authorities.pl [new file with mode: 0755]
misc/migration_tools/merge_authority.pl [deleted file]
t/db_dependent/Authorities/MergeRequests.t [new file with mode: 0644]