archiveForm.html 20.9 KB
Newer Older
Cyril Vazquez's avatar
Cyril Vazquez committed
1
2
3
4
5
6
7
8
9
<!--#
    This file is part of the auth package.
    (c) Maarch Prospre DE LAURE <prosper.delaure@maarch.org>

    For the full copyright and license information, please view the LICENSE
    file that was distributed with this source code.
#-->
<form class="form-horizontal" id="archiveForm">
    <div class="form-group">
10
        <label class="col-sm-3 control-label">Name</label>
11
        <div class="col-sm-9">
Alexis Ragot's avatar
Alexis Ragot committed
12
            <input type="text" class="input-sm form-control archiveInput" name="archiveName" placeholder="Archive name"/>
Cyril Vazquez's avatar
Cyril Vazquez committed
13
14
        </div>
    </div>
Alexis Ragot's avatar
Alexis Ragot committed
15
    <div class="form-group" data-translate-catalog="recordsManagement/archive">
16
        <label class="col-sm-3 control-label">Identifier</label>
17
        <div class="col-sm-9">
Alexis Ragot's avatar
Alexis Ragot committed
18
            <input type="text" class="input-sm form-control archiveInput" name="originatorArchiveId" placeholder="Identifier"/>
Cyril Vazquez's avatar
Cyril Vazquez committed
19
20
        </div>
    </div>
21
    <div class="form-group">
22
        <label class="col-sm-3 control-label">Originating date</label>
23
        <div class="input-group col-sm-9" style="padding-left: 15px; padding-right: 15px;">
24
            <input class="input-sm form-control datePicker archiveInput" name="originatingDate" placeholder="Originating date"/>
25
26
        </div>
    </div>
27

28
    <div class="form-group" id="fileplanLevelDiv">
29
        <label class="col-md-3 control-label">Fileplan level</label>
30
31
32
33
        <div class="col-md-9">
            <input type="checkbox" data-width="100" class="input-sm" id="fileplanLevelToggle">
        </div>
    </div>
34

Alexis Ragot's avatar
Alexis Ragot committed
35
    <input type="hidden" class="archiveInput" name="archivalProfileReference" id="archivalProfile"/>
Alexis Ragot's avatar
Alexis Ragot committed
36
37
38
    <input type="hidden" class="archiveInput" name="filePlanPosition"/>
    <input type="hidden" class="archiveInput" name="originatorOrgRegNumber"/>
    <input type="hidden" class="archiveInput" name="parentArchiveId"/>
39
    <input type="hidden" class="archiveInput" id="fileplanLevel" name="fileplanLevel" value='file'/>
40
</form>
Alexis Ragot's avatar
Alexis Ragot committed
41
42
43

<?hinclude dashboard/mainScreen/descriptionForm.html ?>

44
<div id="managementMetadataDiv">
45
46
<div class="panel-heading" role="tab">
    <strong>
Cyril Vazquez's avatar
Cyril Vazquez committed
47
        <a data-toggle="collapse" href="#management">Management metadata</a>
48
49
    </strong>
</div>
Alexis Ragot's avatar
Alexis Ragot committed
50
<div id="management" class="panel-collapse collapse in">
51
    <form id="managementMetadataForm" class="form-horizontal">
Cyril Vazquez's avatar
Cyril Vazquez committed
52
        <div class="form-group">
53
            <label class="col-md-3 control-label">Retention rule</label>
Cyril Vazquez's avatar
Cyril Vazquez committed
54
            <div class="col-md-6">
Alexis Ragot's avatar
Alexis Ragot committed
55
                <select class="input-sm form-control archiveInput" name="retentionRuleCode" id="retentionRule">
Cyril Vazquez's avatar
Cyril Vazquez committed
56
57
58
59
60
                    <option value=""></option>
                    <?merge retentionRules ?>
                    <option value="[?merge .code ?]" data-duration="[?merge .durationText ?]" data-final-disposition="[?merge .finalDisposition ?]"><?merge .label ?></option>
                </select>
            </div>
Cyril Vazquez's avatar
Cyril Vazquez committed
61
            <div class="col-md-3">
62
                <p class="help-block small"><i id="retentionRuleText"></i></p>
Cyril Vazquez's avatar
Cyril Vazquez committed
63
            </div>
Cyril Vazquez's avatar
Cyril Vazquez committed
64
65
        </div>
        <div class="form-group">
66
            <label class="col-md-3 control-label">Retention start date</label>
Alexis Ragot's avatar
Alexis Ragot committed
67
            <div class="col-md-6">
Alexis Ragot's avatar
Alexis Ragot committed
68
                <input class="input-sm form-control datePicker archiveInput" name="retentionStartDate" placeholder="Retention start date"/>
Cyril Vazquez's avatar
Cyril Vazquez committed
69
70
            </div>
        </div>
71
72
    </form>
</div>
73
</div>
74

75
<div class="hide">
76
77
    <span id="text_file"><i class='fa fa-folder'></i> File</span>
    <span id="text_item"><i class='fa fa-file'></i> Item</span>
78
79
80
    <span id="message_requiredFieldOnEmptyForm">You must define at least the name, the identifier, the date of the document or a document</span>
</div>

81
<script src="/public/js/bootstrap-toggle/bootstrap-toggle.js"></script>
82

Cyril Vazquez's avatar
Cyril Vazquez committed
83
<script type="text/javascript">
84

85

86
    FilePlanLevelToggle = {
87
88
89
90
        load: function (isWithoutProfile) {
            if (isWithoutProfile === undefined) {
                isWithoutProfile = true;
            }
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
            if(isWithoutProfile == true) {
                if($('#fileplanLevelDiv').is(":hidden")) {
                    $('#fileplanLevelDiv').show();
                }

                $('#fileplanLevelToggle').bootstrapToggle({
                    on: $('#text_item'),
                    off: $('#text_file'),
                });

                $('#fileplanLevel').val("file");

                if($('#fileplanLevel').val() == 'item') {
                    $('#fileplanLevelToggle').bootstrapToggle('on');
                    $("#contentsTabBtn").addClass('hide');
                }


                $('#fileplanLevelToggle').on('change', function (e) {
                    if ($('#fileplanLevelToggle').prop('checked')) {
                        $("#fileplanLevel").val('item');
                        $("#contentsTabBtn").addClass('hide');
                    } else {
                        $("#fileplanLevel").val('file');
                        $("#contentsTabBtn").removeClass('hide');
                    }
                });
            } else {
                $('#fileplanLevelDiv').hide();
            }
        }
    };

Cyril Vazquez's avatar
Cyril Vazquez committed
124
    $('#app_maarchRM_main').ready(function () {
125
        //$("#managementMetadataForm").find("[name=retentionStartDate]").data("datepicker").setDate(new Date());
Cyril Vazquez's avatar
Cyril Vazquez committed
126
127
    });

128
129
130
131
132
133
134
    $("#archiveForm").keypress(function(e) {
    //To disable Enter keypress in this form
        if (e.which == 13) {
            return false;
        }
    });

Cyril Vazquez's avatar
Cyril Vazquez committed
135
136
137
138
139
140
141
142
143
    // ARCHIVE
    $('#archivalProfile').on('change', function() {
        ArchiveForm.loadProfile();
        ArchiveForm.displayArchiveDescription();
    });

    $('#retentionRule').on('change', function() {
        ArchiveForm.displayRetentionRulesInfo();
    });
jerome's avatar
jerome committed
144

Cyril Vazquez's avatar
Cyril Vazquez committed
145
    var ArchiveForm = {
Alexis Ragot's avatar
Alexis Ragot committed
146
147
148
        send : function(type, event, button) { //
            let url = null;
            let data = null;
Alexis Ragot's avatar
Alexis Ragot committed
149
            let archive = null;
Cyril Vazquez's avatar
Cyril Vazquez committed
150

Alexis Ragot's avatar
Alexis Ragot committed
151
152
            if (type === 'sync') {
                url = "/archive";
Alexis Ragot's avatar
Alexis Ragot committed
153
                archive = this.syncSerialize();
Alexis Ragot's avatar
Alexis Ragot committed
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169

                if (archive < 0) {
                    return;
                }

                data = JSON.stringify({archive : archive, zipContainer : DocumentForm.zipContainer});
            } else {
                url = "/transfer";
                data = this.asyncSerialize();

                if (data.message <0) {
                    return;
                }

                data = JSON.stringify(data);

Cyril Vazquez's avatar
Cyril Vazquez committed
170
            }
Alexis Ragot's avatar
Alexis Ragot committed
171
            ajax($(button),
Prosper De Laure's avatar
Prosper De Laure committed
172
173
                {
                    type        : 'POST',
Alexis Ragot's avatar
Alexis Ragot committed
174
175
                    url         : url,
                    data        : data,
Prosper De Laure's avatar
Prosper De Laure committed
176
177
178
179
                    contentType : 'application/json',
                    dataType    : 'json',
                    success     : function (response) {
                        gritter.show(response.message, response.status, response.errors);
Alexandre Goldstein's avatar
Alexandre Goldstein committed
180

Prosper De Laure's avatar
Prosper De Laure committed
181
                        if (response.status) {
Prosper De Laure's avatar
Prosper De Laure committed
182
                            trigger("archiveImportOver.recordsManagement", [archive.parentArchiveId]);
Prosper De Laure's avatar
Prosper De Laure committed
183
                            ImportPanel.cancel();
184
185
186
                            var folder = archive.originatorOrgRegNumber;
                            if (archive.filePlanPosition) {
                                folder = archive.filePlanPosition;
jerome's avatar
jerome committed
187
                            }
188
                            trigger('loadFolder.filePlan', [folder]);
189
190

                            $("#documentForm").show();
Prosper De Laure's avatar
Prosper De Laure committed
191
192
193
194
                        }
                    },
                    error       : function (response) {
                        gritter.show(response.responseJSON.message, response.responseJSON.status, response.responseJSON.errors);
Arnaud Pauget's avatar
Arnaud Pauget committed
195
                    }
Cyril Vazquez's avatar
Cyril Vazquez committed
196
                }
Prosper De Laure's avatar
Prosper De Laure committed
197
            );
Cyril Vazquez's avatar
Cyril Vazquez committed
198
        },
199
200
201
202
203

        modify : function(event, button) {
            let url = null;
            let data = null;
            let archive = null;
204
            let archiveId = null;
205
206

            archiveId = $(button).data("archive-id");
207
            archive = this.syncSerialize("modify");
208

209
210
211
212
            if (archive < 0) {
                return;
            }

213
214
215
216
            var parameters = {
                archiveId           : archiveId,
                originatorArchiveId : archive.originatorArchiveId,
                archiveName         : archive.archiveName,
217
                originatingDate     : archive.originatingDate,
218
219
220
221
222
223
224
225
226
227
228
229
230
                description         : archive.descriptionObject
            };

            $.ajax({
                type        : 'PUT',
                url         : "/recordsmanagement/archive/metadata",
                data        : JSON.stringify(parameters),
                contentType : 'application/json',
                dataType    : 'json',
                success     : function (response) {
                    gritter.show(response.message, response.status, response.errors);

                    if (response.status) {
231
                        ImportPanel.cancel();
232
                        $('#archivalProfileFields').empty();
233
                        Archive.getInfo(ArchiveInformation.archiveId);
234
                        $("#searchForm_inputSearchBtn").click();
235
                        trigger("archiveImportOver.recordsManagement");
236
237
                        $("#modifyArchive").addClass("hide");
                        $("#syncImport").removeClass("hide");
238
                        $("#asyncImport").removeClass("hide");
239
                        $("#managementMetadataDiv").removeClass("hide");
240
                        $("#documentForm").show();
241
242
243
244
245
246
247
248
                    }
                },
                error       : function (response) {
                    gritter.show(response.responseJSON.message, response.responseJSON.status, response.responseJSON.errors);
                }
            });
        },

Cyril Vazquez's avatar
Cyril Vazquez committed
249
250
        loadProfile : function() {
            var value = $('#archivalProfile').val();
251
            var dataJson = $('#archivalProfile').data('json');
Cyril Vazquez's avatar
Cyril Vazquez committed
252

253
254
            var selectedProfile = "";
            if (dataJson !== undefined && dataJson !== null && dataJson !== "") {
255
                selectedProfile = dataJson;
256
257
258
259
            }

            if (value == '' || selectedProfile.retentionRuleCode == null || selectedProfile.retentionRuleCode == '' || selectedProfile.retentionRuleCode == undefined) {
                $('#retentionRule').val('').removeAttr("disabled").change();
Cyril Vazquez's avatar
Cyril Vazquez committed
260
            } else {
261
                $('#retentionRule').val(selectedProfile.retentionRuleCode).change().attr("disabled", "disabled");
Cyril Vazquez's avatar
Cyril Vazquez committed
262
263
            }

jerome's avatar
jerome committed
264
265
            if (value == ''
                || selectedProfile.retentionStartDate == ''
266
                || selectedProfile.retentionStartDate == null) {
jerome's avatar
jerome committed
267
                var retentionStartDate = $("#managementMetadataForm").find("[name=retentionStartDate]");
268
                retentionStartDate.data("datepicker").setDate(new Date());
269
                retentionStartDate.closest(".form-group").removeClass("hide");
jerome's avatar
jerome committed
270

Cyril Vazquez's avatar
Cyril Vazquez committed
271
            } else {
272
                 $("#managementMetadataForm").find("[name=retentionStartDate]").val("").closest(".form-group").addClass("hide");
Cyril Vazquez's avatar
Cyril Vazquez committed
273
274
275
276
            }
        },
        displayArchiveDescription : function() {
            var value = $('#archivalProfile').val();
277

Cyril Vazquez's avatar
Cyril Vazquez committed
278
            $('#archivalProfileFields').empty();
jerome's avatar
jerome committed
279

Cyril Vazquez's avatar
Cyril Vazquez committed
280
281
282
283
            if (value == "") {
                Metadata.acceptUserIndex(true);
                return;
            }
jerome's avatar
jerome committed
284

285
            var selectedProfile = $('#archivalProfile').data('json');
jerome's avatar
jerome committed
286

Cyril Vazquez's avatar
Cyril Vazquez committed
287
            Metadata.acceptUserIndex(selectedProfile.acceptUserIndex);
jerome's avatar
jerome committed
288

Cyril Vazquez's avatar
Cyril Vazquez committed
289
290
291
292
293
294
            $.each(selectedProfile.archiveDescription, function(key, value) {
                Metadata.addArchiveDescription(value);
            });
        },
        displayRetentionRulesInfo : function() {
            var value = $('#retentionRule').val();
295

Cyril Vazquez's avatar
Cyril Vazquez committed
296
297
            var selected = $('#retentionRule').find('option:selected');

298
            if (value == '' ||  value == null) {
Cyril Vazquez's avatar
Cyril Vazquez committed
299
300
301
302
                $('#retentionRuleText').empty();
                return;
            }

303
            var finalDisposition = selected.data('final-disposition');
jerome's avatar
jerome committed
304

Cyril Vazquez's avatar
Cyril Vazquez committed
305
306
            var duration = selected.data('duration');

307
308
309
310
            if (duration === undefined) {
                $('#retentionRuleText').text($("#preservation_text").text() + " " + $("#unlimited_text").text());
                return;
            }
Cyril Vazquez's avatar
Cyril Vazquez committed
311
312
313
314
            var numeric = duration.slice(1, -1);
            var unit = duration.substr(duration.length-1);
            var retentionRuleText = $('#retentionRule_text').text();

315
316
317
318
319
            if (unit === 'Y' && numeric >= 9999) {
                $('#retentionRuleText').text($("#preservation_text").text() + " " + $("#unlimited_text").text());
                return;
            }

Cyril Vazquez's avatar
Cyril Vazquez committed
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
            switch (unit) {
                case 'D' : unit = $("#days_text").text();
                           break;

                case 'M' : unit = $("#months_text").text();
                           break;

                case 'Y' : unit = $("#years_text").text();
                           break;
            }

            switch (finalDisposition) {
                case 'destruction'  : finalDisposition = $("#destruction_text").text();
                           break;

                case 'preservation' : finalDisposition = $("#preservation_text").text();
                           break;
            }
338
339
            retentionRuleText = retentionRuleText.replace(/%1\$s/g, finalDisposition);
            retentionRuleText = retentionRuleText.replace(/%2\$s/g, numeric+' '+unit);
340
            $('#retentionRuleText').text(retentionRuleText);
Cyril Vazquez's avatar
Cyril Vazquez committed
341
        },
342
343
344
345
346
347
        syncSerialize : function(action) {
            // to inititate default value and avoid bug on IE 11
            if (action === undefined)
            {
                action = "add";
            }
348
            var form = $('#archiveForm, #managementMetadataForm');
Cyril Vazquez's avatar
Cyril Vazquez committed
349
350
351
            var inputs = form.find('.archiveInput');
            var archive = {
                digitalResources : [],
352
                descriptionObject : {}
Cyril Vazquez's avatar
Cyril Vazquez committed
353
354
355
            }

            inputs.each(function() {
Alexis Ragot's avatar
Alexis Ragot committed
356
357
358
                var value = $(this).val();
                if (value) {
                    if ($(this).hasClass('datePicker')) {
Jerome Boucher's avatar
Jerome Boucher committed
359
                        value = new Date($(this).data('datepicker').getFormattedDate('yyyy-mm-dd'));
Alexis Ragot's avatar
Alexis Ragot committed
360
361
                    }
                    archive[$(this).attr('name')] = value;
Cyril Vazquez's avatar
Cyril Vazquez committed
362
                }
Alexis Ragot's avatar
Alexis Ragot committed
363
            });
Cyril Vazquez's avatar
Cyril Vazquez committed
364

Alexis Ragot's avatar
Alexis Ragot committed
365
366
367
            var selectedProfile = $('#archivalProfile').data('json');

            if (selectedProfile !== undefined && selectedProfile !== null && selectedProfile !== "") {
Cyril Vazquez's avatar
Cyril Vazquez committed
368
                archive.descriptionClass = selectedProfile.descriptionClass;
369
370
371
                if (selectedProfile.fileplanLevel != null) {
                    archive.fileplanLevel = selectedProfile.fileplanLevel;
                }
Cyril Vazquez's avatar
Cyril Vazquez committed
372
373
374
            }

            archive.descriptionObject = Metadata.serialize($('#allFields'));
Cyril Vazquez's avatar
Cyril Vazquez committed
375
376

            if (archive.descriptionObject === -1) {
Cyril Vazquez's avatar
Cyril Vazquez committed
377
378
379
                return -1;
            }

Alexis Ragot's avatar
Alexis Ragot committed
380
            archive.digitalResources = DocumentList.serialize();
381

382
383
384
385
            if (archive.descriptionObject === undefined) {
                return -1;
            }

386
            if (selectedProfile !== undefined && selectedProfile !== null && selectedProfile !== "" && action !== "modify") {
387
388
389
390
391
                if (selectedProfile.fileplanLevel == 'item' && archive.digitalResources==null) {
                    gritter.show($('#documentMissing_error').text(), false);
                    return -2;
                }
            }
Cyril Vazquez's avatar
Cyril Vazquez committed
392

Alexis Ragot's avatar
Alexis Ragot committed
393
            if (!selectedProfile && !archive.archiveName && !archive.originatorArchiveId && !archive.originatingDate && archive.digitalResources == null) {
394
395
396
397
                gritter.show($("#message_requiredFieldOnEmptyForm").text(), false);
                return -3;
            }

Cyril Vazquez's avatar
Cyril Vazquez committed
398
399
400
            return archive;
        },

Alexandre Morin's avatar
Alexandre Morin committed
401
402
403
404
        asyncSerialize : function() {
            var form = $('#archiveForm, #managementMetadataForm');
            var inputs = form.find('.archiveInput');
            var data = {
405
406
407
408
                messageFile : {
                    binaryDataObject : {},
                    descriptiveMetadata : {}
                },
Alexis Ragot's avatar
Alexis Ragot committed
409
410
                attachments : [],
                schema : "recordsManagement"
Alexandre Morin's avatar
Alexandre Morin committed
411
412
            };

413
414
415
416
417
418
            var id = Math.random().toString(36).substr(2, 9);
            var obj = {};
            obj[id] = {
                archiveName                 : null,
                originatorArchiveId         : null,
                originatorId                : null,
419
                archiveType                 : null,
420
421
422
423
424
425
426
427
428
                descriptionObject           : {},
                originatingDate             : null,
                managementMetadata          : {
                    storageRule             : {},
                    accessRule              : {},
                    appraisalRule           : {},
                    classificationRule      : {}
                },
                descriptionClass            : null,
Alexis Ragot's avatar
Alexis Ragot committed
429
                dataObjects                 : []
Alexandre Morin's avatar
Alexandre Morin committed
430
431
432
433
            };

            inputs.each(function() {
                var value = $(this).val();
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480

                switch ($(this).attr('name')) {
                    case 'archivalProfileReference' :
                        if (value) {
                            obj[id].managementMetadata.archivalProfile = value;
                        }
                        break;
                    case 'archiveName' :
                        if (value) {
                            obj[id].archiveName = value;
                        }
                        break;
                    case 'originatingDate' :
                        if (value) {
                            obj[id].originatingDate = $(this).data('datepicker').getFormattedDate('yyyy-mm-dd');
                        }
                        break;
                    case 'originatorArchiveId' :
                        if (value) {
                            obj[id].originatorArchiveId = value;
                        }
                        break;
                    case 'originatorOrgRegNumber' :
                        if (value) {
                            obj[id].originatorId = value;
                        }
                        break;
                    case 'filePlanPosition' :
                        if (value) {
                            obj[id].folderPath = value;
                        }
                        break;
                    case 'parentArchiveId' :
                        if (value) {
                            obj[id].parentArchiveId = value;
                        }
                        break;
                    case 'retentionRuleCode' :
                        if (value) {
                            obj[id].managementMetadata.appraisalRule.code = value;
                        }
                        break;
                    case 'retentionStartDate' :
                        if (value) {
                            obj[id].managementMetadata.appraisalRule.startDate = $(this).data('datepicker').getFormattedDate('yyyy-mm-dd');
                        }
                        break;
Alexandre Morin's avatar
Alexandre Morin committed
481
482
483
484
485
486
                }
            });

            var selectedProfile = $('#archivalProfile').data('json');

            if (selectedProfile !== undefined && selectedProfile !== null && selectedProfile !== "") {
487
                obj[id].descriptionClass = selectedProfile.descriptionClass;
Alexandre Morin's avatar
Alexandre Morin committed
488
                if (selectedProfile.fileplanLevel != null) {
489
490
491
492
493
                    if (selectedProfile.fileplanLevel === 'file') {
                        obj[id].archiveType = 'container';
                    } else {
                        obj[id].archiveType = 'item';
                    }
Alexandre Morin's avatar
Alexandre Morin committed
494
495
496
                }
            }

497
            if (!obj[id].archiveType) {
Alexis Ragot's avatar
Alexis Ragot committed
498
                obj[id].archiveType = 'container';
499
500
            }

501
502
            obj[id].descriptionObject = Metadata.serialize($('#allFields'));
            if (obj[id].descriptionObject === true) {
Alexandre Morin's avatar
Alexandre Morin committed
503
504
505
                return -1;
            }

506
            data.messageFile.binaryDataObject = DocumentList.asyncSerialize();
Alexandre Morin's avatar
Alexandre Morin committed
507
508

            if (selectedProfile !== undefined && selectedProfile !== null && selectedProfile !== "") {
509
                if (obj[id].archiveType === 'item' && data.messageFile.binaryDataObject==null) {
Alexandre Morin's avatar
Alexandre Morin committed
510
511
512
513
514
                    gritter.show($('#documentMissing_error').text(), false);
                    return -2;
                }
            }

515
            if (!selectedProfile && !obj[id].archiveName && !obj[id].originatorArchiveId && !obj[id].originatingDate && data.messageFile.binaryDataObject == null) {
Alexandre Morin's avatar
Alexandre Morin committed
516
517
518
519
                gritter.show($("#message_requiredFieldOnEmptyForm").text(), false);
                return -3;
            }

520
            $.each(data.messageFile.binaryDataObject, function(index, value) {
Alexis Ragot's avatar
Alexis Ragot committed
521
                obj[id].dataObjects.push(index);
522
523
524
            });

            data.messageFile.descriptiveMetadata[id] = obj[id];
525
            data.messageFile = btoa(unescape(encodeURIComponent(JSON.stringify(data.messageFile))));
Alexandre Morin's avatar
Alexandre Morin committed
526
527
            return data;
        },
Cyril Vazquez's avatar
Cyril Vazquez committed
528
        clear : function() {
529
            $('#retentionRule').removeAttr("disabled");
530
            $('#archiveForm, #managementMetadataForm').find('.archiveInput').not('[name="filePlanPosition"],[name="originatorOrgRegNumber"]').val('').change();
Cyril Vazquez's avatar
Cyril Vazquez committed
531

Alexis Ragot's avatar
Alexis Ragot committed
532
            DocumentList.clear();
Cyril Vazquez's avatar
Cyril Vazquez committed
533
534
535
            Metadata.clear($('#allFields'));
        }
    }
536
</script>