From e3b0d10f59107a27dee3cb8c78f9082b79ff7d9c Mon Sep 17 00:00:00 2001
From: juanf <juanf>
Date: Fri, 28 Apr 2017 08:20:29 +0000
Subject: [PATCH] SSDM-4868 : DOCX export, don't export properties with value
 \uFFFD(undefined)

SVN: 38103
---
 .../1/dss/reporting-plugins/exports-api/exports-api.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/dss/reporting-plugins/exports-api/exports-api.py b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/dss/reporting-plugins/exports-api/exports-api.py
index 652be349196..d84f62d3cbe 100644
--- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/dss/reporting-plugins/exports-api/exports-api.py
+++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/dss/reporting-plugins/exports-api/exports-api.py
@@ -467,7 +467,8 @@ def getDOCX(entityObj, v3, sessionToken, isHTML):
             propertyType = propertyAssigment.getPropertyType();
             if propertyType.getCode() in properties:
                 propertyValue = properties[propertyType.getCode()];
-                docxBuilder.addProperty(propertyType.getLabel(), propertyValue);
+                if propertyValue != u"\uFFFD(undefined)":
+                    docxBuilder.addProperty(propertyType.getLabel(), propertyValue);
     
     if isHTML:
         return docxBuilder.getHTMLBytes();
@@ -541,9 +542,10 @@ def getTXT(entityObj, v3, sessionToken, isRichText):
 			propertyType = propertyAssigment.getPropertyType();
 			if propertyType.getCode() in properties:
 				propertyValue = properties[propertyType.getCode()];
-				if(propertyType.getDataType() == DataType.MULTILINE_VARCHAR and isRichText is False):
-					propertyValue = strip_tags(propertyValue).strip();
-				txtBuilder.append("- ").append(propertyType.getLabel()).append(": ").append(propertyValue).append("\n");
+                if propertyValue != u"\uFFFD(undefined)":
+    				if(propertyType.getDataType() == DataType.MULTILINE_VARCHAR and isRichText is False):
+    					propertyValue = strip_tags(propertyValue).strip();
+    				txtBuilder.append("- ").append(propertyType.getLabel()).append(": ").append(propertyValue).append("\n");
 	
 	return txtBuilder.toString();
 	
-- 
GitLab