...
 
Commits (2)
......@@ -69,28 +69,7 @@ class message
foreach ($messages as $message) {
if (isset($message->object->archive)) {
foreach ($message->object->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;
}
$this->presentRules($archive);
}
}
}
......@@ -102,4 +81,43 @@ class message
return $this->view->saveHtml();
}
protected function presentRules($archive)
{
$archive->hasManagement = false;
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;
$archive->hasManagement = true;
if (!empty($archive->archiveUnit)) {
foreach ($archive->archiveUnit as $archiveUnit) {
$this->presentRules($archiveUnit);
}
}
}
if (isset($archive->accessRestrictionRule)) {
$archive->hasManagement = true;
}
}
}
\ No newline at end of file
......@@ -11,38 +11,7 @@
<div class="panel-body">
<?hinclude seda/message/contentDescription.html ?>
<?merge .appraisalRule.bool() ?>
<dl class="dl-horizontal" data-translate-catalog="medona/messages">
<h4>Appraisal rule</h4>
<dt>Code</dt>
<dd translate="no">
<?merge .appraisalRule.code.ifeq('detruire') ?><span>Détruire</span>
<?merge .appraisalRule.code.ifeq('conserver') ?><span>Conserver</span>
</dd>
<dt>Duration</dt>
<dd>
<?merge .appraisalRule.durationNumber.bool() ?>
<span><?merge .appraisalRule.durationNumber ?></span>
<?merge .appraisalRule.durationToDisplay.bool() ?>
<span><?merge .appraisalRule.durationToDisplay ?></span>
</dd>
<dt>Start date</dt>
<dd translate="no">
<?merge .appraisalRule.startDate ?>
</dd>
</dl>
<?merge .accessRestrictionRule.bool() ?>
<dl class="dl-horizontal"data-translate-catalog="medona/messages">
<h4>Access restrition rule</h4>
<dt>Code</dt>
<dd translate="no">
<?merge .accessRestrictionRule.code ?>
</dd>
<dt>Start date</dt>
<dd translate="no">
<?merge .accessRestrictionRule.startDate ?>
</dd>
</dl>
<?hinclude seda/message/managementMetadata.html ?>
<?merge .document /seda/message/document.html?>
<?merge .archiveObject /seda/message/archiveObject.html ?>
......
<?merge .hasManagement ?>
<div class="panel panel-warning">
<div class="panel-heading" role="tab">
<h4 class="panel-title">
......@@ -8,6 +9,7 @@
</div>
<div id="managementMetadata[?merge .id ?]" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingOne">
<div class="panel-body">
<?merge .appraisalRule.bool() ?>
<dl class="dl-horizontal" data-translate-catalog="medona/messages">
<h4>Appraisal rule</h4>
<dt>Code</dt>
......@@ -27,6 +29,8 @@
<?merge .appraisalRule.startDate ?>
</dd>
</dl>
<?merge .accessRestrictionRule.bool() ?>
<dl class="dl-horizontal"data-translate-catalog="medona/messages">
<h4>Access restrition rule</h4>
<dt>Code</dt>
......