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 |
|
var $valIdDemandeur = array("petitionnaire_principal" => "", |
30 |
|
"delegataire" => "", |
31 |
|
"petitionnaire" => array()); |
32 |
|
var $postedIdDemandeur = array("petitionnaire_principal" => "", |
33 |
|
"delegataire" => "", |
34 |
|
"petitionnaire" => array()); |
35 |
|
|
36 |
function dossier($id,&$db,$DEBUG) { |
function dossier($id,&$db,$DEBUG) { |
37 |
$this->constructeur($id,$db,$DEBUG); |
$this->constructeur($id,$db,$DEBUG); |
38 |
} // fin constructeur |
} // fin constructeur |
39 |
|
|
40 |
|
/*Mutateur pour ma variable dossier_instruction_type*/ |
41 |
|
public function getDossierInstructionType(){ |
42 |
|
return $this->dossier_instruction_type; |
43 |
|
} |
44 |
|
public function setDossierInstructionType($dossier_instruction_type){ |
45 |
|
$this->dossier_instruction_type = $dossier_instruction_type; |
46 |
|
} |
47 |
|
|
48 |
|
// {{{ Gestion de la confidentialité des données spécifiques |
49 |
|
|
50 |
|
/** |
51 |
|
* Surcharge pour gérer les actions disponibles dans le portlet |
52 |
|
*/ |
53 |
|
function checkAccessibility() { |
54 |
|
// |
55 |
|
parent::checkAccessibility(); |
56 |
|
// Si l'utilisateur est un intructeur qui en correspond pas à la |
57 |
|
// division du dossier |
58 |
|
if ($this->f->isUserInstructeur() |
59 |
|
&& isset($this->f->om_utilisateur["division"]) |
60 |
|
&& $this->f->om_utilisateur["division"] != $this->getDivisionFromDossier()) { |
61 |
|
// |
62 |
|
$this->actions_sup = array(); |
63 |
|
$this->setParameter("actions", array()); |
64 |
|
} |
65 |
|
|
66 |
|
//Si l'utilisateur est un instructeur et le dossier d'instruction est clôturé, |
67 |
|
//il n'est plus possible de le modifier, on affiche pas le lien de modification du |
68 |
|
//portlet |
69 |
|
if ( $this->f->isUserInstructeur() && $this->getStatut() == "cloture" ){ |
70 |
|
|
71 |
|
$this->parameters["actions"]["modifier"] = NULL; |
72 |
|
|
73 |
|
//Cache le lien du rapport d'instruction, si aucun n'est lié |
74 |
|
if ( $this->getRapportInstruction() == '' ){ |
75 |
|
|
76 |
|
$this->actions_sup['rapport_instruction'] = NULL; |
77 |
|
} |
78 |
|
|
79 |
|
//Cache le lien des données techniques, si aucun n'est lié |
80 |
|
if ( $this->getDonneesTechniques() == '' ){ |
81 |
|
|
82 |
|
$this->actions_sup['donnees_techniques'] = NULL; |
83 |
|
} |
84 |
|
} |
85 |
|
} |
86 |
|
|
87 |
|
/** |
88 |
|
* Cette methode est à surcharger elle permet de tester dans chaque classe |
89 |
|
* des droits des droits spécifiques en fonction des données |
90 |
|
*/ |
91 |
|
function canAccess() { |
92 |
|
// Si l'utilisateur est un intructeur qui ne correspond pas à la |
93 |
|
// division du dossier |
94 |
|
if ($this->f->isUserInstructeur() |
95 |
|
&& $this->f->om_utilisateur["division"] != $this->getDivisionFromDossier() |
96 |
|
&& $this->getParameter("maj") != 3) { |
97 |
|
// |
98 |
|
return false; |
99 |
|
} |
100 |
|
// Si l'utilisateur est un instructeur et que le dossier est cloturé |
101 |
|
if ( $this->f->isUserInstructeur() && $this->getStatut() == "cloture" |
102 |
|
&& $this->getParameter("maj") != 3) { |
103 |
|
|
104 |
|
return false; |
105 |
|
} |
106 |
|
// |
107 |
|
return true; |
108 |
|
} |
109 |
|
|
110 |
|
/** |
111 |
|
* Cette variable permet de stocker le résultat de la méthode |
112 |
|
* getDivisionFromDossier() afin de ne pas effectuer le recalcul à chacun de |
113 |
|
* ces appels. |
114 |
|
* @var string Code de la division du dossier en cours |
115 |
|
*/ |
116 |
|
var $_division_from_dossier = NULL; |
117 |
|
|
118 |
|
/** |
119 |
|
* Cette méthode permet de récupérer le code de division correspondant |
120 |
|
* au dossier sur lequel on se trouve. |
121 |
|
* |
122 |
|
* @return string Code de la division du dossier en cours |
123 |
|
*/ |
124 |
|
function getDivisionFromDossier() { |
125 |
|
|
126 |
|
// Cette méthode peut être appelée plusieurs fois lors d'une requête. |
127 |
|
// Pour éviter de refaire le traitement de recherche de la division |
128 |
|
// alors on vérifie si nous ne l'avons pas déjà calculé. |
129 |
|
if ($this->_division_from_dossier != NULL) { |
130 |
|
// Logger |
131 |
|
$this->addToLog("getDivisionFromDossier(): retour de la valeur déjà calculée - '".$this->_division_from_dossier."'", EXTRA_VERBOSE_MODE); |
132 |
|
// On retourne la valeur déjà calculée |
133 |
|
return $this->_division_from_dossier; |
134 |
|
} |
135 |
|
|
136 |
|
// Par défaut, on définit la valeur du dossier à NULL |
137 |
|
$dossier = NULL; |
138 |
|
// Test sur le mode et le contexte du formulaire |
139 |
|
if ($this->getParameter("maj") == 0 |
140 |
|
&& ($this->getParameter("retourformulaire") == "dossier" |
141 |
|
|| $this->getParameter("retourformulaire") == "dossier_instruction" |
142 |
|
|| $this->getParameter("retourformulaire") == "dossier_instruction_mes_encours" |
143 |
|
|| $this->getParameter("retourformulaire") == "dossier_instruction_tous_encours" |
144 |
|
|| $this->getParameter("retourformulaire") == "dossier_instruction_mes_clotures" |
145 |
|
|| $this->getParameter("retourformulaire") == "dossier_instruction_tous_clotures")) { |
146 |
|
// Si on se trouve en mode AJOUT (seul mode où l'enregistrement |
147 |
|
// n'existe pas en base de données) ET que nous nous trouvons |
148 |
|
// dans le contexte d'un dossier d'instruction alors on récupère |
149 |
|
// le numéro de dossier depuis le paramètre 'idxformulaire' |
150 |
|
$dossier = $this->getParameter("idxformulaire"); |
151 |
|
} else { |
152 |
|
// Sinon on récupère le numéro de dossier dans le champs dossier de |
153 |
|
// l'enregistrement (en base de données) |
154 |
|
$dossier = $this->getVal("dossier"); |
155 |
|
} |
156 |
|
|
157 |
|
// On appelle la méthode de la classe utils qui renvoi le code de la |
158 |
|
// division d'un dossier, on la stocke pour ne pas refaire le calcul au |
159 |
|
// prochain appel de cette méthode |
160 |
|
$this->_division_from_dossier = $this->f->getDivisionFromDossier($dossier); |
161 |
|
// Logger |
162 |
|
$this->addToLog("getDivisionFromDossier(): retour de la valeur nouvellement calculée - '".$this->_division_from_dossier."'", EXTRA_VERBOSE_MODE); |
163 |
|
// On retourne la valeur retournée |
164 |
|
return $this->_division_from_dossier; |
165 |
|
|
166 |
|
} |
167 |
|
|
168 |
|
// }}} |
169 |
|
/* |
170 |
|
* Ajoute un numéro au dossier |
171 |
|
* |
172 |
|
*/ |
173 |
function setValFAjout($val = array()) { |
function setValFAjout($val = array()) { |
174 |
// Cle primaire |
|
175 |
$lettre=$this->f->collectivite["lettre"]; |
/*Récupération de la lettre associé au type de dossier d'instruction*/ |
176 |
$numero_unique = $this->f->collectivite["numero_unique"]; |
$code = $this->getCode($this->getDossierInstructionType()); |
177 |
if($numero_unique==1){ |
|
178 |
// numero unique (voir dyn/var.inc) |
/* Récupération de la valeur du suffixe ce dossier_instruction_type */ |
179 |
$temp=$this->$db->nextId(DB_PREFIXE.$this->table); |
$suffixe = $this->getSuffixe($this->getDossierInstructionType()); |
180 |
}else{ |
|
181 |
// numero suivant nature |
/*S'il est à TRUE, on récupère le numéro de version du dossier d'autorisation*/ |
182 |
$temp=$this->db->nextId(DB_PREFIXE."dossier_".$val['nature']); |
$numeroVersion = ""; |
183 |
|
if ( $suffixe == 't' ){ |
184 |
|
|
185 |
|
$numeroVersion = $this->getNumeroVersion($val['dossier_autorisation']); |
186 |
|
|
187 |
|
/* Incrémentation du numéro de version */ |
188 |
|
if ( is_numeric($numeroVersion) or $numeroVersion == -1 ){ |
189 |
|
|
190 |
|
$this->incrementNumeroVersion($val['dossier_autorisation'], ++$numeroVersion); |
191 |
|
} |
192 |
} |
} |
193 |
$temp=str_pad($temp,4,"0", STR_PAD_LEFT); |
|
194 |
$this->valF['dossier'] = $this->valF['nature'].$this->valF['annee']. |
/*Création du numéro de dossier*/ |
195 |
$lettre.$temp; |
$this->valF['dossier'] = $val['dossier_autorisation']."$code$numeroVersion"; |
196 |
|
$this->valF['version'] = $numeroVersion; |
197 |
} |
} |
198 |
|
|
199 |
|
/*Récupère la valeur du suffixe d'un dossier_instruction_type*/ |
200 |
|
function getSuffixe($dossierInstructionType){ |
201 |
|
|
202 |
|
$suffixe = ""; |
203 |
|
|
204 |
|
$sql = "SELECT |
205 |
|
suffixe |
206 |
|
FROM |
207 |
|
".DB_PREFIXE."dossier_instruction_type |
208 |
|
WHERE |
209 |
|
dossier_instruction_type = $dossierInstructionType"; |
210 |
|
|
211 |
|
$this->addToLog("getSuffixe(): db->query(\"".$sql."\")", VERBOSE_MODE); |
212 |
|
$res = $this->db->query($sql); |
213 |
|
if (database :: isError($res)) |
214 |
|
die($res->getMessage()."erreur ".$sql); |
215 |
|
|
216 |
|
if ( $res->numRows() > 0 ){ |
217 |
|
|
218 |
|
$row = $res->fetchRow(DB_FETCHMODE_ASSOC); |
219 |
|
$suffixe = $row['suffixe']; |
220 |
|
} |
221 |
|
|
222 |
|
return $suffixe; |
223 |
|
} |
224 |
|
|
225 |
|
/*Récupère dans la table de paramètrage la lettre correspondant |
226 |
|
* au dossier_instruction_type |
227 |
|
*/ |
228 |
|
function getCode($dossierInstructionType){ |
229 |
|
|
230 |
|
$code = ""; |
231 |
|
|
232 |
|
$sql = "SELECT |
233 |
|
code |
234 |
|
FROM |
235 |
|
".DB_PREFIXE."dossier_instruction_type |
236 |
|
WHERE |
237 |
|
dossier_instruction_type = $dossierInstructionType"; |
238 |
|
|
239 |
|
$this->addToLog("getCode(): db->query(\"".$sql."\")", VERBOSE_MODE); |
240 |
|
$res = $this->db->query($sql); |
241 |
|
if (database :: isError($res)) |
242 |
|
die($res->getMessage()."erreur ".$sql); |
243 |
|
|
244 |
|
if ( $res->numRows() > 0 ){ |
245 |
|
|
246 |
|
$row = $res->fetchRow(DB_FETCHMODE_ASSOC); |
247 |
|
$code = $row['code']; |
248 |
|
} |
249 |
|
|
250 |
|
return $code; |
251 |
|
} |
252 |
|
|
253 |
|
/*Récupère le numéro de version d'un dossier_autorisation*/ |
254 |
|
function getNumeroVersion($dossierAutorisation){ |
255 |
|
|
256 |
|
$numeroVersion = ""; |
257 |
|
|
258 |
|
$sql = "SELECT |
259 |
|
numero_version |
260 |
|
FROM |
261 |
|
".DB_PREFIXE."dossier_autorisation |
262 |
|
WHERE |
263 |
|
dossier_autorisation = '$dossierAutorisation'"; |
264 |
|
|
265 |
|
$this->addToLog("getNumeroVersion(): db->query(\"".$sql."\")", VERBOSE_MODE); |
266 |
|
$res = $this->db->query($sql); |
267 |
|
if (database :: isError($res)) |
268 |
|
die($res->getMessage()."erreur ".$sql); |
269 |
|
|
270 |
|
if ( $res->numRows() > 0 ){ |
271 |
|
|
272 |
|
$row = $res->fetchRow(DB_FETCHMODE_ASSOC); |
273 |
|
$numeroVersion = $row['numero_version']; |
274 |
|
} |
275 |
|
|
276 |
|
return $numeroVersion; |
277 |
|
} |
278 |
|
|
279 |
|
/*Incrémente le numéro de version du dossier*/ |
280 |
|
function incrementNumeroVersion($dossierAutorisation, $nouveauNumeroVersion) { |
281 |
|
|
282 |
|
$valF = array ( |
283 |
|
"numero_version" => $nouveauNumeroVersion |
284 |
|
); |
285 |
|
|
286 |
|
$res = $this->db->autoExecute(DB_PREFIXE."dossier_autorisation", |
287 |
|
$valF, |
288 |
|
DB_AUTOQUERY_UPDATE, |
289 |
|
"dossier_autorisation = '$dossierAutorisation'"); |
290 |
|
|
291 |
|
if (database :: isError($res)) |
292 |
|
die($res->getMessage()."erreur ".$sql); |
293 |
|
|
294 |
|
} |
295 |
|
|
296 |
function setvalF($val){ |
function setvalF($val){ |
297 |
parent::setvalF($val); |
parent::setvalF($val); |
298 |
|
|
299 |
|
// Récupération des id demandeurs postés |
300 |
|
$this->getPostedValues(); |
301 |
|
|
302 |
// 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 |
303 |
// $sig = 1 |
// $sig = 1 |
304 |
unset ($this->valF['geom']); |
unset ($this->valF['geom']); |
309 |
unset ($this->valF['etat']); |
unset ($this->valF['etat']); |
310 |
unset ($this->valF['delai']); |
unset ($this->valF['delai']); |
311 |
unset ($this->valF['accord_tacite']); |
unset ($this->valF['accord_tacite']); |
|
unset ($this->valF['types']); |
|
312 |
} |
} |
313 |
unset ($this->valF['avis_decision']); // avis + libelle avis |
unset ($this->valF['avis_decision']); // avis + libelle avis |
314 |
unset ($this->valF['terrain_surface_calcul']); |
unset ($this->valF['terrain_surface_calcul']); |
324 |
unset ($this->valF['date_conformite']); |
unset ($this->valF['date_conformite']); |
325 |
} |
} |
326 |
|
|
327 |
|
/*Vérification des données saisies*/ |
328 |
function verifier($val,&$db,$DEBUG){ |
function verifier($val,&$db,$DEBUG){ |
329 |
parent::verifier($val,$db,$DEBUG); |
parent::verifier($val,$db,$DEBUG); |
330 |
|
if(!isset($this->postedIdDemandeur["petitionnaire_principal"]) OR |
331 |
|
empty($this->postedIdDemandeur["petitionnaire_principal"])) { |
332 |
|
$this->correct = false; |
333 |
|
$this->addToMessage(_("La saisie d'un petitionnaire principal est obligatoire.")); |
334 |
|
} |
335 |
if($val['parcelle']!="" and $val['sig']!='Oui'){ |
if($val['parcelle']!="" and $val['sig']!='Oui'){ |
336 |
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'])){ |
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'])){ |
337 |
$this->correct=false; |
$this->correct=false; |
338 |
$this->addToMessage("<br>format parcelle incorrect"); |
$this->addToMessage("<br>format parcelle incorrect"); |
339 |
} |
} |
340 |
} |
} |
|
// regles travaux verification |
|
|
if ($this->valF['travaux']!=""){ |
|
|
$sql= "select * from ".DB_PREFIXE."regle where id = '".$this->valF['travaux']. |
|
|
"' and controle = 'travaux' order by ordre"; |
|
|
$res = $db->query($sql); |
|
|
if (database :: isError($res)) die($res->getMessage().$sql); |
|
|
$this->addToLog("requete ".$sql." execute <br>", EXTRA_VERBOSE_MODE); |
|
|
$regle=0; |
|
|
$msg=""; |
|
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
|
|
if(isset($this->valF[$row['champ']])) |
|
|
$champvaleur=$this->valF[$row['champ']]; |
|
|
else |
|
|
$champvaleur=0; |
|
|
switch ($row['operateur']) { |
|
|
case ">" : |
|
|
if($row['sens']=="plus"){ |
|
|
if($champvaleur > $row['valeur']) |
|
|
$condition = 1; |
|
|
else |
|
|
$condition = 0; |
|
|
if($regle==1 or $condition == 1) |
|
|
$regle=1; |
|
|
else |
|
|
$regle=0; |
|
|
$msg=$msg."<br> + ".$row['message']." [".$row['champ']." = ". |
|
|
$champvaleur."]"; |
|
|
}else{ |
|
|
if($champvaleur > $row['valeur']){ |
|
|
$condition = 0; |
|
|
}else{ |
|
|
$condition = 1; |
|
|
$regle=0; |
|
|
} |
|
|
$msg=$msg."<br> ou ".$row['message']." [".$row['champ']." = ". |
|
|
$champvaleur."]"; |
|
|
} |
|
|
break; |
|
|
case ">=": |
|
|
if($row['sens']=="plus"){ |
|
|
if($champvaleur >= $row['valeur']) |
|
|
$condition = 1; |
|
|
else |
|
|
$condition = 0; |
|
|
if($regle==1 or $condition == 1) |
|
|
$regle=1; |
|
|
else |
|
|
$regle=0; |
|
|
$msg=$msg."<br> + ".$row['message']." [".$row['champ']." = ". |
|
|
$champvaleur."]"; |
|
|
}else{ |
|
|
if($champvaleur >= $row['valeur']){ |
|
|
$condition = 0; |
|
|
|
|
|
}else{ |
|
|
$condition = 1; |
|
|
$regle=0; |
|
|
} |
|
|
$msg=$msg."<br> ou ".$row['message']." [".$row['champ']." = ". |
|
|
$champvaleur."]"; |
|
|
} |
|
|
break; |
|
|
case "<" : |
|
|
if($row['sens']=="plus"){ |
|
|
if($champvaleur < $row['valeur']) |
|
|
$condition = 1; |
|
|
else |
|
|
$condition = 0; |
|
|
if($regle==1 or $condition == 1) |
|
|
$regle=1; |
|
|
else |
|
|
$regle=0; |
|
|
$msg=$msg."<br> + ".$row['message']." [".$row['champ']." = ". |
|
|
$champvaleur."]"; |
|
|
}else{ |
|
|
if($champvaleur < $row['valeur']){ |
|
|
$condition = 0; |
|
|
}else{ |
|
|
$condition = 1; |
|
|
$regle=0; |
|
|
} |
|
|
$msg=$msg."<br> et ".$row['message']." [".$row['champ']." = ". |
|
|
$champvaleur."]"; |
|
|
} |
|
|
break; |
|
|
case "==": |
|
|
if($row['sens']=="plus"){ |
|
|
if($champvaleur == $row['valeur']) |
|
|
$condition = 1; |
|
|
else |
|
|
$condition = 0; |
|
|
if($regle==1 or $condition == 1) |
|
|
$regle=1; |
|
|
else |
|
|
$regle=0; |
|
|
$msg=$msg."<br> + ".$row['message']." [".$row['champ']." = ". |
|
|
$champvaleur."]"; |
|
|
}else{ |
|
|
if($champvaleur == $row['valeur']){ |
|
|
$condition = 0; |
|
|
|
|
|
}else{ |
|
|
$condition = 1; |
|
|
$regle=0; |
|
|
} |
|
|
$msg=$msg."<br> ou ".$row['message']." [".$row['champ']." = ". |
|
|
$champvaleur."]"; |
|
|
} |
|
|
break; |
|
|
//break; |
|
|
} // switch |
|
|
if($regle==0) |
|
|
$this->addToMessage($msg." <br>"); |
|
|
} // while |
|
|
} // travaux |
|
341 |
}//verifier |
}//verifier |
342 |
|
|
343 |
|
|
344 |
function setType(&$form,$maj) { |
function setType(&$form,$maj) { |
345 |
parent::setType($form,$maj); |
parent::setType($form,$maj); |
346 |
|
$form->setType('amenagement','hidden'); // PC |
347 |
|
$form->setType('parcelle_lot','hidden'); // PC |
348 |
|
$form->setType('parcelle_lot_lotissement','hidden'); // PC |
349 |
|
$form->setType('version','hidden'); // PC |
350 |
|
$form->setType('incompletude','hidden'); |
351 |
|
$form->setType('evenement_suivant_tacite','hidden'); |
352 |
|
$form->setType('evenement_suivant_tacite_incompletude','hidden'); |
353 |
|
$form->setType('etat_pendant_incompletude','hidden'); |
354 |
if ($maj < 2) { //ajouter et modifier |
if ($maj < 2) { //ajouter et modifier |
355 |
// cache |
// cache |
356 |
if($maj==0) $form->setType('dossier', 'hidden'); |
if($maj==0) $form->setType('dossier', 'hidden'); |
357 |
$form->setType('annee', 'hidden'); |
$form->setType('annee', 'hidden'); |
|
$form->setType('nature', 'select'); |
|
358 |
$form->setType('parcelle_archive','hidden'); |
$form->setType('parcelle_archive','hidden'); |
359 |
$form->setType('parcelle_lot_archive','hidden'); |
$form->setType('parcelle_lot_archive','hidden'); |
|
$form->setType('objet_dossier','hidden'); // PC |
|
|
$form->setType('amenagement','hidden'); // PC |
|
|
$form->setType('parcelle_lot','hidden'); // PC |
|
|
$form->setType('parcelle_lot_lotissement','hidden'); // PC |
|
360 |
|
|
361 |
$form->setType('geom1', 'hidden'); |
$form->setType('geom1', 'hidden'); |
362 |
$form->setType('geom', 'geom'); |
$form->setType('geom', 'geom'); |
363 |
$form->setType('servitude', 'hiddenstatic'); |
$form->setType('servitude', 'hiddenstatic'); |
|
|
|
|
//select |
|
|
$form->setType('terrain_numero_complement','select'); |
|
|
|
|
|
// combo |
|
|
$form->setType('rivoli','comboD'); |
|
|
$form->setType('terrain_adresse','comboG'); |
|
|
$form->setType('architecte_nom','comboG'); |
|
|
$form->setType('architecte','comboD'); |
|
364 |
|
|
365 |
|
|
366 |
// hiddenstatic |
// hiddenstatic |
367 |
if($maj==1) $form->setType('dossier', 'hiddenstatic'); |
if($maj==1) $form->setType('dossier', 'hiddenstatic'); |
368 |
$form->setType('etat','hiddenstatic'); |
$form->setType('etat','hiddenstatic'); |
369 |
$form->setType('avis_decision','hiddenstatic'); |
$form->setType('avis_decision','hiddenstatic'); |
370 |
|
$form->setType('delai_incompletude','hiddenstatic'); |
371 |
$form->setType('delai','hiddenstatic'); |
$form->setType('delai','hiddenstatic'); |
372 |
$form->setType('terrain_surface_calcul','hiddenstatic'); |
$form->setType('terrain_surface_calcul','hiddenstatic'); |
373 |
$form->setType('shon_calcul','hiddenstatic'); |
$form->setType('shon_calcul','hiddenstatic'); |
374 |
|
|
375 |
$form->setType('accord_tacite','hiddenstatic'); |
$form->setType('accord_tacite','hiddenstatic'); |
|
$form->setType('types', 'hiddenstatic'); // transfert modificatif |
|
376 |
|
|
377 |
|
|
378 |
// hiddenstaticdate |
// hiddenstaticdate |
386 |
$form->setType('date_chantier','hiddenstaticdate'); |
$form->setType('date_chantier','hiddenstaticdate'); |
387 |
$form->setType('date_achevement','hiddenstaticdate'); |
$form->setType('date_achevement','hiddenstaticdate'); |
388 |
$form->setType('date_conformite','hiddenstaticdate'); |
$form->setType('date_conformite','hiddenstaticdate'); |
389 |
|
$form->setType('date_limite_incompletude','hiddenstaticdate'); |
390 |
|
|
391 |
|
$form->setType('date_demande','hiddenstaticdate'); |
392 |
|
$form->setType('date_depot','hiddenstaticdate'); |
393 |
|
$form->setType('date_dernier_depot','hiddenstaticdate'); |
394 |
|
|
395 |
// checkbox |
// checkbox |
396 |
$form->setType('sig','checkbox'); |
$form->setType('sig','checkbox'); |
|
$form->setType('delegataire','checkbox'); |
|
|
|
|
|
// mail |
|
|
$form->setType('delegataire_email','mail'); |
|
|
$form->setType('demandeur_email','mail'); |
|
397 |
|
|
398 |
// zones temp et strategysig |
// zones temp et strategysig |
399 |
|
|
412 |
$form->setType('temp3',$temp3_type); |
$form->setType('temp3',$temp3_type); |
413 |
$form->setType('temp4',$temp4_type); |
$form->setType('temp4',$temp4_type); |
414 |
$form->setType('temp5',$temp5_type); |
$form->setType('temp5',$temp5_type); |
415 |
|
$form->setType('a_qualifier', 'checkbox'); |
416 |
|
|
417 |
|
$form->setType('parcelle', 'hidden'); |
418 |
|
$form->setType('pos', 'hidden'); |
419 |
|
$form->setType('sig', 'hidden'); |
420 |
|
$form->setType('batiment_nombre', 'hidden'); |
421 |
|
$form->setType('logement_nombre', 'hidden'); |
422 |
|
$form->setType('hauteur', 'hidden'); |
423 |
|
$form->setType('piece_nombre', 'hidden'); |
424 |
|
$form->setType('shon', 'hidden'); |
425 |
|
$form->setType('shon_calcul', 'hidden'); |
426 |
|
$form->setType('shob', 'hidden'); |
427 |
|
$form->setType('lot', 'hidden'); |
428 |
} |
} |
429 |
if ($maj == 1) { |
if ($maj == 1) { |
430 |
// |
// |
447 |
} |
} |
448 |
if($maj == 3) { |
if($maj == 3) { |
449 |
$form->setType('annee', 'hidden'); |
$form->setType('annee', 'hidden'); |
|
$form->setType('nature', 'selectstatic'); |
|
450 |
$form->setType('temp1','hidden'); |
$form->setType('temp1','hidden'); |
451 |
$form->setType('temp2','hidden'); |
$form->setType('temp2','hidden'); |
452 |
$form->setType('temp3','hidden'); |
$form->setType('temp3','hidden'); |
456 |
$form->setType('parcelle_lot_archive','hidden'); |
$form->setType('parcelle_lot_archive','hidden'); |
457 |
$form->setType('geom1','hidden'); |
$form->setType('geom1','hidden'); |
458 |
$form->setType('geom','hidden'); |
$form->setType('geom','hidden'); |
459 |
|
$form->setType('a_qualifier', 'checkboxstatic'); |
460 |
|
$form->setType('terrain_references_cadastrales','referencescadastralesstatic'); // PC |
461 |
|
$form->setType('parcelle', 'hidden'); |
462 |
|
$form->setType('pos', 'hidden'); |
463 |
|
$form->setType('sig', 'hidden'); |
464 |
|
$form->setType('batiment_nombre', 'hidden'); |
465 |
|
$form->setType('logement_nombre', 'hidden'); |
466 |
|
$form->setType('hauteur', 'hidden'); |
467 |
|
$form->setType('piece_nombre', 'hidden'); |
468 |
|
$form->setType('shon', 'hidden'); |
469 |
|
$form->setType('shon_calcul', 'hidden'); |
470 |
|
$form->setType('shob', 'hidden'); |
471 |
|
$form->setType('lot', 'hidden'); |
472 |
} |
} |
|
$form->setType('a_qualifier', 'hidden'); |
|
473 |
// |
// |
474 |
if(!$this->f->getParameter('afficher_division') === 'true') { |
if(!$this->f->getParameter('afficher_division') === 'true') { |
475 |
$form->setType('division', 'hidden'); |
$form->setType('division', 'hidden'); |
476 |
} |
} |
477 |
|
$form->setType('dossier_autorisation', 'hiddenstatic'); |
478 |
|
$form->setType('dossier_instruction_type', 'selecthiddenstatic'); |
479 |
|
// |
480 |
|
if ($maj == 0) { |
481 |
|
$form->setType('dossier_autorisation', 'select'); |
482 |
|
} |
483 |
|
// On cache enjeu_ERP si l'option n'est pas activée |
484 |
|
if($this->f->getParameter('option_ERP') != 'true') { |
485 |
|
$form->setType('erp', 'hidden'); |
486 |
|
$form->setType('enjeu_erp', 'hidden'); |
487 |
|
} |
488 |
} |
} |
489 |
|
|
490 |
function setVal(&$form,$maj,$validation){ |
function setVal(&$form,$maj,$validation){ |
493 |
if ($maj == 0){ |
if ($maj == 0){ |
494 |
//$dossier_cp = $this->f->collectivite["cp"]; |
//$dossier_cp = $this->f->collectivite["cp"]; |
495 |
//$dossier_ville = $this->f->collectivite["ville"]; |
//$dossier_ville = $this->f->collectivite["ville"]; |
|
//$form->setVal('nature', $this->nature); |
|
496 |
|
|
497 |
$form->setVal('annee', date('y')); |
$form->setVal('annee', date('y')); |
498 |
$form->setVal('date_demande', date('Y-m-d')); |
$form->setVal('date_demande', date('Y-m-d')); |
509 |
|
|
510 |
$form->setVal('accord_tacite', 'Non'); |
$form->setVal('accord_tacite', 'Non'); |
511 |
$form->setVal('etat', 'initialiser'); |
$form->setVal('etat', 'initialiser'); |
|
$form->setVal('types', 'Initial'); |
|
512 |
} |
} |
513 |
} |
} |
514 |
} |
} |
519 |
if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc.php")) |
if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc.php")) |
520 |
include ("../sql/".$db->phptype."/".$this->table.".form.inc.php"); |
include ("../sql/".$db->phptype."/".$this->table.".form.inc.php"); |
521 |
if($maj<2){ |
if($maj<2){ |
|
// travaux |
|
|
$contenu=array(); |
|
|
// prise en compte du solde en ajout |
|
|
if($maj==0) |
|
|
$sql_travaux = $sql_travaux. |
|
|
" and solde = 'Non' order by libelle"; |
|
|
else |
|
|
$sql_travaux = $sql_travaux. |
|
|
" order by libelle"; |
|
|
$res = $db->query($sql_travaux); |
|
|
if (database::isError($res)) die($res->getMessage()).$sql_travaux; |
|
|
$this->addToLog(" la requete ".$sql_travaux." est executee", VERBOSE_MODE); |
|
|
$contenu[0][0]=""; |
|
|
$contenu[1][0]=_('choisir')." "._('travaux'); |
|
|
$k=1; |
|
|
while ($row=& $res->fetchRow()){ |
|
|
$contenu[0][$k]=$row[0]; |
|
|
$contenu[1][$k]=$row[1]; |
|
|
$k++; |
|
|
} |
|
|
$form->setSelect("travaux",$contenu); |
|
|
|
|
|
// code et libelle voie |
|
|
$contenu=""; |
|
|
$contenu[0][0]="rivoli";// table |
|
|
$contenu[0][1]="rivoli"; // zone origine |
|
|
$contenu[1][0]="libelle"; |
|
|
$contenu[1][1]="terrain_adresse"; |
|
|
$form->setSelect("rivoli",$contenu); |
|
|
//terrain_adresse |
|
|
$contenu=""; |
|
|
$contenu[0][0]="rivoli";// table |
|
|
$contenu[0][1]="libelle"; // zone origine |
|
|
$contenu[1][0]="rivoli"; |
|
|
$contenu[1][1]="rivoli"; |
|
|
$form->setSelect("terrain_adresse",$contenu); |
|
|
// code et libelle architecte |
|
|
$contenu=""; |
|
|
$contenu[0][0]="architecte";// table |
|
|
$contenu[0][1]="architecte"; // zone origine |
|
|
$contenu[1][0]="nom"; |
|
|
$contenu[1][1]="architecte_nom"; |
|
|
$form->setSelect("architecte",$contenu); |
|
|
$contenu=""; |
|
|
$contenu[0][0]="architecte";// table |
|
|
$contenu[0][1]="nom"; // zone origine |
|
|
$contenu[1][0]="architecte"; |
|
|
$contenu[1][1]="architecte"; |
|
|
$form->setSelect("architecte_nom",$contenu); |
|
522 |
// parcelle_lot |
// parcelle_lot |
523 |
$contenu=""; |
$contenu=""; |
524 |
$contenu[0][0]="parcelle_lot";// table |
$contenu[0][0]="parcelle_lot";// table |
537 |
$contenu[0]=array('Non','Oui'); |
$contenu[0]=array('Non','Oui'); |
538 |
$contenu[1]=array('Non','Oui'); |
$contenu[1]=array('Non','Oui'); |
539 |
$form->setSelect("accord_tacite",$contenu); |
$form->setSelect("accord_tacite",$contenu); |
540 |
// terrain_numero_complement |
|
|
$contenu=array(); |
|
|
$contenu[0]=array('','bis','ter','quater'); |
|
|
$contenu[1]=array('','bis','ter','quater'); |
|
|
$form->setSelect("terrain_numero_complement",$contenu); |
|
541 |
// geom *** a voir |
// geom *** a voir |
542 |
if($maj==1){ //modification |
if($maj==1){ //modification |
543 |
$contenu=array(); |
$contenu=array(); |
544 |
$contenu[0]=array("dossier",$this->getParameter("idx")); |
$contenu[0]=array("dossier",$this->getParameter("idx")); |
545 |
$form->setSelect('geom',$contenu); |
$form->setSelect('geom',$contenu); |
546 |
} |
} |
547 |
|
// arrondissement recherche anvancée |
548 |
|
$this->init_select($form, $db, $maj, $debug, "arrondissement", |
549 |
|
$sql_arrondissement, $sql_arrondissement_by_id, false); |
550 |
|
// dossier_autorisation_type_detaille recherche anvancée |
551 |
|
$this->init_select($form, $db, $maj, $debug, "dossier_autorisation_type_detaille", |
552 |
|
$sql_dossier_autorisation_type_detaille, $sql_dossier_autorisation_type_detaille_by_id, false); |
553 |
/* |
/* |
554 |
* Affichage de données dans le select de la parcelle |
* Affichage de données dans le select de la parcelle |
555 |
* */ |
* */ |
579 |
function setLib(&$form,$maj) { |
function setLib(&$form,$maj) { |
580 |
parent::setLib($form,$maj); |
parent::setLib($form,$maj); |
581 |
$form->setLib('geom',''); |
$form->setLib('geom',''); |
582 |
|
$form->setLib('date_limite',_("date limite d'instruction")); |
583 |
|
$form->setLib('delai',_("delai d'instruction")); |
584 |
|
$form->setLib('accord_tacite',_("decision tacite")); |
585 |
} |
} |
586 |
|
|
587 |
function setGroupe(&$form,$maj){ |
function setGroupe(&$form,$maj){ |
|
//If ($maj==0){ |
|
|
// $form->setGroupe('date_demande','D'); |
|
|
// $form->setGroupe('date_depot','G'); |
|
|
// $form->setGroupe('division','F'); |
|
|
//}else{ |
|
|
// $form->setGroupe('dossier','D'); |
|
|
// $form->setGroupe('nature','G'); |
|
|
// $form->setGroupe('annee','G'); |
|
|
// $form->setGroupe('date_demande','G'); |
|
|
// $form->setGroupe('date_depot','G'); |
|
|
// $form->setGroupe('division','F'); |
|
|
//} |
|
|
$form->setGroupe('demandeur_categorie','D'); |
|
|
$form->setGroupe('demandeur_civilite','G'); |
|
|
$form->setGroupe('demandeur_nom','F'); |
|
|
|
|
|
$form->setGroupe('demandeur_societe','D'); |
|
|
$form->setGroupe('demandeur_adresse','G'); |
|
|
$form->setGroupe('demandeur_adresse_complement','F'); |
|
|
|
|
|
$form->setGroupe('demandeur_cp','D'); |
|
|
$form->setGroupe('demandeur_ville','G'); |
|
|
$form->setGroupe('demandeur_pays','F'); |
|
|
|
|
|
$form->setGroupe('demandeur_email','D'); |
|
|
$form->setGroupe('demandeur_telephone','F'); |
|
|
|
|
|
$form->setGroupe('delegataire','D'); |
|
|
$form->setGroupe('delegataire_civilite','G'); |
|
|
$form->setGroupe('delegataire_nom','F'); |
|
|
|
|
|
$form->setGroupe('delegataire_societe','D'); |
|
|
$form->setGroupe('delegataire_adresse','G'); |
|
|
$form->setGroupe('delegataire_adresse_complement','F'); |
|
|
$form->setGroupe('delegataire_cp','D'); |
|
|
$form->setGroupe('delegataire_ville','G'); |
|
|
$form->setGroupe('delegataire_pays','F'); |
|
|
|
|
|
$form->setGroupe('delegataire_email','D'); |
|
|
$form->setGroupe('delegataire_telephone','F'); |
|
|
|
|
|
$form->setGroupe('architecte','D'); |
|
|
$form->setGroupe('architecte_nom','F'); |
|
|
//$form->setGroupe('saisie_architecte','F'); |
|
|
|
|
|
$form->setGroupe('travaux','D'); |
|
|
$form->setGroupe('travaux_complement','F'); |
|
|
|
|
|
// terrain |
|
|
$form->setGroupe('terrain_numero','D'); |
|
|
$form->setGroupe('terrain_numero_complement','G'); |
|
|
$form->setGroupe('rivoli','F'); |
|
|
$form->setGroupe('terrain_adresse','D'); |
|
|
$form->setGroupe('terrain_adresse_complement','F'); |
|
|
|
|
|
$form->setGroupe('terrain_cp','D'); |
|
|
$form->setGroupe('terrain_ville','F'); |
|
|
|
|
|
// surface |
|
|
$form->setGroupe('terrain_surface','D'); |
|
|
$form->setGroupe('terrain_surface_calcul','F'); |
|
|
|
|
|
// instruction |
|
|
$form->setGroupe('date_complet','D'); |
|
|
$form->setGroupe('date_rejet','G'); |
|
|
$form->setGroupe('rejet','G'); |
|
|
$form->setGroupe('delai','F'); |
|
|
|
|
|
$form->setGroupe('date_limite','D'); |
|
|
$form->setGroupe('date_notification_delai','G'); |
|
|
$form->setGroupe('accord_tacite','G'); |
|
|
$form->setGroupe('etat','F'); |
|
|
|
|
|
$form->setGroupe('date_decision','D'); |
|
|
$form->setGroupe('avis_decision','G'); |
|
|
$form->setGroupe('date_validite','G'); |
|
|
$form->setGroupe('types','F'); |
|
|
|
|
|
$form->setGroupe('date_chantier','D'); |
|
|
$form->setGroupe('date_achevement','G'); |
|
|
$form->setGroupe('date_conformite','F'); |
|
588 |
|
|
589 |
// localisation |
// localisation |
590 |
$form->setGroupe('parcelle','D'); |
$form->setGroupe('parcelle','D'); |
600 |
$form->setGroupe('geom','F'); |
$form->setGroupe('geom','F'); |
601 |
} |
} |
602 |
|
|
|
// description |
|
|
$form->setGroupe('batiment_nombre','D'); |
|
|
$form->setGroupe('logement_nombre','G'); |
|
|
$form->setGroupe('hauteur','G'); |
|
|
$form->setGroupe('piece_nombre','F'); |
|
|
|
|
|
$form->setGroupe('shon','D'); |
|
|
$form->setGroupe('shon_calcul','G'); |
|
|
$form->setGroupe('shob','G'); |
|
|
$form->setGroupe('lot','F'); |
|
|
|
|
|
$form->setGroupe('amenagement','D'); |
|
|
$form->setGroupe('parcelle_lot','G'); |
|
|
$form->setGroupe('parcelle_lot_lotissement','F'); |
|
603 |
} |
} |
604 |
|
|
605 |
function setOnchange(&$form,$maj){ |
function setOnchange(&$form,$maj){ |
620 |
function setLayout(&$form, $maj) { |
function setLayout(&$form, $maj) { |
621 |
// |
// |
622 |
$form->setBloc('dossier', 'D', '', ($maj == 3 ? 'col_9':'col_12')); |
$form->setBloc('dossier', 'D', '', ($maj == 3 ? 'col_9':'col_12')); |
623 |
$form->setBloc('dossier', 'D', '', 'col_9'); |
$form->setBloc('dossier', 'D', '', 'col_9'); |
624 |
$form->setFieldset('dossier', 'D', _("Dossier d'instruction")); |
|
625 |
$form->setFieldset('autorite_competente', 'F'); |
$form->setFieldset('dossier', 'D', _("Dossier d'instruction")); |
626 |
$form->setBloc('autorite_competente', 'F'); |
$form->setFieldset('autorite_competente', 'F'); |
627 |
$form->setBloc('date_demande', 'D', '', 'col_3'); |
|
628 |
$form->setFieldset('date_demande', 'D', _("Depot")); |
$form->setBloc('autorite_competente', 'F'); |
629 |
$form->setFieldset('date_depot', 'F'); |
|
630 |
$form->setFieldset('enjeu_urba', 'D', _("Enjeu")); |
$form->setBloc('date_demande', 'D', '', 'col_3'); |
631 |
$form->setFieldset('enjeu_erp', 'F'); |
|
632 |
$form->setBloc('enjeu_erp', 'F'); |
$form->setFieldset('date_demande', 'D', _("Depot")); |
633 |
$form->setBloc('enjeu_erp', 'F'); |
$form->setFieldset('date_dernier_depot', 'F'); |
634 |
// |
|
635 |
$form->setBloc('objet_dossier', 'D', '', 'col_12'); |
$form->setFieldset('enjeu_urba', 'D', _("Enjeu")); |
636 |
// |
$form->setFieldset('enjeu_erp', 'F'); |
637 |
$form->setFieldset('date_complet', 'D', _('Instruction'), 'col_12'); |
|
638 |
$form->setRegroupe('date_conformite','F',''); |
$form->setFieldset('erp', 'D', _("Qualification")); |
639 |
|
$form->setFieldset('a_qualifier', 'F'); |
640 |
|
|
641 |
|
$form->setBloc('a_qualifier', 'F'); |
642 |
|
$form->setBloc('a_qualifier', 'F'); |
643 |
// |
// |
644 |
$form->setBloc('geom1', 'F'); |
$form->setBloc('date_complet', 'D', '', 'col_12'); |
645 |
|
|
646 |
|
$form->setFieldset('date_complet', 'D', _('Instruction'), 'col_12'); |
647 |
|
|
648 |
|
$form->setBloc('date_complet', 'D', '', 'col_4'); |
649 |
|
$form->setBloc('date_limite_incompletude', 'F'); |
650 |
|
|
651 |
|
$form->setBloc('date_rejet', 'D', '', 'col_4'); |
652 |
|
$form->setBloc('delai_incompletude', 'F'); |
653 |
|
|
654 |
|
$form->setBloc('etat', 'D', '', 'col_4'); |
655 |
|
$form->setBloc('date_conformite', 'F'); |
656 |
|
|
657 |
|
$form->setFieldset('date_conformite','F',''); |
658 |
|
|
659 |
|
$form->setBloc('date_conformite', 'F'); |
660 |
|
|
661 |
|
$form->setBloc('parcelle','D',"", "col_12"); |
662 |
|
$form->setBloc('geom1','F'); |
663 |
|
|
664 |
|
//Fieldset "Localisation du terrain" |
665 |
|
$form->setBloc('terrain_references_cadastrales','D',"","col_12"); |
666 |
|
$form->setFieldset('terrain_references_cadastrales','D',_('Localisation du terrain')); |
667 |
|
$form->setFieldset('terrain_superficie','F',''); |
668 |
|
$form->setBloc('terrain_superficie','F'); |
669 |
} |
} |
670 |
|
|
671 |
function setRegroupe(&$form,$maj) { |
function setRegroupe(&$form,$maj) { |
680 |
//$form->setRegroupe('date_depot','G',''); |
//$form->setRegroupe('date_depot','G',''); |
681 |
//$form->setRegroupe('division','F',''); |
//$form->setRegroupe('division','F',''); |
682 |
|
|
683 |
// travaux |
|
|
$form->setRegroupe('architecte','D',_('Architecte')." / "._("Travaux"), $this->aff_travaux); |
|
|
$form->setRegroupe('architecte_nom','G',''); |
|
|
$form->setRegroupe('travaux','G',''); |
|
|
$form->setRegroupe('travaux_complement','F',''); |
|
|
|
|
|
//// instruction |
|
|
//$form->setRegroupe('date_complet','D',_('Instruction'), $this->aff_instruction); |
|
|
//$form->setRegroupe('date_rejet','G',''); |
|
|
//$form->setRegroupe('date_notification_delai','G',''); |
|
|
//$form->setRegroupe('delai','G',''); |
|
|
//$form->setRegroupe('date_limite','G','Decision '); |
|
|
//$form->setRegroupe('accord_tacite','G',''); |
|
|
//$form->setRegroupe('etat','G',''); |
|
|
//$form->setRegroupe('date_decision','G',''); |
|
|
//$form->setRegroupe('avis_decision','G',''); |
|
|
//$form->setRegroupe('date_validite','G',''); |
|
|
//$form->setRegroupe('types','G',''); |
|
|
//$form->setRegroupe('date_chantier','G',''); |
|
|
//$form->setRegroupe('date_achevement','G',''); |
|
|
//$form->setRegroupe('date_conformite','F',''); |
|
|
|
|
|
// demandeur |
|
|
$form->setRegroupe('demandeur_categorie','D',_('Demandeur'), $this->aff_demandeur); |
|
|
$form->setRegroupe('demandeur_civilite','G',''); |
|
|
$form->setRegroupe('demandeur_nom','G',''); |
|
|
$form->setRegroupe('demandeur_societe','G',''); |
|
|
$form->setRegroupe('demandeur_adresse','G','Decision '); |
|
|
$form->setRegroupe('demandeur_cp','G',''); |
|
|
$form->setRegroupe('demandeur_ville','G',''); |
|
|
$form->setRegroupe('demandeur_pays','G',''); |
|
|
$form->setRegroupe('demandeur_email','G',''); |
|
|
$form->setRegroupe('demandeur_telephone','F',''); |
|
|
|
|
|
|
|
|
// delegataire |
|
|
$form->setRegroupe('delegataire','D',_('delegataire'), $this->aff_delegataire); |
|
|
$form->setRegroupe('delegataire_civilite','G',''); |
|
|
$form->setRegroupe('delegataire_nom','G',''); |
|
|
$form->setRegroupe('delegataire_societe','G',''); |
|
|
$form->setRegroupe('delegataire_adresse','G','Decision '); |
|
|
$form->setRegroupe('delegataire_cp','G',''); |
|
|
$form->setRegroupe('delegataire_ville','G',''); |
|
|
$form->setRegroupe('delegataire_pays','G',''); |
|
|
$form->setRegroupe('delegataire_email','G',''); |
|
|
$form->setRegroupe('delegataire_telephone','F',''); |
|
|
|
|
|
// terrain |
|
|
$form->setRegroupe('terrain_numero','D',_('terrain'), $this->aff_terrain); |
|
|
$form->setRegroupe('terrain_numero_complement','G',''); |
|
|
$form->setRegroupe('rivoli','G',''); |
|
|
$form->setRegroupe('terrain_adresse','G',''); |
|
|
$form->setRegroupe('terrain_adresse_complement','G',''); |
|
|
$form->setRegroupe('terrain_cp','G',''); |
|
|
$form->setRegroupe('terrain_ville','G',''); |
|
|
$form->setRegroupe('terrain_surface','G',_('surface'),'');// $this->aff_surface); |
|
|
$form->setRegroupe('terrain_surface_calcul','F',''); |
|
|
|
|
|
// localisation |
|
|
$form->setRegroupe('parcelle','D',_('localisation'), $this->aff_localisation); |
|
|
$form->setRegroupe('pos','G',''); |
|
|
$form->setRegroupe('sig','F',''); |
|
|
if($maj==1){ |
|
|
$form->setRegroupe('sig','G',''); |
|
|
$form->setRegroupe('geom','F',''); |
|
|
} |
|
|
|
|
|
// description |
|
|
$form->setRegroupe('batiment_nombre','D',_('statistique'), $this->aff_description); |
|
|
$form->setRegroupe('logement_nombre','G',''); |
|
|
$form->setRegroupe('hauteur','G',''); |
|
|
$form->setRegroupe('piece_nombre','G',''); |
|
|
$form->setRegroupe('shon','G',''); |
|
|
$form->setRegroupe('shon_calcul','G',''); |
|
|
$form->setRegroupe('shob','G',''); |
|
|
$form->setRegroupe('lot','F',''); |
|
684 |
|
|
685 |
$form->setRegroupe('description','D',_('description').' '._('servitude'), $this->aff_amenagement); |
$form->setRegroupe('description','D',_('description').' '._('servitude'), $this->aff_amenagement); |
686 |
$form->setRegroupe('servitude','F',''); |
$form->setRegroupe('servitude','F',''); |
687 |
|
|
688 |
// amenagement |
|
|
$form->setRegroupe('amenagement','D',_('Amenagement'), $this->aff_amenagement); |
|
|
$form->setRegroupe('parcelle_lot','G',''); |
|
|
$form->setRegroupe('parcelle_lot_lotissement','F',''); |
|
689 |
} |
} |
690 |
|
|
|
|
|
|
|
|
691 |
/* ============================================================= |
/* ============================================================= |
692 |
* fonction trigger relative a la connexion SIG |
* fonction trigger relative a la connexion SIG |
693 |
* $sig = 1 dans dyn/var.inc |
* $sig = 1 dans dyn/var.inc |
708 |
|
|
709 |
} |
} |
710 |
|
|
711 |
// envoie d'une message au service REST d'ERP |
|
712 |
if ($this->valF['enjeu_erp'] === true) { |
if ($this->f->getParameter('option_erp') != "") { |
713 |
$msgenque = new MessageEnqueuer(); |
// envoi du message a ERP en cas d'un depot du dossier dat |
714 |
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
if ($this->getDATDCode($this->valF['dossier']) == |
715 |
$msgenque->enqueueMessage($msgenque::$ERP_DEPOT_DOSSIER_DAT); |
$this->f->getParameter('erp_depot_dossier_dat')) { |
716 |
} |
$msgenque = new MessageEnqueuer(); |
717 |
|
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
718 |
|
$msgenque->enqueueMessage($msgenque::$ERP_DEPOT_DOSSIER_DAT); |
719 |
|
} |
720 |
|
|
721 |
|
// envoi du message a ERP en cas d'une demande d'ouverture DAT |
722 |
|
if ($this->getDATDCode($this->valF['dossier']) == |
723 |
|
$this->f->getParameter('erp_demande_ouverture_dat')) { |
724 |
|
$msgenque = new MessageEnqueuer(); |
725 |
|
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
726 |
|
$msgenque->enqueueMessage($msgenque::$ERP_DEMANDE_OUVERTURE_DAT); |
727 |
|
} |
728 |
|
|
729 |
|
if ($this->valF['erp'] === true) { |
730 |
|
// envoi du message a ERP en cas d'annulation d'une demande |
731 |
|
if ($this->getDATDCode($this->valF['dossier']) == |
732 |
|
$this->f->getParameter('erp_annulation_demande')) { |
733 |
|
$msgenque = new MessageEnqueuer(); |
734 |
|
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
735 |
|
$msgenque->enqueueMessage($msgenque::$ERP_ANNULATION_DEMANDE); |
736 |
|
} |
737 |
|
|
738 |
|
// envoi du message a ERP en cas d'ouverture d'un dossier PC "rattache" |
739 |
|
// au dossier DAACT |
740 |
|
if ($this->getDATDCode($this->valF['dossier']) == |
741 |
|
$this->f->getParameter('erp_demande_ouverture_pc_daact')) { |
742 |
|
$msgenque = new MessageEnqueuer(); |
743 |
|
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
744 |
|
$msgenque->enqueueMessage($msgenque::$ERP_DEMANDE_OUVERTURE_PC); |
745 |
|
} |
746 |
|
} |
747 |
|
} // fin de if ($this->f->getParameter('option_erp') != "") |
748 |
|
|
749 |
|
// Mise à jour des données du dossier d'autorisation |
750 |
|
require_once "../obj/dossier_autorisation.class.php"; |
751 |
|
$da = new dossier_autorisation($this->valF["dossier_autorisation"], $this->db, DEBUG); |
752 |
|
$da->majDossierAutorisation(); |
753 |
} |
} |
754 |
|
|
755 |
/* |
/* |
779 |
$sql = "SELECT |
$sql = "SELECT |
780 |
quartier, arrondissement |
quartier, arrondissement |
781 |
FROM |
FROM |
782 |
quartier |
".DB_PREFIXE."quartier |
783 |
WHERE |
WHERE |
784 |
code_impots='$quartier'"; |
code_impots='$quartier'"; |
785 |
|
|
815 |
/* |
/* |
816 |
* Retourne l'intructeur correspondant le mieux à la parcelle |
* Retourne l'intructeur correspondant le mieux à la parcelle |
817 |
* */ |
* */ |
818 |
function getInstructeurDivision( $quartier, $arrondissement, $section, $nature) { |
function getInstructeurDivision( $quartier, $arrondissement, $section, $dossier_autorisation) { |
819 |
|
|
820 |
$quartier = ( $quartier == NULL ) ? -1 : $quartier; |
$quartier = ( $quartier == NULL ) ? -1 : $quartier; |
821 |
$arrondissement = ( $arrondissement == NULL ) ? -1 : $arrondissement; |
$arrondissement = ( $arrondissement == NULL ) ? -1 : $arrondissement; |
822 |
|
|
823 |
|
/*Récupération du dossier_autorisation_type_detaille concerné par le $dossier_autorisation*/ |
824 |
$sql = " |
$sql = " |
825 |
SELECT |
SELECT |
826 |
instructeur, section, quartier, arrondissement, nature |
dossier_autorisation_type_detaille |
827 |
FROM |
FROM |
828 |
lien_localisation_nature l |
".DB_PREFIXE."dossier_autorisation |
829 |
WHERE |
WHERE |
830 |
( 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 |
|
|
"; |
|
831 |
|
|
832 |
$this->addToLog("getInstructeurDivision( quartier, arrondissement, section, nature) : db->query(\"$sql\")", VERBOSE_MODE); |
$this->addToLog("getInstructeurDivision : db->query(\"$sql\")", VERBOSE_MODE); |
833 |
$res = $this->db->query($sql); |
$resDATD = $this->db->query($sql); |
834 |
if (database :: isError($res)) |
if (database :: isError($resDATD)) |
835 |
die($res->getMessage()."erreur ".$sql); |
die($resDATD->getMessage()."erreur ".$sql); |
836 |
|
|
837 |
if ( $res->numRows() > 0 ){ |
if ( $resDATD->numRows() > 0 ){ |
838 |
|
$rowDATD = $resDATD->fetchRow(DB_FETCHMODE_ASSOC); |
839 |
|
|
840 |
$row = $res->fetchRow(DB_FETCHMODE_ASSOC); |
$sql = " |
841 |
|
SELECT |
842 |
|
instructeur, section, quartier, arrondissement, dossier_autorisation_type_detaille |
843 |
|
FROM |
844 |
|
".DB_PREFIXE."affectation_automatique l |
845 |
|
WHERE |
846 |
|
( dossier_autorisation_type_detaille IS NULL AND arrondissement IS NULL AND quartier IS NULL AND section IS NULL ) OR |
847 |
|
( dossier_autorisation_type_detaille IS NULL AND arrondissement IS NULL AND quartier IS NULL AND section = '$section' ) OR |
848 |
|
( dossier_autorisation_type_detaille IS NULL AND arrondissement IS NULL AND quartier = $quartier AND section IS NULL ) OR |
849 |
|
( dossier_autorisation_type_detaille IS NULL AND arrondissement IS NULL AND quartier = $quartier AND section = '$section' ) OR |
850 |
|
( dossier_autorisation_type_detaille IS NULL AND arrondissement = $arrondissement AND quartier IS NULL AND section IS NULL ) OR |
851 |
|
( dossier_autorisation_type_detaille IS NULL AND arrondissement = $arrondissement AND quartier IS NULL AND section = '$section' ) OR |
852 |
|
( dossier_autorisation_type_detaille IS NULL AND arrondissement = $arrondissement AND quartier = $quartier AND section IS NULL ) OR |
853 |
|
( dossier_autorisation_type_detaille IS NULL AND arrondissement = $arrondissement AND quartier = $quartier AND section = '$section' ) OR |
854 |
|
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement IS NULL AND quartier IS NULL AND section IS NULL ) OR |
855 |
|
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement IS NULL AND quartier IS NULL AND section = '$section' ) OR |
856 |
|
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement IS NULL AND quartier = $quartier AND section IS NULL ) OR |
857 |
|
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement IS NULL AND quartier = $quartier AND section = '$section' ) OR |
858 |
|
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement = $arrondissement AND quartier IS NULL AND section IS NULL ) OR |
859 |
|
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement = $arrondissement AND quartier IS NULL AND section = '$section' ) OR |
860 |
|
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement = $arrondissement AND quartier = $quartier AND section IS NULL ) OR |
861 |
|
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement = $arrondissement AND quartier = $quartier AND section = '$section' ) |
862 |
|
ORDER BY section, quartier, arrondissement, dossier_autorisation_type_detaille |
863 |
|
LIMIT 1 |
864 |
|
"; |
865 |
|
|
866 |
$sql = "SELECT division FROM instructeur WHERE instructeur = ".$row['instructeur']; |
$this->addToLog("getInstructeurDivision : db->query(\"$sql\")", VERBOSE_MODE); |
867 |
$res = $this->db->query($sql); |
$res = $this->db->query($sql); |
868 |
if (database :: isError($res)) |
if (database :: isError($res)) |
869 |
die($res->getMessage()."erreur ".$sql); |
die($res->getMessage()."erreur ".$sql); |
870 |
|
|
871 |
if ( $res->numRows() > 0 ){ |
if ( $res->numRows() > 0 ){ |
872 |
|
|
873 |
$rowT=& $res->fetchRow(DB_FETCHMODE_ASSOC); |
$row = $res->fetchRow(DB_FETCHMODE_ASSOC); |
874 |
$row['division'] = $rowT['division']; |
|
875 |
|
$sql = "SELECT division FROM ".DB_PREFIXE."instructeur WHERE instructeur = ".$row['instructeur']; |
876 |
|
$res = $this->db->query($sql); |
877 |
|
if (database :: isError($res)) |
878 |
|
die($res->getMessage()."erreur ".$sql); |
879 |
|
|
880 |
|
if ( $res->numRows() > 0 ){ |
881 |
|
|
882 |
|
$rowT=& $res->fetchRow(DB_FETCHMODE_ASSOC); |
883 |
|
$row['division'] = $rowT['division']; |
884 |
|
} |
885 |
|
|
886 |
|
return $row; |
887 |
} |
} |
|
|
|
|
return $row; |
|
888 |
} |
} |
889 |
|
|
890 |
return NULL; |
return NULL; |
891 |
} |
} |
892 |
|
|
904 |
$quartier = NULL; |
$quartier = NULL; |
905 |
$arrondissement = NULL; |
$arrondissement = NULL; |
906 |
$section = NULL; |
$section = NULL; |
907 |
|
$instructeur = NULL; |
908 |
|
|
909 |
// Si la parcelle n'est pas vide alors on récupère la section, le |
// Si la parcelle n'est pas vide alors on récupère la section, le |
910 |
// quartier et l'arrondissement |
// quartier et l'arrondissement |
926 |
$section = $this->getSection($val['parcelle']); |
$section = $this->getSection($val['parcelle']); |
927 |
} |
} |
928 |
|
|
929 |
// 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 |
930 |
// 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 |
931 |
if ( ( empty($this->valF['instructeur']) || $this->valF['instructeur'] == '' ) && $val['nature'] != '' ) { |
if ( ( empty($this->valF['instructeur']) || $this->valF['instructeur'] == '' ) && $val['dossier_autorisation'] != '' ) { |
932 |
|
|
933 |
// |
// |
934 |
$instructeurDivision = $this->getInstructeurDivision($quartier, $arrondissement, $section, $val['nature']); |
$instructeurDivision = $this->getInstructeurDivision($quartier, $arrondissement, $section, $val['dossier_autorisation']); |
935 |
if ( $instructeurDivision != NULL ){ |
if ( $instructeurDivision != NULL ){ |
936 |
|
|
937 |
$instructeur = $instructeurDivision['instructeur']; |
$instructeur = $instructeurDivision['instructeur']; |
974 |
$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>"); |
975 |
} |
} |
976 |
} |
} |
977 |
// si la qualification est changée, envoie une message au service ERP |
|
978 |
if ($this->val[array_search('a_qualifier', $this->champs)] != $this->valF['a_qualifier'] |
// verification si envoi vers ERP est active |
979 |
&& $this->valF['enjeu_erp'] === true) { |
if ($this->f->getParameter('option_erp') != "") { |
980 |
$msgenque = new MessageEnqueuer(); |
if ($this->val[array_search('a_qualifier', $this->champs)] == 't' |
981 |
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
&& $this->valF['a_qualifier'] === false) { |
982 |
//$msgenque->competence(xxx); // TODO |
|
983 |
//$msgenque->contrainte_plu(xxx); // TODO |
// envoi du message "ERP Qualifie" pour un dossier DAT qui a besoin |
984 |
$msgenque->enqueueMessage($msgenque::$ERP_DEPOT_DOSSIER_DAT); |
// de la qualification URBA |
985 |
|
if ($this->getDATDCode($this->valF['dossier']) == |
986 |
|
$this->f->getParameter('erp_nature_dat')) { |
987 |
|
$msgenque = new MessageEnqueuer(); |
988 |
|
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
989 |
|
$msgenque->setCompetence($this->valF['autorite_competente']); |
990 |
|
$msgenque->setContraintePlu($this->valF['servitude']); |
991 |
|
$msgenque->setReferenceCadastrale( |
992 |
|
$this->getReferenceCadastrale($this->valF['dossier'])); |
993 |
|
$msgenque->enqueueMessage($msgenque::$ERP_QUALIFIE); |
994 |
|
} |
995 |
|
|
996 |
|
// envoi des messages a ERP en cas du dossier PC traite par URBA, et |
997 |
|
// qui etait classifie come ERP |
998 |
|
if ($this->getDATDCode($this->valF['dossier']) == |
999 |
|
$this->f->getParameter('erp_dossier_nature_pc') |
1000 |
|
&& $this->valF['erp'] == true) { |
1001 |
|
$msgenque = new MessageEnqueuer(); |
1002 |
|
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
1003 |
|
$msgenque->enqueueMessage($msgenque::$ERP_DEMANDE_COMPLETUDE_PC); |
1004 |
|
$msgenque->enqueueMessage($msgenque::$ERP_DEMANDE_QUALIFICATION_PC); |
1005 |
|
} |
1006 |
|
} |
1007 |
|
} // fin de if($this->f->getParameter('option_erp')) |
1008 |
|
|
1009 |
|
// Ajout ou modification des demandeurs |
1010 |
|
$this->insertLinkDemandeDemandeur($db, $DEBUG); |
1011 |
|
} |
1012 |
|
|
1013 |
|
/** |
1014 |
|
* Ne servira surement pas mais dans le doute autant recalculer les données du DA |
1015 |
|
*/ |
1016 |
|
function triggersupprimerapres($id,&$db,$val,$DEBUG) { |
1017 |
|
// Mise à jour des données du dossier d'autorisation |
1018 |
|
require_once "../obj/dossier_autorisation.class.php"; |
1019 |
|
$da = new dossier_autorisation($this->valF["dossier_autorisation"], $this->db, DEBUG); |
1020 |
|
$da->majDossierAutorisation(); |
1021 |
|
} |
1022 |
|
|
1023 |
|
/** |
1024 |
|
* Retourne le type de dossier d'autorisation du dossier courant : |
1025 |
|
* - dossier_autorisation_type_detaille.code |
1026 |
|
**/ |
1027 |
|
function getDATDCode($idxDossier) { |
1028 |
|
$sql = "SELECT dossier_autorisation_type_detaille.code |
1029 |
|
FROM ".DB_PREFIXE."dossier_autorisation_type_detaille |
1030 |
|
INNER JOIN ".DB_PREFIXE."dossier_autorisation |
1031 |
|
ON dossier_autorisation_type_detaille.dossier_autorisation_type_detaille = |
1032 |
|
dossier_autorisation.dossier_autorisation_type_detaille |
1033 |
|
INNER JOIN ".DB_PREFIXE."dossier ON dossier.dossier_autorisation = dossier_autorisation.dossier_autorisation |
1034 |
|
WHERE dossier.dossier = '".$idxDossier."'"; |
1035 |
|
$res = $this -> db -> getOne($sql); |
1036 |
|
$this->f->addToLog("getDATDCode() : db->getOne(\"".$sql."\")", VERBOSE_MODE); |
1037 |
|
if ( database::isError($res)){ |
1038 |
|
die(); |
1039 |
|
} |
1040 |
|
return $res; |
1041 |
|
} |
1042 |
|
|
1043 |
|
|
1044 |
|
/** |
1045 |
|
* Retourne la reference cadastrale de la demande attache a un dossier ERP |
1046 |
|
* specifique |
1047 |
|
* @param string $dossier L'identifiant du dossier |
1048 |
|
* @return string|null La reference cadastrale si elle est trouve, |
1049 |
|
* sinon NULL. En cas d'erreur de la BD, l'execution s'arrete. |
1050 |
|
*/ |
1051 |
|
function getReferenceCadastrale($dossier) { |
1052 |
|
$sql = "SELECT terrain_references_cadastrales FROM ".DB_PREFIXE."demande WHERE dossier_instruction = '" . $dossier . "'"; |
1053 |
|
$res = $this->db->limitquery($sql, 0, 1); |
1054 |
|
$this->addToLog("getReferenceCadastrale(): db->limitquery(\"". |
1055 |
|
str_replace(",",", ",$sql)."\", 0, 1);", VERBOSE_MODE); |
1056 |
|
// Si une erreur survient on die |
1057 |
|
if (database::isError($res, true)) { |
1058 |
|
// Appel de la methode de recuperation des erreurs |
1059 |
|
$this->erreur_db($res->getDebugInfo(), $res->getMessage(), 'demande'); |
1060 |
|
} |
1061 |
|
// retourne la nature du dossier |
1062 |
|
while ($row =& $res->fetchRow()) { |
1063 |
|
return $row[0]; |
1064 |
} |
} |
1065 |
|
// la nature n'etait pas trouve, ce qui ne devrait pas se passer |
1066 |
|
return NULL; |
1067 |
} |
} |
1068 |
|
|
1069 |
|
|
1070 |
function sig_parametre(&$db){ |
function sig_parametre(&$db){ |
1071 |
if (file_exists ("../dyn/var.inc")) |
if (file_exists ("../dyn/var.inc")) |
1211 |
$this->servitude.=" [".$row['libelle']."] ".$row['observation']." a ".round($row['distance'],2)." m - "; |
$this->servitude.=" [".$row['libelle']."] ".$row['observation']." a ".round($row['distance'],2)." m - "; |
1212 |
} |
} |
1213 |
} |
} |
1214 |
|
|
1215 |
|
/** |
1216 |
|
* Gestion des liens entre la demande et les demandeurs recemment ajoutés |
1217 |
|
**/ |
1218 |
|
function insertLinkDemandeDemandeur($db, $DEBUG) { |
1219 |
|
// |
1220 |
|
require_once "../obj/lien_dossier_demandeur.class.php"; |
1221 |
|
// Sippression des anciens demandeurs |
1222 |
|
$this->deleteLinkDossierDemandeur($db, $DEBUG); |
1223 |
|
|
1224 |
|
// Ajout du pétitionnaire principal |
1225 |
|
if(!empty($this->postedIdDemandeur['petitionnaire_principal'])) { |
1226 |
|
$this->addLinkDossierDemandeur($this->postedIdDemandeur['petitionnaire_principal'], true, $db, $DEBUG); |
1227 |
|
} |
1228 |
|
|
1229 |
|
// Ajout du délégataire |
1230 |
|
if(!empty($this->postedIdDemandeur['delegataire'])) { |
1231 |
|
$this->addLinkDossierDemandeur($this->postedIdDemandeur['delegataire'], false, $db, $DEBUG); |
1232 |
|
} |
1233 |
|
|
1234 |
|
// Ajout des pétitionnaires |
1235 |
|
if(isset($this->postedIdDemandeur['petitionnaire'])) { |
1236 |
|
// Ajout des nouveaux liens |
1237 |
|
foreach ($this->postedIdDemandeur['petitionnaire'] as $petitionnaire) { |
1238 |
|
$this->addLinkDossierDemandeur($petitionnaire, false, $db, $DEBUG); |
1239 |
|
} |
1240 |
|
} |
1241 |
|
} |
1242 |
|
|
1243 |
|
|
1244 |
|
/** |
1245 |
|
* Fonction permettant d'ajouter un lien |
1246 |
|
* entre la table demande et demandeur |
1247 |
|
**/ |
1248 |
|
function addLinkDossierDemandeur($id, $principal, $db, $DEBUG) { |
1249 |
|
$lienAjout = new lien_dossier_demandeur( |
1250 |
|
"]", |
1251 |
|
$db, |
1252 |
|
$DEBUG); |
1253 |
|
$lien = array('lien_dossier_demandeur' => "", |
1254 |
|
'petitionnaire_principal' => (($principal)?"t":"f"), |
1255 |
|
'dossier' => $this->valF['dossier'], |
1256 |
|
'demandeur' => $id); |
1257 |
|
$lienAjout->ajouter($lien, $db, $DEBUG); |
1258 |
|
$lienAjout->__destruct(); |
1259 |
|
} |
1260 |
|
|
1261 |
|
/** |
1262 |
|
* Fonction permettant de supprimer un lien |
1263 |
|
* entre la table demande et demandeur |
1264 |
|
**/ |
1265 |
|
function deleteLinkDossierDemandeur($db, $DEBUG) { |
1266 |
|
// Suppression |
1267 |
|
$sql = "DELETE FROM ".DB_PREFIXE."lien_dossier_demandeur ". |
1268 |
|
"WHERE dossier='".$this->valF['dossier']."'"; |
1269 |
|
// Execution de la requete de suppression de l'objet |
1270 |
|
$res = $db->query($sql); |
1271 |
|
// Logger |
1272 |
|
$this->f->addToLog("supprimer(): db->query(\"".$sql."\");", VERBOSE_MODE); |
1273 |
|
if ( database::isError($res)){ |
1274 |
|
die(); |
1275 |
|
} |
1276 |
|
|
1277 |
|
} |
1278 |
|
|
1279 |
|
/** |
1280 |
|
* Methode de recupération des valeurs postées |
1281 |
|
**/ |
1282 |
|
function getPostedValues() { |
1283 |
|
// Récupération des demandeurs dans POST |
1284 |
|
if (isset($_POST['petitionnaire_principal']) OR |
1285 |
|
isset($_POST['delegataire']) OR |
1286 |
|
isset($_POST['petitionnaire'])) { |
1287 |
|
if( isset($_POST['petitionnaire_principal']) AND |
1288 |
|
!empty($_POST['petitionnaire_principal'])) { |
1289 |
|
$this->postedIdDemandeur['petitionnaire_principal'] = $_POST['petitionnaire_principal']; |
1290 |
|
} |
1291 |
|
if( isset($_POST['delegataire']) AND |
1292 |
|
!empty($_POST['delegataire'])) { |
1293 |
|
$this->postedIdDemandeur['delegataire'] = $_POST['delegataire']; |
1294 |
|
} |
1295 |
|
if( isset($_POST['petitionnaire']) AND |
1296 |
|
!empty($_POST['petitionnaire'])) { |
1297 |
|
$this->postedIdDemandeur['petitionnaire'] = $_POST['petitionnaire']; |
1298 |
|
} |
1299 |
|
} |
1300 |
|
} |
1301 |
|
|
1302 |
|
/** |
1303 |
|
* Méthode permettant de récupérer les id des demandeurs liés à la table |
1304 |
|
* liée passée en paramètre |
1305 |
|
* |
1306 |
|
* @param string $from Table liée : "demande", "dossier", dossier_autorisation" |
1307 |
|
* @param string $id Identifiant (clé primaire de la table liée en question) |
1308 |
|
*/ |
1309 |
|
function listeDemandeur($from, $id) { |
1310 |
|
// Récupération des demandeurs de la base |
1311 |
|
$sql = "SELECT demandeur.demandeur, |
1312 |
|
demandeur.type_demandeur, |
1313 |
|
lien_".$from."_demandeur.petitionnaire_principal |
1314 |
|
FROM ".DB_PREFIXE."lien_".$from."_demandeur |
1315 |
|
INNER JOIN ".DB_PREFIXE."demandeur |
1316 |
|
ON demandeur.demandeur=lien_".$from."_demandeur.demandeur |
1317 |
|
WHERE ".$from." = '".$id."'"; |
1318 |
|
$res = $this->f->db->query($sql); |
1319 |
|
$this->f->addToLog("listeDemandeur(): db->query(\"".$sql."\")", VERBOSE_MODE); |
1320 |
|
if ( database::isError($res)){ |
1321 |
|
die(); |
1322 |
|
} |
1323 |
|
// Stockage du résultat dans un tableau |
1324 |
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
1325 |
|
if ($row['petitionnaire_principal'] == 't' AND |
1326 |
|
$row['type_demandeur']=="petitionnaire") { |
1327 |
|
$this->valIdDemandeur['petitionnaire_principal']=$row['demandeur']; |
1328 |
|
} elseif ($row['petitionnaire_principal'] == 'f' AND |
1329 |
|
$row['type_demandeur']=="petitionnaire"){ |
1330 |
|
$this->valIdDemandeur['petitionnaire'][]=$row['demandeur']; |
1331 |
|
} elseif ($row['type_demandeur']=="delegataire"){ |
1332 |
|
$this->valIdDemandeur['delegataire']=$row['demandeur']; |
1333 |
|
} |
1334 |
|
} |
1335 |
|
} |
1336 |
|
|
1337 |
|
/** |
1338 |
|
* Ajout de la liste des demandeurs |
1339 |
|
*/ |
1340 |
|
function formSpecificContent($maj) { |
1341 |
|
|
1342 |
|
$this->listeDemandeur("dossier", $this->getVal('dossier')); |
1343 |
|
|
1344 |
|
if($maj < 2 AND !$this->correct) { |
1345 |
|
$linkable = true; |
1346 |
|
} else { |
1347 |
|
$linkable = false; |
1348 |
|
} |
1349 |
|
|
1350 |
|
// Conteneur de la listes des demandeurs |
1351 |
|
echo "<div id=\"liste_demandeur\" class=\"demande_hidden_bloc col_12\">"; |
1352 |
|
echo "<fieldset class=\"cadre ui-corner-all ui-widget-content\">"; |
1353 |
|
echo " <legend class=\"ui-corner-all ui-widget-content ui-state-active\">" |
1354 |
|
._("Petitionnaire")."</legend>"; |
1355 |
|
// Si des demandeurs sont liés à la demande |
1356 |
|
require_once "../obj/petitionnaire.class.php"; |
1357 |
|
require_once "../obj/delegataire.class.php"; |
1358 |
|
// Affichage du bloc pétitionnaire principal / délégataire |
1359 |
|
// L'ID DU DIV SUIVANT EST NECESSAIRE AU BON FONCTIONNEMENT DU JS |
1360 |
|
echo "<div id=\"petitionnaire_principal_delegataire col_12\">"; |
1361 |
|
// Affichage de la synthèse |
1362 |
|
if (isset ($this->valIdDemandeur["petitionnaire_principal"]) AND |
1363 |
|
!empty($this->valIdDemandeur["petitionnaire_principal"])) { |
1364 |
|
$demandeur = new petitionnaire( |
1365 |
|
$this->valIdDemandeur["petitionnaire_principal"], |
1366 |
|
$this->f->db,false); |
1367 |
|
$demandeur -> afficherSynthese("petitionnaire_principal", $linkable); |
1368 |
|
$demandeur -> __destruct(); |
1369 |
|
} elseif ( isset ($this->postedIdDemandeur["petitionnaire_principal"]) AND |
1370 |
|
!empty($this->postedIdDemandeur["petitionnaire_principal"]) ) { |
1371 |
|
$demandeur = new petitionnaire( |
1372 |
|
$this->postedIdDemandeur["petitionnaire_principal"], |
1373 |
|
$this->f->db,false); |
1374 |
|
$demandeur -> afficherSynthese("petitionnaire_principal", $linkable); |
1375 |
|
$demandeur -> __destruct(); |
1376 |
|
} |
1377 |
|
// Si en édition de formulaire |
1378 |
|
if($maj < 2 AND $linkable) { |
1379 |
|
// Bouton d'ajout du pétitionnaire principal |
1380 |
|
// L'ID DE L'INPUT SUIVANT EST NECESSAIRE AU BON FONCTIONNEMENT DU JS |
1381 |
|
echo "<span id=\"add_petitionnaire_principal\" |
1382 |
|
class=\"om-form-button add-16\">". |
1383 |
|
_("Saisir le petitionnaire principal"). |
1384 |
|
"</span>"; |
1385 |
|
} |
1386 |
|
// Bouton d'ajout du delegataire |
1387 |
|
// L'ID DU DIV ET DE L'INPUT SUIVANT EST NECESSAIRE AU BON FONCTIONNEMENT DU JS |
1388 |
|
echo "<div id=\"delegataire\">"; |
1389 |
|
// Affichage de la synthèse |
1390 |
|
if (isset ($this->valIdDemandeur["delegataire"]) AND |
1391 |
|
!empty($this->valIdDemandeur["delegataire"])) { |
1392 |
|
$demandeur = new delegataire($this->valIdDemandeur["delegataire"], |
1393 |
|
$this->f->db,false); |
1394 |
|
$demandeur -> afficherSynthese("delegataire", $linkable); |
1395 |
|
$demandeur -> __destruct(); |
1396 |
|
} elseif ( isset ($this->postedIdDemandeur["delegataire"]) AND |
1397 |
|
!empty($this->postedIdDemandeur["delegataire"]) ) { |
1398 |
|
|
1399 |
|
$demandeur = new delegataire($this->postedIdDemandeur["delegataire"], |
1400 |
|
$this->f->db,false); |
1401 |
|
$demandeur -> afficherSynthese("delegataire", $linkable); |
1402 |
|
$demandeur -> __destruct(); |
1403 |
|
} |
1404 |
|
if($maj < 2 AND $linkable) { |
1405 |
|
echo "<span id=\"add_delegataire\" |
1406 |
|
class=\"om-form-button add-16\">". |
1407 |
|
_("Saisir le delegataire"). |
1408 |
|
"</span>"; |
1409 |
|
} |
1410 |
|
echo "</div>"; |
1411 |
|
echo "<div class=\"both\"></div>"; |
1412 |
|
echo "</div>"; |
1413 |
|
// Bloc des pétitionnaires secondaires |
1414 |
|
// L'ID DU DIV SUIVANT EST NECESSAIRE AU BON FONCTIONNEMENT DU JS |
1415 |
|
echo "<div id=\"listePetitionnaires col_12\">"; |
1416 |
|
|
1417 |
|
// Affichage de la synthèse |
1418 |
|
if (isset ($this->valIdDemandeur["petitionnaire"]) AND |
1419 |
|
!empty($this->valIdDemandeur["petitionnaire"])) { |
1420 |
|
|
1421 |
|
foreach ($this->valIdDemandeur["petitionnaire"] as $petitionnaire) { |
1422 |
|
$demandeur = new petitionnaire($petitionnaire, |
1423 |
|
$this->f->db,false); |
1424 |
|
$demandeur -> afficherSynthese("petitionnaire", $linkable); |
1425 |
|
$demandeur -> __destruct(); |
1426 |
|
} |
1427 |
|
|
1428 |
|
} elseif ( isset ($this->postedIdDemandeur["petitionnaire"]) AND |
1429 |
|
!empty($this->postedIdDemandeur["petitionnaire"]) ) { |
1430 |
|
foreach ($this->postedIdDemandeur["petitionnaire"] as $petitionnaire) { |
1431 |
|
$demandeur = new petitionnaire($petitionnaire, |
1432 |
|
$this->f->db,false); |
1433 |
|
$demandeur -> afficherSynthese("petitionnaire", $linkable); |
1434 |
|
$demandeur -> __destruct(); |
1435 |
|
} |
1436 |
|
} |
1437 |
|
if ($maj < 2 AND $linkable) { |
1438 |
|
// L'ID DE L'INPUT SUIVANT EST NECESSAIRE AU BON FONCTIONNEMENT DU JS |
1439 |
|
echo "<span id=\"add_petitionnaire\" |
1440 |
|
class=\"om-form-button add-16\">". |
1441 |
|
_("Ajouter un petitionnaire") |
1442 |
|
."</span>"; |
1443 |
|
} |
1444 |
|
echo "</div>"; |
1445 |
|
echo "</fieldset>"; |
1446 |
|
echo "</div>"; |
1447 |
|
} |
1448 |
|
|
1449 |
|
/** |
1450 |
|
* Retourne le statut du dossier |
1451 |
|
* @return string Le statut du dossier d'instruction |
1452 |
|
*/ |
1453 |
|
function getStatut(){ |
1454 |
|
|
1455 |
|
$statut = ''; |
1456 |
|
|
1457 |
|
$etat = $this->getVal("etat"); |
1458 |
|
//Si l'état du dossier d'instruction n'est pas vide |
1459 |
|
if ( $etat != '' ){ |
1460 |
|
|
1461 |
|
$sql = "SELECT statut |
1462 |
|
FROM ".DB_PREFIXE."etat |
1463 |
|
WHERE etat ='".$etat."'"; |
1464 |
|
$statut = $this->db->getOne($sql); |
1465 |
|
$this->f->addToLog("getStatut() : db->getOne(\"".$sql."\")", VERBOSE_MODE); |
1466 |
|
if ( database::isError($statut)){ |
1467 |
|
die(); |
1468 |
|
} |
1469 |
|
} |
1470 |
|
return $statut; |
1471 |
|
} |
1472 |
|
|
1473 |
|
/** |
1474 |
|
* Retourne l'identifiant du rapport d'instruction lié du dossier |
1475 |
|
* @return string L'identifiant du rapport d'instruction lié du dossier |
1476 |
|
*/ |
1477 |
|
function getRapportInstruction(){ |
1478 |
|
|
1479 |
|
$rapport_instruction = ''; |
1480 |
|
|
1481 |
|
$sql = "SELECT rapport_instruction |
1482 |
|
FROM ".DB_PREFIXE."rapport_instruction |
1483 |
|
WHERE dossier_instruction ='".$this->getVal($this->clePrimaire)."'"; |
1484 |
|
$rapport_instruction = $this->db->getOne($sql); |
1485 |
|
$this->f->addToLog("getStatut() : db->getOne(\"".$sql."\")", VERBOSE_MODE); |
1486 |
|
if ( database::isError($rapport_instruction)){ |
1487 |
|
die(); |
1488 |
|
} |
1489 |
|
|
1490 |
|
return $rapport_instruction; |
1491 |
|
} |
1492 |
|
|
1493 |
|
/** |
1494 |
|
* Retourne l'identifiant des données techniques liées du dossier |
1495 |
|
* @return string L'identifiant des données techniques liées du dossier |
1496 |
|
*/ |
1497 |
|
function getDonneesTechniques(){ |
1498 |
|
|
1499 |
|
$donnees_techniques = ''; |
1500 |
|
|
1501 |
|
$sql = "SELECT donnees_techniques |
1502 |
|
FROM ".DB_PREFIXE."donnees_techniques |
1503 |
|
WHERE dossier_instruction ='".$this->getVal($this->clePrimaire)."'"; |
1504 |
|
$donnees_techniques = $this->db->getOne($sql); |
1505 |
|
$this->f->addToLog("getStatut() : db->getOne(\"".$sql."\")", VERBOSE_MODE); |
1506 |
|
if ( database::isError($donnees_techniques)){ |
1507 |
|
die(); |
1508 |
|
} |
1509 |
|
|
1510 |
|
return $donnees_techniques; |
1511 |
|
} |
1512 |
|
|
1513 |
}// fin classe |
}// fin classe |
1514 |
?> |
?> |