14.0.0-15.0.0.sql 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477
  1. --
  2. -- Be carefull to requests order.
  3. -- This file must be loaded by calling /install/index.php page
  4. -- when current version is 14.0.0 or higher.
  5. --
  6. -- To restrict request to Mysql version x.y minimum use -- VMYSQLx.y
  7. -- To restrict request to Pgsql version x.y minimum use -- VPGSQLx.y
  8. -- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new;
  9. -- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol;
  10. -- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60);
  11. -- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname;
  12. -- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60);
  13. -- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name;
  14. -- To create a unique index ALTER TABLE llx_table ADD UNIQUE INDEX uk_table_field (field);
  15. -- To drop an index: -- VMYSQL4.1 DROP INDEX nomindex on llx_table;
  16. -- To drop an index: -- VPGSQL8.2 DROP INDEX nomindex;
  17. -- To make pk to be auto increment (mysql): -- VMYSQL4.3 ALTER TABLE llx_table CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT;
  18. -- To make pk to be auto increment (postgres):
  19. -- -- VPGSQL8.2 CREATE SEQUENCE llx_table_rowid_seq OWNED BY llx_table.rowid;
  20. -- -- VPGSQL8.2 ALTER TABLE llx_table ADD PRIMARY KEY (rowid);
  21. -- -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN rowid SET DEFAULT nextval('llx_table_rowid_seq');
  22. -- -- VPGSQL8.2 SELECT setval('llx_table_rowid_seq', MAX(rowid)) FROM llx_table;
  23. -- To set a field as NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NULL;
  24. -- To set a field as NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL;
  25. -- To set a field as NOT NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NOT NULL;
  26. -- To set a field as NOT NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET NOT NULL;
  27. -- To set a field as default NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL;
  28. -- Note: fields with type BLOB/TEXT can't have default value.
  29. -- To rebuild sequence for postgresql after insert by forcing id autoincrement fields:
  30. -- -- VPGSQL8.2 SELECT dol_util_rebuild_sequences();
  31. -- Missing in v14 or lower
  32. -- VMYSQL4.3 ALTER TABLE llx_partnership MODIFY COLUMN date_partnership_end date NULL;
  33. -- VPGSQL8.2 ALTER TABLE llx_partnership ALTER COLUMN date_partnership_end DROP NOT NULL;
  34. ALTER TABLE llx_accounting_bookkeeping ADD COLUMN date_export datetime DEFAULT NULL;
  35. ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN fk_project integer NOT NULL;
  36. ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN fk_invoice integer NULL;
  37. ALTER TABLE llx_eventorganization_conferenceorboothattendee DROP FOREIGN KEY fx_eventorganization_conferenceorboothattendee_fk_soc;
  38. ALTER TABLE llx_eventorganization_conferenceorboothattendee DROP FOREIGN KEY fx_eventorganization_conferenceorboothattendee_fk_actioncomm;
  39. ALTER TABLE llx_eventorganization_conferenceorboothattendee DROP FOREIGN KEY fx_eventorganization_conferenceorboothattendee_fk_project;
  40. ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_rowid (rowid);
  41. ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_ref (ref);
  42. ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_fk_soc (fk_soc);
  43. ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_fk_actioncomm (fk_actioncomm);
  44. ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_email (email);
  45. ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_status (status);
  46. -- VMYSQL4.1 DROP INDEX uk_eventorganization_conferenceorboothattendee on llx_eventorganization_conferenceorboothattendee;
  47. -- VPGSQL8.2 DROP INDEX uk_eventorganization_conferenceorboothattendee;
  48. ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD UNIQUE INDEX uk_eventorganization_conferenceorboothattendee(fk_project, email, fk_actioncomm);
  49. -- VMYSQL4.3 ALTER TABLE llx_eventorganization_conferenceorboothattendee MODIFY COLUMN fk_actioncomm integer NULL;
  50. -- VPGSQL8.2 ALTER TABLE llx_eventorganization_conferenceorboothattendee ALTER COLUMN fk_actioncomm DROP NOT NULL;
  51. ALTER TABLE llx_mrp_mo ADD COLUMN last_main_doc varchar(255);
  52. UPDATE llx_extrafields SET elementtype = 'salary' WHERE elementtype = 'payment_salary';
  53. ALTER TABLE llx_payment_salary_extrafields RENAME TO llx_salary_extrafields;
  54. -- VMYSQL4.1 DROP INDEX idx_payment_salary_extrafields on llx_salary_extrafields;
  55. -- VPGSQL8.2 DROP INDEX idx_payment_salary_extrafields;
  56. ALTER TABLE llx_salary_extrafields ADD INDEX idx_salary_extrafields (fk_object);
  57. INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailAskConf)', 10, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskConf)__', '__(Hello)__,<br /><br />__(OrganizationEventConfRequestWasReceived)__<br /><br /><br />__(Sincerely)__<br />__USER_SIGNATURE__', null, '1', null);
  58. INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailAskBooth)', 20, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskBooth)__', '__(Hello)__,<br /><br />__(OrganizationEventBoothRequestWasReceived)__<br /><br /><br />__(Sincerely)__<br />__USER_SIGNATURE__', null, '1', null);
  59. -- TODO Add message for registration only to event __ONLINE_PAYMENT_TEXT_AND_URL__
  60. INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailSubsBooth)', 30, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailBoothPayment)__', '__(Hello)__,<br /><br />__(OrganizationEventPaymentOfBoothWasReceived)__<br /><br /><br />__(Sincerely)__<br />__USER_SIGNATURE__', null, '1', null);
  61. INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailSubsEvent)', 40, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailRegistrationPayment)__', '__(Hello)__,<br /><br />__(OrganizationEventPaymentOfRegistrationWasReceived)__<br /><br />__(Sincerely)__<br />__USER_SIGNATURE__', null, '1', null);
  62. INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationMassEmailAttendees)', 50, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailAttendees)__', '__(Hello)__,<br /><br />__(OrganizationEventBulkMailToAttendees)__<br /><br />__(Sincerely)__<br />__USER_SIGNATURE__', null, '1', null);
  63. INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationMassEmailSpeakers)', 60, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailSpeakers)__', '__(Hello)__,<br /><br />__(OrganizationEventBulkMailToSpeakers)__<br /><br />__(Sincerely)__<br />__USER_SIGNATURE__', null, '1', null);
  64. --Fix bad sign on multicompany column for customer invoice lines
  65. UPDATE llx_facturedet SET multicurrency_subprice = -multicurrency_subprice WHERE ((multicurrency_subprice < 0 and subprice > 0) OR (multicurrency_subprice > 0 and subprice < 0));
  66. UPDATE llx_facturedet SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0));
  67. UPDATE llx_facturedet SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and total_tva > 0) OR (multicurrency_total_tva > 0 and total_tva < 0));
  68. UPDATE llx_facturedet SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
  69. --Fix bad sign on multicompany column for customer invoices
  70. UPDATE llx_facture SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0));
  71. UPDATE llx_facture SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and total_tva > 0) OR (multicurrency_total_tva > 0 and total_tva < 0));
  72. UPDATE llx_facture SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
  73. --Fix bad sign on multicurrency column for supplier invoice lines
  74. UPDATE llx_facture_fourn_det SET multicurrency_subprice = -multicurrency_subprice WHERE ((multicurrency_subprice < 0 and pu_ht > 0) OR (multicurrency_subprice > 0 and pu_ht < 0));
  75. UPDATE llx_facture_fourn_det SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0));
  76. UPDATE llx_facture_fourn_det SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and tva > 0) OR (multicurrency_total_tva > 0 and tva < 0));
  77. UPDATE llx_facture_fourn_det SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
  78. --Fix bad sign on multicompany column for customer invoices
  79. UPDATE llx_facture_fourn SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0));
  80. UPDATE llx_facture_fourn SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and total_tva > 0) OR (multicurrency_total_tva > 0 and total_tva < 0));
  81. UPDATE llx_facture_fourn SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
  82. -- v15
  83. ALTER TABLE llx_c_partnership_type ADD UNIQUE INDEX uk_c_partnership_type(entity, code);
  84. ALTER TABLE llx_partnership ADD COLUMN fk_type integer DEFAULT 0 NOT NULL;
  85. ALTER TABLE llx_c_holiday_types CHANGE COLUMN newByMonth newbymonth double(8,5) DEFAULT 0 NOT NULL;
  86. ALTER TABLE llx_product ADD COLUMN mandatory_period tinyint NULL DEFAULT 0;
  87. ALTER TABLE llx_holiday ADD COLUMN date_approve DATETIME DEFAULT NULL;
  88. ALTER TABLE llx_holiday ADD COLUMN fk_user_approve integer DEFAULT NULL;
  89. ALTER TABLE llx_ticket MODIFY COLUMN progress integer;
  90. ALTER TABLE llx_emailcollector_emailcollectoraction MODIFY COLUMN actionparam TEXT;
  91. ALTER TABLE llx_knowledgemanagement_knowledgerecord ADD COLUMN lang varchar(6);
  92. ALTER TABLE llx_knowledgemanagement_knowledgerecord ADD COLUMN entity integer DEFAULT 1;
  93. CREATE TABLE llx_categorie_ticket
  94. (
  95. fk_categorie integer NOT NULL,
  96. fk_ticket integer NOT NULL,
  97. import_key varchar(14)
  98. ) ENGINE=innodb;
  99. ALTER TABLE llx_categorie_ticket ADD PRIMARY KEY pk_categorie_ticket (fk_categorie, fk_ticket);
  100. ALTER TABLE llx_categorie_ticket ADD INDEX idx_categorie_ticket_fk_categorie (fk_categorie);
  101. ALTER TABLE llx_categorie_ticket ADD INDEX idx_categorie_ticket_fk_ticket (fk_ticket);
  102. ALTER TABLE llx_categorie_ticket ADD CONSTRAINT fk_categorie_ticket_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid);
  103. ALTER TABLE llx_categorie_ticket ADD CONSTRAINT fk_categorie_ticket_ticket_rowid FOREIGN KEY (fk_ticket) REFERENCES llx_ticket (rowid);
  104. ALTER TABLE llx_product_fournisseur_price MODIFY COLUMN ref_fourn varchar(128);
  105. ALTER TABLE llx_product_customer_price MODIFY COLUMN ref_customer varchar(128);
  106. ALTER TABLE llx_product_association ADD COLUMN rang integer DEFAULT 0;
  107. -- -- add action trigger
  108. INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) VALUES ('ORDER_SUPPLIER_CANCEL','Supplier order request canceled','Executed when a supplier order is canceled','order_supplier',13);
  109. ALTER TABLE llx_product ADD COLUMN fk_default_bom integer DEFAULT NULL;
  110. ALTER TABLE llx_mrp_mo ADD COLUMN mrptype integer DEFAULT 0;
  111. DELETE FROM llx_menu WHERE type = 'top' AND module = 'cashdesk' AND mainmenu = 'cashdesk';
  112. INSERT INTO llx_c_action_trigger (code, label, description, elementtype, rang) values ('MEMBER_EXCLUDE', 'Member excluded', 'Executed when a member is excluded', 'member', 27);
  113. CREATE TABLE llx_categorie_knowledgemanagement
  114. (
  115. fk_categorie integer NOT NULL,
  116. fk_knowledgemanagement integer NOT NULL,
  117. import_key varchar(14)
  118. )ENGINE=innodb;
  119. ALTER TABLE llx_categorie_knowledgemanagement ADD PRIMARY KEY pk_categorie_knowledgemanagement (fk_categorie, fk_knowledgemanagement);
  120. ALTER TABLE llx_categorie_knowledgemanagement ADD INDEX idx_categorie_knowledgemanagement_fk_categorie (fk_categorie);
  121. ALTER TABLE llx_categorie_knowledgemanagement ADD INDEX idx_categorie_knowledgemanagement_fk_knowledgemanagement (fk_knowledgemanagement);
  122. ALTER TABLE llx_categorie_knowledgemanagement ADD CONSTRAINT fk_categorie_knowledgemanagement_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid);
  123. ALTER TABLE llx_categorie_knowledgemanagement ADD CONSTRAINT fk_categorie_knowledgemanagement_knowledgemanagement_rowid FOREIGN KEY (fk_knowledgemanagement) REFERENCES llx_knowledgemanagement_knowledgerecord (rowid);
  124. ALTER TABLE llx_product_lot ADD COLUMN barcode varchar(180) DEFAULT NULL;
  125. ALTER TABLE llx_product_lot ADD COLUMN fk_barcode_type integer DEFAULT NULL;
  126. ALTER TABLE llx_projet ADD COLUMN max_attendees integer DEFAULT 0;
  127. ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN cost_price double(24,8) DEFAULT 0;
  128. INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2001', 'Aktiebolag');
  129. INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2002', 'Publikt aktiebolag (AB publ)');
  130. INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2003', 'Ekonomisk förening (ek. för.)');
  131. INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2004', 'Bostadsrättsförening (BRF)');
  132. INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2005', 'Hyresrättsförening (HRF)');
  133. INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2006', 'Kooperativ');
  134. INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2007', 'Enskild firma (EF)');
  135. INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2008', 'Handelsbolag (HB)');
  136. INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2009', 'Kommanditbolag (KB)');
  137. INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2010', 'Enkelt bolag');
  138. INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2011', 'Ideell förening');
  139. INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2012', 'Stiftelse');
  140. -- START GRH/HRM MODULE
  141. CREATE TABLE llx_hrm_evaluation
  142. (
  143. rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
  144. ref varchar(128) DEFAULT '(PROV)' NOT NULL,
  145. label varchar(255),
  146. description text,
  147. note_public text,
  148. note_private text,
  149. date_creation datetime NOT NULL,
  150. tms timestamp,
  151. fk_user_creat integer NOT NULL,
  152. fk_user_modif integer,
  153. import_key varchar(14),
  154. status smallint NOT NULL,
  155. date_eval date,
  156. fk_user integer NOT NULL,
  157. fk_job integer NOT NULL
  158. ) ENGINE=innodb;
  159. ALTER TABLE llx_hrm_evaluation ADD INDEX idx_hrm_evaluation_rowid (rowid);
  160. ALTER TABLE llx_hrm_evaluation ADD INDEX idx_hrm_evaluation_ref (ref);
  161. ALTER TABLE llx_hrm_evaluation ADD CONSTRAINT llx_hrm_evaluation_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid);
  162. ALTER TABLE llx_hrm_evaluation ADD INDEX idx_hrm_evaluation_status (status);
  163. create table llx_hrm_evaluation_extrafields
  164. (
  165. rowid integer AUTO_INCREMENT PRIMARY KEY,
  166. tms timestamp,
  167. fk_object integer NOT NULL,
  168. import_key varchar(14) -- import key
  169. ) ENGINE=innodb;
  170. ALTER TABLE llx_hrm_evaluation_extrafields ADD INDEX idx_evaluation_fk_object(fk_object);
  171. CREATE TABLE llx_hrm_evaluationdet
  172. (
  173. -- BEGIN MODULEBUILDER FIELDS
  174. rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
  175. date_creation datetime NOT NULL,
  176. tms timestamp,
  177. fk_user_creat integer NOT NULL,
  178. fk_user_modif integer,
  179. fk_skill integer NOT NULL,
  180. fk_evaluation integer NOT NULL,
  181. rankorder integer NOT NULL,
  182. required_rank integer NOT NULL,
  183. import_key varchar(14)
  184. ) ENGINE=innodb;
  185. ALTER TABLE llx_hrm_evaluationdet ADD INDEX idx_hrm_evaluationdet_rowid (rowid);
  186. ALTER TABLE llx_hrm_evaluationdet ADD CONSTRAINT llx_hrm_evaluationdet_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid);
  187. ALTER TABLE llx_hrm_evaluationdet ADD INDEX idx_hrm_evaluationdet_fk_skill (fk_skill);
  188. ALTER TABLE llx_hrm_evaluationdet ADD INDEX idx_hrm_evaluationdet_fk_evaluation (fk_evaluation);
  189. create table llx_hrm_evaluationdet_extrafields
  190. (
  191. rowid integer AUTO_INCREMENT PRIMARY KEY,
  192. tms timestamp,
  193. fk_object integer NOT NULL,
  194. import_key varchar(14) -- import key
  195. ) ENGINE=innodb;
  196. ALTER TABLE llx_hrm_evaluationdet_extrafields ADD INDEX idx_evaluationdet_fk_object(fk_object);
  197. CREATE TABLE llx_hrm_job
  198. (
  199. rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
  200. label varchar(255) NOT NULL,
  201. description text,
  202. date_creation datetime NOT NULL,
  203. tms timestamp,
  204. deplacement varchar(255),
  205. note_public text,
  206. note_private text,
  207. fk_user_creat integer,
  208. fk_user_modif integer
  209. ) ENGINE=innodb;
  210. ALTER TABLE llx_hrm_job ADD INDEX idx_hrm_job_rowid (rowid);
  211. ALTER TABLE llx_hrm_job ADD INDEX idx_hrm_job_label (label);
  212. create table llx_hrm_job_extrafields
  213. (
  214. rowid integer AUTO_INCREMENT PRIMARY KEY,
  215. tms timestamp,
  216. fk_object integer NOT NULL,
  217. import_key varchar(14) -- import key
  218. ) ENGINE=innodb;
  219. ALTER TABLE llx_hrm_job_extrafields ADD INDEX idx_job_fk_object(fk_object);
  220. CREATE TABLE llx_hrm_job_user(
  221. rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
  222. -- ref varchar(128) NOT NULL,
  223. description text,
  224. date_creation datetime NOT NULL,
  225. tms timestamp,
  226. fk_contrat integer,
  227. fk_user integer NOT NULL,
  228. fk_job integer NOT NULL,
  229. date_start date,
  230. date_end date,
  231. abort_comment varchar(255),
  232. note_public text,
  233. note_private text,
  234. fk_user_creat integer,
  235. fk_user_modif integer
  236. ) ENGINE=innodb;
  237. ALTER TABLE llx_hrm_job_user ADD COLUMN abort_comment varchar(255);
  238. ALTER TABLE llx_hrm_job_user ADD INDEX idx_hrm_job_user_rowid (rowid);
  239. -- ALTER TABLE llx_hrm_job_user ADD INDEX idx_hrm_job_user_ref (ref);
  240. CREATE TABLE llx_hrm_skill
  241. (
  242. rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
  243. label varchar(255),
  244. description text,
  245. date_creation datetime NOT NULL,
  246. tms timestamp,
  247. fk_user_creat integer NOT NULL,
  248. fk_user_modif integer,
  249. required_level integer NOT NULL,
  250. date_validite integer NOT NULL,
  251. temps_theorique double(24,8) NOT NULL,
  252. skill_type integer NOT NULL,
  253. note_public text,
  254. note_private text
  255. ) ENGINE=innodb;
  256. ALTER TABLE llx_hrm_skill ADD INDEX idx_hrm_skill_rowid (rowid);
  257. ALTER TABLE llx_hrm_skill ADD CONSTRAINT llx_hrm_skill_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid);
  258. ALTER TABLE llx_hrm_skill ADD INDEX idx_hrm_skill_skill_type (skill_type);
  259. create table llx_hrm_skill_extrafields
  260. (
  261. rowid integer AUTO_INCREMENT PRIMARY KEY,
  262. tms timestamp,
  263. fk_object integer NOT NULL,
  264. import_key varchar(14) -- import key
  265. ) ENGINE=innodb;
  266. ALTER TABLE llx_hrm_skill_extrafields ADD INDEX idx_skill_fk_object(fk_object);
  267. CREATE TABLE llx_hrm_skilldet
  268. (
  269. rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
  270. description text,
  271. fk_user_creat integer NOT NULL,
  272. fk_user_modif integer,
  273. fk_skill integer NOT NULL,
  274. rankorder integer
  275. ) ENGINE=innodb;
  276. ALTER TABLE llx_hrm_skilldet ADD COLUMN rankorder integer NOT NULL DEFAULT '1';
  277. ALTER TABLE llx_hrm_skilldet ADD INDEX idx_hrm_skilldet_rowid (rowid);
  278. ALTER TABLE llx_hrm_skilldet ADD CONSTRAINT llx_hrm_skilldet_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid);
  279. CREATE TABLE llx_hrm_skillrank
  280. (
  281. rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
  282. fk_skill integer NOT NULL,
  283. rankorder integer NOT NULL,
  284. fk_object integer NOT NULL,
  285. date_creation datetime NOT NULL,
  286. tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  287. fk_user_creat integer NOT NULL,
  288. fk_user_modif integer,
  289. objecttype varchar(128) NOT NULL
  290. ) ENGINE=innodb;
  291. ALTER TABLE llx_hrm_skillrank ADD INDEX idx_hrm_skillrank_rowid (rowid);
  292. ALTER TABLE llx_hrm_skillrank ADD INDEX idx_hrm_skillrank_fk_skill (fk_skill);
  293. ALTER TABLE llx_hrm_skillrank ADD CONSTRAINT llx_hrm_skillrank_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid);
  294. --END GRH/HRM MODULE
  295. ALTER TABLE llx_c_units ADD COLUMN sortorder smallint AFTER code;
  296. -- Manage accountancy auxiliary account for thirdparties per entity
  297. ALTER TABLE llx_societe_perentity ADD COLUMN accountancy_code_customer varchar(24) AFTER entity; -- equivalent to code_compta in llx_societe
  298. ALTER TABLE llx_societe_perentity ADD COLUMN accountancy_code_supplier varchar(24) AFTER accountancy_code_customer; -- equivalent to code_compta_supplier in llx_societe
  299. ALTER TABLE llx_projet_task ADD COLUMN budget_amount double(24,8) AFTER priority;
  300. -- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_graph_ticket_by_severity.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_graph_ticket_by_severity.php' AND entity = 1);
  301. -- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_graph_nb_ticket_last_x_days.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_graph_nb_ticket_last_x_days.php' AND entity = 1);
  302. -- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_graph_nb_tickets_type.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_graph_nb_tickets_type.php' AND entity = 1);
  303. -- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_graph_new_vs_close_ticket.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_graph_new_vs_close_ticket.php' AND entity = 1);
  304. ALTER TABLE llx_user DROP COLUMN jabberid;
  305. ALTER TABLE llx_user DROP COLUMN skype;
  306. ALTER TABLE llx_user DROP COLUMN twitter;
  307. ALTER TABLE llx_user DROP COLUMN facebook;
  308. ALTER TABLE llx_user DROP COLUMN linkedin;
  309. ALTER TABLE llx_user DROP COLUMN instagram;
  310. ALTER TABLE llx_user DROP COLUMN snapchat;
  311. ALTER TABLE llx_user DROP COLUMN googleplus;
  312. ALTER TABLE llx_user DROP COLUMN youtube;
  313. ALTER TABLE llx_user DROP COLUMN whatsapp;
  314. ALTER TABLE llx_adherent DROP COLUMN jabberid;
  315. ALTER TABLE llx_adherent DROP COLUMN skype;
  316. ALTER TABLE llx_adherent DROP COLUMN twitter;
  317. ALTER TABLE llx_adherent DROP COLUMN facebook;
  318. ALTER TABLE llx_adherent DROP COLUMN linkedin;
  319. ALTER TABLE llx_adherent DROP COLUMN instagram;
  320. ALTER TABLE llx_adherent DROP COLUMN snapchat;
  321. ALTER TABLE llx_adherent DROP COLUMN googleplus;
  322. ALTER TABLE llx_adherent DROP COLUMN youtube;
  323. ALTER TABLE llx_adherent DROP COLUMN whatsapp;
  324. ALTER TABLE llx_societe DROP COLUMN jabberid;
  325. ALTER TABLE llx_societe DROP COLUMN skype;
  326. ALTER TABLE llx_societe DROP COLUMN twitter;
  327. ALTER TABLE llx_societe DROP COLUMN facebook;
  328. ALTER TABLE llx_societe DROP COLUMN linkedin;
  329. ALTER TABLE llx_societe DROP COLUMN instagram;
  330. ALTER TABLE llx_societe DROP COLUMN snapchat;
  331. ALTER TABLE llx_societe DROP COLUMN googleplus;
  332. ALTER TABLE llx_societe DROP COLUMN youtube;
  333. ALTER TABLE llx_societe DROP COLUMN whatsapp;
  334. ALTER TABLE llx_socpeople DROP COLUMN jabberid;
  335. ALTER TABLE llx_socpeople DROP COLUMN skype;
  336. ALTER TABLE llx_socpeople DROP COLUMN twitter;
  337. ALTER TABLE llx_socpeople DROP COLUMN facebook;
  338. ALTER TABLE llx_socpeople DROP COLUMN linkedin;
  339. ALTER TABLE llx_socpeople DROP COLUMN instagram;
  340. ALTER TABLE llx_socpeople DROP COLUMN snapchat;
  341. ALTER TABLE llx_socpeople DROP COLUMN googleplus;
  342. ALTER TABLE llx_socpeople DROP COLUMN youtube;
  343. ALTER TABLE llx_socpeople DROP COLUMN whatsapp;
  344. INSERT INTO llx_c_paiement (id,code,libelle,type,active) values (100, 'KLA', 'Klarna', 1, 0);
  345. INSERT INTO llx_c_paiement (id,code,libelle,type,active) values (101, 'SOF', 'Sofort', 1, 0);
  346. INSERT INTO llx_c_paiement (id,code,libelle,type,active) values (102, 'BAN', 'Bancontact', 1, 0);
  347. INSERT INTO llx_c_paiement (id,code,libelle,type,active) values (103, 'IDE', 'iDeal', 1, 0);
  348. INSERT INTO llx_c_paiement (id,code,libelle,type,active) values (104, 'GIR', 'Giropay', 1, 0);
  349. ALTER TABLE llx_paiement_facture ADD COLUMN multicurrency_code varchar(3);
  350. ALTER TABLE llx_paiement_facture ADD COLUMN multicurrency_tx double(24,8) DEFAULT 1;
  351. ALTER TABLE llx_paiement_facture ADD COLUMN multicurrency_amount double(24,8) DEFAULT 0;
  352. ALTER TABLE llx_paiementfourn_facturefourn ADD COLUMN multicurrency_code varchar(3);
  353. ALTER TABLE llx_paiementfourn_facturefourn ADD COLUMN multicurrency_tx double(24,8) DEFAULT 1;
  354. ALTER TABLE llx_paiementfourn_facturefourn ADD COLUMN multicurrency_amount double(24,8) DEFAULT 0;
  355. ALTER TABLE llx_commande_fournisseur MODIFY COLUMN multicurrency_code varchar(3);
  356. ALTER TABLE llx_commande_fournisseurdet MODIFY COLUMN multicurrency_code varchar(3);
  357. ALTER TABLE llx_commande MODIFY COLUMN multicurrency_code varchar(3);
  358. ALTER TABLE llx_commandedet MODIFY COLUMN multicurrency_code varchar(3);
  359. ALTER TABLE llx_contratdet MODIFY COLUMN multicurrency_code varchar(3);
  360. ALTER TABLE llx_expensereport_det MODIFY COLUMN multicurrency_code varchar(3);
  361. ALTER TABLE llx_expensereport MODIFY COLUMN multicurrency_code varchar(3);
  362. ALTER TABLE llx_facture_fourn_det MODIFY COLUMN multicurrency_code varchar(3);
  363. ALTER TABLE llx_facture_fourn MODIFY COLUMN multicurrency_code varchar(3);
  364. ALTER TABLE llx_facture_rec MODIFY COLUMN multicurrency_code varchar(3);
  365. ALTER TABLE llx_facture MODIFY COLUMN multicurrency_code varchar(3);
  366. ALTER TABLE llx_facturedet_rec MODIFY COLUMN multicurrency_code varchar(3);
  367. ALTER TABLE llx_facturedet MODIFY COLUMN multicurrency_code varchar(3);
  368. ALTER TABLE llx_paiement_facture MODIFY COLUMN multicurrency_code varchar(3);
  369. ALTER TABLE llx_paiementfourn_facturefourn MODIFY COLUMN multicurrency_code varchar(3);
  370. ALTER TABLE llx_product_fournisseur_price_log MODIFY COLUMN multicurrency_code varchar(3);
  371. ALTER TABLE llx_product_fournisseur_price MODIFY COLUMN multicurrency_code varchar(3);
  372. ALTER TABLE llx_product_price_by_qty MODIFY COLUMN multicurrency_code varchar(3);
  373. ALTER TABLE llx_product_price MODIFY COLUMN multicurrency_code varchar(3);
  374. ALTER TABLE llx_propal MODIFY COLUMN multicurrency_code varchar(3);
  375. ALTER TABLE llx_propaldet MODIFY COLUMN multicurrency_code varchar(3);
  376. ALTER TABLE llx_societe MODIFY COLUMN multicurrency_code varchar(3);
  377. ALTER TABLE llx_supplier_proposal MODIFY COLUMN multicurrency_code varchar(3);
  378. ALTER TABLE llx_supplier_proposaldet MODIFY COLUMN multicurrency_code varchar(3);
  379. ALTER TABLE llx_propal ADD COLUMN online_sign_ip varchar(48);
  380. ALTER TABLE llx_propal ADD COLUMN online_sign_name varchar(64);
  381. ALTER TABLE llx_entrepot ADD COLUMN warehouse_usage integer DEFAULT 1;