[Bug 40861] New: Weird hash key $ord->{'count(*)'} in serials/acqui-search-result.pl
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40861 Bug ID: 40861 Summary: Weird hash key $ord->{'count(*)'} in serials/acqui-search-result.pl Change sponsored?: --- Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Acquisitions Assignee: koha-bugs@lists.koha-community.org Reporter: m.de.rooy@rijksmuseum.nl QA Contact: testopia@bugs.koha-community.org PLACK-INTRANET-ERROR.LOG PROD [2025/09/22 10:55:07] [WARN] Odd number of elements in anonymous hash at /usr/share/koha/serials/acqui-search-result.pl line 80. Associated code: push @{$loop_basket}, { basketno => $ord->{'basketno'}, total => $ord->{'count(*)'}, authorisedby => $ord->{'authorisedby'}, creationdate => output_pref( { str => $ord->{'creationdate'} } ), closedate => output_pref( { str => $ord->{'closedate'} } ), }; Note that SearchOrders does not create a key count(*) -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40861 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@gmail.com --- Comment #1 from Jonathan Druart <jonathan.druart@gmail.com> --- output_pref can generate that: Koha/DateUtils.pm:284 return if !defined $dt; # NULL date -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40861 --- Comment #2 from Jonathan Druart <jonathan.druart@gmail.com> --- (In reply to Jonathan Druart from comment #1)
output_pref can generate that: Koha/DateUtils.pm:284 return if !defined $dt; # NULL date
Hum, maybe not 278 if ($str) { 279 local $@; 280 $dt = eval { dt_from_string($str) }; 281 Koha::Exceptions::WrongParameter->throw("Invalid date '$str' passed to output_pref") if $@; 282 } 283 284 return if !defined $dt; # NULL date -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40861 --- Comment #3 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- (In reply to Jonathan Druart from comment #1)
output_pref can generate that: Koha/DateUtils.pm:284 return if !defined $dt; # NULL date
This precedes: if ($str) { local $@; $dt = eval { dt_from_string($str) }; Koha::Exceptions::WrongParameter->throw("Invalid date '$str' passed to output_pref") if $@; } We passed a str. Date comes from the db. So perhaps NULL or valid date. Should trigger an exception when wrong? -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40861 --- Comment #4 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- (In reply to Jonathan Druart from comment #2)
(In reply to Jonathan Druart from comment #1)
output_pref can generate that: Koha/DateUtils.pm:284 return if !defined $dt; # NULL date
Hum, maybe not
278 if ($str) { 279 local $@; 280 $dt = eval { dt_from_string($str) }; 281 Koha::Exceptions::WrongParameter->throw("Invalid date '$str' passed to output_pref") if $@; 282 } 283 284 return if !defined $dt; # NULL date
Yes indeed :) -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40861 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40861 --- Comment #5 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 186810 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186810&action=edit Bug 40861: Remove warning from serials/acqui-search-result.pl Odd number of elements in anonymous hash at /kohadevbox/koha/serials/acqui-search-result.pl line 84. it's coming from closedate that is empty, and output_pref that will reach this return: 278 if ($str) { 279 local $@; 280 $dt = eval { dt_from_string($str) }; 281 Koha::Exceptions::WrongParameter->throw("Invalid date '$str' passed to output_pref") if $@; 282 } 283 284 return if !defined $dt; # NULL date if str is undef, we don't enter if l.278 and return l.284 which will shift the elements of the hash (because of the list context) We force the scalar and we are good. There was no side-effect because closedate was the last of the list. Note that total (and the 'count(*)' key) is not used in the template. Test plan: Create an order for a basket of the first vendor "My vendor" and hit http://localhost:8081/cgi-bin/koha/serials/acqui-search-result.pl?supplier=d Without this patch you get the warning Odd number of elements in anonymous hash at /kohadevbox/koha/serials/acqui-search-result.pl line 84. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40861 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |jonathan.druart@gmail.com |ity.org | Summary|Weird hash key |"Odd number of elements in |$ord->{'count(*)'} in |anonymous hash" warning in |serials/acqui-search-result |serials/acqui-search-result |.pl |.pl -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40861 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off Patch complexity|--- |Trivial patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40861 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #186810|0 |1 is obsolete| | --- Comment #6 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 186811 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186811&action=edit Bug 40861: Remove warning from serials/acqui-search-result.pl Odd number of elements in anonymous hash at /kohadevbox/koha/serials/acqui-search-result.pl line 84. it's coming from closedate that is empty, and output_pref that will reach this return: 278 if ($str) { 279 local $@; 280 $dt = eval { dt_from_string($str) }; 281 Koha::Exceptions::WrongParameter->throw("Invalid date '$str' passed to output_pref") if $@; 282 } 283 284 return if !defined $dt; # NULL date if str is undef, we don't enter if l.278 and return l.284 which will shift the elements of the hash (because of the list context) We force the scalar and we are good. There was no side-effect because closedate was the last of the list. Note that total (and the 'count(*)' key) is not used in the template. Test plan: Create an order for a basket of the first vendor "My vendor" and hit http://localhost:8081/cgi-bin/koha/serials/acqui-search-result.pl?supplier=d Without this patch you get the warning Odd number of elements in anonymous hash at /kohadevbox/koha/serials/acqui-search-result.pl line 84. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40861 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |m.de.rooy@rijksmuseum.nl |y.org | Status|Signed Off |Passed QA --- Comment #7 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- PQA too -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40861 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to main Version(s)| |25.11.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40861 --- Comment #8 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Nice work everyone! Pushed to main for 25.11 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40861 Paul Derscheid <paul.derscheid@lmscloud.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to main |Pushed to stable Version(s)|25.11.00 |25.11.00,25.05.04 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40861 --- Comment #9 from Paul Derscheid <paul.derscheid@lmscloud.de> --- Nice work everyone! Pushed to 25.05.x -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40861 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|25.11.00,25.05.04 |25.11.00,25.05.04,24.11.10 released in| | CC| |fridolin.somers@biblibre.co | |m Status|Pushed to stable |Pushed to oldstable --- Comment #10 from Fridolin Somers <fridolin.somers@biblibre.com> --- Pushed to 24.11.x for 24.11.10 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40861 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |25790 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25790 [Bug 25790] [OMNIBUS] warnings removal -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40861 Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to oldstable |Needs documenting --- Comment #11 from Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> --- Not backporting to 22.11.x as it wasn't backported to 24.05.x -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org