Bug 35405

Summary: MarcAuthorities: Use of uninitialized value $tag in hash element at MARC/Record.pm line 202.
Product: Koha Reporter: Marcel de Rooy <m.de.rooy>
Component: Architecture, internals, and plumbingAssignee: Marcel de Rooy <m.de.rooy>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: david, fridolin.somers, lucas
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.05.00,23.11.02,23.05.08
Circulation function:
Bug Depends on:    
Bug Blocks: 25790    
Attachments: Bug 35405: Remove noise from MARC::Record in SearchAuthorities
Bug 35405: Remove noise from MARC::Record in SearchAuthorities
Bug 35405: Remove noise from MARC::Record in SearchAuthorities

Description Marcel de Rooy 2023-11-27 15:05:05 UTC
When calling SearchAuthorities, there can be a lot of noise from MARC::Record.

For each hit:
Use of uninitialized value $tag in hash element at /usr/share/perl5/MARC/Record.pm line 202.
Comment 1 Marcel de Rooy 2023-11-27 15:23:50 UTC
Created attachment 159274 [details] [review]
Bug 35405: Remove noise from MARC::Record in SearchAuthorities

We are calling ->field with an undef parameter.
MARC::Record does not like that and says:
  Use of uninitialized value $tag in hash element at /usr/share/perl5/MARC/Record.pm line 202.
For now, a fix at our side.

Test plan:
Run SearchAuthorities without passing an authtypecode.
Without this patch, it results in a warning per hit.
With this patch, the noise should be gone.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 2 David Nind 2023-11-29 10:09:36 UTC
Created attachment 159322 [details] [review]
Bug 35405: Remove noise from MARC::Record in SearchAuthorities

We are calling ->field with an undef parameter.
MARC::Record does not like that and says:
  Use of uninitialized value $tag in hash element at /usr/share/perl5/MARC/Record.pm line 202.
For now, a fix at our side.

Test plan:
Run SearchAuthorities without passing an authtypecode.
Without this patch, it results in a warning per hit.
With this patch, the noise should be gone.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Nind <david@davidnind.com>
Comment 3 David Nind 2023-11-29 10:18:38 UTC
Testing notes (using KTD):

1. Go to Authorities.
2. Using the search in the header bar, click on the arrow to perform a search.
3. Note that the warning "Use of uninitialized value $tag in hash element at /usr/share/perl5/MARC/Record.pm line 202." appears several times in the /var/log/koha/kohadev/plack-intranet-error.log file.
4. Perform another search, except change the Authority type search from "Default" to "Corporate Name" (using the little selector before the arrow).
5. Note that the warning message in step 3 is not recorded in the log file.
6. Apply the patch and restart_all
7. Repeat steps 2-5 - the warning in step 3 no longer appears.

Additional note: this warning message appears in the log file once for each search (whether or not the authority type is selected) "[WARN] Use of uninitialized value $q2 in concatenation (.) or string at /kohadevbox/koha/C4/AuthoritiesMarc.pm line 230.".
Comment 4 Tomás Cohen Arazi (tcohen) 2023-12-18 11:39:16 UTC
Created attachment 159948 [details] [review]
Bug 35405: Remove noise from MARC::Record in SearchAuthorities

We are calling ->field with an undef parameter.
MARC::Record does not like that and says:
  Use of uninitialized value $tag in hash element at /usr/share/perl5/MARC/Record.pm line 202.
For now, a fix at our side.

Test plan:
Run SearchAuthorities without passing an authtypecode.
Without this patch, it results in a warning per hit.
With this patch, the noise should be gone.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 5 Katrin Fischer 2023-12-18 14:25:21 UTC
Pushed for 24.05!

Well done everyone, thank you!
Comment 6 Fridolin Somers 2024-01-03 14:53:27 UTC
Pushed to 23.11.x for 23.11.02
Comment 7 Lucas Gass (lukeg) 2024-01-04 20:28:52 UTC
Backported to 23.05.x for upcoming 23.05.08