25 |
var $aff_localisation = "collapsible"; |
var $aff_localisation = "collapsible"; |
26 |
var $aff_description = "startClosed"; |
var $aff_description = "startClosed"; |
27 |
var $aff_amenagement = "startClosed"; |
var $aff_amenagement = "startClosed"; |
28 |
|
var $dossier_instruction_type; |
29 |
|
|
30 |
function dossier($id,&$db,$DEBUG) { |
function dossier($id,&$db,$DEBUG) { |
31 |
$this->constructeur($id,$db,$DEBUG); |
$this->constructeur($id,$db,$DEBUG); |
32 |
} // fin constructeur |
} // fin constructeur |
33 |
|
|
34 |
|
/*Mutateur pour ma variable dossier_instruction_type*/ |
35 |
|
public function getDossierInstructionType(){ |
36 |
|
return $this->dossier_instruction_type; |
37 |
|
} |
38 |
|
public function setDossierInstructionType($dossier_instruction_type){ |
39 |
|
$this->dossier_instruction_type = $dossier_instruction_type; |
40 |
|
} |
41 |
|
|
42 |
|
// {{{ Gestion de la confidentialité des données spécifiques |
43 |
|
|
44 |
|
/** |
45 |
|
* Surcharge pour gérer les actions disponibles dans le portlet |
46 |
|
*/ |
47 |
|
function checkAccessibility() { |
48 |
|
// |
49 |
|
parent::checkAccessibility(); |
50 |
|
// Si l'utilisateur est un intructeur qui en correspond pas à la |
51 |
|
// division du dossier |
52 |
|
if ($this->f->isUserInstructeur() |
53 |
|
&& isset($this->f->om_utilisateur["division"]) |
54 |
|
&& $this->f->om_utilisateur["division"] != $this->getDivisionFromDossier()) { |
55 |
|
// |
56 |
|
$this->actions_sup = array(); |
57 |
|
$this->setParameter("actions", array()); |
58 |
|
} |
59 |
|
|
60 |
|
/* |
61 |
|
* Si une action 'rapport_instruction' est présente et |
62 |
|
* que le le rapport d'instruction existe déjà, lien vers l'objet en modification |
63 |
|
* sinon, lien vers un script qui va créer le nouvel objet et |
64 |
|
* rediriger l'utilisateur vers l'objet en modification. |
65 |
|
*/ |
66 |
|
|
67 |
|
// Vérifie si un rapport d'instruction existe déjà |
68 |
|
if ( isset($this->actions_sup["rapport_instruction"]) ) { |
69 |
|
|
70 |
|
// Requête de vérification |
71 |
|
$sql = "SELECT |
72 |
|
rapport_instruction |
73 |
|
FROM |
74 |
|
".DB_PREFIXE."rapport_instruction |
75 |
|
WHERE |
76 |
|
dossier_instruction = '".$this->getParameter('idx')."'"; |
77 |
|
|
78 |
|
// Ajout au log |
79 |
|
$this->f->addToLog("checkAccessibility(): db->query(\"".$sql."\");", VERBOSE_MODE); |
80 |
|
|
81 |
|
// Exécution de la requête |
82 |
|
$res=$this->f->db->query($sql); |
83 |
|
$this->f->isDatabaseError($res); |
84 |
|
|
85 |
|
/* |
86 |
|
* S'il n'y a pas de rapport d'instruction, redirection vers un script |
87 |
|
* de création, puis vers l'objet. |
88 |
|
* */ |
89 |
|
if ( $res->numrows() == 0 ){ |
90 |
|
|
91 |
|
$this->actions_sup["rapport_instruction"]["lien"] = |
92 |
|
'../app/rapport_instruction.php?idx='; |
93 |
|
} |
94 |
|
// S'il a déjà été créé, lien vers l'objet en modification |
95 |
|
elseif ( $res->numrows() > 0 ){ |
96 |
|
|
97 |
|
$row = & $res->fetchRow(DB_FETCHMODE_ASSOC); |
98 |
|
$this->actions_sup["rapport_instruction"]["lien"] = |
99 |
|
'../scr/form.php?obj=rapport_instruction&action=1&idx='. |
100 |
|
$row['rapport_instruction'].'&idD='; |
101 |
|
} |
102 |
|
|
103 |
|
} |
104 |
|
} |
105 |
|
|
106 |
|
/** |
107 |
|
* Cette methode est à surcharger elle permet de tester dans chaque classe |
108 |
|
* des droits des droits spécifiques en fonction des données |
109 |
|
*/ |
110 |
|
function canAccess() { |
111 |
|
// Si l'utilisateur est un intructeur qui ne correspond pas à la |
112 |
|
// division du dossier |
113 |
|
if ($this->f->isUserInstructeur() |
114 |
|
&& $this->f->om_utilisateur["division"] != $this->getDivisionFromDossier() |
115 |
|
&& $this->getParameter("maj") != 3) { |
116 |
|
// |
117 |
|
return false; |
118 |
|
} |
119 |
|
// |
120 |
|
return true; |
121 |
|
} |
122 |
|
|
123 |
|
/** |
124 |
|
* Cette méthode permet de récupérer la division d'un dossier |
125 |
|
*/ |
126 |
|
function getDivisionFromDossier() { |
127 |
|
// |
128 |
|
if (!isset($this->val[array_search("dossier", $this->champs)])) { |
129 |
|
return NULL; |
130 |
|
} |
131 |
|
// |
132 |
|
$sql = "select division from ".DB_PREFIXE."dossier "; |
133 |
|
$sql .= " where dossier='".$this->val[array_search("dossier", $this->champs)]."'"; |
134 |
|
// |
135 |
|
$division = $this->db->getOne($sql); |
136 |
|
$this->addToLog("getDivisionFromDossier(): db->getone(\"".$sql."\")", VERBOSE_MODE); |
137 |
|
database::isError($division); |
138 |
|
// |
139 |
|
return $division; |
140 |
|
} |
141 |
|
|
142 |
|
// }}} |
143 |
|
/* |
144 |
|
* Ajoute un numéro au dossier |
145 |
|
* |
146 |
|
*/ |
147 |
function setValFAjout($val = array()) { |
function setValFAjout($val = array()) { |
148 |
// Cle primaire |
|
149 |
$lettre=$this->f->collectivite["lettre"]; |
/*Récupération de la lettre associé au type de dossier d'instruction*/ |
150 |
$numero_unique = $this->f->collectivite["numero_unique"]; |
$code = $this->getCode($this->getDossierInstructionType()); |
151 |
if($numero_unique==1){ |
|
152 |
// numero unique (voir dyn/var.inc) |
/* Récupération de la valeur du suffixe ce dossier_instruction_type */ |
153 |
$temp=$this->$db->nextId(DB_PREFIXE.$this->table); |
$suffixe = $this->getSuffixe($this->getDossierInstructionType()); |
154 |
}else{ |
|
155 |
// numero suivant nature |
/*S'il est à TRUE, on récupère le numéro de version du dossier d'autorisation*/ |
156 |
$temp=$this->db->nextId(DB_PREFIXE."dossier_".$val['nature']); |
$numeroVersion = ""; |
157 |
} |
if ( $suffixe == 't' ){ |
158 |
$temp=str_pad($temp,4,"0", STR_PAD_LEFT); |
|
159 |
$this->valF['dossier'] = $this->valF['nature'].$this->valF['annee']. |
$numeroVersion = $this->getNumeroVersion($val['dossier_autorisation']); |
160 |
$lettre.$temp; |
|
161 |
|
/* Incrémentation du numéro de version */ |
162 |
|
if ( is_numeric($numeroVersion) or $numeroVersion == -1 ){ |
163 |
|
|
164 |
|
$this->incrementNumeroVersion($val['dossier_autorisation'], ++$numeroVersion); |
165 |
|
} |
166 |
|
} |
167 |
|
|
168 |
|
/*Création du numéro de dossier*/ |
169 |
|
$this->valF['dossier'] = $val['dossier_autorisation']."$code$numeroVersion"; |
170 |
} |
} |
171 |
|
|
172 |
|
/*Récupère la valeur du suffixe d'un dossier_instruction_type*/ |
173 |
|
function getSuffixe($dossierInstructionType){ |
174 |
|
|
175 |
|
$suffixe = ""; |
176 |
|
|
177 |
|
$sql = "SELECT |
178 |
|
suffixe |
179 |
|
FROM |
180 |
|
".DB_PREFIXE."dossier_instruction_type |
181 |
|
WHERE |
182 |
|
dossier_instruction_type = $dossierInstructionType"; |
183 |
|
|
184 |
|
$this->addToLog("getSuffixe(): db->query(\"".$sql."\")", VERBOSE_MODE); |
185 |
|
$res = $this->db->query($sql); |
186 |
|
if (database :: isError($res)) |
187 |
|
die($res->getMessage()."erreur ".$sql); |
188 |
|
|
189 |
|
if ( $res->numRows() > 0 ){ |
190 |
|
|
191 |
|
$row = $res->fetchRow(DB_FETCHMODE_ASSOC); |
192 |
|
$suffixe = $row['suffixe']; |
193 |
|
} |
194 |
|
|
195 |
|
return $suffixe; |
196 |
|
} |
197 |
|
|
198 |
|
/*Récupère dans la table de paramètrage la lettre correspondant |
199 |
|
* au dossier_instruction_type |
200 |
|
*/ |
201 |
|
function getCode($dossierInstructionType){ |
202 |
|
|
203 |
|
$code = ""; |
204 |
|
|
205 |
|
$sql = "SELECT |
206 |
|
code |
207 |
|
FROM |
208 |
|
".DB_PREFIXE."dossier_instruction_type |
209 |
|
WHERE |
210 |
|
dossier_instruction_type = $dossierInstructionType"; |
211 |
|
|
212 |
|
$this->addToLog("getCode(): db->query(\"".$sql."\")", VERBOSE_MODE); |
213 |
|
$res = $this->db->query($sql); |
214 |
|
if (database :: isError($res)) |
215 |
|
die($res->getMessage()."erreur ".$sql); |
216 |
|
|
217 |
|
if ( $res->numRows() > 0 ){ |
218 |
|
|
219 |
|
$row = $res->fetchRow(DB_FETCHMODE_ASSOC); |
220 |
|
$code = $row['code']; |
221 |
|
} |
222 |
|
|
223 |
|
return $code; |
224 |
|
} |
225 |
|
|
226 |
|
/*Récupère le numéro de version d'un dossier_autorisation*/ |
227 |
|
function getNumeroVersion($dossierAutorisation){ |
228 |
|
|
229 |
|
$numeroVersion = ""; |
230 |
|
|
231 |
|
$sql = "SELECT |
232 |
|
numero_version |
233 |
|
FROM |
234 |
|
".DB_PREFIXE."dossier_autorisation |
235 |
|
WHERE |
236 |
|
dossier_autorisation = '$dossierAutorisation'"; |
237 |
|
|
238 |
|
$this->addToLog("getNumeroVersion(): db->query(\"".$sql."\")", VERBOSE_MODE); |
239 |
|
$res = $this->db->query($sql); |
240 |
|
if (database :: isError($res)) |
241 |
|
die($res->getMessage()."erreur ".$sql); |
242 |
|
|
243 |
|
if ( $res->numRows() > 0 ){ |
244 |
|
|
245 |
|
$row = $res->fetchRow(DB_FETCHMODE_ASSOC); |
246 |
|
$numeroVersion = $row['numero_version']; |
247 |
|
} |
248 |
|
|
249 |
|
return $numeroVersion; |
250 |
|
} |
251 |
|
|
252 |
|
/*Incrémente le numéro de version du dossier*/ |
253 |
|
function incrementNumeroVersion($dossierAutorisation, $nouveauNumeroVersion) { |
254 |
|
|
255 |
|
$valF = array ( |
256 |
|
"numero_version" => $nouveauNumeroVersion |
257 |
|
); |
258 |
|
|
259 |
|
$res = $this->db->autoExecute(DB_PREFIXE."dossier_autorisation", |
260 |
|
$valF, |
261 |
|
DB_AUTOQUERY_UPDATE, |
262 |
|
"dossier_autorisation = '$dossierAutorisation'"); |
263 |
|
|
264 |
|
if (database :: isError($res)) |
265 |
|
die($res->getMessage()."erreur ".$sql); |
266 |
|
|
267 |
|
} |
268 |
|
|
269 |
function setvalF($val){ |
function setvalF($val){ |
270 |
parent::setvalF($val); |
parent::setvalF($val); |
271 |
// 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 |
294 |
unset ($this->valF['date_conformite']); |
unset ($this->valF['date_conformite']); |
295 |
} |
} |
296 |
|
|
297 |
|
/*Vérification des données saisies*/ |
298 |
function verifier($val,&$db,$DEBUG){ |
function verifier($val,&$db,$DEBUG){ |
299 |
parent::verifier($val,$db,$DEBUG); |
parent::verifier($val,$db,$DEBUG); |
300 |
if($val['parcelle']!="" and $val['sig']!='Oui'){ |
if($val['parcelle']!="" and $val['sig']!='Oui'){ |
427 |
// cache |
// cache |
428 |
if($maj==0) $form->setType('dossier', 'hidden'); |
if($maj==0) $form->setType('dossier', 'hidden'); |
429 |
$form->setType('annee', 'hidden'); |
$form->setType('annee', 'hidden'); |
|
$form->setType('nature', 'select'); |
|
430 |
$form->setType('parcelle_archive','hidden'); |
$form->setType('parcelle_archive','hidden'); |
431 |
$form->setType('parcelle_lot_archive','hidden'); |
$form->setType('parcelle_lot_archive','hidden'); |
432 |
$form->setType('objet_dossier','hidden'); // PC |
$form->setType('objet_dossier','hidden'); // PC |
520 |
} |
} |
521 |
if($maj == 3) { |
if($maj == 3) { |
522 |
$form->setType('annee', 'hidden'); |
$form->setType('annee', 'hidden'); |
|
$form->setType('nature', 'selectstatic'); |
|
523 |
$form->setType('temp1','hidden'); |
$form->setType('temp1','hidden'); |
524 |
$form->setType('temp2','hidden'); |
$form->setType('temp2','hidden'); |
525 |
$form->setType('temp3','hidden'); |
$form->setType('temp3','hidden'); |
535 |
if(!$this->f->getParameter('afficher_division') === 'true') { |
if(!$this->f->getParameter('afficher_division') === 'true') { |
536 |
$form->setType('division', 'hidden'); |
$form->setType('division', 'hidden'); |
537 |
} |
} |
538 |
|
$form->setType('dossier_autorisation', 'hiddenstatic'); |
539 |
|
// |
540 |
|
if ($maj == 0) { |
541 |
|
$form->setType('dossier_autorisation', 'select'); |
542 |
|
} |
543 |
|
// On cache enjeu_ERP si l'option n'est pas activée |
544 |
|
if($this->f->getParameter('option_ERP') != 'true') { |
545 |
|
$form->setType('erp', 'hidden'); |
546 |
|
$form->setType('enjeu_erp', 'hidden'); |
547 |
|
} |
548 |
} |
} |
549 |
|
|
550 |
function setVal(&$form,$maj,$validation){ |
function setVal(&$form,$maj,$validation){ |
553 |
if ($maj == 0){ |
if ($maj == 0){ |
554 |
//$dossier_cp = $this->f->collectivite["cp"]; |
//$dossier_cp = $this->f->collectivite["cp"]; |
555 |
//$dossier_ville = $this->f->collectivite["ville"]; |
//$dossier_ville = $this->f->collectivite["ville"]; |
|
//$form->setVal('nature', $this->nature); |
|
556 |
|
|
557 |
$form->setVal('annee', date('y')); |
$form->setVal('annee', date('y')); |
558 |
$form->setVal('date_demande', date('Y-m-d')); |
$form->setVal('date_demande', date('Y-m-d')); |
658 |
$contenu[0]=array("dossier",$this->getParameter("idx")); |
$contenu[0]=array("dossier",$this->getParameter("idx")); |
659 |
$form->setSelect('geom',$contenu); |
$form->setSelect('geom',$contenu); |
660 |
} |
} |
661 |
|
// arrondissement recherche anvancée |
662 |
|
$this->init_select($form, $db, $maj, $debug, "arrondissement", |
663 |
|
$sql_arrondissement, $sql_arrondissement_by_id, false); |
664 |
|
// dossier_autorisation_type_detaille recherche anvancée |
665 |
|
$this->init_select($form, $db, $maj, $debug, "dossier_autorisation_type_detaille", |
666 |
|
$sql_dossier_autorisation_type_detaille, $sql_dossier_autorisation_type_detaille_by_id, false); |
667 |
/* |
/* |
668 |
* Affichage de données dans le select de la parcelle |
* Affichage de données dans le select de la parcelle |
669 |
* */ |
* */ |
702 |
// $form->setGroupe('division','F'); |
// $form->setGroupe('division','F'); |
703 |
//}else{ |
//}else{ |
704 |
// $form->setGroupe('dossier','D'); |
// $form->setGroupe('dossier','D'); |
|
// $form->setGroupe('nature','G'); |
|
705 |
// $form->setGroupe('annee','G'); |
// $form->setGroupe('annee','G'); |
706 |
// $form->setGroupe('date_demande','G'); |
// $form->setGroupe('date_demande','G'); |
707 |
// $form->setGroupe('date_depot','G'); |
// $form->setGroupe('date_depot','G'); |
945 |
|
|
946 |
} |
} |
947 |
|
|
|
|
|
|
|
|
948 |
/* ============================================================= |
/* ============================================================= |
949 |
* fonction trigger relative a la connexion SIG |
* fonction trigger relative a la connexion SIG |
950 |
* $sig = 1 dans dyn/var.inc |
* $sig = 1 dans dyn/var.inc |
964 |
$this->addToMessage("<br>"._("Parcelle non renseignee dans dossier")." ".$id." <br>"); |
$this->addToMessage("<br>"._("Parcelle non renseignee dans dossier")." ".$id." <br>"); |
965 |
|
|
966 |
} |
} |
967 |
|
|
968 |
// envoi du message a ERP en cas d'un depot du dossier dat |
|
969 |
if ($this->valF['nature'] == |
if ($this->f->getParameter('option_erp') != "") { |
970 |
$this->f->getParameter('erp_depot_dossier_dat')) { |
// envoi du message a ERP en cas d'un depot du dossier dat |
971 |
$msgenque = new MessageEnqueuer(); |
if ($this->getDATDCode($this->valF['dossier']) == |
972 |
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
$this->f->getParameter('erp_depot_dossier_dat')) { |
|
$msgenque->enqueueMessage($msgenque::$ERP_DEPOT_DOSSIER_DAT); |
|
|
} |
|
|
|
|
|
// envoi du message a ERP en cas d'une demande d'ouverture DAT |
|
|
if ($this->valF['nature'] == |
|
|
$this->f->getParameter('erp_demande_ouverture_dat')) { |
|
|
$msgenque = new MessageEnqueuer(); |
|
|
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
|
|
$msgenque->enqueueMessage($msgenque::$ERP_DEMANDE_OUVERTURE_DAT); |
|
|
} |
|
|
|
|
|
if ($this->valF['erp'] === true) { |
|
|
// envoi du message a ERP en cas d'annulation d'une demande |
|
|
if ($this->valF['nature'] == |
|
|
$this->f->getParameter('erp_annulation_demande')) { |
|
973 |
$msgenque = new MessageEnqueuer(); |
$msgenque = new MessageEnqueuer(); |
974 |
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
975 |
$msgenque->enqueueMessage($msgenque::$ERP_ANNULATION_DEMANDE); |
$msgenque->enqueueMessage($msgenque::$ERP_DEPOT_DOSSIER_DAT); |
976 |
} |
} |
977 |
|
|
978 |
// envoi du message a ERP en cas d'ouverture d'un dossier PC "rattache" |
// envoi du message a ERP en cas d'une demande d'ouverture DAT |
979 |
// au dossier DAACT |
if ($this->getDATDCode($this->valF['dossier']) == |
980 |
if ($this->valF['nature'] == |
$this->f->getParameter('erp_demande_ouverture_dat')) { |
|
$this->f->getParameter('erp_demande_ouverture_pc_daact')) { |
|
981 |
$msgenque = new MessageEnqueuer(); |
$msgenque = new MessageEnqueuer(); |
982 |
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
983 |
$msgenque->enqueueMessage($msgenque::$ERP_DEMANDE_OUVERTURE_PC); |
$msgenque->enqueueMessage($msgenque::$ERP_DEMANDE_OUVERTURE_DAT); |
984 |
} |
} |
985 |
} |
|
986 |
|
if ($this->valF['erp'] === true) { |
987 |
|
// envoi du message a ERP en cas d'annulation d'une demande |
988 |
|
if ($this->getDATDCode($this->valF['dossier']) == |
989 |
|
$this->f->getParameter('erp_annulation_demande')) { |
990 |
|
$msgenque = new MessageEnqueuer(); |
991 |
|
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
992 |
|
$msgenque->enqueueMessage($msgenque::$ERP_ANNULATION_DEMANDE); |
993 |
|
} |
994 |
|
|
995 |
|
// envoi du message a ERP en cas d'ouverture d'un dossier PC "rattache" |
996 |
|
// au dossier DAACT |
997 |
|
if ($this->getDATDCode($this->valF['dossier']) == |
998 |
|
$this->f->getParameter('erp_demande_ouverture_pc_daact')) { |
999 |
|
$msgenque = new MessageEnqueuer(); |
1000 |
|
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
1001 |
|
$msgenque->enqueueMessage($msgenque::$ERP_DEMANDE_OUVERTURE_PC); |
1002 |
|
} |
1003 |
|
} |
1004 |
|
} // fin de if ($this->f->getParameter('option_erp') != "") |
1005 |
} |
} |
1006 |
|
|
1007 |
/* |
/* |
1031 |
$sql = "SELECT |
$sql = "SELECT |
1032 |
quartier, arrondissement |
quartier, arrondissement |
1033 |
FROM |
FROM |
1034 |
quartier |
".DB_PREFIXE."quartier |
1035 |
WHERE |
WHERE |
1036 |
code_impots='$quartier'"; |
code_impots='$quartier'"; |
1037 |
|
|
1067 |
/* |
/* |
1068 |
* Retourne l'intructeur correspondant le mieux à la parcelle |
* Retourne l'intructeur correspondant le mieux à la parcelle |
1069 |
* */ |
* */ |
1070 |
function getInstructeurDivision( $quartier, $arrondissement, $section, $nature) { |
function getInstructeurDivision( $quartier, $arrondissement, $section, $dossier_autorisation) { |
1071 |
|
|
1072 |
$quartier = ( $quartier == NULL ) ? -1 : $quartier; |
$quartier = ( $quartier == NULL ) ? -1 : $quartier; |
1073 |
$arrondissement = ( $arrondissement == NULL ) ? -1 : $arrondissement; |
$arrondissement = ( $arrondissement == NULL ) ? -1 : $arrondissement; |
1074 |
|
|
1075 |
|
/*Récupération du dossier_autorisation_type_detaille concerné par le $dossier_autorisation*/ |
1076 |
$sql = " |
$sql = " |
1077 |
SELECT |
SELECT |
1078 |
instructeur, section, quartier, arrondissement, nature |
dossier_autorisation_type_detaille |
1079 |
FROM |
FROM |
1080 |
lien_localisation_nature l |
".DB_PREFIXE."dossier_autorisation |
1081 |
WHERE |
WHERE |
1082 |
( nature IS NULL AND arrondissement IS NULL AND quartier IS NULL AND section IS NULL ) OR |
dossier_autorisation = '$dossier_autorisation'"; |
|
( nature IS NULL AND arrondissement IS NULL AND quartier IS NULL AND section = '$section' ) OR |
|
|
( nature IS NULL AND arrondissement IS NULL AND quartier = $quartier AND section IS NULL ) OR |
|
|
( nature IS NULL AND arrondissement IS NULL AND quartier = $quartier AND section = '$section' ) OR |
|
|
( nature IS NULL AND arrondissement = $arrondissement AND quartier IS NULL AND section IS NULL ) OR |
|
|
( nature IS NULL AND arrondissement = $arrondissement AND quartier IS NULL AND section = '$section' ) OR |
|
|
( nature IS NULL AND arrondissement = $arrondissement AND quartier = $quartier AND section IS NULL ) OR |
|
|
( nature IS NULL AND arrondissement = $arrondissement AND quartier = $quartier AND section = '$section' ) OR |
|
|
( nature = '$nature' AND arrondissement IS NULL AND quartier IS NULL AND section IS NULL ) OR |
|
|
( nature = '$nature' AND arrondissement IS NULL AND quartier IS NULL AND section = '$section' ) OR |
|
|
( nature = '$nature' AND arrondissement IS NULL AND quartier = $quartier AND section IS NULL ) OR |
|
|
( nature = '$nature' AND arrondissement IS NULL AND quartier = $quartier AND section = '$section' ) OR |
|
|
( nature = '$nature' AND arrondissement = $arrondissement AND quartier IS NULL AND section IS NULL ) OR |
|
|
( nature = '$nature' AND arrondissement = $arrondissement AND quartier IS NULL AND section = '$section' ) OR |
|
|
( nature = '$nature' AND arrondissement = $arrondissement AND quartier = $quartier AND section IS NULL ) OR |
|
|
( nature = '$nature' AND arrondissement = $arrondissement AND quartier = $quartier AND section = '$section' ) |
|
|
ORDER BY section, quartier, arrondissement, nature |
|
|
LIMIT 1 |
|
|
"; |
|
1083 |
|
|
1084 |
$this->addToLog("getInstructeurDivision( quartier, arrondissement, section, nature) : db->query(\"$sql\")", VERBOSE_MODE); |
$this->addToLog("getInstructeurDivision : db->query(\"$sql\")", VERBOSE_MODE); |
1085 |
$res = $this->db->query($sql); |
$resDATD = $this->db->query($sql); |
1086 |
if (database :: isError($res)) |
if (database :: isError($resDATD)) |
1087 |
die($res->getMessage()."erreur ".$sql); |
die($resDATD->getMessage()."erreur ".$sql); |
1088 |
|
|
1089 |
if ( $res->numRows() > 0 ){ |
if ( $resDATD->numRows() > 0 ){ |
1090 |
|
$rowDATD = $resDATD->fetchRow(DB_FETCHMODE_ASSOC); |
1091 |
$row = $res->fetchRow(DB_FETCHMODE_ASSOC); |
|
1092 |
|
$sql = " |
1093 |
|
SELECT |
1094 |
|
instructeur, section, quartier, arrondissement, dossier_autorisation_type_detaille |
1095 |
|
FROM |
1096 |
|
".DB_PREFIXE."affectation_automatique l |
1097 |
|
WHERE |
1098 |
|
( dossier_autorisation_type_detaille IS NULL AND arrondissement IS NULL AND quartier IS NULL AND section IS NULL ) OR |
1099 |
|
( dossier_autorisation_type_detaille IS NULL AND arrondissement IS NULL AND quartier IS NULL AND section = '$section' ) OR |
1100 |
|
( dossier_autorisation_type_detaille IS NULL AND arrondissement IS NULL AND quartier = $quartier AND section IS NULL ) OR |
1101 |
|
( dossier_autorisation_type_detaille IS NULL AND arrondissement IS NULL AND quartier = $quartier AND section = '$section' ) OR |
1102 |
|
( dossier_autorisation_type_detaille IS NULL AND arrondissement = $arrondissement AND quartier IS NULL AND section IS NULL ) OR |
1103 |
|
( dossier_autorisation_type_detaille IS NULL AND arrondissement = $arrondissement AND quartier IS NULL AND section = '$section' ) OR |
1104 |
|
( dossier_autorisation_type_detaille IS NULL AND arrondissement = $arrondissement AND quartier = $quartier AND section IS NULL ) OR |
1105 |
|
( dossier_autorisation_type_detaille IS NULL AND arrondissement = $arrondissement AND quartier = $quartier AND section = '$section' ) OR |
1106 |
|
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement IS NULL AND quartier IS NULL AND section IS NULL ) OR |
1107 |
|
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement IS NULL AND quartier IS NULL AND section = '$section' ) OR |
1108 |
|
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement IS NULL AND quartier = $quartier AND section IS NULL ) OR |
1109 |
|
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement IS NULL AND quartier = $quartier AND section = '$section' ) OR |
1110 |
|
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement = $arrondissement AND quartier IS NULL AND section IS NULL ) OR |
1111 |
|
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement = $arrondissement AND quartier IS NULL AND section = '$section' ) OR |
1112 |
|
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement = $arrondissement AND quartier = $quartier AND section IS NULL ) OR |
1113 |
|
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement = $arrondissement AND quartier = $quartier AND section = '$section' ) |
1114 |
|
ORDER BY section, quartier, arrondissement, dossier_autorisation_type_detaille |
1115 |
|
LIMIT 1 |
1116 |
|
"; |
1117 |
|
|
1118 |
$sql = "SELECT division FROM instructeur WHERE instructeur = ".$row['instructeur']; |
$this->addToLog("getInstructeurDivision : db->query(\"$sql\")", VERBOSE_MODE); |
1119 |
$res = $this->db->query($sql); |
$res = $this->db->query($sql); |
1120 |
if (database :: isError($res)) |
if (database :: isError($res)) |
1121 |
die($res->getMessage()."erreur ".$sql); |
die($res->getMessage()."erreur ".$sql); |
1122 |
|
|
1123 |
if ( $res->numRows() > 0 ){ |
if ( $res->numRows() > 0 ){ |
1124 |
|
|
1125 |
$rowT=& $res->fetchRow(DB_FETCHMODE_ASSOC); |
$row = $res->fetchRow(DB_FETCHMODE_ASSOC); |
1126 |
$row['division'] = $rowT['division']; |
|
1127 |
|
$sql = "SELECT division FROM ".DB_PREFIXE."instructeur WHERE instructeur = ".$row['instructeur']; |
1128 |
|
$res = $this->db->query($sql); |
1129 |
|
if (database :: isError($res)) |
1130 |
|
die($res->getMessage()."erreur ".$sql); |
1131 |
|
|
1132 |
|
if ( $res->numRows() > 0 ){ |
1133 |
|
|
1134 |
|
$rowT=& $res->fetchRow(DB_FETCHMODE_ASSOC); |
1135 |
|
$row['division'] = $rowT['division']; |
1136 |
|
} |
1137 |
|
|
1138 |
|
return $row; |
1139 |
} |
} |
|
|
|
|
return $row; |
|
1140 |
} |
} |
1141 |
|
|
1142 |
return NULL; |
return NULL; |
1143 |
} |
} |
1144 |
|
|
1178 |
$section = $this->getSection($val['parcelle']); |
$section = $this->getSection($val['parcelle']); |
1179 |
} |
} |
1180 |
|
|
1181 |
// Si aucun instructeur n'est saisi et que la nature n'est pas vide |
// Si aucun instructeur n'est saisi et que la dossier_autorisation_type_detaille n'est pas vide |
1182 |
// 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 |
1183 |
if ( ( empty($this->valF['instructeur']) || $this->valF['instructeur'] == '' ) && $val['nature'] != '' ) { |
if ( ( empty($this->valF['instructeur']) || $this->valF['instructeur'] == '' ) && $val['dossier_autorisation'] != '' ) { |
1184 |
|
|
1185 |
// |
// |
1186 |
$instructeurDivision = $this->getInstructeurDivision($quartier, $arrondissement, $section, $val['nature']); |
$instructeurDivision = $this->getInstructeurDivision($quartier, $arrondissement, $section, $val['dossier_autorisation']); |
1187 |
if ( $instructeurDivision != NULL ){ |
if ( $instructeurDivision != NULL ){ |
1188 |
|
|
1189 |
$instructeur = $instructeurDivision['instructeur']; |
$instructeur = $instructeurDivision['instructeur']; |
1226 |
$this->addToMessage("<br>"._("Parcelle ou parcelle_lot non renseignee dans dossier")." ".$id." <br>"); |
$this->addToMessage("<br>"._("Parcelle ou parcelle_lot non renseignee dans dossier")." ".$id." <br>"); |
1227 |
} |
} |
1228 |
} |
} |
1229 |
|
|
1230 |
// BOGUE: le test pour la nature doit etre change parce que |
// verification si envoi vers ERP est active |
1231 |
// 'erp_depot_dossier_dat' n'a pas la connexion directe avec |
if ($this->f->getParameter('option_erp') != "") { |
1232 |
// qualification d'un dossier, mais c'est necessaire pour les tests |
if ($this->val[array_search('a_qualifier', $this->champs)] == 't' |
1233 |
if ($this->val[array_search('a_qualifier', $this->champs)] == 't' |
&& $this->valF['a_qualifier'] === false) { |
1234 |
&& $this->valF['a_qualifier'] === false) { |
|
1235 |
|
// envoi du message "ERP Qualifie" pour un dossier DAT qui a besoin |
1236 |
$dossier_nature_dat = array( |
// de la qualification URBA |
1237 |
$this->f->getParameter('erp_depot_dossier_dat'), |
if ($this->getDATDCode($this->valF['dossier']) == |
1238 |
$this->f->getParameter('erp_demande_ouverture_dat')); |
$this->f->getParameter('erp_nature_dat')) { |
1239 |
|
$msgenque = new MessageEnqueuer(); |
1240 |
// envoi du message "ERP Qualifie" pour un dossier DAT qui a besoin |
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
1241 |
// de la qualification URBA |
$msgenque->setCompetence($this->valF['autorite_competente']); |
1242 |
if (in_array($this->valF['nature'], $dossier_nature_dat)) { |
$msgenque->setContraintePlu($this->valF['servitude']); |
1243 |
$msgenque = new MessageEnqueuer(); |
$msgenque->setReferenceCadastrale( |
1244 |
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
$this->getReferenceCadastrale($this->valF['dossier'])); |
1245 |
$msgenque->setCompetence($this->valF['autorite_competente']); |
$msgenque->enqueueMessage($msgenque::$ERP_QUALIFIE); |
1246 |
$msgenque->setContraintePlu($this->valF['servitude']); |
} |
1247 |
$msgenque->setReferenceCadastrale( |
|
1248 |
$this->getReferenceCadastrale($this->valF['dossier'])); |
// envoi des messages a ERP en cas du dossier PC traite par URBA, et |
1249 |
$msgenque->enqueueMessage($msgenque::$ERP_QUALIFIE); |
// qui etait classifie come ERP |
1250 |
} |
if ($this->getDATDCode($this->valF['dossier']) == |
1251 |
|
$this->f->getParameter('erp_dossier_nature_pc') |
1252 |
// envoi des messages a ERP en cas du dossier PC traite par URBA, et |
&& $this->valF['erp'] == true) { |
1253 |
// qui etait classifie come ERP |
$msgenque = new MessageEnqueuer(); |
1254 |
if ($this->valF['nature'] == 'PC' && $this->valF['erp'] == true) { |
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
1255 |
$msgenque = new MessageEnqueuer(); |
$msgenque->enqueueMessage($msgenque::$ERP_DEMANDE_COMPLETUDE_PC); |
1256 |
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
$msgenque->enqueueMessage($msgenque::$ERP_DEMANDE_QUALIFICATION_PC); |
1257 |
$msgenque->enqueueMessage($msgenque::$ERP_DEMANDE_COMPLETUDE_PC); |
} |
|
$msgenque->enqueueMessage($msgenque::$ERP_DEMANDE_QUALIFICATION_PC); |
|
1258 |
} |
} |
1259 |
|
} // fin de if($this->f->getParameter('option_erp')) |
1260 |
} |
} |
1261 |
|
|
1262 |
|
/** |
1263 |
|
* Retourne le type de dossier d'autorisation du dossier courant : |
1264 |
|
* - dossier_autorisation_type_detaille.code |
1265 |
|
**/ |
1266 |
|
function getDATDCode($idxDossier) { |
1267 |
|
$sql = "SELECT dossier_autorisation_type_detaille.code |
1268 |
|
FROM ".DB_PREFIXE."dossier_autorisation_type_detaille |
1269 |
|
INNER JOIN ".DB_PREFIXE."dossier_autorisation |
1270 |
|
ON dossier_autorisation_type_detaille.dossier_autorisation_type_detaille = |
1271 |
|
dossier_autorisation.dossier_autorisation_type_detaille |
1272 |
|
INNER JOIN ".DB_PREFIXE."dossier ON dossier.dossier_autorisation = dossier_autorisaiton.dossier_autorisation |
1273 |
|
WHERE dossier.dossier = ".$idxDossier; |
1274 |
|
$res = $db -> getOne($sql); |
1275 |
|
$this->f->isDatabaseError(); |
1276 |
|
return $res; |
1277 |
} |
} |
1278 |
|
|
1279 |
|
|
1285 |
* sinon NULL. En cas d'erreur de la BD, l'execution s'arrete. |
* sinon NULL. En cas d'erreur de la BD, l'execution s'arrete. |
1286 |
*/ |
*/ |
1287 |
function getReferenceCadastrale($dossier) { |
function getReferenceCadastrale($dossier) { |
1288 |
$sql = "SELECT terrain_references_cadastrales FROM demande WHERE dossier_instruction = '" . $dossier . "'"; |
$sql = "SELECT terrain_references_cadastrales FROM ".DB_PREFIXE."demande WHERE dossier_instruction = '" . $dossier . "'"; |
1289 |
$res = $this->db->limitquery($sql, 0, 1); |
$res = $this->db->limitquery($sql, 0, 1); |
1290 |
$this->addToLog("getReferenceCadastrale(): db->limitquery(\"". |
$this->addToLog("getReferenceCadastrale(): db->limitquery(\"". |
1291 |
str_replace(",",", ",$sql)."\", 0, 1);", VERBOSE_MODE); |
str_replace(",",", ",$sql)."\", 0, 1);", VERBOSE_MODE); |