/[openfoncier]/branches/lien-openaria/obj/donnees_techniques.class.php
ViewVC logotype

Contents of /branches/lien-openaria/obj/donnees_techniques.class.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4161 - (show annotations)
Fri May 13 14:41:58 2016 UTC (8 years, 8 months ago) by fmichon
File size: 59838 byte(s)
* Création d'une branche pour développer le lien avec l'application openARIA.

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26