my ( @fields_to_update, @values_to_update );
foreach (@FIELDS) {
- if ( $params{$_} ) {
+ if ( defined($params{$_}) ) {
push( @fields_to_update, $_ );
push( @values_to_update, $params{$_} );
}
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{};
}
}
<option value="">LEAVE UNCHANGED</option>
[% 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 ) ) %]
<option value="[% it.itemtype | html %]" selected="selected">[% it.description | html %]</option>
[% ELSE %]
<option value="[% it.itemtype | html %]">[% it.description | html %]</option>
<option value="">LEAVE UNCHANGED</option>
[% 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 ) ) %]
<option value="[% c.authorised_value | html %]" selected="selected">[% c.lib | html %]</option>
[% ELSE %]
<option value="[% c.authorised_value | html %]">[% c.lib | html %]</option>
<option value="">LEAVE UNCHANGED</option>
[% 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 ) ) %]
<option value="[% s.authorised_value | html %]" selected="selected">[% s.lib | html %]</option>
[% ELSE %]
<option value="[% s.authorised_value | html %]">[% s.lib | html %]</option>
<select id="holdingbranch" name="holdingbranch">
<option value="">LEAVE UNCHANGED</option>
[% FOREACH b IN Branches.all() %]
- [% IF course_item.holdingbranch && ( ( course.enabled == 'yes' && b.branchcode == item.holdingbranch ) || ( course.enabled == 'no' && b.branchcode == course_item.holdingbranch ) ) %]
+ [% IF course_item.holdingbranch.defined && ( ( course.enabled == 'yes' && b.value == item.holdingbranch ) || ( course.enabled == 'no' && b.value == course_item.holdingbranch ) ) %]
<option value="[% b.branchcode | html %]" selected="selected">[% b.branchname | html %]</option>
[% ELSE %]
<option value="[% b.branchcode | html %]">[% b.branchname | html %]</option>
<td>[% cr.item.itemcallnumber | html %]</td>
[% IF item_level_itypes %]
<td>
- [% IF cr.course_item.itype %]
+ [% IF cr.course_item.itype.defined %]
[% IF cr.course_item.enabled == 'yes' %]
[% ItemTypes.GetDescription( cr.item.itype ) | html %]
[% ELSE %]
</td>
[% END %]
<td>
- [% IF cr.course_item.ccode %]
+ [% IF cr.course_item.ccode.defined %]
[% IF cr.course_item.enabled == 'yes' %]
[% AuthorisedValues.GetByCode( 'CCODE', cr.item.ccode ) | html %]
[% ELSE %]
[% END %]
</td>
<td>
- [% IF cr.course_item.location %]
+ [% IF cr.course_item.location.defined %]
[% IF cr.course_item.enabled == 'yes' %]
[% AuthorisedValues.GetByCode( 'LOC', cr.item.location ) | html %]
[% ELSE %]
[% END %]
</td>
<td>
- [% IF cr.course_item.holdingbranch %]
+ [% IF cr.course_item.holdingbranch.defined %]
[% IF cr.course_item.enabled == 'yes' %]
[% Branches.GetName( cr.item.holdingbranch ) | html %]
[% ELSE %]