@@ -, +, @@ --- C4/Items.pm | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) --- a/C4/Items.pm +++ a/C4/Items.pm @@ -537,6 +537,7 @@ sub ModItem { $item->{onloan} = undef if $item->{itemlost}; + # Only call GetItem if we need to set an "on" date field if ( $item->{itemlost} || $item->{wthdrawn} ) { my $pre_mod_item = GetItem( $item->{'itemnumber'} ); for my $field (qw( itemlost wthdrawn )) { @@ -553,6 +554,14 @@ sub ModItem { } } } + # If the field is defined but empty, we are removing and, + # and thus need to clear out the 'on' field as well + if ( defined( $item->{itemlost} ) && !$item->{itemlost} ) { + $item->{itemlost_on} = undef; + } + if ( defined( $item->{wthdrawn} ) && !$item->{wthdrawn} ) { + $item->{wthdrawn_on} = undef; + } _set_derived_columns_for_mod($item); _do_column_fixes_for_mod($item); --