13 |
"delegataire" => "", |
"delegataire" => "", |
14 |
"petitionnaire" => array()); |
"petitionnaire" => array()); |
15 |
|
|
16 |
|
var $autreDossierEnCour; |
17 |
|
|
18 |
function demande($id,&$db,$debug) { |
function demande($id,&$db,$debug) { |
19 |
$this->constructeur($id,$db,$debug); |
$this->constructeur($id,$db,$debug); |
20 |
}// fin constructeur |
}// fin constructeur |
35 |
$sql=str_replace("<idx>",$this->getParameter("idx_dossier"), |
$sql=str_replace("<idx>",$this->getParameter("idx_dossier"), |
36 |
$sql_infos_dossier); |
$sql_infos_dossier); |
37 |
$res = $this->db->query($sql); |
$res = $this->db->query($sql); |
38 |
$this->addToLog("demande -> getValFromDossier() : ".$sql); |
$this->f->addToLog("getValFromDossier(): db->query(\"".$sql."\")", VERBOSE_MODE); |
39 |
$this->f->isDatabaseError(); |
if ( database::isError($res)){ |
40 |
|
die(); |
41 |
|
} |
42 |
$row = & $res->fetchRow(DB_FETCHMODE_ASSOC); |
$row = & $res->fetchRow(DB_FETCHMODE_ASSOC); |
43 |
return $row; |
return $row; |
44 |
} |
} |
61 |
} |
} |
62 |
} |
} |
63 |
} |
} |
64 |
|
function getDataSubmit() { |
65 |
|
|
66 |
|
$datasubmit = parent::getDataSubmit(); |
67 |
|
if($this->getParameter("idx_dossier") != "") { |
68 |
|
$datasubmit .= "&idx_dossier=".$this->getParameter("idx_dossier"); |
69 |
|
} |
70 |
|
return $datasubmit; |
71 |
|
} |
72 |
|
|
73 |
/** |
/** |
74 |
* Méthode de verification du contenu |
* Méthode de verification du contenu |
78 |
if(!isset($this->postedIdDemandeur["petitionnaire_principal"]) OR |
if(!isset($this->postedIdDemandeur["petitionnaire_principal"]) OR |
79 |
empty($this->postedIdDemandeur["petitionnaire_principal"])) { |
empty($this->postedIdDemandeur["petitionnaire_principal"])) { |
80 |
$this->correct = false; |
$this->correct = false; |
81 |
$this->addToMessage("La saisie d'un petitionnaire principal est obligatoire."); |
$this->addToMessage(_("La saisie d'un petitionnaire principal est obligatoire.")); |
82 |
|
} |
83 |
|
} |
84 |
|
|
85 |
|
/** |
86 |
|
* Configuration des select |
87 |
|
*/ |
88 |
|
function setSelect(&$form, $maj,&$db,$debug) { |
89 |
|
parent::setSelect($form, $maj,$db,$debug); |
90 |
|
|
91 |
|
if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc.php")) |
92 |
|
include ("../sql/".$db->phptype."/".$this->table.".form.inc.php"); |
93 |
|
elseif(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc")) |
94 |
|
include ("../sql/".$db->phptype."/".$this->table.".form.inc"); |
95 |
|
|
96 |
|
//Récupération de paramètre pour le rechargement ajax du select |
97 |
|
$idx_dossier = $this->getParameter("idx_dossier"); |
98 |
|
$datd = $this->getParameter("datd"); |
99 |
|
|
100 |
|
$contenu = array(); |
101 |
|
|
102 |
|
// Ajout de filtre sur la requête (initial) |
103 |
|
if(isset($idx_dossier) AND $idx_dossier != "") { |
104 |
|
$sql_demande_type .= " WHERE demande_type.demande_nature = 2 "; |
105 |
|
|
106 |
|
// ajout du numéro de dossier existant pour tester l'état du DA |
107 |
|
$sql_demande_type .= "AND dossier.dossier = '".$idx_dossier."' "; |
108 |
|
} else { |
109 |
|
$sql_demande_type .= " WHERE demande_type.demande_nature = 1 "; |
110 |
|
} |
111 |
|
if(isset($_POST["dossier_autorisation_type_detaille"]) AND $_POST["dossier_autorisation_type_detaille"] != "") { |
112 |
|
$datd = $_POST["dossier_autorisation_type_detaille"]; |
113 |
|
} |
114 |
|
// Ajout de filtre sur la requête (dossier_autorisation_type_detaille) |
115 |
|
if(isset($datd) AND $datd != "") { |
116 |
|
$sql_demande_type .= " AND demande_type.dossier_autorisation_type_detaille = ".$datd; |
117 |
|
} else { |
118 |
|
$datd = $this->getVal("dossier_autorisation_type_detaille"); |
119 |
|
if ($datd != "") { |
120 |
|
$sql_demande_type .= " AND demande_type.dossier_autorisation_type_detaille = ".$datd; |
121 |
|
} |
122 |
|
} |
123 |
|
|
124 |
|
$res = $db->query($sql_demande_type); |
125 |
|
|
126 |
|
// logger |
127 |
|
$this->f->addToLog("setSelect(): db->query(\"".$sql_demande_type."\");", |
128 |
|
VERBOSE_MODE); |
129 |
|
if ( database::isError($res)){ |
130 |
|
die(); |
131 |
|
} |
132 |
|
|
133 |
|
$contenu[0][0] = ''; |
134 |
|
$contenu[1][0] = _('choisir')." "._("demande_type"); |
135 |
|
|
136 |
|
$k=1; |
137 |
|
while($row =& $res->fetchRow()){ |
138 |
|
|
139 |
|
$contenu[0][$k] = $row[0]; |
140 |
|
$contenu[1][$k] = $row[1]; |
141 |
|
$k++; |
142 |
} |
} |
143 |
|
|
144 |
|
$form->setSelect("demande_type", $contenu); |
145 |
|
|
146 |
} |
} |
147 |
/* |
/* |
148 |
* Ajout du fielset |
* Ajout du fielset |
176 |
$form->setBloc('terrain_superficie','F'); |
$form->setBloc('terrain_superficie','F'); |
177 |
/*Fin bloc 4*/ |
/*Fin bloc 4*/ |
178 |
|
|
|
/*Champ sur lequel s'ouvre le bloc 4 */ |
|
|
$form->setBloc('nombre_lots','D',"","lots col_12 demande_hidden_bloc"); |
|
|
$form->setFieldset('nombre_lots','D',_('Nombre de lots')); |
|
|
$form->setFieldset('nombre_lots','F',''); |
|
|
$form->setBloc('nombre_lots','F'); |
|
|
/*Fin bloc 5*/ |
|
179 |
} |
} |
180 |
} |
} |
181 |
|
|
188 |
$form->setOnchange("dossier_autorisation_type_detaille","changeDemandeType();"); |
$form->setOnchange("dossier_autorisation_type_detaille","changeDemandeType();"); |
189 |
$form->setOnchange("demande_type","showFormsDemande();"); |
$form->setOnchange("demande_type","showFormsDemande();"); |
190 |
} |
} |
191 |
|
|
192 |
|
function setLib(&$form,$maj) { |
193 |
|
parent::setLib($form,$maj); |
194 |
|
//libelle des champs |
195 |
|
|
196 |
|
$form->setLib('complement',_('terrain_adresse')); |
197 |
|
} |
198 |
/* |
/* |
199 |
* Cache le champ terrain_references_cadastrales |
* Cache le champ terrain_references_cadastrales |
200 |
* Hide the fiels terrain_references_cadastrales |
* Hide the fiels terrain_references_cadastrales |
221 |
$form->setType('terrain_adresse_bp', 'hiddenstatic'); |
$form->setType('terrain_adresse_bp', 'hiddenstatic'); |
222 |
$form->setType('terrain_adresse_cedex', 'hiddenstatic'); |
$form->setType('terrain_adresse_cedex', 'hiddenstatic'); |
223 |
$form->setType('terrain_superficie', 'hiddenstatic'); |
$form->setType('terrain_superficie', 'hiddenstatic'); |
|
$form->setType('nombre_lots', 'hiddenstatic'); |
|
224 |
} |
} |
225 |
if($maj == 1) { |
if($maj == 1) { |
226 |
$form->setType('dossier_autorisation_type_detaille', 'selecthiddenstatic'); |
$form->setType('dossier_autorisation_type_detaille', 'selecthiddenstatic'); |
227 |
$form->setType('demande_type', 'selecthiddenstatic'); |
$form->setType('demande_type', 'selecthiddenstatic'); |
228 |
} |
} |
229 |
if($maj == 3) { |
if($maj == 3) { |
230 |
$form->setType('terrain_references_cadastrales', 'hiddenstatic'); |
$form->setType('terrain_references_cadastrales', 'referencescadastralesstatic'); |
231 |
} |
} |
232 |
|
|
233 |
} |
} |
238 |
function ajoutDossierAutorisation($id, &$db, $val, $DEBUG){ |
function ajoutDossierAutorisation($id, &$db, $val, $DEBUG){ |
239 |
require_once '../obj/dossier_autorisation.class.php'; |
require_once '../obj/dossier_autorisation.class.php'; |
240 |
$dossier_autorisation = new dossier_autorisation("]",$db,$DEBUG); |
$dossier_autorisation = new dossier_autorisation("]",$db,$DEBUG); |
241 |
// Création du dossier |
$id_etat_initial_da = $this->f->getParameter('etat_initial_dossier_autorisation'); |
242 |
foreach($dossier_autorisation->champs as $value) { |
$error = false; |
243 |
$valAuto[$value] = NULL; |
|
244 |
} |
// Vérification de l'existance d'un état initial des DA dans la table om_parametre |
245 |
$valAuto['dossier_autorisation']=NULL; |
// afin d'éviter d'eventuelle erreur de base de données |
246 |
$valAuto['nature']=NULL; |
if(isset($id_etat_initial_da)) { |
247 |
$valAuto['exercice']=NULL; |
$sql = "SELECT count(*) FROM ".DB_PREFIXE."etat_dossier_autorisation |
248 |
$valAuto['insee']=NULL; |
WHERE etat_dossier_autorisation = ".$id_etat_initial_da; |
249 |
$valAuto['arrondissement']=NULL; |
$count = $this->db->getOne($sql); |
250 |
$valAuto['etat']=NULL; |
$this->f->addToLog("ajoutDossierAutorisation() : db->getOne(\"".$sql."\")", VERBOSE_MODE); |
251 |
$valAuto['erp_numero_batiment']=NULL; |
if ( database::isError($count)){ |
252 |
$valAuto['erp_ouvert']=NULL; |
die(); |
253 |
$valAuto['erp_arrete_decision']=NULL; |
} |
254 |
$valAuto['dossier_autorisation_type_detaille']=$this->valF['dossier_autorisation_type_detaille']; |
if($count != 1) { |
255 |
$valAuto['depot_initial']=$this->valF['date_demande']; |
$error = true; |
256 |
$valAuto['terrain_references_cadastrales']=$this->valF['terrain_references_cadastrales']; |
} else { |
257 |
$valAuto['terrain_adresse_voie_numero']=$this->valF['terrain_adresse_voie_numero']; |
// La méthode ajouter prend en paramètre un tableau associatif |
258 |
$valAuto['complement']=$this->valF['complement']; |
// contenant toutes les champs de la classe instanciée, |
259 |
$valAuto['terrain_adresse_lieu_dit']=$this->valF['terrain_adresse_lieu_dit']; |
// d'où l'initialisation du tableau en bouclant sur la liste des champs du DA |
260 |
$valAuto['terrain_adresse_localite']=$this->valF['terrain_adresse_localite']; |
foreach($dossier_autorisation->champs as $value) { |
261 |
$valAuto['terrain_adresse_code_postal']=$this->valF['terrain_adresse_code_postal']; |
$valAuto[$value] = NULL; |
262 |
$valAuto['terrain_adresse_bp']=$this->valF['terrain_adresse_bp']; |
} |
263 |
$valAuto['terrain_adresse_cedex']=$this->valF['terrain_adresse_cedex']; |
// Définition des valeurs à insérer |
264 |
$valAuto['terrain_superficie']=$this->valF['terrain_superficie']; |
$valAuto['dossier_autorisation']=""; |
265 |
$valAuto['numero_version']=-1; |
$valAuto['exercice']=NULL; |
266 |
// Ajout du dossier dans la base |
$valAuto['insee']=NULL; |
267 |
$dossier_autorisation->ajouter($valAuto, $db, $DEBUG); |
$valAuto['arrondissement']=NULL; |
268 |
// Liaison du dossier ajouter à la demande |
$valAuto['etat_dossier_autorisation']=$this->f->getParameter('etat_initial_dossier_autorisation'); |
269 |
$this->valF['dossier_autorisation'] = $dossier_autorisation->valF['dossier_autorisation']; |
$valAuto['erp_numero_batiment']=NULL; |
270 |
|
$valAuto['erp_ouvert']=NULL; |
271 |
|
$valAuto['erp_arrete_decision']=NULL; |
272 |
|
$valAuto['dossier_autorisation_type_detaille']=$this->valF['dossier_autorisation_type_detaille']; |
273 |
|
$valAuto['depot_initial']=$this->dateDBToForm($this->valF['date_demande']); |
274 |
|
$valAuto['terrain_references_cadastrales']=$this->valF['terrain_references_cadastrales']; |
275 |
|
$valAuto['terrain_adresse_voie_numero']=$this->valF['terrain_adresse_voie_numero']; |
276 |
|
$valAuto['complement']=$this->valF['complement']; |
277 |
|
$valAuto['terrain_adresse_lieu_dit']=$this->valF['terrain_adresse_lieu_dit']; |
278 |
|
$valAuto['terrain_adresse_localite']=$this->valF['terrain_adresse_localite']; |
279 |
|
$valAuto['terrain_adresse_code_postal']=$this->valF['terrain_adresse_code_postal']; |
280 |
|
$valAuto['terrain_adresse_bp']=$this->valF['terrain_adresse_bp']; |
281 |
|
$valAuto['terrain_adresse_cedex']=$this->valF['terrain_adresse_cedex']; |
282 |
|
$valAuto['terrain_superficie']=$this->valF['terrain_superficie']; |
283 |
|
$valAuto['numero_version']=-1; |
284 |
|
// Ajout du dossier dans la base |
285 |
|
$dossier_autorisation->ajouter($valAuto, $db, $DEBUG); |
286 |
|
// Liaison du dossier ajouter à la demande |
287 |
|
$this->valF['dossier_autorisation'] = $dossier_autorisation->valF['dossier_autorisation']; |
288 |
|
} |
289 |
|
} else { |
290 |
|
$error = true; |
291 |
|
} |
292 |
|
// Affichage de l'erreur et stop de l'affichage |
293 |
|
if( $error ) { |
294 |
|
echo "</div>"; |
295 |
|
$class = "error"; |
296 |
|
$message = _("Erreur de parametrage. Contactez votre administrateur."); |
297 |
|
$this->f->displayMessage($class, $message); |
298 |
|
die(); |
299 |
|
} |
300 |
|
|
301 |
|
} |
302 |
|
|
303 |
|
function getCodeDemandeType($demande_type){ |
304 |
|
|
305 |
|
$sql = "SELECT |
306 |
|
code |
307 |
|
FROM |
308 |
|
".DB_PREFIXE."demande_type |
309 |
|
WHERE |
310 |
|
demande_type = ".$demande_type; |
311 |
|
$codeDemandeType = $this->db->getOne($sql); |
312 |
|
$this->addToLog("db->getone(\"".$sql."\");", VERBOSE_MODE); |
313 |
|
|
314 |
|
return $codeDemandeType; |
315 |
} |
} |
316 |
|
|
317 |
/** |
/** |
333 |
$dossier->setDossierInstructionType($dossier_instruction_type); |
$dossier->setDossierInstructionType($dossier_instruction_type); |
334 |
|
|
335 |
// Définition des valeurs à entrée dans la table |
// Définition des valeurs à entrée dans la table |
336 |
$valInstr['nature']=$datd->val[array_search("code", $datd->champs)]; |
$valInstr['dossier_instruction_type']=$dossier_instruction_type; |
|
$valInstr['dossier_autorisation_type_detaille']=$this->valF['dossier_autorisation_type_detaille']; |
|
337 |
$valInstr['date_depot']=$this->dateDBToForm($this->valF['date_demande']); |
$valInstr['date_depot']=$this->dateDBToForm($this->valF['date_demande']); |
338 |
|
$valInstr['date_dernier_depot']=$this->dateDBToForm($this->valF['date_demande']); |
339 |
$valInstr['date_demande']=$this->dateDBToForm($this->valF['date_demande']); |
$valInstr['date_demande']=$this->dateDBToForm($this->valF['date_demande']); |
340 |
$valInstr['depot_initial']=$this->dateDBToForm($this->valF['date_demande']); |
$valInstr['depot_initial']=$this->dateDBToForm($this->valF['date_demande']); |
341 |
$valInstr['terrain_references_cadastrales']=$this->valF['terrain_references_cadastrales']; |
$valInstr['terrain_references_cadastrales']=$this->valF['terrain_references_cadastrales']; |
349 |
$valInstr['terrain_superficie']=$this->valF['terrain_superficie']; |
$valInstr['terrain_superficie']=$this->valF['terrain_superficie']; |
350 |
$valInstr['description']=""; |
$valInstr['description']=""; |
351 |
$valInstr['dossier_autorisation']=$this->valF['dossier_autorisation']; |
$valInstr['dossier_autorisation']=$this->valF['dossier_autorisation']; |
352 |
|
|
353 |
|
/* |
354 |
|
* Gestion de la qualification |
355 |
|
* */ |
356 |
|
//Récupérer le code du type de la demande |
357 |
|
$codeDemandeType = $this->getCodeDemandeType($val['demande_type']); |
358 |
|
|
359 |
|
//Marque le dossier comme à qualifier selon le type de dossier d'instruction |
360 |
|
if ( strcasecmp($codeDemandeType, "DI") == 0 || |
361 |
|
strcasecmp($codeDemandeType, "DT") == 0 || |
362 |
|
strcasecmp($codeDemandeType, "DM") == 0 || |
363 |
|
strcasecmp($codeDemandeType, "DP") == 0 || |
364 |
|
strcasecmp($codeDemandeType, "DTP") == 0 || |
365 |
|
strcasecmp($codeDemandeType, "DAACT") == 0 || |
366 |
|
strcasecmp($codeDemandeType, "DOC") == 0 ){ |
367 |
|
|
368 |
|
$valInstr['a_qualifier'] = TRUE; |
369 |
|
} |
370 |
|
|
371 |
|
// Récupération du cerfa pour le type d'instruction sélectionnée et valide |
372 |
|
$sql = "SELECT |
373 |
|
dossier_instruction_type.cerfa |
374 |
|
FROM |
375 |
|
".DB_PREFIXE."dossier_instruction_type |
376 |
|
JOIN |
377 |
|
".DB_PREFIXE."cerfa |
378 |
|
ON |
379 |
|
dossier_instruction_type.cerfa = cerfa.cerfa |
380 |
|
WHERE |
381 |
|
now()<=om_validite_fin |
382 |
|
AND now()>=om_validite_debut |
383 |
|
AND dossier_instruction_type=".$dossier_instruction_type; |
384 |
|
$valInstr['cerfa'] = $db->getOne($sql); |
385 |
|
$this->f->addToLog("ajoutDossierInstruction() : db->getone(\"".$sql."\");", VERBOSE_MODE); |
386 |
|
if ( database::isError($valInstr['cerfa'])){ |
387 |
|
die(); |
388 |
|
} |
389 |
$dossier->ajouter($valInstr, $db, $DEBUG); |
$dossier->ajouter($valInstr, $db, $DEBUG); |
|
$this->f->isDatabaseError(); |
|
390 |
// Liaison du dossier ajouter à la demande |
// Liaison du dossier ajouter à la demande |
391 |
$this->valF['dossier_instruction'] = $dossier->valF['dossier']; |
$this->valF['dossier_instruction'] = $dossier->valF['dossier']; |
392 |
} |
} |
393 |
|
|
394 |
/** |
/** |
395 |
|
* Méthode permettant d'ajouter les données techniques au dossier d'instruction |
396 |
|
*/ |
397 |
|
function ajoutDonneesTechniques($id, &$db, $val, $DEBUG){ |
398 |
|
|
399 |
|
require_once '../obj/donnees_techniques.class.php'; |
400 |
|
$donnees_techniques = new donnees_techniques("]",$db,$DEBUG); |
401 |
|
|
402 |
|
// Champs tous à NULL car seul le champ concernant le dossier d'instruction sera rempli |
403 |
|
foreach($donnees_techniques->champs as $value) { |
404 |
|
$val[$value] = NULL; |
405 |
|
} |
406 |
|
|
407 |
|
// Ajout du numéro de dossier d'instruction |
408 |
|
$val['dossier_instruction']=$this->valF['dossier_instruction']; |
409 |
|
|
410 |
|
// Ajout des données techniques |
411 |
|
$donnees_techniques->ajouter($val, $db, $DEBUG); |
412 |
|
} |
413 |
|
|
414 |
|
/** |
415 |
* Ajout des liens demandeurs / dossier d'autorisation |
* Ajout des liens demandeurs / dossier d'autorisation |
416 |
**/ |
**/ |
417 |
function ajoutLiensDossierAutorisation($id, &$db, $val, $DEBUG) { |
function ajoutLiensDossierAutorisation($id, &$db, $val, $DEBUG) { |
422 |
// Recupération des demandeurs liés à la demande |
// Recupération des demandeurs liés à la demande |
423 |
$sql = str_replace("<demande>",$this->valF['demande'],$sql_lien_demande_demandeur); |
$sql = str_replace("<demande>",$this->valF['demande'],$sql_lien_demande_demandeur); |
424 |
$res = $db->query($sql); |
$res = $db->query($sql); |
425 |
$this->f->addToLog("demande.class.php: db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->f->addToLog("ajoutLiensDossierAutorisation() : db->query(\"".$sql."\");", VERBOSE_MODE); |
426 |
$this->f->isDatabaseError(); |
if ( database::isError($res)){ |
427 |
|
die(); |
428 |
|
} |
429 |
while($row = &$res->fetchRow(DB_FETCHMODE_ASSOC)) { |
while($row = &$res->fetchRow(DB_FETCHMODE_ASSOC)) { |
430 |
$row['lien_dossier_autorisation_demandeur'] = NULL; |
$row['lien_dossier_autorisation_demandeur'] = NULL; |
431 |
$row['dossier_autorisation'] = $this->valF['dossier_autorisation']; |
$row['dossier_autorisation'] = $this->valF['dossier_autorisation']; |
444 |
// Recupération des demandeurs liés à la demande |
// Recupération des demandeurs liés à la demande |
445 |
$sql = str_replace("<demande>",$this->valF['demande'],$sql_lien_demande_demandeur); |
$sql = str_replace("<demande>",$this->valF['demande'],$sql_lien_demande_demandeur); |
446 |
$res = $db->query($sql); |
$res = $db->query($sql); |
447 |
$this->f->addToLog("demande.class.php: db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->f->addToLog("ajoutLiensDossierInstruction() : db->query(\"".$sql."\");", VERBOSE_MODE); |
448 |
$this->f->isDatabaseError(); |
if ( database::isError($res)){ |
449 |
|
die(); |
450 |
|
} |
451 |
while($row = &$res->fetchRow(DB_FETCHMODE_ASSOC)) { |
while($row = &$res->fetchRow(DB_FETCHMODE_ASSOC)) { |
452 |
$row['lien_dossier_demandeur'] = NULL; |
$row['lien_dossier_demandeur'] = NULL; |
453 |
$row['dossier'] = $this->valF['dossier_instruction']; |
$row['dossier'] = $this->valF['dossier_instruction']; |
471 |
$this->addToLog("demande.class.php : ".$sql." execute <br>", EXTRA_VERBOSE_MODE); |
$this->addToLog("demande.class.php : ".$sql." execute <br>", EXTRA_VERBOSE_MODE); |
472 |
|
|
473 |
$res = $this->db->query($sql); |
$res = $this->db->query($sql); |
474 |
$this->f->isDatabaseError($res); |
$this->f->addToLog("getArrondissement() : db->query(\"".$sql."\")", VERBOSE_MODE); |
475 |
|
if ( database::isError($res)){ |
476 |
|
die(); |
477 |
|
} |
478 |
|
|
479 |
if( $res->numrows() > 0 ) { |
if( $res->numrows() > 0 ) { |
480 |
|
|
501 |
demande_type = $demande_type"; |
demande_type = $demande_type"; |
502 |
|
|
503 |
$res = $this->db->query($sql); |
$res = $this->db->query($sql); |
504 |
$this->f->isDatabaseError($res); |
$this->f->addToLog("getEvenement() : db->query(\"".$sql."\")", VERBOSE_MODE); |
505 |
|
if ( database::isError($res)){ |
506 |
|
die(); |
507 |
|
} |
508 |
|
|
509 |
if ( $res->numrows() > 0 ){ |
if ( $res->numrows() > 0 ){ |
510 |
|
|
531 |
evenement = $evenement"; |
evenement = $evenement"; |
532 |
|
|
533 |
$res = $this->db->query($sql); |
$res = $this->db->query($sql); |
534 |
$this->f->isDatabaseError($res); |
$this->f->addToLog("getLettreType() : db->query(\"".$sql."\")", VERBOSE_MODE); |
535 |
|
if ( database::isError($res)){ |
536 |
|
die(); |
537 |
|
} |
538 |
|
|
539 |
if ( $res->numrows() > 0 ){ |
if ( $res->numrows() > 0 ){ |
540 |
|
|
552 |
include '../sql/pgsql/demande.form.inc.php'; |
include '../sql/pgsql/demande.form.inc.php'; |
553 |
if($this->valF["demande_type"] != NULL) { |
if($this->valF["demande_type"] != NULL) { |
554 |
$res = $db->query(str_replace('<idx>', $this->valF['demande_type'], $sql_demande_type_details_by_id)); |
$res = $db->query(str_replace('<idx>', $this->valF['demande_type'], $sql_demande_type_details_by_id)); |
555 |
$this->f->isDatabaseError(); |
$this->f->addToLog("triggerAjouter() : db->query(\"".str_replace('<idx>', $this->valF['demande_type'], $sql_demande_type_details_by_id)."\")", VERBOSE_MODE); |
556 |
|
if ( database::isError($res)){ |
557 |
|
die(); |
558 |
|
} |
559 |
$dossier_type = $res->fetchRow(DB_FETCHMODE_ASSOC); |
$dossier_type = $res->fetchRow(DB_FETCHMODE_ASSOC); |
560 |
// Création du dossier_autorisation |
// Création du dossier_autorisation |
561 |
if($this->valF['dossier_autorisation'] == "") { |
if($this->valF['dossier_autorisation'] == "") { |
566 |
if($dossier_type['dossier_instruction_type'] != NULL) { |
if($dossier_type['dossier_instruction_type'] != NULL) { |
567 |
$this->ajoutDossierInstruction($id, $db, $val, $DEBUG, $dossier_type['dossier_instruction_type']); |
$this->ajoutDossierInstruction($id, $db, $val, $DEBUG, $dossier_type['dossier_instruction_type']); |
568 |
$this -> addToMessage(_("Creation du dossier d'instruction no").$this->valF['dossier_instruction']); |
$this -> addToMessage(_("Creation du dossier d'instruction no").$this->valF['dossier_instruction']); |
569 |
|
|
570 |
|
//Ajout des données techniques au dossier d'instruction |
571 |
|
$this->ajoutDonneesTechniques($id, $db, $val, $DEBUG); |
572 |
} |
} |
573 |
|
|
574 |
/*Création du lien de téléchargement de récépissé de demande*/ |
/*Création du lien de téléchargement de récépissé de demande*/ |
588 |
$valInstr['destinataire']=$this->valF['dossier_instruction']; |
$valInstr['destinataire']=$this->valF['dossier_instruction']; |
589 |
$valInstr['dossier']=$this->valF['dossier_instruction']; |
$valInstr['dossier']=$this->valF['dossier_instruction']; |
590 |
|
|
591 |
$valInstr['datecourrier']=date("d/m/Y"); |
$valInstr['date_evenement']=date("d/m/Y"); |
592 |
$valInstr['evenement']=$evenement; |
$valInstr['evenement']=$evenement; |
593 |
$valInstr['lettretype']=$lettretype; |
$valInstr['lettretype']=$lettretype; |
594 |
$valInstr['complement']=""; |
$valInstr['complement']=""; |
601 |
$valInstr['delai_notification']="1"; |
$valInstr['delai_notification']="1"; |
602 |
$valInstr['archive_delai']="0"; |
$valInstr['archive_delai']="0"; |
603 |
$valInstr['archive_date_complet']=NULL; |
$valInstr['archive_date_complet']=NULL; |
604 |
|
$valInstr['archive_date_dernier_depot']=NULL; |
605 |
$valInstr['archive_date_rejet']=NULL; |
$valInstr['archive_date_rejet']=NULL; |
606 |
$valInstr['archive_date_limite']=NULL; |
$valInstr['archive_date_limite']=NULL; |
607 |
$valInstr['archive_date_notification_delai']=NULL; |
$valInstr['archive_date_notification_delai']=NULL; |
613 |
$valInstr['archive_date_achevement']=NULL; |
$valInstr['archive_date_achevement']=NULL; |
614 |
$valInstr['archive_date_chantier']=NULL; |
$valInstr['archive_date_chantier']=NULL; |
615 |
$valInstr['archive_date_conformite']=NULL; |
$valInstr['archive_date_conformite']=NULL; |
616 |
|
$valInstr['archive_incompletude']=NULL; |
617 |
|
$valInstr['archive_evenement_suivant_tacite']=""; |
618 |
|
$valInstr['archive_evenement_suivant_tacite_incompletude']=NULL; |
619 |
|
$valInstr['archive_etat_pendant_incompletude']=NULL; |
620 |
|
$valInstr['archive_date_limite_incompletude']=NULL; |
621 |
|
$valInstr['archive_delai_incompletude']=NULL; |
622 |
$valInstr['complement3']=""; |
$valInstr['complement3']=""; |
623 |
$valInstr['complement4']=""; |
$valInstr['complement4']=""; |
624 |
$valInstr['complement5']=""; |
$valInstr['complement5']=""; |
633 |
$valInstr['complement14']=""; |
$valInstr['complement14']=""; |
634 |
$valInstr['complement15']=""; |
$valInstr['complement15']=""; |
635 |
$valInstr['avis_decision']=NULL; |
$valInstr['avis_decision']=NULL; |
636 |
|
$valInstr['date_finalisation_courrier']=NULL; |
637 |
|
$valInstr['date_envoi_signature']=NULL; |
638 |
|
$valInstr['date_retour_signature']=NULL; |
639 |
|
$valInstr['date_envoi_rar']=NULL; |
640 |
|
$valInstr['date_retour_rar']=NULL; |
641 |
|
$valInstr['date_envoi_controle_legalite']=NULL; |
642 |
|
$valInstr['date_retour_controle_legalite']=NULL; |
643 |
|
$valInstr['signataire_arrete']=NULL; |
644 |
|
$valInstr['numero_arrete']=NULL; |
645 |
|
$valInstr['code_barres']=NULL; |
646 |
|
|
647 |
/*Fichier requis*/ |
/*Fichier requis*/ |
648 |
require_once '../obj/instruction.class.php'; |
require_once '../obj/instruction.class.php'; |
659 |
$this->valF['instruction_recepisse'] = $instruction->valF['instruction']; |
$this->valF['instruction_recepisse'] = $instruction->valF['instruction']; |
660 |
$this -> addToMessage("<br/><a |
$this -> addToMessage("<br/><a |
661 |
class='lien' |
class='lien' |
662 |
href='../pdf/pdflettretype.php?obj=".$lettretype."&idx=".$this->valF['dossier_instruction']."' |
href='../pdf/pdflettretype.php?obj=".$lettretype."&idx=".$instruction->valF['instruction']."' |
663 |
target='_blank'> |
target='_blank'> |
664 |
<span |
<span |
665 |
class=\"om-icon om-icon-16 om-icon-fix pdf-16\" |
class=\"om-icon om-icon-16 om-icon-fix pdf-16\" |
699 |
if(!empty($this->valF['dossier_instruction'])) { |
if(!empty($this->valF['dossier_instruction'])) { |
700 |
$this->ajoutLiensDossierInstruction($id, $db, $val, $DEBUG); |
$this->ajoutLiensDossierInstruction($id, $db, $val, $DEBUG); |
701 |
} |
} |
702 |
|
|
703 |
|
// Duplication des lots et liaison au nouveau dossier_d'instruction |
704 |
|
if(!empty($this->valF['dossier_autorisation']) AND $val['dossier_autorisation'] != "" ) { |
705 |
|
$this->lienLotDossierInstruction($id, $db, $val, $DEBUG); |
706 |
|
} |
707 |
} |
} |
708 |
|
|
709 |
/*Ajout du lien demande / demandeur(s)*/ |
/*Ajout du lien demande / demandeur(s)*/ |
715 |
} |
} |
716 |
|
|
717 |
/** |
/** |
718 |
|
* Gestion des liens entre les lots du DA et le nouveau dossier |
719 |
|
**/ |
720 |
|
function lienLotDossierInstruction($id, $db, $val, $DEBUG) { |
721 |
|
require_once ("../obj/lot.class.php"); |
722 |
|
$lot = new lot("]", $db, $DEBUG); |
723 |
|
require_once ("../obj/lien_dossier_lot.class.php"); |
724 |
|
$ldl = new lien_dossier_lot("]", $db, $DEBUG); |
725 |
|
require_once ("../obj/lien_lot_demandeur.class.php"); |
726 |
|
$lld = new lien_lot_demandeur("]", $db, $DEBUG); |
727 |
|
|
728 |
|
|
729 |
|
$sqlLots = "SELECT * FROM ".DB_PREFIXE."lot |
730 |
|
WHERE dossier_autorisation = '".$this->valF['dossier_autorisation']."'"; |
731 |
|
$resLot = $db -> query($sqlLots); |
732 |
|
$this->f->addToLog("db->query(\"".$sqlLots."\");", VERBOSE_MODE); |
733 |
|
$this->f->isDatabaseError($resLot); |
734 |
|
while ($rowLot=& $resLot->fetchRow(DB_FETCHMODE_ASSOC)){ |
735 |
|
// Insertion du nouveau lot |
736 |
|
$valLot['lot'] = ""; |
737 |
|
$valLot['libelle'] = $rowLot['libelle']; |
738 |
|
$valLot['dossier_autorisation'] = NULL; |
739 |
|
$lot -> ajouter($valLot, $db, $DEBUG); |
740 |
|
|
741 |
|
//Insertion du lien entre le lot et le dossier d'instruction |
742 |
|
$valLdl['lien_dossier_lot'] = ""; |
743 |
|
$valLdl['dossier'] = $this->valF['dossier_instruction']; |
744 |
|
$valLdl['lot'] = $lot->valF['lot']; |
745 |
|
$ldl->ajouter($valLdl, $db, $DEBUG); |
746 |
|
|
747 |
|
//Insertion des liens entre dossier et les lots |
748 |
|
$sqlDemandeurs = "SELECT * FROM ".DB_PREFIXE."lien_lot_demandeur |
749 |
|
WHERE lot = ".$rowLot['lot']; |
750 |
|
$res = $db -> query($sqlDemandeurs); |
751 |
|
$this->f->addToLog("lienLotDossierInstruction() : db->query(\"".$sqlDemandeurs."\");", VERBOSE_MODE); |
752 |
|
if ( database::isError($res)){ |
753 |
|
die(); |
754 |
|
} |
755 |
|
|
756 |
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
757 |
|
$valLld["lien_lot_demandeur"] = ""; |
758 |
|
$valLld["lot"]=$lot->valF['lot']; |
759 |
|
$valLld["demandeur"] = $row['demandeur']; |
760 |
|
$valLld["petitionnaire_principal"] = $row['petitionnaire_principal']; |
761 |
|
$lld->ajouter($valLld, $db, $DEBUG); |
762 |
|
} |
763 |
|
} |
764 |
|
} |
765 |
|
|
766 |
|
/** |
767 |
* Gestion des liens entre la demande et les demandeurs recemment ajoutés |
* Gestion des liens entre la demande et les demandeurs recemment ajoutés |
768 |
**/ |
**/ |
769 |
function insertLinkDemandeDemandeur($db, $DEBUG) { |
function insertLinkDemandeDemandeur($db, $DEBUG) { |
840 |
// Execution de la requete de suppression de l'objet |
// Execution de la requete de suppression de l'objet |
841 |
$res = $db->query($sql); |
$res = $db->query($sql); |
842 |
// Logger |
// Logger |
843 |
$this->f->addToLog("supprimer(): db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->f->addToLog("deleteLinkDemandeDemandeur(): db->query(\"".$sql."\");", VERBOSE_MODE); |
844 |
$this->f->isDatabaseError(); |
if ( database::isError($res)){ |
845 |
|
die(); |
846 |
|
} |
847 |
|
|
848 |
} |
} |
849 |
|
|
856 |
WHERE demande = ".$this->valF['demande']. |
WHERE demande = ".$this->valF['demande']. |
857 |
"AND demandeur = ".$idDemandeur; |
"AND demandeur = ".$idDemandeur; |
858 |
$count = $this->f->db->getOne($sql); |
$count = $this->f->db->getOne($sql); |
859 |
$this->f->addToLog("db->getone(\"".$sql."\");", VERBOSE_MODE); |
$this->f->addToLog("isLinkDemandeDemandeurExist() : db->getone(\"".$sql."\");", VERBOSE_MODE); |
860 |
$this->f->isDatabaseError($count); |
if ( database::isError($count)){ |
861 |
|
die(); |
862 |
|
} |
863 |
if ($count === 0) { |
if ($count === 0) { |
864 |
return false; |
return false; |
865 |
} else { |
} else { |
890 |
} |
} |
891 |
} |
} |
892 |
} |
} |
893 |
|
|
894 |
/** |
/** |
895 |
* Méthode permettant de récupérer les id des demandeur liés à la demande ou |
* Méthode permettant de récupérer les id des demandeurs liés à la table |
896 |
* liés au dossier d'autorisation |
* liée passée en paramètre |
897 |
**/ |
* |
898 |
|
* @param string $from Table liée : "demande", "dossier", dossier_autorisation" |
899 |
|
* @param string $id Identifiant (clé primaire de la table liée en question) |
900 |
|
*/ |
901 |
function listeDemandeur($from, $id) { |
function listeDemandeur($from, $id) { |
902 |
// Récupération des demandeurs de la base |
// Récupération des demandeurs de la base |
903 |
$sql = "SELECT demandeur.demandeur, |
$sql = "SELECT demandeur.demandeur, |
908 |
ON demandeur.demandeur=lien_".$from."_demandeur.demandeur |
ON demandeur.demandeur=lien_".$from."_demandeur.demandeur |
909 |
WHERE ".$from." = '".$id."'"; |
WHERE ".$from." = '".$id."'"; |
910 |
$res = $this->f->db->query($sql); |
$res = $this->f->db->query($sql); |
911 |
$this->f->addToLog("listeDemandeur() : ".$sql); |
$this->f->addToLog("listeDemandeur(): db->query(\"".$sql."\")", VERBOSE_MODE); |
912 |
$this->f->isDatabaseError($res); |
if ( database::isError($res)){ |
913 |
// Stoquage du résultat dans un tableau |
die(); |
914 |
|
} |
915 |
|
// Stockage du résultat dans un tableau |
916 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
917 |
if ($row['petitionnaire_principal'] == 't' AND |
if ($row['petitionnaire_principal'] == 't' AND |
918 |
$row['type_demandeur']=="petitionnaire") { |
$row['type_demandeur']=="petitionnaire") { |
970 |
|
|
971 |
|
|
972 |
/** |
/** |
973 |
* Ajout de la liste des demandeurs |
* Cette méthode permet d'afficher des informations spécifiques dans le |
974 |
|
* formulaire de l'objet |
975 |
|
* |
976 |
|
* @param integer $maj Mode de mise à jour |
977 |
*/ |
*/ |
978 |
function formSpecificContent($maj) { |
function formSpecificContent($maj) { |
979 |
if(!$this->correct AND $maj != 0) { |
|
980 |
|
/** |
981 |
|
* Gestion du bloc des demandeurs |
982 |
|
*/ |
983 |
|
// Si le mode est (modification ou suppression ou consultation) ET que |
984 |
|
// le formulaire n'est pas correct (c'est-à-dire que le formulaire est |
985 |
|
// actif) |
986 |
|
if (!$this->correct AND $maj != 0) { |
987 |
|
// Alors on récupère les demandeurs dans la table lien pour |
988 |
|
// affectation des résultats dans this->valIdDemandeur |
989 |
$this->listeDemandeur("demande", $this->val[array_search('demande', $this->champs)]); |
$this->listeDemandeur("demande", $this->val[array_search('demande', $this->champs)]); |
990 |
} |
} |
991 |
// Si le paramètre idx_dossier est défini on récupère les demandeurs liés au dossier d'instruction |
|
992 |
if($this->getParameter("idx_dossier") != "") { |
// Si le mode est (ajout ou modification) ET que le formulaire n'est pas |
993 |
$this->listeDemandeur("dossier", $this->getParameter("idx_dossier")); |
// correct (c'est-à-dire que le formulaire est actif) |
994 |
} |
if ($maj < 2 AND !$this->correct) { |
995 |
if($maj < 2 AND !$this->correct) { |
// Alors on positionne le marqueur linkable a true qui permet |
996 |
|
// d'afficher ou non les actions de gestion des demandeurs |
997 |
$linkable = true; |
$linkable = true; |
998 |
} else { |
} else { |
999 |
|
// Sinon on positionne le marqueur linkable a false qui permet |
1000 |
|
// d'afficher ou non les actions de gestion des demandeurs |
1001 |
$linkable = false; |
$linkable = false; |
1002 |
} |
} |
1003 |
|
|
1004 |
|
// Affichage des demandeurs et des actions |
1005 |
// Conteneur de la listes des demandeurs |
// Conteneur de la listes des demandeurs |
1006 |
echo "<div id=\"liste_demandeur\" class=\"demande_hidden_bloc col_12\">"; |
echo "<div id=\"liste_demandeur\" class=\"demande_hidden_bloc col_12\">"; |
1007 |
echo "<fieldset class=\"cadre ui-corner-all ui-widget-content\">"; |
echo "<fieldset class=\"cadre ui-corner-all ui-widget-content\">"; |
1041 |
// Bouton d'ajout du delegataire |
// Bouton d'ajout du delegataire |
1042 |
// L'ID DU DIV ET DE L'INPUT SUIVANT EST NECESSAIRE AU BON FONCTIONNEMENT DU JS |
// L'ID DU DIV ET DE L'INPUT SUIVANT EST NECESSAIRE AU BON FONCTIONNEMENT DU JS |
1043 |
echo "<div id=\"delegataire\">"; |
echo "<div id=\"delegataire\">"; |
|
if ($maj < 2 OR ($maj == 3 AND !empty($this->valIdDemandeur["delegataire"]))) { |
|
|
echo " <span class=\"om-icon om-icon-16 om-icon-fix arrow-right-16\"> |
|
|
<!-- --> |
|
|
</span> "; |
|
|
} |
|
1044 |
// Affichage de la synthèse |
// Affichage de la synthèse |
1045 |
if (isset ($this->valIdDemandeur["delegataire"]) AND |
if (isset ($this->valIdDemandeur["delegataire"]) AND |
1046 |
!empty($this->valIdDemandeur["delegataire"])) { |
!empty($this->valIdDemandeur["delegataire"])) { |
1063 |
"</span>"; |
"</span>"; |
1064 |
} |
} |
1065 |
echo "</div>"; |
echo "</div>"; |
1066 |
|
echo "<div class=\"both\"></div>"; |
1067 |
echo "</div>"; |
echo "</div>"; |
1068 |
// Bloc des pétitionnaires secondaires |
// Bloc des pétitionnaires secondaires |
1069 |
// L'ID DU DIV SUIVANT EST NECESSAIRE AU BON FONCTIONNEMENT DU JS |
// L'ID DU DIV SUIVANT EST NECESSAIRE AU BON FONCTIONNEMENT DU JS |
1111 |
function setValIdDemandeur($valIdDemandeur) { |
function setValIdDemandeur($valIdDemandeur) { |
1112 |
$this->valIdDemandeur = $valIdDemandeur; |
$this->valIdDemandeur = $valIdDemandeur; |
1113 |
} |
} |
1114 |
|
|
1115 |
|
//Supression du lien entre la demandeur et le(s) demandeur(s) |
1116 |
|
function triggerSupprimer($id, &$db, $val, $DEBUG){ |
1117 |
|
|
1118 |
|
//Création de la requête |
1119 |
|
$sql = "DELETE FROM |
1120 |
|
".DB_PREFIXE."lien_demande_demandeur |
1121 |
|
WHERE |
1122 |
|
demande = $id"; |
1123 |
|
|
1124 |
|
$res = $this->f->db->query($sql); |
1125 |
|
$this->f->addToLog("triggerSupprimer() : db->query(\"".$sql."\")"); |
1126 |
|
if ( database::isError($res)){ |
1127 |
|
die(); |
1128 |
|
} |
1129 |
|
} |
1130 |
|
|
1131 |
// }}} |
// }}} |
1132 |
}// fin classe |
}// fin classe |
1133 |
?> |
?> |