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 { |
16 |
var $auto_parcelle; |
var $auto_parcelle; |
17 |
var $auto_parcelle_lot; |
var $auto_parcelle_lot; |
18 |
|
|
19 |
|
function setValFAjout($val = array()) { |
20 |
|
// Cle primaire |
21 |
|
$lettre=$this->f->collectivite["lettre"]; |
22 |
|
$numero_unique = $this->f->collectivite["numero_unique"]; |
23 |
|
if($numero_unique==1){ |
24 |
|
// numero unique (voir dyn/var.inc) |
25 |
|
$temp=$this->$db->nextId(DB_PREFIXE.$this->table); |
26 |
|
}else{ |
27 |
|
// numero suivant nature |
28 |
|
$temp=$this->db->nextId(DB_PREFIXE."dossier_".$this->nature); |
29 |
|
} |
30 |
|
$temp=str_pad($temp,4,"0", STR_PAD_LEFT); |
31 |
|
$this->valF['dossier'] = $this->valF['nature'].$this->valF['annee']. |
32 |
|
$lettre.$temp; |
33 |
|
} |
34 |
|
|
35 |
function setvalF($val){ |
function setvalF($val){ |
36 |
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']); |
|
37 |
// 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 |
38 |
// $sig = 1 |
// $sig = 1 |
39 |
unset ($this->valF['geom']); |
unset ($this->valF['geom']); |
40 |
|
unset ($this->valF['geom1']); |
41 |
// valeurs hiddenstatic (calcule) |
// valeurs hiddenstatic (calcule) |
42 |
if($this->maj==1){ |
if($this->maj==1){ |
43 |
// par defaut |
// par defaut |
57 |
unset ($this->valF['date_validite']); |
unset ($this->valF['date_validite']); |
58 |
unset ($this->valF['date_chantier']); |
unset ($this->valF['date_chantier']); |
59 |
unset ($this->valF['date_achevement']); |
unset ($this->valF['date_achevement']); |
60 |
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(){ |
|
61 |
} |
} |
62 |
|
|
63 |
function verifier($val,&$db,$DEBUG){ |
function verifier($val,&$db,$DEBUG){ |
64 |
$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"); |
|
|
} |
|
65 |
if($val['parcelle']!="" and $val['sig']!='Oui'){ |
if($val['parcelle']!="" and $val['sig']!='Oui'){ |
66 |
if (!preg_match('/^[A-Z]{2}[0-9]{4}$/', $val['parcelle'])){ |
if (!preg_match('/^[A-Z0-9]{1}[A-Z]{1}[0-9]{4}$/', $val['parcelle'])){ |
67 |
$this->correct=false; |
$this->correct=false; |
68 |
$this->addToMessage("<br>format parcelle AANNNN"); |
$this->addToMessage("<br>format parcelle AANNNN"); |
69 |
} |
} |
187 |
|
|
188 |
|
|
189 |
function setType(&$form,$maj) { |
function setType(&$form,$maj) { |
190 |
//parent::setType($form,$maj); |
parent::setType($form,$maj); |
191 |
if ($maj < 2) { //ajouter et modifier |
if ($maj < 2) { //ajouter et modifier |
192 |
// cache |
// cache |
193 |
if($maj==0) $form->setType('dossier', 'hidden'); |
if($maj==0) $form->setType('dossier', 'hidden'); |
199 |
$form->setType('amenagement','hidden'); // PC |
$form->setType('amenagement','hidden'); // PC |
200 |
$form->setType('parcelle_lot','hidden'); // PC |
$form->setType('parcelle_lot','hidden'); // PC |
201 |
$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'); |
|
202 |
|
|
203 |
|
$form->setType('geom1', 'hidden'); |
204 |
|
$form->setType('geom', 'geom'); |
205 |
|
$form->setType('servitude', 'hiddenstatic'); |
206 |
|
|
207 |
//select |
//select |
208 |
$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'); |
|
|
|
|
209 |
|
|
210 |
// combo |
// combo |
211 |
$form->setType('rivoli','comboD'); |
$form->setType('rivoli','comboD'); |
263 |
$form->setType('temp3',$temp3_type); |
$form->setType('temp3',$temp3_type); |
264 |
$form->setType('temp4',$temp4_type); |
$form->setType('temp4',$temp4_type); |
265 |
$form->setType('temp5',$temp5_type); |
$form->setType('temp5',$temp5_type); |
266 |
}else{ // supprimer |
} |
267 |
$form->setType('dossier', 'hiddenstatic'); |
if($maj == 3) { |
268 |
$form->setType('sig', 'hiddenstatic'); |
$form->setType('annee', 'hidden'); |
269 |
|
$form->setType('nature', 'hidden'); |
270 |
|
$form->setType('temp1','hidden'); |
271 |
|
$form->setType('temp2','hidden'); |
272 |
|
$form->setType('temp3','hidden'); |
273 |
|
$form->setType('temp4','hidden'); |
274 |
|
$form->setType('temp5','hidden'); |
275 |
|
$form->setType('parcelle_archive','hidden'); |
276 |
|
$form->setType('parcelle_lot_archive','hidden'); |
277 |
|
$form->setType('geom1','hidden'); |
278 |
} |
} |
279 |
} |
} |
280 |
|
|
282 |
$this->maj=$maj; |
$this->maj=$maj; |
283 |
if ($validation==0) { |
if ($validation==0) { |
284 |
if ($maj == 0){ |
if ($maj == 0){ |
285 |
include ("../dyn/var.inc"); |
$dossier_cp = $this->f->collectivite["cp"]; |
286 |
|
$dossier_ville = $this->f->collectivite["ville"]; |
287 |
$form->setVal('nature', $this->nature); |
$form->setVal('nature', $this->nature); |
288 |
|
|
289 |
$form->setVal('annee', date('y')); |
$form->setVal('annee', date('y')); |
302 |
$form->setVal('accord_tacite', 'Non'); |
$form->setVal('accord_tacite', 'Non'); |
303 |
$form->setVal('etat', 'initialiser'); |
$form->setVal('etat', 'initialiser'); |
304 |
$form->setVal('types', 'Initial'); |
$form->setVal('types', 'Initial'); |
305 |
} |
} |
306 |
} |
} |
307 |
} |
} |
308 |
|
|
309 |
function setSelect(&$form, $maj,&$db,$debug) { |
function setSelect(&$form, $maj,&$db,$debug) { |
310 |
|
parent::setSelect($form, $maj,$db,$debug); |
311 |
//optimisation sur table importante parcelle -> pas d appel methode parent |
//optimisation sur table importante parcelle -> pas d appel methode parent |
312 |
if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc.php")) |
if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc.php")) |
313 |
include ("../sql/".$db->phptype."/".$this->table.".form.inc.php"); |
include ("../sql/".$db->phptype."/".$this->table.".form.inc.php"); |
334 |
} |
} |
335 |
$form->setSelect("travaux",$contenu); |
$form->setSelect("travaux",$contenu); |
336 |
|
|
|
//// 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); |
|
|
|
|
337 |
// code et libelle voie |
// code et libelle voie |
338 |
$contenu=""; |
$contenu=""; |
339 |
$contenu[0][0]="rivoli";// table |
$contenu[0][0]="rivoli";// table |
385 |
$contenu[0]=array('','bis','ter','quater'); |
$contenu[0]=array('','bis','ter','quater'); |
386 |
$contenu[1]=array('','bis','ter','quater'); |
$contenu[1]=array('','bis','ter','quater'); |
387 |
$form->setSelect("terrain_numero_complement",$contenu); |
$form->setSelect("terrain_numero_complement",$contenu); |
388 |
|
// geom *** a voir |
389 |
|
if($maj==1){ //modification |
390 |
|
$contenu=array(); |
391 |
|
$contenu[0]=array("dossier",$this->getParameter("idx")); |
392 |
|
$form->setSelect('geom',$contenu); |
393 |
|
} |
394 |
|
|
395 |
} |
} |
396 |
} |
} |
397 |
|
|
398 |
|
function setLib(&$form,$maj) { |
399 |
|
parent::setLib($form,$maj); |
400 |
|
$form->setLib('geom',''); |
401 |
|
} |
402 |
|
|
403 |
function setGroupe(&$form,$maj){ |
function setGroupe(&$form,$maj){ |
404 |
If ($maj==0){ |
If ($maj==0){ |
405 |
$form->setGroupe('date_demande','D'); |
$form->setGroupe('date_demande','D'); |
486 |
// localisation |
// localisation |
487 |
$form->setGroupe('parcelle','D'); |
$form->setGroupe('parcelle','D'); |
488 |
$form->setGroupe('pos','G'); |
$form->setGroupe('pos','G'); |
489 |
$form->setGroupe('sig','F'); |
if($maj==1){ |
490 |
|
$form->setGroupe('sig','G'); |
491 |
|
$form->setGroupe('geom','F'); |
492 |
|
}else { |
493 |
|
$form->setGroupe('sig','F'); |
494 |
|
} |
495 |
|
if($maj==1){ |
496 |
|
$form->setGroupe('sig','G'); |
497 |
|
$form->setGroupe('geom','F'); |
498 |
|
} |
499 |
|
|
500 |
// description |
// description |
501 |
$form->setGroupe('batiment_nombre','D'); |
$form->setGroupe('batiment_nombre','D'); |
502 |
$form->setGroupe('logement_nombre','G'); |
$form->setGroupe('logement_nombre','G'); |
602 |
$form->setRegroupe('parcelle','D',_('localisation'), $this->aff_localisation); |
$form->setRegroupe('parcelle','D',_('localisation'), $this->aff_localisation); |
603 |
$form->setRegroupe('pos','G',''); |
$form->setRegroupe('pos','G',''); |
604 |
$form->setRegroupe('sig','F',''); |
$form->setRegroupe('sig','F',''); |
605 |
|
if($maj==1){ |
606 |
|
$form->setRegroupe('sig','G',''); |
607 |
|
$form->setRegroupe('geom','F',''); |
608 |
|
} |
609 |
|
|
610 |
// description |
// description |
611 |
$form->setRegroupe('batiment_nombre','D',_('statistique'), $this->aff_description); |
$form->setRegroupe('batiment_nombre','D',_('statistique'), $this->aff_description); |
624 |
$form->setRegroupe('amenagement','D',_('Amenagement'), $this->aff_amenagement); |
$form->setRegroupe('amenagement','D',_('Amenagement'), $this->aff_amenagement); |
625 |
$form->setRegroupe('parcelle_lot','G',''); |
$form->setRegroupe('parcelle_lot','G',''); |
626 |
$form->setRegroupe('parcelle_lot_lotissement','F',''); |
$form->setRegroupe('parcelle_lot_lotissement','F',''); |
|
|
|
|
|
|
|
// temp |
|
627 |
} |
} |
628 |
|
|
|
|
|
|
|
|
629 |
/* ============================================================= |
/* ============================================================= |
630 |
* fonction trigger relative a la connexion SIG |
* fonction trigger relative a la connexion SIG |
631 |
* $sig = 1 dans dyn/var.inc |
* $sig = 1 dans dyn/var.inc |
637 |
$id=$this->valF['dossier']; // id n est pas valorise en ajout |
$id=$this->valF['dossier']; // id n est pas valorise en ajout |
638 |
if($this->sig==1 and $val['sig']!='Oui'){ |
if($this->sig==1 and $val['sig']!='Oui'){ |
639 |
if($val['parcelle']!=''or $val['parcelle_lot']!='') |
if($val['parcelle']!=''or $val['parcelle_lot']!='') |
640 |
$this->sig_interne($id,&$db,$val,$DEBUG); |
$this->sig_interne($id,$db,$val,$DEBUG); |
641 |
else |
else |
642 |
$this->addToMessage("<br>"._("Parcelle non renseignee dans dossier")." ".$id." <br>"); |
$this->addToMessage("<br>"._("Parcelle non renseignee dans dossier")." ".$id." <br>"); |
643 |
} |
} |
649 |
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']) |
650 |
or $val['parcelle_lot']!=$val['parcelle_lot_archive'])){ // parcelle_lot_archive |
or $val['parcelle_lot']!=$val['parcelle_lot_archive'])){ // parcelle_lot_archive |
651 |
if($val['parcelle']!='' or $val['parcelle_lot']!='') |
if($val['parcelle']!='' or $val['parcelle_lot']!='') |
652 |
$this->sig_interne($this->valF['dossier'],&$db,$val,$DEBUG); |
$this->sig_interne($this->valF['dossier'],$db,$val,$DEBUG); |
653 |
else{ |
else{ |
654 |
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 |
655 |
$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."'"; |