1 |
fraynaud |
3 |
<?php |
2 |
fmichon |
1540 |
/** |
3 |
|
|
* |
4 |
|
|
* |
5 |
|
|
* specific : |
6 |
|
|
* - cle secondaire |
7 |
|
|
* destruction autorisée que pour le dernier evenement |
8 |
|
|
* [delete the last event ] |
9 |
|
|
* - variable globale [global variables] |
10 |
|
|
* var $archive_date_depot; |
11 |
|
|
* var $retourformulaire; |
12 |
|
|
* var $idxformulaire; |
13 |
|
|
* - modification des données dans dossier trigger avant |
14 |
|
|
* [modify dossier data with trigger function] |
15 |
|
|
* - function moisdate : pour ajouter des mois a une date |
16 |
|
|
* [add months (delay) and calculation final date] |
17 |
|
|
* - voir script_lang.js : bible ... |
18 |
|
|
* |
19 |
|
|
* @package openfoncier |
20 |
|
|
* @version SVN : $Id$ |
21 |
|
|
*/ |
22 |
fraynaud |
3 |
|
23 |
fmichon |
1540 |
// |
24 |
|
|
require_once "../gen/obj/instruction.class.php"; |
25 |
|
|
|
26 |
|
|
// |
27 |
|
|
require_once "../services/outgoing/messageenqueuer.php"; |
28 |
|
|
|
29 |
|
|
// |
30 |
fraynaud |
3 |
class instruction extends instruction_gen { |
31 |
|
|
|
32 |
fraynaud |
20 |
var $archive_date_depot; // specific |
33 |
|
|
var $retourformulaire; // specific |
34 |
|
|
var $idxformulaire; // specific |
35 |
fraynaud |
3 |
|
36 |
fmichon |
1540 |
function instruction($id, &$db, $debug) { |
37 |
|
|
$this->constructeur($id, $db, $debug); |
38 |
|
|
} |
39 |
fraynaud |
20 |
|
40 |
fmichon |
944 |
// {{{ Gestion de la confidentialité des données spécifiques |
41 |
|
|
|
42 |
|
|
/** |
43 |
|
|
* Surcharge pour gérer les actions disponibles dans le portlet |
44 |
|
|
*/ |
45 |
|
|
function checkAccessibility() { |
46 |
|
|
// |
47 |
|
|
parent::checkAccessibility(); |
48 |
fmichon |
1540 |
// Si l'utilisateur est un intructeur qui ne correspond pas à la |
49 |
fmichon |
944 |
// division du dossier |
50 |
|
|
if ($this->f->isUserInstructeur() |
51 |
|
|
&& isset($this->f->om_utilisateur["division"]) |
52 |
|
|
&& $this->f->om_utilisateur["division"] != $this->getDivisionFromDossier()) { |
53 |
|
|
// |
54 |
|
|
$this->actions_sup = array(); |
55 |
|
|
$this->setParameter("actions", array()); |
56 |
|
|
} |
57 |
|
|
// Si une action 'lu' est présente et que le champ lu est à true |
58 |
|
|
// on supprime l'action |
59 |
|
|
if (isset($this->actions_sup["lu"]) |
60 |
|
|
&& isset($this->val[array_search("lu", $this->champs)]) |
61 |
|
|
&& $this->val[array_search("lu", $this->champs)]== "t") { |
62 |
|
|
unset($this->actions_sup["lu"]); |
63 |
|
|
} |
64 |
|
|
} |
65 |
|
|
|
66 |
|
|
/** |
67 |
|
|
* Cette methode est à surcharger elle permet de tester dans chaque classe |
68 |
|
|
* des droits des droits spécifiques en fonction des données |
69 |
|
|
*/ |
70 |
|
|
function canAccess() { |
71 |
|
|
// Si l'utilisateur est un intructeur qui ne correspond pas à la |
72 |
|
|
// division du dossier |
73 |
|
|
if ($this->f->isUserInstructeur() |
74 |
|
|
&& $this->f->om_utilisateur["division"] != $this->getDivisionFromDossier() |
75 |
|
|
&& $this->getParameter("maj") != 3) { |
76 |
|
|
// |
77 |
|
|
return false; |
78 |
|
|
} |
79 |
|
|
// |
80 |
|
|
return true; |
81 |
|
|
} |
82 |
|
|
|
83 |
|
|
/** |
84 |
|
|
* Cette méthode permet de récupérer la division d'un dossier |
85 |
|
|
*/ |
86 |
|
|
function getDivisionFromDossier() { |
87 |
|
|
// |
88 |
|
|
if (!isset($this->val[array_search("dossier", $this->champs)])) { |
89 |
|
|
return NULL; |
90 |
|
|
} |
91 |
|
|
// |
92 |
|
|
$sql = "select division from ".DB_PREFIXE."dossier "; |
93 |
|
|
$sql .= " where dossier='".$this->val[array_search("dossier", $this->champs)]."'"; |
94 |
|
|
// |
95 |
|
|
$division = $this->db->getOne($sql); |
96 |
|
|
$this->addToLog("getDivisionFromDossier(): db->getone(\"".$sql."\")", VERBOSE_MODE); |
97 |
|
|
database::isError($division); |
98 |
|
|
// |
99 |
|
|
return $division; |
100 |
|
|
} |
101 |
|
|
|
102 |
|
|
// }}} |
103 |
|
|
|
104 |
fmichon |
1540 |
function setType(&$form, $maj) { |
105 |
|
|
// |
106 |
|
|
parent::setType($form, $maj); |
107 |
|
|
// On cache tous les champs |
108 |
|
|
// XXX |
109 |
fraynaud |
20 |
$form->setType('complement3', 'hidden'); |
110 |
|
|
$form->setType('bible3', 'hidden'); |
111 |
|
|
$form->setType('complement4', 'hidden'); |
112 |
|
|
$form->setType('bible4', 'hidden'); |
113 |
|
|
$form->setType('complement5', 'hidden'); |
114 |
|
|
$form->setType('bible5', 'hidden'); |
115 |
|
|
$form->setType('complement6', 'hidden'); |
116 |
|
|
$form->setType('bible6', 'hidden'); |
117 |
|
|
$form->setType('complement7', 'hidden'); |
118 |
|
|
$form->setType('bible7', 'hidden'); |
119 |
|
|
$form->setType('complement8', 'hidden'); |
120 |
|
|
$form->setType('bible8', 'hidden'); |
121 |
|
|
$form->setType('complement9', 'hidden'); |
122 |
|
|
$form->setType('bible9', 'hidden'); |
123 |
|
|
$form->setType('complement10', 'hidden'); |
124 |
|
|
$form->setType('bible10', 'hidden'); |
125 |
|
|
$form->setType('complement11', 'hidden'); |
126 |
|
|
$form->setType('bible11', 'hidden'); |
127 |
|
|
$form->setType('complement12', 'hidden'); |
128 |
|
|
$form->setType('bible12', 'hidden'); |
129 |
|
|
$form->setType('complement13', 'hidden'); |
130 |
|
|
$form->setType('bible13', 'hidden'); |
131 |
|
|
$form->setType('complement14', 'hidden'); |
132 |
|
|
$form->setType('bible14', 'hidden'); |
133 |
|
|
$form->setType('complement15', 'hidden'); |
134 |
|
|
$form->setType('bible15', 'hidden'); |
135 |
fmichon |
1540 |
// |
136 |
fraynaud |
20 |
$form->setType('delai', 'hidden'); |
137 |
|
|
$form->setType('etat', 'hidden'); |
138 |
|
|
$form->setType('accord_tacite', 'hidden'); |
139 |
|
|
$form->setType('action', 'hidden'); |
140 |
|
|
$form->setType('delai_notification', 'hidden'); |
141 |
vpihour |
489 |
$form->setType('avis_decision', 'hidden'); |
142 |
fmichon |
1540 |
// |
143 |
fraynaud |
20 |
$form->setType('archive_delai', 'hidden'); |
144 |
|
|
$form->setType('archive_etat', 'hidden'); |
145 |
|
|
$form->setType('archive_accord_tacite', 'hidden'); |
146 |
|
|
$form->setType('archive_avis', 'hidden'); |
147 |
|
|
$form->setType('archive_date_complet', 'hidden'); |
148 |
|
|
$form->setType('archive_date_rejet', 'hidden'); |
149 |
|
|
$form->setType('archive_date_limite', 'hidden'); |
150 |
|
|
$form->setType('archive_date_notification_delai', 'hidden'); |
151 |
|
|
$form->setType('archive_date_decision', 'hidden'); |
152 |
|
|
$form->setType('archive_date_validite', 'hidden'); |
153 |
|
|
$form->setType('archive_date_achevement', 'hidden'); |
154 |
|
|
$form->setType('archive_date_conformite', 'hidden'); |
155 |
nhaye |
428 |
$form->setType('archive_date_chantier', 'hidden'); |
156 |
fmichon |
1540 |
// |
157 |
vpihour |
1307 |
$form->setType('numero_arrete', 'hidden'); |
158 |
fmichon |
1540 |
|
159 |
|
|
// |
160 |
|
|
if ($maj < 2) { //ajouter et modifier |
161 |
|
|
$form->setType('destinataire', 'hidden'); |
162 |
|
|
$form->setType('lettretype', 'hiddenstatic'); |
163 |
|
|
$form->setType('complement', 'textarea'); |
164 |
|
|
$form->setType('complement2', 'textarea'); |
165 |
|
|
$form->setType('bible_auto', 'httpclick'); |
166 |
|
|
$form->setType('bible', 'httpclick'); |
167 |
|
|
$form->setType('bible2', 'httpclick'); |
168 |
|
|
$form->setType('dossier', 'hidden'); |
169 |
|
|
$form->setType('libelle', 'hiddenstatic'); |
170 |
|
|
$form->setType('signataire_arrete','select'); |
171 |
nhaye |
1564 |
$form->setType('date_envoi_signature','datedisabled'); |
172 |
|
|
$form->setType('date_retour_signature','datedisabled'); |
173 |
|
|
$form->setType('date_envoi_rar','datedisabled'); |
174 |
|
|
$form->setType('date_retour_rar','datedisabled'); |
175 |
|
|
$form->setType('date_envoi_controle_legalite','datedisabled'); |
176 |
|
|
$form->setType('date_retour_controle_legalite','datedisabled'); |
177 |
fmichon |
1540 |
if($maj==0){ // add |
178 |
|
|
$form->setType('instruction', 'hiddenstatic'); |
179 |
|
|
$form->setType('evenement', 'select'); |
180 |
|
|
$form->setType('date_evenement', 'date2'); |
181 |
|
|
}else{ // modify |
182 |
|
|
$form->setType('instruction', 'hiddenstatic'); |
183 |
|
|
$form->setType('evenement', 'selecthiddenstatic'); |
184 |
|
|
//$form->setType('date_evenement', 'hiddenstaticdate'); |
185 |
|
|
$form->setType('date_evenement', 'date2'); |
186 |
|
|
// necessaire pour calcul de date en modification |
187 |
|
|
//$form->setType('delai', 'hiddenstatic'); |
188 |
|
|
} |
189 |
|
|
} elseif($maj==2){ |
190 |
|
|
$form->setType('dossier', 'hidden'); |
191 |
|
|
$form->setType('bible_auto', 'hidden'); |
192 |
|
|
$form->setType('bible', 'hidden'); |
193 |
|
|
$form->setType('bible2', 'hidden'); |
194 |
|
|
}else { |
195 |
|
|
$form->setType('destinataire', 'hidden'); |
196 |
|
|
$form->setType('dossier', 'hidden'); |
197 |
|
|
$form->setType('bible_auto', 'hidden'); |
198 |
|
|
$form->setType('bible', 'hidden'); |
199 |
|
|
$form->setType('bible2', 'hidden'); |
200 |
|
|
} |
201 |
fraynaud |
20 |
} |
202 |
fmichon |
1540 |
|
203 |
|
|
function setSelect(&$form, $maj,&$db,$debug) { |
204 |
|
|
/** |
205 |
|
|
* On ne surcharge pas la méthode parent car une requête sur la table |
206 |
|
|
* dossier est mauvaise pour les performances, car la requête qui |
207 |
|
|
* concerne evenement est plus complexe que celle générée et car les |
208 |
|
|
* champs action, avis_decision et etat ne sont pas utilisés comme des |
209 |
|
|
* select |
210 |
|
|
*/ |
211 |
atreal |
312 |
if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc.php")) |
212 |
|
|
include ("../sql/".$db->phptype."/".$this->table.".form.inc.php"); |
213 |
fmichon |
1540 |
elseif(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc")) |
214 |
|
|
include ("../sql/".$db->phptype."/".$this->table.".form.inc"); |
215 |
nhaye |
428 |
|
216 |
fmichon |
1540 |
//// action |
217 |
|
|
//$this->init_select($form, $db, $maj, $debug, "action", |
218 |
|
|
// $sql_action, $sql_action_by_id, false); |
219 |
vpihour |
1227 |
|
220 |
fmichon |
1540 |
//// avis_decision |
221 |
|
|
//$this->init_select($form, $db, $maj, $debug, "avis_decision", |
222 |
|
|
// $sql_avis_decision, $sql_avis_decision_by_id, false); |
223 |
nhaye |
1140 |
|
224 |
fmichon |
1540 |
//// dossier |
225 |
|
|
//$this->init_select($form, $db, $maj, $debug, "dossier", |
226 |
|
|
// $sql_dossier, $sql_dossier_by_id, false); |
227 |
nhaye |
428 |
|
228 |
fmichon |
1540 |
//// etat |
229 |
|
|
//$this->init_select($form, $db, $maj, $debug, "etat", |
230 |
|
|
// $sql_etat, $sql_etat_by_id, false); |
231 |
|
|
|
232 |
|
|
//// evenement |
233 |
|
|
//$this->init_select($form, $db, $maj, $debug, "evenement", |
234 |
|
|
// $sql_evenement, $sql_evenement_by_id, false); |
235 |
|
|
|
236 |
|
|
// signataire_arrete |
237 |
|
|
$this->init_select($form, $db, $maj, $debug, "signataire_arrete", |
238 |
|
|
$sql_signataire_arrete, $sql_signataire_arrete_by_id, true); |
239 |
|
|
|
240 |
|
|
/** |
241 |
|
|
* Gestion du filtre sur les événements de workflow disponibles |
242 |
|
|
* On récupère ici en fonction de l'état du dossier d'instruction en |
243 |
|
|
* cours et du type du dossier d'instruction en cours la liste |
244 |
|
|
* événements disponibles. |
245 |
|
|
*/ |
246 |
|
|
if ($maj == 0) { |
247 |
|
|
// Récupération des événements par une jointure entre la table dossier |
248 |
|
|
// et la table transition et la table evenement et la table |
249 |
|
|
// lien_dossier_instruction_type_evenement en fonction de l'identifiant |
250 |
|
|
// du dossier d'instruction en cours |
251 |
|
|
$sql = "SELECT |
252 |
|
|
evenement.evenement, |
253 |
|
|
(evenement.libelle||' ['||evenement.action||']') as lib |
254 |
|
|
FROM ".DB_PREFIXE."dossier |
255 |
|
|
INNER JOIN ".DB_PREFIXE."lien_dossier_instruction_type_evenement |
256 |
|
|
ON dossier.dossier_instruction_type=lien_dossier_instruction_type_evenement.dossier_instruction_type |
257 |
|
|
INNER JOIN ".DB_PREFIXE."evenement |
258 |
|
|
ON evenement.evenement=lien_dossier_instruction_type_evenement.evenement |
259 |
|
|
INNER JOIN ".DB_PREFIXE."transition |
260 |
|
|
ON evenement.evenement = transition.evenement |
261 |
|
|
AND dossier.etat=transition.etat |
262 |
|
|
WHERE dossier.dossier='".$this->idxformulaire."' |
263 |
|
|
ORDER BY evenement.action"; |
264 |
|
|
$res = $db->query($sql); |
265 |
|
|
$this->addToLog("setSelect(): db->query(\"".$sql."\");", VERBOSE_MODE); |
266 |
|
|
if (database::isError($res)) { |
267 |
|
|
die($res->getMessage()); |
268 |
fraynaud |
20 |
} |
269 |
fmichon |
1540 |
// Remplissage du tableau du select |
270 |
|
|
$contenu = array( |
271 |
|
|
0 => array("",), |
272 |
|
|
1 => array(_('choisir')." "._('evenement'),) |
273 |
|
|
); |
274 |
|
|
while ($row=& $res->fetchRow()) { |
275 |
|
|
$contenu[0][] = $row[0]; |
276 |
|
|
$contenu[1][] = $row[1]; |
277 |
|
|
} |
278 |
|
|
$form->setSelect("evenement", $contenu); |
279 |
|
|
} else { |
280 |
|
|
$sql = "SELECT |
281 |
|
|
(evenement.libelle||' ['||evenement.action||']') as lib |
282 |
|
|
FROM ".DB_PREFIXE."evenement |
283 |
|
|
WHERE evenement.evenement=".$this->getVal("evenement").""; |
284 |
|
|
$res = $db->getone($sql); |
285 |
|
|
$this->addToLog("setSelect(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
286 |
|
|
if (database::isError($res)) { |
287 |
|
|
die($res->getMessage()); |
288 |
|
|
} |
289 |
|
|
// |
290 |
|
|
$contenu = array( |
291 |
|
|
0 => array($this->getVal("evenement"),), |
292 |
|
|
1 => array($res,) |
293 |
|
|
); |
294 |
|
|
$form->setSelect("evenement", $contenu); |
295 |
fraynaud |
20 |
} |
296 |
fmichon |
1540 |
|
297 |
|
|
/** |
298 |
|
|
* Gesion des liens vers la bible |
299 |
|
|
*/ |
300 |
|
|
// lien bible_auto |
301 |
|
|
$contenu = array(_("automatique")); |
302 |
nhaye |
428 |
$form->setSelect("bible_auto",$contenu); |
303 |
|
|
// lien bible1 |
304 |
fmichon |
1540 |
$contenu = array(_("bible")); |
305 |
nhaye |
428 |
$form->setSelect("bible",$contenu); |
306 |
|
|
// lien bible2 |
307 |
fmichon |
1540 |
$contenu = array(_("bible")); |
308 |
nhaye |
428 |
$form->setSelect("bible2",$contenu); |
309 |
fmichon |
1540 |
} |
310 |
fraynaud |
20 |
|
311 |
fmichon |
1540 |
function cleSecondaire($id, &$db, $val, $DEBUG) { |
312 |
|
|
// |
313 |
|
|
parent::cleSecondaire($id, $db, $val, $DEBUG); |
314 |
|
|
|
315 |
|
|
/** |
316 |
|
|
* Vérification que l'élément supprimé est le dernier pour pouvoir |
317 |
|
|
* remodifier les données de manière itérative. |
318 |
|
|
*/ |
319 |
|
|
// Initialisation |
320 |
|
|
$dernierevenement = ""; |
321 |
|
|
// Récupération du dernier élément de la table d'instruction qui |
322 |
|
|
// concerne le dossier en cours |
323 |
|
|
$sql = "SELECT max(instruction) |
324 |
|
|
FROM ".DB_PREFIXE."instruction |
325 |
|
|
WHERE dossier ='".$this->idxformulaire."'"; |
326 |
|
|
$dernierevenement = $db->getOne($sql); |
327 |
|
|
$this->addToLog("setSelect(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
328 |
|
|
if (database::isError($dernierevenement)) { |
329 |
|
|
die($dernierevenement->getMessage()); |
330 |
|
|
} |
331 |
|
|
// Si on se trouve effectivement sur le dernier evenement d'instruction |
332 |
|
|
if ($dernierevenement == $id) { |
333 |
|
|
// Alors on valide la suppression |
334 |
|
|
$this->correct = true; |
335 |
|
|
$this->addToMessage(_('Destruction_chronologique')); |
336 |
|
|
} else { |
337 |
|
|
// Alors on annule la suppression |
338 |
|
|
$this->correct = false; |
339 |
|
|
$this->addToMessage(_("Seul le dernier evenement d'instruction peut etre supprime.")); |
340 |
|
|
} |
341 |
|
|
} |
342 |
|
|
|
343 |
nhaye |
1564 |
// Vérification de la non modification des dates de suivi |
344 |
|
|
function updateDate($champ) { |
345 |
|
|
if($this->valF[$champ] != "") { |
346 |
|
|
if($this->getVal($champ) != "" AND $this->getVal($champ) != $this->valF[$champ]) { |
347 |
|
|
$this->correct = false; |
348 |
|
|
$this->addToMessage(_("Les dates de suivis ne peuvent etre modifiees")); |
349 |
|
|
} |
350 |
|
|
} |
351 |
|
|
} |
352 |
|
|
|
353 |
fmichon |
1540 |
// Sélectionne le signataire_arrete par défaut |
354 |
|
|
function setVal(&$form,$maj,$validation){ |
355 |
|
|
|
356 |
|
|
// Ajout |
357 |
|
|
if($maj == 0) { |
358 |
|
|
|
359 |
|
|
// Création de la requête |
360 |
|
|
$sql = "SELECT signataire_arrete |
361 |
|
|
FROM ".DB_PREFIXE."signataire_arrete |
362 |
|
|
WHERE defaut IS TRUE"; |
363 |
|
|
|
364 |
|
|
// Exécution de la requête |
365 |
|
|
$this->f->addToLog("deleteAllLienDossierInstructionTypeEvenementEvenement(): db->query(\"".$sql."\");", VERBOSE_MODE); |
366 |
|
|
$res = $this->f->db->query($sql); |
367 |
|
|
$this->f->isDatabaseError(); |
368 |
|
|
|
369 |
|
|
$row = $res->fetchrow(DB_FETCHMODE_ASSOC); |
370 |
|
|
|
371 |
|
|
if ( isset($row['signataire_arrete']) && is_numeric($row['signataire_arrete'])){ |
372 |
|
|
|
373 |
|
|
$form->setVal("signataire_arrete",$row['signataire_arrete']); |
374 |
|
|
} |
375 |
|
|
} |
376 |
|
|
} |
377 |
|
|
|
378 |
|
|
/*Met des valeurs par défaut dans certains des sous-formulaire*/ |
379 |
|
|
function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire){ |
380 |
|
|
if ($validation==0 and $maj<2) { |
381 |
|
|
if ($maj == 0){ |
382 |
|
|
$form->setVal("destinataire", $idxformulaire); |
383 |
|
|
$form->setVal("dossier", $idxformulaire); |
384 |
|
|
$form->setVal("date_evenement", date('Y-m-d')); |
385 |
|
|
} |
386 |
|
|
$form->setVal("bible_auto","bible_auto()"); |
387 |
|
|
$form->setVal("bible","bible()"); |
388 |
|
|
$form->setVal("bible2","bible2()"); |
389 |
|
|
} |
390 |
|
|
$this->retourformulaire=$retourformulaire; |
391 |
|
|
$this->idxformulaire=$idxformulaire; |
392 |
|
|
} |
393 |
|
|
|
394 |
|
|
|
395 |
nhaye |
1439 |
function setLayout(&$form, $maj){ |
396 |
|
|
if ( $maj < 2 OR $maj == 3 ) { |
397 |
|
|
/*Champ sur lequel s'ouvre le bloc 1 */ |
398 |
|
|
$form->setBloc('evenement','D',"","col_12"); |
399 |
fraynaud |
20 |
|
400 |
nhaye |
1439 |
$form->setFieldset('evenement','D',_('Evenement')); |
401 |
|
|
$form->setFieldset('lettretype','F',''); |
402 |
|
|
|
403 |
|
|
$form->setBloc('lettretype','F'); |
404 |
|
|
|
405 |
|
|
$form->setBloc('date_finalisation_courrier','D',"","col_12"); |
406 |
|
|
|
407 |
|
|
$form->setFieldset('date_finalisation_courrier','D',_('Dates')); |
408 |
|
|
$form->setBloc('date_finalisation_courrier','D',"","col_6"); |
409 |
|
|
$form->setBloc('date_envoi_controle_legalite','F'); |
410 |
|
|
|
411 |
|
|
$form->setBloc('signataire_arrete','D',"","col_6"); |
412 |
|
|
$form->setBloc('date_retour_controle_legalite','F'); |
413 |
|
|
$form->setFieldset('date_retour_controle_legalite','F',''); |
414 |
|
|
|
415 |
|
|
$form->setBloc('date_retour_controle_legalite','F'); |
416 |
|
|
|
417 |
|
|
$form->setBloc('complement','D',"","col_12"); |
418 |
|
|
$form->setFieldset('complement','D',_('Complement')); |
419 |
|
|
$form->setFieldset('bible','F',''); |
420 |
|
|
$form->setBloc('bible','F'); |
421 |
|
|
|
422 |
|
|
$form->setBloc('complement2','D',"","col_12"); |
423 |
|
|
$form->setFieldset('complement2','D',_('Complement 2')); |
424 |
|
|
$form->setFieldset('bible2','F',''); |
425 |
|
|
$form->setBloc('bible2','F'); |
426 |
|
|
} |
427 |
fraynaud |
20 |
} |
428 |
|
|
|
429 |
fmichon |
1540 |
function setLib(&$form, $maj) { |
430 |
|
|
// |
431 |
|
|
parent::setLib($form, $maj); |
432 |
|
|
// |
433 |
|
|
$form->setLib('bible_auto', ""); |
434 |
|
|
$form->setLib('bible', ""); |
435 |
|
|
$form->setLib('bible2', ""); |
436 |
fraynaud |
20 |
} |
437 |
|
|
|
438 |
fmichon |
1540 |
function triggerajouter($id, &$db, $val, $DEBUG) { |
439 |
|
|
/** |
440 |
|
|
* Le code suivant permet de récupérer des valeurs des tables evenement |
441 |
|
|
* et dossier pour les stocker dans l'instruction : |
442 |
|
|
* DEPUIS L'EVENEMENT |
443 |
|
|
* - action |
444 |
|
|
* - delai |
445 |
|
|
* - accord_tacite |
446 |
|
|
* - etat |
447 |
|
|
* - avis_decision |
448 |
|
|
* - delai_notification |
449 |
|
|
* - lettretype |
450 |
|
|
* DEPUIS LE DOSSIER D'INSTRUCTION |
451 |
|
|
* - archive_delai |
452 |
|
|
* - archive_accord_tacite |
453 |
|
|
* - archive_etat |
454 |
|
|
* - archive_avis |
455 |
|
|
* - date_complet |
456 |
|
|
* - date_rejet |
457 |
|
|
* - date_limite |
458 |
|
|
* - date_notification_delai |
459 |
|
|
* - date_decision |
460 |
|
|
* - date_validite |
461 |
|
|
* - date_achevement |
462 |
|
|
* - date_chantier |
463 |
|
|
* - date_conformite |
464 |
|
|
* Il permet également de stocker la date_depot du dossier d'instruction |
465 |
|
|
* dans l'attribut $this->archive_date_depot de la classe. |
466 |
|
|
*/ |
467 |
|
|
// Récupération de tous les paramètres de l'événement sélectionné |
468 |
|
|
$sql = "SELECT * FROM ".DB_PREFIXE."evenement |
469 |
|
|
WHERE evenement=".$this->valF['evenement']; |
470 |
fraynaud |
20 |
$res = $db->query($sql); |
471 |
fmichon |
1540 |
$this->addToLog("triggerajouter(): db->query(\"".$sql."\");", VERBOSE_MODE); |
472 |
|
|
if (database::isError($res)) { |
473 |
|
|
die($res->getMessage()); |
474 |
|
|
} |
475 |
|
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
476 |
|
|
// Récupération de l'identifiant de l'action |
477 |
|
|
// si une action est paramétrée dans l'événement |
478 |
|
|
$this->valF['action'] = NULL; |
479 |
|
|
if (isset($row['action']) and !empty($row['action'])) { |
480 |
nhaye |
460 |
$this->valF['action']=$row['action']; |
481 |
|
|
} |
482 |
fmichon |
1540 |
// Récupération de la valeur du délai |
483 |
|
|
$this->valF['delai'] = $row['delai']; |
484 |
|
|
// Récupération de l'identifiant de l'état |
485 |
|
|
// si un état est paramétré dans l'événement |
486 |
|
|
$this->valF['etat']=NULL; |
487 |
|
|
if (isset($row['etat']) and !empty($row['etat'])) { |
488 |
nhaye |
460 |
$this->valF['etat']=$row['etat']; |
489 |
|
|
} |
490 |
fmichon |
1540 |
// Récupération de la valeur d'accord tacite |
491 |
fraynaud |
20 |
$this->valF['accord_tacite']=$row['accord_tacite']; |
492 |
fmichon |
1540 |
// Récupération de la valeur du délai de notification |
493 |
fraynaud |
20 |
$this->valF['delai_notification']=$row['delai_notification']; |
494 |
fmichon |
1540 |
// Récupération de l'identifiant de l'avis |
495 |
|
|
// si un avis est paramétré dans l'événement |
496 |
|
|
$this->valF['avis_decision'] = NULL; |
497 |
vpihour |
489 |
if(isset($row['avis_decision']) and !empty($row['avis_decision'])) { |
498 |
|
|
$this->valF['avis_decision']=$row['avis_decision']; |
499 |
fmichon |
1540 |
} |
500 |
|
|
// Récupération de la valeur de la lettre type |
501 |
|
|
// Sinon on lui affecte lavaleur par défaut standard |
502 |
|
|
if ($row['lettretype'] != "") { |
503 |
|
|
$this->valF['lettretype']=$row['lettretype']; |
504 |
nhaye |
460 |
} else { |
505 |
fmichon |
1540 |
$this->valF['lettretype'] = "standard"; // XXX |
506 |
nhaye |
460 |
} |
507 |
fraynaud |
20 |
} |
508 |
fmichon |
1540 |
// Récupération de toutes les valeurs du dossier d'instruction en cours |
509 |
|
|
$sql = "SELECT * FROM ".DB_PREFIXE."dossier |
510 |
|
|
WHERE dossier='".$this->valF['dossier']."'"; |
511 |
fraynaud |
20 |
$res = $db->query($sql); |
512 |
fmichon |
1540 |
$this->addToLog("triggerajouter(): db->query(\"".$sql."\");", VERBOSE_MODE); |
513 |
|
|
if (database::isError($res)) { |
514 |
fraynaud |
20 |
die($res->getMessage()); |
515 |
fmichon |
1540 |
} |
516 |
|
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
517 |
|
|
// XXX On stocke la date de dépôt actuelle du dossier d'instruction |
518 |
|
|
// dans un attribut de la classe |
519 |
fraynaud |
20 |
$this->archive_date_depot = $row['date_depot']; |
520 |
fmichon |
1540 |
// Récupération de la valeur actuelle du délai, de l'accord tacite, |
521 |
|
|
// de l'état et de l'avis du dossier d'instruction |
522 |
fraynaud |
20 |
$this->valF['archive_delai']=$row['delai']; |
523 |
|
|
$this->valF['archive_accord_tacite']=$row['accord_tacite']; |
524 |
|
|
$this->valF['archive_etat']=$row['etat']; |
525 |
vpihour |
489 |
$this->valF['archive_avis']=$row['avis_decision']; |
526 |
fmichon |
1540 |
// Récupération de la valeur actuelle des 9 dates du dossier |
527 |
|
|
// d'instruction |
528 |
|
|
if ($row['date_complet'] != '') { |
529 |
|
|
$this->valF['archive_date_complet']=$row['date_complet']; |
530 |
|
|
} |
531 |
|
|
if ($row['date_rejet']!='') { |
532 |
|
|
$this->valF['archive_date_rejet']= $row['date_rejet']; |
533 |
|
|
} |
534 |
|
|
if ($row['date_limite']!='') { |
535 |
|
|
$this->valF['archive_date_limite']= $row['date_limite']; |
536 |
|
|
} |
537 |
|
|
if ($row['date_notification_delai']!='') { |
538 |
|
|
$this->valF['archive_date_notification_delai']= $row['date_notification_delai']; |
539 |
|
|
} |
540 |
|
|
if ($row['date_decision']!='') { |
541 |
|
|
$this->valF['archive_date_decision']= $row['date_decision']; |
542 |
|
|
} |
543 |
|
|
if ($row['date_validite']!='') { |
544 |
|
|
$this->valF['archive_date_validite']= $row['date_validite']; |
545 |
|
|
} |
546 |
|
|
if ($row['date_achevement']!='') { |
547 |
|
|
$this->valF['archive_date_achevement']= $row['date_achevement']; |
548 |
|
|
} |
549 |
|
|
if ($row['date_chantier']!='') { |
550 |
|
|
$this->valF['archive_date_chantier']= $row['date_chantier']; |
551 |
|
|
} |
552 |
|
|
if ($row['date_conformite']!='') { |
553 |
|
|
$this->valF['archive_date_conformite']= $row['date_conformite']; |
554 |
|
|
} |
555 |
fraynaud |
20 |
} |
556 |
|
|
} |
557 |
|
|
|
558 |
vpihour |
1137 |
// Test si une restriction est valide |
559 |
|
|
// return boolean |
560 |
|
|
function restrictionIsValid($restriction){ |
561 |
|
|
|
562 |
|
|
/* Met des espace avant et après les opérateurs puis transforme la chaine en |
563 |
|
|
* un tableau */ |
564 |
|
|
$tabRestriction = str_replace(">="," >= ", |
565 |
|
|
str_replace("<="," <= ", |
566 |
|
|
str_replace("-"," - ", |
567 |
|
|
str_replace("+"," + ",$restriction)))); |
568 |
|
|
$tabRestriction = explode( " ", $tabRestriction); |
569 |
|
|
|
570 |
|
|
//Variables de résultat |
571 |
|
|
$res = array(); |
572 |
|
|
$i = 0; |
573 |
|
|
$comp = ""; |
574 |
|
|
|
575 |
|
|
|
576 |
|
|
//Test que le tableau n'est pas vide |
577 |
|
|
if ( count($tabRestriction) > 0 ){ |
578 |
|
|
|
579 |
|
|
$res[0] = $this->getRestrictionValue($tabRestriction[0]); |
580 |
|
|
|
581 |
|
|
//Calcul des variables |
582 |
|
|
for ( $j = 1 ; $j < count($tabRestriction) ; $j += 2 ) { |
583 |
|
|
|
584 |
|
|
//Variable de comparaison |
585 |
|
|
if ( strcmp( ">=", $tabRestriction[$j] ) == 0 || |
586 |
|
|
strcmp( "<=", $tabRestriction[$j]) ==0 ){ |
587 |
|
|
|
588 |
|
|
$comp = $tabRestriction[$j]; |
589 |
|
|
$res[++$i] = $this->getRestrictionValue($tabRestriction[$j+1]); |
590 |
|
|
} |
591 |
|
|
// Fait l'addition |
592 |
|
|
elseif ( strcmp( "+", $tabRestriction[$j]) == 0 ){ |
593 |
|
|
|
594 |
|
|
$res[$i] = $this->moisdate( $res[$i], $this->getRestrictionValue($tabRestriction[$j+1]) ); |
595 |
|
|
} |
596 |
|
|
} |
597 |
|
|
} |
598 |
|
|
|
599 |
|
|
// Effectue le test |
600 |
|
|
if ( strcmp($comp, ">=") == 0 ){ |
601 |
|
|
|
602 |
|
|
if ( $res[0] >= $res[1] || $res[0] == "" ){ |
603 |
|
|
|
604 |
|
|
return true; |
605 |
|
|
} |
606 |
|
|
else { |
607 |
|
|
|
608 |
|
|
return false; |
609 |
|
|
} |
610 |
|
|
} |
611 |
|
|
elseif ( strcmp($comp, "<=") == 0 ){ |
612 |
|
|
|
613 |
|
|
if ( $res[0] <= $res[1] || $res[1] == "" ){ |
614 |
|
|
|
615 |
|
|
return true; |
616 |
|
|
} |
617 |
|
|
else { |
618 |
|
|
|
619 |
|
|
return false; |
620 |
|
|
} |
621 |
|
|
} |
622 |
|
|
|
623 |
|
|
return true; |
624 |
|
|
} |
625 |
|
|
|
626 |
|
|
//Retourne la valeur de valF si $restrictionValue n'est pas un chiffre, le chiffre sinon |
627 |
|
|
function getRestrictionValue($restrictionValue){ |
628 |
|
|
|
629 |
|
|
return ( is_numeric($restrictionValue) ) ? |
630 |
|
|
$restrictionValue : |
631 |
|
|
$this->valF[$restrictionValue]; |
632 |
|
|
} |
633 |
|
|
|
634 |
fraynaud |
123 |
function regle($regle){ |
635 |
|
|
$temp = explode ("+",$regle); |
636 |
atreal |
208 |
//echo '|'.$regle; |
637 |
fraynaud |
124 |
// cas rejet |
638 |
fraynaud |
129 |
if($regle=="null") // 1 dimension -> null |
639 |
fraynaud |
124 |
return null; |
640 |
|
|
if(sizeof($temp)==1) // 1 dimension |
641 |
|
|
if($temp[0]=="archive_date_depot") // initialisation avec le depot |
642 |
fraynaud |
123 |
return $this->$regle; |
643 |
fraynaud |
124 |
else // cas general |
644 |
fraynaud |
123 |
return $this->valF[$regle]; |
645 |
fraynaud |
124 |
if(sizeof($temp)==2){ // 2 dimensions |
646 |
|
|
if($temp[0]=="archive_date_depot") //initialisation avec le depot |
647 |
fraynaud |
123 |
if(is_numeric($temp[1])) |
648 |
|
|
return $this->moisdate($this->$temp[0], $temp[1]); |
649 |
|
|
else |
650 |
|
|
return $this->moisdate($this->$temp[0], $this->valF[$temp[1]]); |
651 |
fraynaud |
124 |
if($temp[0]=="archive_delai") // majoration de delai |
652 |
|
|
return $this->valF[$temp[0]]+$this->valF[$temp[1]]; |
653 |
|
|
// cas general 2 dimensions |
654 |
fraynaud |
123 |
if(is_numeric($temp[1])) |
655 |
|
|
return $this->moisdate($this->valF[$temp[0]], $temp[1]); |
656 |
|
|
else |
657 |
|
|
return $this->moisdate($this->valF[$temp[0]], $this->valF[$temp[1]]); |
658 |
|
|
} |
659 |
fraynaud |
124 |
if(sizeof($temp)==3){ // 3 dimensions |
660 |
|
|
// cas date de validite de sursis |
661 |
|
|
if(is_numeric($temp[1])) |
662 |
|
|
$temp1 = $this->moisdate($this->valF[$temp[0]], $temp[1]); |
663 |
|
|
else |
664 |
|
|
$temp1 = $this->moisdate($this->valF[$temp[0]], $this->valF[$temp[1]]); |
665 |
|
|
if(is_numeric($temp[2])) |
666 |
|
|
return $this->moisdate($temp1, $temp[2]); |
667 |
|
|
else |
668 |
|
|
return $this->moisdate($temp1, $this->valF[$temp[2]]); |
669 |
|
|
} |
670 |
fraynaud |
123 |
} |
671 |
|
|
|
672 |
|
|
|
673 |
fmichon |
1540 |
|
674 |
fraynaud |
20 |
function triggerajouterapres($id,&$db,$val,$DEBUG) { |
675 |
fmichon |
1540 |
/** |
676 |
|
|
* Mise à jour des valeurs du dossier en fonction des valeurs calculées |
677 |
|
|
* par l'action |
678 |
|
|
*/ |
679 |
|
|
// Initialisation |
680 |
|
|
$valF = ""; |
681 |
|
|
// Récupération des paramètres de l'action |
682 |
|
|
$sql = "SELECT * FROM ".DB_PREFIXE."action |
683 |
|
|
WHERE action='".$this->valF['action']."'"; |
684 |
|
|
$res = $db->query($sql); |
685 |
|
|
$this->addToLog("triggerajouterapres(): db->query(\"".$sql."\");", VERBOSE_MODE); |
686 |
|
|
if (database::isError($res)) { |
687 |
|
|
die($res->getMessage()); |
688 |
|
|
} |
689 |
|
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
690 |
|
|
// pour chacune des regles, on applique la regle |
691 |
|
|
if($row['regle_etat']!=''){ |
692 |
|
|
$valF['etat'] = $this->regle($row['regle_etat']); |
693 |
|
|
} |
694 |
|
|
if($row['regle_delai']!=''){ |
695 |
|
|
$valF['delai'] = $this->regle($row['regle_delai']); |
696 |
|
|
} |
697 |
|
|
if($row['regle_accord_tacite']!=''){ |
698 |
|
|
$valF['accord_tacite'] = $this->regle($row['regle_accord_tacite']); |
699 |
|
|
} |
700 |
|
|
if($row['regle_avis']!=''){ |
701 |
|
|
$valF['avis_decision'] = $this->regle($row['regle_avis']); |
702 |
|
|
} |
703 |
|
|
if($row['regle_date_limite']!=''){ |
704 |
|
|
$valF['date_limite']= $this->regle($row['regle_date_limite']); |
705 |
|
|
} |
706 |
|
|
if($row['regle_date_complet']!=''){ |
707 |
|
|
$valF['date_complet']= $this->regle($row['regle_date_complet']); |
708 |
|
|
} |
709 |
|
|
if($row['regle_date_notification_delai']!=''){ |
710 |
|
|
$valF['date_notification_delai']= $this->regle($row['regle_date_notification_delai']); |
711 |
|
|
} |
712 |
|
|
if($row['regle_date_decision']!=''){ |
713 |
|
|
$valF['date_decision']= $this->regle($row['regle_date_decision']); |
714 |
|
|
} |
715 |
|
|
if($row['regle_date_rejet']!=''){ |
716 |
|
|
$valF['date_rejet']= $this->regle($row['regle_date_rejet']); |
717 |
|
|
} |
718 |
|
|
if($row['regle_date_validite']!=''){ |
719 |
|
|
$valF['date_validite']= $this->regle($row['regle_date_validite']); |
720 |
|
|
} |
721 |
|
|
if($row['regle_date_chantier']!=''){ |
722 |
|
|
$valF['date_chantier']= $this->regle($row['regle_date_chantier']); |
723 |
|
|
} |
724 |
|
|
if($row['regle_date_achevement']!=''){ |
725 |
|
|
$valF['date_achevement']= $this->regle($row['regle_date_achevement']); |
726 |
|
|
} |
727 |
|
|
if($row['regle_date_conformite']!=''){ |
728 |
|
|
$valF['date_conformite']= $this->regle($row['regle_date_conformite']); |
729 |
|
|
} |
730 |
|
|
// Appel des méthode stockées dans le champ methode_trigger |
731 |
|
|
if ($row['methode_trigger'] != "") { |
732 |
|
|
foreach (explode(";", $row['methode_trigger']) as $methode) { |
733 |
|
|
if (method_exists($this, $methode)) { |
734 |
|
|
$this->$methode(); |
735 |
|
|
} |
736 |
vpihour |
1284 |
} |
737 |
fraynaud |
121 |
} |
738 |
fmichon |
1540 |
} |
739 |
|
|
// Si des valeurs ont été calculées alors on met à jour l'enregistrement |
740 |
|
|
if ($valF != "") { |
741 |
|
|
// On met à jour le dossier |
742 |
|
|
$cle = " dossier='".$this->valF['dossier']."'"; |
743 |
|
|
$res1 = $db->autoExecute(DB_PREFIXE.'dossier', $valF, DB_AUTOQUERY_UPDATE, $cle); |
744 |
|
|
$this->addToLog("triggerajouterapres(): db->autoexecute(\"".DB_PREFIXE."dossier\", ".print_r($valF, true).", DB_AUTOQUERY_UPDATE, \"".$cle."\");", VERBOSE_MODE); |
745 |
|
|
if (database::isError($res1)) { |
746 |
fraynaud |
20 |
die($res->getMessage()); |
747 |
fmichon |
1540 |
} |
748 |
|
|
// Affichage d'informations à l'utilisateur |
749 |
|
|
$this->addToMessage(_('enregistrement')." ".$this->valF['dossier']." "._('table')." dossier [".$db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
750 |
fraynaud |
20 |
} |
751 |
fmichon |
1540 |
|
752 |
|
|
/** |
753 |
|
|
* REFERENTIEL ERP |
754 |
|
|
*/ |
755 |
fmichon |
1005 |
// verification si envoi vers ERP est active |
756 |
|
|
if ($this->f->getParameter('option_erp') != "") { |
757 |
|
|
// la nature du dossier |
758 |
|
|
$nature_dossier = substr($this->idxformulaire,0,2); |
759 |
fmichon |
1540 |
// |
760 |
|
|
$sql = "SELECT erp |
761 |
|
|
FROM ".DB_PREFIXE."dossier |
762 |
|
|
WHERE dossier='".$this->valF['dossier']."'"; |
763 |
|
|
$dossier_erp = $this->db->getone($sql); |
764 |
|
|
$this->addToLog("triggerajouterapres(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
765 |
|
|
if (database::isError($res)) { |
766 |
|
|
die($res->getMessage()); |
767 |
|
|
} |
768 |
|
|
// |
769 |
|
|
$sql = "SELECT libelle |
770 |
|
|
FROM ".DB_PREFIXE."evenement |
771 |
|
|
WHERE evenement='".$this->valF['evenement']."'"; |
772 |
|
|
$evenement_libelle = $this->db->getone($sql); |
773 |
|
|
$this->addToLog("triggerajouterapres(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
774 |
|
|
if (database::isError($res)) { |
775 |
|
|
die($res->getMessage()); |
776 |
|
|
} |
777 |
|
|
// |
778 |
fmichon |
1005 |
if ($dossier_erp == 't') { |
779 |
|
|
// envoi du message en cas d'un PC qui est ERP et sur lequel un evenement |
780 |
|
|
// d'acceptation etait fait |
781 |
|
|
if ($nature_dossier == |
782 |
|
|
$this->f->getParameter('erp_evenement_accepter_dossier_PC') |
783 |
|
|
&& $this->valF['evenement'] == |
784 |
|
|
$this->f->getParameter('erp_evenement_accepter_sans_reserve')) { |
785 |
|
|
$msgenque = new MessageEnqueuer(); |
786 |
|
|
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
787 |
|
|
$msgenque->setDecision($evenement_libelle); |
788 |
|
|
$msgenque->enqueueMessage($msgenque::$ERP_ARRETE_PC_EFFECTUE); |
789 |
|
|
} |
790 |
|
|
if ($this->valF['evenement'] == |
791 |
|
|
$this->f->getParameter('erp_evenement_refuser_dossier')) { |
792 |
|
|
$msgenque = new MessageEnqueuer(); |
793 |
|
|
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
794 |
|
|
$msgenque->enqueueMessage($msgenque::$ERP_DECISION_CONFORMITE_EFFECTUE); |
795 |
|
|
} |
796 |
mlimic |
936 |
} |
797 |
fmichon |
1005 |
} // fin de if ($this->f->getParameter('option_erp') != "") |
798 |
fmichon |
1540 |
} |
799 |
fraynaud |
129 |
|
800 |
|
|
function triggermodifierapres($id,&$db,$val,$DEBUG) { |
801 |
fmichon |
1540 |
/** |
802 |
|
|
* L'objectif ici est d'effectuer les recalculs de date dans le dossier |
803 |
|
|
* si la date de l'evenement est modifiee |
804 |
|
|
*/ |
805 |
|
|
// Initialisation |
806 |
|
|
$valF = ""; |
807 |
|
|
// Récupération de l'action correspondante à l'événement |
808 |
|
|
$sql = "SELECT action |
809 |
|
|
FROM ".DB_PREFIXE."evenement |
810 |
|
|
WHERE evenement=".$this->valF['evenement']; |
811 |
fraynaud |
129 |
$action = $db->getOne($sql); |
812 |
fmichon |
1540 |
$this->addToLog("triggermodifierapres(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
813 |
|
|
if (database::isError($action)) { |
814 |
|
|
die($action->getMessage()); |
815 |
|
|
} |
816 |
nhaye |
1564 |
|
817 |
|
|
// Récupération de tous les paramètres de l'événement sélectionné |
818 |
|
|
$sql = "SELECT * FROM ".DB_PREFIXE."evenement |
819 |
|
|
WHERE evenement=".$this->valF['evenement']; |
820 |
|
|
$res = $db->query($sql); |
821 |
|
|
$this->addToLog("triggerajouter(): db->query(\"".$sql."\");", VERBOSE_MODE); |
822 |
|
|
if (database::isError($res)) { |
823 |
|
|
die($res->getMessage()); |
824 |
|
|
} |
825 |
|
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
826 |
|
|
// Ajout d'un événement d'instruction |
827 |
|
|
|
828 |
|
|
if ($this->getVal('date_retour_signature') == "" AND $this->valF['date_retour_signature'] != "") { |
829 |
|
|
$new_instruction = new instruction("]", $db, $DEBUG); |
830 |
|
|
foreach($new_instruction->champs as $champ) { |
831 |
|
|
$valNewInstr[$champ] = ""; |
832 |
|
|
} |
833 |
|
|
|
834 |
|
|
$valNewInstr["evenement"] = $row['evenement_retour_signature']; |
835 |
|
|
$valNewInstr["destinataire"] = $this->valF['destinataire']; |
836 |
|
|
$valNewInstr["dossier"] = $this->valF['dossier']; |
837 |
|
|
$valNewInstr["date_evenement"] = date("d/m/Y"); |
838 |
|
|
$new_instruction->ajouter($valNewInstr,$db, $DEBUG); |
839 |
|
|
} |
840 |
|
|
} |
841 |
|
|
|
842 |
fmichon |
1540 |
// Récupération des paramètres de l'action |
843 |
|
|
$sql = "SELECT * FROM ".DB_PREFIXE."action |
844 |
|
|
WHERE action='".$action."'"; |
845 |
fraynaud |
129 |
$res = $db->query($sql); |
846 |
fmichon |
1540 |
$this->addToLog("triggermodifierapres(): db->query(\"".$sql."\");", VERBOSE_MODE); |
847 |
|
|
if (database::isError($res)) { |
848 |
|
|
die($res->getMessage()); |
849 |
|
|
} |
850 |
fraynaud |
129 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
851 |
|
|
// application des regles sur le courrier + delai |
852 |
vpihour |
1127 |
if(preg_match("/date_evenement/",$row['regle_date_limite'])){ |
853 |
fraynaud |
129 |
$valF['date_limite']= $this->regle($row['regle_date_limite']); |
854 |
|
|
} |
855 |
vpihour |
1127 |
if(preg_match("/date_evenement/",$row['regle_date_complet'])){ |
856 |
fraynaud |
129 |
$valF['date_complet']= $this->regle($row['regle_date_complet']); |
857 |
|
|
} |
858 |
vpihour |
1127 |
if(preg_match("/date_evenement/",$row['regle_date_notification_delai'])){ |
859 |
fraynaud |
129 |
$valF['date_notification_delai']= $this->regle($row['regle_date_notification_delai']); |
860 |
|
|
} |
861 |
vpihour |
1127 |
if(preg_match("/date_evenement/",$row['regle_date_decision'])){ |
862 |
fraynaud |
129 |
$valF['date_decision']= $this->regle($row['regle_date_decision']); |
863 |
|
|
} |
864 |
vpihour |
1127 |
if(preg_match("/date_evenement/",$row['regle_date_rejet'])){ |
865 |
fraynaud |
129 |
$valF['date_rejet']= $this->regle($row['regle_date_rejet']); |
866 |
|
|
} |
867 |
vpihour |
1127 |
if(preg_match("/date_evenement/",$row['regle_date_validite'])){ |
868 |
fraynaud |
129 |
$valF['date_validite']= $this->regle($row['regle_date_validite']); |
869 |
|
|
} |
870 |
vpihour |
1127 |
if(preg_match("/date_evenement/",$row['regle_date_chantier'])){ |
871 |
fraynaud |
129 |
$valF['date_chantier']= $this->regle($row['regle_date_chantier']); |
872 |
|
|
} |
873 |
vpihour |
1127 |
if(preg_match("/date_evenement/",$row['regle_date_achevement'])){ |
874 |
fraynaud |
129 |
$valF['date_achevement']= $this->regle($row['regle_date_achevement']); |
875 |
|
|
} |
876 |
vpihour |
1127 |
if(preg_match("/date_evenement/",$row['regle_date_conformite'])){ |
877 |
fraynaud |
129 |
$valF['date_conformite']= $this->regle($row['regle_date_conformite']); |
878 |
|
|
} |
879 |
fmichon |
1540 |
} |
880 |
|
|
// Si des valeurs ont été calculées alors on met à jour l'enregistrement |
881 |
|
|
if ($valF != "") { |
882 |
|
|
// On met à jour le dossier |
883 |
|
|
$cle = " dossier='".$this->valF['dossier']."'"; |
884 |
|
|
$res1 = $db->autoExecute(DB_PREFIXE.'dossier', $valF, DB_AUTOQUERY_UPDATE, $cle); |
885 |
|
|
$this->addToLog("triggerajouterapres(): db->autoexecute(\"".DB_PREFIXE."dossier\", ".print_r($valF, true).", DB_AUTOQUERY_UPDATE, \"".$cle."\");", VERBOSE_MODE); |
886 |
|
|
if (database::isError($res1)) { |
887 |
fraynaud |
129 |
die($res->getMessage()); |
888 |
fmichon |
1540 |
} |
889 |
|
|
// Affichage d'informations à l'utilisateur |
890 |
|
|
$this->addToMessage(_('enregistrement')." ".$this->valF['dossier']." "._('table')." dossier [".$db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
891 |
fraynaud |
129 |
} |
892 |
nhaye |
1299 |
|
893 |
fmichon |
1540 |
/** |
894 |
|
|
* REFERENTIEL ARRETE |
895 |
|
|
*/ |
896 |
|
|
if ($this->f->getParameter('option_referentiel_arrete') != "") { |
897 |
|
|
if ($this->valF['date_retour_signature'] != $this->getVal('date_retour_signature')) { |
898 |
|
|
$msgenque = new MessageEnqueuer(); |
899 |
|
|
$sqlArrete = "SELECT instruction.signataire_arrete as \"ws_DA_In_Signataire\", |
900 |
|
|
signataire_arrete.nom as \"ws_DA_In_Sign_Nom\", |
901 |
|
|
signataire_arrete.prenom as \"ws_DA_In_Sign_Prenom\", |
902 |
|
|
signataire_arrete.qualite as \"ws_DA_In_Sign_Qualite\", |
903 |
|
|
instruction.date_evenement as \"ws_DA_In_Dte_Redac\", |
904 |
|
|
'' as \"ws_DA_In_lieu_Redac\", |
905 |
|
|
instruction.dossier as \"ws_DA_In_N_Doss_DAS\", |
906 |
|
|
'' as \"ws_DA_In_Sigle\", |
907 |
|
|
instruction.etat as \"ws_DA_In_Decision\", |
908 |
|
|
dossier.date_depot as \"ws_DA_In_Dte_Depot_Dem\", |
909 |
|
|
dossier.terrain_numero as \"ws_DA_In_N_Voie\", |
910 |
|
|
'' as \"ws_DA_In_Type_Voie\", |
911 |
|
|
dossier.complement as \"ws_DA_In_Adresse1\", |
912 |
|
|
dossier.terrain_adresse_lieu_dit as \"ws_DA_In_Adresse2\", |
913 |
|
|
dossier.terrain_adresse_code_postal as \"ws_DA_In_CP\", |
914 |
|
|
dossier.terrain_adresse_localite as \"ws_DA_In_Ville\", |
915 |
|
|
dossier.terrain_references_cadastrales as \"ws_DA_In_Nb_Parcelle\", |
916 |
|
|
'' as \"ws_DA_In_Detail_Parcelle\", |
917 |
|
|
CONCAT(donnees_techniques.am_projet_desc,' ',donnees_techniques.co_projet_desc) as \"ws_DA_In_Nature_Trvx\", |
918 |
|
|
'' as \"ws_DA_In_Destination_Trvx\", |
919 |
|
|
dossier_autorisation_type_detaille.code as \"ws_DA_In_Type_Dos_Autoris\", |
920 |
|
|
COALESCE(particulier_nom,personne_morale_raison_sociale) as \"ws_DA_In_Nom_Petition\", |
921 |
|
|
COALESCE(particulier_prenom, personne_morale_denomination) as \"ws_DA_In_Prenom_Petition\", |
922 |
|
|
'' as \"ws_DA_In_Piece_GED\", |
923 |
|
|
instruction.date_retour_signature as \"ws_DA_In_Dte_Signature\" |
924 |
|
|
FROM ".DB_PREFIXE."instruction |
925 |
|
|
LEFT JOIN ".DB_PREFIXE."signataire_arrete ON |
926 |
|
|
instruction.signataire_arrete = signataire_arrete.signataire_arrete |
927 |
|
|
LEFT JOIN ".DB_PREFIXE."dossier ON |
928 |
|
|
instruction.dossier = dossier.dossier |
929 |
|
|
LEFT JOIN ".DB_PREFIXE."lien_dossier_demandeur ON |
930 |
|
|
lien_dossier_demandeur.dossier = dossier.dossier |
931 |
|
|
LEFT JOIN ".DB_PREFIXE."demandeur ON |
932 |
|
|
lien_dossier_demandeur.demandeur = demandeur.demandeur |
933 |
|
|
LEFT JOIN ".DB_PREFIXE."dossier_instruction_type ON |
934 |
|
|
dossier.dossier_instruction_type = dossier_instruction_type.dossier_instruction_type |
935 |
|
|
LEFT JOIN ".DB_PREFIXE."dossier_autorisation_type_detaille ON |
936 |
|
|
dossier_instruction_type.dossier_autorisation_type_detaille = |
937 |
|
|
dossier_autorisation_type_detaille.dossier_autorisation_type_detaille |
938 |
|
|
LEFT JOIN ".DB_PREFIXE."donnees_techniques ON |
939 |
|
|
donnees_techniques.dossier_instruction = dossier.dossier |
940 |
|
|
WHERE instruction.instruction = ".$this->valF['instruction']; |
941 |
|
|
$resArrete = $this->db->query($sqlArrete); |
942 |
|
|
$this->f->addToLog("triggerModifierApres(): db->query(\"".$sqlArrete."\");", VERBOSE_MODE); |
943 |
|
|
$this->f->isDatabaseError(); |
944 |
|
|
|
945 |
|
|
$rowArrete = $resArrete->fetchRow(DB_FETCHMODE_ASSOC); |
946 |
|
|
$msgenque->setArreteInfo($rowArrete); |
947 |
|
|
$msgenque->enqueueMessage($msgenque::$ARRETE_ENVOI); |
948 |
|
|
} |
949 |
nhaye |
1299 |
} |
950 |
fraynaud |
129 |
} |
951 |
|
|
|
952 |
fraynaud |
20 |
function triggersupprimer($id,&$db,$val,$DEBUG) { |
953 |
fmichon |
1540 |
/** |
954 |
|
|
* L'objectif ici est de repositionner les valeurs récupérées en |
955 |
|
|
* archive dans le dossier d'instruction avant de supprimer l'événement |
956 |
|
|
* d'instruction |
957 |
|
|
*/ |
958 |
fraynaud |
20 |
// archive en instruction (si suppression) [archive if delete instruction] |
959 |
|
|
$valF['delai']=$val['archive_delai']; |
960 |
|
|
$valF['accord_tacite']=$val['archive_accord_tacite']; |
961 |
|
|
$valF['etat']=$val['archive_etat']; |
962 |
fraynaud |
80 |
if($val['archive_avis']=='') |
963 |
vpihour |
489 |
$valF['avis_decision']= null; |
964 |
fraynaud |
80 |
else |
965 |
vpihour |
489 |
$valF['avis_decision']=$val['archive_avis']; |
966 |
fraynaud |
20 |
if($val['archive_date_complet']!='') |
967 |
|
|
$valF['date_complet']=$val['archive_date_complet']; |
968 |
|
|
if($val['archive_date_rejet']!='') |
969 |
|
|
$valF['date_rejet']= $val['archive_date_rejet']; |
970 |
|
|
if($val['archive_date_limite']!='') |
971 |
|
|
$valF['date_limite']= $val['archive_date_limite']; |
972 |
|
|
if($val['archive_date_notification_delai']!='') |
973 |
|
|
$valF['date_notification_delai']= $val['archive_date_notification_delai']; |
974 |
|
|
if($val['archive_date_decision']!='') |
975 |
|
|
$valF['date_decision']= $val['archive_date_decision']; |
976 |
|
|
if($val['archive_date_validite']!='') |
977 |
|
|
$valF['date_validite']= $val['archive_date_validite']; |
978 |
|
|
if($val['archive_date_achevement']!='') |
979 |
|
|
$valF['date_achevement']= $val['archive_date_achevement']; |
980 |
|
|
if($val['archive_date_chantier']!='') |
981 |
|
|
$valF['date_chantier']= $val['archive_date_chantier']; |
982 |
|
|
if($val['archive_date_conformite']!='') |
983 |
|
|
$valF['date_conformite']= $val['archive_date_conformite']; |
984 |
fmichon |
1540 |
// On met à jour le dossier |
985 |
|
|
$cle = " dossier='".$val['dossier']."'"; |
986 |
|
|
$res1 = $db->autoExecute(DB_PREFIXE.'dossier', $valF, DB_AUTOQUERY_UPDATE, $cle); |
987 |
|
|
$this->addToLog("triggerajouterapres(): db->autoexecute(\"".DB_PREFIXE."dossier\", ".print_r($valF, true).", DB_AUTOQUERY_UPDATE, \"".$cle."\");", VERBOSE_MODE); |
988 |
|
|
if (database::isError($res1)) { |
989 |
fraynaud |
20 |
die($res->getMessage()); |
990 |
|
|
} |
991 |
fmichon |
1540 |
// Affichage d'informations à l'utilisateur |
992 |
|
|
$this->addToMessage(_('enregistrement')." ".$this->valF['dossier']." "._('table')." dossier [".$db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
993 |
fraynaud |
20 |
} |
994 |
fmichon |
1540 |
|
995 |
fraynaud |
20 |
// ============================================= |
996 |
|
|
// calcul de date avec ajout de mois (delais) |
997 |
|
|
// [add months (delay) and calculation final date] |
998 |
|
|
// LIMITE DE LA FONCTION si delai >24 MOIS |
999 |
|
|
// [limit : delay < 24 month] |
1000 |
|
|
// ============================================= |
1001 |
|
|
function moisdate($date,$delaimois) { |
1002 |
|
|
$temp = explode("-" , $date); |
1003 |
|
|
$jour = (int) $temp[2]; |
1004 |
|
|
$mois = (int) $temp[1]; |
1005 |
|
|
$annee = (int) $temp[0]; |
1006 |
|
|
// calcul si delai superieur à 12 (limite 24) [delay > 24 month] |
1007 |
|
|
if($delaimois>=12){ |
1008 |
|
|
$delaimois=$delaimois-12; |
1009 |
|
|
$annee=$annee+1; |
1010 |
|
|
} |
1011 |
|
|
if($delaimois>=12){ |
1012 |
|
|
$delaimois=$delaimois-12; |
1013 |
|
|
$annee=$annee+1; |
1014 |
|
|
} |
1015 |
|
|
// mois |
1016 |
|
|
$mois=$mois+$delaimois; |
1017 |
|
|
// calcul mois annee [calculation number of years if > 12 month] |
1018 |
|
|
// nb de mois > à 12 |
1019 |
|
|
if ($mois>12){ |
1020 |
|
|
$mois=$mois-12; |
1021 |
|
|
$annee=$annee+1; |
1022 |
|
|
} |
1023 |
|
|
// Calcul du nombre de jours dans le mois sélectionné [calculation number of days] |
1024 |
|
|
switch($mois) { |
1025 |
|
|
case "2": |
1026 |
|
|
if ($annee % 4 == 0 && $annee % 100 != 0 || $annee % 400 == 0) |
1027 |
|
|
$jourmax = 29; |
1028 |
|
|
else |
1029 |
|
|
$jourmax = 28; |
1030 |
|
|
break; |
1031 |
|
|
case "4": |
1032 |
|
|
case "6": |
1033 |
|
|
case "9": |
1034 |
|
|
case "11": |
1035 |
|
|
$jourmax = 30; |
1036 |
|
|
break; |
1037 |
|
|
default: |
1038 |
|
|
$jourmax = 31; |
1039 |
|
|
} |
1040 |
|
|
if ($jour > $jourmax) |
1041 |
|
|
$jour = $jourmax; |
1042 |
|
|
//$dateretour=$annee."-".$mois."-".$jour; |
1043 |
|
|
return $annee."-".$mois."-".$jour ; |
1044 |
|
|
} |
1045 |
|
|
|
1046 |
vpihour |
1137 |
// Vérifie la restriction sur l'événement |
1047 |
|
|
function verifier($val = array(), &$db, $DEBUG){ |
1048 |
nhaye |
1186 |
parent::verifier($val, $db, $DEBUG); |
1049 |
vpihour |
1137 |
//Récupère la restriction |
1050 |
|
|
$sql= "SELECT |
1051 |
|
|
restriction |
1052 |
|
|
FROM |
1053 |
|
|
".DB_PREFIXE."evenement |
1054 |
|
|
WHERE |
1055 |
|
|
evenement =".$this->valF['evenement']; |
1056 |
|
|
|
1057 |
|
|
$res = $db->query($sql); |
1058 |
|
|
$this->f->addToLog("verifier(): db->query(\"".$sql."\");", VERBOSE_MODE); |
1059 |
|
|
$this->f->isDatabaseError(); |
1060 |
|
|
|
1061 |
|
|
$row=& $res->fetchRow(DB_FETCHMODE_ASSOC); |
1062 |
|
|
|
1063 |
|
|
//Test qu'une restriction est présente |
1064 |
|
|
if ( isset($row['restriction']) && $row['restriction'] != "" ){ |
1065 |
|
|
|
1066 |
|
|
//Test si la restriction est valide |
1067 |
|
|
if ( !$this->restrictionIsValid($row['restriction']) ){ |
1068 |
|
|
|
1069 |
|
|
$this->correct=false; |
1070 |
|
|
$this->addToMessage(_("Restriction non valide")); |
1071 |
|
|
} |
1072 |
|
|
else { |
1073 |
|
|
|
1074 |
|
|
$this->correct = true; |
1075 |
|
|
} |
1076 |
|
|
} |
1077 |
nhaye |
1564 |
|
1078 |
|
|
$this->updateDate("date_envoi_signature"); |
1079 |
|
|
$this->updateDate("date_retour_signature"); |
1080 |
|
|
$this->updateDate("date_envoi_rar"); |
1081 |
|
|
$this->updateDate("date_retour_rar"); |
1082 |
|
|
$this->updateDate("date_envoi_controle_legalite"); |
1083 |
|
|
$this->updateDate("date_retour_controle_legalite"); |
1084 |
vpihour |
1137 |
} |
1085 |
vpihour |
1282 |
|
1086 |
|
|
/** |
1087 |
|
|
* Méthode permettant de mettre à jour l'état d'un DA |
1088 |
|
|
*/ |
1089 |
vpihour |
1284 |
function majEtatDA() { |
1090 |
|
|
if($this->valF['action'] == 'accepter' AND $this->valF['avis_decision'] == 8) { |
1091 |
vpihour |
1285 |
$val['etat_dossier_autorisation']=5; |
1092 |
vpihour |
1284 |
} elseif($this->valF['action'] == 'accepter' AND $this->valF['avis_decision'] == 15) { |
1093 |
vpihour |
1285 |
$val['etat_dossier_autorisation']=3; |
1094 |
vpihour |
1284 |
} elseif($this->valF['action'] == 'accepter') { |
1095 |
vpihour |
1285 |
$val['etat_dossier_autorisation']=2; |
1096 |
vpihour |
1284 |
} elseif($this->valF['action'] == 'rejeter') { |
1097 |
vpihour |
1285 |
$val['etat_dossier_autorisation']=4; |
1098 |
vpihour |
1284 |
} elseif($this->valF['action'] == 'terminer') { |
1099 |
vpihour |
1285 |
$val['etat_dossier_autorisation']=8; |
1100 |
vpihour |
1284 |
} elseif($this->valF['action'] == 'majorer') { |
1101 |
vpihour |
1285 |
$val['etat_dossier_autorisation']=6; |
1102 |
vpihour |
1284 |
} else { |
1103 |
vpihour |
1285 |
$val['etat_dossier_autorisation']=7; |
1104 |
vpihour |
1284 |
} |
1105 |
|
|
|
1106 |
|
|
//Récupération du numéro de dossier d'autorisation lié au dossier d'instruction |
1107 |
vpihour |
1285 |
$IDdossier_autorisation = $this->getDossierAutorisation($this->valF['dossier']); |
1108 |
vpihour |
1284 |
|
1109 |
|
|
// Mis à jour de l'état du dossier d'autorisation |
1110 |
|
|
require_once '../obj/dossier_autorisation.class.php'; |
1111 |
|
|
$dossier_autorisation = new dossier_autorisation($IDdossier_autorisation,$this->db,DEBUG); |
1112 |
|
|
|
1113 |
vpihour |
1285 |
$dossier_autorisation->val[array_search("etat_dossier_autorisation", $dossier_autorisation->champs)] = $val['etat_dossier_autorisation']; |
1114 |
vpihour |
1284 |
|
1115 |
|
|
//Récupération des données |
1116 |
|
|
$valDossierAutorisation = array(); |
1117 |
|
|
for ( $i=0 ; $i<count($dossier_autorisation->champs); $i++){ |
1118 |
|
|
|
1119 |
|
|
$valDossierAutorisation[$dossier_autorisation->champs[$i]]= |
1120 |
|
|
$dossier_autorisation->val[$i]; |
1121 |
|
|
} |
1122 |
|
|
|
1123 |
|
|
$dossier_autorisation->modifier($valDossierAutorisation, $this->db, DEBUG); |
1124 |
|
|
} |
1125 |
vpihour |
1282 |
|
1126 |
vpihour |
1284 |
/** |
1127 |
|
|
* Méthode permettant de mettre à jour les données d'un DA |
1128 |
|
|
*/ |
1129 |
|
|
function majDataDA() { |
1130 |
|
|
|
1131 |
vpihour |
1285 |
//Récupération du numéro de dossier d'autorisation lié au dossier d'instruction |
1132 |
|
|
$IDdossier_autorisation = $this->getDossierAutorisation($this->valF['dossier']); |
1133 |
|
|
require_once '../obj/dossier_autorisation.class.php'; |
1134 |
|
|
$dossier_autorisation = new dossier_autorisation($IDdossier_autorisation,$this->db,DEBUG); |
1135 |
|
|
|
1136 |
|
|
require_once '../obj/dossier.class.php'; |
1137 |
|
|
$dossier = new dossier($this->valF['dossier'],$this->db,DEBUG); |
1138 |
|
|
|
1139 |
|
|
//Récupération des données |
1140 |
|
|
$valDossierAutorisation = array(); |
1141 |
|
|
for ( $i=0 ; $i<count($dossier_autorisation->champs); $i++){ |
1142 |
|
|
|
1143 |
|
|
if ( array_search($dossier_autorisation->champs[$i], $dossier->champs) ){ |
1144 |
|
|
|
1145 |
|
|
$valDossierAutorisation[$dossier_autorisation->champs[$i]]=$dossier->getVal($dossier_autorisation->champs[$i]); |
1146 |
|
|
} |
1147 |
|
|
else { |
1148 |
|
|
$valDossierAutorisation[$dossier_autorisation->champs[$i]]= |
1149 |
|
|
$dossier_autorisation->val[$i]; |
1150 |
|
|
} |
1151 |
|
|
} |
1152 |
|
|
|
1153 |
|
|
$dossier_autorisation->modifier($valDossierAutorisation, $this->db, DEBUG); |
1154 |
vpihour |
1286 |
|
1155 |
|
|
// Suppression du liens entre les lots et le DA |
1156 |
|
|
$valLot['dossier_autorisation'] = NULL; |
1157 |
|
|
$this->db->autoExecute(DB_PREFIXE."lot", $valLot, DB_AUTOQUERY_UPDATE, "dossier_autorisation='".$IDdossier_autorisation."'"); |
1158 |
|
|
|
1159 |
|
|
// Liaison des lots du DI avec le DA |
1160 |
|
|
$sqlLot = "SELECT lot FROM ".DB_PREFIXE."lien_dossier_lot WHERE dossier='".$this->valF['dossier']."'"; |
1161 |
|
|
$res = $this->db->query($sqlLot); |
1162 |
|
|
$this->addToLog($sqlLot); |
1163 |
|
|
$this->f->isDatabaseError(); |
1164 |
|
|
while($rowLot = $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
1165 |
|
|
$valLot['dossier_autorisation'] = $IDdossier_autorisation; |
1166 |
|
|
$this->db->autoExecute(DB_PREFIXE."lot", $valLot, DB_AUTOQUERY_UPDATE, "lot=".$rowLot['lot']); |
1167 |
|
|
} |
1168 |
vpihour |
1284 |
} |
1169 |
vpihour |
1285 |
|
1170 |
|
|
// Récupération de l'identifiant du dossier d'autorisation lié au dossier d'instruction |
1171 |
|
|
function getDossierAutorisation($dossier_instruction){ |
1172 |
|
|
|
1173 |
|
|
$sql = "SELECT |
1174 |
|
|
dossier_autorisation.dossier_autorisation |
1175 |
|
|
FROM |
1176 |
|
|
".DB_PREFIXE."dossier_autorisation |
1177 |
|
|
LEFT JOIN |
1178 |
|
|
".DB_PREFIXE."dossier |
1179 |
|
|
ON |
1180 |
|
|
dossier_autorisation.dossier_autorisation = dossier.dossier_autorisation |
1181 |
|
|
WHERE |
1182 |
|
|
dossier.dossier = '".$dossier_instruction."'"; |
1183 |
|
|
|
1184 |
|
|
$IDdossier_autorisation = $this->db->getOne($sql); |
1185 |
|
|
$this->addToLog("getDossierAutorisation(): db->getone(\"".$sql."\")", VERBOSE_MODE); |
1186 |
|
|
database::isError($IDdossier_autorisation); |
1187 |
|
|
|
1188 |
|
|
return $IDdossier_autorisation; |
1189 |
|
|
} |
1190 |
fraynaud |
3 |
}// fin classe |
1191 |
atreal |
208 |
?> |