From c2f73e084ed73200a09bbbf17c66a640fde9b987 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 --- C4/CourseReserves.pm | 6 +++--- .../en/modules/course_reserves/add_items-step2.tt | 8 ++++---- .../en/modules/course_reserves/course-details.tt | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/C4/CourseReserves.pm b/C4/CourseReserves.pm index c3e25e6..e1583dd 100644 --- a/C4/CourseReserves.pm +++ b/C4/CourseReserves.pm @@ -605,7 +605,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{$_} ); } @@ -671,9 +671,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 96bf783..57f757e 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 @@ -36,7 +36,7 @@ [% 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 %] @@ -52,7 +52,7 @@ [% 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 %] @@ -67,7 +67,7 @@ [% 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 %] @@ -82,7 +82,7 @@ [% FOREACH b IN branches %] - [% IF course_item.holdingbranch && ( ( course.enabled == 'yes' && b.value == item.holdingbranch ) || ( course.enabled == 'no' && b.value == course_item.holdingbranch ) ) %] + [% IF course_item.holdingbranch.defined && ( ( course.enabled == 'yes' && b.value == item.holdingbranch ) || ( course.enabled == 'no' && b.value == course_item.holdingbranch ) ) %] [% ELSE %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-details.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-details.tt index 08953f2..ca67708 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-details.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-details.tt @@ -83,7 +83,7 @@ [% cr.item.itemcallnumber %] [% IF item_level_itypes %] - [% IF cr.course_item.itype %] + [% IF cr.course_item.itype.defined %] [% IF cr.course_item.enabled == 'yes' %] [% ItemTypes.GetDescription( cr.item.itype ) %] [% ELSE %] @@ -98,7 +98,7 @@ [% END %] - [% IF cr.course_item.ccode %] + [% IF cr.course_item.ccode.defined %] [% IF cr.course_item.enabled == 'yes' %] [% AuthorisedValues.GetByCode( 'CCODE', cr.item.ccode ) %] [% ELSE %] @@ -112,7 +112,7 @@ [% END %] - [% IF cr.course_item.location %] + [% IF cr.course_item.location.defined %] [% IF cr.course_item.enabled == 'yes' %] [% AuthorisedValues.GetByCode( 'LOC', cr.item.location ) %] [% ELSE %] @@ -126,7 +126,7 @@ [% END %] - [% IF cr.course_item.holdingbranch %] + [% IF cr.course_item.holdingbranch.defined %] [% IF cr.course_item.enabled == 'yes' %] [% Branches.GetName( cr.item.holdingbranch ) %] [% ELSE %] -- 1.7.2.5