From b31dbdc5ea5e2fb425c7fa871011b1d276f4d574 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 26 Apr 2023 11:48:43 +0200 Subject: [PATCH] Add dictionary table for invoice subtypes (country specific) --- .../install/mysql/migration/17.0.0-18.0.0.sql | 12 +++++++++ .../tables/llx_c_invoice_subtype.key.sql | 19 +++++++++++++ .../mysql/tables/llx_c_invoice_subtype.sql | 27 +++++++++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 htdocs/install/mysql/tables/llx_c_invoice_subtype.key.sql create mode 100644 htdocs/install/mysql/tables/llx_c_invoice_subtype.sql diff --git a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql index d47e84a255d..64ede43cf9f 100644 --- a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql +++ b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql @@ -399,3 +399,15 @@ ALTER TABLE llx_bom_bomline ADD COLUMN fk_default_workstation integer DEFAULT NU ALTER TABLE llx_mrp_production ADD COLUMN fk_default_workstation integer DEFAULT NULL; ALTER TABLE llx_facture ADD COLUMN subtype smallint DEFAULT NULL; + +CREATE TABLE llx_c_invoice_subtype ( + rowid integer AUTO_INCREMENT PRIMARY KEY, + entity integer DEFAULT 1, + fk_country integer NOT NULL, + code varchar(3) NOT NULL, + label varchar(100), + active tinyint DEFAULT 1 NOT NULL +) ENGINE=innodb; + +ALTER TABLE llx_c_invoice_subtype ADD UNIQUE INDEX uk_c_invoice_subtype (entity, code); + diff --git a/htdocs/install/mysql/tables/llx_c_invoice_subtype.key.sql b/htdocs/install/mysql/tables/llx_c_invoice_subtype.key.sql new file mode 100644 index 00000000000..a362755358a --- /dev/null +++ b/htdocs/install/mysql/tables/llx_c_invoice_subtype.key.sql @@ -0,0 +1,19 @@ +-- ======================================================================== +-- Copyright (C) 2023 Laurent Destailleur +-- +-- This program 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. +-- +-- This program 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 this program. If not, see . +-- +-- ======================================================================== + +ALTER TABLE llx_c_invoice_subtype ADD UNIQUE INDEX uk_c_invoice_subtype (entity, code); diff --git a/htdocs/install/mysql/tables/llx_c_invoice_subtype.sql b/htdocs/install/mysql/tables/llx_c_invoice_subtype.sql new file mode 100644 index 00000000000..0bdc10fc69d --- /dev/null +++ b/htdocs/install/mysql/tables/llx_c_invoice_subtype.sql @@ -0,0 +1,27 @@ +-- ======================================================================== +-- Copyright (C) 2023 Laurent Destailleur +-- +-- This program 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. +-- +-- This program 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 this program. If not, see . +-- +-- ======================================================================== + +CREATE TABLE llx_c_invoice_subtype ( + rowid integer AUTO_INCREMENT PRIMARY KEY, + entity integer DEFAULT 1, + fk_country integer NOT NULL, + code varchar(3) NOT NULL, + label varchar(100), + active tinyint DEFAULT 1 NOT NULL +) ENGINE=innodb; +