diff --git a/apps/maarch_entreprise/Views/doctypes-administration-redirect-modal.component.html b/apps/maarch_entreprise/Views/doctypes-administration-redirect-modal.component.html
index 0885b31d3a2b933e40c3881fdf3e997e8d6c5e92..450e5f9fe9f026b997e90686d616aaa45b11057c 100644
--- a/apps/maarch_entreprise/Views/doctypes-administration-redirect-modal.component.html
+++ b/apps/maarch_entreprise/Views/doctypes-administration-redirect-modal.component.html
@@ -1,49 +1,27 @@
-<h2 mat-dialog-title>{{lang.entityReplacement}}</h2>
-<form #changeEntityForm="ngForm">
-<!--     <mat-dialog-content>
+<h2 mat-dialog-title>{{lang.documentTypeReplacement}}</h2>
+<form #changeDoctypeForm="ngForm">
+    <mat-dialog-content>
         <div class="alert alert-info" role="alert">
             <mat-list>
-                <mat-list-item *ngIf="data.entity.documents > 0">
+                <mat-list-item>
                     <mat-icon color="primary" mat-list-icon class="fa fa-file fa-2x"></mat-icon>
                     <p mat-line>
-                        <b>{{data.entity.entity_label}}</b> {{lang.isDestTo}}
-                        <b>{{data.entity.documents}}</b> {{lang.documents}}</p>
-                </mat-list-item>
-                <mat-list-item *ngIf="data.entity.instances > 0">
-                    <mat-icon color="primary" mat-list-icon class="fa fa-sitemap fa-2x"></mat-icon>
-                    <p mat-line>
-                        <b>{{data.entity.entity_label}}</b> {{lang.isCopyTo}}
-                        <b>{{data.entity.instances}}</b> {{lang.documents}}</p>
-                </mat-list-item>
-                <mat-list-item *ngIf="data.entity.users.length > 0">
-                    <mat-icon color="primary" mat-list-icon class="fa fa-user fa-2x"></mat-icon>
-                    <p mat-line>
-                        <b>{{data.entity.entity_label}}</b> {{lang.isLinkedTo | lowercase}}
-                        <b>{{data.entity.users.length}}</b> {{lang.users | lowercase}}</p>
-                </mat-list-item>
-                <mat-list-item *ngIf="data.entity.templates > 0">
-                    <mat-icon color="primary" mat-list-icon class="fa fa-file-text-o fa-2x"></mat-icon>
-                    <p mat-line>
-                        <b>{{data.entity.entity_label}}</b> {{lang.isLinkedTo | lowercase}}
-                        <b>{{data.entity.templates}}</b> {{lang.templates | lowercase}}</p>
+                        <b>{{data.count}}</b> {{lang.documents}}
+                    </p>
                 </mat-list-item>
             </mat-list>
-        </div>
+        </div>               
         <mat-form-field>
-            <input type="text" placeholder="{{lang.chooseEntity}}" matInput [matAutocomplete]="auto" [formControl]="elementCtrl"
-                [(ngModel)]="data.entity.redirectEntity">
-            <mat-autocomplete #auto="matAutocomplete">
-                <mat-option *ngFor="let elem of filteredElements | async" [value]="elem.id">
-                    <p mat-line>
-                        <i [class]="elem.type == 'entity' ? 'fa fa-sitemap' : 'fa fa-user'"></i> {{ elem.idToDisplay }}
-                        <small>{{ elem.otherInfo }}</small>
-                    </p>
+            <mat-select id="new_type_id" name="new_type_id" title="{{lang.transferToDoctype}}" placeholder="{{lang.transferToDoctype}}"
+                [(ngModel)]="data.new_type_id" required>
+                <mat-option *ngFor="let type of data.types" [disabled]="type.disabled" [value]="type.type_id">
+                    {{type.description}}
                 </mat-option>
-            </mat-autocomplete>
+            </mat-select>
         </mat-form-field>
     </mat-dialog-content>
     <mat-dialog-actions>
-        <button style="margin:auto;" mat-raised-button color="warn" type="submit" class="btn btn-danger" (click)="dialogRef.close(data.entity)"
-            [disabled]="!changeEntityForm.form.valid || data.entity.redirectEntity == data.entity.entity_id">{{lang.delete}}</button>
-    </mat-dialog-actions> -->
+        <button style="margin:auto;" mat-raised-button color="warn" type="submit" class="btn btn-danger" (click)="dialogRef.close(data)"
+            [disabled]="!changeDoctypeForm.form.valid">{{lang.delete}}</button>
+    </mat-dialog-actions>
 </form>
\ No newline at end of file
diff --git a/apps/maarch_entreprise/Views/doctypes-administration.component.html b/apps/maarch_entreprise/Views/doctypes-administration.component.html
index 45284129bf63eda015cab43246874ae230f91b83..cf68ee4c296758dc6b9bf6746ac93d8065f7e248 100644
--- a/apps/maarch_entreprise/Views/doctypes-administration.component.html
+++ b/apps/maarch_entreprise/Views/doctypes-administration.component.html
@@ -193,13 +193,13 @@
                             <div class="form-group">
                                 <div class="col-sm-6">
                                     <mat-form-field>
-                                        <input matInput [(ngModel)]="currentType.retention_rule" required name="retention_rule" id="retention_rule" title="{{lang.retentionRule}}"
+                                        <input matInput [(ngModel)]="currentType.retention_rule" name="retention_rule" id="retention_rule" title="{{lang.retentionRule}}"
                                             type="text" placeholder="{{lang.retentionRule}}" maxlength="15">
                                     </mat-form-field>
                                 </div>
                                 <div class="col-sm-6">
                                     <mat-form-field>
-                                        <input matInput [(ngModel)]="currentType.duration_current_use" required name="duration_current_use" id="duration_current_use" title="{{lang.durationCurrentUse}}"
+                                        <input matInput [(ngModel)]="currentType.duration_current_use" name="duration_current_use" id="duration_current_use" title="{{lang.durationCurrentUse}}"
                                             type="number" placeholder="{{lang.durationCurrentUse}}">
                                     </mat-form-field>
                                 </div>
diff --git a/apps/maarch_entreprise/js/angular/app/administration/doctypes-administration.component.js b/apps/maarch_entreprise/js/angular/app/administration/doctypes-administration.component.js
index 6d9ff2618fe0330b8f035ad4b6cf68e09dee7f15..72b773fec2b1e82db4f96d80ef8fb9902b5bc9e1 100644
--- a/apps/maarch_entreprise/js/angular/app/administration/doctypes-administration.component.js
+++ b/apps/maarch_entreprise/js/angular/app/administration/doctypes-administration.component.js
@@ -19,9 +19,11 @@ var translate_component_1 = require("../translate.component");
 var notification_service_1 = require("../notification.service");
 var material_1 = require("@angular/material");
 var DoctypesAdministrationComponent = /** @class */ (function () {
-    function DoctypesAdministrationComponent(changeDetectorRef, media, http, notify) {
+    function DoctypesAdministrationComponent(changeDetectorRef, media, http, notify, dialog) {
         this.http = http;
         this.notify = notify;
+        this.dialog = dialog;
+        this.config = {};
         this.lang = translate_component_1.LANG;
         this.doctypes = [];
         this.currentType = false;
@@ -29,6 +31,7 @@ var DoctypesAdministrationComponent = /** @class */ (function () {
         this.currentFirstLevel = false;
         this.firstLevels = false;
         this.folderTypes = false;
+        this.types = false;
         this.secondLevels = false;
         this.processModes = false;
         this.models = false;
@@ -305,7 +308,7 @@ var DoctypesAdministrationComponent = /** @class */ (function () {
         if (r) {
             this.http.delete(this.coreUrl + "rest/doctypes/types/" + this.currentType.type_id)
                 .subscribe(function (data) {
-                if (data.deleted) {
+                if (data.deleted == 0) {
                     _this.resetDatas();
                     _this.readMode();
                     _this.doctypes = data['doctypeTree'];
@@ -315,6 +318,26 @@ var DoctypesAdministrationComponent = /** @class */ (function () {
                     $j('#jstree').jstree('select_node', _this.doctypes[0]);
                 }
                 else {
+                    _this.config = { data: { count: data.deleted, types: data.doctypes } };
+                    _this.dialogRef = _this.dialog.open(DoctypesAdministrationRedirectModalComponent, _this.config);
+                    _this.dialogRef.afterClosed().subscribe(function (result) {
+                        console.log(result);
+                        if (result) {
+                            _this.http.put(_this.coreUrl + "rest/doctypes/types/" + _this.currentType.type_id + "/redirect", result)
+                                .subscribe(function (data) {
+                                _this.resetDatas();
+                                _this.readMode();
+                                _this.doctypes = data['doctypeTree'];
+                                $j('#jstree').jstree(true).settings.core.data = _this.doctypes;
+                                $j('#jstree').jstree("refresh");
+                                _this.notify.success(_this.lang.documentTypeDeleted);
+                                $j('#jstree').jstree('select_node', _this.doctypes[0]);
+                            }, function (err) {
+                                _this.notify.error(err.error.errors);
+                            });
+                        }
+                        _this.dialogRef = null;
+                    });
                 }
             }, function (err) {
                 _this.notify.error(err.error.errors);
@@ -345,7 +368,7 @@ var DoctypesAdministrationComponent = /** @class */ (function () {
             templateUrl: angularGlobals["doctypes-administrationView"],
             providers: [notification_service_1.NotificationService]
         }),
-        __metadata("design:paramtypes", [core_1.ChangeDetectorRef, layout_1.MediaMatcher, http_1.HttpClient, notification_service_1.NotificationService])
+        __metadata("design:paramtypes", [core_1.ChangeDetectorRef, layout_1.MediaMatcher, http_1.HttpClient, notification_service_1.NotificationService, material_1.MatDialog])
     ], DoctypesAdministrationComponent);
     return DoctypesAdministrationComponent;
 }());
diff --git a/apps/maarch_entreprise/js/angular/app/administration/doctypes-administration.component.ts b/apps/maarch_entreprise/js/angular/app/administration/doctypes-administration.component.ts
index 77c204e03b8534eeedbf4959bb8aadcbac002080..e3b6c9486b5e68cb4680021830d032156d405138 100644
--- a/apps/maarch_entreprise/js/angular/app/administration/doctypes-administration.component.ts
+++ b/apps/maarch_entreprise/js/angular/app/administration/doctypes-administration.component.ts
@@ -6,7 +6,6 @@ import { NotificationService } from '../notification.service';
 import { MatPaginator, MatTableDataSource, MatSort, MatDialog, MatDialogConfig, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
 
 declare function $j(selector: any): any;
-
 declare var angularGlobals: any;
 
 
@@ -18,6 +17,8 @@ declare var angularGlobals: any;
 export class DoctypesAdministrationComponent implements OnInit {
     mobileQuery: MediaQueryList;
     private _mobileQueryListener: () => void;
+    dialogRef: MatDialogRef<any>;
+    config: any = {};
     coreUrl: string;
     lang: any = LANG;
 
@@ -27,6 +28,7 @@ export class DoctypesAdministrationComponent implements OnInit {
     currentFirstLevel: any = false;
     firstLevels: any = false;
     folderTypes: any = false;
+    types: any = false;
     secondLevels: any = false;
     processModes: any = false;
     models: any = false;
@@ -36,7 +38,7 @@ export class DoctypesAdministrationComponent implements OnInit {
     creationMode: boolean = false;
 
 
-    constructor(changeDetectorRef: ChangeDetectorRef, media: MediaMatcher, public http: HttpClient, private notify: NotificationService) {
+    constructor(changeDetectorRef: ChangeDetectorRef, media: MediaMatcher, public http: HttpClient, private notify: NotificationService, public dialog: MatDialog) {
         $j("link[href='merged_css.php']").remove();
         this.mobileQuery = media.matchMedia('(max-width: 768px)');
         this._mobileQueryListener = () => changeDetectorRef.detectChanges();
@@ -318,7 +320,7 @@ export class DoctypesAdministrationComponent implements OnInit {
         if (r) {
             this.http.delete(this.coreUrl + "rest/doctypes/types/" + this.currentType.type_id)
                 .subscribe((data: any) => {
-                    if(data.deleted){
+                    if(data.deleted == 0){
                         this.resetDatas();
                         this.readMode();
                         this.doctypes = data['doctypeTree'];
@@ -327,7 +329,25 @@ export class DoctypesAdministrationComponent implements OnInit {
                         this.notify.success(this.lang.documentTypeDeleted);
                         $j('#jstree').jstree('select_node', this.doctypes[0]);
                     } else {
-
+                        this.config = { data: {count: data.deleted, types: data.doctypes} };
+                        this.dialogRef = this.dialog.open(DoctypesAdministrationRedirectModalComponent, this.config);
+                        this.dialogRef.afterClosed().subscribe((result: any) => {
+                        if (result) {
+                            this.http.put(this.coreUrl + "rest/doctypes/types/" + this.currentType.type_id + "/redirect", result)
+                                .subscribe((data: any) => {
+                                    this.resetDatas();
+                                    this.readMode();
+                                    this.doctypes = data['doctypeTree'];
+                                    $j('#jstree').jstree(true).settings.core.data = this.doctypes;
+                                    $j('#jstree').jstree("refresh");
+                                    this.notify.success(this.lang.documentTypeDeleted);
+                                    $j('#jstree').jstree('select_node', this.doctypes[0]);
+                                }, (err) => {
+                                    this.notify.error(err.error.errors);
+                                });
+                        }
+                        this.dialogRef = null;
+                        });
                     }
 
                 }, (err) => {
diff --git a/apps/maarch_entreprise/js/angular/lang/lang-en.js b/apps/maarch_entreprise/js/angular/lang/lang-en.js
index c179b5cb5255f209d7a2ffecb201d42780203205..c08ea6f15b2e76f898a750fb25c75c3402f9a44a 100755
--- a/apps/maarch_entreprise/js/angular/lang/lang-en.js
+++ b/apps/maarch_entreprise/js/angular/lang/lang-en.js
@@ -301,4 +301,6 @@ exports.LANG_EN = {
     "documentTypeAdded": "Document type added",
     "documentTypeUpdated": "Document type updated",
     "documentTypeDeleted": "Document type deleted",
+    "documentTypeReplacement": "Document type replacement",
+    "transferToDoctype": "TReplace by this document type",
 };
diff --git a/apps/maarch_entreprise/js/angular/lang/lang-en.ts b/apps/maarch_entreprise/js/angular/lang/lang-en.ts
index f022c952da62f597a45c040b074c6f243c562576..89fafb89f52477a6bd168ed9dc8eeb81977684f9 100755
--- a/apps/maarch_entreprise/js/angular/lang/lang-en.ts
+++ b/apps/maarch_entreprise/js/angular/lang/lang-en.ts
@@ -299,4 +299,6 @@ export const LANG_EN = {
     "documentTypeAdded"                 : "Document type added",
     "documentTypeUpdated"                 : "Document type updated",
     "documentTypeDeleted"                 : "Document type deleted",
+    "documentTypeReplacement"                 : "Document type replacement",
+    "transferToDoctype"                 : "TReplace by this document type",
 };
diff --git a/apps/maarch_entreprise/js/angular/lang/lang-fr.js b/apps/maarch_entreprise/js/angular/lang/lang-fr.js
index 555f445f9047950b1c2157792599a121ed80cf85..dc93684893007c9dbcb2270a97b6b2427599a952 100755
--- a/apps/maarch_entreprise/js/angular/lang/lang-fr.js
+++ b/apps/maarch_entreprise/js/angular/lang/lang-fr.js
@@ -327,4 +327,6 @@ exports.LANG_FR = {
     "documentTypeAdded": "Type de document ajouté",
     "documentTypeUpdated": "Type de document mis à jour",
     "documentTypeDeleted": "Type de document supprimé",
+    "documentTypeReplacement": "Remplacement du type de document",
+    "transferToDoctype": "Remplacer par le type de document",
 };
diff --git a/apps/maarch_entreprise/js/angular/lang/lang-fr.ts b/apps/maarch_entreprise/js/angular/lang/lang-fr.ts
index 8cc764813535083f27a0c2248ab535b1cd086998..36ac798b27818fcfab959fac2788c51f54f6b29d 100755
--- a/apps/maarch_entreprise/js/angular/lang/lang-fr.ts
+++ b/apps/maarch_entreprise/js/angular/lang/lang-fr.ts
@@ -325,4 +325,6 @@ export const LANG_FR = {
     "documentTypeAdded"                 : "Type de document ajouté",
     "documentTypeUpdated"                 : "Type de document mis à jour",
     "documentTypeDeleted"                 : "Type de document supprimé",
+    "documentTypeReplacement"                 : "Remplacement du type de document",
+    "transferToDoctype"                 : "Remplacer par le type de document",
 };
\ No newline at end of file
diff --git a/core/Test/DoctypeControllerTest.php b/core/Test/DoctypeControllerTest.php
index 264eda3e7197da277bc0b4f1c676e450c0135ca9..0fcb38c9e4812086a38f41ec5841541d4c5e41fd 100755
--- a/core/Test/DoctypeControllerTest.php
+++ b/core/Test/DoctypeControllerTest.php
@@ -507,13 +507,18 @@ class DoctypeControllerTest extends TestCase
         $response     = $doctypeController->delete($fullRequest, new \Slim\Http\Response(), ["id" => $doctypeId]);
         $responseBody = json_decode((string)$response->getBody());
 
-        $this->assertSame(false, $responseBody->deleted);
+        $this->assertSame(1, $responseBody->deleted);
         $this->assertNull($responseBody->doctypeTree);
+        $this->assertNotNull($responseBody->doctypes);
 
         $aArgs = [
             "new_type_id" => self::$doctypeId
         ];
-        $fullRequest = \httpRequestCustom::addContentInBody($aArgs, $request);
+
+        $environment = \Slim\Http\Environment::mock(['REQUEST_METHOD' => 'PUT']);
+        $requestPut  = \Slim\Http\Request::createFromEnvironment($environment);
+        $fullRequest = \httpRequestCustom::addContentInBody($aArgs, $requestPut);
+
         $response     = $doctypeController->deleteRedirect($fullRequest, new \Slim\Http\Response(), ["id" => $doctypeId]);
         $responseBody = json_decode((string)$response->getBody());
 
@@ -553,8 +558,9 @@ class DoctypeControllerTest extends TestCase
         $response     = $doctypeController->delete($fullRequest, new \Slim\Http\Response(), ["id" => self::$doctypeId]);
         $responseBody = json_decode((string)$response->getBody());
 
-        $this->assertSame(true, $responseBody->deleted);
+        $this->assertSame(0, $responseBody->deleted);
         $this->assertNotNull($responseBody->doctypeTree);
+        $this->assertNull($responseBody->doctypes);
 
         //  DELETE FAIL
         $environment = \Slim\Http\Environment::mock(['REQUEST_METHOD' => 'DELETE']);
diff --git a/rest/index.php b/rest/index.php
index 829f456e5da71fb780faeef4898f106c7224c94f..5883261b368fa6e0ad2b63f0854d27aff97f9dfa 100755
--- a/rest/index.php
+++ b/rest/index.php
@@ -281,7 +281,7 @@ $app->post('/doctypes/types', \Doctype\controllers\DoctypeController::class . ':
 $app->get('/doctypes/types/{id}', \Doctype\controllers\DoctypeController::class . ':getById');
 $app->put('/doctypes/types/{id}', \Doctype\controllers\DoctypeController::class . ':update');
 $app->delete('/doctypes/types/{id}', \Doctype\controllers\DoctypeController::class . ':delete');
-$app->delete('/doctypes/types/{id}/redirect', \Doctype\controllers\DoctypeController::class . ':deleteRedirect');
+$app->put('/doctypes/types/{id}/redirect', \Doctype\controllers\DoctypeController::class . ':deleteRedirect');
 
 //Reports
 $app->get('/reports/groups', \Report\controllers\ReportController::class . ':getGroups');
diff --git a/sql/develop.sql b/sql/develop.sql
index fb53bbb5bc9c3116ebbe39e30b7782c21e5d24a7..a8c1a71ca0b940ab06c78f84fdfdeeaceea92d9a 100755
--- a/sql/develop.sql
+++ b/sql/develop.sql
@@ -567,11 +567,11 @@ VALUES ('FULLTEXT_ATTACH_VERSION', 'FULLTEXT', 'Server for attachments version d
 ALTER TABLE doctypes DROP COLUMN IF EXISTS primary_retention;
 ALTER TABLE doctypes DROP COLUMN IF EXISTS secondary_retention;
 ALTER TABLE doctypes DROP COLUMN IF EXISTS retention_final_disposition;
-ALTER TABLE doctypes ADD COLUMN retention_final_disposition character varying(255) NOT NULL DEFAULT 'destruction';
+ALTER TABLE doctypes ADD COLUMN retention_final_disposition character varying(255) DEFAULT NULL;
 ALTER TABLE doctypes DROP COLUMN IF EXISTS retention_rule;
-ALTER TABLE doctypes ADD COLUMN retention_rule character varying(15) NOT NULL DEFAULT 'compta_3_03';
+ALTER TABLE doctypes ADD COLUMN retention_rule character varying(15) DEFAULT NULL;
 ALTER TABLE doctypes DROP COLUMN IF EXISTS duration_current_use;
-ALTER TABLE doctypes ADD COLUMN duration_current_use integer DEFAULT '12';
+ALTER TABLE doctypes ADD COLUMN duration_current_use integer DEFAULT NULL;
 ALTER TABLE entities DROP COLUMN IF EXISTS archival_agency;
 ALTER TABLE entities ADD COLUMN archival_agency character varying(255) DEFAULT 'org_123456789_Archives';
 ALTER TABLE entities DROP COLUMN IF EXISTS archival_agreement;
diff --git a/src/app/doctype/controllers/DoctypeController.php b/src/app/doctype/controllers/DoctypeController.php
index 0468769973e1ee2bb98667956604292b9a3b1fad..94b031cb3d8ad7bc90b4300f597e74f025b7b1ca 100644
--- a/src/app/doctype/controllers/DoctypeController.php
+++ b/src/app/doctype/controllers/DoctypeController.php
@@ -205,21 +205,29 @@ class DoctypeController
                 ->withJson(['errors' => 'Id is not a numeric']);
         }
 
-        if (empty(ResModel::get([
-            'select' => ['res_id'],
+        $count = ResModel::get([
+            'select' => ['count(1)'],
             'where'  => ['type_id = ?'],
-            'data'   => [$aArgs['id']]]))
-        ) {
+            'data'   => [$aArgs['id']]]);
+
+        if ($count[0]['count'] == 0) {
             DoctypeController::deleteAllDoctypeData(['type_id' => $aArgs['id']]);
-            $deleted  = true;
+            $deleted     = 0;
             $doctypeTree = FirstLevelController::getTreeFunction();
         } else {
-            $deleted  = false;
+            $deleted  = $count[0]['count'];
+            $doctypes = DoctypeModel::get();
+            foreach ($doctypes as $key => $value) {
+                if ($value['type_id'] == $aArgs['id']) {
+                    $doctypes[$key]['disabled'] = true;
+                }
+            }
         }
 
         return $response->withJson([
             'deleted'     => $deleted,
-            'doctypeTree' => $doctypeTree
+            'doctypeTree' => $doctypeTree,
+            'doctypes'    => $doctypes
         ]);
     }
 
@@ -250,6 +258,12 @@ class DoctypeController
                 ->withJson(['errors' => 'new_type_id does not exists']);
         }
 
+        if ($data['type_id'] == $data['new_type_id']) {
+            return $response
+                ->withStatus(500)
+                ->withJson(['errors' => 'new_type_id is the same as type_id']);
+        }
+
         ResModel::update([
             'set'   => ['type_id' => $data['new_type_id']],
             'where' => ['type_id = ?'],