1 |
<?php |
<?php |
2 |
//$Id$ |
/** |
3 |
//gen openMairie le 10/02/2011 20:34 |
* |
4 |
/* |
* |
5 |
$Id: instruction.class.php,v 1.29 2010-10-27 10:52:20 fraynaud Exp $ |
* specific : |
6 |
specific : |
* - cle secondaire |
7 |
- cle secondaire |
* destruction autorisée que pour le dernier evenement |
8 |
destruction autorisée que pour le dernier evenement |
* [delete the last event ] |
9 |
[delete the last event ] |
* - variable globale [global variables] |
10 |
- variable globale [global variables] |
* var $archive_date_depot; |
11 |
var $archive_date_depot; |
* var $retourformulaire; |
12 |
var $retourformulaire; |
* var $idxformulaire; |
13 |
var $idxformulaire; |
* - modification des données dans dossier trigger avant |
14 |
- modification des données dans dossier trigger avant |
* [modify dossier data with trigger function] |
15 |
[modify dossier data with trigger function] |
* - function mois_date : pour ajouter des mois a une date |
16 |
- function moisdate : pour ajouter des mois a une date |
* [add months (delay) and calculation final date] |
17 |
[add months (delay) and calculation final date] |
* - voir script_lang.js : bible ... |
18 |
- voir script_lang.js : bible ... |
* |
19 |
*/ |
* @package openfoncier |
20 |
require_once ("../gen/obj/instruction.class.php"); |
* @version SVN : $Id$ |
21 |
require_once("../services/outgoing/messageenqueuer.php"); |
*/ |
22 |
|
|
23 |
|
// |
24 |
|
require_once "../gen/obj/instruction.class.php"; |
25 |
|
|
26 |
|
// |
27 |
|
require_once "../services/outgoing/messageenqueuer.php"; |
28 |
|
|
29 |
|
// |
30 |
class instruction extends instruction_gen { |
class instruction extends instruction_gen { |
31 |
|
|
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" => "getNumDemandeAutor", |
44 |
|
"anneemoisDemandeAutor" => "getAnneemoisDemandeAutor", |
45 |
|
"typeInstruction" => "getTypeInstruction", |
46 |
|
"statutAutorisation" => "getStatutAutorisation", |
47 |
|
"typeAutorisation" => "getTypeAutorisation", |
48 |
|
"dateEvenementDocument" => "getDateEvenementDocument", |
49 |
|
"groupeInstruction" => 'getGroupeInstruction', |
50 |
|
"title" => 'getTitle', |
51 |
|
), |
52 |
|
); |
53 |
|
|
54 |
|
|
55 |
function instruction($id,&$db,$debug) { |
function __construct($id, &$db, $debug) { |
56 |
$this->constructeur($id,$db,$debug); |
$this->constructeur($id, $db, $debug); |
57 |
}// fin constructeur |
} |
58 |
|
|
59 |
// {{{ Gestion de la confidentialité des données spécifiques |
// {{{ Gestion de la confidentialité des données spécifiques |
60 |
|
|
64 |
function checkAccessibility() { |
function checkAccessibility() { |
65 |
// |
// |
66 |
parent::checkAccessibility(); |
parent::checkAccessibility(); |
67 |
// Si l'utilisateur est un intructeur qui en correspond pas à la |
// Si l'utilisateur est un intructeur qui ne correspond pas à la |
68 |
// division du dossier |
// division du dossier |
69 |
if ($this->f->isUserInstructeur() |
if ($this->f->isUserInstructeur() |
70 |
&& isset($this->f->om_utilisateur["division"]) |
&& isset($this->f->om_utilisateur["division"]) |
71 |
&& $this->f->om_utilisateur["division"] != $this->getDivisionFromDossier()) { |
&& $this->f->om_utilisateur["division"] != $this->getDivisionFromDossier()) { |
72 |
// |
// |
73 |
$this->actions_sup = array(); |
//On cache les liens d'action |
74 |
$this->setParameter("actions", array()); |
$this->parameters["actions"]["modifier"] = NULL; |
75 |
|
$this->parameters["actions"]["supprimer"] = NULL; |
76 |
|
$this->actions_sup["finalisation"] = NULL; |
77 |
} |
} |
78 |
// Si une action 'lu' est présente et que le champ lu est à true |
// Si une action 'lu' est présente et que le champ lu est à true |
79 |
// on supprime l'action |
// on supprime l'action |
82 |
&& $this->val[array_search("lu", $this->champs)]== "t") { |
&& $this->val[array_search("lu", $this->champs)]== "t") { |
83 |
unset($this->actions_sup["lu"]); |
unset($this->actions_sup["lu"]); |
84 |
} |
} |
85 |
|
|
86 |
|
//Si pas de lettretype associée |
87 |
|
if($this->getVal("lettretype") == "") { |
88 |
|
// Suppression des actions sur fichier dans le portlet actions |
89 |
|
$this->actions_sup["pdfetat"] = NULL; |
90 |
|
$this->actions_sup["finalisation"] = NULL; |
91 |
|
$this->actions_sup["definalisation"] = NULL; |
92 |
|
} |
93 |
|
|
94 |
|
//Si le document est déjà finalisé, on affiche uniquement le lien de |
95 |
|
//dé-finalisation |
96 |
|
$om_final_instruction = $this->getVal("om_final_instruction"); |
97 |
|
if ( isset($this->actions_sup["finalisation"]) && |
98 |
|
$om_final_instruction== "t" ){ |
99 |
|
|
100 |
|
//On cache les liens d'action |
101 |
|
$this->parameters["actions"]["modifier"] = NULL; |
102 |
|
$this->parameters["actions"]["supprimer"] = NULL; |
103 |
|
//On cache le lien de finalisation et on affiche le bon lien pour l'édition |
104 |
|
$this->actions_sup["finalisation"] = NULL; |
105 |
|
$this->actions_sup["pdfetat"]["lien"] = "../spg/file.php?id="; |
106 |
|
$this->actions_sup["pdfetat"]["id"] = |
107 |
|
"&obj=instruction&champ=om_fichier_instruction"; |
108 |
|
} |
109 |
|
//Si le document n'est pas finalisé, on affiche uniquement le lien de |
110 |
|
//finalisation |
111 |
|
if ( isset($this->actions_sup["definalisation"]) && |
112 |
|
$om_final_instruction!= "t" ){ |
113 |
|
|
114 |
|
//On cache le lien de finalisation et on affiche le bon lien pour l'édition |
115 |
|
$this->actions_sup["definalisation"] = NULL; |
116 |
|
$this->actions_sup["pdfetat"]["lien"] = "../app/pdf_instruction.php?idx="; |
117 |
|
$this->actions_sup["pdfetat"]["id"] = ""; |
118 |
|
} |
119 |
|
|
120 |
|
$idxformulaire = $this->getParameter("idxformulaire"); |
121 |
|
$retourformulaire = $this->getParameter("retourformulaire"); |
122 |
|
//Si le dossier d'instruction auquel est rattachée l'instruction est cloturé, |
123 |
|
//on affiche pas les liens du portlet |
124 |
|
if ( $idxformulaire != '' && |
125 |
|
( |
126 |
|
$retourformulaire == 'dossier' || |
127 |
|
$retourformulaire == 'dossier_instruction' || |
128 |
|
$retourformulaire == 'dossier_instruction_mes_encours' || |
129 |
|
$retourformulaire == 'dossier_instruction_tous_encours' || |
130 |
|
$retourformulaire == 'dossier_instruction_mes_clotures' || |
131 |
|
$retourformulaire == 'dossier_instruction_tous_clotures' |
132 |
|
)){ |
133 |
|
|
134 |
|
//On récuppère le statut du dossier d'instruction |
135 |
|
$statut = $this->getStatutAutorisationDossier($idxformulaire); |
136 |
|
// Si l'utilisateur est un instructeur, que le statut est clôturé |
137 |
|
// et que l'événement n'est pas identifié comme non verrouillable |
138 |
|
if ( $this->f->isUserInstructeur() && $statut == "cloture" |
139 |
|
&& $this->checkEvenementNonVerrouillable($this->getVal("instruction")) === false){ |
140 |
|
|
141 |
|
//On cache les liens du portlet |
142 |
|
$this->parameters["actions"]["modifier"] = NULL; |
143 |
|
$this->actions_sup["finalisation"] = NULL; |
144 |
|
$this->actions_sup["definalisation"] = NULL; |
145 |
|
} |
146 |
|
} |
147 |
} |
} |
148 |
|
|
149 |
/** |
/** |
157 |
&& $this->f->om_utilisateur["division"] != $this->getDivisionFromDossier() |
&& $this->f->om_utilisateur["division"] != $this->getDivisionFromDossier() |
158 |
&& $this->getParameter("maj") != 3) { |
&& $this->getParameter("maj") != 3) { |
159 |
// |
// |
160 |
|
$this->addToLog("canAccess(): utilisateur instructeur sur un dossier d'une autre division", EXTRA_VERBOSE_MODE); |
161 |
|
return false; |
162 |
|
} |
163 |
|
|
164 |
|
$retourformulaire = $this->getParameter("retourformulaire"); |
165 |
|
// Si l'utilisateur est un instructeur, que le dossier est cloturé, |
166 |
|
// que l'utilisateur est dans un sous formulaire précis, que le |
167 |
|
// formulaire n'est pas en mode consulter ou ajouter et que l'événement |
168 |
|
// n'est pas identifié comme non verrouillable |
169 |
|
if ( $this->f->isUserInstructeur() && |
170 |
|
$this->getStatutAutorisationDossier($this->getParameter("idxformulaire")) == "cloture" |
171 |
|
&& ( |
172 |
|
$retourformulaire == 'dossier' || |
173 |
|
$retourformulaire == 'dossier_instruction' || |
174 |
|
$retourformulaire == 'dossier_instruction_mes_encours' || |
175 |
|
$retourformulaire == 'dossier_instruction_tous_encours' || |
176 |
|
$retourformulaire == 'dossier_instruction_mes_clotures' || |
177 |
|
$retourformulaire == 'dossier_instruction_tous_clotures' |
178 |
|
) |
179 |
|
&& $this->getParameter("maj") != 3 |
180 |
|
&& $this->getParameter("maj") != 0 |
181 |
|
&& $this->checkEvenementNonVerrouillable($this->getVal("instruction")) === false) { |
182 |
|
|
183 |
return false; |
return false; |
184 |
} |
} |
185 |
// |
// |
187 |
} |
} |
188 |
|
|
189 |
/** |
/** |
190 |
* 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 |
191 |
|
* getDivisionFromDossier() afin de ne pas effectuer le recalcul à chacun de |
192 |
|
* ces appels. |
193 |
|
* @var string Code de la division du dossier en cours |
194 |
|
*/ |
195 |
|
var $_division_from_dossier = NULL; |
196 |
|
|
197 |
|
/** |
198 |
|
* Cette méthode permet de récupérer le code de division correspondant |
199 |
|
* au dossier sur lequel on se trouve. |
200 |
|
* |
201 |
|
* @return string Code de la division du dossier en cours |
202 |
*/ |
*/ |
203 |
function getDivisionFromDossier() { |
function getDivisionFromDossier() { |
204 |
|
|
205 |
|
// Cette méthode peut être appelée plusieurs fois lors d'une requête. |
206 |
|
// Pour éviter de refaire le traitement de recherche de la division |
207 |
|
// alors on vérifie si nous ne l'avons pas déjà calculé. |
208 |
|
if ($this->_division_from_dossier != NULL) { |
209 |
|
// Logger |
210 |
|
$this->addToLog("getDivisionFromDossier(): retour de la valeur déjà calculée - '".$this->_division_from_dossier."'", EXTRA_VERBOSE_MODE); |
211 |
|
// On retourne la valeur déjà calculée |
212 |
|
return $this->_division_from_dossier; |
213 |
|
} |
214 |
|
|
215 |
|
// Par défaut, on définit la valeur du dossier à NULL |
216 |
|
$dossier = NULL; |
217 |
|
// Test sur le mode et le contexte du formulaire |
218 |
|
if ($this->getParameter("maj") == 0 |
219 |
|
&& ($this->getParameter("retourformulaire") == "dossier" |
220 |
|
|| $this->getParameter("retourformulaire") == "dossier_instruction" |
221 |
|
|| $this->getParameter("retourformulaire") == "dossier_instruction_mes_encours" |
222 |
|
|| $this->getParameter("retourformulaire") == "dossier_instruction_tous_encours" |
223 |
|
|| $this->getParameter("retourformulaire") == "dossier_instruction_mes_clotures" |
224 |
|
|| $this->getParameter("retourformulaire") == "dossier_instruction_tous_clotures")) { |
225 |
|
// Si on se trouve en mode AJOUT (seul mode où l'enregistrement |
226 |
|
// n'existe pas en base de données) ET que nous nous trouvons |
227 |
|
// dans le contexte d'un dossier d'instruction alors on récupère |
228 |
|
// le numéro de dossier depuis le paramètre 'idxformulaire' |
229 |
|
$dossier = $this->getParameter("idxformulaire"); |
230 |
|
} else { |
231 |
|
// Sinon on récupère le numéro de dossier dans le champs dossier de |
232 |
|
// l'enregistrement (en base de données) |
233 |
|
$dossier = $this->getVal("dossier"); |
234 |
|
} |
235 |
|
|
236 |
|
// On appelle la méthode de la classe utils qui renvoi le code de la |
237 |
|
// division d'un dossier, on la stocke pour ne pas refaire le calcul au |
238 |
|
// prochain appel de cette méthode |
239 |
|
$this->_division_from_dossier = $this->f->getDivisionFromDossier($dossier); |
240 |
|
// Logger |
241 |
|
$this->addToLog("getDivisionFromDossier(): retour de la valeur nouvellement calculée - '".$this->_division_from_dossier."'", EXTRA_VERBOSE_MODE); |
242 |
|
// On retourne la valeur retournée |
243 |
|
return $this->_division_from_dossier; |
244 |
|
|
245 |
|
} |
246 |
|
|
247 |
|
/** |
248 |
|
* Cette méthode permet de récupérer le dossier d'autorisation d'un dossier |
249 |
|
*/ |
250 |
|
function getNumDemandeAutorFromDossier($id) { |
251 |
// |
// |
252 |
if (!isset($this->val[array_search("dossier", $this->champs)])) { |
if (!isset($id)) { |
253 |
return NULL; |
return NULL; |
254 |
} |
} |
255 |
// |
// |
256 |
$sql = "select division from ".DB_PREFIXE."dossier "; |
$sql = "select dossier_autorisation from ".DB_PREFIXE."dossier "; |
257 |
$sql .= " where dossier='".$this->val[array_search("dossier", $this->champs)]."'"; |
$sql .= " where dossier='".$id."'"; |
258 |
// |
// |
259 |
$division = $this->db->getOne($sql); |
$dossier_autorisation = $this->db->getOne($sql); |
260 |
$this->addToLog("getDivisionFromDossier(): db->getone(\"".$sql."\")", VERBOSE_MODE); |
$this->addToLog("getNumDemandeAutorFromDossier(): db->getone(\"".$sql."\")", VERBOSE_MODE); |
261 |
database::isError($division); |
database::isError($dossier_autorisation); |
262 |
// |
// |
263 |
return $division; |
return $dossier_autorisation; |
264 |
} |
} |
265 |
|
|
266 |
// }}} |
// }}} |
267 |
|
|
268 |
function cleSecondaire($id,&$db,$val,$DEBUG) { |
function setType(&$form, $maj) { |
269 |
parent::cleSecondaire($id,$db,$val,$DEBUG); |
// |
270 |
// controle suppression cle secondaire [secondary key delete control] |
parent::setType($form, $maj); |
271 |
// ------------------------------------------------------------------------------------ |
// On cache tous les champs |
272 |
// specifique detruire que le dernier [specific instruction : delete the last event ] |
// XXX |
273 |
// ------------------------------------------------------------------------------------ |
$form->setType('complement3_om_html', 'hidden'); |
|
$dernierevenement=''; |
|
|
$sql="select max(instruction) from ".DB_PREFIXE."instruction where dossier ='". |
|
|
$this->idxformulaire."'"; |
|
|
$dernierevenement = $db->getOne($sql); |
|
|
if($dernierevenement==$id){ |
|
|
$this->correct=true; |
|
|
$this->addToMessage(_('Destruction_chronologique')); |
|
|
}else{ |
|
|
$this->addToMessage(_('Destruction_evenement')." : ".$dernierevenement); |
|
|
$this->addToMessage(_('Destruction_chronologique')); |
|
|
$this->correct=false; |
|
|
} |
|
|
} |
|
|
|
|
|
// Sélectionne le signataire_arrete par défaut |
|
|
function setVal(&$form,$maj,$validation){ |
|
|
|
|
|
// Ajout |
|
|
if($maj == 0) { |
|
|
|
|
|
// Création de la requête |
|
|
$sql = "SELECT signataire_arrete |
|
|
FROM ".DB_PREFIXE."signataire_arrete |
|
|
WHERE defaut IS TRUE"; |
|
|
|
|
|
// Exécution de la requête |
|
|
$this->f->addToLog("deleteAllLienDossierInstructionTypeEvenementEvenement(): db->query(\"".$sql."\");", VERBOSE_MODE); |
|
|
$res = $this->f->db->query($sql); |
|
|
$this->f->isDatabaseError(); |
|
|
|
|
|
$row = $res->fetchrow(DB_FETCHMODE_ASSOC); |
|
|
|
|
|
if ( isset($row['signataire_arrete']) && is_numeric($row['signataire_arrete'])){ |
|
|
|
|
|
$form->setVal("signataire_arrete",$row['signataire_arrete']); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
/*Met des valeurs par défaut dans certains des sous-formulaire*/ |
|
|
function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire){ |
|
|
if ($validation==0 and $maj<2) { |
|
|
if ($maj == 0){ |
|
|
$form->setVal("destinataire", $idxformulaire); |
|
|
$form->setVal("dossier", $idxformulaire); |
|
|
$form->setVal("date_evenement", date('Y-m-d')); |
|
|
} |
|
|
$form->setVal("bible_auto","bible_auto()"); |
|
|
$form->setVal("bible","bible()"); |
|
|
$form->setVal("bible2","bible2()"); |
|
|
} |
|
|
$this->retourformulaire=$retourformulaire; |
|
|
$this->idxformulaire=$idxformulaire; |
|
|
} |
|
|
|
|
|
/*Affecte un type à certains champs*/ |
|
|
function setType(&$form,$maj) { |
|
|
parent::setType($form,$maj); |
|
|
if ($maj < 2) { //ajouter et modifier |
|
|
$form->setType('destinataire', 'hidden'); |
|
|
$form->setType('lettretype', 'hiddenstatic'); |
|
|
$form->setType('complement', 'textarea'); |
|
|
$form->setType('complement2', 'textarea'); |
|
|
$form->setType('bible_auto', 'httpclick'); |
|
|
$form->setType('bible', 'httpclick'); |
|
|
$form->setType('bible2', 'httpclick'); |
|
|
$form->setType('dossier', 'hidden'); |
|
|
$form->setType('libelle', 'hiddenstatic'); |
|
|
$form->setType('signataire_arrete','select'); |
|
|
if($maj==0){ // add |
|
|
$form->setType('instruction', 'hiddenstatic'); |
|
|
$form->setType('evenement', 'select'); |
|
|
$form->setType('date_evenement', 'date2'); |
|
|
}else{ // modify |
|
|
$form->setType('instruction', 'hiddenstatic'); |
|
|
$form->setType('evenement', 'hiddenstatic'); |
|
|
//$form->setType('date_evenement', 'hiddenstaticdate'); |
|
|
$form->setType('date_evenement', 'date2'); |
|
|
// necessaire pour calcul de date en modification |
|
|
$form->setType('delai', 'hiddenstatic'); |
|
|
} |
|
|
} elseif($maj==2){ |
|
|
$form->setType('dossier', 'hidden'); |
|
|
$form->setType('bible_auto', 'hidden'); |
|
|
$form->setType('bible', 'hidden'); |
|
|
$form->setType('bible2', 'hidden'); |
|
|
}else { |
|
|
$form->setType('destinataire', 'hidden'); |
|
|
$form->setType('dossier', 'hidden'); |
|
|
$form->setType('bible_auto', 'hidden'); |
|
|
$form->setType('bible', 'hidden'); |
|
|
$form->setType('bible2', 'hidden'); |
|
|
} |
|
|
$form->setType('complement3', 'hidden'); |
|
274 |
$form->setType('bible3', 'hidden'); |
$form->setType('bible3', 'hidden'); |
275 |
$form->setType('complement4', 'hidden'); |
$form->setType('complement4_om_html', 'hidden'); |
276 |
$form->setType('bible4', 'hidden'); |
$form->setType('bible4', 'hidden'); |
277 |
$form->setType('complement5', 'hidden'); |
$form->setType('complement5_om_html', 'hidden'); |
278 |
$form->setType('bible5', 'hidden'); |
$form->setType('bible5', 'hidden'); |
279 |
$form->setType('complement6', 'hidden'); |
$form->setType('complement6_om_html', 'hidden'); |
280 |
$form->setType('bible6', 'hidden'); |
$form->setType('bible6', 'hidden'); |
281 |
$form->setType('complement7', 'hidden'); |
$form->setType('complement7_om_html', 'hidden'); |
282 |
$form->setType('bible7', 'hidden'); |
$form->setType('bible7', 'hidden'); |
283 |
$form->setType('complement8', 'hidden'); |
$form->setType('complement8_om_html', 'hidden'); |
284 |
$form->setType('bible8', 'hidden'); |
$form->setType('bible8', 'hidden'); |
285 |
$form->setType('complement9', 'hidden'); |
$form->setType('complement9_om_html', 'hidden'); |
286 |
$form->setType('bible9', 'hidden'); |
$form->setType('bible9', 'hidden'); |
287 |
$form->setType('complement10', 'hidden'); |
$form->setType('complement10_om_html', 'hidden'); |
288 |
$form->setType('bible10', 'hidden'); |
$form->setType('bible10', 'hidden'); |
289 |
$form->setType('complement11', 'hidden'); |
$form->setType('complement11_om_html', 'hidden'); |
290 |
$form->setType('bible11', 'hidden'); |
$form->setType('bible11', 'hidden'); |
291 |
$form->setType('complement12', 'hidden'); |
$form->setType('complement12_om_html', 'hidden'); |
292 |
$form->setType('bible12', 'hidden'); |
$form->setType('bible12', 'hidden'); |
293 |
$form->setType('complement13', 'hidden'); |
$form->setType('complement13_om_html', 'hidden'); |
294 |
$form->setType('bible13', 'hidden'); |
$form->setType('bible13', 'hidden'); |
295 |
$form->setType('complement14', 'hidden'); |
$form->setType('complement14_om_html', 'hidden'); |
296 |
$form->setType('bible14', 'hidden'); |
$form->setType('bible14', 'hidden'); |
297 |
$form->setType('complement15', 'hidden'); |
$form->setType('complement15_om_html', 'hidden'); |
298 |
$form->setType('bible15', 'hidden'); |
$form->setType('bible15', 'hidden'); |
299 |
|
// |
300 |
$form->setType('delai', 'hidden'); |
$form->setType('delai', 'hidden'); |
301 |
$form->setType('etat', 'hidden'); |
$form->setType('etat', 'hidden'); |
302 |
$form->setType('accord_tacite', 'hidden'); |
$form->setType('accord_tacite', 'hidden'); |
303 |
$form->setType('action', 'hidden'); |
$form->setType('action', 'hidden'); |
304 |
$form->setType('delai_notification', 'hidden'); |
$form->setType('delai_notification', 'hidden'); |
305 |
$form->setType('avis_decision', 'hidden'); |
$form->setType('avis_decision', 'hidden'); |
306 |
|
$form->setType('autorite_competente', 'hidden'); |
307 |
|
// |
308 |
$form->setType('archive_delai', 'hidden'); |
$form->setType('archive_delai', 'hidden'); |
309 |
$form->setType('archive_etat', 'hidden'); |
$form->setType('archive_etat', 'hidden'); |
310 |
$form->setType('archive_accord_tacite', 'hidden'); |
$form->setType('archive_accord_tacite', 'hidden'); |
311 |
$form->setType('archive_avis', 'hidden'); |
$form->setType('archive_avis', 'hidden'); |
312 |
$form->setType('archive_date_complet', 'hidden'); |
$form->setType('archive_date_complet', 'hidden'); |
313 |
|
$form->setType('archive_date_dernier_depot', 'hidden'); |
314 |
$form->setType('archive_date_rejet', 'hidden'); |
$form->setType('archive_date_rejet', 'hidden'); |
315 |
$form->setType('archive_date_limite', 'hidden'); |
$form->setType('archive_date_limite', 'hidden'); |
316 |
$form->setType('archive_date_notification_delai', 'hidden'); |
$form->setType('archive_date_notification_delai', 'hidden'); |
318 |
$form->setType('archive_date_validite', 'hidden'); |
$form->setType('archive_date_validite', 'hidden'); |
319 |
$form->setType('archive_date_achevement', 'hidden'); |
$form->setType('archive_date_achevement', 'hidden'); |
320 |
$form->setType('archive_date_conformite', 'hidden'); |
$form->setType('archive_date_conformite', 'hidden'); |
321 |
$form->setType('archive_date_chantier', 'hidden'); |
$form->setType('archive_date_chantier', 'hidden'); |
322 |
|
$form->setType('archive_autorite_competente','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 |
|
|
336 |
|
// |
337 |
|
$form->setType('duree_validite','hidden'); |
338 |
|
$form->setType('duree_validite_parametrage','hidden'); |
339 |
|
if ($maj < 2) { //ajouter et modifier |
340 |
|
$form->setType('destinataire', 'hidden'); |
341 |
|
$form->setType('lettretype', 'hiddenstatic'); |
342 |
|
$form->setType('complement_om_html', 'html'); |
343 |
|
$form->setType('complement2_om_html', 'html'); |
344 |
|
$form->setType('bible_auto', 'httpclick'); |
345 |
|
$form->setType('bible', 'httpclick'); |
346 |
|
$form->setType('bible2', 'httpclick'); |
347 |
|
$form->setType('dossier', 'hidden'); |
348 |
|
$form->setType('libelle', 'hiddenstatic'); |
349 |
|
$form->setType('signataire_arrete','select'); |
350 |
|
$form->setType('date_envoi_signature','datedisabled'); |
351 |
|
$form->setType('date_retour_signature','datedisabled'); |
352 |
|
$form->setType('date_envoi_rar','datedisabled'); |
353 |
|
$form->setType('date_retour_rar','datedisabled'); |
354 |
|
$form->setType('date_envoi_controle_legalite','datedisabled'); |
355 |
|
$form->setType('date_retour_controle_legalite','datedisabled'); |
356 |
|
$form->setType('date_finalisation_courrier','datedisabled'); |
357 |
|
|
358 |
|
|
359 |
|
|
360 |
|
if($maj==0){ // add |
361 |
|
$form->setType('instruction', 'hidden'); |
362 |
|
$form->setType('lettretype', 'hidden'); |
363 |
|
$form->setType('evenement', 'select'); |
364 |
|
$form->setType('date_evenement', 'date2'); |
365 |
|
}else{ // modify |
366 |
|
$form->setType('instruction', 'hiddenstatic'); |
367 |
|
$form->setType('evenement', 'selecthiddenstatic'); |
368 |
|
//$form->setType('date_evenement', 'hiddenstaticdate'); |
369 |
|
$form->setType('date_evenement', 'date2'); |
370 |
|
// necessaire pour calcul de date en modification |
371 |
|
//$form->setType('delai', 'hiddenstatic'); |
372 |
|
// l'administrateur peut modifier les champs de retour de date |
373 |
|
if ($this->f->user_is_admin == true) { |
374 |
|
$form->setType('date_retour_signature','date'); |
375 |
|
$form->setType('date_retour_rar','date'); |
376 |
|
$form->setType('date_retour_controle_legalite','date'); |
377 |
|
} |
378 |
|
} |
379 |
|
} elseif($maj==2){ |
380 |
|
$form->setType('dossier', 'hidden'); |
381 |
|
$form->setType('bible_auto', 'hidden'); |
382 |
|
$form->setType('bible', 'hidden'); |
383 |
|
$form->setType('bible2', 'hidden'); |
384 |
|
}else { |
385 |
|
$form->setType('destinataire', 'hidden'); |
386 |
|
$form->setType('dossier', 'hidden'); |
387 |
|
$form->setType('bible_auto', 'hidden'); |
388 |
|
$form->setType('bible', 'hidden'); |
389 |
|
$form->setType('bible2', 'hidden'); |
390 |
|
} |
391 |
|
|
392 |
|
//Cache les champs pour la finalisation |
393 |
|
$form->setType('om_fichier_instruction', 'hidden'); |
394 |
|
$form->setType('om_final_instruction', 'hidden'); |
395 |
|
// Cache le document arrêté |
396 |
|
$form->setType('document_numerise', 'hidden'); |
397 |
|
|
398 |
|
//Masquer les champs date_envoi_controle_legalite et |
399 |
|
//date_retour_controle_legalite si ce n'est pas un arrêté |
400 |
|
if ( !is_numeric($this->getVal("avis_decision"))){ |
401 |
|
|
402 |
|
$form->setType("date_envoi_controle_legalite", "hidden"); |
403 |
|
$form->setType("date_retour_controle_legalite", "hidden"); |
404 |
|
} |
405 |
} |
} |
406 |
|
|
407 |
/*Met des valeurs choisies dans certains select du formulaire*/ |
function setSelect(&$form, $maj,&$db,$debug) { |
408 |
function setSelect(&$form, $maj,&$db,$DEBUG) { |
/** |
409 |
|
* On ne surcharge pas la méthode parent car une requête sur la table |
410 |
|
* dossier est mauvaise pour les performances, car la requête qui |
411 |
|
* concerne evenement est plus complexe que celle générée et car les |
412 |
|
* champs action, avis_decision et etat ne sont pas utilisés comme des |
413 |
|
* select |
414 |
|
*/ |
415 |
if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc.php")) |
if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc.php")) |
416 |
include ("../sql/".$db->phptype."/".$this->table.".form.inc.php"); |
include ("../sql/".$db->phptype."/".$this->table.".form.inc.php"); |
417 |
|
elseif(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc")) |
418 |
|
include ("../sql/".$db->phptype."/".$this->table.".form.inc"); |
419 |
|
|
420 |
parent::setSelect($form, $maj, $db, $DEBUG); |
//// action |
421 |
|
//$this->init_select($form, $db, $maj, $debug, "action", |
422 |
// *** evenement *** |
// $sql_action, $sql_action_by_id, false); |
423 |
$contenu=array(); |
|
424 |
// etat du dossier |
//// avis_decision |
425 |
$sql="select etat from ".DB_PREFIXE."dossier where dossier ='". |
//$this->init_select($form, $db, $maj, $debug, "avis_decision", |
426 |
$this->idxformulaire."'"; |
// $sql_avis_decision, $sql_avis_decision_by_id, false); |
427 |
$etat_dossier = $db->getOne($sql); |
|
428 |
// nature du dossier d'autorisation |
//// dossier |
429 |
$sql="select code from ".DB_PREFIXE."dossier |
//$this->init_select($form, $db, $maj, $debug, "dossier", |
430 |
INNER JOIN ".DB_PREFIXE."dossier_autorisation ON |
// $sql_dossier, $sql_dossier_by_id, false); |
431 |
dossier.dossier_autorisation = dossier_autorisation.dossier_autorisation |
|
432 |
INNER JOIN ".DB_PREFIXE."dossier_autorisation_type_detaille ON |
//// etat |
433 |
dossier_autorisation.dossier_autorisation_type_detaille = |
//$this->init_select($form, $db, $maj, $debug, "etat", |
434 |
dossier_autorisation_type_detaille.dossier_autorisation_type_detaille |
// $sql_etat, $sql_etat_by_id, false); |
435 |
WHERE dossier ='". |
|
436 |
$this->idxformulaire."'"; |
//// evenement |
437 |
$nature_dossier = $db->getOne($sql); |
//$this->init_select($form, $db, $maj, $debug, "evenement", |
438 |
|
// $sql_evenement, $sql_evenement_by_id, false); |
439 |
// recherche des evenement de transition |
|
440 |
// XXX modifier la requète après la modification de structure du workflow |
// signataire_arrete |
441 |
$sql= $sql_transition." where transition.etat ='".$etat_dossier."' and dossier='". |
$this->init_select($form, $db, $maj, $debug, "signataire_arrete", |
442 |
$this->idxformulaire."' order by evenement.action"; |
$sql_signataire_arrete, $sql_signataire_arrete_by_id, true); |
443 |
|
|
444 |
// *** attention en dur le CU |
/** |
445 |
$this->addToLog("setSelect(): db->query(\"".$sql."\");", VERBOSE_MODE); |
* Gestion du filtre sur les événements de workflow disponibles |
446 |
|
* On récupère ici en fonction de l'état du dossier d'instruction en |
447 |
|
* cours et du type du dossier d'instruction en cours la liste |
448 |
|
* événements disponibles. |
449 |
|
*/ |
450 |
|
if ($maj == 0) { |
451 |
|
// Récupération des événements par une jointure entre la table dossier |
452 |
|
// et la table transition et la table evenement et la table |
453 |
|
// lien_dossier_instruction_type_evenement en fonction de l'identifiant |
454 |
|
// du dossier d'instruction en cours |
455 |
|
$sql = "SELECT |
456 |
|
evenement.evenement, |
457 |
|
CONCAT(evenement.libelle, ' ['||evenement.action||']') as lib |
458 |
|
FROM ".DB_PREFIXE."dossier |
459 |
|
INNER JOIN ".DB_PREFIXE."lien_dossier_instruction_type_evenement |
460 |
|
ON dossier.dossier_instruction_type=lien_dossier_instruction_type_evenement.dossier_instruction_type |
461 |
|
INNER JOIN ".DB_PREFIXE."evenement |
462 |
|
ON evenement.evenement=lien_dossier_instruction_type_evenement.evenement |
463 |
|
INNER JOIN ".DB_PREFIXE."transition |
464 |
|
ON evenement.evenement = transition.evenement |
465 |
|
AND dossier.etat=transition.etat |
466 |
|
WHERE dossier.dossier='".$this->idxformulaire."' |
467 |
|
ORDER BY evenement.libelle, evenement.action"; |
468 |
|
$res = $db->query($sql); |
469 |
|
$this->addToLog("setSelect(): db->query(\"".$sql."\");", VERBOSE_MODE); |
470 |
|
if (database::isError($res)) { |
471 |
|
die($res->getMessage()); |
472 |
|
} |
473 |
|
// Remplissage du tableau du select |
474 |
|
$contenu = array( |
475 |
|
0 => array("",), |
476 |
|
1 => array(_('choisir')." "._('evenement'),) |
477 |
|
); |
478 |
|
while ($row=& $res->fetchRow()) { |
479 |
|
$contenu[0][] = $row[0]; |
480 |
|
$contenu[1][] = $row[1]; |
481 |
|
} |
482 |
|
$form->setSelect("evenement", $contenu); |
483 |
|
} else { |
484 |
|
$sql = "SELECT |
485 |
|
CONCAT(evenement.libelle, ' ['||evenement.action||']') as lib |
486 |
|
FROM ".DB_PREFIXE."evenement |
487 |
|
WHERE evenement.evenement=".$this->getVal("evenement").""; |
488 |
|
$res = $db->getone($sql); |
489 |
|
$this->addToLog("setSelect(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
490 |
|
if (database::isError($res)) { |
491 |
|
die($res->getMessage()); |
492 |
|
} |
493 |
|
// |
494 |
|
$contenu = array( |
495 |
|
0 => array($this->getVal("evenement"),), |
496 |
|
1 => array($res,) |
497 |
|
); |
498 |
|
$form->setSelect("evenement", $contenu); |
499 |
|
} |
500 |
|
|
501 |
$res = $db->query($sql); |
/** |
502 |
if (database::isError($res)) |
* Gesion des liens vers la bible |
503 |
die($res->getMessage()); |
*/ |
504 |
$contenu[0][0]=""; |
// lien bible_auto |
505 |
$contenu[1][0]=_('choisir')." "._('evenement'); |
$contenu = array(_("automatique")); |
|
$k=1; |
|
|
while ($row=& $res->fetchRow()){ |
|
|
if($maj==0){ // ajouter |
|
|
$contenu[0][$k]=$row[0]; |
|
|
$contenu[1][$k]=$row[1]; |
|
|
$k++; |
|
|
}else{ |
|
|
// select hiddenstatic |
|
|
$contenu[0][$k]=$row[0]; |
|
|
$contenu[1][$k]=$row[1]; |
|
|
$k++; |
|
|
} |
|
|
} |
|
|
$form->setSelect("evenement",$contenu); |
|
|
// lien bible_auto [link] |
|
|
$contenu=array(); |
|
|
$contenu[0]=" automatique "; |
|
506 |
$form->setSelect("bible_auto",$contenu); |
$form->setSelect("bible_auto",$contenu); |
507 |
// lien bible1 |
// lien bible1 |
508 |
$contenu=array(); |
$contenu = array(_("bible")); |
|
$contenu[0]=" Bible "; |
|
509 |
$form->setSelect("bible",$contenu); |
$form->setSelect("bible",$contenu); |
510 |
// lien bible2 |
// lien bible2 |
511 |
$contenu=array(); |
$contenu = array(_("bible")); |
|
$contenu[0]=" Bible "; |
|
512 |
$form->setSelect("bible2",$contenu); |
$form->setSelect("bible2",$contenu); |
513 |
} // function select |
} |
514 |
|
|
515 |
|
function cleSecondaire($id, &$db, $val, $DEBUG) { |
516 |
|
// |
517 |
|
parent::cleSecondaire($id, $db, $val, $DEBUG); |
518 |
|
|
519 |
|
$id = $this->getVal($this->clePrimaire); |
520 |
|
|
521 |
|
|
522 |
|
//Requête de vérification que cet événement d'instruction n'est pas lié |
523 |
|
//à la création d'un dossier d'instruction |
524 |
|
$sql = "SELECT demande_type.dossier_instruction_type |
525 |
|
FROM ".DB_PREFIXE."demande_type |
526 |
|
LEFT JOIN ".DB_PREFIXE."demande |
527 |
|
ON demande.demande_type = demande_type.demande_type |
528 |
|
WHERE demande.instruction_recepisse = ".$id; |
529 |
|
$res = $this->db->getOne($sql); |
530 |
|
$this->addToLog("cleSecondaire(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
531 |
|
if (database::isError($res)) { |
532 |
|
die($res->getMessage()); |
533 |
|
} |
534 |
|
|
535 |
|
// Aucune clé secondaire n'a été trouvée ou c'est un événement sans |
536 |
|
//création de dossier d'instruction, l'événement d'instruction peut être |
537 |
|
//supprimé |
538 |
|
if ( $this->correct !== false || $res == null || $res == ""){ |
539 |
|
|
540 |
|
// Requête de vérification que cet événement d'instruction est lié |
541 |
|
// à une demande |
542 |
|
$sql = "SELECT demande |
543 |
|
FROM ".DB_PREFIXE."demande |
544 |
|
WHERE instruction_recepisse = ".$id; |
545 |
|
$res = $this->db->getOne($sql); |
546 |
|
$this->addToLog("cleSecondaire(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
547 |
|
if (database::isError($res)) { |
548 |
|
die($res->getMessage()); |
549 |
|
} |
550 |
|
|
551 |
|
//Si c'est un événement d'instruction lié à une demande |
552 |
|
if ($res != null || $res != ""){ |
553 |
|
|
554 |
|
require_once "../obj/demande.class.php"; |
555 |
|
$demande = new demande($res, $this->db, DEBUG); |
556 |
|
|
557 |
|
//On met à jour la demande en supprimant la liaison vers |
558 |
|
//l'événement d'instruction |
559 |
|
$demande->setParameter("maj", 1); |
560 |
|
$valF = array(); |
561 |
|
foreach($demande->champs as $identifiant => $champ) { |
562 |
|
$valF[$champ] = $demande->val[$identifiant]; |
563 |
|
} |
564 |
|
$valF['date_demande']=$demande->dateDBToForm($valF['date_demande']); |
565 |
|
$valF['instruction_recepisse']=NULL; |
566 |
|
$ret = $demande->modifier($valF, $this->db, DEBUG); |
567 |
|
} |
568 |
|
|
569 |
|
/** |
570 |
|
* Vérification que l'élément supprimé est le dernier pour pouvoir |
571 |
|
* remodifier les données de manière itérative. |
572 |
|
*/ |
573 |
|
// Initialisation |
574 |
|
$dernierevenement = ""; |
575 |
|
// Récupération du dernier élément de la table d'instruction qui |
576 |
|
// concerne le dossier en cours |
577 |
|
$sql = "SELECT max(instruction) |
578 |
|
FROM ".DB_PREFIXE."instruction |
579 |
|
WHERE dossier ='".$this->idxformulaire."'"; |
580 |
|
$dernierevenement = $db->getOne($sql); |
581 |
|
$this->addToLog("setSelect(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
582 |
|
if (database::isError($dernierevenement)) { |
583 |
|
die($dernierevenement->getMessage()); |
584 |
|
} |
585 |
|
// Si on se trouve effectivement sur le dernier evenement d'instruction |
586 |
|
if ($dernierevenement == $id) { |
587 |
|
// Alors on valide la suppression |
588 |
|
$this->correct = true; |
589 |
|
$this->addToMessage(_('Destruction_chronologique')); |
590 |
|
} else { |
591 |
|
// Alors on annule la suppression |
592 |
|
$this->correct = false; |
593 |
|
$this->addToMessage(_("Seul le dernier evenement d'instruction peut etre supprime.")); |
594 |
|
} |
595 |
|
} |
596 |
|
} |
597 |
|
|
598 |
|
/** |
599 |
|
* Vérification de la possibilité ou non de modifier des dates de suivi |
600 |
|
* @param string $champ champ date à vérifier |
601 |
|
*/ |
602 |
|
function updateDate($champ) { |
603 |
|
|
604 |
|
//Si le retourformulaire est "dossier_instruction" |
605 |
|
if ($this->retourformulaire == "dossier_instruction") { |
606 |
|
|
607 |
|
// Vérification de la possibilité de modifier les dates si déjà éditées |
608 |
|
if($this->valF[$champ] != "" AND !$this->f->user_is_admin) { |
609 |
|
// si l'utilisateur n'est pas un admin |
610 |
|
if($this->getVal($champ) != "" AND $this->getVal($champ) != $this->valF[$champ]) { |
611 |
|
$this->correct = false; |
612 |
|
$this->addToMessage(_("Les dates de suivis ne peuvent etre modifiees")); |
613 |
|
} |
614 |
|
} |
615 |
|
} |
616 |
|
|
617 |
|
// |
618 |
|
return true; |
619 |
|
} |
620 |
|
|
621 |
|
// Sélectionne le signataire_arrete par défaut |
622 |
|
function setVal(&$form,$maj,$validation){ |
623 |
|
|
624 |
|
// Ajout |
625 |
|
if($maj == 0) { |
626 |
|
|
627 |
|
// Création de la requête |
628 |
|
$sql = "SELECT signataire_arrete |
629 |
|
FROM ".DB_PREFIXE."signataire_arrete |
630 |
|
WHERE defaut IS TRUE"; |
631 |
|
|
632 |
|
// Exécution de la requête |
633 |
|
$res = $this->f->db->query($sql); |
634 |
|
$this->f->addToLog("setVal(): db->query(\"".$sql."\");", VERBOSE_MODE); |
635 |
|
if ( database::isError($res)){ |
636 |
|
die(); |
637 |
|
} |
638 |
|
|
639 |
|
$row = $res->fetchrow(DB_FETCHMODE_ASSOC); |
640 |
|
|
641 |
|
if ( isset($row['signataire_arrete']) && is_numeric($row['signataire_arrete'])){ |
642 |
|
|
643 |
|
$form->setVal("signataire_arrete",$row['signataire_arrete']); |
644 |
|
} |
645 |
|
} |
646 |
|
} |
647 |
|
|
648 |
|
/*Met des valeurs par défaut dans certains des sous-formulaire*/ |
649 |
|
function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire){ |
650 |
|
if ($validation==0 and $maj<2) { |
651 |
|
if ($maj == 0){ |
652 |
|
$form->setVal("destinataire", $idxformulaire); |
653 |
|
$form->setVal("dossier", $idxformulaire); |
654 |
|
$form->setVal("date_evenement", date('Y-m-d')); |
655 |
|
} |
656 |
|
$form->setVal("bible_auto","bible_auto()"); |
657 |
|
$form->setVal("bible","bible()"); |
658 |
|
$form->setVal("bible2","bible2()"); |
659 |
|
} |
660 |
|
$this->retourformulaire=$retourformulaire; |
661 |
|
$this->idxformulaire=$idxformulaire; |
662 |
|
} |
663 |
|
|
664 |
|
|
665 |
function setLayout(&$form, $maj){ |
function setLayout(&$form, $maj){ |
666 |
if ( $maj < 2 OR $maj == 3 ) { |
if ( $maj < 2 OR $maj == 3 ) { |
668 |
$form->setBloc('evenement','D',"","col_12"); |
$form->setBloc('evenement','D',"","col_12"); |
669 |
|
|
670 |
$form->setFieldset('evenement','D',_('Evenement')); |
$form->setFieldset('evenement','D',_('Evenement')); |
|
$form->setBloc('evenement','D',"","group col_12"); |
|
|
$form->setBloc('date_evenement','F'); |
|
671 |
$form->setFieldset('lettretype','F',''); |
$form->setFieldset('lettretype','F',''); |
672 |
|
|
673 |
$form->setBloc('lettretype','F'); |
$form->setBloc('lettretype','F'); |
684 |
|
|
685 |
$form->setBloc('date_retour_controle_legalite','F'); |
$form->setBloc('date_retour_controle_legalite','F'); |
686 |
|
|
687 |
$form->setBloc('complement','D',"","col_12"); |
$form->setBloc('complement_om_html','D',"","col_12"); |
688 |
$form->setFieldset('complement','D',_('Complement')); |
$form->setFieldset('complement_om_html','D',_('Complement')); |
689 |
$form->setFieldset('bible','F',''); |
$form->setFieldset('bible','F',''); |
690 |
$form->setBloc('bible','F'); |
$form->setBloc('bible','F'); |
691 |
|
|
692 |
$form->setBloc('complement2','D',"","col_12"); |
$form->setBloc('complement2_om_html','D',"","col_12"); |
693 |
$form->setFieldset('complement2','D',_('Complement 2')); |
$form->setFieldset('complement2_om_html','D',_('Complement 2')); |
694 |
$form->setFieldset('bible2','F',''); |
$form->setFieldset('bible2','F',''); |
695 |
$form->setBloc('bible2','F'); |
$form->setBloc('bible2','F'); |
696 |
} |
} |
697 |
} |
} |
698 |
|
|
699 |
/*Change le libellé de certains champs*/ |
function setLib(&$form, $maj) { |
700 |
function setLib(&$form,$maj) { |
// |
701 |
parent :: setLib($form,$maj); |
parent::setLib($form, $maj); |
702 |
$form->setLib('libelle',' '); |
// |
703 |
$form->setLib('bible_auto',""); |
$form->setLib('bible_auto', ""); |
704 |
$form->setLib('bible',""); |
$form->setLib('bible', ""); |
705 |
$form->setLib('bible2',""); |
$form->setLib('bible2', ""); |
706 |
} |
} |
707 |
|
|
708 |
// ================================================================== |
function triggerajouter($id, &$db, $val, $DEBUG) { |
709 |
// trigger avant modification des données [trigger before modify data] |
/** |
710 |
// ================================================================== |
* Le code suivant permet de récupérer des valeurs des tables evenement |
711 |
function triggerajouter($id,&$db,$val,$DEBUG) { |
* et dossier pour les stocker dans l'instruction : |
712 |
// mise a jour instruction avec evenement |
* DEPUIS L'EVENEMENT |
713 |
// [modify instruction with evenement] |
* - action |
714 |
$sql= "select * from ".DB_PREFIXE."evenement where evenement =".$this->valF['evenement']; |
* - delai |
715 |
|
* - accord_tacite |
716 |
|
* - etat |
717 |
|
* - avis_decision |
718 |
|
* - delai_notification |
719 |
|
* - lettretype |
720 |
|
* - autorite_competente |
721 |
|
* DEPUIS LE DOSSIER D'INSTRUCTION |
722 |
|
* - archive_delai |
723 |
|
* - archive_accord_tacite |
724 |
|
* - archive_etat |
725 |
|
* - archive_avis |
726 |
|
* - date_complet |
727 |
|
* - date_rejet |
728 |
|
* - date_limite |
729 |
|
* - date_notification_delai |
730 |
|
* - date_decision |
731 |
|
* - date_validite |
732 |
|
* - date_achevement |
733 |
|
* - date_chantier |
734 |
|
* - date_conformite |
735 |
|
* - avis_decision |
736 |
|
* Il permet également de stocker la date_depot du dossier d'instruction |
737 |
|
* dans l'attribut $this->archive_date_depot de la classe. |
738 |
|
*/ |
739 |
|
// Récupération de tous les paramètres de l'événement sélectionné |
740 |
|
$sql = "SELECT * FROM ".DB_PREFIXE."evenement |
741 |
|
WHERE evenement=".$this->valF['evenement']; |
742 |
$res = $db->query($sql); |
$res = $db->query($sql); |
743 |
if (database::isError($res)) die($res->getMessage()); |
$this->addToLog("triggerajouter(): db->query(\"".$sql."\");", VERBOSE_MODE); |
744 |
|
if (database::isError($res)) { |
745 |
if ($DEBUG == 1) |
die($res->getMessage()); |
746 |
echo " la requete ".$sql." est exécutée<br>"; |
} |
747 |
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
748 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
// Récupération de l'identifiant de l'action |
749 |
|
// si une action est paramétrée dans l'événement |
750 |
if(isset($row['action']) and !empty($row['action'])) { |
$this->valF['action'] = NULL; |
751 |
|
if (isset($row['action']) and !empty($row['action'])) { |
752 |
$this->valF['action']=$row['action']; |
$this->valF['action']=$row['action']; |
|
} else { |
|
|
$this->valF['action']=NULL; |
|
753 |
} |
} |
754 |
$this->valF['delai']=$row['delai']; |
// Récupération de la valeur du délai |
755 |
if(isset($row['etat']) and !empty($row['etat'])) { |
$this->valF['delai'] = $row['delai']; |
756 |
|
// Récupération de l'identifiant de l'état |
757 |
|
// si un état est paramétré dans l'événement |
758 |
|
$this->valF['etat']=NULL; |
759 |
|
if (isset($row['etat']) and !empty($row['etat'])) { |
760 |
$this->valF['etat']=$row['etat']; |
$this->valF['etat']=$row['etat']; |
|
} else { |
|
|
$this->valF['etat']=NULL; |
|
761 |
} |
} |
762 |
|
// Récupération de la valeur d'accord tacite |
763 |
$this->valF['accord_tacite']=$row['accord_tacite']; |
$this->valF['accord_tacite']=$row['accord_tacite']; |
764 |
|
// Récupération de la valeur du délai de notification |
765 |
$this->valF['delai_notification']=$row['delai_notification']; |
$this->valF['delai_notification']=$row['delai_notification']; |
766 |
|
// Récupération de l'identifiant de l'avis |
767 |
|
// si un avis est paramétré dans l'événement |
768 |
|
$this->valF['avis_decision'] = NULL; |
769 |
if(isset($row['avis_decision']) and !empty($row['avis_decision'])) { |
if(isset($row['avis_decision']) and !empty($row['avis_decision'])) { |
770 |
$this->valF['avis_decision']=$row['avis_decision']; |
$this->valF['avis_decision']=$row['avis_decision']; |
|
} else { |
|
|
$this->valF['avis_decision']=NULL; |
|
771 |
} |
} |
772 |
if($row['lettretype']!="") |
// Récupération de la valeur de l'autorité compétente |
773 |
$this->valF['lettretype']=$row['lettretype']; |
// si l'autorité compétente est paramétré dans l'événement |
774 |
else |
$this->valF['autorite_competente'] = NULL; |
775 |
$this->valF['lettretype']="standard"; |
if(isset($row['autorite_competente']) and !empty($row['autorite_competente'])) { |
776 |
|
$this->valF['autorite_competente']=$row['autorite_competente']; |
777 |
} |
} |
778 |
$sql= "select * from ".DB_PREFIXE."dossier where dossier = '".$this->valF['dossier']."'"; |
// Récupération de la valeur de la lettre type |
779 |
|
$this->valF['lettretype']=$row['lettretype']; |
780 |
|
} |
781 |
|
// Récupération de toutes les valeurs du dossier d'instruction en cours |
782 |
|
$sql = "SELECT * FROM ".DB_PREFIXE."dossier |
783 |
|
WHERE dossier='".$this->valF['dossier']."'"; |
784 |
$res = $db->query($sql); |
$res = $db->query($sql); |
785 |
if (database::isError($res)) |
$this->addToLog("triggerajouter(): db->query(\"".$sql."\");", VERBOSE_MODE); |
786 |
|
if (database::isError($res)) { |
787 |
die($res->getMessage()); |
die($res->getMessage()); |
|
if ($DEBUG == 1) |
|
|
echo " la requete ".$sql." est exécutée<br>"; |
|
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
|
|
// |
|
|
$this->archive_date_depot = $row['date_depot']; |
|
|
// archive en instruction (si suppression) |
|
|
$this->valF['archive_delai']=$row['delai']; |
|
|
$this->valF['archive_accord_tacite']=$row['accord_tacite']; |
|
|
$this->valF['archive_etat']=$row['etat']; |
|
|
$this->valF['archive_avis']=$row['avis_decision']; |
|
|
// compatibilite pgsql |
|
|
if($row['date_complet']!='') |
|
|
$this->valF['archive_date_complet']=$row['date_complet']; |
|
|
if($row['date_rejet']!='') |
|
|
$this->valF['archive_date_rejet']= $row['date_rejet']; |
|
|
if($row['date_limite']!='') |
|
|
$this->valF['archive_date_limite']= $row['date_limite']; |
|
|
if($row['date_notification_delai']!='') |
|
|
$this->valF['archive_date_notification_delai']= $row['date_notification_delai']; |
|
|
if($row['date_decision']!='') |
|
|
$this->valF['archive_date_decision']= $row['date_decision']; |
|
|
if($row['date_validite']!='') |
|
|
$this->valF['archive_date_validite']= $row['date_validite']; |
|
|
if($row['date_achevement']!='') |
|
|
$this->valF['archive_date_achevement']= $row['date_achevement']; |
|
|
if($row['date_chantier']!='') |
|
|
$this->valF['archive_date_chantier']= $row['date_chantier']; |
|
|
if($row['date_conformite']!='') |
|
|
$this->valF['archive_date_conformite']= $row['date_conformite']; |
|
788 |
} |
} |
789 |
|
$row=& $res->fetchRow(DB_FETCHMODE_ASSOC); |
790 |
|
$this->updateArchiveData($row); |
791 |
|
$this->archive_date_depot = $row['date_depot']; |
792 |
|
|
793 |
|
// Récupération de la duree de validite du dossier d'autorisation |
794 |
|
$sql = "SELECT duree_validite_parametrage |
795 |
|
FROM ".DB_PREFIXE."dossier_autorisation_type_detaille |
796 |
|
LEFT JOIN ".DB_PREFIXE."dossier_autorisation |
797 |
|
ON dossier_autorisation.dossier_autorisation_type_detaille = dossier_autorisation_type_detaille.dossier_autorisation_type_detaille |
798 |
|
LEFT JOIN ".DB_PREFIXE."dossier |
799 |
|
ON dossier.dossier_autorisation = dossier_autorisation.dossier_autorisation |
800 |
|
WHERE dossier.dossier='".$this->valF['dossier']."'"; |
801 |
|
$duree_validite_parametrage = $db->getOne($sql); |
802 |
|
$this->addToLog("triggerajouter(): db->getOne(\"".$sql."\");", VERBOSE_MODE); |
803 |
|
database::isError($duree_validite_parametrage); |
804 |
|
if ($duree_validite_parametrage != '') { |
805 |
|
$this->valF['duree_validite_parametrage']= $duree_validite_parametrage; |
806 |
|
} |
807 |
|
|
808 |
|
// Identifiant du type de courrier |
809 |
|
$idTypeCourrier = '11'; |
810 |
|
$idCourrier = str_pad($this->valF["instruction"], 10, "0", STR_PAD_LEFT); |
811 |
|
// Code barres |
812 |
|
$this->valF["code_barres"] = $idTypeCourrier . $idCourrier; |
813 |
} |
} |
814 |
|
|
815 |
// Test si une restriction est valide |
// Test si une restriction est valide |
816 |
// return boolean |
// return boolean |
817 |
function restrictionIsValid($restriction){ |
function restrictionIsValid($restriction){ |
818 |
|
|
819 |
/* Met des espace avant et après les opérateurs puis transforme la chaine en |
// Liste des opérateurs possible |
820 |
* un tableau */ |
$operateurs = array(">=", "<=", "+", "-"); |
821 |
$tabRestriction = str_replace(">="," >= ", |
// Liste des opérateurs avec espace |
822 |
str_replace("<="," <= ", |
$operateurs_blank = array(" >= ", " <= ", " + ", " - "); |
823 |
str_replace("-"," - ", |
|
824 |
str_replace("+"," + ",$restriction)))); |
// Supprime tous les espaces de la chaîne de caractère |
825 |
$tabRestriction = explode( " ", $tabRestriction); |
$restriction = str_replace(' ', '', $restriction); |
826 |
|
|
827 |
//Variables de résultat |
// Met des espace avant et après les opérateurs puis transforme la |
828 |
|
// chaine en un tableau |
829 |
|
$tabRestriction = str_replace($operateurs, $operateurs_blank, |
830 |
|
$restriction); |
831 |
|
$tabRestriction = explode(" ", $tabRestriction); |
832 |
|
|
833 |
|
// Tableau comprenant les résultat |
834 |
$res = array(); |
$res = array(); |
835 |
$i = 0; |
// Compteur pour les résultat |
836 |
$comp = ""; |
// commence à 1 car le 0 doit rester inchangé tout au long du traitement |
837 |
|
$j = 1; |
838 |
|
// Comparateur du calcul |
839 |
//Test que le tableau n'est pas vide |
$comparateur = ''; |
840 |
if ( count($tabRestriction) > 0 ){ |
// Booléen retourné |
841 |
|
$res_bool = true; |
842 |
$res[0] = $this->getRestrictionValue($tabRestriction[0]); |
|
843 |
|
// S'il y a un comparateur |
844 |
//Calcul des variables |
if (in_array(">=", $tabRestriction) |
845 |
for ( $j = 1 ; $j < count($tabRestriction) ; $j += 2 ) { |
|| in_array("<=", $tabRestriction)) { |
846 |
|
|
847 |
//Variable de comparaison |
// Si le tableau n'est pas vide |
848 |
if ( strcmp( ">=", $tabRestriction[$j] ) == 0 || |
if (count($tabRestriction) > 0) { |
849 |
strcmp( "<=", $tabRestriction[$j]) ==0 ){ |
|
850 |
|
// Boucle dans le tableau pour récupérer seulement les valeurs |
851 |
|
foreach ($tabRestriction as $key => $value) { |
852 |
|
|
853 |
$comp = $tabRestriction[$j]; |
// |
854 |
$res[++$i] = $this->getRestrictionValue($tabRestriction[$j+1]); |
if (!in_array($value, $operateurs)) { |
855 |
|
if ($this->getRestrictionValue($value) != false) { |
856 |
|
$res[] = $this->getRestrictionValue($value); |
857 |
|
} else { |
858 |
|
// Message d'erreur |
859 |
|
$error_message = sprintf(_("Le champ %s de l'instruction %s est vide"), "<span class='bold'>".$value."</span>", "<span class='bold'>".$this->valF["instruction"]."</span>"); |
860 |
|
$this->addToMessage($error_message); |
861 |
|
// Arrête le traitement |
862 |
|
return false; |
863 |
|
} |
864 |
|
} |
865 |
} |
} |
866 |
// Fait l'addition |
|
867 |
elseif ( strcmp( "+", $tabRestriction[$j]) == 0 ){ |
// Boucle dans le tableau |
868 |
|
// commence à 1 car le 0 doit rester inchangé tout au long du |
869 |
|
// traitement |
870 |
|
for ($i = 1; $i<count($tabRestriction); $i++) { |
871 |
|
|
872 |
$res[$i] = $this->moisdate( $res[$i], $this->getRestrictionValue($tabRestriction[$j+1]) ); |
// Récupère le comparateur |
873 |
|
if ($tabRestriction[$i] === ">=" |
874 |
|
|| $tabRestriction[$i] === "<=") { |
875 |
|
$comparateur = $tabRestriction[$i]; |
876 |
|
} |
877 |
|
|
878 |
|
// Si l'opérateur qui suit est un "+" |
879 |
|
if ($tabRestriction[$i] === "+") { |
880 |
|
$dateDep = $res[$j]; |
881 |
|
unset($res[$j]);$j++; |
882 |
|
$duree = $res[$j]; |
883 |
|
unset($res[$j]); |
884 |
|
$res[$j] = $this->f->mois_date($dateDep, $duree, "+"); |
885 |
|
} |
886 |
|
|
887 |
|
// Si l'opérateur qui suit est un "-" |
888 |
|
if ($tabRestriction[$i] === "-") { |
889 |
|
$dateDep = $res[$j]; |
890 |
|
unset($res[$j]);$j++; |
891 |
|
$duree = $res[$j]; |
892 |
|
unset($res[$j]); |
893 |
|
$res[$j] = $this->f->mois_date($dateDep, $duree, "-"); |
894 |
|
} |
895 |
} |
} |
|
} |
|
|
} |
|
|
|
|
|
// Effectue le test |
|
|
if ( strcmp($comp, ">=") == 0 ){ |
|
|
|
|
|
if ( $res[0] >= $res[1] || $res[0] == "" ){ |
|
|
|
|
|
return true; |
|
|
} |
|
|
else { |
|
896 |
|
|
|
return false; |
|
897 |
} |
} |
|
} |
|
|
elseif ( strcmp($comp, "<=") == 0 ){ |
|
898 |
|
|
899 |
if ( $res[0] <= $res[1] || $res[1] == "" ){ |
// Si les tableau des résultats n'est pas vide |
900 |
|
if (count($res) > 0) { |
901 |
|
// |
902 |
|
$res_bool = false; |
903 |
|
// Effectue le test |
904 |
|
if ($comparateur === ">=") { |
905 |
|
// |
906 |
|
if (strtotime($res[0]) >= strtotime($res[$j])) { |
907 |
|
$res_bool = true; |
908 |
|
} |
909 |
|
} |
910 |
|
if ($comparateur === "<=") { |
911 |
|
|
912 |
return true; |
if (strtotime($res[0]) <= strtotime($res[$j])) { |
913 |
|
$res_bool = true; |
914 |
|
} |
915 |
|
} |
916 |
} |
} |
917 |
else { |
// Sinon une erreur s'affiche |
918 |
|
} else { |
919 |
|
|
920 |
return false; |
// Message d'erreur |
921 |
} |
$error_message = _("La restriction est sans comparateur"); |
922 |
|
$this->addToMessage($error_message); |
923 |
|
// Arrête le traitement |
924 |
|
return false; |
925 |
} |
} |
926 |
|
|
927 |
return true; |
return $res_bool; |
928 |
|
|
929 |
} |
} |
930 |
|
|
931 |
//Retourne la valeur de valF si $restrictionValue n'est pas un chiffre, le chiffre sinon |
/** |
932 |
|
* Récupère la valeur du champ dans la restriction |
933 |
|
* @param string $restrictionValue Nom du champ |
934 |
|
* @return mixed Valeur du champ |
935 |
|
*/ |
936 |
function getRestrictionValue($restrictionValue){ |
function getRestrictionValue($restrictionValue){ |
937 |
|
|
938 |
return ( is_numeric($restrictionValue) ) ? |
// Initialisation de la valeur de retour |
939 |
$restrictionValue : |
$return = false; |
940 |
$this->valF[$restrictionValue]; |
|
941 |
|
// Récupére les valeurs du dossier |
942 |
|
$value_dossier = $this->get_dossier_actual(); |
943 |
|
|
944 |
|
// |
945 |
|
if (is_numeric($restrictionValue)) { |
946 |
|
$return = $restrictionValue; |
947 |
|
}elseif (isset($value_dossier[$restrictionValue])) { |
948 |
|
$return = $value_dossier[$restrictionValue]; |
949 |
|
}elseif (isset($this->valF[$restrictionValue])) { |
950 |
|
$return = $this->valF[$restrictionValue]; |
951 |
|
} |
952 |
|
|
953 |
|
// Retourne la valeur du champ |
954 |
|
return $return; |
955 |
} |
} |
956 |
|
|
957 |
function regle($regle){ |
/** |
958 |
$temp = explode ("+",$regle); |
* Calcul des règle d'action. |
959 |
//echo '|'.$regle; |
* @param string $rule Règle d'action |
960 |
// cas rejet |
* @param string $rule_name Nom de la règle |
961 |
if($regle=="null") // 1 dimension -> null |
* @param string $type Type de la règle |
962 |
|
* |
963 |
|
* @return mixed Résultat de la règle |
964 |
|
*/ |
965 |
|
function regle($rule, $rule_name, $type = null) { |
966 |
|
|
967 |
|
// Supprime tous les espaces de la chaîne de caractère |
968 |
|
$rule = str_replace(' ', '', $rule); |
969 |
|
// Coupe la chaîne au niveau de l'opérateur |
970 |
|
$operands = explode ("+", $rule); |
971 |
|
// Nombre d'opérande |
972 |
|
$nb_operands = count($operands); |
973 |
|
|
974 |
|
// Règle à null |
975 |
|
if ($rule == "null") { |
976 |
return null; |
return null; |
|
if(sizeof($temp)==1) // 1 dimension |
|
|
if($temp[0]=="archive_date_depot") // initialisation avec le depot |
|
|
return $this->$regle; |
|
|
else // cas general |
|
|
return $this->valF[$regle]; |
|
|
if(sizeof($temp)==2){ // 2 dimensions |
|
|
if($temp[0]=="archive_date_depot") //initialisation avec le depot |
|
|
if(is_numeric($temp[1])) |
|
|
return $this->moisdate($this->$temp[0], $temp[1]); |
|
|
else |
|
|
return $this->moisdate($this->$temp[0], $this->valF[$temp[1]]); |
|
|
if($temp[0]=="archive_delai") // majoration de delai |
|
|
return $this->valF[$temp[0]]+$this->valF[$temp[1]]; |
|
|
// cas general 2 dimensions |
|
|
if(is_numeric($temp[1])) |
|
|
return $this->moisdate($this->valF[$temp[0]], $temp[1]); |
|
|
else |
|
|
return $this->moisdate($this->valF[$temp[0]], $this->valF[$temp[1]]); |
|
|
} |
|
|
if(sizeof($temp)==3){ // 3 dimensions |
|
|
// cas date de validite de sursis |
|
|
if(is_numeric($temp[1])) |
|
|
$temp1 = $this->moisdate($this->valF[$temp[0]], $temp[1]); |
|
|
else |
|
|
$temp1 = $this->moisdate($this->valF[$temp[0]], $this->valF[$temp[1]]); |
|
|
if(is_numeric($temp[2])) |
|
|
return $this->moisdate($temp1, $temp[2]); |
|
|
else |
|
|
return $this->moisdate($temp1, $this->valF[$temp[2]]); |
|
977 |
} |
} |
978 |
|
|
979 |
|
// Si c'est une règle spécifique |
980 |
|
if ($rule_name == "regle_autorite_competente" |
981 |
|
|| $rule_name == "regle_etat" |
982 |
|
|| $rule_name == "regle_accord_tacite" |
983 |
|
|| $rule_name == "regle_avis") { |
984 |
|
// |
985 |
|
return $this->valF[$rule]; |
986 |
|
} |
987 |
|
|
988 |
|
// Tableau des champs de type date |
989 |
|
$rule_type_date = array( |
990 |
|
"regle_date_limite", |
991 |
|
"regle_date_notification_delai", |
992 |
|
"regle_date_complet", |
993 |
|
"regle_date_validite", |
994 |
|
"regle_date_decision", |
995 |
|
"regle_date_chantier", |
996 |
|
"regle_date_achevement", |
997 |
|
"regle_date_conformite", |
998 |
|
"regle_date_rejet", |
999 |
|
"regle_date_dernier_depot", |
1000 |
|
"regle_date_limite_incompletude", |
1001 |
|
); |
1002 |
|
// Tableau des champs de type numérique |
1003 |
|
$rule_type_numeric = array( |
1004 |
|
"regle_delai", |
1005 |
|
"regle_delai_incompletude", |
1006 |
|
); |
1007 |
|
|
1008 |
|
// Définit le type du champ |
1009 |
|
if (in_array($rule_name, $rule_type_date) == true) { |
1010 |
|
$type = "date"; |
1011 |
|
} |
1012 |
|
if (in_array($rule_name, $rule_type_numeric) == true) { |
1013 |
|
$type = "numeric"; |
1014 |
|
} |
1015 |
|
|
1016 |
|
// Initialisation des variables |
1017 |
|
$key_date = 0; |
1018 |
|
$total_numeric = 0; |
1019 |
|
|
1020 |
|
// Pour chaque opérande |
1021 |
|
foreach ($operands as $key => $operand) { |
1022 |
|
|
1023 |
|
// Si c'est une règle de type date |
1024 |
|
if ($type == 'date') { |
1025 |
|
// Vérifie si au moins une des opérandes est une date |
1026 |
|
if (!is_numeric($operand) |
1027 |
|
&& isset($this->valF[$operand]) |
1028 |
|
&& $this->f->check_date($this->valF[$operand]) == true) { |
1029 |
|
// Récupère la position de la date |
1030 |
|
$key_date = $key; |
1031 |
|
} |
1032 |
|
// Les autres opérandes doivent être que des numériques |
1033 |
|
if (is_numeric($operand) == true) { |
1034 |
|
// Ajoute l'opérande au total |
1035 |
|
$total_numeric += $operand; |
1036 |
|
} |
1037 |
|
if (!is_numeric($operand) |
1038 |
|
&& isset($this->valF[$operand]) |
1039 |
|
&& is_numeric($this->valF[$operand]) == true) { |
1040 |
|
// Ajoute l'opérande au total |
1041 |
|
$total_numeric += $this->valF[$operand]; |
1042 |
|
} |
1043 |
|
} |
1044 |
|
|
1045 |
|
// Si c'est une règle de type numérique |
1046 |
|
if ($type == 'numeric') { |
1047 |
|
// Les opérandes doivent être que des numériques |
1048 |
|
if (is_numeric($operand) == true) { |
1049 |
|
// Ajoute l'opérande au total |
1050 |
|
$total_numeric += $operand; |
1051 |
|
} |
1052 |
|
if (!is_numeric($operand) |
1053 |
|
&& isset($this->valF[$operand]) |
1054 |
|
&& is_numeric($this->valF[$operand]) == true) { |
1055 |
|
// Ajoute l'opérande au total |
1056 |
|
$total_numeric += $this->valF[$operand]; |
1057 |
|
} |
1058 |
|
} |
1059 |
|
} |
1060 |
|
|
1061 |
|
// Résultat pour une règle de type date |
1062 |
|
if ($type == 'date') { |
1063 |
|
// Retourne le calcul de la date |
1064 |
|
return $this->f->mois_date($this->valF[$operands[$key_date]], |
1065 |
|
$total_numeric, "+"); |
1066 |
|
} |
1067 |
|
|
1068 |
|
// Résultat pour une règle de type numérique |
1069 |
|
if ($type == 'numeric') { |
1070 |
|
// Retourne le calcul |
1071 |
|
return $total_numeric; |
1072 |
|
} |
1073 |
|
|
1074 |
} |
} |
1075 |
|
|
|
|
|
|
|
|
|
// ================================================================== |
|
|
// valeur dossier apres modification [values dossier after action] |
|
|
// ================================================================== |
|
1076 |
function triggerajouterapres($id,&$db,$val,$DEBUG) { |
function triggerajouterapres($id,&$db,$val,$DEBUG) { |
1077 |
// mise a null au lieu de "" / voir compatibilite mysql |
/** |
1078 |
// voir parametrage CU en dur |
* Mise à jour des valeurs du dossier en fonction des valeurs calculées |
1079 |
// voir parametrage des actions en dur |
* par l'action |
1080 |
$param=1; |
*/ |
1081 |
if($param==1){ |
$this->getValEvenement(); |
1082 |
$sql="select * from ".DB_PREFIXE."action where action = '".$this->valF['action']."'"; |
// Initialisation |
1083 |
$res = $db->query($sql); |
$valF = ""; |
1084 |
if (database::isError($res)) |
// état de complétude actuel du dossier |
1085 |
die($res->getMessage()); |
$incompletude = $this->dossierIncomplet(); |
1086 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
|
1087 |
if($row['regle_etat']!=''){ |
if($incompletude === FALSE) { |
1088 |
$valF['etat']= $this->regle($row['regle_etat']); |
// Si l'événement d'instruction est de type incompletude |
1089 |
} |
if($this->valEvenement['type'] == "incompletude") { |
1090 |
if($row['regle_delai']!=''){ |
// On marque le dossier en incomplétude pour application des actions |
1091 |
$valF['delai']= $this->regle($row['regle_delai']); |
$incompletude = TRUE; |
1092 |
} |
// Set du flag incomplétude de la table dossier |
1093 |
if($row['regle_accord_tacite']!=''){ |
$valF['incompletude'] = TRUE; |
1094 |
$valF['accord_tacite']= $this->regle($row['regle_accord_tacite']); |
// Enregistrement de l'état dans la variable provisoire |
1095 |
} |
$valF['etat_pendant_incompletude'] = $this->valF['archive_etat']; |
1096 |
if($row['regle_avis']!=''){ |
} |
1097 |
$valF['avis_decision']= $this->regle($row['regle_avis']); |
} else { |
1098 |
} |
// Si l'evenement d'instruction est de type retour ou contient une |
1099 |
if($row['regle_date_limite']!=''){ |
// decision, on sort d'incomplétude |
1100 |
$valF['date_limite']= $this->regle($row['regle_date_limite']); |
if($this->valEvenement['type'] == "retour" OR |
1101 |
} |
$this->valEvenement['avis_decision'] != NULL) { |
1102 |
if($row['regle_date_complet']!=''){ |
// On enlève la marque d'incomplétude pour application des actions |
1103 |
$valF['date_complet']= $this->regle($row['regle_date_complet']); |
$incompletude = FALSE; |
1104 |
} |
// On enlève le flag d'incomplétude sur l'enregistrement de la table dossier |
1105 |
if($row['regle_date_notification_delai']!=''){ |
$valF['incompletude'] = FALSE; |
1106 |
$valF['date_notification_delai']= $this->regle($row['regle_date_notification_delai']); |
// Restauration de l'état depuis l'état provisoire |
1107 |
} |
$valF['etat'] = $this->valF['archive_etat_pendant_incompletude']; |
1108 |
if($row['regle_date_decision']!=''){ |
// On vide la variable provisoire ainsi que le délai de complétude |
1109 |
$valF['date_decision']= $this->regle($row['regle_date_decision']); |
// et la date limite de complétude |
1110 |
} |
$valF['etat_pendant_incompletude'] = NULL; |
1111 |
if($row['regle_date_rejet']!=''){ |
$valF['delai_incompletude'] = NULL; |
1112 |
$valF['date_rejet']= $this->regle($row['regle_date_rejet']); |
$valF['date_limite_incompletude'] = NULL; |
1113 |
} |
} |
1114 |
if($row['regle_date_validite']!=''){ |
} |
1115 |
$valF['date_validite']= $this->regle($row['regle_date_validite']); |
// Récupération des paramètres de l'action |
1116 |
} |
$sql = "SELECT * FROM ".DB_PREFIXE."action |
1117 |
if($row['regle_date_chantier']!=''){ |
WHERE action='".$this->valF['action']."'"; |
1118 |
$valF['date_chantier']= $this->regle($row['regle_date_chantier']); |
$res = $db->query($sql); |
1119 |
} |
$this->addToLog("triggerajouterapres(): db->query(\"".$sql."\");", VERBOSE_MODE); |
1120 |
if($row['regle_date_achevement']!=''){ |
if (database::isError($res)) { |
1121 |
$valF['date_achevement']= $this->regle($row['regle_date_achevement']); |
die($res->getMessage()); |
1122 |
} |
} |
1123 |
if($row['regle_date_conformite']!=''){ |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
1124 |
$valF['date_conformite']= $this->regle($row['regle_date_conformite']); |
|
1125 |
} |
// pour chacune des regles, on applique la regle |
1126 |
|
if($row['regle_delai']!=''){ |
1127 |
// Appel des méthode stockées dans le champ methode_trigger |
$valF['delai'] = $this->regle($row['regle_delai'], 'regle_delai'); |
1128 |
if($row['methode_trigger'] != "") { |
} |
1129 |
foreach (explode(";", $row['methode_trigger']) as $methode) { |
if($row['regle_accord_tacite']!=''){ |
1130 |
if(method_exists($this, $methode)) { |
$valF['accord_tacite'] = $this->regle($row['regle_accord_tacite'], 'regle_accord_tacite'); |
1131 |
$this->$methode(); |
} |
1132 |
} |
if($row['regle_avis']!=''){ |
1133 |
|
$valF['avis_decision'] = $this->regle($row['regle_avis'], 'regle_avis'); |
1134 |
} |
} |
1135 |
} |
if($row['regle_date_limite']!=''){ |
1136 |
} |
$valF['date_limite']= $this->regle($row['regle_date_limite'], 'regle_date_limite'); |
1137 |
}else{ |
} |
1138 |
switch ($this->valF['action']) { |
if($row['regle_date_complet']!=''){ |
1139 |
case "initialisation" : |
$valF['date_complet']= $this->regle($row['regle_date_complet'], 'regle_date_complet'); |
1140 |
$valF['delai']= $this->valF['delai']; |
} |
1141 |
$valF['etat']= $this->valF['etat']; |
if($row['regle_date_dernier_depot']!=''){ |
1142 |
$valF['accord_tacite']= $this->valF['accord_tacite']; |
$valF['date_dernier_depot']= $this->regle($row['regle_date_dernier_depot'], 'regle_date_dernier_depot'); |
1143 |
// la date_complet est la date de depot |
} |
1144 |
$valF['date_complet']= $this->archive_date_depot; // **** |
if($row['regle_date_notification_delai']!=''){ |
1145 |
$valF['date_limite'] = $this->moisdate($valF['date_complet'],$valF['delai']); |
$valF['date_notification_delai']= $this->regle($row['regle_date_notification_delai'], 'regle_date_notification_delai'); |
1146 |
$valF['date_notification_delai'] = $this->moisdate($valF['date_complet'],1); |
} |
1147 |
break; |
if($row['regle_date_decision']!=''){ |
1148 |
case "notification" : |
$valF['date_decision']= $this->regle($row['regle_date_decision'], 'regle_date_decision'); |
1149 |
$valF['delai']= $this->valF['delai']; |
} |
1150 |
$valF['etat']= $this->valF['etat']; |
if($row['regle_date_rejet']!=''){ |
1151 |
$valF['accord_tacite']= $this->valF['accord_tacite']; |
$valF['date_rejet']= $this->regle($row['regle_date_rejet'], 'regle_date_rejet'); |
1152 |
// la date_complet est celle precedemment saisie |
} |
1153 |
$valF['date_complet']=$this->valF['archive_date_complet']; |
if($row['regle_date_validite']!=''){ |
1154 |
$valF['date_limite'] = $this->moisdate($valF['date_complet'],$valF['delai']); |
$valF['date_validite']= $this->regle($row['regle_date_validite'], 'regle_date_validite'); |
1155 |
$valF['date_notification_delai'] = $this->moisdate($valF['date_complet'],1); |
} |
1156 |
// la date du courrier ne doit pas etre depasse par rapport au delai de |
if($row['regle_date_chantier']!=''){ |
1157 |
// notification [verify notification date] |
$valF['date_chantier']= $this->regle($row['regle_date_chantier'], 'regle_date_chantier'); |
1158 |
if($this->valF['archive_date_notification_delai']<$this->valF['date_evenement']) |
} |
1159 |
$this->msg=$this->msg."<br><img src='../img/erreur.gif'> "._("date_notification_delai")." ". |
if($row['regle_date_achevement']!=''){ |
1160 |
$this->valF['archive_date_notification_delai']." < "._('date_evenement'); |
$valF['date_achevement']= $this->regle($row['regle_date_achevement'], 'regle_date_achevement'); |
1161 |
// |
} |
1162 |
break; |
if($row['regle_date_conformite']!=''){ |
1163 |
case "retour" : |
$valF['date_conformite']= $this->regle($row['regle_date_conformite'], 'regle_date_conformite'); |
1164 |
$valF['delai']= $this->valF['delai']; |
} |
1165 |
$valF['etat']= $this->valF['etat']; |
if($row['regle_date_limite_incompletude']!=''){ |
1166 |
$valF['accord_tacite']= $this->valF['accord_tacite']; |
$valF['date_limite_incompletude']= $this->regle($row['regle_date_limite_incompletude'], 'regle_date_limite_incompletude'); |
1167 |
// la date_complet est celle de l evenement |
} |
1168 |
$valF['date_complet']= $this->valF['date_evenement']; |
if($row['regle_delai_incompletude']!=''){ |
1169 |
$valF['date_limite'] = $this->moisdate($valF['date_complet'],$valF['delai']); |
$valF['delai_incompletude']= $this->regle($row['regle_delai_incompletude'], 'regle_delai_incompletude'); |
1170 |
$valF['date_notification_delai'] = $this->moisdate($valF['date_complet'],1); |
} |
1171 |
break; |
if($row['regle_autorite_competente']!=''){ |
1172 |
case "rejet" : |
$valF['autorite_competente']= $this->regle($row['regle_autorite_competente'], 'regle_autorite_competente'); |
1173 |
//$valF['delai']=0; // *** delai a garder pour etat dpc |
} |
1174 |
$valF['etat']= $this->valF['etat']; |
if($row['regle_etat']!=''){ |
1175 |
$valF['accord_tacite']= $this->valF['accord_tacite']; |
// Si on est dans le cas général ou qu'on est en incomplétude et |
1176 |
// la date rejet est initialisee |
// qu'on a un événement de type incomplétude alors : on stocke |
1177 |
$valF['date_rejet']= $this->valF['date_evenement']; |
// l'état dans la variable courante |
1178 |
// les dates de depart et fin d instruction sont annulées |
if ($incompletude == FALSE OR $this->valEvenement['type'] == "incompletude") { |
1179 |
$valF['date_limite'] =null; |
$valF['etat'] = $this->regle($row['regle_etat'], 'regle_etat'); |
1180 |
$valF['date_notification_delai'] =null; |
} else { |
1181 |
$valF['date_complet']=null; |
$valF['etat_pendant_incompletude'] = $this->regle($row['regle_etat'], 'regle_etat'); |
1182 |
break; |
} |
1183 |
case "majoration" : |
} |
1184 |
$valF['delai']= $this->valF['archive_delai']+$this->valF['delai']; |
if($this->valEvenement['evenement_suivant_tacite'] != '') { |
1185 |
$valF['etat']= $this->valF['etat']; |
// Si on est pas en incomplétude on stocke l'événement tacite |
1186 |
$valF['accord_tacite']= $this->valF['accord_tacite']; |
//de l'événement dans la variable courante |
1187 |
$valF['date_complet']=$this->valF['archive_date_complet']; |
if ($incompletude == FALSE) { |
1188 |
// majoration de la date limite |
$valF['evenement_suivant_tacite'] = $this->valEvenement['evenement_suivant_tacite']; |
1189 |
$valF['date_limite'] = $this->moisdate($valF['date_complet'],$valF['delai']); |
} else { |
1190 |
$valF['date_notification_delai'] = $this->moisdate($valF['date_complet'],1); |
$valF['evenement_suivant_tacite_incompletude'] = $this->valEvenement['evenement_suivant_tacite']; |
1191 |
// la date du courrier ne doit pas etre depasse par rapport au delai de |
} |
1192 |
// notification |
} |
1193 |
if($this->valF['archive_date_notification_delai']<$this->valF['date_evenement']) |
} |
1194 |
$this->msg=$this->msg."<br><img src='../img/erreur.gif'>"._("date_notification_delai"). |
// Si des valeurs ont été calculées alors on met à jour l'enregistrement |
1195 |
$this->valF['archive_date_notification_delai']." < "._('date_evenement'); |
if ($valF != "") { |
1196 |
break; |
// On met à jour le dossier |
1197 |
case "acceptation" : |
$cle = " dossier='".$this->valF['dossier']."'"; |
1198 |
$valF['etat']= $this->valF['etat']; |
$res1 = $db->autoExecute(DB_PREFIXE.'dossier', $valF, DB_AUTOQUERY_UPDATE, $cle); |
1199 |
$valF['date_decision']= $this->valF['date_evenement']; |
$this->addToLog("triggerajouterapres(): db->autoexecute(\"".DB_PREFIXE."dossier\", ".print_r($valF, true).", DB_AUTOQUERY_UPDATE, \"".$cle."\");", VERBOSE_MODE); |
1200 |
$valF['avis_decision']= $this->valF['avis_decision']; |
if (database::isError($res1)) { |
|
// date de validite = date de l evenement + delai |
|
|
$valF['date_validite'] = $this->moisdate($this->valF['date_evenement'],$this->valF['delai']); |
|
|
break; |
|
|
case "refus" : |
|
|
$valF['etat']= $this->valF['etat']; |
|
|
$valF['date_decision']= $this->valF['date_evenement']; |
|
|
$valF['avis_decision']= $this->valF['avis_decision']; |
|
|
break; |
|
|
case "prolongation" : |
|
|
$valF['date_validite'] = $this->moisdate($this->valF['archive_date_validite'],$this->valF['delai']); |
|
|
break; |
|
|
case "sursis" : |
|
|
$valF['date_limite'] = $this->moisdate($this->valF['date_evenement'],$this->valF['delai']); |
|
|
$valF['etat']= $this->valF['etat']; |
|
|
$valF['accord_tacite']= $this->valF['accord_tacite']; |
|
|
$valF['avis_decision']= $this->valF['avis_decision']; |
|
|
$valF['date_decision']= $this->valF['date_evenement']; |
|
|
$temp = $valF['date_limite']; |
|
|
$valF['date_validite']= $this->moisdate($temp,2); |
|
|
break; |
|
|
case "execution" : |
|
|
$valF['etat']= $this->valF['etat']; |
|
|
$valF['date_chantier'] = $this->valF['date_evenement']; |
|
|
//echo $this->msg=$this->msg.$valF['date_chantier'].""; |
|
|
break; |
|
|
case "achevement" : |
|
|
$valF['etat']= $this->valF['etat']; |
|
|
$valF['date_achevement'] = $this->valF['date_evenement']; |
|
|
break; |
|
|
case "archivage" : |
|
|
$valF['etat']= $this->valF['etat']; |
|
|
$valF['date_conformite'] = $this->valF['date_evenement']; |
|
|
break; |
|
|
|
|
|
default: |
|
|
if ($this->valF['etat']!="") |
|
|
$valF['etat']= $this->valF['etat']; |
|
|
}// end switch |
|
|
} // end param |
|
|
if($valF!=""){ |
|
|
$cle= " dossier = '".$this->valF['dossier']."'"; |
|
|
$res1= $db->autoExecute(DB_PREFIXE.'dossier',$valF,DB_AUTOQUERY_UPDATE,$cle); |
|
|
if (database::isError($res1)) |
|
1201 |
die($res->getMessage()); |
die($res->getMessage()); |
1202 |
if ($DEBUG == 1) |
} |
1203 |
echo "La requête de mise à jour est effectuée.<br>"; |
// Affichage d'informations à l'utilisateur |
1204 |
$this->msg=$this->msg."<br>"._('enregistrement')." ". |
$this->addToMessage(_('enregistrement')." ".$this->valF['dossier']." "._('table')." dossier [".$db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
|
$this->valF['dossier']." "._('table')." dossier [". |
|
|
$db->affectedRows()." "._('enregistrement'). |
|
|
" "._('mis_a_jour')."]" ; |
|
1205 |
} |
} |
1206 |
|
|
1207 |
|
/** |
1208 |
|
* REFERENTIEL ERP |
1209 |
|
*/ |
1210 |
// verification si envoi vers ERP est active |
// verification si envoi vers ERP est active |
1211 |
if ($this->f->getParameter('option_erp') != "") { |
if ($this->f->getParameter('option_erp') != "") { |
1212 |
// la nature du dossier |
// la nature du dossier |
1213 |
$nature_dossier = substr($this->idxformulaire,0,2); |
$nature_dossier = substr($this->idxformulaire,0,2); |
1214 |
$dossier_erp = $this->getFromDB("SELECT erp FROM ".DB_PREFIXE."dossier WHERE dossier = '" . |
// |
1215 |
$this->valF['dossier'] . "'"); |
$sql = "SELECT erp |
1216 |
$evenement_libelle = $this->getFromDB( |
FROM ".DB_PREFIXE."dossier |
1217 |
"SELECT libelle FROM ".DB_PREFIXE."evenement WHERE evenement = '" . |
WHERE dossier='".$this->valF['dossier']."'"; |
1218 |
$this->valF['evenement'] . "'"); |
$dossier_erp = $this->db->getone($sql); |
1219 |
|
$this->addToLog("triggerajouterapres(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
1220 |
|
if (database::isError($res)) { |
1221 |
|
die($res->getMessage()); |
1222 |
|
} |
1223 |
|
// |
1224 |
|
$sql = "SELECT libelle |
1225 |
|
FROM ".DB_PREFIXE."evenement |
1226 |
|
WHERE evenement='".$this->valF['evenement']."'"; |
1227 |
|
$evenement_libelle = $this->db->getone($sql); |
1228 |
|
$this->addToLog("triggerajouterapres(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
1229 |
|
if (database::isError($res)) { |
1230 |
|
die($res->getMessage()); |
1231 |
|
} |
1232 |
|
// |
1233 |
if ($dossier_erp == 't') { |
if ($dossier_erp == 't') { |
1234 |
// envoi du message en cas d'un PC qui est ERP et sur lequel un evenement |
// envoi du message en cas d'un PC qui est ERP et sur lequel un evenement |
1235 |
// d'acceptation etait fait |
// d'acceptation etait fait |
1250 |
} |
} |
1251 |
} |
} |
1252 |
} // fin de if ($this->f->getParameter('option_erp') != "") |
} // fin de if ($this->f->getParameter('option_erp') != "") |
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
* Fait une requette sql pour extraire la valeur d'un champ, et retourne |
|
|
* cette valeur |
|
|
* @param string $sql La requete sql a executer |
|
|
* @return La valeur du champs cherche, sinon NULL. En cas d'erreur de la BD |
|
|
* l'execution s'arrete. |
|
|
*/ |
|
|
function getFromDB($sql) { |
|
|
//$sql = "SELECT libelle FROM ".DB_PREFIXE."dossier WHERE dossier = '" . $dossier . "'"; |
|
|
$res = $this->db->limitquery($sql, 0, 1); |
|
|
$this->addToLog("getDossierERPSpecification(): db->limitquery(\"". |
|
|
str_replace(",",", ",$sql)."\", 0, 1);", VERBOSE_MODE); |
|
|
// Si une erreur survient on die |
|
|
if (database::isError($res, true)) { |
|
|
// Appel de la methode de recuperation des erreurs |
|
|
$this->erreur_db($res->getDebugInfo(), $res->getMessage(), 'instruction'); |
|
|
} |
|
|
// retourne la nature du dossier |
|
|
while ($row =& $res->fetchRow()) { |
|
|
return $row[0]; |
|
|
} |
|
|
// la nature n'etait pas trouve, ce qui ne devrait pas se passer |
|
|
return NULL; |
|
1253 |
|
|
1254 |
} |
// Mise à jour des données du dossier d'autorisation |
1255 |
|
require_once "../obj/dossier_autorisation.class.php"; |
1256 |
|
$da = new dossier_autorisation($this->getNumDemandeAutorFromDossier($this->valF['dossier']), $this->db, DEBUG); |
1257 |
|
if($da->majDossierAutorisation() === false) { |
1258 |
|
$this->addToMessage(_("Erreur lors de la mise a jour des donnees du dossier d'autorisation. Contactez votre administrateur.")); |
1259 |
|
$this->correct = false; |
1260 |
|
return false; |
1261 |
|
} |
1262 |
|
} |
1263 |
|
|
1264 |
function triggermodifierapres($id,&$db,$val,$DEBUG) { |
function triggermodifierapres($id,&$db,$val,$DEBUG) { |
1265 |
/* |
/** |
1266 |
* cette fonction a pour objet de permettre de modifier la date courrier |
* L'objectif ici est d'effectuer les recalculs de date dans le dossier |
1267 |
*/ |
* si la date de l'evenement est modifiee |
1268 |
$valF=array(); |
*/ |
1269 |
$sql= "select action from ".DB_PREFIXE."evenement where evenement =".$this->valF['evenement']; |
// Initialisation |
1270 |
|
$valF = ""; |
1271 |
|
// Initialisation du type d'événement |
1272 |
|
$type_evmt = ""; |
1273 |
|
// Récupération de l'action correspondante à l'événement |
1274 |
|
$sql = "SELECT action |
1275 |
|
FROM ".DB_PREFIXE."evenement |
1276 |
|
WHERE evenement=".$this->valF['evenement']; |
1277 |
$action = $db->getOne($sql); |
$action = $db->getOne($sql); |
1278 |
if (database::isError($action)) die($action->getMessage().$sql); |
$this->addToLog("triggermodifierapres(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
1279 |
$sql="select * from ".DB_PREFIXE."action where action = '".$action."'"; |
if (database::isError($action)) { |
1280 |
|
die($action->getMessage()); |
1281 |
|
} |
1282 |
|
|
1283 |
|
// Récupération des paramètres de l'action |
1284 |
|
$sql = "SELECT * FROM ".DB_PREFIXE."action |
1285 |
|
WHERE action='".$action."'"; |
1286 |
$res = $db->query($sql); |
$res = $db->query($sql); |
1287 |
if (database::isError($res)) die($res->getMessage().$sql); |
$this->addToLog("triggermodifierapres(): db->query(\"".$sql."\");", VERBOSE_MODE); |
1288 |
|
if (database::isError($res)) { |
1289 |
|
die($res->getMessage()); |
1290 |
|
} |
1291 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
1292 |
// application des regles sur le courrier + delai |
// application des regles sur le courrier + delai |
1293 |
if(preg_match("/date_evenement/",$row['regle_date_limite'])){ |
if(preg_match("/date_evenement/",$row['regle_date_limite'])){ |
1294 |
$valF['date_limite']= $this->regle($row['regle_date_limite']); |
$valF['date_limite']= $this->regle($row['regle_date_limite'], 'regle_date_limite'); |
1295 |
} |
} |
1296 |
if(preg_match("/date_evenement/",$row['regle_date_complet'])){ |
if(preg_match("/date_evenement/",$row['regle_date_complet'])){ |
1297 |
$valF['date_complet']= $this->regle($row['regle_date_complet']); |
$valF['date_complet']= $this->regle($row['regle_date_complet'], 'regle_date_complet'); |
1298 |
|
} |
1299 |
|
if(preg_match("/date_evenement/",$row['regle_date_dernier_depot'])){ |
1300 |
|
$valF['date_dernier_depot']= $this->regle($row['regle_date_dernier_depot'], 'regle_date_dernier_depot'); |
1301 |
} |
} |
1302 |
if(preg_match("/date_evenement/",$row['regle_date_notification_delai'])){ |
if(preg_match("/date_evenement/",$row['regle_date_notification_delai'])){ |
1303 |
$valF['date_notification_delai']= $this->regle($row['regle_date_notification_delai']); |
$valF['date_notification_delai']= $this->regle($row['regle_date_notification_delai'], 'regle_date_notification_delai'); |
1304 |
} |
} |
1305 |
if(preg_match("/date_evenement/",$row['regle_date_decision'])){ |
if(preg_match("/date_evenement/",$row['regle_date_decision'])){ |
1306 |
$valF['date_decision']= $this->regle($row['regle_date_decision']); |
$valF['date_decision']= $this->regle($row['regle_date_decision'], 'regle_date_decision'); |
1307 |
} |
} |
1308 |
if(preg_match("/date_evenement/",$row['regle_date_rejet'])){ |
if(preg_match("/date_evenement/",$row['regle_date_rejet'])){ |
1309 |
$valF['date_rejet']= $this->regle($row['regle_date_rejet']); |
$valF['date_rejet']= $this->regle($row['regle_date_rejet'], 'regle_date_rejet'); |
1310 |
} |
} |
1311 |
if(preg_match("/date_evenement/",$row['regle_date_validite'])){ |
if(preg_match("/date_evenement/",$row['regle_date_validite'])){ |
1312 |
$valF['date_validite']= $this->regle($row['regle_date_validite']); |
$valF['date_validite']= $this->regle($row['regle_date_validite'], 'regle_date_validite'); |
1313 |
} |
} |
1314 |
if(preg_match("/date_evenement/",$row['regle_date_chantier'])){ |
if(preg_match("/date_evenement/",$row['regle_date_chantier'])){ |
1315 |
$valF['date_chantier']= $this->regle($row['regle_date_chantier']); |
$valF['date_chantier']= $this->regle($row['regle_date_chantier'], 'regle_date_chantier'); |
1316 |
} |
} |
1317 |
if(preg_match("/date_evenement/",$row['regle_date_achevement'])){ |
if(preg_match("/date_evenement/",$row['regle_date_achevement'])){ |
1318 |
$valF['date_achevement']= $this->regle($row['regle_date_achevement']); |
$valF['date_achevement']= $this->regle($row['regle_date_achevement'], 'regle_date_achevement'); |
1319 |
} |
} |
1320 |
if(preg_match("/date_evenement/",$row['regle_date_conformite'])){ |
if(preg_match("/date_evenement/",$row['regle_date_conformite'])){ |
1321 |
$valF['date_conformite']= $this->regle($row['regle_date_conformite']); |
$valF['date_conformite']= $this->regle($row['regle_date_conformite'], 'regle_date_conformite'); |
1322 |
} |
} |
1323 |
} // while |
} |
1324 |
if($valF!=array()){ |
// Si des valeurs ont été calculées alors on met à jour l'enregistrement |
1325 |
$cle= " dossier = '".$this->valF['dossier']."'"; |
if ($valF != "") { |
1326 |
$res1= $db->autoExecute(DB_PREFIXE.'dossier',$valF,DB_AUTOQUERY_UPDATE,$cle); |
// On met à jour le dossier |
1327 |
if (database::isError($res1)) |
$cle = " dossier='".$this->valF['dossier']."'"; |
1328 |
|
$res1 = $db->autoExecute(DB_PREFIXE.'dossier', $valF, DB_AUTOQUERY_UPDATE, $cle); |
1329 |
|
$this->addToLog("triggermodifierapres(): db->autoexecute(\"".DB_PREFIXE."dossier\", ".print_r($valF, true).", DB_AUTOQUERY_UPDATE, \"".$cle."\");", VERBOSE_MODE); |
1330 |
|
if (database::isError($res1)) { |
1331 |
die($res->getMessage()); |
die($res->getMessage()); |
1332 |
if ($DEBUG == 1) |
} |
1333 |
echo "La requête de mise à jour est effectuée.<br>"; |
// Affichage d'informations à l'utilisateur |
1334 |
$this->msg=$this->msg."<br>"._('enregistrement')." ". |
$this->addToMessage(_('enregistrement')." ".$this->valF['dossier']." "._('table')." dossier [".$db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
|
$this->valF['dossier']." "._('table')." dossier [". |
|
|
$db->affectedRows()." "._('enregistrement'). |
|
|
" "._('mis_a_jour')."]" ; |
|
|
} |
|
|
|
|
|
// Envoi des infos au |
|
|
if ($this->valF['date_retour_signature'] != $this->getVal('date_retour_signature')) { |
|
|
$msgenque = new MessageEnqueuer(); |
|
|
$sqlArrete = "SELECT instruction.signataire_arrete as \"ws_DA_In_Signataire\", |
|
|
signataire_arrete.nom as \"ws_DA_In_Sign_Nom\", |
|
|
signataire_arrete.prenom as \"ws_DA_In_Sign_Prenom\", |
|
|
signataire_arrete.qualite as \"ws_DA_In_Sign_Qualite\", |
|
|
instruction.date_evenement as \"ws_DA_In_Dte_Redac\", |
|
|
'' as \"ws_DA_In_lieu_Redac\", |
|
|
instruction.dossier as \"ws_DA_In_N_Doss_DAS\", |
|
|
'' as \"ws_DA_In_Sigle\", |
|
|
instruction.etat as \"ws_DA_In_Decision\", |
|
|
dossier.date_depot as \"ws_DA_In_Dte_Depot_Dem\", |
|
|
dossier.terrain_numero as \"ws_DA_In_N_Voie\", |
|
|
'' as \"ws_DA_In_Type_Voie\", |
|
|
dossier.complement as \"ws_DA_In_Adresse1\", |
|
|
dossier.terrain_adresse_lieu_dit as \"ws_DA_In_Adresse2\", |
|
|
dossier.terrain_adresse_code_postal as \"ws_DA_In_CP\", |
|
|
dossier.terrain_adresse_localite as \"ws_DA_In_Ville\", |
|
|
dossier.terrain_references_cadastrales as \"ws_DA_In_Nb_Parcelle\", |
|
|
'' as \"ws_DA_In_Detail_Parcelle\", |
|
|
CONCAT(donnees_techniques.am_projet_desc,' ',donnees_techniques.co_projet_desc) as \"ws_DA_In_Nature_Trvx\", |
|
|
'' as \"ws_DA_In_Destination_Trvx\", |
|
|
dossier_autorisation_type_detaille.code as \"ws_DA_In_Type_Dos_Autoris\", |
|
|
COALESCE(particulier_nom,personne_morale_raison_sociale) as \"ws_DA_In_Nom_Petition\", |
|
|
COALESCE(particulier_prenom, personne_morale_denomination) as \"ws_DA_In_Prenom_Petition\", |
|
|
'' as \"ws_DA_In_Piece_GED\", |
|
|
instruction.date_retour_signature as \"ws_DA_In_Dte_Signature\" |
|
|
FROM ".DB_PREFIXE."instruction |
|
|
LEFT JOIN ".DB_PREFIXE."signataire_arrete ON |
|
|
instruction.signataire_arrete = signataire_arrete.signataire_arrete |
|
|
LEFT JOIN ".DB_PREFIXE."dossier ON |
|
|
instruction.dossier = dossier.dossier |
|
|
LEFT JOIN ".DB_PREFIXE."lien_dossier_demandeur ON |
|
|
lien_dossier_demandeur.dossier = dossier.dossier |
|
|
LEFT JOIN ".DB_PREFIXE."demandeur ON |
|
|
lien_dossier_demandeur.demandeur = demandeur.demandeur |
|
|
LEFT JOIN ".DB_PREFIXE."dossier_instruction_type ON |
|
|
dossier.dossier_instruction_type = dossier_instruction_type.dossier_instruction_type |
|
|
LEFT JOIN ".DB_PREFIXE."dossier_autorisation_type_detaille ON |
|
|
dossier_instruction_type.dossier_autorisation_type_detaille = |
|
|
dossier_autorisation_type_detaille.dossier_autorisation_type_detaille |
|
|
LEFT JOIN ".DB_PREFIXE."donnees_techniques ON |
|
|
donnees_techniques.dossier_instruction = dossier.dossier |
|
|
WHERE instruction.instruction = ".$this->valF['instruction']; |
|
|
$resArrete = $this->db->query($sqlArrete); |
|
|
$this->f->addToLog("triggerModifierApres(): db->query(\"".$sqlArrete."\");", VERBOSE_MODE); |
|
|
$this->f->isDatabaseError(); |
|
|
|
|
|
$rowArrete = $resArrete->fetchRow(DB_FETCHMODE_ASSOC); |
|
|
$msgenque->setArreteInfo($rowArrete); |
|
|
$msgenque->enqueueMessage($msgenque::$ARRETE_ENVOI); |
|
1335 |
} |
} |
|
} |
|
|
|
|
1336 |
|
|
1337 |
|
// Récupération de tous les paramètres de l'événement sélectionné |
1338 |
// trigger before delete |
$sql = "SELECT * FROM ".DB_PREFIXE."evenement |
1339 |
function triggersupprimer($id,&$db,$val,$DEBUG) { |
WHERE evenement=".$this->valF['evenement']; |
1340 |
// archive en instruction (si suppression) [archive if delete instruction] |
$res = $db->query($sql); |
1341 |
$valF['delai']=$val['archive_delai']; |
$this->addToLog("triggermodifierapres(): db->query(\"".$sql."\");", VERBOSE_MODE); |
1342 |
$valF['accord_tacite']=$val['archive_accord_tacite']; |
if (database::isError($res)) { |
|
$valF['etat']=$val['archive_etat']; |
|
|
if($val['archive_avis']=='') |
|
|
$valF['avis_decision']= null; |
|
|
else |
|
|
$valF['avis_decision']=$val['archive_avis']; |
|
|
// if= compatibilite pgsql |
|
|
if($val['archive_date_complet']!='') |
|
|
$valF['date_complet']=$val['archive_date_complet']; |
|
|
if($val['archive_date_rejet']!='') |
|
|
$valF['date_rejet']= $val['archive_date_rejet']; |
|
|
if($val['archive_date_limite']!='') |
|
|
$valF['date_limite']= $val['archive_date_limite']; |
|
|
if($val['archive_date_notification_delai']!='') |
|
|
$valF['date_notification_delai']= $val['archive_date_notification_delai']; |
|
|
if($val['archive_date_decision']!='') |
|
|
$valF['date_decision']= $val['archive_date_decision']; |
|
|
if($val['archive_date_validite']!='') |
|
|
$valF['date_validite']= $val['archive_date_validite']; |
|
|
if($val['archive_date_achevement']!='') |
|
|
$valF['date_achevement']= $val['archive_date_achevement']; |
|
|
if($val['archive_date_chantier']!='') |
|
|
$valF['date_chantier']= $val['archive_date_chantier']; |
|
|
if($val['archive_date_conformite']!='') |
|
|
$valF['date_conformite']= $val['archive_date_conformite']; |
|
|
|
|
|
$cle= " dossier = '".$val['dossier']."'"; |
|
|
$res= $db->autoExecute(DB_PREFIXE.'dossier',$valF,DB_AUTOQUERY_UPDATE,$cle); |
|
|
if (database::isError($res)) |
|
1343 |
die($res->getMessage()); |
die($res->getMessage()); |
|
else{ |
|
|
if ($DEBUG == 1) |
|
|
echo "La requête de mise à jour est effectuée.<br>"; |
|
1344 |
} |
} |
1345 |
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
1346 |
|
// Si la date de retour signature est éditée on vérifie si il existe un événement automatique |
1347 |
|
if ($this->getVal('date_retour_signature') == "" AND |
1348 |
|
$this->valF['date_retour_signature'] != "" AND |
1349 |
|
$row['evenement_retour_signature'] != "") { |
1350 |
|
$new_instruction = new instruction("]", $db, $DEBUG); |
1351 |
|
// Création d'un tableau avec la liste des champs de l'instruction |
1352 |
|
foreach($new_instruction->champs as $champ) { |
1353 |
|
$valNewInstr[$champ] = ""; |
1354 |
|
} |
1355 |
|
// Définition des valeurs de la nouvelle instruction |
1356 |
|
$valNewInstr["evenement"] = $row['evenement_retour_signature']; |
1357 |
|
$valNewInstr["destinataire"] = $this->valF['destinataire']; |
1358 |
|
$valNewInstr["dossier"] = $this->valF['dossier']; |
1359 |
|
$valNewInstr["date_evenement"] = $this->f->formatDate($this->valF['date_retour_signature']); |
1360 |
|
$valNewInstr["date_envoi_signature"] = $this->f->formatDate($this->valF['date_envoi_signature']); |
1361 |
|
$valNewInstr["date_retour_signature"] = $this->f->formatDate($this->valF['date_retour_signature']); |
1362 |
|
$valNewInstr["date_envoi_rar"] = $this->f->formatDate($this->valF['date_envoi_rar']); |
1363 |
|
$valNewInstr["date_retour_rar"] = $this->f->formatDate($this->valF['date_retour_rar']); |
1364 |
|
$valNewInstr["date_envoi_controle_legalite"] = $this->f->formatDate($this->valF['date_envoi_controle_legalite']); |
1365 |
|
$valNewInstr["date_retour_controle_legalite"] = $this->f->formatDate($this->valF['date_retour_controle_legalite']); |
1366 |
|
$new_instruction->ajouter($valNewInstr,$db, $DEBUG); |
1367 |
|
} |
1368 |
|
// Si la date de retour AR est éditée on vérifie si il existe un événement automatique |
1369 |
|
if ($this->getVal('date_retour_rar') == "" AND |
1370 |
|
$this->valF['date_retour_rar'] != "" AND |
1371 |
|
$row['evenement_retour_ar'] != "" ) { |
1372 |
|
$new_instruction = new instruction("]", $db, $DEBUG); |
1373 |
|
// Création d'un tableau avec la liste des champs de l'instruction |
1374 |
|
foreach($new_instruction->champs as $champ) { |
1375 |
|
$valNewInstr[$champ] = ""; |
1376 |
|
} |
1377 |
|
// Définition des valeurs de la nouvelle instruction |
1378 |
|
$valNewInstr["evenement"] = $row['evenement_retour_ar']; |
1379 |
|
$valNewInstr["destinataire"] = $this->valF['destinataire']; |
1380 |
|
$valNewInstr["dossier"] = $this->valF['dossier']; |
1381 |
|
$valNewInstr["date_evenement"] = $this->f->formatDate($this->valF['date_retour_rar']); |
1382 |
|
$valNewInstr["date_envoi_signature"] = $this->f->formatDate($this->valF['date_envoi_signature']); |
1383 |
|
$valNewInstr["date_retour_signature"] = $this->f->formatDate($this->valF['date_retour_signature']); |
1384 |
|
$valNewInstr["date_envoi_rar"] = $this->f->formatDate($this->valF['date_envoi_rar']); |
1385 |
|
$valNewInstr["date_retour_rar"] = $this->f->formatDate($this->valF['date_retour_rar']); |
1386 |
|
$valNewInstr["date_envoi_controle_legalite"] = $this->f->formatDate($this->valF['date_envoi_controle_legalite']); |
1387 |
|
$valNewInstr["date_retour_controle_legalite"] = $this->f->formatDate($this->valF['date_retour_controle_legalite']); |
1388 |
|
$new_instruction->ajouter($valNewInstr,$db, $DEBUG); |
1389 |
|
} |
1390 |
|
} |
1391 |
|
|
1392 |
|
/** |
1393 |
|
* REFERENTIEL ARRETE |
1394 |
|
*/ |
1395 |
|
// Si l'option référentiel arrêté est activé et l'événement est de type |
1396 |
|
// arrêté |
1397 |
|
if ($this->f->getParameter('option_referentiel_arrete') != "" AND |
1398 |
|
$type_evmt == "arrete") { |
1399 |
|
if ($this->valF['date_retour_signature'] != $this->getVal('date_retour_signature')) { |
1400 |
|
$msgenque = new MessageEnqueuer(); |
1401 |
|
$sqlArrete = "SELECT instruction.signataire_arrete as \"ws_DA_In_Signataire\", |
1402 |
|
signataire_arrete.nom as \"ws_DA_In_Sign_Nom\", |
1403 |
|
signataire_arrete.prenom as \"ws_DA_In_Sign_Prenom\", |
1404 |
|
signataire_arrete.qualite as \"ws_DA_In_Sign_Qualite\", |
1405 |
|
instruction.date_evenement as \"ws_DA_In_Dte_Redac\", |
1406 |
|
'' as \"ws_DA_In_lieu_Redac\", |
1407 |
|
instruction.dossier as \"ws_DA_In_N_Doss_DAS\", |
1408 |
|
'' as \"ws_DA_In_Sigle\", |
1409 |
|
instruction.etat as \"ws_DA_In_Decision\", |
1410 |
|
dossier.date_depot as \"ws_DA_In_Dte_Depot_Dem\", |
1411 |
|
dossier.terrain_adresse_voie_numero as \"ws_DA_In_N_Voie\", |
1412 |
|
'' as \"ws_DA_In_Type_Voie\", |
1413 |
|
dossier.terrain_adresse_voie as \"ws_DA_In_Adresse1\", |
1414 |
|
dossier.terrain_adresse_lieu_dit as \"ws_DA_In_Adresse2\", |
1415 |
|
dossier.terrain_adresse_code_postal as \"ws_DA_In_CP\", |
1416 |
|
dossier.terrain_adresse_localite as \"ws_DA_In_Ville\", |
1417 |
|
dossier.terrain_references_cadastrales as \"ws_DA_In_Nb_Parcelle\", |
1418 |
|
'' as \"ws_DA_In_Detail_Parcelle\", |
1419 |
|
CONCAT(donnees_techniques.am_projet_desc,' ',donnees_techniques.co_projet_desc) as \"ws_DA_In_Nature_Trvx\", |
1420 |
|
'' as \"ws_DA_In_Destination_Trvx\", |
1421 |
|
dossier_autorisation_type_detaille.code as \"ws_DA_In_Type_Dos_Autoris\", |
1422 |
|
COALESCE(particulier_nom,personne_morale_raison_sociale) as \"ws_DA_In_Nom_Petition\", |
1423 |
|
COALESCE(particulier_prenom, personne_morale_denomination) as \"ws_DA_In_Prenom_Petition\", |
1424 |
|
'' as \"ws_DA_In_Piece_GED\", |
1425 |
|
instruction.date_retour_signature as \"ws_DA_In_Dte_Signature\" |
1426 |
|
FROM ".DB_PREFIXE."instruction |
1427 |
|
LEFT JOIN ".DB_PREFIXE."signataire_arrete ON |
1428 |
|
instruction.signataire_arrete = signataire_arrete.signataire_arrete |
1429 |
|
LEFT JOIN ".DB_PREFIXE."dossier ON |
1430 |
|
instruction.dossier = dossier.dossier |
1431 |
|
LEFT JOIN ".DB_PREFIXE."lien_dossier_demandeur ON |
1432 |
|
lien_dossier_demandeur.dossier = dossier.dossier |
1433 |
|
LEFT JOIN ".DB_PREFIXE."demandeur ON |
1434 |
|
lien_dossier_demandeur.demandeur = demandeur.demandeur |
1435 |
|
LEFT JOIN ".DB_PREFIXE."dossier_instruction_type ON |
1436 |
|
dossier.dossier_instruction_type = dossier_instruction_type.dossier_instruction_type |
1437 |
|
LEFT JOIN ".DB_PREFIXE."dossier_autorisation_type_detaille ON |
1438 |
|
dossier_instruction_type.dossier_autorisation_type_detaille = |
1439 |
|
dossier_autorisation_type_detaille.dossier_autorisation_type_detaille |
1440 |
|
LEFT JOIN ".DB_PREFIXE."donnees_techniques ON |
1441 |
|
donnees_techniques.dossier_instruction = dossier.dossier |
1442 |
|
WHERE instruction.instruction = ".$this->valF['instruction']; |
1443 |
|
$resArrete = $this->db->query($sqlArrete); |
1444 |
|
$this->f->addToLog("triggermodifierapres(): db->query(\"".$sqlArrete."\");", VERBOSE_MODE); |
1445 |
|
if ( database::isError($resArrete)){ |
1446 |
|
die(); |
1447 |
|
} |
1448 |
|
|
1449 |
|
$rowArrete = $resArrete->fetchRow(DB_FETCHMODE_ASSOC); |
1450 |
|
$msgenque->setArreteInfo($rowArrete); |
1451 |
|
$msgenque->enqueueMessage($msgenque::$ARRETE_ENVOI); |
1452 |
|
} |
1453 |
|
} |
1454 |
|
|
1455 |
|
// Mise à jour des données du dossier d'autorisation |
1456 |
|
require_once "../obj/dossier_autorisation.class.php"; |
1457 |
|
$da = new dossier_autorisation($this->getNumDemandeAutorFromDossier($this->valF['dossier']), $this->db, DEBUG); |
1458 |
|
if($da->majDossierAutorisation() === false) { |
1459 |
|
$this->addToMessage(_("Erreur lors de la mise a jour des donnees du dossier d'autorisation. Contactez votre administrateur.")); |
1460 |
|
$this->correct = false; |
1461 |
|
return false; |
1462 |
|
} |
1463 |
|
} |
1464 |
|
|
1465 |
|
function triggersupprimer($id,&$db,$val,$DEBUG) { |
1466 |
|
/** |
1467 |
|
* L'objectif ici est de repositionner les valeurs récupérées en |
1468 |
|
* archive dans le dossier d'instruction avant de supprimer l'événement |
1469 |
|
* d'instruction |
1470 |
|
*/ |
1471 |
|
|
1472 |
|
// Mise à jour des 4 valeurs modifiées par l'action |
1473 |
|
$valF['delai'] = $val['archive_delai']; |
1474 |
|
$valF['accord_tacite'] = $val['archive_accord_tacite']; |
1475 |
|
$valF['etat'] = $val['archive_etat']; |
1476 |
|
if ($val['archive_avis'] != '') { |
1477 |
|
$valF['avis_decision'] = $val['archive_avis']; |
1478 |
|
} else { |
1479 |
|
$valF['avis_decision'] = NULL; |
1480 |
|
} |
1481 |
|
// Mise à jour des 10 dates avec la valeur présente dans le formulaire |
1482 |
|
// de suppression. Si la valeur de la date est vide alors on fixe |
1483 |
|
// à la valeur NULL |
1484 |
|
// |
1485 |
|
if ($val['archive_date_complet'] != '') { |
1486 |
|
$valF['date_complet'] = $val['archive_date_complet']; |
1487 |
|
} else { |
1488 |
|
$valF['date_complet'] = NULL; |
1489 |
|
} |
1490 |
|
if ($val['archive_date_dernier_depot'] != '') { |
1491 |
|
$valF['date_dernier_depot'] = $val['archive_date_dernier_depot']; |
1492 |
|
} else { |
1493 |
|
$valF['date_dernier_depot'] = NULL; |
1494 |
|
} |
1495 |
|
if ($val['archive_date_rejet'] != '') { |
1496 |
|
$valF['date_rejet'] = $val['archive_date_rejet']; |
1497 |
|
} else { |
1498 |
|
$valF['date_rejet'] = NULL; |
1499 |
|
} |
1500 |
|
if ($val['archive_date_limite'] != '') { |
1501 |
|
$valF['date_limite'] = $val['archive_date_limite']; |
1502 |
|
} else { |
1503 |
|
$valF['date_limite'] = NULL; |
1504 |
|
} |
1505 |
|
if ($val['archive_date_notification_delai'] != '') { |
1506 |
|
$valF['date_notification_delai'] = $val['archive_date_notification_delai']; |
1507 |
|
} else { |
1508 |
|
$valF['date_notification_delai'] = NULL; |
1509 |
|
} |
1510 |
|
if ($val['archive_date_decision'] != '') { |
1511 |
|
$valF['date_decision'] = $val['archive_date_decision']; |
1512 |
|
} else { |
1513 |
|
$valF['date_decision'] = NULL; |
1514 |
|
} |
1515 |
|
if ($val['archive_date_validite'] != '') { |
1516 |
|
$valF['date_validite'] = $val['archive_date_validite']; |
1517 |
|
} else { |
1518 |
|
$valF['date_validite'] = NULL; |
1519 |
|
} |
1520 |
|
if ($val['archive_date_achevement'] != '') { |
1521 |
|
$valF['date_achevement'] = $val['archive_date_achevement']; |
1522 |
|
} else { |
1523 |
|
$valF['date_achevement'] = NULL; |
1524 |
|
} |
1525 |
|
if ($val['archive_date_chantier'] != '') { |
1526 |
|
$valF['date_chantier'] = $val['archive_date_chantier']; |
1527 |
|
} else { |
1528 |
|
$valF['date_chantier'] = NULL; |
1529 |
|
} |
1530 |
|
if ($val['archive_date_conformite'] != '') { |
1531 |
|
$valF['date_conformite'] = $val['archive_date_conformite']; |
1532 |
|
} else { |
1533 |
|
$valF['date_conformite'] = NULL; |
1534 |
|
} |
1535 |
|
if ($val['archive_incompletude'] != '') { |
1536 |
|
$valF['incompletude'] = $val['archive_incompletude']; |
1537 |
|
} else { |
1538 |
|
$valF['incompletude'] = NULL; |
1539 |
|
} |
1540 |
|
if ($val['archive_evenement_suivant_tacite'] != '') { |
1541 |
|
$valF['evenement_suivant_tacite'] = $val['archive_evenement_suivant_tacite']; |
1542 |
|
} else { |
1543 |
|
$valF['evenement_suivant_tacite'] = NULL; |
1544 |
|
} |
1545 |
|
if ($val['archive_evenement_suivant_tacite_incompletude'] != '') { |
1546 |
|
$valF['evenement_suivant_tacite_incompletude'] = $val['archive_evenement_suivant_tacite_incompletude']; |
1547 |
|
} else { |
1548 |
|
$valF['evenement_suivant_tacite_incompletude'] = NULL; |
1549 |
|
} |
1550 |
|
if ($val['archive_etat_pendant_incompletude'] != '') { |
1551 |
|
$valF['etat_pendant_incompletude'] = $val['archive_etat_pendant_incompletude']; |
1552 |
|
} else { |
1553 |
|
$valF['etat_pendant_incompletude'] = NULL; |
1554 |
|
} |
1555 |
|
if ($val['archive_date_limite_incompletude'] != '') { |
1556 |
|
$valF['date_limite_incompletude'] = $val['archive_date_limite_incompletude']; |
1557 |
|
} else { |
1558 |
|
$valF['date_limite_incompletude'] = NULL; |
1559 |
|
} |
1560 |
|
if ($val['archive_delai_incompletude'] != '') { |
1561 |
|
$valF['delai_incompletude'] = $val['archive_delai_incompletude']; |
1562 |
|
} else { |
1563 |
|
$valF['delai_incompletude'] = NULL; |
1564 |
|
} |
1565 |
|
if ($val['archive_autorite_competente'] != '') { |
1566 |
|
$valF['autorite_competente'] = $val['archive_autorite_competente']; |
1567 |
|
} else { |
1568 |
|
$valF['autorite_competente'] = NULL; |
1569 |
|
} |
1570 |
|
// On met à jour le dossier |
1571 |
|
$cle = " dossier='".$val['dossier']."'"; |
1572 |
|
$res = $db->autoExecute(DB_PREFIXE.'dossier', $valF, DB_AUTOQUERY_UPDATE, $cle); |
1573 |
|
$this->addToLog("triggersupprimer(): db->autoexecute(\"".DB_PREFIXE."dossier\", ".print_r($valF, true).", DB_AUTOQUERY_UPDATE, \"".$cle."\");", VERBOSE_MODE); |
1574 |
|
if (database::isError($res)) { |
1575 |
|
die($res->getMessage()); |
1576 |
|
} |
1577 |
|
// Affichage d'informations à l'utilisateur |
1578 |
|
$this->addToMessage(_("Suppression de l'instruction")." [".$db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
1579 |
|
|
1580 |
|
// Mise à jour de la demande si un récépissé d'instruction correspond à l'instruction à supprimer |
1581 |
} |
} |
1582 |
// ============================================= |
|
1583 |
// calcul de date avec ajout de mois (delais) |
function triggersupprimerapres($id,&$db,$val,$DEBUG) { |
1584 |
// [add months (delay) and calculation final date] |
|
1585 |
// LIMITE DE LA FONCTION si delai >24 MOIS |
// Mise à jour des données du dossier d'autorisation |
1586 |
// [limit : delay < 24 month] |
require_once "../obj/dossier_autorisation.class.php"; |
1587 |
// ============================================= |
$da = new dossier_autorisation($this->getNumDemandeAutorFromDossier($val["dossier"]), $this->db, DEBUG); |
1588 |
function moisdate($date,$delaimois) { |
if($da->majDossierAutorisation() === false) { |
1589 |
$temp = explode("-" , $date); |
$this->addToMessage(_("Erreur lors de la mise a jour des donnees du dossier d'autorisation. Contactez votre administrateur.")); |
1590 |
$jour = (int) $temp[2]; |
$this->correct = false; |
1591 |
$mois = (int) $temp[1]; |
return false; |
1592 |
$annee = (int) $temp[0]; |
} |
|
// calcul si delai superieur à 12 (limite 24) [delay > 24 month] |
|
|
if($delaimois>=12){ |
|
|
$delaimois=$delaimois-12; |
|
|
$annee=$annee+1; |
|
|
} |
|
|
if($delaimois>=12){ |
|
|
$delaimois=$delaimois-12; |
|
|
$annee=$annee+1; |
|
|
} |
|
|
// mois |
|
|
$mois=$mois+$delaimois; |
|
|
// calcul mois annee [calculation number of years if > 12 month] |
|
|
// nb de mois > à 12 |
|
|
if ($mois>12){ |
|
|
$mois=$mois-12; |
|
|
$annee=$annee+1; |
|
|
} |
|
|
// Calcul du nombre de jours dans le mois sélectionné [calculation number of days] |
|
|
switch($mois) { |
|
|
case "2": |
|
|
if ($annee % 4 == 0 && $annee % 100 != 0 || $annee % 400 == 0) |
|
|
$jourmax = 29; |
|
|
else |
|
|
$jourmax = 28; |
|
|
break; |
|
|
case "4": |
|
|
case "6": |
|
|
case "9": |
|
|
case "11": |
|
|
$jourmax = 30; |
|
|
break; |
|
|
default: |
|
|
$jourmax = 31; |
|
|
} |
|
|
if ($jour > $jourmax) |
|
|
$jour = $jourmax; |
|
|
//$dateretour=$annee."-".$mois."-".$jour; |
|
|
return $annee."-".$mois."-".$jour ; |
|
1593 |
} |
} |
1594 |
|
|
1595 |
// Vérifie la restriction sur l'événement |
// Vérifie la restriction sur l'événement |
1596 |
function verifier($val = array(), &$db, $DEBUG){ |
function verifier($val = array(), &$db, $DEBUG){ |
1597 |
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']; |
|
1598 |
|
|
1599 |
$res = $db->query($sql); |
if ( isset($val['evenement']) && is_numeric($val['evenement'])){ |
1600 |
$this->f->addToLog("verifier(): db->query(\"".$sql."\");", VERBOSE_MODE); |
//Récupère la restriction |
1601 |
$this->f->isDatabaseError(); |
$sql= "SELECT |
1602 |
|
restriction |
1603 |
$row=& $res->fetchRow(DB_FETCHMODE_ASSOC); |
FROM |
1604 |
|
".DB_PREFIXE."evenement |
1605 |
|
WHERE |
1606 |
|
evenement =".$val['evenement']; |
1607 |
|
|
1608 |
|
$res = $db->query($sql); |
1609 |
|
$this->addToLog("verifier(): db->query(\"".$sql."\");", VERBOSE_MODE); |
1610 |
|
if (database::isError($res)) { |
1611 |
|
die($res->getMessage()); |
1612 |
|
} |
1613 |
|
$row=& $res->fetchRow(DB_FETCHMODE_ASSOC); |
1614 |
|
|
1615 |
|
//Test qu'une restriction est présente |
1616 |
|
if ( isset($row['restriction']) && $row['restriction'] != "" ){ |
1617 |
|
|
1618 |
//Test qu'une restriction est présente |
$restriction = $row['restriction']; |
|
if ( isset($row['restriction']) && $row['restriction'] != "" ){ |
|
|
|
|
|
//Test si la restriction est valide |
|
|
if ( !$this->restrictionIsValid($row['restriction']) ){ |
|
1619 |
|
|
1620 |
$this->correct=false; |
//Test si la restriction est valide |
1621 |
$this->addToMessage(_("Restriction non valide")); |
if ( !$this->restrictionIsValid($restriction) ){ |
1622 |
} |
|
1623 |
else { |
$this->correct=false; |
1624 |
|
$this->addToMessage(_("Restriction non valide")); |
1625 |
|
} |
1626 |
|
else { |
1627 |
|
|
1628 |
|
$this->correct = true; |
1629 |
|
} |
1630 |
|
|
1631 |
|
// Liste des opérateurs possible |
1632 |
|
$operateurs = array(">=", "<=", "+", "-"); |
1633 |
|
|
1634 |
|
// Supprime tous les espaces de la chaîne de caractère |
1635 |
|
$restriction = str_replace(' ', '', $restriction); |
1636 |
|
|
1637 |
$this->correct = true; |
// Met des espace avant et après les opérateurs puis transforme la |
1638 |
|
// chaine en un tableau |
1639 |
|
$tabRestriction = str_replace($operateurs, " ", $restriction); |
1640 |
|
// Tableau des champ |
1641 |
|
$tabRestriction = explode(" ", $tabRestriction); |
1642 |
|
// Supprime les numériques du tableau |
1643 |
|
foreach ($tabRestriction as $key => $value) { |
1644 |
|
if (is_numeric($value)) { |
1645 |
|
unset($tabRestriction[$key]); |
1646 |
|
} |
1647 |
|
} |
1648 |
|
|
1649 |
|
// Vérifie les champs utilisés pour la restriction |
1650 |
|
$check_field_exist = $this->f->check_field_exist($tabRestriction, 'instruction'); |
1651 |
|
if ($check_field_exist !== true) { |
1652 |
|
|
1653 |
|
// Liste des champs en erreur |
1654 |
|
$string_error_fields = implode(", ", $check_field_exist); |
1655 |
|
|
1656 |
|
// Message d'erreur |
1657 |
|
$error_message = _("Le champ %s n'est pas utilisable pour le champ %s"); |
1658 |
|
if (count($check_field_exist) > 1) { |
1659 |
|
$error_message = _("Les champs %s ne sont pas utilisable pour le champ %s"); |
1660 |
|
} |
1661 |
|
|
1662 |
|
// Affiche l'erreur |
1663 |
|
$this->correct=false; |
1664 |
|
$this->addToMessage(sprintf($error_message, $string_error_fields, _("restriction"))); |
1665 |
|
$this->addToMessage(_("Veuillez contacter votre administrateur.")); |
1666 |
|
} |
1667 |
} |
} |
1668 |
|
|
1669 |
|
} |
1670 |
|
if(!$this->updateDate("date_envoi_signature")) { |
1671 |
|
return false; |
1672 |
|
} |
1673 |
|
if(!$this->updateDate("date_retour_signature")) { |
1674 |
|
return false; |
1675 |
|
} |
1676 |
|
if(!$this->updateDate("date_envoi_rar")) { |
1677 |
|
return false; |
1678 |
|
} |
1679 |
|
if(!$this->updateDate("date_retour_rar")) { |
1680 |
|
return false; |
1681 |
} |
} |
1682 |
|
if(!$this->updateDate("date_envoi_controle_legalite")) { |
1683 |
|
return false; |
1684 |
|
} |
1685 |
|
if(!$this->updateDate("date_retour_controle_legalite")) { |
1686 |
|
return false; |
1687 |
|
} |
1688 |
|
|
1689 |
} |
} |
1690 |
|
|
1691 |
/** |
/** |
1692 |
* Méthode permettant de mettre à jour l'état d'un DA |
* Méthode permettant de récupérer toutes les valeurs de l'événement |
1693 |
|
* sélectionné après validation du formulaire d'instruction |
1694 |
|
* |
1695 |
|
* @return array() veleurs de l'événement lié |
1696 |
*/ |
*/ |
1697 |
function majEtatDA() { |
|
1698 |
if($this->valF['action'] == 'accepter' AND $this->valF['avis_decision'] == 8) { |
private function getValEvenement() { |
1699 |
$val['etat_dossier_autorisation']=5; |
if(!empty($this->valEvenement)) { |
1700 |
} elseif($this->valF['action'] == 'accepter' AND $this->valF['avis_decision'] == 15) { |
return $this->valEvenement; |
|
$val['etat_dossier_autorisation']=3; |
|
|
} elseif($this->valF['action'] == 'accepter') { |
|
|
$val['etat_dossier_autorisation']=2; |
|
|
} elseif($this->valF['action'] == 'rejeter') { |
|
|
$val['etat_dossier_autorisation']=4; |
|
|
} elseif($this->valF['action'] == 'terminer') { |
|
|
$val['etat_dossier_autorisation']=8; |
|
|
} elseif($this->valF['action'] == 'majorer') { |
|
|
$val['etat_dossier_autorisation']=6; |
|
1701 |
} else { |
} else { |
1702 |
$val['etat_dossier_autorisation']=7; |
$sql = "SELECT * FROM ".DB_PREFIXE."evenement |
1703 |
} |
WHERE evenement=".$this->valF['evenement']; |
1704 |
|
$res = $this->db->query($sql); |
1705 |
//Récupération du numéro de dossier d'autorisation lié au dossier d'instruction |
$this->addToLog("getValEvenement(): db->query(\"".$sql."\");", VERBOSE_MODE); |
1706 |
$IDdossier_autorisation = $this->getDossierAutorisation($this->valF['dossier']); |
if (database::isError($res)) { |
1707 |
|
die($res->getMessage()); |
1708 |
// Mis à jour de l'état du dossier d'autorisation |
} |
1709 |
require_once '../obj/dossier_autorisation.class.php'; |
$this->valEvenement = $res->fetchRow(DB_FETCHMODE_ASSOC); |
1710 |
$dossier_autorisation = new dossier_autorisation($IDdossier_autorisation,$this->db,DEBUG); |
return $this->valEvenement; |
|
|
|
|
$dossier_autorisation->val[array_search("etat_dossier_autorisation", $dossier_autorisation->champs)] = $val['etat_dossier_autorisation']; |
|
|
|
|
|
//Récupération des données |
|
|
$valDossierAutorisation = array(); |
|
|
for ( $i=0 ; $i<count($dossier_autorisation->champs); $i++){ |
|
|
|
|
|
$valDossierAutorisation[$dossier_autorisation->champs[$i]]= |
|
|
$dossier_autorisation->val[$i]; |
|
1711 |
} |
} |
1712 |
|
} |
1713 |
|
|
1714 |
$dossier_autorisation->modifier($valDossierAutorisation, $this->db, DEBUG); |
/** |
1715 |
|
* Méthode permettant de savoir si le dossier lié à l'instruction à le flag |
1716 |
|
* incompletude à true après validation du formulaire d'instruction |
1717 |
|
* |
1718 |
|
* @return boolean |
1719 |
|
*/ |
1720 |
|
private function dossierIncomplet() { |
1721 |
|
$sql = "SELECT incompletude FROM ".DB_PREFIXE."dossier |
1722 |
|
WHERE dossier='".$this->valF['dossier']."'"; |
1723 |
|
$incompletude = $this->db->getOne($sql); |
1724 |
|
$this->addToLog("dossierIncomplet(): db->query(\"".$sql."\");", VERBOSE_MODE); |
1725 |
|
if (database::isError($incompletude)) { |
1726 |
|
die($incompletude->getMessage()); |
1727 |
|
} |
1728 |
|
if ($incompletude == 't') { |
1729 |
|
return true; |
1730 |
|
} else { |
1731 |
|
return false; |
1732 |
|
} |
1733 |
} |
} |
1734 |
|
|
1735 |
/** |
/** |
1736 |
* Méthode permettant de mettre à jour les données d'un DA |
* Finalisation des documents. |
1737 |
*/ |
* @param string $champ champ du fichier à finaliser |
1738 |
function majDataDA() { |
* @param booleen $status permet de définir si on finalise ou définalise |
1739 |
|
* @param string $sousform permet de savoir si se trouve dans un sousformulaire (passé au javascript) |
1740 |
//Récupération du numéro de dossier d'autorisation lié au dossier d'instruction |
*/ |
1741 |
$IDdossier_autorisation = $this->getDossierAutorisation($this->valF['dossier']); |
function finaliser( $champ = '', $status, $sousform, $retourformulaire){ |
1742 |
require_once '../obj/dossier_autorisation.class.php'; |
|
1743 |
$dossier_autorisation = new dossier_autorisation($IDdossier_autorisation,$this->db,DEBUG); |
//Si on finalise le document |
1744 |
|
if ( $status == 1 ){ |
|
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++){ |
|
1745 |
|
|
1746 |
if ( array_search($dossier_autorisation->champs[$i], $dossier->champs) ){ |
//Génération du PDF |
1747 |
|
$_GET['output'] = "string"; |
1748 |
$valDossierAutorisation[$dossier_autorisation->champs[$i]]=$dossier->getVal($dossier_autorisation->champs[$i]); |
$f = $this->f; |
1749 |
|
include '../app/pdf_instruction.php'; |
1750 |
|
|
1751 |
|
//Métadonnées du document |
1752 |
|
$metadata = array( |
1753 |
|
'filename' => 'instruction_'.$idx.'.pdf', |
1754 |
|
'mimetype' => 'application/pdf', |
1755 |
|
'size' => strlen($pdf_output) |
1756 |
|
); |
1757 |
|
|
1758 |
|
// Récupération des métadonnées calculées après validation |
1759 |
|
$spe_metadata = $this->getMetadata("om_fichier_instruction"); |
1760 |
|
|
1761 |
|
$metadata = array_merge($metadata, $spe_metadata); |
1762 |
|
//Si le document a déjà été finalisé |
1763 |
|
//on met à jour le document mais pas son uid |
1764 |
|
if ( $this->getVal("om_fichier_instruction") != '' ){ |
1765 |
|
$uid = $this->f->storage->update( |
1766 |
|
$this->getVal("om_fichier_instruction"), $pdf_output, $metadata); |
1767 |
} |
} |
1768 |
|
//Sinon, on joute le document et on récupère son uid |
1769 |
else { |
else { |
1770 |
$valDossierAutorisation[$dossier_autorisation->champs[$i]]= |
//Stockage du PDF |
1771 |
$dossier_autorisation->val[$i]; |
$uid = $this->f->storage->create($pdf_output, $metadata); |
1772 |
} |
} |
1773 |
} |
} |
1774 |
|
else { |
1775 |
|
//Récupération de l'uid du document finalisé |
1776 |
|
$uid = $this->getVal("om_fichier_instruction"); |
1777 |
|
|
1778 |
|
//On dé-finalise avant de finaliser |
1779 |
|
if ( $uid == '' || $uid == 'OP_FAILURE' ){ |
1780 |
|
return -1; |
1781 |
|
} |
1782 |
|
} |
1783 |
|
//Mise à jour des données |
1784 |
|
if ( $uid != '' && $uid != 'OP_FAILURE' ){ |
1785 |
|
// Logger |
1786 |
|
$this->addToLog("finaliser() - begin", EXTRA_VERBOSE_MODE); |
1787 |
|
// Recuperation de la valeur de la cle primaire de l'objet |
1788 |
|
if($this->getVal($this->clePrimaire) != '') |
1789 |
|
$id = $this->getVal($this->clePrimaire); |
1790 |
|
else |
1791 |
|
$id=$this->id; |
1792 |
|
|
1793 |
|
$actions = array(); |
1794 |
|
//Tableau contenant le lien vers le PDF et lien du portlet pour la mise |
1795 |
|
//à jour de l'interface |
1796 |
|
if ( $status == 0 ){ |
1797 |
|
$lien = '../app/pdf_instruction.php?idx='.$id; |
1798 |
|
|
1799 |
|
//Ajout des actions |
1800 |
|
//Si l'utilisateur a le droit de modifier l'objet |
1801 |
|
if ( $this->f->isAccredited('instruction') || |
1802 |
|
$this->f->isAccredited('instruction_modifier') ){ |
1803 |
|
|
1804 |
|
$actions["modifier"] = ($sousform!='')? |
1805 |
|
'<li><a href="#" onclick="ajaxIt(\'instruction\', |
1806 |
|
\'../scr/sousform.php?obj=instruction&action=1&idx='. |
1807 |
|
$this->getVal($this->clePrimaire). |
1808 |
|
'&premiersf=0&trisf=&retourformulaire='.$retourformulaire.'&idxformulaire='. |
1809 |
|
$this->getVal("dossier"). |
1810 |
|
'&retour=form\');"> |
1811 |
|
<span class="om-prev-icon om-icon-16 edit-16" title="'. |
1812 |
|
_('Modifier').'">'. |
1813 |
|
_('Modifier'). |
1814 |
|
'</span></a></li>': |
1815 |
|
'<li> |
1816 |
|
<a href="form.php?obj=instruction&action=1'.'&idx='. |
1817 |
|
$this->getVal($this->clePrimaire). |
1818 |
|
'&premier=&advs_id=&recherche=&tricol=&selectioncol=&valide=&retour=form"> |
1819 |
|
<span class="om-prev-icon om-icon-16 edit-16" title="'. |
1820 |
|
_('Modifier').'">'. |
1821 |
|
_('Modifier'). |
1822 |
|
'</span></a></li>'; |
1823 |
|
} |
1824 |
|
//Si l'utilisateur a le droit de supprimer l'objet |
1825 |
|
if ( $this->f->isAccredited('instruction') || |
1826 |
|
$this->f->isAccredited('instruction_supprimer') ){ |
1827 |
|
|
1828 |
|
$actions["supprimer"] = ($sousform!='')? |
1829 |
|
'<li><a href="#" onclick="ajaxIt(\'instruction\', |
1830 |
|
\'../scr/sousform.php?obj=instruction&action=2&idx='. |
1831 |
|
$this->getVal($this->clePrimaire). |
1832 |
|
'&premiersf=0&trisf=&retourformulaire='.$retourformulaire.'&idxformulaire='. |
1833 |
|
$this->getVal("dossier"). |
1834 |
|
'&retour=form\');"> |
1835 |
|
<span class="om-prev-icon om-icon-16 delete-16" title="'. |
1836 |
|
_('Supprimer').'">'. |
1837 |
|
_('Supprimer'). |
1838 |
|
'</span></a></li>': |
1839 |
|
'<li> |
1840 |
|
<a href="form.php?obj=instruction&action=1'.'&idx='. |
1841 |
|
$this->getVal($this->clePrimaire). |
1842 |
|
'&premier=&advs_id=&recherche=&tricol=&selectioncol=&valide=&retour=form"> |
1843 |
|
<span class="om-prev-icon om-icon-16 delete-16" title="'. |
1844 |
|
_('Supprimer').'">'. |
1845 |
|
_('Supprimer'). |
1846 |
|
'</span></a></li>'; |
1847 |
|
} |
1848 |
|
} |
1849 |
|
else { |
1850 |
|
$lien = '../spg/file.php?obj=instruction&'. |
1851 |
|
'champ=om_fichier_instruction&id='.$id; |
1852 |
|
} |
1853 |
|
|
1854 |
|
$retour = array( |
1855 |
|
"portlet"=> "<a href=\"#\" onclick=\"finalizeDocument(". |
1856 |
|
$id.", 'instruction', '".$sousform."', ".(($status==0)?1:0).")\"> |
1857 |
|
<span class=\"om-prev-icon om-icon-16 om-icon-fix " |
1858 |
|
.(($status==1)?"de":"")."finalise\" title=\"". |
1859 |
|
(($status==1)?_("Reprendre la redaction du document"):_("Finaliser le document"))."\">". |
1860 |
|
(($status==1)?_("Reprendre la redaction du document"):_("Finaliser le document"))."</span> |
1861 |
|
</a>", |
1862 |
|
"pdf" => $lien, |
1863 |
|
"actions" => $actions |
1864 |
|
); |
1865 |
|
|
1866 |
|
foreach ( $this->champs as $key=>$value ) |
1867 |
|
$val[$value] = $this->val[$key]; |
1868 |
|
$val['date_evenement']=$this->dateDBToForm($val['date_evenement']); |
1869 |
|
$val['archive_date_complet']=$this->dateDBToForm($val['archive_date_complet']); |
1870 |
|
$val['archive_date_rejet']=$this->dateDBToForm($val['archive_date_rejet']); |
1871 |
|
$val['archive_date_limite']=$this->dateDBToForm($val['archive_date_limite']); |
1872 |
|
$val['archive_date_notification_delai']=$this->dateDBToForm($val['archive_date_notification_delai']); |
1873 |
|
$val['archive_date_decision']=$this->dateDBToForm($val['archive_date_decision']); |
1874 |
|
$val['archive_date_validite']=$this->dateDBToForm($val['archive_date_validite']); |
1875 |
|
$val['archive_date_achevement']=$this->dateDBToForm($val['archive_date_achevement']); |
1876 |
|
$val['archive_date_chantier']=$this->dateDBToForm($val['archive_date_chantier']); |
1877 |
|
$val['archive_date_conformite']=$this->dateDBToForm($val['archive_date_conformite']); |
1878 |
|
$val['archive_date_dernier_depot']=$this->dateDBToForm($val['archive_date_dernier_depot']); |
1879 |
|
$val['archive_date_limite_incompletude']=$this->dateDBToForm($val['archive_date_limite_incompletude']); |
1880 |
|
$val['date_finalisation_courrier']=$this->dateDBToForm($val['date_finalisation_courrier']); |
1881 |
|
$val['date_envoi_signature']=$this->dateDBToForm($val['date_envoi_signature']); |
1882 |
|
$val['date_retour_signature']=$this->dateDBToForm($val['date_retour_signature']); |
1883 |
|
$val['date_envoi_rar']=$this->dateDBToForm($val['date_envoi_rar']); |
1884 |
|
$val['date_retour_rar']=$this->dateDBToForm($val['date_retour_rar']); |
1885 |
|
$val['date_envoi_controle_legalite']=$this->dateDBToForm($val['date_envoi_controle_legalite']); |
1886 |
|
$val['date_retour_controle_legalite']=$this->dateDBToForm($val['date_retour_controle_legalite']); |
1887 |
|
|
1888 |
|
$this->setvalF($val); |
1889 |
|
|
1890 |
$dossier_autorisation->modifier($valDossierAutorisation, $this->db, DEBUG); |
// Verification de la validite des donnees |
1891 |
|
$this->verifier($this->val, $this->db, DEBUG); |
1892 |
// Suppression du liens entre les lots et le DA |
// Verification du verrou |
1893 |
$valLot['dossier_autorisation'] = NULL; |
$this->testverrou(); |
1894 |
$this->db->autoExecute(DB_PREFIXE."lot", $valLot, DB_AUTOQUERY_UPDATE, "dossier_autorisation='".$IDdossier_autorisation."'"); |
// Si les verifications precedentes sont correctes, on procede a |
1895 |
|
// la modification, sinon on ne fait rien et on retourne une erreur |
1896 |
// Liaison des lots du DI avec le DA |
if ($this->correct) { |
1897 |
$sqlLot = "SELECT lot FROM ".DB_PREFIXE."lien_dossier_lot WHERE dossier='".$this->valF['dossier']."'"; |
// Execution du trigger 'before' specifique au MODE 'update' |
1898 |
$res = $this->db->query($sqlLot); |
$this->triggermodifier( $id, $this->db, $this->val, DEBUG); |
1899 |
$this->addToLog($sqlLot); |
$valF = array( |
1900 |
$this->f->isDatabaseError(); |
"om_final_instruction"=> ($status==1)?TRUE:FALSE, |
1901 |
while($rowLot = $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
"om_fichier_instruction"=>$uid, |
1902 |
$valLot['dossier_autorisation'] = $IDdossier_autorisation; |
"date_finalisation_courrier"=>date('Y-m-d')); |
1903 |
$this->db->autoExecute(DB_PREFIXE."lot", $valLot, DB_AUTOQUERY_UPDATE, "lot=".$rowLot['lot']); |
// Execution de la requête de modification des donnees de l'attribut |
1904 |
|
// valF de l'objet dans l'attribut table de l'objet |
1905 |
|
$res = $this->db->autoExecute(DB_PREFIXE.$this->table, $valF, |
1906 |
|
DB_AUTOQUERY_UPDATE, $this->getCle($id)); |
1907 |
|
$this->addToLog("finaliser() : db->autoExecute(\"".DB_PREFIXE.$this->table."\", ".print_r($valF, true).", DB_AUTOQUERY_UPDATE, \"".$this->getCle($id)."\")", VERBOSE_MODE); |
1908 |
|
// Si une erreur survient |
1909 |
|
if (database::isError($res)) { |
1910 |
|
// Appel de la methode de recuperation des erreurs |
1911 |
|
$this->erreur_db($res->getDebugInfo(), $res->getMessage(), ''); |
1912 |
|
} else { |
1913 |
|
// Log |
1914 |
|
$this->addToLog(_("Requete executee"), VERBOSE_MODE); |
1915 |
|
// Log |
1916 |
|
$message = _("Enregistrement")." ".$id." "; |
1917 |
|
$message .= _("de la table")." \"".$this->table."\" "; |
1918 |
|
$message .= "[ ".$this->db->affectedRows()." "; |
1919 |
|
$message .= _("enregistrement(s) mis a jour")." ]"; |
1920 |
|
$this->addToLog($message, VERBOSE_MODE); |
1921 |
|
// Mise en place du verrou pour ne pas finaliser plusieurs fois |
1922 |
|
// le meme document |
1923 |
|
$this->verrouille(); |
1924 |
|
// Execution du trigger 'after' specifique au MODE 'update' |
1925 |
|
//$this->triggermodifierapres($id, $this->db, $val, DEBUG); |
1926 |
|
|
1927 |
|
return $retour; |
1928 |
|
} |
1929 |
|
} else { |
1930 |
|
// Message d'echec (saut d'une ligne supplementaire avant le |
1931 |
|
// message pour qu'il soit mis en evidence) |
1932 |
|
$this->addToLog(_("Finalisation non enregistree")); |
1933 |
|
return -1; |
1934 |
|
} |
1935 |
|
} |
1936 |
|
// Si le document n'a pas été stocké |
1937 |
|
else{ |
1938 |
|
return -1; |
1939 |
} |
} |
1940 |
} |
} |
1941 |
|
|
1942 |
// Récupération de l'identifiant du dossier d'autorisation lié au dossier d'instruction |
/** |
1943 |
function getDossierAutorisation($dossier_instruction){ |
* Récupération du numéro de dossier d'instruction à ajouter aux métadonnées |
1944 |
|
* @return string numéro de dossier d'instruction |
1945 |
|
*/ |
1946 |
|
protected function getDossier() { |
1947 |
|
if(empty($this->specificMetadata)) { |
1948 |
|
$this->getSpecificMetadata(); |
1949 |
|
} |
1950 |
|
return $this->specificMetadata->dossier; |
1951 |
|
} |
1952 |
|
/** |
1953 |
|
* Récupération la version du dossier d'instruction à ajouter aux métadonnées |
1954 |
|
* @return int Version |
1955 |
|
*/ |
1956 |
|
protected function getDossierVersion() { |
1957 |
|
if(empty($this->specificMetadata)) { |
1958 |
|
$this->getSpecificMetadata(); |
1959 |
|
} |
1960 |
|
return $this->specificMetadata->version; |
1961 |
|
} |
1962 |
|
/** |
1963 |
|
* Récupération du numéro de dossier d'autorisation à ajouter aux métadonnées |
1964 |
|
* @return string numéro de dossier d'autorisation |
1965 |
|
*/ |
1966 |
|
protected function getNumDemandeAutor() { |
1967 |
|
if(empty($this->specificMetadata)) { |
1968 |
|
$this->getSpecificMetadata(); |
1969 |
|
} |
1970 |
|
return $this->specificMetadata->dossier_autorisation; |
1971 |
|
} |
1972 |
|
/** |
1973 |
|
* Récupération de la date de demande initiale du dossier à ajouter aux métadonnées |
1974 |
|
* @return date de la demande initiale |
1975 |
|
*/ |
1976 |
|
protected function getAnneemoisDemandeAutor() { |
1977 |
|
if(empty($this->specificMetadata)) { |
1978 |
|
$this->getSpecificMetadata(); |
1979 |
|
} |
1980 |
|
return $this->specificMetadata->date_demande_initiale; |
1981 |
|
} |
1982 |
|
/** |
1983 |
|
* Récupération du type de dossier d'instruction à ajouter aux métadonnées |
1984 |
|
* @return string type du dossier d'instruction |
1985 |
|
*/ |
1986 |
|
protected function getTypeInstruction() { |
1987 |
|
if(empty($this->specificMetadata)) { |
1988 |
|
$this->getSpecificMetadata(); |
1989 |
|
} |
1990 |
|
return $this->specificMetadata->dossier_instruction_type; |
1991 |
|
} |
1992 |
|
/** |
1993 |
|
* Récupération du statut du dossier d'autorisation à ajouter aux métadonnées |
1994 |
|
* @return string avis |
1995 |
|
*/ |
1996 |
|
protected function getStatutAutorisation() { |
1997 |
|
if(empty($this->specificMetadata)) { |
1998 |
|
$this->getSpecificMetadata(); |
1999 |
|
} |
2000 |
|
return $this->specificMetadata->statut; |
2001 |
|
} |
2002 |
|
/** |
2003 |
|
* Récupération du type de dossier d'autorisation à ajouter aux métadonnées |
2004 |
|
* @return string type du dossier d'autorisation |
2005 |
|
*/ |
2006 |
|
protected function getTypeAutorisation() { |
2007 |
|
if(empty($this->specificMetadata)) { |
2008 |
|
$this->getSpecificMetadata(); |
2009 |
|
} |
2010 |
|
return $this->specificMetadata->dossier_autorisation_type; |
2011 |
|
} |
2012 |
|
/** |
2013 |
|
* Récupération de la date d'ajout de document à ajouter aux métadonnées |
2014 |
|
* @return date de l'évènement |
2015 |
|
*/ |
2016 |
|
protected function getDateEvenementDocument() { |
2017 |
|
return date("Y-m-d"); |
2018 |
|
} |
2019 |
|
/** |
2020 |
|
* Récupération du groupe d'instruction à ajouter aux métadonnées |
2021 |
|
* @return string Groupe d'instruction |
2022 |
|
*/ |
2023 |
|
protected function getGroupeInstruction() { |
2024 |
|
if(empty($this->specificMetadata)) { |
2025 |
|
$this->getSpecificMetadata(); |
2026 |
|
} |
2027 |
|
return $this->specificMetadata->groupe_instruction; |
2028 |
|
} |
2029 |
|
/** |
2030 |
|
* Récupération du libellé du type du document à ajouter aux métadonnées |
2031 |
|
* @return string Groupe d'instruction |
2032 |
|
*/ |
2033 |
|
protected function getTitle() { |
2034 |
|
|
2035 |
|
// Récupère le champ événement |
2036 |
|
if (isset($this->valF["evenement"]) AND $this->valF["evenement"] != "") { |
2037 |
|
$evenement = $this->valF["evenement"]; |
2038 |
|
} else { |
2039 |
|
$evenement = $this->getVal("evenement"); |
2040 |
|
} |
2041 |
|
|
2042 |
|
// Requête sql |
2043 |
|
$sql = "SELECT libelle FROM ".DB_PREFIXE."evenement |
2044 |
|
WHERE evenement=".$evenement; |
2045 |
|
$evenement_libelle = $this->db->getOne($sql); |
2046 |
|
$this->addToLog("getTitle(): db->getOne(\"".$sql."\");", VERBOSE_MODE); |
2047 |
|
if (database::isError($evenement_libelle)) { |
2048 |
|
die(); |
2049 |
|
} |
2050 |
|
|
2051 |
|
// Retourne le libelle de l'événement |
2052 |
|
return $evenement_libelle; |
2053 |
|
} |
2054 |
|
|
2055 |
|
/** |
2056 |
|
* Cette méthode permet de stocker en attribut toutes les métadonnées |
2057 |
|
* nécessaire à l'ajout d'un document. |
2058 |
|
*/ |
2059 |
|
public function getSpecificMetadata() { |
2060 |
|
if (isset($this->valF["dossier"]) AND $this->valF["dossier"] != "") { |
2061 |
|
$dossier = $this->valF["dossier"]; |
2062 |
|
} else { |
2063 |
|
$dossier = $this->getVal("dossier"); |
2064 |
|
} |
2065 |
|
//Requête pour récupérer les informations essentiels sur le dossier d'instruction |
2066 |
|
$sql = "SELECT dossier.dossier as dossier, |
2067 |
|
dossier_autorisation.dossier_autorisation as dossier_autorisation, |
2068 |
|
to_char(dossier.date_demande, 'YYYY/MM') as date_demande_initiale, |
2069 |
|
dossier_instruction_type.code as dossier_instruction_type, |
2070 |
|
etat_dossier_autorisation.libelle as statut, |
2071 |
|
dossier_autorisation_type.code as dossier_autorisation_type, |
2072 |
|
groupe.code as groupe_instruction |
2073 |
|
FROM ".DB_PREFIXE."dossier |
2074 |
|
LEFT JOIN ".DB_PREFIXE."dossier_instruction_type |
2075 |
|
ON dossier.dossier_instruction_type = dossier_instruction_type.dossier_instruction_type |
2076 |
|
LEFT JOIN ".DB_PREFIXE."dossier_autorisation |
2077 |
|
ON dossier.dossier_autorisation = dossier_autorisation.dossier_autorisation |
2078 |
|
LEFT JOIN ".DB_PREFIXE."etat_dossier_autorisation |
2079 |
|
ON dossier_autorisation.etat_dossier_autorisation = etat_dossier_autorisation.etat_dossier_autorisation |
2080 |
|
LEFT JOIN ".DB_PREFIXE."dossier_autorisation_type_detaille |
2081 |
|
ON dossier_autorisation.dossier_autorisation_type_detaille = dossier_autorisation_type_detaille.dossier_autorisation_type_detaille |
2082 |
|
LEFT JOIN ".DB_PREFIXE."dossier_autorisation_type |
2083 |
|
ON dossier_autorisation_type_detaille.dossier_autorisation_type = dossier_autorisation_type.dossier_autorisation_type |
2084 |
|
LEFT JOIN ".DB_PREFIXE."groupe |
2085 |
|
ON dossier_autorisation_type.groupe = groupe.groupe |
2086 |
|
WHERE dossier.dossier = '".$dossier."'"; |
2087 |
|
$res = $this->db->query($sql); |
2088 |
|
$this->f->addToLog("getSpecificMetadata() : db->query(".$sql.")", VERBOSE_MODE); |
2089 |
|
if ( database::isError($res)){ |
2090 |
|
die(); |
2091 |
|
} |
2092 |
|
|
2093 |
$sql = "SELECT |
//Le résultat est récupéré dans un objet |
2094 |
dossier_autorisation.dossier_autorisation |
$row =& $res->fetchRow(DB_FETCHMODE_OBJECT); |
2095 |
FROM |
|
2096 |
".DB_PREFIXE."dossier_autorisation |
//Si il y a un résultat |
2097 |
LEFT JOIN |
if ($row !== null) { |
2098 |
|
|
2099 |
|
//Génération du numéro de version |
2100 |
|
$sql = "SELECT |
2101 |
|
count(*) |
2102 |
|
FROM |
2103 |
".DB_PREFIXE."dossier |
".DB_PREFIXE."dossier |
2104 |
|
LEFT JOIN |
2105 |
|
".DB_PREFIXE."dossier_autorisation |
2106 |
ON |
ON |
2107 |
dossier_autorisation.dossier_autorisation = dossier.dossier_autorisation |
dossier_autorisation.dossier_autorisation = dossier.dossier_autorisation |
2108 |
|
LEFT JOIN |
2109 |
|
".DB_PREFIXE."dossier_instruction_type |
2110 |
|
ON |
2111 |
|
dossier_instruction_type.dossier_instruction_type = dossier.dossier_instruction_type |
2112 |
WHERE |
WHERE |
2113 |
dossier.dossier = '".$dossier_instruction."'"; |
dossier_autorisation.dossier_autorisation = '".$row->dossier_autorisation."' |
2114 |
|
AND |
2115 |
$IDdossier_autorisation = $this->db->getOne($sql); |
dossier_instruction_type.code = '".$row->dossier_instruction_type."'"; |
2116 |
$this->addToLog("getDossierAutorisation(): db->getone(\"".$sql."\")", VERBOSE_MODE); |
$row->version = $this->db->getOne($sql); |
2117 |
database::isError($IDdossier_autorisation); |
$this->f->addToLog("getSpecificMetadata(): db->getOne(\"".$sql."\")", VERBOSE_MODE); |
2118 |
|
if ( database::isError($row->version)){ |
2119 |
|
$this->f->addToError("", $row->version, $row->version); |
2120 |
|
return false; |
2121 |
|
} |
2122 |
|
|
2123 |
|
//Formatage du numéro de version |
2124 |
|
$row->version = str_pad($row->version, 2, "0", STR_PAD_LEFT); |
2125 |
|
|
2126 |
|
//Alors on créé l'objet dossier_instruction |
2127 |
|
$this->specificMetadata = $row; |
2128 |
|
|
2129 |
|
} |
2130 |
|
} |
2131 |
|
|
2132 |
|
/** |
2133 |
|
* Retourne le statut du dossier d'instruction |
2134 |
|
* @param string $idx Identifiant du dossier d'instruction |
2135 |
|
* @return string Le statut du dossier d'instruction |
2136 |
|
*/ |
2137 |
|
function getStatutAutorisationDossier($idx){ |
2138 |
|
|
2139 |
|
$statut = ''; |
2140 |
|
|
2141 |
|
//Si l'identifiant du dossier d'instruction fourni est correct |
2142 |
|
if ( $idx != '' ){ |
2143 |
|
|
2144 |
|
//On récupère le statut de l'état du dossier à partir de l'identifiant du |
2145 |
|
//dossier |
2146 |
|
$sql = "SELECT etat.statut |
2147 |
|
FROM ".DB_PREFIXE."dossier |
2148 |
|
LEFT JOIN |
2149 |
|
".DB_PREFIXE."etat |
2150 |
|
ON |
2151 |
|
dossier.etat = etat.etat |
2152 |
|
WHERE dossier ='".$idx."'"; |
2153 |
|
$statut = $this->db->getOne($sql); |
2154 |
|
$this->f->addToLog("getStatutAutorisationDossier() : db->getOne(\"".$sql."\")", VERBOSE_MODE); |
2155 |
|
if ( database::isError($statut)){ |
2156 |
|
die(); |
2157 |
|
} |
2158 |
|
} |
2159 |
|
return $statut; |
2160 |
|
} |
2161 |
|
|
2162 |
|
/** |
2163 |
|
* Récupère les données du dossier |
2164 |
|
* @return array |
2165 |
|
*/ |
2166 |
|
function get_dossier_actual() { |
2167 |
|
|
2168 |
|
// Initialisation de la valeur de retour |
2169 |
|
$return = array(); |
2170 |
|
|
2171 |
|
// Récupération de toutes les valeurs du dossier d'instruction en cours |
2172 |
|
$sql = "SELECT * FROM ".DB_PREFIXE."dossier |
2173 |
|
WHERE dossier='".$this->valF['dossier']."'"; |
2174 |
|
$res = $this->db->query($sql); |
2175 |
|
$this->addToLog("get_dossier_actual(): db->query(\"".$sql."\");", VERBOSE_MODE); |
2176 |
|
$this->f->isDatabaseError($res); |
2177 |
|
|
2178 |
|
// |
2179 |
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
2180 |
|
|
2181 |
|
// Récupération de la valeur actuelle du délai, de l'accord tacite, |
2182 |
|
// de l'état et de l'avis du dossier d'instruction |
2183 |
|
$return['archive_delai']=$row['delai']; |
2184 |
|
$return['archive_accord_tacite']=$row['accord_tacite']; |
2185 |
|
$return['archive_etat']=$row['etat']; |
2186 |
|
$return['archive_avis']=$row['avis_decision']; |
2187 |
|
// Récupération de la valeur actuelle des 9 dates du dossier |
2188 |
|
// d'instruction |
2189 |
|
$return['archive_date_complet']=$row['date_complet']; |
2190 |
|
$return['archive_date_dernier_depot']=$row['date_dernier_depot']; |
2191 |
|
$return['archive_date_rejet']= $row['date_rejet']; |
2192 |
|
$return['archive_date_limite']= $row['date_limite']; |
2193 |
|
$return['archive_date_notification_delai']= $row['date_notification_delai']; |
2194 |
|
$return['archive_date_decision']= $row['date_decision']; |
2195 |
|
$return['archive_date_validite']= $row['date_validite']; |
2196 |
|
$return['archive_date_achevement']= $row['date_achevement']; |
2197 |
|
$return['archive_date_chantier']= $row['date_chantier']; |
2198 |
|
$return['archive_date_conformite']= $row['date_conformite']; |
2199 |
|
$return['archive_incompletude']= $row['incompletude']; |
2200 |
|
$return['archive_evenement_suivant_tacite']= $row['evenement_suivant_tacite']; |
2201 |
|
$return['archive_evenement_suivant_tacite_incompletude']= $row['evenement_suivant_tacite_incompletude']; |
2202 |
|
$return['archive_etat_pendant_incompletude']= $row['etat_pendant_incompletude']; |
2203 |
|
$return['archive_date_limite_incompletude']= $row['date_limite_incompletude']; |
2204 |
|
$return['archive_delai_incompletude']= $row['delai_incompletude']; |
2205 |
|
$return['archive_autorite_competente']= $row['autorite_competente']; |
2206 |
|
$return['duree_validite']= $row['duree_validite']; |
2207 |
|
} |
2208 |
|
|
2209 |
|
// Retour de la fonction |
2210 |
|
return $return; |
2211 |
|
|
2212 |
|
} |
2213 |
|
|
2214 |
|
/** |
2215 |
|
* Permet de vérifier qu'un événement est verrouillable |
2216 |
|
* @param integer $idx Identifiant de l'instruction |
2217 |
|
* @return boolean |
2218 |
|
*/ |
2219 |
|
function checkEvenementNonVerrouillable($idx) { |
2220 |
|
|
2221 |
|
// Initialisation du résultat |
2222 |
|
$non_verrouillable = false; |
2223 |
|
|
2224 |
|
// Si la condition n'est pas vide |
2225 |
|
if ($idx != "") { |
2226 |
|
|
2227 |
|
// Requête SQL |
2228 |
|
$sql = "SELECT evenement.non_verrouillable |
2229 |
|
FROM ".DB_PREFIXE."evenement |
2230 |
|
LEFT JOIN ".DB_PREFIXE."instruction |
2231 |
|
ON instruction.evenement = evenement.evenement |
2232 |
|
WHERE instruction.instruction = $idx"; |
2233 |
|
$this->f->addToLog("checkEvenementNonVerrouillable() : db->getOne(\"".$sql."\")", VERBOSE_MODE); |
2234 |
|
$res = $this->db->getOne($sql); |
2235 |
|
$this->f->isDatabaseError($res); |
2236 |
|
|
2237 |
|
// Si le retour de la requête est true |
2238 |
|
if ($res == 't') { |
2239 |
|
// |
2240 |
|
$non_verrouillable = true; |
2241 |
|
} |
2242 |
|
} |
2243 |
|
|
2244 |
|
// Retourne résultat |
2245 |
|
return $non_verrouillable; |
2246 |
|
} |
2247 |
|
|
2248 |
|
/** |
2249 |
|
* Mise à jour des champs archive_* |
2250 |
|
* @param mixed $row La ligne de données |
2251 |
|
*/ |
2252 |
|
public function updateArchiveData($row){ |
2253 |
|
|
2254 |
return $IDdossier_autorisation; |
// Récupération de la valeur actuelle du délai, de l'accord tacite, |
2255 |
|
// de l'état et de l'avis du dossier d'instruction |
2256 |
|
$this->valF['archive_delai']=$row['delai']; |
2257 |
|
$this->valF['archive_accord_tacite']=$row['accord_tacite']; |
2258 |
|
$this->valF['archive_etat']=$row['etat']; |
2259 |
|
$this->valF['archive_avis']=$row['avis_decision']; |
2260 |
|
// Récupération de la valeur actuelle des 9 dates du dossier |
2261 |
|
// d'instruction |
2262 |
|
if ($row['date_complet'] != '') { |
2263 |
|
$this->valF['archive_date_complet']=$row['date_complet']; |
2264 |
|
} |
2265 |
|
if ($row['date_dernier_depot'] != '') { |
2266 |
|
$this->valF['archive_date_dernier_depot']=$row['date_dernier_depot']; |
2267 |
|
} |
2268 |
|
if ($row['date_rejet']!='') { |
2269 |
|
$this->valF['archive_date_rejet']= $row['date_rejet']; |
2270 |
|
} |
2271 |
|
if ($row['date_limite']!='') { |
2272 |
|
$this->valF['archive_date_limite']= $row['date_limite']; |
2273 |
|
} |
2274 |
|
if ($row['date_notification_delai']!='') { |
2275 |
|
$this->valF['archive_date_notification_delai']= $row['date_notification_delai']; |
2276 |
|
} |
2277 |
|
if ($row['date_decision']!='') { |
2278 |
|
$this->valF['archive_date_decision']= $row['date_decision']; |
2279 |
|
} |
2280 |
|
if ($row['date_validite']!='') { |
2281 |
|
$this->valF['archive_date_validite']= $row['date_validite']; |
2282 |
|
} |
2283 |
|
if ($row['date_achevement']!='') { |
2284 |
|
$this->valF['archive_date_achevement']= $row['date_achevement']; |
2285 |
|
} |
2286 |
|
if ($row['date_chantier']!='') { |
2287 |
|
$this->valF['archive_date_chantier']= $row['date_chantier']; |
2288 |
|
} |
2289 |
|
if ($row['date_conformite']!='') { |
2290 |
|
$this->valF['archive_date_conformite']= $row['date_conformite']; |
2291 |
|
} |
2292 |
|
if ($row['incompletude']!='') { |
2293 |
|
$this->valF['archive_incompletude']= $row['incompletude']; |
2294 |
|
} |
2295 |
|
if ($row['evenement_suivant_tacite']!='') { |
2296 |
|
$this->valF['archive_evenement_suivant_tacite']= $row['evenement_suivant_tacite']; |
2297 |
|
} |
2298 |
|
if ($row['evenement_suivant_tacite_incompletude']!='') { |
2299 |
|
$this->valF['archive_evenement_suivant_tacite_incompletude']= $row['evenement_suivant_tacite_incompletude']; |
2300 |
|
} |
2301 |
|
if ($row['etat_pendant_incompletude']!='') { |
2302 |
|
$this->valF['archive_etat_pendant_incompletude']= $row['etat_pendant_incompletude']; |
2303 |
|
} |
2304 |
|
if ($row['date_limite_incompletude']!='') { |
2305 |
|
$this->valF['archive_date_limite_incompletude']= $row['date_limite_incompletude']; |
2306 |
|
} |
2307 |
|
if ($row['delai_incompletude']!='') { |
2308 |
|
$this->valF['archive_delai_incompletude']= $row['delai_incompletude']; |
2309 |
|
} |
2310 |
|
if ($row['autorite_competente']!='') { |
2311 |
|
$this->valF['archive_autorite_competente']= $row['autorite_competente']; |
2312 |
|
} |
2313 |
|
if ($row['duree_validite']!='') { |
2314 |
|
$this->valF['duree_validite']= $row['duree_validite']; |
2315 |
|
} |
2316 |
} |
} |
2317 |
}// fin classe |
}// fin classe |
2318 |
?> |
?> |