Bug 11183

Summary: Warnings in opac
Product: Koha Reporter: Srdjan Jankovic <srdjan>
Component: OPACAssignee: Srdjan Jankovic <srdjan>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: fridolin.somers, gmcharlt, kyle, mtompset, tomascohen
Version: Main   
Hardware: All   
OS: All   
See Also: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11242
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11269
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 8817    
Attachments: bug_11183: get rid of some warninngs
bug_11183: get rid of some warninngs
[SIGNED OFF] bug_11183: get rid of some warnings
bug_11183: get rid of some warnings
Sample code demonstrating problem Galen found.
bug_11183: get rid of some warninngs
bug_11183: get rid of some warninngs
[SIGNED OFF] bug_11183: get rid of some warnings
Bug 11183 - Warnings in opac
[SIGNED-OFF] Bug 11183 - Warnings in opac
bug_11183: Supress undef warning in opac-MARCdetail.pl
bug_11183: Supress undef warning in opac-MARCdetail.pl
bug_11183: get rid of some warnings
Bug 11183 - Warnings in opac
Bug 11183 - Warnings in opac - QA Followup

Description Srdjan Jankovic 2013-11-01 08:03:15 UTC
Get rid of some warnings
Comment 1 Srdjan Jankovic 2013-11-01 08:10:07 UTC Comment hidden (obsolete)
Comment 2 Srdjan Jankovic 2013-11-07 23:28:36 UTC Comment hidden (obsolete)
Comment 3 Mark Tompsett 2013-11-08 06:11:52 UTC Comment hidden (obsolete)
Comment 4 Kyle M Hall 2013-11-08 12:15:24 UTC Comment hidden (obsolete)
Comment 5 Galen Charlton 2013-11-08 16:35:23 UTC
Comment on attachment 22810 [details] [review]
bug_11183: get rid of some warnings

Review of attachment 22810 [details] [review]:
-----------------------------------------------------------------

::: opac/opac-detail.pl
@@ +573,4 @@
>  
>      # get collection code description, too
>      my $ccode = $itm->{'ccode'};
> +    $itm->{'ccode'} = $collections->{$ccode} if $ccode && $collections && $collections->{$ccode};

I believe what was called for was just adding a check on whether $ccode was defined.  Getting rid of the "defined($collections)" and "exists( $collections->{$ccode}" breaks things if the library happened to define "0" as a collection code.

Failed QA.
Comment 6 Mark Tompsett 2013-11-08 17:02:17 UTC Comment hidden (obsolete)
Comment 7 Srdjan Jankovic 2013-11-11 01:37:40 UTC Comment hidden (obsolete)
Comment 8 Srdjan Jankovic 2013-11-11 02:50:23 UTC Comment hidden (obsolete)
Comment 9 Mark Tompsett 2013-11-11 03:05:58 UTC
This is how I tested it:

mtompset@ubuntu:~/kohaclone$ git reset --hard origin/master
HEAD is now at 0d5f73d Merge branch 'new/bug11205'
mtompset@ubuntu:~/kohaclone$ echo > ~/koha-dev/var/log/koha-opac-error_log

#### I then did a simple search 'unhappy'
#### and then clicked an entry know to not have the collection code set.

mtompset@ubuntu:~/kohaclone$ cat ~/koha-dev/var/log/koha-opac-error_log | cut -c85- | sort -u

 opac-detail.pl: Use of uninitialized value $ccode in exists at /home/mtompset/kohaclone/opac/opac-detail.pl line 576., referer: http://demo.library.kohasystem.ca/cgi-bin/koha/opac-search.pl?idx=&q=unhappy&branch_group_limit=
 opac-search.pl: Use of uninitialized value $code_wanted in string eq at /usr/share/perl5/MARC/Field.pm line 314., referer: http://demo.library.kohasystem.ca/cgi-bin/koha/opac-detail.pl?biblionumber=14206&query_desc=kw%2Cwrdl%3A%20happy%20life
 opac-search.pl: Use of uninitialized value $limit_desc in concatenation (.) or string at /home/mtompset/kohaclone/opac/opac-search.pl line 626., referer: http://demo.library.kohasystem.ca/cgi-bin/koha/opac-detail.pl?biblionumber=14206&query_desc=kw%2Cwrdl%3A%20happy%20life
mtompset@ubuntu:~/kohaclone$ git bz apply 11183
Bug 11183 - Warnings in opac

22855 - bug_11183: get rid of some warninngs

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: bug_11183: get rid of some warninngs
mtompset@ubuntu:~/kohaclone$ echo > ~/koha-dev/var/log/koha-opac-error_log 

#### I then did a simple search 'unhappy'
#### and then clicked an entry know to not have the collection code set.

mtompset@ubuntu:~/kohaclone$ cat ~/koha-dev/var/log/koha-opac-error_log | cut -c85- | sort -u

 opac-search.pl: Use of uninitialized value $code_wanted in string eq at /usr/share/perl5/MARC/Field.pm line 314., referer: http://demo.library.kohasystem.ca/cgi-bin/koha/opac-detail.pl?biblionumber=13896&query_desc=kw%2Cwrdl%3A%20unhappy
mtompset@ubuntu:~/kohaclone$

Sorry, gmcharlt. I found a bug in MARC::Field. ;)
But not this. :)
Comment 10 Mark Tompsett 2013-11-11 03:11:03 UTC Comment hidden (obsolete)
Comment 11 Mark Tompsett 2013-11-11 04:26:22 UTC
Okay, the 314 warning bugged me enough, and I hunted it down to line 1838 of the master's C4/Search.pm, which I will add a second patch to this, as the test case triggered the bug.
Comment 12 Mark Tompsett 2013-11-11 04:31:25 UTC Comment hidden (obsolete)
Comment 13 Srdjan Jankovic 2013-11-11 04:31:36 UTC
I did something with Search.pm too on a different bug report.
Comment 14 Mark Tompsett 2013-11-11 04:49:23 UTC
The test plan is as given on the original patch:
To test in OPAC:
* With the OPAC System Preference EnableOpacSearchHistory set
  to Keep, a simple search triggers the warning patched on
  line 626 of opac-search.pl
* Selecting a search result item with no Collection Code
  set triggers the warning patched on line 576 of opac-detail.pl
* Have an item with Collection Code. Check that the Collection
  Code shows.
* Collection Code is set by editing an item in the staff client
  (952$8)

I happen to have two items with unhappy in the title, and so I gave one a collection code, while the other did not have one.
1) Search for unhappy in OPAC
2) Click link 1
3) Browser back
4) Click line 2
These steps are between the clearing of the error log and the viewing unique errors in the error log.

The results of my testing:
mtompset@ubuntu:~/kohaclone$ git reset --hard origin/master
HEAD is now at 0d5f73d Merge branch 'new/bug11205'
mtompset@ubuntu:~/kohaclone$ echo > ~/koha-dev/var/log/koha-opac-error_log mtompset@ubuntu:~/kohaclone$ cat ~/koha-dev/var/log/koha-opac-error_log | cut -c85- | sort -u

 opac-detail.pl: Use of uninitialized value $ccode in exists at /home/mtompset/kohaclone/opac/opac-detail.pl line 576., referer: http://demo.library.kohasystem.ca/cgi-bin/koha/opac-search.pl?idx=&q=unhappy&branch_group_limit=
 opac-search.pl: Use of uninitialized value $code_wanted in string eq at /usr/share/perl5/MARC/Field.pm line 314., referer: http://demo.library.kohasystem.ca/
 opac-search.pl: Use of uninitialized value $limit_desc in concatenation (.) or string at /home/mtompset/kohaclone/opac/opac-search.pl line 626., referer: http://demo.library.kohasystem.ca/
mtompset@ubuntu:~/kohaclone$ git bz apply 11183
Bug 11183 - Warnings in opac

22856 - [SIGNED OFF] bug_11183: get rid of some warnings
22857 - Bug 11183 - Warnings in opac

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: bug_11183: get rid of some warnings
Applying: Bug 11183 - Warnings in opac
mtompset@ubuntu:~/kohaclone$ echo > ~/koha-dev/var/log/koha-opac-error_log mtompset@ubuntu:~/kohaclone$ cat ~/koha-dev/var/log/koha-opac-error_log | cut -c85- | sort -u

mtompset@ubuntu:~/kohaclone$
Comment 15 Srdjan Jankovic 2013-11-12 00:23:35 UTC Comment hidden (obsolete)
Comment 16 Srdjan Jankovic 2013-11-12 07:59:10 UTC Comment hidden (obsolete)
Comment 17 Srdjan Jankovic 2013-11-12 08:07:25 UTC Comment hidden (obsolete)
Comment 18 Mark Tompsett 2013-11-12 15:35:19 UTC
The opac-MARCdetail.pl link is not in the search, but you can get to it by:
1) Search for something in OPAC
2) Click link, which will take you to the "Normal View" page (opac-detail.pl).
3) Click the "MARC detail" view link (opac-MARCdetail.pl).
Comment 19 Srdjan Jankovic 2013-11-13 04:57:03 UTC
Comment on attachment 22867 [details] [review]
bug_11183: Supress undef warning in opac-MARCdetail.pl

Issue dealt with in another bug
Comment 20 Kyle M Hall 2013-11-22 17:16:58 UTC
Created attachment 23095 [details] [review]
bug_11183: get rid of some warnings

To test in OPAC:
* With the OPAC System Preference EnableOpacSearchHistory set
  to Keep, a simple search triggers the warning patched on
  line 626 of opac-search.pl
* Selecting a search result item with no Collection Code
  set triggers the warning patched on line 576 of opac-detail.pl
* Have an item with Collection Code. Check that the Collection
  Code shows.
* Collection Code is set by editing an item in the staff client
  (952$8)

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 21 Kyle M Hall 2013-11-22 17:17:06 UTC Comment hidden (obsolete)
Comment 22 Kyle M Hall 2013-11-22 17:17:38 UTC Comment hidden (obsolete)
Comment 23 Tomás Cohen Arazi 2013-11-23 02:25:03 UTC
The second patch ("Warnings in opac") is similar to the one from Bug 11269 which has been pushed already. This patch is prior to mine, its my fault because I did a wrong search and concluded it hadn't been addresed. Sorry for that.
Comment 24 Galen Charlton 2013-11-29 14:44:19 UTC
Pushed to master.  Thanks, Srdjan!
Comment 25 Fridolin Somers 2013-12-13 14:52:00 UTC
This patch has been pushed to 3.14.x, will be in 3.14.1
Comment 26 Tomás Cohen Arazi 2013-12-23 15:23:45 UTC
This patch has been pushed to 3.12.x, will be in 3.12.8.

Thanks Srdjan!