From b5477b90e957eabdbdfe24d6873b47e717ca171c Mon Sep 17 00:00:00 2001
From: Damien <damien.burel@maarch.org>
Date: Wed, 25 Sep 2019 16:56:58 +0200
Subject: [PATCH] FEAT #11271 TIME 0:25 Fixes from CR

---
 migration/19.12/1912.sql                  |  4 ++--
 modules/avis/avis_workflow.php            | 26 +++++++++++++++++++++++
 sql/structure.sql                         | 17 +++++++++------
 src/app/tag/controllers/TagController.php |  4 ----
 4 files changed, 38 insertions(+), 13 deletions(-)

diff --git a/migration/19.12/1912.sql b/migration/19.12/1912.sql
index 04b6da2dc47..885b33c3299 100644
--- a/migration/19.12/1912.sql
+++ b/migration/19.12/1912.sql
@@ -10,6 +10,8 @@ UPDATE parameters SET param_value_string = '19.12' WHERE id = 'database_version'
 
 /* VIEWS */
 DROP VIEW IF EXISTS res_view_letterbox;
+DROP VIEW IF EXISTS res_view_attachments;
+DROP VIEW IF EXISTS view_folders;
 
 
 /* FULL TEXT */
@@ -244,7 +246,6 @@ DROP TABLE IF EXISTS foldertypes;
 DROP TABLE IF EXISTS foldertypes_doctypes;
 DROP TABLE IF EXISTS foldertypes_doctypes_level1;
 DROP TABLE IF EXISTS foldertypes_indexes;
-DROP VIEW IF EXISTS view_folders;
 
 
 /* RE CREATE VIEWS */
@@ -373,7 +374,6 @@ FROM doctypes d,
          LEFT JOIN users u ON mlb.exp_user_id::text = u.user_id::text OR mlb.dest_user_id::text = u.user_id::text
 WHERE r.type_id = d.type_id AND d.doctypes_first_level_id = dfl.doctypes_first_level_id AND d.doctypes_second_level_id = dsl.doctypes_second_level_id;
 
-DROP VIEW IF EXISTS res_view_attachments;
 CREATE VIEW res_view_attachments AS
   SELECT '0' as res_id, res_id as res_id_version, title, subject, description, type_id, format, typist,
   creation_date, fulltext_result, author, identifier, source, relation, doc_date, docserver_id, path,
diff --git a/modules/avis/avis_workflow.php b/modules/avis/avis_workflow.php
index 0b721270350..3aea35b13ae 100755
--- a/modules/avis/avis_workflow.php
+++ b/modules/avis/avis_workflow.php
@@ -240,6 +240,32 @@ function manage_form($arr_id, $history, $id_action, $label_action, $status, $col
     }
 
 
+//    if (
+//
+//        $sequence == $circuit_avis->nbAvis($res_id, $coll_id)-1
+//
+//    ){
+//
+//        $stmt = $db->query("SELECT status_id FROM groupbasket_status WHERE group_id = ? and basket_id = ? and action_id = ?"
+//
+//            ,array($_SESSION['current_basket']['group_id'],$_SESSION['current_basket']['id'],$id_action));
+//
+//
+//
+//        if($status = $stmt->fetchObject()){
+//
+//            $mailStatus = $status->status_id;
+//
+//            $stmt = $db->query("UPDATE res_letterbox SET status = ? WHERE res_id = ? ", array($mailStatus, $res_id));
+//
+//        }
+//
+//    } else {
+//
+//        //$mailStatus = 'EAVIS';
+//
+//    }
+
     $circuit_avis->processAvis($res_id);
 
     # save note
diff --git a/sql/structure.sql b/sql/structure.sql
index 7330ae792e8..c8b33509855 100755
--- a/sql/structure.sql
+++ b/sql/structure.sql
@@ -1883,14 +1883,17 @@ CONSTRAINT acknowledgment_receipts_pkey PRIMARY KEY (id)
 )
 WITH (OIDS=FALSE);
 
-CREATE TABLE custom_fields
+DROP TABLE IF EXISTS indexing_models;
+CREATE TABLE indexing_models
 (
-  id serial NOT NULL,
-  label character varying(256) NOT NULL,
-  type character varying(256) NOT NULL,
-  values jsonb,
-  CONSTRAINT custom_fields_pkey PRIMARY KEY (id),
-  CONSTRAINT custom_fields_unique_key UNIQUE (label)
+    id SERIAL NOT NULL,
+    label character varying(256) NOT NULL,
+    category character varying(256) NOT NULL,
+    "default" BOOLEAN NOT NULL,
+    owner INTEGER NOT NULL,
+    private BOOLEAN NOT NULL,
+    master INTEGER DEFAULT NULL,
+    CONSTRAINT indexing_models_pkey PRIMARY KEY (id)
 )
 WITH (OIDS=FALSE);
 
diff --git a/src/app/tag/controllers/TagController.php b/src/app/tag/controllers/TagController.php
index eeed457c5a1..88609094a0b 100644
--- a/src/app/tag/controllers/TagController.php
+++ b/src/app/tag/controllers/TagController.php
@@ -4,10 +4,6 @@
 * 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   ParametersController
-* @author  dev <dev@maarch.org>
-* @ingroup core
 */
 
 /**
-- 
GitLab