From 93413ba6aae8a50d47e5c177227e832e8bb012a9 Mon Sep 17 00:00:00 2001 From: Emily Lamancusa Date: Wed, 25 Jun 2025 12:53:02 -0400 Subject: [PATCH] Bug 39871: Don't pass undef for non-nullable fields from batch mod tool To test: 1. Set not-for-loan, withdrawn, and damaged statuses on some items 2. Try to edit only those items with the Batch item modification tool 3. Check the checkboxes to clear the withdrawn, not-for-loan, and damaged statuses 4. Click Save 5. View the background job report --> Note that it says the items could not be modified 6. Look at the items --> The statuses have not been cleared 7. Apply patch and restart_all 8. Repeat steps 2-5 --> The background job report says the modifications were successful 9. View the items --> The statuses have been cleared Signed-off-by: David Flater --- tools/batchMod.pl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/batchMod.pl b/tools/batchMod.pl index 92f19d2929..64892af373 100755 --- a/tools/batchMod.pl +++ b/tools/batchMod.pl @@ -137,7 +137,13 @@ if ( $op eq "cud-action" ) { if ( grep { $cgi_var_name eq $_ } @subfields_to_blank ) { # Empty this column - $new_item_data->{$attr} = undef; + if ( $attr eq 'withdrawn' || $attr eq 'itemlost' || $attr eq 'damaged' || $attr eq 'notforloan' ) { + + # these fields are not nullable; they must be set to 0 instead + $new_item_data->{$attr} = 0; + } else { + $new_item_data->{$attr} = undef; + } } elsif ( my $regex_search = $input->param( $cgi_var_name . '_regex_search' ) ) { $columns_with_regex->{$attr} = { search => $regex_search, -- 2.39.5