diff --git a/application/cmdbabstract.class.inc.php b/application/cmdbabstract.class.inc.php index 0f92218c4..e2f0ca8d2 100644 --- a/application/cmdbabstract.class.inc.php +++ b/application/cmdbabstract.class.inc.php @@ -110,19 +110,19 @@ abstract class cmdbAbstractObject extends CMDBObject implements iDisplay if ($oReplicaSet->Count() > 0) { $bSynchronized = true; - $sTip = "

The object is synchronized with an external data source

"; + $sTip = "

".Dict::S('Core:Synchro:ThisObjectIsSynchronized')."

"; while($aData = $oReplicaSet->FetchAssoc()) { // Assumption: $aData['datasource'] will not be null because the data source id is always set... $sApplicationURL = $aData['datasource']->GetApplicationUrl($this, $aData['replica']); - $sLink = ''; + $sLink = $aData['datasource']->GetName(); if (!empty($sApplicationURL)) { - $sLink = "".$aData['datasource']->GetName().""; + $sLink = "".$aData['datasource']->GetName().""; } if ($aData['replica']->Get('status_dest_creator') == 1) { - $sTip .= "

The object was created by the external data source $sLink

"; + $sTip .= "

".Dict::Format('Core:Synchro:TheObjectWasCreatedBy_Source', $sLink)."

"; $bCreated = true; } if ($bCreated) @@ -131,23 +131,25 @@ abstract class cmdbAbstractObject extends CMDBObject implements iDisplay if (($sDeletePolicy == 'delete') || ($sDeletePolicy == 'update_then_delete')) { $bCanBeDeleted = true; - $sTip .= "

The object can be deleted by the external data source $sLink

"; + $sTip .= "

".Dict::Format('Core:Synchro:TheObjectCanBeDeletedBy_Source', $sLink)."

"; } } $aMasterSources[$aData['datasource']->GetKey()]['datasource'] = $aData['datasource']; $aMasterSources[$aData['datasource']->GetKey()]['url'] = $sLink; + $aMasterSources[$aData['datasource']->GetKey()]['last_synchro'] = $aData['replica']->Get('status_last_seen'); } } $sSynchroIcon = ''; if ($bSynchronized) { - $sTip .= "

List of data sources:

"; + $sTip .= "

".Dict::S('Core:Synchro:ListOfDataSources')."

"; foreach($aMasterSources as $aStruct) { $oDataSource = $aStruct['datasource']; $sLink = $aStruct['url']; - $sTip .= "

".$oDataSource->GetIcon(true, 'style="vertical-align:middle"')." $sLink

"; + $sTip .= "

".$oDataSource->GetIcon(true, 'style="vertical-align:middle"')." $sLink
"; + $sTip .= Dict::S('Core:Synchro:LastSynchro').'
'.$aStruct['last_synchro']."

"; } $sSynchroIcon = ' '; $oPage->add_ready_script("$('#synchro_icon').qtip( { content: '$sTip', show: 'mouseover', hide: 'unfocus', style: { name: 'dark', tip: 'leftTop' }, position: { corner: { target: 'rightMiddle', tooltip: 'leftTop' }} } );"); @@ -384,6 +386,8 @@ abstract class cmdbAbstractObject extends CMDBObject implements iDisplay $val = $this->GetFieldAsHtml($sClass, $sAttCode, $sStateAttCode); if ($val != null) { + /* + * Removed for now... // Check if the attribute is not mastered by a synchro... $aReasons = array(); $iSynchroFlags = $this->GetSynchroReplicaFlags($sAttCode, $aReasons); @@ -400,6 +404,7 @@ abstract class cmdbAbstractObject extends CMDBObject implements iDisplay } $val['comments'] = $sSynchroIcon; + */ // The field is visible, add it to the current column $aDetails[$sTab][$sColIndex][] = $val; $iInputId++; diff --git a/dictionaries/dictionary.itop.core.php b/dictionaries/dictionary.itop.core.php index 163e95bf4..8698f8099 100644 --- a/dictionaries/dictionary.itop.core.php +++ b/dictionaries/dictionary.itop.core.php @@ -552,6 +552,12 @@ Dict::Add('EN US', 'English', 'English', array( 'Core:SynchroAtt:update_policy+' => 'Behavior of the updated field', 'Core:SynchroAtt:reconciliation_attcode' => 'Reconciliation Key', 'Core:SynchroAtt:reconciliation_attcode+' => 'Attribute Code for the External Key Reconciliation', + 'Core:SyncDataExchangeComment' => '(DataExchange)', + 'Core:Synchro:ListOfDataSources' => 'List of data sources:', + 'Core:Synchro:LastSynchro' => 'Last synchronization:', + 'Core:Synchro:ThisObjectIsSynchronized' => 'This object is synchronized with an external data source', + 'Core:Synchro:TheObjectWasCreatedBy_Source' => 'The object was created by the external data source %1$s', + 'Core:Synchro:TheObjectCanBeDeletedBy_Source' => 'The object can be deleted by the external data source %1$s', )); diff --git a/synchro/synchrodatasource.class.inc.php b/synchro/synchrodatasource.class.inc.php index 1ccd775e2..4f125edb8 100644 --- a/synchro/synchrodatasource.class.inc.php +++ b/synchro/synchrodatasource.class.inc.php @@ -301,14 +301,14 @@ EOF $oPage->add($this->HtmlBox('obj_obsoleted', $aData, '#630')); $oPage->add("\n"); $sOQL = urlencode($sBaseOQL." AND status='obsolete'"); - $oPage->add($this->HtmlBox('obj_disappeared_errors', $aData, '#C00', '', " Show")); + $oPage->add($this->HtmlBox('obj_disappeared_errors', $aData, '#C00', '', " Show")); $oPage->add("\n"); $oPage->add($this->HtmlBox('repl_existing', $aData, '#093', 'rowspan="3"').'=>'.$this->HtmlBox('obj_unchanged', $aData, '#393')); $oPage->add("\n"); $oPage->add($this->HtmlBox('obj_updated', $aData, '#3C3')); $oPage->add("\n"); $sOQL = urlencode($sBaseOQL." AND status='modified'"); - $oPage->add($this->HtmlBox('obj_updated_errors', $aData, '#C00', '', " Show")); + $oPage->add($this->HtmlBox('obj_updated_errors', $aData, '#C00', '', " Show")); $oPage->add("\n"); $oPage->add($this->HtmlBox('repl_new', $aData, '#339', 'rowspan="4"').'=>'.$this->HtmlBox('obj_new_unchanged', $aData, '#393')); $oPage->add("\n"); @@ -317,7 +317,7 @@ EOF $oPage->add($this->HtmlBox('obj_created', $aData, '#339')); $oPage->add("\n"); $sOQL = urlencode($sBaseOQL." AND status='new'"); - $oPage->add($this->HtmlBox('obj_new_errors', $aData, '#C00', '', " Show")); + $oPage->add($this->HtmlBox('obj_new_errors', $aData, '#C00', '', " Show")); $oPage->add("\n\n"); $oPage->add(''); $oPage->add_ready_script("UpdateSynoptics('$iLastLog')"); @@ -659,7 +659,7 @@ EOF $oMyChange = MetaModel::NewObject("CMDBChange"); $oMyChange->Set("date", time()); $sUserString = CMDBChange::GetCurrentUserName(); - $oMyChange->Set("userinfo", $sUserString); + $oMyChange->Set("userinfo", $sUserString.' '.Dict::S('Core:SyncDataExchangeComment')); $iChangeId = $oMyChange->DBInsert(); // Start logging this execution (stats + protection against reentrance) @@ -763,7 +763,7 @@ EOF } elseif ($this->Get('reconciliation_policy') == 'use_primary_key') { - // Override the setings made at the attribute level ! + // Override the settings made at the attribute level ! $aReconciliationKeys = array("primary_key" => null); } @@ -840,11 +840,12 @@ EOF } $oReplica->UpdateDestObject($aToUpdate, $oMyChange, $oStatLog); $oReplica->Set('status', 'obsolete'); + $oReplica->Set('info_last_synchro', date('Y-m-d H:i:s')); $oReplica->DBUpdateTracked($oMyChange); break; - case 'delete': - default: + case 'delete': + default: $oStatLog->AddTrace("Destination object to be DELETED", $oReplica); $oReplica->DeleteDestObject($oMyChange, $oStatLog); } @@ -862,7 +863,7 @@ EOF while($oReplica = $oSetToSync->Fetch()) { - $oReplica->Synchro($this, $aReconciliationKeys, $aAttributes, $oMyChange, $oStatLog); + $oReplica->Synchro($this, $aReconciliationKeys, $aAttributes, $oMyChange, $oStatLog); } // Get all the replicas that are to be deleted @@ -1446,6 +1447,7 @@ class SynchroReplica extends DBObject implements iDisplay $oDestObj->DBUpdateTracked($oChange); $oStatLog->AddTrace('Updated object - Values: {'.implode(', ', $aValueTrace).'}', $this); $oStatLog->Inc($sStatsCode.'_updated'); + $this->Set('info_last_modified', date('Y-m-d H:i:s')); } else { @@ -1489,6 +1491,7 @@ class SynchroReplica extends DBObject implements iDisplay $this->Set('status_dest_creator', true); $this->Set('status_last_error', ''); $this->Set('status', 'synchronized'); + $this->Set('info_creation_date', date('Y-m-d H:i:s')); $oStatLog->AddTrace("Created (".implode(', ', $aValueTrace).")", $this); $oStatLog->Inc('stats_nb_obj_created'); @@ -1520,6 +1523,7 @@ class SynchroReplica extends DBObject implements iDisplay { $oDestObj->Set($sAttCode, $value); } + $this->Set('info_last_modified', date('Y-m-d H:i:s')); $oDestObj->DBUpdateTracked($oChange); $oStatLog->AddTrace("Replica marked as obsolete", $this); $oStatLog->Inc('stats_nb_obj_obsoleted'); @@ -1719,7 +1723,7 @@ class SynchroReplica extends DBObject implements iDisplay { $oAdminMenu = new MenuGroup('AdminTools', 80 /* fRank */); new OQLMenuNode('DataSources', 'SELECT SynchroDataSource', $oAdminMenu->GetIndex(), 12 /* fRank */, true, 'SynchroDataSource', UR_ACTION_MODIFY, UR_ALLOWED_YES); - new OQLMenuNode('Replicas', 'SELECT SynchroReplica', $oAdminMenu->GetIndex(), 12 /* fRank */, true, 'SynchroReplica', UR_ACTION_MODIFY, UR_ALLOWED_YES); - new WebPageMenuNode('Test:RunSynchro', '../synchro/synchro_exec.php', $oAdminMenu->GetIndex(), 13 /* fRank */, 'SynchroDataSource'); +// new OQLMenuNode('Replicas', 'SELECT SynchroReplica', $oAdminMenu->GetIndex(), 12 /* fRank */, true, 'SynchroReplica', UR_ACTION_MODIFY, UR_ALLOWED_YES); +// new WebPageMenuNode('Test:RunSynchro', '../synchro/synchro_exec.php', $oAdminMenu->GetIndex(), 13 /* fRank */, 'SynchroDataSource'); } ?> \ No newline at end of file