When I try to remove unused authorithies I get: authid=1 type=PERSO_NAME : used 6 time(s) authid=2 type=TOPIC_TERM : used 23 time(s) authid=3 type=PERSO_NAME : used 3 time(s) authid=4 type=PERSO_NAMEUndefined subroutine &main::DelAuthority called at /usr/share/koha/bin/migration_tools/remove_unused_authorities.pl line 98. When I try only a test works OK. Thank you Fernando
Confirmed on maser with the sample database: authid=172 type=CORPO_NAME : used 2 time(s) authid=173 type=PERSO_NAMEUndefined subroutine &main::DelAuthority called at ./misc/migration_tools/remove_unused_authorities.pl line 98.
Created attachment 136320 [details] [review] Bug 30939: Fix use statement for DelAuthority Without this patch, the script won't delete any unused authorities, but gives an error instead and dies: Undefined subroutine &main::DelAuthority called at ./misc/migration_tools/remove_unused_authorities.pl line 98. To test: - Run from koha-shell: ./misc/migration_tools/remove_unused_authorities.pl -t - Verify several authorities are reported as unused - ./misc/migration_tools/remove_unused_authorities.pl -c - Verify the error message is shown when the first unused authority is found and the script stops - Apply patch and rerun: ./misc/migration_tools/remove_unused_authorities.pl -t - Verify the error is gone, the script finishes and auhorities are deleted https://bugs.koha-community.org/show_bug.cgi?id=30936
Created attachment 136323 [details] [review] Bug 30939: Fix use statement for DelAuthority Without this patch, the script won't delete any unused authorities, but gives an error instead and dies: Undefined subroutine &main::DelAuthority called at ./misc/migration_tools/remove_unused_authorities.pl line 98. To test: - Run from koha-shell: ./misc/migration_tools/remove_unused_authorities.pl -t - Verify several authorities are reported as unused - ./misc/migration_tools/remove_unused_authorities.pl -c - Verify the error message is shown when the first unused authority is found and the script stops - Apply patch and rerun: ./misc/migration_tools/remove_unused_authorities.pl -t - Verify the error is gone, the script finishes and auhorities are deleted https://bugs.koha-community.org/show_bug.cgi?id=30936 Signed-off-by: David Nind <david@davidnind.com>
Created attachment 136661 [details] [review] Bug 30939: Fix use statement for DelAuthority Without this patch, the script won't delete any unused authorities, but gives an error instead and dies: Undefined subroutine &main::DelAuthority called at ./misc/migration_tools/remove_unused_authorities.pl line 98. To test: - Run from koha-shell: ./misc/migration_tools/remove_unused_authorities.pl -t - Verify several authorities are reported as unused - ./misc/migration_tools/remove_unused_authorities.pl -c - Verify the error message is shown when the first unused authority is found and the script stops - Apply patch and rerun: ./misc/migration_tools/remove_unused_authorities.pl -t - Verify the error is gone, the script finishes and auhorities are deleted https://bugs.koha-community.org/show_bug.cgi?id=30936 Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
How could be search for thoses ? I try : git grep 'use C4::.*;' | egrep -v '^(C4|Koha|t)/' | egrep -v 'qw ?(\(|/)' | grep -v Context If found for example : tools/batch_delete_records.pl:use C4::AuthoritiesMarc; Is it a correct match ?
(In reply to Fridolin Somers from comment #5) > How could be search for thoses ? > > I try : > git grep 'use C4::.*;' | egrep -v '^(C4|Koha|t)/' | egrep -v 'qw ?(\(|/)' | > grep -v Context > > If found for example : > tools/batch_delete_records.pl:use C4::AuthoritiesMarc; > > Is it a correct match ? Nope. Because the script is using fully-qualified method names (e.g. C4::AuthoritiesMarc::GetAuthority( $record_id ) ) so not importing the function names into the package scope is not a real issue. We need to check that C4::AuthoritiesMarc defines a method that is used in a script.
Pushed to master for 22.11. Nice work everyone, thanks!
Backported to 22.05.x for 22.05.04
applied to 21.11.x for 21.11.11
Missing dependencies for 21.05.x, it shouldn't be affected, no backport. Nothing to document, marking resolved.