From b58e155a6f86bcc6bcf6c09842e587c0fb672bf1 Mon Sep 17 00:00:00 2001
From: Florian HENRY <florian.henry@open-concept.pro>
Date: Thu, 10 Mar 2016 12:22:49 +0100
Subject: [PATCH] FIX : #4785

---
 htdocs/install/mysql/migration/3.7.0-3.8.0.sql    | 14 +++++++++++++-
 htdocs/install/mysql/tables/llx_holiday_users.sql |  4 ++--
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql
index 388afda3e7e..ff1dbb77d4e 100755
--- a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql
+++ b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql
@@ -795,4 +795,16 @@ ALTER TABLE llx_societe_remise_except MODIFY COLUMN description text NOT NULL;
 
 -- Fix bad data
 update llx_opensurvey_sondage set format = 'D' where format = 'D+';
-update llx_opensurvey_sondage set format = 'A' where format = 'A+';
\ No newline at end of file
+update llx_opensurvey_sondage set format = 'A' where format = 'A+';
+
+--Deal with holidays_user that do not have rowid
+CREATE TABLE llx_holiday_users_tmp
+(
+	rowid       integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
+	fk_user     integer NOT NULL,
+	fk_type     integer NOT NULL,
+	nb_holiday  real NOT NULL DEFAULT '0'
+) ENGINE=innodb;
+INSERT INTO llx_holiday_users_tmp(fk_user,fk_type,nb_holiday) SELECT fk_user,fk_type,nb_holiday FROM llx_holiday_users;
+DROP TABLE llx_holiday_users;
+ALTER TABLE llx_holiday_users_tmp RENAME TO llx_holiday_users;
\ No newline at end of file
diff --git a/htdocs/install/mysql/tables/llx_holiday_users.sql b/htdocs/install/mysql/tables/llx_holiday_users.sql
index 5aa1c3fc061..a5bc2674392 100644
--- a/htdocs/install/mysql/tables/llx_holiday_users.sql
+++ b/htdocs/install/mysql/tables/llx_holiday_users.sql
@@ -18,8 +18,8 @@
 
 CREATE TABLE llx_holiday_users 
 (
+	rowid       integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
 	fk_user     integer NOT NULL,
 	fk_type     integer NOT NULL,
 	nb_holiday   real NOT NULL DEFAULT '0'
-) 
-ENGINE=innodb;
\ No newline at end of file
+) ENGINE=innodb;
\ No newline at end of file
-- 
GitLab