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 |
295 |
} else { |
} else { |
296 |
$form->setType('division','hidden'); |
$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){ |
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') { |
if($this->f->getParameter('afficher_division')==='true') { |
437 |
// instructeur |
// instructeur |
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 |
691 |
|
$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 |
|
|
703 |
|
/*Code impots*/ |
704 |
|
for ( $i = 0 ; $i < strlen($parcelle) ; $i++ ) |
705 |
|
if (is_numeric($parcelle[$i]) ) |
706 |
|
$quartier .= $parcelle[$i]; |
707 |
|
else |
708 |
|
break; |
709 |
|
|
710 |
|
if ( $quartier !== '' ){ |
711 |
|
|
712 |
|
/*identifiant*/ |
713 |
|
$sql = "SELECT |
714 |
|
quartier, arrondissement |
715 |
|
FROM |
716 |
|
quartier |
717 |
|
WHERE |
718 |
|
code_impots='$quartier'"; |
719 |
|
|
720 |
|
$res = $db->query($sql); |
721 |
|
if (database :: isError($res)) |
722 |
|
die($res->getMessage()."erreur ".$sql); |
723 |
|
|
724 |
|
if ( $res->numRows() > 0 ){ |
725 |
|
|
726 |
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
727 |
|
|
728 |
|
$quartier = $row['quartier']; |
729 |
|
$arrondissement = $row['arrondissement']; |
730 |
|
} |
731 |
|
} |
732 |
|
} |
733 |
|
} |
734 |
|
|
735 |
|
/* |
736 |
|
* Retourne la section d'une parcelle |
737 |
|
* */ |
738 |
|
function getSection($parcelle){ |
739 |
|
|
740 |
|
$parcelle = trim($parcelle); |
741 |
|
$section = NULL; |
742 |
|
|
743 |
|
for ( $i = 0 ; $i < strlen($parcelle) ; $i++ ) |
744 |
|
if ( !is_numeric($parcelle[$i]) && is_string($parcelle[$i]) && $parcelle[$i] !== ' ' ) |
745 |
|
$section .= $parcelle[$i]; |
746 |
|
|
747 |
|
return $section; |
748 |
|
} |
749 |
|
|
750 |
|
/* |
751 |
|
* Retourne l'intructeur correspondant le mieux à la parcelle |
752 |
|
* */ |
753 |
|
function getInstructeur( $quartier, $arrondissement, $section, $nature, &$db) { |
754 |
|
|
755 |
|
$sql = " |
756 |
|
SELECT |
757 |
|
instructeur, section, quartier, arrondissement, nature |
758 |
|
FROM |
759 |
|
lien_localisation_nature l |
760 |
|
WHERE |
761 |
|
( nature IS NULL AND arrondissement IS NULL AND quartier IS NULL AND section IS NULL ) OR |
762 |
|
( nature IS NULL AND arrondissement IS NULL AND quartier IS NULL AND section = '$section' ) OR |
763 |
|
( nature IS NULL AND arrondissement IS NULL AND quartier = $quartier AND section IS NULL ) OR |
764 |
|
( nature IS NULL AND arrondissement IS NULL AND quartier = $quartier AND section = '$section' ) OR |
765 |
|
( nature IS NULL AND arrondissement = $arrondissement AND quartier IS NULL AND section IS NULL ) OR |
766 |
|
( nature IS NULL AND arrondissement = $arrondissement AND quartier IS NULL AND section = '$section' ) OR |
767 |
|
( nature IS NULL AND arrondissement = $arrondissement AND quartier = $quartier AND section IS NULL ) OR |
768 |
|
( nature IS NULL AND arrondissement = $arrondissement AND quartier = $quartier AND section = '$section' ) OR |
769 |
|
( nature = '$nature' AND arrondissement IS NULL AND quartier IS NULL AND section IS NULL ) OR |
770 |
|
( nature = '$nature' AND arrondissement IS NULL AND quartier IS NULL AND section = '$section' ) OR |
771 |
|
( nature = '$nature' AND arrondissement IS NULL AND quartier = $quartier AND section IS NULL ) OR |
772 |
|
( nature = '$nature' AND arrondissement IS NULL AND quartier = $quartier AND section = '$section' ) OR |
773 |
|
( nature = '$nature' AND arrondissement = $arrondissement AND quartier IS NULL AND section IS NULL ) OR |
774 |
|
( nature = '$nature' AND arrondissement = $arrondissement AND quartier IS NULL AND section = '$section' ) OR |
775 |
|
( nature = '$nature' AND arrondissement = $arrondissement AND quartier = $quartier AND section IS NULL ) OR |
776 |
|
( nature = '$nature' AND arrondissement = $arrondissement AND quartier = $quartier AND section = '$section' ) |
777 |
|
ORDER BY section, quartier, arrondissement, nature |
778 |
|
LIMIT 1 |
779 |
|
"; |
780 |
|
|
781 |
|
$res = $db->query($sql); |
782 |
|
if (database :: isError($res)) |
783 |
|
die($res->getMessage()."erreur ".$sql); |
784 |
|
|
785 |
|
if ( $res->numRows() > 0 ){ |
786 |
|
$row=& $res->fetchRow(DB_FETCHMODE_ASSOC); |
787 |
|
return $row['instructeur']; |
788 |
|
} |
789 |
|
|
790 |
|
return NULL; |
791 |
|
} |
792 |
|
|
793 |
|
/* ============================================================= |
794 |
|
* fonction trigger relative a la connexion SIG |
795 |
|
* $sig = 1 dans dyn/var.inc |
796 |
|
* =============================================================== |
797 |
|
*/ |
798 |
|
|
799 |
|
function triggerajouter($id,&$db,$val,$DEBUG) { |
800 |
|
if($val['parcelle']!=''){ |
801 |
|
|
802 |
|
/*Localisation*/ |
803 |
|
$quartier = NULL; |
804 |
|
$arrondissement = NULL; |
805 |
|
|
806 |
|
$this->getQuartierArrondissement($val['parcelle'], $quartier, $arrondissement, $db); |
807 |
|
$section = $this->getSection($val['parcelle']); |
808 |
|
/*Instructeur*/ |
809 |
|
if ( ( empty($this->valF['instructeur']) || $this->valF['instructeur'] == '' ) && $val['nature'] != '' |
810 |
|
&& $quartier != NULL && $arrondissement != NULL ){ |
811 |
|
|
812 |
|
$instructeur = $this->getInstructeur($quartier, $arrondissement, $section, $val['nature'], $db); |
813 |
|
|
814 |
|
if ( $instructeur != NULL ) |
815 |
|
$this->valF['instructeur'] = $instructeur; |
816 |
|
else { |
817 |
|
if ( is_numeric($_SESSION['profil']) && $_SESSION['profil'] == 5 ) |
818 |
|
$this->addToMessage("<br/> "._("Pensez a assigner un instructeur a ce dossier.")." <br/>"); |
819 |
|
else |
820 |
|
$this->addToMessage("<br/> "._("Aucun instructeur compatible avec ce dossier trouve, contactez votre administrateur afin d'en assigner un a ce dossier.")." <br/>"); |
821 |
|
} |
822 |
|
} |
823 |
|
|
824 |
else |
else |
825 |
$this->addToMessage("<br>"._("Parcelle non renseignee dans dossier")." ".$id." <br>"); |
$this->addToMessage("<br/> "._("Aucun instructeur compatible avec ce dossier trouve, contactez votre administrateur afin d'en assigner un a ce dossier.")." <br/>"); |
826 |
|
} |
827 |
|
|
828 |
|
else { |
829 |
|
if ( is_numeric($_SESSION['profil']) && $_SESSION['profil'] == 5 ) |
830 |
|
$this->addToMessage("<br/> "._("Pensez a assigner un instructeur a ce dossier.")." <br/>"); |
831 |
|
else |
832 |
|
$this->addToMessage("<br/> "._("Parcelle non saisie, contactez votre administrateur afin d'assigner un instructeur a ce dossier.")." <br/>"); |
833 |
} |
} |
834 |
} |
} |
835 |
|
|
997 |
$this->servitude.=" [".$row['libelle']."] ".$row['observation']." a ".round($row['distance'],2)." m - "; |
$this->servitude.=" [".$row['libelle']."] ".$row['observation']." a ".round($row['distance'],2)." m - "; |
998 |
} |
} |
999 |
} |
} |
|
|
|
|
|
|
1000 |
}// fin classe |
}// fin classe |
1001 |
?> |
?> |