fix: [UI] First recorded change fixed to not be copy pasta of the last change's timestamp

pull/4430/head
iglocska 2019-04-04 15:00:05 +02:00
parent 9893a0839f
commit 251836ff97
2 changed files with 11 additions and 6 deletions

View File

@ -1238,9 +1238,15 @@ class EventsController extends AppController
$this->set('emptyEvent', $emptyEvent);
$attributeCount = isset($event['Attribute']) ? count($event['Attribute']) : 0;
$objectCount = isset($event['Object']) ? count($event['Object']) : 0;
$oldest_timestamp = false;
if (!empty($event['Object'])) {
foreach ($event['Object'] as $k => $object) {
if (!empty($object['Attribute'])) {
foreach ($object['Attribute'] as $attribute) {
if ($oldest_timestamp == false || $oldest_timestamp < $attribute['timestamp']) {
$oldest_timestamp = $attribute['timestamp'];
}
}
$attributeCount += count($object['Attribute']);
}
}
@ -1320,6 +1326,9 @@ class EventsController extends AppController
$startDate = null;
$modificationMap = array();
foreach ($event['Attribute'] as $k => $attribute) {
if ($oldest_timestamp == false || $oldest_timestamp < $attribute['timestamp']) {
$oldest_timestamp = $attribute['timestamp'];
}
if ($startDate === null || $attribute['timestamp'] < $startDate) {
$startDate = $attribute['timestamp'];
}
@ -1458,6 +1467,7 @@ class EventsController extends AppController
$orgTable = $this->Event->Orgc->find('list', array(
'fields' => array('Orgc.id', 'Orgc.name')
));
$this->set('oldest_timestamp', $oldest_timestamp);
$this->set('required_taxonomies', $this->Event->getRequiredTaxonomies());
$this->set('orgTable', $orgTable);
$this->set('currentUri', $attributeUri);
@ -5105,11 +5115,6 @@ class EventsController extends AppController
}
if (isset($result['results']['Object']) && !empty($result['results']['Object'])) {
foreach ($result['results']['Object'] as $tmp_object) {
if (!isset($tmp_object['distribution'])) {
$tmp_object['distribution'] = $defaultDistribution;
} else {
$tmp_object['distribution'] = (int)$tmp_object['distribution'];
}
foreach ($tmp_object['Attribute'] as &$tmp_attribute) {
$tmp_attribute = $this->__fillAttribute($tmp_attribute, $defaultDistribution);
}

View File

@ -188,7 +188,7 @@
);
$table_data[] = array(
'key' => __('First recorded change'),
'value' => date('Y-m-d H:i:s', $event['Event']['timestamp'])
'value' => date('Y-m-d H:i:s', $oldest_timestamp)
);
$table_data[] = array(
'key' => __('Last change'),