In the template for the item search page there is this at line 290: { 'type': 'select', 'values': [% notforloans.json %] }, [% notforloans.json %] appears to be undefined, whether the search form has been submitted or not. Viewing source shows this: { 'type': 'select', 'values': }, ...and the Firebug console reports this error: SyntaxError: expected expression, got '}' /cgi-bin/koha/catalogue/itemsearch.pl Line 240
I don't get this JS error. Looking at the code, it might appear if items.notforloan is not linked to any authorised values in your default framework. Could you confirm?
Okay you're right it was an issue with my system: I had no "NOT_LOAN" authorized values! I must have removed them while testing something else. Should we add a check for this, or assume that no one running a real Koha installation is going to do that?
No idea :) If we care about NOT_LOAN, we should care about others and everywhere.
I'm seeing the same Syntaxerror as Owen after performing an item search and the results are being displayed below the search options, instead of on a clean page. SyntaxError: expected expression, got '}' /cgi-bin/koha/catalogue/itemsearch.pl Line 396 This occurs for us when no LOC value is present, which is the case for a number of libraries. If the library happens to have another custom authorised value, the error does not occur and in another case the use of bsort2 also removed the error.
Created attachment 59396 [details] [review] Bug 16115: Remove JS error on item search if LOC does not exist If LOC is not present, the item search form will raise a JS error: SyntaxError: expected expression, got '}' This patch fixes it by handling this specific case. Note that the "Status" column is still displayed. Test plan: Remove your LOC authorised values Go on the item search form => You will not get the JS error and the "Status" bloc is no longer displayed. There is no need to display it if empty.
Created attachment 59659 [details] [review] [SIGNED-OFF] Bug 16115: Remove JS error on item search if LOC does not exist If LOC is not present, the item search form will raise a JS error: SyntaxError: expected expression, got '}' This patch fixes it by handling this specific case. Note that the "Status" column is still displayed. Test plan: Remove your LOC authorised values Go on the item search form => You will not get the JS error and the "Status" bloc is no longer displayed. There is no need to display it if empty. Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Created attachment 59874 [details] [review] Bug 16115: Remove JS error on item search if NOT_LOAN values do not exist If NOT_LOAN is not present, the item search form will raise a JS error: SyntaxError: expected expression, got '}' This patch fixes it by handling this specific case. Note that the "Status" column is still displayed. Test plan: Remove your NOT_LOAN authorised values Go on the item search form => You will not get the JS error and the "Status" bloc is no longer displayed. There is no need to display it if empty. Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Fixed commit message - LOC case handled on bug 18047
Pushed to master for 17.05, thanks Jonathan!
This patch has been pushed to 16.11.x and will be in 16.11.04.
Pushed to 3.22.x for 3.22.17
Pushed to 16.05.x, for 16.05.10 release