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