Bug 23083: Fix course reserve item editing if one of the value is set to UNCHANGED
[koha-equinox.git] / C4 / CourseReserves.pm
index 428d7e9..39630b6 100644 (file)
@@ -531,11 +531,12 @@ sub _UpdateCourseItem {
       unless ($course_item);
     $ci_id = $course_item->{'ci_id'} unless ($ci_id);
 
-
-    my %mod_params;
-    foreach (@FIELDS) {
-        $mod_params{$_} = $params{$_};
-    }
+    my %mod_params =
+      map {
+        defined $params{$_} && $params{$_} ne ''
+          ? ( $_ => $params{$_} )
+          : ()
+      } @FIELDS;
 
     ModItem( \%mod_params, undef, $course_item->{'itemnumber'} );
 }