/**
  * Detail d'une teleprocedure
  *
  * @author Christophe Beyer <*****@*****.**>
  * @since 2008/01/30
  * @param integer $id Id de la procedure
  * @param integer $print Si version imprimable
  * @param array $rFiche (Si on revient en modif apres erreur) Contient des donnees de l'intervention qui ecrasent celles issues de la base
  */
 public function processFiche()
 {
     $id = $this->getRequest('id', null);
     $errors = $this->getRequest('errors', array());
     $ok = $this->getRequest('ok', array());
     $print = $this->getRequest('print');
     $send = $this->getRequest('send');
     $fiche = $this->getRequest('rFiche', array());
     $daoIntervention = CopixDAOFactory::create("intervention");
     $criticErrors = array();
     if ($id && ($rFiche = $daoIntervention->get($id))) {
         $title = $rFiche->objet;
         $mondroit = Kernel::getLevel("MOD_TELEPROCEDURES", $rFiche->type_teleprocedure);
         if (!TeleproceduresService::canMakeInTelep('VIEW', $mondroit)) {
             $criticErrors[] = CopixI18N::get('kernel|kernel.error.noRights');
         }
     } else {
         $criticErrors[] = CopixI18N::get('teleprocedures|teleprocedures.error.prob.telep');
     }
     if ($criticErrors) {
         return CopixActionGroup::process('genericTools|Messages::getError', array('message' => implode('<br/>', $criticErrors), 'back' => CopixUrl::get('teleprocedures||')));
     }
     if (isset($fiche['mail_from'])) {
         $rFiche->mail_from = $fiche['mail_from'];
     }
     if (isset($fiche['mail_to'])) {
         $rFiche->mail_to = $fiche['mail_to'];
     }
     if (isset($fiche['mail_cc'])) {
         $rFiche->mail_cc = $fiche['mail_cc'];
     }
     if (isset($fiche['mail_message'])) {
         $rFiche->mail_message = $fiche['mail_message'];
     }
     $fiche = CopixZone::process('fiche', array('rFiche' => $rFiche, 'mondroit' => $mondroit, 'errors' => $errors, 'ok' => $ok, 'print' => $print));
     $comms = CopixZone::process('ficheComms', array('rFiche' => $rFiche, 'mondroit' => $mondroit));
     $actions = CopixZone::process('ficheActions', array('rFiche' => $rFiche, 'mondroit' => $mondroit));
     if ($print) {
         $main = $fiche;
     } else {
         $main = $fiche . $comms . $actions;
     }
     $tpl = new CopixTpl();
     $tpl->assign('TITLE_PAGE', $title);
     $tpl->assign("MAIN", $main);
     if (!$print) {
         // Enregistrement dans le trackin
         $user = _currentUser()->getId();
         TeleproceduresService::userReadIntervention($id, $user);
     }
     if (0 && $print) {
         $ppo = new CopixPPO();
         $ppo->result = $main;
         $ppo->TITLE_PAGE = $title;
         return _arPPO($ppo, array('template' => 'print_ppo.tpl', 'mainTemplate' => 'default|main_print.php'));
     } else {
         return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl);
     }
 }