noalyss-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Noalyss-commit] [noalyss] 50/65: Fix SQL upgrade


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 50/65: Fix SQL upgrade
Date: Wed, 09 Sep 2015 08:27:29 +0000

sparkyx pushed a commit to branch master
in repository noalyss.

commit b4652751579d26b3899990716bba62ae4f143bbf
Author: Dany De Bontridder <address@hidden>
Date:   Sun Sep 6 07:06:15 2015 +0200

    Fix SQL upgrade
---
 html/admin/sql/patch/upgrade120.sql |   14 ++++++++++----
 sql/upgrade.sql                     |    9 ++++++++-
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/html/admin/sql/patch/upgrade120.sql 
b/html/admin/sql/patch/upgrade120.sql
index be27190..1eb7daf 100644
--- a/html/admin/sql/patch/upgrade120.sql
+++ b/html/admin/sql/patch/upgrade120.sql
@@ -173,18 +173,24 @@ begin
         ('CONTACT',
         'contact.inc.php',
           'Contact','Liste de vos contacts','ME','Liste de vos contacts 
normalement liée à des fiches de sociétés');
-
+    end if;
+    
+    select count(*) into n_count from profile_menu where me_code='CONTACT' and 
p_id=1;
+    if n_count = 0 then
         insert into 
profile_menu(me_code,me_code_dep,p_id,p_order,p_type_display,pm_default,pm_id_dep)
 select 'CONTACT','GESTION',1,22,'E',0,(select pm_id from profile_menu where 
me_code='GESTION' and p_id=1);
+    end if;
+
+    select count(*) into n_count from profile_menu where me_code='CONTACT' and 
p_id=2;
+    if n_count = 0 then
         insert into 
profile_menu(me_code,me_code_dep,p_id,p_order,p_type_display,pm_default,pm_id_dep)
 select 'CONTACT','GESTION',2,22,'E',0,(select pm_id from profile_menu where 
me_code='GESTION' and p_id=2);
     end if;
 end;
 $BODY$
-language plpgsql;
+LANGUAGE plpgsql;
 
 select insert_menu();
 
 drop function insert_menu();
-
 drop view v_all_menu;
 
 CREATE OR REPLACE VIEW v_all_menu AS 
@@ -266,7 +272,7 @@ begin
        return;
 end;
 $BODY$
-  LANGUAGE plpgsql;
+LANGUAGE plpgsql;
 
 update version set val=121;
 
diff --git a/sql/upgrade.sql b/sql/upgrade.sql
index 8edf7df..3516c8a 100644
--- a/sql/upgrade.sql
+++ b/sql/upgrade.sql
@@ -172,8 +172,15 @@ begin
         ('CONTACT',
         'contact.inc.php',
           'Contact','Liste de vos contacts','ME','Liste de vos contacts 
normalement liée à des fiches de sociétés');
-
+    end if;
+    
+    select count(*) into n_count from profile_menu where me_code='CONTACT' and 
p_id=1;
+    if n_count = 0 then
         insert into 
profile_menu(me_code,me_code_dep,p_id,p_order,p_type_display,pm_default,pm_id_dep)
 select 'CONTACT','GESTION',1,22,'E',0,(select pm_id from profile_menu where 
me_code='GESTION' and p_id=1);
+    end if;
+
+    select count(*) into n_count from profile_menu where me_code='CONTACT' and 
p_id=2;
+    if n_count = 0 then
         insert into 
profile_menu(me_code,me_code_dep,p_id,p_order,p_type_display,pm_default,pm_id_dep)
 select 'CONTACT','GESTION',2,22,'E',0,(select pm_id from profile_menu where 
me_code='GESTION' and p_id=2);
     end if;
 end;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]