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
Automatic patch test results: â ï¸ The patch applies with fuzzy option (ignoring whitespace). This may indicate minor conflicts that need to be resolved. Details: Patch applies with fuzzy option (ignoring whitespace) This is an automated message from the patch testing system.
Created attachment 189929 [details] [review] Bug 39944: Add tests prove t/db_dependent/Koha/ILL/Request.t
Created attachment 189930 [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 190019 [details] [review] Bug 39944: Add tests prove t/db_dependent/Koha/ILL/Request.t
Created attachment 190020 [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 CONCAT('(', REPLACE(value, ' ', ' '), ')') AS 'Value with parenthesis concatenated' FROM illrequestattributes WHERE illrequest_id = 1 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 190022 [details] [review] Bug 39944: Add tests prove t/db_dependent/Koha/ILL/Request.t Signed-off-by: Richard Bridgen <richard.bridgen@nhs.net>
Created attachment 190023 [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 CONCAT('(', REPLACE(value, ' ', ' '), ')') AS 'Value with parenthesis concatenated' FROM illrequestattributes WHERE illrequest_id = 1 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 Signed-off-by: Richard Bridgen <richard.bridgen@nhs.net>