/[openfoncier]/trunk/data/pgsql/v3.14.0-a8.sql
ViewVC logotype

Contents of /trunk/data/pgsql/v3.14.0-a8.sql

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3008 - (show annotations)
Tue Apr 29 09:13:41 2014 UTC (10 years, 9 months ago) by vpihour
File size: 8971 byte(s)
Préparation de la release 3.14.0-a8

1 --------------------------------------------------------------------------------
2 -- Script de mise à jour vers la version v3.14.0-a8
3 --
4 -- XXX Ce fichier doit être renommé en v3.14.0-a8.sql au moment de la release
5 --
6 -- @package openfoncier
7 -- @version SVN : $Id$
8 --------------------------------------------------------------------------------
9
10 -- Les champs du rapport d'instruction en html
11 ALTER TABLE rapport_instruction RENAME analyse_reglementaire TO analyse_reglementaire_om_html;
12 ALTER TABLE rapport_instruction RENAME description_projet TO description_projet_om_html;
13
14 UPDATE om_requete SET requete=replace(requete, 'description_projet as','description_projet_om_html as');
15 UPDATE om_requete SET requete=replace(requete, 'analyse_reglementaire as','analyse_reglementaire_om_html as');
16
17 -- Contrainte d'unicité sur l'identifiant du DI dans données techniques
18 ALTER TABLE donnees_techniques ADD CONSTRAINT donnees_techniques_dossier_instruction_unique UNIQUE (dossier_instruction);
19 ALTER TABLE donnees_techniques ADD CONSTRAINT donnees_techniques_lot_unique UNIQUE (lot);
20 ALTER TABLE donnees_techniques ADD CONSTRAINT donnees_techniques_dossier_autorisation_unique UNIQUE (dossier_autorisation);
21 -- Ajout d'un champ cerfa au données techniques
22 ALTER TABLE donnees_techniques ADD COLUMN cerfa integer NOT NULL DEFAULT 0;
23 ALTER TABLE donnees_techniques ALTER COLUMN cerfa DROP DEFAULT;
24
25 -- Ajout des droits de visualisation et de téléchargement
26 -- du pdf associé à l'avis d'un service (objet consultation)
27 INSERT INTO om_droit (om_droit, libelle, om_profil)
28 SELECT nextval('om_droit_seq'), 'consultation_fichier_voir',
29 (SELECT om_profil FROM om_profil WHERE libelle = 'INSTRUCTEUR')
30 WHERE NOT EXISTS (
31 SELECT om_droit FROM om_droit WHERE libelle = 'consultation_fichier_voir' AND om_profil = (SELECT om_profil FROM om_profil WHERE libelle = 'INSTRUCTEUR')
32 );
33 INSERT INTO om_droit (om_droit, libelle, om_profil)
34 SELECT nextval('om_droit_seq'), 'consultation_fichier_telecharger',
35 (SELECT om_profil FROM om_profil WHERE libelle = 'INSTRUCTEUR')
36 WHERE NOT EXISTS (
37 SELECT om_droit FROM om_droit WHERE libelle = 'consultation_fichier_telecharger' AND om_profil = (SELECT om_profil FROM om_profil WHERE libelle = 'INSTRUCTEUR')
38 );
39
40 --
41 -- Modification du sous-état instruction
42 -- Modification de la requête SQL : suppression de la colonne lettretype + ajout
43 -- des colonnes date_envoi_signature, date_retour_signature, date_envoi_rar,
44 -- date_retour_rar + alias de date_evenement corrigé.
45 --
46 UPDATE om_sousetat SET
47 entete_orientation = '0|0|0|0|0|0',
48 entetecolone_bordure = 'TLB|LTBR|LTBR|LTBR|LTBR|LTBR',
49 entetecolone_align = 'C|C|C|C|C|C',
50 cellule_largeur = '70|25|25|25|25|25',
51 cellule_bordure_un = 'LTBR|LTBR|LTBR|LTBR|LTBR|LTBR',
52 cellule_bordure = 'LTBR|LTBR|LTBR|LTBR|LTBR|LTBR',
53 cellule_align = 'L|C|C|C|C|C',
54 cellule_bordure_total = 'TBL|TBLR|TBLR|TBLR|TBLR|TBLR',
55 cellule_align_total = 'L|C|C|C|C|C',
56 cellule_bordure_moyenne = 'BTL|BTLR|BTLR|BTLR|BTLR|BTLR',
57 cellule_align_moyenne = 'L|C|C|C|C|C',
58 cellule_bordure_nbr = 'TBL|TBLR|TBLR|TBLR|TBLR|TBLR',
59 cellule_align_nbr = 'L|C|C|C|C|C',
60 cellule_numerique = '999|999|999|999|999|999',
61 cellule_total = '0|0|0|0|0|0',
62 cellule_moyenne = '0|0|0|0|0|0',
63 cellule_compteur = '0|0|0|0|0|0',
64 om_sql = '
65 SELECT evenement.libelle as evenement,
66 to_char(date_evenement,''DD/MM/YYYY'') as date_evenement,
67 to_char(date_envoi_signature,''DD/MM/YYYY'') as date_envoi_signature,
68 to_char(date_retour_signature,''DD/MM/YYYY'') as date_retour_signature,
69 to_char(date_envoi_rar,''DD/MM/YYYY'') as date_envoi_rar,
70 to_char(date_retour_rar,''DD/MM/YYYY'') as date_retour_rar
71 from &DB_PREFIXEinstruction
72 inner join &DB_PREFIXEevenement on evenement.evenement = instruction.evenement
73 where dossier = ''&idx''
74 and evenement.retour IS FALSE
75 order by instruction.date_evenement asc, instruction asc
76 ' WHERE id = 'instruction';
77
78 --
79 -- Modification des sous-état consultation, bordereau_controle_legalite,
80 -- bordereau_courriers_signature_maire, bordereau_avis_maire_prefet
81 -- et bordereau_decisions
82 -- Suppression de la dernière ligne faisant état du nombre de ligne du tableau
83 --
84 UPDATE om_sousetat SET cellule_compteur = '0|0|0'
85 WHERE id = 'consultation';
86 UPDATE om_sousetat SET cellule_compteur = '0|0|0|0'
87 WHERE id = 'bordereau_controle_legalite';
88 UPDATE om_sousetat SET cellule_compteur = '0|0|0|0'
89 WHERE id = 'bordereau_courriers_signature_maire';
90 UPDATE om_sousetat SET cellule_compteur = '0|0|0|0'
91 WHERE id = 'bordereau_avis_maire_prefet';
92 UPDATE om_sousetat SET cellule_compteur = '0|0|0|0'
93 WHERE id = 'bordereau_decisions';
94
95 ---
96 --- Ajout du code insee en paramètre
97 ---
98 INSERT INTO om_parametre (om_parametre, libelle, valeur, om_collectivite)
99 SELECT nextval('om_parametre_seq'), 'insee', '13055', 1
100 WHERE
101 NOT EXISTS (
102 SELECT om_parametre FROM om_parametre WHERE libelle = 'insee'
103 )
104 LIMIT 1;
105
106 UPDATE donnees_techniques SET cerfa = 1 WHERE lot IS NULL;
107 UPDATE donnees_techniques SET cerfa = 2 WHERE lot IS NOT NULL;
108
109 -- Ajout des droits de visualisation et de téléchargement
110 -- du pdf associé à l'avis d'un service (objet consultation)
111 -- CELLULE SUIVI
112 INSERT INTO om_droit (om_droit, libelle, om_profil)
113 SELECT nextval('om_droit_seq'), 'consultation_fichier_voir',
114 (SELECT om_profil FROM om_profil WHERE libelle = 'CELLULE SUIVI')
115 WHERE NOT EXISTS (
116 SELECT om_droit FROM om_droit WHERE libelle = 'consultation_fichier_voir' AND om_profil = (SELECT om_profil FROM om_profil WHERE libelle = 'CELLULE SUIVI')
117 );
118 INSERT INTO om_droit (om_droit, libelle, om_profil)
119 SELECT nextval('om_droit_seq'), 'consultation_fichier_telecharger',
120 (SELECT om_profil FROM om_profil WHERE libelle = 'CELLULE SUIVI')
121 WHERE NOT EXISTS (
122 SELECT om_droit FROM om_droit WHERE libelle = 'consultation_fichier_telecharger' AND om_profil = (SELECT om_profil FROM om_profil WHERE libelle = 'CELLULE SUIVI')
123 );
124 -- SERVICE CONSULTÉ
125 INSERT INTO om_droit (om_droit, libelle, om_profil)
126 SELECT nextval('om_droit_seq'), 'consultation_fichier_voir',
127 (SELECT om_profil FROM om_profil WHERE libelle = 'SERVICE CONSULTÉ')
128 WHERE NOT EXISTS (
129 SELECT om_droit FROM om_droit WHERE libelle = 'consultation_fichier_voir' AND om_profil = (SELECT om_profil FROM om_profil WHERE libelle = 'SERVICE CONSULTÉ')
130 );
131 INSERT INTO om_droit (om_droit, libelle, om_profil)
132 SELECT nextval('om_droit_seq'), 'consultation_fichier_telecharger',
133 (SELECT om_profil FROM om_profil WHERE libelle = 'SERVICE CONSULTÉ')
134 WHERE NOT EXISTS (
135 SELECT om_droit FROM om_droit WHERE libelle = 'consultation_fichier_telecharger' AND om_profil = (SELECT om_profil FROM om_profil WHERE libelle = 'SERVICE CONSULTÉ')
136 );
137 -- SERVICE CONSULTÉ INTERNE
138 INSERT INTO om_droit (om_droit, libelle, om_profil)
139 SELECT nextval('om_droit_seq'), 'consultation_fichier_voir',
140 (SELECT om_profil FROM om_profil WHERE libelle = 'SERVICE CONSULTÉ INTERNE')
141 WHERE NOT EXISTS (
142 SELECT om_droit FROM om_droit WHERE libelle = 'consultation_fichier_voir' AND om_profil = (SELECT om_profil FROM om_profil WHERE libelle = 'SERVICE CONSULTÉ INTERNE')
143 );
144 INSERT INTO om_droit (om_droit, libelle, om_profil)
145 SELECT nextval('om_droit_seq'), 'consultation_fichier_telecharger',
146 (SELECT om_profil FROM om_profil WHERE libelle = 'SERVICE CONSULTÉ INTERNE')
147 WHERE NOT EXISTS (
148 SELECT om_droit FROM om_droit WHERE libelle = 'consultation_fichier_telecharger' AND om_profil = (SELECT om_profil FROM om_profil WHERE libelle = 'SERVICE CONSULTÉ INTERNE')
149 );
150
151 --
152 -- Ajout du droit pour accéder au plan sig
153 --
154 INSERT INTO om_droit (om_droit, libelle, om_profil)
155 SELECT nextval('om_droit_seq'), 'dossier_instruction_localiser-sig-externe',
156 (SELECT om_profil FROM om_profil WHERE libelle = 'SERVICE CONSULTÉ')
157 WHERE NOT EXISTS (
158 SELECT om_droit FROM om_droit WHERE libelle = 'dossier_instruction_localiser-sig-externe' AND om_profil = (SELECT om_profil FROM om_profil WHERE libelle = 'SERVICE CONSULTÉ')
159 );
160 INSERT INTO om_droit (om_droit, libelle, om_profil)
161 SELECT nextval('om_droit_seq'), 'dossier_instruction_localiser-sig-externe',
162 (SELECT om_profil FROM om_profil WHERE libelle = 'SERVICE CONSULTÉ INTERNE')
163 WHERE NOT EXISTS (
164 SELECT om_droit FROM om_droit WHERE libelle = 'dossier_instruction_localiser-sig-externe' AND om_profil = (SELECT om_profil FROM om_profil WHERE libelle = 'SERVICE CONSULTÉ INTERNE')
165 );
166
167 -- Mise à jour du paramétrage pour qu'il corresponde à ce qui est attendu fonctionnellement
168 UPDATE evenement
169 SET type = 'arrete'
170 WHERE evenement_retour_signature IN (
171 SELECT evenement
172 FROM evenement
173 WHERE retour IS TRUE AND type = 'arrete');
174
175 UPDATE evenement
176 SET type = null
177 WHERE retour IS TRUE AND type = 'arrete';
178
179 UPDATE evenement
180 SET type = 'majoration_delai'
181 WHERE evenement_retour_ar IN (
182 SELECT evenement
183 FROM evenement
184 WHERE retour IS TRUE AND type = 'majoration_delai');
185
186 UPDATE evenement
187 SET type = null
188 WHERE retour IS TRUE AND type = 'majoration_delai';

Properties

Name Value
svn:keywords Id

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26