The method GuessAuthTypeCode is used when importing from batch or z3950/SRU to find the local authority type depending on MARC flavour and authority record fields. This method should check that found type is configured. Otherwise it can generate software errors when type code is used to fetch Koha::Authority::Type.
Created attachment 91797 [details] [review] Bug 23380: GuessAuthTypeCode should check authority type exists The method GuessAuthTypeCode is used when importing from batch or z3950/SRU to find the local authority type depending on MARC flavour and authority record fields. This method should check that found type is configured. Otherwise it can generate software errors when type code is used to fetch Koha::Authority::Type. Test plan : 1) Delete an authority type, ie NP 2) Connect to a z3950/SRU authority server 3) Look for authorities of this type 4) Import an authority 5) Without patch you get error : Can't call method "auth_tag_to_report" on an undefined value at /home/koha/src/C4/AuthoritiesMarc.pm line 757. 6) With patch you see record edition and in logs "Authority type NP not configured"
Please cover subroutines changes by tests.
Created attachment 145703 [details] [review] Bug 23380: GuessAuthTypeCode should check authority type exists The method GuessAuthTypeCode is used when importing from batch or z3950/SRU to find the local authority type depending on MARC flavour and authority record fields. This method should check that found type is configured. Otherwise it can generate software errors when type code is used to fetch Koha::Authority::Type. Test plan : 1) Delete an authority type, ie NP 2) Connect to a z3950/SRU authority server 3) Look for authorities of this type 4) Import an authority 5) Without patch you get error : Can't call method "auth_tag_to_report" on an undefined value at /home/koha/src/C4/AuthoritiesMarc.pm line 757. 6) With patch you see record edition and in logs "Authority type NP not configured"
Fixed for current master. Using Koha::Authority::Types->search->get_column('authtypecode') is better.
(In reply to Fridolin Somers from comment #4) > Fixed for current master. > > Using Koha::Authority::Types->search->get_column('authtypecode') is better. Which means? Do we close this one?
(In reply to Jonathan Druart from comment #5) > (In reply to Fridolin Somers from comment #4) > > Fixed for current master. > > > > Using Koha::Authority::Types->search->get_column('authtypecode') is better. > > Which means? Do we close this one? No I mean rebased on current master and patch slightly changed