my $update = $input->param('op') eq 'set-cost-matrix'; The above code (line 45) causes a warn 'Use of unintialized value in string eq'
Created attachment 38880 [details] [review] Bug 14153: Noisy warns in admin/transport-cost-matrix.pl This patch silences the warn by putting curly braces around the $input->param('op') code, to kind of group this as a variable. I don't know that this is the best solution for this but the warn is no longer there. To test: 1) Go to Admin -> Transport cost matrix 2) Notice the warns in the error log 3) Apply the patch and refresh page 4) Notice page still works but no warns in error log
Comment on attachment 38880 [details] [review] Bug 14153: Noisy warns in admin/transport-cost-matrix.pl Review of attachment 38880 [details] [review]: ----------------------------------------------------------------- ::: admin/transport-cost-matrix.pl @@ +42,4 @@ > }); > my $use_transport_cost_matrix = C4::Context->preference("UseTransportCostMatrix"); > > +my $update = {$input->param('op')} eq 'set-cost-matrix'; Adding the curly brace here means that the code is trying to create an anonymous hash containing the contents of $input->param('op'), and that can't be compared to the scalar value 'set-cost-matrix'. Also, when trying to update an entry in the table, an "Odd number of elements in anonymous hash" error is thrown. Something like this would do the trick: my $update = ( $input->param('op') // '' ) eq 'set-cost-matrix';
Created attachment 45628 [details] [review] Bug 14153: Galen Charlton's fix to warns Changing line 45 to my $update = ( $input->param('op') // '' ) eq 'set-cost-matrix'; To test: 1) Go to Admin -> Transport cost matrix 2) Notice the warns in the error log 3) Apply the patch and refresh page 4) Notice page still works but no warns in error log
Created attachment 46011 [details] [review] Bug 14153: Noisy warns in admin/transport-cost-matrix.pl To test: 1) Go to Admin -> Transport cost matrix 2) Notice the warns in the error log 3) Apply the patch and refresh page 4) Notice page still works but no warns in error log Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Amended patch: Init a $op variable, if it must be reused later.
Trivial, skipping QA.
Created attachment 46065 [details] [review] Bug 14153: Noisy warns in admin/transport-cost-matrix.pl To test: 1) Go to Admin -> Transport cost matrix 2) Notice the warns in the error log 3) Apply the patch and refresh page 4) Notice page still works but no warns in error log Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Amended patch: Init a $op variable, if it must be reused later. Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
Pushed to Master - thanks
(In reply to Brendan Gallagher from comment #6) > Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> > Amended patch: Init a $op variable, if it must be reused later. Note that I have not made this change finally.
Patch pushed to 3.22.x, will be in 3.22.2
This patch has been pushed to 3.20.x, will be in 3.20.8.