I believe this regression was introduced by bug 35151, by setting the $params->{branchcode} to the patron's branchcode, overwriting the form selection. The intent of that code was so that the patron's branchcode would then be used as a search parameter for the respective's library ILLModuleCopyrightClearance additional contents, but caused this unintended side effect. To reproduce: 1) Enable ILLModule 2) Logged in as koha:koha, create an OPAC request, visit: <opac_url>/cgi-bin/koha/opac-illrequests.pl?op=add_form&backend=Standard 3) Pick any library not Centerville (the default library of the 'koha' user) 4) Notice the created request's library is CPL (Centerville). It ignored the library selection from the form.
Created attachment 189491 [details] [review] Bug 41237: Update fetch of patron's branchcode to search additional_contents by
Created attachment 189492 [details] [review] Bug 41237: Add tests Test plan, k-t-d: 1) Apply tests patch, run: prove t/db_dependent/Koha/ILL/Requests.t 2) Notice it fails. Apply the second patch. Repeat. Notice it passes. Test failure explanation (before fix patch): # Failed test 'Cardnumber not supplied and couldnt find additional_contents for all libraries. Dont show copyrightclearance' # at t/db_dependent/Koha/ILL/Requests.t line 1067. # got: 'copyrightclearance' # expected: 'commit' Its searching the copyrightclearance additional_contents for the provided branchcode param (illrq->patron->branchcode) (and finding one) when it shouldn't. That parameter is only to be utilized for the newly created ILL request's library. The branchcode filter of the additional_contents must the be logged in user's cardnumber, not params->{branchcode}. If no logged in user exists and this stage is reached (ILLOpacUnauthenticatedRequest), then only 'All libraries' ILLModuleCopyrightClearance are to be fetched, as expected. Human test plan, before applying patches: 1) Enable ILLModule 2) Logged in as koha:koha, create an OPAC request, visit: <opac_url>/cgi-bin/koha/opac-illrequests.pl?op=add_form&backend=Standard 3) Pick any library not Centerville (the default library of the 'koha' user) 4) Notice the created request's library is CPL (Centerville). It ignored the library selection from the form. 5) Apply patches. Repeat. Notice the request's library is now the one that was selected on the form.
Created attachment 189493 [details] [review] Bug 41237: Update fetch of patron's branchcode to search additional_contents by Signed-off-by: Stephen Graham <s.graham4@herts.ac.uk>
Created attachment 189494 [details] [review] Bug 41237: Add tests Test plan, k-t-d: 1) Apply tests patch, run: prove t/db_dependent/Koha/ILL/Requests.t 2) Notice it fails. Apply the second patch. Repeat. Notice it passes. Test failure explanation (before fix patch): # Failed test 'Cardnumber not supplied and couldnt find additional_contents for all libraries. Dont show copyrightclearance' # at t/db_dependent/Koha/ILL/Requests.t line 1067. # got: 'copyrightclearance' # expected: 'commit' Its searching the copyrightclearance additional_contents for the provided branchcode param (illrq->patron->branchcode) (and finding one) when it shouldn't. That parameter is only to be utilized for the newly created ILL request's library. The branchcode filter of the additional_contents must the be logged in user's cardnumber, not params->{branchcode}. If no logged in user exists and this stage is reached (ILLOpacUnauthenticatedRequest), then only 'All libraries' ILLModuleCopyrightClearance are to be fetched, as expected. Human test plan, before applying patches: 1) Enable ILLModule 2) Logged in as koha:koha, create an OPAC request, visit: <opac_url>/cgi-bin/koha/opac-illrequests.pl?op=add_form&backend=Standard 3) Pick any library not Centerville (the default library of the 'koha' user) 4) Notice the created request's library is CPL (Centerville). It ignored the library selection from the form. 5) Apply patches. Repeat. Notice the request's library is now the one that was selected on the form. Signed-off-by: Stephen Graham <s.graham4@herts.ac.uk>
Created attachment 189514 [details] [review] [24.11.x] Bug 41237: Update fetch of patron's branchcode to search additional_contents by Signed-off-by: Stephen Graham <s.graham4@herts.ac.uk>