4 |
require_once ("../gen/obj/consultation.class.php"); |
require_once ("../gen/obj/consultation.class.php"); |
5 |
|
|
6 |
class consultation extends consultation_gen { |
class consultation extends consultation_gen { |
7 |
|
var $maj; |
8 |
function consultation($id,&$db,$debug) { |
function consultation($id,&$db,$debug) { |
9 |
$this->constructeur($id,$db,$debug); |
$this->constructeur($id,$db,$debug); |
10 |
}// fin constructeur |
}// fin constructeur |
12 |
function setValFAjout($val){ |
function setValFAjout($val){ |
13 |
$this->valF['service'] = $val['service']; |
$this->valF['service'] = $val['service']; |
14 |
} |
} |
15 |
|
function setvalF($val){ |
16 |
|
parent::setvalF($val); |
17 |
function verifierAjout(){ |
// cles secondaires numerique (contrainte integrite pgsql) |
18 |
$this->correct=True; |
if($val['avis_consultation']=='') $this->valF['avis_consultation']= null; |
|
$imgv=""; |
|
|
$f=" ! "; |
|
|
$imgv="<img src='../img/punaise.png' style='vertical-align:middle' hspace='2' border='0'>"; |
|
|
if ($this->valF['service']==""){ |
|
|
$this->correct=false; |
|
|
$this->msg= $this->msg.$imgv." "._("service")." ". |
|
|
_("obligatoire").$f; |
|
|
} |
|
|
} |
|
|
|
|
|
function verifier(){ |
|
|
$this->correct=True; |
|
|
$imgv=""; |
|
|
$f=" ! "; |
|
|
$imgv="<img src='../img/punaise.png' style='vertical-align:middle' hspace='2' border='0'>"; |
|
|
if ($this->valF['dossier']==""){ |
|
|
$this->correct=false; |
|
|
$this->msg= $this->msg.$imgv." "._("dossier")." ". |
|
|
_("obligatoire").$f; |
|
|
} |
|
|
if ($this->valF['date_envoi']==""){ |
|
|
$this->correct=false; |
|
|
$this->msg= $this->msg.$imgv." "._("date_envoi")." ". |
|
|
_("obligatoire").$f; |
|
|
} |
|
19 |
} |
} |
|
|
|
20 |
function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire){ |
function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire){ |
21 |
if ($validation==0) { |
if ($validation==0) { |
22 |
if ($maj == 0){ |
if ($maj == 0){ |
23 |
$form->setVal("dossier", $idxformulaire); |
$form->setVal("dossier", $idxformulaire); |
24 |
|
$form->setVal("date_envoi",date('d/m/Y')); |
25 |
} |
} |
26 |
|
else |
27 |
|
if ( $maj == 1 ) |
28 |
|
$form->setVal("date_retour",date('d/m/Y')); |
29 |
} |
} |
30 |
} |
} |
31 |
|
|
32 |
function setType(&$form,$maj) { |
function setType(&$form,$maj) { |
33 |
|
parent::setType($form,$maj); |
34 |
if ($maj < 2) { //ajouter et modifier [add and modify] |
if ($maj < 2) { //ajouter et modifier [add and modify] |
35 |
if($maj==0){ // add |
if($maj==0){ // add |
36 |
$form->setType('date_envoi', 'date2'); |
$form->setType('date_envoi', 'date2'); |
37 |
$form->setType('service', 'select'); |
$form->setType('service', 'select'); |
38 |
$form->setType('date_limite', 'hidden'); |
$form->setType('date_limite', 'hidden'); |
39 |
$form->setType('date_retour', 'hidden'); |
$form->setType('date_retour', 'hidden'); |
40 |
$form->setType('avis', 'hidden'); |
$form->setType('avis_consultation', 'hidden'); |
41 |
|
$form->setType('motivation', 'hidden'); |
42 |
|
$form->setType('fichier', 'hidden'); |
43 |
|
$form->setType('lu', 'hidden'); |
44 |
|
$form->setType('date_reception', 'hidden'); |
45 |
}else{ // modify |
}else{ // modify |
46 |
$form->setType('date_envoi', 'hiddenstaticdate'); |
$form->setType('date_envoi', 'hiddenstaticdate'); |
47 |
|
$form->setType('date_limite', 'hiddenstaticdate'); |
48 |
$form->setType('service', 'selectdisabled'); |
$form->setType('service', 'selectdisabled'); |
|
$form->setType('date_limite', 'date2'); |
|
49 |
$form->setType('date_retour', 'date2'); |
$form->setType('date_retour', 'date2'); |
50 |
$form->setType('avis', 'select'); |
$form->setType('avis_consultation', 'select'); |
51 |
|
$form->setType('motivation', 'textarea'); |
52 |
|
$form->setType('fichier', 'upload'); |
53 |
} |
} |
54 |
$form->setType('consultation', 'hiddenstatic'); |
$form->setType('consultation', 'hiddenstatic'); |
55 |
$form->setType('dossier', 'hiddenstatic'); |
$form->setType('dossier', 'hiddenstatic'); |
|
}else{ // supprimer |
|
|
$form->setType('consultation', 'hiddenstatic'); |
|
|
$form->setType('dossier', 'hiddenstatic'); |
|
56 |
} |
} |
57 |
|
else { |
58 |
|
$form->setType('date_limite', 'hidden'); |
59 |
|
$form->setType('date_retour', 'hidden'); |
60 |
|
$form->setType('avis_consultation', 'hidden'); |
61 |
|
$form->setType('motivation', 'hidden'); |
62 |
|
$form->setType('fichier', 'hidden'); |
63 |
|
$form->setType('lu', 'hidden'); |
64 |
|
$form->setType('date_reception', 'hidden'); |
65 |
|
} |
66 |
} |
} |
67 |
|
|
|
function setTaille(&$form,$maj){ |
|
|
$form->setTaille('consultation', 8); |
|
|
$form->setTaille('dossier', 12); |
|
|
$form->setTaille('service', 5); |
|
|
$form->setTaille('date_envoi', 12); |
|
|
$form->setTaille('date_retour', 12); |
|
|
$form->setTaille('avis', 2); |
|
|
$form->setTaille('date_limite', 12); |
|
|
} |
|
|
|
|
|
function setMax(&$form,$maj){ |
|
|
$form->setMax('consultation', 8); |
|
|
$form->setMax('dossier', 12); |
|
|
$form->setMax('service', 5); |
|
|
$form->setMax('date_envoi', 12); |
|
|
$form->setMax('date_retour', 12); |
|
|
$form->setMax('avis', 2); |
|
|
$form->setMax('date_limite', 12); |
|
|
} |
|
|
|
|
|
|
|
68 |
// TRIGGER AVANT MODIFICATION DE DONNEES |
// TRIGGER AVANT MODIFICATION DE DONNEES |
69 |
// trigger before modification data |
// trigger before modification data |
70 |
function triggerajouter($id,&$db,$val,$DEBUG) { |
function triggerajouter($id,&$db,$val,$DEBUG) { |
71 |
// mise a jour instruction avec evenement [return delay] |
// mise a jour instruction avec evenement [return delay] |
72 |
$sql= "select delai from service where service ='".$this->valF['service']."'"; |
if (!$this->valF['date_envoi']==""){ |
73 |
$delai = $db->getOne($sql); |
$sql= "select delai from ".DB_PREFIXE."service where service ='".$this->valF['service']."'"; |
74 |
$this->valF['date_limite'] = $this->moisdate($this->valF['date_envoi'],$delai); |
$delai = $db->getOne($sql); |
75 |
$this->msg=$this->msg."<br>"._("delai")." ". |
$this->valF['date_limite'] = $this->moisdate($this->valF['date_envoi'],$delai); |
76 |
_("retour")." ".$delai." "._("mois")." -> ". |
$this->msg=$this->msg."<br>"._("delai")." ". |
77 |
_("retour")." ".$this->valF['date_limite']."<br>"; |
_("retour")." ".$delai." "._("mois")." -> ". |
78 |
|
_("retour")." ".$this->valF['date_limite']."<br>"; |
79 |
|
$this->valF['lu'] = true; |
80 |
|
|
81 |
|
/*require("../php/phpmailer/class.phpmailer.php"); |
82 |
|
|
83 |
|
$mail = new PHPMailer(); |
84 |
|
|
85 |
|
$mail->IsSMTP(); // set mailer to use SMTP |
86 |
|
$mail->Host = "smtp.gmail.com"; // specify main and backup server |
87 |
|
$mail->SMTPAuth = true; // turn on SMTP authentication |
88 |
|
$mail->Username = ""; // SMTP username |
89 |
|
$mail->Password = ""; // SMTP password |
90 |
|
|
91 |
|
$mail->From = "[email protected]"; |
92 |
|
$mail->FromName = "Mailer"; |
93 |
|
$mail->AddAddress("[email protected]", "Vi"); |
94 |
|
$mail->AddReplyTo("[email protected]", "Information"); |
95 |
|
|
96 |
|
$mail->WordWrap = 50; // set word wrap to 50 characters |
97 |
|
$mail->IsHTML(true); // set email format to HTML |
98 |
|
|
99 |
|
$mail->Subject = "Here is the subject"; |
100 |
|
$mail->Body = "This is the HTML message body <b>in bold!</b>"; |
101 |
|
$mail->AltBody = "This is the body in plain text for non-HTML mail clients"; |
102 |
|
|
103 |
|
if(!$mail->Send()) |
104 |
|
{ |
105 |
|
echo "Message could not be sent. <p>"; |
106 |
|
echo "Mailer Error: " . $mail->ErrorInfo; |
107 |
|
exit; |
108 |
|
} |
109 |
|
|
110 |
|
echo "Message has been sent";*/ |
111 |
|
} |
112 |
} |
} |
113 |
|
|
114 |
// ============================================= |
// ============================================= |
150 |
return $annee."-".$mois."-".$jour ; |
return $annee."-".$mois."-".$jour ; |
151 |
} |
} |
152 |
|
|
153 |
|
// ============================================= |
154 |
|
// Ajout du fielset |
155 |
|
// Add fieldset |
156 |
|
// ============================================= |
157 |
|
function setLayout(&$form, $maj){ |
158 |
|
if ( $maj < 2 ) { |
159 |
|
//Champs sur lequel s'ouvre le fieldset |
160 |
|
$form->setBloc('dossier','D',""); |
161 |
|
$form->setFieldset('dossier','D',_('Consultation')); |
162 |
|
|
163 |
|
//Champs sur lequel se ferme le fieldset |
164 |
|
$form->setFieldset('date_envoi','F',''); |
165 |
|
$form->setBloc('date_envoi','F'); |
166 |
|
if ( $maj == 1 ){ |
167 |
|
//Champs sur lequel s'ouvre le fieldset |
168 |
|
$form->setBloc('date_reception','D',""); |
169 |
|
$form->setFieldset('date_reception','D',_('Retour d\'avis')); |
170 |
|
|
171 |
|
//Champs sur lequel se ferme le fieldset |
172 |
|
$form->setFieldset('lu','F',''); |
173 |
|
$form->setBloc('lu','F'); |
174 |
|
} |
175 |
|
} |
176 |
|
|
177 |
|
} |
178 |
|
|
179 |
|
function setSelect(&$form, $maj,&$db,$debug) { |
180 |
|
parent::setSelect($form, $maj,$db,$debug); |
181 |
|
if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc.php")) |
182 |
|
include ("../sql/".$db->phptype."/".$this->table.".form.inc.php"); |
183 |
|
if($maj<2){ |
184 |
|
$contenu=array(); |
185 |
|
$sql = " SELECT service, abrege, libelle FROM ".DB_PREFIXE."service"; |
186 |
|
$res = $db->query($sql); |
187 |
|
if (database::isError($res)) |
188 |
|
die($res->getMessage()); |
189 |
|
$contenu[0][0]=""; |
190 |
|
$contenu[1][0]=_('choisir')." "._('service'); |
191 |
|
$k=1; |
192 |
|
while ($row=& $res->fetchRow()){ |
193 |
|
if($maj==0){ // ajouter |
194 |
|
$contenu[0][$k]=$row[0]; |
195 |
|
$contenu[1][$k]=$row[1]." ".$row[2]; |
196 |
|
$k++; |
197 |
|
}else{ |
198 |
|
// select hiddenstatic |
199 |
|
$contenu[0][$k]=$row[0]; |
200 |
|
$contenu[1][$k]=$row[1]." ".$row[2]; |
201 |
|
$k++; |
202 |
|
} |
203 |
|
} |
204 |
|
$form->setSelect("service",$contenu); |
205 |
|
} |
206 |
|
} |
207 |
|
|
208 |
|
//Formatage des intitulés des champs. |
209 |
|
function setLib(&$form,$maj) { |
210 |
|
parent::setLib($form,$maj); |
211 |
|
$form->setLib('date_reception','date de reception'); |
212 |
|
$form->setLib('avis_consultation','avis'); |
213 |
|
$form->setLib('fichier','retour d\'avis'); |
214 |
|
} |
215 |
}// fin classe |
}// fin classe |
216 |
?> |
?> |