1-- ===================================================================
2-- Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3-- Copyright (C) 2009      Regis Houssin        <regis.houssin@inodbox.com>
4-- Copyright (C) 2011      Laurent Destailleur  <eldy@users.sourceforge.net>
5-- Copyright (C) 2015      Alexandre Spangaro   <aspangaro@open-dsi.fr>
6--
7-- This program is free software; you can redistribute it and/or modify
8-- it under the terms of the GNU General Public License as published by
9-- the Free Software Foundation; either version 3 of the License, or
10-- (at your option) any later version.
11--
12-- This program is distributed in the hope that it will be useful,
13-- but WITHOUT ANY WARRANTY; without even the implied warranty of
14-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15-- GNU General Public License for more details.
16--
17-- You should have received a copy of the GNU General Public License
18-- along with this program. If not, see <https://www.gnu.org/licenses/>.
19--
20-- ===================================================================
21
22
23create table llx_don
24(
25  rowid           integer AUTO_INCREMENT PRIMARY KEY,
26  ref             varchar(30) DEFAULT NULL,     -- Ref donation (TODO change to NOT NULL)
27  entity          integer DEFAULT 1 NOT NULL,	-- multi company id
28  tms             timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
29  fk_statut       smallint NOT NULL DEFAULT 0,  -- Status of donation promise or validate
30  datedon         datetime,                     -- Date of the donation/promise
31  amount          double(24,8) DEFAULT 0,
32  fk_payment      integer,						-- Id of payment mode
33  paid            smallint default 0 NOT NULL,
34  fk_soc      	  integer NULL,
35  firstname       varchar(50),
36  lastname        varchar(50),
37  societe         varchar(50),
38  address         text,
39  zip             varchar(30),
40  town            varchar(50),
41  country         varchar(50),					-- Deprecated - Replace with fk_country
42  fk_country      integer NOT NULL,
43  email           varchar(255),
44  phone           varchar(24),
45  phone_mobile    varchar(24),
46  public          smallint DEFAULT 1 NOT NULL,  -- Donation is public ? (0,1)
47  fk_projet       integer NULL,                 -- Donation is given for a project ?
48  datec           datetime,                     -- Create date
49  fk_user_author  integer NOT NULL,
50  fk_user_modif   integer,
51  date_valid      datetime,						-- date de validation
52  fk_user_valid   integer NULL,
53  note_private    text,
54  note_public     text,
55  model_pdf       varchar(255),
56  import_key      varchar(14),
57  extraparams	  varchar(255)							-- for other parameters with json format
58)ENGINE=innodb;
59