Explorar o código

N.707 Export of custom fields: improved the xlsx format and implemented the spreadsheet format (both are aligned)

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@4935 a333f486-631f-4898-b8df-5754b55c2be0
romainq %!s(int64=7) %!d(string=hai) anos
pai
achega
188d4e83c3

+ 1 - 1
core/attributedef.class.inc.php

@@ -7406,7 +7406,7 @@ class AttributeCustomFields extends AttributeDefinition
 
 	public function GetEditValue($sValue, $oHostObj = null)
 	{
-		return 'GetEditValueNotImplemented for '.get_class($this);
+		return $this->GetForTemplate($sValue, '', $oHostObj, true);
 	}
 
 	/**

+ 0 - 5
core/excelbulkexport.class.inc.php

@@ -188,11 +188,6 @@ EOF
 				$oAttDef = MetaModel::GetAttributeDef(get_class($oObj), $sAttCode);
 				$sRet = $oAttDef->GetAsCSV($value, '', '', $oObj);
 			}
-			else if ($value instanceOf ormCustomFieldsValue)
-			{
-				$oAttDef = MetaModel::GetAttributeDef(get_class($oObj), $sAttCode);
-				$sRet = $oAttDef->GetAsCSV($value, "\n", '', $oObj);
-			}
 			else
 			{
 				$oAttDef = MetaModel::GetAttributeDef(get_class($oObj), $sAttCode);

+ 8 - 1
core/spreadsheetbulkexport.class.inc.php

@@ -175,7 +175,8 @@ EOF
 				}
 				elseif ($oAttDef instanceof AttributeCustomFields)
 				{
-					$sRet = $oObj->GetAsHTML($sAttCode);
+					// Stick to the weird implementation made in GetNextChunk
+					$sRet = utils::TextToHtml($oObj->GetEditValue($sAttCode));
 				}
 				else
 				{
@@ -326,6 +327,12 @@ EOF
 							}
 							$sData .= "<td x:str>$sField</td>";
 						}
+						elseif ($oAttDef instanceof AttributeCustomFields)
+						{
+							// GetAsHTML returns a table that would not fit
+							$sField = utils::TextToHtml($oObj->GetEditValue($sAttCode));
+							$sData .= "<td x:str>$sField</td>";
+						}
 						else if($oAttDef instanceof AttributeString)
 						{
 							$sField = $oObj->GetAsHTML($sAttCode, $this->bLocalizeOutput);