Bug 32456: Preserve date accessioned if a date is not explicitly passed

To test:
 1 - Edit an item record to have a blank date accessioned
 2 - Save the record as marcxml from the detail page
 3 - Edit the item to have an accession date
 4 - Stage and import the file - matching in KohaBiblio and replacing items
 5 - Import the file
 6 - Confirm the date accessioned is cleared
 7 - Apply patch
 8 - Provide an accession date for the item
 9 - Stage and import the file again
10 - Confirm the date remained
11 - Edit the item to remove the date
12 - Confirm you can manually blank the field

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 2255d42abd)
Signed-off-by: Jacob O'Mara <jacob.omara@ptfs-europe.com>
This commit is contained in:
Nick Clemens 2022-12-13 14:24:13 +00:00 committed by Jacob O'Mara
parent 811f676da0
commit 655cd366e0

View file

@ -307,6 +307,11 @@ sub ModItemFromMarc {
# to prevent it being blanked by set_or_blank
$item->{onloan} = $item_object->onloan if( $item_object->onloan && !defined $item->{onloan} );
# When importing and replacing items we should not remove the dateacquired so we should set it
# to the existing value
$item->{dateaccessioned} = $item_object->dateaccessioned
if ( $item_object->dateaccessioned && !defined $item->{dateaccessioned} );
my ( $perm_loc_tag, $perm_loc_subfield ) = C4::Biblio::GetMarcFromKohaField( "items.permanent_location" );
my $has_permanent_location = defined $perm_loc_tag && defined $item_marc->subfield( $perm_loc_tag, $perm_loc_subfield );