From abda9146f1143696d9117143f816987166fffe55 Mon Sep 17 00:00:00 2001
From: florian HENRY <florian.henry@atm-consulting.fr>
Date: Wed, 7 Sep 2016 11:32:45 +0200
Subject: [PATCH] FIX : cannot add order line (if fk column is not in user they
 whould be NULL by defaut.

---
 htdocs/install/mysql/migration/4.0.0-5.0.0.sql  | 2 +-
 htdocs/install/mysql/tables/llx_commandedet.sql | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql
index 424ee7463e3..566e51ff757 100644
--- a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql
+++ b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql
@@ -28,7 +28,7 @@ ALTER TABLE llx_user DROP COLUMN phenix_pass;
 
 ALTER TABLE llx_societe ADD COLUMN fk_account integer;
 
-ALTER TABLE llx_commandedet ADD COLUMN fk_commandefourndet	integer NOT NULL after import_key;   -- link to detail line of commande fourn (resplenish)
+ALTER TABLE llx_commandedet ADD COLUMN fk_commandefourndet	integer DEFAULT NULL after import_key;   -- link to detail line of commande fourn (resplenish)
 
 ALTER TABLE llx_website ADD COLUMN virtualhost varchar(255) after fk_default_home;
 
diff --git a/htdocs/install/mysql/tables/llx_commandedet.sql b/htdocs/install/mysql/tables/llx_commandedet.sql
index ee407fe9cff..913351ef2f8 100644
--- a/htdocs/install/mysql/tables/llx_commandedet.sql
+++ b/htdocs/install/mysql/tables/llx_commandedet.sql
@@ -57,7 +57,7 @@ create table llx_commandedet
   fk_unit            integer      DEFAULT NULL,           -- lien vers table des unités
   import_key					varchar(14),
   
-  fk_commandefourndet					integer NOT NULL,       -- link to detail line of commande fourn (resplenish)
+  fk_commandefourndet			integer DEFAULT NULL,       -- link to detail line of commande fourn (resplenish)
   
   fk_multicurrency		integer,
   multicurrency_code			varchar(255),
-- 
GitLab