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 |
} |
} |
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 |
|
|
93 |
elseif(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc")) |
elseif(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc")) |
94 |
include ("../sql/".$db->phptype."/".$this->table.".form.inc"); |
include ("../sql/".$db->phptype."/".$this->table.".form.inc"); |
95 |
|
|
96 |
//Récupération de paramètre pour le rechargement ajax du select |
// Si en ajout |
97 |
$idx_dossier = $this->getParameter("idx_dossier"); |
if ($maj == 0) { |
98 |
$datd = $this->getParameter("datd"); |
//Récupération de paramètre pour le rechargement ajax du select |
99 |
|
$idx_dossier = $this->getParameter("idx_dossier"); |
100 |
$contenu = array(); |
$datd = $this->getParameter("datd"); |
101 |
|
|
102 |
// Ajout de filtre sur la requête (initial) |
$contenu = array(); |
103 |
if(isset($idx_dossier) AND $idx_dossier != "") { |
|
104 |
$sql_demande_type .= " WHERE demande_type.demande_nature = 2 "; |
$sql_demande_type = "SELECT demande_type.demande_type, demande_type.libelle FROM ".DB_PREFIXE."demande_type |
105 |
|
LEFT OUTER JOIN ".DB_PREFIXE."lien_demande_type_etat_dossier_autorisation |
106 |
|
ON lien_demande_type_etat_dossier_autorisation.demande_type=demande_type.demande_type |
107 |
|
LEFT OUTER JOIN ".DB_PREFIXE."dossier_autorisation |
108 |
|
ON lien_demande_type_etat_dossier_autorisation.etat_dossier_autorisation= |
109 |
|
dossier_autorisation.etat_dossier_autorisation |
110 |
|
LEFT OUTER JOIN ".DB_PREFIXE."dossier |
111 |
|
ON dossier.dossier_autorisation=dossier_autorisation.dossier_autorisation"; |
112 |
|
|
113 |
|
|
114 |
|
// Ajout de filtre sur la requête (initial) |
115 |
|
if(isset($idx_dossier) AND $idx_dossier != "") { |
116 |
|
$sql_demande_type .= " WHERE demande_type.demande_nature = 2 "; |
117 |
|
|
118 |
// ajout du numéro de dossier existant pour tester l'état du DA |
// ajout du numéro de dossier existant pour tester l'état du DA |
119 |
$sql_demande_type .= "AND dossier.dossier = '".$idx_dossier."' "; |
$sql_demande_type .= "AND dossier.dossier = '".$idx_dossier."' "; |
120 |
} else { |
} else { |
121 |
$sql_demande_type .= " WHERE demande_type.demande_nature = 1 "; |
$sql_demande_type .= " WHERE demande_type.demande_nature = 1 "; |
122 |
} |
} |
123 |
if(isset($_POST["dossier_autorisation_type_detaille"]) AND $_POST["dossier_autorisation_type_detaille"] != "") { |
if(isset($_POST["dossier_autorisation_type_detaille"]) AND $_POST["dossier_autorisation_type_detaille"] != "") { |
124 |
$datd = $_POST["dossier_autorisation_type_detaille"]; |
$datd = $_POST["dossier_autorisation_type_detaille"]; |
125 |
} |
} |
126 |
// Ajout de filtre sur la requête (dossier_autorisation_type_detaille) |
// Ajout de filtre sur la requête (dossier_autorisation_type_detaille) |
127 |
if(isset($datd) AND $datd != "") { |
if(isset($datd) AND $datd != "") { |
|
$sql_demande_type .= " AND demande_type.dossier_autorisation_type_detaille = ".$datd; |
|
|
} else { |
|
|
$datd = $this->getVal("dossier_autorisation_type_detaille"); |
|
|
if ($datd != "") { |
|
128 |
$sql_demande_type .= " AND demande_type.dossier_autorisation_type_detaille = ".$datd; |
$sql_demande_type .= " AND demande_type.dossier_autorisation_type_detaille = ".$datd; |
129 |
|
} else { |
130 |
|
$datd = $this->getVal("dossier_autorisation_type_detaille"); |
131 |
|
if ($datd != "") { |
132 |
|
$sql_demande_type .= " AND demande_type.dossier_autorisation_type_detaille = ".$datd; |
133 |
|
} |
134 |
} |
} |
135 |
} |
$sql_demande_type .= " ORDER BY demande_type.libelle"; |
136 |
|
$res = $db->query($sql_demande_type); |
137 |
|
|
138 |
$res = $db->query($sql_demande_type); |
// logger |
139 |
|
$this->f->addToLog("setSelect(): db->query(\"".$sql_demande_type."\");", |
140 |
|
VERBOSE_MODE); |
141 |
|
if ( database::isError($res)){ |
142 |
|
die(); |
143 |
|
} |
144 |
|
|
145 |
// logger |
$contenu[0][0] = ''; |
146 |
$this->addToLog("setSelect()[gen/obj]: db->query(\"".$sql_demande_type."\");", |
$contenu[1][0] = _('choisir')." "._("demande_type"); |
|
VERBOSE_MODE); |
|
|
$this->f->isDatabaseError($res); |
|
147 |
|
|
148 |
$contenu[0][0] = ''; |
$k=1; |
149 |
$contenu[1][0] = _('choisir')." "._("demande_type"); |
while($row =& $res->fetchRow()){ |
150 |
|
|
151 |
$k=1; |
$contenu[0][$k] = $row[0]; |
152 |
while($row =& $res->fetchRow()){ |
$contenu[1][$k] = $row[1]; |
153 |
|
$k++; |
154 |
|
} |
155 |
|
|
156 |
$contenu[0][$k] = $row[0]; |
$form->setSelect("demande_type", $contenu); |
|
$contenu[1][$k] = $row[1]; |
|
|
$k++; |
|
157 |
} |
} |
158 |
|
|
|
$form->setSelect("demande_type", $contenu); |
|
|
|
|
159 |
} |
} |
160 |
/* |
/* |
161 |
* Ajout du fielset |
* Ajout du fielset |
198 |
*/ |
*/ |
199 |
function setOnchange(&$form,$maj){ |
function setOnchange(&$form,$maj){ |
200 |
parent::setOnchange($form,$maj); |
parent::setOnchange($form,$maj); |
201 |
|
|
202 |
$form->setOnchange("dossier_autorisation_type_detaille","changeDemandeType();"); |
$form->setOnchange("dossier_autorisation_type_detaille","changeDemandeType();"); |
203 |
$form->setOnchange("demande_type","showFormsDemande();"); |
$form->setOnchange("demande_type","showFormsDemande();"); |
204 |
} |
} |
207 |
parent::setLib($form,$maj); |
parent::setLib($form,$maj); |
208 |
//libelle des champs |
//libelle des champs |
209 |
|
|
210 |
$form->setLib('complement',_('terrain_adresse')); |
$form->setLib('terrain_adresse_voie',_('terrain_adresse')); |
211 |
} |
} |
212 |
/* |
/* |
213 |
* Cache le champ terrain_references_cadastrales |
* Cache le champ terrain_references_cadastrales |
228 |
$form->setType('dossier_autorisation_type_detaille', 'selecthiddenstatic'); |
$form->setType('dossier_autorisation_type_detaille', 'selecthiddenstatic'); |
229 |
$form->setType('terrain_references_cadastrales', 'hiddenstatic'); |
$form->setType('terrain_references_cadastrales', 'hiddenstatic'); |
230 |
$form->setType('terrain_adresse_voie_numero', 'hiddenstatic'); |
$form->setType('terrain_adresse_voie_numero', 'hiddenstatic'); |
231 |
$form->setType('complement', 'hiddenstatic'); |
$form->setType('terrain_adresse_voie', 'hiddenstatic'); |
232 |
$form->setType('terrain_adresse_lieu_dit', 'hiddenstatic'); |
$form->setType('terrain_adresse_lieu_dit', 'hiddenstatic'); |
233 |
$form->setType('terrain_adresse_localite', 'hiddenstatic'); |
$form->setType('terrain_adresse_localite', 'hiddenstatic'); |
234 |
$form->setType('terrain_adresse_code_postal', 'hiddenstatic'); |
$form->setType('terrain_adresse_code_postal', 'hiddenstatic'); |
252 |
function ajoutDossierAutorisation($id, &$db, $val, $DEBUG){ |
function ajoutDossierAutorisation($id, &$db, $val, $DEBUG){ |
253 |
require_once '../obj/dossier_autorisation.class.php'; |
require_once '../obj/dossier_autorisation.class.php'; |
254 |
$dossier_autorisation = new dossier_autorisation("]",$db,$DEBUG); |
$dossier_autorisation = new dossier_autorisation("]",$db,$DEBUG); |
255 |
// Création du dossier |
$id_etat_initial_da = $this->f->getParameter('etat_initial_dossier_autorisation'); |
256 |
foreach($dossier_autorisation->champs as $value) { |
$error = false; |
257 |
$valAuto[$value] = NULL; |
|
258 |
} |
// Vérification de l'existance d'un état initial des DA dans la table om_parametre |
259 |
$valAuto['dossier_autorisation']=NULL; |
// afin d'éviter d'eventuelle erreur de base de données |
260 |
$valAuto['exercice']=NULL; |
if(isset($id_etat_initial_da)) { |
261 |
$valAuto['insee']=NULL; |
$sql = "SELECT count(*) FROM ".DB_PREFIXE."etat_dossier_autorisation |
262 |
$valAuto['arrondissement']=NULL; |
WHERE etat_dossier_autorisation = ".$id_etat_initial_da; |
263 |
$valAuto['etat_dossier_autorisation']=$this->getParameter('etat_initial_dossier_autorisation'); |
$count = $this->db->getOne($sql); |
264 |
$valAuto['erp_numero_batiment']=NULL; |
$this->f->addToLog("ajoutDossierAutorisation() : db->getOne(\"".$sql."\")", VERBOSE_MODE); |
265 |
$valAuto['erp_ouvert']=NULL; |
if ( database::isError($count)){ |
266 |
$valAuto['erp_arrete_decision']=NULL; |
die(); |
267 |
$valAuto['dossier_autorisation_type_detaille']=$this->valF['dossier_autorisation_type_detaille']; |
} |
268 |
$valAuto['depot_initial']=$this->dateDBToForm($this->valF['date_demande']); |
if($count != 1) { |
269 |
$valAuto['terrain_references_cadastrales']=$this->valF['terrain_references_cadastrales']; |
$error = true; |
270 |
$valAuto['terrain_adresse_voie_numero']=$this->valF['terrain_adresse_voie_numero']; |
} else { |
271 |
$valAuto['complement']=$this->valF['complement']; |
// La méthode ajouter prend en paramètre un tableau associatif |
272 |
$valAuto['terrain_adresse_lieu_dit']=$this->valF['terrain_adresse_lieu_dit']; |
// contenant toutes les champs de la classe instanciée, |
273 |
$valAuto['terrain_adresse_localite']=$this->valF['terrain_adresse_localite']; |
// d'où l'initialisation du tableau en bouclant sur la liste des champs du DA |
274 |
$valAuto['terrain_adresse_code_postal']=$this->valF['terrain_adresse_code_postal']; |
foreach($dossier_autorisation->champs as $value) { |
275 |
$valAuto['terrain_adresse_bp']=$this->valF['terrain_adresse_bp']; |
$valAuto[$value] = NULL; |
276 |
$valAuto['terrain_adresse_cedex']=$this->valF['terrain_adresse_cedex']; |
} |
277 |
$valAuto['terrain_superficie']=$this->valF['terrain_superficie']; |
// Définition des valeurs à insérer |
278 |
$valAuto['numero_version']=-1; |
$valAuto['dossier_autorisation']=""; |
279 |
// Ajout du dossier dans la base |
$valAuto['exercice']=NULL; |
280 |
$dossier_autorisation->ajouter($valAuto, $db, $DEBUG); |
$valAuto['insee']=NULL; |
281 |
// Liaison du dossier ajouter à la demande |
$valAuto['arrondissement']=NULL; |
282 |
$this->valF['dossier_autorisation'] = $dossier_autorisation->valF['dossier_autorisation']; |
$valAuto['etat_dossier_autorisation']=$this->f->getParameter('etat_initial_dossier_autorisation'); |
283 |
|
$valAuto['erp_numero_batiment']=NULL; |
284 |
|
$valAuto['erp_ouvert']=NULL; |
285 |
|
$valAuto['erp_arrete_decision']=NULL; |
286 |
|
$valAuto['dossier_autorisation_type_detaille']=$this->valF['dossier_autorisation_type_detaille']; |
287 |
|
$valAuto['depot_initial']=$this->dateDBToForm($this->valF['date_demande']); |
288 |
|
$valAuto['terrain_references_cadastrales']=$this->valF['terrain_references_cadastrales']; |
289 |
|
$valAuto['terrain_adresse_voie_numero']=$this->valF['terrain_adresse_voie_numero']; |
290 |
|
$valAuto['terrain_adresse_voie']=$this->valF['terrain_adresse_voie']; |
291 |
|
$valAuto['terrain_adresse_lieu_dit']=$this->valF['terrain_adresse_lieu_dit']; |
292 |
|
$valAuto['terrain_adresse_localite']=$this->valF['terrain_adresse_localite']; |
293 |
|
$valAuto['terrain_adresse_code_postal']=$this->valF['terrain_adresse_code_postal']; |
294 |
|
$valAuto['terrain_adresse_bp']=$this->valF['terrain_adresse_bp']; |
295 |
|
$valAuto['terrain_adresse_cedex']=$this->valF['terrain_adresse_cedex']; |
296 |
|
$valAuto['terrain_superficie']=$this->valF['terrain_superficie']; |
297 |
|
$valAuto['numero_version']=-1; |
298 |
|
// Ajout du dossier dans la base |
299 |
|
$dossier_autorisation->ajouter($valAuto, $db, $DEBUG); |
300 |
|
// Liaison du dossier ajouter à la demande |
301 |
|
$this->valF['dossier_autorisation'] = $dossier_autorisation->valF['dossier_autorisation']; |
302 |
|
} |
303 |
|
} else { |
304 |
|
$error = true; |
305 |
|
} |
306 |
|
// Affichage de l'erreur et stop de l'affichage |
307 |
|
if( $error ) { |
308 |
|
echo "</div>"; |
309 |
|
$class = "error"; |
310 |
|
$message = _("Erreur de parametrage. Contactez votre administrateur."); |
311 |
|
$this->f->displayMessage($class, $message); |
312 |
|
die(); |
313 |
|
} |
314 |
|
|
315 |
} |
} |
316 |
|
|
317 |
function getCodeDemandeType($demande_type){ |
function getCodeDemandeType($demande_type){ |
354 |
$valInstr['depot_initial']=$this->dateDBToForm($this->valF['date_demande']); |
$valInstr['depot_initial']=$this->dateDBToForm($this->valF['date_demande']); |
355 |
$valInstr['terrain_references_cadastrales']=$this->valF['terrain_references_cadastrales']; |
$valInstr['terrain_references_cadastrales']=$this->valF['terrain_references_cadastrales']; |
356 |
$valInstr['terrain_adresse_voie_numero']=$this->valF['terrain_adresse_voie_numero']; |
$valInstr['terrain_adresse_voie_numero']=$this->valF['terrain_adresse_voie_numero']; |
357 |
$valInstr['complement']=$this->valF['complement']; |
$valInstr['terrain_adresse_voie']=$this->valF['terrain_adresse_voie']; |
358 |
$valInstr['terrain_adresse_lieu_dit']=$this->valF['terrain_adresse_lieu_dit']; |
$valInstr['terrain_adresse_lieu_dit']=$this->valF['terrain_adresse_lieu_dit']; |
359 |
$valInstr['terrain_adresse_localite']=$this->valF['terrain_adresse_localite']; |
$valInstr['terrain_adresse_localite']=$this->valF['terrain_adresse_localite']; |
360 |
$valInstr['terrain_adresse_code_postal']=$this->valF['terrain_adresse_code_postal']; |
$valInstr['terrain_adresse_code_postal']=$this->valF['terrain_adresse_code_postal']; |
396 |
AND now()>=om_validite_debut |
AND now()>=om_validite_debut |
397 |
AND dossier_instruction_type=".$dossier_instruction_type; |
AND dossier_instruction_type=".$dossier_instruction_type; |
398 |
$valInstr['cerfa'] = $db->getOne($sql); |
$valInstr['cerfa'] = $db->getOne($sql); |
399 |
$this->addToLog("db->getone(\"".$sql."\");", VERBOSE_MODE); |
$this->f->addToLog("ajoutDossierInstruction() : db->getone(\"".$sql."\");", VERBOSE_MODE); |
400 |
|
if ( database::isError($valInstr['cerfa'])){ |
401 |
|
die(); |
402 |
|
} |
403 |
$dossier->ajouter($valInstr, $db, $DEBUG); |
$dossier->ajouter($valInstr, $db, $DEBUG); |
|
$this->f->isDatabaseError(); |
|
404 |
// Liaison du dossier ajouter à la demande |
// Liaison du dossier ajouter à la demande |
405 |
$this->valF['dossier_instruction'] = $dossier->valF['dossier']; |
$this->valF['dossier_instruction'] = $dossier->valF['dossier']; |
406 |
} |
} |
423 |
|
|
424 |
// Ajout des données techniques |
// Ajout des données techniques |
425 |
$donnees_techniques->ajouter($val, $db, $DEBUG); |
$donnees_techniques->ajouter($val, $db, $DEBUG); |
|
$this->f->isDatabaseError(); |
|
426 |
} |
} |
427 |
|
|
428 |
/** |
/** |
429 |
* Ajout des liens demandeurs / dossier d'autorisation |
* Ajout des liens demandeurs / dossier d'autorisation s'ils n'y sont pas déjà |
430 |
**/ |
**/ |
431 |
function ajoutLiensDossierAutorisation($id, &$db, $val, $DEBUG) { |
function ajoutLiensDossierAutorisation($id, &$db, $val, $DEBUG) { |
432 |
// Création des liens entre le dossier autorisation et les demandeurs |
// Création des liens entre le dossier autorisation et les demandeurs |
434 |
require_once '../obj/lien_dossier_autorisation_demandeur.class.php'; |
require_once '../obj/lien_dossier_autorisation_demandeur.class.php'; |
435 |
$ldad = new lien_dossier_autorisation_demandeur("]",$db,$DEBUG); |
$ldad = new lien_dossier_autorisation_demandeur("]",$db,$DEBUG); |
436 |
// Recupération des demandeurs liés à la demande |
// Recupération des demandeurs liés à la demande |
437 |
$sql = str_replace("<demande>",$this->valF['demande'],$sql_lien_demande_demandeur); |
$sql = str_replace("<demande>",$this->valF['demande'],$sql_lien_demande_demandeur. |
438 |
|
" AND lien_demande_demandeur.demandeur NOT IN ( |
439 |
|
SELECT lien_dossier_autorisation_demandeur.demandeur |
440 |
|
FROM ".DB_PREFIXE."lien_dossier_autorisation_demandeur |
441 |
|
WHERE lien_dossier_autorisation_demandeur.dossier_autorisation = |
442 |
|
'".$this->valF['dossier_autorisation']."' |
443 |
|
)"); |
444 |
$res = $db->query($sql); |
$res = $db->query($sql); |
445 |
$this->f->addToLog("demande.class.php: db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->f->addToLog("ajoutLiensDossierAutorisation() : db->query(\"".$sql."\");", VERBOSE_MODE); |
446 |
$this->f->isDatabaseError(); |
if ( database::isError($res)){ |
447 |
|
die(); |
448 |
|
} |
449 |
while($row = &$res->fetchRow(DB_FETCHMODE_ASSOC)) { |
while($row = &$res->fetchRow(DB_FETCHMODE_ASSOC)) { |
450 |
$row['lien_dossier_autorisation_demandeur'] = NULL; |
$row['lien_dossier_autorisation_demandeur'] = NULL; |
451 |
$row['dossier_autorisation'] = $this->valF['dossier_autorisation']; |
$row['dossier_autorisation'] = $this->valF['dossier_autorisation']; |
464 |
// Recupération des demandeurs liés à la demande |
// Recupération des demandeurs liés à la demande |
465 |
$sql = str_replace("<demande>",$this->valF['demande'],$sql_lien_demande_demandeur); |
$sql = str_replace("<demande>",$this->valF['demande'],$sql_lien_demande_demandeur); |
466 |
$res = $db->query($sql); |
$res = $db->query($sql); |
467 |
$this->f->addToLog("demande.class.php: db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->f->addToLog("ajoutLiensDossierInstruction() : db->query(\"".$sql."\");", VERBOSE_MODE); |
468 |
$this->f->isDatabaseError(); |
if ( database::isError($res)){ |
469 |
|
die(); |
470 |
|
} |
471 |
while($row = &$res->fetchRow(DB_FETCHMODE_ASSOC)) { |
while($row = &$res->fetchRow(DB_FETCHMODE_ASSOC)) { |
472 |
$row['lien_dossier_demandeur'] = NULL; |
$row['lien_dossier_demandeur'] = NULL; |
473 |
$row['dossier'] = $this->valF['dossier_instruction']; |
$row['dossier'] = $this->valF['dossier_instruction']; |
491 |
$this->addToLog("demande.class.php : ".$sql." execute <br>", EXTRA_VERBOSE_MODE); |
$this->addToLog("demande.class.php : ".$sql." execute <br>", EXTRA_VERBOSE_MODE); |
492 |
|
|
493 |
$res = $this->db->query($sql); |
$res = $this->db->query($sql); |
494 |
$this->f->isDatabaseError($res); |
$this->f->addToLog("getArrondissement() : db->query(\"".$sql."\")", VERBOSE_MODE); |
495 |
|
if ( database::isError($res)){ |
496 |
|
die(); |
497 |
|
} |
498 |
|
|
499 |
if( $res->numrows() > 0 ) { |
if( $res->numrows() > 0 ) { |
500 |
|
|
521 |
demande_type = $demande_type"; |
demande_type = $demande_type"; |
522 |
|
|
523 |
$res = $this->db->query($sql); |
$res = $this->db->query($sql); |
524 |
$this->f->isDatabaseError($res); |
$this->f->addToLog("getEvenement() : db->query(\"".$sql."\")", VERBOSE_MODE); |
525 |
|
if ( database::isError($res)){ |
526 |
|
die(); |
527 |
|
} |
528 |
|
|
529 |
if ( $res->numrows() > 0 ){ |
if ( $res->numrows() > 0 ){ |
530 |
|
|
551 |
evenement = $evenement"; |
evenement = $evenement"; |
552 |
|
|
553 |
$res = $this->db->query($sql); |
$res = $this->db->query($sql); |
554 |
$this->f->isDatabaseError($res); |
$this->f->addToLog("getLettreType() : db->query(\"".$sql."\")", VERBOSE_MODE); |
555 |
|
if ( database::isError($res)){ |
556 |
|
die(); |
557 |
|
} |
558 |
|
|
559 |
if ( $res->numrows() > 0 ){ |
if ( $res->numrows() > 0 ){ |
560 |
|
|
569 |
* Ajout des dossiers |
* Ajout des dossiers |
570 |
**/ |
**/ |
571 |
function triggerAjouter($id, &$db, $val, $DEBUG){ |
function triggerAjouter($id, &$db, $val, $DEBUG){ |
572 |
|
|
573 |
include '../sql/pgsql/demande.form.inc.php'; |
include '../sql/pgsql/demande.form.inc.php'; |
574 |
|
|
575 |
if($this->valF["demande_type"] != NULL) { |
if($this->valF["demande_type"] != NULL) { |
576 |
$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)); |
577 |
$this->f->isDatabaseError(); |
$this->f->addToLog("triggerAjouter() : db->query(\"".str_replace('<idx>', $this->valF['demande_type'], $sql_demande_type_details_by_id)."\")", VERBOSE_MODE); |
578 |
|
if ( database::isError($res)){ |
579 |
|
die(); |
580 |
|
} |
581 |
|
// Attribut permettant de définir si un dossier a été créé |
582 |
|
$this->ajoutDI = FALSE; |
583 |
$dossier_type = $res->fetchRow(DB_FETCHMODE_ASSOC); |
$dossier_type = $res->fetchRow(DB_FETCHMODE_ASSOC); |
584 |
// Création du dossier_autorisation |
// Création du dossier_autorisation |
585 |
if($this->valF['dossier_autorisation'] == "") { |
if($this->valF['dossier_autorisation'] == "") { |
586 |
$this->ajoutDossierAutorisation($id, $db, $val, $DEBUG); |
$this->ajoutDossierAutorisation($id, $db, $val, $DEBUG); |
587 |
$this -> addToMessage(_("Creation du dossier d'autorisation no").$this->valF['dossier_autorisation']); |
$this -> addToMessage(_("Creation du dossier d'autorisation no").$this->valF['dossier_autorisation']); |
588 |
} |
} |
589 |
|
// Enregistrement du numéro dossier existant (il sera écrasé si un DI est créé) |
590 |
|
if ($this->getParameter("idx_dossier") != "") { |
591 |
|
$this->valF['dossier_instruction'] = $this->getParameter("idx_dossier"); |
592 |
|
} |
593 |
// Création du dossier d'instruction |
// Création du dossier d'instruction |
594 |
if($dossier_type['dossier_instruction_type'] != NULL) { |
if($dossier_type['dossier_instruction_type'] != NULL) { |
595 |
$this->ajoutDossierInstruction($id, $db, $val, $DEBUG, $dossier_type['dossier_instruction_type']); |
$this->ajoutDossierInstruction($id, $db, $val, $DEBUG, $dossier_type['dossier_instruction_type']); |
596 |
$this -> addToMessage(_("Creation du dossier d'instruction no").$this->valF['dossier_instruction']); |
$this -> addToMessage(_("Creation du dossier d'instruction no").$this->valF['dossier_instruction']); |
597 |
|
// Attribut permettant de définir si un dossier a été créé. |
598 |
|
$this->ajoutDI = TRUE; |
599 |
|
|
600 |
//Ajout des données techniques au dossier d'instruction |
//Ajout des données techniques au dossier d'instruction |
601 |
$this->ajoutDonneesTechniques($id, $db, $val, $DEBUG); |
$this->ajoutDonneesTechniques($id, $db, $val, $DEBUG); |
602 |
} |
} |
603 |
|
|
604 |
|
// Si le dossier_instruction existe |
605 |
|
if (isset($this->valF['dossier_instruction']) && $this->valF['dossier_instruction'] !== "" ) { |
606 |
|
// Récupère les informations nécessaire pour créer le répertoire de numérisation |
607 |
|
$getInfosForFoldername = $this->getInfosForFoldername($this->valF['dossier_instruction']); |
608 |
|
// Création du répertoire pour la numérisation |
609 |
|
if ($this->createFolder($getInfosForFoldername['dossier_autorisation'], $getInfosForFoldername['code'], $getInfosForFoldername['version']) === false) { |
610 |
|
$this->correct = false; |
611 |
|
// efface les messages précédents |
612 |
|
$this->msg = ''; |
613 |
|
// affiche l'erreur pour l'utilisateur et dans le log |
614 |
|
$this->addToErrors('', _("Le repertoire du dossier d'instruction ne s'est pas cree dans le repertoire de numerisation.")." "._("Veuillez contacter votre administrateur."), _("Le repertoire du dossier d'instruction ne s'est pas cree dans le repertoire de numerisation.")); |
615 |
|
// arrête le traitement entier |
616 |
|
return false; |
617 |
|
} |
618 |
|
} |
619 |
|
|
620 |
/*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*/ |
621 |
if ( $this->valF['demande_type'] != "" && is_numeric($this->valF['demande_type']) |
if ( $this->valF['demande_type'] != "" && is_numeric($this->valF['demande_type']) |
659 |
$valInstr['archive_date_achevement']=NULL; |
$valInstr['archive_date_achevement']=NULL; |
660 |
$valInstr['archive_date_chantier']=NULL; |
$valInstr['archive_date_chantier']=NULL; |
661 |
$valInstr['archive_date_conformite']=NULL; |
$valInstr['archive_date_conformite']=NULL; |
662 |
|
$valInstr['archive_incompletude']=NULL; |
663 |
|
$valInstr['archive_evenement_suivant_tacite']=""; |
664 |
|
$valInstr['archive_evenement_suivant_tacite_incompletude']=NULL; |
665 |
|
$valInstr['archive_etat_pendant_incompletude']=NULL; |
666 |
|
$valInstr['archive_date_limite_incompletude']=NULL; |
667 |
|
$valInstr['archive_delai_incompletude']=NULL; |
668 |
$valInstr['complement3']=""; |
$valInstr['complement3']=""; |
669 |
$valInstr['complement4']=""; |
$valInstr['complement4']=""; |
670 |
$valInstr['complement5']=""; |
$valInstr['complement5']=""; |
688 |
$valInstr['date_retour_controle_legalite']=NULL; |
$valInstr['date_retour_controle_legalite']=NULL; |
689 |
$valInstr['signataire_arrete']=NULL; |
$valInstr['signataire_arrete']=NULL; |
690 |
$valInstr['numero_arrete']=NULL; |
$valInstr['numero_arrete']=NULL; |
691 |
|
$valInstr['code_barres']=NULL; |
692 |
|
$valInstr['om_fichier_instruction']=NULL; |
693 |
|
$valInstr['om_final_instruction']=NULL; |
694 |
|
$valInstr['document_numerise']=NULL; |
695 |
|
|
696 |
/*Fichier requis*/ |
/*Fichier requis*/ |
697 |
require_once '../obj/instruction.class.php'; |
require_once '../obj/instruction.class.php'; |
701 |
$instruction->valF = ""; |
$instruction->valF = ""; |
702 |
$instruction->ajouter($valInstr, $db, $DEBUG); |
$instruction->ajouter($valInstr, $db, $DEBUG); |
703 |
|
|
704 |
|
//Finalisation du document |
705 |
|
$_GET['obj']='instruction'; |
706 |
|
$_GET['idx']=$instruction->valF[$instruction->clePrimaire]; |
707 |
|
$instruction = new instruction($_GET['idx'],$db,$DEBUG); |
708 |
|
$res = $instruction->finaliser('', 1, '', ''); |
709 |
|
|
710 |
/*Si la création a réussie*/ |
/*Si la création a réussie*/ |
711 |
if ( $instruction->valF['instruction'] != "" ){ |
if ( $instruction->valF['instruction'] != "" ){ |
712 |
|
|
714 |
$this->valF['instruction_recepisse'] = $instruction->valF['instruction']; |
$this->valF['instruction_recepisse'] = $instruction->valF['instruction']; |
715 |
$this -> addToMessage("<br/><a |
$this -> addToMessage("<br/><a |
716 |
class='lien' |
class='lien' |
717 |
href='../pdf/pdflettretype.php?obj=".$lettretype."&idx=".$instruction->valF['instruction']."' |
href='" |
718 |
|
.((isset($res['pdf'])&&$instruction->valF['om_final_instruction'])?$res['pdf']: |
719 |
|
"../pdf/pdflettretype.php?obj=".$lettretype."&idx=".$instruction->valF['instruction'])."' |
720 |
target='_blank'> |
target='_blank'> |
721 |
<span |
<span |
722 |
class=\"om-icon om-icon-16 om-icon-fix pdf-16\" |
class=\"om-icon om-icon-16 om-icon-fix pdf-16\" |
746 |
* Ajout des délégataires et pétitionnaires |
* Ajout des délégataires et pétitionnaires |
747 |
**/ |
**/ |
748 |
function triggerAjouterApres($id, &$db, $val, $DEBUG){ |
function triggerAjouterApres($id, &$db, $val, $DEBUG){ |
749 |
|
|
750 |
$this->insertLinkDemandeDemandeur($db, $DEBUG); |
$this->insertLinkDemandeDemandeur($db, $DEBUG); |
751 |
|
|
752 |
// Ajout des lliens entre dossier_autorisation et demandeur |
// Ajout des lliens entre dossier_autorisation et demandeur |
753 |
if(!empty($this->valF['dossier_autorisation']) AND $val['dossier_autorisation'] == "" ) { |
if(!empty($this->valF['dossier_autorisation'])) { |
754 |
$this->ajoutLiensDossierAutorisation($id, $db, $val, $DEBUG); |
$this->ajoutLiensDossierAutorisation($id, $db, $val, $DEBUG); |
755 |
} |
} |
756 |
// Ajout des lliens entre dossier et demandeur |
// Ajout des lliens entre dossier et demandeur |
757 |
if(!empty($this->valF['dossier_instruction'])) { |
if($this->ajoutDI === TRUE) { |
758 |
$this->ajoutLiensDossierInstruction($id, $db, $val, $DEBUG); |
$this->ajoutLiensDossierInstruction($id, $db, $val, $DEBUG); |
759 |
} |
} |
760 |
|
|
778 |
function lienLotDossierInstruction($id, $db, $val, $DEBUG) { |
function lienLotDossierInstruction($id, $db, $val, $DEBUG) { |
779 |
require_once ("../obj/lot.class.php"); |
require_once ("../obj/lot.class.php"); |
780 |
$lot = new lot("]", $db, $DEBUG); |
$lot = new lot("]", $db, $DEBUG); |
|
require_once ("../obj/lien_dossier_lot.class.php"); |
|
|
$ldl = new lien_dossier_lot("]", $db, $DEBUG); |
|
781 |
require_once ("../obj/lien_lot_demandeur.class.php"); |
require_once ("../obj/lien_lot_demandeur.class.php"); |
782 |
$lld = new lien_lot_demandeur("]", $db, $DEBUG); |
$lld = new lien_lot_demandeur("]", $db, $DEBUG); |
783 |
|
|
792 |
$valLot['lot'] = ""; |
$valLot['lot'] = ""; |
793 |
$valLot['libelle'] = $rowLot['libelle']; |
$valLot['libelle'] = $rowLot['libelle']; |
794 |
$valLot['dossier_autorisation'] = NULL; |
$valLot['dossier_autorisation'] = NULL; |
795 |
|
$valLot['dossier'] = $this->valF['dossier_instruction']; |
796 |
$lot -> ajouter($valLot, $db, $DEBUG); |
$lot -> ajouter($valLot, $db, $DEBUG); |
797 |
|
|
|
//Insertion du lien entre le lot et le dossier d'instruction |
|
|
$valLdl['lien_dossier_lot'] = ""; |
|
|
$valLdl['dossier'] = $this->valF['dossier_instruction']; |
|
|
$valLdl['lot'] = $lot->valF['lot']; |
|
|
$ldl->ajouter($valLdl, $db, $DEBUG); |
|
|
|
|
798 |
//Insertion des liens entre dossier et les lots |
//Insertion des liens entre dossier et les lots |
799 |
$sqlDemandeurs = "SELECT * FROM ".DB_PREFIXE."lien_lot_demandeur |
$sqlDemandeurs = "SELECT * FROM ".DB_PREFIXE."lien_lot_demandeur |
800 |
WHERE lot = ".$rowLot['lot']; |
WHERE lot = ".$rowLot['lot']; |
801 |
$res = $db -> query($sqlDemandeurs); |
$res = $db -> query($sqlDemandeurs); |
802 |
$this->f->addToLog("db->query(\"".$sqlDemandeurs."\");", VERBOSE_MODE); |
$this->f->addToLog("lienLotDossierInstruction() : db->query(\"".$sqlDemandeurs."\");", VERBOSE_MODE); |
803 |
$this->f->isDatabaseError($res); |
if ( database::isError($res)){ |
804 |
|
die(); |
805 |
|
} |
806 |
|
|
807 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
808 |
$valLld["lien_lot_demandeur"] = ""; |
$valLld["lien_lot_demandeur"] = ""; |
891 |
// Execution de la requete de suppression de l'objet |
// Execution de la requete de suppression de l'objet |
892 |
$res = $db->query($sql); |
$res = $db->query($sql); |
893 |
// Logger |
// Logger |
894 |
$this->f->addToLog("supprimer(): db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->f->addToLog("deleteLinkDemandeDemandeur(): db->query(\"".$sql."\");", VERBOSE_MODE); |
895 |
$this->f->isDatabaseError(); |
if ( database::isError($res)){ |
896 |
|
die(); |
897 |
|
} |
898 |
|
|
899 |
} |
} |
900 |
|
|
907 |
WHERE demande = ".$this->valF['demande']. |
WHERE demande = ".$this->valF['demande']. |
908 |
"AND demandeur = ".$idDemandeur; |
"AND demandeur = ".$idDemandeur; |
909 |
$count = $this->f->db->getOne($sql); |
$count = $this->f->db->getOne($sql); |
910 |
$this->f->addToLog("db->getone(\"".$sql."\");", VERBOSE_MODE); |
$this->f->addToLog("isLinkDemandeDemandeurExist() : db->getone(\"".$sql."\");", VERBOSE_MODE); |
911 |
$this->f->isDatabaseError($count); |
if ( database::isError($count)){ |
912 |
|
die(); |
913 |
|
} |
914 |
if ($count === 0) { |
if ($count === 0) { |
915 |
return false; |
return false; |
916 |
} else { |
} else { |
941 |
} |
} |
942 |
} |
} |
943 |
} |
} |
944 |
|
|
945 |
/** |
/** |
946 |
* 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 |
947 |
* liés au dossier d'autorisation |
* liée passée en paramètre |
948 |
**/ |
* |
949 |
|
* @param string $from Table liée : "demande", "dossier", dossier_autorisation" |
950 |
|
* @param string $id Identifiant (clé primaire de la table liée en question) |
951 |
|
*/ |
952 |
function listeDemandeur($from, $id) { |
function listeDemandeur($from, $id) { |
953 |
// Récupération des demandeurs de la base |
// Récupération des demandeurs de la base |
954 |
if(isset($this->valF['demande_type']) AND $this->getCodeDemandeType($this->valF['demande_type']) != "DT") { |
$sql = "SELECT demandeur.demandeur, |
955 |
$sql = "SELECT demandeur.demandeur, |
demandeur.type_demandeur, |
956 |
demandeur.type_demandeur, |
lien_".$from."_demandeur.petitionnaire_principal |
957 |
lien_".$from."_demandeur.petitionnaire_principal |
FROM ".DB_PREFIXE."lien_".$from."_demandeur |
958 |
FROM ".DB_PREFIXE."lien_".$from."_demandeur |
INNER JOIN ".DB_PREFIXE."demandeur |
959 |
INNER JOIN ".DB_PREFIXE."demandeur |
ON demandeur.demandeur=lien_".$from."_demandeur.demandeur |
960 |
ON demandeur.demandeur=lien_".$from."_demandeur.demandeur |
WHERE ".$from." = '".$id."'"; |
961 |
WHERE ".$from." = '".$id."'"; |
$res = $this->f->db->query($sql); |
962 |
$res = $this->f->db->query($sql); |
$this->f->addToLog("listeDemandeur(): db->query(\"".$sql."\")", VERBOSE_MODE); |
963 |
$this->f->addToLog("listeDemandeur() : ".$sql); |
if ( database::isError($res)){ |
964 |
$this->f->isDatabaseError($res); |
die(); |
965 |
// Stoquage du résultat dans un tableau |
} |
966 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
// Stockage du résultat dans un tableau |
967 |
if ($row['petitionnaire_principal'] == 't' AND |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
968 |
$row['type_demandeur']=="petitionnaire") { |
if ($row['petitionnaire_principal'] == 't' AND |
969 |
$this->valIdDemandeur['petitionnaire_principal']=$row['demandeur']; |
$row['type_demandeur']=="petitionnaire") { |
970 |
} elseif ($row['petitionnaire_principal'] == 'f' AND |
$this->valIdDemandeur['petitionnaire_principal']=$row['demandeur']; |
971 |
$row['type_demandeur']=="petitionnaire"){ |
} elseif ($row['petitionnaire_principal'] == 'f' AND |
972 |
$this->valIdDemandeur['petitionnaire'][]=$row['demandeur']; |
$row['type_demandeur']=="petitionnaire"){ |
973 |
} elseif ($row['type_demandeur']=="delegataire"){ |
$this->valIdDemandeur['petitionnaire'][]=$row['demandeur']; |
974 |
$this->valIdDemandeur['delegataire']=$row['demandeur']; |
} elseif ($row['type_demandeur']=="delegataire"){ |
975 |
} |
$this->valIdDemandeur['delegataire']=$row['demandeur']; |
976 |
} |
} |
977 |
} |
} |
978 |
} |
} |
1021 |
|
|
1022 |
|
|
1023 |
/** |
/** |
1024 |
* Ajout de la liste des demandeurs |
* Cette méthode permet d'afficher des informations spécifiques dans le |
1025 |
|
* formulaire de l'objet |
1026 |
|
* |
1027 |
|
* @param integer $maj Mode de mise à jour |
1028 |
*/ |
*/ |
1029 |
function formSpecificContent($maj) { |
function formSpecificContent($maj) { |
1030 |
if(!$this->correct AND $maj != 0) { |
|
1031 |
|
/** |
1032 |
|
* Gestion du bloc des demandeurs |
1033 |
|
*/ |
1034 |
|
// Si le mode est (modification ou suppression ou consultation) ET que |
1035 |
|
// le formulaire n'est pas correct (c'est-à-dire que le formulaire est |
1036 |
|
// actif) |
1037 |
|
if (!$this->correct AND $maj != 0) { |
1038 |
|
// Alors on récupère les demandeurs dans la table lien pour |
1039 |
|
// affectation des résultats dans this->valIdDemandeur |
1040 |
$this->listeDemandeur("demande", $this->val[array_search('demande', $this->champs)]); |
$this->listeDemandeur("demande", $this->val[array_search('demande', $this->champs)]); |
1041 |
} |
} |
1042 |
// Si le paramètre idx_dossier est défini on récupère les demandeurs liés au dossier d'instruction |
|
1043 |
if($this->getParameter("idx_dossier") != "") { |
// Si le mode est (ajout ou modification) ET que le formulaire n'est pas |
1044 |
$this->listeDemandeur("dossier", $this->getParameter("idx_dossier")); |
// correct (c'est-à-dire que le formulaire est actif) |
1045 |
} |
if ($maj < 2 AND !$this->correct) { |
1046 |
if($maj < 2 AND !$this->correct) { |
// Alors on positionne le marqueur linkable a true qui permet |
1047 |
|
// d'afficher ou non les actions de gestion des demandeurs |
1048 |
$linkable = true; |
$linkable = true; |
1049 |
} else { |
} else { |
1050 |
|
// Sinon on positionne le marqueur linkable a false qui permet |
1051 |
|
// d'afficher ou non les actions de gestion des demandeurs |
1052 |
$linkable = false; |
$linkable = false; |
1053 |
} |
} |
1054 |
|
|
1055 |
|
// Affichage des demandeurs et des actions |
1056 |
// Conteneur de la listes des demandeurs |
// Conteneur de la listes des demandeurs |
1057 |
echo "<div id=\"liste_demandeur\" class=\"demande_hidden_bloc col_12\">"; |
echo "<div id=\"liste_demandeur\" class=\"demande_hidden_bloc col_12\">"; |
1058 |
echo "<fieldset class=\"cadre ui-corner-all ui-widget-content\">"; |
echo "<fieldset class=\"cadre ui-corner-all ui-widget-content\">"; |
1063 |
require_once "../obj/delegataire.class.php"; |
require_once "../obj/delegataire.class.php"; |
1064 |
// Affichage du bloc pétitionnaire principal / délégataire |
// Affichage du bloc pétitionnaire principal / délégataire |
1065 |
// L'ID DU DIV SUIVANT EST NECESSAIRE AU BON FONCTIONNEMENT DU JS |
// L'ID DU DIV SUIVANT EST NECESSAIRE AU BON FONCTIONNEMENT DU JS |
1066 |
echo "<div id=\"petitionnaire_principal_delegataire col_12\">"; |
echo "<div id=\"petitionnaire_principal_delegataire\">"; |
1067 |
// Affichage de la synthèse |
// Affichage de la synthèse |
1068 |
if (isset ($this->valIdDemandeur["petitionnaire_principal"]) AND |
if (isset ($this->valIdDemandeur["petitionnaire_principal"]) AND |
1069 |
!empty($this->valIdDemandeur["petitionnaire_principal"])) { |
!empty($this->valIdDemandeur["petitionnaire_principal"])) { |
1118 |
echo "</div>"; |
echo "</div>"; |
1119 |
// Bloc des pétitionnaires secondaires |
// Bloc des pétitionnaires secondaires |
1120 |
// L'ID DU DIV SUIVANT EST NECESSAIRE AU BON FONCTIONNEMENT DU JS |
// L'ID DU DIV SUIVANT EST NECESSAIRE AU BON FONCTIONNEMENT DU JS |
1121 |
echo "<div id=\"listePetitionnaires col_12\">"; |
echo "<div id=\"listePetitionnaires\">"; |
1122 |
|
|
1123 |
// Affichage de la synthèse |
// Affichage de la synthèse |
1124 |
if (isset ($this->valIdDemandeur["petitionnaire"]) AND |
if (isset ($this->valIdDemandeur["petitionnaire"]) AND |
1173 |
demande = $id"; |
demande = $id"; |
1174 |
|
|
1175 |
$res = $this->f->db->query($sql); |
$res = $this->f->db->query($sql); |
1176 |
$this->f->addToLog("triggerSupprimer() : ".$sql); |
$this->f->addToLog("triggerSupprimer() : db->query(\"".$sql."\")"); |
1177 |
$this->f->isDatabaseError($res); |
if ( database::isError($res)){ |
1178 |
|
die(); |
1179 |
|
} |
1180 |
} |
} |
1181 |
|
|
1182 |
// }}} |
// }}} |
1183 |
|
|
1184 |
|
|
1185 |
|
/** |
1186 |
|
* Cette fonction permet de récupérer les informations nécessaires |
1187 |
|
* à la génération du nom du répertoire |
1188 |
|
* @param string $dossier Identifiant du dossier |
1189 |
|
* @return array Tableau des résultats |
1190 |
|
*/ |
1191 |
|
private function getInfosForFoldername($dossier) { |
1192 |
|
|
1193 |
|
//Requête SQL |
1194 |
|
$sql = "SELECT dossier.dossier_autorisation, dossier_instruction_type.code, dossier.version |
1195 |
|
FROM ".DB_PREFIXE."dossier |
1196 |
|
LEFT JOIN ".DB_PREFIXE."dossier_instruction_type |
1197 |
|
ON dossier_instruction_type.dossier_instruction_type = dossier.dossier_instruction_type |
1198 |
|
WHERE dossier.dossier = '".$dossier."'"; |
1199 |
|
$res = $this->f->db->query($sql); |
1200 |
|
$this->addToLog("getInfosForFoldername() : db->query(".$sql.")", VERBOSE_MODE); |
1201 |
|
database::isError($res); |
1202 |
|
|
1203 |
|
// tableau des résultats |
1204 |
|
$row = $res->fetchRow(DB_FETCHMODE_ASSOC); |
1205 |
|
|
1206 |
|
// retourne le tableau des résultats |
1207 |
|
return $row; |
1208 |
|
} |
1209 |
|
|
1210 |
|
/** |
1211 |
|
* Cette fonction permet la création du répertoire dans le dossier de numérisation |
1212 |
|
* @param string $dossier_autorisation Identifiant dossier d'autorisation |
1213 |
|
* @param string $code Type du dossier d'instruction |
1214 |
|
* @param int $version Numéro de version du dossier |
1215 |
|
* @return boolean Vrai ou Faux |
1216 |
|
*/ |
1217 |
|
private function createFolder($dossier_autorisation, $code, $version) { |
1218 |
|
|
1219 |
|
// génération du nom du répertoire |
1220 |
|
$foldername = $dossier_autorisation.".".$code.$version; |
1221 |
|
|
1222 |
|
// création du répertoire dans le dossier de numérisation |
1223 |
|
if (isset($this->f->config["path_scan"])) { |
1224 |
|
$dir = $this->f->config["path_scan"]."Todo/"; |
1225 |
|
// vérifie que le répêrtoire des "à traiter" existe |
1226 |
|
// et qu'un répertoire du dossier n'existe pas déjà |
1227 |
|
if (is_dir($dir) && !file_exists($dir.$foldername)) { |
1228 |
|
mkdir($dir.$foldername, 0777); |
1229 |
|
// si la création a réussi |
1230 |
|
$this->addToLog("createFolder() : Success", VERBOSE_MODE); |
1231 |
|
return true; |
1232 |
|
} |
1233 |
|
} |
1234 |
|
|
1235 |
|
// en cas d'échec |
1236 |
|
$this->addToLog("createFolder() : Failure", VERBOSE_MODE); |
1237 |
|
return false; |
1238 |
|
} |
1239 |
|
|
1240 |
}// fin classe |
}// fin classe |
1241 |
?> |
?> |