Verified Commit 3572d7b0 authored by Alexis Ragot's avatar Alexis Ragot
Browse files

Fix "unlimited" duration on retention rule management and on view

parent 47766a8c
......@@ -55,9 +55,9 @@ class accessRule
if ($accessRule->duration == null) {
continue;
}
if ($accessRule->duration->y >= 999999999) {
if ($accessRule->duration->y >= 9999) {
$accessRule->duration = null;
$accessRule->durationUnit = "Unlimited";
$accessRule->durationUnit = "unlimited";
}
}
......
......@@ -438,7 +438,7 @@ trait archiveEntryTrait
}
$archive->disposalDate = null;
if (!empty($archive->retentionStartDate) && !empty($archive->retentionDuration) && $archive->retentionDuration->y < 999) {
if (!empty($archive->retentionStartDate) && !empty($archive->retentionDuration) && $archive->retentionDuration->y < 9999) {
$archive->disposalDate = $archive->retentionStartDate->shift($archive->retentionDuration);
}
}
......
......@@ -73,6 +73,9 @@ trait archiveModificationTrait
*/
public function modifyRetentionRule($retentionRule, $archiveIds)
{
$retentionRuleReceived = $retentionRule;
if (!is_array($archiveIds)) {
$archiveIds = array($archiveIds);
}
......@@ -95,33 +98,37 @@ trait archiveModificationTrait
$operationResult = false;
} else {
$retentionRule = clone($retentionRuleReceived);
$retentionRule->archiveId = $archiveId;
// Update current object for caller
if (!$retentionRule->changeStartDate) {
if ($retentionRule->changeStartDate === false) {
$retentionRule->retentionStartDate = $archive->retentionStartDate;
}
if (empty($retentionRule->retentionRuleCode)) {
$retentionRule->retentionRuleCode = $archive->retentionRuleCode;
$retentionRule->retentionDuration = $archive->retentionDuration;
}
if (!empty($retentionRule->retentionDuration) && !empty($retentionRule->retentionStartDate)) {
$retentionRule->disposalDate = $this->calculateDate($retentionRule->retentionStartDate, $retentionRule->retentionDuration);
}
if ($retentionRule->retentionDuration === '') {
$retentionRule->retentionDuration = null;
}
if ($retentionRule->finalDisposition === null) {
$retentionRule->finalDisposition = $archive->finalDisposition;
} elseif ($retentionRule->finalDisposition === '') {
$retentionRule->finalDisposition = null;
}
if ($retentionRule->retentionDuration === '') {
$retentionRule->retentionDuration = null;
} elseif (!empty($retentionRule->retentionDuration) && $retentionRule->retentionDuration->y >= 9999) {
$retentionRule->disposalDate = '';
} else {
if (!empty($retentionRule->retentionDuration) && !empty($retentionRule->retentionStartDate)) {
$retentionRule->disposalDate = $this->calculateDate($retentionRule->retentionStartDate, $retentionRule->retentionDuration);
}
}
if ($retentionRule->disposalDate === '') {
$retentionRule->disposalDate = null;
}
......
......@@ -991,5 +991,5 @@ msgstr "Ne pas mettre à jour le sort final"
msgid "Edit metadata"
msgstr "Modifier les métadonnées"
msgid "unlimited"
msgid "Unlimited"
msgstr "Illimitée"
\ No newline at end of file
......@@ -150,7 +150,7 @@ file that was distributed with this source code.
serialize : function() {
if ($('#accessRuleDurationUnit').val() == "*") {
accessRuleDuration = 'P' + 999999999 + 'Y';
accessRuleDuration = 'P' + 9999 + 'Y';
} else if ($('#accesRuleDuration').val() == 0) {
accessRuleDuration = 0;
......
......@@ -52,12 +52,21 @@
<br/>
</span>
<b>DUA</b>:&nbsp;
<?merge archive.retentionDuration ?>&nbsp;
<?merge archive.retentionDurationUnit.ifeq('Y') ?><span>Year(s)</span>
<?merge archive.retentionDurationUnit.ifeq('M') ?><span>Month(s)</span>
<?merge archive.retentionDurationUnit.ifeq('D') ?><span>Day(s)</span>
<i class="fa fa-info-circle " style="color: #b43d3d" id="descriptionLevelText" aria-hidden="true" title="Durée légale ou pratique de conservation des données et/ou documents, au terme de laquelle leur sort final est appliqué."></i><br/>
<?merge archive.retentionDuration.ifgte(9999) ?>
<div>
<b>DUA</b>:&nbsp;<span>Unlimited</span>
<i class="fa fa-info-circle " style="color: #b43d3d" id="descriptionLevelText" aria-hidden="true" title="Durée légale ou pratique de conservation des données et/ou documents, au terme de laquelle leur sort final est appliqué."></i><br/>
</div>
<?merge archive.retentionDuration.iflte(9998) ?>
<div>
<b>DUA</b>:
<?merge archive.retentionDuration ?>&nbsp;
<?merge archive.retentionDurationUnit.ifeq('Y') ?><span>Year(s)</span>
<?merge archive.retentionDurationUnit.ifeq('M') ?><span>Month(s)</span>
<?merge archive.retentionDurationUnit.ifeq('D') ?><span>Day(s)</span>
<i class="fa fa-info-circle " style="color: #b43d3d" id="descriptionLevelText" aria-hidden="true" title="Durée légale ou pratique de conservation des données et/ou documents, au terme de laquelle leur sort final est appliqué."></i><br/>
</div>
<br/>
<?merge archive.finalDisposition.ifeq('destruction') ?>
......
......@@ -56,6 +56,7 @@
<span id="text_Y">year(s)</span>
<span id="text_preservation">preservation</span>
<span id="text_destruction">destruction</span>
<span id="text_unlimited">Unlimited</span>
</div>
<style>
......
......@@ -272,7 +272,7 @@
serialize: function() {
if ($('#durationUnit').val() == "*") {
duration = 'P' + 999999999 + 'Y';
duration = 'P' + 9999 + 'Y';
} else if ($('#duration').val() == 0) {
duration = 0;
} else {
......
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