[Bug 15822] New: STAFF Advanced search error date utils
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15822 Bug ID: 15822 Summary: STAFF Advanced search error date utils Change sponsored?: --- Product: Koha Version: 3.22 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Searching Assignee: gmcharlt@gmail.com Reporter: hblancoca@gmail.com QA Contact: testopia@bugs.koha-community.org When i try to search in staff advanced search "topographic signature" 340.11, appears following error: Can't locate object method "ymd" via package "dateonly" (perhaps you forgot to load "dateonly"?) at /usr/share/koha/lib/Koha/DateUtils.pm line 223. the search string is: http://catalogo.edu.co:8080/cgi-bin/koha/catalogue/search.pl?idx=callnum&q=340.11&idx=kw&op=and&sort_by=relevance I can probe, that when i search with "Explorar índices" option enabled the string changes(adding scan variable) and try other values to explore. http://catalogo.edu.co:8080/cgi-bin/koha/catalogue/search.pl?idx=callnum&q=340.11&op=and&idx=kw&op=and&idx=kw&scan=1&sort_by=relevance Really appreciate your help -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15822 Humberto Blanco <hblancoca@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- OS|All |Linux Priority|P5 - low |P1 - high Severity|enhancement |critical CC| |hblancoca@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15822 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@bugs.koha-c | |ommunity.org --- Comment #1 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Hi Humberto, Could you give us the detail of the record matching this callnumber please? You certainly have a date starting with '0000-0' in your DB for this record, it would be good to know why one. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15822 --- Comment #2 from Humberto Blanco <hblancoca@gmail.com> --- (In reply to Jonathan Druart from comment #1)
Hi Humberto, Could you give us the detail of the record matching this callnumber please? You certainly have a date starting with '0000-0' in your DB for this record, it would be good to know why one.
I dont know exactly what are you talking, can be a little more specific please, this was after migration to 3.22 from 3.08.006. I´m adding a image of one of those records that have "340.11" in call number. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15822 --- Comment #3 from Humberto Blanco <hblancoca@gmail.com> --- Created attachment 48121 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=48121&action=edit Image for one of those record width "340.11" -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15822 --- Comment #4 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Could you export the record and attach it to the bug report. Then execute, in your sql cli: SELECT * FROM biblio WHERE biblionumber=YOUR_BIBLIONUMBER and post the result here. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15822 Héctor Eduardo Castro Avalos <hector.hecaxmmx@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hector.hecaxmmx@gmail.com --- Comment #5 from Héctor Eduardo Castro Avalos <hector.hecaxmmx@gmail.com> --- 082 field isn't indexed. Line 164 to 168 in ccl.properties #Classification-Dewey 13 A classification number from 082 # the Dewey Decimal # Classification, developed by # Melvyl Dewey. #Dewey-classification 1=13 When you search under Callnumber in advanced search the index used is 952$o callnum or Local-classification Like Jonathan comment maybe you have a date starting with 000-00 in another 952 field or Holding field. I recommend you search in all bibliographic record (Leader/008) and holding data to see if you have invalid dates Saludos Humberto -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15822 --- Comment #6 from Humberto Blanco <hblancoca@gmail.com> --- (In reply to Jonathan Druart from comment #4)
Could you export the record and attach it to the bug report. Then execute, in your sql cli: SELECT * FROM biblio WHERE biblionumber=YOUR_BIBLIONUMBER and post the result here.
Jonathan, I used: SELECT * FROM biblio inner join biblioitems using (biblionumber) WHERE cn_class like '340.11' I attached the output -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15822 --- Comment #7 from Humberto Blanco <hblancoca@gmail.com> --- Created attachment 48153 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=48153&action=edit select cn_class -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15822 --- Comment #8 from Humberto Blanco <hblancoca@gmail.com> --- in the apache2 log found thiswhen the error exist [Wed Feb 17 00:25:53 2016] -e: CGI::param called in list context from package ModPerl::ROOT::ModPerl::Registry::usr_share_koha_intranet_cgi_2dbin_catalogue_search_2epl line 168, this can lead to vulnerabilities. See the warning in "Fetching the value or values of a single named parameter" at /usr/share/perl5/CGI.pm line 436, <DATA> line 751. [Wed Feb 17 00:25:53 2016] -e: CGI::param called in list context from package C4::Auth line 399, this can lead to vulnerabilities. See the warning in "Fetching the value or values of a single named parameter" at /usr/share/perl5/CGI.pm line 436, <DATA> line 751. [Wed Feb 17 00:25:53 2016] -e: CGI::param called in list context from package ModPerl::ROOT::ModPerl::Registry::usr_share_koha_intranet_cgi_2dbin_catalogue_search_2epl line 386, this can lead to vulnerabilities. See the warning in "Fetching the value or values of a single named parameter" at /usr/share/perl5/CGI.pm line 436, <DATA> line 751. [Wed Feb 17 00:25:53 2016] -e: CGI::param called in list context from package ModPerl::ROOT::ModPerl::Registry::usr_share_koha_intranet_cgi_2dbin_catalogue_search_2epl line 394, this can lead to vulnerabilities. See the warning in "Fetching the value or values of a single named parameter" at /usr/share/perl5/CGI.pm line 436, <DATA> line 751. [Wed Feb 17 00:25:53 2016] -e: CGI::param called in list context from package ModPerl::ROOT::ModPerl::Registry::usr_share_koha_intranet_cgi_2dbin_catalogue_search_2epl line 402, this can lead to vulnerabilities. See the warning in "Fetching the value or values of a single named parameter" at /usr/share/perl5/CGI.pm line 436, <DATA> line 751. [Wed Feb 17 00:25:53 2016] -e: CGI::param called in list context from package ModPerl::ROOT::ModPerl::Registry::usr_share_koha_intranet_cgi_2dbin_catalogue_search_2epl line 406, this can lead to vulnerabilities. See the warning in "Fetching the value or values of a single named parameter" at /usr/share/perl5/CGI.pm line 436, <DATA> line 751. [Wed Feb 17 00:25:53 2016] -e: CGI::param called in list context from package ModPerl::ROOT::ModPerl::Registry::usr_share_koha_intranet_cgi_2dbin_catalogue_search_2epl line 416, this can lead to vulnerabilities. See the warning in "Fetching the value or values of a single named parameter" at /usr/share/perl5/CGI.pm line 436, <DATA> line 751. [Wed Feb 17 00:25:53 2016] -e: CGI::param called in list context from package ModPerl::ROOT::ModPerl::Registry::usr_share_koha_intranet_cgi_2dbin_catalogue_search_2epl line 419, this can lead to vulnerabilities. See the warning in "Fetching the value or values of a single named parameter" at /usr/share/perl5/CGI.pm line 436, <DATA> line 751. [Wed Feb 17 00:25:53 2016] -e: CGI::param called in list context from package ModPerl::ROOT::ModPerl::Registry::usr_share_koha_intranet_cgi_2dbin_catalogue_search_2epl line 420, this can lead to vulnerabilities. See the warning in "Fetching the value or values of a single named parameter" at /usr/share/perl5/CGI.pm line 436, <DATA> line 751. [Wed Feb 17 00:26:03 2016] -e: CGI::param called in list context from package C4::Auth line 399, this can lead to vulnerabilities. See the warning in "Fetching the value or values of a single named parameter" at /usr/share/perl5/CGI.pm line 436, <DATA> line 751. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15822 --- Comment #9 from Humberto Blanco <hblancoca@gmail.com> --- (In reply to Héctor Eduardo Castro Avalos from comment #5)
082 field isn't indexed.
Line 164 to 168 in ccl.properties
#Classification-Dewey 13 A classification number from 082 # the Dewey Decimal # Classification, developed by # Melvyl Dewey. #Dewey-classification 1=13
When you search under Callnumber in advanced search the index used is 952$o callnum or Local-classification
Like Jonathan comment maybe you have a date starting with 000-00 in another 952 field or Holding field.
I recommend you search in all bibliographic record (Leader/008) and holding data to see if you have invalid dates
Saludos Humberto
those happend after migration to koha 3.22, any idea for one more detailed log?? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15822 --- Comment #10 from Humberto Blanco <hblancoca@gmail.com> --- This morning i have the same error when do this search http://catalogo.urosario.edu.co/cgi-bin/koha/opac-search.pl?idx=kw&q=vivo&offset=80&sort_by=relevance_dsc and get the error Software error: Can't locate object method "ymd" via package "dateonly" (perhaps you forgot to load "dateonly"?) at /usr/share/koha/lib/Koha/DateUtils.pm line 223. In the QueryWeightFields KOHA preferences set to disabled. and the query works fine. but in the staff i have the same error in advanced search. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15822 --- Comment #11 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- I am sorry but I don't have enough information to help you. On a test server, you could try to modify Koha::DateUtils::output_pref with: +++ b/Koha/DateUtils.pm @@ -220,6 +220,7 @@ sub output_pref { return unless defined $dt; # FIXME: see bug 13242 => no TZ for dates 'infinite' + use Data::Dumper;warn Dumper caller; if ( $dt->ymd !~ /^9999/ ) { my $tz = $dateonly ? DateTime::TimeZone->new(name => 'floating') : C4::Context->tz; $dt->set_time_zone( $tz ); Looking at the logs, you will know which routines has called it just before crashing. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15822 --- Comment #12 from Héctor Eduardo Castro Avalos <hector.hecaxmmx@gmail.com> --- Your records look good, Humberto. I could see that in my records I don't have biblioitems.cn_sort with any data populated on it. And you got 340_110000000000000 in all records Maybe Jonathan knows more about it, He got a lot of experience in Koha Regards -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15822 --- Comment #13 from Humberto Blanco <hblancoca@gmail.com> --- Today review and found that nothing is happend if i found "topographic signature" 340.1 or 340.12 or failed when search some terms that use spaces in the url the system puts + to do this and the problem appears like indexes for example in advanced search : (idx=kw%2Cphr, q=la+informalidad+laboral) http://catalogo.urosario.edu.co:8080/cgi-bin/koha/catalogue/search.pl?idx=kw%2Cphr&q=la+informalidad+laboral&op=and&idx=kw&op=and&idx=kw&sort_by=relevance In general search failed http://catalogo.urosario.edu.co:8080/cgi-bin/koha/catalogue/search.pl?q=la+i... -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15822 --- Comment #14 from Galen Charlton <gmcharlt@gmail.com> --- In haste: I ran into this today and have diagnosed at least one cause of it. Suppose that the search results contain an item where item.onloan is set to '0000-00-00', not NULL. In that case, the following line in C4/Search.pm $onloan_items->{$key}->{due_date} = output_pref( { dt => dt_from_string( $item->{onloan} ), dateonly => 1 } ); ends up calling output_pref with the following parameters: { dt => 'dateonly', 1 => undef } Changing line 50 in Koha/DateUtils.pm from return if $date_string and $date_string =~ m|^0000-0|; to return undef if $date_string and $date_string =~ m|^0000-0|; works around that oddity. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15822 --- Comment #15 from Humberto Blanco <hblancoca@gmail.com> --- (In reply to Galen Charlton from comment #14)
In haste: I ran into this today and have diagnosed at least one cause of it. Suppose that the search results contain an item where item.onloan is set to '0000-00-00', not NULL. In that case, the following line in C4/Search.pm
$onloan_items->{$key}->{due_date} = output_pref( { dt => dt_from_string( $item->{onloan} ), dateonly => 1 } );
ends up calling output_pref with the following parameters:
{ dt => 'dateonly', 1 => undef }
Changing line 50 in Koha/DateUtils.pm from
return if $date_string and $date_string =~ m|^0000-0|;
to
return undef if $date_string and $date_string =~ m|^0000-0|;
works around that oddity.
Works for me, i probe son queries and works fine, thanks Galen -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15822 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|3.22 |master Severity|critical |major --- Comment #16 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- I do not recreate, but the correct fix would be: diff --git a/C4/Search.pm b/C4/Search.pm index 4d5c0ed..235d49b 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -2084,7 +2084,7 @@ sub searchResults { { $onloan_count++; my $key = $prefix . $item->{onloan} . $item->{barcode}; - $onloan_items->{$key}->{due_date} = output_pref( { dt => dt_from_string( $item->{onloan} ), dateonly => 1 } ); + $onloan_items->{$key}->{due_date} = output_pref( { str => $item->{onloan}, dateonly => 1 } ); $onloan_items->{$key}->{count}++ if $item->{$hbranch}; $onloan_items->{$key}->{branchname} = $item->{branchname}; $onloan_items->{$key}->{location} = $shelflocations->{ $item->{location} }; Lowering the severity as it does not seem to affect a lot of people. Please confirm that this change fixes the issue. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15822 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15822 --- Comment #17 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 57725 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=57725&action=edit Bug 15822: Fix 500 error when searching if items.onloan=0000-00-00 The calls output_pref({ dt => dt_from_string( $date ) }) are wrong and should be replaced with output_pref({ str => $date }) For better error handling. Here we fix the problem of items.onloan when searching Test plan: - Set items.onloan=0000-00-00 (UPDATE items SET onloan='0000-00-00') This can come from old data or bad migration - Execute a search => Without this patch you get Can't locate object method "ymd" via package "dateonly" (perhaps you forgot to load "dateonly"?) at /home/vagrant/kohaclone/Koha/DateUtils.pm line 225. => With this patch you won't get the error -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15822 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|gmcharlt@gmail.com |jonathan.druart@bugs.koha-c | |ommunity.org -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15822 Hugo Agud <hagud@orex.es> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hagud@orex.es -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15822 Alex Buckley <alexbuckley@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #57725|0 |1 is obsolete| | --- Comment #18 from Alex Buckley <alexbuckley@catalyst.net.nz> --- Created attachment 57849 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=57849&action=edit Bug 15822: Fix 500 error when searching if items.onloan=0000-00-00 The calls output_pref({ dt => dt_from_string( $date ) }) are wrong and should be replaced with output_pref({ str => $date }) For better error handling. Here we fix the problem of items.onloan when searching Test plan: - Set items.onloan=0000-00-00 (UPDATE items SET onloan='0000-00-00') This can come from old data or bad migration - Execute a search => Without this patch you get Can't locate object method "ymd" via package "dateonly" (perhaps you forgot to load "dateonly"?) at /home/vagrant/kohaclone/Koha/DateUtils.pm line 225. => With this patch you won't get the error Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15822 Alex Buckley <alexbuckley@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off CC| |alexbuckley@catalyst.net.nz -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15822 Alex Buckley <alexbuckley@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #48121|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15822 Alex Buckley <alexbuckley@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #48153|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15822 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15822 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #57849|0 |1 is obsolete| | --- Comment #19 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 57985 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=57985&action=edit Bug 15822: Fix 500 error when searching if items.onloan=0000-00-00 The calls output_pref({ dt => dt_from_string( $date ) }) are wrong and should be replaced with output_pref({ str => $date }) For better error handling. Here we fix the problem of items.onloan when searching Test plan: - Set items.onloan=0000-00-00 (UPDATE items SET onloan='0000-00-00') This can come from old data or bad migration - Execute a search => Without this patch you get Can't locate object method "ymd" via package "dateonly" (perhaps you forgot to load "dateonly"?) at /home/vagrant/kohaclone/Koha/DateUtils.pm line 225. => With this patch you won't get the error Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15822 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master CC| |kyle@bywatersolutions.com --- Comment #20 from Kyle M Hall <kyle@bywatersolutions.com> --- Pushed to master for 17.05, thanks Jonathan! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15822 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Master |Pushed to Stable CC| |katrin.fischer@bsz-bw.de --- Comment #21 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- This patch has been pushed to 16.11.x, will be in 16.11.01. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15822 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |julian.maurice@biblibre.com --- Comment #22 from Julian Maurice <julian.maurice@biblibre.com> --- Pushed to 3.22.x for 3.22.14 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15822 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=17502 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15822 Mason James <mtj@kohaaloha.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mtj@kohaaloha.com --- Comment #23 from Mason James <mtj@kohaaloha.com> --- Pushed to 16.05.x, for 16.05.06 release -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15822 Fridolin SOMERS <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |17821 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17821 [Bug 17821] due date in intranet search results should use TT date plugin -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org