When creating an ILL request, if the form data contains leading or trailing whitespaces, this may cause issues for backends. Example: A DOI is entered as ' 123', instead of '123'. If the backend needs to use that data entry, it'll need to first trim and/or sanitize it. It's better if core Koha does this trimming before delegating the creation of the request to the backend, so it's maintained in a single place.
Created attachment 182668 [details] [review] Bug 39944: Add tests prove t/db_dependent/Koha/ILL/Request.t
Created attachment 182669 [details] [review] Bug 39944: Trim form params Test plan, ktd, before applying patch: 1) Enable ILLModule sys pref and create a new ILL request: <staff_url>/cgi-bin/koha/ill/ill-requests.pl?method=create&backend=Standard 2) Pick type 'journal article' and enter ' 123' to DOI (notice the leading white space) 3) Enter a cardnumber and a library. Click 'Create'. 4) Run the following SQL query (koha-mysql kohadev): $ SELECT * from illrequestattributes where illrequest_id = '<put your request ID here>' and type ='doi'; 5) Notice the value is saved with the leading whitespace. Apply patch. Repeat. Notice it no longer saves with the leading white space. Sponsored-by: NHS England
Created attachment 182672 [details] [review] Bug 39944: Add tests prove t/db_dependent/Koha/ILL/Request.t
Created attachment 182673 [details] [review] Bug 39944: Trim form params Test plan, ktd, before applying patch: 1) Enable ILLModule sys pref and create a new ILL request: <staff_url>/cgi-bin/koha/ill/ill-requests.pl?method=create&backend=Standard 2) Pick type 'journal article' and enter ' 123' to DOI (notice the leading white space) 3) Enter a cardnumber and a library. Click 'Create'. 4) Run the following SQL query (koha-mysql kohadev): $ SELECT * from illrequestattributes where illrequest_id = '<put your request ID here>' and type ='doi'; 5) Notice the value is saved with the leading whitespace. Apply patch. Repeat. Notice it no longer saves with the leading white space. Sponsored-by: NHS England