Get rid of some warnings
Created attachment 22663 [details] [review] bug_11183: get rid of some warninngs To test in OPAC: * Set EnableOpacSearchHistory to yes (Keep). Do an advanced search with limits. Complete search with limits should show. * Have an item with Collection Code. Check that the Collection Code shows.
Created attachment 22794 [details] [review] bug_11183: get rid of some warninngs To test in OPAC: * Set EnableOpacSearchHistory to yes (Keep). Do an advanced search with limits. Complete search with limits should show. * Have an item with Collection Code. Check that the Collection Code shows.
Created attachment 22801 [details] [review] [SIGNED OFF] 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 * Collection Code is set by editing an item in the staff client (952$8) Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Created attachment 22810 [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 * 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> Passes koha-qa.pl, works as advertised.
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.
Created attachment 22839 [details] Sample code demonstrating problem Galen found. It also includes a revision which should work. I know a code of '' isn't really possible, but that also fails.
Created attachment 22853 [details] [review] bug_11183: get rid of some warninngs To test in OPAC: * Set EnableOpacSearchHistory to yes (Keep). Do an advanced search with limits. Complete search with limits should show. * Have an item with Collection Code. Check that the Collection Code shows.
Created attachment 22855 [details] [review] bug_11183: get rid of some warninngs To test in OPAC: * Set EnableOpacSearchHistory to yes (Keep). Do an advanced search with limits. Complete search with limits should show. * Have an item with Collection Code. Check that the Collection Code shows.
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. :)
Created attachment 22856 [details] [review] [SIGNED OFF] 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>
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.
Created attachment 22857 [details] [review] Bug 11183 - Warnings in opac This may affect staff as well. During testing of Srdjan Jankovic's patch, the following error message was triggered: opac-search.pl: Use of uninitialized value $code_wanted in string eq at /usr/share/perl5/MARC/Field.pm line 314. This was traced to a bad call on subfields in C4::Search. By adding an if check around the call, this warning is no longer triggered.
I did something with Search.pm too on a different bug report.
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$
Created attachment 22862 [details] [review] [SIGNED-OFF] Bug 11183 - Warnings in opac This may affect staff as well. During testing of Srdjan Jankovic's patch, the following error message was triggered: opac-search.pl: Use of uninitialized value $code_wanted in string eq at /usr/share/perl5/MARC/Field.pm line 314. This was traced to a bad call on subfields in C4::Search. By adding an if check around the call, this warning is no longer triggered. Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Created attachment 22866 [details] [review] bug_11183: Supress undef warning in opac-MARCdetail.pl To test: * Go to /cgi-bin/koha/opac-MARCdetail.pl?biblionumber=<your fav biblionumber> and confirm that pre and post patch page looks the same. An apology: I tried to find a syspref combination that displays opac-MARCdetail.pl links in OPAC search results, and failed. If anyone knows, the secret combination, please disclose. I resorted to entering the url by hand.
Created attachment 22867 [details] [review] bug_11183: Supress undef warning in opac-MARCdetail.pl To test: * Go to /cgi-bin/koha/opac-MARCdetail.pl?biblionumber=<your fav biblionumber> and confirm that pre and post patch page looks the same. An apology: I tried to find a syspref combination that displays opac-MARCdetail.pl links in OPAC search results, and failed. If anyone knows, the secret combination, please disclose. I resorted to entering the url by hand.
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 on attachment 22867 [details] [review] bug_11183: Supress undef warning in opac-MARCdetail.pl Issue dealt with in another bug
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>
Created attachment 23096 [details] [review] Bug 11183 - Warnings in opac This may affect staff as well. During testing of Srdjan Jankovic's patch, the following error message was triggered: opac-search.pl: Use of uninitialized value $code_wanted in string eq at /usr/share/perl5/MARC/Field.pm line 314. This was traced to a bad call on subfields in C4::Search. By adding an if check around the call, this warning is no longer triggered. Signed-off-by: Srdjan <srdjan@catalyst.net.nz> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 23097 [details] [review] Bug 11183 - Warnings in opac - QA Followup
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.
Pushed to master. Thanks, Srdjan!
This patch has been pushed to 3.14.x, will be in 3.14.1
This patch has been pushed to 3.12.x, will be in 3.12.8. Thanks Srdjan!