From f79615d5cf1aaf44097df044ad65aef756bef61f Mon Sep 17 00:00:00 2001
From: Nick Clemens <nick@bywatersolutions.com>
Date: Thu, 16 Dec 2021 16:21:46 +0000
Subject: [PATCH] Bug 29719: Do not clear onloan value when not passed in MARC

To test:
 1 - Check an item out to a paron
 2 - Export the item using Tools->Export data
 3 - Stage the record for import
 4 - Match on 999c and replace items
 5 - Import the batch
 6 - View the record and note item is checked out and Available
 7 - In the DB note the onloan value is now null
 8 - Check in the item
 9 - Apply patch
10 - Repeat 1-5
11 - View the record and note item is checked out
12 - In the DB note the onloan value matches the due date
---
 Koha/Object.pm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Koha/Object.pm b/Koha/Object.pm
index 54edbd38a0..adb7b3de28 100644
--- a/Koha/Object.pm
+++ b/Koha/Object.pm
@@ -299,6 +299,7 @@ sub set_or_blank {
 
     foreach my $col ( keys %{$columns_info} ) {
 
+        next if $col eq 'onloan'; # Do not blank onloan field
         next if exists $properties->{$col};
 
         if ( $columns_info->{$col}->{is_nullable} ) {
-- 
2.20.1