Fixed bugs on CSV import (was not working fine when exporting/importing incident tickets)

SVN:trunk[316]
This commit is contained in:
Romain Quetiez
2010-03-12 13:48:39 +00:00
parent 5b4057aebb
commit f454ebf4b5
4 changed files with 65 additions and 44 deletions

View File

@@ -130,6 +130,7 @@ abstract class AttributeDefinition
public function IsExternalField() {return false;}
public function IsWritable() {return false;}
public function IsNullAllowed() {return true;}
public function GetNullValue() {return null;}
public function GetCode() {return $this->m_sCode;}
public function GetLabel() {return $this->Get("label");}
public function GetDescription() {return $this->Get("description");}
@@ -328,7 +329,6 @@ class AttributeDBFieldVoid extends AttributeDefinition
public function IsNullAllowed() {return false;}
protected function ScalarToSQL($value) {return $value;} // format value as a valuable SQL literal (quoted outside)
protected function SQLToScalar($value) {return $value;} // take the result of a fetch... and make it a PHP variable
public function GetSQLExpressions()
{
@@ -483,12 +483,6 @@ class AttributeInteger extends AttributeDBField
assert(is_numeric($value));
return $value; // supposed to be an int
}
public function SQLToScalar($value)
{
// Use cast (int) or intval() ?
return (int)$value;
}
}
/**
@@ -525,11 +519,6 @@ class AttributeBoolean extends AttributeInteger
if ($value) return 1;
return 0;
}
public function SQLToScalar($value)
{
// Use cast (int) or intval() ?
return (int)$value;
}
}
/**
@@ -610,10 +599,6 @@ class AttributeString extends AttributeDBField
}
return $value;
}
public function SQLToScalar($value)
{
return $value;
}
public function GetAsCSV($sValue, $sSeparator = ',', $sTextQualifier = '"')
{
@@ -986,10 +971,6 @@ class AttributeDate extends AttributeDBField
}
return $value;
}
public function SQLToScalar($value)
{
return $value;
}
public function GetAsHTML($value)
{
@@ -1047,6 +1028,7 @@ class AttributeExternalKey extends AttributeDBFieldVoid
public function GetDefaultValue() {return 0;}
public function IsNullAllowed() {return $this->Get("is_null_allowed");}
public function GetNullValue() {return 0;}
public function GetBasicFilterOperators()
{
@@ -1093,6 +1075,11 @@ class AttributeExternalKey extends AttributeDBFieldVoid
{
return $this->Get("on_target_delete");
}
public function MakeRealValue($proposedValue)
{
return (int)$proposedValue;
}
}
/**
@@ -1226,11 +1213,6 @@ class AttributeExternalField extends AttributeDefinition
$oExtAttDef = $this->GetExtAttDef();
return $oExtAttDef->ScalarToSQL($value);
}
public function SQLToScalar($value)
{
$oExtAttDef = $this->GetExtAttDef();
return $oExtAttDef->SQLToScalar($value);
}
// Do not overload GetSQLExpression here because this is handled in the joins