Verified Commit e7b00483 authored by Arnaud Pauget's avatar Arnaud Pauget
Browse files

Add propreties on appraisalRule for correctly displaying it

parent a1d0ef76
...@@ -315,11 +315,29 @@ class message ...@@ -315,11 +315,29 @@ class message
} }
} }
foreach ($messageObject->archive as $archive) {
if (isset($archive->appraisalRule)) {
$dateInter = new \DateInterval($archive->appraisalRule->duration);
$numberDuration = 0;
$toDisplay = '';
if ($dateInter->y != 0) {
$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; $messageObjects[] = $messageObject;
} }
end($messageObjects)->last = true; end($messageObjects)->last = true;
$this->view->addContentFile($baseMessage->schema."/message/messageModal.html"); $this->view->addContentFile($baseMessage->schema."/message/messageModal.html");
$messageDiv = $this->view->getElementById('[?merge .messageId ?]'); $messageDiv = $this->view->getElementById('[?merge .messageId ?]');
...@@ -347,6 +365,7 @@ class message ...@@ -347,6 +365,7 @@ class message
$dataTable->setPaginationType("full_numbers"); $dataTable->setPaginationType("full_numbers");
$dataTable->setSorting(array(array(0, 'desc'))); $dataTable->setSorting(array(array(0, 'desc')));
} }
// var_dump($messageObjects[0]->archive[0]->appraisalRule);
$this->view->setSource('messages', $messageObjects); $this->view->setSource('messages', $messageObjects);
$this->view->merge(); $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