Bug 39175

Summary: Send request to partners explodes
Product: Koha Reporter: Pedro Amorim <pedro.amorim>
Component: ILLAssignee: Pedro Amorim <pedro.amorim>
Status: Pushed to stable --- QA Contact: Marcel de Rooy <m.de.rooy>
Severity: normal    
Priority: P5 - low CC: aude.charillon, blawlor, jeremy.evans, katrin.fischer, m.de.rooy, martin.renvoize, paul.derscheid, pedro.amorim, tomascohen
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.05.00, 24.11.03
Circulation function:
Bug Depends on: 35570    
Bug Blocks: 32630    
Attachments: Bug 39175: Fix Attributes->Attribute
Bug 39175: Fix Attributes->Attribute
Bug 39175: Fix Attributes->Attribute

Description Pedro Amorim 2025-02-20 11:09:16 UTC
Bug introduced in FreeForm prior to adding it to core in this commit:
https://github.com/PTFS-Europe/koha-ill-freeform/commit/369dffb159f1e70162b685b473dcf26c76f7e7e7#diff-662970ddc6f6828afd23e6823399a4a32807c4a6c487a0aff86c9d116f60797dR806

It should've been Koha::Illrequestattribute into Koha::ILL::Request::Attribute not Koha::ILL::Request::Attributes
Comment 1 Pedro Amorim 2025-02-20 11:11:04 UTC
Created attachment 178386 [details] [review]
Bug 39175: Fix Attributes->Attribute

Bug introduced in FreeForm prior to adding it to core in this commit:
https://github.com/PTFS-Europe/koha-ill-freeform/commit/369dffb159f1e70162b685b473dcf26c76f7e7e7#diff-662970ddc6f6828afd23e6823399a4a32807c4a6c487a0aff86c9d116f60797dR806

It should've been Koha::Illrequestattribute into Koha::ILL::Request::Attribute not Koha::ILL::Request::Attributes

To test, k-t-d:
1) Enable ILLModule syspref
2) Edit the only patron in k-t-d with the 'Interlibrary loan' category:
<staff_url>/cgi-bin/koha/members/memberentry.pl?op=edit_form&destination=circ&borrowernumber=16
3) Add a valid e-mail address to 'Primary email:'
4) Create a new ILL request:
/cgi-bin/koha/ill/ill-requests.pl?method=create&backend=Standard
5) Add any type, any valid patron cardnumber, any library. Click 'Create'.
6) Click 'Place request with partners'
7) Pick the only available partner library 'FRL-Walker'
8) Click 'Send email'.
9) Notice you get an error. Apply patch & restart plack. Repeat.
10) Confirm the there's no error and message was queue as expected:
$ select * from message_queue;
Comment 2 Brendan Lawlor 2025-02-20 15:07:03 UTC
Created attachment 178423 [details] [review]
Bug 39175: Fix Attributes->Attribute

Bug introduced in FreeForm prior to adding it to core in this commit:
https://github.com/PTFS-Europe/koha-ill-freeform/commit/369dffb159f1e70162b685b473dcf26c76f7e7e7#diff-662970ddc6f6828afd23e6823399a4a32807c4a6c487a0aff86c9d116f60797dR806

It should've been Koha::Illrequestattribute into Koha::ILL::Request::Attribute not Koha::ILL::Request::Attributes

To test, k-t-d:
1) Enable ILLModule syspref
2) Edit the only patron in k-t-d with the 'Interlibrary loan' category:
<staff_url>/cgi-bin/koha/members/memberentry.pl?op=edit_form&destination=circ&borrowernumber=16
3) Add a valid e-mail address to 'Primary email:'
4) Create a new ILL request:
/cgi-bin/koha/ill/ill-requests.pl?method=create&backend=Standard
5) Add any type, any valid patron cardnumber, any library. Click 'Create'.
6) Click 'Place request with partners'
7) Pick the only available partner library 'FRL-Walker'
8) Click 'Send email'.
9) Notice you get an error. Apply patch & restart plack. Repeat.
10) Confirm the there's no error and message was queue as expected:
$ select * from message_queue;

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Comment 3 Brendan Lawlor 2025-02-20 15:13:14 UTC
Test notes:
The error is almost silent, but when you try to place request with partner libraries and click send email the page just reloads with &error=unknown_error added to the url.

The email still gets added to the message_queue, so after confirming the error before testing the patch it's helpful to ktd --dbshell > delete from message_queue; so the last step is easy to confirm.
Comment 4 Marcel de Rooy 2025-02-21 09:26:28 UTC
Created attachment 178454 [details] [review]
Bug 39175: Fix Attributes->Attribute

Bug introduced in FreeForm prior to adding it to core in this commit:
https://github.com/PTFS-Europe/koha-ill-freeform/commit/369dffb159f1e70162b685b473dcf26c76f7e7e7#diff-662970ddc6f6828afd23e6823399a4a32807c4a6c487a0aff86c9d116f60797dR806

It should've been Koha::Illrequestattribute into Koha::ILL::Request::Attribute not Koha::ILL::Request::Attributes

To test, k-t-d:
1) Enable ILLModule syspref
2) Edit the only patron in k-t-d with the 'Interlibrary loan' category:
<staff_url>/cgi-bin/koha/members/memberentry.pl?op=edit_form&destination=circ&borrowernumber=16
3) Add a valid e-mail address to 'Primary email:'
4) Create a new ILL request:
/cgi-bin/koha/ill/ill-requests.pl?method=create&backend=Standard
5) Add any type, any valid patron cardnumber, any library. Click 'Create'.
6) Click 'Place request with partners'
7) Pick the only available partner library 'FRL-Walker'
8) Click 'Send email'.
9) Notice you get an error. Apply patch & restart plack. Repeat.
10) Confirm the there's no error and message was queue as expected:
$ select * from message_queue;

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 5 Katrin Fischer 2025-02-21 14:52:06 UTC
This is clearly fixing a bad bug and as such I am pushing it, but it feels like a unit test to prevent future regression would be nice here.
Comment 6 Katrin Fischer 2025-02-21 15:45:12 UTC
Pushed for 25.05!

Well done everyone, thank you!
Comment 7 Paul Derscheid 2025-03-19 23:17:51 UTC
Nice work everyone!

Pushed to 24.11.x for 24.11.03
Comment 8 Aude Charillon 2025-04-15 08:22:20 UTC
*** Bug 39629 has been marked as a duplicate of this bug. ***
Comment 9 Katrin Fischer 2025-05-16 15:53:41 UTC
(In reply to Katrin Fischer from comment #5)
> This is clearly fixing a bad bug and as such I am pushing it, but it feels
> like a unit test to prevent future regression would be nice here.

Would still be nice,...