From 6779695ba052d61fb8c3fd9e3bfebf6606d1f18b 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 (cherry picked from commit cec6f46b47ae9625222f35014f6693ba7bb365e8) Signed-off-by: Fridolin Somers (cherry picked from commit 3c410ab3a3b0e1dbcae3e155a63333f1e630017f) Signed-off-by: Lucas Gass --- 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 5156c8fb98..32c9730f55 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