| Summary: | Warning in Koha::Items->hidden_in_opac | ||
|---|---|---|---|
| Product: | Koha | Reporter: | Fridolin Somers <fridolin.somers> |
| Component: | Architecture, internals, and plumbing | Assignee: | Jonathan Druart <jonathan.druart> |
| Status: | RESOLVED FIXED | QA Contact: | Tomás Cohen Arazi (tcohen) <tomascohen> |
| Severity: | normal | ||
| Priority: | P5 - low | CC: | dcook, jesse, jonathan.druart, lucas, stalkernoid, tomascohen |
| Version: | Main | ||
| Hardware: | All | ||
| OS: | All | ||
| 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: |
24.11.00,24.05.06,23.11.11
|
|
| Circulation function: | |||
| Bug Depends on: | |||
| Bug Blocks: | 25790 | ||
| Attachments: |
Bug 33188: Remove warning from Koha::Item->hidden_in_opac
Bug 33188: Remove warning from Koha::Item->hidden_in_opac Bug 33188: Remove warning from Koha::Item->hidden_in_opac |
||
Not sure how to fix. Do we consider undef like empty string in order to allow hiding undef ? Shouldn't it be updated to one of the following:
1.
if ( any { $self->$field && $self->$field eq $_ } @{ $rules->{$field} } ) {
2.
if ( any { my $field = $self->$field; ($field && $field eq $_ ) ? 1 : 0; } @{ $rules->{$field} } ) {
Or am I missing something?
Created attachment 173647 [details] [review] Bug 33188: Remove warning from Koha::Item->hidden_in_opac "Use of uninitialized value in string eq" Test plan: prove t/db_dependent/Koha/Item.t should return green Created attachment 173732 [details] [review] Bug 33188: Remove warning from Koha::Item->hidden_in_opac "Use of uninitialized value in string eq" Test plan: prove t/db_dependent/Koha/Item.t should return green Signed-off-by: David Nind <david@davidnind.com> Created attachment 173733 [details] [review] Bug 33188: Remove warning from Koha::Item->hidden_in_opac "Use of uninitialized value in string eq" Test plan: prove t/db_dependent/Koha/Item.t should return green Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Edit: tidied the tests (tcohen) Simple fix, includes tests! Note: please remember to tidy your patches before submitting. Please refer to the relevant wiki section for setting up your editor here: https://wiki.koha-community.org/wiki/Perltidy :-P Pushed for 24.11! Well done everyone, thank you! Backported to 24.05.x for upcoming 24.05.06 Pushed to 23.11.x for 23.11.11 *** Bug 29858 has been marked as a duplicate of this bug. *** Not pushed to LTS. Marked Resolved. If you feel this should be in LTS please reply with your reason. |
In Koha::Items->hidden_in_opac there is often a warning : Use of uninitialized value in string eq at /home/koha/src/Koha/Item.pm line 633. This the line : if ( any { $self->$field eq $_ } @{ $rules->{$field} } ) { When $self->$field is undef, the eq creates the warn. This can happen with any nillable field like items.location not yet defined after item acquisition.