Bug 23380 - GuessAuthTypeCode should check authority type exists
Summary: GuessAuthTypeCode should check authority type exists
Status: Failed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Fridolin Somers
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-26 10:00 UTC by Fridolin Somers
Modified: 2023-02-02 08:11 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 23380: GuessAuthTypeCode should check authority type exists (2.28 KB, patch)
2019-07-26 11:21 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 23380: GuessAuthTypeCode should check authority type exists (2.33 KB, patch)
2023-01-26 19:25 UTC, Fridolin Somers
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Fridolin Somers 2019-07-26 10:00:14 UTC
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.
Comment 1 Fridolin Somers 2019-07-26 11:21:56 UTC
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"
Comment 2 Jonathan Druart 2019-11-26 15:35:49 UTC
Please cover subroutines changes by tests.
Comment 3 Fridolin Somers 2023-01-26 19:25:23 UTC
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"
Comment 4 Fridolin Somers 2023-01-26 19:27:56 UTC
Fixed for current master.

Using Koha::Authority::Types->search->get_column('authtypecode') is better.
Comment 5 Jonathan Druart 2023-01-31 15:42:20 UTC
(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?
Comment 6 Fridolin Somers 2023-02-02 08:11:01 UTC
(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