/[openfoncier]/trunk/app/sitadel.class.php
ViewVC logotype

Contents of /trunk/app/sitadel.class.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 187 - (show annotations)
Tue Oct 11 15:01:43 2011 UTC (13 years, 3 months ago) by fraynaud
File size: 13464 byte(s)
mise au point sitadel


1 <?php
2 /**
3 * Ce fichier est destine a gerer les transferts sitadel
4 *
5 * @package openmairie_foncier
6 * @version SVN : $Id
7 */
8
9
10 class sitadel {
11
12 var $dossier;
13
14 var $row; // dossier
15 var $val; // parametre par defaut
16 var $parametre; //parametre dossier
17 var $DEBUG=2;
18
19 function sitadel($dossier) {
20 $this->dossier=$dossier;
21 // recherche de parametre
22 }// fin constructeur
23
24
25 function entete($mouvement, $departement, $commune){
26 // sitadel : mouv|typpermis|equivalence|dep|commune|andepnumpc|indmod
27 $entete=$mouvement."|".$this->row['nature']."||0".$departement."|".$commune."|".$this->row['annee'].
28 "|".substr($this->dossier,4,5)."|".substr($this->dossier,9,2)."|";
29 return $entete;
30 }
31
32 function etatcivil(){
33 // etat civil demandeur
34 // codemo|
35 if($this->row['demandeur_categorie']==9
36 or $this->row['demandeur_categorie']=="")
37 $codemo=1;// personne physique
38 else
39 $codemo=2;// personne morale
40 $etatcivil=$codemo."|"; // 1 personne physique ; 2 sinon
41 // openfoncier civilite (5/8 ok), nom (80/30-> substr), societe (80/50->substr)
42 // civpart|prenompart|nompart|denopm|rspm|siret|catjur|civrep|prenomrep|nomrep|
43 // suivant codemo = 1 (personne physique) ou 2 (personne morale)
44 // demandeur_civilite n est pas normalise Madame ou Monsieur
45 if($codemo==1){
46 // *civpart*|*prenompart*|nompart||||||
47 $etatcivil.= $this->p('civpart')."|".$this->p('prenompart')."|";
48 $etatcivil.= $this->maj(substr($this->row['demandeur_nom'],0,30))."||||||||";
49 }else{
50 //denopm|*rspm*|*siret*|*catjur*|*civrep*|*prenomrep*|nomrep|
51 $etatcivil.="|||"; // codemo=1
52 $etatcivil.=$this->maj(substr($this->row['demandeur_societe']),0,50)."|";
53 $etatcivil.=$this->maj(substr($this->row['categorie_libelle'],0,30))."|";
54 $etatcivil.=$this->p('rspm')."|".$this->p('siret')."|".$this->p('catjur')."|".
55 $this->p('civrep')."|".$this->p('prenomrep'); // *** +1
56 $etatcivil.=$this->maj(substr($this->row['demandeur_nom'],0,30))."|";
57 }
58 return $etatcivil;
59 }
60
61 function adresse(){
62 // openfoncier : adresse (80/ 26+38 -> substr sur 2 zones) - cp (5/5 OK) - ville (30/36 -> OK)
63 // *numvoiemo*|*typvoiemo*|libvoiemo|lieuditmo(+)|communemo|codposmo|*bpmo*|*cedexmo*|*paysmo*|*divetermo|
64 $adresse="";
65 $adresse = $this->p('numvoiemo')."|".$this->p('typvoiemo')."|".
66 $adresse.= $this->maj(substr($this->row['demandeur_adresse'],0,26))."|".
67 $this->maj(substr($this->row['demandeur_adresse'],26,38))."|";
68 $adresse.= $this->maj($this->row['demandeur_ville'])."|".$this->row['demandeur_cp']."|";
69 $adresse.= $this->p('bpmo')."|".$this->p('cedexmo')."|".$this->p('paysmo')."|".$this->p('divtermo')."|";
70 return $adresse;
71 }
72
73
74 function delegataire(){
75 // openFoncier civilite (non normalise monsieur/madame), nom (80/30 substr)
76 // openfoncier : adresse (80/ 26+38 -> substr sur 2 zones) - cp (5/5 OK) - ville (30/32 -> OK)
77 // *civtiers*|*prenomtier*|nomtier|*numvoietiers*|*typvoietiers*|
78 // libvoietiers|lieudittier|communetier|codpostier
79 // |*bptier*|*cedextier*|*paystier*|*divtertier*|
80 $delegataire="";
81 if($this->row['delegataire']=='Oui'){
82 $delegataire.= $this->p('civtier')."|".$this->p('prenomtier');
83 $delegataire.="|".$this->maj(substr($this->row['delegataire_nom'],0,30))."|";
84 $delegataire.= "|".$this->p('typevoietier')."|".$this->maj(substr($this->row['delegataire_adresse'],0,26))."|".
85 $this->maj(substr($this->row['delegataire_adresse'],26,38))."|";
86 $delegataire.= $this->maj($this->row['delegataire_ville'])."|".
87 $this->row['delegataire_cp']."|";
88 $delegataire.= $this->p('bptier')."|".$this->p('cedextier')."|";
89 $delegataire.= $this->p('paystier')."|".$this->p('divtertier')."|";
90 }else{
91 $delegataire.= "|||||||||||||"; // *** 13 |
92 }
93 return $delegataire;
94 }
95
96 function meltel($mouvement){
97 // sitadel : telmo|melmo|
98 $meltel="";
99 if($mouvement != "Transfert")
100 $meltel.=$this->row['demandeur_telephone']."|";
101 $meltel.= $this->row['demandeur_email']."|";
102 // sitadel: suivi
103 if($this->row['delegataire']=='Oui'){
104 $meltel.= "1";
105 }else{
106 $meltel.= "0";
107 }
108 // |
109 if($mouvement != "Transfert")
110 $meltel= "|";
111 return $meltel;
112 }
113
114
115 function adresse_terrain(){
116 // openfoncier numero (4/5 substr), adresse(80, 26 +38 -> substr), complement (non utilise (80)), cp (5/5 ok), ville (30/32 ok)
117 // sitadel : |numvoiete|*typvoiete*|libvoiete|lieudite|communete|codposte|*bpte*|*cedexte*|
118 // mettre le | en debut pour info du 2eme groupe (suite 1er groupe)
119 $adresse="|";
120 //
121 $adresse.= substr($this->row['terrain_numero'],0,4)."|".$this->p('typvoiete')."|";
122 $adresse.= $this->maj(substr($this->row['terrain_adresse'],0,26))."|".
123 $this->maj(substr($this->row['terrain_adresse'],26,38))."|";
124 $adresse.= $this->maj($this->row['terrain_ville'])."|";
125 $adresse.= $this->row['terrain_cp']."|";
126 $adresse.= $this->p('bpte')."|".$this->p('cedexte')."|";
127 return $adresse;
128
129 }
130
131 function parcelle(){
132 // ========
133 // parcelle
134 // ========
135 // cadastre 3 parcelles + 3 sections
136 // openfoncier = 1 seule parcelle (6/3+5)
137 // sitadel : scadastre1|ncadastre1|*scadastre2*|*ncadastre2*|*scadastre3*|*ncadastre3*|
138 $parcelle= substr($this->row['parcelle'],0,2)."|";
139 $parcelle.= substr($this->row['parcelle'],2,4)."|";
140 $parcelle.= $this->p('scadastre2')."|".$this->p('ncadastre2')."|";
141 $parcelle.= $this->p('scadastre3')."|".$this->p('ncadastre3')."|";
142 return $parcelle;
143 }
144
145
146
147 function decision_groupe1($avis_sitadel, $avis_sitadel_motif){
148 $decision= '1|'; // au nom de la commune
149 $decision.= $avis_sitadel."|";
150 // date au format francais 8 caracteres
151 $decision.= substr($this->row['date_decision'],8,2).''.
152 substr($this->row['date_decision'],5,2)."".
153 substr($this->row['date_decision'],0,4)."|";
154 $decision.= $avis_sitadel_motif;
155 return $decision;
156 }
157
158 function terrain(){
159 $contenu="";
160 $contenu= floor($this->row['terrain_surface'])."|";
161 return $contenu;
162 }
163
164
165
166
167 function amenagement(){
168 // renseignement du groupe 2 ***
169 // lotissement|zac|afu|
170
171 if($this->row['amenagement']!='')
172 $contenu.= "1|";
173 else
174 $dcontenu.= "0|";
175 $contenu.= $this->p('zac')."|".$this->p('afu')."|";
176 return $contenu;
177 }
178
179 function travaux($travaux, $lascot,$mouvement){
180 // libnattrav| ou libmotif dans MODIFICATIF
181 $contenu=$this->maj($travaux)."|";
182 // natproj| innexistant en MODIFICATIF
183 if($mouvement != "Modificatif"){
184 if($lascot=='1'
185 or $lascot=='2'
186 or $lascot=='3')
187 $contenu.= $lascot."|"; // natproj 1:construction 2:extension ou 3:surelevation
188 else
189 $contenu.= "|";
190 }
191 // INITIAL (ou TRANSFERT)natdp|nattrav|*annexe*|*nivmax*
192 // MODIFICATIF nattrav|*annexe*|*nivmax*
193 if($mouvement != "Modificatif"){
194 $natdp='00000';
195 if($lascot=='1') $natdp="10000"; // nouvelle construction
196 if($lascot=='2') $natdp="01000"; // travaux sur construction existante
197 if($lascot=='3') $natdp="01000"; //
198 if($lascot=='X') $natdp="00001"; // cloture
199 $contenu.= $natdp."|";
200 }
201 // nattrav
202 $nattrav = "0000";
203 if($lascot=='2') $nattrav="1000";
204 if($lascot=='3') $nattrav="0100";
205 $contenu.= $nattrav."|";
206 // annexe non renseigner defaut 00000
207 $contenu.= $this->p('annexe')."|";
208 //nivmax non saisi
209 $contenu.=$this->p('nivmax')."|";
210 return $contenu;
211 }
212
213 function destination($shon){
214 $contenu="";
215 for($i=1;$i<=9;$i++){
216 if(!isset($shon[$i])) $shon[$i]=0;
217 $contenu.=$shon[$i].'|';
218
219 }
220 return $contenu;
221 }
222
223 function descriptif($mouvement){
224 // cpublic : non renseignee N par defaut
225 // O/N transport/enseignement/sante/social/special/culture
226
227 $contenu= $this->p('cpublic')."|"; //* supp|
228 // nblogdem
229 if($mouvement != "Modificatif"){
230 $contenu.= $this->row['logement_nombre']."|";
231 }
232 // nbmaison : nombre de maison
233 $contenu.= $this->p('nbmaison')."|";
234 // nblogcoll : nombre de logement collectif
235 $contenu.= $this->p('nblogcoll')."|";
236 // nbtotlog : nombre de logement total
237 $contenu.= $this->p('nbtotlog')."|";
238 // natres : nature des residences
239 // O/N 1=ages, 2=etudiant, 3=tourisme, 4=hotel, 5=social, 6= handicap, 7=autres
240 $contenu.= $this->p('natres')."|";
241 // libres= si autre residence (long max 1000 c)
242 $contenu.= $this->p('libres')."|";
243 // util : O/N personnel, principale, secondaire, vente, location
244 $contenu.= $this->p('util')."|";
245 //chambre
246 $contenu.= $this->p('chambre')."|";
247 // nb logement sociaux
248 $contenu.= $this->p('finis')."|";
249 // nb logt financt aides
250 $contenu.= $this->p('finaa')."|";
251 // nb de logt pret a taux 0
252 $contenu.= $this->p('finptz')."|";
253 // nb de logt finances autrt
254 $contenu.= $this->p('finaf')."|";
255 // nb pieces en maison individuelle
256 if($mouvement != "Modificatif")
257 $contenu.= $this->row['piece_nombre']."|"; // voir si 0
258 // chambre (num capacite accueil locaux hebergement)
259 // $contenu.= "|";
260 // nb de logement 1piece
261 $contenu.= $this->p('piec1')."|";
262 // nb de logement 2 pieces
263 $contenu.= $this->p('piec2')."|";
264 // nb de logement 3 pieces
265 $contenu.= $this->p('piec3')."|";
266 // nb de logement 4 pieces
267 $contenu.= $this->p('piec4')."|";
268 // nb de logement 5 pieces
269 $contenu.= $this->p('piec5')."|";
270 // nb de logement 6 pieces
271 $contenu.= $this->p('piec6');
272 // (derniere zone decision et modificatif)
273 return $contenu;
274 }
275
276 function chantier(){
277 //datereoc|
278 $suivi1="";
279 $suivi1.=substr($this->row['date_chantier'],8,2).substr($this->row['date_chantier'],5,2).
280 substr($this->row['date_chantier'],0,4)."|"; // *** au format francais
281 //nblogoc|nbmaisoc|nbcolloc|
282 $suivi1.=$this->p('nblogoc')."|".$this->p('nbmaisoc')."|".$this->p('nbcolloc')."|";
283 //shonoc|
284 $suivi1.=floor($this->row['shon'])."|"; // ok *** enlever les decimales
285 //*finisoc*|*finaaoc*|*finptzoc*|*finafoc|*indoc*|
286 $suivi1.=$this->p('finisoc')."|".$this->p('finaaoc')."|".
287 $this->p('finptzoc')."|".$this->p('finafoc')."|".$this->p('indoc')."|";
288 $suivi1.="|||||||||||"; // achevement 11|
289 return $suivi1;
290
291 }
292
293 function achevement(){
294 $suivi2="||||||||||"; // occupation 10 |
295 //datereat|
296 $suivi2.=substr($this->row['date_achevement'],8,2).substr($this->row['date_achevement'],5,2).
297 substr($this->row['date_achevement'],0,4)."|"; // ok *** au format francais
298 //nblogat|nbmaisat|nbcollat|
299 $suivi2.=$this->p('nblogat')."|".$this->p('nbmaisat')."|".$this->p('nbcollat')."|";
300 //shonat|
301 $suivi2.=floor($this->row['shon'])."|"; // ok *** enlever les decimales
302 //finisat|finaaat|finptzat|finafat|indat|
303 $suivi2.=$this->p('finisat')."|".$this->p('finaaat')."|".$this->p('finptzat').
304 "|".$this->p('finafat')."|".$this->p('indat')."|";
305 // Finchantier 1 si etat=cloturer sinon 0
306 if ($this->row['etat']=="cloturer"){
307 $suivi2.="1|";
308 }else{
309 $suivi2.="0|";
310 }
311 // Origat 1 par defaut
312 $suivi2.=$this->p('origat');
313 return $suivi2;
314 }
315
316 function p($champ){
317 if($this->DEBUG==2) return $champ;
318 if(isset($this->parametre[$champ])){
319 return $this->parametre[$champ];
320 }else
321 return $this->val[$champ];
322 }
323
324
325 function maj($val) {
326 $val = strtoupper($val);
327 $val=str_replace(chr(195), "", $val); // supprime le premier code des accents en UTF-8
328 $s = array('/[âàäÀ]/', '/[éêèëÉÈ]/', '/[îï]/', '/[ôöÔ]/', '/[ûùü]/', '/[çÇ]/', '/\'|\"|^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\-\s\r/');
329 $r = array('A', 'E', 'I', 'O', 'U', 'C', ' ');
330 $val = preg_replace($s , $r, $val);
331 return $val;
332 }
333
334
335
336
337
338
339 }
340
341 ?>

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26