Bug 23844

Summary: Noisy warns in addbiblio.pl when importing from Z3950
Product: Koha Reporter: Nick Clemens (kidclamp) <nick>
Component: CatalogingAssignee: Nick Clemens (kidclamp) <nick>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: 1joynelson, jonathan.druart, lucas, m.de.rooy, mkstephens
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:
20.05.00, 19.11.03
Circulation function:
Attachments: Bug 23844: Check if field defined in framework and specify 'Default' for framework
Bug 23844: Check if field defined in framework and specify 'Default' for framework
Bug 23844: Check if field defined in framework and specify 'Default' for framework

Description Nick Clemens (kidclamp) 2019-10-18 18:26:06 UTC
To recreate:
1 - Go to Cataloguing
2 - New from Z3950
3 - Find an import a record
4 - Check the plack logs:
Use of uninitialized value in string ne at /kohadevbox/koha/cataloguing/addbiblio.pl line 565.
Use of uninitialized value in string ne at /kohadevbox/koha/cataloguing/addbiblio.pl line 580.
Use of uninitialized value $frameworkcode in string eq at /kohadevbox/koha/cataloguing/addbiblio.pl line 711.
Use of uninitialized value $frameworkcode in string eq at /kohadevbox/koha/cataloguing/addbiblio.pl line 715.
Use of uninitialized value $frameworkcode in string eq at /kohadevbox/koha/cataloguing/addbiblio.pl line 734.
Comment 1 Nick Clemens (kidclamp) 2019-10-18 18:28:01 UTC
Created attachment 94416 [details] [review]
Bug 23844: Check if field defined in framework and specify 'Default' for framework

To test:
1 - Go to Cataloguing
2 - New from Z3950
3 - Find an import a record
4 - Check the plack logs:
Use of uninitialized value in string ne at /kohadevbox/koha/cataloguing/addbiblio.pl line 565.
Use of uninitialized value in string ne at /kohadevbox/koha/cataloguing/addbiblio.pl line 580.
Use of uninitialized value $frameworkcode in string eq at /kohadevbox/koha/cataloguing/addbiblio.pl line 711.
Use of uninitialized value $frameworkcode in string eq at /kohadevbox/koha/cataloguing/addbiblio.pl line 715.
Use of uninitialized value $frameworkcode in string eq at /kohadevbox/koha/cataloguing/addbiblio.pl line 734.
5 - Apply patch
6 - Repeat
7 - No new errors
8 - Confirm selecting 'Default' from 'New from Z3950' dropdown also generates no errors
Comment 2 Myka Kennedy Stephens 2020-01-19 01:21:16 UTC
Created attachment 97585 [details] [review]
Bug 23844: Check if field defined in framework and specify 'Default' for framework

To test:
1 - Go to Cataloguing
2 - New from Z3950
3 - Find an import a record
4 - Check the plack logs:
Use of uninitialized value in string ne at /kohadevbox/koha/cataloguing/addbiblio.pl line 565.
Use of uninitialized value in string ne at /kohadevbox/koha/cataloguing/addbiblio.pl line 580.
Use of uninitialized value $frameworkcode in string eq at /kohadevbox/koha/cataloguing/addbiblio.pl line 711.
Use of uninitialized value $frameworkcode in string eq at /kohadevbox/koha/cataloguing/addbiblio.pl line 715.
Use of uninitialized value $frameworkcode in string eq at /kohadevbox/koha/cataloguing/addbiblio.pl line 734.
5 - Apply patch
6 - Repeat
7 - No new errors
8 - Confirm selecting 'Default' from 'New from Z3950' dropdown also generates no errors

Signed-off-by: Myka Kennedy Stephens <mkstephens@lancasterseminary.edu>
Comment 3 Myka Kennedy Stephens 2020-01-19 01:28:46 UTC
Patch works as described for Cataloging > New from Z39.50 and Cataloging > New from Z39.50 > Default framework.

I would like to point out that the $frameworkcode errors do still appear with this patch applied when adding records using Catloging > New Record > Default framework > Z39.50 search and also when using the New > New Record (then click Z39.50 search button) option from within an existing record.

My plack logs showed the $frameworkcode errors on lines 708, 712, and 731, and I'm seeing a lot more "uninitialized value in string ne" errors than in the example provided.
I'm also seeing the following error regardless of method for adding records:
"Use of uninitialized value $searchid in concatenation (.) or string at /kohadevbox/koha/cataloguing/addbiblio.pl line 860."
Comment 4 Jonathan Druart 2020-01-21 15:52:25 UTC
Nick, I only get those:

Use of uninitialized value $frameworkcode in string eq at /kohadevbox/koha/cataloguing/addbiblio.pl line 708.
Use of uninitialized value $frameworkcode in string eq at /kohadevbox/koha/cataloguing/addbiblio.pl line 712.
Use of uninitialized value $frameworkcode in string eq at /kohadevbox/koha/cataloguing/addbiblio.pl line 731.


Who did you end up with tab that is NULL?

I get:
MariaDB [koha_kohadev]> select distinct(tab) from marc_subfield_structure;
+------+
| tab  |
+------+
|   -1 |
|    0 |
|    1 |
|    2 |
|    3 |
|    4 |
|    5 |
|    6 |
|    7 |
|    8 |
|    9 |
|   10 |
+------+
12 rows in set (0.03 sec)
Comment 5 Nick Clemens (kidclamp) 2020-01-22 13:22:09 UTC
(In reply to Jonathan Druart from comment #4)
> Nick, I only get those:
> 
> Use of uninitialized value $frameworkcode in string eq at
> /kohadevbox/koha/cataloguing/addbiblio.pl line 708.
> Use of uninitialized value $frameworkcode in string eq at
> /kohadevbox/koha/cataloguing/addbiblio.pl line 712.
> Use of uninitialized value $frameworkcode in string eq at
> /kohadevbox/koha/cataloguing/addbiblio.pl line 731.
> 
> 
> Who did you end up with tab that is NULL?
> 
> I get:
> MariaDB [koha_kohadev]> select distinct(tab) from marc_subfield_structure;
> +------+
> | tab  |
> +------+
> |   -1 |
> |    0 |
> |    1 |
> |    2 |
> |    3 |
> |    4 |
> |    5 |
> |    6 |
> |    7 |
> |    8 |
> |    9 |
> |   10 |
> +------+
> 12 rows in set (0.03 sec)

I believe the issue here is when the imported record has fields that are not defined in the frameworks - so we are trying to get the tab for a field that has no tab defined.
Comment 6 Jonathan Druart 2020-02-05 10:53:14 UTC
Created attachment 98446 [details] [review]
Bug 23844: Check if field defined in framework and specify 'Default' for framework

To test:
1 - Go to Cataloguing
2 - New from Z3950
3 - Find an import a record
4 - Check the plack logs:
Use of uninitialized value in string ne at /kohadevbox/koha/cataloguing/addbiblio.pl line 565.
Use of uninitialized value in string ne at /kohadevbox/koha/cataloguing/addbiblio.pl line 580.
Use of uninitialized value $frameworkcode in string eq at /kohadevbox/koha/cataloguing/addbiblio.pl line 711.
Use of uninitialized value $frameworkcode in string eq at /kohadevbox/koha/cataloguing/addbiblio.pl line 715.
Use of uninitialized value $frameworkcode in string eq at /kohadevbox/koha/cataloguing/addbiblio.pl line 734.
5 - Apply patch
6 - Repeat
7 - No new errors
8 - Confirm selecting 'Default' from 'New from Z3950' dropdown also generates no errors

Signed-off-by: Myka Kennedy Stephens <mkstephens@lancasterseminary.edu>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Note: the template change does not seem necessary here but should not
hurt
Comment 7 Martin Renvoize (ashimema) 2020-02-05 12:38:57 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 8 Joy Nelson 2020-02-11 00:18:30 UTC
Pushed to 19.11.x branch for 19.11.03
Comment 9 Lucas Gass (lukeg) 2020-03-09 17:14:41 UTC
doesnt apply clean to 19.05.x, no backport