Bug 23885

Summary: Move staff client search results JavaScript into separate file
Product: Koha Reporter: Owen Leonard <oleonard>
Component: TemplatesAssignee: Owen Leonard <oleonard>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: 1joynelson, david, katrin.fischer, martin.renvoize
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
As part of the coding guidelines (JS1 - Whenever possible JavaScript should be placed in a separate file), this patch patch moves most of the JavaScript embedded in results.tt for the staff interface into a separate file.
Version(s) released in:
20.05.00
Bug Depends on:    
Bug Blocks: 24808, 26158    
Attachments: Bug 23885: Move staff client search results JavaScript into separate file
Bug 23885: Move staff client search results JavaScript into separate file
Bug 23885: Screenshots of potential problem
Bug 23885: Move staff client search results JavaScript into separate file

Description Owen Leonard 2019-10-23 13:37:46 UTC
Coding guideline JS1 (https://wiki.koha-community.org/wiki/Coding_Guidelines#JS1:_Embedding_JavaScript_blocks_in_templates) says "Whenever possible JavaScript should be placed in a separate file."

I propose to move most of the JS embedded in results.tt to a separate file.
Comment 1 Owen Leonard 2019-10-23 14:29:41 UTC
Created attachment 94630 [details] [review]
Bug 23885: Move staff client search results JavaScript into separate file

This patch moves most of the JavaScript embedded in results.tt into a
separate file. The JavaScript that remains on the page is everything
which requires processing by Template Toolkit. This is limited to
variable definition.

To test, apply the patch and perform a catalog search in the staff
client. On the results page, test that JavaScript functionality has not
been affected:

 - The search results toolbar should "float" as you scroll
 - Select all and Clear all
 - Default search term highlighting; Unhighlight and highlight controls
 - Adding and removing one or more items from the cart
 - Adding one or more items to a list
 - Placing one or more holds my making selections and clicking "Place
   hold"
 - Browse selected records
 - Z39.50 search (search form should be populated with your search
   terms)
 - "Show more" and "Show less" links in the facets sidebar
 - Book cover image services: Amazon, Coce, local covers, etc.
 - Open a patron record and click "Search to hold"
  - Perform a search and select one or more results
    - Test "Place hold" from the hold menu in the toolbar
    - Test "Place hold for..." from the hold menu in the toolbar
    - Test "Forget..." from the hold menu in the toolbar
 - In Tools -> Patron clubs, locate a club with enrolled members
   - From the "Actions" menu, select "Search to hold"
     - Perform a search and select one or more results
       - Test "Place hold" from the hold menu in the toolbar
       - Test "Place hold for..." from the hold menu in the toolbar
       - Test "Forget..." from the hold menu in the toolbar
Comment 2 David Nind 2020-01-27 10:31:57 UTC
Created attachment 97964 [details] [review]
Bug 23885: Move staff client search results JavaScript into separate file

This patch moves most of the JavaScript embedded in results.tt into a
separate file. The JavaScript that remains on the page is everything
which requires processing by Template Toolkit. This is limited to
variable definition.

To test, apply the patch and perform a catalog search in the staff
client. On the results page, test that JavaScript functionality has not
been affected:

 - The search results toolbar should "float" as you scroll
 - Select all and Clear all
 - Default search term highlighting; Unhighlight and highlight controls
 - Adding and removing one or more items from the cart
 - Adding one or more items to a list
 - Placing one or more holds by making selections and clicking "Place
   hold"
 - Browse selected records
 - Z39.50 search (search form should be populated with your search
   terms)
 - "Show more" and "Show less" links in the facets sidebar
 - Book cover image services: Amazon, Coce, local covers, etc.
 - Open a patron record and click "Search to hold"
  - Perform a search and select one or more results
    - Test "Place hold" from the hold menu in the toolbar
    - Test "Place hold for..." from the hold menu in the toolbar
    - Test "Forget..." from the hold menu in the toolbar
 - In Tools -> Patron clubs, locate a club with enrolled members
   - From the "Actions" menu, select "Search to hold"
     - Perform a search and select one or more results
       - Test "Place hold" from the hold menu in the toolbar
       - Test "Place hold for..." from the hold menu in the toolbar
       - Test "Forget..." from the hold menu in the toolbar

Signed-off-by: David Nind <david@davidnind.com>
Comment 3 David Nind 2020-01-27 10:44:21 UTC
Created attachment 97970 [details]
Bug 23885: Screenshots of potential problem

A potential problem identified during testing is placing a hold for a Patron club. 

This didn’t work for me before the patch was applied as well as when the patch was applied, so it is either something I did or it is another issue.

When you select an item with a tick and then try to place a hold for the Patron Club from the drop down list (screenshot 1 in attachment) you get “No items are available” (see screenshot 2 in attachment).

Selecting ‘Place hold for ...’ from the links works fine though.
Comment 4 Katrin Fischer 2020-01-27 21:20:39 UTC
(In reply to David Nind from comment #3)
> Created attachment 97970 [details]
> Bug 23885: Screenshots of potential problem
> 
> A potential problem identified during testing is placing a hold for a Patron
> club. 
> 
> This didn’t work for me before the patch was applied as well as when the
> patch was applied, so it is either something I did or it is another issue.
> 
> When you select an item with a tick and then try to place a hold for the
> Patron Club from the drop down list (screenshot 1 in attachment) you get “No
> items are available” (see screenshot 2 in attachment).
> 
> Selecting ‘Place hold for ...’ from the links works fine though.

I haven't managed to get the pull down to display when testing without the patch - maybe someone else can give this a try?
Comment 5 Katrin Fischer 2020-01-27 21:56:07 UTC
Created attachment 98004 [details] [review]
Bug 23885: Move staff client search results JavaScript into separate file

This patch moves most of the JavaScript embedded in results.tt into a
separate file. The JavaScript that remains on the page is everything
which requires processing by Template Toolkit. This is limited to
variable definition.

To test, apply the patch and perform a catalog search in the staff
client. On the results page, test that JavaScript functionality has not
been affected:

 - The search results toolbar should "float" as you scroll
 - Select all and Clear all
 - Default search term highlighting; Unhighlight and highlight controls
 - Adding and removing one or more items from the cart
 - Adding one or more items to a list
 - Placing one or more holds my making selections and clicking "Place
   hold"
 - Browse selected records
 - Z39.50 search (search form should be populated with your search
   terms)
 - "Show more" and "Show less" links in the facets sidebar
 - Book cover image services: Amazon, Coce, local covers, etc.
 - Open a patron record and click "Search to hold"
  - Perform a search and select one or more results
    - Test "Place hold" from the hold menu in the toolbar
    - Test "Place hold for..." from the hold menu in the toolbar
    - Test "Forget..." from the hold menu in the toolbar
 - In Tools -> Patron clubs, locate a club with enrolled members
   - From the "Actions" menu, select "Search to hold"
     - Perform a search and select one or more results
       - Test "Place hold" from the hold menu in the toolbar
       - Test "Place hold for..." from the hold menu in the toolbar
       - Test "Forget..." from the hold menu in the toolbar

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 6 Martin Renvoize 2020-01-29 09:10:20 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 7 Joy Nelson 2020-02-10 22:41:41 UTC
Enhancement not backported to 19.11.x