If you have UseCashRegisters set to "Don't use" and in intranet try to change a library you are currently logged in at (/cgi-bin/koha/circ/set-library.pl) then you get the following warning in the logs: plack-intranet-error.log: > Use of uninitialized value $register_id in string ne at /usr/share/koha/intranet/cgi-bin/circ/set-library.pl line 81.
Created attachment 139966 [details] [review] Bug 28167: Remove uninitialized variable warnings from circ/set-library.pl With UseCashRegisters syspref disabled going to the page /cgi-bin/koha/circ/set-library.pl in staff interface and setting a library gives the following errors in plack-intranet-error.log: Use of uninitialized value $register_id in string ne at /kohadevbox/koha/circ/set-library.pl line 79. Use of uninitialized value $referer in pattern match (m//) at /kohadevbox/koha/circ/set-library.pl line 114. In the if clause $userenv_register_id appears to be typoed, it should have been $register_id as $userenv_register_id is always defined. As for the $referer variable, it is undef if there is no referer so let's just initialize it to an empty string for the regex so it doesn't give the warning. To test: 1) Go directly to /cgi-bin/koha/circ/set-library.pl by typing it in the URL bar and set a library 2) Make sure plack-intranet-error.log doesn't contain the above mentioned errors after applying this patch
Created attachment 140505 [details] [review] Bug 28167: Remove uninitialized variable warnings from circ/set-library.pl With UseCashRegisters syspref disabled going to the page /cgi-bin/koha/circ/set-library.pl in staff interface and setting a library gives the following errors in plack-intranet-error.log: Use of uninitialized value $register_id in string ne at /kohadevbox/koha/circ/set-library.pl line 79. Use of uninitialized value $referer in pattern match (m//) at /kohadevbox/koha/circ/set-library.pl line 114. In the if clause $userenv_register_id appears to be typoed, it should have been $register_id as $userenv_register_id is always defined. As for the $referer variable, it is undef if there is no referer so let's just initialize it to an empty string for the regex so it doesn't give the warning. To test: 1) Go directly to /cgi-bin/koha/circ/set-library.pl by typing it in the URL bar and set a library 2) Make sure plack-intranet-error.log doesn't contain the above mentioned errors after applying this patch Signed-off-by: David Nind <david@davidnind.com>
Created attachment 140569 [details] [review] Bug 28167: Remove uninitialized variable warnings from circ/set-library.pl With UseCashRegisters syspref disabled going to the page /cgi-bin/koha/circ/set-library.pl in staff interface and setting a library gives the following errors in plack-intranet-error.log: Use of uninitialized value $register_id in string ne at /kohadevbox/koha/circ/set-library.pl line 79. Use of uninitialized value $referer in pattern match (m//) at /kohadevbox/koha/circ/set-library.pl line 114. In the if clause $userenv_register_id appears to be typoed, it should have been $register_id as $userenv_register_id is always defined. As for the $referer variable, it is undef if there is no referer so let's just initialize it to an empty string for the regex so it doesn't give the warning. To test: 1) Go directly to /cgi-bin/koha/circ/set-library.pl by typing it in the URL bar and set a library 2) Make sure plack-intranet-error.log doesn't contain the above mentioned errors after applying this patch Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Nice catch Joonas, cleans up the warning nicely and no regressions found. Passing QA
Pushed to master for 22.11. Nice work everyone, thanks!
Backported to 22.05.x for upcoming 22.05.07 release
applied to 21.11 for 21.11.14
Not backported to oldoldstable (21.05.x). Feel free to ask if it's needed. Nothing to document it seems, marking resolved.