/[openfoncier]/trunk/obj/consultation.class.php
ViewVC logotype

Diff of /trunk/obj/consultation.class.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 41 by fraynaud, Fri Jul 22 16:30:22 2011 UTC revision 555 by vpihour, Tue Oct 30 14:05:14 2012 UTC
# Line 4  Line 4 
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(!is_numeric($val['avis'])) $this->valF['avis']= null;  
     }  
   
     function verifier(){  
         $this->correct=True;  
         $imgv="";  
         $f="&nbsp!    ";  
         $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;  
         }  
         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', 'upload2');
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');
   
     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);  
     }  
49    
50      function setMax(&$form,$maj){          $form->setType('consultation', 'hidden');
         $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);  
51      }      }
52    
   
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->addToMessage(_("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        }
68        
69        function triggerajouterapres($id,&$db,$val,$DEBUG) {
70            
71            // Verification de la demande de notif par mail
72            $sql= "SELECT abrege, notification_email, email FROM ".DB_PREFIXE.
73                    "service WHERE service ='".$this->valF['service']."'";
74            $res=$db->query($sql);
75            $notif = $res->fetchrow(DB_FETCHMODE_ASSOC);
76            if (database :: isError($sql))die($res->getMessage()."erreur ".$sql);
77            if ($notif['notification_email']=='t') {
78                
79                // Recuperation des infos du dossier
80                $sql= "SELECT dossier, terrain_adresse, terrain_adresse_complement, terrain_cp, terrain_ville
81                        FROM ".DB_PREFIXE."dossier WHERE dossier ='".$this->valF['dossier']."'";
82                $res=$db->query($sql);
83                $dossier = $res->fetchrow(DB_FETCHMODE_ASSOC);
84                
85                // Definition des parametres d'envoi du mail
86                $title=_("Consultation de services : dossier no")." ".$dossier['dossier'];
87                $corps=_("Votre service est consulte concernant le dossier no")." ".$dossier['dossier']."<br/>".
88                _("Il concerne le terrain situe a l'adresse :")." ".utf8_decode($dossier['terrain_adresse']).
89                " ".utf8_decode($dossier['terrain_adresse_complement'])." ".utf8_decode($dossier['terrain_cp'])." ".$dossier['terrain_ville']."<br/>".
90                _("Vous pouvez y acceder et rendre votre avis a l'adresse")." <a href='".$this->f->getParameter('lien_interne_vdm').
91                "scr/form.php?obj=consultation&action=3&idx=".$this->valF['consultation']."' >".
92                _("Lien interne (services VDM)")."</a> "._("ou")." <a href='".$this->f->getParameter('lien_externe').
93                "scr/form.php?obj=consultation&action=3&idx=".$this->valF['consultation']."' >".
94                _("Lien externe (hors VDM)")."</a>";
95                // Envoi du mail avec message de retour
96                if($this->f->sendMail($title, $corps, $notif['email'])) {
97                    $this->addToMessage(_("Envoi d'un mail de notification au service")." ".$notif['abrege']);
98                } else {
99                    $this->addToMessage(_("L'envoi du mail de notification a echoue"));
100                }
101            }
102            
103      }      }
104    
105      // =============================================      // =============================================
# Line 146  class consultation extends consultation_ Line 141  class consultation extends consultation_
141          return $annee."-".$mois."-".$jour ;          return $annee."-".$mois."-".$jour ;
142      }      }
143    
144            // =============================================
145        // Ajout du fielset
146        // Add fieldset
147        // =============================================
148            function setLayout(&$form, $maj){
149                    if ( $maj < 2 OR $maj == 3 ) {
150                            //Champs sur lequel s'ouvre le fieldset
151                            $form->setBloc('dossier','D',"");
152                            $form->setFieldset('dossier','D',_('Consultation'));
153            
154                            //Champs sur lequel se ferme le fieldset
155                            $form->setFieldset('date_envoi','F','');
156                            $form->setBloc('date_envoi','F');
157                            if ( $maj == 1 OR $maj == 3 ){
158                                    //Champs sur lequel s'ouvre le fieldset
159                                    $form->setBloc('date_reception','D',"");
160                                    $form->setFieldset('date_reception','D',_('Retour d\'avis'));
161                    
162                                    //Champs sur lequel se ferme le fieldset
163                                    $form->setFieldset('lu','F','');
164                                    $form->setBloc('lu','F');
165                            }
166                    }
167                            
168            }
169            
170  }// fin classe  }// fin classe
 ?>  
171    ?>

Legend:
Removed from v.41  
changed lines
  Added in v.555

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26