3 |
//gen openMairie le 02/05/2013 15:03 |
//gen openMairie le 02/05/2013 15:03 |
4 |
|
|
5 |
require_once ("../gen/obj/document_numerise.class.php"); |
require_once ("../gen/obj/document_numerise.class.php"); |
6 |
|
require_once("../services/outgoing/messageenqueuer.php"); |
7 |
|
|
8 |
class document_numerise extends document_numerise_gen { |
class document_numerise extends document_numerise_gen { |
9 |
|
|
12 |
"uid" => array( |
"uid" => array( |
13 |
"dossier" => "getDossier", |
"dossier" => "getDossier", |
14 |
"dossier_version" => "getDossierVersion", |
"dossier_version" => "getDossierVersion", |
15 |
"numDemandeAutor" => "getDossierAutorisation", |
"numDemandeAutor" => "getNumDemandeAutor", |
16 |
"anneemoisDemandeAutori" => "getDateDemandeInitiale", |
"anneemoisDemandeAutor" => "getAnneemoisDemandeAutor", |
17 |
"typeInstructionAutorisation" => "getDossierInstructionType", |
"typeInstruction" => "getTypeInstruction", |
18 |
"statutAutorisation" => "getStatut", |
"statutAutorisation" => "getStatutAutorisation", |
19 |
"typeAutorisation" => "getDossierAutorisationType", |
"typeAutorisation" => "getTypeAutorisation", |
20 |
"dateEvenementDocument" => "getDateEvenement", |
"dateEvenementDocument" => "getDateEvenementDocument", |
21 |
"filename" => "getFilename", |
"filename" => "getFilename", |
22 |
"groupeInstruction" => 'getGroupeInstruction', |
"groupeInstruction" => 'getGroupeInstruction', |
23 |
"title" => 'getTypeDoc', |
"title" => 'getTitle', |
24 |
), |
), |
25 |
"document_arrete" => array( |
"document_arrete" => array( |
26 |
"numArrete" => "getNumArrete", |
"numArrete" => "getNumArrete", |
27 |
"specialiteArrete" => "getSpecialiteArrete", |
"ReglementaireArrete" => "getReglementaireArrete", |
28 |
"decisionArrete" => "getDecisionArrete", |
"NotificationArrete" => "getNotificationArrete", |
29 |
"chketatReglementaire" => "getChketatReglementaire", |
"dateNotificationArrete" => "getDateNotificationArrete", |
30 |
"chkNotification" => "getChkNotification", |
"controleLegalite" => "getControleLegalite", |
31 |
"dateNotification" => "getDateNotification", |
"dateSignature" => "getDateSignature", |
|
"chkCreationdroit" => "getChkCreationdroit", |
|
|
"chkPublication" => "getChkPublication", |
|
|
"datePublication" => "getDatePublication", |
|
|
"chkControleLegalite" => "getChkControleLegalite", |
|
|
"dateSignatureArrete" => "getDateSignatureArrete", |
|
32 |
"nomSignataire" => "getNomSignataire", |
"nomSignataire" => "getNomSignataire", |
33 |
"qualiteSignataire" => "getQualiteSignataire", |
"qualiteSignataire" => "getQualiteSignataire", |
|
"chkDelegation" => "getChkDelegation", |
|
34 |
"ap_numRue" => "getAp_numRue", |
"ap_numRue" => "getAp_numRue", |
35 |
"ap_nomDeLaVoie" => "getAp_nomDeLaVoie", |
"ap_nomDeLaVoie" => "getAp_nomDeLaVoie", |
36 |
"ap_codePostal" => "getAp_codePostal", |
"ap_codePostal" => "getAp_codePostal", |
37 |
"ap_ville" => "getAp_ville", |
"ap_ville" => "getAp_ville", |
38 |
|
"activite" => "getActivite", |
39 |
|
"dateControleLegalite" => "getDateControleLegalite", |
40 |
), |
), |
41 |
); |
); |
42 |
|
|
50 |
|
|
51 |
function setType(&$form,$maj) { |
function setType(&$form,$maj) { |
52 |
parent::setType($form,$maj); |
parent::setType($form,$maj); |
53 |
|
|
54 |
//type |
//type |
55 |
|
$form->setType('document_numerise','hidden'); |
56 |
|
$form->setType('dossier','hidden'); |
57 |
|
$form->setType('nom_fichier','hidden'); |
58 |
|
|
59 |
if ($maj==0){ //ajout |
if ($maj==0){ //ajout |
60 |
$form->setType('nom_fichier','hidden'); |
$form->setType('nom_fichier','hidden'); |
61 |
if($this->retourformulaire == "") { |
if($this->retourformulaire == "") { |
63 |
} else { |
} else { |
64 |
$form->setType('uid','upload2'); |
$form->setType('uid','upload2'); |
65 |
} |
} |
|
if(($this->retourformulaire=='dossier_instruction' |
|
|
|| $this->retourformulaire=='dossier_instruction_tous_clotures' |
|
|
|| $this->retourformulaire=='dossier_instruction_mes_clotures' |
|
|
|| $this->retourformulaire=='dossier_instruction_tous_encours' |
|
|
|| $this->retourformulaire=='dossier_instruction_mes_encours') |
|
|
and $form->val['dossier'] == $this->getParameter('idxformulaire')) { |
|
|
$form->setType('dossier','hidden'); |
|
|
} else { |
|
|
$form->setType('dossier','select'); |
|
|
} |
|
66 |
}// fin ajout |
}// fin ajout |
67 |
|
|
68 |
if ($maj==1){ //modifier |
if ($maj==1){ //modifier |
69 |
$form->setType('nom_fichier','hiddenstatic'); |
$form->setType('nom_fichier','hiddenstatic'); |
70 |
if($this->retourformulaire == "") { |
if($this->retourformulaire == "") { |
72 |
} else { |
} else { |
73 |
$form->setType('uid','upload2'); |
$form->setType('uid','upload2'); |
74 |
} |
} |
|
if(($this->retourformulaire=='dossier_instruction' |
|
|
|| 'dossier_instruction_tous_clotures' |
|
|
|| 'dossier_instruction_mes_clotures' |
|
|
|| 'dossier_instruction_tous_encours' |
|
|
|| 'dossier_instruction_mes_encours') |
|
|
and $form->val['dossier'] == $this->getParameter('idxformulaire')) { |
|
|
$form->setType('dossier','hidden'); |
|
|
} else { |
|
|
$form->setType('dossier','select'); |
|
|
} |
|
75 |
}// fin modifier |
}// fin modifier |
76 |
|
|
77 |
// Mode supprimer |
if ($maj==2){ //supprimer |
78 |
if ($maj==2){ |
$form->setType('uid','filestatic'); |
79 |
$form->setType('nom_fichier','filestatic'); |
$form->setType('date_creation','datestatic'); |
80 |
} |
}// fin supprimer |
81 |
|
|
82 |
if ($maj==3){ //modifier |
if ($maj==3){ //consulter |
83 |
$form->setType('nom_fichier','hiddenstatic'); |
$form->setType('uid','file'); |
84 |
} |
}// fin consulter |
85 |
} |
} |
86 |
|
|
87 |
function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire,&$db,$DEBUG=null){ |
function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire,&$db,$DEBUG=null){ |
89 |
|
|
90 |
$this->retourformulaire = $retourformulaire; |
$this->retourformulaire = $retourformulaire; |
91 |
|
|
92 |
if($retourformulaire =='dossier' OR |
if($maj == 0 && |
93 |
($retourformulaire =='dossier_instruction' |
($retourformulaire =='dossier' |
94 |
|
|| $retourformulaire =='dossier_instruction' |
95 |
|| $retourformulaire=='dossier_instruction_tous_clotures' |
|| $retourformulaire=='dossier_instruction_tous_clotures' |
96 |
|| $retourformulaire=='dossier_instruction_mes_clotures' |
|| $retourformulaire=='dossier_instruction_mes_clotures' |
97 |
|| $retourformulaire=='dossier_instruction_tous_encours' |
|| $retourformulaire=='dossier_instruction_tous_encours' |
121 |
function setvalF($val) { |
function setvalF($val) { |
122 |
parent::setvalF($val); |
parent::setvalF($val); |
123 |
|
|
124 |
|
//Si le type est renseigné |
125 |
if ($val['document_numerise_type'] != "") { |
if ($val['document_numerise_type'] != "") { |
126 |
|
//Recupère le code du type du document |
127 |
$document_numerise_type = $this->get_document_numerise_type_code_by_id($val["document_numerise_type"]); |
$document_numerise_type = $this->get_document_numerise_type_code_by_id($val["document_numerise_type"]); |
128 |
|
|
129 |
|
// Si c'est un arrêté alors on ajoute les métadonnées pour ce type de document |
130 |
|
if ($this->get_document_numerise_type_categorie_libelle($val["document_numerise_type"]) == 'Arrêté') { |
131 |
|
|
132 |
|
// rassemble les eléments des deux tableau |
133 |
|
$this->metadata['uid'] = array_merge($this->metadata['uid'], $this->metadata['document_arrete']); |
134 |
|
} |
135 |
} else { |
} else { |
136 |
$document_numerise_type = ""; |
$document_numerise_type = ""; |
137 |
} |
} |
142 |
|
|
143 |
//Génération automatique nom du fichier |
//Génération automatique nom du fichier |
144 |
$this->valF['nom_fichier'] = $this->generateFilename($this->valF["date_creation"], $document_numerise_type); |
$this->valF['nom_fichier'] = $this->generateFilename($this->valF["date_creation"], $document_numerise_type); |
|
|
|
|
// Si c'est un arrêté alors on ajoute les métadonnées pour ce type de document |
|
|
if ($this->get_document_numerise_type_categorie_libelle($val["document_numerise_type"]) == 'Arrêté') { |
|
|
|
|
|
// rassemble les elément des deux tableau |
|
|
$this->metadata['uid'] = array_merge($this->metadata['uid'], $this->metadata['document_arrete']); |
|
|
} |
|
145 |
} |
} |
146 |
|
|
147 |
/** |
/** |
148 |
* Permet de mettre à jour un champs dans la table instruction sans passer par ses triggers |
* Permet de mettre à jour un champs dans la table instruction sans passer par ses triggers |
149 |
* @param string $uid Identifiant du fichier |
* @param string $document_numerise Identifiant du fichier |
150 |
*/ |
*/ |
151 |
private function updateInstructionAutoExecute($uid) { |
private function updateInstructionAutoExecute($document_numerise) { |
152 |
|
|
153 |
// valeurs à mettre à jour |
// valeurs à mettre à jour |
154 |
$val = array("document_arrete"=>$uid); |
$val = array("document_numerise"=>$document_numerise); |
155 |
// met à jour la table instruction sans passer par ses triggers |
// met à jour la table instruction sans passer par ses triggers |
156 |
$res = $this->db->autoExecute(DB_PREFIXE."instruction", $val, DB_AUTOQUERY_UPDATE,"instruction=".$this->getLastInstruction($this->valF['dossier'])); |
$res = $this->db->autoExecute(DB_PREFIXE."instruction", $val, DB_AUTOQUERY_UPDATE,"instruction=".$this->getLastInstructionArrete($this->valF['dossier'])); |
157 |
// Exécution du traitement |
// Exécution du traitement |
158 |
$this->f->addToLog("updateInstructionDocumentArrete() : db->autoExecute(".$res.")", VERBOSE_MODE); |
$this->f->addToLog("updateInstructionDocumentArrete() : db->autoExecute(".$res.")", VERBOSE_MODE); |
159 |
if (database::isError($res)) { |
if (database::isError($res)) { |
167 |
*/ |
*/ |
168 |
function triggerajouterapres($id,&$db,$val,$DEBUG) { |
function triggerajouterapres($id,&$db,$val,$DEBUG) { |
169 |
|
|
170 |
// Si c'est un arrêté alors alors on met à jour la table instruction |
// Si c'est un arrêté alors alors on met à jour la table instruction |
171 |
if ($this->get_document_numerise_type_categorie_libelle($val["document_numerise_type"]) == 'Arrêté') { |
if ($this->get_document_numerise_type_categorie_libelle($val["document_numerise_type"]) == 'Arrêté') { |
172 |
|
|
173 |
// Met à jour la table instruction |
// Met à jour la table instruction |
174 |
$this->updateInstructionAutoExecute($this->valF['uid']); |
$this->updateInstructionAutoExecute($this->valF['document_numerise']); |
175 |
} |
} |
176 |
|
|
177 |
|
//Si l'option ERP est activée |
178 |
|
if ($this->f->getParameter('option_erp') == "true") { |
179 |
|
|
180 |
|
//Envoi d'un message au référentiel ERP si on ajoute une piece sur |
181 |
|
//un dossier de type AT |
182 |
|
if ($this->f->getDATDCode($this->valF['dossier']) === 'AT') { |
183 |
|
//On initialise la queue de message |
184 |
|
$msgenque = new MessageEnqueuer(); |
185 |
|
//On initialise le dossier d'instruction |
186 |
|
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
187 |
|
|
188 |
|
//On récupère l'état du dossier d'instruction |
189 |
|
$etat = $this->getEtatDossier($this->valF['dossier']); |
190 |
|
|
191 |
|
//On calcule le type de pièce |
192 |
|
$msgenque->setTypePiece(($etat==='incomplet')?_("complementaire"):_("supplementaire")); |
193 |
|
$return = $msgenque->enqueueMessage($msgenque::$ERP_AJOUT_PIECE); |
194 |
|
//Si une erreur s'est produite on arrête le traitement et on |
195 |
|
//retourne une erreur |
196 |
|
if ($return !== 0){ |
197 |
|
|
198 |
|
$this->addToMessage(_("Une erreur s'est produite lors de ". |
199 |
|
"l'envoi du message au referentiel ERP. Merci de ". |
200 |
|
"contacter votre administrateur")); |
201 |
|
//Si c'est un problème de connexion vers rabbitMQ et AMQP |
202 |
|
//On ne valide pas le formulaire |
203 |
|
if ( $return === -3 ){ |
204 |
|
$this->addToMessage("<br/>"._("SAISIE NON ENREGISTREE")."<br/>"); |
205 |
|
$this->correct = false; |
206 |
|
return false; |
207 |
|
} |
208 |
|
} |
209 |
|
else { |
210 |
|
$this->addToMessage(_("Le message a ete transmis au ". |
211 |
|
"referentiel ERP.")); |
212 |
|
} |
213 |
|
} |
214 |
|
} |
215 |
|
} |
216 |
|
|
217 |
|
/** |
218 |
|
* Permet d’effectuer des actions avant la modification des données dans la base |
219 |
|
*/ |
220 |
|
function triggermodifier($id,&$db,$val,$DEBUG) { |
221 |
|
|
222 |
|
// si le fichier n'a pas été déjà modifié |
223 |
|
if (stripos($val['uid'], 'tmp') === false) { |
224 |
|
// récupération du fichier et de ses métadonnées |
225 |
|
$file = $this->f->storage->get($val['uid']); |
226 |
|
// créé un fichier temporaire |
227 |
|
$tmp_file = $this->f->storage->create_temporary($file['file_content'], $file['metadata'], "from_content"); |
228 |
|
// remplace le fichier par le temporaire pour obliger la modification du fichier |
229 |
|
$this->valF['uid'] = 'tmp|'.$tmp_file; |
230 |
|
} |
231 |
} |
} |
232 |
|
|
233 |
/** |
/** |
237 |
$objsf, $premiersf, $tricolsf, $validation, |
$objsf, $premiersf, $tricolsf, $validation, |
238 |
$idx, $maj, $retour) { |
$idx, $maj, $retour) { |
239 |
|
|
240 |
if( $maj == 0 && ($retourformulaire === "dossier_instruction" |
if(($maj == 0 || $maj == 3 || $maj == 2) && ($retourformulaire === "dossier_instruction" |
241 |
|| $retourformulaire==='dossier_instruction_tous_clotures' |
|| $retourformulaire==='dossier_instruction_tous_clotures' |
242 |
|| $retourformulaire==='dossier_instruction_mes_clotures' |
|| $retourformulaire==='dossier_instruction_mes_clotures' |
243 |
|| $retourformulaire==='dossier_instruction_tous_encours' |
|| $retourformulaire==='dossier_instruction_tous_encours' |
315 |
* Récupération du numéro de dossier d'autorisation à ajouter aux métadonnées |
* Récupération du numéro de dossier d'autorisation à ajouter aux métadonnées |
316 |
* @return [type] [description] |
* @return [type] [description] |
317 |
*/ |
*/ |
318 |
protected function getDossierAutorisation() { |
protected function getNumDemandeAutor() { |
319 |
if(empty($this->specificMetadata)) { |
if(empty($this->specificMetadata)) { |
320 |
$this->getSpecificMetadata(); |
$this->getSpecificMetadata(); |
321 |
} |
} |
325 |
* Récupération de la date de demande initiale du dossier à ajouter aux métadonnées |
* Récupération de la date de demande initiale du dossier à ajouter aux métadonnées |
326 |
* @return [type] [description] |
* @return [type] [description] |
327 |
*/ |
*/ |
328 |
protected function getDateDemandeInitiale() { |
protected function getAnneemoisDemandeAutor() { |
329 |
if(empty($this->specificMetadata)) { |
if(empty($this->specificMetadata)) { |
330 |
$this->getSpecificMetadata(); |
$this->getSpecificMetadata(); |
331 |
} |
} |
335 |
* Récupération du type de dossier d'instruction à ajouter aux métadonnées |
* Récupération du type de dossier d'instruction à ajouter aux métadonnées |
336 |
* @return [type] [description] |
* @return [type] [description] |
337 |
*/ |
*/ |
338 |
protected function getDossierInstructionType() { |
protected function getTypeInstruction() { |
339 |
if(empty($this->specificMetadata)) { |
if(empty($this->specificMetadata)) { |
340 |
$this->getSpecificMetadata(); |
$this->getSpecificMetadata(); |
341 |
} |
} |
345 |
* Récupération du statut du dossier d'autorisation à ajouter aux métadonnées |
* Récupération du statut du dossier d'autorisation à ajouter aux métadonnées |
346 |
* @return [type] [description] |
* @return [type] [description] |
347 |
*/ |
*/ |
348 |
protected function getStatut() { |
protected function getStatutAutorisation() { |
349 |
if(empty($this->specificMetadata)) { |
if(empty($this->specificMetadata)) { |
350 |
$this->getSpecificMetadata(); |
$this->getSpecificMetadata(); |
351 |
} |
} |
355 |
* Récupération du type de dossier d'autorisation à ajouter aux métadonnées |
* Récupération du type de dossier d'autorisation à ajouter aux métadonnées |
356 |
* @return [type] [description] |
* @return [type] [description] |
357 |
*/ |
*/ |
358 |
protected function getDossierAutorisationType() { |
protected function getTypeAutorisation() { |
359 |
if(empty($this->specificMetadata)) { |
if(empty($this->specificMetadata)) { |
360 |
$this->getSpecificMetadata(); |
$this->getSpecificMetadata(); |
361 |
} |
} |
372 |
* Récupération de la date d'ajout de document à ajouter aux métadonnées |
* Récupération de la date d'ajout de document à ajouter aux métadonnées |
373 |
* @return [type] [description] |
* @return [type] [description] |
374 |
*/ |
*/ |
375 |
protected function getDateEvenement() { |
protected function getDateEvenementDocument() { |
376 |
return date("d/m/Y", strtotime($this->valF["date_creation"])); |
return date("Y-m-d", strtotime($this->valF["date_creation"])); |
377 |
} |
} |
378 |
/** |
/** |
379 |
* Récupération du groupe d'instruction à ajouter aux métadonnées |
* Récupération du groupe d'instruction à ajouter aux métadonnées |
389 |
* Récupération du libellé du type du document à ajouter aux métadonnées |
* Récupération du libellé du type du document à ajouter aux métadonnées |
390 |
* @return string Groupe d'instruction |
* @return string Groupe d'instruction |
391 |
*/ |
*/ |
392 |
protected function getTypeDoc() { |
protected function getTitle() { |
393 |
//Requête sql |
//Requête sql |
394 |
$sql = "SELECT libelle |
$sql = "SELECT libelle |
395 |
FROM ".DB_PREFIXE."document_numerise_type |
FROM ".DB_PREFIXE."document_numerise_type |
396 |
WHERE document_numerise_type = ".$this->valF["document_numerise_type"]; |
WHERE document_numerise_type = ".$this->valF["document_numerise_type"]; |
397 |
$document_numerise_type_libelle = $this->db->getOne($sql); |
$document_numerise_type_libelle = $this->db->getOne($sql); |
398 |
$this->addToLog("db->getone(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog("db->getone(\"".$sql."\");", VERBOSE_MODE); |
399 |
$this->f->addToLog("getTypeDoc() : db->getOne(".$sql.")", VERBOSE_MODE); |
$this->f->addToLog("getTitle() : db->getOne(".$sql.")", VERBOSE_MODE); |
400 |
if (database::isError($document_numerise_type_libelle)) { |
if (database::isError($document_numerise_type_libelle)) { |
401 |
die(); |
die(); |
402 |
} |
} |
416 |
return ''; |
return ''; |
417 |
} |
} |
418 |
/** |
/** |
|
* @return string ads |
|
|
*/ |
|
|
function getSpecialiteArrete() { |
|
|
return "ADS"; |
|
|
} |
|
|
/** |
|
|
* @return string decision |
|
|
*/ |
|
|
function getDecisionArrete() { |
|
|
if (empty($this->metadonneesArrete)) { |
|
|
$this->getArreteMetadata(); |
|
|
} |
|
|
return $this->metadonneesArrete["decisionarrete"]; |
|
|
} |
|
|
/** |
|
419 |
* @return chaîne vide |
* @return chaîne vide |
420 |
*/ |
*/ |
421 |
function getChketatReglementaire() { |
function getReglementaireArrete() { |
422 |
return 'true'; |
return 'true'; |
423 |
} |
} |
424 |
/** |
/** |
425 |
* @return boolean de notification au pétitionnaire |
* @return boolean de notification au pétitionnaire |
426 |
*/ |
*/ |
427 |
function getChkNotification() { |
function getNotificationArrete() { |
428 |
return 'true'; |
return 'true'; |
429 |
} |
} |
430 |
/** |
/** |
431 |
* @return date de notification au pétitionnaire |
* @return date de notification au pétitionnaire |
432 |
*/ |
*/ |
433 |
function getDateNotification() { |
function getDateNotificationArrete() { |
434 |
if (empty($this->metadonneesArrete)) { |
if (empty($this->metadonneesArrete)) { |
435 |
$this->getArreteMetadata(); |
$this->getArreteMetadata(); |
436 |
} |
} |
437 |
return $this->metadonneesArrete["datenotification"]; |
return $this->metadonneesArrete["datenotification"]; |
438 |
} |
} |
439 |
/** |
/** |
|
* @return chaîne vide |
|
|
*/ |
|
|
function getChkCreationdroit() { |
|
|
return "true"; |
|
|
} |
|
|
/** |
|
|
* @return chaîne vide |
|
|
*/ |
|
|
function getChkPublication() { |
|
|
return "true"; |
|
|
} |
|
|
/** |
|
|
* @return chaîne vide |
|
|
*/ |
|
|
function getDatePublication() { |
|
|
return ""; |
|
|
} |
|
|
/** |
|
440 |
* @return boolean check si le document est passé au contrôle de légalité |
* @return boolean check si le document est passé au contrôle de légalité |
441 |
*/ |
*/ |
442 |
function getChkControleLegalite() { |
function getControleLegalite() { |
443 |
return 'true'; |
return 'true'; |
444 |
} |
} |
445 |
/** |
/** |
446 |
* @return date de signature de l'arrêté |
* @return date de signature de l'arrêté |
447 |
*/ |
*/ |
448 |
function getDateSignatureArrete() { |
function getDateSignature() { |
449 |
if (empty($this->metadonneesArrete)) { |
if (empty($this->metadonneesArrete)) { |
450 |
$this->getArreteMetadata(); |
$this->getArreteMetadata(); |
451 |
} |
} |
470 |
return $this->metadonneesArrete["qualitesignataire"]; |
return $this->metadonneesArrete["qualitesignataire"]; |
471 |
} |
} |
472 |
/** |
/** |
|
* @return string chaîne vide |
|
|
*/ |
|
|
function getChkDelegation() { |
|
|
return "true"; |
|
|
} |
|
|
/** |
|
473 |
* @return string numéro du terrain |
* @return string numéro du terrain |
474 |
*/ |
*/ |
475 |
function getAp_numRue() { |
function getAp_numRue() { |
505 |
} |
} |
506 |
return $this->metadonneesArrete["ap_ville"]; |
return $this->metadonneesArrete["ap_ville"]; |
507 |
} |
} |
508 |
|
/** |
509 |
|
* @return string activité |
510 |
|
*/ |
511 |
|
function getActivite() { |
512 |
|
return "Droit du sol"; |
513 |
|
} |
514 |
|
/** |
515 |
|
* @return string date du retour de controle légalité |
516 |
|
*/ |
517 |
|
function getDateControleLegalite() { |
518 |
|
if (empty($this->metadonneesArrete)) { |
519 |
|
$this->getArreteMetadata(); |
520 |
|
} |
521 |
|
return $this->metadonneesArrete["datecontrolelegalite"]; |
522 |
|
} |
523 |
|
|
524 |
// Fin des méthodes de récupération des métadonnées |
// Fin des méthodes de récupération des métadonnées |
525 |
// }}} |
// }}} |
526 |
|
|
598 |
$sql = "SELECT dossier.dossier as dossier, |
$sql = "SELECT dossier.dossier as dossier, |
599 |
dossier_autorisation.dossier_autorisation as dossier_autorisation, |
dossier_autorisation.dossier_autorisation as dossier_autorisation, |
600 |
to_char(dossier.date_demande, 'YYYY/MM') as date_demande_initiale, |
to_char(dossier.date_demande, 'YYYY/MM') as date_demande_initiale, |
|
dossier.version as version, |
|
601 |
dossier_instruction_type.code as dossier_instruction_type, |
dossier_instruction_type.code as dossier_instruction_type, |
602 |
etat_dossier_autorisation.libelle as statut, |
etat_dossier_autorisation.libelle as statut, |
603 |
dossier_autorisation_type.code as dossier_autorisation_type, |
dossier_autorisation_type.code as dossier_autorisation_type, |
627 |
|
|
628 |
//Si il y a un résultat |
//Si il y a un résultat |
629 |
if ($row !== null) { |
if ($row !== null) { |
630 |
|
|
631 |
|
//Génération du numéro de version |
632 |
|
$sql = "SELECT |
633 |
|
count(*) |
634 |
|
FROM |
635 |
|
".DB_PREFIXE."dossier |
636 |
|
LEFT JOIN |
637 |
|
".DB_PREFIXE."dossier_autorisation |
638 |
|
ON |
639 |
|
dossier_autorisation.dossier_autorisation = dossier.dossier_autorisation |
640 |
|
LEFT JOIN |
641 |
|
".DB_PREFIXE."dossier_instruction_type |
642 |
|
ON |
643 |
|
dossier_instruction_type.dossier_instruction_type = dossier.dossier_instruction_type |
644 |
|
WHERE |
645 |
|
dossier_autorisation.dossier_autorisation = '".$row->dossier_autorisation."' |
646 |
|
AND |
647 |
|
dossier_instruction_type.code = '".$row->dossier_instruction_type."'"; |
648 |
|
$row->version = $this->db->getOne($sql); |
649 |
|
$this->f->addToLog("getInfosForFoldername(): db->getOne(\"".$sql."\")", VERBOSE_MODE); |
650 |
|
if ( database::isError($row->version)){ |
651 |
|
$this->f->addToError("", $row->version, $row->version); |
652 |
|
return false; |
653 |
|
} |
654 |
|
|
655 |
|
//Formatage du numéro de version |
656 |
|
$row->version = str_pad($row->version, 2, "0", STR_PAD_LEFT); |
657 |
|
|
658 |
//Alors on créé l'objet dossier_instruction |
//Alors on créé l'objet dossier_instruction |
659 |
$this->specificMetadata = $row; |
$this->specificMetadata = $row; |
666 |
* les données sont stockés dans l'attribut $this->metadonneesArrete |
* les données sont stockés dans l'attribut $this->metadonneesArrete |
667 |
*/ |
*/ |
668 |
function getArreteMetadata() { |
function getArreteMetadata() { |
669 |
$sqlArrete = "SELECT signataire_arrete.nom as \"nomsignataire\", |
|
670 |
signataire_arrete.qualite as \"qualitesignataire\", |
//Récupération de la dernière instruction dont l'événement est de type 'arrete' |
671 |
instruction.date_evenement as \"datesignaturearrete\", |
$instructionArrete = $this->getLastInstructionArrete($this->valF["dossier"]); |
672 |
instruction.etat as \"decisionarrete\", |
|
673 |
instruction.date_retour_rar as \"datenotification\", |
if($instructionArrete !== '' and is_numeric($instructionArrete)) { |
674 |
instruction.date_retour_signature as \"datesignaturesrrete\", |
$sqlArrete = "SELECT signataire_arrete.nom as \"nomsignataire\", |
675 |
dossier.terrain_adresse_voie_numero as \"ap_numrue\", |
signataire_arrete.qualite as \"qualitesignataire\", |
676 |
dossier.complement as \"ap_nomdelavoie\", |
instruction.etat as \"decisionarrete\", |
677 |
dossier.terrain_adresse_code_postal as \"ap_codepostal\", |
instruction.date_retour_rar as \"datenotification\", |
678 |
dossier.terrain_adresse_localite as \"ap_ville\" |
instruction.date_retour_signature as \"datesignaturearrete\", |
679 |
FROM ".DB_PREFIXE."instruction |
instruction.date_retour_controle_legalite as \"datecontrolelegalite\", |
680 |
LEFT JOIN ".DB_PREFIXE."signataire_arrete ON |
dossier.terrain_adresse_voie_numero as \"ap_numrue\", |
681 |
instruction.signataire_arrete = signataire_arrete.signataire_arrete |
dossier.terrain_adresse_voie as \"ap_nomdelavoie\", |
682 |
LEFT JOIN ".DB_PREFIXE."dossier ON |
dossier.terrain_adresse_code_postal as \"ap_codepostal\", |
683 |
instruction.dossier = dossier.dossier |
dossier.terrain_adresse_localite as \"ap_ville\" |
684 |
LEFT JOIN ".DB_PREFIXE."donnees_techniques ON |
FROM ".DB_PREFIXE."instruction |
685 |
donnees_techniques.dossier_instruction = dossier.dossier |
LEFT JOIN ".DB_PREFIXE."signataire_arrete ON |
686 |
WHERE dossier.dossier = '".$this->valF["dossier"]."' |
instruction.signataire_arrete = signataire_arrete.signataire_arrete |
687 |
AND instruction.instruction = ".$this->getLastInstruction($this->valF["dossier"]); |
LEFT JOIN ".DB_PREFIXE."dossier ON |
688 |
$resArrete = $this->db->query($sqlArrete); |
instruction.dossier = dossier.dossier |
689 |
$this->f->addToLog("getArreteMetadata(): db->query(\"".$sqlArrete."\");", VERBOSE_MODE); |
LEFT JOIN ".DB_PREFIXE."donnees_techniques ON |
690 |
if ( database::isError($resArrete)){ |
donnees_techniques.dossier_instruction = dossier.dossier |
691 |
die(); |
WHERE dossier.dossier = '".$this->valF["dossier"]."' |
692 |
|
AND instruction.instruction = ".$instructionArrete; |
693 |
|
$resArrete = $this->db->query($sqlArrete); |
694 |
|
$this->f->addToLog("getArreteMetadata(): db->query(\"".$sqlArrete."\");", VERBOSE_MODE); |
695 |
|
if ( database::isError($resArrete)){ |
696 |
|
die(); |
697 |
|
} |
698 |
|
|
699 |
|
$this->metadonneesArrete = $resArrete->fetchRow(DB_FETCHMODE_ASSOC); |
700 |
} |
} |
|
|
|
|
$this->metadonneesArrete = $resArrete->fetchRow(DB_FETCHMODE_ASSOC); |
|
701 |
} |
} |
702 |
|
|
703 |
/** |
/** |
723 |
* @param string $idx Identifiant du dossier d'instruction |
* @param string $idx Identifiant du dossier d'instruction |
724 |
* @return string Le statut du dossier d'instruction |
* @return string Le statut du dossier d'instruction |
725 |
*/ |
*/ |
726 |
function getStatutDossier($idx){ |
function getStatutAutorisationDossier($idx){ |
727 |
|
|
728 |
$statut = ''; |
$statut = ''; |
729 |
|
|
740 |
dossier.etat = etat.etat |
dossier.etat = etat.etat |
741 |
WHERE dossier ='".$idx."'"; |
WHERE dossier ='".$idx."'"; |
742 |
$statut = $this->db->getOne($sql); |
$statut = $this->db->getOne($sql); |
743 |
$this->f->addToLog("getStatutDossier() : db->getOne(\"".$sql."\")", VERBOSE_MODE); |
$this->f->addToLog("getStatutAutorisationDossier() : db->getOne(\"".$sql."\")", VERBOSE_MODE); |
744 |
if ( database::isError($statut)){ |
if ( database::isError($statut)){ |
745 |
die(); |
die(); |
746 |
} |
} |
806 |
|
|
807 |
} |
} |
808 |
|
|
809 |
function getLastInstruction($dossier) { |
function getLastInstructionArrete($dossier) { |
810 |
|
|
811 |
// |
// On récupère la dernière instruction dont l'événement est de type "arrete" |
812 |
$sql = "SELECT max(instruction) FROM ".DB_PREFIXE."instruction |
$sql = "SELECT max(instruction) FROM ".DB_PREFIXE."instruction |
813 |
JOIN ".DB_PREFIXE."dossier ON instruction.dossier = dossier.dossier |
JOIN ".DB_PREFIXE."dossier ON instruction.dossier = dossier.dossier |
814 |
WHERE dossier.dossier='".$dossier."'"; |
LEFT JOIN ".DB_PREFIXE."evenement |
815 |
|
ON instruction.evenement = evenement.evenement |
816 |
|
WHERE dossier.dossier='".$dossier."' AND |
817 |
|
evenement.type = 'arrete'"; |
818 |
$lastInstruction = $this->db->getOne($sql); |
$lastInstruction = $this->db->getOne($sql); |
819 |
$this->f->addToLog("getStatutDossier() : db->getOne(\"".$sql."\")", VERBOSE_MODE); |
$this->f->addToLog("getStatutAutorisationDossier() : db->getOne(\"".$sql."\")", VERBOSE_MODE); |
820 |
if ( database::isError($lastInstruction)){ |
if ( database::isError($lastInstruction)){ |
821 |
die(); |
die(); |
822 |
} |
} |
823 |
|
|
824 |
return $lastInstruction; |
return $lastInstruction; |
825 |
} |
} |
826 |
|
|
827 |
|
/** |
828 |
|
* Méthode de verification du contenu |
829 |
|
*/ |
830 |
|
function verifier($val, &$db, $DEBUG) { |
831 |
|
parent::verifier($val, $db, $DEBUG); |
832 |
|
|
833 |
|
//Si le type est renseigné |
834 |
|
if ($val['document_numerise_type'] != "") { |
835 |
|
|
836 |
|
// Si c'est un arrêté |
837 |
|
if ($this->get_document_numerise_type_categorie_libelle($val["document_numerise_type"]) == 'Arrêté') { |
838 |
|
|
839 |
|
// On vérifie que le dossier a au moins une instruction dont l'événement est |
840 |
|
// de type 'arrete' |
841 |
|
$instructionArrete = $this->getLastInstructionArrete($this->valF["dossier"]); |
842 |
|
|
843 |
|
if ( $instructionArrete !== '' && is_numeric($instructionArrete)){ |
844 |
|
|
845 |
|
// Les champs date_retour_rar, date_retour_controle_legalite et date_retour_signature sont obligatoire pour un document arrêté |
846 |
|
if(!$this->getDateNotificationArrete() || $this->getDateNotificationArrete() == '') { |
847 |
|
$this->correct = false; |
848 |
|
$this->addToMessage( _('Le champ').' <span class="bold">'._("date_retour_rar").'</span> '._('est obligatoire pour un arrete.')); |
849 |
|
} |
850 |
|
|
851 |
|
if(!$this->getDateSignature() || $this->getDateSignature() == '') { |
852 |
|
$this->correct = false; |
853 |
|
$this->addToMessage( _('Le champ').' <span class="bold">'._("date_retour_signature").'</span> '._('est obligatoire pour un arrete.')); |
854 |
|
} |
855 |
|
|
856 |
|
if(!$this->getDateControleLegalite() || $this->getDateControleLegalite() == '') { |
857 |
|
$this->correct = false; |
858 |
|
$this->addToMessage( _('Le champ').' <span class="bold">'._("date_retour_controle_legalite").'</span> '._('est obligatoire pour un arrete.')); |
859 |
|
} |
860 |
|
} |
861 |
|
//Sinon on log une erreur |
862 |
|
else { |
863 |
|
|
864 |
|
$this->correct = false; |
865 |
|
$this->addToMessage( _('Une instruction ').' <span class="bold">'._('avec un evenement de type \'arrete\'').'</span> '._('est obligatoire pour un arrete.')); |
866 |
|
} |
867 |
|
} |
868 |
|
} |
869 |
|
} |
870 |
|
|
871 |
|
/** |
872 |
|
* Récupère l'état d'un dossier d'instruction |
873 |
|
* @param $idxDossier L'identifiant du dossier d'instruction |
874 |
|
* @return L'état du dossier d'instruction |
875 |
|
*/ |
876 |
|
function getEtatDossier($idxDossier){ |
877 |
|
|
878 |
|
$etat = ""; |
879 |
|
|
880 |
|
$sql = "SELECT etat.etat |
881 |
|
FROM ".DB_PREFIXE."etat |
882 |
|
LEFT JOIN |
883 |
|
".DB_PREFIXE."dossier |
884 |
|
ON |
885 |
|
dossier.etat = etat.etat |
886 |
|
WHERE dossier.dossier = '".$idxDossier."'"; |
887 |
|
$etat = $this->db->getOne($sql); |
888 |
|
$this->addToLog("getEtatDossier(): db->getOne(\"".$sql."\");", VERBOSE_MODE); |
889 |
|
// Si une erreur survient on die |
890 |
|
if (database::isError($etat, true)) { |
891 |
|
// Appel de la methode de recuperation des erreurs |
892 |
|
$this->erreur_db($etat->getDebugInfo(), $etat->getMessage(), 'document_numerise'); |
893 |
|
} |
894 |
|
|
895 |
|
return $etat; |
896 |
|
} |
897 |
|
|
898 |
}// fin classe |
}// fin classe |
899 |
?> |
?> |