564 |
$form->setType('instructeur', 'selecthiddenstatic'); |
$form->setType('instructeur', 'selecthiddenstatic'); |
565 |
} |
} |
566 |
// |
// |
567 |
if($this->f->getParameter('afficher_division') === 'true') { |
if($this->f->getParameter('option_afficher_division') === 'true') { |
568 |
// |
// |
569 |
if ($this->f->isAccredited("dossier_modifier_division")) { |
if ($this->f->isAccredited("dossier_modifier_division")) { |
570 |
$form->setType('division', 'select'); |
$form->setType('division', 'select'); |
625 |
} |
} |
626 |
|
|
627 |
// |
// |
628 |
if(!$this->f->getParameter('afficher_division') === 'true') { |
if(!$this->f->getParameter('option_afficher_division') === 'true') { |
629 |
$form->setType('division', 'hidden'); |
$form->setType('division', 'hidden'); |
630 |
} |
} |
631 |
$form->setType('dossier_autorisation', 'hidden'); |
$form->setType('dossier_autorisation', 'hidden'); |
645 |
function setVal(&$form,$maj,$validation){ |
function setVal(&$form,$maj,$validation){ |
646 |
$this->maj=$maj; |
$this->maj=$maj; |
647 |
|
|
648 |
if($this->getVal('geom') != "") { |
if($this->getVal('geom') != "" |
649 |
|
&& $this->f->getParameter('option_sig') == 'sig_externe' |
650 |
|
&& $this->f->issetSIGParameter() === true) { |
651 |
$form->setVal('geom', |
$form->setVal('geom', |
652 |
"<a id='action-form-localiser'". |
"<a id='action-form-localiser'". |
653 |
" target='_blank' href='../app/redirect_plan_sig.php?idx=".$this->getVal("dossier")."'>". |
" target='_blank' href='../app/redirect_plan_sig.php?idx=".$this->getVal("dossier")."'>". |
654 |
"<span class='om-icon om-icon-16 om-icon-fix sig-16' title='Localiser'>Localiser</span> ". |
"<span class='om-icon om-icon-16 om-icon-fix sig-16' title='Localiser'>Localiser</span> ". |
655 |
$this->getVal('geom'). |
$this->getVal('geom'). |
656 |
" </a>"); |
" </a>"); |
|
} else { |
|
|
$form->setVal('geom', ''); |
|
657 |
} |
} |
658 |
if ($validation==0) { |
if ($validation==0) { |
659 |
if ($maj == 0){ |
if ($maj == 0){ |
735 |
$form->setSelect("parcelle",$contenu); |
$form->setSelect("parcelle",$contenu); |
736 |
|
|
737 |
} |
} |
738 |
if($this->f->getParameter('afficher_division')==='true') { |
if($this->f->getParameter('option_afficher_division')==='true') { |
739 |
// instructeur |
// instructeur |
740 |
$this->init_select($form, $db, $maj, $debug, "instructeur", |
$this->init_select($form, $db, $maj, $debug, "instructeur", |
741 |
$sql_instructeur_div, $sql_instructeur_div_by_id, false); |
$sql_instructeur_div, $sql_instructeur_div_by_id, false); |
769 |
function setLayout(&$form, $maj) { |
function setLayout(&$form, $maj) { |
770 |
// |
// |
771 |
$form->setBloc('dossier_libelle', 'D', '', ($maj == 3 ? 'col_9':'col_12')); |
$form->setBloc('dossier_libelle', 'D', '', ($maj == 3 ? 'col_9':'col_12')); |
772 |
|
|
773 |
$form->setBloc('dossier_libelle', 'D', '', 'col_9'); |
$form->setBloc('dossier_libelle', 'D', '', 'col_9'); |
774 |
|
|
775 |
$form->setFieldset('dossier_libelle', 'D', _("Dossier d'instruction")); |
$form->setFieldset('dossier_libelle', 'D', _("Dossier d'instruction")); |
776 |
$form->setFieldset('numero_versement_archive', 'F'); |
$form->setFieldset('numero_versement_archive', 'F'); |
777 |
|
//Fieldset "Localisation du terrain" |
778 |
|
// |
779 |
|
$form->setBloc('terrain_adresse_voie_numero','D'); |
780 |
|
$form->setFieldset('terrain_adresse_voie_numero','D',_('Localisation du terrain')); |
781 |
|
|
782 |
|
$form->setBloc('terrain_adresse_voie_numero','D',"","col_6"); |
783 |
|
$form->setBloc('terrain_references_cadastrales','F'); |
784 |
|
|
785 |
$form->setBloc('numero_versement_archive', 'F'); |
$form->setBloc('terrain_adresse_voie','D',"","col_6"); |
786 |
|
$form->setBloc('geom','F'); |
787 |
|
|
788 |
|
$form->setFieldset('geom','F',''); |
789 |
|
$form->setBloc('geom','F'); |
790 |
|
|
791 |
|
$form->setBloc('geom', 'F'); |
792 |
|
|
793 |
$form->setBloc('date_demande', 'D', '', 'col_3'); |
$form->setBloc('date_demande', 'D', '', 'col_3'); |
794 |
|
|
795 |
$form->setFieldset('date_demande', 'D', _("Depot")); |
$form->setFieldset('date_demande', 'D', _("Depot")); |
803 |
|
|
804 |
$form->setBloc('a_qualifier', 'F'); |
$form->setBloc('a_qualifier', 'F'); |
805 |
$form->setBloc('a_qualifier', 'F'); |
$form->setBloc('a_qualifier', 'F'); |
806 |
|
|
807 |
// |
// |
808 |
$form->setBloc('date_complet', 'D', '', 'col_12'); |
$form->setBloc('date_complet', 'D', '', 'col_12'); |
809 |
|
|
824 |
|
|
825 |
$form->setBloc('parcelle','D',"", "col_12"); |
$form->setBloc('parcelle','D',"", "col_12"); |
826 |
$form->setBloc('geom1','F'); |
$form->setBloc('geom1','F'); |
|
|
|
|
//Fieldset "Localisation du terrain" |
|
|
$form->setBloc('terrain_references_cadastrales','D',"","col_12"); |
|
|
$form->setFieldset('terrain_references_cadastrales','D',_('Localisation du terrain')); |
|
|
$form->setFieldset('terrain_superficie','F',''); |
|
|
$form->setBloc('terrain_superficie','F'); |
|
827 |
|
|
828 |
$form->setBloc('description','D',"", "col_12"); |
$form->setBloc('description','D',"", "col_12"); |
829 |
$form->setBloc('servitude','F',''); |
$form->setBloc('servitude','F',''); |
923 |
|
|
924 |
} |
} |
925 |
|
|
926 |
/* |
/** |
927 |
* Calcul l'identifiant du quartier et d'un arrondissement d'une parcelle |
* Récupère l'identifiant du quartier et d'un arrondissement d'une référence |
928 |
* */ |
* cadastrale |
929 |
function getQuartierArrondissement($parcelle) { |
* @param string $reference_cadastrale |
930 |
|
* |
931 |
|
* @return array |
932 |
|
*/ |
933 |
|
function getQuartierArrondissement($reference_cadastrale) { |
934 |
|
|
935 |
$parcelle = trim($parcelle); |
$reference_cadastrale = trim($reference_cadastrale); |
936 |
$quartier = ''; |
$quartier = ''; |
937 |
|
|
938 |
/*Récupère le code impot du quartier dans la parcelle*/ |
//Récupère le code impot du quartier dans la référence cadastrale |
939 |
for ( $i = 0 ; $i < strlen($parcelle) ; $i++ ){ |
for ( $i = 0 ; $i < strlen($reference_cadastrale) ; $i++ ){ |
940 |
|
|
941 |
if (is_numeric($parcelle[$i]) ){ |
//Si c'est un chiffre, c'est le code quartier |
942 |
|
if (is_numeric($reference_cadastrale[$i]) ){ |
943 |
$quartier .= $parcelle[$i]; |
|
944 |
} |
$quartier .= $reference_cadastrale[$i]; |
945 |
else{ |
} |
946 |
|
//Sinon c'est la section |
947 |
break; |
else{ |
948 |
} |
break; |
949 |
} |
} |
950 |
|
} |
951 |
|
|
952 |
|
//Si le code impôt du quartier a bien été renseigné |
953 |
if ( $quartier !== '' ){ |
if ( $quartier !== '' ){ |
954 |
|
|
955 |
/*identifiant*/ |
//Requête de récupération de l'identifiantdu quartier et de |
956 |
|
//l'arrondissement |
957 |
$sql = "SELECT |
$sql = "SELECT |
958 |
quartier, arrondissement |
quartier, arrondissement |
959 |
FROM |
FROM |
960 |
".DB_PREFIXE."quartier |
".DB_PREFIXE."quartier |
961 |
WHERE |
WHERE |
962 |
code_impots='$quartier'"; |
code_impots='$quartier'"; |
963 |
|
$this->addToLog("getQuartierArrondissement() : db->query(\"$sql\")", VERBOSE_MODE); |
|
$this->addToLog("getQuartierArrondissement(parcelle) : db->query(\"$sql\")", VERBOSE_MODE); |
|
964 |
$res = $this->db->query($sql); |
$res = $this->db->query($sql); |
965 |
if (database :: isError($res)) |
if (database::isError($res)) { |
966 |
die($res->getMessage()."erreur ".$sql); |
die(); |
967 |
|
} |
968 |
if ( $res->numRows() > 0 ){ |
|
969 |
|
//Si on a un résultat |
970 |
|
if ( $res->numRows() == 1 ){ |
971 |
|
// |
972 |
return $res->fetchRow(DB_FETCHMODE_ASSOC); |
return $res->fetchRow(DB_FETCHMODE_ASSOC); |
973 |
} |
} |
974 |
} |
} |
975 |
|
|
976 |
return NULL; |
return NULL; |
977 |
} |
} |
978 |
|
|
979 |
/* |
/** |
980 |
* Retourne la section d'une parcelle |
* Récupère la section d'une référence cadastrale |
981 |
* */ |
* @param string $reference_cadastrale |
982 |
function getSection($parcelle){ |
* |
983 |
|
* @return string |
984 |
|
*/ |
985 |
|
function getSection($reference_cadastrale){ |
986 |
|
|
987 |
$parcelle = trim($parcelle); |
$reference_cadastrale = trim($reference_cadastrale); |
988 |
$section = NULL; |
$section = NULL; |
989 |
|
|
990 |
for ( $i = 0 ; $i < strlen($parcelle) ; $i++ ) |
for ( $i = 0 ; $i < strlen($reference_cadastrale) ; $i++ ) |
991 |
if ( !is_numeric($parcelle[$i]) && is_string($parcelle[$i]) && $parcelle[$i] !== ' ' ) |
if ( !is_numeric($reference_cadastrale[$i]) && is_string($reference_cadastrale[$i]) && $reference_cadastrale[$i] !== ' ' ) |
992 |
$section .= $parcelle[$i]; |
$section .= $reference_cadastrale[$i]; |
993 |
|
|
994 |
return $section; |
return $section; |
995 |
} |
} |
996 |
|
|
997 |
/* |
/* |
998 |
* Retourne l'intructeur correspondant le mieux à la parcelle |
* Retourne l'intructeur correspondant le mieux à la parcelle |
999 |
* */ |
* */ |
1000 |
function getInstructeurDivision( $quartier, $arrondissement, $section, $dossier_autorisation) { |
/** |
1001 |
|
* Récupère la section d'une référence cadastrale |
1002 |
|
* @param string $quartier |
1003 |
|
* @param string $arrondissement |
1004 |
|
* @param string $section |
1005 |
|
* @param string $dossier_autorisation |
1006 |
|
* |
1007 |
|
* @return array |
1008 |
|
*/ |
1009 |
|
function getInstructeurDivision( $quartier, $arrondissement, $section, $dossier_autorisation) { |
1010 |
|
|
1011 |
$quartier = ( $quartier == NULL ) ? -1 : $quartier; |
$quartier = ( $quartier == NULL ) ? -1 : $quartier; |
1012 |
$arrondissement = ( $arrondissement == NULL ) ? -1 : $arrondissement; |
$arrondissement = ( $arrondissement == NULL ) ? -1 : $arrondissement; |
1013 |
|
|
1014 |
/*Récupération du dossier_autorisation_type_detaille concerné par le $dossier_autorisation*/ |
//Récupération du dossier_autorisation_type_detaille concerné par le |
1015 |
|
//$dossier_autorisation |
1016 |
$sql = " |
$sql = " |
1017 |
SELECT |
SELECT |
1018 |
dossier_autorisation_type_detaille |
dossier_autorisation_type_detaille |
1024 |
$this->addToLog("getInstructeurDivision : db->query(\"$sql\")", VERBOSE_MODE); |
$this->addToLog("getInstructeurDivision : db->query(\"$sql\")", VERBOSE_MODE); |
1025 |
$resDATD = $this->db->query($sql); |
$resDATD = $this->db->query($sql); |
1026 |
if (database :: isError($resDATD)) |
if (database :: isError($resDATD)) |
1027 |
die($resDATD->getMessage()."erreur ".$sql); |
die($resDATD->getMessage()."erreur ".$sql); |
1028 |
|
|
1029 |
|
//Si le dossier d'autorisation a un type détaillé de dossier |
1030 |
|
//d'autorisation associé |
1031 |
if ( $resDATD->numRows() > 0 ){ |
if ( $resDATD->numRows() > 0 ){ |
1032 |
$rowDATD = $resDATD->fetchRow(DB_FETCHMODE_ASSOC); |
$rowDATD = $resDATD->fetchRow(DB_FETCHMODE_ASSOC); |
1033 |
|
|
1034 |
|
//Requête de récupération de l'instructeur à affecter |
1035 |
$sql = " |
$sql = " |
1036 |
SELECT |
SELECT |
1037 |
instructeur, section, quartier, arrondissement, dossier_autorisation_type_detaille |
instructeur, section, quartier, arrondissement, dossier_autorisation_type_detaille |
1055 |
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement = $arrondissement AND quartier = $quartier AND section IS NULL ) OR |
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement = $arrondissement AND quartier = $quartier AND section IS NULL ) OR |
1056 |
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement = $arrondissement AND quartier = $quartier AND section = '$section' ) |
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement = $arrondissement AND quartier = $quartier AND section = '$section' ) |
1057 |
ORDER BY section, quartier, arrondissement, dossier_autorisation_type_detaille |
ORDER BY section, quartier, arrondissement, dossier_autorisation_type_detaille |
1058 |
LIMIT 1 |
LIMIT 1"; |
|
"; |
|
|
|
|
1059 |
$this->addToLog("getInstructeurDivision : db->query(\"$sql\")", VERBOSE_MODE); |
$this->addToLog("getInstructeurDivision : db->query(\"$sql\")", VERBOSE_MODE); |
1060 |
$res = $this->db->query($sql); |
$res = $this->db->query($sql); |
1061 |
if (database :: isError($res)) |
if (database :: isError($res)) |
1062 |
die($res->getMessage()."erreur ".$sql); |
die($res->getMessage()."erreur ".$sql); |
1063 |
|
|
1064 |
|
//Si on a récupéré un instructeur correspondant aux critères |
1065 |
if ( $res->numRows() > 0 ){ |
if ( $res->numRows() > 0 ){ |
1066 |
|
|
1067 |
$row = $res->fetchRow(DB_FETCHMODE_ASSOC); |
$row = $res->fetchRow(DB_FETCHMODE_ASSOC); |
1068 |
|
//On récupère sa division |
1069 |
$sql = "SELECT division FROM ".DB_PREFIXE."instructeur WHERE instructeur = ".$row['instructeur']; |
$sql = "SELECT division FROM ".DB_PREFIXE."instructeur WHERE instructeur = ".$row['instructeur']; |
1070 |
$res = $this->db->query($sql); |
$res = $this->db->query($sql); |
1071 |
if (database :: isError($res)) |
if (database :: isError($res)) |
1072 |
die($res->getMessage()."erreur ".$sql); |
die($res->getMessage()."erreur ".$sql); |
1073 |
|
|
1074 |
|
$row['division'] = NULL; |
1075 |
|
//S'il a une division |
1076 |
if ( $res->numRows() > 0 ){ |
if ( $res->numRows() > 0 ){ |
1077 |
|
|
1078 |
$rowT=& $res->fetchRow(DB_FETCHMODE_ASSOC); |
$rowT=& $res->fetchRow(DB_FETCHMODE_ASSOC); |
1101 |
$arrondissement = NULL; |
$arrondissement = NULL; |
1102 |
$section = NULL; |
$section = NULL; |
1103 |
$instructeur = NULL; |
$instructeur = NULL; |
1104 |
|
|
1105 |
// Si la parcelle n'est pas vide alors on récupère la section, le |
// Si la référence cadastrale n'est pas vide alors on récupère la |
1106 |
// quartier et l'arrondissement |
//section, le quartier et l'arrondissement |
1107 |
if ($val['parcelle'] != '') { |
if ($this->valF['terrain_references_cadastrales'] != '') { |
1108 |
// Cette méthode récupère l'arrondissement et le quartier associé à une parcelle |
|
1109 |
$quartierArrondissement = $this->getQuartierArrondissement($val['parcelle']); |
// Cette méthode récupère l'arrondissement et le quartier de la |
1110 |
|
//référence cadastrale saisie |
1111 |
|
$quartierArrondissement = $this->getQuartierArrondissement($this->valF['terrain_references_cadastrales']); |
1112 |
if ( $quartierArrondissement!= NULL ){ |
if ( $quartierArrondissement!= NULL ){ |
1113 |
|
|
1114 |
$quartier = $quartierArrondissement['quartier']; |
$quartier = $quartierArrondissement['quartier']; |
1121 |
$quartier = NULL; |
$quartier = NULL; |
1122 |
} |
} |
1123 |
// On récupère la section |
// On récupère la section |
1124 |
$section = $this->getSection($val['parcelle']); |
$section = $this->getSection($this->valF['terrain_references_cadastrales']); |
1125 |
} |
} |
1126 |
|
|
1127 |
// Si aucun instructeur n'est saisi et que la dossier_autorisation_type_detaille n'est pas vide |
// Si aucun instructeur n'est saisi et que la dossier_autorisation_type_detaille n'est pas vide |
1128 |
// alors on récupère l'instructeur et la division depuis l'affectation |
// alors on récupère l'instructeur et la division depuis l'affectation |
1129 |
if ( ( empty($this->valF['instructeur']) || $this->valF['instructeur'] == '' ) && $val['dossier_autorisation'] != '' ) { |
if ( ( empty($this->valF['instructeur']) || $this->valF['instructeur'] == '' ) && $val['dossier_autorisation'] != '' ) { |
1130 |
|
|
1131 |
// |
//Récupération de l'instructeur ainsi que de sa division |
1132 |
$instructeurDivision = $this->getInstructeurDivision($quartier, $arrondissement, $section, $val['dossier_autorisation']); |
$instructeurDivision = $this->getInstructeurDivision($quartier, $arrondissement, $section, $this->valF['dossier_autorisation']); |
1133 |
|
|
1134 |
|
//Si un instructeur et sa division ont été récupérés |
1135 |
if ( $instructeurDivision != NULL ){ |
if ( $instructeurDivision != NULL ){ |
1136 |
|
|
1137 |
$instructeur = $instructeurDivision['instructeur']; |
$instructeur = $instructeurDivision['instructeur']; |
1138 |
$division = $instructeurDivision['division']; |
$division = $instructeurDivision['division']; |
1139 |
} |
} |
1140 |
|
//Si un instructeur et sa division n'ont pas été récupérés, on |
1141 |
|
//ajoute pas les données |
1142 |
if ( $instructeur != NULL ){ |
if ( $instructeur != NULL ){ |
1143 |
|
|
1144 |
$this->valF['instructeur'] = $instructeur; |
$this->valF['instructeur'] = $instructeur; |
1145 |
$this->valF['division'] = $division; |
$this->valF['division'] = $division; |
1146 |
} else { |
} else { |
1147 |
|
//On affiche un message à l'utilisateur pour lui signifier |
1148 |
|
//qu'aucun instructeur n'a été assigné au dossier d'instruction |
1149 |
|
//créé |
1150 |
if ($this->f->isAccredited("dossier_modifier_instructeur")) { |
if ($this->f->isAccredited("dossier_modifier_instructeur")) { |
1151 |
$this->addToMessage("<br/> "._("Pensez a assigner un instructeur a ce dossier.")." <br/>"); |
$this->addToMessage("<br/> "._("Pensez a assigner un instructeur a ce dossier.")." <br/>"); |
1152 |
} else { |
} else { |