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){ |
43 |
$this->correct=true; |
$this->correct=true; |
44 |
$this->msg="<br>"._('destruction_chronologique')." ok <br>"; |
$this->addToMessage(_('Destruction_chronologique')); |
45 |
}else{ |
}else{ |
46 |
$this->msg="<br>"._('destruction_evenement')." : ".$dernierevenement. |
$this->addToMessage(_('Destruction_evenement')." : ".$dernierevenement); |
47 |
"<br>"._('destruction_chronologique'); |
$this->addToMessage(_('Destruction_chronologique')); |
48 |
$this->correct=false; |
$this->correct=false; |
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 |
|
} elseif($maj==2){ |
92 |
|
$form->setType('dossier', 'hiddenstatic'); |
93 |
|
}else { |
94 |
|
$form->setType('destinataire', 'hidden'); |
95 |
|
$form->setType('dossier', 'static'); |
96 |
|
} |
97 |
$form->setType('complement3', 'hidden'); |
$form->setType('complement3', 'hidden'); |
98 |
|
$form->setType('bible_auto', 'hidden'); |
99 |
|
$form->setType('bible', 'hidden'); |
100 |
|
$form->setType('bible2', 'hidden'); |
101 |
$form->setType('bible3', 'hidden'); |
$form->setType('bible3', 'hidden'); |
102 |
$form->setType('complement4', 'hidden'); |
$form->setType('complement4', 'hidden'); |
103 |
$form->setType('bible4', 'hidden'); |
$form->setType('bible4', 'hidden'); |
123 |
$form->setType('bible14', 'hidden'); |
$form->setType('bible14', 'hidden'); |
124 |
$form->setType('complement15', 'hidden'); |
$form->setType('complement15', 'hidden'); |
125 |
$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'); |
|
126 |
$form->setType('delai', 'hidden'); |
$form->setType('delai', 'hidden'); |
127 |
$form->setType('etat', 'hidden'); |
$form->setType('etat', 'hidden'); |
128 |
$form->setType('accord_tacite', 'hidden'); |
$form->setType('accord_tacite', 'hidden'); |
141 |
$form->setType('archive_date_validite', 'hidden'); |
$form->setType('archive_date_validite', 'hidden'); |
142 |
$form->setType('archive_date_achevement', 'hidden'); |
$form->setType('archive_date_achevement', 'hidden'); |
143 |
$form->setType('archive_date_conformite', 'hidden'); |
$form->setType('archive_date_conformite', 'hidden'); |
144 |
$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'); |
|
|
} |
|
145 |
} |
} |
146 |
|
|
147 |
|
function setSelect(&$form, $maj,&$db,$DEBUG) { |
148 |
|
if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc.php")) |
149 |
|
include ("../sql/".$db->phptype."/".$this->table.".form.inc.php"); |
150 |
|
|
151 |
function setTaille(&$form,$maj){ |
// *** evenement *** |
152 |
$form->setTaille('complement', 120); |
$contenu=array(); |
153 |
$form->setTaille('complement2', 120); |
// etat du dossier |
154 |
$form->setTaille('datecourrier', 12); |
$sql="select etat from ".DB_PREFIXE."dossier where dossier ='". |
155 |
} |
$this->idxformulaire."'"; |
156 |
|
$etat_dossier = $db->getOne($sql); |
157 |
function setMax(&$form,$maj){ |
$nature_dossier= substr($this->idxformulaire,0,2); |
158 |
$form->setMax('complement',12 ); |
// recherche des evenement de transition |
159 |
$form->setMax('complement2',12 ); |
$sql= $sql_transition." where transition.etat ='".$etat_dossier."' and (evenement.nature ='". |
160 |
} |
$nature_dossier."' or (nature ='T' and nature !='CU')) order by evenement.action"; |
161 |
|
|
162 |
|
// *** attention en dur le CU |
163 |
|
|
164 |
|
|
165 |
//function setSelect(&$form, $maj,&$db,$DEBUG,$idxformulaire) { |
$res = $db->query($sql); |
166 |
function setSelect(&$form, $maj,&$db,$DEBUG) { |
if (database::isError($res)) |
167 |
if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc")) |
die($res->getMessage()); |
168 |
include ("../sql/".$db->phptype."/".$this->table.".form.inc"); |
$contenu[0][0]=""; |
169 |
if($maj<2){ |
$contenu[1][0]=_('choisir')." "._('evenement'); |
170 |
// *** evenement *** |
$k=1; |
171 |
$contenu=array(); |
while ($row=& $res->fetchRow()){ |
172 |
// etat du dossier |
if($maj==0){ // ajouter |
173 |
$sql="select etat from dossier where dossier ='". |
$contenu[0][$k]=$row[0]; |
174 |
$this->idxformulaire."'"; |
$contenu[1][$k]=$row[1]; |
175 |
$etat_dossier = $db->getOne($sql); |
$k++; |
176 |
$nature_dossier= substr($this->idxformulaire,0,2); |
}else{ |
177 |
// recherche des evenement de transition |
// select hiddenstatic |
178 |
$sql= $sql_transition." where transition.etat ='".$etat_dossier."' and (evenement.nature ='". |
$contenu[0][$k]=$row[0]; |
179 |
$nature_dossier."' or (nature ='T' and nature !='CU')) order by evenement.action"; |
$contenu[1][$k]=$row[1]; |
180 |
// *** attention en dur le CU |
$k++; |
181 |
|
} |
|
|
|
|
$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); |
|
182 |
} |
} |
183 |
|
$form->setSelect("evenement",$contenu); |
184 |
|
// lien bible_auto [link] |
185 |
|
$contenu=array(); |
186 |
|
$contenu[0]=" automatique "; |
187 |
|
$form->setSelect("bible_auto",$contenu); |
188 |
|
// lien bible1 |
189 |
|
$contenu=array(); |
190 |
|
$contenu[0]=" Bible "; |
191 |
|
$form->setSelect("bible",$contenu); |
192 |
|
// lien bible2 |
193 |
|
$contenu=array(); |
194 |
|
$contenu[0]=" Bible "; |
195 |
|
$form->setSelect("bible2",$contenu); |
196 |
} // function select |
} // function select |
197 |
|
|
198 |
function setGroupe(&$form,$maj){ |
function setGroupe(&$form,$maj){ |
207 |
$form->setRegroupe('libelle','G',''); |
$form->setRegroupe('libelle','G',''); |
208 |
$form->setRegroupe('datecourrier','G',''); |
$form->setRegroupe('datecourrier','G',''); |
209 |
$form->setRegroupe('lettretype','F',''); |
$form->setRegroupe('lettretype','F',''); |
210 |
$form->setRegroupe('complement','D',_('complement'), "startClosed"); |
$form->setRegroupe('complement','D',_('complement'), "collapsible"); |
211 |
$form->setRegroupe('bible_auto','G',''); |
$form->setRegroupe('bible_auto','G',''); |
212 |
$form->setRegroupe('bible','F',''); |
$form->setRegroupe('bible','F',''); |
213 |
$form->setRegroupe('complement2','D',_('complement2'), "startClosed"); |
$form->setRegroupe('complement2','D',_('complement2'), "startClosed"); |
224 |
$form->setLib('datecourrier',_(" du ")); |
$form->setLib('datecourrier',_(" du ")); |
225 |
} |
} |
226 |
|
|
|
function setOnchange(&$form,$maj){ |
|
|
$form->setOnchange("datecourrier","fdate(this)"); |
|
|
} |
|
|
|
|
227 |
// ================================================================== |
// ================================================================== |
228 |
// trigger avant modification données [trigger before modify data] |
// trigger avant modification données [trigger before modify data] |
229 |
// ================================================================== |
// ================================================================== |
230 |
function triggerajouter($id,&$db,$val,$DEBUG) { |
function triggerajouter($id,&$db,$val,$DEBUG) { |
231 |
// mise a jour instruction avec evenement |
// mise a jour instruction avec evenement |
232 |
// [modify instruction with evenement] |
// [modify instruction with evenement] |
233 |
$sql= "select * from evenement where evenement =".$this->valF['evenement']; |
$sql= "select * from ".DB_PREFIXE."evenement where evenement =".$this->valF['evenement']; |
234 |
$res = $db->query($sql); |
$res = $db->query($sql); |
235 |
if (database::isError($res)) |
if (database::isError($res)) die($res->getMessage()); |
|
die($res->getMessage()); |
|
236 |
if ($DEBUG == 1) |
if ($DEBUG == 1) |
237 |
echo " la requete ".$sql." est exécutée<br>"; |
echo " la requete ".$sql." est exécutée<br>"; |
238 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
239 |
$this->valF['action']=$row['action']; |
if(isset($row['action']) and !empty($row['action'])) { |
240 |
|
$this->valF['action']=$row['action']; |
241 |
|
} else { |
242 |
|
$this->valF['action']=NULL; |
243 |
|
} |
244 |
$this->valF['delai']=$row['delai']; |
$this->valF['delai']=$row['delai']; |
245 |
$this->valF['etat']=$row['etat']; |
if(isset($row['etat']) and !empty($row['etat'])) { |
246 |
|
$this->valF['etat']=$row['etat']; |
247 |
|
} else { |
248 |
|
$this->valF['etat']=NULL; |
249 |
|
} |
250 |
$this->valF['accord_tacite']=$row['accord_tacite']; |
$this->valF['accord_tacite']=$row['accord_tacite']; |
251 |
$this->valF['delai_notification']=$row['delai_notification']; |
$this->valF['delai_notification']=$row['delai_notification']; |
252 |
$this->valF['avis']=$row['avis']; |
if(isset($row['avis']) and !empty($row['avis'])) { |
253 |
|
$this->valF['avis']=$row['avis']; |
254 |
|
} else { |
255 |
|
$this->valF['avis']=NULL; |
256 |
|
} |
257 |
if($row['lettretype']!="") |
if($row['lettretype']!="") |
258 |
$this->valF['lettretype']=$row['lettretype']; |
$this->valF['lettretype']=$row['lettretype']; |
259 |
else |
else |
260 |
$this->valF['lettretype']="standard"; |
$this->valF['lettretype']="standard"; |
261 |
} |
} |
262 |
$sql= "select * from dossier where dossier = '".$this->valF['dossier']."'"; |
$sql= "select * from ".DB_PREFIXE."dossier where dossier = '".$this->valF['dossier']."'"; |
263 |
$res = $db->query($sql); |
$res = $db->query($sql); |
264 |
if (database::isError($res)) |
if (database::isError($res)) |
265 |
die($res->getMessage()); |
die($res->getMessage()); |
297 |
|
|
298 |
function regle($regle){ |
function regle($regle){ |
299 |
$temp = explode ("+",$regle); |
$temp = explode ("+",$regle); |
300 |
echo '/'.$regle.sizeof($temp); |
//echo '|'.$regle; |
301 |
if(sizeof($temp)==1) |
// cas rejet |
302 |
if($temp[0]=="archive_date_depot") |
if($regle=="null") // 1 dimension -> null |
303 |
|
return null; |
304 |
|
if(sizeof($temp)==1) // 1 dimension |
305 |
|
if($temp[0]=="archive_date_depot") // initialisation avec le depot |
306 |
return $this->$regle; |
return $this->$regle; |
307 |
else |
else // cas general |
308 |
return $this->valF[$regle]; |
return $this->valF[$regle]; |
309 |
else{ |
if(sizeof($temp)==2){ // 2 dimensions |
310 |
if($temp[0]=="archive_date_depot") |
if($temp[0]=="archive_date_depot") //initialisation avec le depot |
311 |
if(is_numeric($temp[1])) |
if(is_numeric($temp[1])) |
312 |
return $this->moisdate($this->$temp[0], $temp[1]); |
return $this->moisdate($this->$temp[0], $temp[1]); |
313 |
else |
else |
314 |
return $this->moisdate($this->$temp[0], $this->valF[$temp[1]]); |
return $this->moisdate($this->$temp[0], $this->valF[$temp[1]]); |
315 |
|
if($temp[0]=="archive_delai") // majoration de delai |
316 |
|
return $this->valF[$temp[0]]+$this->valF[$temp[1]]; |
317 |
|
// cas general 2 dimensions |
318 |
if(is_numeric($temp[1])) |
if(is_numeric($temp[1])) |
319 |
return $this->moisdate($this->valF[$temp[0]], $temp[1]); |
return $this->moisdate($this->valF[$temp[0]], $temp[1]); |
320 |
else |
else |
321 |
return $this->moisdate($this->valF[$temp[0]], $this->valF[$temp[1]]); |
return $this->moisdate($this->valF[$temp[0]], $this->valF[$temp[1]]); |
322 |
} |
} |
323 |
|
if(sizeof($temp)==3){ // 3 dimensions |
324 |
|
// cas date de validite de sursis |
325 |
|
if(is_numeric($temp[1])) |
326 |
|
$temp1 = $this->moisdate($this->valF[$temp[0]], $temp[1]); |
327 |
|
else |
328 |
|
$temp1 = $this->moisdate($this->valF[$temp[0]], $this->valF[$temp[1]]); |
329 |
|
if(is_numeric($temp[2])) |
330 |
|
return $this->moisdate($temp1, $temp[2]); |
331 |
|
else |
332 |
|
return $this->moisdate($temp1, $this->valF[$temp[2]]); |
333 |
|
} |
334 |
} |
} |
335 |
|
|
336 |
|
|
343 |
// voir parametrage CU en dur |
// voir parametrage CU en dur |
344 |
// voir parametrage des actions en dur |
// voir parametrage des actions en dur |
345 |
$param=1; |
$param=1; |
|
|
|
346 |
if($param==1){ |
if($param==1){ |
347 |
$sql="select * from action where action = '".$this->valF['action']."'"; |
$sql="select * from ".DB_PREFIXE."action where action = '".$this->valF['action']."'"; |
348 |
$res = $db->query($sql); |
$res = $db->query($sql); |
349 |
if (database::isError($res)) |
if (database::isError($res)) |
350 |
die($res->getMessage()); |
die($res->getMessage()); |
358 |
if($row['regle_accord_tacite']!=''){ |
if($row['regle_accord_tacite']!=''){ |
359 |
$valF['accord_tacite']= $this->regle($row['regle_accord_tacite']); |
$valF['accord_tacite']= $this->regle($row['regle_accord_tacite']); |
360 |
} |
} |
361 |
|
if($row['regle_avis']!=''){ |
362 |
|
$valF['avis']= $this->regle($row['regle_avis']); |
363 |
|
} |
364 |
if($row['regle_date_limite']!=''){ |
if($row['regle_date_limite']!=''){ |
365 |
$valF['date_limite']= $this->regle($row['regle_date_limite']); |
$valF['date_limite']= $this->regle($row['regle_date_limite']); |
366 |
} |
} |
370 |
if($row['regle_date_notification_delai']!=''){ |
if($row['regle_date_notification_delai']!=''){ |
371 |
$valF['date_notification_delai']= $this->regle($row['regle_date_notification_delai']); |
$valF['date_notification_delai']= $this->regle($row['regle_date_notification_delai']); |
372 |
} |
} |
373 |
|
if($row['regle_date_decision']!=''){ |
374 |
|
$valF['date_decision']= $this->regle($row['regle_date_decision']); |
375 |
|
} |
376 |
|
if($row['regle_date_rejet']!=''){ |
377 |
|
$valF['date_rejet']= $this->regle($row['regle_date_rejet']); |
378 |
|
} |
379 |
|
if($row['regle_date_validite']!=''){ |
380 |
|
$valF['date_validite']= $this->regle($row['regle_date_validite']); |
381 |
|
} |
382 |
|
if($row['regle_date_chantier']!=''){ |
383 |
|
$valF['date_chantier']= $this->regle($row['regle_date_chantier']); |
384 |
|
} |
385 |
|
if($row['regle_date_achevement']!=''){ |
386 |
|
$valF['date_achevement']= $this->regle($row['regle_date_achevement']); |
387 |
|
} |
388 |
|
if($row['regle_date_conformite']!=''){ |
389 |
|
$valF['date_conformite']= $this->regle($row['regle_date_conformite']); |
390 |
|
} |
391 |
} |
} |
392 |
}else{ |
}else{ |
393 |
|
switch ($this->valF['action']) { |
394 |
switch ($this->valF['action']) { |
case "initialisation" : |
395 |
case "initialisation" : |
$valF['delai']= $this->valF['delai']; |
396 |
$valF['delai']= $this->valF['delai']; |
$valF['etat']= $this->valF['etat']; |
397 |
$valF['etat']= $this->valF['etat']; |
$valF['accord_tacite']= $this->valF['accord_tacite']; |
398 |
$valF['accord_tacite']= $this->valF['accord_tacite']; |
// la date_complet est la date de depot |
399 |
// la date_complet est la date de depot |
$valF['date_complet']= $this->archive_date_depot; // **** |
400 |
$valF['date_complet']= $this->archive_date_depot; // **** |
$valF['date_limite'] = $this->moisdate($valF['date_complet'],$valF['delai']); |
401 |
$valF['date_limite'] = $this->moisdate($valF['date_complet'],$valF['delai']); |
$valF['date_notification_delai'] = $this->moisdate($valF['date_complet'],1); |
402 |
$valF['date_notification_delai'] = $this->moisdate($valF['date_complet'],1); |
break; |
403 |
break; |
case "notification" : |
404 |
case "notification" : |
$valF['delai']= $this->valF['delai']; |
405 |
$valF['delai']= $this->valF['delai']; |
$valF['etat']= $this->valF['etat']; |
406 |
$valF['etat']= $this->valF['etat']; |
$valF['accord_tacite']= $this->valF['accord_tacite']; |
407 |
$valF['accord_tacite']= $this->valF['accord_tacite']; |
// la date_complet est celle precedemment saisie |
408 |
// la date_complet est celle precedemment saisie |
$valF['date_complet']=$this->valF['archive_date_complet']; |
409 |
$valF['date_complet']=$this->valF['archive_date_complet']; |
$valF['date_limite'] = $this->moisdate($valF['date_complet'],$valF['delai']); |
410 |
$valF['date_limite'] = $this->moisdate($valF['date_complet'],$valF['delai']); |
$valF['date_notification_delai'] = $this->moisdate($valF['date_complet'],1); |
411 |
$valF['date_notification_delai'] = $this->moisdate($valF['date_complet'],1); |
// la date du courrier ne doit pas etre depasse par rapport au delai de |
412 |
// la date du courrier ne doit pas etre depasse par rapport au delai de |
// notification [verify notification date] |
413 |
// notification [verify notification date] |
if($this->valF['archive_date_notification_delai']<$this->valF['datecourrier']) |
414 |
if($this->valF['archive_date_notification_delai']<$this->valF['datecourrier']) |
$this->msg=$this->msg."<br><img src='../img/erreur.gif'> "._("date_notification_delai")." ". |
415 |
$this->msg=$this->msg."<br><img src='../img/erreur.gif'> "._("date_notification_delai")." ". |
$this->valF['archive_date_notification_delai']." < "._('datecourrier'); |
416 |
|
// |
417 |
|
break; |
418 |
|
case "retour" : |
419 |
|
$valF['delai']= $this->valF['delai']; |
420 |
|
$valF['etat']= $this->valF['etat']; |
421 |
|
$valF['accord_tacite']= $this->valF['accord_tacite']; |
422 |
|
// la date_complet est celle de l evenement |
423 |
|
$valF['date_complet']= $this->valF['datecourrier']; |
424 |
|
$valF['date_limite'] = $this->moisdate($valF['date_complet'],$valF['delai']); |
425 |
|
$valF['date_notification_delai'] = $this->moisdate($valF['date_complet'],1); |
426 |
|
break; |
427 |
|
case "rejet" : |
428 |
|
//$valF['delai']=0; // *** delai a garder pour etat dpc |
429 |
|
$valF['etat']= $this->valF['etat']; |
430 |
|
$valF['accord_tacite']= $this->valF['accord_tacite']; |
431 |
|
// la date rejet est initialisee |
432 |
|
$valF['date_rejet']= $this->valF['datecourrier']; |
433 |
|
// les dates de depart et fin d instruction sont annulées |
434 |
|
$valF['date_limite'] =null; |
435 |
|
$valF['date_notification_delai'] =null; |
436 |
|
$valF['date_complet']=null; |
437 |
|
break; |
438 |
|
case "majoration" : |
439 |
|
$valF['delai']= $this->valF['archive_delai']+$this->valF['delai']; |
440 |
|
$valF['etat']= $this->valF['etat']; |
441 |
|
$valF['accord_tacite']= $this->valF['accord_tacite']; |
442 |
|
$valF['date_complet']=$this->valF['archive_date_complet']; |
443 |
|
// majoration de la date limite |
444 |
|
$valF['date_limite'] = $this->moisdate($valF['date_complet'],$valF['delai']); |
445 |
|
$valF['date_notification_delai'] = $this->moisdate($valF['date_complet'],1); |
446 |
|
// la date du courrier ne doit pas etre depasse par rapport au delai de |
447 |
|
// notification |
448 |
|
if($this->valF['archive_date_notification_delai']<$this->valF['datecourrier']) |
449 |
|
$this->msg=$this->msg."<br><img src='../img/erreur.gif'>"._("date_notification_delai"). |
450 |
$this->valF['archive_date_notification_delai']." < "._('datecourrier'); |
$this->valF['archive_date_notification_delai']." < "._('datecourrier'); |
451 |
// |
break; |
452 |
break; |
case "acceptation" : |
453 |
case "retour" : |
$valF['etat']= $this->valF['etat']; |
454 |
$valF['delai']= $this->valF['delai']; |
$valF['date_decision']= $this->valF['datecourrier']; |
455 |
$valF['etat']= $this->valF['etat']; |
$valF['avis']= $this->valF['avis']; |
456 |
$valF['accord_tacite']= $this->valF['accord_tacite']; |
// date de validite = date de l evenement + delai |
457 |
// la date_complet est celle de l evenement |
$valF['date_validite'] = $this->moisdate($this->valF['datecourrier'],$this->valF['delai']); |
458 |
$valF['date_complet']= $this->valF['datecourrier']; |
break; |
459 |
$valF['date_limite'] = $this->moisdate($valF['date_complet'],$valF['delai']); |
case "refus" : |
460 |
$valF['date_notification_delai'] = $this->moisdate($valF['date_complet'],1); |
$valF['etat']= $this->valF['etat']; |
461 |
break; |
$valF['date_decision']= $this->valF['datecourrier']; |
462 |
case "rejet" : |
$valF['avis']= $this->valF['avis']; |
463 |
//$valF['delai']=0; // *** delai a garder pour etat dpc |
break; |
464 |
$valF['etat']= $this->valF['etat']; |
case "prolongation" : |
465 |
$valF['accord_tacite']= $this->valF['accord_tacite']; |
$valF['date_validite'] = $this->moisdate($this->valF['archive_date_validite'],$this->valF['delai']); |
466 |
// la date rejet est initialisee |
break; |
467 |
$valF['date_rejet']= $this->valF['datecourrier']; |
case "sursis" : |
468 |
// les dates de depart et fin d instruction sont annulées |
$valF['date_limite'] = $this->moisdate($this->valF['datecourrier'],$this->valF['delai']); |
469 |
$valF['date_limite'] =null; |
$valF['etat']= $this->valF['etat']; |
470 |
$valF['date_notification_delai'] =null; |
$valF['accord_tacite']= $this->valF['accord_tacite']; |
471 |
$valF['date_complet']=null; |
$valF['avis']= $this->valF['avis']; |
472 |
break; |
$valF['date_decision']= $this->valF['datecourrier']; |
473 |
case "majoration" : |
$temp = $valF['date_limite']; |
474 |
$valF['delai']= $this->valF['archive_delai']+$this->valF['delai']; |
$valF['date_validite']= $this->moisdate($temp,2); |
475 |
$valF['etat']= $this->valF['etat']; |
break; |
476 |
$valF['accord_tacite']= $this->valF['accord_tacite']; |
case "execution" : |
477 |
$valF['date_complet']=$this->valF['archive_date_complet']; |
$valF['etat']= $this->valF['etat']; |
478 |
// majoration de la date limite |
$valF['date_chantier'] = $this->valF['datecourrier']; |
479 |
$valF['date_limite'] = $this->moisdate($valF['date_complet'],$valF['delai']); |
//echo $this->msg=$this->msg.$valF['date_chantier'].""; |
480 |
$valF['date_notification_delai'] = $this->moisdate($valF['date_complet'],1); |
break; |
481 |
// la date du courrier ne doit pas etre depasse par rapport au delai de |
case "achevement" : |
482 |
// notification |
$valF['etat']= $this->valF['etat']; |
483 |
if($this->valF['archive_date_notification_delai']<$this->valF['datecourrier']) |
$valF['date_achevement'] = $this->valF['datecourrier']; |
484 |
$this->msg=$this->msg."<br><img src='../img/erreur.gif'>"._("date_notification_delai"). |
break; |
485 |
$this->valF['archive_date_notification_delai']." < "._('datecourrier'); |
case "archivage" : |
486 |
break; |
$valF['etat']= $this->valF['etat']; |
487 |
case "acceptation" : |
$valF['date_conformite'] = $this->valF['datecourrier']; |
488 |
$valF['etat']= $this->valF['etat']; |
break; |
489 |
$valF['date_decision']= $this->valF['datecourrier']; |
|
490 |
$valF['avis']= $this->valF['avis']; |
default: |
491 |
// date de validite = date de l evenement + delai |
if ($this->valF['etat']!="") |
492 |
$valF['date_validite'] = $this->moisdate($this->valF['datecourrier'],$this->valF['delai']); |
$valF['etat']= $this->valF['etat']; |
493 |
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 |
|
494 |
} // end param |
} // end param |
|
// mise à jour dossier [modify dossier] |
|
|
print_r($valF); |
|
495 |
if($valF!=""){ |
if($valF!=""){ |
496 |
$cle= " dossier = '".$this->valF['dossier']."'"; |
$cle= " dossier = '".$this->valF['dossier']."'"; |
497 |
$res1= $db->autoExecute('dossier',$valF,DB_AUTOQUERY_UPDATE,$cle); |
$res1= $db->autoExecute(DB_PREFIXE.'dossier',$valF,DB_AUTOQUERY_UPDATE,$cle); |
498 |
if (database::isError($res1)) |
if (database::isError($res1)) |
499 |
die($res->getMessage()); |
die($res->getMessage()); |
500 |
if ($DEBUG == 1) |
if ($DEBUG == 1) |
505 |
" "._('mis_a_jour')."]" ; |
" "._('mis_a_jour')."]" ; |
506 |
} |
} |
507 |
} |
} |
508 |
|
|
509 |
|
function triggermodifierapres($id,&$db,$val,$DEBUG) { |
510 |
|
/* |
511 |
|
* cette fonction apour objet de permettre de modifier la date courrier |
512 |
|
*/ |
513 |
|
$valF=array(); |
514 |
|
$sql= "select action from ".DB_PREFIXE."evenement where evenement =".$this->valF['evenement']; |
515 |
|
$action = $db->getOne($sql); |
516 |
|
if (database::isError($action)) die($action->getMessage().$sql); |
517 |
|
$sql="select * from ".DB_PREFIXE."action where action = '".$action."'"; |
518 |
|
$res = $db->query($sql); |
519 |
|
if (database::isError($res)) die($res->getMessage().$sql); |
520 |
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
521 |
|
// application des regles sur le courrier + delai |
522 |
|
if(preg_match("/datecourrier/",$row['regle_date_limite'])){ |
523 |
|
$valF['date_limite']= $this->regle($row['regle_date_limite']); |
524 |
|
} |
525 |
|
if(preg_match("/datecourrier/",$row['regle_date_complet'])){ |
526 |
|
$valF['date_complet']= $this->regle($row['regle_date_complet']); |
527 |
|
} |
528 |
|
if(preg_match("/datecourrier/",$row['regle_date_notification_delai'])){ |
529 |
|
$valF['date_notification_delai']= $this->regle($row['regle_date_notification_delai']); |
530 |
|
} |
531 |
|
if(preg_match("/datecourrier/",$row['regle_date_decision'])){ |
532 |
|
$valF['date_decision']= $this->regle($row['regle_date_decision']); |
533 |
|
} |
534 |
|
if(preg_match("/datecourrier/",$row['regle_date_rejet'])){ |
535 |
|
$valF['date_rejet']= $this->regle($row['regle_date_rejet']); |
536 |
|
} |
537 |
|
if(preg_match("/datecourrier/",$row['regle_date_validite'])){ |
538 |
|
$valF['date_validite']= $this->regle($row['regle_date_validite']); |
539 |
|
} |
540 |
|
if(preg_match("/datecourrier/",$row['regle_date_chantier'])){ |
541 |
|
$valF['date_chantier']= $this->regle($row['regle_date_chantier']); |
542 |
|
} |
543 |
|
if(preg_match("/datecourrier/",$row['regle_date_achevement'])){ |
544 |
|
$valF['date_achevement']= $this->regle($row['regle_date_achevement']); |
545 |
|
} |
546 |
|
if(preg_match("/datecourrier/",$row['regle_date_conformite'])){ |
547 |
|
$valF['date_conformite']= $this->regle($row['regle_date_conformite']); |
548 |
|
} |
549 |
|
} // while |
550 |
|
if($valF!=array()){ |
551 |
|
$cle= " dossier = '".$this->valF['dossier']."'"; |
552 |
|
$res1= $db->autoExecute(DB_PREFIXE.'dossier',$valF,DB_AUTOQUERY_UPDATE,$cle); |
553 |
|
if (database::isError($res1)) |
554 |
|
die($res->getMessage()); |
555 |
|
if ($DEBUG == 1) |
556 |
|
echo "La requête de mise à jour est effectuée.<br>"; |
557 |
|
$this->msg=$this->msg."<br>"._('enregistrement')." ". |
558 |
|
$this->valF['dossier']." "._('table')." dossier [". |
559 |
|
$db->affectedRows()." "._('enregistrement'). |
560 |
|
" "._('mis_a_jour')."]" ; |
561 |
|
} |
562 |
|
} |
563 |
|
|
564 |
|
|
565 |
|
|
566 |
// trigger before delete |
// trigger before delete |
567 |
function triggersupprimer($id,&$db,$val,$DEBUG) { |
function triggersupprimer($id,&$db,$val,$DEBUG) { |
594 |
$valF['date_conformite']= $val['archive_date_conformite']; |
$valF['date_conformite']= $val['archive_date_conformite']; |
595 |
|
|
596 |
$cle= " dossier = '".$val['dossier']."'"; |
$cle= " dossier = '".$val['dossier']."'"; |
597 |
$res= $db->autoExecute('dossier',$valF,DB_AUTOQUERY_UPDATE,$cle); |
$res= $db->autoExecute(DB_PREFIXE.'dossier',$valF,DB_AUTOQUERY_UPDATE,$cle); |
598 |
if (database::isError($res)) |
if (database::isError($res)) |
599 |
die($res->getMessage()); |
die($res->getMessage()); |
600 |
else{ |
else{ |
654 |
} |
} |
655 |
|
|
656 |
}// fin classe |
}// fin classe |
|
?> |
|
657 |
|
?> |