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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 923 - (show annotations)
Thu Nov 29 22:51:42 2012 UTC (12 years, 2 months ago) by fmichon
File size: 52816 byte(s)
Ajout de la constante DB_PREFIXE manquante

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26