Bug 40559

Summary: Fix a noisy warn in catalogue/MARCdetail
Product: Koha Reporter: Marcel de Rooy <m.de.rooy>
Component: Architecture, internals, and plumbingAssignee: Marcel de Rooy <m.de.rooy>
Status: BLOCKED --- QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: dcook, jonathan.druart
Version: Main   
Hardware: All   
OS: All   
GIT URL: 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 40559: Fix noisy warning in MARCdetail
Bug 40559: cleanup

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
Also wondering....

                 next
                    if ( $tagslib->{ $fields[$x_i]->tag() }->{ $subf[$i][0] }->{tab} // q{} ) ne
                     $tabloop;    # Note: defaulting to '0' changes behavior!

Why?
Comment 6 Marcel de Rooy 2025-09-16 11:13:29 UTC
Will check
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
(In reply to Jonathan Druart from comment #5)
> Also wondering....
> 
>                  next
>                     if ( $tagslib->{ $fields[$x_i]->tag() }->{ $subf[$i][0]
> }->{tab} // q{} ) ne
>                      $tabloop;    # Note: defaulting to '0' changes behavior!
> 
> Why?

Since tabloop can be zero? Or do you mean something else?
Comment 9 Jonathan Druart 2025-09-19 08:05:05 UTC
(In reply to Marcel de Rooy from comment #8)
> (In reply to Jonathan Druart from comment #5)
> > Also wondering....
> > 
> >                  next
> >                     if ( $tagslib->{ $fields[$x_i]->tag() }->{ $subf[$i][0]
> > }->{tab} // q{} ) ne
> >                      $tabloop;    # Note: defaulting to '0' changes behavior!
> > 
> > Why?
> 
> Since tabloop can be zero? Or do you mean something else?

The if syntax:
  next if ( $var ) ne $tabloop;