1 |
fraynaud |
3 |
<?php |
2 |
|
|
//$Id$ |
3 |
|
|
//gen openMairie le 10/02/2011 20:39 |
4 |
|
|
require_once ("../gen/obj/dossier.class.php"); |
5 |
fraynaud |
12 |
//require_once ("../sig/strategyDynmap.class.php"); //specific |
6 |
fraynaud |
3 |
|
7 |
|
|
class dossier extends dossier_gen { |
8 |
|
|
|
9 |
fraynaud |
12 |
//function dossier($id,&$db,$debug) { |
10 |
|
|
// $this->constructeur($id,$db,$debug); |
11 |
|
|
//}// fin constructeur |
12 |
fraynaud |
3 |
|
13 |
fraynaud |
11 |
|
14 |
|
|
function setvalF($val){ |
15 |
|
|
parent::setvalF($val); |
16 |
|
|
if($val['instructeur']!="") // pgsql |
17 |
|
|
$this->valF['instructeur'] = $val['instructeur']; |
18 |
|
|
// *** architecte |
19 |
|
|
if($val['architecte']!="") |
20 |
|
|
$this->valF['architecte'] = $val['architecte']; |
21 |
|
|
if($val['terrain_surface']!="") // pgsql |
22 |
|
|
$this->valF['terrain_surface'] = $val['terrain_surface']; |
23 |
|
|
if($val['travaux']!="") // pgsql |
24 |
|
|
$this->valF['travaux'] = $val['travaux']; |
25 |
|
|
if($val['demandeur_categorie']!="") // pgsql |
26 |
|
|
$this->valF['demandeur_categorie'] = $val['demandeur_categorie']; |
27 |
|
|
unset ($this->valF['geom']); |
28 |
|
|
} |
29 |
|
|
|
30 |
|
|
/* |
31 |
|
|
function setValFAjout($val){ |
32 |
|
|
|
33 |
|
|
if($val['demandeur_categorie']!="") // pgsql |
34 |
|
|
$this->valF['demandeur_categorie'] = $val['demandeur_categorie']; |
35 |
|
|
$this->valF['demandeur_civilite'] = $val['demandeur_civilite']; |
36 |
|
|
$this->valF['demandeur_nom'] = $val['demandeur_nom']; |
37 |
|
|
$this->valF['demandeur_societe'] = $val['demandeur_societe']; |
38 |
|
|
$this->valF['demandeur_adresse'] = $val['demandeur_adresse']; |
39 |
|
|
$this->valF['demandeur_cp'] = $val['demandeur_cp']; |
40 |
|
|
$this->valF['demandeur_ville'] = $val['demandeur_ville']; |
41 |
|
|
$this->valF['demandeur_email'] = $val['demandeur_email']; |
42 |
|
|
$this->valF['demandeur_pays'] = $val['demandeur_pays']; |
43 |
|
|
$this->valF['demandeur_telephone'] = $val['demandeur_telephone']; |
44 |
|
|
// |
45 |
|
|
$this->valF['delegataire_civilite'] = $val['delegataire_civilite']; |
46 |
|
|
$this->valF['delegataire_nom'] = $val['delegataire_nom']; |
47 |
|
|
$this->valF['delegataire_societe'] = $val['delegataire_societe']; |
48 |
|
|
$this->valF['delegataire_adresse'] = $val['delegataire_adresse']; |
49 |
|
|
$this->valF['delegataire_cp'] = $val['delegataire_cp']; |
50 |
|
|
$this->valF['delegataire_ville'] = $val['delegataire_ville']; |
51 |
|
|
$this->valF['delegataire_email'] = $val['delegataire_email']; |
52 |
|
|
$this->valF['delegataire_pays'] = $val['delegataire_pays']; |
53 |
|
|
$this->valF['delegataire_telephone'] = $val['delegataire_telephone']; |
54 |
|
|
} |
55 |
|
|
// initialisation valF pour la cle primaire |
56 |
|
|
*/ |
57 |
|
|
|
58 |
|
|
function setId($db){ |
59 |
|
|
// id automatique nextid |
60 |
|
|
// departement 13 |
61 |
|
|
// ville 004 |
62 |
|
|
// nature 2 caracteres |
63 |
|
|
// lettre R arles F vitrolles |
64 |
|
|
// numero sur 6 caracteres |
65 |
|
|
include ("../dyn/var.inc"); |
66 |
|
|
if($numero_unique==1){ |
67 |
|
|
// numero unique |
68 |
|
|
$temp=$db->nextId($this->table); |
69 |
|
|
}else{ |
70 |
|
|
// numero suivant nature |
71 |
|
|
$temp=$db->nextId("dossier_".$this->nature); |
72 |
|
|
} |
73 |
|
|
$temp=str_pad($temp,4,"0", STR_PAD_LEFT); |
74 |
|
|
$this->valF['dossier'] = $this->valF['nature'].$this->valF['annee']. |
75 |
|
|
$lettre.$temp; |
76 |
|
|
} |
77 |
|
|
|
78 |
|
|
/* |
79 |
|
|
function verifierAjout(){ |
80 |
|
|
} |
81 |
|
|
*/ |
82 |
|
|
|
83 |
|
|
function verifier($val,&$db,$DEBUG){ |
84 |
|
|
$this->correct=True; |
85 |
|
|
// obligatoire |
86 |
|
|
if($val['date_depot']!=""){ |
87 |
|
|
$this->valF['date_depot'] = $this->dateDB($val['date_depot']); |
88 |
|
|
}else{ |
89 |
|
|
$this->correct=false; |
90 |
|
|
$this->msg= $this->msg."<br>date_depot obligatoire"; |
91 |
|
|
} |
92 |
|
|
if($val['parcelle']!="" and $val['sig']!='Oui'){ |
93 |
|
|
if (!preg_match('/^[A-Z]{2}[0-9]{4}$/', $val['parcelle'])){ |
94 |
|
|
$this->correct=false; |
95 |
|
|
$this->msg= $this->msg."<br>format parcelle AANNNN"; |
96 |
|
|
} |
97 |
|
|
} |
98 |
|
|
// regles travaux verification |
99 |
|
|
if ($this->valF['travaux']!=""){ |
100 |
|
|
$sql= "select * from regle where id = '".$this->valF['travaux']. |
101 |
|
|
"' and controle = 'travaux' order by ordre"; |
102 |
|
|
$res = $db->query($sql); |
103 |
|
|
if (DB :: isError($res)) |
104 |
|
|
die($res->getMessage().$sql); |
105 |
|
|
else{ |
106 |
|
|
if ($DEBUG == 1) |
107 |
|
|
echo " la requete ".$sql." est executee<br>"; |
108 |
|
|
$regle=0; |
109 |
|
|
$msg=""; |
110 |
|
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
111 |
|
|
switch ($row['operateur']) { |
112 |
|
|
case ">" : |
113 |
|
|
if($row['sens']=="plus"){ |
114 |
|
|
if($this->valF[$row['champ']] > $row['valeur']) |
115 |
|
|
$condition = 1; |
116 |
|
|
else |
117 |
|
|
$condition = 0; |
118 |
|
|
if($regle==1 or $condition == 1) |
119 |
|
|
$regle=1; |
120 |
|
|
else |
121 |
|
|
$regle=0; |
122 |
|
|
$msg=$msg."<br> + ".$row['message']." [".$row['champ']." = ". |
123 |
|
|
$this->valF[$row['champ']]."]"; |
124 |
|
|
}else{ |
125 |
|
|
if($this->valF[$row['champ']] > $row['valeur']){ |
126 |
|
|
$condition = 0; |
127 |
|
|
}else{ |
128 |
|
|
$condition = 1; |
129 |
|
|
$regle=0; |
130 |
|
|
} |
131 |
|
|
$msg=$msg."<br> ou ".$row['message']." [".$row['champ']." = ". |
132 |
|
|
$this->valF[$row['champ']]."]"; |
133 |
|
|
} |
134 |
|
|
break; |
135 |
|
|
case ">=": |
136 |
|
|
if($row['sens']=="plus"){ |
137 |
|
|
if($this->valF[$row['champ']] >= $row['valeur']) |
138 |
|
|
$condition = 1; |
139 |
|
|
else |
140 |
|
|
$condition = 0; |
141 |
|
|
if($regle==1 or $condition == 1) |
142 |
|
|
$regle=1; |
143 |
|
|
else |
144 |
|
|
$regle=0; |
145 |
|
|
$msg=$msg."<br> + ".$row['message']." [".$row['champ']." = ". |
146 |
|
|
$this->valF[$row['champ']]."]"; |
147 |
|
|
}else{ |
148 |
|
|
if($this->valF[$row['champ']] >= $row['valeur']){ |
149 |
|
|
$condition = 0; |
150 |
|
|
|
151 |
|
|
}else{ |
152 |
|
|
$condition = 1; |
153 |
|
|
$regle=0; |
154 |
|
|
} |
155 |
|
|
$msg=$msg."<br> ou ".$row['message']." [".$row['champ']." = ". |
156 |
|
|
$this->valF[$row['champ']]."]"; |
157 |
|
|
} |
158 |
|
|
break; |
159 |
|
|
case "<" : |
160 |
|
|
if($row['sens']=="plus"){ |
161 |
|
|
if($this->valF[$row['champ']] < $row['valeur']) |
162 |
|
|
$condition = 1; |
163 |
|
|
else |
164 |
|
|
$condition = 0; |
165 |
|
|
if($regle==1 or $condition == 1) |
166 |
|
|
$regle=1; |
167 |
|
|
else |
168 |
|
|
$regle=0; |
169 |
|
|
$msg=$msg."<br> + ".$row['message']." [".$row['champ']." = ". |
170 |
|
|
$this->valF[$row['champ']]."]"; |
171 |
|
|
}else{ |
172 |
|
|
if($this->valF[$row['champ']] < $row['valeur']){ |
173 |
|
|
$condition = 0; |
174 |
|
|
}else{ |
175 |
|
|
$condition = 1; |
176 |
|
|
$regle=0; |
177 |
|
|
} |
178 |
|
|
$msg=$msg."<br> et ".$row['message']." [".$row['champ']." = ". |
179 |
|
|
$this->valF[$row['champ']]."]"; |
180 |
|
|
} |
181 |
|
|
break; |
182 |
|
|
case "==": |
183 |
|
|
if($row['sens']=="plus"){ |
184 |
|
|
if($this->valF[$row['champ']] == $row['valeur']) |
185 |
|
|
$condition = 1; |
186 |
|
|
else |
187 |
|
|
$condition = 0; |
188 |
|
|
if($regle==1 or $condition == 1) |
189 |
|
|
$regle=1; |
190 |
|
|
else |
191 |
|
|
$regle=0; |
192 |
|
|
$msg=$msg."<br> + ".$row['message']." [".$row['champ']." = ". |
193 |
|
|
$this->valF[$row['champ']]."]"; |
194 |
|
|
}else{ |
195 |
|
|
if($this->valF[$row['champ']] == $row['valeur']){ |
196 |
|
|
$condition = 0; |
197 |
|
|
|
198 |
|
|
}else{ |
199 |
|
|
$condition = 1; |
200 |
|
|
$regle=0; |
201 |
|
|
} |
202 |
|
|
$msg=$msg."<br> ou ".$row['message']." [".$row['champ']." = ". |
203 |
|
|
$this->valF[$row['champ']]."]"; |
204 |
|
|
} |
205 |
|
|
break; |
206 |
|
|
break; |
207 |
|
|
} // switch |
208 |
|
|
} |
209 |
|
|
if($regle==0) |
210 |
|
|
$this->msg= $this->msg.$msg." <br><br>"; |
211 |
|
|
} |
212 |
|
|
} |
213 |
|
|
}//verifier |
214 |
|
|
|
215 |
|
|
/* |
216 |
|
|
function retour($premier,$recherche){ |
217 |
|
|
if (!$this->correct){ |
218 |
|
|
echo "<a href=\"tab.php?obj=".$this->nature. |
219 |
|
|
"&premier=".$premier."&recherche=".$recherche. |
220 |
|
|
"\">"; |
221 |
|
|
echo"<img src='../img/retour.png' align='top' hspace='10' border='0'>"; |
222 |
|
|
echo "</a></center></td> </tr>"; |
223 |
|
|
}else{ |
224 |
|
|
echo "<tr><td> </td></tr><tr><td colspan=2><center><a href=\"tab.php?obj=".$this->nature. |
225 |
|
|
"&premier=".$premier."&recherche=".$recherche. |
226 |
|
|
"\">"; |
227 |
|
|
echo"<img src='../img/retour.png' align='top' border='0'>"; |
228 |
|
|
echo "</a></center></td> </tr>"; |
229 |
|
|
} |
230 |
|
|
} |
231 |
|
|
|
232 |
|
|
function bouton($maj){ |
233 |
|
|
include("../dyn/var.inc"); |
234 |
|
|
if (!$this->correct){ |
235 |
|
|
if ($maj == 2) //supprimer |
236 |
|
|
$bouton = _("Supprimer"); |
237 |
|
|
else |
238 |
|
|
if ($maj == 1) // modifier |
239 |
|
|
$bouton = _("Modifier"); |
240 |
|
|
else // ajouter |
241 |
|
|
$bouton = _("Ajouter"); |
242 |
|
|
echo "<tr><td> </td></tr><tr><td colspan=2><center><input type='submit' value='". |
243 |
|
|
$bouton." ".ucwords($this->table)."' style=".$styleBouton. |
244 |
|
|
" >"; |
245 |
|
|
} |
246 |
|
|
} |
247 |
|
|
*/ |
248 |
|
|
|
249 |
|
|
function setType(&$form,$maj) { |
250 |
|
|
if ($maj < 2) { //ajouter et modifier |
251 |
|
|
$form->setType('annee', 'hidden'); |
252 |
|
|
$form->setType('nature', 'hidden'); |
253 |
|
|
//select |
254 |
|
|
$form->setType('etat','hiddenstatic'); |
255 |
|
|
$form->setType('avis','hiddenstatic'); |
256 |
|
|
$form->setType('travaux','select'); |
257 |
|
|
$form->setType('instructeur','select'); |
258 |
|
|
$form->setType('accord_tacite','hiddenstatic'); |
259 |
|
|
$form->setType('terrain_numero_complement','select'); |
260 |
|
|
|
261 |
|
|
// combo |
262 |
|
|
$form->setType('rivoli','comboD'); |
263 |
|
|
$form->setType('terrain_adresse','comboG'); |
264 |
|
|
$form->setType('architecte','comboD'); |
265 |
|
|
$form->setType('architecte_nom','comboG'); |
266 |
|
|
|
267 |
|
|
// hiddenstatic |
268 |
|
|
$form->setType('delai','hiddenstatic'); |
269 |
|
|
$form->setType('terrain_surface_calcul','hiddenstatic'); |
270 |
|
|
$form->setType('parcelle_archive','hiddenstatic'); |
271 |
|
|
|
272 |
|
|
//hidden |
273 |
|
|
$form->setType('terrain_cp','hidden'); |
274 |
|
|
$form->setType('terrain_ville','hidden'); |
275 |
|
|
$form->setType('batiment_nombre','hidden'); |
276 |
|
|
$form->setType('logement_nombre','hidden'); |
277 |
|
|
$form->setType('shob','hidden'); |
278 |
|
|
$form->setType('shon','hidden'); |
279 |
|
|
$form->setType('lot','hidden'); |
280 |
|
|
$form->setType('hauteur','hidden'); |
281 |
|
|
$form->setType('piece_nombre','hidden'); |
282 |
|
|
$form->setType('shon_calcul','hidden'); |
283 |
|
|
$form->setType('amenagement','hidden'); |
284 |
|
|
|
285 |
|
|
$form->setType('objet_dossier','hidden'); |
286 |
|
|
|
287 |
|
|
$form->setType('sig','checkbox'); |
288 |
|
|
$form->setType('siglien','http'); |
289 |
|
|
// delegataire |
290 |
|
|
$form->setType('delegataire','checkbox'); |
291 |
|
|
$form->setType('saisie_architecte', 'httpclick'); |
292 |
|
|
// zones temp et strategysig |
293 |
|
|
include ("../dyn/var.inc"); |
294 |
|
|
if(!isset($sauvegardeDossier)) $sauvegardeDossier=''; |
295 |
|
|
if($sauvegardeDossier != '') // strategie sig |
296 |
|
|
$form->setType('pos','hiddenstatic'); |
297 |
|
|
else |
298 |
|
|
$form->setType('pos','select'); |
299 |
|
|
// temp |
300 |
|
|
$form->setType('temp1',$temp1_type); |
301 |
|
|
$form->setType('temp2',$temp2_type); |
302 |
|
|
$form->setType('temp3',$temp3_type); |
303 |
|
|
$form->setType('temp4',$temp4_type); |
304 |
|
|
$form->setType('temp5',$temp5_type); |
305 |
|
|
|
306 |
|
|
// maj ou ajout |
307 |
|
|
if($maj==0){ |
308 |
|
|
$form->setType('dossier', 'hidden'); |
309 |
|
|
$form->setType('date_rejet','hidden'); |
310 |
|
|
$form->setType('date_complet','hidden'); |
311 |
|
|
$form->setType('date_notification_delai','hidden'); |
312 |
|
|
$form->setType('delai','hidden'); |
313 |
|
|
$form->setType('date_limite','hidden'); |
314 |
|
|
$form->setType('accord_tacite','hidden'); |
315 |
|
|
$form->setType('etat','hidden'); |
316 |
|
|
$form->setType('date_decision','hidden'); |
317 |
|
|
$form->setType('avis','hidden'); |
318 |
|
|
$form->setType('date_validite','hidden'); |
319 |
|
|
$form->setType('date_chantier','hidden'); |
320 |
|
|
$form->setType('date_achevement','hidden'); |
321 |
|
|
$form->setType('date_conformite','hidden'); |
322 |
|
|
$form->setType('delegataire_email','mail'); |
323 |
|
|
$form->setType('delegataire_civilite','select'); |
324 |
|
|
// demandeur |
325 |
|
|
$form->setType('demandeur_civilite','select'); |
326 |
|
|
$form->setType('demandeur_email','mail'); |
327 |
|
|
$form->setType('demandeur_categorie','select'); |
328 |
|
|
$form->setType('saisie_demandeur', 'hidden'); |
329 |
|
|
$form->setType('saisie_delegataire', 'hidden'); |
330 |
|
|
$form->setType('types', 'hidden'); |
331 |
|
|
// $form->setType('saisie_architecte', 'httpclick'); |
332 |
|
|
}else{ |
333 |
|
|
$form->setType('dossier','hiddenstatic'); |
334 |
|
|
$form->setType('saisie_demandeur', 'httpclick'); |
335 |
|
|
$form->setType('saisie_delegataire', 'httpclick'); |
336 |
|
|
$form->setType('types', 'hiddenstatic'); |
337 |
|
|
|
338 |
|
|
$form->setType('date_notification_delai','hiddenstaticdate'); |
339 |
|
|
$form->setType('date_decision','hiddenstaticdate'); |
340 |
|
|
$form->setType('date_limite','hiddenstaticdate'); |
341 |
|
|
$form->setType('date_rejet','hiddenstaticdate'); |
342 |
|
|
$form->setType('date_complet','hiddenstaticdate'); |
343 |
|
|
$form->setType('date_limite','hiddenstaticdate'); |
344 |
|
|
$form->setType('date_validite','hiddenstaticdate'); |
345 |
|
|
$form->setType('date_chantier','hiddenstaticdate'); |
346 |
|
|
$form->setType('date_achevement','hiddenstaticdate'); |
347 |
|
|
$form->setType('date_conformite','hiddenstaticdate'); |
348 |
|
|
// demandeur |
349 |
|
|
$form->setType('demandeur_nom','textdisabled'); |
350 |
|
|
$form->setType('demandeur_civilite','hidden'); |
351 |
|
|
$form->setType('demandeur_societe','hidden'); |
352 |
|
|
$form->setType('demandeur_adresse','hidden'); |
353 |
|
|
$form->setType('demandeur_cp','hidden'); |
354 |
|
|
$form->setType('demandeur_ville','hidden'); |
355 |
|
|
$form->setType('demandeur_pays','hidden'); |
356 |
|
|
$form->setType('demandeur_telephone','hidden'); |
357 |
|
|
$form->setType('demandeur_email','hidden'); |
358 |
|
|
$form->setType('demandeur_categorie','hidden'); |
359 |
|
|
//delegataire |
360 |
|
|
$form->setType('delegataire_civilite','hidden'); |
361 |
|
|
$form->setType('delegataire_nom','textdisabled'); |
362 |
|
|
$form->setType('delegataire_societe','hidden'); |
363 |
|
|
$form->setType('delegataire_adresse','hidden'); |
364 |
|
|
$form->setType('delegataire_cp','hidden'); |
365 |
|
|
$form->setType('delegataire_ville','hidden'); |
366 |
|
|
$form->setType('delegataire_pays','hidden'); |
367 |
|
|
$form->setType('delegataire_telephone','hidden'); |
368 |
|
|
$form->setType('delegataire_email','hidden'); |
369 |
|
|
} |
370 |
|
|
}else{ // supprimer |
371 |
|
|
$form->setType('dossier', 'hiddenstatic'); |
372 |
|
|
$form->setType('sig', 'hiddenstatic'); |
373 |
|
|
} |
374 |
|
|
} |
375 |
|
|
|
376 |
|
|
function setMax(&$form,$maj){ |
377 |
|
|
$form->setMax('architecte_nom', 30); |
378 |
|
|
|
379 |
|
|
$form->setMax('demandeur_nom', 80); |
380 |
|
|
$form->setMax('demandeur_societe', 80); |
381 |
|
|
$form->setMax('demandeur_adresse', 40); |
382 |
|
|
$form->setMax('demandeur_cp', 5); |
383 |
|
|
$form->setMax('demandeur_ville', 30); |
384 |
|
|
$form->setMax('demandeur_pays', 40); |
385 |
|
|
$form->setMax('demandeur_telephone', 14); |
386 |
|
|
$form->setMax('demandeur_email', 40); |
387 |
|
|
|
388 |
|
|
$form->setMax('delegataire_societe', 80); |
389 |
|
|
$form->setMax('delegataire_nom', 80); |
390 |
|
|
$form->setMax('delegataire_adresse', 80); |
391 |
|
|
$form->setMax('delegataire_pays', 40); |
392 |
|
|
$form->setMax('delegataire_cp', 5); |
393 |
|
|
$form->setMax('delegataire_ville', 30); |
394 |
|
|
$form->setMax('delegataire_telephone', 14); |
395 |
|
|
$form->setMax('delegataire_email', 40); |
396 |
|
|
|
397 |
|
|
$form->setMax('terrain_adresse', 80); |
398 |
|
|
$form->setMax('terrain_numero', 4); |
399 |
|
|
$form->setMax('terrain_adresse_complement', 80); |
400 |
|
|
$form->setMax('rivoli', 4); |
401 |
|
|
$form->setMax('parcelle', 20); |
402 |
|
|
|
403 |
|
|
$form->setMax('temp1', 100); |
404 |
|
|
$form->setMax('temp2', 100); |
405 |
|
|
$form->setMax('temp3', 100); |
406 |
|
|
$form->setMax('temp4', 100); |
407 |
|
|
$form->setMax('temp5', 100); |
408 |
|
|
} |
409 |
|
|
|
410 |
|
|
function setTaille(&$form,$maj){ |
411 |
|
|
// date |
412 |
|
|
$form->setTaille('date_demande', 12); |
413 |
|
|
$form->setTaille('date_notification_delai', 12); |
414 |
|
|
$form->setTaille('date_decision', 12); |
415 |
|
|
$form->setTaille('date_limite', 12); |
416 |
|
|
$form->setTaille('date_depot', 12); |
417 |
|
|
// demandeur |
418 |
|
|
|
419 |
|
|
$form->setTaille('demandeur_nom', 30); |
420 |
|
|
$form->setTaille('demandeur_societe', 30); |
421 |
|
|
$form->setTaille('demandeur_adresse', 40); |
422 |
|
|
$form->setTaille('demandeur_cp', 5); |
423 |
|
|
$form->setTaille('demandeur_ville', 30); |
424 |
|
|
$form->setTaille('demandeur_pays', 40); |
425 |
|
|
$form->setTaille('demandeur_telephone', 14); |
426 |
|
|
$form->setTaille('demandeur_email', 40); |
427 |
|
|
|
428 |
|
|
// delegataire |
429 |
|
|
$form->setTaille('delegataire_societe', 40); |
430 |
|
|
$form->setTaille('delegataire_nom', 30); |
431 |
|
|
$form->setTaille('delegataire_adresse', 40); |
432 |
|
|
$form->setTaille('delegataire_pays', 20); |
433 |
|
|
$form->setTaille('delegataire_cp', 5); |
434 |
|
|
$form->setTaille('delegataire_ville', 30); |
435 |
|
|
$form->setTaille('delegataire_telephone', 14); |
436 |
|
|
$form->setTaille('delegataire_email', 40); |
437 |
|
|
// terrain |
438 |
|
|
$form->setTaille('terrain_surface', 6); |
439 |
|
|
$form->setTaille('terrain_surface_calcul', 6); |
440 |
|
|
$form->setTaille('terrain_adresse', 25); |
441 |
|
|
$form->setTaille('terrain_adresse_complement', 80); |
442 |
|
|
$form->setTaille('terrain_numero', 4); |
443 |
|
|
$form->setTaille('rivoli', 4); |
444 |
|
|
$form->setTaille('parcelle', 20); |
445 |
|
|
// |
446 |
|
|
$form->setTaille('architecte_nom', 30); |
447 |
|
|
$form->setTaille('architecte', 3); |
448 |
|
|
|
449 |
|
|
$form->setTaille('temp1', 100); |
450 |
|
|
$form->setTaille('temp2', 100); |
451 |
|
|
$form->setTaille('temp3', 100); |
452 |
|
|
$form->setTaille('temp4', 100); |
453 |
|
|
$form->setTaille('temp5', 100); |
454 |
|
|
} |
455 |
|
|
|
456 |
|
|
function setVal(&$form,$maj,$validation){ |
457 |
|
|
if ($validation==0) { |
458 |
|
|
if ($maj == 0){ |
459 |
|
|
include ("../dyn/var.inc"); |
460 |
|
|
$form->setVal('nature', $this->nature); |
461 |
|
|
|
462 |
|
|
$form->setVal('annee', date('y')); |
463 |
|
|
$form->setVal('date_demande', date('Y-m-d')); |
464 |
|
|
$form->setVal('date_depot', date('Y-m-d')); |
465 |
|
|
|
466 |
|
|
$form->setVal('demandeur_cp', $dossier_cp); |
467 |
|
|
$form->setVal('demandeur_ville', $dossier_ville); |
468 |
|
|
|
469 |
|
|
$form->setVal('delegataire_cp', $dossier_cp); |
470 |
|
|
$form->setVal('delegataire_ville', $dossier_ville); |
471 |
|
|
|
472 |
|
|
$form->setVal('terrain_cp', $dossier_cp); |
473 |
|
|
$form->setVal('terrain_ville', $dossier_ville); |
474 |
|
|
|
475 |
|
|
$form->setVal('accord_tacite', 'Non'); |
476 |
|
|
$form->setVal('etat', 'initialiser'); |
477 |
|
|
$form->setVal('types', 'Initial'); |
478 |
|
|
//$form->setVal('instructeur', $_SESSION['util']); |
479 |
|
|
|
480 |
|
|
$form->setVal("saisie_architecte","saisie3()"); |
481 |
|
|
?> |
482 |
|
|
<script language="javascript"> |
483 |
|
|
var pfenetre; |
484 |
|
|
var fenetreouverte=false; |
485 |
|
|
function saisie3() |
486 |
|
|
{ |
487 |
|
|
if(fenetreouverte==true) |
488 |
|
|
pfenetre.close(); |
489 |
|
|
pfenetre=window.open("../scr/form_fenetre.php?obj=dossier_architecte","delegataire","width=780,height=430,top=120,left=10"); |
490 |
|
|
fenetreouverte=true; |
491 |
|
|
} |
492 |
|
|
</script> |
493 |
|
|
<?php |
494 |
|
|
}else{ |
495 |
|
|
$form->setVal("saisie_architecte","saisie3()"); |
496 |
|
|
$form->setVal("saisie_demandeur","saisie1()"); |
497 |
|
|
$form->setVal("saisie_delegataire","saisie2()"); |
498 |
|
|
|
499 |
|
|
?><script language="javascript"> |
500 |
|
|
var pfenetre; |
501 |
|
|
var fenetreouverte=false; |
502 |
|
|
function saisie1() |
503 |
|
|
{ |
504 |
|
|
if(fenetreouverte==true) |
505 |
|
|
pfenetre.close(); |
506 |
|
|
var idx=document.f1.dossier.value; |
507 |
|
|
pfenetre=window.open("../scr/form_fenetre.php?obj=dossier_demandeur"+"&idx="+idx,"demandeur","width=780,height=330,top=120,left=10"); |
508 |
|
|
fenetreouverte=true; |
509 |
|
|
} |
510 |
|
|
function saisie2() |
511 |
|
|
{ |
512 |
|
|
if(fenetreouverte==true) |
513 |
|
|
pfenetre.close(); |
514 |
|
|
var idx=document.f1.dossier.value; |
515 |
|
|
pfenetre=window.open("../scr/form_fenetre.php?obj=dossier_delegataire"+"&idx="+idx,"delegataire","width=780,height=330,top=120,left=10"); |
516 |
|
|
fenetreouverte=true; |
517 |
|
|
} |
518 |
|
|
function saisie3() |
519 |
|
|
{ |
520 |
|
|
if(fenetreouverte==true) |
521 |
|
|
pfenetre.close(); |
522 |
|
|
pfenetre=window.open("../scr/form_fenetre.php?obj=dossier_architecte","delegataire","width=780,height=430,top=120,left=10"); |
523 |
|
|
fenetreouverte=true; |
524 |
|
|
} |
525 |
|
|
</script> |
526 |
|
|
<?php |
527 |
|
|
} |
528 |
|
|
} |
529 |
|
|
} |
530 |
|
|
|
531 |
|
|
function setSelect(&$form, $maj,&$db,$debug) { |
532 |
|
|
parent::setSelect($form, $maj,$db,$debug); |
533 |
fraynaud |
12 |
if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc")) |
534 |
|
|
include ("../sql/".$db->phptype."/".$this->table.".form.inc"); |
535 |
fraynaud |
11 |
if($maj<2){ |
536 |
|
|
// travaux |
537 |
|
|
$contenu=array(); |
538 |
|
|
if($maj==0) $sql_travaux = $sql_travaux." and solde = 'Non'"; |
539 |
|
|
$sql_travaux = $sql_travaux." order by libelle"; |
540 |
|
|
$res = $db->query($sql_travaux); |
541 |
|
|
if (DB :: isError($res)) |
542 |
|
|
die($res->getMessage().$sql_travaux); |
543 |
|
|
else{ |
544 |
|
|
if ($debug == 1) |
545 |
|
|
echo " la requete ".$sql_travaux." est executee<br>"; |
546 |
|
|
$contenu[0][0]=0; |
547 |
|
|
$contenu[1][0]=_('choisir')." "._('travaux'); |
548 |
|
|
$k=1; |
549 |
|
|
while ($row=& $res->fetchRow()){ |
550 |
|
|
$contenu[0][$k]=$row[0]; |
551 |
|
|
$contenu[1][$k]=$row[1]; |
552 |
|
|
$k++; |
553 |
|
|
} |
554 |
|
|
$form->setSelect("travaux",$contenu); |
555 |
|
|
} |
556 |
|
|
// lien sig |
557 |
|
|
include ("../dyn/var.inc"); |
558 |
|
|
$contenu=array(); |
559 |
|
|
$contenu[0]="<img src='".$image_sig."'>"; |
560 |
|
|
$form->setSelect("siglien",$contenu); |
561 |
|
|
// code et libelle voie |
562 |
|
|
$contenu=""; |
563 |
|
|
$contenu[0][0]="rivoli";// table |
564 |
|
|
$contenu[0][1]="rivoli"; // zone origine |
565 |
|
|
$contenu[1][0]="libelle"; |
566 |
|
|
$contenu[1][1]="terrain_adresse"; |
567 |
|
|
$form->setSelect("rivoli",$contenu); |
568 |
|
|
$contenu=""; |
569 |
|
|
$contenu[0][0]="rivoli";// table |
570 |
|
|
$contenu[0][1]="libelle"; // zone origine |
571 |
|
|
$contenu[1][0]="rivoli"; |
572 |
|
|
$contenu[1][1]="rivoli"; |
573 |
|
|
$form->setSelect("terrain_adresse",$contenu); |
574 |
|
|
// code et libelle architecte |
575 |
|
|
$contenu=""; |
576 |
|
|
$contenu[0][0]="architecte";// table |
577 |
|
|
$contenu[0][1]="architecte"; // zone origine |
578 |
|
|
$contenu[1][0]="nom"; |
579 |
|
|
$contenu[1][1]="architecte_nom"; |
580 |
|
|
$form->setSelect("architecte",$contenu); |
581 |
|
|
$contenu=""; |
582 |
|
|
$contenu[0][0]="architecte";// table |
583 |
|
|
$contenu[0][1]="nom"; // zone origine |
584 |
|
|
$contenu[1][0]="architecte"; |
585 |
|
|
$contenu[1][1]="architecte"; |
586 |
|
|
$form->setSelect("architecte_nom",$contenu); |
587 |
|
|
// accord tacite |
588 |
|
|
$contenu=array(); |
589 |
|
|
$contenu[0]=array('Non','Oui'); |
590 |
|
|
$contenu[1]=array('Non','Oui'); |
591 |
|
|
$form->setSelect("etat",$contenu); |
592 |
|
|
$form->setSelect("accord_tacite",$contenu); |
593 |
|
|
// terrain_numero_complement |
594 |
|
|
$contenu=array(); |
595 |
|
|
$contenu[0]=array('','bis','ter','quater'); |
596 |
|
|
$contenu[1]=array('','bis','ter','quater'); |
597 |
|
|
$form->setSelect("terrain_numero_complement",$contenu); |
598 |
|
|
// lien demandeur |
599 |
|
|
$contenu=array(); |
600 |
|
|
$contenu[0]=" <img src='../img/modifier.gif' border ='0'> "; |
601 |
|
|
$form->setSelect("saisie_demandeur",$contenu); |
602 |
|
|
// lien demandeur |
603 |
|
|
$contenu=array(); |
604 |
|
|
$contenu[0]=" <img src='../img/modifier.gif' border ='0'> "; |
605 |
|
|
$form->setSelect("saisie_delegataire",$contenu); |
606 |
|
|
// lien architecte |
607 |
|
|
$contenu=array(); |
608 |
|
|
$contenu[0]=" <img src='../img/ajouter.gif' border ='0'> "; |
609 |
|
|
$form->setSelect("saisie_architecte",$contenu); |
610 |
|
|
} |
611 |
|
|
} |
612 |
|
|
|
613 |
|
|
function setGroupe(&$form,$maj){ |
614 |
|
|
If ($maj==0){ |
615 |
|
|
$form->setGroupe('date_demande','D'); |
616 |
|
|
$form->setGroupe('date_depot','G'); |
617 |
|
|
$form->setGroupe('instructeur','F'); |
618 |
|
|
|
619 |
|
|
$form->setGroupe('demandeur_categorie','D'); |
620 |
|
|
$form->setGroupe('demandeur_civilite','G'); |
621 |
|
|
$form->setGroupe('demandeur_nom','G'); |
622 |
|
|
$form->setGroupe('demandeur_societe','F'); |
623 |
|
|
|
624 |
|
|
$form->setGroupe('demandeur_adresse','D'); |
625 |
|
|
$form->setGroupe('demandeur_cp','G'); |
626 |
|
|
$form->setGroupe('demandeur_ville','G'); |
627 |
|
|
$form->setGroupe('demandeur_pays','F'); |
628 |
|
|
|
629 |
|
|
$form->setGroupe('demandeur_email','D'); |
630 |
|
|
$form->setGroupe('demandeur_telephone','G'); |
631 |
|
|
$form->setGroupe('delegataire','F'); |
632 |
|
|
|
633 |
|
|
$form->setGroupe('delegataire_civilite','D'); |
634 |
|
|
$form->setGroupe('delegataire_nom','G'); |
635 |
|
|
$form->setGroupe('delegataire_societe','F'); |
636 |
|
|
|
637 |
|
|
$form->setGroupe('delegataire_adresse','D'); |
638 |
|
|
$form->setGroupe('delegataire_cp','G'); |
639 |
|
|
$form->setGroupe('delegataire_ville','G'); |
640 |
|
|
$form->setGroupe('delegataire_pays','F'); |
641 |
|
|
|
642 |
|
|
$form->setGroupe('delegataire_email','D'); |
643 |
|
|
$form->setGroupe('delegataire_telephone','F'); |
644 |
|
|
}else{ |
645 |
|
|
$form->setGroupe('dossier','D'); |
646 |
|
|
$form->setGroupe('date_demande','G'); |
647 |
|
|
$form->setGroupe('date_depot','G'); |
648 |
|
|
$form->setGroupe('instructeur','F'); |
649 |
|
|
|
650 |
|
|
$form->setGroupe('date_complet','D'); |
651 |
|
|
$form->setGroupe('date_rejet','G'); |
652 |
|
|
$form->setGroupe('date_notification_delai','F'); |
653 |
|
|
|
654 |
|
|
$form->setGroupe('demandeur_nom','D'); |
655 |
|
|
$form->setGroupe('delegataire','G'); |
656 |
|
|
$form->setGroupe('saisie_demandeur','G'); |
657 |
|
|
$form->setGroupe('delegataire_nom','G'); |
658 |
|
|
$form->setGroupe('saisie_delegataire','F'); |
659 |
|
|
} |
660 |
|
|
// terrain |
661 |
|
|
$form->setGroupe('terrain_numero','D'); |
662 |
|
|
$form->setGroupe('terrain_numero_complement','G'); |
663 |
|
|
$form->setGroupe('rivoli','G'); |
664 |
|
|
$form->setGroupe('terrain_adresse','G'); |
665 |
|
|
$form->setGroupe('terrain_adresse_complement','G'); |
666 |
|
|
$form->setGroupe('terrain_surface','G'); |
667 |
|
|
$form->setGroupe('terrain_surface_calcul','F'); |
668 |
|
|
|
669 |
|
|
$form->setGroupe('date_complet','D'); |
670 |
|
|
$form->setGroupe('date_rejet','G'); |
671 |
|
|
$form->setGroupe('rejet','G'); |
672 |
|
|
$form->setGroupe('delai','F'); |
673 |
|
|
|
674 |
|
|
$form->setGroupe('date_limite','D'); |
675 |
|
|
$form->setGroupe('date_notification_delai','G'); |
676 |
|
|
$form->setGroupe('accord_tacite','G'); |
677 |
|
|
$form->setGroupe('etat','F'); |
678 |
|
|
|
679 |
|
|
$form->setGroupe('date_decision','D'); |
680 |
|
|
$form->setGroupe('avis','G'); |
681 |
|
|
$form->setGroupe('date_validite','G'); |
682 |
|
|
$form->setGroupe('types','F'); |
683 |
|
|
|
684 |
|
|
$form->setGroupe('date_achevement','D'); |
685 |
|
|
$form->setGroupe('date_chantier','G'); |
686 |
|
|
$form->setGroupe('date_conformite','F'); |
687 |
|
|
|
688 |
|
|
$form->setGroupe('parcelle','D'); |
689 |
|
|
$form->setGroupe('pos','G'); |
690 |
|
|
$form->setGroupe('sig','G'); |
691 |
|
|
$form->setGroupe('siglien','F'); |
692 |
|
|
} |
693 |
|
|
|
694 |
|
|
|
695 |
|
|
|
696 |
|
|
function setLib(&$form,$maj) { |
697 |
|
|
$form->setLib('date_demande',' '._('date_demande').' '); |
698 |
|
|
$form->setLib('date_depot'," "._('date_depot')." "); |
699 |
|
|
$form->setLib('instructeur'," "._('instructeur')." "); |
700 |
|
|
$form->setLib('date_complet',_('date_complet').' '); |
701 |
|
|
$form->setLib('date_rejet',_('date_rejet').' '); |
702 |
|
|
$form->setLib('date_notification_delai',' '._('date_notification_delai').' '); |
703 |
|
|
$form->setLib('delai',' '._('delai').' '); |
704 |
|
|
$form->setLib('siglien',' '); |
705 |
|
|
If ($maj==0){ |
706 |
|
|
$form->setLib('demandeur_categorie',_('demandeur_categorie')); |
707 |
|
|
$form->setLib('demandeur_civilite',''); |
708 |
|
|
$form->setLib('demandeur_nom',''); |
709 |
|
|
$form->setLib('demandeur_societe',_('demandeur_societe').' '); |
710 |
|
|
$form->setLib('demandeur_adresse',''); |
711 |
|
|
$form->setLib('demandeur_cp',''); |
712 |
|
|
$form->setLib('demandeur_ville',''); |
713 |
|
|
$form->setLib('demandeur_pays',' '._('demandeur_pays').' '); |
714 |
|
|
$form->setLib('demandeur_telephone',' '._('demandeur_telephone').' '); |
715 |
|
|
$form->setLib('demandeur_email',''); |
716 |
|
|
$form->setLib('delegataire_civilite',_('delegataire_civilite')); |
717 |
|
|
$form->setLib('delegataire_nom',''); |
718 |
|
|
$form->setLib('delegataire_societe',_('delegataire_societe').': '); |
719 |
|
|
$form->setLib('delegataire_adresse',''); |
720 |
|
|
$form->setLib('delegataire_cp',''); |
721 |
|
|
$form->setLib('delegataire_ville',''); |
722 |
|
|
$form->setLib('delegataire_pays',' '._('delegataire_pays').': '); |
723 |
|
|
$form->setLib('delegataire_telephone',' '._('delegataire_telephone').': '); |
724 |
|
|
$form->setLib('delegataire_email',''); |
725 |
|
|
}else{ |
726 |
|
|
$form->setLib('demandeur_nom',_('demandeur_nom')); |
727 |
|
|
$form->setLib('delegataire_nom',''); |
728 |
|
|
$form->setLib('types',''); |
729 |
|
|
} |
730 |
|
|
$form->setLib('terrain_numero',_('terrain_numero').' : '); |
731 |
|
|
$form->setLib('terrain_numero_complement',''); |
732 |
|
|
$form->setLib('terrain_adresse',''); |
733 |
|
|
$form->setLib('terrain_adresse_complement',''); |
734 |
|
|
$form->setLib('rivoli',''); |
735 |
|
|
$form->setLib('terrain_surface',' '._('terrain_surface').' : '); |
736 |
|
|
$form->setLib('terrain_surface_calcul',' '._('terrain_surface_calcul').' : '); |
737 |
|
|
$form->setLib('parcelle',' '._('parcelle').' : '); |
738 |
|
|
$form->setLib('date_decision',' '._('date_decision').' : '); |
739 |
|
|
$form->setLib('date_validite',' '._('date_validite').' : '); |
740 |
|
|
$form->setLib('date_achevement',' '._('date_achevement').' : '); |
741 |
|
|
$form->setLib('avis',''); |
742 |
|
|
$form->setLib('date_limite',' '._('date_limite').' : '); |
743 |
|
|
$form->setLib('date_chantier',' '._('date_chantier').' : '); |
744 |
|
|
$form->setLib('date_conformite',' '._('date_conformite').' : '); |
745 |
|
|
$form->setLib('etat',' '._('etat').' : '); |
746 |
|
|
$form->setLib('accord_tacite',' '._('accord_tacite').' : '); |
747 |
|
|
$form->setLib('date_rejet',' DPC : '); |
748 |
|
|
|
749 |
|
|
$form->setLib('objet_dossier',''); |
750 |
|
|
$form->setLib('travaux',''); |
751 |
|
|
$form->setLib('saisie_demandeur',""); |
752 |
|
|
$form->setLib('saisie_delegataire',""); |
753 |
|
|
$form->setLib('saisie_architecte',""); |
754 |
|
|
$form->setLib('architecte_nom',""); |
755 |
|
|
$form->setLib('architecte'," "); |
756 |
|
|
// zones temp |
757 |
|
|
include ("../dyn/var.inc"); |
758 |
|
|
$form->setLib('temp1',$temp1_lib); |
759 |
|
|
$form->setLib('temp2',$temp2_lib); |
760 |
|
|
$form->setLib('temp3',$temp3_lib); |
761 |
|
|
$form->setLib('temp4',$temp4_lib); |
762 |
|
|
$form->setLib('temp5',$temp5_lib); |
763 |
|
|
} |
764 |
|
|
|
765 |
|
|
function setOnchange(&$form,$maj){ |
766 |
|
|
parent::setOnchange($form,$maj); |
767 |
|
|
// mise en majuscule |
768 |
|
|
$form->setOnchange("demandeur_nom","this.value=this.value.toUpperCase()"); |
769 |
|
|
$form->setOnchange("demandeur_societe","this.value=this.value.toUpperCase()"); |
770 |
|
|
$form->setOnchange("delegataire_nom","this.value=this.value.toUpperCase()"); |
771 |
|
|
$form->setOnchange("delegataire_societe","this.value=this.value.toUpperCase()"); |
772 |
|
|
} |
773 |
|
|
|
774 |
|
|
function setRegroupe(&$form,$maj){ |
775 |
|
|
If ($maj==1){ |
776 |
|
|
$form->setRegroupe('date_complet','D','Instruction '); |
777 |
|
|
$form->setRegroupe('date_rejet','G',''); |
778 |
|
|
$form->setRegroupe('date_notification_delai','G',''); |
779 |
|
|
$form->setRegroupe('delai','G',''); |
780 |
|
|
$form->setRegroupe('date_limite','G','Decision '); |
781 |
|
|
$form->setRegroupe('accord_tacite','G',''); |
782 |
|
|
$form->setRegroupe('etat','G',''); |
783 |
|
|
$form->setRegroupe('date_decision','G',''); |
784 |
|
|
$form->setRegroupe('avis','G',''); |
785 |
|
|
$form->setRegroupe('date_validite','G',''); |
786 |
|
|
$form->setRegroupe('types','G',''); |
787 |
|
|
$form->setRegroupe('date_chantier','G',''); |
788 |
|
|
$form->setRegroupe('date_achevement','G',''); |
789 |
|
|
$form->setRegroupe('date_conformite','F',''); |
790 |
|
|
} |
791 |
fraynaud |
12 |
// |
792 |
|
|
If ($maj==0){ |
793 |
|
|
$form->setRegroupe('date_demande','D','Depot'); |
794 |
|
|
} |
795 |
|
|
If ($maj==1){ |
796 |
|
|
$form->setRegroupe('dossier','D',_(Depot)); |
797 |
|
|
$form->setRegroupe('date_demande','G',''); |
798 |
|
|
} |
799 |
|
|
$form->setRegroupe('date_depot','G',''); |
800 |
|
|
$form->setRegroupe('instructeur','F',''); |
801 |
|
|
|
802 |
|
|
$form->setRegroupe('terrain_numero','D',_('terrain')); |
803 |
|
|
$form->setRegroupe('terrain_numero_complement','G',''); |
804 |
|
|
$form->setRegroupe('rivoli','G',''); |
805 |
|
|
$form->setRegroupe('terrain_adresse','G',''); |
806 |
|
|
$form->setRegroupe('terrain_adresse_complement','G',''); |
807 |
|
|
$form->setRegroupe('terrain_surface','G',''); |
808 |
|
|
$form->setRegroupe('terrain_surface_calcul','F',''); |
809 |
fraynaud |
11 |
} |
810 |
|
|
|
811 |
|
|
|
812 |
|
|
|
813 |
|
|
/* ============================================================= |
814 |
|
|
* fonction trigger relative a la connexion SIG |
815 |
|
|
* mise a jour de service web SIG via SOAP |
816 |
|
|
* voir /sig |
817 |
|
|
* -> si le traitement est fait correctement sig = 'Oui' |
818 |
|
|
* sinon SIG = 'Non' |
819 |
|
|
* dans var.inc il y a la strategie de sauvegarde SIG |
820 |
|
|
* pour deconnecter un objet dossier |
821 |
|
|
* mettre var acces_sig = 'Non' dans les classes PC, PA, DP et PD ??? a voir |
822 |
|
|
* =============================================================== |
823 |
|
|
*/ |
824 |
|
|
|
825 |
|
|
|
826 |
fraynaud |
12 |
function triggerajouter($id,&$db,$val,$DEBUG) { |
827 |
|
|
if (file_exists ("../dyn/var.inc")) |
828 |
|
|
include ("../dyn/var.inc"); |
829 |
|
|
if(!isset($sauvegardeDossier)) $sauvegardeDossier=''; |
830 |
|
|
if($sauvegardeDossier != '' and $this->valF['parcelle']!=''){ |
831 |
|
|
$this->strategySig=new $sauvegardeDossier($this); |
832 |
|
|
if($this->strategySig->correct){ // strategie |
833 |
|
|
$pos=$this->strategySig->ajouterDossier($this->valF['parcelle'],$this->valF['dossier']); |
834 |
|
|
$this->msg = $this->msg."".$this->strategySig->dmsg."<br>"; |
835 |
|
|
// si c'est correct |
836 |
|
|
if ($this->strategySig->correct){ |
837 |
|
|
$this->valF['sig']='Oui'; |
838 |
|
|
$this->valF['pos']=$pos[0]; |
839 |
|
|
}else |
840 |
|
|
$this->valF['sig']='Non'; |
841 |
|
|
}else{ |
842 |
|
|
$this->msg = $this->msg."<br> serveur non accessible pour ". |
843 |
|
|
$sauvegardeDossier."<br>".$this->strategySig->dmsg."<br>"; |
844 |
|
|
} |
845 |
|
|
}else // pas de strategie |
846 |
|
|
$this->msg = $this->msg."<br>SIG pas de strategie externe active dans var.inc ou parcelle vide<br>"; |
847 |
|
|
} |
848 |
fraynaud |
11 |
|
849 |
|
|
function triggerajouterapres($id,&$db,$val,$DEBUG) { |
850 |
|
|
if (file_exists ("../dyn/var.inc")) |
851 |
|
|
include ("../dyn/var.inc"); |
852 |
|
|
if(!isset($sig)) $sig=0; |
853 |
|
|
if($sig==1){ |
854 |
|
|
$this->sig_interne($id,&$db,$val,$DEBUG); |
855 |
|
|
} |
856 |
|
|
} |
857 |
|
|
|
858 |
|
|
function triggermodifier($id,&$db,$val,$DEBUG) { |
859 |
|
|
// parametre sig dans var.inc |
860 |
|
|
if (file_exists ("../dyn/var.inc")) |
861 |
|
|
include ("../dyn/var.inc"); |
862 |
|
|
if(!isset($sauvegardeDossier)) $sauvegardeDossier=''; |
863 |
fraynaud |
12 |
if(!isset($sig)) $sig=0; |
864 |
fraynaud |
11 |
// strategy externe dans var.inc |
865 |
|
|
if($sauvegardeDossier != ''){ |
866 |
fraynaud |
12 |
if($val['sig']== 'Oui'){ // modification SIG |
867 |
|
|
if($val["parcelle_archive"]!=$this->valF['parcelle']){ // la parcelle doit etre modifie |
868 |
|
|
$this->strategySig=new $sauvegardeDossier($this); |
869 |
|
|
if($this->strategySig->correct){ // connexion correct |
870 |
|
|
$pos=$this->strategySig->modifierDossier($this->valF['parcelle'],$this->valF['dossier']); |
871 |
|
|
$this->msg = $this->msg."".$this->strategySig->dmsg."<br>"; |
872 |
fraynaud |
11 |
$this->valF['sig']='Oui'; |
873 |
fraynaud |
12 |
$this->valF['pos']=$pos[0]; |
874 |
|
|
}else{ // connexion incorrecte |
875 |
|
|
$this->msg = $this->msg."<br> serveur non accessible pour ". |
876 |
|
|
$sauvegardeDossier."<br>".$this->strategySig->dmsg."<br>"; |
877 |
|
|
$this->valF['sig']='Non'; |
878 |
|
|
} |
879 |
|
|
}else // parcelle inchangee |
880 |
|
|
$this->msg = $this->msg." SIG aucune modification SIG car meme parcelle et saisie sig ok"; |
881 |
|
|
}else{ // ajout SIG = Non |
882 |
|
|
if($this->valF['parcelle']!=''){ // la parcelle ne doit pas etre vide |
883 |
|
|
$this->strategySig=new $sauvegardeDossier($this); |
884 |
|
|
if($this->strategySig->correct){ // connexion correcte |
885 |
|
|
$pos= $this->strategySig->ajouterDossier($this->valF['parcelle'],$this->valF['dossier']); |
886 |
|
|
$this->msg = $this->msg."".$this->strategySig->dmsg."<br>"; |
887 |
|
|
// sig transaction correcte |
888 |
|
|
if ($this->strategySig->correct){ |
889 |
|
|
$this->valF['sig']='Oui'; |
890 |
|
|
$this->valF['pos']=$pos[0]; |
891 |
|
|
}else |
892 |
|
|
$this->valF['sig']='Non'; |
893 |
|
|
}else{ // connexion incorrecte |
894 |
|
|
$this->msg = $this->msg."<br> serveur non accessible pour ". |
895 |
|
|
$sauvegardeDossier."<br>".$this->strategySig->dmsg."<br>"; |
896 |
|
|
$this->valF['sig']='Non'; |
897 |
|
|
} |
898 |
|
|
}else |
899 |
|
|
$this->msg = $this->msg."<br> parcelle vide, pas d'ajout SIG <br>"; |
900 |
|
|
} |
901 |
fraynaud |
11 |
}else // autres dossier ou pas de lien |
902 |
fraynaud |
12 |
$this->msg = $this->msg." SIG pas de strategie externe active dans var.inc"; |
903 |
fraynaud |
11 |
if($sig==1){ |
904 |
|
|
$this->sig_interne($this->valF['dossier'],&$db,$val,$DEBUG); |
905 |
|
|
} |
906 |
|
|
} |
907 |
|
|
|
908 |
|
|
function triggersupprimer($id,&$db,$val,$DEBUG) { |
909 |
fraynaud |
12 |
// Parametres var.inc sig |
910 |
|
|
if (file_exists ("../dyn/var.inc")) |
911 |
|
|
include ("../dyn/var.inc"); |
912 |
|
|
if(!isset($sauvegardeDossier)) $sauvegardeDossier=''; |
913 |
|
|
// strategy externe -> si le dossier a ete creer dans le sig (val(sig)= Oui) |
914 |
|
|
if($val['sig']== 'Oui'){ |
915 |
|
|
if($sauvegardeDossier != ''){ // strategie |
916 |
|
|
$this->strategySig=new $sauvegardeDossier($this); |
917 |
|
|
if($this->strategySig->correct){ // SIG connexion |
918 |
|
|
$this->strategySig->supprimerDossier($id); |
919 |
|
|
$this->msg = $this->msg."".$this->strategySig->dmsg."<br><br>"; |
920 |
|
|
}else // SIG pas de connexion |
921 |
|
|
$this->msg = $this->msg."<br> serveur non accessible pour ". |
922 |
|
|
$sauvegardeDossier."<br>".$this->strategySig->dmsg."<br>"; |
923 |
|
|
}else // pas de strategie |
924 |
|
|
$this->msg = $this->msg." SIG pas de strategie active dans var.inc"; |
925 |
|
|
}else // SIG pas de dossier |
926 |
|
|
$this->msg = $this->msg."<br>"."SIG pas de dossier ". |
927 |
|
|
$id." [sig = ".$val['sig']." ]<br>"; |
928 |
fraynaud |
11 |
} |
929 |
|
|
|
930 |
|
|
|
931 |
|
|
function sig_interne($id,&$db,$val,$DEBUG){ |
932 |
fraynaud |
12 |
// Strategy interne dans var.inc |
933 |
|
|
// si la parcelle existe, il est cree un point au milieu de la parcelle |
934 |
|
|
// de maniere automatique |
935 |
|
|
// a voir si $this->valF['sig'] = oui -> parametrage manuel |
936 |
fraynaud |
11 |
$this->msg = $this->msg."<br> SIG strategie interne active dans var.inc"; |
937 |
|
|
if($this->valF['parcelle']!=''){ //si la parcelle est renseignée |
938 |
|
|
$projection = $db -> getOne("select srid from geometry_columns where f_table_name='dossier'"); |
939 |
|
|
$sql= "select astext(centroid(geom)) from parcelle where parcelle ='".$val["parcelle"]."'"; |
940 |
|
|
$geom = $db -> getOne($sql); |
941 |
|
|
if($geom!=''){ // parcelle exitante |
942 |
|
|
// pb des guillemets a voir |
943 |
|
|
//$this->valF['geom']= "geometryfromtext('".$geom."', ".$projection.") "; |
944 |
|
|
$sql ="update dossier set geom =geometryfromtext('".$geom."', ".$projection." ) where dossier ='".$id."'"; |
945 |
|
|
$res = $db -> query($sql); |
946 |
|
|
if (DB :: isError($res)){ |
947 |
|
|
die($res->getMessage()."erreur ".$sql); |
948 |
|
|
}else{ |
949 |
|
|
$this->msg = $this->msg."<br> geom = centroid de parcelle ".$val["parcelle"]." dans dossier ".$id; |
950 |
|
|
} |
951 |
|
|
|
952 |
|
|
}else |
953 |
|
|
$this->msg = $this->msg."<br> parcelle ".$val["parcelle"]." inexistante -> saisie manuelle ".$id; |
954 |
|
|
}else{ |
955 |
|
|
$sql ="update dossier set geom = null where dossier ='".$id."'"; |
956 |
|
|
$res = $db -> query($sql); |
957 |
|
|
if (DB :: isError($res)){ |
958 |
|
|
die($res->getMessage()."erreur ".$sql); |
959 |
|
|
}else{ |
960 |
|
|
$this->msg = $this->msg."<br> geom=vide car parcelle non renseignee dans dossier ".$id." <br>"; |
961 |
|
|
} |
962 |
|
|
} |
963 |
|
|
} |
964 |
|
|
|
965 |
fraynaud |
3 |
}// fin classe |
966 |
|
|
?> |