Bug 33322

Summary: "Please select at least one suggestion" when doing a catalog search from suggestions page
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: TemplatesAssignee: Owen Leonard <oleonard>
Status: RESOLVED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: Laura.escamilla, lucas, nick
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.05.00,22.11.05
Bug Depends on:    
Bug Blocks: 34080    
Attachments: Bug 33322: Refine click handler for suggestion batch operations
Bug 33322: Refine click handler for suggestion batch operations
Bug 33322: Refine click handler for suggestion batch operations
Bug 33322: (QA follow-up) Add comment to clarify selector context

Description Katrin Fischer 2023-03-23 15:02:06 UTC
Something is not quite right here:

* Go to Suggestions
* Click on catalog search and enter a search term
* Search for it
* You'll get an alert with "Please select at least one suggestion"
Comment 1 Owen Leonard 2023-03-24 11:57:35 UTC
Created attachment 148657 [details] [review]
Bug 33322: Refine click handler for suggestion batch operations

The handler for suggestion batch operations looks for clicks on
"button[type='submit']" which is not very specific. With the new staff
interface this ends up including the header search form.

This patch modifies the markup of the batch operations section of
the template and makes the click handler more specific so that only the
right buttons are affected.

To test, apply the patch and go to Suggestions.

- In the header search form, perform a catalog search. You should be
  able to click the submit button to successfully initiate the search.
- Without checking a checkbox associated with any open suggestion, test
  the batch operation buttons at the bottom:
  - Change status
  - Change item type
  - Update manager
  - Delete
  - Archive
  All should trigger a JS alert, "Please select at least one suggestion"
- Test each batch operation with one or more suggestions selected and
  confirm that the operation completes successfully.
Comment 2 ByWater Sandboxes 2023-03-27 12:18:42 UTC
Created attachment 148761 [details] [review]
Bug 33322: Refine click handler for suggestion batch operations

The handler for suggestion batch operations looks for clicks on
"button[type='submit']" which is not very specific. With the new staff
interface this ends up including the header search form.

This patch modifies the markup of the batch operations section of
the template and makes the click handler more specific so that only the
right buttons are affected.

To test, apply the patch and go to Suggestions.

- In the header search form, perform a catalog search. You should be
  able to click the submit button to successfully initiate the search.
- Without checking a checkbox associated with any open suggestion, test
  the batch operation buttons at the bottom:
  - Change status
  - Change item type
  - Update manager
  - Delete
  - Archive
  All should trigger a JS alert, "Please select at least one suggestion"
- Test each batch operation with one or more suggestions selected and
  confirm that the operation completes successfully.

Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
Comment 3 Nick Clemens 2023-03-29 14:33:21 UTC
Created attachment 148925 [details] [review]
Bug 33322: Refine click handler for suggestion batch operations

The handler for suggestion batch operations looks for clicks on
"button[type='submit']" which is not very specific. With the new staff
interface this ends up including the header search form.

This patch modifies the markup of the batch operations section of
the template and makes the click handler more specific so that only the
right buttons are affected.

To test, apply the patch and go to Suggestions.

- In the header search form, perform a catalog search. You should be
  able to click the submit button to successfully initiate the search.
- Without checking a checkbox associated with any open suggestion, test
  the batch operation buttons at the bottom:
  - Change status
  - Change item type
  - Update manager
  - Delete
  - Archive
  All should trigger a JS alert, "Please select at least one suggestion"
- Test each batch operation with one or more suggestions selected and
  confirm that the operation completes successfully.

Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 4 Nick Clemens 2023-03-29 14:33:25 UTC
Created attachment 148926 [details] [review]
Bug 33322: (QA follow-up) Add comment to clarify selector context
Comment 5 Nick Clemens 2023-03-29 14:34:09 UTC
I got confused and thought we had a second selector, added a comment as a reminder - feel free to drop that RM
Comment 6 Tomás Cohen Arazi 2023-04-03 10:30:22 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 7 Katrin Fischer 2023-04-06 13:50:21 UTC
Please backport, this was originally spotted in 22.11
Comment 8 Jacob O'Mara 2023-04-16 17:24:46 UTC
Nice work, thanks everyone!

Pushed to 22.11.x for the next release.
Comment 9 Lucas Gass 2023-04-24 17:37:20 UTC
Doesn't apply cleanly to 22.05.x, no backport. If needed please rebase.
Comment 10 Owen Leonard 2023-04-24 18:59:58 UTC
The bug is a result of the new staff interface so 22.05.x shouldn't need it
Comment 11 Lucas Gass 2023-04-24 20:13:40 UTC
(In reply to Owen Leonard from comment #10)
> The bug is a result of the new staff interface so 22.05.x shouldn't need it

Thanks Owen.