Bug 37150

Summary: Can't delete single title from a list using the "Remove from list" link
Product: Koha Reporter: Owen Leonard <oleonard>
Component: OPACAssignee: Owen Leonard <oleonard>
Status: Passed QA --- QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: cubingguy714, martin.renvoize, phil
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:
Bug Depends on: 34478    
Bug Blocks: 36557    
Attachments: Bug 37150: Can't delete single title from a list using the "Remove from list" link
Bug 37150: Can't delete single title from a list using the "Remove from list" link
Bug 37150: Can't delete single title from a list using the "Remove from list" link
Bug 37150: Can't delete single title from a list using the "Remove from list" link

Description Owen Leonard 2024-06-21 13:16:08 UTC
In the OPAC's display of titles on a list, the "Remove from link" control on individual titles tries to use a GET operation which fails because of CSRF protection. We need to POST that request.
Comment 1 Owen Leonard 2024-06-21 14:33:51 UTC Comment hidden (obsolete)
Comment 2 Phil Ringnalda 2024-06-21 15:10:34 UTC
I selected the checkboxes for two of the titles on my list that I wanted to place on hold, then I noticed a third one that I had already read, which I wanted to get rid of, so I used the Remove from this list for that item, got a modal asking if I wanted to remove that one title, said I did, and it and the two I wanted to place on hold were all three removed from the list.
Comment 3 Owen Leonard 2024-06-24 14:54:50 UTC
Created attachment 168015 [details] [review]
Bug 37150: Can't delete single title from a list using the "Remove from list" link

In the OPAC display of titles on a list, the "Remove from list" control
needs to trigger a POST operation instead of GET. This patch
appends a form for handling single entry deletions, populating
the hidden input upon confirmation.

To test, apply the patch and create a list if necessary, adding multiple
titles to it.

- View the contents of your list.
- Each title on your list should have a "Remove from this list" link.
  - Click one of these. You should see a modal confirmation, "Are you
    sure you want to remove this item from the list?"
    - Confirming should delete the title form the list.
  - Check multiple checkboxes in the list of titles and click "Remove
    from list" at the top of the list.
    - You should see a modal confirmation, "Are you sure you want to
      remove these items from the list?"
      - Confirming should result in all checked titles being removed
        from the list.
  - Check one or more checkboxes and then click a single "Remove from
    list" link. After confirming, you should find that only the one
    title was removed from the list.

Sponsored-by: Athens County Public Libraries
Comment 4 Eric Garcia 2024-06-24 16:02:19 UTC
Created attachment 168022 [details] [review]
Bug 37150: Can't delete single title from a list using the "Remove from list" link

In the OPAC display of titles on a list, the "Remove from list" control
needs to trigger a POST operation instead of GET. This patch
appends a form for handling single entry deletions, populating
the hidden input upon confirmation.

To test, apply the patch and create a list if necessary, adding multiple
titles to it.

- View the contents of your list.
- Each title on your list should have a "Remove from this list" link.
  - Click one of these. You should see a modal confirmation, "Are you
    sure you want to remove this item from the list?"
    - Confirming should delete the title form the list.
  - Check multiple checkboxes in the list of titles and click "Remove
    from list" at the top of the list.
    - You should see a modal confirmation, "Are you sure you want to
      remove these items from the list?"
      - Confirming should result in all checked titles being removed
        from the list.
  - Check one or more checkboxes and then click a single "Remove from
    list" link. After confirming, you should find that only the one
    title was removed from the list.

Sponsored-by: Athens County Public Libraries
Signed-off-by: Eric Garcia <cubingguy714@gmail.com>
Comment 5 Martin Renvoize 2024-06-28 13:53:28 UTC
Created attachment 168240 [details] [review]
Bug 37150: Can't delete single title from a list using the "Remove from list" link

In the OPAC display of titles on a list, the "Remove from list" control
needs to trigger a POST operation instead of GET. This patch
appends a form for handling single entry deletions, populating
the hidden input upon confirmation.

To test, apply the patch and create a list if necessary, adding multiple
titles to it.

- View the contents of your list.
- Each title on your list should have a "Remove from this list" link.
  - Click one of these. You should see a modal confirmation, "Are you
    sure you want to remove this item from the list?"
    - Confirming should delete the title form the list.
  - Check multiple checkboxes in the list of titles and click "Remove
    from list" at the top of the list.
    - You should see a modal confirmation, "Are you sure you want to
      remove these items from the list?"
      - Confirming should result in all checked titles being removed
        from the list.
  - Check one or more checkboxes and then click a single "Remove from
    list" link. After confirming, you should find that only the one
    title was removed from the list.

Sponsored-by: Athens County Public Libraries
Signed-off-by: Eric Garcia <cubingguy714@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 6 Martin Renvoize 2024-06-28 13:54:04 UTC
Thanks Owen, all working well no QA failures.

Passing QA