Verified Commit 0b21dedc authored by Alexandre Morin's avatar Alexandre Morin
Browse files

Final disposition management

parent 3f10514c
...@@ -110,7 +110,9 @@ trait archiveModificationTrait ...@@ -110,7 +110,9 @@ trait archiveModificationTrait
$retentionRule->retentionDuration = null; $retentionRule->retentionDuration = null;
} }
if ($retentionRule->finalDisposition === '') { if ($retentionRule->finalDisposition === null) {
$retentionRule->finalDisposition = $archive->finalDisposition;
} elseif ($retentionRule->finalDisposition === '') {
$retentionRule->finalDisposition = null; $retentionRule->finalDisposition = null;
} }
......
...@@ -62,14 +62,18 @@ class retentionRule ...@@ -62,14 +62,18 @@ class retentionRule
*/ */
public function index($retentionRule) public function index($retentionRule)
{ {
//$this->view->addHeaders(); $publicArchives = \laabs::configuration('presentation.maarchRM')['publicArchives'];
//$this->view->useLayout();
$this->view->addContentFile('recordsManagement/retentionRule/index.html'); $this->view->addContentFile('recordsManagement/retentionRule/index.html');
$this->view->translate(); $this->view->translate();
$dataTable = $this->view->getElementById("rulesTable")->plugin['dataTable']; $dataTable = $this->view->getElementById("rulesTable")->plugin['dataTable'];
$dataTable->setPaginationType("full_numbers"); $dataTable->setPaginationType("full_numbers");
$dataTable->setUnsortableColumns(5);
if ($publicArchives) {
$dataTable->setUnsortableColumns(4);
} else {
$dataTable->setUnsortableColumns(5);
}
foreach ($retentionRule as $rule) { foreach ($retentionRule as $rule) {
if (!isset($rule->durationUnit)) { if (!isset($rule->durationUnit)) {
...@@ -77,8 +81,13 @@ class retentionRule ...@@ -77,8 +81,13 @@ class retentionRule
$rule->duration = substr($rule->duration, 1, -1); $rule->duration = substr($rule->duration, 1, -1);
$rule->durationUnit = $this->view->translator->getText($rule->durationUnit, "duration", "recordsManagement/retentionRule"); $rule->durationUnit = $this->view->translator->getText($rule->durationUnit, "duration", "recordsManagement/retentionRule");
} }
$rule->finalDispositionTran = $this->view->translator->getText($rule->finalDisposition, false, "recordsManagement/retentionRule");
if (!$publicArchives) {
$rule->finalDispositionTran = $this->view->translator->getText($rule->finalDisposition, false, "recordsManagement/retentionRule");
}
} }
$this->view->setSource('publicArchives', $publicArchives);
$this->view->setSource('retentionRule', $retentionRule); $this->view->setSource('retentionRule', $retentionRule);
$this->view->merge(); $this->view->merge();
...@@ -93,6 +102,7 @@ class retentionRule ...@@ -93,6 +102,7 @@ class retentionRule
*/ */
public function listRules($retentionRule) public function listRules($retentionRule)
{ {
$publicArchives = \laabs::configuration('presentation.maarchRM')['publicArchives'];
$this->view->addContentFile('recordsManagement/retentionRule/list.html'); $this->view->addContentFile('recordsManagement/retentionRule/list.html');
$this->view->translate(); $this->view->translate();
...@@ -107,6 +117,7 @@ class retentionRule ...@@ -107,6 +117,7 @@ class retentionRule
$rule->durationUnit = $this->view->translator->getText($rule->durationUnit, "duration", "recordsManagement/retentionRule"); $rule->durationUnit = $this->view->translator->getText($rule->durationUnit, "duration", "recordsManagement/retentionRule");
} }
$this->view->setSource('publicArchives', $publicArchives);
$this->view->setSource('retentionRule', $retentionRule); $this->view->setSource('retentionRule', $retentionRule);
$this->view->merge(); $this->view->merge();
......
...@@ -971,3 +971,6 @@ msgstr "Aucune organisation sélectionnée" ...@@ -971,3 +971,6 @@ msgstr "Aucune organisation sélectionnée"
msgid "You have to choose a working organization unit to proceed this action." msgid "You have to choose a working organization unit to proceed this action."
msgstr "L'utilisateur courant n'est affecté à aucune organisation. Contactez votre administrateur." msgstr "L'utilisateur courant n'est affecté à aucune organisation. Contactez votre administrateur."
msgid "Do not update the final disposition"
msgstr "Ne pas mettre à jour le sort final"
...@@ -5,43 +5,68 @@ ...@@ -5,43 +5,68 @@
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-condensed"> <table class="table table-condensed">
<tbody> <tbody>
<tr id="selectedArchiveId"><td><strong>Reference</strong></td><td><span></span></td></tr> <tr id="selectedArchiveId">
<tr id="selectedArchiveReference"><td><strong>Archive name</strong></td><td><span></span></td></tr> <td><strong>Reference</strong></td>
<tr id="startDate" style="display: none;"><td><strong>Start date</strong></td><td><input class='form-control input-sm ruleInput datePicker' name="startDate"></td></tr> <td><span></span></td>
<tr id="accessCode"><td><strong>Code</strong></td><td> </tr>
<tr id="selectedArchiveReference">
<td><strong>Archive name</strong></td>
<td><span></span></td>
</tr>
<tr id="startDate" style="display: none;">
<td><strong>Start date</strong></td>
<td><input class='form-control input-sm ruleInput datePicker' name="startDate"></td>
</tr>
<tr id="finalDisposition">
<td><strong>Final disposition</strong></td>
<td>
<select id="retentionRuleFinalDisposition" name="retentionRuleFinalDisposition" class="form-control">
<option value=''> To be defined later</option>
<option value='destruction'>Destruction</option>
<option value='preservation'>Preservation</option>
</select>
<div id="updateFinalDisposition" style="display: none;">
<input id="checkboxUpdateFinalDisposition" type="checkbox"> Do not update the final disposition
</div>
</td>
</tr>
<tr id="accessCode">
<td><strong>Code</strong></td>
<td>
<select id="accessRuleCode" name="accessRuleCode" class="form-control input-sm ruleInputAccess"> <select id="accessRuleCode" name="accessRuleCode" class="form-control input-sm ruleInputAccess">
<option value="">Select a rule</option> <option value="">Select a rule</option>
<?merge accessRules ?> <?merge accessRules ?>
<option value='[?merge .code ?]' data-json='[?merge .json ?]'><?merge .code ?></option> <option value='[?merge .code ?]' data-json='[?merge .json ?]'><?merge .code ?></option>
</select><br> </select><br>
<dl class="dl dl-horizontal" id="accessRule"> <dl class="dl dl-horizontal" id="accessRule">
<dt><span>Duration</span> : </dt><dd span id="accessRuleDuration"></dd> <dt><span>Duration</span> :</dt>
<dt><span>Description</span> : </dt><dd id="accessRuleDescription"></dd> <dd span id="accessRuleDuration"></dd>
<dt><span>Description</span> :</dt>
<dd id="accessRuleDescription"></dd>
</dl> </dl>
</td></tr> </td>
<tr id="retentionCode"><td><strong>Code</strong></td><td> </tr>
<select id="retentionRuleCode" name="retentionRuleCode" class="form-control input-sm ruleInputAccess"> <tr id="retentionCode">
<option value="">Select a rule</option> <td><strong>Code</strong></td>
<?merge retentionRules ?> <td>
<option value='[?merge .code ?]' data-json='[?merge .json ?]'><?merge .label ?></option> <select id="retentionRuleCode" name="retentionRuleCode"
class="form-control input-sm ruleInputAccess">
<option value="">Select a rule</option>
<?merge retentionRules ?>
<option value='[?merge .code ?]' data-json='[?merge .json ?]'><?merge .label ?></option>
</select><br> </select><br>
<dl class="dl dl-horizontal" id="retentionRule"> <dl class="dl dl-horizontal" id="retentionRule">
<dt><span>Duration</span> : </dt><dd id="retentionRuleDuration"></dd> <dt><span>Duration</span> :</dt>
<div class="pull-left"> <dd id="retentionRuleDuration"></dd>
<dt><span>Final disposition</span> : </dt> <div class="pull-left">
<div class="col-md-6"> <dt><span>Description</span> :</dt>
<select id="finalDisposition" name="finalDisposition" class="form-control"> <dd id="retentionRuleDescription"></dd>
<option value=''> To be defined later </option> </div>
<option value='destruction'>Destruction</option> </dl>
<option value='preservation'>Preservation</option> </td>
</select> </tr>
</div><br/>&nbsp;
<dt><span>Description</span> : </dt><dd id="retentionRuleDescription"></dd>
</dl>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>
...@@ -49,29 +74,32 @@ ...@@ -49,29 +74,32 @@
</div> </div>
<script> <script>
var ArchiveModification = { var ArchiveModification = {
modal: $('#modificationModal'), modal: $('#modificationModal'),
serialize: function(type) { serialize: function (type) {
var parameter = {} var parameter = {};
if(type === "accessRule") { if (type === "accessRule") {
var code = this.modal.find('[name="accessRuleCode"]').find('option:selected').data('json'); var code = this.modal.find('[name="accessRuleCode"]').find('option:selected').data('json');
parameter.accessRule = { parameter.accessRule = {
accessRuleCode : this.modal.find('[name="accessRuleCode"]').val(), accessRuleCode: this.modal.find('[name="accessRuleCode"]').val(),
accessRuleStartDate : this.modal.find('[name="startDate"]').val(), accessRuleStartDate: this.modal.find('[name="startDate"]').val(),
accessRuleDuration : code.duration accessRuleDuration: code.duration
} }
} else if (type === "retentionRule") { } else if (type === "retentionRule") {
var code = this.modal.find('[name="retentionRuleCode"]').find('option:selected').data('json'); var code = this.modal.find('[name="retentionRuleCode"]').find('option:selected').data('json');
parameter.retentionRule = { parameter.retentionRule = {
retentionStartDate : this.modal.find('[name="startDate"]').val(), retentionStartDate: this.modal.find('[name="startDate"]').val(),
retentionRuleCode : this.modal.find('[name="retentionRuleCode"]').val(), retentionRuleCode: this.modal.find('[name="retentionRuleCode"]').val(),
retentionDuration : code.duration, retentionDuration: code.duration
finalDisposition : $('#finalDisposition').val() };
if (!($("#updateFinalDisposition").css('display') === 'block' && $('#retentionRuleFinalDisposition').prop("disabled"))) {
parameter.retentionRule.finalDisposition = $('#retentionRuleFinalDisposition').val();
} }
} }
......
...@@ -71,6 +71,14 @@ ...@@ -71,6 +71,14 @@
ModificationModal.loadRetentionCode(); ModificationModal.loadRetentionCode();
}); });
$("#checkboxUpdateFinalDisposition").on('change', function () {
if (this.checked) {
$("#retentionRuleFinalDisposition").prop("disabled",true);
} else {
$("#retentionRuleFinalDisposition").prop("disabled",false);
}
});
$("#comment").bind('input propertychange', function () { $("#comment").bind('input propertychange', function () {
if ($("#comment").val() == "") { if ($("#comment").val() == "") {
$("#save").prop("disabled",true); $("#save").prop("disabled",true);
...@@ -107,26 +115,29 @@ ...@@ -107,26 +115,29 @@
if (type == 'accessRule') { if (type == 'accessRule') {
$('#startDate, #accessCode').css('display', ''); $('#startDate, #accessCode').css('display', '');
$('#retentionCode').css('display', 'none'); $('#retentionCode, #finalDisposition, #updateFinalDisposition').css('display', 'none');
$('#archivalAgency').css('display', 'none'); $('#archivalAgency').css('display', 'none');
this.loadRule(archiveId, archiveName, type); this.loadRule(archiveId, archiveName, type);
} else if (type == "retentionRule") { } else if (type == "retentionRule") {
$('#startDate,#retentionCode').css('display', ''); $('#retentionRuleDuration').text('');
$('#accessCode').css('display', 'none'); $('#retentionRuleDescription').text('');
$('#startDate, #retentionCode, #finalDisposition').css('display', '');
$('#accessCode, #updateFinalDisposition').css('display', 'none');
$('#archivalAgency').css('display', 'none'); $('#archivalAgency').css('display', 'none');
this.loadRule(archiveId, archiveName); this.loadRule(archiveId, archiveName);
} else if (type == "flagForTransfer") { } else if (type == "flagForTransfer") {
$('#archivalAgency').css('display', ''); $('#archivalAgency').css('display', '');
$('#startDate,#accessCode,#retentionCode').css('display', 'none'); $('#startDate, #accessCode, #retentionCode, #finalDisposition, #updateFinalDisposition').css('display', 'none');
this.loadArchivalAgency(); this.loadArchivalAgency();
} else { } else {
$('#archivalAgency').css('display', 'none'); $('#archivalAgency').css('display', 'none');
$('#startDate,#accessCode,#retentionCode').css('display', 'none'); $('#startDate, #accessCode, #retentionCode, #finalDisposition, #updateFinalDisposition').css('display', 'none');
this.modal.modal(); this.modal.modal();
} }
$('#save').data("archiveids", ""); $('#save').data("archiveids", "");
$('#archiveModificationForm').css('display', ''); $('#archiveModificationForm').css('display', '');
$('#modal_multipleSelection').css('display', 'none'); $('#modal_multipleSelection').css('display', 'none');
...@@ -226,26 +237,29 @@ ...@@ -226,26 +237,29 @@
if( type === "accessRule") { if( type === "accessRule") {
$('#startDate, #accessCode').css('display', ''); $('#startDate, #accessCode').css('display', '');
$('#retentionCode').css('display', 'none'); $('#retentionCode, #finalDisposition, #updateFinalDisposition').css('display', 'none');
$('#archiveModificationForm').css('display', ''); $('#archiveModificationForm').css('display', '');
$('#archivalAgency').css('display', 'none'); $('#archivalAgency').css('display', 'none');
} else if ( type === "retentionRule") { } else if ( type === "retentionRule") {
$('#startDate,#retentionCode').css('display', ''); $('#retentionRuleDuration').text('');
$('#retentionRuleDescription').text('');
$('#startDate, #retentionCode, #finalDisposition, #updateFinalDisposition').css('display', '');
$('#accessCode').css('display', 'none'); $('#accessCode').css('display', 'none');
$('#archiveModificationForm').css('display', ''); $('#archiveModificationForm').css('display', '');
$('#archivalAgency').css('display', 'none'); $('#archivalAgency').css('display', 'none');
} else if (type == "flagForTransfer") { } else if (type == "flagForTransfer") {
$('#archivalAgency').css('display', ''); $('#archivalAgency').css('display', '');
$('#startDate,#accessCode,#retentionCode').css('display', 'none'); $('#startDate, #accessCode, #retentionCode, #finalDisposition, #updateFinalDisposition').css('display', 'none');
this.loadArchivalAgency(); this.loadArchivalAgency();
} else { } else {
$('#archivalAgency').css('display', 'none'); $('#archivalAgency').css('display', 'none');
$('#startDate,#accessCode,#retentionCode').css('display', 'none'); $('#startDate, #accessCode, #retentionCode, #finalDisposition, #updateFinalDisposition').css('display', 'none');
this.modal.modal(); this.modal.modal();
} }
$('#save').data("archiveids", ids); $('#save').data("archiveids", ids);
$('#modal_multipleSelection').css('display', ''); $('#modal_multipleSelection').css('display', '');
$('#modal_selected').html(selected); $('#modal_selected').html(selected);
...@@ -293,9 +307,9 @@ ...@@ -293,9 +307,9 @@
success : function (response) { success : function (response) {
gritter.show(response.message, response.status, response.errors); gritter.show(response.message, response.status, response.errors);
if (response.status) { if (response.status) {
$("#retentionRuleFinalDisposition").prop("disabled",false);
ModificationModal.close(); ModificationModal.close();
ModificationModal.modal.one('hidden.bs.modal', function () { ModificationModal.modal.one('hidden.bs.modal', function () {
console.log("passage");
//$('#modificationModal').modal();* //$('#modificationModal').modal();*
$('#archive_search').click(); $('#archive_search').click();
}); });
...@@ -365,7 +379,6 @@ ...@@ -365,7 +379,6 @@
} else { } else {
$('#retentionRule').css("display", ''); $('#retentionRule').css("display", '');
$('#retentionRuleDuration').text(retentionRuleDuration[1] + ' ' + $('#text_' + retentionRuleDurationUnit).html()); $('#retentionRuleDuration').text(retentionRuleDuration[1] + ' ' + $('#text_' + retentionRuleDurationUnit).html());
$('#retentionRuleFinalDisposition').val(retentionRuleCode.finalDisposition);
$('#retentionRuleDescription').text(retentionRuleCode.description); $('#retentionRuleDescription').text(retentionRuleCode.description);
} }
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
Retention rules Retention rules
</h1> </h1>
</div> </div>
<span id="publicArchives" class="hidden"><?merge publicArchives ?></span>
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<div id='retentionRuleList'> <div id='retentionRuleList'>
...@@ -68,6 +68,7 @@ ...@@ -68,6 +68,7 @@
</div> </div>
</div> </div>
</div> </div>
<?merge publicArchives.bool().not() ?>
<div class="form-group col-md-12"> <div class="form-group col-md-12">
<div class="col-md-10"> <div class="col-md-10">
<label class="control-label">Final disposition <span style="color: red">*</span></label> <label class="control-label">Final disposition <span style="color: red">*</span></label>
......
...@@ -17,7 +17,8 @@ ...@@ -17,7 +17,8 @@
<th>Label</th> <th>Label</th>
<th>Description</th> <th>Description</th>
<th>Retention duration</th> <th>Retention duration</th>
<th>Final disposition</th> <?merge publicArchives.bool().not() ?>
<th id="theadFinalDisposition">Final disposition</th>
<th/> <th/>
</tr> </tr>
</thead> </thead>
...@@ -28,7 +29,8 @@ ...@@ -28,7 +29,8 @@
<td><?merge .label ?></td> <td><?merge .label ?></td>
<td><?merge .description ?></td> <td><?merge .description ?></td>
<td><?merge .duration ?>&nbsp;<?merge .durationUnit ?></td> <td><?merge .duration ?>&nbsp;<?merge .durationUnit ?></td>
<td><?merge .finalDispositionTran ?></td> <?merge publicArchives.bool().not() ?>
<td id="tbodyFinalDisposition"><?merge .finalDispositionTran ?></td>
<td> <td>
<div class="btn-group pull-right"> <div class="btn-group pull-right">
<button type="button" class="btn btn-info btn-sm edit" data-code='[?merge .code ?]' title="Edit"><span class="fa fa-edit">&nbsp;</span></button> <button type="button" class="btn btn-info btn-sm edit" data-code='[?merge .code ?]' title="Edit"><span class="fa fa-edit">&nbsp;</span></button>
......
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