Verified Commit 6196b1ad authored by Arnaud Pauget's avatar Arnaud Pauget
Browse files

Fix bug if no archives is in message

parent e7b00483
......@@ -314,24 +314,25 @@ 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)";
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) {
$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;
}
$archive->appraisalRule->durationNumber = $numberDuration;
$archive->appraisalRule->durationToDisplay = $toDisplay;
}
}
$messageObjects[] = $messageObject;
......
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