Bug 26337

Summary: Remove unused authorities script should skip merge
Product: Koha Reporter: Nick Clemens <nick>
Component: Command-line UtilitiesAssignee: Nick Clemens <nick>
Status: RESOLVED FIXED QA Contact: Josef Moravec <josef.moravec>
Severity: normal    
Priority: P5 - low CC: andrew, david, ephetteplace, josef.moravec, m.de.rooy, robin, victor
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Text to go in the release notes:
Version(s) released in:
20.11.00, 20.05.07
Attachments: Bug 26337: Pass skip_merge to DelAuthority when removing unsused authorities
Bug 26337: Pass skip_merge to DelAuthority when removing unsused authorities
Bug 26337: Pass skip_merge to DelAuthority when removing unsused authorities

Description Nick Clemens 2020-09-01 13:29:21 UTC
Remove unused authorities checks if an authority is used

If not it calls DelAuthority

DelAuthority checks if the authority is used and removes it from records if it is.

We should pass 'skip_merge' when calling form this script as we have already checked the usage here
Comment 1 Nick Clemens 2020-09-01 13:37:05 UTC
Created attachment 109431 [details] [review]
Bug 26337: Pass skip_merge to DelAuthority when removing unsused authorities

This script checks that an authority is not being used before deleting it.
We do not need to check biblios for the authority id as we have already verified it is unused.

TO test:
 1 - Reset db to koha test database
 2 - perl misc/migration_tools/remove_unused_authorities.pl -t
 3 - Note a number of unsued authorities
 4 - perl misc/migration_tools/remove_unused_authorities.pl -c
 5 - Note authorities are removed
 6 - Reset db
 7 - Apply patch
 8 - perl misc/migration_tools/remove_unused_authorities.pl -t
 9 - Note results are the same
10 - perl misc/migration_tools/remove_unused_authorities.pl -c
11 - Note results are the same
Comment 2 David Nind 2020-11-05 05:33:19 UTC
Created attachment 113030 [details] [review]
Bug 26337: Pass skip_merge to DelAuthority when removing unsused authorities

This script checks that an authority is not being used before deleting it.
We do not need to check biblios for the authority id as we have already verified it is unused.

TO test:
 1 - Reset db to koha test database
 2 - perl misc/migration_tools/remove_unused_authorities.pl -t
 3 - Note a number of unsued authorities
 4 - perl misc/migration_tools/remove_unused_authorities.pl -c
 5 - Note authorities are removed
 6 - Reset db
 7 - Apply patch
 8 - perl misc/migration_tools/remove_unused_authorities.pl -t
 9 - Note results are the same
10 - perl misc/migration_tools/remove_unused_authorities.pl -c
11 - Note results are the same

Signed-off-by: David Nind <david@davidnind.com>
Comment 3 David Nind 2020-11-05 05:34:09 UTC
Results from running through the test plan.

Before patch applied
====================

perl misc/migration_tools/remove_unused_authorities.pl -t

  1706 authorities parsed
  493 can be deleted because unused
  1213 unchanged because used

perl misc/migration_tools/remove_unused_authorities.pl -c

  1706 authorities parsed
  493 deleted because unused
  1213 unchanged because used

After patch applied
===================

perl misc/migration_tools/remove_unused_authorities.pl -t

  1706 authorities parsed
  493 can be deleted because unused
  1213 unchanged because used

perl misc/migration_tools/remove_unused_authorities.pl -c

  1706 authorities parsed
  493 deleted because unused
  1213 unchanged because used
Comment 4 Josef Moravec 2020-11-17 16:56:41 UTC
Created attachment 113745 [details] [review]
Bug 26337: Pass skip_merge to DelAuthority when removing unsused authorities

This script checks that an authority is not being used before deleting it.
We do not need to check biblios for the authority id as we have already verified it is unused.

TO test:
 1 - Reset db to koha test database
 2 - perl misc/migration_tools/remove_unused_authorities.pl -t
 3 - Note a number of unsued authorities
 4 - perl misc/migration_tools/remove_unused_authorities.pl -c
 5 - Note authorities are removed
 6 - Reset db
 7 - Apply patch
 8 - perl misc/migration_tools/remove_unused_authorities.pl -t
 9 - Note results are the same
10 - perl misc/migration_tools/remove_unused_authorities.pl -c
11 - Note results are the same

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 5 Jonathan Druart 2020-11-18 11:04:06 UTC
Pushed to master for 20.11, thanks to everybody involved!
Comment 6 Andrew Fuerste-Henry 2020-12-09 20:59:11 UTC
Pushed to 20.05.x for 20.05.07
Comment 7 Victor Grousset/tuxayo 2020-12-10 14:35:30 UTC
Not backported to oldoldstable (19.11.x). Feel free to ask if it's needed.