Koha/koha-tmpl
Emily Lamancusa 4b94b6546d
Bug 38588: Don't generate a second transfer when printing transfer slip
When an item is checked in that should automatically return to its home
branch, AddReturn generates the appropriate transfer. In some cases, the
Print Slip button generates a second transfer, which now causes an
exception to be thrown.

In returns.pl, the op cud-dotransfer is used when a transfer was not
initiated previously and the librarian has confirmed they want to
initiate and send a transfer. The op cud-transfer is used when a
transfer has already been generated and the page needs to send or
cancel the transfer.

This patch updates the op from the modal to ensure that the correct of
the two options is generated according to whether a transfer was already
initiated or not.

To test:
1. Find or create an item that belongs to a branch other than the
   logged-in branch
2. In a new tab, check in the item - this should trigger a Return to
   Home transfer (keep the bib record tab open for later)
3. Click "Print Slip"
--> Internal server error - 'Active item transfer already exists'
4. Apply patch and restart_all
5. Check in item again and cancel the transfer
6. Check in item again to generate new transfer
7. Click "Print Slip"
--> Checkin page loads correctly
--> Refresh bib record and confirm item shows as in-transit
8. Enable syspref ShowAllCheckins
9. Repeat steps 5-7
--> Ensure item displays correctly in checkins table
--> Refresh bib record and confirm item still shows as in-transit
10. Repeat steps 5-7, except this time click "Yes" instead of "Print
    Slip"
--> Ensure item displays correctly in the checkins table
--> Refresh bib record and confirm item shows as in-transit
10. Set syspref TransfersBlockCirc to Don't Block, and set
    AutomaticConfirmTransfer to Enable
11. Check in the item again and cancel the transfer
12. Check in the item to generate new transfer
13. Click away from the modal without selecting a response
--> Ensure item displays correctly in the checkins table
--> Refresh bib record and confirm item shows as in-transit
14. Check out the item to a customer
15. Check the item in and click "Yes"
--> Ensure item displays correctly in the checkins table
--> Refresh bib record and confirm item shows as in-transit
16. Repeat steps 14-15, clicking "Print Slip" instead of "Yes"
--> Ensure item displays correctly in the checkins table
--> Refresh bib record and confirm item shows as in-transit
17. Repeat steps 14-15, clicking away from the modal without selecting a
    response
--> Ensure item displays correctly in the checkins table
--> Refresh bib record and confirm item shows as in-transit

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-01-10 17:59:40 +01:00
..
intranet-tmpl Bug 38588: Don't generate a second transfer when printing transfer slip 2025-01-10 17:59:40 +01:00
opac-tmpl Bug 26211: (QA follow-up) Shorten error message 2024-12-30 15:12:46 +01:00