From 9b428ec7ed43c3926483aa692315efdebb545f7b Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Wed, 5 Jun 2013 10:01:17 -0400 Subject: [PATCH] Bug 10382: collection not returning to null when removed from course reserves Test Plan: 1) Create an item, do not set a collection code 2) Add the item to a course, and choose to set a collection code 3) Ensure the course is enabled, and the collection code is now visible 4) Disable the course, ensure the collection code is no longer visible Signed-off-by: Josef Moravec Signed-off-by: Marcel de Rooy Signed-off-by: Nick Clemens (cherry picked from commit b1bb9f9e6b028dce0109755180100e4033424227) Signed-off-by: Martin Renvoize --- C4/CourseReserves.pm | 6 +++--- .../modules/course_reserves/add_items-step2.tt | 16 ++++++++-------- .../en/modules/course_reserves/course-details.tt | 8 ++++---- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/C4/CourseReserves.pm b/C4/CourseReserves.pm index 2b1ef027df..a6ee227430 100644 --- a/C4/CourseReserves.pm +++ b/C4/CourseReserves.pm @@ -604,7 +604,7 @@ sub _ModStoredFields { my ( @fields_to_update, @values_to_update ); foreach (@FIELDS) { - if ( $params{$_} ) { + if ( defined($params{$_}) ) { push( @fields_to_update, $_ ); push( @values_to_update, $params{$_} ); } @@ -670,9 +670,9 @@ sub _SwapAllFields { my %course_item_fields; my %item_fields; foreach (@FIELDS) { - if ( $course_item->{$_} ) { + if ( defined( $course_item->{$_} ) ) { $course_item_fields{$_} = $course_item->{$_}; - $item_fields{$_} = $item->{$_}; + $item_fields{$_} = $item->{$_} || q{}; } } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/add_items-step2.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/add_items-step2.tt index 9389d576fd..5f76eb534b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/add_items-step2.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/add_items-step2.tt @@ -39,8 +39,8 @@ [% FOREACH it IN itypes %] - [% IF course_item.itype && ( ( course.enabled == 'yes' && it.itemtype == item.itype ) || ( course.enabled == 'no' && it.itemtype == course_item.itype ) ) %] - + [% IF course_item.itype.defined && ( ( course.enabled == 'yes' && it.itemtype == item.itype ) || ( course.enabled == 'no' && it.itemtype == course_item.itype ) ) %] + [% ELSE %] [% END %] @@ -55,8 +55,8 @@ [% FOREACH c IN ccodes %] - [% IF course_item.ccode && ( ( course.enabled == 'yes' && c.authorised_value == item.ccode ) || ( course.enabled == 'no' && c.authorised_value == course_item.ccode ) ) %] - + [% IF course_item.ccode.defined && ( ( course.enabled == 'yes' && c.authorised_value == item.ccode ) || ( course.enabled == 'no' && c.authorised_value == course_item.ccode ) ) %] + [% ELSE %] [% END %] @@ -70,8 +70,8 @@ [% FOREACH s IN locations %] - [% IF course_item.location && ( ( course.enabled == 'yes' && s.authorised_value == item.location ) || ( course.enabled == 'no' && s.authorised_value == course_item.location ) ) %] - + [% IF course_item.location.defined && ( ( course.enabled == 'yes' && s.authorised_value == item.location ) || ( course.enabled == 'no' && s.authorised_value == course_item.location ) ) %] + [% ELSE %] [% END %] @@ -84,8 +84,8 @@