34 |
&& $this->val[array_search("lu", $this->champs)]== "t") { |
&& $this->val[array_search("lu", $this->champs)]== "t") { |
35 |
unset($this->actions_sup["lu"]); |
unset($this->actions_sup["lu"]); |
36 |
} |
} |
37 |
|
|
38 |
|
//Si le document est déjà finalisé, on affiche uniquement le lien de |
39 |
|
//dé-finalisation |
40 |
|
if ( isset($this->actions_sup["finalisation"]) && |
41 |
|
isset($this->val[array_search("om_final_consultation", $this->champs)]) |
42 |
|
&& $this->val[array_search("om_final_consultation", $this->champs)]== "t" ){ |
43 |
|
|
44 |
|
//On cache le lien |
45 |
|
unset($this->actions_sup["finalisation"]); |
46 |
|
} |
47 |
|
//Si le document n'est pas finalisé, on affiche uniquement le lien de |
48 |
|
//finalisation |
49 |
|
if ( isset($this->actions_sup["definalisation"]) && |
50 |
|
isset($this->val[array_search("om_final_consultation", $this->champs)]) |
51 |
|
&& $this->val[array_search("om_final_consultation", $this->champs)]!= "t" ){ |
52 |
|
|
53 |
|
//On cache le lien |
54 |
|
unset($this->actions_sup["definalisation"]); |
55 |
|
} |
56 |
} |
} |
57 |
|
|
58 |
/** |
/** |
105 |
$sql .= " where dossier='".$this->val[array_search("dossier", $this->champs)]."'"; |
$sql .= " where dossier='".$this->val[array_search("dossier", $this->champs)]."'"; |
106 |
// |
// |
107 |
$division = $this->db->getOne($sql); |
$division = $this->db->getOne($sql); |
108 |
$this->addToLog("getDivisionFromDossier(): db->getone(\"".$sql."\")", VERBOSE_MODE); |
$this->f->addToLog("getDivisionFromDossier(): db->getone(\"".$sql."\")", VERBOSE_MODE); |
109 |
database::isError($division); |
if (database::isError($division)){ |
110 |
|
die(); |
111 |
|
} |
112 |
// |
// |
113 |
return $division; |
return $division; |
114 |
} elseif ($this->getParameter("maj") == 0 |
} elseif ($this->getParameter("maj") == 0 |
125 |
$sql .= " where dossier='".$this->getParameter("idxformulaire")."'"; |
$sql .= " where dossier='".$this->getParameter("idxformulaire")."'"; |
126 |
// |
// |
127 |
$division = $this->db->getOne($sql); |
$division = $this->db->getOne($sql); |
128 |
$this->addToLog("getDivisionFromDossier(): db->getone(\"".$sql."\")", VERBOSE_MODE); |
$this->f->addToLog("getDivisionFromDossier(): db->getone(\"".$sql."\")", VERBOSE_MODE); |
129 |
database::isError($division); |
if (database::isError($division)){ |
130 |
|
die(); |
131 |
|
} |
132 |
// |
// |
133 |
return $division; |
return $division; |
134 |
} else { |
} else { |
163 |
} |
} |
164 |
|
|
165 |
function setvalF($val) { |
function setvalF($val) { |
166 |
|
// |
167 |
parent::setValF($val); |
parent::setValF($val); |
168 |
if($this->getParameter('maj')==0) { |
// |
169 |
$this->valF["date_reception"]=$this->valF["date_envoi"]; |
if ($this->getParameter('maj') == 0) { |
170 |
|
// |
171 |
|
if (isset($this->valF["date_envoi"])) { |
172 |
|
$this->valF["date_reception"] = $this->valF["date_envoi"]; |
173 |
|
} |
174 |
|
// |
175 |
$this->valF["lu"] = true; |
$this->valF["lu"] = true; |
176 |
} |
} |
177 |
|
|
185 |
$this->valF["lu"]=false; |
$this->valF["lu"]=false; |
186 |
} |
} |
187 |
} |
} |
188 |
|
|
189 |
function verifier($val, &$db, $DEBUG) { |
function setLib(&$form, $maj) { |
190 |
parent::verifier($val, $db, $DEBUG); |
// |
191 |
// Si le fichier envoye est different de l'existant |
parent::setLib($form, $maj); |
192 |
if (isset($this->val[array_search("fichier",$this->champs)]) |
// |
193 |
&& $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)]; |
|
|
} |
|
|
} |
|
|
} |
|
194 |
} |
} |
195 |
|
|
196 |
function setType(&$form,$maj) { |
function setType(&$form,$maj) { |
197 |
// Appel du parent |
// Appel du parent |
198 |
parent::setType($form,$maj); |
parent::setType($form,$maj); |
270 |
$form->setType('lu', 'hidden'); |
$form->setType('lu', 'hidden'); |
271 |
|
|
272 |
} |
} |
273 |
|
|
274 |
|
} |
275 |
|
// Mode supprimer |
276 |
|
if ($maj == 2) { |
277 |
|
$form->setType('fichier', 'filestatic'); |
278 |
} |
} |
279 |
// MODE - CONSULTER |
// MODE - CONSULTER |
280 |
if ( $maj == 3 ) { |
if ( $maj == 3 ) { |
282 |
} |
} |
283 |
//// On cache la clé primaire |
//// On cache la clé primaire |
284 |
//$form->setType('consultation', 'hidden'); |
//$form->setType('consultation', 'hidden'); |
285 |
|
// |
286 |
|
if ($this->getParameter("retourformulaire") == "dossier" |
287 |
|
|| $this->getParameter("retourformulaire") == "dossier_instruction" |
288 |
|
|| $this->getParameter("retourformulaire") == "dossier_instruction_mes_encours" |
289 |
|
|| $this->getParameter("retourformulaire") == "dossier_instruction_tous_encours" |
290 |
|
|| $this->getParameter("retourformulaire") == "dossier_instruction_mes_clotures" |
291 |
|
|| $this->getParameter("retourformulaire") == "dossier_instruction_tous_clotures") { |
292 |
|
// |
293 |
|
$form->setType('dossier', 'hidden'); |
294 |
|
} |
295 |
|
|
296 |
|
$form->setType('code_barres', 'hidden'); |
297 |
|
|
298 |
|
//Cache les champs pour la finalisation |
299 |
|
$form->setType('om_fichier_consultation', 'hidden'); |
300 |
|
$form->setType('om_final_consultation', 'hidden'); |
301 |
} |
} |
302 |
|
|
303 |
// Cette méthode permet de calculer la date limite en fonction de la date |
// Cette méthode permet de calculer la date limite en fonction de la date |
325 |
function triggerajouter($id,&$db,$val,$DEBUG) { |
function triggerajouter($id,&$db,$val,$DEBUG) { |
326 |
// |
// |
327 |
$this->calculDateLimite(); |
$this->calculDateLimite(); |
328 |
|
|
329 |
|
// Identifiant du type de courrier |
330 |
|
$idTypeCourrier = '12'; |
331 |
|
$idCourrier = str_pad($this->valF["consultation"], 10, "0", STR_PAD_LEFT); |
332 |
|
// Code barres |
333 |
|
$this->valF["code_barres"] = $idTypeCourrier . $idCourrier; |
334 |
} |
} |
335 |
|
|
336 |
// |
// |
423 |
function getFromDB($sql) { |
function getFromDB($sql) { |
424 |
//$sql = "SELECT libelle FROM ".DB_PREFIXE."dossier WHERE dossier = '" . $dossier . "'"; |
//$sql = "SELECT libelle FROM ".DB_PREFIXE."dossier WHERE dossier = '" . $dossier . "'"; |
425 |
$res = $this->db->limitquery($sql, 0, 1); |
$res = $this->db->limitquery($sql, 0, 1); |
426 |
$this->addToLog("getDossierERPSpecification(): db->limitquery(\"". |
$this->f->addToLog("getDossierERPSpecification(): db->limitquery(\"". |
427 |
str_replace(",",", ",$sql)."\", 0, 1);", VERBOSE_MODE); |
str_replace(",",", ",$sql)."\", 0, 1);", VERBOSE_MODE); |
428 |
// Si une erreur survient on die |
// Si une erreur survient on die |
429 |
if (database::isError($res, true)) { |
if (database::isError($res, true)) { |
570 |
$idx, $maj, $retour); |
$idx, $maj, $retour); |
571 |
} |
} |
572 |
} |
} |
573 |
|
|
574 |
|
/** |
575 |
|
* Ajout des contraintes spécifiques pour l'ajout d'un fichier en retour de |
576 |
|
* consultation |
577 |
|
*/ |
578 |
|
function setSelect(&$form, $maj,&$db,$debug) { |
579 |
|
parent::setSelect($form, $maj,$db,$debug); |
580 |
|
|
581 |
|
//Seulement dans le cas d'un retour d'avis |
582 |
|
if($this->retourformulaire == "demande_avis_encours") { |
583 |
|
|
584 |
|
//Tableau des contraintes spécifiques |
585 |
|
$params = array( |
586 |
|
"constraint" => array( |
587 |
|
"size_max" => 2, |
588 |
|
"extension" => ".pdf" |
589 |
|
), |
590 |
|
"metadata" => array() |
591 |
|
); |
592 |
|
|
593 |
|
$form->setSelect("fichier", $params); |
594 |
|
} |
595 |
|
} |
596 |
}// fin classe |
}// fin classe |
597 |
?> |
?> |