/[openfoncier]/trunk/gen/obj/lot.class.php
ViewVC logotype

Contents of /trunk/gen/obj/lot.class.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1263 - (show annotations)
Fri Feb 15 16:14:17 2013 UTC (11 years, 11 months ago) by nhaye
File size: 5582 byte(s)
Modification de la structure de la base : les cerfa sont maintenant liés aux types de dossier d'instruction,
modification des requêtes en fonction de la modification de la structure,
ajout de correction d'erreurs

1 <?php
2 //$Id$
3 //gen openMairie le 15/02/2013 16:29
4
5 require_once ("../obj/om_dbform.class.php");
6
7 class lot_gen extends om_dbform {
8 var $table="lot";
9 var $clePrimaire="lot";
10 var $typeCle="N";
11 var $required_field=array(
12 "libelle",
13 "lot"
14 );
15 var $retourformulaire;
16
17 function setvalF($val) {
18 //affectation valeur formulaire
19 if (!is_numeric($val['lot'])) {
20 $this->valF['lot'] = ""; // -> requis
21 } else {
22 $this->valF['lot'] = $val['lot'];
23 }
24 $this->valF['libelle'] = $val['libelle'];
25 if ($val['dossier_autorisation'] == "") {
26 $this->valF['dossier_autorisation'] = NULL;
27 } else {
28 $this->valF['dossier_autorisation'] = $val['dossier_autorisation'];
29 }
30 }
31
32 //=================================================
33 //cle primaire automatique [automatic primary key]
34 //==================================================
35
36 function setId(&$db) {
37 //numero automatique
38 $this->valF[$this->clePrimaire] = $db->nextId(DB_PREFIXE.$this->table);
39 }
40
41 function setValFAjout($val) {
42 //numero automatique -> pas de controle ajout cle primaire
43 }
44
45 function verifierAjout() {
46 //numero automatique -> pas de verfication de cle primaire
47 }
48
49 //==========================
50 // Formulaire [form]
51 //==========================
52
53 function setType(&$form,$maj) {
54 //type
55 if ($maj==0){ //ajout
56 $form->setType('lot','hidden');// cle automatique
57 $form->setType('libelle','text');
58
59 if($this->retourformulaire=='dossier_autorisation'
60 and $form->val['dossier_autorisation'] == $this->getParameter('idxformulaire')) {
61 $form->setType('dossier_autorisation','selecthiddenstatic');
62 } else {
63 $form->setType('dossier_autorisation','select');
64 }
65 }// fin ajout
66 if ($maj==1){ //modifier
67 $form->setType('lot','hiddenstatic');
68 $form->setType('libelle','text');
69
70 if($this->retourformulaire=='dossier_autorisation'
71 and $form->val['dossier_autorisation'] == $this->getParameter('idxformulaire')) {
72 $form->setType('dossier_autorisation','selecthiddenstatic');
73 } else {
74 $form->setType('dossier_autorisation','select');
75 }
76 }// fin modifier
77 if ($maj==2){ //supprimer
78 $form->setType('lot','hiddenstatic');
79 $form->setType('libelle','hiddenstatic');
80 $form->setType('dossier_autorisation','selectstatic');
81 }//fin supprimer
82 if ($maj==3){ //consulter
83 $form->setType('lot','static');
84 $form->setType('libelle','static');
85 $form->setType('dossier_autorisation','selectstatic');
86 }//fin consulter
87 }
88
89 function setOnchange(&$form,$maj) {
90 //javascript controle client
91 $form->setOnchange('lot','VerifNum(this)');
92 }
93 /**
94 * Methode setTaille
95 */
96 function setTaille(&$form, $maj) {
97 $form->setTaille("lot", 11);
98 $form->setTaille("libelle", 30);
99 $form->setTaille("dossier_autorisation", 20);
100 }
101
102 /**
103 * Methode setMax
104 */
105 function setMax(&$form, $maj) {
106 $form->setMax("lot", 11);
107 $form->setMax("libelle", 80);
108 $form->setMax("dossier_autorisation", 20);
109 }
110
111
112 function setLib(&$form,$maj) {
113 //libelle des champs
114 $form->setLib('lot',_('lot'));
115 $form->setLib('libelle',_('libelle'));
116 $form->setLib('dossier_autorisation',_('dossier_autorisation'));
117 }
118
119 function setSelect(&$form, $maj,&$db,$debug) {
120 if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc.php"))
121 include ("../sql/".$db->phptype."/".$this->table.".form.inc.php");
122 elseif(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc"))
123 include ("../sql/".$db->phptype."/".$this->table.".form.inc");
124
125 // dossier_autorisation
126 $this->init_select($form, $db, $maj, $debug, "dossier_autorisation",
127 $sql_dossier_autorisation, $sql_dossier_autorisation_by_id, false);
128 }// fin select
129
130 //==================================
131 // sous Formulaire [subform]
132 //==================================
133
134 function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire,&$db,$DEBUG=null){
135 $this->retourformulaire = $retourformulaire;
136 if($validation == 0) {
137 if($retourformulaire =='dossier_autorisation')
138 $form->setVal('dossier_autorisation', $idxformulaire);
139 }// fin validation
140 }// fin setValsousformulaire
141
142 //==================================
143 // cle secondaire [secondary key]
144 //==================================
145 /**
146 * Methode clesecondaire
147 */
148 function cleSecondaire($id, &$db = NULL, $val = array(), $DEBUG = false) {
149 // On appelle la methode de la classe parent
150 parent::cleSecondaire($id, $db, $val, $DEBUG);
151 // Verification de la cle secondaire : donnees_techniques
152 $this->rechercheTable($db, "donnees_techniques", "lot", $id);
153 // Verification de la cle secondaire : lien_dossier_lot
154 $this->rechercheTable($db, "lien_dossier_lot", "lot", $id);
155 // Verification de la cle secondaire : lien_lot_demandeur
156 $this->rechercheTable($db, "lien_lot_demandeur", "lot", $id);
157 }
158
159
160 }// fin classe
161 ?>

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26