Commit 1360c010 authored by Alexandre Morin's avatar Alexandre Morin

Fix A frozen archive can't be modified

parent 0509ab34
......@@ -37,6 +37,10 @@ trait archiveModificationTrait
{
$archive = $this->sdoFactory->read('recordsManagement/archive', $archiveId);
if ($archive->status === 'frozen') {
throw new \bundle\recordsManagement\Exception\retentionRuleException('A frozen archive can\'t be modified.');
}
$this->getAccessRule($archive);
return \laabs::castMessage($archive, 'recordsManagement/archiveRetentionRule');
......@@ -53,6 +57,10 @@ trait archiveModificationTrait
{
$archive = $this->sdoFactory->read('recordsManagement/archive', $archiveId);
if ($archive->status === 'frozen') {
throw new \bundle\recordsManagement\Exception\retentionRuleException('A frozen archive can\'t be modified.');
}
$this->getAccessRule($archive);
return \laabs::castMessage($archive, 'recordsManagement/archiveAccessRule');
......
......@@ -230,6 +230,9 @@ msgstr "Vous n'avez pas l'authorisation d'effectuer cette action."
msgid "An organization is required to check an archive integrity"
msgstr "Vous devez vous positionner dans un service pour verifier l'intégité d'une archive."
msgid "A frozen archive can't be modified."
msgstr "Une archive gelée ne peut pas être modifiée."
msgid "Permission denied: You have to choose a working organization unit to proceed this action."
msgstr "Non authorisé : Vous devez vous positionner dans un service pour effectuer cette action."
......
......@@ -121,8 +121,6 @@
$('#save').data("archiveids", "");
$('#archiveModificationForm').css('display', '');
$('#modal_multipleSelection').css('display', 'none');
this.modal.modal();
},
loadRule: function(archiveId, archiveName) {
......@@ -139,33 +137,39 @@
url : url,
dataType : 'json',
success : function (response) {
if (ModificationModal.modalType === "accessRule") {
rule = response.accessRule;
if (rule.accessRuleDuration) {
rule.accessRuleDurationUnit = rule.accessRuleDuration.substring(rule.accessRuleDuration.length-1);
rule.accessRuleDuration = rule.accessRuleDuration.substring(1, rule.accessRuleDuration.length-1);
if (response.status) {
if (ModificationModal.modalType === "accessRule") {
rule = response.accessRule;
if (rule.accessRuleDuration) {
rule.accessRuleDurationUnit = rule.accessRuleDuration.substring(rule.accessRuleDuration.length - 1);
rule.accessRuleDuration = rule.accessRuleDuration.substring(1, rule.accessRuleDuration.length - 1);
}
} else {
rule = response.retentionRule;
}
} else {
rule = response.retentionRule;
}
$.each(rule, function(key, value) {
ModificationModal.modal.find("[name='" +key+ "']").val(value);
});
$.each(rule, function (key, value) {
ModificationModal.modal.find("[name='" + key + "']").val(value);
});
if( ModificationModal.modalType === "accessRule") {
ModificationModal.loadAccessCode();
}
if (ModificationModal.modalType === "accessRule") {
ModificationModal.loadAccessCode();
}
if( ModificationModal.modalType === "retentionRule") {
ModificationModal.loadRetentionCode();
}
if (ModificationModal.modalType === "retentionRule") {
ModificationModal.loadRetentionCode(rule);
}
// Set datepicker Date
dateValue = rule.startDate.split('/');
if (dateValue.length == 3) {
date = new Date(parseInt(dateValue[2]), parseInt(dateValue[1])-1, parseInt(dateValue[0]));
$('#startDate').find('input').datepicker('setDate', date);
// Set datepicker Date
dateValue = rule.startDate.split('/');
if (dateValue.length == 3) {
date = new Date(parseInt(dateValue[2]), parseInt(dateValue[1]) - 1, parseInt(dateValue[0]));
$('#startDate').find('input').datepicker('setDate', date);
}
$('#modificationModal').modal();
} else {
gritter.show(response.message, response.status);
}
},
error : function(response) {
......
Markdown is supported
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