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 |
11 |
|
|
|
function setValFAjout($val){ |
|
|
$this->valF['service'] = $val['service']; |
|
|
} |
|
|
|
|
|
function setvalF($val){ |
|
|
parent::setvalF($val); |
|
|
// cles secondaires numerique (contrainte integrite pgsql) |
|
|
if($val['avis']=='') $this->valF['avis']= null; |
|
|
} |
|
|
|
|
|
function verifier(){ |
|
|
$this->correct=True; |
|
|
$imgv=""; |
|
|
$f=" ! "; |
|
|
$imgv="<img src='../app/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; |
|
|
} |
|
|
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; |
|
|
} |
|
|
} |
|
|
|
|
12 |
function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire){ |
function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire){ |
13 |
if ($validation==0) { |
if ($validation==0) { |
14 |
if ($maj == 0){ |
if ($maj == 0){ |
15 |
$form->setVal("dossier", $idxformulaire); |
$form->setVal("dossier", $idxformulaire); |
16 |
|
$form->setVal("date_envoi",date('d/m/Y')); |
17 |
} |
} |
18 |
|
else |
19 |
|
if ( $maj == 1 ) |
20 |
|
$form->setVal("date_retour",date('d/m/Y')); |
21 |
} |
} |
22 |
} |
} |
23 |
|
|
24 |
function setType(&$form,$maj) { |
function setType(&$form,$maj) { |
25 |
|
parent::setType($form,$maj); |
26 |
if ($maj < 2) { //ajouter et modifier [add and modify] |
if ($maj < 2) { //ajouter et modifier [add and modify] |
27 |
if($maj==0){ // add |
if($maj==0){ // add |
28 |
$form->setType('date_envoi', 'date2'); |
$form->setType('date_envoi', 'date2'); |
29 |
$form->setType('service', 'select'); |
$form->setType('service', 'select'); |
30 |
$form->setType('date_limite', 'hidden'); |
$form->setType('date_limite', 'hidden'); |
31 |
$form->setType('date_retour', 'hidden'); |
$form->setType('date_retour', 'hidden'); |
32 |
$form->setType('avis', 'hidden'); |
$form->setType('avis_consultation', 'hidden'); |
33 |
|
$form->setType('motivation', 'hidden'); |
34 |
|
$form->setType('fichier', 'hidden'); |
35 |
|
$form->setType('lu', 'hidden'); |
36 |
|
$form->setType('date_reception', 'hidden'); |
37 |
}else{ // modify |
}else{ // modify |
38 |
$form->setType('date_envoi', 'hiddenstaticdate'); |
$form->setType('date_envoi', 'hiddenstaticdate'); |
39 |
$form->setType('service', 'selectdisabled'); |
$form->setType('date_limite', 'hiddenstaticdate'); |
40 |
$form->setType('date_limite', 'date2'); |
$form->setType('service', 'selecthiddenstatic'); |
41 |
$form->setType('date_retour', 'date2'); |
$form->setType('date_retour', 'date2'); |
42 |
$form->setType('avis', 'select'); |
$form->setType('avis_consultation', 'select'); |
43 |
|
$form->setType('motivation', 'textarea'); |
44 |
|
$form->setType('fichier', 'upload'); |
45 |
} |
} |
|
$form->setType('consultation', 'hiddenstatic'); |
|
|
$form->setType('dossier', 'hiddenstatic'); |
|
|
}else{ // supprimer |
|
|
$form->setType('consultation', 'hiddenstatic'); |
|
46 |
$form->setType('dossier', 'hiddenstatic'); |
$form->setType('dossier', 'hiddenstatic'); |
47 |
} |
} |
48 |
} |
$form->setType('consultation', 'hidden'); |
49 |
|
|
50 |
function setTaille(&$form,$maj){ |
$form->setType('consultation', 'hidden'); |
|
$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); |
|
51 |
} |
} |
52 |
|
|
|
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); |
|
|
} |
|
|
|
|
|
|
|
53 |
// TRIGGER AVANT MODIFICATION DE DONNEES |
// TRIGGER AVANT MODIFICATION DE DONNEES |
54 |
// trigger before modification data |
// trigger before modification data |
55 |
function triggerajouter($id,&$db,$val,$DEBUG) { |
function triggerajouter($id,&$db,$val,$DEBUG) { |
56 |
// mise a jour instruction avec evenement [return delay] |
// mise a jour instruction avec evenement [return delay] |
57 |
if (!$this->valF['date_envoi']==""){ |
if (!$this->valF['date_envoi']==""){ |
58 |
$sql= "select delai from service where service ='".$this->valF['service']."'"; |
$sql= "select delai from ".DB_PREFIXE."service where service ='".$this->valF['service']."'"; |
59 |
$delai = $db->getOne($sql); |
$delai = $db->getOne($sql); |
60 |
$this->valF['date_limite'] = $this->moisdate($this->valF['date_envoi'],$delai); |
$this->valF['date_limite'] = $this->moisdate($this->valF['date_envoi'],$delai); |
61 |
$this->msg=$this->msg."<br>"._("delai")." ". |
$this->msg=$this->msg._("delai")." ". |
62 |
_("retour")." ".$delai." "._("mois")." -> ". |
_("retour")." ".$delai." "._("mois")." -> ". |
63 |
_("retour")." ".$this->valF['date_limite']."<br>"; |
_("retour")." ".$this->valF['date_limite']."<br>"; |
64 |
|
$this->valF['lu'] = true; |
65 |
} |
} |
66 |
} |
} |
67 |
|
|
104 |
return $annee."-".$mois."-".$jour ; |
return $annee."-".$mois."-".$jour ; |
105 |
} |
} |
106 |
|
|
107 |
|
// ============================================= |
108 |
|
// Ajout du fielset |
109 |
|
// Add fieldset |
110 |
|
// ============================================= |
111 |
|
function setLayout(&$form, $maj){ |
112 |
|
if ( $maj < 2 OR $maj == 3 ) { |
113 |
|
//Champs sur lequel s'ouvre le fieldset |
114 |
|
$form->setBloc('dossier','D',""); |
115 |
|
$form->setFieldset('dossier','D',_('Consultation')); |
116 |
|
|
117 |
|
//Champs sur lequel se ferme le fieldset |
118 |
|
$form->setFieldset('date_envoi','F',''); |
119 |
|
$form->setBloc('date_envoi','F'); |
120 |
|
if ( $maj == 1 OR $maj == 3 ){ |
121 |
|
//Champs sur lequel s'ouvre le fieldset |
122 |
|
$form->setBloc('date_reception','D',""); |
123 |
|
$form->setFieldset('date_reception','D',_('Retour d\'avis')); |
124 |
|
|
125 |
|
//Champs sur lequel se ferme le fieldset |
126 |
|
$form->setFieldset('lu','F',''); |
127 |
|
$form->setBloc('lu','F'); |
128 |
|
} |
129 |
|
} |
130 |
|
|
131 |
|
} |
132 |
|
|
133 |
}// fin classe |
}// fin classe |
|
?> |
|
134 |
|
?> |