18 |
- voir script_lang.js : bible ... |
- voir script_lang.js : bible ... |
19 |
*/ |
*/ |
20 |
require_once ("../gen/obj/instruction.class.php"); |
require_once ("../gen/obj/instruction.class.php"); |
21 |
|
require_once("../services/outgoing/messageenqueuer.php"); |
22 |
|
|
23 |
class instruction extends instruction_gen { |
class instruction extends instruction_gen { |
24 |
|
|
30 |
$this->constructeur($id,$db,$debug); |
$this->constructeur($id,$db,$debug); |
31 |
}// fin constructeur |
}// fin constructeur |
32 |
|
|
33 |
|
// {{{ Gestion de la confidentialité des données spécifiques |
34 |
|
|
35 |
|
/** |
36 |
|
* Surcharge pour gérer les actions disponibles dans le portlet |
37 |
|
*/ |
38 |
|
function checkAccessibility() { |
39 |
|
// |
40 |
|
parent::checkAccessibility(); |
41 |
|
// Si l'utilisateur est un intructeur qui en correspond pas à la |
42 |
|
// division du dossier |
43 |
|
if ($this->f->isUserInstructeur() |
44 |
|
&& isset($this->f->om_utilisateur["division"]) |
45 |
|
&& $this->f->om_utilisateur["division"] != $this->getDivisionFromDossier()) { |
46 |
|
// |
47 |
|
$this->actions_sup = array(); |
48 |
|
$this->setParameter("actions", array()); |
49 |
|
} |
50 |
|
// Si une action 'lu' est présente et que le champ lu est à true |
51 |
|
// on supprime l'action |
52 |
|
if (isset($this->actions_sup["lu"]) |
53 |
|
&& isset($this->val[array_search("lu", $this->champs)]) |
54 |
|
&& $this->val[array_search("lu", $this->champs)]== "t") { |
55 |
|
unset($this->actions_sup["lu"]); |
56 |
|
} |
57 |
|
} |
58 |
|
|
59 |
|
/** |
60 |
|
* Cette methode est à surcharger elle permet de tester dans chaque classe |
61 |
|
* des droits des droits spécifiques en fonction des données |
62 |
|
*/ |
63 |
|
function canAccess() { |
64 |
|
// Si l'utilisateur est un intructeur qui ne correspond pas à la |
65 |
|
// division du dossier |
66 |
|
if ($this->f->isUserInstructeur() |
67 |
|
&& $this->f->om_utilisateur["division"] != $this->getDivisionFromDossier() |
68 |
|
&& $this->getParameter("maj") != 3) { |
69 |
|
// |
70 |
|
return false; |
71 |
|
} |
72 |
|
// |
73 |
|
return true; |
74 |
|
} |
75 |
|
|
76 |
|
/** |
77 |
|
* Cette méthode permet de récupérer la division d'un dossier |
78 |
|
*/ |
79 |
|
function getDivisionFromDossier() { |
80 |
|
// |
81 |
|
if (!isset($this->val[array_search("dossier", $this->champs)])) { |
82 |
|
return NULL; |
83 |
|
} |
84 |
|
// |
85 |
|
$sql = "select division from ".DB_PREFIXE."dossier "; |
86 |
|
$sql .= " where dossier='".$this->val[array_search("dossier", $this->champs)]."'"; |
87 |
|
// |
88 |
|
$division = $this->db->getOne($sql); |
89 |
|
$this->addToLog("getDivisionFromDossier(): db->getone(\"".$sql."\")", VERBOSE_MODE); |
90 |
|
database::isError($division); |
91 |
|
// |
92 |
|
return $division; |
93 |
|
} |
94 |
|
|
95 |
|
// }}} |
96 |
|
|
97 |
function cleSecondaire($id,&$db,$val,$DEBUG) { |
function cleSecondaire($id,&$db,$val,$DEBUG) { |
98 |
parent::cleSecondaire($id,$db,$val,$DEBUG); |
parent::cleSecondaire($id,$db,$val,$DEBUG); |
99 |
// controle suppression cle secondaire [secondary key delete control] |
// controle suppression cle secondaire [secondary key delete control] |
114 |
} |
} |
115 |
} |
} |
116 |
|
|
117 |
|
// Sélectionne le signataire_arrete par défaut |
118 |
|
function setVal(&$form,$maj,$validation){ |
119 |
|
|
120 |
|
// Ajout |
121 |
|
if($maj == 0) { |
122 |
|
|
123 |
|
// Création de la requête |
124 |
|
$sql = "SELECT signataire_arrete |
125 |
|
FROM ".DB_PREFIXE."signataire_arrete |
126 |
|
WHERE defaut IS TRUE"; |
127 |
|
|
128 |
|
// Exécution de la requête |
129 |
|
$this->f->addToLog("deleteAllLienDossierInstructionTypeEvenementEvenement(): db->query(\"".$sql."\");", VERBOSE_MODE); |
130 |
|
$res = $this->f->db->query($sql); |
131 |
|
$this->f->isDatabaseError(); |
132 |
|
|
133 |
|
$row = $res->fetchrow(DB_FETCHMODE_ASSOC); |
134 |
|
|
135 |
|
if ( isset($row['signataire_arrete']) && is_numeric($row['signataire_arrete'])){ |
136 |
|
|
137 |
|
$form->setVal("signataire_arrete",$row['signataire_arrete']); |
138 |
|
} |
139 |
|
} |
140 |
|
} |
141 |
|
|
142 |
|
/*Met des valeurs par défaut dans certains des sous-formulaire*/ |
143 |
function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire){ |
function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire){ |
144 |
if ($validation==0 and $maj<2) { |
if ($validation==0 and $maj<2) { |
145 |
if ($maj == 0){ |
if ($maj == 0){ |
146 |
$form->setVal("destinataire", $idxformulaire); |
$form->setVal("destinataire", $idxformulaire); |
147 |
$form->setVal("dossier", $idxformulaire); |
$form->setVal("dossier", $idxformulaire); |
148 |
$form->setVal("datecourrier", date('Y-m-d')); |
$form->setVal("date_evenement", date('Y-m-d')); |
149 |
} |
} |
150 |
$form->setVal("bible_auto","bible_auto()"); |
$form->setVal("bible_auto","bible_auto()"); |
151 |
$form->setVal("bible","bible()"); |
$form->setVal("bible","bible()"); |
155 |
$this->idxformulaire=$idxformulaire; |
$this->idxformulaire=$idxformulaire; |
156 |
} |
} |
157 |
|
|
158 |
|
/*Affecte un type à certains champs*/ |
159 |
function setType(&$form,$maj) { |
function setType(&$form,$maj) { |
160 |
parent::setType($form,$maj); |
parent::setType($form,$maj); |
161 |
if ($maj < 2) { //ajouter et modifier |
if ($maj < 2) { //ajouter et modifier |
168 |
$form->setType('bible2', 'httpclick'); |
$form->setType('bible2', 'httpclick'); |
169 |
$form->setType('dossier', 'hiddenstatic'); |
$form->setType('dossier', 'hiddenstatic'); |
170 |
$form->setType('libelle', 'hiddenstatic'); |
$form->setType('libelle', 'hiddenstatic'); |
171 |
|
$form->setType('signataire_arrete','select'); |
172 |
if($maj==0){ // add |
if($maj==0){ // add |
173 |
$form->setType('instruction', 'hiddenstatic'); |
$form->setType('instruction', 'hiddenstatic'); |
174 |
$form->setType('evenement', 'select'); |
$form->setType('evenement', 'select'); |
175 |
$form->setType('datecourrier', 'date2'); |
$form->setType('date_evenement', 'date2'); |
176 |
}else{ // modify |
}else{ // modify |
177 |
$form->setType('instruction', 'hiddenstatic'); |
$form->setType('instruction', 'hiddenstatic'); |
178 |
$form->setType('evenement', 'hiddenstatic'); |
$form->setType('evenement', 'hiddenstatic'); |
179 |
//$form->setType('datecourrier', 'hiddenstaticdate'); |
//$form->setType('date_evenement', 'hiddenstaticdate'); |
180 |
$form->setType('datecourrier', 'date2'); |
$form->setType('date_evenement', 'date2'); |
181 |
// necessaire pour calcul de date en modification |
// necessaire pour calcul de date en modification |
182 |
$form->setType('delai', 'hiddenstatic'); |
$form->setType('delai', 'hiddenstatic'); |
183 |
} |
} |
184 |
} elseif($maj==2){ |
} elseif($maj==2){ |
185 |
$form->setType('dossier', 'hiddenstatic'); |
$form->setType('dossier', 'hiddenstatic'); |
186 |
|
$form->setType('bible_auto', 'hidden'); |
187 |
|
$form->setType('bible', 'hidden'); |
188 |
|
$form->setType('bible2', 'hidden'); |
189 |
}else { |
}else { |
190 |
$form->setType('destinataire', 'hidden'); |
$form->setType('destinataire', 'hidden'); |
191 |
$form->setType('dossier', 'static'); |
$form->setType('dossier', 'static'); |
192 |
|
$form->setType('bible_auto', 'hidden'); |
193 |
|
$form->setType('bible', 'hidden'); |
194 |
|
$form->setType('bible2', 'hidden'); |
195 |
} |
} |
196 |
$form->setType('complement3', 'hidden'); |
$form->setType('complement3', 'hidden'); |
|
$form->setType('bible_auto', 'hidden'); |
|
|
$form->setType('bible', 'hidden'); |
|
|
$form->setType('bible2', 'hidden'); |
|
197 |
$form->setType('bible3', 'hidden'); |
$form->setType('bible3', 'hidden'); |
198 |
$form->setType('complement4', 'hidden'); |
$form->setType('complement4', 'hidden'); |
199 |
$form->setType('bible4', 'hidden'); |
$form->setType('bible4', 'hidden'); |
224 |
$form->setType('accord_tacite', 'hidden'); |
$form->setType('accord_tacite', 'hidden'); |
225 |
$form->setType('action', 'hidden'); |
$form->setType('action', 'hidden'); |
226 |
$form->setType('delai_notification', 'hidden'); |
$form->setType('delai_notification', 'hidden'); |
227 |
$form->setType('avis', 'hidden'); |
$form->setType('avis_decision', 'hidden'); |
228 |
$form->setType('archive_delai', 'hidden'); |
$form->setType('archive_delai', 'hidden'); |
229 |
$form->setType('archive_etat', 'hidden'); |
$form->setType('archive_etat', 'hidden'); |
230 |
$form->setType('archive_accord_tacite', 'hidden'); |
$form->setType('archive_accord_tacite', 'hidden'); |
240 |
$form->setType('archive_date_chantier', 'hidden'); |
$form->setType('archive_date_chantier', 'hidden'); |
241 |
} |
} |
242 |
|
|
243 |
|
/*Met des valeurs choisies dans certains select du formulaire*/ |
244 |
function setSelect(&$form, $maj,&$db,$DEBUG) { |
function setSelect(&$form, $maj,&$db,$DEBUG) { |
245 |
if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc.php")) |
if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc.php")) |
246 |
include ("../sql/".$db->phptype."/".$this->table.".form.inc.php"); |
include ("../sql/".$db->phptype."/".$this->table.".form.inc.php"); |
247 |
|
|
248 |
|
parent::setSelect($form, $maj, $db, $DEBUG); |
249 |
|
|
250 |
// *** evenement *** |
// *** evenement *** |
251 |
$contenu=array(); |
$contenu=array(); |
252 |
// etat du dossier |
// etat du dossier |
253 |
$sql="select etat from ".DB_PREFIXE."dossier where dossier ='". |
$sql="select etat from ".DB_PREFIXE."dossier where dossier ='". |
254 |
$this->idxformulaire."'"; |
$this->idxformulaire."'"; |
255 |
$etat_dossier = $db->getOne($sql); |
$etat_dossier = $db->getOne($sql); |
256 |
$nature_dossier= substr($this->idxformulaire,0,2); |
// nature du dossier d'autorisation |
257 |
|
$sql="select code from ".DB_PREFIXE."dossier |
258 |
|
INNER JOIN ".DB_PREFIXE."dossier_autorisation ON |
259 |
|
dossier.dossier_autorisation = dossier_autorisation.dossier_autorisation |
260 |
|
INNER JOIN ".DB_PREFIXE."dossier_autorisation_type_detaille ON |
261 |
|
dossier_autorisation.dossier_autorisation_type_detaille = |
262 |
|
dossier_autorisation_type_detaille.dossier_autorisation_type_detaille |
263 |
|
WHERE dossier ='". |
264 |
|
$this->idxformulaire."'"; |
265 |
|
$nature_dossier = $db->getOne($sql); |
266 |
|
|
267 |
// recherche des evenement de transition |
// recherche des evenement de transition |
268 |
$sql= $sql_transition." where transition.etat ='".$etat_dossier."' and (evenement.nature ='". |
// XXX modifier la requète après la modification de structure du workflow |
269 |
$nature_dossier."' or (nature ='T' and nature !='CU')) order by evenement.action"; |
$sql= $sql_transition." where transition.etat ='".$etat_dossier."' and dossier='". |
270 |
|
$this->idxformulaire."' order by evenement.action"; |
271 |
|
|
272 |
// *** attention en dur le CU |
// *** attention en dur le CU |
273 |
|
$this->addToLog("setSelect(): db->query(\"".$sql."\");", VERBOSE_MODE); |
274 |
|
|
275 |
$res = $db->query($sql); |
$res = $db->query($sql); |
276 |
if (database::isError($res)) |
if (database::isError($res)) |
308 |
function setGroupe(&$form,$maj){ |
function setGroupe(&$form,$maj){ |
309 |
$form->setGroupe('evenement','D'); |
$form->setGroupe('evenement','D'); |
310 |
$form->setGroupe('libelle','G'); |
$form->setGroupe('libelle','G'); |
311 |
$form->setGroupe('datecourrier','G'); |
$form->setGroupe('date_evenement','G'); |
312 |
$form->setGroupe('lettretype','F'); |
$form->setGroupe('lettretype','F'); |
313 |
} |
} |
314 |
|
|
315 |
function setRegroupe(&$form,$maj){ |
function setRegroupe(&$form,$maj){ |
316 |
$form->setRegroupe('evenement','D',_('evenement'), "collapsible"); |
$form->setRegroupe('evenement','D',_('evenement'), "collapsible"); |
317 |
$form->setRegroupe('libelle','G',''); |
$form->setRegroupe('libelle','G',''); |
318 |
$form->setRegroupe('datecourrier','G',''); |
$form->setRegroupe('date_evenement','G',''); |
319 |
$form->setRegroupe('lettretype','F',''); |
$form->setRegroupe('lettretype','F',''); |
320 |
$form->setRegroupe('complement','D',_('complement'), "collapsible"); |
$form->setRegroupe('complement','D',_('complement'), "collapsible"); |
321 |
$form->setRegroupe('bible_auto','G',''); |
$form->setRegroupe('bible_auto','G',''); |
324 |
$form->setRegroupe('bible2','F',''); |
$form->setRegroupe('bible2','F',''); |
325 |
} |
} |
326 |
|
|
327 |
|
/*Change le libellé de certains champs*/ |
328 |
function setLib(&$form,$maj) { |
function setLib(&$form,$maj) { |
329 |
parent :: setLib($form,$maj); |
parent :: setLib($form,$maj); |
330 |
$form->setLib('libelle',' '); |
$form->setLib('libelle',' '); |
332 |
$form->setLib('bible',""); |
$form->setLib('bible',""); |
333 |
$form->setLib('bible2',""); |
$form->setLib('bible2',""); |
334 |
$form->setLib('lettretype',"->"._(" courrier ")); |
$form->setLib('lettretype',"->"._(" courrier ")); |
335 |
$form->setLib('datecourrier',_(" du ")); |
$form->setLib('date_evenement',_(" du ")); |
336 |
} |
} |
337 |
|
|
338 |
// ================================================================== |
// ================================================================== |
339 |
// trigger avant modification données [trigger before modify data] |
// trigger avant modification des données [trigger before modify data] |
340 |
// ================================================================== |
// ================================================================== |
341 |
function triggerajouter($id,&$db,$val,$DEBUG) { |
function triggerajouter($id,&$db,$val,$DEBUG) { |
342 |
// mise a jour instruction avec evenement |
// mise a jour instruction avec evenement |
343 |
// [modify instruction with evenement] |
// [modify instruction with evenement] |
344 |
$sql= "select * from ".DB_PREFIXE."evenement where evenement =".$this->valF['evenement']; |
$sql= "select * from ".DB_PREFIXE."evenement where evenement =".$this->valF['evenement']; |
345 |
|
|
346 |
$res = $db->query($sql); |
$res = $db->query($sql); |
347 |
if (database::isError($res)) die($res->getMessage()); |
if (database::isError($res)) die($res->getMessage()); |
348 |
|
|
349 |
if ($DEBUG == 1) |
if ($DEBUG == 1) |
350 |
echo " la requete ".$sql." est exécutée<br>"; |
echo " la requete ".$sql." est exécutée<br>"; |
351 |
|
|
352 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
353 |
|
|
354 |
if(isset($row['action']) and !empty($row['action'])) { |
if(isset($row['action']) and !empty($row['action'])) { |
355 |
$this->valF['action']=$row['action']; |
$this->valF['action']=$row['action']; |
356 |
} else { |
} else { |
364 |
} |
} |
365 |
$this->valF['accord_tacite']=$row['accord_tacite']; |
$this->valF['accord_tacite']=$row['accord_tacite']; |
366 |
$this->valF['delai_notification']=$row['delai_notification']; |
$this->valF['delai_notification']=$row['delai_notification']; |
367 |
if(isset($row['avis']) and !empty($row['avis'])) { |
if(isset($row['avis_decision']) and !empty($row['avis_decision'])) { |
368 |
$this->valF['avis']=$row['avis']; |
$this->valF['avis_decision']=$row['avis_decision']; |
369 |
} else { |
} else { |
370 |
$this->valF['avis']=NULL; |
$this->valF['avis_decision']=NULL; |
371 |
} |
} |
372 |
if($row['lettretype']!="") |
if($row['lettretype']!="") |
373 |
$this->valF['lettretype']=$row['lettretype']; |
$this->valF['lettretype']=$row['lettretype']; |
374 |
else |
else |
375 |
$this->valF['lettretype']="standard"; |
$this->valF['lettretype']="standard"; |
376 |
|
|
377 |
} |
} |
378 |
$sql= "select * from ".DB_PREFIXE."dossier where dossier = '".$this->valF['dossier']."'"; |
$sql= "select * from ".DB_PREFIXE."dossier where dossier = '".$this->valF['dossier']."'"; |
379 |
$res = $db->query($sql); |
$res = $db->query($sql); |
388 |
$this->valF['archive_delai']=$row['delai']; |
$this->valF['archive_delai']=$row['delai']; |
389 |
$this->valF['archive_accord_tacite']=$row['accord_tacite']; |
$this->valF['archive_accord_tacite']=$row['accord_tacite']; |
390 |
$this->valF['archive_etat']=$row['etat']; |
$this->valF['archive_etat']=$row['etat']; |
391 |
$this->valF['archive_avis']=$row['avis']; |
$this->valF['archive_avis']=$row['avis_decision']; |
392 |
// compatibilite pgsql |
// compatibilite pgsql |
393 |
if($row['date_complet']!='') |
if($row['date_complet']!='') |
394 |
$this->valF['archive_date_complet']=$row['date_complet']; |
$this->valF['archive_date_complet']=$row['date_complet']; |
411 |
} |
} |
412 |
} |
} |
413 |
|
|
414 |
|
// Test si une restriction est valide |
415 |
|
// return boolean |
416 |
|
function restrictionIsValid($restriction){ |
417 |
|
|
418 |
|
/* Met des espace avant et après les opérateurs puis transforme la chaine en |
419 |
|
* un tableau */ |
420 |
|
$tabRestriction = str_replace(">="," >= ", |
421 |
|
str_replace("<="," <= ", |
422 |
|
str_replace("-"," - ", |
423 |
|
str_replace("+"," + ",$restriction)))); |
424 |
|
$tabRestriction = explode( " ", $tabRestriction); |
425 |
|
|
426 |
|
//Variables de résultat |
427 |
|
$res = array(); |
428 |
|
$i = 0; |
429 |
|
$comp = ""; |
430 |
|
|
431 |
|
|
432 |
|
//Test que le tableau n'est pas vide |
433 |
|
if ( count($tabRestriction) > 0 ){ |
434 |
|
|
435 |
|
$res[0] = $this->getRestrictionValue($tabRestriction[0]); |
436 |
|
|
437 |
|
//Calcul des variables |
438 |
|
for ( $j = 1 ; $j < count($tabRestriction) ; $j += 2 ) { |
439 |
|
|
440 |
|
//Variable de comparaison |
441 |
|
if ( strcmp( ">=", $tabRestriction[$j] ) == 0 || |
442 |
|
strcmp( "<=", $tabRestriction[$j]) ==0 ){ |
443 |
|
|
444 |
|
$comp = $tabRestriction[$j]; |
445 |
|
$res[++$i] = $this->getRestrictionValue($tabRestriction[$j+1]); |
446 |
|
} |
447 |
|
// Fait l'addition |
448 |
|
elseif ( strcmp( "+", $tabRestriction[$j]) == 0 ){ |
449 |
|
|
450 |
|
$res[$i] = $this->moisdate( $res[$i], $this->getRestrictionValue($tabRestriction[$j+1]) ); |
451 |
|
} |
452 |
|
} |
453 |
|
} |
454 |
|
|
455 |
|
// Effectue le test |
456 |
|
if ( strcmp($comp, ">=") == 0 ){ |
457 |
|
|
458 |
|
if ( $res[0] >= $res[1] || $res[0] == "" ){ |
459 |
|
|
460 |
|
return true; |
461 |
|
} |
462 |
|
else { |
463 |
|
|
464 |
|
return false; |
465 |
|
} |
466 |
|
} |
467 |
|
elseif ( strcmp($comp, "<=") == 0 ){ |
468 |
|
|
469 |
|
if ( $res[0] <= $res[1] || $res[1] == "" ){ |
470 |
|
|
471 |
|
return true; |
472 |
|
} |
473 |
|
else { |
474 |
|
|
475 |
|
return false; |
476 |
|
} |
477 |
|
} |
478 |
|
|
479 |
|
return true; |
480 |
|
} |
481 |
|
|
482 |
|
//Retourne la valeur de valF si $restrictionValue n'est pas un chiffre, le chiffre sinon |
483 |
|
function getRestrictionValue($restrictionValue){ |
484 |
|
|
485 |
|
return ( is_numeric($restrictionValue) ) ? |
486 |
|
$restrictionValue : |
487 |
|
$this->valF[$restrictionValue]; |
488 |
|
} |
489 |
|
|
490 |
function regle($regle){ |
function regle($regle){ |
491 |
$temp = explode ("+",$regle); |
$temp = explode ("+",$regle); |
492 |
//echo '|'.$regle; |
//echo '|'.$regle; |
551 |
$valF['accord_tacite']= $this->regle($row['regle_accord_tacite']); |
$valF['accord_tacite']= $this->regle($row['regle_accord_tacite']); |
552 |
} |
} |
553 |
if($row['regle_avis']!=''){ |
if($row['regle_avis']!=''){ |
554 |
$valF['avis']= $this->regle($row['regle_avis']); |
$valF['avis_decision']= $this->regle($row['regle_avis']); |
555 |
} |
} |
556 |
if($row['regle_date_limite']!=''){ |
if($row['regle_date_limite']!=''){ |
557 |
$valF['date_limite']= $this->regle($row['regle_date_limite']); |
$valF['date_limite']= $this->regle($row['regle_date_limite']); |
602 |
$valF['date_notification_delai'] = $this->moisdate($valF['date_complet'],1); |
$valF['date_notification_delai'] = $this->moisdate($valF['date_complet'],1); |
603 |
// la date du courrier ne doit pas etre depasse par rapport au delai de |
// la date du courrier ne doit pas etre depasse par rapport au delai de |
604 |
// notification [verify notification date] |
// notification [verify notification date] |
605 |
if($this->valF['archive_date_notification_delai']<$this->valF['datecourrier']) |
if($this->valF['archive_date_notification_delai']<$this->valF['date_evenement']) |
606 |
$this->msg=$this->msg."<br><img src='../img/erreur.gif'> "._("date_notification_delai")." ". |
$this->msg=$this->msg."<br><img src='../img/erreur.gif'> "._("date_notification_delai")." ". |
607 |
$this->valF['archive_date_notification_delai']." < "._('datecourrier'); |
$this->valF['archive_date_notification_delai']." < "._('date_evenement'); |
608 |
// |
// |
609 |
break; |
break; |
610 |
case "retour" : |
case "retour" : |
612 |
$valF['etat']= $this->valF['etat']; |
$valF['etat']= $this->valF['etat']; |
613 |
$valF['accord_tacite']= $this->valF['accord_tacite']; |
$valF['accord_tacite']= $this->valF['accord_tacite']; |
614 |
// la date_complet est celle de l evenement |
// la date_complet est celle de l evenement |
615 |
$valF['date_complet']= $this->valF['datecourrier']; |
$valF['date_complet']= $this->valF['date_evenement']; |
616 |
$valF['date_limite'] = $this->moisdate($valF['date_complet'],$valF['delai']); |
$valF['date_limite'] = $this->moisdate($valF['date_complet'],$valF['delai']); |
617 |
$valF['date_notification_delai'] = $this->moisdate($valF['date_complet'],1); |
$valF['date_notification_delai'] = $this->moisdate($valF['date_complet'],1); |
618 |
break; |
break; |
621 |
$valF['etat']= $this->valF['etat']; |
$valF['etat']= $this->valF['etat']; |
622 |
$valF['accord_tacite']= $this->valF['accord_tacite']; |
$valF['accord_tacite']= $this->valF['accord_tacite']; |
623 |
// la date rejet est initialisee |
// la date rejet est initialisee |
624 |
$valF['date_rejet']= $this->valF['datecourrier']; |
$valF['date_rejet']= $this->valF['date_evenement']; |
625 |
// les dates de depart et fin d instruction sont annulées |
// les dates de depart et fin d instruction sont annulées |
626 |
$valF['date_limite'] =null; |
$valF['date_limite'] =null; |
627 |
$valF['date_notification_delai'] =null; |
$valF['date_notification_delai'] =null; |
637 |
$valF['date_notification_delai'] = $this->moisdate($valF['date_complet'],1); |
$valF['date_notification_delai'] = $this->moisdate($valF['date_complet'],1); |
638 |
// la date du courrier ne doit pas etre depasse par rapport au delai de |
// la date du courrier ne doit pas etre depasse par rapport au delai de |
639 |
// notification |
// notification |
640 |
if($this->valF['archive_date_notification_delai']<$this->valF['datecourrier']) |
if($this->valF['archive_date_notification_delai']<$this->valF['date_evenement']) |
641 |
$this->msg=$this->msg."<br><img src='../img/erreur.gif'>"._("date_notification_delai"). |
$this->msg=$this->msg."<br><img src='../img/erreur.gif'>"._("date_notification_delai"). |
642 |
$this->valF['archive_date_notification_delai']." < "._('datecourrier'); |
$this->valF['archive_date_notification_delai']." < "._('date_evenement'); |
643 |
break; |
break; |
644 |
case "acceptation" : |
case "acceptation" : |
645 |
$valF['etat']= $this->valF['etat']; |
$valF['etat']= $this->valF['etat']; |
646 |
$valF['date_decision']= $this->valF['datecourrier']; |
$valF['date_decision']= $this->valF['date_evenement']; |
647 |
$valF['avis']= $this->valF['avis']; |
$valF['avis_decision']= $this->valF['avis_decision']; |
648 |
// date de validite = date de l evenement + delai |
// date de validite = date de l evenement + delai |
649 |
$valF['date_validite'] = $this->moisdate($this->valF['datecourrier'],$this->valF['delai']); |
$valF['date_validite'] = $this->moisdate($this->valF['date_evenement'],$this->valF['delai']); |
650 |
break; |
break; |
651 |
case "refus" : |
case "refus" : |
652 |
$valF['etat']= $this->valF['etat']; |
$valF['etat']= $this->valF['etat']; |
653 |
$valF['date_decision']= $this->valF['datecourrier']; |
$valF['date_decision']= $this->valF['date_evenement']; |
654 |
$valF['avis']= $this->valF['avis']; |
$valF['avis_decision']= $this->valF['avis_decision']; |
655 |
break; |
break; |
656 |
case "prolongation" : |
case "prolongation" : |
657 |
$valF['date_validite'] = $this->moisdate($this->valF['archive_date_validite'],$this->valF['delai']); |
$valF['date_validite'] = $this->moisdate($this->valF['archive_date_validite'],$this->valF['delai']); |
658 |
break; |
break; |
659 |
case "sursis" : |
case "sursis" : |
660 |
$valF['date_limite'] = $this->moisdate($this->valF['datecourrier'],$this->valF['delai']); |
$valF['date_limite'] = $this->moisdate($this->valF['date_evenement'],$this->valF['delai']); |
661 |
$valF['etat']= $this->valF['etat']; |
$valF['etat']= $this->valF['etat']; |
662 |
$valF['accord_tacite']= $this->valF['accord_tacite']; |
$valF['accord_tacite']= $this->valF['accord_tacite']; |
663 |
$valF['avis']= $this->valF['avis']; |
$valF['avis_decision']= $this->valF['avis_decision']; |
664 |
$valF['date_decision']= $this->valF['datecourrier']; |
$valF['date_decision']= $this->valF['date_evenement']; |
665 |
$temp = $valF['date_limite']; |
$temp = $valF['date_limite']; |
666 |
$valF['date_validite']= $this->moisdate($temp,2); |
$valF['date_validite']= $this->moisdate($temp,2); |
667 |
break; |
break; |
668 |
case "execution" : |
case "execution" : |
669 |
$valF['etat']= $this->valF['etat']; |
$valF['etat']= $this->valF['etat']; |
670 |
$valF['date_chantier'] = $this->valF['datecourrier']; |
$valF['date_chantier'] = $this->valF['date_evenement']; |
671 |
//echo $this->msg=$this->msg.$valF['date_chantier'].""; |
//echo $this->msg=$this->msg.$valF['date_chantier'].""; |
672 |
break; |
break; |
673 |
case "achevement" : |
case "achevement" : |
674 |
$valF['etat']= $this->valF['etat']; |
$valF['etat']= $this->valF['etat']; |
675 |
$valF['date_achevement'] = $this->valF['datecourrier']; |
$valF['date_achevement'] = $this->valF['date_evenement']; |
676 |
break; |
break; |
677 |
case "archivage" : |
case "archivage" : |
678 |
$valF['etat']= $this->valF['etat']; |
$valF['etat']= $this->valF['etat']; |
679 |
$valF['date_conformite'] = $this->valF['datecourrier']; |
$valF['date_conformite'] = $this->valF['date_evenement']; |
680 |
break; |
break; |
681 |
|
|
682 |
default: |
default: |
696 |
$db->affectedRows()." "._('enregistrement'). |
$db->affectedRows()." "._('enregistrement'). |
697 |
" "._('mis_a_jour')."]" ; |
" "._('mis_a_jour')."]" ; |
698 |
} |
} |
699 |
|
// verification si envoi vers ERP est active |
700 |
|
if ($this->f->getParameter('option_erp') != "") { |
701 |
|
// la nature du dossier |
702 |
|
$nature_dossier = substr($this->idxformulaire,0,2); |
703 |
|
$dossier_erp = $this->getFromDB("SELECT erp FROM ".DB_PREFIXE."dossier WHERE dossier = '" . |
704 |
|
$this->valF['dossier'] . "'"); |
705 |
|
$evenement_libelle = $this->getFromDB( |
706 |
|
"SELECT libelle FROM ".DB_PREFIXE."evenement WHERE evenement = '" . |
707 |
|
$this->valF['evenement'] . "'"); |
708 |
|
if ($dossier_erp == 't') { |
709 |
|
// envoi du message en cas d'un PC qui est ERP et sur lequel un evenement |
710 |
|
// d'acceptation etait fait |
711 |
|
if ($nature_dossier == |
712 |
|
$this->f->getParameter('erp_evenement_accepter_dossier_PC') |
713 |
|
&& $this->valF['evenement'] == |
714 |
|
$this->f->getParameter('erp_evenement_accepter_sans_reserve')) { |
715 |
|
$msgenque = new MessageEnqueuer(); |
716 |
|
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
717 |
|
$msgenque->setDecision($evenement_libelle); |
718 |
|
$msgenque->enqueueMessage($msgenque::$ERP_ARRETE_PC_EFFECTUE); |
719 |
|
} |
720 |
|
if ($this->valF['evenement'] == |
721 |
|
$this->f->getParameter('erp_evenement_refuser_dossier')) { |
722 |
|
$msgenque = new MessageEnqueuer(); |
723 |
|
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
724 |
|
$msgenque->enqueueMessage($msgenque::$ERP_DECISION_CONFORMITE_EFFECTUE); |
725 |
|
} |
726 |
|
} |
727 |
|
} // fin de if ($this->f->getParameter('option_erp') != "") |
728 |
} |
} |
729 |
|
|
730 |
|
|
731 |
|
/** |
732 |
|
* Fait une requette sql pour extraire la valeur d'un champ, et retourne |
733 |
|
* cette valeur |
734 |
|
* @param string $sql La requete sql a executer |
735 |
|
* @return La valeur du champs cherche, sinon NULL. En cas d'erreur de la BD |
736 |
|
* l'execution s'arrete. |
737 |
|
*/ |
738 |
|
function getFromDB($sql) { |
739 |
|
//$sql = "SELECT libelle FROM ".DB_PREFIXE."dossier WHERE dossier = '" . $dossier . "'"; |
740 |
|
$res = $this->db->limitquery($sql, 0, 1); |
741 |
|
$this->addToLog("getDossierERPSpecification(): db->limitquery(\"". |
742 |
|
str_replace(",",", ",$sql)."\", 0, 1);", VERBOSE_MODE); |
743 |
|
// Si une erreur survient on die |
744 |
|
if (database::isError($res, true)) { |
745 |
|
// Appel de la methode de recuperation des erreurs |
746 |
|
$this->erreur_db($res->getDebugInfo(), $res->getMessage(), 'instruction'); |
747 |
|
} |
748 |
|
// retourne la nature du dossier |
749 |
|
while ($row =& $res->fetchRow()) { |
750 |
|
return $row[0]; |
751 |
|
} |
752 |
|
// la nature n'etait pas trouve, ce qui ne devrait pas se passer |
753 |
|
return NULL; |
754 |
|
|
755 |
|
} |
756 |
|
|
757 |
|
|
758 |
function triggermodifierapres($id,&$db,$val,$DEBUG) { |
function triggermodifierapres($id,&$db,$val,$DEBUG) { |
759 |
/* |
/* |
760 |
* cette fonction apour objet de permettre de modifier la date courrier |
* cette fonction a pour objet de permettre de modifier la date courrier |
761 |
*/ |
*/ |
762 |
$valF=array(); |
$valF=array(); |
763 |
$sql= "select action from ".DB_PREFIXE."evenement where evenement =".$this->valF['evenement']; |
$sql= "select action from ".DB_PREFIXE."evenement where evenement =".$this->valF['evenement']; |
768 |
if (database::isError($res)) die($res->getMessage().$sql); |
if (database::isError($res)) die($res->getMessage().$sql); |
769 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
770 |
// application des regles sur le courrier + delai |
// application des regles sur le courrier + delai |
771 |
if(preg_match("/datecourrier/",$row['regle_date_limite'])){ |
if(preg_match("/date_evenement/",$row['regle_date_limite'])){ |
772 |
$valF['date_limite']= $this->regle($row['regle_date_limite']); |
$valF['date_limite']= $this->regle($row['regle_date_limite']); |
773 |
} |
} |
774 |
if(preg_match("/datecourrier/",$row['regle_date_complet'])){ |
if(preg_match("/date_evenement/",$row['regle_date_complet'])){ |
775 |
$valF['date_complet']= $this->regle($row['regle_date_complet']); |
$valF['date_complet']= $this->regle($row['regle_date_complet']); |
776 |
} |
} |
777 |
if(preg_match("/datecourrier/",$row['regle_date_notification_delai'])){ |
if(preg_match("/date_evenement/",$row['regle_date_notification_delai'])){ |
778 |
$valF['date_notification_delai']= $this->regle($row['regle_date_notification_delai']); |
$valF['date_notification_delai']= $this->regle($row['regle_date_notification_delai']); |
779 |
} |
} |
780 |
if(preg_match("/datecourrier/",$row['regle_date_decision'])){ |
if(preg_match("/date_evenement/",$row['regle_date_decision'])){ |
781 |
$valF['date_decision']= $this->regle($row['regle_date_decision']); |
$valF['date_decision']= $this->regle($row['regle_date_decision']); |
782 |
} |
} |
783 |
if(preg_match("/datecourrier/",$row['regle_date_rejet'])){ |
if(preg_match("/date_evenement/",$row['regle_date_rejet'])){ |
784 |
$valF['date_rejet']= $this->regle($row['regle_date_rejet']); |
$valF['date_rejet']= $this->regle($row['regle_date_rejet']); |
785 |
} |
} |
786 |
if(preg_match("/datecourrier/",$row['regle_date_validite'])){ |
if(preg_match("/date_evenement/",$row['regle_date_validite'])){ |
787 |
$valF['date_validite']= $this->regle($row['regle_date_validite']); |
$valF['date_validite']= $this->regle($row['regle_date_validite']); |
788 |
} |
} |
789 |
if(preg_match("/datecourrier/",$row['regle_date_chantier'])){ |
if(preg_match("/date_evenement/",$row['regle_date_chantier'])){ |
790 |
$valF['date_chantier']= $this->regle($row['regle_date_chantier']); |
$valF['date_chantier']= $this->regle($row['regle_date_chantier']); |
791 |
} |
} |
792 |
if(preg_match("/datecourrier/",$row['regle_date_achevement'])){ |
if(preg_match("/date_evenement/",$row['regle_date_achevement'])){ |
793 |
$valF['date_achevement']= $this->regle($row['regle_date_achevement']); |
$valF['date_achevement']= $this->regle($row['regle_date_achevement']); |
794 |
} |
} |
795 |
if(preg_match("/datecourrier/",$row['regle_date_conformite'])){ |
if(preg_match("/date_evenement/",$row['regle_date_conformite'])){ |
796 |
$valF['date_conformite']= $this->regle($row['regle_date_conformite']); |
$valF['date_conformite']= $this->regle($row['regle_date_conformite']); |
797 |
} |
} |
798 |
} // while |
} // while |
819 |
$valF['accord_tacite']=$val['archive_accord_tacite']; |
$valF['accord_tacite']=$val['archive_accord_tacite']; |
820 |
$valF['etat']=$val['archive_etat']; |
$valF['etat']=$val['archive_etat']; |
821 |
if($val['archive_avis']=='') |
if($val['archive_avis']=='') |
822 |
$valF['avis']= null; |
$valF['avis_decision']= null; |
823 |
else |
else |
824 |
$valF['avis']=$val['archive_avis']; |
$valF['avis_decision']=$val['archive_avis']; |
825 |
// if= compatibilite pgsql |
// if= compatibilite pgsql |
826 |
if($val['archive_date_complet']!='') |
if($val['archive_date_complet']!='') |
827 |
$valF['date_complet']=$val['archive_date_complet']; |
$valF['date_complet']=$val['archive_date_complet']; |
902 |
return $annee."-".$mois."-".$jour ; |
return $annee."-".$mois."-".$jour ; |
903 |
} |
} |
904 |
|
|
905 |
|
// Vérifie la restriction sur l'événement |
906 |
|
function verifier($val = array(), &$db, $DEBUG){ |
907 |
|
parent::verifier($val, $db, $DEBUG); |
908 |
|
//Récupère la restriction |
909 |
|
$sql= "SELECT |
910 |
|
restriction |
911 |
|
FROM |
912 |
|
".DB_PREFIXE."evenement |
913 |
|
WHERE |
914 |
|
evenement =".$this->valF['evenement']; |
915 |
|
|
916 |
|
$res = $db->query($sql); |
917 |
|
$this->f->addToLog("verifier(): db->query(\"".$sql."\");", VERBOSE_MODE); |
918 |
|
$this->f->isDatabaseError(); |
919 |
|
|
920 |
|
$row=& $res->fetchRow(DB_FETCHMODE_ASSOC); |
921 |
|
|
922 |
|
//Test qu'une restriction est présente |
923 |
|
if ( isset($row['restriction']) && $row['restriction'] != "" ){ |
924 |
|
|
925 |
|
//Test si la restriction est valide |
926 |
|
if ( !$this->restrictionIsValid($row['restriction']) ){ |
927 |
|
|
928 |
|
$this->correct=false; |
929 |
|
$this->addToMessage(_("Restriction non valide")); |
930 |
|
} |
931 |
|
else { |
932 |
|
|
933 |
|
$this->correct = true; |
934 |
|
} |
935 |
|
} |
936 |
|
} |
937 |
|
|
938 |
|
/** |
939 |
|
* Méthode permettant de mettre à jour l'état d'un DA |
940 |
|
*/ |
941 |
|
function majEtatDA($dossier_autorisation, $action, $avis_decision) { |
942 |
|
|
943 |
|
} |
944 |
|
|
945 |
|
/** |
946 |
|
* Méthode permettant de mettre à jour les données d'un DA |
947 |
|
*/ |
948 |
|
function majDataDA($dossier_autorisation, $valDI) { |
949 |
|
|
950 |
|
} |
951 |
|
|
952 |
}// fin classe |
}// fin classe |
953 |
?> |
?> |