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

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

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

revision 1263 by nhaye, Fri Feb 15 16:14:17 2013 UTC revision 2109 by vpihour, Mon Jul 22 14:13:01 2013 UTC
# Line 12  class donnees_techniques extends donnees Line 12  class donnees_techniques extends donnees
12          $this->constructeur($id,$db,$debug);          $this->constructeur($id,$db,$debug);
13      }// fin constructeur      }// fin constructeur
14    
   
15      /**      /**
16       * Méthode permettant de récupérer l'id du cerfa lié au dossier       * Méthode permettant de récupérer l'id du cerfa lié au dossier
17       **/       **/
18      function getCerfa(){      function getCerfa(){
19            if($this->getParameter("retourformulaire") == "lot") {
20                $sql = "SELECT cerfa_lot FROM ".DB_PREFIXE."dossier_instruction_type
21                    JOIN ".DB_PREFIXE."dossier ON dossier.dossier_instruction_type=
22                                    dossier_instruction_type.dossier_instruction_type
23                    JOIN ".DB_PREFIXE."lot ON dossier.dossier=lot.dossier
24                    WHERE lot.lot = ".$this->getParameter("idxformulaire");
25    
26          $sql = "SELECT cerfa FROM ".DB_PREFIXE."dossier_instruction_type          } else {
27                $sql = "SELECT cerfa  FROM ".DB_PREFIXE."dossier_instruction_type
28                  JOIN ".DB_PREFIXE."dossier ON dossier.dossier_instruction_type=                  JOIN ".DB_PREFIXE."dossier ON dossier.dossier_instruction_type=
29                                  dossier_instruction_type.dossier_instruction_type                                  dossier_instruction_type.dossier_instruction_type
30                  WHERE dossier = '".$this->getParameter("idxformulaire")."'";                  WHERE dossier = '";
31                    $sql .= $this->getParameter("idxformulaire")."'";
32            }
33    
34          $cerfa = $this->db->getOne($sql);          $cerfa = $this->db->getOne($sql);
35          $this->addToLog("db->getone(\"".$sql."\");", VERBOSE_MODE);          $this->f->addToLog("getCerfa() : db->getone(\"".$sql."\");", VERBOSE_MODE);
36          $this->f->isDatabaseError($cerfa);          if ( database::isError($cerfa)){
37                die();
38            }
39    
40          // Si le cerfa est défini dans dossier on instancie le cerfa correspondant          // Si le cerfa est défini dans dossier on instancie le cerfa correspondant
41          if(!empty($cerfa)) {          if(!empty($cerfa)) {
42              require_once ("../obj/cerfa.class.php");              require_once ("../obj/cerfa.class.php");
43              $this->cerfa = new cerfa($cerfa, $this->db, DEBUG);              $this->cerfa = new cerfa($cerfa, $this->db, DEBUG);
44                //On vérifie que le cerfa est en cours de validité
45                $date_debut = new DateTime($this->cerfa->getVal("om_validite_debut"));
46                $date_debut = $date_debut->format('Ymd');
47                
48                $date_fin = new DateTime($this->cerfa->getVal("om_validite_fin"));
49                $date_fin = $date_fin->format('Ymd');
50                
51                $date_aujourdhui = date('Ymd');
52                
53                // Teste si le cerfa est en cours de validité
54                $is_encours = true;
55                if ( $date_aujourdhui < $date_debut || $date_aujourdhui > $date_fin ){
56                    $is_encours = false;
57                }
58                
59                //Si le cerfa n'est pas en cours de validité, on affiche pas le formulaire
60                //et on affiche un message d'erreur
61                if ( $is_encours == false){
62                    $this->f->displayMessage("error", _("Aucun cerfa en cours de validite lie a ce dossier"));
63                    die();
64                }
65          } else {          } else {
66              $this->f->displayMessage("error", _("Aucun cerfa lié à ce type de dossier"));              $this->f->displayMessage("error", _("Aucun cerfa lie a ce type de dossier"));
67              die();              die();
68          }          }
69      }      }
70    
71        /**
72         * Méthode permettant de vérifier si le tableau passé en parametre est défini
73         * dans la table des cerfa
74         */
75    
76        function setTabSelect($tab, $idchamp) {
77            // Test si un tableau de surface a été défini
78            if ( $this->cerfa->getVal($idchamp) !=  "" ){
79                
80                // Configuration du tableau des surfaces
81                $contenu['column_header']=$tab[$this->cerfa->getVal($idchamp)]['column_header'];
82                $contenu['row_header']=$tab[$this->cerfa->getVal($idchamp)]['row_header'];
83        
84                foreach($tab[$this->cerfa->getVal($idchamp)]['values'] as $champ) {
85                    $contenu['values'][$champ] = $this->getVal($champ);
86                }
87        
88                $this->form->setSelect($idchamp,$contenu);
89            }
90        }
91    
92    
93      function setSelect(&$form, $maj,&$db,$debug) {      function setSelect(&$form, $maj,&$db,$debug) {
94          parent::setSelect($form, $maj,$db,$debug);          parent::setSelect($form, $maj,$db,$debug);
95          if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc.php"))          if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc.php"))
# Line 47  class donnees_techniques extends donnees Line 101  class donnees_techniques extends donnees
101              $this->getCerfa();              $this->getCerfa();
102          }          }
103    
104          // Configuration du tableau des surfaces          $this->setTabSelect($tab_surface, "tab_surface");
105          $contenu['column_header']=$tab_surface[$this->cerfa->getVal("tab_surface")]['column_header'];          $this->setTabSelect($tab_tax_su_princ, "tab_tax_su_princ");
106          $contenu['row_header']=$tab_surface[$this->cerfa->getVal("tab_surface")]['row_header'];          $this->setTabSelect($tab_tax_su_heber, "tab_tax_su_heber");
107            $this->setTabSelect($tab_tax_su_secon, "tab_tax_su_secon");
108          foreach($tab_surface[$this->cerfa->getVal("tab_surface")]['values'] as $champ) {          $this->setTabSelect($tab_tax_su_tot, "tab_tax_su_tot");
109              $contenu['values'][$champ] = $this->getVal($champ);          $this->setTabSelect($tab_tax_su_tot, "tab_tax_su_non_habit_surf");
110          }          $this->setTabSelect($tab_tax_am, "tab_tax_am");
111            
112          $form->setSelect("tab_surface",$contenu);          // Définition des champs Oui/Non/Je ne sais pas
113            $value[] = array("nesaispas","oui","non");
114            $value[] = array(_("Je ne sais pas"),_("Oui"),_("Non"));
115            
116            $form->setSelect('terr_juri_titul',$value);
117            $form->setSelect('terr_juri_lot',$value);
118            $form->setSelect('terr_juri_zac',$value);
119            $form->setSelect('terr_juri_afu',$value);
120            $form->setSelect('terr_juri_pup',$value);
121            $form->setSelect('terr_juri_oin',$value);
122            $form->setSelect('terr_juri_desc',$value);
123            $form->setSelect('terr_div_surf_etab',$value);
124            $form->setSelect('terr_div_surf_av_div',$value);
125    
126      }      }
127    
128    
129      // XXX Créer une nouvelle méthode au même endroit que l'appel a checkAccessibility()      // XXX Créer une nouvelle méthode au même endroit que l'appel a checkAccessibility()
130      function checkAccessibility() {      function checkAccessibility() {
131            if(file_exists ("../sql/".$this->db->phptype."/".$this->table.".form.inc.php"))
132                include ("../sql/".$this->db->phptype."/".$this->table.".form.inc.php");
133            elseif(file_exists ("../sql/".$this->db->phptype."/".$this->table.".form.inc"))
134                include ("../sql/".$this->db->phptype."/".$this->table.".form.inc");
135            if(empty($this->cerfa)) {
136                $this->getCerfa();
137            }
138    
139          unset($this->champs[array_search("su_avt_shon1",$this->champs)]);          $id_tab_surface = $this->cerfa->getVal("tab_surface");
140          unset($this->champs[array_search("su_avt_shon2",$this->champs)]);          $id_tab_tax_su_princ = $this->cerfa->getVal("tab_tax_su_princ");
141          unset($this->champs[array_search("su_avt_shon3",$this->champs)]);          $id_tab_tax_su_heber = $this->cerfa->getVal("tab_tax_su_heber");
142          unset($this->champs[array_search("su_avt_shon4",$this->champs)]);          $id_tab_tax_su_secon = $this->cerfa->getVal("tab_tax_su_secon");
143          unset($this->champs[array_search("su_avt_shon5",$this->champs)]);          $id_tab_tax_su_tot = $this->cerfa->getVal("tab_tax_su_tot");
144          unset($this->champs[array_search("su_avt_shon6",$this->champs)]);          $id_tab_tax_su_non_habit_surf = $this->cerfa->getVal("tab_tax_su_non_habit_surf");
145          unset($this->champs[array_search("su_avt_shon7",$this->champs)]);          $id_tab_tax_am = $this->cerfa->getVal("tab_tax_am");
146          unset($this->champs[array_search("su_avt_shon8",$this->champs)]);  
147          unset($this->champs[array_search("su_avt_shon9",$this->champs)]);          //Suppression des champs de tableaux
148          unset($this->champs[array_search("su_cstr_shon1",$this->champs)]);          if(!empty($id_tab_surface)) {
149          unset($this->champs[array_search("su_cstr_shon2",$this->champs)]);              foreach($tab_surface[$this->cerfa->getVal("tab_surface")]['values'] as $champ) {
150          unset($this->champs[array_search("su_cstr_shon3",$this->champs)]);                  unset($this->champs[array_search($champ,$this->champs)]);
151          unset($this->champs[array_search("su_cstr_shon4",$this->champs)]);              }
152          unset($this->champs[array_search("su_cstr_shon5",$this->champs)]);          }
153          unset($this->champs[array_search("su_cstr_shon6",$this->champs)]);          if(!empty($id_tab_tax_su_princ)) {
154          unset($this->champs[array_search("su_cstr_shon7",$this->champs)]);              foreach($tab_tax_su_princ[$this->cerfa->getVal("tab_tax_su_princ")]['values'] as $champ) {
155          unset($this->champs[array_search("su_cstr_shon8",$this->champs)]);                  unset($this->champs[array_search($champ,$this->champs)]);
156          unset($this->champs[array_search("su_cstr_shon9",$this->champs)]);              }
157          unset($this->champs[array_search("su_trsf_shon1",$this->champs)]);          }
158          unset($this->champs[array_search("su_trsf_shon2",$this->champs)]);          if(!empty($id_tab_tax_su_heber)) {
159          unset($this->champs[array_search("su_trsf_shon3",$this->champs)]);              foreach($tab_tax_su_heber[$this->cerfa->getVal("tab_tax_su_heber")]['values'] as $champ) {
160          unset($this->champs[array_search("su_trsf_shon4",$this->champs)]);                  unset($this->champs[array_search($champ,$this->champs)]);
161          unset($this->champs[array_search("su_trsf_shon5",$this->champs)]);              }
162          unset($this->champs[array_search("su_trsf_shon6",$this->champs)]);          }
163          unset($this->champs[array_search("su_trsf_shon7",$this->champs)]);          if(!empty($id_tab_tax_su_secon)) {
164          unset($this->champs[array_search("su_trsf_shon8",$this->champs)]);              foreach($tab_tax_su_secon[$this->cerfa->getVal("tab_tax_su_secon")]['values'] as $champ) {
165          unset($this->champs[array_search("su_trsf_shon9",$this->champs)]);                  unset($this->champs[array_search($champ,$this->champs)]);
166          unset($this->champs[array_search("su_chge_shon1",$this->champs)]);              }
167          unset($this->champs[array_search("su_chge_shon2",$this->champs)]);          }
168          unset($this->champs[array_search("su_chge_shon3",$this->champs)]);          if(!empty($id_tab_tax_su_tot)) {
169          unset($this->champs[array_search("su_chge_shon4",$this->champs)]);              foreach($tab_tax_su_tot[$this->cerfa->getVal("tab_tax_su_tot")]['values'] as $champ) {
170          unset($this->champs[array_search("su_chge_shon5",$this->champs)]);                  unset($this->champs[array_search($champ,$this->champs)]);
171          unset($this->champs[array_search("su_chge_shon6",$this->champs)]);              }
172          unset($this->champs[array_search("su_chge_shon7",$this->champs)]);          }
173          unset($this->champs[array_search("su_chge_shon8",$this->champs)]);          if(!empty($id_tab_tax_su_non_habit_surf)) {
174          unset($this->champs[array_search("su_chge_shon9",$this->champs)]);              foreach($tab_tax_su_non_habit_surf[$this->cerfa->getVal("tab_tax_su_non_habit_surf")]['values'] as $champ) {
175          unset($this->champs[array_search("su_demo_shon1",$this->champs)]);                  unset($this->champs[array_search($champ,$this->champs)]);
176          unset($this->champs[array_search("su_demo_shon2",$this->champs)]);              }
177          unset($this->champs[array_search("su_demo_shon3",$this->champs)]);          }
178          unset($this->champs[array_search("su_demo_shon4",$this->champs)]);          if(!empty($id_tab_tax_am)) {
179          unset($this->champs[array_search("su_demo_shon5",$this->champs)]);              foreach($tab_tax_am[$this->cerfa->getVal("tab_tax_am")]['values'] as $champ) {
180          unset($this->champs[array_search("su_demo_shon6",$this->champs)]);                  unset($this->champs[array_search($champ,$this->champs)]);
181          unset($this->champs[array_search("su_demo_shon7",$this->champs)]);              }
182          unset($this->champs[array_search("su_demo_shon8",$this->champs)]);          }
         unset($this->champs[array_search("su_demo_shon9",$this->champs)]);  
         unset($this->champs[array_search("su_sup_shon1",$this->champs)]);  
         unset($this->champs[array_search("su_sup_shon2",$this->champs)]);  
         unset($this->champs[array_search("su_sup_shon3",$this->champs)]);  
         unset($this->champs[array_search("su_sup_shon4",$this->champs)]);  
         unset($this->champs[array_search("su_sup_shon5",$this->champs)]);  
         unset($this->champs[array_search("su_sup_shon6",$this->champs)]);  
         unset($this->champs[array_search("su_sup_shon7",$this->champs)]);  
         unset($this->champs[array_search("su_sup_shon8",$this->champs)]);  
         unset($this->champs[array_search("su_sup_shon9",$this->champs)]);  
         unset($this->champs[array_search("su_tot_shon1",$this->champs)]);  
         unset($this->champs[array_search("su_tot_shon2",$this->champs)]);  
         unset($this->champs[array_search("su_tot_shon3",$this->champs)]);  
         unset($this->champs[array_search("su_tot_shon4",$this->champs)]);  
         unset($this->champs[array_search("su_tot_shon5",$this->champs)]);  
         unset($this->champs[array_search("su_tot_shon6",$this->champs)]);  
         unset($this->champs[array_search("su_tot_shon7",$this->champs)]);  
         unset($this->champs[array_search("su_tot_shon8",$this->champs)]);  
         unset($this->champs[array_search("su_tot_shon9",$this->champs)]);  
         unset($this->champs[array_search("su_avt_shon_tot",$this->champs)]);  
         unset($this->champs[array_search("su_cstr_shon_tot",$this->champs)]);  
         unset($this->champs[array_search("su_trsf_shon_tot",$this->champs)]);  
         unset($this->champs[array_search("su_chge_shon_tot",$this->champs)]);  
         unset($this->champs[array_search("su_demo_shon_tot",$this->champs)]);  
         unset($this->champs[array_search("su_sup_shon_tot",$this->champs)]);  
         unset($this->champs[array_search("su_tot_shon_tot",$this->champs)]);  
183          // Renumérotation          // Renumérotation
184          $this->champs = array_values($this->champs);          $this->champs = array_values($this->champs);
185            
186            $idxformulaire = $this->getParameter("idxformulaire");
187            //Si le dossier d'instruction auquel sont rattachées les données techniques
188            //est cloturé, on affiche pas le lien de modification du portlet
189            if ( $idxformulaire != '' ){
190                    
191                //On récuppère le statut du dossier d'instruction        
192                $statut = $this->f->getStatutDossier($idxformulaire);
193                if ( $this->f->isUserInstructeur() && $statut == "cloture" ){
194                    
195                    //On cache le lien de modification
196                    $this->parameters["actions"]["modifier"] = NULL;
197                }
198            }
199        }
200        
201        /**
202         * Cette methode est à surcharger elle permet de tester dans chaque classe
203         * des droits spécifiques en fonction des données
204         */
205        function canAccess() {
206            // Si l'utilisateur est un instructeur et que le dossier est cloturé
207            if ( $this->f->isUserInstructeur() &&
208                $this->f->getStatutDossier($this->getParameter("idxformulaire")) == "cloture"
209                && $this->getParameter("maj") != 3) {
210                
211                return false;
212            }
213            //
214            return true;
215        }
216        
217        /**
218         * Méthode permettant de définir le type des différents tableaux en fonction
219         * des valeurs du cerfa
220         **/
221        function setTabType($tab) {
222            // Définition du type "tableau"
223            if ( $this->cerfa->getVal($tab) !=  "" ){
224                
225                $this->form->setType($tab,'tableau');
226            }
227            //Le chache si non défini
228            else {
229                
230                $this->form->setType($tab,'hidden');
231            }
232      }      }
233    
234        /**
235         * Méthode permettant de définir le type des champs des tableaux en fonction
236         * des valeurs du cerfa
237         **/
238        function setTabChampType($tab) {
239            if(file_exists ("../sql/".$this->db->phptype."/".$this->table.".form.inc.php"))
240                include ("../sql/".$this->db->phptype."/".$this->table.".form.inc.php");
241            elseif(file_exists ("../sql/".$this->db->phptype."/".$this->table.".form.inc"))
242                include ("../sql/".$this->db->phptype."/".$this->table.".form.inc");
243            // Pour chaque champ dans la liste des champs du cerfa
244            $tableau = $$tab;
245    
246            foreach ($this->champs as $champ) {
247                if(array_search($champ, $this->cerfa->champs) !== false) {
248                    // On les cache si décoché dans le formulaire de cerfa
249                    if($this->cerfa->getVal($champ) == 'f') {
250                        $this->form->setType($champ,'hidden');
251                    }
252                } else {
253                    
254                    if(!in_array($champ, $tableau[$this->cerfa->getVal($tab)]['values'])) {
255    
256                        $this->form->setType($champ,'hidden');
257                    }
258                }
259            }
260        }
261    
262    
263    
264      function setType(&$form,$maj) {      function setType(&$form,$maj) {
265          parent::setType($form,$maj);          parent::setType($form,$maj);
266    
# Line 149  class donnees_techniques extends donnees Line 272  class donnees_techniques extends donnees
272          if(empty($this->cerfa)) {          if(empty($this->cerfa)) {
273              $this->getCerfa();              $this->getCerfa();
274          }          }
         // Définition du type "tableau"  
         $form->setType('tab_surface','tableau');  
275    
276          $form->setType('dossier_instruction', 'hidden');          $this->setTabType("tab_surface");
277            $this->setTabType("tab_tax_su_princ");
278            $this->setTabType("tab_tax_su_heber");
279            $this->setTabType("tab_tax_su_secon");
280            $this->setTabType("tab_tax_su_tot");
281            $this->setTabType("tab_tax_su_non_habit_surf");
282            $this->setTabType("tab_tax_am");
283    
284            //Champs select pour les liste a choix oui/non/je ne sais pas (terr_*)
285            if($maj == 0) {
286                $form->setType('terr_juri_titul','select');
287                $form->setType('terr_juri_lot','select');
288                $form->setType('terr_juri_zac','select');
289                $form->setType('terr_juri_afu','select');
290                $form->setType('terr_juri_pup','select');
291                $form->setType('terr_juri_oin','select');
292    
293            } elseif($maj == 1) {
294                $form->setType('terr_juri_titul','select');
295                $form->setType('terr_juri_lot','select');
296                $form->setType('terr_juri_zac','select');
297                $form->setType('terr_juri_afu','select');
298                $form->setType('terr_juri_pup','select');
299                $form->setType('terr_juri_oin','select');
300    
301            } elseif($maj == 2) {
302                $form->setType('terr_juri_titul','selectstatic');
303                $form->setType('terr_juri_lot','selectstatic');
304                $form->setType('terr_juri_zac','selectstatic');
305                $form->setType('terr_juri_afu','selectstatic');
306                $form->setType('terr_juri_pup','selectstatic');
307                $form->setType('terr_juri_oin','selectstatic');
308    
309            } elseif($maj == 3) {
310                $form->setType('terr_juri_titul','selectstatic');
311                $form->setType('terr_juri_lot','selectstatic');
312                $form->setType('terr_juri_zac','selectstatic');
313                $form->setType('terr_juri_afu','selectstatic');
314                $form->setType('terr_juri_pup','selectstatic');
315                $form->setType('terr_juri_oin','selectstatic');
316    
317            }
318    
319    
320            //Cache les champs des clés étrangères, elles sont renseignées automatiquement
321            $form->setType('dossier_instruction', 'hidden');
322            $form->setType('lot', 'hidden');
323            
324          // Boucler sur les champs du cerfa pour cacher les données qui ne doivent          // Boucler sur les champs du cerfa pour cacher les données qui ne doivent
325          // pas être saisies          // pas être saisies
326    
327          foreach ($this->cerfa->champs as $champ) {          foreach ($this->champs as $champ) {
328              if(array_search($champ, $this->champs) !== false) {              if(array_search($champ, $this->cerfa->champs) !== false) {
329                  if($this->cerfa->getVal($champ) == 'f') {                  if($this->cerfa->getVal($champ) == 'f') {
330                      $form->setType($champ,'hidden');                      $form->setType($champ,'hidden');
331                  }                  }
332                } else {
333                    $id_tab_surface = $this->cerfa->getVal("tab_surface");
334                    $id_tab_tax_su_princ = $this->cerfa->getVal("tab_tax_su_princ");
335                    $id_tab_tax_su_heber = $this->cerfa->getVal("tab_tax_su_heber");
336                    $id_tab_tax_su_secon = $this->cerfa->getVal("tab_tax_su_secon");
337                    $id_tab_tax_su_tot = $this->cerfa->getVal("tab_tax_su_tot");
338                    $id_tab_tax_su_non_habit_surf = $this->cerfa->getVal("tab_tax_su_non_habit_surf");
339                    $id_tab_tax_am = $this->cerfa->getVal("tab_tax_am");
340                    $hidden = true;
341    
342                    // On cache tous les champs
343                    $form->setType($champ,'hidden');
344    
345                    // On défini l'affichage des champs des tableaux de configuration
346                    // Si les tableau sont définis dans le cerfa on test si les champs des données
347                    // techniques sont définis dans les tableaux de configuration des tableaux
348                    // pour chaque cerfa  alors on les affiche en type "text"
349                    if(!empty($id_tab_surface)) {
350                        if(in_array($champ, $tab_surface[$this->cerfa->getVal("tab_surface")]['values'])) {
351                            $hidden = false;
352                        }
353                    }
354                    if(!empty($id_tab_tax_su_princ)) {
355                        if(in_array($champ, $tab_tax_su_princ[$this->cerfa->getVal("tab_tax_su_princ")]['values'])) {
356                            $hidden = false;
357                        }
358                    }
359                    if(!empty($id_tab_tax_su_heber)) {
360                        if(in_array($champ, $tab_tax_su_heber[$this->cerfa->getVal("tab_tax_su_heber")]['values'])) {
361                            $hidden = false;
362                        }
363                    }
364                    if(!empty($id_tab_tax_su_secon)) {
365                        if(in_array($champ, $tab_tax_su_secon[$this->cerfa->getVal("tab_tax_su_secon")]['values'])) {
366                            $hidden = false;
367                        }
368                    }
369                    if(!empty($id_tab_tax_su_tot)) {
370                        if(in_array($champ, $tab_tax_su_tot[$this->cerfa->getVal("tab_tax_su_tot")]['values'])) {
371                            $hidden = false;
372                        }
373                    }
374                    if(!empty($id_tab_tax_su_non_habit_surf)) {
375                        if(in_array($champ, $tab_tax_su_non_habit_surf[$this->cerfa->getVal("tab_tax_su_non_habit_surf")]['values'])) {
376                            $hidden = false;
377                        }
378                    }
379                    if(!empty($id_tab_tax_am)) {
380                        if(in_array($champ, $tab_tax_am[$this->cerfa->getVal("tab_tax_am")]['values'])) {
381                            $hidden = false;
382                        }
383                    }
384    
385                    if(!$hidden){
386                        if($maj < 2) {
387                            $form->setType($champ,'text');
388                        } else {
389                            $form->setType($champ,'static');
390                        }
391                        
392                    }
393              }              }
394          }          }
395      }      }
396    
397        // Ajout des clés étrangères
398      function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire,&$db,$DEBUG=null){      function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire,&$db,$DEBUG=null){
399          $this->retourformulaire = $retourformulaire;          $this->retourformulaire = $retourformulaire;
400          if($validation == 0) {          if($validation == 0) {
401              if($retourformulaire =='dossier')              
402                //Si on est dans le dossier
403                if($retourformulaire =='dossier' || $retourformulaire =='dossier_instruction' ) {
404                    
405                  $form->setVal('dossier_instruction', $idxformulaire);                  $form->setVal('dossier_instruction', $idxformulaire);
406              if($retourformulaire =='dossier_instruction')                  $form->setVal('lot', "");
407                  $form->setVal('dossier_instruction', $idxformulaire);              }
408              if($retourformulaire =='lot')              
409                //Si on est dans le lot
410                if($retourformulaire =='lot') {
411                    
412                    $form->setVal('dossier_instruction', "");
413                  $form->setVal('lot', $idxformulaire);                  $form->setVal('lot', $idxformulaire);
414                }
415          }// fin validation          }// fin validation
416      }// fin setValsousformulaire      }// fin setValsousformulaire
417    
418        function setLib(&$form,$maj) {
419            parent::setLib($form,$maj);
420            //libelle des champs
421            $form->setLib('tab_surface', "");
422            $form->setLib('tab_tax_su_princ', "");
423            $form->setLib('tab_tax_su_heber', "");
424            $form->setLib('tab_tax_su_secon', "");
425            $form->setLib('tab_tax_su_tot', "");
426            $form->setLib('tab_tax_su_non_habit_surf', "");
427            $form->setLib('tab_tax_am', "");
428        }
429    
430        function setLayout(&$form, $maj) {
431                    /*Fieldset Parametrage du cerfa */
432            $form->setBloc('cerfa','D',"","col_12");
433                $form->setFieldset('cerfa','D'
434                                   ,_("Parametrage du cerfa"));
435                    
436    
437                $form->setFieldset('om_validite_fin','F','');
438            $form->setBloc('om_validite_fin','F');
439    
440            $form->setBloc('terr_juri_titul','D',"","col_12");
441                $form->setFieldset('terr_juri_titul','D'
442                                   ,_("Terrain"));
443                    $form->setBloc('terr_juri_titul','D',_("Situation juridique du terrain"),"col_12");
444                    $form->setBloc('terr_juri_desc','F');
445                    $form->setBloc('terr_div_surf_etab','D',_("Terrain issu d'une division de propriete"),"col_12");
446                    $form->setBloc('terr_div_surf_av_div','F');
447    
448                $form->setFieldset('terr_div_surf_av_div','F','');
449            $form->setBloc('terr_div_surf_av_div','F');
450    
451            $form->setBloc('avap_co_elt_pro','D',"","col_12");
452                $form->setFieldset('avap_co_elt_pro','D'
453                                   ,_("Projet"));
454                    
455    
456                $form->setFieldset('avap_aut_auv_elec','F','');
457            $form->setBloc('avap_aut_auv_elec','F');
458    
459    
460            $form->setBloc('tr_total','D',"","col_12");
461                $form->setFieldset('tr_total','D'
462                                   ,_("Projet"));
463                    
464    
465                $form->setFieldset('tr_desc','F','');
466            $form->setBloc('tr_desc','F');
467    
468            /*Fieldset n°4 Ouverture de chantier */
469            $form->setBloc('doc_date','D',"","col_12");
470                $form->setFieldset('doc_date','D'
471                                   ,_("Ouverture de chantier"));
472    
473                $form->setFieldset('doc_nb_log_autre','F','');
474            $form->setBloc('doc_nb_log_autre','F');
475    
476            /*Fieldset n°4  Achèvement des travaux */
477            $form->setBloc('daact_date','D',"","col_12");
478                $form->setFieldset('daact_date','D'
479                                   ,_("Achevement des travaux"));
480    
481                $form->setFieldset('daact_nb_log_autre','F','');
482            $form->setBloc('daact_nb_log_autre','F');
483    
484            /*Fieldset n°4 Projet d'aménagement */
485            $form->setBloc('am_lotiss','D',"","col_12");
486                $form->setFieldset('am_lotiss','D'
487                                   ,_("Projet d'amenagement"));
488                    // bloc 4.1
489                    $form->setBloc('am_lotiss','D',_("Nature des travaux, instalations
490                                   ou amenagements envisages"),"col_12");
491    
492                    $form->setBloc('am_tranche_desc','F');
493                    
494                    // bloc 4.2
495                    $form->setBloc('am_lot_max_nb','D',_("Demande concernant un lotissement"),"col_12");
496    
497                    $form->setBloc('am_lot_vente_ant','F');
498    
499                    // bloc 4.3
500                    $form->setBloc('am_empl_nb','D',_("Amenagement d'un camping ou
501                                   d'un terrain amenage en vue de l'hebergement
502                                   touristique"),"col_12");
503    
504                    $form->setBloc('am_exist_agrand','F');
505    
506                $form->setFieldset('am_coupe_autr','F','');
507            
508            $form->setBloc('am_coupe_autr','F');
509    
510            /*Fieldset n°5 Projet de construction */
511            $form->setBloc('co_archi_recours','D',"","col_12");
512                $form->setFieldset('co_archi_recours','D'
513                                   ,_("Projet de construction"));
514                    // bloc 5.1
515                    $form->setBloc('co_archi_recours','D',_("Architecte"),"col_12");
516                    
517                        $form->setBloc('co_archi_recours','DF', "","group");
518                        
519                        $form->setBloc('co_archi_nom','D', "","group");
520                        $form->setBloc('co_archi_prenom','F');
521                        
522                        $form->setBloc('co_archi_adr_num','D', "","group");
523                        $form->setBloc('co_archi_adr_voie','F');
524    
525                        $form->setBloc('co_archi_adr_lieu_dit','D', "","group");
526                        $form->setBloc('co_archi_adr_localite','F');
527                        
528                        $form->setBloc('co_archi_adr_cp','D', "","group");
529                        $form->setBloc('co_archi_adr_cedex','F');
530                        
531                        $form->setBloc('co_archi_no_incri','DF', "","group");
532                        
533                        $form->setBloc('co_archi_cg','DF', "","group");
534                        
535                        $form->setBloc('co_archi_tel1','D', "","group");
536                        $form->setBloc('co_archi_tel2','F');
537                        
538                        $form->setBloc('co_archi_mail','DF', "","group");
539    
540                    $form->setBloc('co_archi_mail','F');
541                    
542                    // bloc 5.2
543                    $form->setBloc('co_cstr_nouv','D',_("Nature du projet"),"col_12");
544    
545                    $form->setBloc('co_elec_tension','F');
546    
547                    // bloc 5.3
548                    $form->setBloc('co_tot_log_nb','D',_("Informations complementaires"),"col_12");
549    
550                    $form->setBloc('co_trx_nivsup','F');
551    
552                    // bloc 5.4
553                    $form->setBloc('co_demont_period','D',_("Construction periodiquement
554                                   demontee et re-installee"),"col_12");
555    
556                    $form->setBloc('co_demont_period','F');
557    
558                    // bloc 5.5
559                    $form->setBloc('tab_surface','D',_("Destination des constructions
560                                   et tableau des surfaces"),"col_12");
561    
562                    $form->setBloc('tab_surface','F');
563    
564                    // bloc 5.6
565                    $form->setBloc('co_sp_transport','D',_("Destination des constructions
566                                   futures en cas de realisation au benefice d'un
567                                   service public ou d'interet collectif"),"col_12");
568    
569                    $form->setBloc('co_sp_culture','F');
570    
571                    // bloc 5.7
572                    $form->setBloc('co_statio_avt_nb','D',_("Stationnement"),"col_12");
573    
574                    $form->setBloc('co_statio_comm_cin_surf','F');
575    
576                $form->setFieldset('co_statio_apr_surf','F','');
577            
578            $form->setBloc('co_statio_apr_surf','F');
579    
580            // Description de modification
581            $form->setBloc('mod_desc','D',"","col_12");
582                $form->setFieldset('mod_desc','D'
583                                   ,_("Objet de la modification"));
584                $form->setFieldset('mod_desc','F','');
585            $form->setBloc('mod_desc','F');
586            
587            /*Fieldset n°6 Projet necessitant demolitions */
588            $form->setBloc('dm_constr_dates','D',"","col_12");
589                $form->setFieldset('dm_constr_dates','D'
590                                   ,_("Projet necessitant demolitions"));
591    
592                    $form->setBloc('dm_constr_dates','D',"","col_12");
593    
594                    $form->setBloc('dm_tot_log_nb','F');
595    
596                $form->setFieldset('dm_tot_log_nb','F','');
597            
598            $form->setBloc('dm_tot_log_nb','F');
599    
600            $form->setBloc('tax_surf_tot','D',_("Declaration des elements necessaires au calcul des impositions"),"col_12");
601            $form->setBloc('tax_surf_tot','D',"","col_12");
602                $form->setFieldset('tax_surf_tot','D'
603                                   ,_("Renseignement"));
604    
605                    $form->setBloc('tax_surf_tot','D',"","col_12");
606    
607                    $form->setBloc('tax_dest_loc_tr','F');
608    
609                    $form->setBloc('tab_tax_su_princ','D',_("Locaux a usage d'habitation principale"),"col_12");
610                    $form->setBloc('tab_tax_su_princ','F');
611    
612                    $form->setBloc('tab_tax_su_heber','D',_("Locaux a usage d'hebergement"),"col_12");
613                    $form->setBloc('tab_tax_su_heber','F');
614    
615                    $form->setBloc('tab_tax_su_secon','D',_("Locaux a usage d'habitation secondaire"),"col_12");
616                    $form->setBloc('tab_tax_su_secon','F');
617    
618                    $form->setBloc('tab_tax_su_tot','D',_("Total de logement"),"col_12");
619                    $form->setBloc('tab_tax_su_tot','F');
620    
621                    $form->setBloc('tax_ext_pret','D',"","col_12");
622                    $form->setBloc('tax_log_exist_nb','F');
623    
624                    $form->setBloc('tax_comm_nb','D',_("Creation ou extension de locaux non destines a l'habitation"),"col_12");
625                    $form->setBloc('tab_tax_su_non_habit_surf','F');
626    
627                    $form->setBloc('tab_tax_am','D',_("Autres elements soumis a la taxe d'amenagement"),"col_12");
628                    $form->setBloc('tab_tax_am','F');
629    
630                    $form->setBloc('tax_trx_presc_ppr','D',_("Cas particuliers"),"col_12");
631                    $form->setBloc('tax_monu_hist','F');
632    
633                $form->setFieldset('tax_monu_hist','F','');
634            
635            $form->setBloc('tax_monu_hist','F');
636    
637            $form->setBloc('vsd_surf_planch_smd','D',"","col_12");
638                $form->setFieldset('vsd_surf_planch_smd','D'
639                                   ,_("Autres renseignements"));
640    
641                    $form->setBloc('vsd_surf_planch_smd','D',_("Versement pour sous-densite (VSD)"),"col_12");
642                    $form->setBloc('vsd_rescr_fisc','F');
643    
644                    $form->setBloc('pld_val_terr','D',_("Plafond legal de densite (PLD)"),"col_12");
645                    $form->setBloc('pld_const_exist_dem_surf','F');
646    
647                $form->setFieldset('pld_const_exist_dem_surf','F','');
648            
649            $form->setBloc('pld_const_exist_dem_surf','F');
650    
651            $form->setBloc('pld_const_exist_dem_surf','F');
652        }
653    
654    
655        
656        /**
657         * Surcharge du bouton retour afin de retourner sur le dossier d'instruction selon de cas
658         */
659        function retoursousformulaire($idxformulaire, $retourformulaire, $val,
660                                      $objsf, $premiersf, $tricolsf, $validation,
661                                      $idx, $maj, $retour) {
662    
663            $visualisation = $this->getParameter('visualisation');
664            
665            if ( $visualisation == "" ){
666                
667                // Ajout et consultation, retour dossier
668                if ( ( $maj == 0 && $validation == 0 ) ||
669                    ( $maj == 3 && $validation == 0 ) ||
670                    ( $maj == 0 && $validation == 1 )  && $retourformulaire == "dossier_instruction" ){
671                
672                    echo "\n<a class=\"retour\" ";
673                        echo "href=\"#\" ";
674                        echo "onclick=\"redirectPortletAction(1,'main');\" ";
675                        echo ">";
676                        echo _("Retour");
677                    echo "</a>\n";
678                }
679                //Sinon affiche un retour normal
680                else{
681                    
682                    parent::retoursousformulaire($idxformulaire, $retourformulaire, $val,
683                                          $objsf, $premiersf, $tricolsf, $validation,
684                                          $idx, $maj, $retour);
685                }
686            }
687        }
688    
689        /**
690         * Cette variable permet de stocker le résultat de la méthode
691         * getDivisionFromDossier() afin de ne pas effectuer le recalcul à chacun de
692         * ces appels.
693         * @var string Code de la division du dossier en cours
694         */
695        var $_division_from_dossier = NULL;
696    
697        /**
698         * Cette méthode permet de récupérer le code de division correspondant
699         * au dossier sur lequel on se trouve.
700         *
701         * @return string Code de la division du dossier en cours
702         */
703        function getDivisionFromDossier() {
704    
705            // Cette méthode peut être appelée plusieurs fois lors d'une requête.
706            // Pour éviter de refaire le traitement de recherche de la division
707            // alors on vérifie si nous ne l'avons pas déjà calculé.
708            if ($this->_division_from_dossier != NULL) {
709                // Logger
710                $this->addToLog("getDivisionFromDossier(): retour de la valeur déjà calculée - '".$this->_division_from_dossier."'", EXTRA_VERBOSE_MODE);
711                // On retourne la valeur déjà calculée
712                return $this->_division_from_dossier;
713            }
714    
715            // Par défaut, on définit la valeur du dossier à NULL
716            $dossier = NULL;
717            // Test sur le mode et le contexte du formulaire
718            if ($this->getParameter("maj") == 0
719                && ($this->getParameter("retourformulaire") == "dossier"
720                    || $this->getParameter("retourformulaire") == "dossier_instruction"
721                    || $this->getParameter("retourformulaire") == "dossier_instruction_mes_encours"
722                    || $this->getParameter("retourformulaire") == "dossier_instruction_tous_encours"
723                    || $this->getParameter("retourformulaire") == "dossier_instruction_mes_clotures"
724                    || $this->getParameter("retourformulaire") == "dossier_instruction_tous_clotures")) {
725                // Si on se trouve en mode AJOUT (seul mode où l'enregistrement
726                // n'existe pas en base de données) ET que nous nous trouvons
727                // dans le contexte d'un dossier d'instruction alors on récupère
728                // le numéro de dossier depuis le paramètre 'idxformulaire'
729                $dossier = $this->getParameter("idxformulaire");
730            } else {
731                // Sinon on récupère le numéro de dossier dans le champs dossier de
732                // l'enregistrement (en base de données)
733                $dossier = $this->getVal("dossier");
734            }
735    
736            // On appelle la méthode de la classe utils qui renvoi le code de la
737            // division d'un dossier, on la stocke pour ne pas refaire le calcul au
738            // prochain appel de cette méthode
739            $this->_division_from_dossier = $this->f->getDivisionFromDossier($dossier);
740            // Logger
741            $this->addToLog("getDivisionFromDossier(): retour de la valeur nouvellement calculée - '".$this->_division_from_dossier."'", EXTRA_VERBOSE_MODE);
742            // On retourne la valeur retournée
743            return $this->_division_from_dossier;
744    
745        }
746  }// fin classe  }// fin classe
 ?>  
747    ?>

Legend:
Removed from v.1263  
changed lines
  Added in v.2109

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26