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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3730 - (hide annotations)
Fri Mar 18 11:50:26 2016 UTC (8 years, 10 months ago) by mbroquet
File size: 60875 byte(s)
Actualisation du trunk
1 mbroquet 3730 <?php
2     //$Id: donnees_techniques.class.php 5856 2016-02-03 11:35:25Z stimezouaght $
3     //gen openMairie le 13/02/2013 14:41
4    
5     require_once ("../gen/obj/donnees_techniques.class.php");
6    
7     class donnees_techniques extends donnees_techniques_gen {
8    
9     var $cerfa; // Instance de la classe cerfa
10    
11     /**
12     * Instance de la classe dossier.
13     *
14     * @var null
15     */
16     var $inst_dossier = null;
17    
18     /** @var boolean Les nouvelles actions sont activées sur cet objet */
19     var $activate_class_action;
20    
21     function donnees_techniques($id, &$db = null, $debug = null) {
22     //On active les nouvelles actions
23     $this->activate_class_action = true;
24     $this->constructeur($id,$db,$debug);
25     }// fin constructeur
26    
27     /**
28     * Définition des actions disponibles sur la classe.
29     *
30     * @return void
31     */
32     function init_class_actions() {
33    
34     // On récupère les actions génériques définies dans la méthode
35     // d'initialisation de la classe parente
36     parent::init_class_actions();
37    
38     // ACTION - 001 - modifier
39     //
40     $this->class_actions[1]["condition"] = "is_editable";
41    
42     // ACTION - 002 - supprimer
43     //
44     $this->class_actions[2]["condition"] = "is_deletable";
45     }
46    
47     /**
48     * CONDITION - is_deletable.
49     *
50     * Condition pour afficher le bouton de suppression.
51     *
52     * @return boolean
53     */
54     function is_deletable() {
55    
56     // Si c'est un sous-formulaire du dossier d'autorisation
57     if ($this->getParameter("retourformulaire") == 'dossier_autorisation'
58     || $this->getParameter("retourformulaire") == 'dossier_autorisation_avis') {
59    
60     //
61     return false;
62     }
63    
64     // Contrôle si l'utilisateur possède un bypass
65     $bypass = $this->f->isAccredited(get_class()."_supprimer_bypass");
66     //
67     if ($bypass == true) {
68    
69     //
70     return true;
71     }
72    
73     // Si l'utilisateur est un intructeur qui ne correspond pas à la
74     // division du dossier
75     if ($this->f->isUserInstructeur()
76     && $this->f->om_utilisateur["division"] != $this->getDivisionFromDossier()) {
77    
78     //
79     return false;
80     }
81    
82     // Si l'utilisateur est un instructeur et que le dossier est cloturé
83     if ($this->f->isUserInstructeur()
84     && $this->getParameter("idxformulaire") != ''
85     && $this->f->getStatutDossier($this->getParameter("idxformulaire")) == "cloture") {
86    
87     //
88     return false;
89     }
90    
91     //
92     return true;
93     }
94    
95     /**
96     * CONDITION - is_editable.
97     *
98     * Condition pour afficher le bouton de modification.
99     *
100     * @return boolean
101     */
102     function is_editable() {
103    
104     // Si c'est un sous-formulaire du dossier d'autorisation
105     if ($this->getParameter("retourformulaire") == 'dossier_autorisation'
106     || $this->getParameter("retourformulaire") == 'dossier_autorisation_avis') {
107    
108     //
109     return false;
110     }
111    
112     // Contrôle si l'utilisateur possède un bypass
113     $bypass = $this->f->isAccredited(get_class()."_modifier_bypass");
114     //
115     if ($bypass == true) {
116    
117     //
118     return true;
119     }
120    
121     // Si l'utilisateur est un intructeur qui ne correspond pas à la
122     // division du dossier
123     if ($this->f->isUserInstructeur()
124     && $this->f->om_utilisateur["division"] != $this->getDivisionFromDossier()) {
125    
126     //
127     return false;
128     }
129    
130     // Si l'utilisateur est un instructeur et que le dossier est cloturé
131     if ($this->f->isUserInstructeur()
132     && $this->getParameter("idxformulaire") != ''
133     && $this->f->getStatutDossier($this->getParameter("idxformulaire")) == "cloture") {
134    
135     //
136     return false;
137     }
138    
139     //
140     return true;
141     }
142    
143     /**
144     * Méthode permettant de récupérer l'id du cerfa lié au dossier.
145     *
146     * @return cerfa handler du cerfa
147     */
148     function getCerfa() {
149     if($this->cerfa != null) {
150     return $this->cerfa;
151     }
152     require_once ("../obj/cerfa.class.php");
153     $this->cerfa = new cerfa($this->getVal("cerfa"), $this->db, DEBUG);
154     return $this->cerfa;
155     }
156    
157     /**
158     * Méthode permettant de vérifier si le tableau passé en parametre est défini
159     * dans la table des cerfa
160     */
161    
162     function setTabSelect($tab, $idchamp) {
163     // Test si un tableau de surface a été défini
164     if ( $this->cerfa->getVal($idchamp) != "" ){
165    
166     // Configuration du tableau des surfaces
167     $contenu['column_header']=$tab[$this->cerfa->getVal($idchamp)]['column_header'];
168     $contenu['row_header']=$tab[$this->cerfa->getVal($idchamp)]['row_header'];
169    
170     foreach($tab[$this->cerfa->getVal($idchamp)]['values'] as $champ) {
171     $contenu['values'][$champ] = $this->getVal($champ);
172     }
173    
174     $this->form->setSelect($idchamp,$contenu);
175     }
176     }
177    
178    
179     function setSelect(&$form, $maj,&$db,$debug) {
180     if(file_exists ("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc.php"))
181     include ("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc.php");
182     elseif(file_exists ("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc"))
183     include ("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc");
184    
185     if(empty($this->cerfa)) {
186     $this->getCerfa();
187     }
188    
189     $this->setTabSelect($tab_surface, "tab_surface");
190     $this->setTabSelect($tab_tax_su_princ, "tab_tax_su_princ");
191     $this->setTabSelect($tab_tax_su_heber, "tab_tax_su_heber");
192     $this->setTabSelect($tab_tax_su_secon, "tab_tax_su_secon");
193     $this->setTabSelect($tab_tax_su_tot, "tab_tax_su_tot");
194     $this->setTabSelect($tab_tax_su_non_habit_surf, "tab_tax_su_non_habit_surf");
195     $this->setTabSelect($tab_tax_su_parc_statio_expl_comm, "tab_tax_su_parc_statio_expl_comm");
196     $this->setTabSelect($tab_tax_am, "tab_tax_am");
197     $this->setTabSelect($tab_erp_eff, "tab_erp_eff");
198    
199     // Définition des champs Oui/Non/Je ne sais pas
200     $value[] = array(
201     "nesaispas",
202     "non",
203     "oui",
204     );
205     $value[] = array(
206     _("Je ne sais pas"),
207     _("Non"),
208     _("Oui"),
209     );
210    
211     $form->setSelect('terr_juri_titul',$value);
212     $form->setSelect('terr_juri_lot',$value);
213     $form->setSelect('terr_juri_zac',$value);
214     $form->setSelect('terr_juri_afu',$value);
215     $form->setSelect('terr_juri_pup',$value);
216     $form->setSelect('terr_juri_oin',$value);
217     $form->setSelect('terr_juri_desc',$value);
218     $form->setSelect('terr_div_surf_etab',$value);
219     $form->setSelect('terr_div_surf_av_div',$value);
220    
221     //
222     $this->init_select($form, $this->f->db, $maj, null, "erp_class_cat", $sql_erp_class_cat, $sql_erp_class_cat_by_id, false);
223     //
224     $this->init_select($form, $this->f->db, $maj, null, "erp_class_type", $sql_erp_class_type, $sql_erp_class_type_by_id, false);
225    
226    
227     //Récupérer le nom et le prénom de l'architecte
228     $coordonneesArchitecte = $this->getPrenomNomArchitecte($this->getVal('architecte'));
229     $value = "";
230     if ($maj<2){
231     $value = array(
232     "data" => $coordonneesArchitecte,
233     "obj" => "architecte",
234     );
235     }
236     else {
237     $value[0][0]=$this->getVal('architecte');
238     $value[1][0]=$coordonneesArchitecte;// table
239     }
240     $form->setSelect('architecte', $value);
241     }
242    
243    
244     // XXX Créer une nouvelle méthode au même endroit que l'appel a checkAccessibility()
245     function checkAccessibility() {
246     if(file_exists ("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc.php"))
247     include ("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc.php");
248     elseif(file_exists ("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc"))
249     include ("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc");
250    
251     //
252     if(empty($this->cerfa)) {
253     $this->getCerfa();
254     }
255    
256     $id_tab_surface = $this->cerfa->getVal("tab_surface");
257     $id_tab_tax_su_princ = $this->cerfa->getVal("tab_tax_su_princ");
258     $id_tab_tax_su_heber = $this->cerfa->getVal("tab_tax_su_heber");
259     $id_tab_tax_su_secon = $this->cerfa->getVal("tab_tax_su_secon");
260     $id_tab_tax_su_tot = $this->cerfa->getVal("tab_tax_su_tot");
261     $id_tab_tax_su_non_habit_surf = $this->cerfa->getVal("tab_tax_su_non_habit_surf");
262     $id_tab_tax_su_parc_statio_expl_comm = $this->cerfa->getVal("tab_tax_su_parc_statio_expl_comm");
263     $id_tab_tax_am = $this->cerfa->getVal("tab_tax_am");
264     $id_tab_erp_eff = $this->cerfa->getVal("tab_erp_eff");
265    
266     //Suppression des champs de tableaux
267     if(!empty($id_tab_surface)) {
268     foreach($tab_surface[$this->cerfa->getVal("tab_surface")]['values'] as $champ) {
269     unset($this->champs[array_search($champ,$this->champs)]);
270     }
271     }
272     if(!empty($id_tab_tax_su_princ)) {
273     foreach($tab_tax_su_princ[$this->cerfa->getVal("tab_tax_su_princ")]['values'] as $champ) {
274     unset($this->champs[array_search($champ,$this->champs)]);
275     }
276     }
277     if(!empty($id_tab_tax_su_heber)) {
278     foreach($tab_tax_su_heber[$this->cerfa->getVal("tab_tax_su_heber")]['values'] as $champ) {
279     unset($this->champs[array_search($champ,$this->champs)]);
280     }
281     }
282     if(!empty($id_tab_tax_su_secon)) {
283     foreach($tab_tax_su_secon[$this->cerfa->getVal("tab_tax_su_secon")]['values'] as $champ) {
284     unset($this->champs[array_search($champ,$this->champs)]);
285     }
286     }
287     if(!empty($id_tab_tax_su_tot)) {
288     foreach($tab_tax_su_tot[$this->cerfa->getVal("tab_tax_su_tot")]['values'] as $champ) {
289     unset($this->champs[array_search($champ,$this->champs)]);
290     }
291     }
292     if(!empty($id_tab_tax_su_non_habit_surf)) {
293     foreach($tab_tax_su_non_habit_surf[$this->cerfa->getVal("tab_tax_su_non_habit_surf")]['values'] as $champ) {
294     unset($this->champs[array_search($champ,$this->champs)]);
295     }
296     }
297     if(!empty($id_tab_tax_su_parc_statio_expl_comm)) {
298     foreach($tab_tax_su_parc_statio_expl_comm[$this->cerfa->getVal("tab_tax_su_parc_statio_expl_comm")]['values'] as $champ) {
299     unset($this->champs[array_search($champ,$this->champs)]);
300     }
301     }
302     if(!empty($id_tab_tax_am)) {
303     foreach($tab_tax_am[$this->cerfa->getVal("tab_tax_am")]['values'] as $champ) {
304     unset($this->champs[array_search($champ,$this->champs)]);
305     }
306     }
307     if(!empty($id_tab_erp_eff)) {
308     foreach($tab_erp_eff[$this->cerfa->getVal("tab_erp_eff")]['values'] as $champ) {
309     unset($this->champs[array_search($champ,$this->champs)]);
310     }
311     }
312     // Renumérotation
313     $this->champs = array_values($this->champs);
314     }
315    
316     /**
317     * Méthode permettant de définir le type des différents tableaux en fonction
318     * des valeurs du cerfa
319     **/
320     function setTabType($tab) {
321     // Définition du type "tableau"
322     if ( $this->cerfa->getVal($tab) != "" ){
323    
324     $this->form->setType($tab,'tableau');
325     }
326     //Le chache si non défini
327     else {
328    
329     $this->form->setType($tab,'hidden');
330     }
331     }
332    
333     /**
334     * Méthode permettant de définir le type des champs des tableaux en fonction
335     * des valeurs du cerfa
336     **/
337     function setTabChampType($tab) {
338     if(file_exists ("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc.php"))
339     include ("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc.php");
340     elseif(file_exists ("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc"))
341     include ("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc");
342     // Pour chaque champ dans la liste des champs du cerfa
343     $tableau = $$tab;
344     foreach ($this->champs as $champ) {
345    
346     if(array_search($champ, $this->cerfa->champs) !== false) {
347     // On les cache si décoché dans le formulaire de cerfa
348     if($this->cerfa->getVal($champ) == 'f') {
349     $this->form->setType($champ,'hidden');
350     }
351     } else {
352    
353     if(!in_array($champ, $tableau[$this->cerfa->getVal($tab)]['values'])) {
354    
355     $this->form->setType($champ,'hidden');
356     }
357     }
358     }
359     }
360    
361    
362    
363     function setType(&$form,$maj) {
364     parent::setType($form,$maj);
365    
366     if(file_exists ("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc.php"))
367     include ("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc.php");
368     elseif(file_exists ("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc"))
369     include ("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc");
370    
371     if(empty($this->cerfa)) {
372     $this->getCerfa();
373     }
374    
375     $this->setTabType("tab_surface");
376     $this->setTabType("tab_tax_su_princ");
377     $this->setTabType("tab_tax_su_heber");
378     $this->setTabType("tab_tax_su_secon");
379     $this->setTabType("tab_tax_su_tot");
380     $this->setTabType("tab_tax_su_non_habit_surf");
381     $this->setTabType("tab_tax_su_parc_statio_expl_comm");
382     $this->setTabType("tab_tax_am");
383     $this->setTabType("tab_erp_eff");
384    
385     //Champs select pour les liste a choix oui/non/je ne sais pas (terr_*)
386     if($maj == 0) {
387     $form->setType('terr_juri_titul','select');
388     $form->setType('terr_juri_lot','select');
389     $form->setType('terr_juri_zac','select');
390     $form->setType('terr_juri_afu','select');
391     $form->setType('terr_juri_pup','select');
392     $form->setType('terr_juri_oin','select');
393     $form->setType('architecte', 'manage_with_popup');
394     $form->setType('erp_class_cat','select');
395     $form->setType('erp_class_type','select');
396    
397     } elseif($maj == 1) {
398     $form->setType('terr_juri_titul','select');
399     $form->setType('terr_juri_lot','select');
400     $form->setType('terr_juri_zac','select');
401     $form->setType('terr_juri_afu','select');
402     $form->setType('terr_juri_pup','select');
403     $form->setType('terr_juri_oin','select');
404     $form->setType('architecte', 'manage_with_popup');
405     $form->setType('erp_class_cat','select');
406     $form->setType('erp_class_type','select');
407    
408     } elseif($maj == 2) {
409     $form->setType('terr_juri_titul','selectstatic');
410     $form->setType('terr_juri_lot','selectstatic');
411     $form->setType('terr_juri_zac','selectstatic');
412     $form->setType('terr_juri_afu','selectstatic');
413     $form->setType('terr_juri_pup','selectstatic');
414     $form->setType('terr_juri_oin','selectstatic');
415     $form->setType('architecte', 'selectstatic');
416     $form->setType('erp_class_cat','selectstatic');
417     $form->setType('erp_class_type','selectstatic');
418    
419     } elseif($maj == 3) {
420     $form->setType('terr_juri_titul','selectstatic');
421     $form->setType('terr_juri_lot','selectstatic');
422     $form->setType('terr_juri_zac','selectstatic');
423     $form->setType('terr_juri_afu','selectstatic');
424     $form->setType('terr_juri_pup','selectstatic');
425     $form->setType('terr_juri_oin','selectstatic');
426     $form->setType('architecte', 'selectstatic');
427     $form->setType('erp_class_cat','selectstatic');
428     $form->setType('erp_class_type','selectstatic');
429    
430     }
431    
432     // Anciens champs à conserver pour les anciens cerfa
433     $form->setType("co_statio_avt_shob", "hidden");
434     $form->setType("co_statio_apr_shob", "hidden");
435     $form->setType("co_statio_avt_surf", "hidden");
436     $form->setType("co_statio_apr_surf", "hidden");
437     $form->setType("co_trx_amgt", "hidden");
438     $form->setType("co_modif_aspect", "hidden");
439     $form->setType("co_modif_struct", "hidden");
440     $form->setType("co_trx_imm", "hidden");
441     $form->setType("co_cstr_shob", "hidden");
442     $form->setType("am_voyage_deb", "hidden");
443     $form->setType("am_voyage_fin", "hidden");
444     $form->setType("am_modif_amgt", "hidden");
445     $form->setType("am_lot_max_shob", "hidden");
446     $form->setType("mod_desc", "hidden");
447     $form->setType("tr_total", "hidden");
448     $form->setType("tr_partiel", "hidden");
449     $form->setType("tr_desc", "hidden");
450     $form->setType("avap_co_clot", "hidden");
451     $form->setType("avap_aut_coup_aba_arb", "hidden");
452     $form->setType("avap_ouv_infra", "hidden");
453     $form->setType("avap_aut_inst_mob", "hidden");
454     $form->setType("avap_aut_plant", "hidden");
455     $form->setType("avap_aut_auv_elec", "hidden");
456     $form->setType("tax_dest_loc_tr", "hidden");
457    
458    
459     //Cache les champs des clés étrangères, elles sont renseignées automatiquement
460     $form->setType('dossier_instruction', 'hidden');
461     $form->setType('lot', 'hidden');
462     $form->setType('cerfa', 'hidden');
463    
464     // Boucler sur les champs du cerfa pour cacher les données qui ne doivent
465     // pas être saisies
466    
467     foreach ($this->champs as $champ) {
468     if(array_search($champ, $this->cerfa->champs) !== false) {
469     if($this->cerfa->getVal($champ) == 'f') {
470     $form->setType($champ,'hidden');
471     }
472     } else {
473     $id_tab_surface = $this->cerfa->getVal("tab_surface");
474     $id_tab_tax_su_princ = $this->cerfa->getVal("tab_tax_su_princ");
475     $id_tab_tax_su_heber = $this->cerfa->getVal("tab_tax_su_heber");
476     $id_tab_tax_su_secon = $this->cerfa->getVal("tab_tax_su_secon");
477     $id_tab_tax_su_tot = $this->cerfa->getVal("tab_tax_su_tot");
478     $id_tab_tax_su_non_habit_surf = $this->cerfa->getVal("tab_tax_su_non_habit_surf");
479     $id_tab_tax_su_parc_statio_expl_comm = $this->cerfa->getVal("tab_tax_su_parc_statio_expl_comm");
480     $id_tab_tax_am = $this->cerfa->getVal("tab_tax_am");
481     $id_tab_erp_eff = $this->cerfa->getVal("tab_erp_eff");
482     $hidden = true;
483    
484     // On cache tous les champs
485     $form->setType($champ,'hidden');
486    
487     // On défini l'affichage des champs des tableaux de configuration
488     // Si les tableau sont définis dans le cerfa on test si les champs des données
489     // techniques sont définis dans les tableaux de configuration des tableaux
490     // pour chaque cerfa alors on les affiche en type "text"
491     if(!empty($id_tab_surface)) {
492     if(in_array($champ, $tab_surface[$this->cerfa->getVal("tab_surface")]['values'])) {
493     $hidden = false;
494     }
495     }
496     if(!empty($id_tab_tax_su_princ)) {
497     if(in_array($champ, $tab_tax_su_princ[$this->cerfa->getVal("tab_tax_su_princ")]['values'])) {
498     $hidden = false;
499     }
500     }
501     if(!empty($id_tab_tax_su_heber)) {
502     if(in_array($champ, $tab_tax_su_heber[$this->cerfa->getVal("tab_tax_su_heber")]['values'])) {
503     $hidden = false;
504     }
505     }
506     if(!empty($id_tab_tax_su_secon)) {
507     if(in_array($champ, $tab_tax_su_secon[$this->cerfa->getVal("tab_tax_su_secon")]['values'])) {
508     $hidden = false;
509     }
510     }
511     if(!empty($id_tab_tax_su_tot)) {
512     if(in_array($champ, $tab_tax_su_tot[$this->cerfa->getVal("tab_tax_su_tot")]['values'])) {
513     $hidden = false;
514     }
515     }
516     if(!empty($id_tab_tax_su_non_habit_surf)) {
517     if(in_array($champ, $tab_tax_su_non_habit_surf[$this->cerfa->getVal("tab_tax_su_non_habit_surf")]['values'])) {
518     $hidden = false;
519     }
520     }
521     if(!empty($id_tab_tax_su_parc_statio_expl_comm)) {
522     if(in_array($champ, $tab_tax_su_parc_statio_expl_comm[$this->cerfa->getVal("tab_tax_su_parc_statio_expl_comm")]['values'])) {
523     $hidden = false;
524     }
525     }
526     if(!empty($id_tab_tax_am)) {
527     if(in_array($champ, $tab_tax_am[$this->cerfa->getVal("tab_tax_am")]['values'])) {
528     $hidden = false;
529     }
530     }
531     if(!empty($id_tab_erp_eff)) {
532     if(in_array($champ, $tab_erp_eff[$this->cerfa->getVal("tab_erp_eff")]['values'])) {
533     $hidden = false;
534     }
535     }
536    
537     if(!$hidden){
538     if($maj < 2) {
539     $form->setType($champ,'text');
540     } else {
541     $form->setType($champ,'static');
542     }
543    
544     }
545     }
546     }
547     }
548    
549     // Ajout des clés étrangères
550     function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire,&$db,$DEBUG=null){
551     $this->retourformulaire = $retourformulaire;
552     if($validation == 0) {
553    
554     //Si on est dans le dossier
555     if($retourformulaire =='dossier' || $retourformulaire =='dossier_instruction' ) {
556    
557     $form->setVal('dossier_instruction', $idxformulaire);
558     $form->setVal('lot', "");
559     }
560    
561     //Si on est dans le lot
562     if($retourformulaire =='lot') {
563    
564     $form->setVal('dossier_instruction', "");
565     $form->setVal('lot', $idxformulaire);
566     }
567     }// fin validation
568     }// fin setValsousformulaire
569    
570     function setLib(&$form,$maj) {
571     parent::setLib($form,$maj);
572     //libelle des champs
573     $form->setLib('tab_surface', "");
574     $form->setLib('tab_tax_su_princ', "");
575     $form->setLib('tab_tax_su_heber', "");
576     $form->setLib('tab_tax_su_secon', "");
577     $form->setLib('tab_tax_su_tot', "");
578     $form->setLib('tab_tax_su_non_habit_surf', "");
579     $form->setLib('tab_tax_su_parc_statio_expl_comm', "");
580     $form->setLib('tab_tax_am', "");
581     $form->setLib('tab_erp_eff', "");
582     $form->setLib('ope_proj_desc', _("description"));
583     }
584    
585     function setLayout(&$form, $maj) {
586    
587     // Terrain
588     $form->setBloc('terr_juri_titul','D',"","col_12");
589     $form->setFieldset('terr_juri_titul','D'
590     ,_("Terrain"), "startClosed");
591    
592     $form->setBloc('terr_juri_titul','D',_("Situation juridique du terrain"), "col_12 alignFormSpec");
593     $form->setBloc('terr_juri_oin','F');
594     $form->setBloc('terr_juri_desc','DF',"", "group");
595     $form->setBloc('terr_div_surf_etab','D',_("Terrain issu d'une division de propriete"), "col_12 alignFormSpec");
596     $form->setBloc('terr_div_surf_av_div', 'F');
597    
598     $form->setFieldset('terr_div_surf_av_div','F','');
599    
600     $form->setBloc('terr_div_surf_av_div','F');
601    
602     // Description de la demande / du projet
603     $form->setFieldset('ope_proj_desc', 'D',
604     _("Description de la demande / du projet"), "col_12 startClosed");
605     $form->setBloc('ope_proj_desc', 'DF', "", "group");
606     $form->setBloc('ope_proj_div_co', 'DF', "", "group");
607     $form->setBloc('ope_proj_div_contr', 'DF', "", "group");
608     $form->setFieldset('ope_proj_div_contr', 'F');
609    
610     // Construire, aménager ou modifier un ERP
611     $form->setBloc('erp_class_cat','D',"","col_12");
612     $form->setFieldset('erp_class_cat','D'
613     ,_("Construire, amenager ou modifier un ERP"), "startClosed");
614    
615     $form->setBloc('erp_class_cat','DF', _("Activite"),"alignFormSpec");
616     $form->setBloc('erp_class_type','DF', "","alignFormSpec");
617    
618     $form->setBloc('erp_cstr_neuve','DF', _("Nature des travaux (plusieurs cases possibles)"),"col_12");
619     $form->setBloc('erp_cstr_neuve','DF', "","alignFormSpec");
620     $form->setBloc('erp_trvx_acc','DF', "","alignFormSpec");
621     $form->setBloc('erp_extension','DF', "","alignFormSpec");
622     $form->setBloc('erp_rehab','DF', "","alignFormSpec");
623     $form->setBloc('erp_trvx_am','DF', "","alignFormSpec");
624     $form->setBloc('erp_vol_nouv_exist','DF', "","alignFormSpec");
625    
626     $form->setBloc('tab_erp_eff','D',_("Effectif"),"col_12");
627     $form->setBloc('tab_erp_eff','DF', "", "col_12");
628     $form->setBloc('tab_erp_eff','F', "","");
629    
630     $form->setFieldset('tab_erp_eff','F', '');
631     $form->setBloc('tab_erp_eff','F');
632    
633     // Aménager
634     $form->setBloc('am_lotiss','D',"","col_12");
635     $form->setFieldset('am_lotiss','D'
636     ,_("Amenager"), "startClosed");
637     $form->setBloc('am_lotiss','D',"","col_12");
638     $form->setFieldset('am_lotiss','D'
639     ,_("Projet d'amenagement"), "startClosed alignFormSpec");
640     // bloc 4.1
641     $form->setBloc('am_lotiss','DF',_("Nature des travaux, installations
642     ou amenagements envisages"), "group");
643     $form->setBloc('am_div_mun','DF',"", "group");
644     $form->setBloc('am_autre_div','DF',"", "group");
645     $form->setBloc('am_camping','DF',"", "group");
646     $form->setBloc('am_parc_resid_loi','DF',"", "group");
647     $form->setBloc('am_sport_moto','DF',"", "group");
648     $form->setBloc('am_sport_attrac','DF',"", "group");
649     $form->setBloc('am_sport_golf','DF',"", "group");
650     $form->setBloc('am_caravane','DF',"", "group");
651     $form->setBloc('am_carav_duree','DF',"", "group");
652     $form->setBloc('am_statio','DF',"", "group");
653     $form->setBloc('am_statio_cont','DF',"", "group");
654     $form->setBloc('am_affou_exhau','DF',"", "group");
655     $form->setBloc('am_affou_exhau_sup','DF',"", "group");
656     $form->setBloc('am_affou_prof','DF',"", "group");
657     $form->setBloc('am_exhau_haut','DF',"", "group");
658    
659     $form->setBloc('am_chem_ouv_esp','D',_("Dans les secteurs proteges :"),"col_12");
660     $form->setBloc('am_chem_ouv_esp','DF',_("Amenagement situe dans un espace remarquable :"), "group");
661     $form->setBloc('am_agri_peche','DF',"", "group");
662    
663     $form->setBloc('am_crea_voie','DF',_("Amenagement situe dans un secteur sauvegarde :"), "group");
664     $form->setBloc('am_modif_voie_exist','DF',"", "group");
665     $form->setBloc('am_crea_esp_sauv','DF',"", "group");
666    
667     $form->setBloc('am_crea_esp_class','DF',_("Amenagement situe dans un site classe ou une reserve naturelle 1 :"), "group");
668     $form->setBloc('am_coupe_abat','DF',"", "group");
669     $form->setBloc('am_prot_plu','DF',"", "group");
670     $form->setBloc('am_prot_muni','DF',"", "group");
671     $form->setBloc('am_mobil_voyage','DF',"", "group");
672     $form->setBloc('am_aire_voyage','DF',"", "group");
673     $form->setBloc('am_rememb_afu','DF',"", "group");
674     $form->setBloc('co_ouvr_infra','DF',"", "group");
675     $form->setBloc('co_ouvr_infra','F');
676    
677     $form->setBloc('am_mob_art','DF',_("Dans un secteur sauvegarde, site classe ou reserve naturelle :"), "group");
678     $form->setBloc('am_modif_voie_esp','DF',"", "group");
679     $form->setBloc('am_plant_voie_esp','DF',"", "group");
680     $form->setBloc('co_ouvr_elec','DF',"", "group");
681     $form->setFieldset('co_ouvr_elec','F','');
682     $form->setBloc('co_ouvr_elec','F');
683     $form->setBloc('am_projet_desc','D',"","col_12");
684     $form->setFieldset('am_projet_desc','D'
685     ,_("Description amenagement"), "startClosed");
686    
687     $form->setBloc('am_projet_desc','DF',"", "group");
688     $form->setBloc('am_terr_surf','DF',"", "alignFormSpec");
689     $form->setBloc('am_tranche_desc','DF',"", "group");
690     $form->setFieldset('am_tranche_desc','F','');
691     $form->setBloc('am_tranche_desc','F');
692     $form->setBloc('am_lot_max_nb','D',"","col_12");
693     $form->setFieldset('am_lot_max_nb','D'
694     ,_("Complement d'amenagement"), "startClosed");
695     // bloc 4.2
696     $form->setBloc('am_lot_max_nb','D',_("Demande concernant un lotissement"),"col_12 alignFormSpec");
697    
698     $form->setBloc('am_lot_max_nb','DF',"", "group");
699     $form->setBloc('am_lot_max_shon','DF',"", "group");
700    
701     $form->setBloc('am_lot_cstr_cos','DF',_("Comment la constructibilite globale sera-t-elle repartie ?"), "group");
702     $form->setBloc('am_lot_cstr_plan','DF',"", "group");
703     $form->setBloc('am_lot_cstr_vente','DF',"", "group");
704     $form->setBloc('am_lot_fin_diff','DF',"", "group");
705    
706     $form->setBloc('am_lot_consign','DF',_("si oui, quelle garantie sera utilisee ?"), "group");
707     $form->setBloc('am_lot_gar_achev','DF',"", "group");
708     $form->setBloc('am_lot_vente_ant','DF',"", "group");
709     $form->setBloc('am_lot_vente_ant','F');
710    
711     // bloc 4.3
712     $form->setBloc('am_exist_agrand','D',_("Amenagement d'un camping ou
713     d'un terrain amenage en vue de l'hebergement
714     touristique"),"col_12");
715    
716     $form->setBloc('am_exist_agrand','DF',"", "alignFormSpec");
717     $form->setBloc('am_exist_date','DF',"", "alignFormSpec-type-date");
718     $form->setBloc('am_exist_num','D',"", "alignFormSpec");
719     $form->setBloc('am_empl_nb','F',"", "");
720    
721     $form->setBloc('am_tente_nb','D',_("Nombre maximum d’emplacements reserves aux :"), "col_12 alignForm");
722     $form->setBloc('am_mobil_nb','F',"", "");
723    
724     $form->setBloc('am_pers_nb','DF',"", "alignFormSpec group");
725    
726     $form->setBloc('am_empl_hll_nb','D',_("Implantation d’habitations legeres de loisirs (HLL) :"), "col_12 alignFormSpec");
727     //$form->setBloc('am_empl_hll_nb','DF',"", "group");
728     $form->setBloc('am_hll_shon','F');
729    
730     $form->setBloc('am_periode_exploit','DF',"", "group");
731    
732     $form->setBloc('am_coupe_bois','D',_("Declaration de coupe et/ou abattage d’arbres :"),"col_12 cerfasubtitle");
733    
734     $form->setBloc('am_coupe_bois','D',_("Courte description du lieu :"), "cerfasubtitle alignForm");
735     $form->setBloc('am_coupe_align','F',"", "");
736    
737     $form->setBloc('am_coupe_ess','D',_("Nature du boisement :"),"col_12 cerfasubtitle alignForm");
738     $form->setBloc('am_coupe_autr','F');
739     $form->setBloc('am_coupe_autr','F');
740    
741     $form->setBloc('am_coupe_autr','F');
742    
743    
744     $form->setFieldset('am_coupe_autr','F','');
745    
746     $form->setBloc('am_coupe_autr','F');
747     $form->setFieldset('am_coupe_autr','F','');
748     $form->setBloc('am_coupe_autr','F');
749     // Fin amménager
750     // Construire
751     $form->setBloc('co_archi_recours','D',"","col_12");
752     $form->setFieldset('co_archi_recours','D'
753     ,_("Construire"), "startClosed");
754     $form->setBloc('co_archi_recours','D', "","col_12");
755     $form->setFieldset('co_archi_recours','D'
756     ,_("Projet construction"), "startClosed");
757    
758     $form->setBloc('co_archi_recours','D',_("Architecte"), "col_12");
759     $form->setBloc('co_archi_recours','DF',"", "alignFormSpec group");
760     $form->setBloc('architecte','DF', "", "group");
761     $form->setBloc('architecte','F');
762    
763     $form->setBloc('co_cstr_nouv','D',_("Nature du projet"), "col_12 alignFormSpec");
764     $form->setBloc('avap_co_elt_pro','DF',"", "group");
765     $form->setBloc('avap_nouv_haut_surf','DF',"", "group");
766     $form->setBloc('co_cloture','F');
767     $form->setBloc('co_projet_desc','DF',"", "group");
768     $form->setBloc('co_elec_tension','DF', "", "alignFormSpec");
769     $form->setFieldset('co_elec_tension','F','');
770     $form->setFieldset('co_tot_log_nb','D'
771     ,_("Complement construction"), "startClosed");
772    
773     $form->setBloc('co_tot_log_nb','D',"", "alignForm");
774     $form->setBloc('co_tot_coll_nb','F',"", "");
775    
776     $form->setBloc('co_mais_piece_nb','D',"", "alignForm");
777     $form->setBloc('co_mais_niv_nb','F',"", "");
778    
779     $form->setBloc('co_fin_lls_nb','D', _("Repartition du nombre total de logement crees par type de financement :"),"col_12");
780     $form->setBloc('co_fin_lls_nb','D',"", "alignForm");
781     $form->setBloc('co_fin_autr_nb','F',"", "");
782    
783     $form->setBloc('co_fin_autr_desc','DF',"", "alignFormSpec group");
784     $form->setBloc('co_mais_contrat_ind','DF',"", "alignFormSpec group");
785     $form->setBloc('co_mais_contrat_ind','F');
786    
787     $form->setBloc('co_uti_pers','D',_("Mode d'utilisation principale des logements :"), "col_12");
788     $form->setBloc('co_uti_pers','D', "", "alignForm");
789     $form->setBloc('co_uti_loc','F',"", "");
790     $form->setBloc('co_uti_loc','F',"", "");
791    
792     $form->setBloc('co_uti_princ','D',_("S’il s’agit d’une occupation personnelle, veuillez preciser :"), "col_12");
793     $form->setBloc('co_uti_princ','D',"", "alignForm");
794     $form->setBloc('co_uti_secon','F',"", "");
795     $form->setBloc('co_uti_secon','F',"", "group");
796    
797     $form->setBloc('co_anx_pisc','D',_("Si le projet porte sur une annexe a l’habitation, veuillez preciser :"), "col_12");
798     $form->setBloc('co_anx_pisc','D',"", "alignForm");
799     $form->setBloc('co_anx_autr_desc','F',"", "");
800     $form->setBloc('co_anx_autr_desc','F',"", "group");
801    
802     $form->setBloc('co_resid_agees','D',_("Si le projet est un foyer ou une residence, a quel titre :"), "col_12 alignForm");
803     $form->setBloc('co_resid_agees','D',"", "alignForm");
804     $form->setBloc('co_resid_hand','F',"", "");
805     $form->setBloc('co_resid_hand','F',"", "group");
806    
807     $form->setBloc('co_resid_autr','DF',"", "group alignFormSpec");
808     $form->setBloc('co_resid_autr_desc','DF',"", "group");
809     $form->setBloc('co_foyer_chamb_nb','DF',"", "group alignFormSpec");
810    
811     $form->setBloc('co_log_1p_nb','D',_("Repartition du nombre de logements crees selon le nombre de pieces :"), "col_12");
812     $form->setBloc('co_log_1p_nb','D', "", "alignForm");
813     $form->setBloc('co_log_6p_nb','F',"", "group");
814     $form->setBloc('co_log_6p_nb','F',"", "group");
815    
816     $form->setBloc('co_bat_niv_nb','DF',"", "alignFormSpec");
817    
818     $form->setBloc('co_trx_exten','D',_("Indiquez si vos travaux comprennent notamment :"), "col_12");
819     $form->setBloc('co_trx_exten','D',"", "alignForm");
820     $form->setBloc('co_trx_nivsup','F',"", "group");
821    
822     $form->setBloc('co_demont_periode','DF', _("Construction periodiquement demontee et re-installee :"),"col_12 group");
823     $form->setBloc('co_demont_periode','F',"", "group");
824    
825     $form->setFieldset('co_demont_periode','F','');
826     $form->setFieldset('tab_surface','D'
827     ,_("Destinations et surfaces des constructions"), "startClosed");
828     $form->setBloc('tab_surface','D', "","col_12 group");
829     $form->setBloc('tab_surface','F');
830     $form->setBloc('co_sp_transport','D', _("Destination des constructions futures en cas de realisation au benefice d'un service public ou d'interet collectif :"),"col_12");
831     $form->setBloc('co_sp_transport','D', "","alignForm");
832     $form->setBloc('co_sp_culture','F', "","");
833     $form->setBloc('co_sp_culture','F', "","");
834    
835     $form->setFieldset('co_sp_culture','F','');
836     $form->setFieldset('co_statio_avt_nb','D'
837     ,_("Divers construction"), "startClosed");
838    
839     $form->setBloc('co_statio_avt_nb','D', _("Nombre de places de stationnement"),"col_12");
840     $form->setBloc('co_statio_avt_nb','D', "","alignForm");
841     $form->setBloc('co_statio_apr_nb','F', "","");
842     $form->setBloc('co_statio_apr_nb','F', "","");
843    
844     $form->setBloc('co_statio_adr','D', _("Places de stationnement affectees au projet, amenagees ou reservees en dehors du terrain sur lequel est situe le projet"),"col_12");
845     $form->setBloc('co_statio_adr','DF', "","group");
846    
847     $form->setBloc('co_statio_place_nb','D', "","col_12");
848     $form->setBloc('co_statio_place_nb','D', "","alignForm");
849     $form->setBloc('co_statio_tot_shob','F', "","");
850     $form->setBloc('co_statio_tot_shob','F', "","");
851     $form->setBloc('co_statio_tot_shob','F');
852     $form->setBloc('co_statio_comm_cin_surf','D', _("Pour les commerces et cinemas :"),"col_12 alignFormSpec");
853     $form->setBloc('co_perf_energ','F',"", "");
854    
855     $form->setFieldset('co_perf_energ','F','');
856     $form->setBloc('co_perf_energ','F');
857    
858     $form->setFieldset('co_perf_energ','F','');
859    
860     $form->setBloc('co_perf_energ','F');
861     // Fin construire
862    
863     /*Fieldset n°6 Projet necessitant demolitions */
864     $form->setBloc('dm_constr_dates','D',"","col_12");
865     $form->setFieldset('dm_constr_dates','D'
866     ,_("Demolir"), "startClosed");
867     $form->setBloc('dm_constr_dates','DF', "","group");
868     $form->setBloc('dm_total','D', "","alignFormSpec");
869     $form->setBloc('dm_partiel','F');
870     $form->setBloc('dm_projet_desc','DF', "","group");
871     $form->setBloc('dm_tot_log_nb','DF', "","alignFormSpec");
872     $form->setFieldset('dm_tot_log_nb','F','');
873    
874     $form->setBloc('dm_tot_log_nb','F');
875    
876     /*Fieldset n°4 Ouverture de chantier */
877     $form->setBloc('doc_date','D',"","col_12");
878     $form->setFieldset('doc_date','D'
879     ,_("Ouverture de chantier"), "startClosed alignFormSpec");
880     $form->setBloc('doc_date','DF', "","group");
881     $form->setBloc('doc_tot_trav','DF', "","group");
882     $form->setBloc('doc_tranche_trav','DF', "","group");
883     $form->setBloc('doc_tranche_trav_desc','DF', "","group");
884     $form->setBloc('doc_surf','DF', "","group");
885     $form->setBloc('doc_nb_log','DF', "","group");
886     $form->setBloc('doc_nb_log_indiv','DF', "","group");
887     $form->setBloc('doc_nb_log_coll','DF', "","group");
888     //
889     $form->setBloc('doc_nb_log_lls','DF', _("Repartition du nombre de logements commences par type de financement"), "group");
890     $form->setBloc('doc_nb_log_aa','DF', "","group");
891     $form->setBloc('doc_nb_log_ptz','DF', "","group");
892     $form->setBloc('doc_nb_log_autre','DF', "","group");
893     $form->setFieldset('doc_nb_log_autre','F','');
894     $form->setBloc('doc_nb_log_autre','F');
895    
896     /*Fieldset n°4 Achèvement des travaux */
897     $form->setBloc('daact_date','D',"","col_12");
898     $form->setFieldset('daact_date','D'
899     ,_("Achevement des travaux") , "startClosed alignFormSpec");
900     $form->setBloc('daact_date','DF', "","group");
901     $form->setBloc('daact_date_chgmt_dest','DF', "","group");
902     $form->setBloc('daact_tot_trav','DF', "","group");
903     $form->setBloc('daact_tranche_trav','DF', "","group");
904     $form->setBloc('daact_tranche_trav_desc','DF', "","group");
905     $form->setBloc('daact_surf','DF', "","group");
906     $form->setBloc('daact_nb_log','DF', "","group");
907     $form->setBloc('daact_nb_log_indiv','DF', "","group");
908     $form->setBloc('daact_nb_log_coll','DF', "","group");
909     //
910     $form->setBloc('daact_nb_log_lls','DF', _("Repartition du nombre de logements commences par type de financement"), "group");
911     $form->setBloc('daact_nb_log_aa','DF', "","group");
912     $form->setBloc('daact_nb_log_ptz','DF', "","group");
913     $form->setBloc('daact_nb_log_autre','DF', "","group");
914     $form->setFieldset('daact_nb_log_autre','F','');
915     $form->setBloc('daact_nb_log_autre','F');
916    
917     $form->setBloc('code_cnil','D',"","col_12");
918     $form->setFieldset('code_cnil','D'
919     ,_("cnil (opposition à l’utilisation des informations du formulaire à des fins commerciales)") , "startClosed alignFormSpec");
920     $form->setBloc('code_cnil','DF', "","group");
921     $form->setFieldset('code_cnil','F','');
922     $form->setBloc('code_cnil','F');
923    
924     $form->setBloc('tax_surf_tot_cstr','D',"","col_12");
925     $form->setFieldset('tax_surf_tot_cstr','D'
926     ,_("Declaration des elements necessaires au calcul des impositions"), "startClosed");
927    
928     $form->setBloc('tax_surf_tot_cstr','D', _("Renseignement"),"col_12");
929     $form->setBloc('tax_surf_tot_cstr','D', "", "alignFormSpec");
930     $form->setBloc('tax_surf_suppr_mod','F', "","");
931     $form->setBloc('tax_surf_suppr_mod','F', "","");
932    
933     $form->setBloc('tab_tax_su_princ','D',_("Creation de locaux destines a l’habitation :"),"col_12");
934     $form->setBloc('tab_tax_su_princ','DF',_("tab_tax_su_princ"), "col_12");
935     $form->setBloc('tab_tax_su_heber','DF',_("tab_tax_su_heber"), "col_12");
936     $form->setBloc('tab_tax_su_tot','F', "","");
937     //
938     $form->setBloc('tax_ext_pret','DF', _("Extension de l’habitation principale, creation d’un batiment annexe a cette habitation ou d’un garage clos et couvert."), "alignFormSpec");
939     $form->setBloc('tax_ext_desc','DF', "","group");
940     $form->setBloc('tax_surf_tax_exist_cons','D', "","alignFormSpec");
941     $form->setBloc('tax_log_ap_trvx_nb','F');
942    
943     //
944     $form->setBloc('tax_surf_abr_jard_pig_colom','DF', _("Creation d’abris de jardin, de pigeonniers et colombiers"), "col_12");
945    
946     $form->setBloc('tax_comm_nb','D', _("Creation ou extension de locaux non destines a l'habitation :"),"col_12");
947     $form->setBloc('tax_comm_nb','DF', "","col_12 alignFormSpec");
948     $form->setBloc('tab_tax_su_parc_statio_expl_comm','DF');
949     $form->setBloc('tax_su_non_habit_abr_jard_pig_colom','F');
950     //
951     $form->setBloc('tab_tax_am','DF',_("tab_tax_am"),"col_12");
952    
953     $form->setBloc('tax_am_statio_ext_cr','D', _("Autres elements crees soumis à la taxe d’amenagement :"),"col_12");
954     $form->setBloc('tax_pann_volt_sup_cr','F');
955    
956     $form->setBloc('tax_surf_loc_arch','D', _("Redevance d’archeologie preventive"),"col_12 alignFormSpec");
957     $form->setBloc('tax_surf_loc_arch','D', _("Veuillez preciser la profondeur du(des) terrassement(s) necessaire(s) a la realisation de votre projet"),"");
958     $form->setBloc('tax_eol_haut_nb_arch','F');
959     $form->setBloc('tax_eol_haut_nb_arch','F');
960    
961     $form->setBloc('tax_trx_presc_ppr','D', _("Cas particuliers"),"col_12 alignFormSpec");
962     $form->setBloc('tax_monu_hist','F');
963    
964     $form->setBloc('vsd_surf_planch_smd','D', _("Versement pour sous-densite (VSD)"),"col_12");
965     $form->setBloc('vsd_surf_planch_smd','D', "","alignFormSpec");
966     $form->setBloc('vsd_const_sxist_non_dem_surf','F');
967    
968     $form->setBloc('vsd_rescr_fisc','DF',"", "alignFormSpec-type-date");
969     $form->setBloc('vsd_rescr_fisc','F');
970    
971     $form->setBloc('pld_val_terr','D', _("Plafond legal de densite (PLD)"),"col_12 alignFormSpec");
972     $form->setBloc('pld_const_exist_dem_surf','F');
973    
974     $form->setBloc('tax_desc','DF', _("Autres renseignements"),"col_12 alignFormSpec");
975    
976     $form->setFieldset('tax_desc','F','');
977    
978     $form->setBloc('tax_desc','F');
979     }
980    
981     /**
982     * Surcharge de la méthode setOnChange
983     */
984     function setOnchange(&$form,$maj){
985     parent::setOnchange($form,$maj);
986    
987     $form->setOnchange("co_tot_ind_nb","sommeChampsCerfa('co_tot_log_nb',['co_tot_ind_nb','co_tot_coll_nb']);");
988     $form->setOnchange("co_tot_coll_nb","sommeChampsCerfa('co_tot_log_nb',['co_tot_ind_nb','co_tot_coll_nb']);");
989    
990     $form->setOnchange("doc_nb_log_indiv","sommeChampsCerfa('doc_nb_log',['doc_nb_log_indiv','doc_nb_log_coll']);");
991     $form->setOnchange("doc_nb_log_coll","sommeChampsCerfa('doc_nb_log',['doc_nb_log_indiv','doc_nb_log_coll']);");
992    
993     $form->setOnchange("su_avt_shon1","calculSurfaceTotal();");
994     $form->setOnchange("su_avt_shon2","calculSurfaceTotal();");
995     $form->setOnchange("su_avt_shon3","calculSurfaceTotal();");
996     $form->setOnchange("su_avt_shon4","calculSurfaceTotal();");
997     $form->setOnchange("su_avt_shon5","calculSurfaceTotal();");
998     $form->setOnchange("su_avt_shon6","calculSurfaceTotal();");
999     $form->setOnchange("su_avt_shon7","calculSurfaceTotal();");
1000     $form->setOnchange("su_avt_shon8","calculSurfaceTotal();");
1001     $form->setOnchange("su_avt_shon9","calculSurfaceTotal();");
1002     $form->setOnchange("su_cstr_shon1","calculSurfaceTotal();");
1003     $form->setOnchange("su_cstr_shon2","calculSurfaceTotal();");
1004     $form->setOnchange("su_cstr_shon3","calculSurfaceTotal();");
1005     $form->setOnchange("su_cstr_shon4","calculSurfaceTotal();");
1006     $form->setOnchange("su_cstr_shon5","calculSurfaceTotal();");
1007     $form->setOnchange("su_cstr_shon6","calculSurfaceTotal();");
1008     $form->setOnchange("su_cstr_shon7","calculSurfaceTotal();");
1009     $form->setOnchange("su_cstr_shon8","calculSurfaceTotal();");
1010     $form->setOnchange("su_cstr_shon9","calculSurfaceTotal();");
1011     $form->setOnchange("su_chge_shon1","calculSurfaceTotal();");
1012     $form->setOnchange("su_chge_shon2","calculSurfaceTotal();");
1013     $form->setOnchange("su_chge_shon3","calculSurfaceTotal();");
1014     $form->setOnchange("su_chge_shon4","calculSurfaceTotal();");
1015     $form->setOnchange("su_chge_shon5","calculSurfaceTotal();");
1016     $form->setOnchange("su_chge_shon6","calculSurfaceTotal();");
1017     $form->setOnchange("su_chge_shon7","calculSurfaceTotal();");
1018     $form->setOnchange("su_chge_shon8","calculSurfaceTotal();");
1019     $form->setOnchange("su_chge_shon9","calculSurfaceTotal();");
1020     $form->setOnchange("su_demo_shon1","calculSurfaceTotal();");
1021     $form->setOnchange("su_demo_shon2","calculSurfaceTotal();");
1022     $form->setOnchange("su_demo_shon3","calculSurfaceTotal();");
1023     $form->setOnchange("su_demo_shon4","calculSurfaceTotal();");
1024     $form->setOnchange("su_demo_shon5","calculSurfaceTotal();");
1025     $form->setOnchange("su_demo_shon6","calculSurfaceTotal();");
1026     $form->setOnchange("su_demo_shon7","calculSurfaceTotal();");
1027     $form->setOnchange("su_demo_shon8","calculSurfaceTotal();");
1028     $form->setOnchange("su_demo_shon9","calculSurfaceTotal();");
1029     $form->setOnchange("su_sup_shon1","calculSurfaceTotal();");
1030     $form->setOnchange("su_sup_shon2","calculSurfaceTotal();");
1031     $form->setOnchange("su_sup_shon3","calculSurfaceTotal();");
1032     $form->setOnchange("su_sup_shon4","calculSurfaceTotal();");
1033     $form->setOnchange("su_sup_shon5","calculSurfaceTotal();");
1034     $form->setOnchange("su_sup_shon6","calculSurfaceTotal();");
1035     $form->setOnchange("su_sup_shon7","calculSurfaceTotal();");
1036     $form->setOnchange("su_sup_shon8","calculSurfaceTotal();");
1037     $form->setOnchange("su_sup_shon9","calculSurfaceTotal();");
1038     $form->setOnchange("su_tot_shon1","calculSurfaceTotal();");
1039     $form->setOnchange("su_tot_shon2","calculSurfaceTotal();");
1040     $form->setOnchange("su_tot_shon3","calculSurfaceTotal();");
1041     $form->setOnchange("su_tot_shon4","calculSurfaceTotal();");
1042     $form->setOnchange("su_tot_shon5","calculSurfaceTotal();");
1043     $form->setOnchange("su_tot_shon6","calculSurfaceTotal();");
1044     $form->setOnchange("su_tot_shon7","calculSurfaceTotal();");
1045     $form->setOnchange("su_tot_shon8","calculSurfaceTotal();");
1046     $form->setOnchange("su_tot_shon9","calculSurfaceTotal();");
1047    
1048     }
1049    
1050    
1051     /**
1052     * Surcharge du bouton retour afin de retourner sur le dossier d'instruction selon de cas
1053     */
1054     function retoursousformulaire($idxformulaire, $retourformulaire, $val,
1055     $objsf, $premiersf, $tricolsf, $validation,
1056     $idx, $maj, $retour) {
1057    
1058     $visualisation = $this->getParameter('visualisation');
1059    
1060     if ( $visualisation == "" ){
1061    
1062     // Ajout et consultation, retour dossier
1063     if ( ( $maj == 0 && $validation == 0 ) ||
1064     ( $maj == 3 && $validation == 0 ) ||
1065     ( $maj == 0 && $validation == 1 ) && $retourformulaire == "dossier_instruction" ){
1066    
1067     echo "\n<a class=\"retour\" ";
1068     echo "href=\"#\" ";
1069     echo "onclick=\"redirectPortletAction(1,'main');\" ";
1070     echo ">";
1071     echo _("Retour");
1072     echo "</a>\n";
1073     }
1074     //Sinon affiche un retour normal
1075     else{
1076    
1077     parent::retoursousformulaire($idxformulaire, $retourformulaire, $val,
1078     $objsf, $premiersf, $tricolsf, $validation,
1079     $idx, $maj, $retour);
1080     }
1081     }
1082     }
1083    
1084     /**
1085     * Cette variable permet de stocker le résultat de la méthode
1086     * getDivisionFromDossier() afin de ne pas effectuer le recalcul à chacun de
1087     * ces appels.
1088     * @var string Code de la division du dossier en cours
1089     */
1090     var $_division_from_dossier = NULL;
1091    
1092     /**
1093     * Cette méthode permet de récupérer le code de division correspondant
1094     * au dossier sur lequel on se trouve.
1095     *
1096     * @return string Code de la division du dossier en cours
1097     */
1098     function getDivisionFromDossier() {
1099    
1100     // Cette méthode peut être appelée plusieurs fois lors d'une requête.
1101     // Pour éviter de refaire le traitement de recherche de la division
1102     // alors on vérifie si nous ne l'avons pas déjà calculé.
1103     if ($this->_division_from_dossier != NULL) {
1104     // Logger
1105     $this->addToLog("getDivisionFromDossier(): retour de la valeur déjà calculée - '".$this->_division_from_dossier."'", EXTRA_VERBOSE_MODE);
1106     // On retourne la valeur déjà calculée
1107     return $this->_division_from_dossier;
1108     }
1109    
1110     // Par défaut, on définit la valeur du dossier à NULL
1111     $dossier = NULL;
1112     // Test sur le mode et le contexte du formulaire
1113     if ($this->getParameter("maj") == 0
1114     && ($this->getParameter("retourformulaire") == "dossier"
1115     || $this->getParameter("retourformulaire") == "dossier_instruction"
1116     || $this->getParameter("retourformulaire") == "dossier_instruction_mes_encours"
1117     || $this->getParameter("retourformulaire") == "dossier_instruction_tous_encours"
1118     || $this->getParameter("retourformulaire") == "dossier_instruction_mes_clotures"
1119     || $this->getParameter("retourformulaire") == "dossier_instruction_tous_clotures")) {
1120     // Si on se trouve en mode AJOUT (seul mode où l'enregistrement
1121     // n'existe pas en base de données) ET que nous nous trouvons
1122     // dans le contexte d'un dossier d'instruction alors on récupère
1123     // le numéro de dossier depuis le paramètre 'idxformulaire'
1124     $dossier = $this->getParameter("idxformulaire");
1125     } else {
1126     // Sinon on récupère le numéro de dossier dans le champs dossier de
1127     // l'enregistrement (en base de données)
1128     $dossier = $this->getVal("dossier_instruction");
1129     }
1130    
1131     // On appelle la méthode de la classe utils qui renvoi le code de la
1132     // division d'un dossier, on la stocke pour ne pas refaire le calcul au
1133     // prochain appel de cette méthode
1134     $this->_division_from_dossier = $this->f->getDivisionFromDossier($dossier);
1135     // Logger
1136     $this->addToLog("getDivisionFromDossier(): retour de la valeur nouvellement calculée - '".$this->_division_from_dossier."'", EXTRA_VERBOSE_MODE);
1137     // On retourne la valeur retournée
1138     return $this->_division_from_dossier;
1139    
1140     }
1141    
1142     /**
1143     * Retourne le nom et le prénom de l'architecte qui a l'identifiant $id
1144     * @param integer $id
1145     * @param object $db
1146     * @return string
1147     */
1148     function getPrenomNomArchitecte($id){
1149    
1150     $coordonneesArchitecte = "";
1151     if ( $id != '' && is_numeric($id) ){
1152    
1153     $sql = "SELECT
1154     CONCAT(architecte.prenom, ' ', architecte.nom)
1155     FROM
1156     ".DB_PREFIXE."architecte
1157     WHERE
1158     architecte.architecte = ".$id;
1159     $coordonneesArchitecte = $this->db->getOne($sql);
1160     $this->f->addToLog("setSelect() : db->getOne(\"".$sql."\")", VERBOSE_MODE);
1161     if ( database::isError($coordonneesArchitecte)){
1162     $this->f->addToError("", $coordonneesArchitecte, $coordonneesArchitecte);
1163     return false;
1164     }
1165     }
1166     return $coordonneesArchitecte;
1167     }
1168    
1169     /**
1170     * Récupère l'instance de la classe dossier.
1171     *
1172     * @param string $dossier Identifiant
1173     *
1174     * @return object
1175     */
1176     function get_inst_dossier($dossier = null) {
1177     //
1178     if (is_null($this->inst_dossier)) {
1179     //
1180     if (is_null($dossier)) {
1181     $dossier = $this->getVal("dossier_instruction");
1182     }
1183     //
1184     require_once "../obj/dossier.class.php";
1185     $this->inst_dossier = new dossier($dossier);
1186     }
1187     //
1188     return $this->inst_dossier;
1189     }
1190    
1191     /**
1192     * Permet d’effectuer des actions après la modification des données dans la
1193     * base.
1194     *
1195     * @param integer $id Identifiant de l'objet
1196     * @param object &$db Instance de la bdd
1197     * @param array $val Liste des valeurs
1198     * @param mixed $DEBUG Debug
1199     *
1200     * @return boolean
1201     */
1202     function triggermodifierapres($id, &$db, $val, $DEBUG) {
1203    
1204     // Instance du dossier d'instruction
1205     $dossier = $this->get_inst_dossier();
1206    
1207     // Valeurs pour le calcul
1208     $valF = array();
1209    
1210     // Instance de la taxe d'aménagement
1211     require_once "../obj/taxe_amenagement.class.php";
1212     $inst_taxe_amenagement = new taxe_amenagement(0);
1213     // Récupération des champs nécessaires à la simulation
1214     $list_fields = $inst_taxe_amenagement->get_list_fields_simulation();
1215    
1216     // Pour chaque champ
1217     foreach ($list_fields as $field) {
1218     // Si un seul des champs requis a une valeur
1219     $getVal = $this->getVal($field);
1220     if (!empty($getVal)) {
1221     //
1222     $valF = $val;
1223     }
1224     }
1225    
1226     // Met à jour les montants du dossier
1227     if ($dossier->update_dossier_tax_mtn($dossier->getVal('tax_secteur'), $valF) == false) {
1228     //
1229     $this->addToMessage(_("La mise a jour des montants de la simulation de la taxe d'amenagement a echouee."));
1230     return false;
1231     }
1232    
1233     return true;
1234     }
1235    
1236     /**
1237     * Récupère toutes les valeurs de l'enregistrement.
1238     *
1239     * @return array
1240     */
1241     function get_form_val() {
1242    
1243     // Initialisation du tableau des résultats
1244     $result = array();
1245    
1246     // Pour chaque champs
1247     foreach ($this->champs as $champ) {
1248     // Récupère sa valeur
1249     $result[$champ] = $this->getVal($champ);
1250     }
1251    
1252     // Retourne le résultat
1253     return $result;
1254     }
1255    
1256     }// fin classe
1257     ?>

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26