Bug 36976 - Warning 'Argument "" isn't numeric in numeric' in log when merging bibliographic records
Summary: Warning 'Argument "" isn't numeric in numeric' in log when merging bibliograp...
Status: Pushed to stable
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low trivial
Assignee: Janusz Kaczmarek
QA Contact: Marcel de Rooy
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-05-28 12:41 UTC by Janusz Kaczmarek
Modified: 2024-11-18 17:00 UTC (History)
2 users (show)

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


Attachments
Bug 36976: Warning 'Argument "" isn't numeric in numeric' in log when merging bibliographic records (1.87 KB, patch)
2024-05-28 12:50 UTC, Janusz Kaczmarek
Details | Diff | Splinter Review
Bug 36976: Warning 'Argument "" isn't numeric in numeric' in log when merging bibliographic records (1.92 KB, patch)
2024-05-28 15:56 UTC, Roman Dolny
Details | Diff | Splinter Review
Bug 36976: Warning 'Argument "" isn't numeric in numeric' in log when merging bibliographic records (2.02 KB, patch)
2024-06-28 07:14 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Janusz Kaczmarek 2024-05-28 12:41:40 UTC
When merging bibliographic records, Koha generates warning:

[WARN] Argument "" isn't numeric in numeric ge (>=) at /kohadevbox/koha/Koha/Util/MARC.pm line 81.

in [plack-]intranet-error.log.

This is because $tagslib->{$fieldtag}->{'tab'} -- for a tag, not for a subfield --is (always?) an empty string (cf. C4::Biblio::GetMarcStructure : $res->{$tag}->{tab} = ""), and in Koha::Util::MARC::createMergeHash it is compared numerically with 0.
Comment 1 Janusz Kaczmarek 2024-05-28 12:50:35 UTC
Created attachment 167222 [details] [review]
Bug 36976: Warning 'Argument "" isn't numeric in numeric' in log when merging bibliographic records

When merging bibliographic records, Koha generates warning:

[WARN] Argument "" isn't numeric in numeric ge (>=) at /kohadevbox/koha/Koha/Util/MARC.pm line 81.

in [plack-]intranet-error.log.

This is because $tagslib->{$fieldtag}->{'tab'} -- for a tag, not for a
subfield --is (always?) an empty string (cf.
C4::Biblio::GetMarcStructure : $res->{$tag}->{tab} = ""), and in
Koha::Util::MARC::createMergeHash it is compared numerically with 0.

Test plan:
==========
1. From biblio search result page, selact two records with the checkboxes
   and start a merge (Edit -> Merge records).  Proceed with merging.
   After the merge, controll the content of the plack-intranet-error.log
   (when using plack -- standard in ktd).  Note the lines:
   [WARN] Argument "" isn't numeric in numeric ge (>=) at /kohadevbox/koha/Koha/Util/MARC.pm line 81.
2. Apply the patch; restart_all.
3. Repeat p. 1.  There should be no fresh warnings.

Sponsored-by: Ignatianum University in Cracow
Comment 2 Roman Dolny 2024-05-28 15:56:42 UTC
Created attachment 167228 [details] [review]
Bug 36976: Warning 'Argument "" isn't numeric in numeric' in log when merging bibliographic records

When merging bibliographic records, Koha generates warning:

[WARN] Argument "" isn't numeric in numeric ge (>=) at /kohadevbox/koha/Koha/Util/MARC.pm line 81.

in [plack-]intranet-error.log.

This is because $tagslib->{$fieldtag}->{'tab'} -- for a tag, not for a
subfield --is (always?) an empty string (cf.
C4::Biblio::GetMarcStructure : $res->{$tag}->{tab} = ""), and in
Koha::Util::MARC::createMergeHash it is compared numerically with 0.

Test plan:
==========
1. From biblio search result page, selact two records with the checkboxes
   and start a merge (Edit -> Merge records).  Proceed with merging.
   After the merge, controll the content of the plack-intranet-error.log
   (when using plack -- standard in ktd).  Note the lines:
   [WARN] Argument "" isn't numeric in numeric ge (>=) at /kohadevbox/koha/Koha/Util/MARC.pm line 81.
2. Apply the patch; restart_all.
3. Repeat p. 1.  There should be no fresh warnings.

Sponsored-by: Ignatianum University in Cracow
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Comment 3 Marcel de Rooy 2024-06-28 07:14:12 UTC
(In reply to Janusz Kaczmarek from comment #0)

> This is because $tagslib->{$fieldtag}->{'tab'} -- for a tag, not for a
> subfield --is (always?) an empty string (cf. C4::Biblio::GetMarcStructure :
> $res->{$tag}->{tab} = ""), and in Koha::Util::MARC::createMergeHash it is
> compared numerically with 0.

If it always is empty string, what is the use of comparing it ?
Note that ( $tagslib->{$fieldtag}->{tab} || 0 ) >= 0 might be shorter?
It seems that the test for defined $tagslib->{$fieldtag} is the crucial one. If that exists, tab will be empty string. (Exists might be more appropriate..)

But I dont see any harm in pushing this one.
Comment 4 Marcel de Rooy 2024-06-28 07:14:39 UTC
Created attachment 168223 [details] [review]
Bug 36976: Warning 'Argument "" isn't numeric in numeric' in log when merging bibliographic records

When merging bibliographic records, Koha generates warning:

[WARN] Argument "" isn't numeric in numeric ge (>=) at /kohadevbox/koha/Koha/Util/MARC.pm line 81.

in [plack-]intranet-error.log.

This is because $tagslib->{$fieldtag}->{'tab'} -- for a tag, not for a
subfield --is (always?) an empty string (cf.
C4::Biblio::GetMarcStructure : $res->{$tag}->{tab} = ""), and in
Koha::Util::MARC::createMergeHash it is compared numerically with 0.

Test plan:
==========
1. From biblio search result page, selact two records with the checkboxes
   and start a merge (Edit -> Merge records).  Proceed with merging.
   After the merge, controll the content of the plack-intranet-error.log
   (when using plack -- standard in ktd).  Note the lines:
   [WARN] Argument "" isn't numeric in numeric ge (>=) at /kohadevbox/koha/Koha/Util/MARC.pm line 81.
2. Apply the patch; restart_all.
3. Repeat p. 1.  There should be no fresh warnings.

Sponsored-by: Ignatianum University in Cracow
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 5 Katrin Fischer 2024-06-28 11:50:27 UTC
Pushed for 24.11!

Well done everyone, thank you!
Comment 6 Lucas Gass (lukeg) 2024-11-18 17:00:30 UTC
Backported to 24.05.x for upcomin 24.05.06