1 |
<?php |
<?php |
2 |
//$Id$ |
//$Id$ |
3 |
//gen openMairie le 10/02/2011 20:39 |
//gen openMairie le 10/02/2011 20:39 |
4 |
|
|
5 |
require_once ("../gen/obj/dossier.class.php"); |
require_once ("../gen/obj/dossier.class.php"); |
6 |
|
|
7 |
class dossier extends dossier_gen { |
class dossier extends dossier_gen { |
15 |
var $auto_servitude_point; |
var $auto_servitude_point; |
16 |
var $auto_parcelle; |
var $auto_parcelle; |
17 |
var $auto_parcelle_lot; |
var $auto_parcelle_lot; |
18 |
|
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 |
|
|
32 |
|
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 |
|
$temp=$this->db->nextId(DB_PREFIXE."dossier_".$val['nature']); |
42 |
|
} |
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 |
|
|
48 |
function setvalF($val){ |
function setvalF($val){ |
49 |
parent::setvalF($val); |
parent::setvalF($val); |
|
// cles secondaires numerique (contrainte integrite pgsql) |
|
|
if(!is_numeric($val['instructeur'])) $this->valF['instructeur']= null; |
|
|
if(!is_numeric($val['architecte'])) $this->valF['architecte']= null; |
|
|
if(!is_numeric($val['travaux'])) $this->valF['travaux']= null; |
|
|
if(!is_numeric($val['demandeur_categorie'])) $this->valF['demandeur_categorie']= null; |
|
|
// cle secondaire alpha vide (contrainte integrite pgsql) |
|
|
if($val['demandeur_civilite']=='') $this->valF['demandeur_civilite']= null; |
|
|
if($val['delegataire_civilite']=='') $this->valF['delegataire_civilite']= null; |
|
|
// zone numerique non valorisée a 0 |
|
|
if(!is_numeric($val['delai'])) unset ($this->valF['delai']); |
|
|
if(!is_numeric($val['terrain_surface'])) unset ($this->valF['terrain_surface']); |
|
|
if(!is_numeric($val['batiment_nombre'])) unset ($this->valF['batiment_nombre']); |
|
|
if(!is_numeric($val['logement_nombre'])) unset ($this->valF['logement_nombre']); |
|
|
if(!is_numeric($val['shon'])) unset ($this->valF['shon']); |
|
|
if(!is_numeric($val['shob'])) unset ($this->valF['shob']); |
|
|
if(!is_numeric($val['lot'])) unset ($this->valF['lot']); |
|
|
if(!is_numeric($val['hauteur'])) unset ($this->valF['hauteur']); |
|
|
if(!is_numeric($val['piece_nombre'])) unset ($this->valF['piece_nombre']); |
|
|
if(!is_numeric($val['parcelle_lot'])) unset ($this->valF['parcelle_lot']); |
|
50 |
// enlever les valeurs a ne pas saisir -> recherche en trigger ajouter et modifier |
// enlever les valeurs a ne pas saisir -> recherche en trigger ajouter et modifier |
51 |
// $sig = 1 |
// $sig = 1 |
52 |
unset ($this->valF['geom']); |
unset ($this->valF['geom']); |
53 |
|
unset ($this->valF['geom1']); |
54 |
// valeurs hiddenstatic (calcule) |
// valeurs hiddenstatic (calcule) |
55 |
if($this->maj==1){ |
if($this->maj==1){ |
56 |
// par defaut |
// par defaut |
59 |
unset ($this->valF['accord_tacite']); |
unset ($this->valF['accord_tacite']); |
60 |
unset ($this->valF['types']); |
unset ($this->valF['types']); |
61 |
} |
} |
62 |
unset ($this->valF['avis']); // avis + libelle avis |
unset ($this->valF['avis_decision']); // avis + libelle avis |
63 |
unset ($this->valF['terrain_surface_calcul']); |
unset ($this->valF['terrain_surface_calcul']); |
64 |
unset ($this->valF['shon_calcul']); |
unset ($this->valF['shon_calcul']); |
65 |
unset ($this->valF['parcelle_archive']); |
unset ($this->valF['parcelle_archive']); |
70 |
unset ($this->valF['date_validite']); |
unset ($this->valF['date_validite']); |
71 |
unset ($this->valF['date_chantier']); |
unset ($this->valF['date_chantier']); |
72 |
unset ($this->valF['date_achevement']); |
unset ($this->valF['date_achevement']); |
73 |
unset ($this->valF['date_conformite']); |
unset ($this->valF['date_conformite']); |
|
} |
|
|
|
|
|
// specifique |
|
|
function setId($db){ |
|
|
// id automatique nextid |
|
|
// departement 13 |
|
|
// ville 004 |
|
|
// nature 2 caracteres |
|
|
// lettre R arles F vitrolles |
|
|
// numero sur 6 caracteres |
|
|
if (file_exists ("../dyn/var.inc")) |
|
|
include ("../dyn/var.inc"); |
|
|
if($numero_unique==1){ |
|
|
// numero unique (voir dyn/var.inc) |
|
|
$temp=$db->nextId(DB_PREFIXE.$this->table); |
|
|
}else{ |
|
|
// numero suivant nature |
|
|
$temp=$db->nextId(DB_PREFIXE."dossier_".$this->nature); |
|
|
} |
|
|
$temp=str_pad($temp,4,"0", STR_PAD_LEFT); |
|
|
$this->valF['dossier'] = $this->valF['nature'].$this->valF['annee']. |
|
|
$lettre.$temp; |
|
|
} |
|
|
|
|
|
// fonction a surcharger car utilisation d un nextID alpha |
|
|
function verifierAjout(){ |
|
74 |
} |
} |
75 |
|
|
76 |
function verifier($val,&$db,$DEBUG){ |
function verifier($val,&$db,$DEBUG){ |
77 |
$this->correct=True; |
parent::verifier($val,$db,$DEBUG); |
|
// obligatoire |
|
|
if($val['date_depot']==""){ |
|
|
// $this->valF['date_depot'] = $this->dateDB($val['date_depot']); |
|
|
//}else{ |
|
|
$this->correct=false; |
|
|
$this->addToMessage("<br>date_depot obligatoire"); |
|
|
} |
|
78 |
if($val['parcelle']!="" and $val['sig']!='Oui'){ |
if($val['parcelle']!="" and $val['sig']!='Oui'){ |
79 |
if (!preg_match('/^[A-Z]{2}[0-9]{4}$/', $val['parcelle'])){ |
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 |
$this->correct=false; |
$this->correct=false; |
81 |
$this->addToMessage("<br>format parcelle AANNNN"); |
$this->addToMessage("<br>format parcelle incorrect"); |
82 |
} |
} |
83 |
} |
} |
84 |
// regles travaux verification |
// regles travaux verification |
200 |
|
|
201 |
|
|
202 |
function setType(&$form,$maj) { |
function setType(&$form,$maj) { |
203 |
//parent::setType($form,$maj); |
parent::setType($form,$maj); |
204 |
if ($maj < 2) { //ajouter et modifier |
if ($maj < 2) { //ajouter et modifier |
205 |
// cache |
// cache |
206 |
if($maj==0) $form->setType('dossier', 'hidden'); |
if($maj==0) $form->setType('dossier', 'hidden'); |
207 |
$form->setType('annee', 'hidden'); |
$form->setType('annee', 'hidden'); |
208 |
$form->setType('nature', 'hidden'); |
$form->setType('nature', 'select'); |
209 |
$form->setType('parcelle_archive','hidden'); |
$form->setType('parcelle_archive','hidden'); |
210 |
$form->setType('parcelle_lot_archive','hidden'); |
$form->setType('parcelle_lot_archive','hidden'); |
211 |
$form->setType('objet_dossier','hidden'); // PC |
$form->setType('objet_dossier','hidden'); // PC |
212 |
$form->setType('amenagement','hidden'); // PC |
$form->setType('amenagement','hidden'); // PC |
213 |
$form->setType('parcelle_lot','hidden'); // PC |
$form->setType('parcelle_lot','hidden'); // PC |
214 |
$form->setType('parcelle_lot_lotissement','hidden'); // PC |
$form->setType('parcelle_lot_lotissement','hidden'); // PC |
|
$form->setType('geom', 'hidden'); |
|
|
$form->setType('servitude', 'hiddenstatic'); |
|
|
$form->setType('description', 'textarea'); |
|
|
|
|
|
// date |
|
|
$form->setType('date_depot','date'); |
|
|
$form->setType('date_demande','date'); |
|
215 |
|
|
216 |
|
$form->setType('geom1', 'hidden'); |
217 |
|
$form->setType('geom', 'geom'); |
218 |
|
$form->setType('servitude', 'hiddenstatic'); |
219 |
|
|
220 |
//select |
//select |
221 |
$form->setType('travaux','select'); |
$form->setType('terrain_numero_complement','select'); |
|
$form->setType('instructeur','select'); |
|
|
$form->setType('terrain_numero_complement','select'); |
|
|
$form->setType('delegataire_civilite','select'); |
|
|
$form->setType('demandeur_civilite','select'); |
|
|
$form->setType('demandeur_categorie','select'); |
|
|
|
|
222 |
|
|
223 |
// combo |
// combo |
224 |
$form->setType('rivoli','comboD'); |
$form->setType('rivoli','comboD'); |
230 |
// hiddenstatic |
// hiddenstatic |
231 |
if($maj==1) $form->setType('dossier', 'hiddenstatic'); |
if($maj==1) $form->setType('dossier', 'hiddenstatic'); |
232 |
$form->setType('etat','hiddenstatic'); |
$form->setType('etat','hiddenstatic'); |
233 |
$form->setType('avis','hiddenstatic'); |
$form->setType('avis_decision','hiddenstatic'); |
234 |
$form->setType('delai','hiddenstatic'); |
$form->setType('delai','hiddenstatic'); |
235 |
$form->setType('terrain_surface_calcul','hiddenstatic'); |
$form->setType('terrain_surface_calcul','hiddenstatic'); |
236 |
$form->setType('shon_calcul','hiddenstatic'); |
$form->setType('shon_calcul','hiddenstatic'); |
276 |
$form->setType('temp3',$temp3_type); |
$form->setType('temp3',$temp3_type); |
277 |
$form->setType('temp4',$temp4_type); |
$form->setType('temp4',$temp4_type); |
278 |
$form->setType('temp5',$temp5_type); |
$form->setType('temp5',$temp5_type); |
279 |
}else{ // supprimer |
} |
280 |
$form->setType('dossier', 'hiddenstatic'); |
if ($maj == 1) { |
281 |
$form->setType('sig', 'hiddenstatic'); |
// |
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 |
|
if($maj == 3) { |
300 |
|
$form->setType('annee', 'hidden'); |
301 |
|
$form->setType('nature', 'selectstatic'); |
302 |
|
$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 |
|
$form->setType('geom','hidden'); |
311 |
|
} |
312 |
|
$form->setType('a_qualifier', 'hidden'); |
313 |
|
// |
314 |
|
if(!$this->f->getParameter('afficher_division') === 'true') { |
315 |
|
$form->setType('division', 'hidden'); |
316 |
} |
} |
317 |
} |
} |
318 |
|
|
320 |
$this->maj=$maj; |
$this->maj=$maj; |
321 |
if ($validation==0) { |
if ($validation==0) { |
322 |
if ($maj == 0){ |
if ($maj == 0){ |
323 |
include ("../dyn/var.inc"); |
//$dossier_cp = $this->f->collectivite["cp"]; |
324 |
$form->setVal('nature', $this->nature); |
//$dossier_ville = $this->f->collectivite["ville"]; |
325 |
|
//$form->setVal('nature', $this->nature); |
326 |
|
|
327 |
$form->setVal('annee', date('y')); |
$form->setVal('annee', date('y')); |
328 |
$form->setVal('date_demande', date('Y-m-d')); |
$form->setVal('date_demande', date('Y-m-d')); |
329 |
$form->setVal('date_depot', date('Y-m-d')); |
$form->setVal('date_depot', date('Y-m-d')); |
330 |
|
|
331 |
$form->setVal('demandeur_cp', $dossier_cp); |
//$form->setVal('demandeur_cp', $dossier_cp); |
332 |
$form->setVal('demandeur_ville', $dossier_ville); |
//$form->setVal('demandeur_ville', $dossier_ville); |
333 |
|
|
334 |
$form->setVal('delegataire_cp', $dossier_cp); |
//$form->setVal('delegataire_cp', $dossier_cp); |
335 |
$form->setVal('delegataire_ville', $dossier_ville); |
//$form->setVal('delegataire_ville', $dossier_ville); |
336 |
|
|
337 |
$form->setVal('terrain_cp', $dossier_cp); |
//$form->setVal('terrain_cp', $dossier_cp); |
338 |
$form->setVal('terrain_ville', $dossier_ville); |
//$form->setVal('terrain_ville', $dossier_ville); |
339 |
|
|
340 |
$form->setVal('accord_tacite', 'Non'); |
$form->setVal('accord_tacite', 'Non'); |
341 |
$form->setVal('etat', 'initialiser'); |
$form->setVal('etat', 'initialiser'); |
342 |
$form->setVal('types', 'Initial'); |
$form->setVal('types', 'Initial'); |
343 |
} |
} |
344 |
} |
} |
345 |
} |
} |
346 |
|
|
347 |
function setSelect(&$form, $maj,&$db,$debug) { |
function setSelect(&$form, $maj,&$db,$debug) { |
348 |
|
parent::setSelect($form, $maj,$db,$debug); |
349 |
//optimisation sur table importante parcelle -> pas d appel methode parent |
//optimisation sur table importante parcelle -> pas d appel methode parent |
350 |
if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc.php")) |
if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc.php")) |
351 |
include ("../sql/".$db->phptype."/".$this->table.".form.inc.php"); |
include ("../sql/".$db->phptype."/".$this->table.".form.inc.php"); |
372 |
} |
} |
373 |
$form->setSelect("travaux",$contenu); |
$form->setSelect("travaux",$contenu); |
374 |
|
|
|
//// instructeur |
|
|
$contenu=array(); |
|
|
$res = $db->query($sql_instructeur); |
|
|
if (database::isError($res)) die($res->getMessage().$sql_instructeur); |
|
|
$this->addToLog(" la requete ".$sql_instructeur." est executee", VERBOSE_MODE); |
|
|
$contenu[0][0]=""; |
|
|
$contenu[1][0]=_('choisir')." "._('instructeur'); |
|
|
$k=1; |
|
|
while ($row=& $res->fetchRow()){ |
|
|
$contenu[0][$k]=$row[0]; |
|
|
$contenu[1][$k]=$row[1]; |
|
|
$k++; |
|
|
} |
|
|
$form->setSelect("instructeur",$contenu); |
|
|
|
|
|
// demandeur et delegataire civilite |
|
|
$contenu=array(); |
|
|
$res = $db->query($sql_civilite); |
|
|
if (database::isError($res)) die($res->getMessage().$sql_); |
|
|
$this->addToLog(" la requete ".$sql_civilite." est executee", VERBOSE_MODE); |
|
|
$contenu[0][0]=""; |
|
|
$contenu[1][0]=_('choisir')." "._('civilite'); |
|
|
$k=1; |
|
|
while ($row=& $res->fetchRow()){ |
|
|
$contenu[0][$k]=$row[0]; |
|
|
$contenu[1][$k]=$row[1]; |
|
|
$k++; |
|
|
} |
|
|
$form->setSelect("demandeur_civilite",$contenu); |
|
|
$form->setSelect("delegataire_civilite",$contenu); |
|
|
|
|
|
// demandeur categorie |
|
|
$contenu=array(); |
|
|
$res = $db->query($sql_categorie_demandeur); |
|
|
if (database::isError($res)) die($res->getMessage().$sql_categorie_demandeur); |
|
|
$this->addToLog(" la requete ".$sql_categorie_demandeur." est executee", VERBOSE_MODE); |
|
|
$contenu[0][0]=""; |
|
|
$contenu[1][0]=_('choisir')." "._('categorie'); |
|
|
$k=1; |
|
|
while ($row=& $res->fetchRow()){ |
|
|
$contenu[0][$k]=$row[0]; |
|
|
$contenu[1][$k]=$row[1]; |
|
|
$k++; |
|
|
} |
|
|
$form->setSelect("demandeur_categorie",$contenu); |
|
|
|
|
|
// pos |
|
|
$contenu=array(); |
|
|
$res = $db->query($sql_pos); |
|
|
if (database::isError($res)) die($res->getMessage().$sql_pos); |
|
|
$this->addToLog(" la requete ".$sql_pos." est executee", VERBOSE_MODE); |
|
|
$contenu[0][0]=""; |
|
|
$contenu[1][0]=_('choisir')." "._('pos'); |
|
|
$k=1; |
|
|
while ($row=& $res->fetchRow()){ |
|
|
$contenu[0][$k]=$row[0]; |
|
|
$contenu[1][$k]=$row[1]; |
|
|
$k++; |
|
|
} |
|
|
$form->setSelect("pos",$contenu); |
|
|
|
|
375 |
// code et libelle voie |
// code et libelle voie |
376 |
$contenu=""; |
$contenu=""; |
377 |
$contenu[0][0]="rivoli";// table |
$contenu[0][0]="rivoli";// table |
416 |
$contenu=array(); |
$contenu=array(); |
417 |
$contenu[0]=array('Non','Oui'); |
$contenu[0]=array('Non','Oui'); |
418 |
$contenu[1]=array('Non','Oui'); |
$contenu[1]=array('Non','Oui'); |
|
$form->setSelect("etat",$contenu); |
|
419 |
$form->setSelect("accord_tacite",$contenu); |
$form->setSelect("accord_tacite",$contenu); |
420 |
// terrain_numero_complement |
// terrain_numero_complement |
421 |
$contenu=array(); |
$contenu=array(); |
422 |
$contenu[0]=array('','bis','ter','quater'); |
$contenu[0]=array('','bis','ter','quater'); |
423 |
$contenu[1]=array('','bis','ter','quater'); |
$contenu[1]=array('','bis','ter','quater'); |
424 |
$form->setSelect("terrain_numero_complement",$contenu); |
$form->setSelect("terrain_numero_complement",$contenu); |
425 |
|
// 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 |
|
/* |
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 |
|
} |
451 |
|
if($this->f->getParameter('afficher_division')==='true') { |
452 |
|
// instructeur |
453 |
|
$this->init_select($form, $db, $maj, $debug, "instructeur", |
454 |
|
$sql_instructeur_div, $sql_instructeur_div_by_id, false); |
455 |
} |
} |
456 |
} |
} |
457 |
|
|
458 |
|
function setLib(&$form,$maj) { |
459 |
|
parent::setLib($form,$maj); |
460 |
|
$form->setLib('geom',''); |
461 |
|
} |
462 |
|
|
463 |
function setGroupe(&$form,$maj){ |
function setGroupe(&$form,$maj){ |
464 |
If ($maj==0){ |
//If ($maj==0){ |
465 |
$form->setGroupe('date_demande','D'); |
// $form->setGroupe('date_demande','D'); |
466 |
$form->setGroupe('date_depot','G'); |
// $form->setGroupe('date_depot','G'); |
467 |
$form->setGroupe('instructeur','F'); |
// $form->setGroupe('division','F'); |
468 |
}else{ |
//}else{ |
469 |
$form->setGroupe('dossier','D'); |
// $form->setGroupe('dossier','D'); |
470 |
$form->setGroupe('nature','G'); |
// $form->setGroupe('nature','G'); |
471 |
$form->setGroupe('annee','G'); |
// $form->setGroupe('annee','G'); |
472 |
$form->setGroupe('date_demande','G'); |
// $form->setGroupe('date_demande','G'); |
473 |
$form->setGroupe('date_depot','G'); |
// $form->setGroupe('date_depot','G'); |
474 |
$form->setGroupe('instructeur','F'); |
// $form->setGroupe('division','F'); |
475 |
} |
//} |
476 |
$form->setGroupe('demandeur_categorie','D'); |
$form->setGroupe('demandeur_categorie','D'); |
477 |
$form->setGroupe('demandeur_civilite','G'); |
$form->setGroupe('demandeur_civilite','G'); |
478 |
$form->setGroupe('demandeur_nom','F'); |
$form->setGroupe('demandeur_nom','F'); |
503 |
$form->setGroupe('delegataire_telephone','F'); |
$form->setGroupe('delegataire_telephone','F'); |
504 |
|
|
505 |
$form->setGroupe('architecte','D'); |
$form->setGroupe('architecte','D'); |
506 |
$form->setGroupe('architecte_nom','G'); |
$form->setGroupe('architecte_nom','F'); |
507 |
$form->setGroupe('saisie_architecte','F'); |
//$form->setGroupe('saisie_architecte','F'); |
508 |
|
|
509 |
$form->setGroupe('travaux','D'); |
$form->setGroupe('travaux','D'); |
510 |
$form->setGroupe('travaux_complement','F'); |
$form->setGroupe('travaux_complement','F'); |
535 |
$form->setGroupe('etat','F'); |
$form->setGroupe('etat','F'); |
536 |
|
|
537 |
$form->setGroupe('date_decision','D'); |
$form->setGroupe('date_decision','D'); |
538 |
$form->setGroupe('avis','G'); |
$form->setGroupe('avis_decision','G'); |
539 |
$form->setGroupe('date_validite','G'); |
$form->setGroupe('date_validite','G'); |
540 |
$form->setGroupe('types','F'); |
$form->setGroupe('types','F'); |
541 |
|
|
546 |
// localisation |
// localisation |
547 |
$form->setGroupe('parcelle','D'); |
$form->setGroupe('parcelle','D'); |
548 |
$form->setGroupe('pos','G'); |
$form->setGroupe('pos','G'); |
549 |
$form->setGroupe('sig','F'); |
if($maj==1){ |
550 |
|
$form->setGroupe('sig','G'); |
551 |
|
$form->setGroupe('geom','F'); |
552 |
|
}else { |
553 |
|
$form->setGroupe('sig','F'); |
554 |
|
} |
555 |
|
if($maj==1){ |
556 |
|
$form->setGroupe('sig','G'); |
557 |
|
$form->setGroupe('geom','F'); |
558 |
|
} |
559 |
|
|
560 |
// description |
// description |
561 |
$form->setGroupe('batiment_nombre','D'); |
$form->setGroupe('batiment_nombre','D'); |
562 |
$form->setGroupe('logement_nombre','G'); |
$form->setGroupe('logement_nombre','G'); |
588 |
$form->setOnchange('terrain_surface','VerifNumdec(this)'); |
$form->setOnchange('terrain_surface','VerifNumdec(this)'); |
589 |
} |
} |
590 |
|
|
591 |
function setRegroupe(&$form,$maj){ |
function setLayout(&$form, $maj) { |
592 |
// depot |
// |
593 |
If ($maj==0){ |
$form->setBloc('dossier', 'D', '', ($maj == 3 ? 'col_9':'col_12')); |
594 |
$form->setRegroupe('date_demande','D',_("Depot"),$this->aff_depot ); |
$form->setBloc('dossier', 'D', '', 'col_9'); |
595 |
} |
$form->setFieldset('dossier', 'D', _("Dossier d'instruction")); |
596 |
If ($maj==1){ |
$form->setFieldset('autorite_competente', 'F'); |
597 |
$form->setRegroupe('dossier','D',_("Depot"), $this->aff_depot); |
$form->setBloc('autorite_competente', 'F'); |
598 |
$form->setRegroupe('date_demande','G',''); |
$form->setBloc('date_demande', 'D', '', 'col_3'); |
599 |
} |
$form->setFieldset('date_demande', 'D', _("Depot")); |
600 |
$form->setRegroupe('date_depot','G',''); |
$form->setFieldset('date_depot', 'F'); |
601 |
$form->setRegroupe('instructeur','F',''); |
$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 |
|
} |
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 |
// travaux |
// travaux |
628 |
$form->setRegroupe('architecte','D',_('Architecte')." / "._("Travaux"), $this->aff_travaux); |
$form->setRegroupe('architecte','D',_('Architecte')." / "._("Travaux"), $this->aff_travaux); |
629 |
$form->setRegroupe('architecte_nom','G',''); |
$form->setRegroupe('architecte_nom','G',''); |
630 |
$form->setRegroupe('travaux','G',''); |
$form->setRegroupe('travaux','G',''); |
631 |
$form->setRegroupe('travaux_complement','F',''); |
$form->setRegroupe('travaux_complement','F',''); |
632 |
|
|
633 |
// instruction |
//// instruction |
634 |
$form->setRegroupe('date_complet','D',_('Instruction'), $this->aff_instruction); |
//$form->setRegroupe('date_complet','D',_('Instruction'), $this->aff_instruction); |
635 |
$form->setRegroupe('date_rejet','G',''); |
//$form->setRegroupe('date_rejet','G',''); |
636 |
$form->setRegroupe('date_notification_delai','G',''); |
//$form->setRegroupe('date_notification_delai','G',''); |
637 |
$form->setRegroupe('delai','G',''); |
//$form->setRegroupe('delai','G',''); |
638 |
$form->setRegroupe('date_limite','G','Decision '); |
//$form->setRegroupe('date_limite','G','Decision '); |
639 |
$form->setRegroupe('accord_tacite','G',''); |
//$form->setRegroupe('accord_tacite','G',''); |
640 |
$form->setRegroupe('etat','G',''); |
//$form->setRegroupe('etat','G',''); |
641 |
$form->setRegroupe('date_decision','G',''); |
//$form->setRegroupe('date_decision','G',''); |
642 |
$form->setRegroupe('avis','G',''); |
//$form->setRegroupe('avis_decision','G',''); |
643 |
$form->setRegroupe('date_validite','G',''); |
//$form->setRegroupe('date_validite','G',''); |
644 |
$form->setRegroupe('types','G',''); |
//$form->setRegroupe('types','G',''); |
645 |
$form->setRegroupe('date_chantier','G',''); |
//$form->setRegroupe('date_chantier','G',''); |
646 |
$form->setRegroupe('date_achevement','G',''); |
//$form->setRegroupe('date_achevement','G',''); |
647 |
$form->setRegroupe('date_conformite','F',''); |
//$form->setRegroupe('date_conformite','F',''); |
648 |
|
|
649 |
// demandeur |
// demandeur |
650 |
$form->setRegroupe('demandeur_categorie','D',_('Demandeur'), $this->aff_demandeur); |
$form->setRegroupe('demandeur_categorie','D',_('Demandeur'), $this->aff_demandeur); |
686 |
$form->setRegroupe('parcelle','D',_('localisation'), $this->aff_localisation); |
$form->setRegroupe('parcelle','D',_('localisation'), $this->aff_localisation); |
687 |
$form->setRegroupe('pos','G',''); |
$form->setRegroupe('pos','G',''); |
688 |
$form->setRegroupe('sig','F',''); |
$form->setRegroupe('sig','F',''); |
689 |
|
if($maj==1){ |
690 |
|
$form->setRegroupe('sig','G',''); |
691 |
|
$form->setRegroupe('geom','F',''); |
692 |
|
} |
693 |
|
|
694 |
// description |
// description |
695 |
$form->setRegroupe('batiment_nombre','D',_('statistique'), $this->aff_description); |
$form->setRegroupe('batiment_nombre','D',_('statistique'), $this->aff_description); |
708 |
$form->setRegroupe('amenagement','D',_('Amenagement'), $this->aff_amenagement); |
$form->setRegroupe('amenagement','D',_('Amenagement'), $this->aff_amenagement); |
709 |
$form->setRegroupe('parcelle_lot','G',''); |
$form->setRegroupe('parcelle_lot','G',''); |
710 |
$form->setRegroupe('parcelle_lot_lotissement','F',''); |
$form->setRegroupe('parcelle_lot_lotissement','F',''); |
|
|
|
|
|
|
|
// temp |
|
711 |
} |
} |
712 |
|
|
713 |
|
|
714 |
|
|
715 |
/* ============================================================= |
/* ============================================================= |
716 |
* fonction trigger relative a la connexion SIG |
* fonction trigger relative a la connexion SIG |
722 |
$this->sig_parametre($db); |
$this->sig_parametre($db); |
723 |
$id=$this->valF['dossier']; // id n est pas valorise en ajout |
$id=$this->valF['dossier']; // id n est pas valorise en ajout |
724 |
if($this->sig==1 and $val['sig']!='Oui'){ |
if($this->sig==1 and $val['sig']!='Oui'){ |
725 |
if($val['parcelle']!=''or $val['parcelle_lot']!='') |
if($val['parcelle']!=''or $val['parcelle_lot']!=''){ |
726 |
$this->sig_interne($id,&$db,$val,$DEBUG); |
|
727 |
|
$this->sig_interne($id,$db,$val,$DEBUG); |
728 |
|
} |
729 |
else |
else |
730 |
$this->addToMessage("<br>"._("Parcelle non renseignee dans dossier")." ".$id." <br>"); |
$this->addToMessage("<br>"._("Parcelle non renseignee dans dossier")." ".$id." <br>"); |
731 |
|
|
732 |
} |
} |
733 |
} |
} |
734 |
|
|
735 |
|
/* |
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 |
|
$quartier = ''; |
742 |
|
|
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 |
|
if ( $res->numRows() > 0 ){ |
765 |
|
|
766 |
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
767 |
|
|
768 |
|
$quartier = $row['quartier']; |
769 |
|
$arrondissement = $row['arrondissement']; |
770 |
|
} |
771 |
|
} |
772 |
|
} |
773 |
|
} |
774 |
|
|
775 |
|
/* |
776 |
|
* Retourne la section d'une parcelle |
777 |
|
* */ |
778 |
|
function getSection($parcelle){ |
779 |
|
|
780 |
|
$parcelle = trim($parcelle); |
781 |
|
$section = NULL; |
782 |
|
|
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 |
|
|
790 |
|
/* |
791 |
|
* Retourne l'intructeur correspondant le mieux à la parcelle |
792 |
|
* */ |
793 |
|
function getInstructeur( $quartier, $arrondissement, $section, $nature, &$db, &$division) { |
794 |
|
|
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 |
|
|
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 |
|
return $row['instructeur']; |
839 |
|
} |
840 |
|
|
841 |
|
return NULL; |
842 |
|
} |
843 |
|
|
844 |
|
/* ============================================================= |
845 |
|
* fonction trigger relative a la connexion SIG |
846 |
|
* $sig = 1 dans dyn/var.inc |
847 |
|
* =============================================================== |
848 |
|
*/ |
849 |
|
|
850 |
|
function triggerajouter($id,&$db,$val,$DEBUG) { |
851 |
|
// |
852 |
|
$this->addToLog("triggerajouter() : start", EXTRA_VERBOSE_MODE); |
853 |
|
|
854 |
|
// Initialisation des variables nécessaires à l'affectation automatique |
855 |
|
$quartier = 'NULL'; |
856 |
|
$arrondissement = 'NULL'; |
857 |
|
$section = 'NULL' ; |
858 |
|
|
859 |
|
// Si la parcelle n'est pas vide alors on récupère la section, le |
860 |
|
// quartier et l'arrondissement |
861 |
|
if ($val['parcelle'] != '') { |
862 |
|
// Cette méthode modifie les variables $quartier et $arrondissement |
863 |
|
$this->getQuartierArrondissement($val['parcelle'], $quartier, $arrondissement, $db); |
864 |
|
// Si il n'y a pas d'arrondissement alors on on vide le quartier |
865 |
|
if ( strcmp($arrondissement,'NULL') == 0 ) { |
866 |
|
$quartier = 'NULL'; |
867 |
|
} |
868 |
|
// On récupère la section |
869 |
|
$section = $this->getSection($val['parcelle']); |
870 |
|
} |
871 |
|
|
872 |
|
// Si aucun instructeur n'est saisi et que la nature n'est pas vide |
873 |
|
// alors on récupère l'instructeur et la division depuis l'affectation |
874 |
|
if ( ( empty($this->valF['instructeur']) || $this->valF['instructeur'] == '' ) && $val['nature'] != '' ) { |
875 |
|
// |
876 |
|
$division = ''; |
877 |
|
// |
878 |
|
$instructeur = $this->getInstructeur($quartier, $arrondissement, $section, $val['nature'], $db, $division); |
879 |
|
|
880 |
|
if ( $instructeur != NULL ){ |
881 |
|
$this->valF['instructeur'] = $instructeur; |
882 |
|
$this->valF['division'] = $division; |
883 |
|
} else { |
884 |
|
if ($this->f->isAccredited("dossier_modifier_instructeur")) { |
885 |
|
$this->addToMessage("<br/> "._("Pensez a assigner un instructeur a ce dossier.")." <br/>"); |
886 |
|
} else { |
887 |
|
$this->addToMessage("<br/> "._("Aucun instructeur compatible avec ce dossier trouve, contactez votre administrateur afin d'en assigner un a ce dossier.")." <br/>"); |
888 |
|
} |
889 |
|
} |
890 |
|
} else { |
891 |
|
$this->addToMessage("<br/> "._("Aucun instructeur compatible avec ce dossier trouve, contactez votre administrateur afin d'en assigner un a ce dossier.")." <br/>"); |
892 |
|
} |
893 |
|
// |
894 |
|
$this->addToLog("triggerajouter() : end", EXTRA_VERBOSE_MODE); |
895 |
|
} |
896 |
|
|
897 |
function triggermodifierapres($id,&$db,$val,$DEBUG) { |
function triggermodifierapres($id,&$db,$val,$DEBUG) { |
898 |
$this->sig_parametre($db); |
$this->sig_parametre($db); |
900 |
if(($this->sig==1 and $val['sig']!='Oui' and ($val['parcelle']!=$val['parcelle_archive']) |
if(($this->sig==1 and $val['sig']!='Oui' and ($val['parcelle']!=$val['parcelle_archive']) |
901 |
or $val['parcelle_lot']!=$val['parcelle_lot_archive'])){ // parcelle_lot_archive |
or $val['parcelle_lot']!=$val['parcelle_lot_archive'])){ // parcelle_lot_archive |
902 |
if($val['parcelle']!='' or $val['parcelle_lot']!='') |
if($val['parcelle']!='' or $val['parcelle_lot']!='') |
903 |
$this->sig_interne($this->valF['dossier'],&$db,$val,$DEBUG); |
$this->sig_interne($this->valF['dossier'],$db,$val,$DEBUG); |
904 |
else{ |
else{ |
905 |
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 |
906 |
$sql ="update ".DB_PREFIXE."dossier set geom = null, servitude = '', pos= '' where dossier ='".$id."'"; |
$sql ="update ".DB_PREFIXE."dossier set geom = null, servitude = '', pos= '' where dossier ='".$id."'"; |
1002 |
if (database :: isError($res)) |
if (database :: isError($res)) |
1003 |
die($res->getMessage()."erreur ".$sql); |
die($res->getMessage()."erreur ".$sql); |
1004 |
} |
} |
1005 |
$this->addToMessage("<br> parcelle ".$parcelle." "._("inexistante")." ".$id.""); |
//$this->addToMessage("<br> parcelle ".$parcelle." "._("inexistante")." ".$id.""); |
1006 |
} |
} |
1007 |
} |
} |
1008 |
|
|
1058 |
$this->servitude.=" [".$row['libelle']."] ".$row['observation']." a ".round($row['distance'],2)." m - "; |
$this->servitude.=" [".$row['libelle']."] ".$row['observation']." a ".round($row['distance'],2)." m - "; |
1059 |
} |
} |
1060 |
} |
} |
|
|
|
|
|
|
1061 |
}// fin classe |
}// fin classe |
1062 |
?> |
?> |