2 |
//$Id$ |
//$Id$ |
3 |
//gen openMairie le 10/02/2011 20:39 |
//gen openMairie le 10/02/2011 20:39 |
4 |
require_once ("../gen/obj/dossier.class.php"); |
require_once ("../gen/obj/dossier.class.php"); |
|
//require_once ("../sig/strategyDynmap.class.php"); //specific |
|
5 |
|
|
6 |
class dossier extends dossier_gen { |
class dossier extends dossier_gen { |
7 |
|
|
8 |
var $maj; |
var $maj; |
9 |
|
var $sig; |
10 |
|
var $servitude=""; |
11 |
|
var $auto_pos; |
12 |
|
var $auto_servitude_surfacique; |
13 |
|
var $auto_servitude_ligne; |
14 |
|
var $auto_servitude_point; |
15 |
|
var $auto_parcelle; |
16 |
|
var $auto_parcelle_lot; |
17 |
|
|
18 |
|
|
19 |
function setvalF($val){ |
function setvalF($val){ |
20 |
parent::setvalF($val); |
parent::setvalF($val); |
|
|
|
21 |
// cles secondaires numerique (contrainte integrite pgsql) |
// cles secondaires numerique (contrainte integrite pgsql) |
22 |
if(!is_numeric($val['instructeur'])) $this->valF['instructeur']= null; |
if(!is_numeric($val['instructeur'])) $this->valF['instructeur']= null; |
23 |
if(!is_numeric($val['architecte'])) $this->valF['architecte']= null; |
if(!is_numeric($val['architecte'])) $this->valF['architecte']= null; |
24 |
if(!is_numeric($val['travaux'])) $this->valF['travaux']= null; |
if(!is_numeric($val['travaux'])) $this->valF['travaux']= null; |
25 |
if(!is_numeric($val['demandeur_categorie'])) $this->valF['demandeur_categorie']= null; |
if(!is_numeric($val['demandeur_categorie'])) $this->valF['demandeur_categorie']= null; |
|
|
|
26 |
// cle secondaire alpha vide (contrainte integrite pgsql) |
// cle secondaire alpha vide (contrainte integrite pgsql) |
27 |
if($val['demandeur_civilite']=='') $this->valF['demandeur_civilite']= null; |
if($val['demandeur_civilite']=='') $this->valF['demandeur_civilite']= null; |
28 |
if($val['delegataire_civilite']=='') $this->valF['delegataire_civilite']= null; |
if($val['delegataire_civilite']=='') $this->valF['delegataire_civilite']= null; |
|
|
|
29 |
// zone numerique non valorisée a 0 |
// zone numerique non valorisée a 0 |
30 |
if(!is_numeric($val['delai'])) unset ($this->valF['delai']); |
if(!is_numeric($val['delai'])) unset ($this->valF['delai']); |
31 |
if(!is_numeric($val['terrain_surface'])) unset ($this->valF['terrain_surface']); |
if(!is_numeric($val['terrain_surface'])) unset ($this->valF['terrain_surface']); |
36 |
if(!is_numeric($val['lot'])) unset ($this->valF['lot']); |
if(!is_numeric($val['lot'])) unset ($this->valF['lot']); |
37 |
if(!is_numeric($val['hauteur'])) unset ($this->valF['hauteur']); |
if(!is_numeric($val['hauteur'])) unset ($this->valF['hauteur']); |
38 |
if(!is_numeric($val['piece_nombre'])) unset ($this->valF['piece_nombre']); |
if(!is_numeric($val['piece_nombre'])) unset ($this->valF['piece_nombre']); |
39 |
|
if(!is_numeric($val['parcelle_lot'])) unset ($this->valF['parcelle_lot']); |
40 |
|
// enlever les valeurs a ne pas saisir -> recherche en trigger ajouter et modifier |
41 |
// enlever les valeurs a ne pas saisir -> recherche en trigger ajouter et modifier |
// $sig = 1 |
42 |
// $sig = 1 |
unset ($this->valF['geom']); |
|
unset ($this->valF['geom']); |
|
|
|
|
43 |
// valeurs hiddenstatic (calcule) |
// valeurs hiddenstatic (calcule) |
44 |
if($this->maj==1){ |
if($this->maj==1){ |
45 |
// par defaut |
// par defaut |
52 |
unset ($this->valF['terrain_surface_calcul']); |
unset ($this->valF['terrain_surface_calcul']); |
53 |
unset ($this->valF['shon_calcul']); |
unset ($this->valF['shon_calcul']); |
54 |
unset ($this->valF['parcelle_archive']); |
unset ($this->valF['parcelle_archive']); |
55 |
|
unset ($this->valF['parcelle_lot_archive']); |
56 |
unset ($this->valF['date_notification_delai']); |
unset ($this->valF['date_notification_delai']); |
57 |
unset ($this->valF['date_decision']); |
unset ($this->valF['date_decision']); |
58 |
unset ($this->valF['date_limite']); |
unset ($this->valF['date_limite']); |
74 |
include ("../dyn/var.inc"); |
include ("../dyn/var.inc"); |
75 |
if($numero_unique==1){ |
if($numero_unique==1){ |
76 |
// numero unique (voir dyn/var.inc) |
// numero unique (voir dyn/var.inc) |
77 |
$temp=$db->nextId($this->table); |
$temp=$db->nextId(DB_PREFIXE.$this->table); |
78 |
}else{ |
}else{ |
79 |
// numero suivant nature |
// numero suivant nature |
80 |
$temp=$db->nextId("dossier_".$this->nature); |
$temp=$db->nextId(DB_PREFIXE."dossier_".$this->nature); |
81 |
} |
} |
82 |
$temp=str_pad($temp,4,"0", STR_PAD_LEFT); |
$temp=str_pad($temp,4,"0", STR_PAD_LEFT); |
83 |
$this->valF['dossier'] = $this->valF['nature'].$this->valF['annee']. |
$this->valF['dossier'] = $this->valF['nature'].$this->valF['annee']. |
91 |
function verifier($val,&$db,$DEBUG){ |
function verifier($val,&$db,$DEBUG){ |
92 |
$this->correct=True; |
$this->correct=True; |
93 |
// obligatoire |
// obligatoire |
94 |
if($val['date_depot']!=""){ |
if($val['date_depot']==""){ |
95 |
$this->valF['date_depot'] = $this->dateDB($val['date_depot']); |
// $this->valF['date_depot'] = $this->dateDB($val['date_depot']); |
96 |
}else{ |
//}else{ |
97 |
$this->correct=false; |
$this->correct=false; |
98 |
$this->msg= $this->msg."<br>date_depot obligatoire"; |
$this->addToMessage("<br>date_depot obligatoire"); |
99 |
} |
} |
100 |
if($val['parcelle']!="" and $val['sig']!='Oui'){ |
if($val['parcelle']!="" and $val['sig']!='Oui'){ |
101 |
if (!preg_match('/^[A-Z]{2}[0-9]{4}$/', $val['parcelle'])){ |
if (!preg_match('/^[A-Z]{2}[0-9]{4}$/', $val['parcelle'])){ |
102 |
$this->correct=false; |
$this->correct=false; |
103 |
$this->msg= $this->msg."<br>format parcelle AANNNN"; |
$this->addToMessage("<br>format parcelle AANNNN"); |
104 |
} |
} |
105 |
} |
} |
106 |
// regles travaux verification |
// regles travaux verification |
107 |
if ($this->valF['travaux']!=""){ |
if ($this->valF['travaux']!=""){ |
108 |
$sql= "select * from regle where id = '".$this->valF['travaux']. |
$sql= "select * from ".DB_PREFIXE."regle where id = '".$this->valF['travaux']. |
109 |
"' and controle = 'travaux' order by ordre"; |
"' and controle = 'travaux' order by ordre"; |
110 |
$res = $db->query($sql); |
$res = $db->query($sql); |
111 |
if (DB :: isError($res)) |
if (database :: isError($res)) die($res->getMessage().$sql); |
112 |
die($res->getMessage().$sql); |
$this->addToLog("requete ".$sql." execute <br>", EXTRA_VERBOSE_MODE); |
113 |
else{ |
$regle=0; |
114 |
if ($DEBUG == 1) |
$msg=""; |
115 |
echo " la requete ".$sql." est executee<br>"; |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
116 |
$regle=0; |
if(isset($this->valF[$row['champ']])) |
117 |
$msg=""; |
$champvaleur=$this->valF[$row['champ']]; |
118 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
else |
119 |
switch ($row['operateur']) { |
$champvaleur=0; |
120 |
case ">" : |
switch ($row['operateur']) { |
121 |
if($row['sens']=="plus"){ |
case ">" : |
122 |
if($this->valF[$row['champ']] > $row['valeur']) |
if($row['sens']=="plus"){ |
123 |
$condition = 1; |
if($champvaleur > $row['valeur']) |
124 |
else |
$condition = 1; |
125 |
$condition = 0; |
else |
126 |
if($regle==1 or $condition == 1) |
$condition = 0; |
127 |
$regle=1; |
if($regle==1 or $condition == 1) |
128 |
else |
$regle=1; |
129 |
$regle=0; |
else |
130 |
$msg=$msg."<br> + ".$row['message']." [".$row['champ']." = ". |
$regle=0; |
131 |
$this->valF[$row['champ']]."]"; |
$msg=$msg."<br> + ".$row['message']." [".$row['champ']." = ". |
132 |
|
$champvaleur."]"; |
133 |
|
}else{ |
134 |
|
if($champvaleur > $row['valeur']){ |
135 |
|
$condition = 0; |
136 |
}else{ |
}else{ |
137 |
if($this->valF[$row['champ']] > $row['valeur']){ |
$condition = 1; |
138 |
$condition = 0; |
$regle=0; |
|
}else{ |
|
|
$condition = 1; |
|
|
$regle=0; |
|
|
} |
|
|
$msg=$msg."<br> ou ".$row['message']." [".$row['champ']." = ". |
|
|
$this->valF[$row['champ']]."]"; |
|
139 |
} |
} |
140 |
break; |
$msg=$msg."<br> ou ".$row['message']." [".$row['champ']." = ". |
141 |
case ">=": |
$champvaleur."]"; |
142 |
if($row['sens']=="plus"){ |
} |
|
if($this->valF[$row['champ']] >= $row['valeur']) |
|
|
$condition = 1; |
|
|
else |
|
|
$condition = 0; |
|
|
if($regle==1 or $condition == 1) |
|
|
$regle=1; |
|
|
else |
|
|
$regle=0; |
|
|
$msg=$msg."<br> + ".$row['message']." [".$row['champ']." = ". |
|
|
$this->valF[$row['champ']]."]"; |
|
|
}else{ |
|
|
if($this->valF[$row['champ']] >= $row['valeur']){ |
|
|
$condition = 0; |
|
|
|
|
|
}else{ |
|
|
$condition = 1; |
|
|
$regle=0; |
|
|
} |
|
|
$msg=$msg."<br> ou ".$row['message']." [".$row['champ']." = ". |
|
|
$this->valF[$row['champ']]."]"; |
|
|
} |
|
143 |
break; |
break; |
144 |
case "<" : |
case ">=": |
145 |
if($row['sens']=="plus"){ |
if($row['sens']=="plus"){ |
146 |
if($this->valF[$row['champ']] < $row['valeur']) |
if($champvaleur >= $row['valeur']) |
147 |
$condition = 1; |
$condition = 1; |
148 |
else |
else |
149 |
$condition = 0; |
$condition = 0; |
150 |
if($regle==1 or $condition == 1) |
if($regle==1 or $condition == 1) |
151 |
$regle=1; |
$regle=1; |
152 |
else |
else |
153 |
$regle=0; |
$regle=0; |
154 |
$msg=$msg."<br> + ".$row['message']." [".$row['champ']." = ". |
$msg=$msg."<br> + ".$row['message']." [".$row['champ']." = ". |
155 |
$this->valF[$row['champ']]."]"; |
$champvaleur."]"; |
156 |
|
}else{ |
157 |
|
if($champvaleur >= $row['valeur']){ |
158 |
|
$condition = 0; |
159 |
|
|
160 |
}else{ |
}else{ |
161 |
if($this->valF[$row['champ']] < $row['valeur']){ |
$condition = 1; |
162 |
$condition = 0; |
$regle=0; |
|
}else{ |
|
|
$condition = 1; |
|
|
$regle=0; |
|
|
} |
|
|
$msg=$msg."<br> et ".$row['message']." [".$row['champ']." = ". |
|
|
$this->valF[$row['champ']]."]"; |
|
163 |
} |
} |
164 |
break; |
$msg=$msg."<br> ou ".$row['message']." [".$row['champ']." = ". |
165 |
|
$champvaleur."]"; |
166 |
|
} |
167 |
|
break; |
168 |
|
case "<" : |
169 |
|
if($row['sens']=="plus"){ |
170 |
|
if($champvaleur < $row['valeur']) |
171 |
|
$condition = 1; |
172 |
|
else |
173 |
|
$condition = 0; |
174 |
|
if($regle==1 or $condition == 1) |
175 |
|
$regle=1; |
176 |
|
else |
177 |
|
$regle=0; |
178 |
|
$msg=$msg."<br> + ".$row['message']." [".$row['champ']." = ". |
179 |
|
$champvaleur."]"; |
180 |
|
}else{ |
181 |
|
if($champvaleur < $row['valeur']){ |
182 |
|
$condition = 0; |
183 |
|
}else{ |
184 |
|
$condition = 1; |
185 |
|
$regle=0; |
186 |
|
} |
187 |
|
$msg=$msg."<br> et ".$row['message']." [".$row['champ']." = ". |
188 |
|
$champvaleur."]"; |
189 |
|
} |
190 |
|
break; |
191 |
case "==": |
case "==": |
192 |
if($row['sens']=="plus"){ |
if($row['sens']=="plus"){ |
193 |
if($this->valF[$row['champ']] == $row['valeur']) |
if($champvaleur == $row['valeur']) |
194 |
$condition = 1; |
$condition = 1; |
195 |
else |
else |
196 |
$condition = 0; |
$condition = 0; |
199 |
else |
else |
200 |
$regle=0; |
$regle=0; |
201 |
$msg=$msg."<br> + ".$row['message']." [".$row['champ']." = ". |
$msg=$msg."<br> + ".$row['message']." [".$row['champ']." = ". |
202 |
$this->valF[$row['champ']]."]"; |
$champvaleur."]"; |
203 |
}else{ |
}else{ |
204 |
if($this->valF[$row['champ']] == $row['valeur']){ |
if($champvaleur == $row['valeur']){ |
205 |
$condition = 0; |
$condition = 0; |
206 |
|
|
207 |
}else{ |
}else{ |
209 |
$regle=0; |
$regle=0; |
210 |
} |
} |
211 |
$msg=$msg."<br> ou ".$row['message']." [".$row['champ']." = ". |
$msg=$msg."<br> ou ".$row['message']." [".$row['champ']." = ". |
212 |
$this->valF[$row['champ']]."]"; |
$champvaleur."]"; |
213 |
} |
} |
|
break; |
|
214 |
break; |
break; |
215 |
|
//break; |
216 |
} // switch |
} // switch |
217 |
} |
if($regle==0) |
218 |
if($regle==0) |
$this->addToMessage($msg." <br>"); |
219 |
$this->msg= $this->msg.$msg." <br><br>"; |
} // while |
220 |
} |
} // travaux |
|
} |
|
221 |
}//verifier |
}//verifier |
222 |
|
|
223 |
|
|
228 |
if($maj==0) $form->setType('dossier', 'hidden'); |
if($maj==0) $form->setType('dossier', 'hidden'); |
229 |
$form->setType('annee', 'hidden'); |
$form->setType('annee', 'hidden'); |
230 |
$form->setType('nature', 'hidden'); |
$form->setType('nature', 'hidden'); |
231 |
$form->setType('parcelle_archive','hidden'); |
$form->setType('parcelle_archive','hidden'); |
232 |
|
$form->setType('parcelle_lot_archive','hidden'); |
233 |
$form->setType('objet_dossier','hidden'); // PC |
$form->setType('objet_dossier','hidden'); // PC |
234 |
$form->setType('amenagement','hidden'); // PC |
$form->setType('amenagement','hidden'); // PC |
235 |
|
$form->setType('parcelle_lot','hidden'); // PC |
236 |
// a voir a quoi cela peut servir |
$form->setType('parcelle_lot_lotissement','hidden'); // PC |
237 |
$form->setType('sig','hidden'); // PC |
$form->setType('geom', 'hidden'); |
238 |
$form->setType('siglien','hidden'); // PC |
$form->setType('servitude', 'hiddenstatic'); |
239 |
|
$form->setType('description', 'textarea'); |
240 |
|
|
241 |
// date |
// date |
242 |
$form->setType('date_depot','date'); |
$form->setType('date_depot','date'); |
243 |
$form->setType('date_demande','date'); |
$form->setType('date_demande','date'); |
249 |
$form->setType('delegataire_civilite','select'); |
$form->setType('delegataire_civilite','select'); |
250 |
$form->setType('demandeur_civilite','select'); |
$form->setType('demandeur_civilite','select'); |
251 |
$form->setType('demandeur_categorie','select'); |
$form->setType('demandeur_categorie','select'); |
252 |
|
|
253 |
|
|
254 |
// combo |
// combo |
255 |
$form->setType('rivoli','comboD'); |
$form->setType('rivoli','comboD'); |
256 |
$form->setType('terrain_adresse','comboG'); |
$form->setType('terrain_adresse','comboG'); |
|
//$form->setType('architecte','comboD'); |
|
|
//$form->setType('architecte','textdisabled'); // ne valorise pas |
|
257 |
$form->setType('architecte_nom','comboG'); |
$form->setType('architecte_nom','comboG'); |
258 |
|
$form->setType('architecte','comboD'); |
259 |
|
|
260 |
|
|
261 |
// hiddenstatic |
// hiddenstatic |
262 |
if($maj==1) $form->setType('dossier', 'hiddenstatic'); |
if($maj==1) $form->setType('dossier', 'hiddenstatic'); |
283 |
$form->setType('date_conformite','hiddenstaticdate'); |
$form->setType('date_conformite','hiddenstaticdate'); |
284 |
|
|
285 |
// checkbox |
// checkbox |
286 |
//$form->setType('sig','checkbox'); |
$form->setType('sig','checkbox'); |
287 |
$form->setType('delegataire','checkbox'); |
$form->setType('delegataire','checkbox'); |
288 |
|
|
|
// http |
|
|
//$form->setType('siglien','http'); |
|
|
$form->setType('saisie_architecte', 'httpclick'); |
|
|
|
|
289 |
// mail |
// mail |
290 |
$form->setType('delegataire_email','mail'); |
$form->setType('delegataire_email','mail'); |
291 |
$form->setType('demandeur_email','mail'); |
$form->setType('demandeur_email','mail'); |
292 |
|
|
293 |
// zones temp et strategysig |
// zones temp et strategysig |
294 |
include ("../dyn/var.inc"); |
|
295 |
if(!isset($sauvegardeDossier)) $sauvegardeDossier=''; |
|
296 |
if($sauvegardeDossier != '') // strategie sig |
// temp |
297 |
$form->setType('pos','hiddenstatic'); |
if (file_exists ("../dyn/var.inc")) |
298 |
|
include ("../dyn/var.inc"); |
299 |
|
if(!isset($auto_pos)) |
300 |
|
$auto_pos=0; |
301 |
|
if($auto_pos==1) |
302 |
|
$form->setType('pos','hiddenstatic'); |
303 |
else |
else |
304 |
$form->setType('pos','select'); |
$form->setType('pos','select'); |
|
// temp |
|
305 |
$form->setType('temp1',$temp1_type); |
$form->setType('temp1',$temp1_type); |
306 |
$form->setType('temp2',$temp2_type); |
$form->setType('temp2',$temp2_type); |
307 |
$form->setType('temp3',$temp3_type); |
$form->setType('temp3',$temp3_type); |
343 |
$form->setMax('terrain_ville', 30); |
$form->setMax('terrain_ville', 30); |
344 |
|
|
345 |
$form->setMax('parcelle', 20); |
$form->setMax('parcelle', 20); |
346 |
|
$form->setMax('parcelle_lot_lotissement', 60); |
347 |
|
$form->setMax('description', 2); |
348 |
|
|
349 |
$form->setMax('temp1', 100); |
$form->setMax('temp1', 100); |
350 |
$form->setMax('temp2', 100); |
$form->setMax('temp2', 100); |
388 |
$form->setTaille('terrain_ville', 20); |
$form->setTaille('terrain_ville', 20); |
389 |
$form->setTaille('rivoli', 4); |
$form->setTaille('rivoli', 4); |
390 |
$form->setTaille('parcelle', 20); |
$form->setTaille('parcelle', 20); |
391 |
|
$form->setTaille('parcelle_lot_lotissement', 30); |
392 |
// |
// |
393 |
$form->setTaille('architecte_nom', 30); |
$form->setTaille('architecte_nom', 30); |
394 |
$form->setTaille('architecte', 3); |
$form->setTaille('architecte', 3); |
395 |
// description |
// description |
396 |
$form->setTaille('hauteur','3'); |
$form->setTaille('hauteur','3'); |
397 |
|
$form->setTaille('description','80'); |
398 |
|
|
399 |
$form->setTaille('temp1', 100); |
$form->setTaille('temp1', 100); |
400 |
$form->setTaille('temp2', 100); |
$form->setTaille('temp2', 100); |
426 |
$form->setVal('accord_tacite', 'Non'); |
$form->setVal('accord_tacite', 'Non'); |
427 |
$form->setVal('etat', 'initialiser'); |
$form->setVal('etat', 'initialiser'); |
428 |
$form->setVal('types', 'Initial'); |
$form->setVal('types', 'Initial'); |
|
$form->setVal("saisie_architecte","saisie3()"); |
|
|
}else{ |
|
|
$form->setVal("saisie_architecte","saisie3()"); |
|
429 |
} |
} |
430 |
} |
} |
431 |
} |
} |
432 |
|
|
433 |
function setSelect(&$form, $maj,&$db,$debug) { |
function setSelect(&$form, $maj,&$db,$debug) { |
434 |
//optimisation sur table importante parcelle -> pas d appel methode parent |
//optimisation sur table importante parcelle -> pas d appel methode parent |
435 |
if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc")) |
if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc")) |
436 |
include ("../sql/".$db->phptype."/".$this->table.".form.inc"); |
include ("../sql/".$db->phptype."/".$this->table.".form.inc"); |
437 |
if($maj<2){ |
if($maj<2){ |
438 |
// travaux |
// travaux |
439 |
$contenu=array(); |
$contenu=array(); |
445 |
$sql_travaux = $sql_travaux. |
$sql_travaux = $sql_travaux. |
446 |
" order by libelle"; |
" order by libelle"; |
447 |
$res = $db->query($sql_travaux); |
$res = $db->query($sql_travaux); |
448 |
if (database::isError($res)) |
if (database::isError($res)) die($res->getMessage()).$sql_travaux; |
449 |
die($res->getMessage()); |
$this->addToLog(" la requete ".$sql_travaux." est executee", VERBOSE_MODE); |
450 |
else{ |
$contenu[0][0]=""; |
451 |
if ($debug == 1) |
$contenu[1][0]=_('choisir')." "._('travaux'); |
452 |
echo " la requete ".$sql_travaux." est executee<br>"; |
$k=1; |
453 |
$contenu[0][0]=""; |
while ($row=& $res->fetchRow()){ |
454 |
$contenu[1][0]=_('choisir')." "._('travaux'); |
$contenu[0][$k]=$row[0]; |
455 |
$k=1; |
$contenu[1][$k]=$row[1]; |
456 |
while ($row=& $res->fetchRow()){ |
$k++; |
|
$contenu[0][$k]=$row[0]; |
|
|
$contenu[1][$k]=$row[1]; |
|
|
$k++; |
|
|
} |
|
|
$form->setSelect("travaux",$contenu); |
|
457 |
} |
} |
458 |
|
$form->setSelect("travaux",$contenu); |
459 |
|
|
460 |
// instructeur |
//// instructeur |
461 |
$contenu=array(); |
$contenu=array(); |
462 |
$res = $db->query($sql_instructeur); |
$res = $db->query($sql_instructeur); |
463 |
if (DB :: isError($res)) |
if (database::isError($res)) die($res->getMessage().$sql_instructeur); |
464 |
die($res->getMessage().$sql_instructeur); |
$this->addToLog(" la requete ".$sql_instructeur." est executee", VERBOSE_MODE); |
465 |
else{ |
$contenu[0][0]=""; |
466 |
if ($debug == 1) |
$contenu[1][0]=_('choisir')." "._('instructeur'); |
467 |
echo " la requete ".$sql_instructeur." est executee<br>"; |
$k=1; |
468 |
$contenu[0][0]=""; |
while ($row=& $res->fetchRow()){ |
|
$contenu[1][0]=$this->lang('choisir')." ".$this->lang('instructeur'); |
|
|
$k=1; |
|
|
while ($row=& $res->fetchRow()){ |
|
469 |
$contenu[0][$k]=$row[0]; |
$contenu[0][$k]=$row[0]; |
470 |
$contenu[1][$k]=$row[1]; |
$contenu[1][$k]=$row[1]; |
471 |
$k++; |
$k++; |
|
} |
|
|
$form->setSelect("instructeur",$contenu); |
|
472 |
} |
} |
473 |
|
$form->setSelect("instructeur",$contenu); |
474 |
|
|
475 |
// demandeur et delegataire civilite |
// demandeur et delegataire civilite |
476 |
$contenu=array(); |
$contenu=array(); |
477 |
$res = $db->query($sql_civilite); |
$res = $db->query($sql_civilite); |
478 |
if (database::isError($res)) |
if (database::isError($res)) die($res->getMessage().$sql_); |
479 |
die($res->getMessage().$sql_travaux); |
$this->addToLog(" la requete ".$sql_civilite." est executee", VERBOSE_MODE); |
480 |
else{ |
$contenu[0][0]=""; |
481 |
if ($debug == 1) |
$contenu[1][0]=_('choisir')." "._('civilite'); |
482 |
echo " la requete ".$sql_civilite." est execute<br>"; |
$k=1; |
483 |
$contenu[0][0]=""; |
while ($row=& $res->fetchRow()){ |
|
$contenu[1][0]=_('choisir')." "._('civilite'); |
|
|
$k=1; |
|
|
while ($row=& $res->fetchRow()){ |
|
484 |
$contenu[0][$k]=$row[0]; |
$contenu[0][$k]=$row[0]; |
485 |
$contenu[1][$k]=$row[1]; |
$contenu[1][$k]=$row[1]; |
486 |
$k++; |
$k++; |
487 |
} |
} |
488 |
$form->setSelect("demandeur_civilite",$contenu); |
$form->setSelect("demandeur_civilite",$contenu); |
489 |
$form->setSelect("delegataire_civilite",$contenu); |
$form->setSelect("delegataire_civilite",$contenu); |
490 |
} |
|
491 |
// demandeur categorie |
// demandeur categorie |
492 |
$contenu=array(); |
$contenu=array(); |
493 |
$res = $db->query($sql_categorie_demandeur); |
$res = $db->query($sql_categorie_demandeur); |
494 |
if (database::isError($res)) |
if (database::isError($res)) die($res->getMessage().$sql_categorie_demandeur); |
495 |
die($res->getMessage().$sql_categorie_demandeur); |
$this->addToLog(" la requete ".$sql_categorie_demandeur." est executee", VERBOSE_MODE); |
496 |
else{ |
$contenu[0][0]=""; |
497 |
if ($debug == 1) |
$contenu[1][0]=_('choisir')." "._('categorie'); |
498 |
echo " la requete ".$sql_categorie_demandeur." est execute<br>"; |
$k=1; |
499 |
$contenu[0][0]=""; |
while ($row=& $res->fetchRow()){ |
|
$contenu[1][0]=_('choisir')." "._('categorie'); |
|
|
$k=1; |
|
|
while ($row=& $res->fetchRow()){ |
|
500 |
$contenu[0][$k]=$row[0]; |
$contenu[0][$k]=$row[0]; |
501 |
$contenu[1][$k]=$row[1]; |
$contenu[1][$k]=$row[1]; |
502 |
$k++; |
$k++; |
|
} |
|
|
$form->setSelect("demandeur_categorie",$contenu); |
|
503 |
} |
} |
504 |
|
$form->setSelect("demandeur_categorie",$contenu); |
505 |
|
|
506 |
// pos |
// pos |
507 |
$contenu=array(); |
$contenu=array(); |
508 |
$res = $db->query($sql_pos); |
$res = $db->query($sql_pos); |
509 |
if (database::isError($res)) |
if (database::isError($res)) die($res->getMessage().$sql_pos); |
510 |
die($res->getMessage().$sql_pos); |
$this->addToLog(" la requete ".$sql_pos." est executee", VERBOSE_MODE); |
511 |
else{ |
$contenu[0][0]=""; |
512 |
if ($debug == 1) |
$contenu[1][0]=_('choisir')." "._('pos'); |
513 |
echo " la requete ".$sql_architecte." est execute<br>"; |
$k=1; |
514 |
$contenu[0][0]=""; |
while ($row=& $res->fetchRow()){ |
|
$contenu[1][0]=$this->lang('choisir')." ".$this->lang('pos'); |
|
|
$k=1; |
|
|
while ($row=& $res->fetchRow()){ |
|
515 |
$contenu[0][$k]=$row[0]; |
$contenu[0][$k]=$row[0]; |
516 |
$contenu[1][$k]=$row[1]; |
$contenu[1][$k]=$row[1]; |
517 |
$k++; |
$k++; |
|
} |
|
|
$form->setSelect("pos",$contenu); |
|
518 |
} |
} |
519 |
// lien sig |
$form->setSelect("pos",$contenu); |
520 |
include ("../dyn/var.inc"); |
|
|
$contenu=array(); |
|
|
$contenu[0]="<img src='".$image_sig."'>"; |
|
|
$form->setSelect("siglien",$contenu); |
|
521 |
// code et libelle voie |
// code et libelle voie |
522 |
$contenu=""; |
$contenu=""; |
523 |
$contenu[0][0]="rivoli";// table |
$contenu[0][0]="rivoli";// table |
525 |
$contenu[1][0]="libelle"; |
$contenu[1][0]="libelle"; |
526 |
$contenu[1][1]="terrain_adresse"; |
$contenu[1][1]="terrain_adresse"; |
527 |
$form->setSelect("rivoli",$contenu); |
$form->setSelect("rivoli",$contenu); |
528 |
|
//terrain_adresse |
529 |
$contenu=""; |
$contenu=""; |
530 |
$contenu[0][0]="rivoli";// table |
$contenu[0][0]="rivoli";// table |
531 |
$contenu[0][1]="libelle"; // zone origine |
$contenu[0][1]="libelle"; // zone origine |
545 |
$contenu[1][0]="architecte"; |
$contenu[1][0]="architecte"; |
546 |
$contenu[1][1]="architecte"; |
$contenu[1][1]="architecte"; |
547 |
$form->setSelect("architecte_nom",$contenu); |
$form->setSelect("architecte_nom",$contenu); |
548 |
|
// parcelle_lot |
549 |
|
$contenu=""; |
550 |
|
$contenu[0][0]="parcelle_lot";// table |
551 |
|
$contenu[0][1]="parcelle_lot"; // zone origine |
552 |
|
$contenu[1][0]="lotissement"; |
553 |
|
$contenu[1][1]="parcelle_lot_lotissement"; |
554 |
|
$form->setSelect("parcelle_lot",$contenu); |
555 |
|
$contenu=""; |
556 |
|
$contenu[0][0]="parcelle_lot";// table |
557 |
|
$contenu[0][1]="lotissement"; // zone origine |
558 |
|
$contenu[1][0]="parcelle_lot"; |
559 |
|
$contenu[1][1]="parcelle_lot"; |
560 |
|
$form->setSelect("parcelle_lot_lotissement",$contenu); |
561 |
// accord tacite |
// accord tacite |
562 |
$contenu=array(); |
$contenu=array(); |
563 |
$contenu[0]=array('Non','Oui'); |
$contenu[0]=array('Non','Oui'); |
569 |
$contenu[0]=array('','bis','ter','quater'); |
$contenu[0]=array('','bis','ter','quater'); |
570 |
$contenu[1]=array('','bis','ter','quater'); |
$contenu[1]=array('','bis','ter','quater'); |
571 |
$form->setSelect("terrain_numero_complement",$contenu); |
$form->setSelect("terrain_numero_complement",$contenu); |
|
// lien demandeur |
|
|
$contenu=array(); |
|
|
$contenu[0]=" <img src='../img/modifier.gif' border ='0'> "; |
|
|
$form->setSelect("saisie_demandeur",$contenu); |
|
|
// lien demandeur |
|
|
$contenu=array(); |
|
|
$contenu[0]=" <img src='../img/modifier.gif' border ='0'> "; |
|
|
$form->setSelect("saisie_delegataire",$contenu); |
|
|
// lien architecte |
|
|
$contenu=array(); |
|
|
$contenu[0]=" <img src='../img/ajouter.gif' border ='0'> "; |
|
|
$form->setSelect("saisie_architecte",$contenu); |
|
572 |
} |
} |
573 |
} |
} |
574 |
|
|
649 |
$form->setGroupe('date_chantier','D'); |
$form->setGroupe('date_chantier','D'); |
650 |
$form->setGroupe('date_achevement','G'); |
$form->setGroupe('date_achevement','G'); |
651 |
$form->setGroupe('date_conformite','F'); |
$form->setGroupe('date_conformite','F'); |
652 |
|
|
653 |
// localisation |
// localisation |
654 |
$form->setGroupe('parcelle','D'); |
$form->setGroupe('parcelle','D'); |
655 |
$form->setGroupe('pos','F'); |
$form->setGroupe('pos','G'); |
656 |
//$form->setGroupe('sig','G'); |
$form->setGroupe('sig','F'); |
|
//$form->setGroupe('siglien','F'); |
|
657 |
|
|
658 |
// description |
// description |
659 |
$form->setGroupe('batiment_nombre','D'); |
$form->setGroupe('batiment_nombre','D'); |
665 |
$form->setGroupe('shon_calcul','G'); |
$form->setGroupe('shon_calcul','G'); |
666 |
$form->setGroupe('shob','G'); |
$form->setGroupe('shob','G'); |
667 |
$form->setGroupe('lot','F'); |
$form->setGroupe('lot','F'); |
668 |
|
|
669 |
|
$form->setGroupe('amenagement','D'); |
670 |
|
$form->setGroupe('parcelle_lot','G'); |
671 |
|
$form->setGroupe('parcelle_lot_lotissement','F'); |
672 |
} |
} |
673 |
|
|
674 |
|
|
736 |
// travaux |
// travaux |
737 |
$form->setLib('objet_dossier',''); |
$form->setLib('objet_dossier',''); |
738 |
$form->setLib('travaux',''); |
$form->setLib('travaux',''); |
|
$form->setLib('saisie_architecte',""); // *** |
|
739 |
$form->setLib('architecte_nom',""); |
$form->setLib('architecte_nom',""); |
740 |
$form->setLib('architecte',''); |
$form->setLib('architecte',''); |
741 |
|
|
747 |
$form->setLib('shon',' '._('shon').' : '); |
$form->setLib('shon',' '._('shon').' : '); |
748 |
$form->setLib('shon_calcul',' '._('calcul shon').' : '); |
$form->setLib('shon_calcul',' '._('calcul shon').' : '); |
749 |
$form->setLib('shob',' '._('shob').' : '); |
$form->setLib('shob',' '._('shob').' : '); |
750 |
|
|
751 |
|
|
752 |
|
// amenagement |
753 |
$form->setLib('amenagement',' '._('amenagement').' : '); |
$form->setLib('amenagement',' '._('amenagement').' : '); |
754 |
|
$form->setLib('parcelle_lot',''); |
755 |
|
$form->setLib('parcelle_lot_lotissement',' '._('lotissement').' : '); |
756 |
|
$form->setLib('parcelle_lot_numero',' '._('no').' : '); |
757 |
|
$form->setLib('sig',' '._('verrou').' '._('sig').' : '); |
758 |
|
|
759 |
// zones temp |
// zones temp |
760 |
include ("../dyn/var.inc"); |
include ("../dyn/var.inc"); |
773 |
$form->setOnchange("delegataire_nom","this.value=this.value.toUpperCase()"); |
$form->setOnchange("delegataire_nom","this.value=this.value.toUpperCase()"); |
774 |
$form->setOnchange("delegataire_societe","this.value=this.value.toUpperCase()"); |
$form->setOnchange("delegataire_societe","this.value=this.value.toUpperCase()"); |
775 |
$form->setOnchange("architecte_nom","this.value=this.value.toUpperCase()"); |
$form->setOnchange("architecte_nom","this.value=this.value.toUpperCase()"); |
776 |
|
$form->setOnchange("terrain_adresse","this.value=this.value.toUpperCase()"); |
777 |
|
|
778 |
} |
} |
779 |
|
|
780 |
function setRegroupe(&$form,$maj){ |
function setRegroupe(&$form,$maj){ |
781 |
// depot |
// depot |
782 |
If ($maj==0){ |
If ($maj==0){ |
783 |
$form->setRegroupe('date_demande','D',_(Depot),$this->aff_depot ); |
$form->setRegroupe('date_demande','D',_("Depot"),$this->aff_depot ); |
784 |
} |
} |
785 |
If ($maj==1){ |
If ($maj==1){ |
786 |
$form->setRegroupe('dossier','D',_(Depot), $this->aff_depot); |
$form->setRegroupe('dossier','D',_("Depot"), $this->aff_depot); |
787 |
$form->setRegroupe('date_demande','G',''); |
$form->setRegroupe('date_demande','G',''); |
788 |
} |
} |
789 |
$form->setRegroupe('date_depot','G',''); |
$form->setRegroupe('date_depot','G',''); |
792 |
// travaux |
// travaux |
793 |
$form->setRegroupe('architecte','D',_('Architecte')." / "._("Travaux"), $this->aff_travaux); |
$form->setRegroupe('architecte','D',_('Architecte')." / "._("Travaux"), $this->aff_travaux); |
794 |
$form->setRegroupe('architecte_nom','G',''); |
$form->setRegroupe('architecte_nom','G',''); |
|
$form->setRegroupe('saisie_architecte','G',''); |
|
795 |
$form->setRegroupe('travaux','F',''); |
$form->setRegroupe('travaux','F',''); |
796 |
|
|
797 |
// instruction |
// instruction |
848 |
|
|
849 |
// localisation |
// localisation |
850 |
$form->setRegroupe('parcelle','D',_('localisation'), $this->aff_localisation); |
$form->setRegroupe('parcelle','D',_('localisation'), $this->aff_localisation); |
851 |
$form->setRegroupe('pos','F',''); |
$form->setRegroupe('pos','G',''); |
852 |
//$form->setRegroupe('sig','G',''); |
$form->setRegroupe('sig','F',''); |
853 |
//$form->setRegroupe('siglien','F',''); |
|
854 |
|
|
855 |
// description |
// description |
856 |
$form->setRegroupe('batiment_nombre','D',_('description'), $this->aff_description); |
$form->setRegroupe('batiment_nombre','D',_('statistique'), $this->aff_description); |
857 |
$form->setRegroupe('logement_nombre','G',''); |
$form->setRegroupe('logement_nombre','G',''); |
858 |
$form->setRegroupe('hauteur','G',''); |
$form->setRegroupe('hauteur','G',''); |
859 |
$form->setRegroupe('piece_nombre','G',''); |
$form->setRegroupe('piece_nombre','G',''); |
861 |
$form->setRegroupe('shon_calcul','G',''); |
$form->setRegroupe('shon_calcul','G',''); |
862 |
$form->setRegroupe('shob','G',''); |
$form->setRegroupe('shob','G',''); |
863 |
$form->setRegroupe('lot','F',''); |
$form->setRegroupe('lot','F',''); |
864 |
|
|
865 |
|
$form->setRegroupe('description','D',_('description').' '._('servitude'), $this->aff_amenagement); |
866 |
|
$form->setRegroupe('servitude','F',''); |
867 |
|
|
868 |
|
// amenagement |
869 |
|
$form->setRegroupe('amenagement','D',_('Amenagement'), $this->aff_amenagement); |
870 |
|
$form->setRegroupe('parcelle_lot','G',''); |
871 |
|
$form->setRegroupe('parcelle_lot_lotissement','F',''); |
872 |
|
|
873 |
|
|
874 |
// temp |
// temp |
875 |
} |
} |
876 |
|
|
882 |
* =============================================================== |
* =============================================================== |
883 |
*/ |
*/ |
884 |
|
|
|
|
|
885 |
function triggerajouterapres($id,&$db,$val,$DEBUG) { |
function triggerajouterapres($id,&$db,$val,$DEBUG) { |
886 |
if (file_exists ("../dyn/var.inc")) |
$this->sig_parametre($db); |
|
include ("../dyn/var.inc"); |
|
|
if(!isset($sig)) $sig=0; |
|
|
if(!isset($auto_pos)) $auto_pos=0; |
|
887 |
$id=$this->valF['dossier']; // id n est pas valorise en ajout |
$id=$this->valF['dossier']; // id n est pas valorise en ajout |
888 |
if($sig==1 ){ |
if($this->sig==1 and $val['sig']!='Oui'){ |
889 |
if($val['parcelle']!='') |
if($val['parcelle']!=''or $val['parcelle_lot']!='') |
890 |
$this->sig_interne($id,&$db,$val,$DEBUG,$auto_pos); |
$this->sig_interne($id,&$db,$val,$DEBUG); |
891 |
else |
else |
892 |
$this->msg = $this->msg."<br>"._("Parcelle non renseignee dans dossier")." ".$id." <br>"; |
$this->addToMessage("<br>"._("Parcelle non renseignee dans dossier")." ".$id." <br>"); |
893 |
} |
} |
894 |
} |
} |
895 |
|
|
896 |
function triggermodifierapres($id,&$db,$val,$DEBUG) { |
function triggermodifierapres($id,&$db,$val,$DEBUG) { |
897 |
if (file_exists ("../dyn/var.inc")) |
$this->sig_parametre($db); |
|
include ("../dyn/var.inc"); |
|
|
if(!isset($sig)) $sig=0; |
|
|
if(!isset($auto_pos)) $auto_pos=0; |
|
898 |
// si la parcelle est changée |
// si la parcelle est changée |
899 |
if($sig==1 and $val['parcelle']!=$val['parcelle_archive']){ |
if(($this->sig==1 and $val['sig']!='Oui' and ($val['parcelle']!=$val['parcelle_archive']) |
900 |
if($val['parcelle']!='') |
or $val['parcelle_lot']!=$val['parcelle_lot_archive'])){ // parcelle_lot_archive |
901 |
$this->sig_interne($this->valF['dossier'],&$db,$val,$DEBUG,$auto_pos); |
if($val['parcelle']!='' or $val['parcelle_lot']!='') |
902 |
} |
$this->sig_interne($this->valF['dossier'],&$db,$val,$DEBUG); |
903 |
|
else{ |
904 |
|
if($this->maj ==1){ // en maj mettre a null la geometrie si parcelle changée inexistante |
905 |
|
$sql ="update ".DB_PREFIXE."dossier set geom = null, servitude = '', pos= '' where dossier ='".$id."'"; |
906 |
|
$res = $db -> query($sql); |
907 |
|
$this->addToLog("requete trigger modifier parcelle vide -> maj pos et servitude :".$sql, VERBOSE_MODE); |
908 |
|
if (database :: isError($res)) |
909 |
|
die($res->getMessage()."erreur ".$sql); |
910 |
|
} |
911 |
|
$this->addToMessage("<br>"._("Parcelle ou parcelle_lot non renseignee dans dossier")." ".$id." <br>"); |
912 |
|
} |
913 |
|
} |
914 |
|
} |
915 |
|
|
916 |
|
function sig_parametre(&$db){ |
917 |
|
if (file_exists ("../dyn/var.inc")) |
918 |
|
include ("../dyn/var.inc"); |
919 |
|
if(!isset($sig)) |
920 |
|
$this->sig=0; |
921 |
|
else |
922 |
|
$this->sig=1; |
923 |
|
if(!isset($auto_pos)) |
924 |
|
$this->auto_pos=0; |
925 |
|
else |
926 |
|
$this->auto_pos=$auto_pos; |
927 |
|
if(!isset($auto_servitude_surfacique)) |
928 |
|
$this->auto_servitude_surfacique=0; |
929 |
|
else |
930 |
|
$this->auto_servitude_surfacique=$auto_servitude_surfacique; |
931 |
|
if(!isset($auto_servitude_ligne)) |
932 |
|
$this->auto_servitude_ligne=0; |
933 |
|
else |
934 |
|
$this->auto_servitude_ligne=$auto_servitude_ligne; |
935 |
|
if(!isset($auto_servitude_point)) |
936 |
|
$this->auto_servitude_point=0; |
937 |
|
else |
938 |
|
$this->auto_servitude_point=$auto_servitude_point; |
939 |
|
if(!isset($auto_parcelle)) |
940 |
|
$this->auto_parcelle=0; |
941 |
|
else |
942 |
|
$this->auto_parcelle=$auto_parcelle; |
943 |
|
if(!isset($auto_parcelle_lot)) |
944 |
|
$this->auto_parcelle_lot=0; |
945 |
|
else |
946 |
|
$this->auto_parcelle_lot=$auto_parcelle_lot; |
947 |
|
$this->addToLog("trigger valeur sig :".$this->sig, VERBOSE_MODE); |
948 |
|
$this->addToLog("trigger valeur auto_pos :". $this->auto_pos, VERBOSE_MODE); |
949 |
|
$this->addToLog("trigger valeur auto_servitude_surfacique :".$this->auto_servitude_surfacique, VERBOSE_MODE); |
950 |
|
$this->addToLog("trigger valeur auto_servitude_ligne :". $this->auto_servitude_ligne, VERBOSE_MODE); |
951 |
|
$this->addToLog("trigger valeur auto_servitude_point :".$this->auto_servitude_point, VERBOSE_MODE); |
952 |
|
$this->addToLog("trigger valeur auto_parcelle :". $this->auto_parcelle, VERBOSE_MODE); |
953 |
|
$this->addToLog("trigger valeur auto_parcelle_lot :".$this->auto_parcelle_lot, VERBOSE_MODE); |
954 |
} |
} |
955 |
|
|
956 |
function sig_interne($id,&$db,$val,$DEBUG,$auto_pos){ |
|
957 |
|
function sig_interne($id,&$db,$val,$DEBUG){ |
958 |
// Strategy interne dans var.inc |
// Strategy interne dans var.inc |
959 |
// si la parcelle existe, il est cree un point au milieu de la parcelle |
// si la parcelle existe, il est cree un point au milieu de la parcelle |
960 |
// de maniere automatique |
// de maniere automatique |
961 |
|
$geom=''; |
962 |
|
$parcelle=$val["parcelle"]; |
963 |
$projection = $db -> getOne("select srid from geometry_columns where f_table_name='dossier'"); |
$projection = $db -> getOne("select srid from geometry_columns where f_table_name='dossier'"); |
964 |
$sql= "select astext(centroid(geom)) from parcelle where parcelle ='".$val["parcelle"]."'"; |
if($this->auto_parcelle==1 and $val["parcelle"]!=''){ |
965 |
$geom = $db -> getOne($sql); |
$sql= "select astext(centroid(geom)) from ".DB_PREFIXE."parcelle where parcelle ='".$val["parcelle"]."'"; |
966 |
if($geom!=''){ // la parcelle est exitante dans la table / vue parcelle |
$this->addToLog("recherche centroid parcelle :".$sql, VERBOSE_MODE); |
967 |
$sql ="update dossier set geom =geometryfromtext('".$geom."', ".$projection." ) where dossier ='".$id."'"; |
$geom = $db -> getOne($sql); |
968 |
|
if (database :: isError($geom))die($res->getMessage()."erreur ".$sql); |
969 |
|
} |
970 |
|
if($geom=='' and $this->auto_parcelle_lot==1 and $val["parcelle_lot"]!=''){ // lot |
971 |
|
$sql= "select astext(centroid(geom)) from ".DB_PREFIXE."parcelle_lot where parcelle_lot ='".$val["parcelle_lot"]."'"; |
972 |
|
$this->addToLog("recherche centroid parcelle lot :".$sql, VERBOSE_MODE); |
973 |
|
$geom = $db -> getOne($sql); |
974 |
|
if (database :: isError($geom))die($res->getMessage()."erreur ".$sql); |
975 |
|
$parcelle=$val["parcelle_lot"]." ".$val["parcelle_lot_lotissement"]; |
976 |
|
} |
977 |
|
if($geom!=''){ // la parcelle est exitante dans la table ou vue parcelle |
978 |
|
$sql ="update ".DB_PREFIXE."dossier set geom =geometryfromtext('".$geom."', ".$projection." ) where dossier ='".$id."'"; |
979 |
|
$this->addToLog("sig_interne maj geom :".$sql, VERBOSE_MODE); |
980 |
$res = $db -> query($sql); |
$res = $db -> query($sql); |
981 |
if (database :: isError($res)){ |
if (database :: isError($res)) die($res->getMessage()."erreur ".$sql); |
982 |
die($res->getMessage()."erreur ".$sql); |
$this->addToMessage(""._("centroid de parcelle calcule")." ".$parcelle." "); |
983 |
}else{ |
if($this->auto_pos==1) // recherche du pos |
984 |
$this->msg = $this->msg."<br>"._("centroid de parcelle calculé")." ".$val["parcelle"]. |
$this->calcul_auto_pos($id,$db,$geom,$projection); |
985 |
" "._("dossier")." ".$id."<br>"; |
if($this->auto_servitude_surfacique==1) // recherche de servitude surfacique |
986 |
} |
$this->calcul_auto_servitude_surfacique($id,$db,$geom,$projection); |
987 |
if($auto_pos==1) // recherche du pos |
if($this->auto_servitude_ligne==1) // recherche de servitude ligne |
988 |
$this->auto_pos($id,$db,$geom,$projection); |
$this->calcul_auto_servitude_ligne($id,$db,$geom,$projection); |
989 |
}else{ // parcelle inexistante |
if($this->auto_servitude_point==1) // recherche de servitude point |
990 |
|
$this->calcul_auto_servitude_point($id,$db,$geom,$projection); |
991 |
|
$temp=strtr($this->servitude,"'"," "); // enleve le ' |
992 |
|
$sql1 ="update ".DB_PREFIXE."dossier set servitude = '".$temp."' where dossier = '".$id."'"; |
993 |
|
$res1 = $db -> query($sql1); |
994 |
|
$this->addToLog("maj servitudes :".$sql1, VERBOSE_MODE); |
995 |
|
if (database:: isError($res1)) die($res1->getMessage()."erreur ".$sql1); |
996 |
|
}else{ // parcelle inexistante //*** |
997 |
if($this->maj ==1){ // en maj mettre a null la geometrie si parcelle changée inexistante |
if($this->maj ==1){ // en maj mettre a null la geometrie si parcelle changée inexistante |
998 |
$sql ="update dossier set geom = null where dossier ='".$id."'"; |
$sql ="update ".DB_PREFIXE."dossier set geom = null, servitude = '', pos= '' where dossier ='".$id."'"; |
999 |
$res = $db -> query($sql); |
$res = $db -> query($sql); |
1000 |
|
$this->addToLog("requete sig_interne maj parcelle inexistante :".$sql, VERBOSE_MODE); |
1001 |
if (database :: isError($res)) |
if (database :: isError($res)) |
1002 |
die($res->getMessage()."erreur ".$sql); |
die($res->getMessage()."erreur ".$sql); |
1003 |
} |
} |
1004 |
$this->msg = $this->msg."<br> parcelle ".$val["parcelle"]." "._("inexistante")." ".$id."<br>"; |
$this->addToMessage("<br> parcelle ".$parcelle." "._("inexistante")." ".$id.""); |
1005 |
} |
} |
1006 |
} |
} |
1007 |
|
|
1008 |
function auto_pos($id,&$db,$geom,$projection){ |
function calcul_auto_pos($id,&$db,$geom,$projection){ |
1009 |
// recherche du pos automatique dans le geom de la table / vue pos |
// recherche du pos automatique |
1010 |
$sql="select pos from pos WHERE ST_contains(geom, geometryfromtext('".$geom."', ".$projection."))"; |
$sql="select pos from ".DB_PREFIXE."pos WHERE ST_contains(geom, geometryfromtext('".$geom."', ".$projection."))"; |
1011 |
$pos = $db -> getOne($sql); |
$pos = $db -> getOne($sql); |
1012 |
|
$this->addToLog("recherche auto_pos :".$sql, VERBOSE_MODE); |
1013 |
if($pos!=''){ |
if($pos!=''){ |
1014 |
$sql1 ="update dossier set pos = '".$pos."' where dossier = '".$id."'"; |
$sql1 ="update ".DB_PREFIXE."dossier set pos = '".$pos."' where dossier = '".$id."'"; |
1015 |
$res1 = $db -> query($sql1); |
$res1 = $db -> query($sql1); |
1016 |
if (database:: isError($res1)){ // ok |
$this->addToLog("maj auto_pos :".$sql1, VERBOSE_MODE); |
1017 |
die($res1->getMessage()."erreur ".$sql1); |
if (database:: isError($res1)) die($res1->getMessage()."erreur ".$sql1); |
1018 |
}else{ |
$this->addToMessage("<br>"._("POS/PLU")." : ".$pos.""); |
|
$this->msg = $this->msg."<br>"._("POS/PLU renseignee automatiquement dans dossier")." ".$id." -> ".$pos."<br>"; |
|
|
} |
|
1019 |
}else{ |
}else{ |
1020 |
$this->msg = $this->msg."<br>"._("POS/PLU non trouvé pour dossier")." ".$id."<br>"; |
$this->addToMessage("<br>"._("POS/PLU non trouvé")." ".$id.""); |
1021 |
} |
} |
1022 |
} |
} |
1023 |
|
|
1024 |
|
function calcul_auto_servitude_surfacique($id,&$db,$geom,$projection){ |
1025 |
|
// recherche servitude surfacique |
1026 |
|
$sql="select * from ".DB_PREFIXE."servitude_surfacique WHERE ST_contains(geom, geometryfromtext('".$geom."', ".$projection."))"; |
1027 |
|
$res=$db->query($sql); |
1028 |
|
if (database:: isError($res)) die($res1->getMessage()."erreur ".$sql); |
1029 |
|
$this->addToLog("requete :".$sql." executee ", VERBOSE_MODE); |
1030 |
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
1031 |
|
$this->addToMessage("<br>"._("servitude")." : ".$row['libelle']." - ".$row['observation']); |
1032 |
|
$this->servitude.=" [".$row['libelle']."] ".$row['observation']." - "; |
1033 |
|
} |
1034 |
|
} |
1035 |
|
|
1036 |
|
function calcul_auto_servitude_ligne($id,&$db,$geom,$projection){ |
1037 |
|
// recherche servitude ligne |
1038 |
|
$sql="select * from ".DB_PREFIXE."servitude_ligne WHERE ST_contains(ST_buffer(geom, perimetre), geometryfromtext('".$geom."', ".$projection."))"; |
1039 |
|
$res=$db->query($sql); |
1040 |
|
if (database:: isError($res)) die($res1->getMessage()."erreur ".$sql); |
1041 |
|
$this->addToLog("requete :".$sql." executee ", VERBOSE_MODE); |
1042 |
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
1043 |
|
$this->addToMessage("<br>"._("servitude")." : ".$row['libelle']." - ".$row['observation']); |
1044 |
|
$this->servitude.=" [".$row['libelle']."] ".$row['observation']." - "; |
1045 |
|
} |
1046 |
|
} |
1047 |
|
|
1048 |
|
function calcul_auto_servitude_point($id,&$db,$geom,$projection){ |
1049 |
|
// recherche servitude point |
1050 |
|
$sql="select libelle,observation, perimetre, distance(geom, geometryfromtext('".$geom."', ".$projection.")) as distance from ". |
1051 |
|
DB_PREFIXE."servitude_point WHERE distance(geom, geometryfromtext('".$geom."', ".$projection."))<perimetre"; |
1052 |
|
$res=$db->query($sql); |
1053 |
|
if (database:: isError($res)) die($res1->getMessage()."erreur ".$sql); |
1054 |
|
$this->addToLog("requete :".$sql." executee ", VERBOSE_MODE); |
1055 |
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
1056 |
|
$this->addToMessage("<br>"._("servitude")." : ".$row['libelle']." - ".$row['observation']." a ".round($row['distance'],2)." m "); |
1057 |
|
$this->servitude.=" [".$row['libelle']."] ".$row['observation']." a ".round($row['distance'],2)." m - "; |
1058 |
|
} |
1059 |
|
} |
1060 |
|
|
1061 |
|
|
1062 |
}// fin classe |
}// fin classe |
1063 |
?> |
?> |