/[openfoncier]/trunk/obj/dossier.class.php
ViewVC logotype

Contents of /trunk/obj/dossier.class.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 927 - (show annotations)
Fri Nov 30 02:42:42 2012 UTC (12 years, 2 months ago) by fmichon
File size: 52309 byte(s)
Amélioration de la gestion des identifiants des dossiers

1 <?php
2 //$Id$
3 //gen openMairie le 10/02/2011 20:39
4
5 require_once ("../gen/obj/dossier.class.php");
6 require_once("../services/outgoing/messageenqueuer.php");
7
8 class dossier extends dossier_gen {
9
10 var $maj;
11 var $sig;
12 var $servitude="";
13 var $auto_pos;
14 var $auto_servitude_surfacique;
15 var $auto_servitude_ligne;
16 var $auto_servitude_point;
17 var $auto_parcelle;
18 var $auto_parcelle_lot;
19 var $aff_depot = "collapsible";
20 var $aff_travaux = "collapsible";
21 var $aff_instruction = "collapsible";
22 var $aff_demandeur = "startClosed";
23 var $aff_delegataire = "startClosed";
24 var $aff_terrain = "startClosed";
25 var $aff_localisation = "collapsible";
26 var $aff_description = "startClosed";
27 var $aff_amenagement = "startClosed";
28
29 function dossier($id,&$db,$DEBUG) {
30 $this->constructeur($id,$db,$DEBUG);
31 } // fin constructeur
32
33 function setValFAjout($val = array()) {
34 $this->valF['dossier'] = $val['dossier_autorisation'];
35 }
36
37 function setvalF($val){
38 parent::setvalF($val);
39 // enlever les valeurs a ne pas saisir -> recherche en trigger ajouter et modifier
40 // $sig = 1
41 unset ($this->valF['geom']);
42 unset ($this->valF['geom1']);
43 // valeurs hiddenstatic (calcule)
44 if($this->maj==1){
45 // par defaut
46 unset ($this->valF['etat']);
47 unset ($this->valF['delai']);
48 unset ($this->valF['accord_tacite']);
49 unset ($this->valF['types']);
50 }
51 unset ($this->valF['avis_decision']); // avis + libelle avis
52 unset ($this->valF['terrain_surface_calcul']);
53 unset ($this->valF['shon_calcul']);
54 unset ($this->valF['parcelle_archive']);
55 unset ($this->valF['parcelle_lot_archive']);
56 unset ($this->valF['date_notification_delai']);
57 unset ($this->valF['date_decision']);
58 unset ($this->valF['date_limite']);
59 unset ($this->valF['date_validite']);
60 unset ($this->valF['date_chantier']);
61 unset ($this->valF['date_achevement']);
62 unset ($this->valF['date_conformite']);
63 }
64
65 function verifier($val,&$db,$DEBUG){
66 parent::verifier($val,$db,$DEBUG);
67 if($val['parcelle']!="" and $val['sig']!='Oui'){
68 if (!preg_match('/^[0-9]{3} [A-Z]{1,3} [0-9]{1,5}$/', $val['parcelle']) && !preg_match('/^[0-9]{3}[A-Z]{1,3}[0-9]{1,5}$/', $val['parcelle'])){
69 $this->correct=false;
70 $this->addToMessage("<br>format parcelle incorrect");
71 }
72 }
73 // regles travaux verification
74 if ($this->valF['travaux']!=""){
75 $sql= "select * from ".DB_PREFIXE."regle where id = '".$this->valF['travaux'].
76 "' and controle = 'travaux' order by ordre";
77 $res = $db->query($sql);
78 if (database :: isError($res)) die($res->getMessage().$sql);
79 $this->addToLog("requete ".$sql." execute <br>", EXTRA_VERBOSE_MODE);
80 $regle=0;
81 $msg="";
82 while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){
83 if(isset($this->valF[$row['champ']]))
84 $champvaleur=$this->valF[$row['champ']];
85 else
86 $champvaleur=0;
87 switch ($row['operateur']) {
88 case ">" :
89 if($row['sens']=="plus"){
90 if($champvaleur > $row['valeur'])
91 $condition = 1;
92 else
93 $condition = 0;
94 if($regle==1 or $condition == 1)
95 $regle=1;
96 else
97 $regle=0;
98 $msg=$msg."<br> + ".$row['message']." [".$row['champ']." = ".
99 $champvaleur."]";
100 }else{
101 if($champvaleur > $row['valeur']){
102 $condition = 0;
103 }else{
104 $condition = 1;
105 $regle=0;
106 }
107 $msg=$msg."<br> ou ".$row['message']." [".$row['champ']." = ".
108 $champvaleur."]";
109 }
110 break;
111 case ">=":
112 if($row['sens']=="plus"){
113 if($champvaleur >= $row['valeur'])
114 $condition = 1;
115 else
116 $condition = 0;
117 if($regle==1 or $condition == 1)
118 $regle=1;
119 else
120 $regle=0;
121 $msg=$msg."<br> + ".$row['message']." [".$row['champ']." = ".
122 $champvaleur."]";
123 }else{
124 if($champvaleur >= $row['valeur']){
125 $condition = 0;
126
127 }else{
128 $condition = 1;
129 $regle=0;
130 }
131 $msg=$msg."<br> ou ".$row['message']." [".$row['champ']." = ".
132 $champvaleur."]";
133 }
134 break;
135 case "<" :
136 if($row['sens']=="plus"){
137 if($champvaleur < $row['valeur'])
138 $condition = 1;
139 else
140 $condition = 0;
141 if($regle==1 or $condition == 1)
142 $regle=1;
143 else
144 $regle=0;
145 $msg=$msg."<br> + ".$row['message']." [".$row['champ']." = ".
146 $champvaleur."]";
147 }else{
148 if($champvaleur < $row['valeur']){
149 $condition = 0;
150 }else{
151 $condition = 1;
152 $regle=0;
153 }
154 $msg=$msg."<br> et ".$row['message']." [".$row['champ']." = ".
155 $champvaleur."]";
156 }
157 break;
158 case "==":
159 if($row['sens']=="plus"){
160 if($champvaleur == $row['valeur'])
161 $condition = 1;
162 else
163 $condition = 0;
164 if($regle==1 or $condition == 1)
165 $regle=1;
166 else
167 $regle=0;
168 $msg=$msg."<br> + ".$row['message']." [".$row['champ']." = ".
169 $champvaleur."]";
170 }else{
171 if($champvaleur == $row['valeur']){
172 $condition = 0;
173
174 }else{
175 $condition = 1;
176 $regle=0;
177 }
178 $msg=$msg."<br> ou ".$row['message']." [".$row['champ']." = ".
179 $champvaleur."]";
180 }
181 break;
182 //break;
183 } // switch
184 if($regle==0)
185 $this->addToMessage($msg." <br>");
186 } // while
187 } // travaux
188 }//verifier
189
190
191 function setType(&$form,$maj) {
192 parent::setType($form,$maj);
193 if ($maj < 2) { //ajouter et modifier
194 // cache
195 if($maj==0) $form->setType('dossier', 'hidden');
196 $form->setType('annee', 'hidden');
197 $form->setType('nature', 'select');
198 $form->setType('parcelle_archive','hidden');
199 $form->setType('parcelle_lot_archive','hidden');
200 $form->setType('objet_dossier','hidden'); // PC
201 $form->setType('amenagement','hidden'); // PC
202 $form->setType('parcelle_lot','hidden'); // PC
203 $form->setType('parcelle_lot_lotissement','hidden'); // PC
204
205 $form->setType('geom1', 'hidden');
206 $form->setType('geom', 'geom');
207 $form->setType('servitude', 'hiddenstatic');
208
209 //select
210 $form->setType('terrain_numero_complement','select');
211
212 // combo
213 $form->setType('rivoli','comboD');
214 $form->setType('terrain_adresse','comboG');
215 $form->setType('architecte_nom','comboG');
216 $form->setType('architecte','comboD');
217
218
219 // hiddenstatic
220 if($maj==1) $form->setType('dossier', 'hiddenstatic');
221 $form->setType('etat','hiddenstatic');
222 $form->setType('avis_decision','hiddenstatic');
223 $form->setType('delai','hiddenstatic');
224 $form->setType('terrain_surface_calcul','hiddenstatic');
225 $form->setType('shon_calcul','hiddenstatic');
226
227 $form->setType('accord_tacite','hiddenstatic');
228 $form->setType('types', 'hiddenstatic'); // transfert modificatif
229
230
231 // hiddenstaticdate
232 $form->setType('date_notification_delai','hiddenstaticdate');
233 $form->setType('date_decision','hiddenstaticdate');
234 $form->setType('date_limite','hiddenstaticdate');
235 $form->setType('date_rejet','hiddenstaticdate');
236 $form->setType('date_complet','hiddenstaticdate');
237 $form->setType('date_limite','hiddenstaticdate');
238 $form->setType('date_validite','hiddenstaticdate');
239 $form->setType('date_chantier','hiddenstaticdate');
240 $form->setType('date_achevement','hiddenstaticdate');
241 $form->setType('date_conformite','hiddenstaticdate');
242
243 // checkbox
244 $form->setType('sig','checkbox');
245 $form->setType('delegataire','checkbox');
246
247 // mail
248 $form->setType('delegataire_email','mail');
249 $form->setType('demandeur_email','mail');
250
251 // zones temp et strategysig
252
253
254 // temp
255 if (file_exists ("../dyn/var.inc"))
256 include ("../dyn/var.inc");
257 if(!isset($auto_pos))
258 $auto_pos=0;
259 if($auto_pos==1)
260 $form->setType('pos','hiddenstatic');
261 else
262 $form->setType('pos','select');
263 $form->setType('temp1',$temp1_type);
264 $form->setType('temp2',$temp2_type);
265 $form->setType('temp3',$temp3_type);
266 $form->setType('temp4',$temp4_type);
267 $form->setType('temp5',$temp5_type);
268 $form->setType('a_qualifier', 'checkbox');
269 }
270 if ($maj == 1) {
271 //
272 if ($this->f->isAccredited("dossier_modifier_instructeur")) {
273 $form->setType('instructeur', 'select');
274 } else {
275 $form->setType('instructeur', 'selecthiddenstatic');
276 }
277 //
278 if($this->f->getParameter('afficher_division') === 'true') {
279 //
280 if ($this->f->isAccredited("dossier_modifier_division")) {
281 $form->setType('division', 'select');
282 } else {
283 $form->setType('division', 'selecthiddenstatic');
284 }
285 } else {
286 $form->setType('division', 'hidden');
287 }
288 }
289 if($maj == 3) {
290 $form->setType('annee', 'hidden');
291 $form->setType('nature', 'selectstatic');
292 $form->setType('temp1','hidden');
293 $form->setType('temp2','hidden');
294 $form->setType('temp3','hidden');
295 $form->setType('temp4','hidden');
296 $form->setType('temp5','hidden');
297 $form->setType('parcelle_archive','hidden');
298 $form->setType('parcelle_lot_archive','hidden');
299 $form->setType('geom1','hidden');
300 $form->setType('geom','hidden');
301 $form->setType('a_qualifier', 'checkboxstatic');
302 }
303 //
304 if(!$this->f->getParameter('afficher_division') === 'true') {
305 $form->setType('division', 'hidden');
306 }
307 $form->setType('dossier_autorisation', 'hiddenstatic');
308 }
309
310 function setVal(&$form,$maj,$validation){
311 $this->maj=$maj;
312 if ($validation==0) {
313 if ($maj == 0){
314 //$dossier_cp = $this->f->collectivite["cp"];
315 //$dossier_ville = $this->f->collectivite["ville"];
316 //$form->setVal('nature', $this->nature);
317
318 $form->setVal('annee', date('y'));
319 $form->setVal('date_demande', date('Y-m-d'));
320 $form->setVal('date_depot', date('Y-m-d'));
321
322 //$form->setVal('demandeur_cp', $dossier_cp);
323 //$form->setVal('demandeur_ville', $dossier_ville);
324
325 //$form->setVal('delegataire_cp', $dossier_cp);
326 //$form->setVal('delegataire_ville', $dossier_ville);
327
328 //$form->setVal('terrain_cp', $dossier_cp);
329 //$form->setVal('terrain_ville', $dossier_ville);
330
331 $form->setVal('accord_tacite', 'Non');
332 $form->setVal('etat', 'initialiser');
333 $form->setVal('types', 'Initial');
334 }
335 }
336 }
337
338 function setSelect(&$form, $maj,&$db,$debug) {
339 parent::setSelect($form, $maj,$db,$debug);
340 //optimisation sur table importante parcelle -> pas d appel methode parent
341 if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc.php"))
342 include ("../sql/".$db->phptype."/".$this->table.".form.inc.php");
343 if($maj<2){
344 // travaux
345 $contenu=array();
346 // prise en compte du solde en ajout
347 if($maj==0)
348 $sql_travaux = $sql_travaux.
349 " and solde = 'Non' order by libelle";
350 else
351 $sql_travaux = $sql_travaux.
352 " order by libelle";
353 $res = $db->query($sql_travaux);
354 if (database::isError($res)) die($res->getMessage()).$sql_travaux;
355 $this->addToLog(" la requete ".$sql_travaux." est executee", VERBOSE_MODE);
356 $contenu[0][0]="";
357 $contenu[1][0]=_('choisir')." "._('travaux');
358 $k=1;
359 while ($row=& $res->fetchRow()){
360 $contenu[0][$k]=$row[0];
361 $contenu[1][$k]=$row[1];
362 $k++;
363 }
364 $form->setSelect("travaux",$contenu);
365
366 // code et libelle voie
367 $contenu="";
368 $contenu[0][0]="rivoli";// table
369 $contenu[0][1]="rivoli"; // zone origine
370 $contenu[1][0]="libelle";
371 $contenu[1][1]="terrain_adresse";
372 $form->setSelect("rivoli",$contenu);
373 //terrain_adresse
374 $contenu="";
375 $contenu[0][0]="rivoli";// table
376 $contenu[0][1]="libelle"; // zone origine
377 $contenu[1][0]="rivoli";
378 $contenu[1][1]="rivoli";
379 $form->setSelect("terrain_adresse",$contenu);
380 // code et libelle architecte
381 $contenu="";
382 $contenu[0][0]="architecte";// table
383 $contenu[0][1]="architecte"; // zone origine
384 $contenu[1][0]="nom";
385 $contenu[1][1]="architecte_nom";
386 $form->setSelect("architecte",$contenu);
387 $contenu="";
388 $contenu[0][0]="architecte";// table
389 $contenu[0][1]="nom"; // zone origine
390 $contenu[1][0]="architecte";
391 $contenu[1][1]="architecte";
392 $form->setSelect("architecte_nom",$contenu);
393 // parcelle_lot
394 $contenu="";
395 $contenu[0][0]="parcelle_lot";// table
396 $contenu[0][1]="parcelle_lot"; // zone origine
397 $contenu[1][0]="lotissement";
398 $contenu[1][1]="parcelle_lot_lotissement";
399 $form->setSelect("parcelle_lot",$contenu);
400 $contenu="";
401 $contenu[0][0]="parcelle_lot";// table
402 $contenu[0][1]="lotissement"; // zone origine
403 $contenu[1][0]="parcelle_lot";
404 $contenu[1][1]="parcelle_lot";
405 $form->setSelect("parcelle_lot_lotissement",$contenu);
406 // accord tacite
407 $contenu=array();
408 $contenu[0]=array('Non','Oui');
409 $contenu[1]=array('Non','Oui');
410 $form->setSelect("accord_tacite",$contenu);
411 // terrain_numero_complement
412 $contenu=array();
413 $contenu[0]=array('','bis','ter','quater');
414 $contenu[1]=array('','bis','ter','quater');
415 $form->setSelect("terrain_numero_complement",$contenu);
416 // geom *** a voir
417 if($maj==1){ //modification
418 $contenu=array();
419 $contenu[0]=array("dossier",$this->getParameter("idx"));
420 $form->setSelect('geom',$contenu);
421 }
422
423 /*
424 * Affichage de données dans le select de la parcelle
425 * */
426 $contenu=array();
427 $sql="select parcelle from ".DB_PREFIXE."parcelle ";
428 $res = $db->query($sql);
429 if (database::isError($res))
430 die($res->getMessage());
431 $contenu[0][0]="";
432 $contenu[1][0]=_("choisir parcelle");
433 $k=1;
434 while ($row=& $res->fetchRow()){
435 $contenu[0][$k]=$row[0];
436 $contenu[1][$k]=$row[0];
437 $k++;
438 }
439 $form->setSelect("parcelle",$contenu);
440
441 }
442 if($this->f->getParameter('afficher_division')==='true') {
443 // instructeur
444 $this->init_select($form, $db, $maj, $debug, "instructeur",
445 $sql_instructeur_div, $sql_instructeur_div_by_id, false);
446 }
447 }
448
449 function setLib(&$form,$maj) {
450 parent::setLib($form,$maj);
451 $form->setLib('geom','');
452 }
453
454 function setGroupe(&$form,$maj){
455 //If ($maj==0){
456 // $form->setGroupe('date_demande','D');
457 // $form->setGroupe('date_depot','G');
458 // $form->setGroupe('division','F');
459 //}else{
460 // $form->setGroupe('dossier','D');
461 // $form->setGroupe('nature','G');
462 // $form->setGroupe('annee','G');
463 // $form->setGroupe('date_demande','G');
464 // $form->setGroupe('date_depot','G');
465 // $form->setGroupe('division','F');
466 //}
467 $form->setGroupe('demandeur_categorie','D');
468 $form->setGroupe('demandeur_civilite','G');
469 $form->setGroupe('demandeur_nom','F');
470
471 $form->setGroupe('demandeur_societe','D');
472 $form->setGroupe('demandeur_adresse','G');
473 $form->setGroupe('demandeur_adresse_complement','F');
474
475 $form->setGroupe('demandeur_cp','D');
476 $form->setGroupe('demandeur_ville','G');
477 $form->setGroupe('demandeur_pays','F');
478
479 $form->setGroupe('demandeur_email','D');
480 $form->setGroupe('demandeur_telephone','F');
481
482 $form->setGroupe('delegataire','D');
483 $form->setGroupe('delegataire_civilite','G');
484 $form->setGroupe('delegataire_nom','F');
485
486 $form->setGroupe('delegataire_societe','D');
487 $form->setGroupe('delegataire_adresse','G');
488 $form->setGroupe('delegataire_adresse_complement','F');
489 $form->setGroupe('delegataire_cp','D');
490 $form->setGroupe('delegataire_ville','G');
491 $form->setGroupe('delegataire_pays','F');
492
493 $form->setGroupe('delegataire_email','D');
494 $form->setGroupe('delegataire_telephone','F');
495
496 $form->setGroupe('architecte','D');
497 $form->setGroupe('architecte_nom','F');
498 //$form->setGroupe('saisie_architecte','F');
499
500 $form->setGroupe('travaux','D');
501 $form->setGroupe('travaux_complement','F');
502
503 // terrain
504 $form->setGroupe('terrain_numero','D');
505 $form->setGroupe('terrain_numero_complement','G');
506 $form->setGroupe('rivoli','F');
507 $form->setGroupe('terrain_adresse','D');
508 $form->setGroupe('terrain_adresse_complement','F');
509
510 $form->setGroupe('terrain_cp','D');
511 $form->setGroupe('terrain_ville','F');
512
513 // surface
514 $form->setGroupe('terrain_surface','D');
515 $form->setGroupe('terrain_surface_calcul','F');
516
517 // instruction
518 $form->setGroupe('date_complet','D');
519 $form->setGroupe('date_rejet','G');
520 $form->setGroupe('rejet','G');
521 $form->setGroupe('delai','F');
522
523 $form->setGroupe('date_limite','D');
524 $form->setGroupe('date_notification_delai','G');
525 $form->setGroupe('accord_tacite','G');
526 $form->setGroupe('etat','F');
527
528 $form->setGroupe('date_decision','D');
529 $form->setGroupe('avis_decision','G');
530 $form->setGroupe('date_validite','G');
531 $form->setGroupe('types','F');
532
533 $form->setGroupe('date_chantier','D');
534 $form->setGroupe('date_achevement','G');
535 $form->setGroupe('date_conformite','F');
536
537 // localisation
538 $form->setGroupe('parcelle','D');
539 $form->setGroupe('pos','G');
540 if($maj==1){
541 $form->setGroupe('sig','G');
542 $form->setGroupe('geom','F');
543 }else {
544 $form->setGroupe('sig','F');
545 }
546 if($maj==1){
547 $form->setGroupe('sig','G');
548 $form->setGroupe('geom','F');
549 }
550
551 // description
552 $form->setGroupe('batiment_nombre','D');
553 $form->setGroupe('logement_nombre','G');
554 $form->setGroupe('hauteur','G');
555 $form->setGroupe('piece_nombre','F');
556
557 $form->setGroupe('shon','D');
558 $form->setGroupe('shon_calcul','G');
559 $form->setGroupe('shob','G');
560 $form->setGroupe('lot','F');
561
562 $form->setGroupe('amenagement','D');
563 $form->setGroupe('parcelle_lot','G');
564 $form->setGroupe('parcelle_lot_lotissement','F');
565 }
566
567 function setOnchange(&$form,$maj){
568 parent::setOnchange($form,$maj);
569 // mise en majuscule
570 $form->setOnchange("demandeur_nom","this.value=this.value.toUpperCase()");
571 $form->setOnchange("demandeur_societe","this.value=this.value.toUpperCase()");
572 $form->setOnchange("delegataire_nom","this.value=this.value.toUpperCase()");
573 $form->setOnchange("delegataire_societe","this.value=this.value.toUpperCase()");
574 $form->setOnchange("architecte_nom","this.value=this.value.toUpperCase()");
575 $form->setOnchange("terrain_adresse","this.value=this.value.toUpperCase()");
576 $form->setOnchange('shon','VerifNumdec(this)');
577 $form->setOnchange('shob','VerifNumdec(this)');
578 $form->setOnchange('hauteur','VerifNumdec(this)');
579 $form->setOnchange('terrain_surface','VerifNumdec(this)');
580 }
581
582 function setLayout(&$form, $maj) {
583 //
584 $form->setBloc('dossier', 'D', '', ($maj == 3 ? 'col_9':'col_12'));
585 $form->setBloc('dossier', 'D', '', 'col_9');
586 $form->setFieldset('dossier', 'D', _("Dossier d'instruction"));
587 $form->setFieldset('autorite_competente', 'F');
588 $form->setBloc('autorite_competente', 'F');
589 $form->setBloc('date_demande', 'D', '', 'col_3');
590 $form->setFieldset('date_demande', 'D', _("Depot"));
591 $form->setFieldset('date_depot', 'F');
592 $form->setFieldset('enjeu_urba', 'D', _("Enjeu"));
593 $form->setFieldset('enjeu_erp', 'F');
594 $form->setBloc('enjeu_erp', 'F');
595 $form->setBloc('enjeu_erp', 'F');
596 //
597 $form->setBloc('objet_dossier', 'D', '', 'col_12');
598 //
599 $form->setFieldset('date_complet', 'D', _('Instruction'), 'col_12');
600 $form->setRegroupe('date_conformite','F','');
601 //
602 $form->setBloc('terrain_superficie', 'F');
603
604 }
605
606 function setRegroupe(&$form,$maj) {
607 //// depot
608 //If ($maj==0){
609 // $form->setRegroupe('date_demande','D',_("Depot"),$this->aff_depot );
610 //}
611 //If ($maj==1){
612 // $form->setRegroupe('dossier','D',_("Depot"), $this->aff_depot);
613 // $form->setRegroupe('date_demande','G','');
614 //}
615 //$form->setRegroupe('date_depot','G','');
616 //$form->setRegroupe('division','F','');
617
618 // travaux
619 $form->setRegroupe('architecte','D',_('Architecte')." / "._("Travaux"), $this->aff_travaux);
620 $form->setRegroupe('architecte_nom','G','');
621 $form->setRegroupe('travaux','G','');
622 $form->setRegroupe('travaux_complement','F','');
623
624 //// instruction
625 //$form->setRegroupe('date_complet','D',_('Instruction'), $this->aff_instruction);
626 //$form->setRegroupe('date_rejet','G','');
627 //$form->setRegroupe('date_notification_delai','G','');
628 //$form->setRegroupe('delai','G','');
629 //$form->setRegroupe('date_limite','G','Decision ');
630 //$form->setRegroupe('accord_tacite','G','');
631 //$form->setRegroupe('etat','G','');
632 //$form->setRegroupe('date_decision','G','');
633 //$form->setRegroupe('avis_decision','G','');
634 //$form->setRegroupe('date_validite','G','');
635 //$form->setRegroupe('types','G','');
636 //$form->setRegroupe('date_chantier','G','');
637 //$form->setRegroupe('date_achevement','G','');
638 //$form->setRegroupe('date_conformite','F','');
639
640 // demandeur
641 $form->setRegroupe('demandeur_categorie','D',_('Demandeur'), $this->aff_demandeur);
642 $form->setRegroupe('demandeur_civilite','G','');
643 $form->setRegroupe('demandeur_nom','G','');
644 $form->setRegroupe('demandeur_societe','G','');
645 $form->setRegroupe('demandeur_adresse','G','Decision ');
646 $form->setRegroupe('demandeur_cp','G','');
647 $form->setRegroupe('demandeur_ville','G','');
648 $form->setRegroupe('demandeur_pays','G','');
649 $form->setRegroupe('demandeur_email','G','');
650 $form->setRegroupe('demandeur_telephone','F','');
651
652
653 // delegataire
654 $form->setRegroupe('delegataire','D',_('delegataire'), $this->aff_delegataire);
655 $form->setRegroupe('delegataire_civilite','G','');
656 $form->setRegroupe('delegataire_nom','G','');
657 $form->setRegroupe('delegataire_societe','G','');
658 $form->setRegroupe('delegataire_adresse','G','Decision ');
659 $form->setRegroupe('delegataire_cp','G','');
660 $form->setRegroupe('delegataire_ville','G','');
661 $form->setRegroupe('delegataire_pays','G','');
662 $form->setRegroupe('delegataire_email','G','');
663 $form->setRegroupe('delegataire_telephone','F','');
664
665 // terrain
666 $form->setRegroupe('terrain_numero','D',_('terrain'), $this->aff_terrain);
667 $form->setRegroupe('terrain_numero_complement','G','');
668 $form->setRegroupe('rivoli','G','');
669 $form->setRegroupe('terrain_adresse','G','');
670 $form->setRegroupe('terrain_adresse_complement','G','');
671 $form->setRegroupe('terrain_cp','G','');
672 $form->setRegroupe('terrain_ville','G','');
673 $form->setRegroupe('terrain_surface','G',_('surface'),'');// $this->aff_surface);
674 $form->setRegroupe('terrain_surface_calcul','F','');
675
676 // localisation
677 $form->setRegroupe('parcelle','D',_('localisation'), $this->aff_localisation);
678 $form->setRegroupe('pos','G','');
679 $form->setRegroupe('sig','F','');
680 if($maj==1){
681 $form->setRegroupe('sig','G','');
682 $form->setRegroupe('geom','F','');
683 }
684
685 // description
686 $form->setRegroupe('batiment_nombre','D',_('statistique'), $this->aff_description);
687 $form->setRegroupe('logement_nombre','G','');
688 $form->setRegroupe('hauteur','G','');
689 $form->setRegroupe('piece_nombre','G','');
690 $form->setRegroupe('shon','G','');
691 $form->setRegroupe('shon_calcul','G','');
692 $form->setRegroupe('shob','G','');
693 $form->setRegroupe('lot','F','');
694
695 $form->setRegroupe('description','D',_('description').' '._('servitude'), $this->aff_amenagement);
696 $form->setRegroupe('servitude','F','');
697
698 // amenagement
699 $form->setRegroupe('amenagement','D',_('Amenagement'), $this->aff_amenagement);
700 $form->setRegroupe('parcelle_lot','G','');
701 $form->setRegroupe('parcelle_lot_lotissement','F','');
702
703 }
704
705
706
707 /* =============================================================
708 * fonction trigger relative a la connexion SIG
709 * $sig = 1 dans dyn/var.inc
710 * utilisé aussi pour envoyer une message au service REST d'ERP
711 * ===============================================================
712 */
713
714 function triggerajouterapres($id,&$db,$val,$DEBUG) {
715 $this->sig_parametre($db);
716 $id=$this->valF['dossier']; // id n est pas valorise en ajout
717 if($this->sig==1 and $val['sig']!='Oui'){
718 if($val['parcelle']!=''or $val['parcelle_lot']!=''){
719
720 $this->sig_interne($id,$db,$val,$DEBUG);
721 }
722 else
723 $this->addToMessage("<br>"._("Parcelle non renseignee dans dossier")." ".$id." <br>");
724
725 }
726
727 // envoi du message a ERP en cas d'un depot du dossier dat
728 if ($this->valF['nature'] ==
729 $this->f->getParameter('erp_depot_dossier_dat')) {
730 $msgenque = new MessageEnqueuer();
731 $msgenque->setDossierInstructionIdentifier($this->valF['dossier']);
732 $msgenque->enqueueMessage($msgenque::$ERP_DEPOT_DOSSIER_DAT);
733 }
734
735 // envoi du message a ERP en cas d'une demande d'ouverture DAT
736 if ($this->valF['nature'] ==
737 $this->f->getParameter('erp_demande_ouverture_dat')) {
738 $msgenque = new MessageEnqueuer();
739 $msgenque->setDossierInstructionIdentifier($this->valF['dossier']);
740 $msgenque->enqueueMessage($msgenque::$ERP_DEMANDE_OUVERTURE_DAT);
741 }
742
743 if ($this->valF['erp'] === true) {
744 // envoi du message a ERP en cas d'annulation d'une demande
745 if ($this->valF['nature'] ==
746 $this->f->getParameter('erp_annulation_demande')) {
747 $msgenque = new MessageEnqueuer();
748 $msgenque->setDossierInstructionIdentifier($this->valF['dossier']);
749 $msgenque->enqueueMessage($msgenque::$ERP_ANNULATION_DEMANDE);
750 }
751
752 // envoi du message a ERP en cas d'ouverture d'un dossier PC "rattache"
753 // au dossier DAACT
754 if ($this->valF['nature'] ==
755 $this->f->getParameter('erp_demande_ouverture_pc_daact')) {
756 $msgenque = new MessageEnqueuer();
757 $msgenque->setDossierInstructionIdentifier($this->valF['dossier']);
758 $msgenque->enqueueMessage($msgenque::$ERP_DEMANDE_OUVERTURE_PC);
759 }
760 }
761
762 }
763
764 /*
765 * Calcul l'identifiant du quartier et d'un arrondissement d'une parcelle
766 * */
767 function getQuartierArrondissement($parcelle) {
768
769 $parcelle = trim($parcelle);
770 $quartier = '';
771
772 /*Récupère le code impot du quartier dans la parcelle*/
773 for ( $i = 0 ; $i < strlen($parcelle) ; $i++ ){
774
775 if (is_numeric($parcelle[$i]) ){
776
777 $quartier .= $parcelle[$i];
778 }
779 else{
780
781 break;
782 }
783 }
784
785 if ( $quartier !== '' ){
786
787 /*identifiant*/
788 $sql = "SELECT
789 quartier, arrondissement
790 FROM
791 ".DB_PREFIXE."quartier
792 WHERE
793 code_impots='$quartier'";
794
795 $this->addToLog("getQuartierArrondissement(parcelle) : db->query(\"$sql\")", VERBOSE_MODE);
796 $res = $this->db->query($sql);
797 if (database :: isError($res))
798 die($res->getMessage()."erreur ".$sql);
799
800 if ( $res->numRows() > 0 ){
801
802 return $res->fetchRow(DB_FETCHMODE_ASSOC);
803 }
804 }
805
806 return NULL;
807 }
808
809 /*
810 * Retourne la section d'une parcelle
811 * */
812 function getSection($parcelle){
813
814 $parcelle = trim($parcelle);
815 $section = NULL;
816
817 for ( $i = 0 ; $i < strlen($parcelle) ; $i++ )
818 if ( !is_numeric($parcelle[$i]) && is_string($parcelle[$i]) && $parcelle[$i] !== ' ' )
819 $section .= $parcelle[$i];
820
821 return $section;
822 }
823
824 /*
825 * Retourne l'intructeur correspondant le mieux Ă  la parcelle
826 * */
827 function getInstructeurDivision( $quartier, $arrondissement, $section, $nature) {
828
829 $quartier = ( $quartier == NULL ) ? -1 : $quartier;
830 $arrondissement = ( $arrondissement == NULL ) ? -1 : $arrondissement;
831
832 $sql = "
833 SELECT
834 instructeur, section, quartier, arrondissement, nature
835 FROM
836 ".DB_PREFIXE."lien_localisation_nature l
837 WHERE
838 ( nature IS NULL AND arrondissement IS NULL AND quartier IS NULL AND section IS NULL ) OR
839 ( nature IS NULL AND arrondissement IS NULL AND quartier IS NULL AND section = '$section' ) OR
840 ( nature IS NULL AND arrondissement IS NULL AND quartier = $quartier AND section IS NULL ) OR
841 ( nature IS NULL AND arrondissement IS NULL AND quartier = $quartier AND section = '$section' ) OR
842 ( nature IS NULL AND arrondissement = $arrondissement AND quartier IS NULL AND section IS NULL ) OR
843 ( nature IS NULL AND arrondissement = $arrondissement AND quartier IS NULL AND section = '$section' ) OR
844 ( nature IS NULL AND arrondissement = $arrondissement AND quartier = $quartier AND section IS NULL ) OR
845 ( nature IS NULL AND arrondissement = $arrondissement AND quartier = $quartier AND section = '$section' ) OR
846 ( nature = '$nature' AND arrondissement IS NULL AND quartier IS NULL AND section IS NULL ) OR
847 ( nature = '$nature' AND arrondissement IS NULL AND quartier IS NULL AND section = '$section' ) OR
848 ( nature = '$nature' AND arrondissement IS NULL AND quartier = $quartier AND section IS NULL ) OR
849 ( nature = '$nature' AND arrondissement IS NULL AND quartier = $quartier AND section = '$section' ) OR
850 ( nature = '$nature' AND arrondissement = $arrondissement AND quartier IS NULL AND section IS NULL ) OR
851 ( nature = '$nature' AND arrondissement = $arrondissement AND quartier IS NULL AND section = '$section' ) OR
852 ( nature = '$nature' AND arrondissement = $arrondissement AND quartier = $quartier AND section IS NULL ) OR
853 ( nature = '$nature' AND arrondissement = $arrondissement AND quartier = $quartier AND section = '$section' )
854 ORDER BY section, quartier, arrondissement, nature
855 LIMIT 1
856 ";
857
858 $this->addToLog("getInstructeurDivision( quartier, arrondissement, section, nature) : db->query(\"$sql\")", VERBOSE_MODE);
859 $res = $this->db->query($sql);
860 if (database :: isError($res))
861 die($res->getMessage()."erreur ".$sql);
862
863 if ( $res->numRows() > 0 ){
864
865 $row = $res->fetchRow(DB_FETCHMODE_ASSOC);
866
867 $sql = "SELECT division FROM ".DB_PREFIXE."instructeur WHERE instructeur = ".$row['instructeur'];
868 $res = $this->db->query($sql);
869 if (database :: isError($res))
870 die($res->getMessage()."erreur ".$sql);
871
872 if ( $res->numRows() > 0 ){
873
874 $rowT=& $res->fetchRow(DB_FETCHMODE_ASSOC);
875 $row['division'] = $rowT['division'];
876 }
877
878 return $row;
879 }
880
881 return NULL;
882 }
883
884 /* =============================================================
885 * fonction trigger relative a la connexion SIG
886 * $sig = 1 dans dyn/var.inc
887 * ===============================================================
888 */
889
890 function triggerajouter($id,&$db,$val,$DEBUG) {
891 //
892 $this->addToLog("triggerajouter() : start", EXTRA_VERBOSE_MODE);
893
894 // Initialisation des variables nécessaires à l'affectation automatique
895 $quartier = NULL;
896 $arrondissement = NULL;
897 $section = NULL;
898 $instructeur = NULL;
899
900 // Si la parcelle n'est pas vide alors on récupère la section, le
901 // quartier et l'arrondissement
902 if ($val['parcelle'] != '') {
903 // Cette méthode récupère l'arrondissement et le quartier associé à une parcelle
904 $quartierArrondissement = $this->getQuartierArrondissement($val['parcelle']);
905 if ( $quartierArrondissement!= NULL ){
906
907 $quartier = $quartierArrondissement['quartier'];
908 $arrondissement = $quartierArrondissement['arrondissement'];
909 }
910 // Si il n'y a pas d'arrondissement alors on vide le quartier
911 if ( strcmp($arrondissement,'') == 0 ) {
912
913 $arrondissement = NULL;
914 $quartier = NULL;
915 }
916 // On récupère la section
917 $section = $this->getSection($val['parcelle']);
918 }
919
920 // Si aucun instructeur n'est saisi et que la nature n'est pas vide
921 // alors on récupère l'instructeur et la division depuis l'affectation
922 if ( ( empty($this->valF['instructeur']) || $this->valF['instructeur'] == '' ) && $val['nature'] != '' ) {
923
924 //
925 $instructeurDivision = $this->getInstructeurDivision($quartier, $arrondissement, $section, $val['nature']);
926 if ( $instructeurDivision != NULL ){
927
928 $instructeur = $instructeurDivision['instructeur'];
929 $division = $instructeurDivision['division'];
930 }
931
932 if ( $instructeur != NULL ){
933
934 $this->valF['instructeur'] = $instructeur;
935 $this->valF['division'] = $division;
936 } else {
937 if ($this->f->isAccredited("dossier_modifier_instructeur")) {
938 $this->addToMessage("<br/> "._("Pensez a assigner un instructeur a ce dossier.")." <br/>");
939 } else {
940 $this->addToMessage("<br/> "._("Aucun instructeur compatible avec ce dossier trouve, contactez votre administrateur afin d'en assigner un a ce dossier.")." <br/>");
941 }
942 }
943 } else {
944 $this->addToMessage("<br/> "._("Aucun instructeur compatible avec ce dossier trouve, contactez votre administrateur afin d'en assigner un a ce dossier.")." <br/>");
945 }
946 //
947 $this->addToLog("triggerajouter() : end", EXTRA_VERBOSE_MODE);
948 }
949
950 function triggermodifierapres($id,&$db,$val,$DEBUG) {
951 $this->sig_parametre($db);
952 // si la parcelle est changée
953 if(($this->sig==1 and $val['sig']!='Oui' and ($val['parcelle']!=$val['parcelle_archive'])
954 or $val['parcelle_lot']!=$val['parcelle_lot_archive'])){ // parcelle_lot_archive
955 if($val['parcelle']!='' or $val['parcelle_lot']!='')
956 $this->sig_interne($this->valF['dossier'],$db,$val,$DEBUG);
957 else{
958 if($this->maj ==1){ // en maj mettre a null la geometrie si parcelle changée inexistante
959 $sql ="update ".DB_PREFIXE."dossier set geom = null, servitude = '', pos= '' where dossier ='".$id."'";
960 $res = $db -> query($sql);
961 $this->addToLog("requete trigger modifier parcelle vide -> maj pos et servitude :".$sql, VERBOSE_MODE);
962 if (database :: isError($res))
963 die($res->getMessage()."erreur ".$sql);
964 }
965 $this->addToMessage("<br>"._("Parcelle ou parcelle_lot non renseignee dans dossier")." ".$id." <br>");
966 }
967 }
968
969 // BOGUE: le test pour la nature doit etre change parce que
970 // 'erp_depot_dossier_dat' n'a pas la connexion directe avec
971 // qualification d'un dossier, mais c'est necessaire pour les tests
972 if ($this->val[array_search('a_qualifier', $this->champs)] == 't'
973 && $this->valF['a_qualifier'] === false) {
974
975 $dossier_nature_dat = array(
976 $this->f->getParameter('erp_depot_dossier_dat'),
977 $this->f->getParameter('erp_demande_ouverture_dat'));
978
979 // envoi du message "ERP Qualifie" pour un dossier DAT qui a besoin
980 // de la qualification URBA
981 if (in_array($this->valF['nature'], $dossier_nature_dat)) {
982 $msgenque = new MessageEnqueuer();
983 $msgenque->setDossierInstructionIdentifier($this->valF['dossier']);
984 $msgenque->setCompetence($this->valF['autorite_competente']);
985 $msgenque->setContraintePlu($this->valF['servitude']);
986 $msgenque->setReferenceCadastrale(
987 $this->getReferenceCadastrale($this->valF['dossier']));
988 $msgenque->enqueueMessage($msgenque::$ERP_QUALIFIE);
989 }
990
991 // envoi des messages a ERP en cas du dossier PC traite par URBA, et
992 // qui etait classifie come ERP
993 if ($this->valF['nature'] == 'PC' && $this->valF['erp'] == true) {
994 $msgenque = new MessageEnqueuer();
995 $msgenque->setDossierInstructionIdentifier($this->valF['dossier']);
996 $msgenque->enqueueMessage($msgenque::$ERP_DEMANDE_COMPLETUDE_PC);
997 $msgenque->enqueueMessage($msgenque::$ERP_DEMANDE_QUALIFICATION_PC);
998 }
999
1000 }
1001
1002 }
1003
1004
1005 /**
1006 * Retourne la reference cadastrale de la demande attache a un dossier ERP
1007 * specifique
1008 * @param string $dossier L'identifiant du dossier
1009 * @return string|null La reference cadastrale si elle est trouve,
1010 * sinon NULL. En cas d'erreur de la BD, l'execution s'arrete.
1011 */
1012 function getReferenceCadastrale($dossier) {
1013 $sql = "SELECT terrain_references_cadastrales FROM ".DB_PREFIXE."demande WHERE dossier_instruction = '" . $dossier . "'";
1014 $res = $this->db->limitquery($sql, 0, 1);
1015 $this->addToLog("getReferenceCadastrale(): db->limitquery(\"".
1016 str_replace(",",", ",$sql)."\", 0, 1);", VERBOSE_MODE);
1017 // Si une erreur survient on die
1018 if (database::isError($res, true)) {
1019 // Appel de la methode de recuperation des erreurs
1020 $this->erreur_db($res->getDebugInfo(), $res->getMessage(), 'demande');
1021 }
1022 // retourne la nature du dossier
1023 while ($row =& $res->fetchRow()) {
1024 return $row[0];
1025 }
1026 // la nature n'etait pas trouve, ce qui ne devrait pas se passer
1027 return NULL;
1028 }
1029
1030
1031 function sig_parametre(&$db){
1032 if (file_exists ("../dyn/var.inc"))
1033 include ("../dyn/var.inc");
1034 if(!isset($sig))
1035 $this->sig=0;
1036 else
1037 $this->sig=1;
1038 if(!isset($auto_pos))
1039 $this->auto_pos=0;
1040 else
1041 $this->auto_pos=$auto_pos;
1042 if(!isset($auto_servitude_surfacique))
1043 $this->auto_servitude_surfacique=0;
1044 else
1045 $this->auto_servitude_surfacique=$auto_servitude_surfacique;
1046 if(!isset($auto_servitude_ligne))
1047 $this->auto_servitude_ligne=0;
1048 else
1049 $this->auto_servitude_ligne=$auto_servitude_ligne;
1050 if(!isset($auto_servitude_point))
1051 $this->auto_servitude_point=0;
1052 else
1053 $this->auto_servitude_point=$auto_servitude_point;
1054 if(!isset($auto_parcelle))
1055 $this->auto_parcelle=0;
1056 else
1057 $this->auto_parcelle=$auto_parcelle;
1058 if(!isset($auto_parcelle_lot))
1059 $this->auto_parcelle_lot=0;
1060 else
1061 $this->auto_parcelle_lot=$auto_parcelle_lot;
1062 $this->addToLog("trigger valeur sig :".$this->sig, VERBOSE_MODE);
1063 $this->addToLog("trigger valeur auto_pos :". $this->auto_pos, VERBOSE_MODE);
1064 $this->addToLog("trigger valeur auto_servitude_surfacique :".$this->auto_servitude_surfacique, VERBOSE_MODE);
1065 $this->addToLog("trigger valeur auto_servitude_ligne :". $this->auto_servitude_ligne, VERBOSE_MODE);
1066 $this->addToLog("trigger valeur auto_servitude_point :".$this->auto_servitude_point, VERBOSE_MODE);
1067 $this->addToLog("trigger valeur auto_parcelle :". $this->auto_parcelle, VERBOSE_MODE);
1068 $this->addToLog("trigger valeur auto_parcelle_lot :".$this->auto_parcelle_lot, VERBOSE_MODE);
1069 }
1070
1071
1072 function sig_interne($id,&$db,$val,$DEBUG){
1073 // Strategy interne dans var.inc
1074 // si la parcelle existe, il est cree un point au milieu de la parcelle
1075 // de maniere automatique
1076 $geom='';
1077 $parcelle=$val["parcelle"];
1078 $projection = $db -> getOne("select srid from geometry_columns where f_table_name='dossier'");
1079 if($this->auto_parcelle==1 and $val["parcelle"]!=''){
1080 $sql= "select astext(centroid(geom)) from ".DB_PREFIXE."parcelle where parcelle ='".$val["parcelle"]."'";
1081 $this->addToLog("recherche centroid parcelle :".$sql, VERBOSE_MODE);
1082 $geom = $db -> getOne($sql);
1083 if (database :: isError($geom))die($res->getMessage()."erreur ".$sql);
1084 }
1085 if($geom=='' and $this->auto_parcelle_lot==1 and $val["parcelle_lot"]!=''){ // lot
1086 $sql= "select astext(centroid(geom)) from ".DB_PREFIXE."parcelle_lot where parcelle_lot ='".$val["parcelle_lot"]."'";
1087 $this->addToLog("recherche centroid parcelle lot :".$sql, VERBOSE_MODE);
1088 $geom = $db -> getOne($sql);
1089 if (database :: isError($geom))die($res->getMessage()."erreur ".$sql);
1090 $parcelle=$val["parcelle_lot"]." ".$val["parcelle_lot_lotissement"];
1091 }
1092 if($geom!=''){ // la parcelle est exitante dans la table ou vue parcelle
1093 $sql ="update ".DB_PREFIXE."dossier set geom =geometryfromtext('".$geom."', ".$projection." ) where dossier ='".$id."'";
1094 $this->addToLog("sig_interne maj geom :".$sql, VERBOSE_MODE);
1095 $res = $db -> query($sql);
1096 if (database :: isError($res)) die($res->getMessage()."erreur ".$sql);
1097 $this->addToMessage(""._("centroid de parcelle calcule")." ".$parcelle." ");
1098 if($this->auto_pos==1) // recherche du pos
1099 $this->calcul_auto_pos($id,$db,$geom,$projection);
1100 if($this->auto_servitude_surfacique==1) // recherche de servitude surfacique
1101 $this->calcul_auto_servitude_surfacique($id,$db,$geom,$projection);
1102 if($this->auto_servitude_ligne==1) // recherche de servitude ligne
1103 $this->calcul_auto_servitude_ligne($id,$db,$geom,$projection);
1104 if($this->auto_servitude_point==1) // recherche de servitude point
1105 $this->calcul_auto_servitude_point($id,$db,$geom,$projection);
1106 $temp=strtr($this->servitude,"'"," "); // enleve le '
1107 $sql1 ="update ".DB_PREFIXE."dossier set servitude = '".$temp."' where dossier = '".$id."'";
1108 $res1 = $db -> query($sql1);
1109 $this->addToLog("maj servitudes :".$sql1, VERBOSE_MODE);
1110 if (database:: isError($res1)) die($res1->getMessage()."erreur ".$sql1);
1111 }else{ // parcelle inexistante //***
1112 if($this->maj ==1){ // en maj mettre a null la geometrie si parcelle changée inexistante
1113 $sql ="update ".DB_PREFIXE."dossier set geom = null, servitude = '', pos= '' where dossier ='".$id."'";
1114 $res = $db -> query($sql);
1115 $this->addToLog("requete sig_interne maj parcelle inexistante :".$sql, VERBOSE_MODE);
1116 if (database :: isError($res))
1117 die($res->getMessage()."erreur ".$sql);
1118 }
1119 //$this->addToMessage("<br> parcelle ".$parcelle." "._("inexistante")." ".$id."");
1120 }
1121 }
1122
1123 function calcul_auto_pos($id,&$db,$geom,$projection){
1124 // recherche du pos automatique
1125 $sql="select pos from ".DB_PREFIXE."pos WHERE ST_contains(geom, geometryfromtext('".$geom."', ".$projection."))";
1126 $pos = $db -> getOne($sql);
1127 $this->addToLog("recherche auto_pos :".$sql, VERBOSE_MODE);
1128 if($pos!=''){
1129 $sql1 ="update ".DB_PREFIXE."dossier set pos = '".$pos."' where dossier = '".$id."'";
1130 $res1 = $db -> query($sql1);
1131 $this->addToLog("maj auto_pos :".$sql1, VERBOSE_MODE);
1132 if (database:: isError($res1)) die($res1->getMessage()."erreur ".$sql1);
1133 $this->addToMessage("<br>"._("POS/PLU")." : ".$pos."");
1134 }else{
1135 $this->addToMessage("<br>"._("POS/PLU non trouve")." ".$id."");
1136 }
1137 }
1138
1139 function calcul_auto_servitude_surfacique($id,&$db,$geom,$projection){
1140 // recherche servitude surfacique
1141 $sql="select * from ".DB_PREFIXE."servitude_surfacique WHERE ST_contains(geom, geometryfromtext('".$geom."', ".$projection."))";
1142 $res=$db->query($sql);
1143 if (database:: isError($res)) die($res1->getMessage()."erreur ".$sql);
1144 $this->addToLog("requete :".$sql." executee ", VERBOSE_MODE);
1145 while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){
1146 $this->addToMessage("<br>"._("servitude")." : ".$row['libelle']." - ".$row['observation']);
1147 $this->servitude.=" [".$row['libelle']."] ".$row['observation']." - ";
1148 }
1149 }
1150
1151 function calcul_auto_servitude_ligne($id,&$db,$geom,$projection){
1152 // recherche servitude ligne
1153 $sql="select * from ".DB_PREFIXE."servitude_ligne WHERE ST_contains(ST_buffer(geom, perimetre), geometryfromtext('".$geom."', ".$projection."))";
1154 $res=$db->query($sql);
1155 if (database:: isError($res)) die($res1->getMessage()."erreur ".$sql);
1156 $this->addToLog("requete :".$sql." executee ", VERBOSE_MODE);
1157 while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){
1158 $this->addToMessage("<br>"._("servitude")." : ".$row['libelle']." - ".$row['observation']);
1159 $this->servitude.=" [".$row['libelle']."] ".$row['observation']." - ";
1160 }
1161 }
1162
1163 function calcul_auto_servitude_point($id,&$db,$geom,$projection){
1164 // recherche servitude point
1165 $sql="select libelle,observation, perimetre, distance(geom, geometryfromtext('".$geom."', ".$projection.")) as distance from ".
1166 DB_PREFIXE."servitude_point WHERE distance(geom, geometryfromtext('".$geom."', ".$projection."))<perimetre";
1167 $res=$db->query($sql);
1168 if (database:: isError($res)) die($res1->getMessage()."erreur ".$sql);
1169 $this->addToLog("requete :".$sql." executee ", VERBOSE_MODE);
1170 while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){
1171 $this->addToMessage("<br>"._("servitude")." : ".$row['libelle']." - ".$row['observation']." a ".round($row['distance'],2)." m ");
1172 $this->servitude.=" [".$row['libelle']."] ".$row['observation']." a ".round($row['distance'],2)." m - ";
1173 }
1174 }
1175 }// fin classe
1176 ?>

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26