Bug 32737

Summary: Don't allow placing duplicate ILL requests to same partner
Product: Koha Reporter: Pedro Amorim <pedro.amorim>
Component: ILLAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact:
Severity: minor    
Priority: P5 - low CC: martin.renvoize
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 22531    
Bug Blocks:    

Description Pedro Amorim 2023-01-27 13:06:07 UTC
Bug 22531 adds the possibility of placing an ILL request with partners even if a request had been placed with a partner previously.
This, however, allows for a request to be placed with the same partner multiple times, adding new entries on message_queue each time the request is placed with the same partner.
A possible solution would be to remove previously placed partners from the "Select partner libraries:" list in the "Place request with partners" UI screen.

To reproduce:
- Apply 22531

Preparation:
- Create a report using the following SQL in order to verify that notices are being generated:
SELECT borrowernumber, subject, content, message_transport_type, to_address, from_address FROM message_queue WHERE letter_code LIKE 'ILL%' ORDER BY message_id DESC
- Create two "partners". These are patrons that belong to a patron category that has a code that matches the <partner_code> value in your koha-conf.xml (default is ILLLIBS). Patrons in this category must have a primary email defined. Patrons defined in this way are offered as request partners within the ILL interface.
- Go to "Koha administration", search for "ILLModule" syspref, ensure it is set to "Enable"
- Go to "Koha administration", search for "IllLog" syspref, ensure it is set to "Log"
- Go to "Koha administration" > "Libraries", choose a library and "Edit" it
- Ensure the "Email" field for the library is populated

Reproduce:
1 - Create an ILL request using the FreeForm backend
2 - From the "Manage ILL request" screen, select "Place request with partners"
3 - In "Select partner libraries" choose one partner library, then click "Send email"
4 - Run the report created during preparation and check that the entry has been added to message_queue
5 - For the same request, repeat steps 2 and 3 and place the request with the same partner as previously
6 - Run the report again and check that a second identical entry has been added to message_queue
7 - Go to the request again and verify that the "ILL request log" also has one entry for each time the request was placed for the same partner (working as intended)