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