Bug 40908

Summary: Issues with deleting items from additem page
Product: Koha Reporter: Lucas Gass (lukeg) <lucas>
Component: CatalogingAssignee: Lucas Gass (lukeg) <lucas>
Status: Pushed to main --- QA Contact: Brendan Lawlor <blawlor>
Severity: normal    
Priority: P5 - low CC: aspencatteam, blawlor, johanna.miettunen, jvasche, m.de.rooy
Version: Main   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: Trivial patch Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
25.11.00
Circulation function:
Attachments: Bug 40908: Remove JS confirmation, fix link, fix modal
Bug 40908: Remove JS confirmation, fix link, fix modal
Bug 40908: Remove JS confirmation, fix link, fix modal

Description Lucas Gass (lukeg) 2025-09-30 12:40:55 UTC
There are a few problems with the item deletion on additem.tt

-Clicking delete from the Actions button -> delete pops up both a JS alert and a BS confirmation modal. The deletion works.

-Clicking the "Delete item" button that appears when you hover over any cell pops up both a JS alert and a BS confirmation modal. The deletion does NOT work. 

-The "Cancel" button in the delete-item-modal does nothing.
Comment 1 Lucas Gass (lukeg) 2025-09-30 12:44:32 UTC
Created attachment 187098 [details] [review]
Bug 40908: Remove JS confirmation, fix link, fix modal

To test:
1. Without the patch:

-Clicking delete from the Actions button -> delete pops up both a JS alert and a BS confirmation modal. The deletion works.

-Clicking the "Delete item" button that appears when you hover over any cell pops up both a JS alert and a BS confirmation modal. The deletion does NOT work.

-The "Cancel" button in the delete-item-modal does nothing.

2. APPLY THE PATCH:

-Clicking delete from the Actions button -> 1 modal for confirmation. The deletion works.

-Clicking the "Delete item" button that appears when you hover over any cell pops up only a modal confirmation. The deletion works.

-The "Cancel" button in the delete-item-modal properly closes the modal.
Comment 2 Biblibre Sandboxes 2025-09-30 15:34:28 UTC
Created attachment 187111 [details] [review]
Bug 40908: Remove JS confirmation, fix link, fix modal

To test:
1. Without the patch:

-Clicking delete from the Actions button -> delete pops up both a JS alert and a BS confirmation modal. The deletion works.

-Clicking the "Delete item" button that appears when you hover over any cell pops up both a JS alert and a BS confirmation modal. The deletion does NOT work.

-The "Cancel" button in the delete-item-modal does nothing.

2. APPLY THE PATCH:

-Clicking delete from the Actions button -> 1 modal for confirmation. The deletion works.

-Clicking the "Delete item" button that appears when you hover over any cell pops up only a modal confirmation. The deletion works.

-The "Cancel" button in the delete-item-modal properly closes the modal.

Signed-off-by: Jason <jvasche@roundrocktexas.gov>
Comment 3 Jason Vasché (RRPL) 2025-09-30 15:39:16 UTC
Testing as described worked fine.  Also successfully tested the patch on "delete item" from individual cells in an item row (clicking on one displays "delete item" and "edit item").
Comment 4 Brendan Lawlor 2025-09-30 20:20:54 UTC
Created attachment 187135 [details] [review]
Bug 40908: Remove JS confirmation, fix link, fix modal

To test:
1. Without the patch:

-Clicking delete from the Actions button -> delete pops up both a JS alert and a BS confirmation modal. The deletion works.

-Clicking the "Delete item" button that appears when you hover over any cell pops up both a JS alert and a BS confirmation modal. The deletion does NOT work.

-The "Cancel" button in the delete-item-modal does nothing.

2. APPLY THE PATCH:

-Clicking delete from the Actions button -> 1 modal for confirmation. The deletion works.

-Clicking the "Delete item" button that appears when you hover over any cell pops up only a modal confirmation. The deletion works.

-The "Cancel" button in the delete-item-modal properly closes the modal.

Signed-off-by: Jason <jvasche@roundrocktexas.gov>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Comment 5 Brendan Lawlor 2025-09-30 20:23:22 UTC
This changes make sense and fix the bugs describes with deleting items on the additem page:

Remove call to confirmDelete() to get rid of the alert that pops up before the modal.

Change the delete_link data- attribute in cataloging_additem.js to match the way the Delete link is rendered in the actions drop down in additem.tt to fix the delete button in the cells. 
data-itemnumber="[% item.itemnumber | html %]"

Add the bs prefix in data-bs-dismiss="modal" for Bootstrap 5 to fic the Cancel button in the modal.

Nice work. Passing QA!
Comment 6 Lucas Gass (lukeg) 2025-10-06 15:17:13 UTC
Nice work everyone!

Pushed to main for 25.11