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 |
|
|
42 |
$this->val[array_search("avis_consultation",$this->champs)] != $val["avis_consultation"] OR |
$this->val[array_search("avis_consultation",$this->champs)] != $val["avis_consultation"] OR |
43 |
$this->val[array_search("date_retour",$this->champs)] != $val["date_retour"] OR |
$this->val[array_search("date_retour",$this->champs)] != $val["date_retour"] OR |
44 |
$this->val[array_search("motivation",$this->champs)] != $val["motivation"] OR |
$this->val[array_search("motivation",$this->champs)] != $val["motivation"] OR |
45 |
$this->val[array_search("fichier",$this->champs)] != $val["fichier"] ) |
$this->val[array_search("fichier",$this->champs)] != $val["fichier"]) |
46 |
) { |
) { |
47 |
$this->valF["lu"]=false; |
$this->valF["lu"]=false; |
48 |
} |
} |
49 |
|
} |
50 |
|
|
51 |
|
function verifier($val, &$db, $DEBUG) { |
52 |
|
parent::verifier($val, $db, $DEBUG); |
53 |
// Si le fichier envoye est different de l'existant |
// Si le fichier envoye est different de l'existant |
54 |
if (isset($this->val[array_search("fichier",$this->champs)]) |
if (isset($this->val[array_search("fichier",$this->champs)]) |
55 |
&& $this->val[array_search("fichier",$this->champs)] != $val["fichier"] |
&& $this->val[array_search("fichier",$this->champs)] != $val["fichier"] |
71 |
// Sinon on supprime le fichier dans tmp |
// Sinon on supprime le fichier dans tmp |
72 |
// on reinitialise le nom du fichier a l'ancienne valeur |
// on reinitialise le nom du fichier a l'ancienne valeur |
73 |
} else { |
} else { |
74 |
|
$this->correct = false; |
75 |
$this->addToMessage($res); |
$this->addToMessage($res); |
76 |
unlink("../tmp/".$this->valF['fichier']); |
unlink("../tmp/".$this->valF['fichier']); |
77 |
$this->valF['fichier']=$this->val[array_search("fichier",$this->champs)]; |
$this->valF['fichier']=$this->val[array_search("fichier",$this->champs)]; |
136 |
$form->setType('fichier', 'tmpUpload'); |
$form->setType('fichier', 'tmpUpload'); |
137 |
} else { |
} else { |
138 |
// Si non on affiche uniquement le nom du fichier |
// Si non on affiche uniquement le nom du fichier |
139 |
$form->setType('fichier', 'hiddenstatic'); |
$form->setType('fichier', 'tmpUploadStatic'); |
140 |
} |
} |
141 |
|
|
142 |
// Modification layout : écran de retour d'avis permettant |
// Modification layout : écran de retour d'avis permettant |
155 |
} |
} |
156 |
|
|
157 |
} |
} |
158 |
|
// MODE - CONSULTER |
159 |
|
if ( $maj == 3 ) { |
160 |
|
$form->setType('fichier', 'tmpUploadStatic'); |
161 |
|
} |
162 |
//// On cache la clé primaire |
//// On cache la clé primaire |
163 |
//$form->setType('consultation', 'hidden'); |
//$form->setType('consultation', 'hidden'); |
164 |
} |
} |
213 |
} |
} |
214 |
} |
} |
215 |
|
|
216 |
|
// s'il s'agit de la consultation ERP Secu ou ERP Accessibilite envoie un |
217 |
|
// message a ERP |
218 |
|
if ($this->isDossierPC($this->valF['dossier']) == 'PC' |
219 |
|
&& ($this->valF['service'] == $this->f->getParameter('erp_service_accessibilite') |
220 |
|
|| $this->valF['service'] == $this->f->getParameter('erp_service_securite'))) { |
221 |
|
$msgenque = new MessageEnqueuer(); |
222 |
|
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
223 |
|
$msgenque->setConsultationIdentifier($this->valF['consultation']); |
224 |
|
$msgenque->enqueueMessage($msgenque::$ERP_DEMANDE_INSTRUCTION_PC); |
225 |
|
} |
226 |
|
|
227 |
|
} |
228 |
|
|
229 |
|
|
230 |
|
function isDossierPC($dossier) { |
231 |
|
$sql = "SELECT nature FROM dossier WHERE dossier = '" . $dossier . "'"; |
232 |
|
$res = $this->db->limitquery($sql, 0, 1); |
233 |
|
$this->addToLog("isDossierPC(): db->limitquery(\"".str_replace(",",", ",$sql)."\", 0, 1);", VERBOSE_MODE); |
234 |
|
// Si une erreur survient on die |
235 |
|
if (database::isError($res, true)) { |
236 |
|
// Appel de la methode de recuperation des erreurs |
237 |
|
$this->erreur_db($res->getDebugInfo(), $res->getMessage(), $tableSelect); |
238 |
|
} |
239 |
|
// retourne la nature du dossier |
240 |
|
while ($row =& $res->fetchRow()) { |
241 |
|
return $row[0]; |
242 |
|
} |
243 |
|
// la nature n'etait pas trouve, ce qui ne devrait pas se passer |
244 |
|
return NULL; |
245 |
} |
} |
246 |
|
|
247 |
// ============================================= |
// ============================================= |
351 |
echo _("Retour"); |
echo _("Retour"); |
352 |
// |
// |
353 |
echo "</a>\n"; |
echo "</a>\n"; |
|
|
|
354 |
} |
} |
355 |
|
|
356 |
|
/** |
357 |
|
* Méthode de verification d'accèssibilité de la consultation |
358 |
|
* à l'utilisateur connecté |
359 |
|
*/ |
360 |
|
function canAccess() { |
361 |
|
parent::canAccess(); |
362 |
|
if($this->f->isUserServiceExt()) { |
363 |
|
// On compare l'id du service de la consultation |
364 |
|
// aux id des services de utilisateur connecté |
365 |
|
foreach($this->f->om_utilisateur['service'] as $service) { |
366 |
|
if($this->val[array_search("service",$this->champs)]===$service['service']) { |
367 |
|
return true; |
368 |
|
} |
369 |
|
} |
370 |
|
return false; |
371 |
|
} else{ |
372 |
|
return true; |
373 |
|
} |
374 |
|
} |
375 |
|
|
376 |
|
/** |
377 |
|
* Surcharge du bouton retour pour popup |
378 |
|
*/ |
379 |
|
function retoursousformulaire($idxformulaire, $retourformulaire, $val, |
380 |
|
$objsf, $premiersf, $tricolsf, $validation, |
381 |
|
$idx, $maj, $retour) { |
382 |
|
if($retourformulaire === "demande_avis_encours") { |
383 |
|
echo "\n<a class=\"retour\" "; |
384 |
|
echo "href=\""; |
385 |
|
echo "#"; |
386 |
|
echo "\" "; |
387 |
|
echo ">"; |
388 |
|
// |
389 |
|
echo _("Retour"); |
390 |
|
// |
391 |
|
echo "</a>\n"; |
392 |
|
} else { |
393 |
|
parent::retoursousformulaire($idxformulaire, $retourformulaire, $val, |
394 |
|
$objsf, $premiersf, $tricolsf, $validation, |
395 |
|
$idx, $maj, $retour); |
396 |
|
} |
397 |
|
} |
398 |
}// fin classe |
}// fin classe |
399 |
?> |
?> |