From 1803a3fc17c7c4df27e4bce6eb79cd7862460b6d Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Wed, 3 Mar 2021 08:33:21 -0500 Subject: [PATCH] Bug 27837: Update permanent location if passed into ModItemFromMarc Signed-off-by: Andrew Fuerste-Henry Signed-off-by: Rhonda Kuiper Signed-off-by: Tomas Cohen Arazi Signed-off-by: Katrin Fischer Signed-off-by: Martin Renvoize Signed-off-by: Jonathan Druart (cherry picked from commit 97647da9a0541cb02ab0777ead388c8ff99a0424) Signed-off-by: Fridolin Somers (cherry picked from commit ed682c0f0acc5093dc8198efac3fd770ffea8d86) Signed-off-by: Andrew Fuerste-Henry --- C4/Items.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/C4/Items.pm b/C4/Items.pm index 81f3231e1b..96328f6017 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -308,6 +308,8 @@ sub ModItemFromMarc { my $item_object = Koha::Items->find($itemnumber); my $item = TransformMarcToKoha( $localitemmarc, $frameworkcode, 'items' ); + my $has_permanent_location = $item->{permanent_location}; + # Retrieving the values for the fields that are not linked my @mapped_fields = Koha::MarcSubfieldStructures->search( { @@ -330,6 +332,8 @@ sub ModItemFromMarc { $item_object = $item_object->set_or_blank($item); $item_object->cn_sort($existing_cn_sort); # Resetting to the existing value + $item_object->make_column_dirty('permanent_location') if $has_permanent_location; + my $unlinked_item_subfields = _get_unlinked_item_subfields( $localitemmarc, $frameworkcode ); $item_object->more_subfields_xml(_get_unlinked_subfields_xml($unlinked_item_subfields)); $item_object->store({ skip_record_index => $params->{skip_record_index} }); -- 2.39.5