Commit ef42a494 authored by Jerome Boucher's avatar Jerome Boucher
Browse files

Merge branch 'fix/8340_DurationDisplay' into 'develop'

Fix/8340 duration display

See merge request maarch/thirdPartyArchiving!63
parents 55931d50 7ade38c4
......@@ -324,12 +324,36 @@ class message
}
}
}
if (isset($messageObject->archive)) {
foreach ($messageObject->archive as $archive) {
if (isset($archive->appraisalRule)) {
$dateInter = new \DateInterval($archive->appraisalRule->duration);
$numberDuration = 0;
$toDisplay = '';
if ($dateInter->y != 0) {
if ($dateInter->y == 999999999) {
$toDisplay = "Unlimited";
} else {
$numberDuration = $dateInter->y;
$toDisplay = "Year(s)";
}
} elseif ($dateInter->m != 0) {
$numberDuration = $dateInter->m;
$toDisplay = "Month(s)";
} elseif ($dateInter->d != 0) {
$numberDuration = $dateInter->d;
$toDisplay = "Day(s)";
}
$archive->appraisalRule->durationNumber = $numberDuration;
$archive->appraisalRule->durationToDisplay = $toDisplay;
}
}
}
$messageObjects[] = $messageObject;
}
end($messageObjects)->last = true;
$this->view->addContentFile($baseMessage->schema."/message/messageModal.html");
$messageDiv = $this->view->getElementById('[?merge .messageId ?]');
......@@ -357,7 +381,7 @@ class message
$dataTable->setPaginationType("full_numbers");
$dataTable->setSorting(array(array(0, 'desc')));
}
$this->view->setSource('messages', $messageObjects);
$this->view->merge();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment