Bug 16010: follow-up of 15381 - FIX merge_authorities migration script

Caused by commit 7e70202d34
    Bug 15381: Remove GetAuthType and GetAuthTypeCode

If you execute perl misc/migration_tools/merge_authority.pl -f 1 -t 2
you will get:
Can't locate object method "authtypecode" via package "1" (perhaps you forgot to load "1"?)
 at misc/migration_tools/merge_authority.pl line 58.

GetAuthority does not return a Koha::Authority but a MARC::Record:
there is no authtype code method!

Test plan:
perl misc/migration_tools/merge_authority.pl -f X -t Y
Should not return any error.
Note that if the authid X or Y does not exist, the script will die.

Signed-off-by: Frédéric Demians <f.demians@tamil.fr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
This commit is contained in:
Jonathan Druart 2016-03-09 08:20:04 +00:00 committed by Brendan Gallagher
parent 99f2feeed9
commit ec3387185d
1 changed files with 5 additions and 2 deletions

View File

@ -55,8 +55,11 @@ $|=1; # flushes output
my $authfrom = GetAuthority($mergefrom);
my $authto = GetAuthority($mergeto);
my $authtypecodefrom = $mergefrom->authtypecode;
my $authtypecodeto = $mergeto->authtypecode;
die "Authority $mergefrom does not exist" unless $authfrom;
die "Authority $mergeto does not exist" unless $authto;
my $authtypecodefrom = Koha::Authorities->find($mergefrom)->authtypecode;
my $authtypecodeto = Koha::Authorities->find($mergeto)->authtypecode;
unless ($noconfirm || $batch) {
print "************\n";