Bug 9988: Check the merge limit in sub merge
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tue, 21 Feb 2017 10:54:23 +0000 (11:54 +0100)
committerKyle M Hall <kyle@bywatersolutions.com>
Thu, 13 Apr 2017 12:53:46 +0000 (08:53 -0400)
commit04263912c7e413c5dbf13fe61dcdfa4b4912ab56
treed74405d5ac410d037899ce2a5e510653bc293fd0
parent06647d29a7c02b6483f27f6c46e9d0e639236d6e
Bug 9988: Check the merge limit in sub merge

At this point, we are replacing dontmerge functionality by the new
AuthorityMergeLimit logic. Instead of doing this check before calling
merge, we just call merge and check it there. In order to let the cron
job do the larger (postponed) merges, we add a parameter override_limit.

A subtest is added in Merge.t to test the 'postponed merge' feature. Since
merge now also calls get_usage_count, an additional mock is added. All
references to dontmerge are removed.

In merge two lines, initializing $dbh and $counteditbiblios, are moved.
The dontmerge test in DelAuthority and ModAuthority is removed. Since this
did not leave much in ModAuthority, I fixed the whitespace on the remaining
lines rightaway (yes, I know).
A minimal set of changes is applied to the cron script; it will get further
attention on a next patch.

Test plan:
[1] Run t/db_dependent/Authorities/Merge.t
[2] Set AuthorityMergeLimit to 2. Modify an authority with two linked
    biblios. Check that the merge was done immediately.
[3] Now modify an authority with more than 2 linked records.
    Verify that the merge was postponed; a record must be inserted in
    the need_merge_authorities table.
[4] Testing of the merge cron job is *postponed* to a next patch.
    Note: I tested a modification, but the script just needs more
    attention.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
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>
C4/AuthoritiesMarc.pm
misc/migration_tools/merge_authority.pl
t/db_dependent/Authorities/Merge.t