Bug 40559 - Fix a noisy warn in catalogue/MARCdetail
Summary: Fix a noisy warn in catalogue/MARCdetail
Status: Pushed to oldstable
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor
Assignee: Marcel de Rooy
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 41153
  Show dependency treegraph
 
Reported: 2025-07-31 07:54 UTC by Marcel de Rooy
Modified: 2025-12-02 10:24 UTC (History)
3 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
25.11.00,25.05.06,24.11.11
Circulation function:


Attachments
Bug 40559: Fix noisy warning in MARCdetail (1.77 KB, patch)
2025-07-31 09:02 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 40559: cleanup (3.20 KB, patch)
2025-09-15 14:31 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 40559: Fix noisy warning in MARCdetail (2.07 KB, patch)
2025-10-31 09:55 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 Marcel de Rooy 2025-07-31 07:54:05 UTC
Actually a long standing fix already..
Comment 1 Marcel de Rooy 2025-07-31 09:02:40 UTC
Created attachment 184919 [details] [review]
Bug 40559: Fix noisy warning in MARCdetail

Rebased for 25.06.
Resolves:
    [2025/07/31 10:59:02] [WARN] Use of uninitialized value in string eq at /usr/share/koha/catalogue/MARCdetail.pl line 203.

Test plan:
Check if warn disappears with this patch.
Trigger the warn by opening catalogue/MARCdetail on staff view. (Should
be enough with a normal MARC record.)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 2 Marcel de Rooy 2025-07-31 09:03:20 UTC
Trivial. Self SO
Comment 3 Jonathan Druart 2025-09-15 14:31:15 UTC
Created attachment 186407 [details] [review]
Bug 40559: cleanup
Comment 4 Jonathan Druart 2025-09-15 14:31:25 UTC
Would you accept this follow-up?
Comment 5 Jonathan Druart 2025-09-15 14:32:10 UTC Comment hidden (obsolete)
Comment 6 Marcel de Rooy 2025-09-16 11:13:29 UTC Comment hidden (obsolete)
Comment 7 Marcel de Rooy 2025-09-17 14:11:34 UTC
(In reply to Jonathan Druart from comment #4)
> Would you accept this follow-up?

I feel that we should move it on its own report. The noisy warning patch is just about 1 line of code (-1,+3) and can be backported.
The cleanup could go on its own and would be an enhancement, right?
Comment 8 Marcel de Rooy 2025-09-17 14:24:24 UTC Comment hidden (obsolete)
Comment 9 Jonathan Druart 2025-09-19 08:05:05 UTC Comment hidden (obsolete)
Comment 10 Marcel de Rooy 2025-10-31 08:54:00 UTC
(In reply to Marcel de Rooy from comment #7)
> (In reply to Jonathan Druart from comment #4)
> > Would you accept this follow-up?
> 
> I feel that we should move it on its own report. The noisy warning patch is
> just about 1 line of code (-1,+3) and can be backported.
> The cleanup could go on its own and would be an enhancement, right?

Well. Lets get this moving again now.
I proposed to move the second patch. And I did so now.
See bug 41153. Will take a look there further.
Comment 11 Marcel de Rooy 2025-10-31 08:54:34 UTC
Comment on attachment 186407 [details] [review]
Bug 40559: cleanup

Moved to new report
Comment 12 Marcel de Rooy 2025-10-31 09:32:28 UTC
(In reply to Marcel de Rooy from comment #1)
> Trigger the warn by opening catalogue/MARCdetail on staff view. (Should
> be enough with a normal MARC record.)

Unfortunately, things are not as easy as they may seem.
This (obviously) depends on the value of marc_subfield_structure.kohafield.
I checked a production db and my dev db. And they were not the same. So I could trigger this on production easier than in dev.

But note that this column is null by default:
  `kohafield` varchar(40) DEFAULT NULL,
Comment 13 Marcel de Rooy 2025-10-31 09:47:58 UTC
PROD
| 020      | a           | biblioitems.isbn |
| 020      | q           | NULL             |
DEV
| 020      | a           | biblioitems.isbn |
| 020      | q           |                  |
Comment 14 Marcel de Rooy 2025-10-31 09:55:12 UTC
Created attachment 188796 [details] [review]
Bug 40559: Fix noisy warning in MARCdetail

Rebased for 25.06.
Resolves:
    Use of uninitialized value in string eq at /usr/share/koha/catalogue/MARCdetail.pl line 203.

Test plan:
Make sure that there is a combination of framework/field/subfield having
an entry in marc_subfield_structure where kohafield is NULL.
To force this for default fw on 020$q:
    update marc_subfield_structure
    set kohafield=NULL
    where tagfield='020' and tagsubfield='q' and frameworkcode='';
Pick a biblio in this framework having that field/subfield. Or create
a 020 with $q filled. Hit catalogue/MARCdetail now.
Without this patch, it triggers the warn. With this patch, it does not.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 15 Marcel de Rooy 2025-10-31 09:57:28 UTC
I amended the commit message/test plan to be more accurate.
Given the trivial change, the age of this patch (coming from 2020), the time spent on it now again and Jonathan having seen it too, taking the liberty to pass QA on it now. And continuing with the follow-up.
Comment 16 Lucas Gass (lukeg) 2025-10-31 21:29:03 UTC
Nice work everyone!

Pushed to main for 25.11
Comment 17 Paul Derscheid 2025-11-25 16:30:39 UTC
Nice work everyone!

Pushed to 25.05.x
Comment 18 Fridolin Somers 2025-12-02 10:24:44 UTC
Pushed to 24.11.x for 24.11.11