Bug 11183 - Warnings in opac
Summary: Warnings in opac
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Srdjan Jankovic
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 8817
  Show dependency treegraph
 
Reported: 2013-11-01 08:03 UTC by Srdjan Jankovic
Modified: 2015-06-04 23:23 UTC (History)
5 users (show)

See Also:
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_11183: get rid of some warninngs (1.81 KB, patch)
2013-11-01 08:10 UTC, Srdjan Jankovic
Details | Diff | Splinter Review
bug_11183: get rid of some warninngs (1.83 KB, patch)
2013-11-07 23:28 UTC, Srdjan Jankovic
Details | Diff | Splinter Review
[SIGNED OFF] bug_11183: get rid of some warnings (2.04 KB, patch)
2013-11-08 06:11 UTC, Mark Tompsett
Details | Diff | Splinter Review
bug_11183: get rid of some warnings (2.12 KB, patch)
2013-11-08 12:15 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Sample code demonstrating problem Galen found. (6.30 KB, text/plain)
2013-11-08 17:02 UTC, Mark Tompsett
Details
bug_11183: get rid of some warninngs (1.84 KB, patch)
2013-11-11 01:37 UTC, Srdjan Jankovic
Details | Diff | Splinter Review
bug_11183: get rid of some warninngs (1.85 KB, patch)
2013-11-11 02:50 UTC, Srdjan Jankovic
Details | Diff | Splinter Review
[SIGNED OFF] bug_11183: get rid of some warnings (2.14 KB, patch)
2013-11-11 03:11 UTC, Mark Tompsett
Details | Diff | Splinter Review
Bug 11183 - Warnings in opac (1.22 KB, patch)
2013-11-11 04:31 UTC, Mark Tompsett
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 11183 - Warnings in opac (1.28 KB, patch)
2013-11-12 00:23 UTC, Srdjan Jankovic
Details | Diff | Splinter Review
bug_11183: Supress undef warning in opac-MARCdetail.pl (1.49 KB, patch)
2013-11-12 07:59 UTC, Srdjan Jankovic
Details | Diff | Splinter Review
bug_11183: Supress undef warning in opac-MARCdetail.pl (2.20 KB, patch)
2013-11-12 08:07 UTC, Srdjan Jankovic
Details | Diff | Splinter Review
bug_11183: get rid of some warnings (2.18 KB, patch)
2013-11-22 17:16 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 11183 - Warnings in opac (1.33 KB, patch)
2013-11-22 17:17 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 11183 - Warnings in opac - QA Followup (1018 bytes, patch)
2013-11-22 17:17 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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 (khall) 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 (khall) 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 (khall) 2013-11-22 17:17:06 UTC Comment hidden (obsolete)
Comment 22 Kyle M Hall (khall) 2013-11-22 17:17:38 UTC Comment hidden (obsolete)
Comment 23 Tomás Cohen Arazi (tcohen) 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 (tcohen) 2013-12-23 15:23:45 UTC
This patch has been pushed to 3.12.x, will be in 3.12.8.

Thanks Srdjan!