32 |
var $archive_date_depot; // specific |
var $archive_date_depot; // specific |
33 |
var $retourformulaire; // specific |
var $retourformulaire; // specific |
34 |
var $idxformulaire; // specific |
var $idxformulaire; // specific |
35 |
|
var $valEvenement; |
36 |
|
// Tableau contenant une partie des métadonnées arrêtés |
37 |
|
var $metadonneesArrete; |
38 |
|
|
39 |
|
var $metadata = array( |
40 |
|
"om_fichier_instruction" => array( |
41 |
|
"dossier" => "getDossier", |
42 |
|
"dossier_version" => "getDossierVersion", |
43 |
|
"numDemandeAutor" => "getDossierAutorisation", |
44 |
|
"anneemoisDemandeAutori" => "getDateDemandeInitiale", |
45 |
|
"typeInstructionAutorisation" => "getDossierInstructionType", |
46 |
|
"statutAutorisation" => "getStatut", |
47 |
|
"typeAutorisation" => "getDossierAutorisationType", |
48 |
|
"dateEvenementDocument" => "getDateEvenement", |
49 |
|
"groupeInstruction" => 'getGroupeInstruction', |
50 |
|
"title" => 'getEvenementLibelle', |
51 |
|
), |
52 |
|
"document_arrete" => array( |
53 |
|
"numArrete" => "getNumArrete", |
54 |
|
"specialiteArrete" => "getSpecialiteArrete", |
55 |
|
"decisionArrete" => "getDecisionArrete", |
56 |
|
"chketatReglementaire" => "getChketatReglementaire", |
57 |
|
"chkNotification" => "getChkNotification", |
58 |
|
"dateNotification" => "getDateNotification", |
59 |
|
"chkCreationdroit" => "getChkCreationdroit", |
60 |
|
"chkPublication" => "getChkPublication", |
61 |
|
"datePublication" => "getDatePublication", |
62 |
|
"chkControleLegalite" => "getChkControleLegalite", |
63 |
|
"dateSignatureArrete" => "getDateSignatureArrete", |
64 |
|
"nomSignataire" => "getNomSignataire", |
65 |
|
"qualiteSignataire" => "getQualiteSignataire", |
66 |
|
"chkDelegation" => "getChkDelegation", |
67 |
|
"ap_numRue" => "getAp_numRue", |
68 |
|
"ap_nomDeLaVoie" => "getAp_nomDeLaVoie", |
69 |
|
"ap_codePostal" => "getAp_codePostal", |
70 |
|
"ap_ville" => "getAp_ville", |
71 |
|
), |
72 |
|
); |
73 |
|
|
74 |
|
|
75 |
function instruction($id, &$db, $debug) { |
function instruction($id, &$db, $debug) { |
76 |
$this->constructeur($id, $db, $debug); |
$this->constructeur($id, $db, $debug); |
100 |
&& $this->val[array_search("lu", $this->champs)]== "t") { |
&& $this->val[array_search("lu", $this->champs)]== "t") { |
101 |
unset($this->actions_sup["lu"]); |
unset($this->actions_sup["lu"]); |
102 |
} |
} |
103 |
|
|
104 |
|
//Si le document est déjà finalisé, on affiche uniquement le lien de |
105 |
|
//dé-finalisation |
106 |
|
$om_final_instruction = $this->getVal("om_final_instruction"); |
107 |
|
if ( isset($this->actions_sup["finalisation"]) && |
108 |
|
$om_final_instruction== "t" ){ |
109 |
|
|
110 |
|
//On cache les liens d'action |
111 |
|
$this->parameters["actions"]["modifier"] = NULL; |
112 |
|
$this->parameters["actions"]["supprimer"] = NULL; |
113 |
|
//On cache le lien de finalisation et on affiche le bon lien pour l'édition |
114 |
|
$this->actions_sup["finalisation"] = NULL; |
115 |
|
$this->actions_sup["pdfetat"]["lien"] = "../spg/file.php?id="; |
116 |
|
$this->actions_sup["pdfetat"]["id"] = |
117 |
|
"&obj=instruction&champ=om_fichier_instruction"; |
118 |
|
} |
119 |
|
//Si le document n'est pas finalisé, on affiche uniquement le lien de |
120 |
|
//finalisation |
121 |
|
if ( isset($this->actions_sup["definalisation"]) && |
122 |
|
$om_final_instruction!= "t" ){ |
123 |
|
|
124 |
|
//On cache le lien de finalisation et on affiche le bon lien pour l'édition |
125 |
|
$this->actions_sup["definalisation"] = NULL; |
126 |
|
$this->actions_sup["pdfetat"]["lien"] = "../app/pdf_instruction.php?idx="; |
127 |
|
$this->actions_sup["pdfetat"]["id"] = ""; |
128 |
|
} |
129 |
|
|
130 |
|
$idxformulaire = $this->getParameter("idxformulaire"); |
131 |
|
$retourformulaire = $this->getParameter("retourformulaire"); |
132 |
|
//Si le dossier d'instruction auquel est rattachée l'instruction est cloturé, |
133 |
|
//on affiche pas les liens du portlet |
134 |
|
if ( $idxformulaire != '' && |
135 |
|
( |
136 |
|
$retourformulaire == 'dossier' || |
137 |
|
$retourformulaire == 'dossier_instruction' || |
138 |
|
$retourformulaire == 'dossier_instruction_mes_encours' || |
139 |
|
$retourformulaire == 'dossier_instruction_tous_encours' || |
140 |
|
$retourformulaire == 'dossier_instruction_mes_clotures' || |
141 |
|
$retourformulaire == 'dossier_instruction_tous_clotures' |
142 |
|
)){ |
143 |
|
|
144 |
|
//On récuppère le statut du dossier d'instruction |
145 |
|
$statut = $this->getStatutDossier($idxformulaire); |
146 |
|
if ( $this->f->isUserInstructeur() && $statut == "cloture" ){ |
147 |
|
|
148 |
|
//On cache le lien de modification |
149 |
|
$this->parameters["actions"]["modifier"] = NULL; |
150 |
|
$this->actions_sup["finalisation"] = NULL; |
151 |
|
$this->actions_sup["definalisation"] = NULL; |
152 |
|
} |
153 |
|
} |
154 |
} |
} |
155 |
|
|
156 |
/** |
/** |
164 |
&& $this->f->om_utilisateur["division"] != $this->getDivisionFromDossier() |
&& $this->f->om_utilisateur["division"] != $this->getDivisionFromDossier() |
165 |
&& $this->getParameter("maj") != 3) { |
&& $this->getParameter("maj") != 3) { |
166 |
// |
// |
167 |
|
$this->addToLog("canAccess(): utilisateur instructeur sur un dossier d'une autre division", EXTRA_VERBOSE_MODE); |
168 |
|
return false; |
169 |
|
} |
170 |
|
|
171 |
|
$retourformulaire = $this->getParameter("retourformulaire"); |
172 |
|
// Si l'utilisateur est un instructeur et que le dossier est cloturé |
173 |
|
if ( $this->f->isUserInstructeur() && |
174 |
|
$this->getStatutDossier($this->getParameter("idxformulaire")) == "cloture" && |
175 |
|
( |
176 |
|
$retourformulaire == 'dossier' || |
177 |
|
$retourformulaire == 'dossier_instruction' || |
178 |
|
$retourformulaire == 'dossier_instruction_mes_encours' || |
179 |
|
$retourformulaire == 'dossier_instruction_tous_encours' || |
180 |
|
$retourformulaire == 'dossier_instruction_mes_clotures' || |
181 |
|
$retourformulaire == 'dossier_instruction_tous_clotures' |
182 |
|
) |
183 |
|
&& $this->getParameter("maj") != 3 && $this->getParameter("maj") != 0 ) { |
184 |
|
|
185 |
return false; |
return false; |
186 |
} |
} |
187 |
// |
// |
189 |
} |
} |
190 |
|
|
191 |
/** |
/** |
192 |
* Cette méthode permet de récupérer la division d'un dossier |
* Cette variable permet de stocker le résultat de la méthode |
193 |
|
* getDivisionFromDossier() afin de ne pas effectuer le recalcul à chacun de |
194 |
|
* ces appels. |
195 |
|
* @var string Code de la division du dossier en cours |
196 |
|
*/ |
197 |
|
var $_division_from_dossier = NULL; |
198 |
|
|
199 |
|
/** |
200 |
|
* Cette méthode permet de récupérer le code de division correspondant |
201 |
|
* au dossier sur lequel on se trouve. |
202 |
|
* |
203 |
|
* @return string Code de la division du dossier en cours |
204 |
*/ |
*/ |
205 |
function getDivisionFromDossier() { |
function getDivisionFromDossier() { |
206 |
|
|
207 |
|
// Cette méthode peut être appelée plusieurs fois lors d'une requête. |
208 |
|
// Pour éviter de refaire le traitement de recherche de la division |
209 |
|
// alors on vérifie si nous ne l'avons pas déjà calculé. |
210 |
|
if ($this->_division_from_dossier != NULL) { |
211 |
|
// Logger |
212 |
|
$this->addToLog("getDivisionFromDossier(): retour de la valeur déjà calculée - '".$this->_division_from_dossier."'", EXTRA_VERBOSE_MODE); |
213 |
|
// On retourne la valeur déjà calculée |
214 |
|
return $this->_division_from_dossier; |
215 |
|
} |
216 |
|
|
217 |
|
// Par défaut, on définit la valeur du dossier à NULL |
218 |
|
$dossier = NULL; |
219 |
|
// Test sur le mode et le contexte du formulaire |
220 |
|
if ($this->getParameter("maj") == 0 |
221 |
|
&& ($this->getParameter("retourformulaire") == "dossier" |
222 |
|
|| $this->getParameter("retourformulaire") == "dossier_instruction" |
223 |
|
|| $this->getParameter("retourformulaire") == "dossier_instruction_mes_encours" |
224 |
|
|| $this->getParameter("retourformulaire") == "dossier_instruction_tous_encours" |
225 |
|
|| $this->getParameter("retourformulaire") == "dossier_instruction_mes_clotures" |
226 |
|
|| $this->getParameter("retourformulaire") == "dossier_instruction_tous_clotures")) { |
227 |
|
// Si on se trouve en mode AJOUT (seul mode où l'enregistrement |
228 |
|
// n'existe pas en base de données) ET que nous nous trouvons |
229 |
|
// dans le contexte d'un dossier d'instruction alors on récupère |
230 |
|
// le numéro de dossier depuis le paramètre 'idxformulaire' |
231 |
|
$dossier = $this->getParameter("idxformulaire"); |
232 |
|
} else { |
233 |
|
// Sinon on récupère le numéro de dossier dans le champs dossier de |
234 |
|
// l'enregistrement (en base de données) |
235 |
|
$dossier = $this->getVal("dossier"); |
236 |
|
} |
237 |
|
|
238 |
|
// On appelle la méthode de la classe utils qui renvoi le code de la |
239 |
|
// division d'un dossier, on la stocke pour ne pas refaire le calcul au |
240 |
|
// prochain appel de cette méthode |
241 |
|
$this->_division_from_dossier = $this->f->getDivisionFromDossier($dossier); |
242 |
|
// Logger |
243 |
|
$this->addToLog("getDivisionFromDossier(): retour de la valeur nouvellement calculée - '".$this->_division_from_dossier."'", EXTRA_VERBOSE_MODE); |
244 |
|
// On retourne la valeur retournée |
245 |
|
return $this->_division_from_dossier; |
246 |
|
|
247 |
|
} |
248 |
|
|
249 |
|
/** |
250 |
|
* Cette méthode permet de récupérer le dossier d'autorisation d'un dossier |
251 |
|
*/ |
252 |
|
function getDossierAutorisationFromDossier($id) { |
253 |
// |
// |
254 |
if (!isset($this->val[array_search("dossier", $this->champs)])) { |
if (!isset($id)) { |
255 |
return NULL; |
return NULL; |
256 |
} |
} |
257 |
// |
// |
258 |
$sql = "select division from ".DB_PREFIXE."dossier "; |
$sql = "select dossier_autorisation from ".DB_PREFIXE."dossier "; |
259 |
$sql .= " where dossier='".$this->val[array_search("dossier", $this->champs)]."'"; |
$sql .= " where dossier='".$id."'"; |
260 |
// |
// |
261 |
$division = $this->db->getOne($sql); |
$dossier_autorisation = $this->db->getOne($sql); |
262 |
$this->addToLog("getDivisionFromDossier(): db->getone(\"".$sql."\")", VERBOSE_MODE); |
$this->addToLog("getDossierAutorisationFromDossier(): db->getone(\"".$sql."\")", VERBOSE_MODE); |
263 |
database::isError($division); |
database::isError($dossier_autorisation); |
264 |
// |
// |
265 |
return $division; |
return $dossier_autorisation; |
266 |
} |
} |
267 |
|
|
268 |
// }}} |
// }}} |
322 |
$form->setType('archive_date_chantier', 'hidden'); |
$form->setType('archive_date_chantier', 'hidden'); |
323 |
// |
// |
324 |
$form->setType('numero_arrete', 'hidden'); |
$form->setType('numero_arrete', 'hidden'); |
325 |
|
// |
326 |
|
$form->setType('code_barres', 'hidden'); |
327 |
|
|
328 |
// |
// |
329 |
|
$form->setType('archive_incompletude','hidden'); |
330 |
|
$form->setType('archive_evenement_suivant_tacite','hidden'); |
331 |
|
$form->setType('archive_evenement_suivant_tacite_incompletude','hidden'); |
332 |
|
$form->setType('archive_etat_pendant_incompletude','hidden'); |
333 |
|
$form->setType('archive_date_limite_incompletude','hidden'); |
334 |
|
$form->setType('archive_delai_incompletude','hidden'); |
335 |
if ($maj < 2) { //ajouter et modifier |
if ($maj < 2) { //ajouter et modifier |
336 |
$form->setType('destinataire', 'hidden'); |
$form->setType('destinataire', 'hidden'); |
337 |
$form->setType('lettretype', 'hiddenstatic'); |
$form->setType('lettretype', 'hiddenstatic'); |
349 |
$form->setType('date_retour_rar','datedisabled'); |
$form->setType('date_retour_rar','datedisabled'); |
350 |
$form->setType('date_envoi_controle_legalite','datedisabled'); |
$form->setType('date_envoi_controle_legalite','datedisabled'); |
351 |
$form->setType('date_retour_controle_legalite','datedisabled'); |
$form->setType('date_retour_controle_legalite','datedisabled'); |
352 |
|
$form->setType('date_finalisation_courrier','datedisabled'); |
353 |
if($maj==0){ // add |
if($maj==0){ // add |
354 |
$form->setType('instruction', 'hiddenstatic'); |
$form->setType('instruction', 'hiddenstatic'); |
355 |
$form->setType('evenement', 'select'); |
$form->setType('evenement', 'select'); |
374 |
$form->setType('bible', 'hidden'); |
$form->setType('bible', 'hidden'); |
375 |
$form->setType('bible2', 'hidden'); |
$form->setType('bible2', 'hidden'); |
376 |
} |
} |
377 |
|
|
378 |
|
//Cache les champs pour la finalisation |
379 |
|
$form->setType('om_fichier_instruction', 'hidden'); |
380 |
|
$form->setType('om_final_instruction', 'hidden'); |
381 |
|
// Cache le document arrêté |
382 |
|
$form->setType('document_arrete', 'hidden'); |
383 |
} |
} |
384 |
|
|
385 |
function setSelect(&$form, $maj,&$db,$debug) { |
function setSelect(&$form, $maj,&$db,$debug) { |
493 |
function cleSecondaire($id, &$db, $val, $DEBUG) { |
function cleSecondaire($id, &$db, $val, $DEBUG) { |
494 |
// |
// |
495 |
parent::cleSecondaire($id, $db, $val, $DEBUG); |
parent::cleSecondaire($id, $db, $val, $DEBUG); |
496 |
|
|
497 |
/** |
// Aucune clé secondaire n'a été trouvée, l'instruction peut être supprimée |
498 |
* Vérification que l'élément supprimé est le dernier pour pouvoir |
if ( $this->correct !== false ){ |
499 |
* remodifier les données de manière itérative. |
|
500 |
*/ |
/** |
501 |
// Initialisation |
* Vérification que l'élément supprimé est le dernier pour pouvoir |
502 |
$dernierevenement = ""; |
* remodifier les données de manière itérative. |
503 |
// Récupération du dernier élément de la table d'instruction qui |
*/ |
504 |
// concerne le dossier en cours |
// Initialisation |
505 |
$sql = "SELECT max(instruction) |
$dernierevenement = ""; |
506 |
FROM ".DB_PREFIXE."instruction |
// Récupération du dernier élément de la table d'instruction qui |
507 |
WHERE dossier ='".$this->idxformulaire."'"; |
// concerne le dossier en cours |
508 |
$dernierevenement = $db->getOne($sql); |
$sql = "SELECT max(instruction) |
509 |
$this->addToLog("setSelect(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
FROM ".DB_PREFIXE."instruction |
510 |
if (database::isError($dernierevenement)) { |
WHERE dossier ='".$this->idxformulaire."'"; |
511 |
die($dernierevenement->getMessage()); |
$dernierevenement = $db->getOne($sql); |
512 |
} |
$this->addToLog("setSelect(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
513 |
// Si on se trouve effectivement sur le dernier evenement d'instruction |
if (database::isError($dernierevenement)) { |
514 |
if ($dernierevenement == $id) { |
die($dernierevenement->getMessage()); |
515 |
// Alors on valide la suppression |
} |
516 |
$this->correct = true; |
// Si on se trouve effectivement sur le dernier evenement d'instruction |
517 |
$this->addToMessage(_('Destruction_chronologique')); |
if ($dernierevenement == $id) { |
518 |
} else { |
// Alors on valide la suppression |
519 |
// Alors on annule la suppression |
$this->correct = true; |
520 |
$this->correct = false; |
$this->addToMessage(_('Destruction_chronologique')); |
521 |
$this->addToMessage(_("Seul le dernier evenement d'instruction peut etre supprime.")); |
} else { |
522 |
|
// Alors on annule la suppression |
523 |
|
$this->correct = false; |
524 |
|
$this->addToMessage(_("Seul le dernier evenement d'instruction peut etre supprime.")); |
525 |
|
} |
526 |
} |
} |
527 |
} |
} |
528 |
|
|
548 |
WHERE defaut IS TRUE"; |
WHERE defaut IS TRUE"; |
549 |
|
|
550 |
// Exécution de la requête |
// Exécution de la requête |
|
$this->f->addToLog("deleteAllLienDossierInstructionTypeEvenementEvenement(): db->query(\"".$sql."\");", VERBOSE_MODE); |
|
551 |
$res = $this->f->db->query($sql); |
$res = $this->f->db->query($sql); |
552 |
$this->f->isDatabaseError(); |
$this->f->addToLog("deleteAllLienDossierInstructionTypeEvenementEvenement(): db->query(\"".$sql."\");", VERBOSE_MODE); |
553 |
|
if ( database::isError($res)){ |
554 |
|
die(); |
555 |
|
} |
556 |
|
|
557 |
$row = $res->fetchrow(DB_FETCHMODE_ASSOC); |
$row = $res->fetchrow(DB_FETCHMODE_ASSOC); |
558 |
|
|
743 |
if ($row['date_conformite']!='') { |
if ($row['date_conformite']!='') { |
744 |
$this->valF['archive_date_conformite']= $row['date_conformite']; |
$this->valF['archive_date_conformite']= $row['date_conformite']; |
745 |
} |
} |
746 |
|
if ($row['incompletude']!='') { |
747 |
|
$this->valF['archive_incompletude']= $row['incompletude']; |
748 |
|
} |
749 |
|
if ($row['evenement_suivant_tacite']!='') { |
750 |
|
$this->valF['archive_evenement_suivant_tacite']= $row['evenement_suivant_tacite']; |
751 |
|
} |
752 |
|
if ($row['evenement_suivant_tacite_incompletude']!='') { |
753 |
|
$this->valF['archive_evenement_suivant_tacite_incompletude']= $row['evenement_suivant_tacite_incompletude']; |
754 |
|
} |
755 |
|
if ($row['etat_pendant_incompletude']!='') { |
756 |
|
$this->valF['archive_etat_pendant_incompletude']= $row['etat_pendant_incompletude']; |
757 |
|
} |
758 |
|
if ($row['date_limite_incompletude']!='') { |
759 |
|
$this->valF['archive_date_limite_incompletude']= $row['date_limite_incompletude']; |
760 |
|
} |
761 |
|
if ($row['delai_incompletude']!='') { |
762 |
|
$this->valF['archive_delai_incompletude']= $row['delai_incompletude']; |
763 |
|
} |
764 |
} |
} |
765 |
|
|
766 |
|
// Identifiant du type de courrier |
767 |
|
$idTypeCourrier = '11'; |
768 |
|
$idCourrier = str_pad($this->valF["instruction"], 10, "0", STR_PAD_LEFT); |
769 |
|
// Code barres |
770 |
|
$this->valF["code_barres"] = $idTypeCourrier . $idCourrier; |
771 |
} |
} |
772 |
|
|
773 |
// Test si une restriction est valide |
// Test si une restriction est valide |
891 |
* Mise à jour des valeurs du dossier en fonction des valeurs calculées |
* Mise à jour des valeurs du dossier en fonction des valeurs calculées |
892 |
* par l'action |
* par l'action |
893 |
*/ |
*/ |
894 |
|
$this->getValEvenement(); |
895 |
// Initialisation |
// Initialisation |
896 |
$valF = ""; |
$valF = ""; |
897 |
|
// état de complétude actuel du dossier |
898 |
|
$incompletude = $this->dossierIncomplet(); |
899 |
|
|
900 |
|
if($incompletude === FALSE) { |
901 |
|
// Si l'événement d'instruction est de type incompletude |
902 |
|
if($this->valEvenement['type'] == "incompletude") { |
903 |
|
// On marque le dossier en incomplétude pour application des actions |
904 |
|
$incompletude = TRUE; |
905 |
|
// Set du flag incomplétude de la table dossier |
906 |
|
$valF['incompletude'] = TRUE; |
907 |
|
// Enregistrement de l'état dans la variable provisoire |
908 |
|
$valF['etat_pendant_incompletude'] = $this->valF['archive_etat']; |
909 |
|
} |
910 |
|
} else { |
911 |
|
// Si l'evenement d'instruction est de type retour ou contient une |
912 |
|
// decision, on sort d'incomplétude |
913 |
|
if($this->valEvenement['type'] == "retour" OR |
914 |
|
$this->valEvenement['avis_decision'] != NULL) { |
915 |
|
// On enlève la marque d'incomplétude pour application des actions |
916 |
|
$incompletude = FALSE; |
917 |
|
// On enlève le flag d'incomplétude sur l'enregistrement de la table dossier |
918 |
|
$valF['incompletude'] = FALSE; |
919 |
|
// Restauration de l'état depuis l'état provisoire |
920 |
|
$valF['etat'] = $this->valF['archive_etat_pendant_incompletude']; |
921 |
|
// On vide la variable provisoire ainsi que le délai de complétude |
922 |
|
// et la date limite de complétude |
923 |
|
$valF['etat_pendant_incompletude'] = NULL; |
924 |
|
$valF['delai_incompletude'] = NULL; |
925 |
|
$valF['date_limite_incompletude'] = NULL; |
926 |
|
} |
927 |
|
} |
928 |
// Récupération des paramètres de l'action |
// Récupération des paramètres de l'action |
929 |
$sql = "SELECT * FROM ".DB_PREFIXE."action |
$sql = "SELECT * FROM ".DB_PREFIXE."action |
930 |
WHERE action='".$this->valF['action']."'"; |
WHERE action='".$this->valF['action']."'"; |
934 |
die($res->getMessage()); |
die($res->getMessage()); |
935 |
} |
} |
936 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
937 |
|
|
938 |
// pour chacune des regles, on applique la regle |
// pour chacune des regles, on applique la regle |
|
if($row['regle_etat']!=''){ |
|
|
$valF['etat'] = $this->regle($row['regle_etat']); |
|
|
} |
|
939 |
if($row['regle_delai']!=''){ |
if($row['regle_delai']!=''){ |
940 |
$valF['delai'] = $this->regle($row['regle_delai']); |
$valF['delai'] = $this->regle($row['regle_delai']); |
941 |
} |
} |
975 |
if($row['regle_date_conformite']!=''){ |
if($row['regle_date_conformite']!=''){ |
976 |
$valF['date_conformite']= $this->regle($row['regle_date_conformite']); |
$valF['date_conformite']= $this->regle($row['regle_date_conformite']); |
977 |
} |
} |
978 |
// Appel des méthode stockées dans le champ methode_trigger |
if($row['regle_date_limite_incompletude']!=''){ |
979 |
if ($row['methode_trigger'] != "") { |
$valF['date_limite_incompletude']= $this->regle($row['regle_date_limite_incompletude']); |
980 |
foreach (explode(";", $row['methode_trigger']) as $methode) { |
} |
981 |
if (method_exists($this, $methode)) { |
if($row['regle_delai_incompletude']!=''){ |
982 |
$this->$methode(); |
$valF['delai_incompletude']= $this->regle($row['regle_delai_incompletude']); |
983 |
} |
} |
984 |
|
if($row['regle_etat']!=''){ |
985 |
|
// Si on est dans le cas général ou qu'on est en incomplétude et |
986 |
|
// qu'on a un événement de type incomplétude alors : on stocke |
987 |
|
// l'état dans la variable courante |
988 |
|
if ($incompletude == FALSE OR $this->valEvenement['type'] == "incompletude") { |
989 |
|
$valF['etat'] = $this->regle($row['regle_etat']); |
990 |
|
} else { |
991 |
|
$valF['etat_pendant_incompletude'] = $this->regle($row['regle_etat']); |
992 |
|
} |
993 |
|
} |
994 |
|
|
995 |
|
if($this->valEvenement['evenement_suivant_tacite'] != '') { |
996 |
|
// Si on est pas en incomplétude on stocke l'événement tacite |
997 |
|
//de l'événement dans la variable courante |
998 |
|
if ($incompletude == FALSE) { |
999 |
|
$valF['evenement_suivant_tacite'] = $this->valEvenement['evenement_suivant_tacite']; |
1000 |
|
} else { |
1001 |
|
$valF['evenement_suivant_tacite_incompletude'] = $this->valEvenement['evenement_suivant_tacite']; |
1002 |
} |
} |
1003 |
} |
} |
1004 |
} |
} |
1061 |
} |
} |
1062 |
} |
} |
1063 |
} // fin de if ($this->f->getParameter('option_erp') != "") |
} // fin de if ($this->f->getParameter('option_erp') != "") |
|
} |
|
1064 |
|
|
1065 |
|
// Mise à jour des données du dossier d'autorisation |
1066 |
|
require_once "../obj/dossier_autorisation.class.php"; |
1067 |
|
$da = new dossier_autorisation($this->getDossierAutorisationFromDossier($this->valF['dossier']), $this->db, DEBUG); |
1068 |
|
$da->majDossierAutorisation(); |
1069 |
|
} |
1070 |
|
function triggermodifier($id,&$db,$val,$DEBUG) { |
1071 |
|
// Ajout de l'arrêté dans la GED |
1072 |
|
if ($this->valF['numero_arrete'] != $this->getVal('numero_arrete') |
1073 |
|
AND $this->valF["om_fichier_instruction"] != "") { |
1074 |
|
$file = $this->f->storage->get($this->valF["om_fichier_instruction"]); |
1075 |
|
if(isset($file) and $file != null) { |
1076 |
|
// Récupération des métadonnées calculées après validation |
1077 |
|
$spe_metadata = $this->getMetadata("document_arrete"); |
1078 |
|
$pdf_output = $file["file_content"]; |
1079 |
|
//Métadonnées du document |
1080 |
|
$metadata = array( |
1081 |
|
'filename' => 'instruction_'.$this->valF[$this->clePrimaire].'.pdf', |
1082 |
|
'mimetype' => 'application/pdf', |
1083 |
|
'size' => strlen($pdf_output) |
1084 |
|
); |
1085 |
|
$metadata = array_merge($metadata, $spe_metadata); |
1086 |
|
|
1087 |
|
//Si le document a déjà été finalisé |
1088 |
|
//on met à jour le document mais pas son uid |
1089 |
|
if ( $this->getVal("document_arrete") != '' ){ |
1090 |
|
$uid = $this->f->storage->update( |
1091 |
|
$this->getVal("document_arrete"), $pdf_output, $metadata); |
1092 |
|
} |
1093 |
|
//Sinon, on joute le document et on récupère son uid |
1094 |
|
else { |
1095 |
|
//Stockage du PDF |
1096 |
|
$uid = $this->f->storage->create($pdf_output, $metadata); |
1097 |
|
} |
1098 |
|
if($uid != OP_FAILURE) { |
1099 |
|
$this->valF["document_arrete"] = $uid; |
1100 |
|
} |
1101 |
|
} |
1102 |
|
|
1103 |
|
} |
1104 |
|
} |
1105 |
function triggermodifierapres($id,&$db,$val,$DEBUG) { |
function triggermodifierapres($id,&$db,$val,$DEBUG) { |
1106 |
/** |
/** |
1107 |
* L'objectif ici est d'effectuer les recalculs de date dans le dossier |
* L'objectif ici est d'effectuer les recalculs de date dans le dossier |
1128 |
die($res->getMessage()); |
die($res->getMessage()); |
1129 |
} |
} |
1130 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
1131 |
// Ajout d'un événement d'instruction |
// Si la date de retour signature est éditée on vérifie si il existe un événement automatique |
1132 |
|
if ($this->getVal('date_retour_signature') == "" AND |
1133 |
if ($this->getVal('date_retour_signature') == "" AND $this->valF['date_retour_signature'] != "") { |
$this->valF['date_retour_signature'] != "" AND |
1134 |
|
$row['evenement_retour_signature'] != "") { |
1135 |
$new_instruction = new instruction("]", $db, $DEBUG); |
$new_instruction = new instruction("]", $db, $DEBUG); |
1136 |
|
// Création d'un tableau avec la liste des champs de l'instruction |
1137 |
foreach($new_instruction->champs as $champ) { |
foreach($new_instruction->champs as $champ) { |
1138 |
$valNewInstr[$champ] = ""; |
$valNewInstr[$champ] = ""; |
1139 |
} |
} |
1140 |
|
// Définition des valeurs de la nouvelle instruction |
1141 |
$valNewInstr["evenement"] = $row['evenement_retour_signature']; |
$valNewInstr["evenement"] = $row['evenement_retour_signature']; |
1142 |
$valNewInstr["destinataire"] = $this->valF['destinataire']; |
$valNewInstr["destinataire"] = $this->valF['destinataire']; |
1143 |
$valNewInstr["dossier"] = $this->valF['dossier']; |
$valNewInstr["dossier"] = $this->valF['dossier']; |
1144 |
$valNewInstr["date_evenement"] = date("d/m/Y"); |
$valNewInstr["date_evenement"] = date("d/m/Y"); |
1145 |
$new_instruction->ajouter($valNewInstr,$db, $DEBUG); |
$new_instruction->ajouter($valNewInstr,$db, $DEBUG); |
1146 |
} |
} |
1147 |
|
// Si la date de retour AR est éditée on vérifie si il existe un événement automatique |
1148 |
|
if ($this->getVal('date_retour_rar') == "" AND |
1149 |
|
$this->valF['date_retour_rar'] != "" AND |
1150 |
|
$row['evenement_retour_ar'] != "" ) { |
1151 |
|
$new_instruction = new instruction("]", $db, $DEBUG); |
1152 |
|
// Création d'un tableau avec la liste des champs de l'instruction |
1153 |
|
foreach($new_instruction->champs as $champ) { |
1154 |
|
$valNewInstr[$champ] = ""; |
1155 |
|
} |
1156 |
|
// Définition des valeurs de la nouvelle instruction |
1157 |
|
$valNewInstr["evenement"] = $row['evenement_retour_ar']; |
1158 |
|
$valNewInstr["destinataire"] = $this->valF['destinataire']; |
1159 |
|
$valNewInstr["dossier"] = $this->valF['dossier']; |
1160 |
|
$valNewInstr["date_evenement"] = date("d/m/Y"); |
1161 |
|
$new_instruction->ajouter($valNewInstr,$db, $DEBUG); |
1162 |
|
} |
1163 |
} |
} |
1164 |
|
|
1165 |
// Récupération des paramètres de l'action |
// Récupération des paramètres de l'action |
1266 |
WHERE instruction.instruction = ".$this->valF['instruction']; |
WHERE instruction.instruction = ".$this->valF['instruction']; |
1267 |
$resArrete = $this->db->query($sqlArrete); |
$resArrete = $this->db->query($sqlArrete); |
1268 |
$this->f->addToLog("triggerModifierApres(): db->query(\"".$sqlArrete."\");", VERBOSE_MODE); |
$this->f->addToLog("triggerModifierApres(): db->query(\"".$sqlArrete."\");", VERBOSE_MODE); |
1269 |
$this->f->isDatabaseError(); |
if ( database::isError($resArrete)){ |
1270 |
|
die(); |
1271 |
|
} |
1272 |
|
|
1273 |
$rowArrete = $resArrete->fetchRow(DB_FETCHMODE_ASSOC); |
$rowArrete = $resArrete->fetchRow(DB_FETCHMODE_ASSOC); |
1274 |
$msgenque->setArreteInfo($rowArrete); |
$msgenque->setArreteInfo($rowArrete); |
1275 |
$msgenque->enqueueMessage($msgenque::$ARRETE_ENVOI); |
$msgenque->enqueueMessage($msgenque::$ARRETE_ENVOI); |
1276 |
} |
} |
1277 |
} |
} |
1278 |
|
|
1279 |
|
// Mise à jour des données du dossier d'autorisation |
1280 |
|
require_once "../obj/dossier_autorisation.class.php"; |
1281 |
|
$da = new dossier_autorisation($this->getDossierAutorisationFromDossier($this->valF['dossier']), $this->db, DEBUG); |
1282 |
|
$da->majDossierAutorisation(); |
1283 |
} |
} |
1284 |
|
|
1285 |
|
/** |
1286 |
|
* Méthode de récupération des métadonnées arrêtés dans la base de données, |
1287 |
|
* les données sont stockés dans l'attribut $this->metadonneesArrete |
1288 |
|
*/ |
1289 |
|
function getArreteMetadata() { |
1290 |
|
$sqlArrete = "SELECT signataire_arrete.nom as \"nomsignataire\", |
1291 |
|
signataire_arrete.qualite as \"qualitesignataire\", |
1292 |
|
instruction.date_evenement as \"datesignaturearrete\", |
1293 |
|
instruction.etat as \"decisionarrete\", |
1294 |
|
dossier.terrain_adresse_voie_numero as \"ap_numrue\", |
1295 |
|
dossier.complement as \"ap_nomdelavoie\", |
1296 |
|
dossier.terrain_adresse_code_postal as \"ap_codepostal\", |
1297 |
|
dossier.terrain_adresse_localite as \"ap_ville\" |
1298 |
|
FROM ".DB_PREFIXE."instruction |
1299 |
|
LEFT JOIN ".DB_PREFIXE."signataire_arrete ON |
1300 |
|
instruction.signataire_arrete = signataire_arrete.signataire_arrete |
1301 |
|
LEFT JOIN ".DB_PREFIXE."dossier ON |
1302 |
|
instruction.dossier = dossier.dossier |
1303 |
|
LEFT JOIN ".DB_PREFIXE."donnees_techniques ON |
1304 |
|
donnees_techniques.dossier_instruction = dossier.dossier |
1305 |
|
WHERE instruction.instruction = ".$this->valF['instruction']; |
1306 |
|
$resArrete = $this->db->query($sqlArrete); |
1307 |
|
$this->f->addToLog("triggerModifierApres(): db->query(\"".$sqlArrete."\");", VERBOSE_MODE); |
1308 |
|
if ( database::isError($resArrete)){ |
1309 |
|
die(); |
1310 |
|
} |
1311 |
|
|
1312 |
|
$this->metadonneesArrete = $resArrete->fetchRow(DB_FETCHMODE_ASSOC); |
1313 |
|
} |
1314 |
|
|
1315 |
|
// {{{ |
1316 |
|
// Méthodes de récupération des métadonnées arrêté |
1317 |
|
/** |
1318 |
|
* @return string Retourne le numéro d'arrêté |
1319 |
|
*/ |
1320 |
|
function getNumArrete() { |
1321 |
|
return $this->valF['numero_arrete']; |
1322 |
|
} |
1323 |
|
/** |
1324 |
|
* @return string ads |
1325 |
|
*/ |
1326 |
|
function getSpecialiteArrete() { |
1327 |
|
return "ADS"; |
1328 |
|
} |
1329 |
|
/** |
1330 |
|
* @return string decision |
1331 |
|
*/ |
1332 |
|
function getDecisionArrete() { |
1333 |
|
if (empty($this->metadonneesArrete)) { |
1334 |
|
$this->getArreteMetadata(); |
1335 |
|
} |
1336 |
|
return $this->metadonneesArrete["decisionarrete"]; |
1337 |
|
} |
1338 |
|
/** |
1339 |
|
* @return chaîne vide |
1340 |
|
*/ |
1341 |
|
function getChketatReglementaire() { |
1342 |
|
return ""; |
1343 |
|
} |
1344 |
|
/** |
1345 |
|
* @return boolean de notification au pétitionnaire |
1346 |
|
*/ |
1347 |
|
function getChkNotification() { |
1348 |
|
if( isset($this->valF["date_retour_rar"]) ) { |
1349 |
|
return true; |
1350 |
|
} else { |
1351 |
|
return false; |
1352 |
|
} |
1353 |
|
} |
1354 |
|
/** |
1355 |
|
* @return date de notification au pétitionnaire |
1356 |
|
*/ |
1357 |
|
function getDateNotification() { |
1358 |
|
return date("d/m/Y", strtotime($this->valF["date_retour_rar"])); |
1359 |
|
} |
1360 |
|
/** |
1361 |
|
* @return chaîne vide |
1362 |
|
*/ |
1363 |
|
function getChkCreationdroit() { |
1364 |
|
return ""; |
1365 |
|
} |
1366 |
|
/** |
1367 |
|
* @return chaîne vide |
1368 |
|
*/ |
1369 |
|
function getChkPublication() { |
1370 |
|
return ""; |
1371 |
|
} |
1372 |
|
/** |
1373 |
|
* @return chaîne vide |
1374 |
|
*/ |
1375 |
|
function getDatePublication() { |
1376 |
|
return ""; |
1377 |
|
} |
1378 |
|
/** |
1379 |
|
* @return boolean check si le document est passé au contrôle de légalité |
1380 |
|
*/ |
1381 |
|
function getChkControleLegalite() { |
1382 |
|
if( isset($this->valF["date_retour_controle_legalite"]) ) { |
1383 |
|
return true; |
1384 |
|
} else { |
1385 |
|
return false; |
1386 |
|
} |
1387 |
|
} |
1388 |
|
/** |
1389 |
|
* @return date de signature de l'arrêté |
1390 |
|
*/ |
1391 |
|
function getDateSignatureArrete() { |
1392 |
|
return date("d/m/Y", strtotime($this->valF['date_retour_signature'])); |
1393 |
|
} |
1394 |
|
/** |
1395 |
|
* @return string nom du signataire |
1396 |
|
*/ |
1397 |
|
function getNomSignataire() { |
1398 |
|
if (empty($this->metadonneesArrete)) { |
1399 |
|
$this->getArreteMetadata(); |
1400 |
|
} |
1401 |
|
return $this->metadonneesArrete["nomsignataire"]; |
1402 |
|
} |
1403 |
|
/** |
1404 |
|
* @return string qualité du signataire |
1405 |
|
*/ |
1406 |
|
function getQualiteSignataire() { |
1407 |
|
if (empty($this->metadonneesArrete)) { |
1408 |
|
$this->getArreteMetadata(); |
1409 |
|
} |
1410 |
|
return $this->metadonneesArrete["qualitesignataire"]; |
1411 |
|
} |
1412 |
|
/** |
1413 |
|
* @return string chaîne vide |
1414 |
|
*/ |
1415 |
|
function getChkDelegation() { |
1416 |
|
return ""; |
1417 |
|
} |
1418 |
|
/** |
1419 |
|
* @return string numéro du terrain |
1420 |
|
*/ |
1421 |
|
function getAp_numRue() { |
1422 |
|
if (empty($this->metadonneesArrete)) { |
1423 |
|
$this->getArreteMetadata(); |
1424 |
|
} |
1425 |
|
return $this->metadonneesArrete["ap_numrue"]; |
1426 |
|
} |
1427 |
|
/** |
1428 |
|
* @return string nom de la rue du terrain |
1429 |
|
*/ |
1430 |
|
function getAp_nomDeLaVoie() { |
1431 |
|
if (empty($this->metadonneesArrete)) { |
1432 |
|
$this->getArreteMetadata(); |
1433 |
|
} |
1434 |
|
return $this->metadonneesArrete["ap_nomdelavoie"]; |
1435 |
|
} |
1436 |
|
/** |
1437 |
|
* @return string code postal du terrain |
1438 |
|
*/ |
1439 |
|
function getAp_codePostal() { |
1440 |
|
if (empty($this->metadonneesArrete)) { |
1441 |
|
$this->getArreteMetadata(); |
1442 |
|
} |
1443 |
|
return $this->metadonneesArrete["ap_codepostal"]; |
1444 |
|
} |
1445 |
|
/** |
1446 |
|
* @return string ville du terrain |
1447 |
|
*/ |
1448 |
|
function getAp_ville() { |
1449 |
|
if (empty($this->metadonneesArrete)) { |
1450 |
|
$this->getArreteMetadata(); |
1451 |
|
} |
1452 |
|
return $this->metadonneesArrete["ap_ville"]; |
1453 |
|
} |
1454 |
|
|
1455 |
|
// Fin des méthodes de récupération des métadonnées |
1456 |
|
// }}} |
1457 |
|
|
1458 |
function triggersupprimer($id,&$db,$val,$DEBUG) { |
function triggersupprimer($id,&$db,$val,$DEBUG) { |
1459 |
/** |
/** |
1460 |
* L'objectif ici est de repositionner les valeurs récupérées en |
* L'objectif ici est de repositionner les valeurs récupérées en |
1461 |
* archive dans le dossier d'instruction avant de supprimer l'événement |
* archive dans le dossier d'instruction avant de supprimer l'événement |
1462 |
* d'instruction |
* d'instruction |
1463 |
*/ |
*/ |
1464 |
// archive en instruction (si suppression) [archive if delete instruction] |
// Mise à jour des 4 valeurs modifiées par l'action |
1465 |
$valF['delai']=$val['archive_delai']; |
$valF['delai'] = $val['archive_delai']; |
1466 |
$valF['accord_tacite']=$val['archive_accord_tacite']; |
$valF['accord_tacite'] = $val['archive_accord_tacite']; |
1467 |
$valF['etat']=$val['archive_etat']; |
$valF['etat'] = $val['archive_etat']; |
1468 |
if($val['archive_avis']=='') |
if ($val['archive_avis'] != '') { |
1469 |
$valF['avis_decision']= null; |
$valF['avis_decision'] = $val['archive_avis']; |
1470 |
else |
} else { |
1471 |
$valF['avis_decision']=$val['archive_avis']; |
$valF['avis_decision'] = NULL; |
1472 |
if($val['archive_date_complet']!='') |
} |
1473 |
$valF['date_complet']=$val['archive_date_complet']; |
// Mise à jour des 10 dates avec la valeur présente dans le formulaire |
1474 |
if($val['archive_date_dernier_depot']!='') |
// de suppression. Si la valeur de la date est vide alors on fixe |
1475 |
$valF['date_dernier_depot']=$val['archive_date_dernier_depot']; |
// à la valeur NULL |
1476 |
if($val['archive_date_rejet']!='') |
// |
1477 |
$valF['date_rejet']= $val['archive_date_rejet']; |
if ($val['archive_date_complet'] != '') { |
1478 |
if($val['archive_date_limite']!='') |
$valF['date_complet'] = $val['archive_date_complet']; |
1479 |
$valF['date_limite']= $val['archive_date_limite']; |
} else { |
1480 |
if($val['archive_date_notification_delai']!='') |
$valF['date_complet'] = NULL; |
1481 |
$valF['date_notification_delai']= $val['archive_date_notification_delai']; |
} |
1482 |
if($val['archive_date_decision']!='') |
if ($val['archive_date_dernier_depot'] != '') { |
1483 |
$valF['date_decision']= $val['archive_date_decision']; |
$valF['date_dernier_depot'] = $val['archive_date_dernier_depot']; |
1484 |
if($val['archive_date_validite']!='') |
} else { |
1485 |
$valF['date_validite']= $val['archive_date_validite']; |
$valF['date_dernier_depot'] = NULL; |
1486 |
if($val['archive_date_achevement']!='') |
} |
1487 |
$valF['date_achevement']= $val['archive_date_achevement']; |
if ($val['archive_date_rejet'] != '') { |
1488 |
if($val['archive_date_chantier']!='') |
$valF['date_rejet'] = $val['archive_date_rejet']; |
1489 |
$valF['date_chantier']= $val['archive_date_chantier']; |
} else { |
1490 |
if($val['archive_date_conformite']!='') |
$valF['date_rejet'] = NULL; |
1491 |
$valF['date_conformite']= $val['archive_date_conformite']; |
} |
1492 |
|
if ($val['archive_date_limite'] != '') { |
1493 |
|
$valF['date_limite'] = $val['archive_date_limite']; |
1494 |
|
} else { |
1495 |
|
$valF['date_limite'] = NULL; |
1496 |
|
} |
1497 |
|
if ($val['archive_date_notification_delai'] != '') { |
1498 |
|
$valF['date_notification_delai'] = $val['archive_date_notification_delai']; |
1499 |
|
} else { |
1500 |
|
$valF['date_notification_delai'] = NULL; |
1501 |
|
} |
1502 |
|
if ($val['archive_date_decision'] != '') { |
1503 |
|
$valF['date_decision'] = $val['archive_date_decision']; |
1504 |
|
} else { |
1505 |
|
$valF['date_decision'] = NULL; |
1506 |
|
} |
1507 |
|
if ($val['archive_date_validite'] != '') { |
1508 |
|
$valF['date_validite'] = $val['archive_date_validite']; |
1509 |
|
} else { |
1510 |
|
$valF['date_validite'] = NULL; |
1511 |
|
} |
1512 |
|
if ($val['archive_date_achevement'] != '') { |
1513 |
|
$valF['date_achevement'] = $val['archive_date_achevement']; |
1514 |
|
} else { |
1515 |
|
$valF['date_achevement'] = NULL; |
1516 |
|
} |
1517 |
|
if ($val['archive_date_chantier'] != '') { |
1518 |
|
$valF['date_chantier'] = $val['archive_date_chantier']; |
1519 |
|
} else { |
1520 |
|
$valF['date_chantier'] = NULL; |
1521 |
|
} |
1522 |
|
if ($val['archive_date_conformite'] != '') { |
1523 |
|
$valF['date_conformite'] = $val['archive_date_conformite']; |
1524 |
|
} else { |
1525 |
|
$valF['date_conformite'] = NULL; |
1526 |
|
} |
1527 |
|
if ($val['archive_incompletude'] != '') { |
1528 |
|
$valF['incompletude'] = $val['archive_incompletude']; |
1529 |
|
} else { |
1530 |
|
$valF['incompletude'] = NULL; |
1531 |
|
} |
1532 |
|
if ($val['archive_evenement_suivant_tacite'] != '') { |
1533 |
|
$valF['evenement_suivant_tacite'] = $val['archive_evenement_suivant_tacite']; |
1534 |
|
} else { |
1535 |
|
$valF['evenement_suivant_tacite'] = NULL; |
1536 |
|
} |
1537 |
|
if ($val['archive_evenement_suivant_tacite_incompletude'] != '') { |
1538 |
|
$valF['evenement_suivant_tacite_incompletude'] = $val['archive_evenement_suivant_tacite_incompletude']; |
1539 |
|
} else { |
1540 |
|
$valF['evenement_suivant_tacite_incompletude'] = NULL; |
1541 |
|
} |
1542 |
|
if ($val['archive_etat_pendant_incompletude'] != '') { |
1543 |
|
$valF['etat_pendant_incompletude'] = $val['archive_etat_pendant_incompletude']; |
1544 |
|
} else { |
1545 |
|
$valF['etat_pendant_incompletude'] = NULL; |
1546 |
|
} |
1547 |
|
if ($val['archive_date_limite_incompletude'] != '') { |
1548 |
|
$valF['date_limite_incompletude'] = $val['archive_date_limite_incompletude']; |
1549 |
|
} else { |
1550 |
|
$valF['date_limite_incompletude'] = NULL; |
1551 |
|
} |
1552 |
|
if ($val['archive_delai_incompletude'] != '') { |
1553 |
|
$valF['delai_incompletude'] = $val['archive_delai_incompletude']; |
1554 |
|
} else { |
1555 |
|
$valF['delai_incompletude'] = NULL; |
1556 |
|
} |
1557 |
// On met à jour le dossier |
// On met à jour le dossier |
1558 |
$cle = " dossier='".$val['dossier']."'"; |
$cle = " dossier='".$val['dossier']."'"; |
1559 |
$res1 = $db->autoExecute(DB_PREFIXE.'dossier', $valF, DB_AUTOQUERY_UPDATE, $cle); |
$res = $db->autoExecute(DB_PREFIXE.'dossier', $valF, DB_AUTOQUERY_UPDATE, $cle); |
1560 |
$this->addToLog("triggersupprimer(): db->autoexecute(\"".DB_PREFIXE."dossier\", ".print_r($valF, true).", DB_AUTOQUERY_UPDATE, \"".$cle."\");", VERBOSE_MODE); |
$this->addToLog("triggersupprimer(): db->autoexecute(\"".DB_PREFIXE."dossier\", ".print_r($valF, true).", DB_AUTOQUERY_UPDATE, \"".$cle."\");", VERBOSE_MODE); |
1561 |
if (database::isError($res1)) { |
if (database::isError($res)) { |
1562 |
die($res->getMessage()); |
die($res->getMessage()); |
1563 |
} |
} |
1564 |
// Affichage d'informations à l'utilisateur |
// Affichage d'informations à l'utilisateur |
1565 |
$this->addToMessage(_("Suppression de l'instruction")." [".$db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
$this->addToMessage(_("Suppression de l'instruction")." [".$db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
1566 |
|
|
1567 |
|
// Mise à jour de la demande si un récépissé d'instruction correspond à l'instruction à supprimer |
1568 |
|
} |
1569 |
|
|
1570 |
|
function triggersupprimerapres($id,&$db,$val,$DEBUG) { |
1571 |
|
|
1572 |
|
// Mise à jour des données du dossier d'autorisation |
1573 |
|
require_once "../obj/dossier_autorisation.class.php"; |
1574 |
|
$da = new dossier_autorisation($this->getDossierAutorisationFromDossier($val["dossier"]), $this->db, DEBUG); |
1575 |
|
$da->majDossierAutorisation(); |
1576 |
} |
} |
1577 |
|
|
1578 |
// ============================================= |
// ============================================= |
1629 |
// Vérifie la restriction sur l'événement |
// Vérifie la restriction sur l'événement |
1630 |
function verifier($val = array(), &$db, $DEBUG){ |
function verifier($val = array(), &$db, $DEBUG){ |
1631 |
parent::verifier($val, $db, $DEBUG); |
parent::verifier($val, $db, $DEBUG); |
|
//Récupère la restriction |
|
|
$sql= "SELECT |
|
|
restriction |
|
|
FROM |
|
|
".DB_PREFIXE."evenement |
|
|
WHERE |
|
|
evenement =".$this->valF['evenement']; |
|
|
|
|
|
$res = $db->query($sql); |
|
|
$this->f->addToLog("verifier(): db->query(\"".$sql."\");", VERBOSE_MODE); |
|
|
$this->f->isDatabaseError(); |
|
|
|
|
|
$row=& $res->fetchRow(DB_FETCHMODE_ASSOC); |
|
1632 |
|
|
1633 |
//Test qu'une restriction est présente |
if ( isset($val['evenement']) && is_numeric($val['evenement'])){ |
1634 |
if ( isset($row['restriction']) && $row['restriction'] != "" ){ |
//Récupère la restriction |
1635 |
|
$sql= "SELECT |
1636 |
//Test si la restriction est valide |
restriction |
1637 |
if ( !$this->restrictionIsValid($row['restriction']) ){ |
FROM |
1638 |
|
".DB_PREFIXE."evenement |
1639 |
$this->correct=false; |
WHERE |
1640 |
$this->addToMessage(_("Restriction non valide")); |
evenement =".$val['evenement']; |
1641 |
} |
|
1642 |
else { |
$res = $db->query($sql); |
1643 |
|
$this->addToLog("verifier(): db->query(\"".$sql."\");", VERBOSE_MODE); |
1644 |
|
if (database::isError($res)) { |
1645 |
|
die($res->getMessage()); |
1646 |
|
} |
1647 |
|
$row=& $res->fetchRow(DB_FETCHMODE_ASSOC); |
1648 |
|
|
1649 |
|
//Test qu'une restriction est présente |
1650 |
|
if ( isset($row['restriction']) && $row['restriction'] != "" ){ |
1651 |
|
|
1652 |
$this->correct = true; |
//Test si la restriction est valide |
1653 |
|
if ( !$this->restrictionIsValid($row['restriction']) ){ |
1654 |
|
|
1655 |
|
$this->correct=false; |
1656 |
|
$this->addToMessage(_("Restriction non valide")); |
1657 |
|
} |
1658 |
|
else { |
1659 |
|
|
1660 |
|
$this->correct = true; |
1661 |
|
} |
1662 |
} |
} |
1663 |
} |
} |
1664 |
|
|
1669 |
$this->updateDate("date_envoi_controle_legalite"); |
$this->updateDate("date_envoi_controle_legalite"); |
1670 |
$this->updateDate("date_retour_controle_legalite"); |
$this->updateDate("date_retour_controle_legalite"); |
1671 |
} |
} |
1672 |
|
|
1673 |
|
/** |
1674 |
|
* Méthode permettant de récupérer toutes les valeurs de l'événement |
1675 |
|
* sélectionné après validation du formulaire d'instruction |
1676 |
|
* |
1677 |
|
* @return array() veleurs de l'événement lié |
1678 |
|
*/ |
1679 |
|
|
1680 |
|
private function getValEvenement() { |
1681 |
|
if(!empty($this->valEvenement)) { |
1682 |
|
return $this->valEvenement; |
1683 |
|
} else { |
1684 |
|
$sql = "SELECT * FROM ".DB_PREFIXE."evenement |
1685 |
|
WHERE evenement=".$this->valF['evenement']; |
1686 |
|
$res = $this->db->query($sql); |
1687 |
|
$this->addToLog("getValEvenement(): db->query(\"".$sql."\");", VERBOSE_MODE); |
1688 |
|
if (database::isError($res)) { |
1689 |
|
die($res->getMessage()); |
1690 |
|
} |
1691 |
|
$this->valEvenement = $res->fetchRow(DB_FETCHMODE_ASSOC); |
1692 |
|
return $this->valEvenement; |
1693 |
|
} |
1694 |
|
} |
1695 |
|
|
1696 |
/** |
/** |
1697 |
* Méthode permettant de mettre à jour l'état d'un DA |
* Méthode permettant de savoir si le dossier lié à l'instruction à le flag |
1698 |
|
* incompletude à true après validation du formulaire d'instruction |
1699 |
|
* |
1700 |
|
* @return boolean |
1701 |
*/ |
*/ |
1702 |
function majEtatDA() { |
private function dossierIncomplet() { |
1703 |
if($this->valF['action'] == 'accepter' AND $this->valF['avis_decision'] == 8) { |
$sql = "SELECT incompletude FROM ".DB_PREFIXE."dossier |
1704 |
$val['etat_dossier_autorisation']=5; |
WHERE dossier='".$this->valF['dossier']."'"; |
1705 |
} elseif($this->valF['action'] == 'accepter' AND $this->valF['avis_decision'] == 15) { |
$incompletude = $this->db->getOne($sql); |
1706 |
$val['etat_dossier_autorisation']=3; |
$this->addToLog("dossierIncomplet(): db->query(\"".$sql."\");", VERBOSE_MODE); |
1707 |
} elseif($this->valF['action'] == 'accepter') { |
if (database::isError($incompletude)) { |
1708 |
$val['etat_dossier_autorisation']=2; |
die($incompletude->getMessage()); |
1709 |
} elseif($this->valF['action'] == 'rejeter') { |
} |
1710 |
$val['etat_dossier_autorisation']=4; |
if ($incompletude == 't') { |
1711 |
} elseif($this->valF['action'] == 'terminer') { |
return true; |
|
$val['etat_dossier_autorisation']=8; |
|
|
} elseif($this->valF['action'] == 'majorer') { |
|
|
$val['etat_dossier_autorisation']=6; |
|
1712 |
} else { |
} else { |
1713 |
$val['etat_dossier_autorisation']=7; |
return false; |
1714 |
} |
} |
1715 |
|
} |
1716 |
//Récupération du numéro de dossier d'autorisation lié au dossier d'instruction |
|
1717 |
$IDdossier_autorisation = $this->getDossierAutorisation($this->valF['dossier']); |
/** |
1718 |
|
* Finalisation des documents. |
1719 |
// Mis à jour de l'état du dossier d'autorisation |
* @param string $champ champ du fichier à finaliser |
1720 |
require_once '../obj/dossier_autorisation.class.php'; |
* @param booleen $status permet de définir si on finalise ou définalise |
1721 |
$dossier_autorisation = new dossier_autorisation($IDdossier_autorisation,$this->db,DEBUG); |
* @param string $sousform permet de savoir si se trouve dans un sousformulaire (passé au javascript) |
1722 |
|
*/ |
1723 |
$dossier_autorisation->val[array_search("etat_dossier_autorisation", $dossier_autorisation->champs)] = $val['etat_dossier_autorisation']; |
function finaliser( $champ = '', $status, $sousform, $retourformulaire){ |
1724 |
|
|
1725 |
//Récupération des données |
//Si on finalise le document |
1726 |
$valDossierAutorisation = array(); |
if ( $status == 1 ){ |
|
for ( $i=0 ; $i<count($dossier_autorisation->champs); $i++){ |
|
1727 |
|
|
1728 |
$valDossierAutorisation[$dossier_autorisation->champs[$i]]= |
//Génération du PDF |
1729 |
$dossier_autorisation->val[$i]; |
$_GET['output'] = "string"; |
1730 |
|
$f = $this->f; |
1731 |
|
include '../app/pdf_instruction.php'; |
1732 |
|
|
1733 |
|
//Métadonnées du document |
1734 |
|
$metadata = array( |
1735 |
|
'filename' => 'instruction_'.$idx.'.pdf', |
1736 |
|
'mimetype' => 'application/pdf', |
1737 |
|
'size' => strlen($pdf_output) |
1738 |
|
); |
1739 |
|
|
1740 |
|
// Récupération des métadonnées calculées après validation |
1741 |
|
$spe_metadata = $this->getMetadata("om_fichier_instruction"); |
1742 |
|
|
1743 |
|
$metadata = array_merge($metadata, $spe_metadata); |
1744 |
|
//Si le document a déjà été finalisé |
1745 |
|
//on met à jour le document mais pas son uid |
1746 |
|
if ( $this->getVal("om_fichier_instruction") != '' ){ |
1747 |
|
$uid = $this->f->storage->update( |
1748 |
|
$this->getVal("om_fichier_instruction"), $pdf_output, $metadata); |
1749 |
|
} |
1750 |
|
//Sinon, on joute le document et on récupère son uid |
1751 |
|
else { |
1752 |
|
//Stockage du PDF |
1753 |
|
$uid = $this->f->storage->create($pdf_output, $metadata); |
1754 |
|
} |
1755 |
|
} |
1756 |
|
else { |
1757 |
|
//Récupération de l'uid du document finalisé |
1758 |
|
$uid = $this->getVal("om_fichier_instruction"); |
1759 |
|
|
1760 |
|
//On dé-finalise avant de finaliser |
1761 |
|
if ( $uid == '' ){ |
1762 |
|
return -1; |
1763 |
|
} |
1764 |
} |
} |
1765 |
|
|
1766 |
$dossier_autorisation->modifier($valDossierAutorisation, $this->db, DEBUG); |
//Mise à jour des données |
1767 |
} |
if ( $uid != '' ){ |
1768 |
|
// Logger |
1769 |
/** |
$this->addToLog("finaliser() - begin", EXTRA_VERBOSE_MODE); |
1770 |
* Méthode permettant de mettre à jour les données d'un DA |
// Recuperation de la valeur de la cle primaire de l'objet |
1771 |
*/ |
if($this->getVal($this->clePrimaire) != '') |
1772 |
function majDataDA() { |
$id = $this->getVal($this->clePrimaire); |
1773 |
|
else |
1774 |
//Récupération du numéro de dossier d'autorisation lié au dossier d'instruction |
$id=$this->id; |
|
$IDdossier_autorisation = $this->getDossierAutorisation($this->valF['dossier']); |
|
|
require_once '../obj/dossier_autorisation.class.php'; |
|
|
$dossier_autorisation = new dossier_autorisation($IDdossier_autorisation,$this->db,DEBUG); |
|
|
|
|
|
require_once '../obj/dossier.class.php'; |
|
|
$dossier = new dossier($this->valF['dossier'],$this->db,DEBUG); |
|
|
|
|
|
//Récupération des données |
|
|
$valDossierAutorisation = array(); |
|
|
for ( $i=0 ; $i<count($dossier_autorisation->champs); $i++){ |
|
1775 |
|
|
1776 |
if ( array_search($dossier_autorisation->champs[$i], $dossier->champs) ){ |
$actions = array(); |
1777 |
|
//Tableau contenant le lien vers le PDF et lien du portlet pour la mise |
1778 |
|
//à jour de l'interface |
1779 |
|
if ( $status == 0 ){ |
1780 |
|
$lien = '../app/pdf_instruction.php?idx='.$id; |
1781 |
|
|
1782 |
$valDossierAutorisation[$dossier_autorisation->champs[$i]]=$dossier->getVal($dossier_autorisation->champs[$i]); |
//Ajout des actions |
1783 |
|
//Si l'utilisateur a le droit de modifier l'objet |
1784 |
|
if ( $this->f->isAccredited('instruction') || |
1785 |
|
$this->f->isAccredited('instruction_modifier') ){ |
1786 |
|
|
1787 |
|
$actions["modifier"] = ($sousform!='')? |
1788 |
|
'<li><a href="#" onclick="ajaxIt(\'instruction\', |
1789 |
|
\'../scr/sousform.php?obj=instruction&action=1&idx='. |
1790 |
|
$this->getVal($this->clePrimaire). |
1791 |
|
'&premiersf=0&trisf=&retourformulaire='.$retourformulaire.'&idxformulaire='. |
1792 |
|
$this->getVal("dossier"). |
1793 |
|
'&retour=form\');"> |
1794 |
|
<span class="om-prev-icon om-icon-16 edit-16" title="'. |
1795 |
|
_('Modifier').'">'. |
1796 |
|
_('Modifier'). |
1797 |
|
'</span></a></li>': |
1798 |
|
'<li> |
1799 |
|
<a href="form.php?obj=instruction&action=1'.'&idx='. |
1800 |
|
$this->getVal($this->clePrimaire). |
1801 |
|
'&premier=&advs_id=&recherche=&tricol=&selectioncol=&valide=&retour=form"> |
1802 |
|
<span class="om-prev-icon om-icon-16 edit-16" title="'. |
1803 |
|
_('Modifier').'">'. |
1804 |
|
_('Modifier'). |
1805 |
|
'</span></a></li>'; |
1806 |
|
} |
1807 |
|
//Si l'utilisateur a le droit de supprimer l'objet |
1808 |
|
if ( $this->f->isAccredited('instruction') || |
1809 |
|
$this->f->isAccredited('instruction_supprimer') ){ |
1810 |
|
|
1811 |
|
$actions["supprimer"] = ($sousform!='')? |
1812 |
|
'<li><a href="#" onclick="ajaxIt(\'instruction\', |
1813 |
|
\'../scr/sousform.php?obj=instruction&action=2&idx='. |
1814 |
|
$this->getVal($this->clePrimaire). |
1815 |
|
'&premiersf=0&trisf=&retourformulaire='.$retourformulaire.'&idxformulaire='. |
1816 |
|
$this->getVal("dossier"). |
1817 |
|
'&retour=form\');"> |
1818 |
|
<span class="om-prev-icon om-icon-16 delete-16" title="'. |
1819 |
|
_('Supprimer').'">'. |
1820 |
|
_('Supprimer'). |
1821 |
|
'</span></a></li>': |
1822 |
|
'<li> |
1823 |
|
<a href="form.php?obj=instruction&action=1'.'&idx='. |
1824 |
|
$this->getVal($this->clePrimaire). |
1825 |
|
'&premier=&advs_id=&recherche=&tricol=&selectioncol=&valide=&retour=form"> |
1826 |
|
<span class="om-prev-icon om-icon-16 delete-16" title="'. |
1827 |
|
_('Supprimer').'">'. |
1828 |
|
_('Supprimer'). |
1829 |
|
'</span></a></li>'; |
1830 |
|
} |
1831 |
} |
} |
1832 |
else { |
else { |
1833 |
$valDossierAutorisation[$dossier_autorisation->champs[$i]]= |
$lien = '../spg/file.php?obj=instruction&'. |
1834 |
$dossier_autorisation->val[$i]; |
'champ=om_fichier_instruction&id='.$id; |
1835 |
|
} |
1836 |
|
|
1837 |
|
$retour = array( |
1838 |
|
"portlet"=> "<a href=\"#\" onclick=\"finalizeDocument(". |
1839 |
|
$id.", 'instruction', '".$sousform."', ".(($status==0)?1:0).")\"> |
1840 |
|
<span class=\"om-prev-icon om-icon-16 om-icon-fix " |
1841 |
|
.(($status==1)?"de":"")."finalise\" title=\"". |
1842 |
|
(($status==1)?_("Reprendre la redaction du document"):_("Finaliser le document"))."\">". |
1843 |
|
(($status==1)?_("Reprendre la redaction du document"):_("Finaliser le document"))."</span> |
1844 |
|
</a>", |
1845 |
|
"pdf" => $lien, |
1846 |
|
"actions" => $actions |
1847 |
|
); |
1848 |
|
|
1849 |
|
foreach ( $this->champs as $key=>$value ) |
1850 |
|
$val[$value] = $this->val[$key]; |
1851 |
|
$val['date_evenement']=$this->dateDBToForm($val['date_evenement']); |
1852 |
|
$val['archive_date_complet']=$this->dateDBToForm($val['archive_date_complet']); |
1853 |
|
$val['archive_date_rejet']=$this->dateDBToForm($val['archive_date_rejet']); |
1854 |
|
$val['archive_date_limite']=$this->dateDBToForm($val['archive_date_limite']); |
1855 |
|
$val['archive_date_notification_delai']=$this->dateDBToForm($val['archive_date_notification_delai']); |
1856 |
|
$val['archive_date_decision']=$this->dateDBToForm($val['archive_date_decision']); |
1857 |
|
$val['archive_date_validite']=$this->dateDBToForm($val['archive_date_validite']); |
1858 |
|
$val['archive_date_achevement']=$this->dateDBToForm($val['archive_date_achevement']); |
1859 |
|
$val['archive_date_chantier']=$this->dateDBToForm($val['archive_date_chantier']); |
1860 |
|
$val['archive_date_conformite']=$this->dateDBToForm($val['archive_date_conformite']); |
1861 |
|
$val['archive_date_dernier_depot']=$this->dateDBToForm($val['archive_date_dernier_depot']); |
1862 |
|
$val['archive_date_limite_incompletude']=$this->dateDBToForm($val['archive_date_limite_incompletude']); |
1863 |
|
$val['date_finalisation_courrier']=$this->dateDBToForm($val['date_finalisation_courrier']); |
1864 |
|
$val['date_envoi_signature']=$this->dateDBToForm($val['date_envoi_signature']); |
1865 |
|
$val['date_retour_signature']=$this->dateDBToForm($val['date_retour_signature']); |
1866 |
|
$val['date_envoi_rar']=$this->dateDBToForm($val['date_envoi_rar']); |
1867 |
|
$val['date_retour_rar']=$this->dateDBToForm($val['date_retour_rar']); |
1868 |
|
$val['date_envoi_controle_legalite']=$this->dateDBToForm($val['date_envoi_controle_legalite']); |
1869 |
|
$val['date_retour_controle_legalite']=$this->dateDBToForm($val['date_retour_controle_legalite']); |
1870 |
|
|
1871 |
|
$this->setvalF($val); |
1872 |
|
|
1873 |
|
// Verification de la validite des donnees |
1874 |
|
$this->verifier($this->val, $this->db, DEBUG); |
1875 |
|
// Verification du verrou |
1876 |
|
$this->testverrou(); |
1877 |
|
// Si les verifications precedentes sont correctes, on procede a |
1878 |
|
// la modification, sinon on ne fait rien et on retourne une erreur |
1879 |
|
if ($this->correct) { |
1880 |
|
// Execution du trigger 'before' specifique au MODE 'update' |
1881 |
|
$this->triggermodifier( $id, $this->db, $this->val, DEBUG); |
1882 |
|
$valF = array( |
1883 |
|
"om_final_instruction"=> ($status==1)?TRUE:FALSE, |
1884 |
|
"om_fichier_instruction"=>$uid, |
1885 |
|
"date_finalisation_courrier"=>date('Y-m-d')); |
1886 |
|
// Execution de la requête de modification des donnees de l'attribut |
1887 |
|
// valF de l'objet dans l'attribut table de l'objet |
1888 |
|
$res = $this->db->autoExecute(DB_PREFIXE.$this->table, $valF, |
1889 |
|
DB_AUTOQUERY_UPDATE, $this->getCle($id)); |
1890 |
|
$this->addToLog("finaliser() : db->autoExecute(\"".DB_PREFIXE.$this->table."\", ".print_r($valF, true).", DB_AUTOQUERY_UPDATE, \"".$this->getCle($id)."\")", VERBOSE_MODE); |
1891 |
|
// Si une erreur survient |
1892 |
|
if (database::isError($res)) { |
1893 |
|
// Appel de la methode de recuperation des erreurs |
1894 |
|
$this->erreur_db($res->getDebugInfo(), $res->getMessage(), ''); |
1895 |
|
} else { |
1896 |
|
// Log |
1897 |
|
$this->addToLog(_("Requete executee"), VERBOSE_MODE); |
1898 |
|
// Log |
1899 |
|
$message = _("Enregistrement")." ".$id." "; |
1900 |
|
$message .= _("de la table")." \"".$this->table."\" "; |
1901 |
|
$message .= "[ ".$this->db->affectedRows()." "; |
1902 |
|
$message .= _("enregistrement(s) mis a jour")." ]"; |
1903 |
|
$this->addToLog($message, VERBOSE_MODE); |
1904 |
|
// Mise en place du verrou pour ne pas finaliser plusieurs fois |
1905 |
|
// le meme document |
1906 |
|
$this->verrouille(); |
1907 |
|
// Execution du trigger 'after' specifique au MODE 'update' |
1908 |
|
//$this->triggermodifierapres($id, $this->db, $val, DEBUG); |
1909 |
|
|
1910 |
|
return $retour; |
1911 |
|
} |
1912 |
|
} else { |
1913 |
|
// Message d'echec (saut d'une ligne supplementaire avant le |
1914 |
|
// message pour qu'il soit mis en evidence) |
1915 |
|
$this->addToLog("Finalisation non enregistree"); |
1916 |
|
return -1; |
1917 |
} |
} |
1918 |
} |
} |
1919 |
|
// Si le document n'a pas été stocké |
1920 |
|
else{ |
1921 |
|
return -1; |
1922 |
|
} |
1923 |
|
} |
1924 |
|
|
1925 |
$dossier_autorisation->modifier($valDossierAutorisation, $this->db, DEBUG); |
/** |
1926 |
|
* Récupération du numéro de dossier d'instruction à ajouter aux métadonnées |
1927 |
// Suppression du liens entre les lots et le DA |
* @return string numéro de dossier d'instruction |
1928 |
$valLot['dossier_autorisation'] = NULL; |
*/ |
1929 |
$this->db->autoExecute(DB_PREFIXE."lot", $valLot, DB_AUTOQUERY_UPDATE, "dossier_autorisation='".$IDdossier_autorisation."'"); |
protected function getDossier() { |
1930 |
|
if(empty($this->specificMetadata)) { |
1931 |
|
$this->getSpecificMetadata(); |
1932 |
|
} |
1933 |
|
return $this->specificMetadata->dossier; |
1934 |
|
} |
1935 |
|
/** |
1936 |
|
* Récupération la version du dossier d'instruction à ajouter aux métadonnées |
1937 |
|
* @return int Version |
1938 |
|
*/ |
1939 |
|
protected function getDossierVersion() { |
1940 |
|
if(empty($this->specificMetadata)) { |
1941 |
|
$this->getSpecificMetadata(); |
1942 |
|
} |
1943 |
|
return $this->specificMetadata->version; |
1944 |
|
} |
1945 |
|
/** |
1946 |
|
* Récupération du numéro de dossier d'autorisation à ajouter aux métadonnées |
1947 |
|
* @return string numéro de dossier d'autorisation |
1948 |
|
*/ |
1949 |
|
protected function getDossierAutorisation() { |
1950 |
|
if(empty($this->specificMetadata)) { |
1951 |
|
$this->getSpecificMetadata(); |
1952 |
|
} |
1953 |
|
return $this->specificMetadata->dossier_autorisation; |
1954 |
|
} |
1955 |
|
/** |
1956 |
|
* Récupération de la date de demande initiale du dossier à ajouter aux métadonnées |
1957 |
|
* @return date de la demande initiale |
1958 |
|
*/ |
1959 |
|
protected function getDateDemandeInitiale() { |
1960 |
|
if(empty($this->specificMetadata)) { |
1961 |
|
$this->getSpecificMetadata(); |
1962 |
|
} |
1963 |
|
return $this->specificMetadata->date_demande_initiale; |
1964 |
|
} |
1965 |
|
/** |
1966 |
|
* Récupération du type de dossier d'instruction à ajouter aux métadonnées |
1967 |
|
* @return string type du dossier d'instruction |
1968 |
|
*/ |
1969 |
|
protected function getDossierInstructionType() { |
1970 |
|
if(empty($this->specificMetadata)) { |
1971 |
|
$this->getSpecificMetadata(); |
1972 |
|
} |
1973 |
|
return $this->specificMetadata->dossier_instruction_type; |
1974 |
|
} |
1975 |
|
/** |
1976 |
|
* Récupération du statut du dossier d'autorisation à ajouter aux métadonnées |
1977 |
|
* @return string avis |
1978 |
|
*/ |
1979 |
|
protected function getStatut() { |
1980 |
|
if(empty($this->specificMetadata)) { |
1981 |
|
$this->getSpecificMetadata(); |
1982 |
|
} |
1983 |
|
return $this->specificMetadata->statut; |
1984 |
|
} |
1985 |
|
/** |
1986 |
|
* Récupération du type de dossier d'autorisation à ajouter aux métadonnées |
1987 |
|
* @return string type du dossier d'autorisation |
1988 |
|
*/ |
1989 |
|
protected function getDossierAutorisationType() { |
1990 |
|
if(empty($this->specificMetadata)) { |
1991 |
|
$this->getSpecificMetadata(); |
1992 |
|
} |
1993 |
|
return $this->specificMetadata->dossier_autorisation_type; |
1994 |
|
} |
1995 |
|
/** |
1996 |
|
* Récupération de la date d'ajout de document à ajouter aux métadonnées |
1997 |
|
* @return date de l'évènement |
1998 |
|
*/ |
1999 |
|
protected function getDateEvenement() { |
2000 |
|
return date("d/m/Y"); |
2001 |
|
} |
2002 |
|
/** |
2003 |
|
* Récupération du groupe d'instruction à ajouter aux métadonnées |
2004 |
|
* @return string Groupe d'instruction |
2005 |
|
*/ |
2006 |
|
protected function getGroupeInstruction() { |
2007 |
|
if(empty($this->specificMetadata)) { |
2008 |
|
$this->getSpecificMetadata(); |
2009 |
|
} |
2010 |
|
return $this->specificMetadata->groupe_instruction; |
2011 |
|
} |
2012 |
|
/** |
2013 |
|
* Récupération du libellé du type du document à ajouter aux métadonnées |
2014 |
|
* @return string Groupe d'instruction |
2015 |
|
*/ |
2016 |
|
protected function getEvenementLibelle() { |
2017 |
|
|
2018 |
|
// Récupère le champ événement |
2019 |
|
if (isset($this->valF["evenement"]) AND $this->valF["evenement"] != "") { |
2020 |
|
$evenement = $this->valF["evenement"]; |
2021 |
|
} else { |
2022 |
|
$evenement = $this->getVal("evenement"); |
2023 |
|
} |
2024 |
|
|
2025 |
|
// Requête sql |
2026 |
|
$sql = "SELECT libelle FROM ".DB_PREFIXE."evenement |
2027 |
|
WHERE evenement=".$evenement; |
2028 |
|
$evenement_libelle = $this->db->getOne($sql); |
2029 |
|
$this->addToLog("getEvenementLibelle(): db->getOne(\"".$sql."\");", VERBOSE_MODE); |
2030 |
|
if (database::isError($evenement_libelle)) { |
2031 |
|
die(); |
2032 |
|
} |
2033 |
|
|
2034 |
|
// Retourne le libelle de l'événement |
2035 |
|
return $evenement_libelle; |
2036 |
|
} |
2037 |
|
|
2038 |
|
/** |
2039 |
|
* Cette méthode permet de stocker en attribut toutes les métadonnées |
2040 |
|
* nécessaire à l'ajout d'un document. |
2041 |
|
*/ |
2042 |
|
public function getSpecificMetadata() { |
2043 |
|
if (isset($this->valF["dossier"]) AND $this->valF["dossier"] != "") { |
2044 |
|
$dossier = $this->valF["dossier"]; |
2045 |
|
} else { |
2046 |
|
$dossier = $this->getVal("dossier"); |
2047 |
|
} |
2048 |
|
//Requête pour récupérer les informations essentiels sur le dossier d'instruction |
2049 |
|
$sql = "SELECT dossier.dossier as dossier, |
2050 |
|
dossier_autorisation.dossier_autorisation as dossier_autorisation, |
2051 |
|
to_char(dossier.date_demande, 'YYYY/MM') as date_demande_initiale, |
2052 |
|
dossier.version as version, |
2053 |
|
dossier_instruction_type.code as dossier_instruction_type, |
2054 |
|
etat_dossier_autorisation.libelle as statut, |
2055 |
|
dossier_autorisation_type.code as dossier_autorisation_type, |
2056 |
|
groupe.code as groupe_instruction |
2057 |
|
FROM ".DB_PREFIXE."dossier |
2058 |
|
LEFT JOIN ".DB_PREFIXE."dossier_instruction_type |
2059 |
|
ON dossier.dossier_instruction_type = dossier_instruction_type.dossier_instruction_type |
2060 |
|
LEFT JOIN ".DB_PREFIXE."dossier_autorisation |
2061 |
|
ON dossier.dossier_autorisation = dossier_autorisation.dossier_autorisation |
2062 |
|
LEFT JOIN ".DB_PREFIXE."etat_dossier_autorisation |
2063 |
|
ON dossier_autorisation.etat_dossier_autorisation = etat_dossier_autorisation.etat_dossier_autorisation |
2064 |
|
LEFT JOIN ".DB_PREFIXE."dossier_autorisation_type_detaille |
2065 |
|
ON dossier_autorisation.dossier_autorisation_type_detaille = dossier_autorisation_type_detaille.dossier_autorisation_type_detaille |
2066 |
|
LEFT JOIN ".DB_PREFIXE."dossier_autorisation_type |
2067 |
|
ON dossier_autorisation_type_detaille.dossier_autorisation_type = dossier_autorisation_type.dossier_autorisation_type |
2068 |
|
LEFT JOIN ".DB_PREFIXE."groupe |
2069 |
|
ON dossier_autorisation_type.groupe = groupe.groupe |
2070 |
|
WHERE dossier.dossier = '".$dossier."'"; |
2071 |
|
$res = $this->db->query($sql); |
2072 |
|
$this->f->addToLog("obj/document_numerise.class.php : db->query(".$sql.")", VERBOSE_MODE); |
2073 |
|
if ( database::isError($res)){ |
2074 |
|
die(); |
2075 |
|
} |
2076 |
|
|
2077 |
// Liaison des lots du DI avec le DA |
//Le résultat est récupéré dans un objet |
2078 |
$sqlLot = "SELECT lot FROM ".DB_PREFIXE."lien_dossier_lot WHERE dossier='".$this->valF['dossier']."'"; |
$row =& $res->fetchRow(DB_FETCHMODE_OBJECT); |
2079 |
$res = $this->db->query($sqlLot); |
|
2080 |
$this->addToLog($sqlLot); |
//Si il y a un résultat |
2081 |
$this->f->isDatabaseError(); |
if ($row !== null) { |
2082 |
while($rowLot = $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
|
2083 |
$valLot['dossier_autorisation'] = $IDdossier_autorisation; |
//Alors on créé l'objet dossier_instruction |
2084 |
$this->db->autoExecute(DB_PREFIXE."lot", $valLot, DB_AUTOQUERY_UPDATE, "lot=".$rowLot['lot']); |
$this->specificMetadata = $row; |
2085 |
|
|
2086 |
} |
} |
2087 |
} |
} |
2088 |
|
|
2089 |
// Récupération de l'identifiant du dossier d'autorisation lié au dossier d'instruction |
/** |
2090 |
function getDossierAutorisation($dossier_instruction){ |
* Retourne le statut du dossier d'instruction |
2091 |
|
* @param string $idx Identifiant du dossier d'instruction |
2092 |
|
* @return string Le statut du dossier d'instruction |
2093 |
|
*/ |
2094 |
|
function getStatutDossier($idx){ |
2095 |
|
|
2096 |
$sql = "SELECT |
$statut = ''; |
2097 |
dossier_autorisation.dossier_autorisation |
|
2098 |
FROM |
//Si l'identifiant du dossier d'instruction fourni est correct |
2099 |
".DB_PREFIXE."dossier_autorisation |
if ( $idx != '' ){ |
2100 |
|
|
2101 |
|
//On récupère le statut de l'état du dossier à partir de l'identifiant du |
2102 |
|
//dossier |
2103 |
|
$sql = "SELECT etat.statut |
2104 |
|
FROM ".DB_PREFIXE."dossier |
2105 |
LEFT JOIN |
LEFT JOIN |
2106 |
".DB_PREFIXE."dossier |
".DB_PREFIXE."etat |
2107 |
ON |
ON |
2108 |
dossier_autorisation.dossier_autorisation = dossier.dossier_autorisation |
dossier.etat = etat.etat |
2109 |
WHERE |
WHERE dossier ='".$idx."'"; |
2110 |
dossier.dossier = '".$dossier_instruction."'"; |
$statut = $this->db->getOne($sql); |
2111 |
|
$this->f->addToLog("getStatutDossier() : db->getOne(\"".$sql."\")", VERBOSE_MODE); |
2112 |
$IDdossier_autorisation = $this->db->getOne($sql); |
if ( database::isError($statut)){ |
2113 |
$this->addToLog("getDossierAutorisation(): db->getone(\"".$sql."\")", VERBOSE_MODE); |
die(); |
2114 |
database::isError($IDdossier_autorisation); |
} |
2115 |
|
} |
2116 |
return $IDdossier_autorisation; |
return $statut; |
2117 |
} |
} |
2118 |
}// fin classe |
}// fin classe |
2119 |
?> |
?> |