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 <flaterdavid@gmail.com>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 341c93ee58)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
Emily Lamancusa 2025-06-25 12:53:02 -04:00 committed by Paul Derscheid
parent 377602a36d
commit 2e206204c6
No known key found for this signature in database
GPG Key ID: C25F9FD44CED595B
1 changed files with 7 additions and 1 deletions

View File

@ -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,