lib/rfm/layout.rb in ginjo-rfm-2.1.2 vs lib/rfm/layout.rb in ginjo-rfm-2.1.3
- old
+ new
@@ -395,22 +395,22 @@
# check for errors
error = doc['FMPXMLLAYOUT']['ERRORCODE'].to_s.to_i
raise Rfm::Error::FileMakerError.getError(error) if error != 0
# process valuelists
- vlists = doc['FMPXMLLAYOUT']['VALUELISTS']['VALUELIST']
+ vlists = [doc['FMPXMLLAYOUT']['VALUELISTS']['VALUELIST']].flatten
if !vlists.nil? #root.elements['VALUELISTS'].size > 0
vlists.each {|valuelist|
name = valuelist['NAME']
- @value_lists[name] = valuelist['VALUE'].collect{|value|
+ @value_lists[name] = [valuelist['VALUE']].flatten.collect{|value|
Rfm::Metadata::ValueListItem.new(value['__content__'], value['DISPLAY'], name)
} rescue []
}
@value_lists.freeze
end
# process field controls
- doc['FMPXMLLAYOUT']['LAYOUT']['FIELD'].each {|field|
+ [doc['FMPXMLLAYOUT']['LAYOUT']['FIELD']].flatten.each {|field|
name = field_mapping[field['NAME']] || field['NAME']
style = field['STYLE']
type = style['TYPE']
value_list_name = style['VALUELIST']
value_list = @value_lists[value_list_name] if value_list_name != ''
\ No newline at end of file