117 |
// }}} |
// }}} |
118 |
|
|
119 |
function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire){ |
function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire){ |
120 |
|
// ajout du retourformulaire aux attributs de l'objet |
121 |
|
$this->retourformulaire = $retourformulaire; |
122 |
if ($validation==0) { |
if ($validation==0) { |
123 |
if ($maj == 0){ |
if ($maj == 0){ |
124 |
$form->setVal("dossier", $idxformulaire); |
$form->setVal("dossier", $idxformulaire); |
140 |
} |
} |
141 |
|
|
142 |
function setvalF($val) { |
function setvalF($val) { |
143 |
|
// |
144 |
parent::setValF($val); |
parent::setValF($val); |
145 |
if($this->getParameter('maj')==0) { |
// |
146 |
$this->valF["date_reception"]=$this->valF["date_envoi"]; |
if ($this->getParameter('maj') == 0) { |
147 |
|
// |
148 |
|
if (isset($this->valF["date_envoi"])) { |
149 |
|
$this->valF["date_reception"] = $this->valF["date_envoi"]; |
150 |
|
} |
151 |
|
// |
152 |
|
$this->valF["lu"] = true; |
153 |
} |
} |
154 |
|
|
155 |
// Si un retour d'avis est modifie on passe "lu" a false |
// Si un retour d'avis est modifie on passe "lu" a false |
162 |
$this->valF["lu"]=false; |
$this->valF["lu"]=false; |
163 |
} |
} |
164 |
} |
} |
165 |
|
|
166 |
function verifier($val, &$db, $DEBUG) { |
function setLib(&$form, $maj) { |
167 |
parent::verifier($val, $db, $DEBUG); |
// |
168 |
// Si le fichier envoye est different de l'existant |
parent::setLib($form, $maj); |
169 |
if (isset($this->val[array_search("fichier",$this->champs)]) |
// |
170 |
&& $this->val[array_search("fichier",$this->champs)] != $val["fichier"] |
$form->setLib($this->clePrimaire, _("id")); |
|
&& $this->valF['fichier']!="") { |
|
|
// Si le fichier existe dans tmp |
|
|
if(file_exists("../tmp/".$this->valF['fichier'])) { |
|
|
$contents=file_get_contents("../tmp/".$this->valF['fichier']); |
|
|
// On essaye de l'enregistrer |
|
|
$res = $this->f->storeDecisionFile($contents, $this->valF['fichier'], |
|
|
$this->valF['dossier'], |
|
|
'consultation_'.$this->valF['consultation']."_"); |
|
|
// Si l'enregistrement s'est bien deroule |
|
|
// on supprime le fichier dans tmp |
|
|
// on met a jour valF avec le nouveau nom du fichier |
|
|
if($res===true){ |
|
|
$this->addToMessage(_("Sauvegarde du fichier reussi")); |
|
|
unlink("../tmp/".$this->valF['fichier']); |
|
|
$this->valF['fichier']='consultation_'.$this->valF['consultation']."_".$this->valF['fichier']; |
|
|
// Sinon on supprime le fichier dans tmp |
|
|
// on reinitialise le nom du fichier a l'ancienne valeur |
|
|
} else { |
|
|
$this->correct = false; |
|
|
$this->addToMessage($res); |
|
|
unlink("../tmp/".$this->valF['fichier']); |
|
|
$this->valF['fichier']=$this->val[array_search("fichier",$this->champs)]; |
|
|
} |
|
|
} |
|
|
} |
|
171 |
} |
} |
172 |
|
|
173 |
function setType(&$form,$maj) { |
function setType(&$form,$maj) { |
174 |
// Appel du parent |
// Appel du parent |
175 |
parent::setType($form,$maj); |
parent::setType($form,$maj); |
217 |
} |
} |
218 |
|
|
219 |
// Gestion du type du widget sur le champ fichier |
// Gestion du type du widget sur le champ fichier |
220 |
if($this->val[array_search("fichier",$this->champs)]=="" OR |
if($this->getVal("fichier") == "" OR |
221 |
$this->f->isAccredited('consultation_modifier_fichier')) { |
$this->f->isAccredited('consultation_modifier_fichier')) { |
222 |
// Si il n'y a jamais eu de fichier enregistré ou que |
// Si il n'y a jamais eu de fichier enregistré ou que |
223 |
// l'utilisateur a spécifiquement les droits pour modifier |
// l'utilisateur a spécifiquement les droits pour modifier |
224 |
// un fichier déjà enregistré alors on positionne un type |
// un fichier déjà enregistré alors on positionne un type |
225 |
// de widget modifiable |
// de widget modifiable |
226 |
$form->setType('fichier', 'tmpUpload'); |
if($this->retourformulaire == "demande_avis_encours") { |
227 |
|
$form->setType('fichier', 'upload2'); |
228 |
|
} else { |
229 |
|
$form->setType('fichier', 'upload'); |
230 |
|
} |
231 |
} else { |
} else { |
232 |
// Si non on affiche uniquement le nom du fichier |
// Si non on affiche uniquement le nom du fichier |
233 |
$form->setType('fichier', 'tmpUploadStatic'); |
$form->setType('fichier', 'file'); |
234 |
} |
} |
235 |
|
|
236 |
// Modification layout : écran de retour d'avis permettant |
// Modification layout : écran de retour d'avis permettant |
251 |
} |
} |
252 |
// MODE - CONSULTER |
// MODE - CONSULTER |
253 |
if ( $maj == 3 ) { |
if ( $maj == 3 ) { |
254 |
$form->setType('fichier', 'tmpUploadStatic'); |
$form->setType('fichier', 'file'); |
255 |
} |
} |
256 |
//// On cache la clé primaire |
//// On cache la clé primaire |
257 |
//$form->setType('consultation', 'hidden'); |
//$form->setType('consultation', 'hidden'); |
258 |
|
// |
259 |
|
if ($this->getParameter("retourformulaire") == "dossier" |
260 |
|
|| $this->getParameter("retourformulaire") == "dossier_instruction" |
261 |
|
|| $this->getParameter("retourformulaire") == "dossier_instruction_mes_encours" |
262 |
|
|| $this->getParameter("retourformulaire") == "dossier_instruction_tous_encours" |
263 |
|
|| $this->getParameter("retourformulaire") == "dossier_instruction_mes_clotures" |
264 |
|
|| $this->getParameter("retourformulaire") == "dossier_instruction_tous_clotures") { |
265 |
|
// |
266 |
|
$form->setType('dossier', 'hidden'); |
267 |
|
} |
268 |
} |
} |
269 |
|
|
270 |
// TRIGGER AVANT MODIFICATION DE DONNEES |
// Cette méthode permet de calculer la date limite en fonction de la date |
271 |
// trigger before modification data |
// de réception et du délai de consultation du service consulté |
272 |
function triggerajouter($id,&$db,$val,$DEBUG) { |
function calculDateLimite() { |
273 |
// mise a jour instruction avec evenement [return delay] |
// mise a jour instruction avec evenement [return delay] |
274 |
if ($this->valF['date_envoi']!=""){ |
if ($this->valF["date_reception"] != "") { |
275 |
$sql= "select delai from ".DB_PREFIXE."service where service ='".$this->valF['service']."'"; |
// |
276 |
$delai = $db->getOne($sql); |
$sql = " select delai from ".DB_PREFIXE."service "; |
277 |
$this->valF['date_limite'] = $this->moisdate($this->valF['date_envoi'],$delai); |
$sql .= " where service='".$this->valF["service"]."' "; |
278 |
|
// |
279 |
|
$delai = $this->db->getOne($sql); |
280 |
|
$this->addToLog("triggerajouter(): db->getone(\"".$sql."\")", VERBOSE_MODE); |
281 |
|
// |
282 |
|
$this->valF["date_limite"] = $this->moisdate($this->valF["date_reception"], $delai); |
283 |
|
// |
284 |
$this->addToMessage(_("delai")." ". |
$this->addToMessage(_("delai")." ". |
285 |
_("retour")." ".$delai." "._("mois")." -> ". |
_("retour")." ".$delai." "._("mois")." -> ". |
286 |
_("retour")." ".date("d/m/Y", strtotime($this->valF['date_limite']))."<br>"); |
_("retour")." ".date("d/m/Y", strtotime($this->valF["date_limite"]))); |
|
$this->valF['lu'] = true; |
|
287 |
} |
} |
|
|
|
288 |
} |
} |
289 |
|
|
290 |
|
// TRIGGER AVANT MODIFICATION DE DONNEES |
291 |
|
// trigger before modification data |
292 |
|
function triggerajouter($id,&$db,$val,$DEBUG) { |
293 |
|
// |
294 |
|
$this->calculDateLimite(); |
295 |
|
} |
296 |
|
|
297 |
|
// |
298 |
|
function triggermodifier($id,&$db,$val,$DEBUG) { |
299 |
|
// |
300 |
|
$this->calculDateLimite(); |
301 |
|
} |
302 |
|
|
303 |
|
// |
304 |
function triggerajouterapres($id,&$db,$val,$DEBUG) { |
function triggerajouterapres($id,&$db,$val,$DEBUG) { |
305 |
|
|
306 |
// Verification de la demande de notif par mail |
// Verification de la demande de notif par mail |
495 |
|
|
496 |
if($this->getParameter("retour")=="form" AND !($this->getParameter("validation")>0 AND $this->getParameter("maj")==2 AND $this->correct)) { |
if($this->getParameter("retour")=="form" AND !($this->getParameter("validation")>0 AND $this->getParameter("maj")==2 AND $this->correct)) { |
497 |
echo "form.php?".$params; |
echo "form.php?".$params; |
498 |
} elseif($this->getParameter("retour")=="avis_code_barre") { |
} elseif($this->getParameter("retour")=="suivi_retours_de_consultation") { |
499 |
echo "../app/avis_code_barre.php"; |
echo "../app/suivi_retours_de_consultation.php"; |
500 |
} else { |
} else { |
501 |
echo "tab.php?".$params; |
echo "tab.php?".$params; |
502 |
} |
} |