Bug 19706

Summary: Item search: Unsupported format html
Product: Koha Reporter: Elias <elias.dehler>
Component: CatalogingAssignee: Nick Clemens <nick>
Status: CLOSED FIXED QA Contact: Josef Moravec <josef.moravec>
Severity: major    
Priority: P3 CC: jonathan.druart, josef.moravec, m.de.rooy, marjorie.barry-vila, nick
Version: master   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18047
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 19706 - Fix bad json formed when there are no CCODE values
Bug 19706: Fix bad json formed when there are no CCODE values
Bug 19706: (followup) - correct variable name 'ccodes' not 'ccode'
Bug 19706: Fix bad json formed when there are no CCODE values
Bug 19706: (followup) - correct variable name 'ccodes' not 'ccode'
Bug 19706: Fix bad json formed when there are no CCODE values
Bug 19706: (QA follow-up) Hide the collection code selector if no value is defined (for consistency)

Description Elias 2017-11-28 06:54:14 UTC
After upgrading to 17.05.06.000 Item search no longer works, as long as screen is selected.
CSV and Barcodes file working as intended.

When screen is the selected output you get the following software error:
Unsupported format html at /usr/share/koha/intranet/cgi-bin/catalogue/itemsearch.pl line 41.

Steps to reproduce:

1. upgrade to 17.05.06.000

2. in the intra: search -> item search

3. leave everything as it is and click search
Comment 1 Jonathan Druart 2017-12-05 17:46:06 UTC
I do not recreate, the format must be "json", unless you have javascript disabled.
Can you confirm you did not disable javascript?
Comment 2 Nick Clemens 2017-12-12 11:15:31 UTC
This appears to be an issue if there are no CCODE values defined. The column limiting code is malformed and javascript error breaks functionality.
Comment 3 Nick Clemens 2017-12-12 11:18:38 UTC Comment hidden (obsolete)
Comment 4 Owen Leonard 2017-12-12 16:52:48 UTC
Created attachment 69745 [details] [review]
Bug 19706: Fix bad json formed when there are no CCODE values

To test:
1 - Delete all ccode values in your system
2 - Load the item search page
3 - View the console and note a js error
4 - Try to perform an item search to screen
5 - Internal server error ("unsupported format 'html'" in logs)
6 - Apply patch
7 - Reload page
8 - Note js error is gone
9 - Perform search to screen, success!

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 5 Josef Moravec 2017-12-14 11:51:31 UTC
Comment on attachment 69745 [details] [review]
Bug 19706: Fix bad json formed when there are no CCODE values

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

Sorry, does not work, if you have defined some values in CCODE category, the select is not visible either

::: koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt
@@ +363,4 @@
>                      { 'type': 'text' },
>                      { 'type': 'text' },
>                      { 'type': 'text' },
> +                    [% IF ccode.size %]

should be ccodes.size (plural)
Comment 6 Nick Clemens 2017-12-14 12:44:39 UTC
Created attachment 69800 [details] [review]
Bug 19706: (followup) - correct variable name 'ccodes' not 'ccode'

To test:
1 - Have some values in CCODE authorised values
2 - Ensure collection drop down on item search displays correctly
3 - Ensure item search returns results ot screen with no js errors
Comment 7 David Bourgault 2017-12-15 20:22:06 UTC
Created attachment 69831 [details] [review]
Bug 19706: Fix bad json formed when there are no CCODE values

To test:
1 - Delete all ccode values in your system
2 - Load the item search page
3 - View the console and note a js error
4 - Try to perform an item search to screen
5 - Internal server error ("unsupported format 'html'" in logs)
6 - Apply patch
7 - Reload page
8 - Note js error is gone
9 - Perform search to screen, success!

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: David Bourgault <david.bourgault@inlibro.com>
Comment 8 David Bourgault 2017-12-15 20:22:41 UTC
Created attachment 69832 [details] [review]
Bug 19706: (followup) - correct variable name 'ccodes' not 'ccode'

To test:
1 - Have some values in CCODE authorised values
2 - Ensure collection drop down on item search displays correctly
3 - Ensure item search returns results ot screen with no js errors

Signed-off-by: David Bourgault <david.bourgault@inlibro.com>
Comment 9 Josef Moravec 2017-12-17 07:31:56 UTC
Created attachment 69835 [details] [review]
Bug 19706: Fix bad json formed when there are no CCODE values

To test:
1 - Delete all ccode values in your system
2 - Load the item search page
3 - View the console and note a js error
4 - Try to perform an item search to screen
5 - Internal server error ("unsupported format 'html'" in logs)
6 - Apply patch
7 - Reload page
8 - Note js error is gone
9 - Perform search to screen, success!

To test there is no regression:
1 - Have some values in CCODE authorised values
2 - Ensure collection drop down on item search displays correctly
3 - Ensure item search returns results ot screen with no js errors

Signed-off-by Owen Leonard <oleonard@myacpl.org>

Signed-off-by: David Bourgault <david.bourgault@inlibro.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 10 Josef Moravec 2017-12-17 07:32:01 UTC
Created attachment 69836 [details] [review]
Bug 19706: (QA follow-up) Hide the collection code selector if no value is defined (for consistency)

Test plan:
0) Go to item search
1) Do have some authorized values in CCODE category -> selector of
collection is visible
2) Don't have any authorized value in CCODE category -> selector of
collection is not visible

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 11 Josef Moravec 2017-12-17 07:34:39 UTC
I squashed the two patches to simplify history and added follow-up to make the item search form behave consistant - if there is no ccode value, the selector for collection is not visible on item search form.
Comment 12 Jonathan Druart 2017-12-18 15:19:16 UTC
Pushed to master for 18.05, thanks to everybody involved!
Comment 13 Nick Clemens 2017-12-20 13:02:43 UTC
Awesome work all! Pushed to stable for 17.11.01