cataloguing/additem.pl has this code: my $number_of_copies = min( scalar $input->param('number_of_copies'), 1000 ); # TODO refine hardcoded maximum? "number_of_copies" comes from the "Add multiple copies of this item" feature. The field for entering the number of copies defaults to empty, and this results in this warning, from the code above: [WARN] Argument "" isn't numeric in subroutine entry at /usr/share/koha/intranet/cgi-bin/cataloguing/additem.pl line 233. We could fix this a couple of ways: - Make the number_of_copies field default to 1 - Fix the code, so 1 is used for number_of_copies, if the input is empty
I would do this: - my $number_of_copies = min( scalar $input->param('number_of_copies'), 1000 ); # TODO refine hardcoded maximum? + my $number_of_copies = min( $input->param('number_of_copies') || 0, 1000 ); # TODO refine hardcoded maximum?
Created attachment 159338 [details] [review] Bug 35414: Silence warn related to number_of_copies To test in ktd: - Tail the logs with "sudo tail -f /var/log/koha/kohadev/plack*.log" - Find a record in the staff client - Add an item to the record - Observe "[WARN] Argument "" isn't numeric in subroutine entry ..." in /var/log/koha/kohadev/plack-intranet-error.log - Apply this patch - restart_all - Tail the logs again - Add another item - Observe the absence of the earlier warning Thanks to Jonathan Druart for suggesting this particular solution!
Created attachment 159365 [details] [review] Bug 35414: Silence warn related to number_of_copies To test in ktd: - Tail the logs with "sudo tail -f /var/log/koha/kohadev/plack*.log" - Find a record in the staff client - Add an item to the record - Observe "[WARN] Argument "" isn't numeric in subroutine entry ..." in /var/log/koha/kohadev/plack-intranet-error.log - Apply this patch - restart_all - Tail the logs again - Add another item - Observe the absence of the earlier warning Thanks to Jonathan Druart for suggesting this particular solution! Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Created attachment 159425 [details] [review] Bug 35414: Silence warn related to number_of_copies To test in ktd: - Tail the logs with "sudo tail -f /var/log/koha/kohadev/plack*.log" - Find a record in the staff client - Add an item to the record - Observe "[WARN] Argument "" isn't numeric in subroutine entry ..." in /var/log/koha/kohadev/plack-intranet-error.log - Apply this patch - restart_all - Tail the logs again - Add another item - Observe the absence of the earlier warning Thanks to Jonathan Druart for suggesting this particular solution! Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Pushed for 24.05! Well done everyone, thank you!
Pushed to 23.11.x for 23.11.01
Backported to 23.05.x for upcoming 23.05.07