29 |
$this->constructeur($id,$db,$debug); |
$this->constructeur($id,$db,$debug); |
30 |
}// fin constructeur |
}// fin constructeur |
31 |
|
|
|
function setvalF($val){ |
|
|
$this->valF['instruction'] = $val['instruction']; |
|
|
$this->valF['destinataire'] = $val['destinataire']; |
|
|
$this->valF['lettretype'] = $val['lettretype']; |
|
|
$this->valF['dossier'] = $val['dossier']; |
|
|
if($val['datecourrier']!="") |
|
|
$this->valF['datecourrier'] = $this->dateDB($val['datecourrier']); |
|
|
$this->valF['complement'] = $val['complement']; |
|
|
$this->valF['complement2'] = $val['complement2']; |
|
|
$this->valF['evenement'] = $val['evenement']; |
|
|
} |
|
|
|
|
|
|
|
32 |
function cleSecondaire($id,&$db,$val,$DEBUG) { |
function cleSecondaire($id,&$db,$val,$DEBUG) { |
33 |
// controle suppression cle secondaire [secondary key delete control] |
parent::cleSecondaire($id,$db,$val,$DEBUG); |
34 |
// ------------------------------------------------------------------------------------ |
// controle suppression cle secondaire [secondary key delete control] |
35 |
// specifique detruire que le dernier [specific instruction : delete the last event ] |
// ------------------------------------------------------------------------------------ |
36 |
// ------------------------------------------------------------------------------------ |
// specifique detruire que le dernier [specific instruction : delete the last event ] |
37 |
|
// ------------------------------------------------------------------------------------ |
38 |
$dernierevenement=''; |
$dernierevenement=''; |
39 |
$sql="select max(instruction) from instruction where dossier ='". |
$sql="select max(instruction) from ".DB_PREFIXE."instruction where dossier ='". |
40 |
$this->idxformulaire."'"; |
$this->idxformulaire."'"; |
41 |
$dernierevenement = $db->getOne($sql); |
$dernierevenement = $db->getOne($sql); |
42 |
if($dernierevenement==$id){ |
if($dernierevenement==$id){ |
49 |
} |
} |
50 |
} |
} |
51 |
|
|
|
function verifier($val,&$db,$DEBUG){ |
|
|
$this->correct=True; |
|
|
$imgv=""; |
|
|
$f=" ! "; |
|
|
$imgv="<img src='../app/img/punaise.png' style='vertical-align:middle' hspace='2' border='0'>"; |
|
|
// obligatoire |
|
|
if ($this->valF['destinataire']==""){ |
|
|
$this->correct=false; |
|
|
$this->msg= $this->msg.$imgv." "._('instruction')." ". |
|
|
_('obligatoire').$f; |
|
|
} |
|
|
if ($val['datecourrier']==""){ |
|
|
$this->correct=false; |
|
|
$this->msg= $this->msg.$imgv." "._('datecourrier')." ". |
|
|
_('obligatoire').$f; |
|
|
} |
|
|
if ($val['evenement']==""){ |
|
|
$this->correct=false; |
|
|
$this->msg= $this->msg.$imgv." "._('evenement')." ". |
|
|
_('obligatoire').$f; |
|
|
} |
|
|
}//verifier |
|
|
|
|
52 |
function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire){ |
function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire){ |
53 |
if ($validation==0) { |
if ($validation==0 and $maj<2) { |
54 |
if ($maj == 0){ |
if ($maj == 0){ |
55 |
$form->setVal("destinataire", $idxformulaire); |
$form->setVal("destinataire", $idxformulaire); |
56 |
$form->setVal("dossier", $idxformulaire); |
$form->setVal("dossier", $idxformulaire); |
65 |
} |
} |
66 |
|
|
67 |
function setType(&$form,$maj) { |
function setType(&$form,$maj) { |
68 |
if ($maj < 2) { //ajouter et modifier |
parent::setType($form,$maj); |
69 |
$form->setType('destinataire', 'hidden'); |
if ($maj < 2) { //ajouter et modifier |
70 |
$form->setType('lettretype', 'hiddenstatic'); |
$form->setType('destinataire', 'hidden'); |
71 |
$form->setType('complement', 'textarea'); |
$form->setType('lettretype', 'hiddenstatic'); |
72 |
$form->setType('complement2', 'textarea'); |
$form->setType('complement', 'textarea'); |
73 |
|
$form->setType('complement2', 'textarea'); |
74 |
|
$form->setType('bible_auto', 'httpclick'); |
75 |
|
$form->setType('bible', 'httpclick'); |
76 |
|
$form->setType('bible2', 'httpclick'); |
77 |
|
$form->setType('dossier', 'hiddenstatic'); |
78 |
|
$form->setType('libelle', 'hiddenstatic'); |
79 |
|
if($maj==0){ // add |
80 |
|
$form->setType('instruction', 'hiddenstatic'); |
81 |
|
$form->setType('evenement', 'select'); |
82 |
|
$form->setType('datecourrier', 'date2'); |
83 |
|
}else{ // modify |
84 |
|
$form->setType('instruction', 'hiddenstatic'); |
85 |
|
$form->setType('evenement', 'hiddenstatic'); |
86 |
|
//$form->setType('datecourrier', 'hiddenstaticdate'); |
87 |
|
$form->setType('datecourrier', 'date2'); |
88 |
|
// necessaire pour calcul de date en modification |
89 |
|
$form->setType('delai', 'hiddenstatic'); |
90 |
|
} |
91 |
|
}else{ // supprimer [delete] |
92 |
|
$form->setType('instruction', 'hiddenstatic'); |
93 |
|
$form->setType('dossier', 'hiddenstatic'); |
94 |
|
$form->setType('archive_delai', 'hiddenstatic'); |
95 |
|
$form->setType('archive_etat', 'hiddenstatic'); |
96 |
|
$form->setType('archive_accord_tacite', 'hiddenstatic'); |
97 |
|
$form->setType('archive_avis', 'hiddenstatic'); |
98 |
|
$form->setType('archive_date_complet', 'hiddenstatic'); |
99 |
|
$form->setType('archive_date_rejet', 'hiddenstatic'); |
100 |
|
$form->setType('archive_date_limite', 'hiddenstatic'); |
101 |
|
$form->setType('archive_date_notification_delai', 'hiddenstatic'); |
102 |
|
$form->setType('archive_date_decision', 'hiddenstatic'); |
103 |
|
$form->setType('archive_date_validite', 'hiddenstatic'); |
104 |
|
$form->setType('archive_date_achevement', 'hiddenstatic'); |
105 |
|
} |
106 |
$form->setType('complement3', 'hidden'); |
$form->setType('complement3', 'hidden'); |
107 |
|
$form->setType('bible_auto', 'hidden'); |
108 |
|
$form->setType('bible', 'hidden'); |
109 |
|
$form->setType('bible2', 'hidden'); |
110 |
$form->setType('bible3', 'hidden'); |
$form->setType('bible3', 'hidden'); |
111 |
$form->setType('complement4', 'hidden'); |
$form->setType('complement4', 'hidden'); |
112 |
$form->setType('bible4', 'hidden'); |
$form->setType('bible4', 'hidden'); |
132 |
$form->setType('bible14', 'hidden'); |
$form->setType('bible14', 'hidden'); |
133 |
$form->setType('complement15', 'hidden'); |
$form->setType('complement15', 'hidden'); |
134 |
$form->setType('bible15', 'hidden'); |
$form->setType('bible15', 'hidden'); |
|
$form->setType('bible_auto', 'httpclick'); |
|
|
$form->setType('bible', 'httpclick'); |
|
|
$form->setType('bible2', 'httpclick'); |
|
|
$form->setType('dossier', 'hiddenstatic'); |
|
135 |
$form->setType('delai', 'hidden'); |
$form->setType('delai', 'hidden'); |
136 |
$form->setType('etat', 'hidden'); |
$form->setType('etat', 'hidden'); |
137 |
$form->setType('accord_tacite', 'hidden'); |
$form->setType('accord_tacite', 'hidden'); |
150 |
$form->setType('archive_date_validite', 'hidden'); |
$form->setType('archive_date_validite', 'hidden'); |
151 |
$form->setType('archive_date_achevement', 'hidden'); |
$form->setType('archive_date_achevement', 'hidden'); |
152 |
$form->setType('archive_date_conformite', 'hidden'); |
$form->setType('archive_date_conformite', 'hidden'); |
153 |
$form->setType('archive_date_chantier', 'hidden'); |
$form->setType('archive_date_chantier', 'hidden'); |
|
$form->setType('libelle', 'hiddenstatic'); |
|
|
if($maj==0){ // add |
|
|
$form->setType('instruction', 'hiddenstatic'); |
|
|
$form->setType('evenement', 'select'); |
|
|
$form->setType('datecourrier', 'date2'); |
|
|
}else{ // modify |
|
|
$form->setType('instruction', 'hiddenstatic'); |
|
|
$form->setType('evenement', 'hiddenstatic'); |
|
|
//$form->setType('datecourrier', 'hiddenstaticdate'); |
|
|
$form->setType('datecourrier', 'date2'); |
|
|
} |
|
|
}else{ // supprimer [delete] |
|
|
$form->setType('instruction', 'hiddenstatic'); |
|
|
$form->setType('dossier', 'hiddenstatic'); |
|
|
$form->setType('archive_delai', 'hiddenstatic'); |
|
|
$form->setType('archive_etat', 'hiddenstatic'); |
|
|
$form->setType('archive_accord_tacite', 'hiddenstatic'); |
|
|
$form->setType('archive_avis', 'hiddenstatic'); |
|
|
$form->setType('archive_date_complet', 'hiddenstatic'); |
|
|
$form->setType('archive_date_rejet', 'hiddenstatic'); |
|
|
$form->setType('archive_date_limite', 'hiddenstatic'); |
|
|
$form->setType('archive_date_notification_delai', 'hiddenstatic'); |
|
|
$form->setType('archive_date_decision', 'hiddenstatic'); |
|
|
$form->setType('archive_date_validite', 'hiddenstatic'); |
|
|
$form->setType('archive_date_achevement', 'hiddenstatic'); |
|
|
} |
|
154 |
} |
} |
155 |
|
|
156 |
|
function setSelect(&$form, $maj,&$db,$DEBUG) { |
157 |
|
if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc.php")) |
158 |
|
include ("../sql/".$db->phptype."/".$this->table.".form.inc.php"); |
159 |
|
|
160 |
function setTaille(&$form,$maj){ |
// *** evenement *** |
161 |
$form->setTaille('complement', 120); |
$contenu=array(); |
162 |
$form->setTaille('complement2', 120); |
// etat du dossier |
163 |
$form->setTaille('datecourrier', 12); |
$sql="select etat from ".DB_PREFIXE."dossier where dossier ='". |
164 |
} |
$this->idxformulaire."'"; |
165 |
|
$etat_dossier = $db->getOne($sql); |
166 |
function setMax(&$form,$maj){ |
$nature_dossier= substr($this->idxformulaire,0,2); |
167 |
$form->setMax('complement',12 ); |
// recherche des evenement de transition |
168 |
$form->setMax('complement2',12 ); |
$sql= $sql_transition." where transition.etat ='".$etat_dossier."' and (evenement.nature ='". |
169 |
} |
$nature_dossier."' or (nature ='T' and nature !='CU')) order by evenement.action"; |
170 |
|
|
171 |
|
// *** attention en dur le CU |
172 |
|
|
173 |
|
|
174 |
//function setSelect(&$form, $maj,&$db,$DEBUG,$idxformulaire) { |
$res = $db->query($sql); |
175 |
function setSelect(&$form, $maj,&$db,$DEBUG) { |
if (database::isError($res)) |
176 |
if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc")) |
die($res->getMessage()); |
177 |
include ("../sql/".$db->phptype."/".$this->table.".form.inc"); |
$contenu[0][0]=""; |
178 |
if($maj<2){ |
$contenu[1][0]=_('choisir')." "._('evenement'); |
179 |
// *** evenement *** |
$k=1; |
180 |
$contenu=array(); |
while ($row=& $res->fetchRow()){ |
181 |
// etat du dossier |
if($maj==0){ // ajouter |
182 |
$sql="select etat from dossier where dossier ='". |
$contenu[0][$k]=$row[0]; |
183 |
$this->idxformulaire."'"; |
$contenu[1][$k]=$row[1]; |
184 |
$etat_dossier = $db->getOne($sql); |
$k++; |
185 |
$nature_dossier= substr($this->idxformulaire,0,2); |
}else{ |
186 |
// recherche des evenement de transition |
// select hiddenstatic |
187 |
$sql= $sql_transition." where transition.etat ='".$etat_dossier."' and (evenement.nature ='". |
$contenu[0][$k]=$row[0]; |
188 |
$nature_dossier."' or (nature ='T' and nature !='CU')) order by evenement.action"; |
$contenu[1][$k]=$row[1]; |
189 |
// *** attention en dur le CU |
$k++; |
190 |
|
} |
|
|
|
|
$res = $db->query($sql); |
|
|
if (database::isError($res)) |
|
|
die($res->getMessage()); |
|
|
$contenu[0][0]=""; |
|
|
$contenu[1][0]=_('choisir')." "._('evenement'); |
|
|
$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 "; |
|
|
$form->setSelect("bible_auto",$contenu); |
|
|
// lien bible1 |
|
|
$contenu=array(); |
|
|
$contenu[0]=" Bible "; |
|
|
$form->setSelect("bible",$contenu); |
|
|
// lien bible2 |
|
|
$contenu=array(); |
|
|
$contenu[0]=" Bible "; |
|
|
$form->setSelect("bible2",$contenu); |
|
191 |
} |
} |
192 |
|
$form->setSelect("evenement",$contenu); |
193 |
|
// lien bible_auto [link] |
194 |
|
$contenu=array(); |
195 |
|
$contenu[0]=" automatique "; |
196 |
|
$form->setSelect("bible_auto",$contenu); |
197 |
|
// lien bible1 |
198 |
|
$contenu=array(); |
199 |
|
$contenu[0]=" Bible "; |
200 |
|
$form->setSelect("bible",$contenu); |
201 |
|
// lien bible2 |
202 |
|
$contenu=array(); |
203 |
|
$contenu[0]=" Bible "; |
204 |
|
$form->setSelect("bible2",$contenu); |
205 |
} // function select |
} // function select |
206 |
|
|
207 |
function setGroupe(&$form,$maj){ |
function setGroupe(&$form,$maj){ |
216 |
$form->setRegroupe('libelle','G',''); |
$form->setRegroupe('libelle','G',''); |
217 |
$form->setRegroupe('datecourrier','G',''); |
$form->setRegroupe('datecourrier','G',''); |
218 |
$form->setRegroupe('lettretype','F',''); |
$form->setRegroupe('lettretype','F',''); |
219 |
$form->setRegroupe('complement','D',_('complement'), "startClosed"); |
$form->setRegroupe('complement','D',_('complement'), "collapsible"); |
220 |
$form->setRegroupe('bible_auto','G',''); |
$form->setRegroupe('bible_auto','G',''); |
221 |
$form->setRegroupe('bible','F',''); |
$form->setRegroupe('bible','F',''); |
222 |
$form->setRegroupe('complement2','D',_('complement2'), "startClosed"); |
$form->setRegroupe('complement2','D',_('complement2'), "startClosed"); |
233 |
$form->setLib('datecourrier',_(" du ")); |
$form->setLib('datecourrier',_(" du ")); |
234 |
} |
} |
235 |
|
|
|
function setOnchange(&$form,$maj){ |
|
|
$form->setOnchange("datecourrier","fdate(this)"); |
|
|
} |
|
|
|
|
236 |
// ================================================================== |
// ================================================================== |
237 |
// trigger avant modification données [trigger before modify data] |
// trigger avant modification données [trigger before modify data] |
238 |
// ================================================================== |
// ================================================================== |
239 |
function triggerajouter($id,&$db,$val,$DEBUG) { |
function triggerajouter($id,&$db,$val,$DEBUG) { |
240 |
// mise a jour instruction avec evenement |
// mise a jour instruction avec evenement |
241 |
// [modify instruction with evenement] |
// [modify instruction with evenement] |
242 |
$sql= "select * from evenement where evenement =".$this->valF['evenement']; |
$sql= "select * from ".DB_PREFIXE."evenement where evenement =".$this->valF['evenement']; |
243 |
$res = $db->query($sql); |
$res = $db->query($sql); |
244 |
if (database::isError($res)) |
if (database::isError($res)) die($res->getMessage()); |
|
die($res->getMessage()); |
|
245 |
if ($DEBUG == 1) |
if ($DEBUG == 1) |
246 |
echo " la requete ".$sql." est exécutée<br>"; |
echo " la requete ".$sql." est exécutée<br>"; |
247 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
256 |
else |
else |
257 |
$this->valF['lettretype']="standard"; |
$this->valF['lettretype']="standard"; |
258 |
} |
} |
259 |
$sql= "select * from dossier where dossier = '".$this->valF['dossier']."'"; |
$sql= "select * from ".DB_PREFIXE."dossier where dossier = '".$this->valF['dossier']."'"; |
260 |
$res = $db->query($sql); |
$res = $db->query($sql); |
261 |
if (database::isError($res)) |
if (database::isError($res)) |
262 |
die($res->getMessage()); |
die($res->getMessage()); |
294 |
|
|
295 |
function regle($regle){ |
function regle($regle){ |
296 |
$temp = explode ("+",$regle); |
$temp = explode ("+",$regle); |
297 |
echo '/'.$regle.sizeof($temp); |
//echo '|'.$regle; |
298 |
if(sizeof($temp)==1) |
// cas rejet |
299 |
if($temp[0]=="archive_date_depot") |
if($regle=="null") // 1 dimension -> null |
300 |
|
return null; |
301 |
|
if(sizeof($temp)==1) // 1 dimension |
302 |
|
if($temp[0]=="archive_date_depot") // initialisation avec le depot |
303 |
return $this->$regle; |
return $this->$regle; |
304 |
else |
else // cas general |
305 |
return $this->valF[$regle]; |
return $this->valF[$regle]; |
306 |
else{ |
if(sizeof($temp)==2){ // 2 dimensions |
307 |
if($temp[0]=="archive_date_depot") |
if($temp[0]=="archive_date_depot") //initialisation avec le depot |
308 |
if(is_numeric($temp[1])) |
if(is_numeric($temp[1])) |
309 |
return $this->moisdate($this->$temp[0], $temp[1]); |
return $this->moisdate($this->$temp[0], $temp[1]); |
310 |
else |
else |
311 |
return $this->moisdate($this->$temp[0], $this->valF[$temp[1]]); |
return $this->moisdate($this->$temp[0], $this->valF[$temp[1]]); |
312 |
|
if($temp[0]=="archive_delai") // majoration de delai |
313 |
|
return $this->valF[$temp[0]]+$this->valF[$temp[1]]; |
314 |
|
// cas general 2 dimensions |
315 |
if(is_numeric($temp[1])) |
if(is_numeric($temp[1])) |
316 |
return $this->moisdate($this->valF[$temp[0]], $temp[1]); |
return $this->moisdate($this->valF[$temp[0]], $temp[1]); |
317 |
else |
else |
318 |
return $this->moisdate($this->valF[$temp[0]], $this->valF[$temp[1]]); |
return $this->moisdate($this->valF[$temp[0]], $this->valF[$temp[1]]); |
319 |
} |
} |
320 |
|
if(sizeof($temp)==3){ // 3 dimensions |
321 |
|
// cas date de validite de sursis |
322 |
|
if(is_numeric($temp[1])) |
323 |
|
$temp1 = $this->moisdate($this->valF[$temp[0]], $temp[1]); |
324 |
|
else |
325 |
|
$temp1 = $this->moisdate($this->valF[$temp[0]], $this->valF[$temp[1]]); |
326 |
|
if(is_numeric($temp[2])) |
327 |
|
return $this->moisdate($temp1, $temp[2]); |
328 |
|
else |
329 |
|
return $this->moisdate($temp1, $this->valF[$temp[2]]); |
330 |
|
} |
331 |
} |
} |
332 |
|
|
333 |
|
|
340 |
// voir parametrage CU en dur |
// voir parametrage CU en dur |
341 |
// voir parametrage des actions en dur |
// voir parametrage des actions en dur |
342 |
$param=1; |
$param=1; |
|
|
|
343 |
if($param==1){ |
if($param==1){ |
344 |
$sql="select * from action where action = '".$this->valF['action']."'"; |
$sql="select * from ".DB_PREFIXE."action where action = '".$this->valF['action']."'"; |
345 |
$res = $db->query($sql); |
$res = $db->query($sql); |
346 |
if (database::isError($res)) |
if (database::isError($res)) |
347 |
die($res->getMessage()); |
die($res->getMessage()); |
355 |
if($row['regle_accord_tacite']!=''){ |
if($row['regle_accord_tacite']!=''){ |
356 |
$valF['accord_tacite']= $this->regle($row['regle_accord_tacite']); |
$valF['accord_tacite']= $this->regle($row['regle_accord_tacite']); |
357 |
} |
} |
358 |
|
if($row['regle_avis']!=''){ |
359 |
|
$valF['avis']= $this->regle($row['regle_avis']); |
360 |
|
} |
361 |
if($row['regle_date_limite']!=''){ |
if($row['regle_date_limite']!=''){ |
362 |
$valF['date_limite']= $this->regle($row['regle_date_limite']); |
$valF['date_limite']= $this->regle($row['regle_date_limite']); |
363 |
} |
} |
367 |
if($row['regle_date_notification_delai']!=''){ |
if($row['regle_date_notification_delai']!=''){ |
368 |
$valF['date_notification_delai']= $this->regle($row['regle_date_notification_delai']); |
$valF['date_notification_delai']= $this->regle($row['regle_date_notification_delai']); |
369 |
} |
} |
370 |
|
if($row['regle_date_decision']!=''){ |
371 |
|
$valF['date_decision']= $this->regle($row['regle_date_decision']); |
372 |
|
} |
373 |
|
if($row['regle_date_rejet']!=''){ |
374 |
|
$valF['date_rejet']= $this->regle($row['regle_date_rejet']); |
375 |
|
} |
376 |
|
if($row['regle_date_validite']!=''){ |
377 |
|
$valF['date_validite']= $this->regle($row['regle_date_validite']); |
378 |
|
} |
379 |
|
if($row['regle_date_chantier']!=''){ |
380 |
|
$valF['date_chantier']= $this->regle($row['regle_date_chantier']); |
381 |
|
} |
382 |
|
if($row['regle_date_achevement']!=''){ |
383 |
|
$valF['date_achevement']= $this->regle($row['regle_date_achevement']); |
384 |
|
} |
385 |
|
if($row['regle_date_conformite']!=''){ |
386 |
|
$valF['date_conformite']= $this->regle($row['regle_date_conformite']); |
387 |
|
} |
388 |
} |
} |
389 |
}else{ |
}else{ |
390 |
|
switch ($this->valF['action']) { |
391 |
switch ($this->valF['action']) { |
case "initialisation" : |
392 |
case "initialisation" : |
$valF['delai']= $this->valF['delai']; |
393 |
$valF['delai']= $this->valF['delai']; |
$valF['etat']= $this->valF['etat']; |
394 |
$valF['etat']= $this->valF['etat']; |
$valF['accord_tacite']= $this->valF['accord_tacite']; |
395 |
$valF['accord_tacite']= $this->valF['accord_tacite']; |
// la date_complet est la date de depot |
396 |
// la date_complet est la date de depot |
$valF['date_complet']= $this->archive_date_depot; // **** |
397 |
$valF['date_complet']= $this->archive_date_depot; // **** |
$valF['date_limite'] = $this->moisdate($valF['date_complet'],$valF['delai']); |
398 |
$valF['date_limite'] = $this->moisdate($valF['date_complet'],$valF['delai']); |
$valF['date_notification_delai'] = $this->moisdate($valF['date_complet'],1); |
399 |
$valF['date_notification_delai'] = $this->moisdate($valF['date_complet'],1); |
break; |
400 |
break; |
case "notification" : |
401 |
case "notification" : |
$valF['delai']= $this->valF['delai']; |
402 |
$valF['delai']= $this->valF['delai']; |
$valF['etat']= $this->valF['etat']; |
403 |
$valF['etat']= $this->valF['etat']; |
$valF['accord_tacite']= $this->valF['accord_tacite']; |
404 |
$valF['accord_tacite']= $this->valF['accord_tacite']; |
// la date_complet est celle precedemment saisie |
405 |
// la date_complet est celle precedemment saisie |
$valF['date_complet']=$this->valF['archive_date_complet']; |
406 |
$valF['date_complet']=$this->valF['archive_date_complet']; |
$valF['date_limite'] = $this->moisdate($valF['date_complet'],$valF['delai']); |
407 |
$valF['date_limite'] = $this->moisdate($valF['date_complet'],$valF['delai']); |
$valF['date_notification_delai'] = $this->moisdate($valF['date_complet'],1); |
408 |
$valF['date_notification_delai'] = $this->moisdate($valF['date_complet'],1); |
// la date du courrier ne doit pas etre depasse par rapport au delai de |
409 |
// la date du courrier ne doit pas etre depasse par rapport au delai de |
// notification [verify notification date] |
410 |
// notification [verify notification date] |
if($this->valF['archive_date_notification_delai']<$this->valF['datecourrier']) |
411 |
if($this->valF['archive_date_notification_delai']<$this->valF['datecourrier']) |
$this->msg=$this->msg."<br><img src='../img/erreur.gif'> "._("date_notification_delai")." ". |
412 |
$this->msg=$this->msg."<br><img src='../img/erreur.gif'> "._("date_notification_delai")." ". |
$this->valF['archive_date_notification_delai']." < "._('datecourrier'); |
413 |
|
// |
414 |
|
break; |
415 |
|
case "retour" : |
416 |
|
$valF['delai']= $this->valF['delai']; |
417 |
|
$valF['etat']= $this->valF['etat']; |
418 |
|
$valF['accord_tacite']= $this->valF['accord_tacite']; |
419 |
|
// la date_complet est celle de l evenement |
420 |
|
$valF['date_complet']= $this->valF['datecourrier']; |
421 |
|
$valF['date_limite'] = $this->moisdate($valF['date_complet'],$valF['delai']); |
422 |
|
$valF['date_notification_delai'] = $this->moisdate($valF['date_complet'],1); |
423 |
|
break; |
424 |
|
case "rejet" : |
425 |
|
//$valF['delai']=0; // *** delai a garder pour etat dpc |
426 |
|
$valF['etat']= $this->valF['etat']; |
427 |
|
$valF['accord_tacite']= $this->valF['accord_tacite']; |
428 |
|
// la date rejet est initialisee |
429 |
|
$valF['date_rejet']= $this->valF['datecourrier']; |
430 |
|
// les dates de depart et fin d instruction sont annulées |
431 |
|
$valF['date_limite'] =null; |
432 |
|
$valF['date_notification_delai'] =null; |
433 |
|
$valF['date_complet']=null; |
434 |
|
break; |
435 |
|
case "majoration" : |
436 |
|
$valF['delai']= $this->valF['archive_delai']+$this->valF['delai']; |
437 |
|
$valF['etat']= $this->valF['etat']; |
438 |
|
$valF['accord_tacite']= $this->valF['accord_tacite']; |
439 |
|
$valF['date_complet']=$this->valF['archive_date_complet']; |
440 |
|
// majoration de la date limite |
441 |
|
$valF['date_limite'] = $this->moisdate($valF['date_complet'],$valF['delai']); |
442 |
|
$valF['date_notification_delai'] = $this->moisdate($valF['date_complet'],1); |
443 |
|
// la date du courrier ne doit pas etre depasse par rapport au delai de |
444 |
|
// notification |
445 |
|
if($this->valF['archive_date_notification_delai']<$this->valF['datecourrier']) |
446 |
|
$this->msg=$this->msg."<br><img src='../img/erreur.gif'>"._("date_notification_delai"). |
447 |
$this->valF['archive_date_notification_delai']." < "._('datecourrier'); |
$this->valF['archive_date_notification_delai']." < "._('datecourrier'); |
448 |
// |
break; |
449 |
break; |
case "acceptation" : |
450 |
case "retour" : |
$valF['etat']= $this->valF['etat']; |
451 |
$valF['delai']= $this->valF['delai']; |
$valF['date_decision']= $this->valF['datecourrier']; |
452 |
$valF['etat']= $this->valF['etat']; |
$valF['avis']= $this->valF['avis']; |
453 |
$valF['accord_tacite']= $this->valF['accord_tacite']; |
// date de validite = date de l evenement + delai |
454 |
// la date_complet est celle de l evenement |
$valF['date_validite'] = $this->moisdate($this->valF['datecourrier'],$this->valF['delai']); |
455 |
$valF['date_complet']= $this->valF['datecourrier']; |
break; |
456 |
$valF['date_limite'] = $this->moisdate($valF['date_complet'],$valF['delai']); |
case "refus" : |
457 |
$valF['date_notification_delai'] = $this->moisdate($valF['date_complet'],1); |
$valF['etat']= $this->valF['etat']; |
458 |
break; |
$valF['date_decision']= $this->valF['datecourrier']; |
459 |
case "rejet" : |
$valF['avis']= $this->valF['avis']; |
460 |
//$valF['delai']=0; // *** delai a garder pour etat dpc |
break; |
461 |
$valF['etat']= $this->valF['etat']; |
case "prolongation" : |
462 |
$valF['accord_tacite']= $this->valF['accord_tacite']; |
$valF['date_validite'] = $this->moisdate($this->valF['archive_date_validite'],$this->valF['delai']); |
463 |
// la date rejet est initialisee |
break; |
464 |
$valF['date_rejet']= $this->valF['datecourrier']; |
case "sursis" : |
465 |
// les dates de depart et fin d instruction sont annulées |
$valF['date_limite'] = $this->moisdate($this->valF['datecourrier'],$this->valF['delai']); |
466 |
$valF['date_limite'] =null; |
$valF['etat']= $this->valF['etat']; |
467 |
$valF['date_notification_delai'] =null; |
$valF['accord_tacite']= $this->valF['accord_tacite']; |
468 |
$valF['date_complet']=null; |
$valF['avis']= $this->valF['avis']; |
469 |
break; |
$valF['date_decision']= $this->valF['datecourrier']; |
470 |
case "majoration" : |
$temp = $valF['date_limite']; |
471 |
$valF['delai']= $this->valF['archive_delai']+$this->valF['delai']; |
$valF['date_validite']= $this->moisdate($temp,2); |
472 |
$valF['etat']= $this->valF['etat']; |
break; |
473 |
$valF['accord_tacite']= $this->valF['accord_tacite']; |
case "execution" : |
474 |
$valF['date_complet']=$this->valF['archive_date_complet']; |
$valF['etat']= $this->valF['etat']; |
475 |
// majoration de la date limite |
$valF['date_chantier'] = $this->valF['datecourrier']; |
476 |
$valF['date_limite'] = $this->moisdate($valF['date_complet'],$valF['delai']); |
//echo $this->msg=$this->msg.$valF['date_chantier'].""; |
477 |
$valF['date_notification_delai'] = $this->moisdate($valF['date_complet'],1); |
break; |
478 |
// la date du courrier ne doit pas etre depasse par rapport au delai de |
case "achevement" : |
479 |
// notification |
$valF['etat']= $this->valF['etat']; |
480 |
if($this->valF['archive_date_notification_delai']<$this->valF['datecourrier']) |
$valF['date_achevement'] = $this->valF['datecourrier']; |
481 |
$this->msg=$this->msg."<br><img src='../img/erreur.gif'>"._("date_notification_delai"). |
break; |
482 |
$this->valF['archive_date_notification_delai']." < "._('datecourrier'); |
case "archivage" : |
483 |
break; |
$valF['etat']= $this->valF['etat']; |
484 |
case "acceptation" : |
$valF['date_conformite'] = $this->valF['datecourrier']; |
485 |
$valF['etat']= $this->valF['etat']; |
break; |
486 |
$valF['date_decision']= $this->valF['datecourrier']; |
|
487 |
$valF['avis']= $this->valF['avis']; |
default: |
488 |
// date de validite = date de l evenement + delai |
if ($this->valF['etat']!="") |
489 |
$valF['date_validite'] = $this->moisdate($this->valF['datecourrier'],$this->valF['delai']); |
$valF['etat']= $this->valF['etat']; |
490 |
break; |
}// end switch |
|
case "refus" : |
|
|
$valF['etat']= $this->valF['etat']; |
|
|
$valF['date_decision']= $this->valF['datecourrier']; |
|
|
$valF['avis']= $this->valF['avis']; |
|
|
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['datecourrier'],$this->valF['delai']); |
|
|
$valF['etat']= $this->valF['etat']; |
|
|
$valF['accord_tacite']= $this->valF['accord_tacite']; |
|
|
$valF['avis']= $this->valF['avis']; |
|
|
$valF['date_decision']= $this->valF['datecourrier']; |
|
|
$temp = $valF['date_limite']; |
|
|
$valF['date_validite']= $this->moisdate($temp,2); |
|
|
break; |
|
|
case "execution" : |
|
|
$valF['etat']= $this->valF['etat']; |
|
|
$valF['date_chantier'] = $this->valF['datecourrier']; |
|
|
//echo $this->msg=$this->msg.$valF['date_chantier'].""; |
|
|
break; |
|
|
case "achevement" : |
|
|
$valF['etat']= $this->valF['etat']; |
|
|
$valF['date_achevement'] = $this->valF['datecourrier']; |
|
|
break; |
|
|
case "archivage" : |
|
|
$valF['etat']= $this->valF['etat']; |
|
|
$valF['date_conformite'] = $this->valF['datecourrier']; |
|
|
break; |
|
|
|
|
|
default: |
|
|
if ($this->valF['etat']!="") |
|
|
$valF['etat']= $this->valF['etat']; |
|
|
}// end switch |
|
491 |
} // end param |
} // end param |
|
// mise à jour dossier [modify dossier] |
|
|
print_r($valF); |
|
492 |
if($valF!=""){ |
if($valF!=""){ |
493 |
$cle= " dossier = '".$this->valF['dossier']."'"; |
$cle= " dossier = '".$this->valF['dossier']."'"; |
494 |
$res1= $db->autoExecute('dossier',$valF,DB_AUTOQUERY_UPDATE,$cle); |
$res1= $db->autoExecute(DB_PREFIXE.'dossier',$valF,DB_AUTOQUERY_UPDATE,$cle); |
495 |
if (database::isError($res1)) |
if (database::isError($res1)) |
496 |
die($res->getMessage()); |
die($res->getMessage()); |
497 |
if ($DEBUG == 1) |
if ($DEBUG == 1) |
502 |
" "._('mis_a_jour')."]" ; |
" "._('mis_a_jour')."]" ; |
503 |
} |
} |
504 |
} |
} |
505 |
|
|
506 |
|
function triggermodifierapres($id,&$db,$val,$DEBUG) { |
507 |
|
/* |
508 |
|
* cette fonction apour objet de permettre de modifier la date courrier |
509 |
|
*/ |
510 |
|
$valF=array(); |
511 |
|
$sql= "select action from ".DB_PREFIXE."evenement where evenement =".$this->valF['evenement']; |
512 |
|
$action = $db->getOne($sql); |
513 |
|
if (database::isError($action)) die($action->getMessage().$sql); |
514 |
|
$sql="select * from ".DB_PREFIXE."action where action = '".$action."'"; |
515 |
|
$res = $db->query($sql); |
516 |
|
if (database::isError($res)) die($res->getMessage().$sql); |
517 |
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
518 |
|
// application des regles sur le courrier + delai |
519 |
|
if(preg_match("/datecourrier/",$row['regle_date_limite'])){ |
520 |
|
$valF['date_limite']= $this->regle($row['regle_date_limite']); |
521 |
|
} |
522 |
|
if(preg_match("/datecourrier/",$row['regle_date_complet'])){ |
523 |
|
$valF['date_complet']= $this->regle($row['regle_date_complet']); |
524 |
|
} |
525 |
|
if(preg_match("/datecourrier/",$row['regle_date_notification_delai'])){ |
526 |
|
$valF['date_notification_delai']= $this->regle($row['regle_date_notification_delai']); |
527 |
|
} |
528 |
|
if(preg_match("/datecourrier/",$row['regle_date_decision'])){ |
529 |
|
$valF['date_decision']= $this->regle($row['regle_date_decision']); |
530 |
|
} |
531 |
|
if(preg_match("/datecourrier/",$row['regle_date_rejet'])){ |
532 |
|
$valF['date_rejet']= $this->regle($row['regle_date_rejet']); |
533 |
|
} |
534 |
|
if(preg_match("/datecourrier/",$row['regle_date_validite'])){ |
535 |
|
$valF['date_validite']= $this->regle($row['regle_date_validite']); |
536 |
|
} |
537 |
|
if(preg_match("/datecourrier/",$row['regle_date_chantier'])){ |
538 |
|
$valF['date_chantier']= $this->regle($row['regle_date_chantier']); |
539 |
|
} |
540 |
|
if(preg_match("/datecourrier/",$row['regle_date_achevement'])){ |
541 |
|
$valF['date_achevement']= $this->regle($row['regle_date_achevement']); |
542 |
|
} |
543 |
|
if(preg_match("/datecourrier/",$row['regle_date_conformite'])){ |
544 |
|
$valF['date_conformite']= $this->regle($row['regle_date_conformite']); |
545 |
|
} |
546 |
|
} // while |
547 |
|
if($valF!=array()){ |
548 |
|
$cle= " dossier = '".$this->valF['dossier']."'"; |
549 |
|
$res1= $db->autoExecute(DB_PREFIXE.'dossier',$valF,DB_AUTOQUERY_UPDATE,$cle); |
550 |
|
if (database::isError($res1)) |
551 |
|
die($res->getMessage()); |
552 |
|
if ($DEBUG == 1) |
553 |
|
echo "La requête de mise à jour est effectuée.<br>"; |
554 |
|
$this->msg=$this->msg."<br>"._('enregistrement')." ". |
555 |
|
$this->valF['dossier']." "._('table')." dossier [". |
556 |
|
$db->affectedRows()." "._('enregistrement'). |
557 |
|
" "._('mis_a_jour')."]" ; |
558 |
|
} |
559 |
|
} |
560 |
|
|
561 |
|
|
562 |
|
|
563 |
// trigger before delete |
// trigger before delete |
564 |
function triggersupprimer($id,&$db,$val,$DEBUG) { |
function triggersupprimer($id,&$db,$val,$DEBUG) { |
591 |
$valF['date_conformite']= $val['archive_date_conformite']; |
$valF['date_conformite']= $val['archive_date_conformite']; |
592 |
|
|
593 |
$cle= " dossier = '".$val['dossier']."'"; |
$cle= " dossier = '".$val['dossier']."'"; |
594 |
$res= $db->autoExecute('dossier',$valF,DB_AUTOQUERY_UPDATE,$cle); |
$res= $db->autoExecute(DB_PREFIXE.'dossier',$valF,DB_AUTOQUERY_UPDATE,$cle); |
595 |
if (database::isError($res)) |
if (database::isError($res)) |
596 |
die($res->getMessage()); |
die($res->getMessage()); |
597 |
else{ |
else{ |
651 |
} |
} |
652 |
|
|
653 |
}// fin classe |
}// fin classe |
|
?> |
|
654 |
|
?> |