From 67f05515d9eb152c8a32be0bbeb5341fa2a4c908 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Tue, 3 Jun 2014 06:19:24 +0200 Subject: [PATCH 1/2] Add accountancy_code into llx_c_paiement --- htdocs/admin/dict.php | 10 +++++----- htdocs/install/mysql/tables/llx_c_paiement.sql | 14 ++++++++------ 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index d834929d00f45..38fdf20d2c4b6 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -8,7 +8,7 @@ * Copyright (C) 2011 Remy Younes * Copyright (C) 2012-2013 Marcos GarcĂ­a * Copyright (C) 2012 Christophe Battarel - * Copyright (C) 2011-2012 Alexandre Spangaro + * Copyright (C) 2011-2014 Alexandre Spangaro * * 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 @@ -144,7 +144,7 @@ $tabsql[10]= "SELECT t.rowid, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, p.libelle as country, p.code as country_code, t.fk_pays as country_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p WHERE t.fk_pays=p.rowid"; $tabsql[11]= "SELECT t.rowid as rowid, element, source, code, libelle, active FROM ".MAIN_DB_PREFIX."c_type_contact AS t"; $tabsql[12]= "SELECT c.rowid as rowid, code, sortorder, c.libelle, c.libelle_facture, nbjour, fdm, decalage, active FROM ".MAIN_DB_PREFIX.'c_payment_term AS c'; -$tabsql[13]= "SELECT id as rowid, code, c.libelle, type, active FROM ".MAIN_DB_PREFIX."c_paiement AS c"; +$tabsql[13]= "SELECT id as rowid, code, c.libelle, type, active, accountancy_code FROM ".MAIN_DB_PREFIX."c_paiement AS c"; $tabsql[14]= "SELECT e.rowid as rowid, e.code as code, e.libelle, e.price, e.organization, e.fk_pays as country_id, p.code as country_code, p.libelle as country, e.active FROM ".MAIN_DB_PREFIX."c_ecotaxe AS e, ".MAIN_DB_PREFIX."c_pays as p WHERE e.fk_pays=p.rowid and p.active=1"; $tabsql[15]= "SELECT rowid as rowid, code, label as libelle, width, height, unit, active FROM ".MAIN_DB_PREFIX."c_paper_format"; $tabsql[16]= "SELECT code, label as libelle, sortorder, active FROM ".MAIN_DB_PREFIX."c_prospectlevel"; @@ -202,7 +202,7 @@ $tabfield[10]= "country_id,country,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code_sell,accountancy_code_buy,note"; $tabfield[11]= "element,source,code,libelle"; $tabfield[12]= "code,libelle,libelle_facture,nbjour,fdm,decalage"; -$tabfield[13]= "code,libelle,type"; +$tabfield[13]= "code,libelle,type,accountancy_code"; $tabfield[14]= "code,libelle,price,organization,country_id,country"; $tabfield[15]= "code,libelle,width,height,unit"; $tabfield[16]= "code,libelle,sortorder"; @@ -231,7 +231,7 @@ $tabfieldvalue[10]= "country,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code_sell,accountancy_code_buy,note"; $tabfieldvalue[11]= "element,source,code,libelle"; $tabfieldvalue[12]= "code,libelle,libelle_facture,nbjour,fdm,decalage"; -$tabfieldvalue[13]= "code,libelle,type"; +$tabfieldvalue[13]= "code,libelle,type,accountancy_code"; $tabfieldvalue[14]= "code,libelle,price,organization,country"; $tabfieldvalue[15]= "code,libelle,width,height,unit"; $tabfieldvalue[16]= "code,libelle,sortorder"; @@ -260,7 +260,7 @@ $tabfieldinsert[10]= "fk_pays,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code_sell,accountancy_code_buy,note"; $tabfieldinsert[11]= "element,source,code,libelle"; $tabfieldinsert[12]= "code,libelle,libelle_facture,nbjour,fdm,decalage"; -$tabfieldinsert[13]= "code,libelle,type"; +$tabfieldinsert[13]= "code,libelle,type,accountancy_code"; $tabfieldinsert[14]= "code,libelle,price,organization,fk_pays"; $tabfieldinsert[15]= "code,label,width,height,unit"; $tabfieldinsert[16]= "code,label,sortorder"; diff --git a/htdocs/install/mysql/tables/llx_c_paiement.sql b/htdocs/install/mysql/tables/llx_c_paiement.sql index 8d78992a4f89f..cc2f7500ab12f 100644 --- a/htdocs/install/mysql/tables/llx_c_paiement.sql +++ b/htdocs/install/mysql/tables/llx_c_paiement.sql @@ -1,6 +1,7 @@ -- ======================================================================== -- Copyright (C) 2001-2004 Rodolphe Quiedeville -- Copyright (C) 2004 Laurent Destailleur +-- Copyright (C) 2014 Alexandre Spangaro -- -- 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 @@ -26,12 +27,13 @@ create table llx_c_paiement ( - id integer PRIMARY KEY, - code varchar(6) NOT NULL, - libelle varchar(30), - type smallint, - active tinyint DEFAULT 1 NOT NULL, - module varchar(32) NULL + id integer PRIMARY KEY, + code varchar(6) NOT NULL, + libelle varchar(30), + type smallint, + active tinyint DEFAULT 1 NOT NULL, + accountancy_code varchar(32) DEFAULT NULL, + module varchar(32) NULL )ENGINE=innodb; From 865d853af8cab161fc3501e3b822455b8c56a856 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Tue, 24 Jun 2014 06:02:17 +0200 Subject: [PATCH 2/2] Add migration file to 3.7 & update llx_c_paiement --- .../install/mysql/migration/3.6.0-3.7.0.sql | 21 +++++++++++++++++++ .../install/mysql/tables/llx_c_paiement.sql | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 htdocs/install/mysql/migration/3.6.0-3.7.0.sql diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql new file mode 100644 index 0000000000000..a57c3e5a743b8 --- /dev/null +++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql @@ -0,0 +1,21 @@ +-- +-- Be carefull to requests order. +-- This file must be loaded by calling /install/index.php page +-- when current version is 3.7.0 or higher. +-- +-- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new; +-- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol; +-- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60); +-- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname; +-- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60); +-- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name; +-- To restrict request to Mysql version x.y use -- VMYSQLx.y +-- To restrict request to Pgsql version x.y use -- VPGSQLx.y +-- To make pk to be auto increment (mysql): VMYSQL4.3 ALTER TABLE llx_c_shipment_mode CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT; +-- To make pk to be auto increment (postgres) VPGSQL8.2 NOT POSSIBLE. MUST DELETE/CREATE TABLE + +-- -- VPGSQL8.2 DELETE FROM llx_usergroup_user WHERE fk_user NOT IN (SELECT rowid from llx_user); +-- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); + + +ALTER TABLE llx_c_paiement ADD COLUMN accountancy_code varchar(32) DEFAULT NULL AFTER active; \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_c_paiement.sql b/htdocs/install/mysql/tables/llx_c_paiement.sql index cc2f7500ab12f..665897069cc5f 100644 --- a/htdocs/install/mysql/tables/llx_c_paiement.sql +++ b/htdocs/install/mysql/tables/llx_c_paiement.sql @@ -32,7 +32,7 @@ create table llx_c_paiement libelle varchar(30), type smallint, active tinyint DEFAULT 1 NOT NULL, - accountancy_code varchar(32) DEFAULT NULL, + accountancy_code varchar(32) NULL, module varchar(32) NULL )ENGINE=innodb;