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()) { |
function setValFAjout($val = array()) { |
33 |
// Cle primaire |
// Cle primaire |
38 |
$temp=$this->$db->nextId(DB_PREFIXE.$this->table); |
$temp=$this->$db->nextId(DB_PREFIXE.$this->table); |
39 |
}else{ |
}else{ |
40 |
// numero suivant nature |
// numero suivant nature |
41 |
$temp=$this->db->nextId(DB_PREFIXE."dossier_".$this->nature); |
$temp=$this->db->nextId(DB_PREFIXE."dossier_".$val['nature']); |
42 |
} |
} |
43 |
$temp=str_pad($temp,4,"0", STR_PAD_LEFT); |
$temp=str_pad($temp,4,"0", STR_PAD_LEFT); |
44 |
$this->valF['dossier'] = $this->valF['nature'].$this->valF['annee']. |
$this->valF['dossier'] = $this->valF['nature'].$this->valF['annee']. |
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']); |
76 |
function verifier($val,&$db,$DEBUG){ |
function verifier($val,&$db,$DEBUG){ |
77 |
parent::verifier($val,$db,$DEBUG); |
parent::verifier($val,$db,$DEBUG); |
78 |
if($val['parcelle']!="" and $val['sig']!='Oui'){ |
if($val['parcelle']!="" and $val['sig']!='Oui'){ |
79 |
if (!preg_match('/^[A-Z0-9]{1}[A-Z]{1}[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 |
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 |
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'); |
279 |
} |
} |
280 |
if($maj == 3) { |
if($maj == 3) { |
281 |
$form->setType('annee', 'hidden'); |
$form->setType('annee', 'hidden'); |
282 |
$form->setType('nature', 'hidden'); |
$form->setType('nature', 'selectstatic'); |
283 |
$form->setType('temp1','hidden'); |
$form->setType('temp1','hidden'); |
284 |
$form->setType('temp2','hidden'); |
$form->setType('temp2','hidden'); |
285 |
$form->setType('temp3','hidden'); |
$form->setType('temp3','hidden'); |
288 |
$form->setType('parcelle_archive','hidden'); |
$form->setType('parcelle_archive','hidden'); |
289 |
$form->setType('parcelle_lot_archive','hidden'); |
$form->setType('parcelle_lot_archive','hidden'); |
290 |
$form->setType('geom1','hidden'); |
$form->setType('geom1','hidden'); |
291 |
|
$form->setType('geom','hidden'); |
292 |
} |
} |
293 |
|
if($this->f->getParameter('afficher_division')==='true') { |
294 |
|
$form->setType('division','hiddenstatic'); |
295 |
|
} else { |
296 |
|
$form->setType('division','hidden'); |
297 |
|
} |
298 |
|
|
299 |
|
/* Gestion des droits pour l'ajout forcé d'un instructeur, si le profil est 5, c'est un administrateur */ |
300 |
|
if ( !$this->f->isAccredited("dossier_modifier_instructeur") ) |
301 |
|
$form->setType('instructeur', 'hidden'); |
302 |
} |
} |
303 |
|
|
304 |
function setVal(&$form,$maj,$validation){ |
function setVal(&$form,$maj,$validation){ |
305 |
$this->maj=$maj; |
$this->maj=$maj; |
306 |
if ($validation==0) { |
if ($validation==0) { |
307 |
if ($maj == 0){ |
if ($maj == 0){ |
308 |
$dossier_cp = $this->f->collectivite["cp"]; |
//$dossier_cp = $this->f->collectivite["cp"]; |
309 |
$dossier_ville = $this->f->collectivite["ville"]; |
//$dossier_ville = $this->f->collectivite["ville"]; |
310 |
$form->setVal('nature', $this->nature); |
//$form->setVal('nature', $this->nature); |
311 |
|
|
312 |
$form->setVal('annee', date('y')); |
$form->setVal('annee', date('y')); |
313 |
$form->setVal('date_demande', date('Y-m-d')); |
$form->setVal('date_demande', date('Y-m-d')); |
314 |
$form->setVal('date_depot', date('Y-m-d')); |
$form->setVal('date_depot', date('Y-m-d')); |
315 |
|
|
316 |
$form->setVal('demandeur_cp', $dossier_cp); |
//$form->setVal('demandeur_cp', $dossier_cp); |
317 |
$form->setVal('demandeur_ville', $dossier_ville); |
//$form->setVal('demandeur_ville', $dossier_ville); |
318 |
|
|
319 |
$form->setVal('delegataire_cp', $dossier_cp); |
//$form->setVal('delegataire_cp', $dossier_cp); |
320 |
$form->setVal('delegataire_ville', $dossier_ville); |
//$form->setVal('delegataire_ville', $dossier_ville); |
321 |
|
|
322 |
$form->setVal('terrain_cp', $dossier_cp); |
//$form->setVal('terrain_cp', $dossier_cp); |
323 |
$form->setVal('terrain_ville', $dossier_ville); |
//$form->setVal('terrain_ville', $dossier_ville); |
324 |
|
|
325 |
$form->setVal('accord_tacite', 'Non'); |
$form->setVal('accord_tacite', 'Non'); |
326 |
$form->setVal('etat', 'initialiser'); |
$form->setVal('etat', 'initialiser'); |
401 |
$contenu=array(); |
$contenu=array(); |
402 |
$contenu[0]=array('Non','Oui'); |
$contenu[0]=array('Non','Oui'); |
403 |
$contenu[1]=array('Non','Oui'); |
$contenu[1]=array('Non','Oui'); |
|
$form->setSelect("etat",$contenu); |
|
404 |
$form->setSelect("accord_tacite",$contenu); |
$form->setSelect("accord_tacite",$contenu); |
405 |
// terrain_numero_complement |
// terrain_numero_complement |
406 |
$contenu=array(); |
$contenu=array(); |
414 |
$form->setSelect('geom',$contenu); |
$form->setSelect('geom',$contenu); |
415 |
} |
} |
416 |
|
|
417 |
|
/* |
418 |
|
* Affichage de données dans le select de la parcelle |
419 |
|
* */ |
420 |
|
$contenu=array(); |
421 |
|
$sql="select parcelle from ".DB_PREFIXE."parcelle "; |
422 |
|
$res = $db->query($sql); |
423 |
|
if (database::isError($res)) |
424 |
|
die($res->getMessage()); |
425 |
|
$contenu[0][0]=""; |
426 |
|
$contenu[1][0]=_("choisir parcelle"); |
427 |
|
$k=1; |
428 |
|
while ($row=& $res->fetchRow()){ |
429 |
|
$contenu[0][$k]=$row[0]; |
430 |
|
$contenu[1][$k]=$row[0]; |
431 |
|
$k++; |
432 |
|
} |
433 |
|
$form->setSelect("parcelle",$contenu); |
434 |
|
|
435 |
|
} |
436 |
|
if($this->f->getParameter('afficher_division')==='true') { |
437 |
|
// instructeur |
438 |
|
$this->init_select($form, $db, $maj, $debug, "instructeur", |
439 |
|
$sql_instructeur_div, $sql_instructeur_div_by_id, false); |
440 |
} |
} |
441 |
} |
} |
442 |
|
|
449 |
If ($maj==0){ |
If ($maj==0){ |
450 |
$form->setGroupe('date_demande','D'); |
$form->setGroupe('date_demande','D'); |
451 |
$form->setGroupe('date_depot','G'); |
$form->setGroupe('date_depot','G'); |
452 |
$form->setGroupe('instructeur','F'); |
$form->setGroupe('division','F'); |
453 |
}else{ |
}else{ |
454 |
$form->setGroupe('dossier','D'); |
$form->setGroupe('dossier','D'); |
455 |
$form->setGroupe('nature','G'); |
$form->setGroupe('nature','G'); |
456 |
$form->setGroupe('annee','G'); |
$form->setGroupe('annee','G'); |
457 |
$form->setGroupe('date_demande','G'); |
$form->setGroupe('date_demande','G'); |
458 |
$form->setGroupe('date_depot','G'); |
$form->setGroupe('date_depot','G'); |
459 |
$form->setGroupe('instructeur','F'); |
$form->setGroupe('division','F'); |
460 |
} |
} |
461 |
$form->setGroupe('demandeur_categorie','D'); |
$form->setGroupe('demandeur_categorie','D'); |
462 |
$form->setGroupe('demandeur_civilite','G'); |
$form->setGroupe('demandeur_civilite','G'); |
520 |
$form->setGroupe('etat','F'); |
$form->setGroupe('etat','F'); |
521 |
|
|
522 |
$form->setGroupe('date_decision','D'); |
$form->setGroupe('date_decision','D'); |
523 |
$form->setGroupe('avis','G'); |
$form->setGroupe('avis_decision','G'); |
524 |
$form->setGroupe('date_validite','G'); |
$form->setGroupe('date_validite','G'); |
525 |
$form->setGroupe('types','F'); |
$form->setGroupe('types','F'); |
526 |
|
|
583 |
$form->setRegroupe('date_demande','G',''); |
$form->setRegroupe('date_demande','G',''); |
584 |
} |
} |
585 |
$form->setRegroupe('date_depot','G',''); |
$form->setRegroupe('date_depot','G',''); |
586 |
$form->setRegroupe('instructeur','F',''); |
$form->setRegroupe('division','F',''); |
587 |
|
|
588 |
// travaux |
// travaux |
589 |
$form->setRegroupe('architecte','D',_('Architecte')." / "._("Travaux"), $this->aff_travaux); |
$form->setRegroupe('architecte','D',_('Architecte')." / "._("Travaux"), $this->aff_travaux); |
600 |
$form->setRegroupe('accord_tacite','G',''); |
$form->setRegroupe('accord_tacite','G',''); |
601 |
$form->setRegroupe('etat','G',''); |
$form->setRegroupe('etat','G',''); |
602 |
$form->setRegroupe('date_decision','G',''); |
$form->setRegroupe('date_decision','G',''); |
603 |
$form->setRegroupe('avis','G',''); |
$form->setRegroupe('avis_decision','G',''); |
604 |
$form->setRegroupe('date_validite','G',''); |
$form->setRegroupe('date_validite','G',''); |
605 |
$form->setRegroupe('types','G',''); |
$form->setRegroupe('types','G',''); |
606 |
$form->setRegroupe('date_chantier','G',''); |
$form->setRegroupe('date_chantier','G',''); |
671 |
$form->setRegroupe('parcelle_lot_lotissement','F',''); |
$form->setRegroupe('parcelle_lot_lotissement','F',''); |
672 |
} |
} |
673 |
|
|
674 |
|
|
675 |
|
|
676 |
/* ============================================================= |
/* ============================================================= |
677 |
* fonction trigger relative a la connexion SIG |
* fonction trigger relative a la connexion SIG |
678 |
* $sig = 1 dans dyn/var.inc |
* $sig = 1 dans dyn/var.inc |
683 |
$this->sig_parametre($db); |
$this->sig_parametre($db); |
684 |
$id=$this->valF['dossier']; // id n est pas valorise en ajout |
$id=$this->valF['dossier']; // id n est pas valorise en ajout |
685 |
if($this->sig==1 and $val['sig']!='Oui'){ |
if($this->sig==1 and $val['sig']!='Oui'){ |
686 |
if($val['parcelle']!=''or $val['parcelle_lot']!='') |
if($val['parcelle']!=''or $val['parcelle_lot']!=''){ |
687 |
|
|
688 |
$this->sig_interne($id,$db,$val,$DEBUG); |
$this->sig_interne($id,$db,$val,$DEBUG); |
689 |
|
} |
690 |
else |
else |
691 |
$this->addToMessage("<br>"._("Parcelle non renseignee dans dossier")." ".$id." <br>"); |
$this->addToMessage("<br>"._("Parcelle non renseignee dans dossier")." ".$id." <br>"); |
692 |
|
|
693 |
|
} |
694 |
|
} |
695 |
|
|
696 |
|
/* |
697 |
|
* Calcul l'identifiant du quartier et d'un arrondissement d'une parcelle |
698 |
|
* */ |
699 |
|
function getQuartierArrondissement($parcelle, &$quartier, &$arrondissement, &$db) { |
700 |
|
|
701 |
|
$parcelle = trim($parcelle); |
702 |
|
$quartier = ''; |
703 |
|
|
704 |
|
/*Code impots*/ |
705 |
|
for ( $i = 0 ; $i < strlen($parcelle) ; $i++ ) |
706 |
|
if (is_numeric($parcelle[$i]) ) |
707 |
|
$quartier .= $parcelle[$i]; |
708 |
|
else |
709 |
|
break; |
710 |
|
|
711 |
|
if ( $quartier !== '' ){ |
712 |
|
|
713 |
|
/*identifiant*/ |
714 |
|
$sql = "SELECT |
715 |
|
quartier, arrondissement |
716 |
|
FROM |
717 |
|
quartier |
718 |
|
WHERE |
719 |
|
code_impots='$quartier'"; |
720 |
|
|
721 |
|
$res = $db->query($sql); |
722 |
|
if (database :: isError($res)) |
723 |
|
die($res->getMessage()."erreur ".$sql); |
724 |
|
|
725 |
|
if ( $res->numRows() > 0 ){ |
726 |
|
|
727 |
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
728 |
|
|
729 |
|
$quartier = $row['quartier']; |
730 |
|
$arrondissement = $row['arrondissement']; |
731 |
|
} |
732 |
|
} |
733 |
|
} |
734 |
|
} |
735 |
|
|
736 |
|
/* |
737 |
|
* Retourne la section d'une parcelle |
738 |
|
* */ |
739 |
|
function getSection($parcelle){ |
740 |
|
|
741 |
|
$parcelle = trim($parcelle); |
742 |
|
$section = NULL; |
743 |
|
|
744 |
|
for ( $i = 0 ; $i < strlen($parcelle) ; $i++ ) |
745 |
|
if ( !is_numeric($parcelle[$i]) && is_string($parcelle[$i]) && $parcelle[$i] !== ' ' ) |
746 |
|
$section .= $parcelle[$i]; |
747 |
|
|
748 |
|
return $section; |
749 |
|
} |
750 |
|
|
751 |
|
/* |
752 |
|
* Retourne l'intructeur correspondant le mieux à la parcelle |
753 |
|
* */ |
754 |
|
function getInstructeur( $quartier, $arrondissement, $section, $nature, &$db) { |
755 |
|
|
756 |
|
$sql = " |
757 |
|
SELECT |
758 |
|
instructeur, section, quartier, arrondissement, nature |
759 |
|
FROM |
760 |
|
lien_localisation_nature l |
761 |
|
WHERE |
762 |
|
( nature IS NULL AND arrondissement IS NULL AND quartier IS NULL AND section IS NULL ) OR |
763 |
|
( nature IS NULL AND arrondissement IS NULL AND quartier IS NULL AND section = '$section' ) OR |
764 |
|
( nature IS NULL AND arrondissement IS NULL AND quartier = $quartier AND section IS NULL ) OR |
765 |
|
( nature IS NULL AND arrondissement IS NULL AND quartier = $quartier AND section = '$section' ) OR |
766 |
|
( nature IS NULL AND arrondissement = $arrondissement AND quartier IS NULL AND section IS NULL ) OR |
767 |
|
( nature IS NULL AND arrondissement = $arrondissement AND quartier IS NULL AND section = '$section' ) OR |
768 |
|
( nature IS NULL AND arrondissement = $arrondissement AND quartier = $quartier AND section IS NULL ) OR |
769 |
|
( nature IS NULL AND arrondissement = $arrondissement AND quartier = $quartier AND section = '$section' ) OR |
770 |
|
( nature = '$nature' AND arrondissement IS NULL AND quartier IS NULL AND section IS NULL ) OR |
771 |
|
( nature = '$nature' AND arrondissement IS NULL AND quartier IS NULL AND section = '$section' ) OR |
772 |
|
( nature = '$nature' AND arrondissement IS NULL AND quartier = $quartier AND section IS NULL ) OR |
773 |
|
( nature = '$nature' AND arrondissement IS NULL AND quartier = $quartier AND section = '$section' ) OR |
774 |
|
( nature = '$nature' AND arrondissement = $arrondissement AND quartier IS NULL AND section IS NULL ) OR |
775 |
|
( nature = '$nature' AND arrondissement = $arrondissement AND quartier IS NULL AND section = '$section' ) OR |
776 |
|
( nature = '$nature' AND arrondissement = $arrondissement AND quartier = $quartier AND section IS NULL ) OR |
777 |
|
( nature = '$nature' AND arrondissement = $arrondissement AND quartier = $quartier AND section = '$section' ) |
778 |
|
ORDER BY section, quartier, arrondissement, nature |
779 |
|
LIMIT 1 |
780 |
|
"; |
781 |
|
|
782 |
|
$res = $db->query($sql); |
783 |
|
if (database :: isError($res)) |
784 |
|
die($res->getMessage()."erreur ".$sql); |
785 |
|
|
786 |
|
if ( $res->numRows() > 0 ){ |
787 |
|
$row=& $res->fetchRow(DB_FETCHMODE_ASSOC); |
788 |
|
return $row['instructeur']; |
789 |
} |
} |
790 |
|
|
791 |
|
return NULL; |
792 |
|
} |
793 |
|
|
794 |
|
/* ============================================================= |
795 |
|
* fonction trigger relative a la connexion SIG |
796 |
|
* $sig = 1 dans dyn/var.inc |
797 |
|
* =============================================================== |
798 |
|
*/ |
799 |
|
|
800 |
|
function triggerajouter($id,&$db,$val,$DEBUG) { |
801 |
|
|
802 |
|
|
803 |
|
/*Localisation*/ |
804 |
|
$quartier = 'NULL'; |
805 |
|
$arrondissement = 'NULL'; |
806 |
|
$section = 'NULL' ; |
807 |
|
|
808 |
|
if($val['parcelle']!=''){ |
809 |
|
|
810 |
|
$this->getQuartierArrondissement($val['parcelle'], $quartier, $arrondissement, $db); |
811 |
|
|
812 |
|
if ( strcmp($arrondissement,'NULL') == 0 ) |
813 |
|
$quartier = 'NULL'; |
814 |
|
|
815 |
|
$section = $this->getSection($val['parcelle']); |
816 |
|
|
817 |
|
|
818 |
|
} |
819 |
|
|
820 |
|
/*Instructeur*/ |
821 |
|
if ( ( empty($this->valF['instructeur']) || $this->valF['instructeur'] == '' ) && $val['nature'] != '' ){ |
822 |
|
|
823 |
|
$instructeur = $this->getInstructeur($quartier, $arrondissement, $section, $val['nature'], $db); |
824 |
|
|
825 |
|
if ( $instructeur != NULL ) |
826 |
|
$this->valF['instructeur'] = $instructeur; |
827 |
|
else { |
828 |
|
if ( is_numeric($_SESSION['profil']) && $_SESSION['profil'] == 5 ) |
829 |
|
$this->addToMessage("<br/> "._("Pensez a assigner un instructeur a ce dossier.")." <br/>"); |
830 |
|
else |
831 |
|
$this->addToMessage("<br/> "._("Aucun instructeur compatible avec ce dossier trouve, contactez votre administrateur afin d'en assigner un a ce dossier.")." <br/>"); |
832 |
|
} |
833 |
|
} |
834 |
|
|
835 |
|
else |
836 |
|
$this->addToMessage("<br/> "._("Aucun instructeur compatible avec ce dossier trouve, contactez votre administrateur afin d'en assigner un a ce dossier.")." <br/>"); |
837 |
} |
} |
838 |
|
|
839 |
function triggermodifierapres($id,&$db,$val,$DEBUG) { |
function triggermodifierapres($id,&$db,$val,$DEBUG) { |
944 |
if (database :: isError($res)) |
if (database :: isError($res)) |
945 |
die($res->getMessage()."erreur ".$sql); |
die($res->getMessage()."erreur ".$sql); |
946 |
} |
} |
947 |
$this->addToMessage("<br> parcelle ".$parcelle." "._("inexistante")." ".$id.""); |
//$this->addToMessage("<br> parcelle ".$parcelle." "._("inexistante")." ".$id.""); |
948 |
} |
} |
949 |
} |
} |
950 |
|
|
1000 |
$this->servitude.=" [".$row['libelle']."] ".$row['observation']." a ".round($row['distance'],2)." m - "; |
$this->servitude.=" [".$row['libelle']."] ".$row['observation']." a ".round($row['distance'],2)." m - "; |
1001 |
} |
} |
1002 |
} |
} |
|
|
|
|
|
|
1003 |
}// fin classe |
}// fin classe |
1004 |
?> |
?> |