Skip to content

Commit

Permalink
WIP add mapSetOfLtext
Browse files Browse the repository at this point in the history
  • Loading branch information
Siilwyn committed Sep 22, 2016
1 parent 4340963 commit 4b065b8
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/coffee/exportmapping.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ class ExportMapping
else if attributeTypeDef.name is CONS.ATTRIBUTE_TYPE_SET and attributeTypeDef.elementType?.name is CONS.ATTRIBUTE_TYPE_LENUM
# we need special treatment for set of lenums
row = @_mapSetOfLenum(attribute, productType, row)
else if attributeTypeDef.name is CONS.ATTRIBUTE_TYPE_SET and attributeTypeDef.elementType?.name is CONS.ATTRIBUTE_TYPE_LTEXT
# we need special treatment for set of lenums
row = @_mapSetOfLtext(attribute, productType, row)
else if attributeTypeDef.name is CONS.ATTRIBUTE_TYPE_LENUM # we need special treatnemt for lenums
row = @_mapLenum(attribute, productType, row)
else if @header.has attribute.name
Expand Down Expand Up @@ -217,6 +220,18 @@ class ExportMapping
row[index] = attribute.value.key
row

_mapSetOfLtext: (attribute, productType, row) ->
h2i = @header.productTypeAttributeToIndex productType, attribute

for lang, index of h2i
row[index] = _.reduce(attribute.value, (memo, val, index) ->
if typeof val[lang] is 'undefined' then return memo

memo += GLOBALS.DELIM_MULTI_VALUE unless index is 0
memo + val[lang]
, '')
row

_mapSetAttribute: (attribute, attributeTypeDef) ->
switch attributeTypeDef.elementType.name
when CONS.ATTRIBUTE_TYPE_ENUM
Expand Down

0 comments on commit 4b065b8

Please sign in to comment.