From f041ab73f20d27d50f54a46a299cd06f204d1d79 Mon Sep 17 00:00:00 2001 From: Guillaume Heurtier <guillaume.heurtier@maarch.org> Date: Fri, 16 Oct 2020 14:48:52 +0200 Subject: [PATCH] FEAT #14383 TIME 0:20 fix custom fields tu --- migration/20.10/2010.sql | 2 +- sql/structure.sql | 3 +++ test/unitTests/app/customField/CustomFieldControllerTest.php | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/migration/20.10/2010.sql b/migration/20.10/2010.sql index 13d542339cf..a0d15742fa4 100755 --- a/migration/20.10/2010.sql +++ b/migration/20.10/2010.sql @@ -298,7 +298,7 @@ UPDATE res_attachments SET attachment_type = 'reply_record_management' WHERE att ALTER TABLE custom_fields DROP COLUMN IF EXISTS mode; DROP TYPE IF EXISTS custom_fields_modes; CREATE TYPE custom_fields_modes AS ENUM ('form', 'technical'); -ALTER TABLE custom_fields ADD COLUMN mode custom_fields_modes DEFAULT 'form'; +ALTER TABLE custom_fields ADD COLUMN mode custom_fields_modes NOT NULL DEFAULT 'form'; /* RE CREATE VIEWS */ CREATE OR REPLACE VIEW res_view_letterbox AS diff --git a/sql/structure.sql b/sql/structure.sql index 019eef42b06..49d128b5e6f 100755 --- a/sql/structure.sql +++ b/sql/structure.sql @@ -1314,11 +1314,14 @@ CONSTRAINT acknowledgement_receipts_pkey PRIMARY KEY (id) ) WITH (OIDS=FALSE); +CREATE TYPE custom_fields_modes AS ENUM ('form', 'technical'); + CREATE TABLE custom_fields ( id serial NOT NULL, label character varying(256) NOT NULL, type character varying(256) NOT NULL, + mode custom_fields_modes NOT NULL DEFAULT 'form', values jsonb, CONSTRAINT custom_fields_pkey PRIMARY KEY (id), CONSTRAINT custom_fields_unique_key UNIQUE (label) diff --git a/test/unitTests/app/customField/CustomFieldControllerTest.php b/test/unitTests/app/customField/CustomFieldControllerTest.php index 6dead37c9b1..3ba2cef0670 100644 --- a/test/unitTests/app/customField/CustomFieldControllerTest.php +++ b/test/unitTests/app/customField/CustomFieldControllerTest.php @@ -24,6 +24,7 @@ class CustomFieldControllerTest extends TestCase $args = [ 'label' => 'mon custom', 'type' => 'select', + 'mode' => 'form', 'values' => ['one', 'two'] ]; $fullRequest = \httpRequestCustom::addContentInBody($args, $request); @@ -43,6 +44,7 @@ class CustomFieldControllerTest extends TestCase $args = [ 'label' => 'mon custom', 'type' => 'select', + 'mode' => 'form', 'values' => ['one', 'two'] ]; $fullRequest = \httpRequestCustom::addContentInBody($args, $request); @@ -76,6 +78,7 @@ class CustomFieldControllerTest extends TestCase $args = [ 'label' => 'mon custom22', + 'mode' => 'form', 'values' => ['one', 'two', 'trois'] ]; $fullRequest = \httpRequestCustom::addContentInBody($args, $request); -- GitLab