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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2559 - (show annotations)
Fri Nov 29 14:41:02 2013 UTC (11 years, 2 months ago) by nhaye
File size: 34446 byte(s)
Ajout d'un code sitadel pour l'export de l'autorité compétente.

1 <?php
2 /**
3 * Classe permettant la mise en forme de chaque ligne de l'export SITADEL
4 * Les méthode retourne des morceaux de lignes en faisant correspondre les valeurs
5 * du dossier avec les valeurs définie pour l'export SITADEL
6 *
7 * @package openfoncier
8 * @version SVN : $Id$
9 */
10
11 class sitadel {
12
13 private $dossier; // identifiant du dossier à insérer dans l'export
14 private $row; // Valeurs du dossier
15 private $val; // parametre par defaut
16 private $parametre; //parametre dossier
17 private $DEBUG=0; // 1 = valeur
18
19 /**
20 * Constructeur, initialisation de l'attribut dossier
21 *
22 * @param dossier string identifiant du dossier à traiter
23 */
24 function sitadel($dossier) {
25 $this->dossier=$dossier;
26 }// fin constructeur
27
28 /**
29 * Mutateur pour le tableau de données du dossier
30 *
31 * @param $row Le tableau de données du dossier
32 * @return void
33 * */
34 public function setRow($row){
35 $this->row = $row;
36 }
37
38 /**
39 * Mutateur pour le paramètre par défaut
40 *
41 * @param $val Le paramètre par défaut
42 * @return void
43 * */
44 public function setVal($val){
45 $this->val = $val;
46 }
47
48 /**
49 * Permet de mettre en forme le début de chaque la ligne
50 *
51 * @param mouvement string DEPOT, DECISION, SUIVI, TRANSFERT, MODIFICATIF, SUPPRESSION
52 * @param departement string non utilisé
53 * @param commune string code commune du dossier
54 * @param pf_departement string code du département du dossier
55 *
56 * @return string entete de la ligne
57 */
58 function entete($mouvement, $departement, $commune,$pf_departement){
59 // sitadel : mouv|typpermis|equivalence|dep|commune|andepnumpc|indmod
60 // l'equivalence n'est pas utilisée
61 $entete=$mouvement."|".$this->row['code']."|Vm|".$pf_departement.$departement."|".$commune."|".substr($this->dossier,8,2).
62 "|".substr($this->dossier,10,5)."|".$this->getDossierVersion($this->dossier)."|";
63 return $entete;
64 }
65
66 /**
67 * Retourne le numéro de version du dossier d'instruction
68 * @param string $dossier
69 * @return string
70 */
71 private function getDossierVersion($dossier){
72 $numeroVersion[0] = "";
73
74 //Si le numéro de dossier est fourni
75 if ( $dossier !== "" ){
76 preg_match('/\d+$/', $dossier, $numeroVersion);
77 }
78
79 return $numeroVersion[0];
80 }
81
82 /**
83 * Permet de mettre en forme l'état civil :
84 * personne morale / physique
85 * société, siret, civilité, nom, prénom / civilité, nom, prénom
86 *
87 * @return string demandeur désigné
88 */
89 function etatcivil(){
90 // etat civil demandeur
91 // codemo|
92 if ($this->row['qualite'] == "particulier") {
93 $codemo=1;// personne physique
94 } else {
95 $codemo=2;// personne morale
96 }
97 $etatcivil=$codemo."|"; // 1 personne physique ; 2 sinon
98 // openfoncier civilite (5/8 ok), nom (80/30-> substr), societe (80/50->substr)
99 // civpart|prenompart|nompart|denopm|rspm|siret|catjur|civrep|prenomrep|nomrep|
100 // suivant codemo = 1 (personne physique) ou 2 (personne morale)
101 // demandeur_civilite n est pas normalise Madame ou Monsieur
102 if ($codemo == 1) {
103 // *civpart*|*prenompart*|nompart||||||
104 $etatcivil.= $this->maj(substr($this->row['civilite_pp'],0,8))."|";
105 $etatcivil.= $this->maj(substr($this->row['pp_particulier_prenom'],0,30))."|";
106
107 $etatcivil.= $this->maj(substr($this->row['pp_particulier_nom'],0,30))."|Vm|Vm|Vm|Vm|Vm|Vm|Vm|";
108 } else {
109 //denopm|*rspm*|*siret*|*catjur*|*civrep*|*prenomrep*|nomrep|
110 $etatcivil.="Vm|Vm|Vm|"; // codemo=1
111 $etatcivil.=$this->maj(substr($this->row['pp_personne_morale_denomination'],0,50))."|";
112 $etatcivil.=$this->maj(substr($this->row['pp_personne_morale_raison_sociale'],0,30))."|";
113 $etatcivil.=$this->maj(substr($this->row['pp_personne_morale_siret'],0,14))."|";
114 $etatcivil.=$this->maj(substr($this->row['pp_personne_morale_categorie_juridique'],0,4))."|";
115 $etatcivil.=$this->maj(substr($this->row['civilite_pm_libelle'],0,8))."|";
116 $etatcivil.=$this->maj(substr($this->row['pp_personne_morale_prenom'],0,30))."|";
117 $etatcivil.=$this->maj(substr($this->row['pp_personne_morale_nom'],0,30))."|";
118 }
119 return $etatcivil;
120 }
121
122 function adresse(){
123 // openfoncier : adresse (80/ 26+38 -> substr sur 2 zones) - cp (5/5 OK) - ville (30/36 -> OK)
124 // *numvoiemo*|*typvoiemo*|libvoiemo|lieuditmo(+)|communemo|codposmo|*bpmo*|*cedexmo*|*paysmo*|*divetermo|
125 $adresse="";
126 $adresse.= $this->maj(substr($this->row['pp_numero'],0,5))."|";
127 $adresse.= $this->maj(substr("",0,5))."|";
128 $adresse.= $this->maj(substr($this->row['pp_voie'],0,26))."|";
129 $adresse.= $this->maj(substr($this->row['pp_lieu_dit'],0,38))."|";
130 $adresse.= $this->maj(substr($this->row['pp_localite'],0,32))."|";
131 $adresse.= $this->maj(substr($this->row['pp_code_postal'],0,5))."|";
132 $adresse.= $this->maj(substr($this->row['pp_bp'],0,5))."|";
133 $adresse.= $this->maj(substr($this->row['pp_cedex'],0,5))."|";
134 $adresse.= $this->maj(substr($this->row['pp_pays'],0,3))."|";
135 $adresse.= $this->maj(substr($this->row['pp_division_territoriale'],0,38))."|";
136
137 return $adresse;
138 }
139
140
141 function delegataire(){
142 // openFoncier civilite (non normalise monsieur/madame), nom (80/30 substr)
143 // openfoncier : adresse (80/ 26+38 -> substr sur 2 zones) - cp (5/5 OK) - ville (30/32 -> OK)
144 // *civtiers*|*prenomtier*|nomtier|*numvoietiers*|*typvoietiers*|
145 // libvoietiers|lieudittier|communetier|codpostier
146 // |*bptier*|*cedextier*|*paystier*|*divtertier*|
147 $delegataire="";
148 $delegataire.= $this->maj(substr($this->row['civilite_delegataire_libelle'],0,8))."|";
149 $delegataire.= $this->maj(substr($this->row['delegataire_particulier_prenom'],0,30))."|";
150 $delegataire.= $this->maj(substr($this->row['delegataire_particulier_nom'],0,30))."|";
151 $delegataire.= $this->maj(substr($this->row['delegataire_numero'],0,5))."|";
152 $delegataire.= $this->maj(substr("",0,5))."|";
153 $delegataire.= $this->maj(substr($this->row['delegataire_voie'],0,26))."|";
154 $delegataire.= $this->maj(substr($this->row['delegataire_lieu_dit'],0,38))."|";
155 $delegataire.= $this->maj(substr($this->row['delegataire_localite'],0,32))."|";
156 $delegataire.= $this->maj(substr($this->row['delegataire_code_postal'],0,5))."|";
157 $delegataire.= $this->maj(substr($this->row['delegataire_bp'],0,5))."|";
158 $delegataire.= $this->maj(substr($this->row['delegataire_cedex'],0,5))."|";
159 $delegataire.= $this->maj(substr($this->row['delegataire_pays'],0,3))."|";
160 $delegataire.= $this->maj(substr($this->row['delegataire_division_territoriale'],0,38))."|";
161 return $delegataire;
162 }
163
164 function meltel($mouvement){
165 // openfoncier telephone_fixe (14/20), courriel(40, 50) pas de suivi
166 // sitadel : telmo|melmo|suivi
167 $meltel="";
168 if($mouvement != "TRANSFERT")
169 $meltel.=$this->maj($this->row['pp_telephone_fixe'])."|";
170 $meltel.= $this->maj($this->row['pp_courriel'])."|";
171 // suivi electronique
172 // Il n'y a pas de notification par mail gérée dans l'appli
173 $meltel.= "0";
174
175 // suivi -> fin enr pour transfert (sans |)
176 if($mouvement != "TRANSFERT")
177 $meltel.= "|";
178 return $meltel;
179 }
180
181 /**
182 * Permet de mettre en forme l'adresse du terrain
183 * @return string champs du terrain séparés par des |
184 */
185 function adresse_terrain(){
186 // openfoncier numero (4/5 substr), adresse(80, 26 +38 -> substr), complement (non utilise (80)), cp (5/5 ok), ville (30/32 ok)
187 // sitadel : |numvoiete|*typvoiete*|libvoiete|lieudite|communete|codposte|*bpte*|*cedexte*|
188 // mettre le | en debut pour info du 2eme groupe (suite 1er groupe)
189 $adresse="";
190 $adresse.= $this->maj(substr($this->row['dossier_terrain_adresse_voie_numero'],0,5))."|";
191 $adresse.= $this->maj(substr("",0,5))."|";
192 $adresse.= $this->maj(substr($this->row['dossier_terrain_adresse_voie'],0,26))."|";
193 $adresse.= $this->maj(substr($this->row['dossier_terrain_adresse_lieu_dit'],0,38))."|";
194 $adresse.= $this->maj(substr($this->row['dossier_terrain_adresse_localite'],0,32))."|";
195 $adresse.= $this->maj(substr($this->row['dossier_terrain_adresse_code_postal'],0,5))."|";
196 $adresse.= $this->maj(substr($this->row['dossier_terrain_adresse_bp'],0,5))."|";
197 $adresse.= $this->maj(substr($this->row['dossier_terrain_adresse_cedex'],0,5))."|";
198
199 return $adresse;
200 }
201
202 /**
203 * Formalise la parcelle à partir de la référence cadastrale
204 *
205 * @return string la chaine formatée
206 */
207 function parcelle(){
208 // ========
209 // parcelle
210 // ========
211 // cadastre 3 parcelles + 3 sections
212 // openfoncier = 1 seule parcelle (6/3+5)
213 // sitadel : scadastre1|ncadastre1|*scadastre2*|*ncadastre2*|*scadastre3*|*ncadastre3*|
214 $parcelle = "";
215 if ($this->row['dossier_terrain_references_cadastrales'] != "" ) {
216 $tab_parcelles = $this->parseParcelles($this->row['dossier_terrain_references_cadastrales']);
217
218 $parcelle .= ( isset($tab_parcelles[0]) && count($tab_parcelles[0]) == 3 )
219 ? $this->maj(substr($tab_parcelles[0]['section'],0,3))."|".
220 $this->maj(substr($tab_parcelles[0]['parcelle'],0,5))."|"
221 : "Vm|Vm|";
222 $parcelle .= ( isset($tab_parcelles[1]) && count($tab_parcelles[1]) == 3 )
223 ? $this->maj(substr($tab_parcelles[1]['section'],0,3))."|".
224 $this->maj(substr($tab_parcelles[1]['parcelle'],0,5))."|"
225 : "Vm|Vm|";
226 $parcelle .= ( isset($tab_parcelles[2]) && count($tab_parcelles[2]) == 3 )
227 ? $this->maj(substr($tab_parcelles[2]['section'],0,3))."|".
228 $this->maj(substr($tab_parcelles[2]['parcelle'],0,5))."|"
229 : "Vm|Vm|";
230 } else {
231 $parcelle= "Vm|Vm|Vm|Vm|Vm|Vm|";
232 }
233
234 return $parcelle;
235 }
236
237 /**
238 * Permet de calculer la liste des parcelles à partir de la chaîne passée en paramètre
239 * et la retourner sous forme d'un tableau associatif
240 *
241 * @param string $strParcelles chaîne de la parcelles
242 * @return array (array(quartier, section, parcelle), ...)
243 */
244 function parseParcelles($strParcelles) {
245
246 // Séparation des lignes
247 $references = explode(";", $strParcelles);
248 $liste_parcelles = array();
249
250 // On boucle sur chaque ligne pour ajouter la liste des parcelles de chaque ligne
251 foreach ($references as $parcelles) {
252
253 // On transforme la chaîne de la ligne de parcelles en tableau
254 $ref = str_split($parcelles);
255 // Les 1er caractères sont numériques
256 $num = true;
257
258 // Tableau des champs de la ligne de références cadastrales
259 $reference_tab = array();
260 $temp = "";
261 foreach ($ref as $carac) {
262
263 // Permet de tester si le caractère courant est de même type que le précédent
264 if(is_numeric($carac) === $num) {
265 $temp .= $carac;
266 } else {
267 // Bascule
268 $num = !$num;
269 // On stock le champ
270 $reference_tab[] = $temp;
271 // re-init de la valeur temporaire pour le champ suivant
272 $temp = $carac;
273 }
274 }
275 // Stockage du dernier champ sur lequel il n'y a pas eu de bascule
276 $reference_tab[] = $temp;
277 // Calcul des parcelles
278 $quartier = $reference_tab[0];
279 $sect = $reference_tab[1];
280
281 $ancien_ref_parc = "";
282 for ($i=2; $i < count($reference_tab); $i+=2) {
283 $parc["quartier"] = $quartier;
284 $parc["section"] = $sect;
285 if( $ancien_ref_parc == "" OR $reference_tab[$i-1] == "/") {
286 // 1ere parcelle ou parcelle individuelle
287 $parc["parcelle"] = $reference_tab[$i];
288 // Ajout d'une parcelle à la liste
289 $liste_parcelles[] = $parc;
290 } elseif ($reference_tab[$i-1] == "A") {
291 // Interval de parcelles
292 for ($j=$ancien_ref_parc+1; $j <= $reference_tab[$i]; $j++) {
293 $parc["parcelle"] = $j;
294 // Ajout d'une parcelle à la liste
295 $liste_parcelles[] = $parc;
296 }
297 }
298 //Gestion des erreurs
299 else{
300
301 echo _("Une erreur de formattage a ete detecte dans la reference cadastrale du dossier ").$this->row['dossier'];
302 }
303 // Sauvegarde de la référence courante de parcelle
304 $ancien_ref_parc = $reference_tab[$i];
305 }
306 }
307
308 return $liste_parcelles;
309 }
310
311 /**
312 * Données pour le groupe 1 du mouvement décision
313 *
314 * @return string la chaine de données du groupe 1
315 */
316 function decision_groupe1(){
317 // openfoncier autorite_competente (integer/1), sitadel(integer, 1)
318 // date_limite (date, 8)| date_notification_delai (date, 8),
319 // sitadel_motif (integer, 1)
320 // sitadel : collectivite|natdec|datredec|motifann
321
322 $decision = $this->maj(substr($this->row['autorite_competente_sitadel'],0,1))."|";
323 $decision.= $this->maj(substr($this->row['sitadel'],0,1))."|";
324
325 $datredec = "";
326 //Choix de la date
327 if ( $this->row['sitadel'] == 1 || $this->row['sitadel'] == 2 || $this->row['sitadel'] == 3 ){
328
329 $datredec = $this->row['date_limite'];
330 }
331 elseif( $this->row['sitadel'] != "" ){
332
333 $datredec = $this->row['date_notification_delai'];
334 }
335 // date au format francais 8 caracteres
336 $decision.= $this->maj(substr($datredec,8,2).''.
337 substr($datredec,5,2)."".
338 substr($datredec,0,4))."|";
339
340 $decision.= $this->maj(substr($this->row['sitadel_motif'],0,1));
341 $decision.= ($this->row['sitadel'] == 2 ||
342 $this->row['sitadel'] == 4 ||
343 $this->row['sitadel'] == 5) ? "|" : "";
344
345 return $decision;
346 }
347
348 /**
349 * Données pour le groupe 2 du mouvement décision concernant les aménagements et
350 * le terrain
351 *
352 * @return string la chaine de données du groupe 2
353 */
354 function amenagement_terrain(){
355 // openfoncier am_terr_surf (numeric/7) am_lotiss (bool/1) terr_juri_afu (20/1)
356 // co_cstr_nouv (20/1) co_cstr_exist (text/1000) co_modif_aspect (bool/1)
357 // co_modif_struct (bool/1) co_cloture (bool/1) co_trx_exten (bool/1)
358 // co_trx_surelev (bool/1) co_trx_nivsup (bool/1) co_trx_amgt (bool/1)
359 // co_anx_pisc (bool/1) co_anx_gara (bool/1) co_anx_veran (bool/1)
360 // co_anx_abri (bool/1) co_anx_autr (bool/1) co_bat_niv_nb (integer/3)
361 // sitadel : terrain|lotissement|ZAC|AFU|libnattrav|natproj|natdp|nattrav|
362 // annexe|nivmax
363 $amenagement_terrain="";
364 //Terrain
365 $amenagement_terrain .= ((isset($this->row['am_terr_surf'])) ? $this->maj(substr(floor($this->row['am_terr_surf']),0,7)) : 0)."|";
366 //Lotissement
367 $amenagement_terrain .= ((isset($this->row['am_lotiss']) && $this->maj($this->row['am_lotiss']) == 't') ? 1 : 0)."|";
368 //ZAC
369 $amenagement_terrain .= ((isset($this->row['terr_juri_zac']) && $this->maj($this->row['terr_juri_zac']) != '') ? 1 : 0)."|";
370 //AFU
371 $amenagement_terrain .= ((isset($this->row['terr_juri_afu']) && $this->maj($this->row['terr_juri_afu']) != '') ? 1 : 0)."|";
372 //Libnattrav
373 $amenagement_terrain .= (isset($this->row['terr_juri_desc'])) ? $this->maj(substr($this->row['terr_juri_desc'],0,1000))."|" : "Vm|";
374
375 // Nouvelle co,nstruction et travaux sur construction (natproj)
376 if ( isset($this->row['co_cstr_nouv']) && isset($this->row['co_cstr_exist']) &&
377 $this->maj($this->row['co_cstr_nouv']) == 't' &&
378 $this->maj($this->row['co_cstr_exist']) == 't' ){
379
380 $amenagement_terrain .= "3|";
381 }
382 //Nouvelle construction
383 elseif ( isset($this->row['co_cstr_nouv']) && $this->maj($this->row['co_cstr_nouv']) == 't' ) {
384
385 $amenagement_terrain .= "1|";
386 }
387 //Travaux sur construction existante
388 elseif ( isset($this->row['co_cstr_exist']) && $this->maj($this->row['co_cstr_exist']) == 't' ) {
389
390 $amenagement_terrain .= "2|";
391 }
392 //Sinon
393 else{
394
395 $amenagement_terrain .= "Vm|";
396 }
397 //Nature du projet dans le cas d'un DP (natdp)
398 if ( $this->row['code'] == "DP" ){
399
400 $amenagement_terrain .= ((isset($this->row['co_cstr_nouv']) && $this->maj($this->row['co_cstr_nouv']) == 't') ? 1 : 0);
401 $amenagement_terrain .= ((isset($this->row['co_cstr_exist']) && $this->maj($this->row['co_cstr_exist']) == 't') ? 1 : 0);
402 $amenagement_terrain .= ((isset($this->row['co_modif_aspect']) && $this->maj($this->row['co_modif_aspect']) == 't') ? 1 : 0);
403 $amenagement_terrain .= ((isset($this->row['co_modif_struct']) && $this->maj($this->row['co_modif_struct']) == 't') ? 1 : 0);
404 $amenagement_terrain .= ((isset($this->row['co_cloture']) && $this->maj($this->row['co_cloture']) == 't') ? 1 : 0)."|";
405 }
406 else {
407
408 $amenagement_terrain .= "Vm|";
409 }
410
411 //Nature des travaux sur construction existante
412 //nattrav
413 $amenagement_terrain .= ((isset($this->row['co_trx_exten']) && $this->maj($this->row['co_trx_exten']) == 't') ? 1 : 0);
414 $amenagement_terrain .= ((isset($this->row['co_trx_surelev']) && $this->maj($this->row['co_trx_surelev']) == 't') ? 1 : 0);
415 $amenagement_terrain .= ((isset($this->row['co_trx_niv_sup']) && $this->maj($this->row['co_trx_niv_sup']) == 't') ? 1 : 0);
416 $amenagement_terrain .= ((isset($this->row['co_trx_amgt']) && $this->maj($this->row['co_trx_amgt']) == 't') ? 1 : 0)."|";
417
418 //Annexe
419 $amenagement_terrain .= ((isset($this->row['co_anx_pisc']) && $this->maj($this->row['co_anx_pisc']) == 't') ? 1 : 0);
420 $amenagement_terrain .= ((isset($this->row['co_anx_gara']) && $this->maj($this->row['co_anx_gara']) == 't') ? 1 : 0);
421 $amenagement_terrain .= ((isset($this->row['co_anxveran']) && $this->maj($this->row['co_anxveran']) == 't') ? 1 : 0);
422 $amenagement_terrain .= ((isset($this->row['co_anx_abri']) && $this->maj($this->row['co_anx_abri']) == 't') ? 1 : 0);
423 $amenagement_terrain .= ((isset($this->row['co_anx_autr']) && $this->maj($this->row['co_anx_autr']) == 't') ? 1 : 0)."|";
424
425 //nivmax
426 $amenagement_terrain .= isset($this->row['co_bat_niv_nb']) && $this->maj(substr($this->row['co_bat_niv_nb'],0,3))."|";
427
428 return $amenagement_terrain;
429 }
430
431 /**
432 * Données pour le groupe 2 du mouvement décision concernant les SHON
433 *
434 * @return string la chaine de données du groupe 2
435 */
436 function shon($nom){
437 // openfoncier (numeric/7)
438
439 $shon = "";
440
441 $shon .= ((isset($this->row[$nom.'1'])) ? $this->maj(substr(floor($this->row[$nom.'1']),0,7)) : 0)."|";
442 $shon .= ((isset($this->row[$nom.'2'])) ? $this->maj(substr(floor($this->row[$nom.'2']),0,7)) : 0)."|";
443 $shon .= ((isset($this->row[$nom.'3'])) ? $this->maj(substr(floor($this->row[$nom.'3']),0,7)) : 0)."|";
444 $shon .= ((isset($this->row[$nom.'4'])) ? $this->maj(substr(floor($this->row[$nom.'4']),0,7)) : 0)."|";
445 $shon .= ((isset($this->row[$nom.'5'])) ? $this->maj(substr(floor($this->row[$nom.'5']),0,7)) : 0)."|";
446 $shon .= ((isset($this->row[$nom.'6'])) ? $this->maj(substr(floor($this->row[$nom.'6']),0,7)) : 0)."|";
447 $shon .= ((isset($this->row[$nom.'7'])) ? $this->maj(substr(floor($this->row[$nom.'7']),0,7)) : 0)."|";
448 $shon .= ((isset($this->row[$nom.'8'])) ? $this->maj(substr(floor($this->row[$nom.'8']),0,7)) : 0)."|";
449 $shon .= ((isset($this->row[$nom.'9'])) ? $this->maj(substr(floor($this->row[$nom.'9']),0,7)) : 0)."|";
450
451 return $shon;
452 }
453
454 /**
455 * Permet de mettre en forme le descriptif des modifications apportés sur le
456 * terrain dans les dossier d'instruction de type modificatif
457 *
458 * @return string chaîne mise en forme
459 */
460 function modificatif_terrain() {
461 $modificatif_terrain="";
462
463 // Terrain
464 $modificatif_terrain .= ((isset($this->row['am_terr_surf'])) ? $this->maj(substr(floor($this->row['am_terr_surf']),0,7)) : 0)."|";
465 // Description des modifications
466 $modificatif_terrain .= (isset($this->row['mod_desc'])) ? $this->maj(substr($this->row['mod_desc'],0,1000))."|" : "Vm|";
467 //Nature des travaux sur construction existante
468 //nattrav
469 $modificatif_terrain .= ((isset($this->row['co_trx_exten']) && $this->maj($this->row['co_trx_exten']) == 't') ? 1 : 0);
470 $modificatif_terrain .= ((isset($this->row['co_trx_surelev']) && $this->maj($this->row['co_trx_surelev']) == 't') ? 1 : 0);
471 $modificatif_terrain .= ((isset($this->row['co_trx_niv_sup']) && $this->maj($this->row['co_trx_niv_sup']) == 't') ? 1 : 0);
472 $modificatif_terrain .= ((isset($this->row['co_trx_amgt']) && $this->maj($this->row['co_trx_amgt']) == 't') ? 1 : 0)."|";
473
474 //Annexe
475 $modificatif_terrain .= ((isset($this->row['co_anx_pisc']) && $this->maj($this->row['co_anx_pisc']) == 't') ? 1 : 0);
476 $modificatif_terrain .= ((isset($this->row['co_anx_gara']) && $this->maj($this->row['co_anx_gara']) == 't') ? 1 : 0);
477 $modificatif_terrain .= ((isset($this->row['co_anxveran']) && $this->maj($this->row['co_anxveran']) == 't') ? 1 : 0);
478 $modificatif_terrain .= ((isset($this->row['co_anx_abri']) && $this->maj($this->row['co_anx_abri']) == 't') ? 1 : 0);
479 $modificatif_terrain .= ((isset($this->row['co_anx_autr']) && $this->maj($this->row['co_anx_autr']) == 't') ? 1 : 0)."|";
480
481 //nivmax
482 $modificatif_terrain .= isset($this->row['co_bat_niv_nb']) && $this->maj(substr($this->row['co_bat_niv_nb'],0,3))."|";
483
484
485 return $modificatif_terrain;
486 }
487
488 /**
489 * Données pour le groupe 2 du mouvement décision concernant les destinations
490 *
491 * @return string la chaine de données du groupe 2
492 */
493 function destination($mouvement){
494
495 $destination = "";
496
497 $destination .= ((isset($this->row['co_sp_transport']) && $this->row['co_sp_transport'] == 't') ? 1 : 0);
498 $destination .= ((isset($this->row['co_sp_enseign']) && $this->row['co_sp_enseign'] == 't') ? 1 : 0);
499 $destination .= ((isset($this->row['co_sp_sante']) && $this->row['co_sp_sante'] == 't') ? 1 : 0);
500 $destination .= ((isset($this->row['co_sp_act_soc']) && $this->row['co_sp_act_soc'] == 't') ? 1 : 0);
501 $destination .= ((isset($this->row['co_sp_ouvr_spe']) && $this->row['co_sp_ouvr_spe'] == 't') ? 1 : 0);
502 $destination .= ((isset($this->row['co_sp_culture']) && $this->row['co_sp_culture'] == 't') ? 1 : 0)."|";
503
504 if($mouvement != "MODIFICATIF"){
505 $destination .= ((isset($this->row['dm_tot_log_nb']) && !empty($this->row['dm_tot_log_nb'])) ? $this->row['dm_tot_log_nb'] : 0)."|";
506 }
507 $destination .= ((isset($this->row['co_tot_ind_nb']) && !empty($this->row['co_tot_ind_nb'])) ? $this->row['co_tot_ind_nb'] : 0)."|";
508 $destination .= ((isset($this->row['co_tot_coll_nb']) && !empty($this->row['co_tot_coll_nb'])) ? $this->row['co_tot_coll_nb'] : 0)."|";
509 $destination .= ((isset($this->row['co_tot_log_nb']) && !empty($this->row['co_tot_log_nb'])) ? $this->row['co_tot_log_nb'] : 0)."|";
510
511 $destination .= ((isset($this->row['co_resid_agees']) && $this->row['co_resid_agees']) ? 1 : 0);
512 $destination .= ((isset($this->row['co_resid_etud']) && $this->row['co_resid_etud']) ? 1 : 0);
513 $destination .= ((isset($this->row['co_resid_tourism']) && $this->row['co_resid_tourism']) ? 1 : 0);
514 $destination .= ((isset($this->row['co_resid_hot_soc']) && $this->row['co_resid_hot_soc']) ? 1 : 0);
515 $destination .= ((isset($this->row['co_resid_soc']) && $this->row['co_resid_soc']) ? 1 : 0);
516 $destination .= ((isset($this->row['co_resid_hand']) && $this->row['co_resid_hand']) ? 1 : 0);
517 $destination .= ((isset($this->row['co_resid_autr']) && $this->row['co_resid_autr']) ? 1 : 0)."|";
518
519 $destination .= (isset($this->row['co_resid_autr_desc']) ? $this->maj($this->row['co_resid_autr_desc']) : "")."|";
520
521 $destination .= ((isset($this->row['co_uti_pers']) && $this->row['co_uti_pers']) ? 1 : 0);
522 $destination .= ((isset($this->row['co_uti_princ']) && $this->row['co_uti_princ']) ? 1 : 0);
523 $destination .= ((isset($this->row['co_uti_secon']) && $this->row['co_uti_secon']) ? 1 : 0);
524 $destination .= ((isset($this->row['co_uti_vente']) && $this->row['co_uti_vente']) ? 1 : 0);
525 $destination .= ((isset($this->row['co_uti_loc']) && $this->row['co_uti_loc']) ? 1 : 0)."|";
526
527 $destination .= ((isset($this->row['co_foyer_chamb_nb']) && !empty($this->row['co_foyer_chamb_nb'])) ? $this->row['co_foyer_chamb_nb'] : 0)."|";
528
529 return $destination;
530 }
531
532 /**
533 * Données pour le groupe 2 du mouvement décision concernant la répartition des
534 * logements créées par type de financement
535 *
536 * @return string la chaine de données du groupe 2
537 */
538 function repartitionFinan(){
539
540 $repartitionFinan = "";
541
542 $repartitionFinan .= ((isset($this->row['co_fin_lls_nb']) && $this->row['co_fin_lls_nb']) ? $this->row['co_fin_lls_nb'] : 0)."|";
543 $repartitionFinan .= ((isset($this->row['co_fin_aa_nb']) && $this->row['co_fin_aa_nb']) ? $this->row['co_fin_aa_nb'] : 0)."|";
544 $repartitionFinan .= ((isset($this->row['co_fin_ptz_nb']) && $this->row['co_fin_ptz_nb']) ? $this->row['co_fin_ptz_nb'] : 0)."|";
545 $repartitionFinan .= ((isset($this->row['co_fin_autr_nb']) && $this->row['co_fin_autr_nb']) ? $this->row['co_fin_autr_nb'] : 0)."|";
546
547 return $repartitionFinan;
548 }
549
550 /**
551 * Données pour le groupe 2 du mouvement décision concernant la répartition des
552 * logements créées par nombre de pièces
553 *
554 * @return string la chaine de données du groupe 2
555 */
556 function repartitionNbPiece($mouvement){
557
558 $repartitionFinan = "";
559 if($mouvement != "MODIFICATIF"){
560 $repartitionFinan .= ((isset($this->row['co_mais_piece_nb']) && $this->maj($this->row['co_mais_piece_nb']) == 't') ? 1 : 0)."|";
561 }
562 $repartitionFinan .= ((isset($this->row['co_log_1p_nb']) && $this->maj($this->row['co_log_1p_nb']) == 't') ? 1 : 0)."|";
563 $repartitionFinan .= ((isset($this->row['co_log_2p_nb']) && $this->maj($this->row['co_log_2p_nb']) == 't') ? 1 : 0)."|";
564 $repartitionFinan .= ((isset($this->row['co_log_3p_nb']) && $this->maj($this->row['co_log_3p_nb']) == 't') ? 1 : 0)."|";
565 $repartitionFinan .= ((isset($this->row['co_log_4p_nb']) && $this->maj($this->row['co_log_4p_nb']) == 't') ? 1 : 0)."|";
566 $repartitionFinan .= ((isset($this->row['co_log_5p_nb']) && $this->maj($this->row['co_log_5p_nb']) == 't') ? 1 : 0)."|";
567 $repartitionFinan .= ((isset($this->row['co_log_6p_nb']) && $this->maj($this->row['co_log_6p_nb']) == 't') ? 1 : 0);
568
569 return $repartitionFinan;
570 }
571
572 /**
573 * Permet de mettre en forme les données du mouvement suivi pour une ouverture de chantier
574 * @return string Chaîne contenant les infos spécifiques aux DOC séparé par "|"
575 */
576 function chantier(){
577
578 $chantier="";
579
580 if(isset($this->row['doc_date'])) {
581 $chantier .= substr($this->row['doc_date'],8,2).substr($this->row['doc_date'],5,2).
582 substr($this->row['doc_date'],0,4)."|"; // *** au format francais
583 } else {
584 $chantier .= "|";
585 }
586 $chantier .= ((isset($this->row['doc_nb_log']) AND $this->row['doc_nb_log'] != "" ) ? $this->row['doc_nb_log'] : "vm")."|";
587 $chantier .= ((isset($this->row['doc_nb_log_indiv']) AND $this->row['doc_nb_log_indiv'] != "" ) ? $this->row['doc_nb_log_indiv'] : "vm")."|";
588 $chantier .= ((isset($this->row['doc_nb_log_coll']) AND $this->row['doc_nb_log_coll'] != "" ) ? $this->row['doc_nb_log_coll'] : "vm")."|";
589 $chantier .= ((isset($this->row['doc_surf']) AND $this->row['doc_surf'] != "" ) ? substr(floor($this->row['doc_surf']),0,7) : "vm")."|";
590 $chantier .= ((isset($this->row['doc_nb_log_lls']) AND $this->row['doc_nb_log_lls'] != "" ) ? $this->row['doc_nb_log_lls'] : "vm")."|";
591 $chantier .= ((isset($this->row['doc_nb_log_aa']) AND $this->row['doc_nb_log_aa'] != "" ) ? $this->row['doc_nb_log_aa'] : "vm")."|";
592 $chantier .= ((isset($this->row['doc_nb_log_ptz']) AND $this->row['doc_nb_log_ptz'] != "" ) ? $this->row['doc_nb_log_ptz'] : "vm")."|";
593 $chantier .= ((isset($this->row['doc_nb_log_autre']) AND $this->row['doc_nb_log_autre'] != "" ) ? $this->row['doc_nb_log_autre'] : "vm")."|";
594 // indice de la tranche commencée
595 $chantier .= "vm|";
596
597 $chantier.="|||||||||||"; // achevement 11|
598 return $chantier;
599 }
600
601 /**
602 * Permet d'afficher le dessein correspondant à une DAACT
603 * @return string Chaîne contenant les infos spécifiques aux DAACT séparé par "|"
604 */
605 function achevement(){
606 $achevement="||||||||||"; // chantier 10 |
607 if(isset($this->row['daact_date'])) {
608 $achevement .= substr($this->row['daact_date'],8,2).substr($this->row['daact_date'],5,2).
609 substr($this->row['daact_date'],0,4)."|"; // *** au format francais
610 } else {
611 $achevement .= "|";
612 }
613 $achevement .= ((isset($this->row['daact_nb_log']) AND $this->row['daact_nb_log'] != "" ) ? $this->row['daact_nb_log'] : "vm")."|";
614 $achevement .= ((isset($this->row['daact_nb_log_indiv']) AND $this->row['daact_nb_log_indiv'] != "" ) ? $this->row['daact_nb_log_indiv'] : "vm")."|";
615 $achevement .= ((isset($this->row['daact_nb_log_coll']) AND $this->row['daact_nb_log_coll'] != "" ) ? $this->row['daact_nb_log_coll'] : "vm")."|";
616 $achevement .= ((isset($this->row['daact_surf']) AND $this->row['daact_surf'] != "" ) ? substr(floor($this->row['daact_surf']),0,7) : "vm")."|";
617 $achevement .= ((isset($this->row['daact_nb_log_lls']) AND $this->row['daact_nb_log_lls'] != "" ) ? $this->row['daact_nb_log_lls'] : "vm")."|";
618 $achevement .= ((isset($this->row['daact_nb_log_aa']) AND $this->row['daact_nb_log_aa'] != "" ) ? $this->row['daact_nb_log_aa'] : "vm")."|";
619 $achevement .= ((isset($this->row['daact_nb_log_ptz']) AND $this->row['daact_nb_log_ptz'] != "" ) ? $this->row['daact_nb_log_ptz'] : "vm")."|";
620 $achevement .= ((isset($this->row['daact_nb_log_autre']) AND $this->row['daact_nb_log_autre'] != "" ) ? $this->row['daact_nb_log_autre'] : "vm")."|";
621 // indice de la tranche complétée
622 $achevement .= "vm|";
623 // Finchantier 1 si etat=cloturer sinon 0
624 if ($this->row['statut_di']=="cloture"){
625 $achevement.="1|";
626 }else{
627 $achevement.="0|";
628 }
629 // indique la provenance de l'info d'achèvement des travaux (déclaration/DGI)
630 $achevement .= "vm|";
631 return $achevement;
632 }
633
634 /**
635 * Permet de récupérer la valeur par defaut du champ passé en paramètre
636 * @param string $champ nom du champ dont on souhaite afficher la valeur par defaut
637 * @return string valeur par defaut
638 */
639 function defaultValue($champ){
640 if($this->DEBUG==2) return $champ;
641 if(isset($this->parametre[$champ])){
642 return $this->parametre[$champ];
643 }else
644 return $this->val[$champ];
645 }
646
647 /**
648 * Normalise la chaine de caractère ou renvoit "valeur manquant".
649 *
650 * @param $val La valeur du champ
651 * @return string la chaine formatée ou "vm"
652 */
653 function maj($val) {
654 $val = strtoupper($val);
655 $val=str_replace(chr(195), "", $val); // supprime le premier code des accents en UTF-8
656 $s = array('/[âàäÀ]/', '/[éêèëÉÈ]/', '/[îï]/', '/[ôöÔ]/', '/[ûùü]/', '/[çÇ]/', '/\'|\"|^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\-\s\r/');
657 $r = array('A', 'E', 'I', 'O', 'U', 'C', ' ');
658 $val = preg_replace($s , $r, $val);
659 // Formatage des valeurs manquantes
660 return $this->testVM($val);
661 }
662
663 /**
664 * Permet de tester si la valeur est manquante et retourner Vm
665 * sinon retourne le champ
666 *
667 * @param string $champ champ à tester
668 * @return string valeur à insérer dans l'export
669 */
670 function testVM($champ) {
671 if ( $champ == "" ) {
672 return "vm";
673 } else {
674 return $champ;
675 }
676 }
677 }
678
679 ?>

Properties

Name Value
svn:keywords Id

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26