From cec6f46b47ae9625222f35014f6693ba7bb365e8 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 5 Aug 2019 10:54:57 -0500 Subject: [PATCH] Bug 22142: Do not revert data if 'unchanged' was set Signed-off-by: Kyle M Hall Signed-off-by: Katrin Fischer Signed-off-by: Martin Renvoize --- C4/CourseReserves.pm | 1 + t/db_dependent/CourseReserves/CourseItems.t | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/C4/CourseReserves.pm b/C4/CourseReserves.pm index 39630b63c9..2c130af192 100644 --- a/C4/CourseReserves.pm +++ b/C4/CourseReserves.pm @@ -590,6 +590,7 @@ sub _RevertFields { my $mod_item_params; foreach my $field ( @FIELDS ) { + next unless defined $course_item->{$field}; $mod_item_params->{$field} = $course_item->{$field}; } diff --git a/t/db_dependent/CourseReserves/CourseItems.t b/t/db_dependent/CourseReserves/CourseItems.t index 38ceaa39e3..c5ce9652ff 100644 --- a/t/db_dependent/CourseReserves/CourseItems.t +++ b/t/db_dependent/CourseReserves/CourseItems.t @@ -23,7 +23,7 @@ use C4::CourseReserves qw/ModCourseItem ModCourseReserve DelCourseReserve GetCou use C4::Context; use Koha::Items; -use Test::More tests => 28; +use Test::More tests => 29; BEGIN { require_ok('C4::CourseReserves'); -- 2.39.5