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 |
59 |
} |
} |
60 |
} |
} |
61 |
} |
} |
62 |
|
function getDataSubmit() { |
63 |
|
|
64 |
|
$datasubmit = parent::getDataSubmit(); |
65 |
|
if($this->getParameter("idx_dossier") != "") { |
66 |
|
$datasubmit .= "&idx_dossier=".$this->getParameter("idx_dossier"); |
67 |
|
} |
68 |
|
return $datasubmit; |
69 |
|
} |
70 |
|
|
71 |
/** |
/** |
72 |
* Méthode de verification du contenu |
* Méthode de verification du contenu |
79 |
$this->addToMessage("La saisie d'un petitionnaire principal est obligatoire."); |
$this->addToMessage("La saisie d'un petitionnaire principal est obligatoire."); |
80 |
} |
} |
81 |
} |
} |
82 |
|
|
83 |
|
/** |
84 |
|
* Configuration des select |
85 |
|
*/ |
86 |
|
function setSelect(&$form, $maj,&$db,$debug) { |
87 |
|
parent::setSelect($form, $maj,$db,$debug); |
88 |
|
|
89 |
|
if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc.php")) |
90 |
|
include ("../sql/".$db->phptype."/".$this->table.".form.inc.php"); |
91 |
|
elseif(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc")) |
92 |
|
include ("../sql/".$db->phptype."/".$this->table.".form.inc"); |
93 |
|
|
94 |
|
//Récupération de paramètre pour le rechargement ajax du select |
95 |
|
$idx_dossier = $this->getParameter("idx_dossier"); |
96 |
|
$datd = $this->getParameter("datd"); |
97 |
|
|
98 |
|
$contenu = array(); |
99 |
|
|
100 |
|
// Ajout de filtre sur la requête (initial) |
101 |
|
if(isset($idx_dossier) AND $idx_dossier != "") { |
102 |
|
$sql_demande_type .= " WHERE demande_type.demande_nature = 2 "; |
103 |
|
|
104 |
|
// ajout du numéro de dossier existant pour tester l'état du DA |
105 |
|
$sql_demande_type .= "AND dossier.dossier = '".$idx_dossier."' "; |
106 |
|
} else { |
107 |
|
$sql_demande_type .= " WHERE demande_type.demande_nature = 1 "; |
108 |
|
} |
109 |
|
if(isset($_POST["dossier_autorisation_type_detaille"]) AND $_POST["dossier_autorisation_type_detaille"] != "") { |
110 |
|
$datd = $_POST["dossier_autorisation_type_detaille"]; |
111 |
|
} |
112 |
|
// Ajout de filtre sur la requête (dossier_autorisation_type_detaille) |
113 |
|
if(isset($datd) AND $datd != "") { |
114 |
|
$sql_demande_type .= " AND demande_type.dossier_autorisation_type_detaille = ".$datd; |
115 |
|
} else { |
116 |
|
$datd = $this->getVal("dossier_autorisation_type_detaille"); |
117 |
|
if ($datd != "") { |
118 |
|
$sql_demande_type .= " AND demande_type.dossier_autorisation_type_detaille = ".$datd; |
119 |
|
} |
120 |
|
} |
121 |
|
|
122 |
|
$res = $db->query($sql_demande_type); |
123 |
|
|
124 |
|
// logger |
125 |
|
$this->addToLog("setSelect()[gen/obj]: db->query(\"".$sql_demande_type."\");", |
126 |
|
VERBOSE_MODE); |
127 |
|
$this->f->isDatabaseError($res); |
128 |
|
|
129 |
|
$contenu[0][0] = ''; |
130 |
|
$contenu[1][0] = _('choisir')." "._("demande_type"); |
131 |
|
|
132 |
|
$k=1; |
133 |
|
while($row =& $res->fetchRow()){ |
134 |
|
|
135 |
|
$contenu[0][$k] = $row[0]; |
136 |
|
$contenu[1][$k] = $row[1]; |
137 |
|
$k++; |
138 |
|
} |
139 |
|
|
140 |
|
$form->setSelect("demande_type", $contenu); |
141 |
|
|
142 |
|
} |
143 |
/* |
/* |
144 |
* Ajout du fielset |
* Ajout du fielset |
145 |
* Add fieldset |
* Add fieldset |
184 |
$form->setOnchange("dossier_autorisation_type_detaille","changeDemandeType();"); |
$form->setOnchange("dossier_autorisation_type_detaille","changeDemandeType();"); |
185 |
$form->setOnchange("demande_type","showFormsDemande();"); |
$form->setOnchange("demande_type","showFormsDemande();"); |
186 |
} |
} |
187 |
|
|
188 |
|
function setLib(&$form,$maj) { |
189 |
|
parent::setLib($form,$maj); |
190 |
|
//libelle des champs |
191 |
|
|
192 |
|
$form->setLib('complement',_('terrain_adresse')); |
193 |
|
} |
194 |
/* |
/* |
195 |
* Cache le champ terrain_references_cadastrales |
* Cache le champ terrain_references_cadastrales |
196 |
* Hide the fiels terrain_references_cadastrales |
* Hide the fiels terrain_references_cadastrales |
234 |
function ajoutDossierAutorisation($id, &$db, $val, $DEBUG){ |
function ajoutDossierAutorisation($id, &$db, $val, $DEBUG){ |
235 |
require_once '../obj/dossier_autorisation.class.php'; |
require_once '../obj/dossier_autorisation.class.php'; |
236 |
$dossier_autorisation = new dossier_autorisation("]",$db,$DEBUG); |
$dossier_autorisation = new dossier_autorisation("]",$db,$DEBUG); |
237 |
// Création du dossier |
$id_etat_initial_da = $this->f->getParameter('etat_initial_dossier_autorisation'); |
238 |
foreach($dossier_autorisation->champs as $value) { |
$error = false; |
239 |
$valAuto[$value] = NULL; |
|
240 |
} |
// Vérification de l'existance d'un état initial des DA dans la table om_parametre |
241 |
$valAuto['dossier_autorisation']=NULL; |
// afin d'éviter d'eventuelle erreur de base de données |
242 |
$valAuto['exercice']=NULL; |
if(isset($id_etat_initial_da)) { |
243 |
$valAuto['insee']=NULL; |
$sql = "SELECT count(*) FROM ".DB_PREFIXE."etat_dossier_autorisation |
244 |
$valAuto['arrondissement']=NULL; |
WHERE etat_dossier_autorisation = ".$id_etat_initial_da; |
245 |
$valAuto['etat']=NULL; |
$count = $this->db->getOne($sql); |
246 |
$valAuto['erp_numero_batiment']=NULL; |
$this->addToLog("ajoutDossierAutorisation() getOne() : ".$sql); |
247 |
$valAuto['erp_ouvert']=NULL; |
$this->f->isDatabaseError($count); |
248 |
$valAuto['erp_arrete_decision']=NULL; |
if($count != 1) { |
249 |
$valAuto['dossier_autorisation_type_detaille']=$this->valF['dossier_autorisation_type_detaille']; |
$error = true; |
250 |
$valAuto['depot_initial']=$this->valF['date_demande']; |
} else { |
251 |
$valAuto['terrain_references_cadastrales']=$this->valF['terrain_references_cadastrales']; |
// La méthode ajouter prend en paramètre un tableau associatif |
252 |
$valAuto['terrain_adresse_voie_numero']=$this->valF['terrain_adresse_voie_numero']; |
// contenant toutes les champs de la classe instanciée, |
253 |
$valAuto['complement']=$this->valF['complement']; |
// d'où l'initialisation du tableau en bouclant sur la liste des champs du DA |
254 |
$valAuto['terrain_adresse_lieu_dit']=$this->valF['terrain_adresse_lieu_dit']; |
foreach($dossier_autorisation->champs as $value) { |
255 |
$valAuto['terrain_adresse_localite']=$this->valF['terrain_adresse_localite']; |
$valAuto[$value] = NULL; |
256 |
$valAuto['terrain_adresse_code_postal']=$this->valF['terrain_adresse_code_postal']; |
} |
257 |
$valAuto['terrain_adresse_bp']=$this->valF['terrain_adresse_bp']; |
// Définition des valeurs à insérer |
258 |
$valAuto['terrain_adresse_cedex']=$this->valF['terrain_adresse_cedex']; |
$valAuto['dossier_autorisation']=""; |
259 |
$valAuto['terrain_superficie']=$this->valF['terrain_superficie']; |
$valAuto['exercice']=NULL; |
260 |
$valAuto['numero_version']=-1; |
$valAuto['insee']=NULL; |
261 |
// Ajout du dossier dans la base |
$valAuto['arrondissement']=NULL; |
262 |
$dossier_autorisation->ajouter($valAuto, $db, $DEBUG); |
$valAuto['etat_dossier_autorisation']=$this->f->getParameter('etat_initial_dossier_autorisation'); |
263 |
// Liaison du dossier ajouter à la demande |
$valAuto['erp_numero_batiment']=NULL; |
264 |
$this->valF['dossier_autorisation'] = $dossier_autorisation->valF['dossier_autorisation']; |
$valAuto['erp_ouvert']=NULL; |
265 |
|
$valAuto['erp_arrete_decision']=NULL; |
266 |
|
$valAuto['dossier_autorisation_type_detaille']=$this->valF['dossier_autorisation_type_detaille']; |
267 |
|
$valAuto['depot_initial']=$this->dateDBToForm($this->valF['date_demande']); |
268 |
|
$valAuto['terrain_references_cadastrales']=$this->valF['terrain_references_cadastrales']; |
269 |
|
$valAuto['terrain_adresse_voie_numero']=$this->valF['terrain_adresse_voie_numero']; |
270 |
|
$valAuto['complement']=$this->valF['complement']; |
271 |
|
$valAuto['terrain_adresse_lieu_dit']=$this->valF['terrain_adresse_lieu_dit']; |
272 |
|
$valAuto['terrain_adresse_localite']=$this->valF['terrain_adresse_localite']; |
273 |
|
$valAuto['terrain_adresse_code_postal']=$this->valF['terrain_adresse_code_postal']; |
274 |
|
$valAuto['terrain_adresse_bp']=$this->valF['terrain_adresse_bp']; |
275 |
|
$valAuto['terrain_adresse_cedex']=$this->valF['terrain_adresse_cedex']; |
276 |
|
$valAuto['terrain_superficie']=$this->valF['terrain_superficie']; |
277 |
|
$valAuto['numero_version']=-1; |
278 |
|
// Ajout du dossier dans la base |
279 |
|
$dossier_autorisation->ajouter($valAuto, $db, $DEBUG); |
280 |
|
// Liaison du dossier ajouter à la demande |
281 |
|
$this->valF['dossier_autorisation'] = $dossier_autorisation->valF['dossier_autorisation']; |
282 |
|
} |
283 |
|
} else { |
284 |
|
$error = true; |
285 |
|
} |
286 |
|
// Affichage de l'erreur et stop de l'affichage |
287 |
|
if( $error ) { |
288 |
|
echo "</div>"; |
289 |
|
$class = "error"; |
290 |
|
$message = _("Erreur de parametrage. Contactez votre administrateur."); |
291 |
|
$this->f->displayMessage($class, $message); |
292 |
|
die(); |
293 |
|
} |
294 |
|
|
295 |
|
} |
296 |
|
|
297 |
|
function getCodeDemandeType($demande_type){ |
298 |
|
|
299 |
|
$sql = "SELECT |
300 |
|
code |
301 |
|
FROM |
302 |
|
".DB_PREFIXE."demande_type |
303 |
|
WHERE |
304 |
|
demande_type = ".$demande_type; |
305 |
|
$codeDemandeType = $this->db->getOne($sql); |
306 |
|
$this->addToLog("db->getone(\"".$sql."\");", VERBOSE_MODE); |
307 |
|
|
308 |
|
return $codeDemandeType; |
309 |
} |
} |
310 |
|
|
311 |
/** |
/** |
329 |
// Définition des valeurs à entrée dans la table |
// Définition des valeurs à entrée dans la table |
330 |
$valInstr['dossier_instruction_type']=$dossier_instruction_type; |
$valInstr['dossier_instruction_type']=$dossier_instruction_type; |
331 |
$valInstr['date_depot']=$this->dateDBToForm($this->valF['date_demande']); |
$valInstr['date_depot']=$this->dateDBToForm($this->valF['date_demande']); |
332 |
|
$valInstr['date_dernier_depot']=$this->dateDBToForm($this->valF['date_demande']); |
333 |
$valInstr['date_demande']=$this->dateDBToForm($this->valF['date_demande']); |
$valInstr['date_demande']=$this->dateDBToForm($this->valF['date_demande']); |
334 |
$valInstr['depot_initial']=$this->dateDBToForm($this->valF['date_demande']); |
$valInstr['depot_initial']=$this->dateDBToForm($this->valF['date_demande']); |
335 |
$valInstr['terrain_references_cadastrales']=$this->valF['terrain_references_cadastrales']; |
$valInstr['terrain_references_cadastrales']=$this->valF['terrain_references_cadastrales']; |
343 |
$valInstr['terrain_superficie']=$this->valF['terrain_superficie']; |
$valInstr['terrain_superficie']=$this->valF['terrain_superficie']; |
344 |
$valInstr['description']=""; |
$valInstr['description']=""; |
345 |
$valInstr['dossier_autorisation']=$this->valF['dossier_autorisation']; |
$valInstr['dossier_autorisation']=$this->valF['dossier_autorisation']; |
346 |
|
|
347 |
|
/* |
348 |
|
* Gestion de la qualification |
349 |
|
* */ |
350 |
|
//Récupérer le code du type de la demande |
351 |
|
$codeDemandeType = $this->getCodeDemandeType($val['demande_type']); |
352 |
|
|
353 |
|
//Marque le dossier comme à qualifier selon le type de dossier d'instruction |
354 |
|
if ( strcasecmp($codeDemandeType, "DI") == 0 || |
355 |
|
strcasecmp($codeDemandeType, "DT") == 0 || |
356 |
|
strcasecmp($codeDemandeType, "DM") == 0 || |
357 |
|
strcasecmp($codeDemandeType, "DP") == 0 || |
358 |
|
strcasecmp($codeDemandeType, "DTP") == 0 || |
359 |
|
strcasecmp($codeDemandeType, "DAACT") == 0 || |
360 |
|
strcasecmp($codeDemandeType, "DOC") == 0 ){ |
361 |
|
|
362 |
|
$valInstr['a_qualifier'] = TRUE; |
363 |
|
} |
364 |
|
|
365 |
|
// Récupération du cerfa pour le type d'instruction sélectionnée et valide |
366 |
|
$sql = "SELECT |
367 |
|
dossier_instruction_type.cerfa |
368 |
|
FROM |
369 |
|
".DB_PREFIXE."dossier_instruction_type |
370 |
|
JOIN |
371 |
|
".DB_PREFIXE."cerfa |
372 |
|
ON |
373 |
|
dossier_instruction_type.cerfa = cerfa.cerfa |
374 |
|
WHERE |
375 |
|
now()<=om_validite_fin |
376 |
|
AND now()>=om_validite_debut |
377 |
|
AND dossier_instruction_type=".$dossier_instruction_type; |
378 |
|
$valInstr['cerfa'] = $db->getOne($sql); |
379 |
|
$this->addToLog("db->getone(\"".$sql."\");", VERBOSE_MODE); |
380 |
|
|
381 |
$dossier->ajouter($valInstr, $db, $DEBUG); |
$dossier->ajouter($valInstr, $db, $DEBUG); |
382 |
$this->f->isDatabaseError(); |
$this->f->isDatabaseError(); |
383 |
// Liaison du dossier ajouter à la demande |
// Liaison du dossier ajouter à la demande |
385 |
} |
} |
386 |
|
|
387 |
/** |
/** |
388 |
|
* Méthode permettant d'ajouter les données techniques au dossier d'instruction |
389 |
|
*/ |
390 |
|
function ajoutDonneesTechniques($id, &$db, $val, $DEBUG){ |
391 |
|
|
392 |
|
require_once '../obj/donnees_techniques.class.php'; |
393 |
|
$donnees_techniques = new donnees_techniques("]",$db,$DEBUG); |
394 |
|
|
395 |
|
// Champs tous à NULL car seul le champ concernant le dossier d'instruction sera rempli |
396 |
|
foreach($donnees_techniques->champs as $value) { |
397 |
|
$val[$value] = NULL; |
398 |
|
} |
399 |
|
|
400 |
|
// Ajout du numéro de dossier d'instruction |
401 |
|
$val['dossier_instruction']=$this->valF['dossier_instruction']; |
402 |
|
|
403 |
|
// Ajout des données techniques |
404 |
|
$donnees_techniques->ajouter($val, $db, $DEBUG); |
405 |
|
$this->f->isDatabaseError(); |
406 |
|
} |
407 |
|
|
408 |
|
/** |
409 |
* Ajout des liens demandeurs / dossier d'autorisation |
* Ajout des liens demandeurs / dossier d'autorisation |
410 |
**/ |
**/ |
411 |
function ajoutLiensDossierAutorisation($id, &$db, $val, $DEBUG) { |
function ajoutLiensDossierAutorisation($id, &$db, $val, $DEBUG) { |
544 |
if($dossier_type['dossier_instruction_type'] != NULL) { |
if($dossier_type['dossier_instruction_type'] != NULL) { |
545 |
$this->ajoutDossierInstruction($id, $db, $val, $DEBUG, $dossier_type['dossier_instruction_type']); |
$this->ajoutDossierInstruction($id, $db, $val, $DEBUG, $dossier_type['dossier_instruction_type']); |
546 |
$this -> addToMessage(_("Creation du dossier d'instruction no").$this->valF['dossier_instruction']); |
$this -> addToMessage(_("Creation du dossier d'instruction no").$this->valF['dossier_instruction']); |
547 |
|
|
548 |
|
//Ajout des données techniques au dossier d'instruction |
549 |
|
$this->ajoutDonneesTechniques($id, $db, $val, $DEBUG); |
550 |
} |
} |
551 |
|
|
552 |
/*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*/ |
579 |
$valInstr['delai_notification']="1"; |
$valInstr['delai_notification']="1"; |
580 |
$valInstr['archive_delai']="0"; |
$valInstr['archive_delai']="0"; |
581 |
$valInstr['archive_date_complet']=NULL; |
$valInstr['archive_date_complet']=NULL; |
582 |
|
$valInstr['archive_date_dernier_depot']=NULL; |
583 |
$valInstr['archive_date_rejet']=NULL; |
$valInstr['archive_date_rejet']=NULL; |
584 |
$valInstr['archive_date_limite']=NULL; |
$valInstr['archive_date_limite']=NULL; |
585 |
$valInstr['archive_date_notification_delai']=NULL; |
$valInstr['archive_date_notification_delai']=NULL; |
613 |
$valInstr['date_envoi_controle_legalite']=NULL; |
$valInstr['date_envoi_controle_legalite']=NULL; |
614 |
$valInstr['date_retour_controle_legalite']=NULL; |
$valInstr['date_retour_controle_legalite']=NULL; |
615 |
$valInstr['signataire_arrete']=NULL; |
$valInstr['signataire_arrete']=NULL; |
616 |
|
$valInstr['numero_arrete']=NULL; |
617 |
|
|
618 |
/*Fichier requis*/ |
/*Fichier requis*/ |
619 |
require_once '../obj/instruction.class.php'; |
require_once '../obj/instruction.class.php'; |
630 |
$this->valF['instruction_recepisse'] = $instruction->valF['instruction']; |
$this->valF['instruction_recepisse'] = $instruction->valF['instruction']; |
631 |
$this -> addToMessage("<br/><a |
$this -> addToMessage("<br/><a |
632 |
class='lien' |
class='lien' |
633 |
href='../pdf/pdflettretype.php?obj=".$lettretype."&idx=".$this->valF['dossier_instruction']."' |
href='../pdf/pdflettretype.php?obj=".$lettretype."&idx=".$instruction->valF['instruction']."' |
634 |
target='_blank'> |
target='_blank'> |
635 |
<span |
<span |
636 |
class=\"om-icon om-icon-16 om-icon-fix pdf-16\" |
class=\"om-icon om-icon-16 om-icon-fix pdf-16\" |
708 |
$valLot['libelle'] = $rowLot['libelle']; |
$valLot['libelle'] = $rowLot['libelle']; |
709 |
$valLot['dossier_autorisation'] = NULL; |
$valLot['dossier_autorisation'] = NULL; |
710 |
$lot -> ajouter($valLot, $db, $DEBUG); |
$lot -> ajouter($valLot, $db, $DEBUG); |
711 |
print_r($rowLot); |
|
712 |
//Insertion du lien entre le lot et le dossier d'instruction |
//Insertion du lien entre le lot et le dossier d'instruction |
713 |
$valLdl['lien_dossier_lot'] = ""; |
$valLdl['lien_dossier_lot'] = ""; |
714 |
$valLdl['dossier'] = $this->valF['dossier_instruction']; |
$valLdl['dossier'] = $this->valF['dossier_instruction']; |
861 |
**/ |
**/ |
862 |
function listeDemandeur($from, $id) { |
function listeDemandeur($from, $id) { |
863 |
// Récupération des demandeurs de la base |
// Récupération des demandeurs de la base |
864 |
$sql = "SELECT demandeur.demandeur, |
if(isset($this->valF['demande_type']) AND $this->getCodeDemandeType($this->valF['demande_type']) != "DT") { |
865 |
demandeur.type_demandeur, |
$sql = "SELECT demandeur.demandeur, |
866 |
lien_".$from."_demandeur.petitionnaire_principal |
demandeur.type_demandeur, |
867 |
FROM ".DB_PREFIXE."lien_".$from."_demandeur |
lien_".$from."_demandeur.petitionnaire_principal |
868 |
INNER JOIN ".DB_PREFIXE."demandeur |
FROM ".DB_PREFIXE."lien_".$from."_demandeur |
869 |
ON demandeur.demandeur=lien_".$from."_demandeur.demandeur |
INNER JOIN ".DB_PREFIXE."demandeur |
870 |
WHERE ".$from." = '".$id."'"; |
ON demandeur.demandeur=lien_".$from."_demandeur.demandeur |
871 |
$res = $this->f->db->query($sql); |
WHERE ".$from." = '".$id."'"; |
872 |
$this->f->addToLog("listeDemandeur() : ".$sql); |
$res = $this->f->db->query($sql); |
873 |
$this->f->isDatabaseError($res); |
$this->f->addToLog("listeDemandeur() : ".$sql); |
874 |
// Stoquage du résultat dans un tableau |
$this->f->isDatabaseError($res); |
875 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
// Stoquage du résultat dans un tableau |
876 |
if ($row['petitionnaire_principal'] == 't' AND |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
877 |
$row['type_demandeur']=="petitionnaire") { |
if ($row['petitionnaire_principal'] == 't' AND |
878 |
$this->valIdDemandeur['petitionnaire_principal']=$row['demandeur']; |
$row['type_demandeur']=="petitionnaire") { |
879 |
} elseif ($row['petitionnaire_principal'] == 'f' AND |
$this->valIdDemandeur['petitionnaire_principal']=$row['demandeur']; |
880 |
$row['type_demandeur']=="petitionnaire"){ |
} elseif ($row['petitionnaire_principal'] == 'f' AND |
881 |
$this->valIdDemandeur['petitionnaire'][]=$row['demandeur']; |
$row['type_demandeur']=="petitionnaire"){ |
882 |
} elseif ($row['type_demandeur']=="delegataire"){ |
$this->valIdDemandeur['petitionnaire'][]=$row['demandeur']; |
883 |
$this->valIdDemandeur['delegataire']=$row['demandeur']; |
} elseif ($row['type_demandeur']=="delegataire"){ |
884 |
|
$this->valIdDemandeur['delegataire']=$row['demandeur']; |
885 |
|
} |
886 |
} |
} |
887 |
} |
} |
888 |
} |
} |