diff --git a/synchro/synchrodatasource.class.inc.php b/synchro/synchrodatasource.class.inc.php index 349241697..67ddc9363 100644 --- a/synchro/synchrodatasource.class.inc.php +++ b/synchro/synchrodatasource.class.inc.php @@ -69,9 +69,10 @@ class SynchroDataSource extends cmdbAbstractObject MetaModel::Init_AddAttribute(new AttributeString("delete_policy_retention", array("allowed_values"=>null, "sql"=>"delete_policy_retention", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); MetaModel::Init_AddAttribute(new AttributeLinkedSet("attribute_list", array("linked_class"=>"SynchroAttribute", "ext_key_to_me"=>"sync_source_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeLinkedSet("status_list", array("linked_class"=>"SynchroLog", "ext_key_to_me"=>"sync_source_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array()))); // Display lists - MetaModel::Init_SetZListItems('details', array('name', 'description', 'scope_class', 'scope_restriction', 'status', 'user_id', 'full_load_periodicity', 'reconciliation_policy', 'action_on_zero', 'action_on_one', 'action_on_multiple', 'delete_policy', 'delete_policy_update', 'delete_policy_retention', /*'attribute_list'*/)); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('details', array('name', 'description', 'scope_class', 'scope_restriction', 'status', 'user_id', 'full_load_periodicity', 'reconciliation_policy', 'action_on_zero', 'action_on_one', 'action_on_multiple', 'delete_policy', 'delete_policy_update', 'delete_policy_retention' /*'attribute_list'*/, 'status_list')); // Attributes to be displayed for the complete details MetaModel::Init_SetZListItems('list', array('scope_class', 'status', 'user_id', 'full_load_periodicity')); // Attributes to be displayed for a list // Search criteria MetaModel::Init_SetZListItems('standard_search', array('name', 'status', 'scope_class', 'user_id')); // Criteria of the std search form @@ -116,8 +117,8 @@ class SynchroDataSource extends cmdbAbstractObject if (!$bEditMode) { // Read-only mode - $aRow['reconciliation'] = $oAttribute->Get('reconcile') == 1 ? Dict::S('UI:Synchro:Yes') : Dict::S('UI:Synchro:No'); - $aRow['update'] = $oAttribute->Get('update') == 1 ? Dict::S('UI:Synchro:Yes') : Dict::S('UI:Synchro:No'); + $aRow['reconciliation'] = $oAttribute->Get('reconcile') == 1 ? Dict::S('Core:SynchroReconcile:Yes') : Dict::S('Core:SynchroReconcile:No'); + $aRow['update'] = $oAttribute->Get('update') == 1 ? Dict::S('Core:SynchroUpdate:Yes') : Dict::S('Core:SynchroUpdate:No'); $aRow['attcode'] = MetaModel::GetLabel($this->GetTargetClass(), $oAttribute->Get('attcode')); $aRow['update_policy'] = $oAttribute->GetAsHTML('update_policy'); } @@ -137,6 +138,92 @@ class SynchroDataSource extends cmdbAbstractObject } } $oPage->Table($aAttribs, $aValues); + $oPage->SetCurrentTab(Dict::S('Core:SynchroStatus')); + + $sSelectSynchroLog = 'SELECT SynchroLog WHERE sync_source_id = :source_id'; + $oSetSynchroLog = new CMDBObjectSet(DBObjectSearch::FromOQL($sSelectSynchroLog), array('start_date' => false) /* order by*/, array('source_id' => $this->GetKey())); + + if ($oSetSynchroLog->Count() > 0) + { + $oLastLog = $oSetSynchroLog->Fetch(); + $sStartDate = $oLastLog->Get('start_date'); + $oLastLog->Get('stats_nb_seen'); + $iModified = $oLastLog->Get('stats_nb_modified'); + $iErrors = $oLastLog->Get('stats_nb_errors'); + $iCreated = $oLastLog->Get('stats_nb_created'); + $iDeleted = $oLastLog->Get('stats_nb_deleted'); + $oLastLog->Get('stats_nb_reconciled'); + if ($oLastLog->Get('status') == 'running') + { + // Still running ! + $oPage->p('
| Ignored ($iIgnored) | + | |
| Disappeared ($iDisappeared) | => | Deleted ($iDeleted) | +
| Obsoleted ($iObsoleted) | +||
| Errors ($iDisappearedErrors) | +||
| Existing ($iExisting) | => | Unchanged ($iUnchanged) | +
| Updated ($iUpdated) | +||
| Errors ($iUpdatedErrors) | +||
| New ($iNew) | => | Errors ($iNewErrors) | +
| Reconciled ($iReconciled) | +||
| Created ($iCreated) | +||