mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-19 15:22:17 +02:00
#540 Data synchro: the option "write if empty" was not implemented
SVN:1.2[1933]
This commit is contained in:
@@ -1736,10 +1736,23 @@ class SynchroReplica extends DBObject implements iDisplay
|
|||||||
$value = $this->GetValueFromExtData($sAttCode, $oSyncAtt, $oStatLog);
|
$value = $this->GetValueFromExtData($sAttCode, $oSyncAtt, $oStatLog);
|
||||||
if (!is_null($value))
|
if (!is_null($value))
|
||||||
{
|
{
|
||||||
|
if ($oSyncAtt->Get('update_policy') == 'write_if_empty')
|
||||||
|
{
|
||||||
|
$oAttDef = MetaModel::GetAttributeDef(get_class($oDestObj), $sAttCode);
|
||||||
|
if ($oAttDef->IsNull($oDestObj->Get($sAttCode)))
|
||||||
|
{
|
||||||
|
// The value is still "empty" in the target object, we are allowed to write the new value
|
||||||
$oDestObj->Set($sAttCode, $value);
|
$oDestObj->Set($sAttCode, $value);
|
||||||
$aValueTrace[] = "$sAttCode: $value";
|
$aValueTrace[] = "$sAttCode: $value";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$oDestObj->Set($sAttCode, $value);
|
||||||
|
$aValueTrace[] = "$sAttCode: $value";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// Really modified ?
|
// Really modified ?
|
||||||
if ($oDestObj->IsModified())
|
if ($oDestObj->IsModified())
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user