archiveForm.html 20.8 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
87
88
89
90
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
    FilePlanLevelToggle = {
        load: function (isWithoutProfile = true) {
            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
122
    $('#app_maarchRM_main').ready(function () {
123
        //$("#managementMetadataForm").find("[name=retentionStartDate]").data("datepicker").setDate(new Date());
Cyril Vazquez's avatar
Cyril Vazquez committed
124
125
    });

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

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

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

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

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

                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
168
            }
Alexis Ragot's avatar
Alexis Ragot committed
169
            ajax($(button),
Prosper De Laure's avatar
Prosper De Laure committed
170
171
                {
                    type        : 'POST',
Alexis Ragot's avatar
Alexis Ragot committed
172
173
                    url         : url,
                    data        : data,
Prosper De Laure's avatar
Prosper De Laure committed
174
175
176
177
                    contentType : 'application/json',
                    dataType    : 'json',
                    success     : function (response) {
                        gritter.show(response.message, response.status, response.errors);
Alexandre Goldstein's avatar
Alexandre Goldstein committed
178

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

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

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

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

207
208
209
210
            if (archive < 0) {
                return;
            }

211
212
213
214
            var parameters = {
                archiveId           : archiveId,
                originatorArchiveId : archive.originatorArchiveId,
                archiveName         : archive.archiveName,
215
                originatingDate     : archive.originatingDate,
216
217
218
219
220
221
222
223
224
225
226
227
228
                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) {
229
                        ImportPanel.cancel();
230
                        $('#archivalProfileFields').empty();
231
                        Archive.getInfo(ArchiveInformation.archiveId);
232
                        $("#searchForm_inputSearchBtn").click();
233
                        trigger("archiveImportOver.recordsManagement");
234
235
                        $("#modifyArchive").addClass("hide");
                        $("#syncImport").removeClass("hide");
236
                        $("#asyncImport").removeClass("hide");
237
                        $("#managementMetadataDiv").removeClass("hide");
238
                        $("#documentForm").show();
239
240
241
242
243
244
245
246
                    }
                },
                error       : function (response) {
                    gritter.show(response.responseJSON.message, response.responseJSON.status, response.responseJSON.errors);
                }
            });
        },

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

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

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

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

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

Cyril Vazquez's avatar
Cyril Vazquez committed
276
            $('#archivalProfileFields').empty();
jerome's avatar
jerome committed
277

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

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

Cyril Vazquez's avatar
Cyril Vazquez committed
285
            Metadata.acceptUserIndex(selectedProfile.acceptUserIndex);
jerome's avatar
jerome committed
286

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

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

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

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

Cyril Vazquez's avatar
Cyril Vazquez committed
303
304
            var duration = selected.data('duration');

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

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

Cyril Vazquez's avatar
Cyril Vazquez committed
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
            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;
            }
336
337
            retentionRuleText = retentionRuleText.replace(/%1\$s/g, finalDisposition);
            retentionRuleText = retentionRuleText.replace(/%2\$s/g, numeric+' '+unit);
338
            $('#retentionRuleText').text(retentionRuleText);
Cyril Vazquez's avatar
Cyril Vazquez committed
339
        },
340
341
342
343
344
345
        syncSerialize : function(action) {
            // to inititate default value and avoid bug on IE 11
            if (action === undefined)
            {
                action = "add";
            }
346
            var form = $('#archiveForm, #managementMetadataForm');
Cyril Vazquez's avatar
Cyril Vazquez committed
347
348
349
            var inputs = form.find('.archiveInput');
            var archive = {
                digitalResources : [],
350
                descriptionObject : {}
Cyril Vazquez's avatar
Cyril Vazquez committed
351
352
353
            }

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

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

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

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

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

Alexis Ragot's avatar
Alexis Ragot committed
378
            archive.digitalResources = DocumentList.serialize();
379

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

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

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

Cyril Vazquez's avatar
Cyril Vazquez committed
396
397
398
            return archive;
        },

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

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

            inputs.each(function() {
                var value = $(this).val();
432
433
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

                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
479
480
481
482
483
484
                }
            });

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

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

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

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

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

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

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

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

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

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