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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 342 - (show annotations)
Mon Jul 2 09:36:56 2012 UTC (12 years, 7 months ago) by fraynaud
File size: 9634 byte(s)
openfoncier version sig wms


1 <?php
2 //$Id$
3 //gen openMairie le 28/06/2012 16:26
4 require_once ("../obj/om_dbform.class.php");
5
6 class destination_shon_gen extends om_dbform {
7 var $table="destination_shon";
8 var $clePrimaire="destination_shon";
9 var $typeCle="N";
10 var $retourformulaire;
11
12 function setvalF($val) {
13 //affectation valeur formulaire
14 if(!is_numeric($val['destination_shon']))
15 unset($this->valF['destination_shon']);
16 else
17 $this->valF['destination_shon'] = $val['destination_shon'];
18 $this->valF['destination'] = $val['destination'];
19 $this->valF['shon'] = $val['shon'];
20 $this->valF['shon_anterieure'] = $val['shon_anterieure'];
21 $this->valF['shon_demolie'] = $val['shon_demolie'];
22 $this->valF['shon_anterieure_supprimee'] = $val['shon_anterieure_supprimee'];
23 $this->valF['shon_nouvelle_transformee'] = $val['shon_nouvelle_transformee'];
24 $this->valF['shon_nouvelle'] = $val['shon_nouvelle'];
25 $this->valF['shon_shob_transformee'] = $val['shon_shob_transformee'];
26 $this->valF['dossier'] = $val['dossier'];
27 }
28
29 //=================================================
30 //cle primaire automatique [automatic primary key]
31 //==================================================
32
33 function setId(&$db) {
34 //numero automatique
35 $this->valF[$this->table] = $db->nextId(DB_PREFIXE.$this->table);
36 }
37
38 function setValFAjout($val) {
39 //numero automatique -> pas de controle ajout cle primaire
40 }
41
42 function verifierAjout() {
43 //numero automatique -> pas de verfication de cle primaire
44 }
45
46 //====================================
47 // verifier avant validation [verify]
48 //=====================================
49 /**
50 * Methode verifier
51 */
52 function verifier($val = array(), &$db = NULL, $DEBUG = false) {
53 // On appelle la methode de la classe parent
54 parent::verifier($val, $db, $DEBUG);
55 // On verifie si le champ n'est pas vide
56 if ($this->valF['destination'] == "") {
57 $this->correct = false;
58 $this->addToMessage(_("Le champ")." "._("destination")." "._("est obligatoire"));
59 }
60 }
61
62
63 //==========================
64 // Formulaire [form]
65 //==========================
66
67 function setType(&$form,$maj) {
68 //type
69 if ($maj==0){ //ajout
70 $form->setType('destination_shon','hidden');// cle automatique
71 if($this->retourformulaire=='destination')
72 $form->setType('destination','hiddenstatic');
73 else
74 $form->setType('destination','select');
75 $form->setType('shon','text');
76 $form->setType('shon_anterieure','text');
77 $form->setType('shon_demolie','text');
78 $form->setType('shon_anterieure_supprimee','text');
79 $form->setType('shon_nouvelle_transformee','text');
80 $form->setType('shon_nouvelle','text');
81 $form->setType('shon_shob_transformee','text');
82 if($this->retourformulaire=='dossier')
83 $form->setType('dossier','hiddenstatic');
84 else
85 $form->setType('dossier','select');
86 }// fin ajout
87 if ($maj==1){ //modifier
88 $form->setType('destination_shon','hiddenstatic');
89 if($this->retourformulaire=='destination')
90 $form->setType('destination','hiddenstatic');
91 else
92 $form->setType('destination','select');
93 $form->setType('shon','text');
94 $form->setType('shon_anterieure','text');
95 $form->setType('shon_demolie','text');
96 $form->setType('shon_anterieure_supprimee','text');
97 $form->setType('shon_nouvelle_transformee','text');
98 $form->setType('shon_nouvelle','text');
99 $form->setType('shon_shob_transformee','text');
100 if($this->retourformulaire=='dossier')
101 $form->setType('dossier','hiddenstatic');
102 else
103 $form->setType('dossier','select');
104 }// fin modifier
105 if ($maj==2){ //supprimer
106 $form->setType('destination_shon','hiddenstatic');
107 $form->setType('destination','hiddenstatic');
108 $form->setType('shon','hiddenstatic');
109 $form->setType('shon_anterieure','hiddenstatic');
110 $form->setType('shon_demolie','hiddenstatic');
111 $form->setType('shon_anterieure_supprimee','hiddenstatic');
112 $form->setType('shon_nouvelle_transformee','hiddenstatic');
113 $form->setType('shon_nouvelle','hiddenstatic');
114 $form->setType('shon_shob_transformee','hiddenstatic');
115 $form->setType('dossier','hiddenstatic');
116 }//fin supprimer
117 }
118
119 function setOnchange(&$form,$maj) {
120 //javascript controle client
121 $form->setOnchange('destination_shon','VerifNum(this)');
122 }
123 /**
124 * Methode setTaille
125 */
126 function setTaille(&$form, $maj) {
127 $form->setTaille("destination_shon", 11);
128 $form->setTaille("destination", 10);
129 $form->setTaille("shon", 8);
130 $form->setTaille("shon_anterieure", 8);
131 $form->setTaille("shon_demolie", 8);
132 $form->setTaille("shon_anterieure_supprimee", 8);
133 $form->setTaille("shon_nouvelle_transformee", 8);
134 $form->setTaille("shon_nouvelle", 8);
135 $form->setTaille("shon_shob_transformee", 8);
136 $form->setTaille("dossier", 12);
137 }
138
139 /**
140 * Methode setMax
141 */
142 function setMax(&$form, $maj) {
143 $form->setMax("destination_shon", 11);
144 $form->setMax("destination", 2);
145 $form->setMax("shon", 8);
146 $form->setMax("shon_anterieure", 8);
147 $form->setMax("shon_demolie", 8);
148 $form->setMax("shon_anterieure_supprimee", 8);
149 $form->setMax("shon_nouvelle_transformee", 8);
150 $form->setMax("shon_nouvelle", 8);
151 $form->setMax("shon_shob_transformee", 8);
152 $form->setMax("dossier", 12);
153 }
154
155
156 function setLib(&$form,$maj) {
157 //libelle des champs
158 $form->setLib('destination_shon',_('destination_shon'));
159 $form->setLib('destination',_('destination'));
160 $form->setLib('shon',_('shon'));
161 $form->setLib('shon_anterieure',_('shon_anterieure'));
162 $form->setLib('shon_demolie',_('shon_demolie'));
163 $form->setLib('shon_anterieure_supprimee',_('shon_anterieure_supprimee'));
164 $form->setLib('shon_nouvelle_transformee',_('shon_nouvelle_transformee'));
165 $form->setLib('shon_nouvelle',_('shon_nouvelle'));
166 $form->setLib('shon_shob_transformee',_('shon_shob_transformee'));
167 $form->setLib('dossier',_('dossier'));
168 }
169
170 function setSelect(&$form, $maj,&$db,$debug) {
171 if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc.php"))
172 include ("../sql/".$db->phptype."/".$this->table.".form.inc.php");
173 elseif(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc"))
174 include ("../sql/".$db->phptype."/".$this->table.".form.inc");
175 if($maj<2){
176 // destination
177 $contenu=array();
178 $res = $db->query($sql_destination);
179 // Logger
180 $this->addToLog("setSelect()[gen/obj]: db->query(\"".$sql_destination."\");", VERBOSE_MODE);
181 if (database::isError($res))
182 die($res->getMessage().$sql_destination);
183 else{
184 if ($debug == 1)
185 echo " la requete ".$sql_destination." est executee<br>";
186 $contenu[0][0]='';
187 $contenu[1][0]=_('choisir')."&nbsp;"._('destination');
188 $k=1;
189 while ($row=& $res->fetchRow()){
190 $contenu[0][$k]=$row[0];
191 $contenu[1][$k]=$row[1];
192 $k++;
193 }
194 $form->setSelect('destination',$contenu);
195 }// fin error db
196 // dossier
197 $contenu=array();
198 $res = $db->query($sql_dossier);
199 // Logger
200 $this->addToLog("setSelect()[gen/obj]: db->query(\"".$sql_dossier."\");", VERBOSE_MODE);
201 if (database::isError($res))
202 die($res->getMessage().$sql_dossier);
203 else{
204 if ($debug == 1)
205 echo " la requete ".$sql_dossier." est executee<br>";
206 $contenu[0][0]='';
207 $contenu[1][0]=_('choisir')."&nbsp;"._('dossier');
208 $k=1;
209 while ($row=& $res->fetchRow()){
210 $contenu[0][$k]=$row[0];
211 $contenu[1][$k]=$row[1];
212 $k++;
213 }
214 $form->setSelect('dossier',$contenu);
215 }// fin error db
216 }// fin maj
217 }// fin select
218
219 //==================================
220 // sous Formulaire [subform]
221 //==================================
222
223 function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire,&$db,$DEBUG=null){
224 $this->retourformulaire = $retourformulaire;
225 if($validation==0) {
226 if($retourformulaire =='destination')
227 $form->setVal('destination', $idxformulaire);
228 if($retourformulaire =='dossier')
229 $form->setVal('dossier', $idxformulaire);
230 }// fin validation
231 }// fin setValsousformulaire
232
233 //==================================
234 // cle secondaire [secondary key]
235 //==================================
236
237 }// fin classe
238 ?>

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26