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

@@ -568,10 +568,32 @@ abstract class DBObject
$aDelta = array();
foreach ($aProposal as $sAtt => $proposedValue)
{
if (!array_key_exists($sAtt, $this->m_aOrigValues) || ($this->m_aOrigValues[$sAtt] !== $proposedValue))
if (!array_key_exists($sAtt, $this->m_aOrigValues))
{
// The value was not set
$aDelta[$sAtt] = $proposedValue;
}
elseif(is_object($proposedValue))
{
// The value is an object, the comparison is not strict
// #@# todo - should be even less strict => add verb on AttributeDefinition: Compare($a, $b)
if ($this->m_aOrigValues[$sAtt] != $proposedValue)
{
$aDelta[$sAtt] = $proposedValue;
}
}
else
{
// The value is a scalar, the comparison must be 100% strict
if($this->m_aOrigValues[$sAtt] !== $proposedValue)
{
//echo "$sAtt:<pre>\n";
//var_dump($this->m_aOrigValues[$sAtt]);
//var_dump($proposedValue);
//echo "</pre>\n";
$aDelta[$sAtt] = $proposedValue;
}
}
}
return $aDelta;
}