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

Final disposition management

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