From: Kyle M Hall Date: Wed, 29 Apr 2020 14:40:21 +0000 (-0400) Subject: Bug 24772: Don't revert course item fields when deleting a course item unless it... X-Git-Url: http://git.equinoxoli.org/?p=koha-equinox.git;a=commitdiff_plain;h=04813346c84157902d5926e3128ec147138cfa49 Bug 24772: Don't revert course item fields when deleting a course item unless it is enabled Deactivating a from Course Reserves reverts Item's Shelving Location correctly, then deleting the same course reverts the Course Reserve Items to old shelving location values. Test Plan: 1) Add items to a Course - make sure they all have shelving locations prior to being added to the course. 2) When adding items change their shelving location to something else. See that Shelving Location has changed; permanent location in parentheses 3) Deactivated course See that Shelving Location has changed back to its original location 4) Deleted course See that Shelving Location has changed back to what was picked during adding it to the Course. 5) Apply this patch, restart all the things! 6) Repeat steps 1-4, note the shelvig location is not lost! Signed-off-by: Victor Grousset/tuxayo Signed-off-by: Hannah Olsen Signed-off-by: Martin Renvoize --- diff --git a/C4/CourseReserves.pm b/C4/CourseReserves.pm index 3799fb8..595f0b7 100644 --- a/C4/CourseReserves.pm +++ b/C4/CourseReserves.pm @@ -702,7 +702,10 @@ sub DelCourseItem { return unless ($ci_id); - _RevertFields( ci_id => $ci_id ); + my $course_item = Koha::Course::Items->find( $ci_id ); + return unless $course_item; + + _RevertFields( ci_id => $ci_id ) if $course_item->enabled eq 'yes'; my $query = " DELETE FROM course_items