2 |
//$Id$ |
//$Id$ |
3 |
//gen openMairie le 10/02/2011 20:32 |
//gen openMairie le 10/02/2011 20:32 |
4 |
require_once ("../gen/obj/consultation.class.php"); |
require_once ("../gen/obj/consultation.class.php"); |
5 |
|
require_once("../services/outgoing/messageenqueuer.php"); |
6 |
|
|
7 |
class consultation extends consultation_gen { |
class consultation extends consultation_gen { |
8 |
var $maj; |
|
9 |
function consultation($id,&$db,$debug) { |
function consultation($id,&$db,$debug) { |
10 |
$this->constructeur($id,$db,$debug); |
$this->constructeur($id,$db,$debug); |
11 |
}// fin constructeur |
}// fin constructeur |
12 |
|
|
13 |
|
// {{{ Gestion de la confidentialité des données spécifiques |
14 |
|
|
15 |
|
/** |
16 |
|
* Surcharge pour gérer les actions disponibles dans le portlet |
17 |
|
*/ |
18 |
|
function checkAccessibility() { |
19 |
|
// |
20 |
|
parent::checkAccessibility(); |
21 |
|
// Si l'utilisateur est un intructeur qui en correspond pas à la |
22 |
|
// division du dossier |
23 |
|
if ($this->f->isUserInstructeur() |
24 |
|
&& isset($this->f->om_utilisateur["division"]) |
25 |
|
&& $this->f->om_utilisateur["division"] != $this->getDivisionFromDossier()) { |
26 |
|
// |
27 |
|
$this->actions_sup = array(); |
28 |
|
$this->setParameter("actions", array()); |
29 |
|
} |
30 |
|
// Si une action 'lu' est présente et que le champ lu est à true |
31 |
|
// on supprime l'action |
32 |
|
if (isset($this->actions_sup["lu"]) |
33 |
|
&& isset($this->val[array_search("lu", $this->champs)]) |
34 |
|
&& $this->val[array_search("lu", $this->champs)]== "t") { |
35 |
|
unset($this->actions_sup["lu"]); |
36 |
|
} |
37 |
|
} |
38 |
|
|
39 |
|
/** |
40 |
|
* Cette methode est à surcharger elle permet de tester dans chaque classe |
41 |
|
* des droits des droits spécifiques en fonction des données |
42 |
|
*/ |
43 |
|
function canAccess() { |
44 |
|
// Si l'utilisateur est un utilisateur de service externe |
45 |
|
// on vérifie qu'il peut accéder à la consultation |
46 |
|
if ($this->f->isUserServiceExt()) { |
47 |
|
// On compare l'id du service de la consultation |
48 |
|
// aux id des services de utilisateur connecté |
49 |
|
foreach($this->f->om_utilisateur['service'] as $service) { |
50 |
|
if($this->val[array_search("service",$this->champs)]===$service['service']) { |
51 |
|
return true; |
52 |
|
} |
53 |
|
} |
54 |
|
// |
55 |
|
$this->f->addToLog("canAccess(): utilisateur de service sur une consultation d'un autre service", EXTRA_VERBOSE_MODE); |
56 |
|
return false; |
57 |
|
} |
58 |
|
// Si l'utilisateur est un intructeur qui ne correspond pas à la |
59 |
|
// division du dossier |
60 |
|
if ($this->f->isUserInstructeur() |
61 |
|
&& $this->f->om_utilisateur["division"] != $this->getDivisionFromDossier() |
62 |
|
&& $this->getParameter("maj") != 3) { |
63 |
|
// |
64 |
|
$this->f->addToLog("canAccess(): utilisateur instructeur sur un dossier d'une autre division", EXTRA_VERBOSE_MODE); |
65 |
|
return false; |
66 |
|
} |
67 |
|
// |
68 |
|
return true; |
69 |
|
} |
70 |
|
|
71 |
|
/** |
72 |
|
* Cette méthode permet de récupérer la division d'un dossier |
73 |
|
*/ |
74 |
|
function getDivisionFromDossier() { |
75 |
|
// Si on se trouve en mode MODIFIER ou SUPPRIMER ou CONSULTER alors on |
76 |
|
// récupère le numéro de dossier dans la consultation et on en retourne |
77 |
|
// sa division |
78 |
|
if ($this->getParameter("maj") == 1 || $this->getParameter("maj") == 2 |
79 |
|
|| $this->getParameter("maj") == 3) { |
80 |
|
// |
81 |
|
if (!isset($this->val[array_search("dossier", $this->champs)])) { |
82 |
|
return NULL; |
83 |
|
} |
84 |
|
// |
85 |
|
$sql = "select division from ".DB_PREFIXE."dossier "; |
86 |
|
$sql .= " where dossier='".$this->val[array_search("dossier", $this->champs)]."'"; |
87 |
|
// |
88 |
|
$division = $this->db->getOne($sql); |
89 |
|
$this->addToLog("getDivisionFromDossier(): db->getone(\"".$sql."\")", VERBOSE_MODE); |
90 |
|
database::isError($division); |
91 |
|
// |
92 |
|
return $division; |
93 |
|
} elseif ($this->getParameter("maj") == 0 |
94 |
|
&& ($this->getParameter("retourformulaire") == "dossier" |
95 |
|
|| $this->getParameter("retourformulaire") == "dossier_instruction" |
96 |
|
|| $this->getParameter("retourformulaire") == "dossier_instruction_mes_encours" |
97 |
|
|| $this->getParameter("retourformulaire") == "dossier_instruction_tous_encours" |
98 |
|
|| $this->getParameter("retourformulaire") == "dossier_instruction_mes_clotures" |
99 |
|
|| $this->getParameter("retourformulaire") == "dossier_instruction_tous_clotures")) { |
100 |
|
// Si on se trouve en mode AJOUTER et en sous formulaire alors on |
101 |
|
// récupère le numéro de dossier dans les paramètres de sous |
102 |
|
// formulaires et on en retourne sa division |
103 |
|
$sql = "select division from ".DB_PREFIXE."dossier "; |
104 |
|
$sql .= " where dossier='".$this->getParameter("idxformulaire")."'"; |
105 |
|
// |
106 |
|
$division = $this->db->getOne($sql); |
107 |
|
$this->addToLog("getDivisionFromDossier(): db->getone(\"".$sql."\")", VERBOSE_MODE); |
108 |
|
database::isError($division); |
109 |
|
// |
110 |
|
return $division; |
111 |
|
} else { |
112 |
|
return NULL; |
113 |
|
} |
114 |
|
|
115 |
|
} |
116 |
|
|
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); |
125 |
$form->setVal("date_envoi",date('d/m/Y')); |
$form->setVal("date_envoi",date('d/m/Y')); |
126 |
} |
} |
127 |
if($maj == 1) { |
if($maj == 1) { |
128 |
$form->setVal("date_retour",date('d/m/Y')); |
if($this->f->isAccredited('consultation_retour_avis_suivi') OR |
129 |
|
$this->f->isAccredited('consultation_retour_avis_service')) { |
130 |
|
$form->setVal("date_retour",date('d/m/Y')); |
131 |
|
} |
132 |
} |
} |
133 |
} |
} |
134 |
} |
} |
140 |
} |
} |
141 |
|
|
142 |
function setvalF($val) { |
function setvalF($val) { |
143 |
|
// |
144 |
parent::setValF($val); |
parent::setValF($val); |
145 |
if($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 |
156 |
if($this->maj==1 AND ($this->val[array_search("avis_consultation",$this->champs)] != $val["avis_consultation"] OR |
if($this->getParameter('maj')==1 AND ( |
157 |
$this->val[array_search("date_retour",$this->champs)] != $val["date_retour"] OR |
$this->val[array_search("avis_consultation",$this->champs)] != $val["avis_consultation"] OR |
158 |
$this->val[array_search("motivation",$this->champs)] != $val["motivation"] OR |
$this->val[array_search("date_retour",$this->champs)] != $val["date_retour"] OR |
159 |
$this->val[array_search("fichier",$this->champs)] != $val["fichier"])) { |
$this->val[array_search("motivation",$this->champs)] != $val["motivation"] OR |
160 |
$this->valF["lu"]=FALSE; |
$this->val[array_search("fichier",$this->champs)] != $val["fichier"]) |
161 |
$this->valF["date_retour"]=$this->dateDB(date('d/m/Y')); |
) { |
162 |
|
$this->valF["lu"]=false; |
163 |
} |
} |
|
|
|
164 |
} |
} |
165 |
|
|
166 |
|
function setLib(&$form, $maj) { |
167 |
|
// |
168 |
|
parent::setLib($form, $maj); |
169 |
|
// |
170 |
|
$form->setLib($this->clePrimaire, _("id")); |
171 |
|
} |
172 |
|
|
173 |
function setType(&$form,$maj) { |
function setType(&$form,$maj) { |
174 |
|
// Appel du parent |
175 |
parent::setType($form,$maj); |
parent::setType($form,$maj); |
176 |
if ($maj < 2) { //ajouter et modifier [add and modify] |
// MODE - AJOUTER |
177 |
if($maj==0){ // add |
if ($maj == 0) { |
178 |
$form->setType('date_envoi', 'date2'); |
// On cache alors tous les champs que nous ne voulons pas voir |
179 |
$form->setType('service', 'select'); |
// apparaître dans le formulaire d'ajout (principalement les |
180 |
$form->setType('date_limite', 'hidden'); |
// informations sur le retour d'avis) |
181 |
$form->setType('date_retour', 'hidden'); |
$form->setType('date_retour', 'hidden'); |
182 |
$form->setType('avis_consultation', 'hidden'); |
$form->setType('date_reception', 'hidden'); |
183 |
$form->setType('motivation', 'hidden'); |
$form->setType('date_limite', 'hidden'); |
184 |
$form->setType('fichier', 'hidden'); |
$form->setType('avis_consultation', 'hidden'); |
185 |
|
$form->setType('motivation', 'hidden'); |
186 |
|
$form->setType('fichier', 'hidden'); |
187 |
|
$form->setType('lu', 'hidden'); |
188 |
|
// On permet la modification de certains champs |
189 |
|
$form->setType('dossier', 'hiddenstatic'); |
190 |
|
$form->setType('service', 'select'); |
191 |
|
$form->setType('date_envoi', 'date2'); |
192 |
|
} |
193 |
|
// MODE - MODIFIER |
194 |
|
if ($maj == 1) { |
195 |
|
|
196 |
|
// On affiche en statique les informations qui ne sont plus |
197 |
|
// modifiables |
198 |
|
$form->setType('dossier', 'hiddenstatic'); |
199 |
|
$form->setType('date_envoi', 'hiddenstaticdate'); |
200 |
|
$form->setType('date_limite', 'hiddenstaticdate'); |
201 |
|
$form->setType('service', 'selecthiddenstatic'); |
202 |
|
|
203 |
|
// La date de réception ne peut être modifiée que par un |
204 |
|
// utilisateur en ayant spécifiquement la permission |
205 |
|
if($this->f->isAccredited('consultation_modifier_date_reception')) { |
206 |
|
$form->setType('date_reception', 'date2'); |
207 |
|
} else { |
208 |
|
$form->setType('date_reception', 'hiddenstaticdate'); |
209 |
|
} |
210 |
|
|
211 |
|
// Le marqueur lu/non lu ne peut être modifié que par un |
212 |
|
// utilisateur en ayant spécifiquement la permission |
213 |
|
if ($this->f->isAccredited('consultation_modifier_lu')) { |
214 |
|
$form->setType('lu', 'checkbox'); |
215 |
|
} else { |
216 |
$form->setType('lu', 'hidden'); |
$form->setType('lu', 'hidden'); |
217 |
$form->setType('date_reception', 'hidden'); |
} |
218 |
}else{ // modify |
|
219 |
if($this->f->isAccredited('consultation_retour_avis_service')) { |
// Gestion du type du widget sur le champ fichier |
220 |
$form->setType('dossier', 'hidden'); |
if($this->getVal("fichier") == "" OR |
221 |
$form->setType('service', 'hidden'); |
$this->f->isAccredited('consultation_modifier_fichier')) { |
222 |
$form->setType('date_envoi', 'hidden'); |
// Si il n'y a jamais eu de fichier enregistré ou que |
223 |
$form->setType('date_retour', 'hidden'); |
// l'utilisateur a spécifiquement les droits pour modifier |
224 |
$form->setType('date_reception', 'hidden'); |
// un fichier déjà enregistré alors on positionne un type |
225 |
$form->setType('date_limite', 'hidden'); |
// de widget modifiable |
226 |
$form->setType('lu', 'hidden'); |
if($this->retourformulaire == "demande_avis_encours") { |
|
} else { |
|
|
$form->setType('date_envoi', 'hiddenstaticdate'); |
|
|
$form->setType('date_limite', 'hiddenstaticdate'); |
|
|
$form->setType('date_reception', 'hiddenstaticdate'); |
|
|
$form->setType('service', 'selecthiddenstatic'); |
|
|
$form->setType('date_retour', 'date2'); |
|
|
$form->setType('avis_consultation', 'select'); |
|
|
$form->setType('motivation', 'textarea'); |
|
227 |
$form->setType('fichier', 'upload2'); |
$form->setType('fichier', 'upload2'); |
228 |
//Affichage du champ en modification pour le prifil instructeur |
} else { |
229 |
if(!$this->f->isAccredited('consultation_modifier_lu')) { |
$form->setType('fichier', 'upload'); |
|
$form->setType('lu', 'hidden'); |
|
|
} |
|
230 |
} |
} |
231 |
|
} else { |
232 |
|
// Si non on affiche uniquement le nom du fichier |
233 |
|
$form->setType('fichier', 'file'); |
234 |
} |
} |
|
$form->setType('dossier', 'hiddenstatic'); |
|
|
} |
|
|
$form->setType('consultation', 'hidden'); |
|
|
//setType pour profil service |
|
235 |
|
|
236 |
|
// Modification layout : écran de retour d'avis permettant |
237 |
|
// uniquement la saisie des trois champs : avis, motivation et fichier |
238 |
|
if (!$this->f->isAccredited('consultation_consulter_autre_que_retour_avis')) { |
239 |
|
|
240 |
|
// On cache alors tous les champs que nous ne voulons pas voir |
241 |
|
$form->setType('dossier', 'hidden'); |
242 |
|
$form->setType('service', 'hidden'); |
243 |
|
$form->setType('date_envoi', 'hidden'); |
244 |
|
$form->setType('date_retour', 'hidden'); |
245 |
|
$form->setType('date_reception', 'hidden'); |
246 |
|
$form->setType('date_limite', 'hidden'); |
247 |
|
$form->setType('lu', 'hidden'); |
248 |
|
|
249 |
|
} |
250 |
|
|
251 |
|
} |
252 |
|
// MODE - CONSULTER |
253 |
|
if ( $maj == 3 ) { |
254 |
|
$form->setType('fichier', 'file'); |
255 |
|
} |
256 |
|
//// On cache la clé primaire |
257 |
|
//$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")." ".$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 |
307 |
$sql= "SELECT abrege, notification_email, email FROM ".DB_PREFIXE. |
$sql= "SELECT abrege, libelle, notification_email, email FROM ".DB_PREFIXE. |
308 |
"service WHERE service ='".$this->valF['service']."'"; |
"service WHERE service ='".$this->valF['service']."'"; |
309 |
$res=$db->query($sql); |
$res=$db->query($sql); |
310 |
$notif = $res->fetchrow(DB_FETCHMODE_ASSOC); |
$notif = $res->fetchrow(DB_FETCHMODE_ASSOC); |
322 |
$corps=_("Votre service est consulte concernant le dossier no")." ".$dossier['dossier']."<br/>". |
$corps=_("Votre service est consulte concernant le dossier no")." ".$dossier['dossier']."<br/>". |
323 |
_("Il concerne le terrain situe a l'adresse :")." ".utf8_decode($dossier['terrain_adresse']). |
_("Il concerne le terrain situe a l'adresse :")." ".utf8_decode($dossier['terrain_adresse']). |
324 |
" ".utf8_decode($dossier['terrain_adresse_complement'])." ".utf8_decode($dossier['terrain_cp'])." ".$dossier['terrain_ville']."<br/>". |
" ".utf8_decode($dossier['terrain_adresse_complement'])." ".utf8_decode($dossier['terrain_cp'])." ".$dossier['terrain_ville']."<br/>". |
325 |
_("Vous pouvez y acceder et rendre votre avis a l'adresse")." <a href='".$this->f->getParameter('lien_interne_vdm'). |
_("Vous pouvez y acceder et rendre votre avis a l'adresse")." <a href='".$this->f->getParameter('services_consultes_lien_interne'). |
326 |
"scr/form.php?obj=consultation&action=3&idx=".$this->valF['consultation']."' >". |
"scr/form.php?obj=consultation&action=3&idx=".$this->valF['consultation']."' >". |
327 |
_("Lien interne (services VDM)")."</a> "._("ou")." <a href='".$this->f->getParameter('lien_externe'). |
_("Lien interne (services VDM)")."</a> "._("ou")." <a href='".$this->f->getParameter('services_consultes_lien_externe'). |
328 |
"scr/form.php?obj=consultation&action=3&idx=".$this->valF['consultation']."' >". |
"scr/form.php?obj=consultation&action=3&idx=".$this->valF['consultation']."' >". |
329 |
_("Lien externe (hors VDM)")."</a>"; |
_("Lien externe (hors VDM)")."</a>"; |
330 |
// Envoi du mail avec message de retour |
// Envoi du mail avec message de retour |
331 |
if($this->f->sendMail($title, $corps, $notif['email'])) { |
if($this->f->sendMail($title, $corps, $notif['email'])) { |
332 |
$this->addToMessage(_("Envoi d'un mail de notification au service")." ".$notif['abrege']); |
$this->addToMessage(_("Envoi d'un mail de notification au service")." \"(".$notif['abrege'].") ".$notif["libelle"]."\""); |
333 |
} else { |
} else { |
334 |
$this->addToMessage(_("L'envoi du mail de notification a echoue")); |
$this->addToMessage(_("L'envoi du mail de notification a echoue")); |
335 |
} |
} |
336 |
} |
} |
337 |
|
|
338 |
|
|
339 |
|
// verification si envoi vers ERP est active |
340 |
|
if ($this->f->getParameter('option_erp') != "") { |
341 |
|
// s'il s'agit de la consultation ERP Secu, ERP Accessibilite, ou |
342 |
|
// deenvoie un |
343 |
|
// message a ERP |
344 |
|
$dossier_erp = $this->getFromDB("SELECT erp FROM ".DB_PREFIXE. |
345 |
|
"dossier WHERE dossier = '" .$this->valF['dossier'] . "'"); |
346 |
|
$dossier_nature = $this->getFromDB("SELECT dossier_autorisation_type_detaille.code FROM ".DB_PREFIXE. |
347 |
|
"dossier |
348 |
|
INNER JOIN ".DB_PREFIXE."dossier_autorisation |
349 |
|
ON dossier.dossier_autorisation=dossier_autorisation.dossier_autorisation |
350 |
|
INNER JOIN ".DB_PREFIXE."dossier_autorisation_type_detaille |
351 |
|
ON dossier_autorisation.dossier_autorisation_type_detaille |
352 |
|
= dossier_autorisation_type_detaille.dossier_autorisation_type_detaille |
353 |
|
WHERE dossier = '" . $this->valF['dossier'] . "'"); |
354 |
|
if ($dossier_erp == 't' |
355 |
|
&& substr($dossier_nature, 0, 2) == $this->f->getParameter('erp_dossier_nature_pc')) { |
356 |
|
// envoi du message "Demande d'instruction d'un dossier PC pour un ERP" |
357 |
|
if (($this->valF['service'] == $this->f->getParameter('erp_service_accessibilite') |
358 |
|
|| $this->valF['service'] == $this->f->getParameter('erp_service_securite'))) { |
359 |
|
$msgenque = new MessageEnqueuer(); |
360 |
|
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
361 |
|
$msgenque->setConsultationIdentifier($this->valF['consultation']); |
362 |
|
$msgenque->enqueueMessage($msgenque::$ERP_DEMANDE_INSTRUCTION_PC); |
363 |
|
} |
364 |
|
|
365 |
|
// envoi du message "Consultation ERP pour conformite" en cas de creation de la |
366 |
|
// consultation du service ERP Conformite |
367 |
|
if ($this->valF['service'] == $this->f->getParameter('erp_service_conformite')) { |
368 |
|
$msgenque = new MessageEnqueuer(); |
369 |
|
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
370 |
|
$msgenque->setConsultationIdentifier($this->valF['consultation']); |
371 |
|
$msgenque->enqueueMessage($msgenque::$ERP_CONSULTATION_CONFORMITE); |
372 |
|
} |
373 |
|
} |
374 |
|
} // fin de if($this->f->getParameter('option_erp')) |
375 |
|
} |
376 |
|
|
377 |
|
/** |
378 |
|
* Fait une requette sql pour extraire la valeur d'un champ, et retourne |
379 |
|
* cette valeur |
380 |
|
* @param string $sql La requete sql a executer |
381 |
|
* @return La valeur du champs cherche, sinon NULL. En cas d'erreur de la BD |
382 |
|
* l'execution s'arrete. |
383 |
|
*/ |
384 |
|
function getFromDB($sql) { |
385 |
|
//$sql = "SELECT libelle FROM ".DB_PREFIXE."dossier WHERE dossier = '" . $dossier . "'"; |
386 |
|
$res = $this->db->limitquery($sql, 0, 1); |
387 |
|
$this->addToLog("getDossierERPSpecification(): db->limitquery(\"". |
388 |
|
str_replace(",",", ",$sql)."\", 0, 1);", VERBOSE_MODE); |
389 |
|
// Si une erreur survient on die |
390 |
|
if (database::isError($res, true)) { |
391 |
|
// Appel de la methode de recuperation des erreurs |
392 |
|
$this->erreur_db($res->getDebugInfo(), $res->getMessage(), 'instruction'); |
393 |
|
} |
394 |
|
// retourne la nature du dossier |
395 |
|
while ($row =& $res->fetchRow()) { |
396 |
|
return $row[0]; |
397 |
|
} |
398 |
|
// la nature n'etait pas trouve, ce qui ne devrait pas se passer |
399 |
|
return NULL; |
400 |
|
|
401 |
} |
} |
402 |
|
|
403 |
// ============================================= |
// ============================================= |
444 |
// Add fieldset |
// Add fieldset |
445 |
// ============================================= |
// ============================================= |
446 |
function setLayout(&$form, $maj){ |
function setLayout(&$form, $maj){ |
447 |
if ( $maj < 2 OR $maj == 3 ) { |
|
448 |
if(!$this->f->isAccredited('consultation_retour_avis_service')) { |
// Modification layout : écran de retour d'avis permettant |
449 |
|
// uniquement la saisie des trois champs : avis, motivation et fichier |
450 |
|
if ($this->f->isAccredited('consultation_consulter_autre_que_retour_avis')) { |
451 |
|
|
452 |
//Champs sur lequel s'ouvre le fieldset |
//Champs sur lequel s'ouvre le fieldset |
453 |
$form->setBloc('dossier','D',""); |
$form->setBloc('dossier','D',""); |
454 |
$form->setFieldset('dossier','D',_('Consultation')); |
$form->setFieldset('dossier','D',_('Consultation')); |
456 |
//Champs sur lequel se ferme le fieldset |
//Champs sur lequel se ferme le fieldset |
457 |
$form->setFieldset('date_envoi','F',''); |
$form->setFieldset('date_envoi','F',''); |
458 |
$form->setBloc('date_envoi','F'); |
$form->setBloc('date_envoi','F'); |
459 |
|
|
460 |
} |
} |
461 |
if ( $maj == 1 OR $maj == 3 ){ |
|
462 |
|
// MODE - autre que AJOUTER alors on affiche un fieldset retour |
463 |
|
// d'avis |
464 |
|
if ($maj != 0) { |
465 |
|
|
466 |
//Champs sur lequel s'ouvre le fieldset |
//Champs sur lequel s'ouvre le fieldset |
467 |
$form->setBloc('date_reception','D',""); |
$form->setBloc('date_reception','D',""); |
468 |
$form->setFieldset('date_reception','D',_('Retour d\'avis')); |
$form->setFieldset('date_reception','D',_('Retour d\'avis')); |
469 |
|
|
470 |
//Champs sur lequel se ferme le fieldset |
//Champs sur lequel se ferme le fieldset |
471 |
$form->setFieldset('lu','F',''); |
$form->setFieldset('lu','F',''); |
472 |
$form->setBloc('lu','F'); |
$form->setBloc('lu','F'); |
473 |
|
|
474 |
} |
} |
475 |
|
} |
476 |
|
|
477 |
|
/** Surcharge de la methode retour afin de retourner sur la page de saisie de |
478 |
|
* code barre si besoin |
479 |
|
**/ |
480 |
|
function retour($premier = 0, $recherche = "", $tricol = "") { |
481 |
|
$params ="obj=".get_class($this); |
482 |
|
if($this->getParameter("retour")=="form") { |
483 |
|
$params .= "&idx=".$this->getParameter("idx"); |
484 |
|
$params .= "&action=3"; |
485 |
|
} |
486 |
|
$params .= "&premier=".$this->getParameter("premier"); |
487 |
|
$params .= "&tricol=".$this->getParameter("tricol"); |
488 |
|
$params .= "&recherche=".$this->getParameter("recherche"); |
489 |
|
$params .= "&selectioncol=".$this->getParameter("selectioncol"); |
490 |
|
$params .= "&advs_id=".$this->getParameter("advs_id"); |
491 |
|
$params .= "&valide=".$this->getParameter("valide"); |
492 |
|
echo "\n<a class=\"retour\" "; |
493 |
|
echo "href=\""; |
494 |
|
// |
495 |
|
|
496 |
|
if($this->getParameter("retour")=="form" AND !($this->getParameter("validation")>0 AND $this->getParameter("maj")==2 AND $this->correct)) { |
497 |
|
echo "form.php?".$params; |
498 |
|
} elseif($this->getParameter("retour")=="suivi_retours_de_consultation") { |
499 |
|
echo "../app/suivi_retours_de_consultation.php"; |
500 |
|
} else { |
501 |
|
echo "tab.php?".$params; |
502 |
|
} |
503 |
|
// |
504 |
|
echo "\""; |
505 |
|
echo ">"; |
506 |
|
// |
507 |
|
echo _("Retour"); |
508 |
|
// |
509 |
|
echo "</a>\n"; |
510 |
|
} |
511 |
|
|
512 |
|
/** |
513 |
|
* Surcharge du bouton retour pour popup |
514 |
|
*/ |
515 |
|
function retoursousformulaire($idxformulaire, $retourformulaire, $val, |
516 |
|
$objsf, $premiersf, $tricolsf, $validation, |
517 |
|
$idx, $maj, $retour) { |
518 |
|
if($retourformulaire === "demande_avis_encours") { |
519 |
|
echo "\n<a class=\"retour\" "; |
520 |
|
echo "href=\""; |
521 |
|
echo "#"; |
522 |
|
echo "\" "; |
523 |
|
echo ">"; |
524 |
|
// |
525 |
|
echo _("Retour"); |
526 |
|
// |
527 |
|
echo "</a>\n"; |
528 |
|
} else { |
529 |
|
parent::retoursousformulaire($idxformulaire, $retourformulaire, $val, |
530 |
|
$objsf, $premiersf, $tricolsf, $validation, |
531 |
|
$idx, $maj, $retour); |
532 |
} |
} |
533 |
} |
} |
|
|
|
534 |
}// fin classe |
}// fin classe |
535 |
?> |
?> |