diff --git a/modules/entities/entity_del.php b/modules/entities/entity_del.php
deleted file mode 100755
index 9c746f14280341c6738467601dc09c9e942cb617..0000000000000000000000000000000000000000
--- a/modules/entities/entity_del.php
+++ /dev/null
@@ -1,171 +0,0 @@
-<?php
-
-/*
-*    Copyright 2008,20015 Maarch
-*
-*  This file is part of Maarch Framework.
-*
-*   Maarch Framework is free software: you can redistribute it and/or modify
-*   it under the terms of the GNU General Public License as published by
-*   the Free Software Foundation, either version 3 of the License, or
-*   (at your option) any later version.
-*
-*   Maarch Framework is distributed in the hope that it will be useful,
-*   but WITHOUT ANY WARRANTY; without even the implied warranty of
-*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*   GNU General Public License for more details.
-*
-*   You should have received a copy of the GNU General Public License
-*    along with Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/**
-* File : entity_del.php
-*
-* Delete an entity
-*
-* @package  Maarch Framework 3.0
-* @version 1
-* @since 03/2009
-* @license GPL
-* @author  Cedric Ndoumba  <dev@maarch.org>
-* @author  Claire Figueras  <dev@maarch.org>
-* @author  Laurent Giovannoni  <dev@maarch.org>
-*/
-
-$admin = new core_tools();
-$admin->test_admin('manage_entities', 'entities');
-$_SESSION['m_admin']= array();
-/****************Management of the location bar  ************/
-$init = false;
-if(isset($_REQUEST['reinit']) && $_REQUEST['reinit'] == "true")
-{
-    $init = true;
-}
-$level = "";
-if(isset($_REQUEST['level']) && ($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1))
-{
-    $level = $_REQUEST['level'];
-}
-$page_path = '';
-$page_label = _ENTITY_DELETION;
-$page_id = "entity_del";
-$admin->manage_location_bar($page_path, $page_label, $page_id, $init, $level);
-/***********************************************************/
-require_once('modules'.DIRECTORY_SEPARATOR.'entities'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_manage_entities.php');
-require("modules/entities/entities_tables.php");
-$admin = new core_tools();
-$ent = new entity();
-$db = new Database();
-$admin->load_lang();
-$admin->test_admin('manage_entities', 'entities');
-$entities = $ent->getShortEntityTree(array());
-$order = $_REQUEST['order'];
-$order_field = $_REQUEST['order_field'];
-$start = $_REQUEST['start'];
-$what = $_REQUEST['what'];
-$label = '';
-if(isset($_REQUEST['id']))
-{
-    $s_id = addslashes($db->wash($_REQUEST['id'], "alphanum", _THE_ENTITY));
-    $label = $ent->getentitylabel($s_id);
-}
-else
-{
-    $s_id = "";
-}
-if(isset($_REQUEST['valid']))
-{
-    $documents = true;
-    if(!empty($_REQUEST['doc_entity_id']))
-    {
-        for($i=0;$i<count($_SESSION['collections']);$i++)
-        {
-            // Skip this test if view doesn't have a column named res_id or destination
-            if(!$db->test_column($_SESSION['collections'][$i]['view'], 'res_id')) continue;
-            if(!$db->test_column($_SESSION['collections'][$i]['view'], 'destination')) continue;
-            $db = new Database();
-            if(isset($_SESSION['collections'][$i]['table']) && !empty($_SESSION['collections'][$i]['table']))
-            {
-                
-                $stmt = $db->query("UPDATE ".$_SESSION['collections'][$i]['table']." SET destination = ? WHERE destination = ? AND status <> 'DEL'", array($_REQUEST['doc_entity_id'],$s_id));
-
-                //$db->show();
-            }
-        }
-        $stmt = $db->query('SELECT user_id FROM ' . ENT_USERS_ENTITIES . ' WHERE entity_id = ? AND primary_entity = ? AND user_id IN (SELECT user_id FROM users_entities WHERE entity_id = ?)',
-            [$s_id, 'Y', $_REQUEST['doc_entity_id']]);
-
-        while($doubleUser = $stmt->fetchObject())
-        {
-            $db->query('DELETE FROM ' . ENT_USERS_ENTITIES . ' WHERE user_id = ? AND entity_id = ?', [$doubleUser->user_id, $_REQUEST['doc_entity_id']]);
-        }
-
-        $stmt = $db->query("UPDATE ".ENT_USERS_ENTITIES." SET entity_id = ?"
-            ." WHERE entity_id = ? AND user_id NOT IN (SELECT DISTINCT(user_id) FROM " . ENT_USERS_ENTITIES 
-            . " WHERE entity_id = ?)", array($_REQUEST['doc_entity_id'],$s_id,$_REQUEST['doc_entity_id']));
-        
-        $stmt = $db->query("DELETE FROM " . ENT_USERS_ENTITIES . " WHERE entity_id = ?",array($s_id));
-        $stmt = $db->query("SELECT entity_id FROM ".ENT_ENTITIES." WHERE parent_entity_id = ?",array($s_id));
-        $db = new Database();
-        while($lineEnt=$stmt->fetchObject())
-        {
-            //si la nouvelle entité (l'entité remplaçante) est une entité fille de l'entité à supprimer alors l'entité remplaçante récupère l'entité mère de l'entité à supprimer
-            if($lineEnt->entity_id == $_REQUEST['doc_entity_id'])
-            {
-                $stmt2 = $db->query("SELECT parent_entity_id FROM ".ENT_ENTITIES." WHERE entity_id = ?", array($s_id));
-                $lineParentEnt = $stmt2->fetchObject();
-                $stmt2 = $db->query("UPDATE ".ENT_ENTITIES." SET parent_entity_id = ? WHERE entity_id = ?",array($lineParentEnt->parent_entity_id,$lineEnt->entity_id));
-                //$db2->show();
-            }
-            else
-            {
-                $stmt2 = $db->query("UPDATE ".ENT_ENTITIES." SET parent_entity_id = ? WHERE entity_id = ?",array($_REQUEST['doc_entity_id'],$lineEnt->entity_id));
-                //$db2->show();
-            }
-        }
-        //exit;
-    }
-    elseif(empty($_REQUEST['doc_entity_id']))
-    {
-        $_SESSION['error'] .= _ENTITY_MANDATORY_FOR_REDIRECTION."<br>";
-        $documents = false;
-    }
-    if($documents)
-    {
-        if($_REQUEST['doc_entity_id'] <> "")
-        {
-            $entity_id_up = $_REQUEST['doc_entity_id'];
-        }
-        if($admin->is_module_loaded('basket'))
-        {
-            //groupbasket_redirect
-            $stmt = $db->query("UPDATE ".$_SESSION['tablename']['ent_groupbasket_redirect']." SET entity_id = ? WHERE entity_id = ?",array($entity_id_up,$s_id));
-             //listinstance
-            $stmt = $db->query("UPDATE ".$_SESSION['tablename']['ent_listinstance']." SET item_id = ? WHERE item_id = ? and item_type = 'entity_id'",array($entity_id_up,$s_id));
-            //$db->show();
-            //listmodels
-            $stmt = $db->query("DELETE FROM ".$_SESSION['tablename']['ent_listmodels']." WHERE object_id = ?",array($s_id));
-            //$db->show();
-        }
-        //$db->show();
-        if($admin->is_module_loaded('templates'))
-        {
-            //templates_association
-            $stmt = $db->query("UPDATE ".$_SESSION['tablename']['temp_templates_association']." SET value_field = ? WHERE value_field = ? and what = 'destination'",array($entity_id_up,$s_id));
-            //$db->show();
-        }
-        
-        //exit;
-        $ent->adminentity($s_id, 'del');
-    }
-    else
-    {
-        $ent->formDeleteEntity($s_id, $label, $entities, $admin);
-    }
-}
-else
-{
-    $ent->formDeleteEntity($s_id, $label, $entities, $admin);
-}
-?>
diff --git a/modules/entities/param_templates_entities.php b/modules/entities/param_templates_entities.php
index b3858f6d44b2960e8aa011500edc49dacc9593cf..62adc660a33f617070cca1c8bfa683e91110f1a2 100755
--- a/modules/entities/param_templates_entities.php
+++ b/modules/entities/param_templates_entities.php
@@ -102,11 +102,11 @@ elseif($_SESSION['service_tag'] == 'template_info')
 elseif($_SESSION['service_tag'] == 'load_template_db')
 {
     $db = new Database();
-    $stmt = $db->query("Delete from ".$_SESSION['tablename']['temp_templates_association']." where template_id = ? and what = 'destination'",array($_SESSION['m_admin']['template']['ID']));
+    $stmt = $db->query("Delete from ".$_SESSION['tablename']['temp_templates_association']." where template_id = ?",array($_SESSION['m_admin']['template']['ID']));
 
     for($i=0; $i < count($_SESSION['m_admin']['template']['ENTITIES']);$i++)
     {
-        $stmt = $db->query("insert into ".$_SESSION['tablename']['temp_templates_association']." ( template_id, what, value_field, maarch_module  ) VALUES (  ? , 'destination', ?, 'entities')",array($_SESSION['m_admin']['template']['ID'],$_SESSION['m_admin']['template']['ENTITIES'][$i]['ID']));
+        $stmt = $db->query("insert into ".$_SESSION['tablename']['temp_templates_association']." ( template_id, value_field  ) VALUES (?, ?)",array($_SESSION['m_admin']['template']['ID'],$_SESSION['m_admin']['template']['ENTITIES'][$i]['ID']));
     }
     $_SESSION['service_tag'] = '';
 }
diff --git a/modules/entities/xml/IVS/requests_definitions.xml b/modules/entities/xml/IVS/requests_definitions.xml
index ccc606cf797bf509aad2ce2d177af1b634b4df25..a18e682a1d655524ab9e83fc268e23987dfc06ad 100755
--- a/modules/entities/xml/IVS/requests_definitions.xml
+++ b/modules/entities/xml/IVS/requests_definitions.xml
@@ -69,10 +69,6 @@
 		<parameter name="display" value="true"/>
 		<parameter name="module" value="entities"/>
     </requestDefinition>
-    <requestDefinition method="GET" path="/apps/maarch_entreprise/index.php" validationRule="entity_del" >
-		<parameter name="page" value="entity_del"/>
-		<parameter name="module" value="entities"/>
-    </requestDefinition>
     <requestDefinition method="GET" path="/apps/maarch_entreprise/index.php" validationRule="view_tree_entities" >
 		<parameter name="page" value="view_tree_entities"/>
 		<parameter name="module" value="entities"/>
diff --git a/modules/entities/xml/IVS/validation_rules.xml b/modules/entities/xml/IVS/validation_rules.xml
index 82049567a0ded787cf29425e1d9db6d82e9eddde..87554f0d45cefd66fe7648401bddc0821c41269e 100755
--- a/modules/entities/xml/IVS/validation_rules.xml
+++ b/modules/entities/xml/IVS/validation_rules.xml
@@ -75,12 +75,6 @@
 		<parameter name="archival_agreement" type="string" />
 		<parameter name="archival_agency" type="string" />
     </validationRule>
-    <validationRule name="entity_del" extends="standardForm" mode="error">
-		<parameter name="module" type="identifier" />
-		<parameter name="id" type="identifier" />
-		<parameter name="valid" type="identifier" />
-		<parameter name="doc_entity_id" type="string" />
-    </validationRule>
     <validationRule name="choose_tree" extends="standardForm" mode="error">
 		<parameter name="module" type="identifier" />
 		<parameter name="tree_id" type="identifier" />
diff --git a/modules/templates/choose_template.php b/modules/templates/choose_template.php
index 8ae2c2b2aa5cb7c9c52972dd01dfd20f4e8b8678..121fe270ad333d15515e34c9fb54b318f9f816a2 100755
--- a/modules/templates/choose_template.php
+++ b/modules/templates/choose_template.php
@@ -64,7 +64,7 @@ $stmt = $db->query(
     "select * from " 
     . _TEMPLATES_TABLE_NAME . " t, " 
     . _TEMPLATES_ASSOCIATION_TABLE_NAME . " ta where "
-    . "t.template_id = ta.template_id and ta.what = 'destination' and ta.value_field = ? ", array($_REQUEST['entity'])
+    . "t.template_id = ta.template_id and ta.value_field = ? ", array($_REQUEST['entity'])
 );
 
 
diff --git a/modules/templates/class/class_modules_tools_Abstract.php b/modules/templates/class/class_modules_tools_Abstract.php
index ffb2f662d5b827b6b251286190659831d8e4078e..2b7eeb19eeaca63492cb102758928475152aaa68 100755
--- a/modules/templates/class/class_modules_tools_Abstract.php
+++ b/modules/templates/class/class_modules_tools_Abstract.php
@@ -98,19 +98,12 @@ abstract class templates_Abstract extends Database
 
         if(empty($field))
         {
-            $stmt = $db->query("select distinct what from ".$_SESSION['tablename']['temp_templates_association']." where template_id = ? ", 
-							array($template_id)
-					);
-            while($res = $stmt->fetchObject())
-            {
-                $items[$res->what] = array();
-            }
+            $items['destination'] = [];
             foreach(array_keys($items) as $key)
             {
-                $stmt2 = $db->query("select value_field from ".$_SESSION['tablename']['temp_templates_association']." where template_id = ? and what = ? ", 
-									array($template_id,$key)
+                $stmt2 = $db->query("select value_field from ".$_SESSION['tablename']['temp_templates_association']." where template_id = ? ",
+									array($template_id)
 						);
-                $items[$key] = array();
                 while($res = $stmt2->fetchOject())
                 {
                     array_push($items[$key], $res->value_field);
@@ -119,9 +112,9 @@ abstract class templates_Abstract extends Database
         }
         else
         {
-            $items[$field] = array();
-            $stmt = $db->query("select value_field from ".$_SESSION['tablename']['temp_templates_association']." where template_id = ? and what = ? ", 
-							array($template_id,$field)
+            $items[$field] = [];
+            $stmt = $db->query("select value_field from ".$_SESSION['tablename']['temp_templates_association']." where template_id = ? ",
+							array($template_id)
 					);
             while($res = $stmt->fetchObject())
             {
diff --git a/modules/templates/class/templates_controler_Abstract.php b/modules/templates/class/templates_controler_Abstract.php
index dfe4d290ad32bdf5bb87b9dc7f64bac17a4712e8..6c49853b3806adc1b8fc837cbe517c9cf4f8defa 100755
--- a/modules/templates/class/templates_controler_Abstract.php
+++ b/modules/templates/class/templates_controler_Abstract.php
@@ -537,8 +537,8 @@ abstract class templates_controler_Abstract extends ObjectControler implements O
         $db = new Database();
         $stmt = $db->query(
             'select * from ' . _TEMPLATES_TABLE_NAME . ' t, ' . _TEMPLATES_ASSOCIATION_TABLE_NAME . ' ta '
-            . 'where t.template_id = ta.template_id and ta.what = ? and ta.value_field = ? ORDER BY t.template_label',
-            ['destination', $entityId]
+            . 'where t.template_id = ta.template_id and ta.value_field = ? ORDER BY t.template_label',
+            [$entityId]
         );
         $docservers_controler = new docservers_controler();
         $docserverTemplate = $docservers_controler->get('TEMPLATES');
@@ -563,13 +563,13 @@ abstract class templates_controler_Abstract extends ObjectControler implements O
         $db = new Database();
         $db->query(
             "delete from " . _TEMPLATES_ASSOCIATION_TABLE_NAME 
-            . " where template_id = ? and what = 'destination' ", array($templateId)
+            . " where template_id = ?", array($templateId)
         );
        
         for ($i=0;$i<count($_SESSION['m_admin']['templatesEntitiesSelected']);$i++) {
             $db->query(
                 "insert into " . _TEMPLATES_ASSOCIATION_TABLE_NAME 
-                . " (template_id, what, value_field, maarch_module) VALUES (?, 'destination', ? , 'entities')", 
+                . " (template_id, value_field) VALUES (?, ?)",
                 array($templateId, $_SESSION['m_admin']['templatesEntitiesSelected'][$i])
             ); 
         }
@@ -583,31 +583,21 @@ abstract class templates_controler_Abstract extends ObjectControler implements O
             return $items;
         }
         if (empty($field)) {
+            $items['destination'] = [];
             $stmt = $db->query(
-                "select distinct what from " 
+                "select value_field from "
                 . _TEMPLATES_ASSOCIATION_TABLE_NAME
-                . " where template_id = ? ", array($templateId)
+                . " where template_id = ?", array($templateId)
             );
             while ($res = $stmt->fetchObject()) {
-                $items[$res->what] = array();
-            }
-            foreach (array_keys($items) as $key) {
-                $stmt = $db->query(
-                    "select value_field from " 
-                    . _TEMPLATES_ASSOCIATION_TABLE_NAME 
-                    . " where template_id = ? and what = ? ", array($templateId, $key)
-                );
-                $items[$key] = array();
-                while ($res = $stmt->fetchObject()) {
-                    array_push($items[$key], $res->value_field);
-                }
+                array_push($items['destination'], $res->value_field);
             }
         } else {
-            $items[$field] = array();
+            $items[$field] = [];
             $stmt = $db->query(
                 "select value_field from " 
                 . _TEMPLATES_ASSOCIATION_TABLE_NAME 
-                . " where template_id = ? and what = ? ", array($templateId, $field)
+                . " where template_id = ?", array($templateId)
             );
             while ($res = $stmt->fetchObject()) {
                 array_push($items[$field], $res->value_field);
diff --git a/rest/index.php b/rest/index.php
index 1dc35d2477d37fad054e5db4538f38295a0f2863..3f1037a32bc61bb7a4f99990b141e2a2219d750d 100755
--- a/rest/index.php
+++ b/rest/index.php
@@ -222,6 +222,7 @@ $app->delete('/statuses/{identifier}', \Status\controllers\StatusController::cla
 $app->get('/administration/statuses/new', \Status\controllers\StatusController::class . ':getNewInformations');
 
 //Templates
+$app->get('/templates', \Template\controllers\TemplateController::class . ':get');
 $app->post('/templates/{id}/duplicate', \Template\controllers\TemplateController::class . ':duplicate');
 
 //Users
diff --git a/sql/data_fr.sql b/sql/data_fr.sql
index a72b305d47d1bae2e36defec199cb29a688e2ab2..7a422b827a85e6b71ed0a02d9c6c5a8a4417d48f 100755
--- a/sql/data_fr.sql
+++ b/sql/data_fr.sql
@@ -1739,11 +1739,10 @@ Select setval('notifications_seq', (select max(notification_sid)+1 from notifica
 ------------
 TRUNCATE TABLE templates_association;
 INSERT INTO templates_association
-(template_id, what, value_field, maarch_module)
-SELECT template_id, 'destination', entity_id, 'entities'
+(template_id, value_field)
+SELECT template_id, entity_id
 FROM templates, entities
 WHERE template_type in ('OFFICE','TXT');
-Select setval('templates_association_seq', (select max(system_id)+1 from templates_association), false);
 -----
 -- Archive identifiers
 -----
diff --git a/sql/develop.sql b/sql/develop.sql
index 1812d705668d150d770cb6219f1b96add0e24e71..5d3fc4b4adf1c80508edbe43f432c22d288868c7 100644
--- a/sql/develop.sql
+++ b/sql/develop.sql
@@ -52,6 +52,13 @@ ALTER TABLE docserver_types DROP COLUMN IF EXISTS is_signed;
 DROP TABLE IF EXISTS docserver_locations;
 UPDATE docservers set is_readonly = 'Y' WHERE docserver_id = 'FASTHD_AI';
 
+/* Templates */
+ALTER TABLE templates_association DROP COLUMN IF EXISTS system_id;
+ALTER TABLE templates_association DROP COLUMN IF EXISTS what;
+ALTER TABLE templates_association DROP COLUMN IF EXISTS maarch_module;
+ALTER TABLE templates_association ADD COLUMN id serial;
+ALTER TABLE templates_association ADD UNIQUE (id);
+
 /* Refactoring */
 DROP VIEW IF EXISTS af_view_customer_target_view;
 DROP VIEW IF EXISTS af_view_customer_view;
@@ -65,7 +72,3 @@ DROP VIEW IF EXISTS res_view;
 DROP TABLE IF EXISTS res_x;
 DROP TABLE IF EXISTS res_version_x;
 DROP TABLE IF EXISTS adr_x;
-
-
-
-
diff --git a/sql/reinit_sequences.sql b/sql/reinit_sequences.sql
index 0257f9be63ddf435bd3664d304560b1a3fdf9197..5a411c504757bf2b2d75f285e2ba9ff0fae6b307 100644
--- a/sql/reinit_sequences.sql
+++ b/sql/reinit_sequences.sql
@@ -1,7 +1,6 @@
 
 Select setval('notifications_seq', (select max(notification_sid)+1 from notifications), false);
 Select setval('res_id_mlb_seq', (select max(res_id)+1 from res_letterbox), false);
-Select setval('templates_association_seq', (select max(system_id)+1 from templates_association), false);
 Select setval('user_signatures_seq', (select max(id)+1 from user_signatures), false);
 Select setval('templates_seq', (select max(template_id)+1 from templates), false);
 Select setval('tag_id_seq', (select max(tag_id)+1 from tags), false);
diff --git a/sql/structure.sql b/sql/structure.sql
index d7248fec5e27e4129c81406089ac3dc93edbf47a..5a973af9e7589875a6b89590e50a9eafd96e76a4 100755
--- a/sql/structure.sql
+++ b/sql/structure.sql
@@ -987,13 +987,6 @@ CREATE SEQUENCE templates_seq
   START 110
   CACHE 1;
 
-CREATE SEQUENCE templates_association_seq
-  INCREMENT 1
-  MINVALUE 1
-  MAXVALUE 9223372036854775807
-  START 140
-  CACHE 1;
-
 CREATE TABLE templates
 (
   template_id bigint NOT NULL DEFAULT nextval('templates_seq'::regclass),
@@ -1013,12 +1006,10 @@ WITH (OIDS=FALSE);
 
 CREATE TABLE templates_association
 (
-  system_id bigint NOT NULL DEFAULT nextval('templates_association_seq'::regclass),
+  id serial,
   template_id bigint NOT NULL,
-  what character varying(255) NOT NULL,
   value_field character varying(255) NOT NULL,
-  maarch_module character varying(255) NOT NULL DEFAULT 'apps'::character varying,
-  CONSTRAINT templates_association_pkey PRIMARY KEY (system_id)
+  CONSTRAINT templates_association_pkey PRIMARY KEY (id)
 )
 WITH (
   OIDS=FALSE
diff --git a/src/app/docserver/models/DocserverModelAbstract.php b/src/app/docserver/models/DocserverModelAbstract.php
index 9671e840be193bb37edd0b76898bf82a1e6a0b11..8c485a62d1bb4fbbf9f7fa46c48d40471c34088f 100644
--- a/src/app/docserver/models/DocserverModelAbstract.php
+++ b/src/app/docserver/models/DocserverModelAbstract.php
@@ -22,7 +22,7 @@ class DocserverModelAbstract
 {
     public static function get(array $aArgs = [])
     {
-        ValidatorModel::arrayType($aArgs, ['select', 'where', 'orderBy']);
+        ValidatorModel::arrayType($aArgs, ['select', 'where', 'data', 'orderBy']);
         ValidatorModel::intType($aArgs, ['limit']);
 
         $aDocservers = DatabaseModel::select([
diff --git a/src/app/entity/controllers/EntityController.php b/src/app/entity/controllers/EntityController.php
index fddc620d10cff62f338bfc511944bd96da8a7530..7788b9a898c35f5a19c6660f4dcba235f97f74f2 100644
--- a/src/app/entity/controllers/EntityController.php
+++ b/src/app/entity/controllers/EntityController.php
@@ -24,6 +24,7 @@ use Resource\models\ResModel;
 use Respect\Validation\Validator;
 use Slim\Http\Request;
 use Slim\Http\Response;
+use Template\models\TemplateAssociationModel;
 use Template\models\TemplateModel;
 use User\models\UserEntityModel;
 use User\models\UserModel;
@@ -139,7 +140,7 @@ class EntityController
         $entity['hasChildren'] = count($children) > 0;
         $documents = ResModel::get(['select' => [1], 'where' => ['destination = ?'], 'data' => [$aArgs['id']]]);
         $entity['documents'] = count($documents);
-        $templates = TemplateModel::getAssociation(['select' => [1], 'where' => ['value_field = ?', 'what = ?'], 'data' => [$aArgs['id'], 'destination']]);
+        $templates = TemplateAssociationModel::get(['select' => [1], 'where' => ['value_field = ?', 'what = ?'], 'data' => [$aArgs['id'], 'destination']]);
         $entity['templates'] = count($templates);
         $instances = ListInstanceModel::get(['select' => [1], 'where' => ['item_id = ?', 'item_type = ?'], 'data' => [$aArgs['id'], 'entity_id']]);
         $entity['instances'] = count($instances);
@@ -305,7 +306,7 @@ class EntityController
         $children = EntityModel::get(['select' => [1], 'where' => ['parent_entity_id = ?'], 'data' => [$aArgs['id']]]);
         $documents = ResModel::get(['select' => [1], 'where' => ['destination = ?'], 'data' => [$aArgs['id']]]);
         $users = EntityModel::getUsersById(['select' => [1], 'id' => $aArgs['id']]);
-        $templates = TemplateModel::getAssociation(['select' => [1], 'where' => ['value_field = ?', 'what = ?'], 'data' => [$aArgs['id'], 'destination']]);
+        $templates = TemplateAssociationModel::get(['select' => [1], 'where' => ['value_field = ?', 'what = ?'], 'data' => [$aArgs['id'], 'destination']]);
         $instances = ListInstanceModel::get(['select' => [1], 'where' => ['item_id = ?', 'item_type = ?'], 'data' => [$aArgs['id'], 'entity_id']]);
         $redirects = BasketModel::getGroupActionRedirect(['select' => [1], 'where' => ['entity_id = ?'], 'data' => [$aArgs['id']]]);
 
@@ -386,7 +387,7 @@ class EntityController
         //ListTemplates
         ListTemplateModel::delete(['where' => ['object_id = ?'], 'data' => [$aArgs['id']]]);
         //Templates
-        TemplateModel::updateAssociation(['set' => ['value_field' => $aArgs['newEntityId']], 'where' => ['value_field = ?', 'what = ?'], 'data' => [$aArgs['id'], 'destination']]);
+        TemplateAssociationModel::update(['set' => ['value_field' => $aArgs['newEntityId']], 'where' => ['value_field = ?'], 'data' => [$aArgs['id']]]);
 
 
         EntityModel::delete(['where' => ['entity_id = ?'], 'data' => [$aArgs['id']]]);
diff --git a/src/app/template/controllers/TemplateController.php b/src/app/template/controllers/TemplateController.php
index aecfc5488c533615abcd4a0051c76e05c27a1795..f670c79f190acb522b70ba57d1bbf1ceefc213db 100644
--- a/src/app/template/controllers/TemplateController.php
+++ b/src/app/template/controllers/TemplateController.php
@@ -16,13 +16,31 @@ namespace Template\controllers;
 
 use Docserver\controllers\DocserverController;
 use Docserver\models\DocserverModel;
+use Group\models\ServiceModel;
 use Slim\Http\Request;
 use Slim\Http\Response;
+use Template\models\TemplateAssociationModel;
 use Template\models\TemplateModel;
 
-
 class TemplateController
 {
+    public function get(Request $request, Response $response)
+    {
+        if (!ServiceModel::hasService(['id' => 'admin_templates', 'userId' => $GLOBALS['userId'], 'location' => 'templates', 'type' => 'admin'])) {
+            return $response->withStatus(403)->withJson(['errors' => 'Service forbidden']);
+        }
+
+        $templates = TemplateModel::get();
+        foreach ($templates as $key => $template) {
+            $linkedEntities = TemplateAssociationModel::get(['select' => ['value_field'], 'where' => ['template_id = ?'], 'data' => [$template['template_id']]]);
+            foreach ($linkedEntities as $linkedEntity) {
+                $templates[$key]['entities'][] = $linkedEntity['value_field'];
+            }
+        }
+
+        return $response->withJson(['templates' => $templates]);
+    }
+
     public function duplicate(Request $request, Response $response, array $aArgs)
     {
         $template = TemplateModel::getById(['id' => $aArgs['id']]);
diff --git a/src/app/template/models/TemplateAssociationModel.php b/src/app/template/models/TemplateAssociationModel.php
new file mode 100644
index 0000000000000000000000000000000000000000..8e965038dced2d5ec71fbc362e42eb9220e5ed06
--- /dev/null
+++ b/src/app/template/models/TemplateAssociationModel.php
@@ -0,0 +1,19 @@
+<?php
+
+/**
+ * Copyright Maarch since 2008 under licence GPLv3.
+ * See LICENCE.txt file at the root folder for more details.
+ * This file is part of Maarch software.
+ *
+ */
+
+/**
+ * @brief Template Association Model
+ * @author dev@maarch.org
+ */
+
+namespace Template\models;
+
+class TemplateAssociationModel extends TemplateAssociationModelAbstract
+{
+}
diff --git a/src/app/template/models/TemplateAssociationModelAbstract.php b/src/app/template/models/TemplateAssociationModelAbstract.php
new file mode 100644
index 0000000000000000000000000000000000000000..2b6c4e96391c1d759eec68bae262696dc692ed1c
--- /dev/null
+++ b/src/app/template/models/TemplateAssociationModelAbstract.php
@@ -0,0 +1,82 @@
+<?php
+
+/**
+ * Copyright Maarch since 2008 under licence GPLv3.
+ * See LICENCE.txt file at the root folder for more details.
+ * This file is part of Maarch software.
+ *
+ */
+
+/**
+ * @brief Template Association Model Abstract
+ * @author dev@maarch.org
+ */
+
+namespace Template\models;
+
+use SrcCore\models\ValidatorModel;
+use SrcCore\models\DatabaseModel;
+
+abstract class TemplateAssociationModelAbstract
+{
+    public static function get(array $aArgs = [])
+    {
+        ValidatorModel::arrayType($aArgs, ['select', 'where', 'data', 'orderBy']);
+        ValidatorModel::intType($aArgs, ['limit']);
+
+        $aTemplates = DatabaseModel::select([
+            'select'    => empty($aArgs['select']) ? ['*'] : $aArgs['select'],
+            'table'     => ['templates_association'],
+            'where'     => empty($aArgs['where']) ? [] : $aArgs['where'],
+            'data'      => empty($aArgs['data']) ? [] : $aArgs['data'],
+            'order_by'  => empty($aArgs['orderBy']) ? [] : $aArgs['orderBy'],
+            'limit'     => empty($aArgs['limit']) ? 0 : $aArgs['limit']
+        ]);
+
+        return $aTemplates;
+    }
+
+//    public static function create(array $aArgs)
+//    {
+//        ValidatorModel::notEmpty($aArgs, ['template_label']);
+//        ValidatorModel::stringType($aArgs, ['template_label']);
+//
+//        $nextSequenceId = DatabaseModel::getNextSequenceValue(['sequenceId' => 'templates_seq']);
+//
+//        DatabaseModel::insert(
+//            [
+//                'table'         => 'templates',
+//                'columnsValues' => [
+//                    'template_id'               => $nextSequenceId,
+//                    'template_label'            => $aArgs['template_label'],
+//                    'template_comment'          => $aArgs['template_comment'],
+//                    'template_content'          => $aArgs['template_content'],
+//                    'template_type'             => $aArgs['template_type'],
+//                    'template_style'            => $aArgs['template_style'],
+//                    'template_datasource'       => $aArgs['template_datasource'],
+//                    'template_target'           => $aArgs['template_target'],
+//                    'template_attachment_type'  => $aArgs['template_attachment_type'],
+//                    'template_path'             => $aArgs['template_path'],
+//                    'template_file_name'        => $aArgs['template_file_name'],
+//                ]
+//            ]
+//        );
+//
+//        return $nextSequenceId;
+//    }
+
+    public static function update(array $aArgs)
+    {
+        ValidatorModel::notEmpty($aArgs, ['set', 'where', 'data']);
+        ValidatorModel::arrayType($aArgs, ['set', 'where', 'data']);
+
+        DatabaseModel::update([
+            'table' => 'templates_association',
+            'set'   => $aArgs['set'],
+            'where' => $aArgs['where'],
+            'data'  => $aArgs['data']
+        ]);
+
+        return true;
+    }
+}
diff --git a/src/app/template/models/TemplateModelAbstract.php b/src/app/template/models/TemplateModelAbstract.php
index 2f33315adce4409b00926ef9a945ea30194d4326..3996a50d1a1cb4c8686e34583910fc1d8de56d18 100644
--- a/src/app/template/models/TemplateModelAbstract.php
+++ b/src/app/template/models/TemplateModelAbstract.php
@@ -19,6 +19,23 @@ use SrcCore\models\DatabaseModel;
 
 abstract class TemplateModelAbstract
 {
+    public static function get(array $aArgs = [])
+    {
+        ValidatorModel::arrayType($aArgs, ['select', 'where', 'data', 'orderBy']);
+        ValidatorModel::intType($aArgs, ['limit']);
+
+        $aTemplates = DatabaseModel::select([
+            'select'    => empty($aArgs['select']) ? ['*'] : $aArgs['select'],
+            'table'     => ['templates'],
+            'where'     => empty($aArgs['where']) ? [] : $aArgs['where'],
+            'data'      => empty($aArgs['data']) ? [] : $aArgs['data'],
+            'order_by'  => empty($aArgs['orderBy']) ? [] : $aArgs['orderBy'],
+            'limit'     => empty($aArgs['limit']) ? 0 : $aArgs['limit']
+        ]);
+
+        return $aTemplates;
+    }
+
     public static function getById(array $aArgs)
     {
         ValidatorModel::notEmpty($aArgs, ['id']);
@@ -80,33 +97,4 @@ abstract class TemplateModelAbstract
 
         return $nextSequenceId;
     }
-
-    public static function getAssociation(array $aArgs = [])
-    {
-        ValidatorModel::arrayType($aArgs, ['select', 'where', 'data']);
-
-        $aTemplatesAssociation = DatabaseModel::select([
-            'select'    => empty($aArgs['select']) ? ['*'] : $aArgs['select'],
-            'table'     => ['templates_association'],
-            'where'     => $aArgs['where'],
-            'data'      => $aArgs['data']
-        ]);
-
-        return $aTemplatesAssociation;
-    }
-
-    public static function updateAssociation(array $aArgs)
-    {
-        ValidatorModel::notEmpty($aArgs, ['set', 'where', 'data']);
-        ValidatorModel::arrayType($aArgs, ['set', 'where', 'data']);
-
-        DatabaseModel::delete([
-            'table' => 'templates_association',
-            'set'   => $aArgs['set'],
-            'where' => $aArgs['where'],
-            'data'  => $aArgs['data']
-        ]);
-
-        return true;
-    }
 }