/[openfoncier]/trunk/data/pgsql/v3.2.0-dev.sql
ViewVC logotype

Diff of /trunk/data/pgsql/v3.2.0-dev.sql

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 723 by nhaye, Fri Nov 16 15:04:37 2012 UTC revision 947 by nhaye, Fri Nov 30 16:11:30 2012 UTC
# Line 1  Line 1 
1    INSERT INTO nature VALUES ('DD', 'Dépôt de dossier DAT');
2    INSERT INTO nature VALUES ('DO', 'Demande d''ouverture ERP DAT');
3    INSERT INTO nature VALUES ('AD', 'Annulation de la demande');
4    INSERT INTO nature VALUES ('DA', 'Demande PC ratachée DAACT');
5    ALTER TABLE dossier ADD COLUMN erp boolean;
6    UPDATE action SET regle_avis = 'avis_decision' WHERE libelle = 'accepter un dossier';
7    
8  --  --
9  -- Ajout de table: avis_consultation_tmp;  -- Ajout de table: avis_consultation_tmp;
10  --  --
# Line 247  INSERT INTO om_droit VALUES (nextval('om Line 254  INSERT INTO om_droit VALUES (nextval('om
254  INSERT INTO om_droit VALUES (nextval('om_droit_seq'), 'PC', 2); -- droit d'instructeur  INSERT INTO om_droit VALUES (nextval('om_droit_seq'), 'PC', 2); -- droit d'instructeur
255  INSERT INTO om_droit VALUES (nextval('om_droit_seq'), 'messages_mes_retours', 2); -- droit d'instructeur  INSERT INTO om_droit VALUES (nextval('om_droit_seq'), 'messages_mes_retours', 2); -- droit d'instructeur
256  INSERT INTO om_droit VALUES (nextval('om_droit_seq'), 'messages_tous_retours', 2); -- droit d'instructeur  INSERT INTO om_droit VALUES (nextval('om_droit_seq'), 'messages_tous_retours', 2); -- droit d'instructeur
257  INSERT INTO om_droit VALUES (nextval('om_droit_seq'), 'messages_consulter', 2); -- droit d'instructeur  INSERT INTO om_droit VALUES (nextval('om_droit_seq'), 'dossier_message_consulter', 2); -- droit d'instructeur
258  INSERT INTO om_droit VALUES (nextval('om_droit_seq'), 'messages_modifier', 2); -- droit d'instructeur  INSERT INTO om_droit VALUES (nextval('om_droit_seq'), 'dossier_message_modifier', 2); -- droit d'instructeur
259  INSERT INTO om_droit VALUES (nextval('om_droit_seq'), 'messages_tab', 2); -- droit d'instructeur  INSERT INTO om_droit VALUES (nextval('om_droit_seq'), 'dossier_message_tab', 2); -- droit d'instructeur
260  INSERT INTO om_droit VALUES (nextval('om_droit_seq'), 'dossier', 2); -- droit d'instructeur  INSERT INTO om_droit VALUES (nextval('om_droit_seq'), 'dossier', 2); -- droit d'instructeur
261  INSERT INTO om_droit VALUES (nextval('om_droit_seq'), 'dashboard', 2); -- droit d'instructeur  INSERT INTO om_droit VALUES (nextval('om_droit_seq'), 'dashboard', 2); -- droit d'instructeur
262  INSERT INTO om_droit VALUES (nextval('om_droit_seq'), 'menu_instruction', 2); -- droit d'instructeur  INSERT INTO om_droit VALUES (nextval('om_droit_seq'), 'menu_instruction', 2); -- droit d'instructeur
 INSERT INTO om_droit VALUES (nextval('om_droit_seq'), 'messages', 2); -- droit d'instructeur  
   
263    
264  --  --
265  -- Modification de la structure des instructeurs  -- Modification de la structure des instructeurs
# Line 357  ALTER TABLE om_parametre ALTER COLUMN va Line 362  ALTER TABLE om_parametre ALTER COLUMN va
362  INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'avis_code_barre', '2');  INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'avis_code_barre', '2');
363    
364  --  --
365  -- Ajout des tables arrondissement, quartier et lien_localisation_nature  -- Ajout des tables arrondissement, quartier et affectation_automatique
366  --  --
367  CREATE TABLE arrondissement (  CREATE TABLE arrondissement (
368          arrondissement integer NOT NULL,          arrondissement integer NOT NULL,
369          libelle character varying(3) NOT NULL          libelle character varying(3) NOT NULL,
370            code_postal character varying(5) NOT NULL
371  );  );
372    
373  ALTER TABLE ONLY arrondissement  ALTER TABLE ONLY arrondissement
# Line 393  CREATE SEQUENCE quartier_seq Line 399  CREATE SEQUENCE quartier_seq
399    START 1    START 1
400    CACHE 1;    CACHE 1;
401    
402  CREATE TABLE lien_localisation_nature (  CREATE TABLE affectation_automatique (
403          lien_localisation_nature integer NOT NULL,          affectation_automatique integer NOT NULL,
         nature character varying(2),  
404          arrondissement integer,          arrondissement integer,
405          quartier integer ,          quartier integer ,
406          section varchar(2),          section varchar(2),
407          instructeur integer NOT NULL          instructeur integer NOT NULL
408  );  );
409    
410  ALTER TABLE ONLY lien_localisation_nature  ALTER TABLE ONLY affectation_automatique
411      ADD CONSTRAINT lien_localisation_nature_pkey PRIMARY KEY (lien_localisation_nature);      ADD CONSTRAINT affectation_automatique_pkey PRIMARY KEY (affectation_automatique);
412  ALTER TABLE ONLY lien_localisation_nature  ALTER TABLE ONLY affectation_automatique
413      ADD CONSTRAINT lien_localisation_nature_nature_fkey FOREIGN KEY (nature) REFERENCES nature(nature);      ADD CONSTRAINT affectation_automatique_arrondissement_fkey FOREIGN KEY (arrondissement) REFERENCES arrondissement(arrondissement);
414  ALTER TABLE ONLY lien_localisation_nature  ALTER TABLE ONLY affectation_automatique
415      ADD CONSTRAINT lien_localisation_nature_arrondissement_fkey FOREIGN KEY (arrondissement) REFERENCES arrondissement(arrondissement);      ADD CONSTRAINT affectation_automatique_quartier_fkey FOREIGN KEY (quartier) REFERENCES quartier(quartier);
416  ALTER TABLE ONLY lien_localisation_nature  ALTER TABLE ONLY affectation_automatique
417      ADD CONSTRAINT lien_localisation_nature_quartier_fkey FOREIGN KEY (quartier) REFERENCES quartier(quartier);      ADD CONSTRAINT affectation_automatique_instructeur_fkey FOREIGN KEY (instructeur) REFERENCES instructeur(instructeur);
 ALTER TABLE ONLY lien_localisation_nature  
     ADD CONSTRAINT lien_localisation_nature_instructeur_fkey FOREIGN KEY (instructeur) REFERENCES instructeur(instructeur);  
418    
419  CREATE SEQUENCE lien_localisation_nature_seq  CREATE SEQUENCE affectation_automatique_seq
420    INCREMENT 1    INCREMENT 1
421    MINVALUE 1    MINVALUE 1
422    MAXVALUE 9223372036854775807    MAXVALUE 9223372036854775807
# Line 433  INSERT INTO om_droit VALUES (nextval('om Line 436  INSERT INTO om_droit VALUES (nextval('om
436  -- Ajout des droits pour le retour des services  -- Ajout des droits pour le retour des services
437  INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'demande_avis_passee', '2');  INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'demande_avis_passee', '2');
438    
439  -- Ajout des droits sur lien_localisation_nature  -- Ajout des droits sur affectation_automatique
440  INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'lien_localisation_nature', '2');  INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'affectation_automatique', '2');
441    
442  -- Ajout du droit pour changer l'état (lu/non lu) d'une  consultation  -- Ajout du droit pour changer l'état (lu/non lu) d'une  consultation
443  INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'consultation_modifier_lu', '2');  INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'consultation_modifier_lu', '2');
# Line 459  CREATE SEQUENCE messages_seq Line 462  CREATE SEQUENCE messages_seq
462  -- Create table dossier_message  -- Create table dossier_message
463  CREATE TABLE dossier_message (  CREATE TABLE dossier_message (
464      message integer PRIMARY KEY DEFAULT nextval('messages_seq'),      message integer PRIMARY KEY DEFAULT nextval('messages_seq'),
465      dossier character varying(12),      dossier character varying(20),
466      type character varying(60),      type character varying(60),
467      emetteur character varying(40),      emetteur character varying(40),
468      date_emission DATE NOT NULL,      date_emission TIMESTAMP NOT NULL,
469      lu boolean default FALSE,      lu boolean default FALSE,
470      contenu character varying(256),      contenu text,
471      FOREIGN KEY ( dossier ) REFERENCES dossier ( dossier )      FOREIGN KEY ( dossier ) REFERENCES dossier ( dossier )
472  );  );
473  ALTER SEQUENCE messages_seq OWNED BY dossier_message.message;  ALTER SEQUENCE messages_seq OWNED BY dossier_message.message;
# Line 474  INSERT INTO om_droit VALUES (nextval('om Line 477  INSERT INTO om_droit VALUES (nextval('om
477  -- Droit de l'ajout forcé d'un instructeur  -- Droit de l'ajout forcé d'un instructeur
478  INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'dossier_modifier_instructeur', '2');  INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'dossier_modifier_instructeur', '2');
479    
480  -- Module 1  
481    ---
482    --- TABLE : GENRE
483    ---
484    CREATE TABLE genre (
485            genre integer,
486            code character varying(20),
487            libelle character varying(100),
488            description text
489    );
490    ALTER TABLE ONLY genre
491        ADD CONSTRAINT genre_pkey PRIMARY KEY (genre);
492    CREATE SEQUENCE genre_seq
493      INCREMENT 1
494      MINVALUE 1
495      MAXVALUE 9223372036854775807
496      START 1
497      CACHE 1;
498    
499    
500    ---
501    --- TABLE : GROUPE
502    ---
503    CREATE TABLE groupe (
504            groupe integer,
505            code character varying(20),
506            libelle character varying(100),
507            description text,
508            genre integer NOT NULL
509    );
510    ALTER TABLE ONLY groupe
511        ADD CONSTRAINT groupe_pkey PRIMARY KEY (groupe);
512    ALTER TABLE ONLY groupe
513        ADD CONSTRAINT groupe_genre_fkey FOREIGN KEY (genre) REFERENCES genre(genre);
514    CREATE SEQUENCE groupe_seq
515      INCREMENT 1
516      MINVALUE 1
517      MAXVALUE 9223372036854775807
518      START 1
519      CACHE 1;
520    
521    
522    ---
523    ---
524    ---
525  CREATE TABLE dossier_autorisation_type (  CREATE TABLE dossier_autorisation_type (
526          dossier_autorisation_type integer,          dossier_autorisation_type integer,
527          code character varying(20),          code character varying(20),
# Line 500  CREATE TABLE dossier_autorisation_type_d Line 547  CREATE TABLE dossier_autorisation_type_d
547          code character varying(20),          code character varying(20),
548          libelle character varying(100),          libelle character varying(100),
549          description text,          description text,
550          dossier_autorisation_type integer          dossier_autorisation_type integer NOT NULL
551  );  );
552    
553  ALTER TABLE ONLY dossier_autorisation_type_detaille  ALTER TABLE ONLY dossier_autorisation_type_detaille
# Line 515  CREATE SEQUENCE dossier_autorisation_typ Line 562  CREATE SEQUENCE dossier_autorisation_typ
562    START 1    START 1
563    CACHE 1;    CACHE 1;
564    
565    -- Ajout du champs dossier_autorisation_type_detaille dans la table affectation_automatique et de la contrainte FK
566    
567    ALTER TABLE affectation_automatique ADD COLUMN dossier_autorisation_type_detaille integer;
568    
569    ALTER TABLE ONLY affectation_automatique
570        ADD CONSTRAINT affectation_automatique_dossier_autorisation_type_detaille_fkey FOREIGN KEY (dossier_autorisation_type_detaille) REFERENCES dossier_autorisation_type_detaille(dossier_autorisation_type_detaille);
571    
572  --  --
573    
574  CREATE TABLE dossier_instruction_type (  CREATE TABLE dossier_instruction_type (
# Line 522  CREATE TABLE dossier_instruction_type ( Line 576  CREATE TABLE dossier_instruction_type (
576          code character varying(20),          code character varying(20),
577          libelle character varying(100),          libelle character varying(100),
578          description text,          description text,
579          dossier_autorisation_type_detaille integer,          dossier_autorisation_type_detaille integer NOT NULL,
580          suffixe boolean default FALSE          suffixe boolean default FALSE
581  );  );
582    
# Line 538  CREATE SEQUENCE dossier_instruction_type Line 592  CREATE SEQUENCE dossier_instruction_type
592    START 1    START 1
593    CACHE 1;    CACHE 1;
594    
 --  
   
 CREATE TABLE demande_genre (  
         demande_genre integer,  
         code character varying(20),  
         libelle character varying(100),  
         description text  
 );  
   
 ALTER TABLE ONLY demande_genre  
     ADD CONSTRAINT demande_genre_pkey PRIMARY KEY (demande_genre);  
   
 CREATE SEQUENCE demande_genre_seq  
   INCREMENT 1  
   MINVALUE 1  
   MAXVALUE 9223372036854775807  
   START 1  
   CACHE 1;  
   
 --  
   
 CREATE TABLE groupe (  
         groupe integer,  
         code character varying(20),  
         libelle character varying(100),  
         description text,  
         demande_genre integer  
 );  
   
 ALTER TABLE ONLY groupe  
     ADD CONSTRAINT groupe_pkey PRIMARY KEY (groupe);  
 ALTER TABLE ONLY groupe  
     ADD CONSTRAINT groupe_demande_genre_fkey FOREIGN KEY (demande_genre) REFERENCES demande_genre(demande_genre);  
   
 CREATE SEQUENCE groupe_seq  
   INCREMENT 1  
   MINVALUE 1  
   MAXVALUE 9223372036854775807  
   START 1  
   CACHE 1;  
595    
596  -- Ajout de clé étrangère à la table dossier_autorisation_type  -- Ajout de clé étrangère à la table dossier_autorisation_type
597  ALTER TABLE dossier_autorisation_type ADD COLUMN groupe integer;  ALTER TABLE dossier_autorisation_type ADD COLUMN groupe integer;
# Line 617  CREATE TABLE demande_type ( Line 631  CREATE TABLE demande_type (
631          contraintes character varying(20),          contraintes character varying(20),
632          etats_dossier_autorisation_autorises character varying(100),          etats_dossier_autorisation_autorises character varying(100),
633          qualification boolean,          qualification boolean,
634          evenement integer          evenement integer NOT NULL
635  );  );
636    
637  ALTER TABLE ONLY demande_type  ALTER TABLE ONLY demande_type
# Line 690  ALTER TABLE ONLY dossier Line 704  ALTER TABLE ONLY dossier
704  INSERT INTO dossier_autorisation_type(dossier_autorisation_type, code, libelle) SELECT nextval('dossier_autorisation_type_seq'), nature, libelle FROM nature;  INSERT INTO dossier_autorisation_type(dossier_autorisation_type, code, libelle) SELECT nextval('dossier_autorisation_type_seq'), nature, libelle FROM nature;
705  INSERT INTO dossier_autorisation_type_detaille(dossier_autorisation_type_detaille, code, libelle) SELECT nextval('dossier_autorisation_type_seq'), nature, libelle FROM nature;  INSERT INTO dossier_autorisation_type_detaille(dossier_autorisation_type_detaille, code, libelle) SELECT nextval('dossier_autorisation_type_seq'), nature, libelle FROM nature;
706    
 INSERT INTO demande_genre VALUES (nextval('demande_genre_seq'), 'URBA', 'Pôle Urbanisme', 'Responsabilité de la DDU');  
 INSERT INTO demande_genre VALUES (nextval('demande_genre_seq'), 'ERP', 'Pôle ERP', 'Responsabilité de la DGUP');  
   
 INSERT INTO groupe VALUES (nextval('groupe_seq'), 'ADS', 'Autorisation ADS', '',1);  
 INSERT INTO groupe VALUES (nextval('groupe_seq'), 'CTX', 'Contentieux dans le domaine urbanisme', '',1);  
 INSERT INTO groupe VALUES (nextval('groupe_seq'), 'CU', 'Changement d''usage', '',1);  
 INSERT INTO groupe VALUES (nextval('groupe_seq'), 'RU', 'Renseignement d''urbanisme', '',1);  
 INSERT INTO groupe VALUES (nextval('groupe_seq'), 'ERP', 'ERP', '',2);  
   
707  -- Table dossier_autorisation  -- Table dossier_autorisation
708    
709  CREATE TABLE dossier_autorisation (  CREATE TABLE dossier_autorisation (
710      dossier_autorisation integer,      dossier_autorisation character varying(20),
711      nature character varying(2),      nature character varying(2),
712      dossier_autorisation_type_detaille integer,      dossier_autorisation_type_detaille integer,
713      exercice integer,      exercice integer,
# Line 718  CREATE TABLE dossier_autorisation ( Line 723  CREATE TABLE dossier_autorisation (
723      terrain_superficie double precision,      terrain_superficie double precision,
724      arrondissement integer,      arrondissement integer,
725      depot_initial date,      depot_initial date,
726      etat character varying(20)      etat character varying(20),
727        erp_numero_batiment integer,
728        erp_ouvert boolean,
729        erp_date_ouverture date,
730        erp_arrete_decision boolean,
731        erp_date_arrete_decision date
732  );  );
733    
734  ALTER TABLE ONLY dossier_autorisation  ALTER TABLE ONLY dossier_autorisation
# Line 726  ALTER TABLE ONLY dossier_autorisation Line 736  ALTER TABLE ONLY dossier_autorisation
736  ALTER TABLE ONLY dossier_autorisation  ALTER TABLE ONLY dossier_autorisation
737      ADD CONSTRAINT dossier_autorisation_nature_fkey FOREIGN KEY (nature) REFERENCES nature(nature);      ADD CONSTRAINT dossier_autorisation_nature_fkey FOREIGN KEY (nature) REFERENCES nature(nature);
738  ALTER TABLE ONLY dossier_autorisation  ALTER TABLE ONLY dossier_autorisation
739      ADD CONSTRAINT dossier_autorisation_type_detaille_fkey FOREIGN KEY (type_detaille) REFERENCES dossier_autorisation_type_detaille(dossier_autorisation_type_detaille);      ADD CONSTRAINT dossier_autorisation_type_detaille_fkey FOREIGN KEY (dossier_autorisation_type_detaille) REFERENCES dossier_autorisation_type_detaille(dossier_autorisation_type_detaille);
740  ALTER TABLE ONLY dossier_autorisation  ALTER TABLE ONLY dossier_autorisation
741      ADD CONSTRAINT dossier_autorisation_arrondissement_fkey FOREIGN KEY (arrondissement) REFERENCES arrondissement(arrondissement);      ADD CONSTRAINT dossier_autorisation_arrondissement_fkey FOREIGN KEY (arrondissement) REFERENCES arrondissement(arrondissement);
742  ALTER TABLE ONLY dossier_autorisation  ALTER TABLE ONLY dossier_autorisation
# Line 743  CREATE SEQUENCE dossier_autorisation_seq Line 753  CREATE SEQUENCE dossier_autorisation_seq
753    
754  CREATE TABLE demande (  CREATE TABLE demande (
755          demande integer,          demande integer,
756          dossier_autorisation_type_detaille integer,          dossier_autorisation_type_detaille integer NOT NULL,
757          demande_type integer,          demande_type integer NOT NULL,
758          dossier_instruction character varying(12),          dossier_instruction character varying(20),
759          dossier_autorisation integer,          dossier_autorisation character varying(20),
760          date_demande date,          date_demande date NOT NULL,
761          terrain_references_cadastrales character varying(100),          terrain_references_cadastrales character varying(100),
762          terrain_adresse_voie_numero integer,          terrain_adresse_voie_numero integer,
763          complement character varying(30),          complement character varying(30),
# Line 783  CREATE SEQUENCE demande_seq Line 793  CREATE SEQUENCE demande_seq
793  CREATE TABLE demandeur (  CREATE TABLE demandeur (
794          demandeur integer,          demandeur integer,
795          type_demandeur character varying(40),          type_demandeur character varying(40),
796            qualite character varying(40),
797          particulier_civilite character varying(10),          particulier_civilite character varying(10),
798          particulier_nom character varying(40),          particulier_nom character varying(40),
799          particulier_prenom character varying(40),          particulier_prenom character varying(40),
# Line 1005  UPDATE civilite SET libelle='Monsieur' W Line 1016  UPDATE civilite SET libelle='Monsieur' W
1016  CREATE TABLE lien_dossier_autorisation_demandeur (  CREATE TABLE lien_dossier_autorisation_demandeur (
1017      lien_dossier_autorisation_demandeur integer,      lien_dossier_autorisation_demandeur integer,
1018      petitionnaire_principal boolean,      petitionnaire_principal boolean,
1019      dossier_autorisation integer,      dossier_autorisation character varying(20),
1020      demandeur integer      demandeur integer
1021  );  );
1022    
# Line 1021  CREATE SEQUENCE lien_dossier_autorisatio Line 1032  CREATE SEQUENCE lien_dossier_autorisatio
1032    MINVALUE 1    MINVALUE 1
1033    MAXVALUE 9223372036854775807    MAXVALUE 9223372036854775807
1034    START 1    START 1
   CACHE 1;  
1035      CACHE 1;
1036    
1037      -- Ajout du champ à qualifier --
1038      
1039      ALTER TABLE dossier ADD COLUMN a_qualifier boolean;
1040    
1041    -- Ajout d'un champ à la table état --
1042    ALTER TABLE etat ADD COLUMN statut character varying(60);
1043    UPDATE etat set statut='encours'
1044    where etat = 'notifier' or etat = 'majorer' or etat = 'initialiser';
1045    UPDATE etat set statut='cloture'
1046    where etat = 'accepter' or etat = 'cloturer' or etat = 'rejeter'
1047    or etat = 'executer' or etat = 'terminer';
1048    
1049    --Changement des civilités dans les états et sous-états
1050    UPDATE om_sousetat SET om_sql='SELECT  ''Commune &commune''||'' ''||''Dossier ''||dossier as dossier,   ''Depot ''||to_char(date_depot,''DD/MM/YYYY'')||'' Notifie le  ''||COALESCE(to_char(date_complet,''DD/MM/YYYY''),''inconu'') as date_dp_n,  TRIM(CONCAT(civilite.libelle, '' '', demandeur_nom, '' '',demandeur_adresse,'' '',demandeur_cp,''  '',demandeur_ville,'' Parcelle '',parcelle)) as nom_adresse_demandeur,  terrain_numero||'' ''||terrain_numero_complement||'' ''||terrain_adresse||'' ''||terrain_adresse_complement||''   ''||terrain_cp||''  ''||terrain_ville||'' ''||travaux.libelle as adresse_terrain_travaux,   ''shon  ''||shon||'' shob ''||shob as SN_SB,   terrain_surface as superficie,   logement_nombre as nbr_logement,   COALESCE(avis_decision.libelle,''inconu'') as avis_decision,  ''Decision''||COALESCE(to_char(date_decision,''DD/MM/YYYY''),''inconu'')||'' Limite ''||COALESCE(to_char(date_limite,''DD/MM/YYYY''),''inconu'') as date_dc_l,  delai||'' mois'' as delai, '' '' as date_affichage_decision, '' '' as DOC_DAT_Conformite  from dossier left join travaux on dossier.travaux=travaux.travaux left join avis_decision on dossier.avis_decision=avis_decision.avis_decision  left join civilite on demandeur_civilite = civilite.civilite   where dossier.nature=''&nature'' AND (date_decision>=''&datedebut''   AND date_decision<=''&datefin'')  ORDER BY dossier' WHERE om_sousetat = 10;
1051    
1052    
1053    UPDATE om_etat SET om_sql='select dossier,nature.libelle as nature, civilite.libelle AS demandeur_civilite,demandeur_nom,demandeur_societe, demandeur_adresse,demandeur_cp,demandeur_ville, terrain_numero, terrain_adresse, terrain_cp, terrain_ville, terrain_surface,  hauteur, shon, shob, batiment_nombre, logement_nombre, delai, to_char(date_depot,''DD/MM/YYYY'') as date_depot, to_char(date_complet,''DD/MM/YYYY'') as date_complet, to_char(date_notification_delai,''DD/MM/YYYY'') as date_notification_delai, to_char(date_limite,''DD/MM/YYYY'') as date_limite, travaux.libelle as travaux from dossier inner join nature on nature.nature = dossier.nature left join travaux on dossier.travaux=travaux.travaux left join civilite on demandeur_civilite=civilite.civilite where dossier = ''&idx''' WHERE om_etat = 7;
1054    
1055    UPDATE om_etat SET om_sql='select service.libelle as service_libelle, service.adresse as service_adresse, service.cp as service_cp, service.ville as service_ville, consultation.dossier as dossier, travaux.libelle as libelle_travaux, civilite.libelle as demandeur_civilite,date_demande, demandeur_nom, demandeur_adresse, demandeur_cp, demandeur_ville, terrain_adresse from  consultation inner join service on service.service = consultation.service inner join dossier on dossier.dossier =consultation.dossier left join travaux on travaux.travaux = dossier.travaux left join civilite on demandeur_civilite = civilite.civilite where  consultation= &idx' WHERE om_etat = 6;
1056    
1057    UPDATE om_etat SET om_sql='select service.libelle as service, service.adresse, service.cp, service.ville, dossier.dossier,nature.libelle as nature, civilite.libelle as demandeur_civilite, demandeur_nom, emandeur_societe, demandeur_adresse, demandeur_cp, demandeur_ville, terrain_numero, terrain_adresse, terrain_cp, terrain_ville, terrain_surface,  hauteur, shon, shob, batiment_nombre, logement_nombre, to_char(date_depot,''DD/MM/YYYY'')  as date_depot, to_char(date_rejet,''DD/MM/YYYY'')  as date_rejet, travaux.libelle as travaux, to_char(date_envoi,''DD/MM/YYYY'')  as date_envoi from consultation inner join dossier on dossier.dossier=consultation.dossier inner join service on service.service=consultation.service inner join nature on nature.nature = dossier.nature left join travaux on dossier.travaux=travaux.travaux left join civilite on demandeur_civilite = civilite.civilite where consultation = &idx' WHERE om_etat = 4;
1058    
1059    UPDATE om_sousetat SET om_sql='SELECT  ''Commune &commune''||'' ''||''Dossier ''||dossier as dossier,to_char(date_depot,''DD/MM/YYYY'') as date_depot, TRIM(CONCAT( civilite.libelle,'' '', demandeur_nom)) as nom_demandeur, terrain_numero||'' ''||terrain_numero_complement||'' ''||terrain_adresse||'' ''||terrain_adresse_complement||''  ''||terrain_cp||''  ''||terrain_ville as adresse_terrain, shon, logement_nombre as nb_logt from dossier left join civilite on demandeur_civilite = civilite.civilite  where dossier.nature=''&nature'' AND (date_depot>=''&datedebut''  AND date_depot<=''&datefin'') ORDER BY dossier' WHERE om_sousetat = 9;
1060    
1061    UPDATE om_sousetat SET om_sql='SELECT  ''Commune &commune''||'' ''||''Dossier ''||dossier as dossier,  ''Depot ''||to_char(date_depot,''DD/MM/YYYY'')||'' Notifie le  ''||COALESCE(to_char(date_complet,''DD/MM/YYYY''),''inconu'') as date_dp_n, TRIM(CONCAT(civilite.libelle,'' '',demandeur_nom,'' '',demandeur_adresse,'' '',demandeur_cp,''  '',demandeur_ville,'' Parcelle '',parcelle)) as nom_adresse_demandeur, terrain_numero||'' ''||terrain_numero_complement||'' ''||terrain_adresse||'' ''||terrain_adresse_complement||''  ''||terrain_cp||''  ''||terrain_ville||'' ''||travaux.libelle as adresse_terrain_travaux, ''shon  ''||shon||'' shob ''||shob as SN_SB, terrain_surface as superficie, logement_nombre as nbr_logement, COALESCE(avis_decision.libelle,''inconu'') as avis_decision, ''Decision''||COALESCE(to_char(date_decision,''DD/MM/YYYY''),''inconu'')||'' Limite ''||COALESCE(to_char(date_limite,''DD/MM/YYYY''),''inconu'') as date_dc_l, delai||'' mois'' as delai, '' '' as date_affichage_decision, '' '' as DOC_DAT_Conformite from dossier left join civilite on demandeur_civilite = civilite.civilite left join travaux on dossier.travaux=travaux.travaux left join avis_decision on dossier.avis_decision=avis_decision.avis_decision where dossier.nature=''&nature'' AND (date_depot>=''&datedebut'' AND date_depot<=''&datefin'') ORDER BY dossier' WHERE om_sousetat = 8;
1062    
1063    -- Ajout d'un nouvel état et d'un nouvel sous-état pour les affichages des dossiers / ! \ GROUPE a rajouter
1064    INSERT INTO om_etat VALUES (nextval('om_etat_seq'), 1, 'dossier_m', 'import du 25/11/2012', true, 'L', 'A4', 'helvetica', 'I', 8, 'pixel.png', 58, 7, 'Registre des dossiers en cours', 5, 7, 100, 10, 'helvetica', 'B', 15, '1', 'L', '
1065    No commune : &departement &commune &ville', 120, 7, 195, 5, 'helvetica', '', 10, '0', 'J', 'select nom from om_utilisateur', 'dossier_m', 'helvetica', 8, 5, 5, '0-0-0');
1066    
1067    INSERT INTO om_sousetat VALUES (nextval('om_sousetat_seq'), 1, 'dossier_m', 'import du 26/11/2012', true, 'Edition du &aujourdhui', 8, 'helvetica', '', 9, '0', 'L', '0', '243-246-246', '0-0-0', 5, 0, '1', '1', '0|0|0|0|0|0|90|90|0|0|0|90|90', 37, 'TLB|LTB|LTBR|TLB|LTB|LTBR|TLB|LTB|LTBR|LTBR|TLB|LTB|LTBR|LTBR|LTBR', 'C|C|C|L|L|R|R|R|L|R|R|R|R', '145-184-189', '0-0-0', 280, '1', 7, '0-0-0', '243-246-246', '255-255-255', '1', 9, '20|20|20|50|57|15|15|10|20|20|11|21|21', 'LTBR|LTBR|LTBRL|LTBR|LTBR|LTBRL|LTBR|LTBR|LTBR|LTBRL|LTBR|LTBR|LTBR', 'LTBR|LTBR|LTBR|LTBR|LTBR|LTBRL|LTBR|LTBR|LTBR|LTBRL|LTBR|LTBR|LTBR', 'C|C|C|L|L|C|R|R|L|C|R|C|C', '1', 10, 15, '196-213-215', 'TBL|TBL|TBL|TBLR|TBL|TBL|TBLR|TBLR|TBL|TBL|TBLR|TBLR|TBLR', 'L|L|L|C|L|L|C|C|L|L|C|C|C', '1', 10, 5, '212-219-220', 'BTL|BTL|BTL|BTLR|BTL|BTL|BTLR|TBLR|BTL|BTL|BTLR|TBLR|TBLR', 'L|L|L|C|L|L|C|C|L|L|C|C|C', '1', 10, 15, '255-255-255', 'TBL|TBL|TBL|TBLR|TBL|TBL|TBLR|TBLR|TBL|TBL|TBLR|TBLR|TBLR', 'L|L|L|R|L|L|R|R|L|L|R|R|R', '999|999|999|999|999|999|999|999|999|999|999|999|999', '0|0|0|0|0|0|0|0|0|0|0|0|0', '0|0|0|0|0|0|0|0|0|0|0|0|0', '0|0|0|0|0|0|0|0|0|0|0|0|0', 'SELECT  ''Commune &commune''||'' ''||''Dossier ''||dossier as dossier,  ''Depot ''||to_char(date_depot,''DD/MM/YYYY'')||'' Notifie le  ''||COALESCE(to_char(date_complet,''DD/MM/YYYY''),''inconu'') as date_dp_n, arrondissement.libelle as arrondissement, TRIM(CONCAT(civilite.libelle,'' '',demandeur_nom,'' '',demandeur_adresse,'' '',demandeur_cp,''  '',demandeur_ville,'' Parcelle '',parcelle)) as nom_adresse_demandeur, CONCAT(terrain_numero, '' '', terrain_numero_complement, '' '', terrain_adresse, '' '', terrain_adresse_complement, ''  '', terrain_cp, ''  '', terrain_ville, '' '', travaux.libelle) as adresse_terrain_travaux, CONCAT(''shon  '', shon, '' shob '', shob) as SN_SB, terrain_surface as superficie, logement_nombre as nbr_logement, COALESCE(avis_decision.libelle,''inconu'') as avis_decision, ''Decision''||COALESCE(to_char(date_decision,''DD/MM/YYYY''),''inconu'')||'' Limite ''||COALESCE(to_char(date_limite,''DD/MM/YYYY''),''inconu'') as date_dc_l, delai||'' mois'' as delai, '' '' as date_affichage_decision, '' '' as DOC_DAT_Conformite from dossier left join civilite on demandeur_civilite = civilite.civilite left join travaux on dossier.travaux=travaux.travaux left join avis_decision on dossier.avis_decision=avis_decision.avis_decision left join arrondissement on terrain_cp = arrondissement.code_postal where (select e.statut from etat e where e.etat = dossier.etat ) = ''encours''  ORDER BY arrondissement.libelle');
1068    
1069    -- Ajout d'un nouvel évènement "affichage_obligatoire"
1070    INSERT INTO evenement VALUES (89, 'affichage_obligatoire', 'T', 'divers', NULL, 0, 'Non', 0, 'attestation_affichage', '   ', NULL);
1071    -- Ajout d'un nouveau paramètre pour l'évènement "affichage_obligatoire"
1072    INSERT INTO om_parametre VALUES (nextval('om_parametre_seq'), 'affichage_obligatoire', '89', 1);
1073    
1074    -- Ajout des colonnes manquant dans dossier por rapport à la table demande
1075    ALTER TABLE dossier ADD COLUMN terrain_references_cadastrales character varying(100);
1076    ALTER TABLE dossier ADD COLUMN terrain_adresse_voie_numero integer;
1077    ALTER TABLE dossier ADD COLUMN complement character varying(30);
1078    ALTER TABLE dossier ADD COLUMN terrain_adresse_lieu_dit character varying(30);
1079    ALTER TABLE dossier ADD COLUMN terrain_adresse_localite character varying(30);
1080    ALTER TABLE dossier ADD COLUMN terrain_adresse_code_postal character varying(5);
1081    ALTER TABLE dossier ADD COLUMN terrain_adresse_bp character varying(15);
1082    ALTER TABLE dossier ADD COLUMN terrain_adresse_cedex character varying(15);
1083    ALTER TABLE dossier ADD COLUMN terrain_superficie double precision;
1084    
1085    -- Ajout d'une nouvelle lettre type
1086    INSERT INTO om_lettretype VALUES (nextval('om_lettretype_seq'), 1, 'attestation_affichage', 'attestion d''affichage obligatoire', true, 'P', 'A4', 'logolettretype.png', 8, 9, 'Attestation d''affichage', 70, 20, 130, 5, 'arial', '', 8, '1', 'L', 'Bonjour', 30, 102, 160, 4, 'arial', '', 8, '0', 'J', 'select nom from &DB_PREFIXEom_utilisateur');
1087    
1088      -- Table Lien demande demandeur
1089    
1090    CREATE TABLE lien_dossier_demandeur (
1091        lien_dossier_demandeur integer,
1092        petitionnaire_principal boolean,
1093        dossier character varying(20),
1094        demandeur integer
1095    );
1096    
1097    ALTER TABLE ONLY lien_dossier_demandeur
1098        ADD CONSTRAINT lien_dossier_demandeur_pkey PRIMARY KEY (lien_dossier_demandeur);
1099    ALTER TABLE ONLY lien_dossier_demandeur
1100        ADD CONSTRAINT lien_dossier_demandeur_dossier_fkey FOREIGN KEY (dossier) REFERENCES dossier(dossier);
1101    ALTER TABLE ONLY lien_dossier_demandeur
1102        ADD CONSTRAINT lien_dossier_demandeur_demandeur_fkey FOREIGN KEY (demandeur) REFERENCES demandeur(demandeur);
1103    
1104    CREATE SEQUENCE lien_dossier_demandeur_seq
1105      INCREMENT 1
1106      MINVALUE 1
1107      MAXVALUE 9223372036854775807
1108      START 1
1109      CACHE 1;
1110    
1111    ALTER TABLE dossier ALTER nature TYPE character varying(3);
1112    ALTER TABLE nature ALTER nature TYPE character varying(3);
1113    ALTER TABLE nature ALTER libelle TYPE character varying(150);
1114    ALTER TABLE dossier ALTER nature DROP NOT NULL;
1115    
1116    INSERT INTO nature VALUES ('PCI', 'Permis de construire pour une maison individuelle et / ou ses annexes');
1117    INSERT INTO nature VALUES ('PCA', 'Permis de construire comprenant ou non des démolitions');
1118    INSERT INTO nature VALUES ('AZ', 'Demande d''autorisation spéciale de travaux dans le périmètre d''une AVAP');
1119    INSERT INTO nature VALUES ('DAT', 'Demande d''autorisation de construire, d''aménager ou de modifier un ERP');
1120    
1121    ALTER TABLE dossier ALTER COLUMN dossier TYPE character varying(20);
1122    
1123    ALTER TABLE dossier ADD column dossier_autorisation character varying(20) NOT NULL;
1124    ALTER TABLE ONLY dossier
1125        ADD CONSTRAINT dossier_dossier_autorisation_fkey FOREIGN KEY (dossier_autorisation) REFERENCES dossier_autorisation(dossier_autorisation);
1126    
1127    ALTER TABLE instruction ALTER COLUMN dossier TYPE character varying(20);
1128    
1129    ALTER TABLE instruction ALTER COLUMN dossier TYPE character varying(20);
1130    ALTER TABLE consultation ALTER COLUMN dossier TYPE character varying(20);
1131    ALTER TABLE terrain ALTER COLUMN dossier TYPE character varying(20);
1132    ALTER TABLE blocnote ALTER COLUMN dossier TYPE character varying(20);
1133    ALTER TABLE destination_shon ALTER COLUMN dossier TYPE character varying(20);
1134    ALTER TABLE statistique ALTER COLUMN dossier TYPE character varying(20);
1135    
1136    INSERT INTO om_parametre VALUES (nextval('om_parametre_seq'), 'option_ERP', 'true', 1);
1137    INSERT INTO om_parametre VALUES (nextval('om_parametre_seq'), 'option_GED', 'false', 1);

Legend:
Removed from v.723  
changed lines
  Added in v.947

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26