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']; |
384 |
|
|
385 |
// Récupération du cerfa pour le type d'instruction sélectionnée et valide |
// Récupération du cerfa pour le type d'instruction sélectionnée et valide |
386 |
$sql = "SELECT |
$sql = "SELECT |
387 |
dossier_instruction_type.cerfa |
dossier_autorisation_type_detaille.cerfa |
388 |
FROM |
FROM |
389 |
".DB_PREFIXE."dossier_instruction_type |
".DB_PREFIXE."dossier_autorisation_type_detaille |
390 |
JOIN |
JOIN |
391 |
".DB_PREFIXE."cerfa |
".DB_PREFIXE."cerfa |
392 |
ON |
ON |
393 |
dossier_instruction_type.cerfa = cerfa.cerfa |
dossier_autorisation_type_detaille.cerfa = cerfa.cerfa |
394 |
WHERE |
WHERE |
395 |
now()<=om_validite_fin |
now()<=om_validite_fin |
396 |
AND now()>=om_validite_debut |
AND now()>=om_validite_debut |
397 |
AND dossier_instruction_type=".$dossier_instruction_type; |
AND dossier_autorisation_type_detaille=".$this->valF['dossier_autorisation_type_detaille']; |
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 |
} |
} |
407 |
|
|
408 |
/** |
/** |
409 |
* Méthode permettant d'ajouter les données techniques au dossier d'instruction |
* Méthode permettant d'ajouter les données techniques au dossier d'autorisation |
410 |
*/ |
*/ |
411 |
function ajoutDonneesTechniques($id, &$db, $val, $DEBUG){ |
function ajoutDonneesTechniquesDA($id, &$db, $val, $DEBUG){ |
412 |
|
|
413 |
require_once '../obj/donnees_techniques.class.php'; |
require_once '../obj/donnees_techniques.class.php'; |
414 |
$donnees_techniques = new donnees_techniques("]",$db,$DEBUG); |
$donnees_techniques = new donnees_techniques("]",$db,$DEBUG); |
415 |
|
|
416 |
// Champs tous à NULL car seul le champ concernant le dossier d'instruction sera rempli |
// Champs tous à NULL car seul le champ concernant le dossier d'autorisation sera rempli |
417 |
foreach($donnees_techniques->champs as $value) { |
foreach($donnees_techniques->champs as $value) { |
418 |
$val[$value] = NULL; |
$val[$value] = NULL; |
419 |
} |
} |
420 |
|
|
421 |
// Ajout du numéro de dossier d'instruction |
// Ajout du numéro de dossier d'instruction |
422 |
$val['dossier_instruction']=$this->valF['dossier_instruction']; |
$val['dossier_autorisation']=$this->valF['dossier_autorisation']; |
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 |
* Méthode permettant d'ajouter les données techniques au dossier d'autorisation |
430 |
|
*/ |
431 |
|
function ajoutDonneesTechniquesDI($id, &$db, $val, $DEBUG){ |
432 |
|
|
433 |
|
// Requête permettant de récupérer le dernier enregistrement en base des données techniques |
434 |
|
// liées au dossier d'autorisationdu dossier d'instruction en cours de création |
435 |
|
$sql_dt_from_da = "SELECT donnees_techniques |
436 |
|
FROM ".DB_PREFIXE."donnees_techniques |
437 |
|
WHERE dossier_autorisation = '".$this->valF['dossier_autorisation']."' |
438 |
|
ORDER BY donnees_techniques DESC"; |
439 |
|
// Récupération de l'id |
440 |
|
$id_da = $this->db->getOne($sql_dt_from_da); |
441 |
|
if ( database::isError($id_da)){ |
442 |
|
// affiche l'erreur pour l'utilisateur et dans le log |
443 |
|
$this->addToErrors("", |
444 |
|
_("Erreur lors de la recuperation des donnees techniques en cours de validite"), |
445 |
|
_("Erreur lors de la recuperation des donnees techniques en cours de validite")); |
446 |
|
return false; |
447 |
|
} |
448 |
|
require_once '../obj/donnees_techniques.class.php'; |
449 |
|
$donnees_techniques = new donnees_techniques($id_da,$db,$DEBUG); |
450 |
|
|
451 |
|
// Récupération des données du DA |
452 |
|
foreach($donnees_techniques->champs as $value) { |
453 |
|
$val[$value] = $donnees_techniques->getVal($value); |
454 |
|
} |
455 |
|
|
456 |
|
// Ajout du numéro de dossier d'instruction |
457 |
|
$val['dossier_instruction'] = $this->valF['dossier_instruction']; |
458 |
|
// Suppression du numéro de dossier d'autorisation |
459 |
|
$val['dossier_autorisation'] = NULL; |
460 |
|
|
461 |
|
// Ajout des données techniques |
462 |
|
$donnees_techniques->ajouter($val, $db, $DEBUG); |
463 |
|
} |
464 |
|
|
465 |
|
/** |
466 |
|
* Ajout des liens demandeurs / dossier d'autorisation s'ils n'y sont pas déjà |
467 |
**/ |
**/ |
468 |
function ajoutLiensDossierAutorisation($id, &$db, $val, $DEBUG) { |
function ajoutLiensDossierAutorisation($id, &$db, $val, $DEBUG) { |
469 |
// Création des liens entre le dossier autorisation et les demandeurs |
// Création des liens entre le dossier autorisation et les demandeurs |
471 |
require_once '../obj/lien_dossier_autorisation_demandeur.class.php'; |
require_once '../obj/lien_dossier_autorisation_demandeur.class.php'; |
472 |
$ldad = new lien_dossier_autorisation_demandeur("]",$db,$DEBUG); |
$ldad = new lien_dossier_autorisation_demandeur("]",$db,$DEBUG); |
473 |
// Recupération des demandeurs liés à la demande |
// Recupération des demandeurs liés à la demande |
474 |
$sql = str_replace("<demande>",$this->valF['demande'],$sql_lien_demande_demandeur); |
$sql = str_replace("<demande>",$this->valF['demande'],$sql_lien_demande_demandeur. |
475 |
|
" AND lien_demande_demandeur.demandeur NOT IN ( |
476 |
|
SELECT lien_dossier_autorisation_demandeur.demandeur |
477 |
|
FROM ".DB_PREFIXE."lien_dossier_autorisation_demandeur |
478 |
|
WHERE lien_dossier_autorisation_demandeur.dossier_autorisation = |
479 |
|
'".$this->valF['dossier_autorisation']."' |
480 |
|
)"); |
481 |
$res = $db->query($sql); |
$res = $db->query($sql); |
482 |
$this->f->addToLog("demande.class.php: db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->f->addToLog("ajoutLiensDossierAutorisation() : db->query(\"".$sql."\");", VERBOSE_MODE); |
483 |
$this->f->isDatabaseError(); |
if ( database::isError($res)){ |
484 |
|
die(); |
485 |
|
} |
486 |
while($row = &$res->fetchRow(DB_FETCHMODE_ASSOC)) { |
while($row = &$res->fetchRow(DB_FETCHMODE_ASSOC)) { |
487 |
$row['lien_dossier_autorisation_demandeur'] = NULL; |
$row['lien_dossier_autorisation_demandeur'] = NULL; |
488 |
$row['dossier_autorisation'] = $this->valF['dossier_autorisation']; |
$row['dossier_autorisation'] = $this->valF['dossier_autorisation']; |
501 |
// Recupération des demandeurs liés à la demande |
// Recupération des demandeurs liés à la demande |
502 |
$sql = str_replace("<demande>",$this->valF['demande'],$sql_lien_demande_demandeur); |
$sql = str_replace("<demande>",$this->valF['demande'],$sql_lien_demande_demandeur); |
503 |
$res = $db->query($sql); |
$res = $db->query($sql); |
504 |
$this->f->addToLog("demande.class.php: db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->f->addToLog("ajoutLiensDossierInstruction() : db->query(\"".$sql."\");", VERBOSE_MODE); |
505 |
$this->f->isDatabaseError(); |
if ( database::isError($res)){ |
506 |
|
die(); |
507 |
|
} |
508 |
while($row = &$res->fetchRow(DB_FETCHMODE_ASSOC)) { |
while($row = &$res->fetchRow(DB_FETCHMODE_ASSOC)) { |
509 |
$row['lien_dossier_demandeur'] = NULL; |
$row['lien_dossier_demandeur'] = NULL; |
510 |
$row['dossier'] = $this->valF['dossier_instruction']; |
$row['dossier'] = $this->valF['dossier_instruction']; |
528 |
$this->addToLog("demande.class.php : ".$sql." execute <br>", EXTRA_VERBOSE_MODE); |
$this->addToLog("demande.class.php : ".$sql." execute <br>", EXTRA_VERBOSE_MODE); |
529 |
|
|
530 |
$res = $this->db->query($sql); |
$res = $this->db->query($sql); |
531 |
$this->f->isDatabaseError($res); |
$this->f->addToLog("getArrondissement() : db->query(\"".$sql."\")", VERBOSE_MODE); |
532 |
|
if ( database::isError($res)){ |
533 |
|
die(); |
534 |
|
} |
535 |
|
|
536 |
if( $res->numrows() > 0 ) { |
if( $res->numrows() > 0 ) { |
537 |
|
|
558 |
demande_type = $demande_type"; |
demande_type = $demande_type"; |
559 |
|
|
560 |
$res = $this->db->query($sql); |
$res = $this->db->query($sql); |
561 |
$this->f->isDatabaseError($res); |
$this->f->addToLog("getEvenement() : db->query(\"".$sql."\")", VERBOSE_MODE); |
562 |
|
if ( database::isError($res)){ |
563 |
|
die(); |
564 |
|
} |
565 |
|
|
566 |
if ( $res->numrows() > 0 ){ |
if ( $res->numrows() > 0 ){ |
567 |
|
|
588 |
evenement = $evenement"; |
evenement = $evenement"; |
589 |
|
|
590 |
$res = $this->db->query($sql); |
$res = $this->db->query($sql); |
591 |
$this->f->isDatabaseError($res); |
$this->f->addToLog("getLettreType() : db->query(\"".$sql."\")", VERBOSE_MODE); |
592 |
|
if ( database::isError($res)){ |
593 |
|
die(); |
594 |
|
} |
595 |
|
|
596 |
if ( $res->numrows() > 0 ){ |
if ( $res->numrows() > 0 ){ |
597 |
|
|
601 |
|
|
602 |
return $lettretype; |
return $lettretype; |
603 |
} |
} |
604 |
|
|
605 |
|
/** |
606 |
|
* Retourne le libellé du dossier d'autorisation |
607 |
|
* @param string $dossier_autorisation Identifiant du dossier d'autorisation |
608 |
|
* @return string Libellé dossier d'autorisation |
609 |
|
*/ |
610 |
|
function get_dossier_autorisation_libelle($dossier_autorisation) { |
611 |
|
|
612 |
|
$dossier_autorisation_libelle = ""; |
613 |
|
|
614 |
|
// Requête SQL |
615 |
|
$sql = "SELECT |
616 |
|
dossier_autorisation_libelle |
617 |
|
FROM |
618 |
|
".DB_PREFIXE."dossier_autorisation |
619 |
|
WHERE |
620 |
|
dossier_autorisation = '$dossier_autorisation'"; |
621 |
|
|
622 |
|
$dossier_autorisation_libelle = $this->db->getOne($sql); |
623 |
|
$this->addToLog("get_dossier_autorisation_libelle(): db->getOne(\"".$sql."\")", VERBOSE_MODE); |
624 |
|
database::isError($dossier_autorisation_libelle); |
625 |
|
|
626 |
|
// Retourne le résultat |
627 |
|
return $dossier_autorisation_libelle; |
628 |
|
} |
629 |
|
|
630 |
|
/** |
631 |
|
* Retourne le libellé du dossier d'autorisation |
632 |
|
* @param string $dossier_autorisation Identifiant du dossier d'autorisation |
633 |
|
* @return string Libellé dossier d'autorisation |
634 |
|
*/ |
635 |
|
function get_dossier_libelle($dossier) { |
636 |
|
|
637 |
|
$dossier_libelle = ""; |
638 |
|
|
639 |
|
// Requête SQL |
640 |
|
$sql = "SELECT |
641 |
|
dossier_libelle |
642 |
|
FROM |
643 |
|
".DB_PREFIXE."dossier |
644 |
|
WHERE |
645 |
|
dossier = '$dossier'"; |
646 |
|
|
647 |
|
$dossier_libelle = $this->db->getOne($sql); |
648 |
|
$this->addToLog("get_dossier_libelle(): db->getOne(\"".$sql."\")", VERBOSE_MODE); |
649 |
|
database::isError($dossier_libelle); |
650 |
|
|
651 |
|
// Retourne le résultat |
652 |
|
return $dossier_libelle; |
653 |
|
} |
654 |
|
|
655 |
/** |
/** |
656 |
* Ajout des dossiers |
* Ajout des dossiers |
657 |
**/ |
**/ |
658 |
function triggerAjouter($id, &$db, $val, $DEBUG){ |
function triggerAjouter($id, &$db, $val, $DEBUG){ |
659 |
|
|
660 |
include '../sql/pgsql/demande.form.inc.php'; |
include '../sql/pgsql/demande.form.inc.php'; |
661 |
|
|
662 |
if($this->valF["demande_type"] != NULL) { |
if($this->valF["demande_type"] != NULL) { |
663 |
$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)); |
664 |
$this->f->isDatabaseError(); |
$this->f->addToLog("triggerAjouter() : db->query(\"".str_replace('<idx>', $this->valF['demande_type'], $sql_demande_type_details_by_id)."\")", VERBOSE_MODE); |
665 |
|
if ( database::isError($res)){ |
666 |
|
die(); |
667 |
|
} |
668 |
|
// Attribut permettant de définir si un dossier a été créé |
669 |
|
$this->ajoutDI = FALSE; |
670 |
$dossier_type = $res->fetchRow(DB_FETCHMODE_ASSOC); |
$dossier_type = $res->fetchRow(DB_FETCHMODE_ASSOC); |
671 |
// Création du dossier_autorisation |
// Création du dossier_autorisation |
672 |
if($this->valF['dossier_autorisation'] == "") { |
if($this->valF['dossier_autorisation'] == "") { |
673 |
$this->ajoutDossierAutorisation($id, $db, $val, $DEBUG); |
$this->ajoutDossierAutorisation($id, $db, $val, $DEBUG); |
674 |
$this -> addToMessage(_("Creation du dossier d'autorisation no").$this->valF['dossier_autorisation']); |
$this -> addToMessage(_("Creation du dossier d'autorisation no").$this->get_dossier_autorisation_libelle($this->valF['dossier_autorisation'])); |
675 |
|
//Ajout des données techniques au dossier d'autorisation |
676 |
|
$this->ajoutDonneesTechniquesDA($id, $db, $val, $DEBUG); |
677 |
|
} |
678 |
|
// Enregistrement du numéro dossier existant (il sera écrasé si un DI est créé) |
679 |
|
if ($this->getParameter("idx_dossier") != "") { |
680 |
|
$this->valF['dossier_instruction'] = $this->getParameter("idx_dossier"); |
681 |
} |
} |
682 |
// Création du dossier d'instruction |
// Création du dossier d'instruction |
683 |
if($dossier_type['dossier_instruction_type'] != NULL) { |
if($dossier_type['dossier_instruction_type'] != NULL) { |
684 |
$this->ajoutDossierInstruction($id, $db, $val, $DEBUG, $dossier_type['dossier_instruction_type']); |
$this->ajoutDossierInstruction($id, $db, $val, $DEBUG, $dossier_type['dossier_instruction_type']); |
685 |
$this -> addToMessage(_("Creation du dossier d'instruction no").$this->valF['dossier_instruction']); |
$this -> addToMessage(_("Creation du dossier d'instruction no").$this->get_dossier_libelle($this->valF['dossier_instruction'])); |
686 |
|
// Attribut permettant de définir si un dossier a été créé. |
687 |
|
$this->ajoutDI = TRUE; |
688 |
|
|
689 |
//Ajout des données techniques au dossier d'instruction |
//Ajout des données techniques au dossier d'instruction |
690 |
$this->ajoutDonneesTechniques($id, $db, $val, $DEBUG); |
$this->ajoutDonneesTechniquesDI($id, $db, $val, $DEBUG); |
691 |
|
} |
692 |
|
|
693 |
|
// Si le dossier_instruction existe |
694 |
|
if (isset($this->valF['dossier_instruction']) && $this->valF['dossier_instruction'] !== "" ) { |
695 |
|
// Récupère les informations nécessaire pour créer le répertoire de numérisation |
696 |
|
$getInfosForFoldername = $this->getInfosForFoldername($this->valF['dossier_instruction']); |
697 |
|
// Création du répertoire pour la numérisation |
698 |
|
if ($this->createFolder($getInfosForFoldername['dossier_autorisation'], $getInfosForFoldername['code'], $getInfosForFoldername['version']) === false) { |
699 |
|
$this->correct = false; |
700 |
|
// efface les messages précédents |
701 |
|
$this->msg = ''; |
702 |
|
// affiche l'erreur pour l'utilisateur et dans le log |
703 |
|
$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.")); |
704 |
|
// arrête le traitement entier |
705 |
|
return false; |
706 |
|
} |
707 |
} |
} |
708 |
|
|
709 |
/*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*/ |
748 |
$valInstr['archive_date_achevement']=NULL; |
$valInstr['archive_date_achevement']=NULL; |
749 |
$valInstr['archive_date_chantier']=NULL; |
$valInstr['archive_date_chantier']=NULL; |
750 |
$valInstr['archive_date_conformite']=NULL; |
$valInstr['archive_date_conformite']=NULL; |
751 |
|
$valInstr['archive_incompletude']=NULL; |
752 |
|
$valInstr['archive_evenement_suivant_tacite']=""; |
753 |
|
$valInstr['archive_evenement_suivant_tacite_incompletude']=NULL; |
754 |
|
$valInstr['archive_etat_pendant_incompletude']=NULL; |
755 |
|
$valInstr['archive_date_limite_incompletude']=NULL; |
756 |
|
$valInstr['archive_delai_incompletude']=NULL; |
757 |
|
$valInstr['archive_autorite_competente']=NULL; |
758 |
$valInstr['complement3']=""; |
$valInstr['complement3']=""; |
759 |
$valInstr['complement4']=""; |
$valInstr['complement4']=""; |
760 |
$valInstr['complement5']=""; |
$valInstr['complement5']=""; |
778 |
$valInstr['date_retour_controle_legalite']=NULL; |
$valInstr['date_retour_controle_legalite']=NULL; |
779 |
$valInstr['signataire_arrete']=NULL; |
$valInstr['signataire_arrete']=NULL; |
780 |
$valInstr['numero_arrete']=NULL; |
$valInstr['numero_arrete']=NULL; |
781 |
|
$valInstr['code_barres']=NULL; |
782 |
|
$valInstr['om_fichier_instruction']=NULL; |
783 |
|
$valInstr['om_final_instruction']=NULL; |
784 |
|
$valInstr['document_numerise']=NULL; |
785 |
|
$valInstr['autorite_competente']=NULL; |
786 |
|
|
787 |
/*Fichier requis*/ |
/*Fichier requis*/ |
788 |
require_once '../obj/instruction.class.php'; |
require_once '../obj/instruction.class.php'; |
792 |
$instruction->valF = ""; |
$instruction->valF = ""; |
793 |
$instruction->ajouter($valInstr, $db, $DEBUG); |
$instruction->ajouter($valInstr, $db, $DEBUG); |
794 |
|
|
795 |
|
//Finalisation du document |
796 |
|
$_GET['obj']='instruction'; |
797 |
|
$_GET['idx']=$instruction->valF[$instruction->clePrimaire]; |
798 |
|
$instruction = new instruction($_GET['idx'],$db,$DEBUG); |
799 |
|
$res = $instruction->finaliser('', 1, '', ''); |
800 |
|
|
801 |
/*Si la création a réussie*/ |
/*Si la création a réussie*/ |
802 |
if ( $instruction->valF['instruction'] != "" ){ |
if ( $instruction->valF['instruction'] != "" ){ |
803 |
|
|
805 |
$this->valF['instruction_recepisse'] = $instruction->valF['instruction']; |
$this->valF['instruction_recepisse'] = $instruction->valF['instruction']; |
806 |
$this -> addToMessage("<br/><a |
$this -> addToMessage("<br/><a |
807 |
class='lien' |
class='lien' |
808 |
href='../pdf/pdflettretype.php?obj=".$lettretype."&idx=".$instruction->valF['instruction']."' |
href='" |
809 |
|
.((isset($res['pdf'])&&$instruction->valF['om_final_instruction'])?$res['pdf']: |
810 |
|
"../pdf/pdflettretype.php?obj=".$lettretype."&idx=".$instruction->valF['instruction'])."' |
811 |
target='_blank'> |
target='_blank'> |
812 |
<span |
<span |
813 |
class=\"om-icon om-icon-16 om-icon-fix pdf-16\" |
class=\"om-icon om-icon-16 om-icon-fix pdf-16\" |
837 |
* Ajout des délégataires et pétitionnaires |
* Ajout des délégataires et pétitionnaires |
838 |
**/ |
**/ |
839 |
function triggerAjouterApres($id, &$db, $val, $DEBUG){ |
function triggerAjouterApres($id, &$db, $val, $DEBUG){ |
840 |
|
|
841 |
$this->insertLinkDemandeDemandeur($db, $DEBUG); |
$this->insertLinkDemandeDemandeur($db, $DEBUG); |
842 |
|
|
843 |
// Ajout des lliens entre dossier_autorisation et demandeur |
// Ajout des lliens entre dossier_autorisation et demandeur |
844 |
if(!empty($this->valF['dossier_autorisation']) AND $val['dossier_autorisation'] == "" ) { |
if(!empty($this->valF['dossier_autorisation'])) { |
845 |
$this->ajoutLiensDossierAutorisation($id, $db, $val, $DEBUG); |
$this->ajoutLiensDossierAutorisation($id, $db, $val, $DEBUG); |
846 |
} |
} |
847 |
// Ajout des lliens entre dossier et demandeur |
// Ajout des lliens entre dossier et demandeur |
848 |
if(!empty($this->valF['dossier_instruction'])) { |
if($this->ajoutDI === TRUE) { |
849 |
$this->ajoutLiensDossierInstruction($id, $db, $val, $DEBUG); |
$this->ajoutLiensDossierInstruction($id, $db, $val, $DEBUG); |
850 |
} |
} |
851 |
|
|
852 |
// Duplication des lots et liaison au nouveau dossier_d'instruction |
// Duplication des lots (et leurs données techniques) et |
853 |
|
// liaison au nouveau dossier_d'instruction |
854 |
if(!empty($this->valF['dossier_autorisation']) AND $val['dossier_autorisation'] != "" ) { |
if(!empty($this->valF['dossier_autorisation']) AND $val['dossier_autorisation'] != "" ) { |
855 |
$this->lienLotDossierInstruction($id, $db, $val, $DEBUG); |
$this->lienLotDossierInstruction($id, $db, $val, $DEBUG); |
856 |
} |
} |
870 |
function lienLotDossierInstruction($id, $db, $val, $DEBUG) { |
function lienLotDossierInstruction($id, $db, $val, $DEBUG) { |
871 |
require_once ("../obj/lot.class.php"); |
require_once ("../obj/lot.class.php"); |
872 |
$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); |
|
873 |
require_once ("../obj/lien_lot_demandeur.class.php"); |
require_once ("../obj/lien_lot_demandeur.class.php"); |
874 |
$lld = new lien_lot_demandeur("]", $db, $DEBUG); |
$lld = new lien_lot_demandeur("]", $db, $DEBUG); |
875 |
|
|
884 |
$valLot['lot'] = ""; |
$valLot['lot'] = ""; |
885 |
$valLot['libelle'] = $rowLot['libelle']; |
$valLot['libelle'] = $rowLot['libelle']; |
886 |
$valLot['dossier_autorisation'] = NULL; |
$valLot['dossier_autorisation'] = NULL; |
887 |
|
$valLot['dossier'] = $this->valF['dossier_instruction']; |
888 |
$lot -> ajouter($valLot, $db, $DEBUG); |
$lot -> ajouter($valLot, $db, $DEBUG); |
889 |
|
|
|
//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); |
|
|
|
|
890 |
//Insertion des liens entre dossier et les lots |
//Insertion des liens entre dossier et les lots |
891 |
$sqlDemandeurs = "SELECT * FROM ".DB_PREFIXE."lien_lot_demandeur |
$sqlDemandeurs = "SELECT * FROM ".DB_PREFIXE."lien_lot_demandeur |
892 |
WHERE lot = ".$rowLot['lot']; |
WHERE lot = ".$rowLot['lot']; |
893 |
$res = $db -> query($sqlDemandeurs); |
$res = $db -> query($sqlDemandeurs); |
894 |
$this->f->addToLog("db->query(\"".$sqlDemandeurs."\");", VERBOSE_MODE); |
$this->f->addToLog("lienLotDossierInstruction() : db->query(\"".$sqlDemandeurs."\");", VERBOSE_MODE); |
895 |
$this->f->isDatabaseError($res); |
if ( database::isError($res)){ |
896 |
|
die(); |
897 |
|
} |
898 |
|
|
899 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
900 |
$valLld["lien_lot_demandeur"] = ""; |
$valLld["lien_lot_demandeur"] = ""; |
903 |
$valLld["petitionnaire_principal"] = $row['petitionnaire_principal']; |
$valLld["petitionnaire_principal"] = $row['petitionnaire_principal']; |
904 |
$lld->ajouter($valLld, $db, $DEBUG); |
$lld->ajouter($valLld, $db, $DEBUG); |
905 |
} |
} |
906 |
|
|
907 |
|
// Récupération des données techniques du nouveau lots |
908 |
|
$this->ajoutDonneesTechniquesLots($id, $db, $val, $DEBUG, $rowLot['lot'], $lot->valF['lot']); |
909 |
|
|
910 |
|
} |
911 |
|
} |
912 |
|
|
913 |
|
|
914 |
|
/** |
915 |
|
* Méthode permettant d'ajouter les données techniques aux lots |
916 |
|
*/ |
917 |
|
function ajoutDonneesTechniquesLots($id, &$db, $val, $DEBUG, $lotInit, $lotDest){ |
918 |
|
// Requete permettant de recupérer les données techniques du lot passé en paramètre ($lotInit) |
919 |
|
$sql_get_dt = "SELECT donnees_techniques FROM ".DB_PREFIXE."donnees_techniques WHERE lot=".$lotInit; |
920 |
|
$id_dt = $this->f->db->getOne($sql_get_dt); |
921 |
|
// Si des données techniques sont liées au lots on les "copie" et on les lies au lot passé en paramètre (lotDest) |
922 |
|
if(isset($id_dt) AND !empty($id_dt)) { |
923 |
|
$this->f->addToLog("ajoutDonneesTechniquesLots() : db->getone(\"".$sql_get_dt."\");", VERBOSE_MODE); |
924 |
|
if ( database::isError($id_dt)){ |
925 |
|
// Appel de la methode de recuperation des erreurs |
926 |
|
$this->erreur_db($id_dt->getDebugInfo(), $id_dt->getMessage(), ''); |
927 |
|
return false; |
928 |
|
} |
929 |
|
require_once '../obj/donnees_techniques.class.php'; |
930 |
|
$donnees_techniques = new donnees_techniques($id_dt,$db,$DEBUG); |
931 |
|
|
932 |
|
// Récupération des données dans le tableau des valeurs à insérer |
933 |
|
foreach($donnees_techniques->champs as $value) { |
934 |
|
$val[$value] = $donnees_techniques->getVal($value); |
935 |
|
} |
936 |
|
// Modification du lien vers le nouveau lot |
937 |
|
$val["lot"] = $lotDest; |
938 |
|
// Ajout des données techniques |
939 |
|
$donnees_techniques->ajouter($val, $db, $DEBUG); |
940 |
} |
} |
941 |
} |
} |
942 |
|
|
1017 |
// Execution de la requete de suppression de l'objet |
// Execution de la requete de suppression de l'objet |
1018 |
$res = $db->query($sql); |
$res = $db->query($sql); |
1019 |
// Logger |
// Logger |
1020 |
$this->f->addToLog("supprimer(): db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->f->addToLog("deleteLinkDemandeDemandeur(): db->query(\"".$sql."\");", VERBOSE_MODE); |
1021 |
$this->f->isDatabaseError(); |
if ( database::isError($res)){ |
1022 |
|
die(); |
1023 |
|
} |
1024 |
|
|
1025 |
} |
} |
1026 |
|
|
1033 |
WHERE demande = ".$this->valF['demande']. |
WHERE demande = ".$this->valF['demande']. |
1034 |
"AND demandeur = ".$idDemandeur; |
"AND demandeur = ".$idDemandeur; |
1035 |
$count = $this->f->db->getOne($sql); |
$count = $this->f->db->getOne($sql); |
1036 |
$this->f->addToLog("db->getone(\"".$sql."\");", VERBOSE_MODE); |
$this->f->addToLog("isLinkDemandeDemandeurExist() : db->getone(\"".$sql."\");", VERBOSE_MODE); |
1037 |
$this->f->isDatabaseError($count); |
if ( database::isError($count)){ |
1038 |
|
die(); |
1039 |
|
} |
1040 |
if ($count === 0) { |
if ($count === 0) { |
1041 |
return false; |
return false; |
1042 |
} else { |
} else { |
1067 |
} |
} |
1068 |
} |
} |
1069 |
} |
} |
1070 |
|
|
1071 |
/** |
/** |
1072 |
* 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 |
1073 |
* liés au dossier d'autorisation |
* liée passée en paramètre |
1074 |
**/ |
* |
1075 |
|
* @param string $from Table liée : "demande", "dossier", dossier_autorisation" |
1076 |
|
* @param string $id Identifiant (clé primaire de la table liée en question) |
1077 |
|
*/ |
1078 |
function listeDemandeur($from, $id) { |
function listeDemandeur($from, $id) { |
1079 |
// Récupération des demandeurs de la base |
// Récupération des demandeurs de la base |
1080 |
if(isset($this->valF['demande_type']) AND $this->getCodeDemandeType($this->valF['demande_type']) != "DT") { |
$sql = "SELECT demandeur.demandeur, |
1081 |
$sql = "SELECT demandeur.demandeur, |
demandeur.type_demandeur, |
1082 |
demandeur.type_demandeur, |
lien_".$from."_demandeur.petitionnaire_principal |
1083 |
lien_".$from."_demandeur.petitionnaire_principal |
FROM ".DB_PREFIXE."lien_".$from."_demandeur |
1084 |
FROM ".DB_PREFIXE."lien_".$from."_demandeur |
INNER JOIN ".DB_PREFIXE."demandeur |
1085 |
INNER JOIN ".DB_PREFIXE."demandeur |
ON demandeur.demandeur=lien_".$from."_demandeur.demandeur |
1086 |
ON demandeur.demandeur=lien_".$from."_demandeur.demandeur |
WHERE ".$from." = '".$id."'"; |
1087 |
WHERE ".$from." = '".$id."'"; |
$res = $this->f->db->query($sql); |
1088 |
$res = $this->f->db->query($sql); |
$this->f->addToLog("listeDemandeur(): db->query(\"".$sql."\")", VERBOSE_MODE); |
1089 |
$this->f->addToLog("listeDemandeur() : ".$sql); |
if ( database::isError($res)){ |
1090 |
$this->f->isDatabaseError($res); |
die(); |
1091 |
// Stoquage du résultat dans un tableau |
} |
1092 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
// Stockage du résultat dans un tableau |
1093 |
if ($row['petitionnaire_principal'] == 't' AND |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
1094 |
$row['type_demandeur']=="petitionnaire") { |
if ($row['petitionnaire_principal'] == 't' AND |
1095 |
$this->valIdDemandeur['petitionnaire_principal']=$row['demandeur']; |
$row['type_demandeur']=="petitionnaire") { |
1096 |
} elseif ($row['petitionnaire_principal'] == 'f' AND |
$this->valIdDemandeur['petitionnaire_principal']=$row['demandeur']; |
1097 |
$row['type_demandeur']=="petitionnaire"){ |
} elseif ($row['petitionnaire_principal'] == 'f' AND |
1098 |
$this->valIdDemandeur['petitionnaire'][]=$row['demandeur']; |
$row['type_demandeur']=="petitionnaire"){ |
1099 |
} elseif ($row['type_demandeur']=="delegataire"){ |
$this->valIdDemandeur['petitionnaire'][]=$row['demandeur']; |
1100 |
$this->valIdDemandeur['delegataire']=$row['demandeur']; |
} elseif ($row['type_demandeur']=="delegataire"){ |
1101 |
} |
$this->valIdDemandeur['delegataire']=$row['demandeur']; |
1102 |
} |
} |
1103 |
} |
} |
1104 |
} |
} |
1126 |
echo "obj=".get_class($this); |
echo "obj=".get_class($this); |
1127 |
if($this->getParameter("retour")=="form") { |
if($this->getParameter("retour")=="form") { |
1128 |
echo "&idx=".$this->getParameter("idx"); |
echo "&idx=".$this->getParameter("idx"); |
1129 |
|
echo "&idz=".$this->getParameter("idz"); |
1130 |
echo "&action=3"; |
echo "&action=3"; |
1131 |
} |
} |
1132 |
} |
} |
1148 |
|
|
1149 |
|
|
1150 |
/** |
/** |
1151 |
* Ajout de la liste des demandeurs |
* Cette méthode permet d'afficher des informations spécifiques dans le |
1152 |
|
* formulaire de l'objet |
1153 |
|
* |
1154 |
|
* @param integer $maj Mode de mise à jour |
1155 |
*/ |
*/ |
1156 |
function formSpecificContent($maj) { |
function formSpecificContent($maj) { |
1157 |
if(!$this->correct AND $maj != 0) { |
|
1158 |
|
/** |
1159 |
|
* Gestion du bloc des demandeurs |
1160 |
|
*/ |
1161 |
|
// Si le mode est (modification ou suppression ou consultation) ET que |
1162 |
|
// le formulaire n'est pas correct (c'est-à-dire que le formulaire est |
1163 |
|
// actif) |
1164 |
|
if (!$this->correct AND $maj != 0) { |
1165 |
|
// Alors on récupère les demandeurs dans la table lien pour |
1166 |
|
// affectation des résultats dans this->valIdDemandeur |
1167 |
$this->listeDemandeur("demande", $this->val[array_search('demande', $this->champs)]); |
$this->listeDemandeur("demande", $this->val[array_search('demande', $this->champs)]); |
1168 |
} |
} |
1169 |
// Si le paramètre idx_dossier est défini on récupère les demandeurs liés au dossier d'instruction |
|
1170 |
if($this->getParameter("idx_dossier") != "") { |
// Si le mode est (ajout ou modification) ET que le formulaire n'est pas |
1171 |
$this->listeDemandeur("dossier", $this->getParameter("idx_dossier")); |
// correct (c'est-à-dire que le formulaire est actif) |
1172 |
} |
if ($maj < 2 AND !$this->correct) { |
1173 |
if($maj < 2 AND !$this->correct) { |
// Alors on positionne le marqueur linkable a true qui permet |
1174 |
|
// d'afficher ou non les actions de gestion des demandeurs |
1175 |
$linkable = true; |
$linkable = true; |
1176 |
} else { |
} else { |
1177 |
|
// Sinon on positionne le marqueur linkable a false qui permet |
1178 |
|
// d'afficher ou non les actions de gestion des demandeurs |
1179 |
$linkable = false; |
$linkable = false; |
1180 |
} |
} |
1181 |
|
|
1182 |
|
// Affichage des demandeurs et des actions |
1183 |
// Conteneur de la listes des demandeurs |
// Conteneur de la listes des demandeurs |
1184 |
echo "<div id=\"liste_demandeur\" class=\"demande_hidden_bloc col_12\">"; |
echo "<div id=\"liste_demandeur\" class=\"demande_hidden_bloc col_12\">"; |
1185 |
echo "<fieldset class=\"cadre ui-corner-all ui-widget-content\">"; |
echo "<fieldset class=\"cadre ui-corner-all ui-widget-content\">"; |
1190 |
require_once "../obj/delegataire.class.php"; |
require_once "../obj/delegataire.class.php"; |
1191 |
// Affichage du bloc pétitionnaire principal / délégataire |
// Affichage du bloc pétitionnaire principal / délégataire |
1192 |
// L'ID DU DIV SUIVANT EST NECESSAIRE AU BON FONCTIONNEMENT DU JS |
// L'ID DU DIV SUIVANT EST NECESSAIRE AU BON FONCTIONNEMENT DU JS |
1193 |
echo "<div id=\"petitionnaire_principal_delegataire col_12\">"; |
echo "<div id=\"petitionnaire_principal_delegataire\">"; |
1194 |
// Affichage de la synthèse |
// Affichage de la synthèse |
1195 |
if (isset ($this->valIdDemandeur["petitionnaire_principal"]) AND |
if (isset ($this->valIdDemandeur["petitionnaire_principal"]) AND |
1196 |
!empty($this->valIdDemandeur["petitionnaire_principal"])) { |
!empty($this->valIdDemandeur["petitionnaire_principal"])) { |
1245 |
echo "</div>"; |
echo "</div>"; |
1246 |
// Bloc des pétitionnaires secondaires |
// Bloc des pétitionnaires secondaires |
1247 |
// L'ID DU DIV SUIVANT EST NECESSAIRE AU BON FONCTIONNEMENT DU JS |
// L'ID DU DIV SUIVANT EST NECESSAIRE AU BON FONCTIONNEMENT DU JS |
1248 |
echo "<div id=\"listePetitionnaires col_12\">"; |
echo "<div id=\"listePetitionnaires\">"; |
1249 |
|
|
1250 |
// Affichage de la synthèse |
// Affichage de la synthèse |
1251 |
if (isset ($this->valIdDemandeur["petitionnaire"]) AND |
if (isset ($this->valIdDemandeur["petitionnaire"]) AND |
1300 |
demande = $id"; |
demande = $id"; |
1301 |
|
|
1302 |
$res = $this->f->db->query($sql); |
$res = $this->f->db->query($sql); |
1303 |
$this->f->addToLog("triggerSupprimer() : ".$sql); |
$this->f->addToLog("triggerSupprimer() : db->query(\"".$sql."\")"); |
1304 |
$this->f->isDatabaseError($res); |
if ( database::isError($res)){ |
1305 |
|
die(); |
1306 |
|
} |
1307 |
} |
} |
1308 |
|
|
1309 |
// }}} |
// }}} |
1310 |
|
|
1311 |
|
|
1312 |
|
/** |
1313 |
|
* Cette fonction permet de récupérer les informations nécessaires |
1314 |
|
* à la génération du nom du répertoire |
1315 |
|
* @param string $dossier Identifiant du dossier |
1316 |
|
* @return array Tableau des résultats |
1317 |
|
*/ |
1318 |
|
private function getInfosForFoldername($dossier) { |
1319 |
|
|
1320 |
|
//Requête SQL |
1321 |
|
$sql = "SELECT dossier.dossier_autorisation, dossier_instruction_type.code |
1322 |
|
FROM ".DB_PREFIXE."dossier |
1323 |
|
LEFT JOIN ".DB_PREFIXE."dossier_instruction_type |
1324 |
|
ON dossier_instruction_type.dossier_instruction_type = dossier.dossier_instruction_type |
1325 |
|
WHERE dossier.dossier = '".$dossier."'"; |
1326 |
|
$res = $this->f->db->query($sql); |
1327 |
|
$this->addToLog("getInfosForFoldername() : db->query(".$sql.")", VERBOSE_MODE); |
1328 |
|
database::isError($res); |
1329 |
|
|
1330 |
|
// tableau des résultats |
1331 |
|
$row = $res->fetchRow(DB_FETCHMODE_ASSOC); |
1332 |
|
|
1333 |
|
//Génération du numéro de version |
1334 |
|
$sql = "SELECT |
1335 |
|
count(*) |
1336 |
|
FROM |
1337 |
|
".DB_PREFIXE."dossier |
1338 |
|
LEFT JOIN |
1339 |
|
".DB_PREFIXE."dossier_autorisation |
1340 |
|
ON |
1341 |
|
dossier_autorisation.dossier_autorisation = dossier.dossier_autorisation |
1342 |
|
LEFT JOIN |
1343 |
|
".DB_PREFIXE."dossier_instruction_type |
1344 |
|
ON |
1345 |
|
dossier_instruction_type.dossier_instruction_type = dossier.dossier_instruction_type |
1346 |
|
WHERE |
1347 |
|
dossier_autorisation.dossier_autorisation = '".$row['dossier_autorisation']."' |
1348 |
|
AND |
1349 |
|
dossier_instruction_type.code = '".$row['code']."'"; |
1350 |
|
$row['version'] = $this->db->getOne($sql); |
1351 |
|
$this->f->addToLog("getInfosForFoldername(): db->getOne(\"".$sql."\")", VERBOSE_MODE); |
1352 |
|
if ( database::isError($row['version'])){ |
1353 |
|
$this->f->addToError("", $row['version'], $row['version']); |
1354 |
|
return false; |
1355 |
|
} |
1356 |
|
|
1357 |
|
//Formatage du numéro de version |
1358 |
|
require_once '../obj/dossier.class.php'; |
1359 |
|
$dossier = new dossier($dossier,$this->db,DEBUG); |
1360 |
|
$row['version'] = $dossier->getNumeroVersionDossierInstructionType($dossier->getVal('dossier_autorisation'), $dossier->getVal('dossier_instruction_type'), $row['version']); |
1361 |
|
|
1362 |
|
// retourne le tableau des résultats |
1363 |
|
return $row; |
1364 |
|
} |
1365 |
|
|
1366 |
|
/** |
1367 |
|
* Cette fonction permet la création du répertoire dans le dossier de numérisation |
1368 |
|
* @param string $dossier_autorisation Identifiant dossier d'autorisation |
1369 |
|
* @param string $code Type du dossier d'instruction |
1370 |
|
* @param int $version Numéro de version du dossier |
1371 |
|
* @return boolean Vrai ou Faux |
1372 |
|
*/ |
1373 |
|
private function createFolder($dossier_autorisation, $code, $version) { |
1374 |
|
|
1375 |
|
// génération du nom du répertoire |
1376 |
|
$foldername = $dossier_autorisation.".".$code.$version; |
1377 |
|
|
1378 |
|
// création du répertoire dans le dossier de numérisation |
1379 |
|
if (isset($this->f->config["path_scan"])) { |
1380 |
|
$dir = $this->f->config["path_scan"]."Todo/"; |
1381 |
|
// vérifie que le répêrtoire des "à traiter" existe |
1382 |
|
// et qu'un répertoire du dossier n'existe pas déjà |
1383 |
|
if (is_dir($dir) && !file_exists($dir.$foldername)) { |
1384 |
|
mkdir($dir.$foldername, 0777); |
1385 |
|
// si la création a réussi |
1386 |
|
$this->addToLog("createFolder() : Success", VERBOSE_MODE); |
1387 |
|
return true; |
1388 |
|
} |
1389 |
|
} |
1390 |
|
|
1391 |
|
// en cas d'échec |
1392 |
|
$this->addToLog("createFolder() : Failure", VERBOSE_MODE); |
1393 |
|
return false; |
1394 |
|
} |
1395 |
|
|
1396 |
}// fin classe |
}// fin classe |
1397 |
?> |
?> |