1 |
mbroquet |
3730 |
<?php |
2 |
|
|
//$Id: consultation.class.php 5853 2016-02-03 09:08:36Z nmeucci $ |
3 |
|
|
//gen openMairie le 03/02/2016 10:04 |
4 |
|
|
|
5 |
|
|
require_once "../obj/om_dbform.class.php"; |
6 |
|
|
|
7 |
|
|
class consultation_gen extends om_dbform { |
8 |
|
|
|
9 |
|
|
var $table = "consultation"; |
10 |
|
|
var $clePrimaire = "consultation"; |
11 |
|
|
var $typeCle = "N"; |
12 |
|
|
var $required_field = array( |
13 |
|
|
"consultation", |
14 |
|
|
"date_envoi", |
15 |
|
|
"dossier", |
16 |
|
|
"service" |
17 |
|
|
); |
18 |
|
|
var $unique_key = array( |
19 |
|
|
"code_barres", |
20 |
|
|
); |
21 |
|
|
var $foreign_keys_extended = array( |
22 |
|
|
"avis_consultation" => array("avis_consultation", ), |
23 |
|
|
"dossier" => array("dossier", "dossier_instruction", "dossier_instruction_mes_encours", "dossier_instruction_tous_encours", "dossier_instruction_mes_clotures", "dossier_instruction_tous_clotures", ), |
24 |
|
|
"service" => array("service", ), |
25 |
|
|
); |
26 |
|
|
|
27 |
|
|
|
28 |
|
|
|
29 |
|
|
function setvalF($val) { |
30 |
|
|
//affectation valeur formulaire |
31 |
|
|
if (!is_numeric($val['consultation'])) { |
32 |
|
|
$this->valF['consultation'] = ""; // -> requis |
33 |
|
|
} else { |
34 |
|
|
$this->valF['consultation'] = $val['consultation']; |
35 |
|
|
} |
36 |
|
|
$this->valF['dossier'] = $val['dossier']; |
37 |
|
|
if ($val['date_envoi'] != "") { |
38 |
|
|
$this->valF['date_envoi'] = $this->dateDB($val['date_envoi']); |
39 |
|
|
} |
40 |
|
|
if ($val['date_retour'] != "") { |
41 |
|
|
$this->valF['date_retour'] = $this->dateDB($val['date_retour']); |
42 |
|
|
} else { |
43 |
|
|
$this->valF['date_retour'] = NULL; |
44 |
|
|
} |
45 |
|
|
if ($val['date_limite'] != "") { |
46 |
|
|
$this->valF['date_limite'] = $this->dateDB($val['date_limite']); |
47 |
|
|
} else { |
48 |
|
|
$this->valF['date_limite'] = NULL; |
49 |
|
|
} |
50 |
|
|
if (!is_numeric($val['service'])) { |
51 |
|
|
$this->valF['service'] = ""; // -> requis |
52 |
|
|
} else { |
53 |
|
|
$this->valF['service'] = $val['service']; |
54 |
|
|
} |
55 |
|
|
if (!is_numeric($val['avis_consultation'])) { |
56 |
|
|
$this->valF['avis_consultation'] = NULL; |
57 |
|
|
} else { |
58 |
|
|
$this->valF['avis_consultation'] = $val['avis_consultation']; |
59 |
|
|
} |
60 |
|
|
if ($val['date_reception'] != "") { |
61 |
|
|
$this->valF['date_reception'] = $this->dateDB($val['date_reception']); |
62 |
|
|
} else { |
63 |
|
|
$this->valF['date_reception'] = NULL; |
64 |
|
|
} |
65 |
|
|
$this->valF['motivation'] = $val['motivation']; |
66 |
|
|
if ($val['fichier'] == "") { |
67 |
|
|
$this->valF['fichier'] = NULL; |
68 |
|
|
} else { |
69 |
|
|
$this->valF['fichier'] = $val['fichier']; |
70 |
|
|
} |
71 |
|
|
if ($val['lu'] == 1 || $val['lu'] == "t" || $val['lu'] == "Oui") { |
72 |
|
|
$this->valF['lu'] = true; |
73 |
|
|
} else { |
74 |
|
|
$this->valF['lu'] = false; |
75 |
|
|
} |
76 |
|
|
if ($val['code_barres'] == "") { |
77 |
|
|
$this->valF['code_barres'] = NULL; |
78 |
|
|
} else { |
79 |
|
|
$this->valF['code_barres'] = $val['code_barres']; |
80 |
|
|
} |
81 |
|
|
if ($val['om_fichier_consultation'] == "") { |
82 |
|
|
$this->valF['om_fichier_consultation'] = NULL; |
83 |
|
|
} else { |
84 |
|
|
$this->valF['om_fichier_consultation'] = $val['om_fichier_consultation']; |
85 |
|
|
} |
86 |
|
|
if ($val['om_final_consultation'] == 1 || $val['om_final_consultation'] == "t" || $val['om_final_consultation'] == "Oui") { |
87 |
|
|
$this->valF['om_final_consultation'] = true; |
88 |
|
|
} else { |
89 |
|
|
$this->valF['om_final_consultation'] = false; |
90 |
|
|
} |
91 |
|
|
} |
92 |
|
|
|
93 |
|
|
//================================================= |
94 |
|
|
//cle primaire automatique [automatic primary key] |
95 |
|
|
//================================================== |
96 |
|
|
|
97 |
|
|
function setId(&$dnu1 = null) { |
98 |
|
|
//numero automatique |
99 |
|
|
$this->valF[$this->clePrimaire] = $this->f->db->nextId(DB_PREFIXE.$this->table); |
100 |
|
|
} |
101 |
|
|
|
102 |
|
|
function setValFAjout($val) { |
103 |
|
|
//numero automatique -> pas de controle ajout cle primaire |
104 |
|
|
} |
105 |
|
|
|
106 |
|
|
function verifierAjout() { |
107 |
|
|
//numero automatique -> pas de verfication de cle primaire |
108 |
|
|
} |
109 |
|
|
|
110 |
|
|
//========================== |
111 |
|
|
// Formulaire [form] |
112 |
|
|
//========================== |
113 |
|
|
/** |
114 |
|
|
* |
115 |
|
|
*/ |
116 |
|
|
function setType(&$form, $maj) { |
117 |
|
|
// Récupération du mode de l'action |
118 |
|
|
$crud = $this->get_action_crud($maj); |
119 |
|
|
|
120 |
|
|
// MODE AJOUTER |
121 |
|
|
if ($maj == 0 || $crud == 'create') { |
122 |
|
|
$form->setType("consultation", "hidden"); |
123 |
|
|
if ($this->is_in_context_of_foreign_key("dossier", $this->retourformulaire)) { |
124 |
|
|
$form->setType("dossier", "selecthiddenstatic"); |
125 |
|
|
} else { |
126 |
|
|
$form->setType("dossier", "select"); |
127 |
|
|
} |
128 |
|
|
$form->setType("date_envoi", "date"); |
129 |
|
|
$form->setType("date_retour", "date"); |
130 |
|
|
$form->setType("date_limite", "date"); |
131 |
|
|
if ($this->is_in_context_of_foreign_key("service", $this->retourformulaire)) { |
132 |
|
|
$form->setType("service", "selecthiddenstatic"); |
133 |
|
|
} else { |
134 |
|
|
$form->setType("service", "select"); |
135 |
|
|
} |
136 |
|
|
if ($this->is_in_context_of_foreign_key("avis_consultation", $this->retourformulaire)) { |
137 |
|
|
$form->setType("avis_consultation", "selecthiddenstatic"); |
138 |
|
|
} else { |
139 |
|
|
$form->setType("avis_consultation", "select"); |
140 |
|
|
} |
141 |
|
|
$form->setType("date_reception", "date"); |
142 |
|
|
$form->setType("motivation", "textarea"); |
143 |
|
|
$form->setType("fichier", "text"); |
144 |
|
|
$form->setType("lu", "checkbox"); |
145 |
|
|
$form->setType("code_barres", "text"); |
146 |
|
|
$form->setType("om_fichier_consultation", "text"); |
147 |
|
|
$form->setType("om_final_consultation", "checkbox"); |
148 |
|
|
} |
149 |
|
|
|
150 |
|
|
// MDOE MODIFIER |
151 |
|
|
if ($maj == 1 || $crud == 'update') { |
152 |
|
|
$form->setType("consultation", "hiddenstatic"); |
153 |
|
|
if ($this->is_in_context_of_foreign_key("dossier", $this->retourformulaire)) { |
154 |
|
|
$form->setType("dossier", "selecthiddenstatic"); |
155 |
|
|
} else { |
156 |
|
|
$form->setType("dossier", "select"); |
157 |
|
|
} |
158 |
|
|
$form->setType("date_envoi", "date"); |
159 |
|
|
$form->setType("date_retour", "date"); |
160 |
|
|
$form->setType("date_limite", "date"); |
161 |
|
|
if ($this->is_in_context_of_foreign_key("service", $this->retourformulaire)) { |
162 |
|
|
$form->setType("service", "selecthiddenstatic"); |
163 |
|
|
} else { |
164 |
|
|
$form->setType("service", "select"); |
165 |
|
|
} |
166 |
|
|
if ($this->is_in_context_of_foreign_key("avis_consultation", $this->retourformulaire)) { |
167 |
|
|
$form->setType("avis_consultation", "selecthiddenstatic"); |
168 |
|
|
} else { |
169 |
|
|
$form->setType("avis_consultation", "select"); |
170 |
|
|
} |
171 |
|
|
$form->setType("date_reception", "date"); |
172 |
|
|
$form->setType("motivation", "textarea"); |
173 |
|
|
$form->setType("fichier", "text"); |
174 |
|
|
$form->setType("lu", "checkbox"); |
175 |
|
|
$form->setType("code_barres", "text"); |
176 |
|
|
$form->setType("om_fichier_consultation", "text"); |
177 |
|
|
$form->setType("om_final_consultation", "checkbox"); |
178 |
|
|
} |
179 |
|
|
|
180 |
|
|
// MODE SUPPRIMER |
181 |
|
|
if ($maj == 2 || $crud == 'delete') { |
182 |
|
|
$form->setType("consultation", "hiddenstatic"); |
183 |
|
|
$form->setType("dossier", "selectstatic"); |
184 |
|
|
$form->setType("date_envoi", "hiddenstatic"); |
185 |
|
|
$form->setType("date_retour", "hiddenstatic"); |
186 |
|
|
$form->setType("date_limite", "hiddenstatic"); |
187 |
|
|
$form->setType("service", "selectstatic"); |
188 |
|
|
$form->setType("avis_consultation", "selectstatic"); |
189 |
|
|
$form->setType("date_reception", "hiddenstatic"); |
190 |
|
|
$form->setType("motivation", "hiddenstatic"); |
191 |
|
|
$form->setType("fichier", "hiddenstatic"); |
192 |
|
|
$form->setType("lu", "hiddenstatic"); |
193 |
|
|
$form->setType("code_barres", "hiddenstatic"); |
194 |
|
|
$form->setType("om_fichier_consultation", "hiddenstatic"); |
195 |
|
|
$form->setType("om_final_consultation", "hiddenstatic"); |
196 |
|
|
} |
197 |
|
|
|
198 |
|
|
// MODE CONSULTER |
199 |
|
|
if ($maj == 3 || $crud == 'read') { |
200 |
|
|
$form->setType("consultation", "static"); |
201 |
|
|
$form->setType("dossier", "selectstatic"); |
202 |
|
|
$form->setType("date_envoi", "datestatic"); |
203 |
|
|
$form->setType("date_retour", "datestatic"); |
204 |
|
|
$form->setType("date_limite", "datestatic"); |
205 |
|
|
$form->setType("service", "selectstatic"); |
206 |
|
|
$form->setType("avis_consultation", "selectstatic"); |
207 |
|
|
$form->setType("date_reception", "datestatic"); |
208 |
|
|
$form->setType("motivation", "textareastatic"); |
209 |
|
|
$form->setType("fichier", "static"); |
210 |
|
|
$form->setType("lu", "checkboxstatic"); |
211 |
|
|
$form->setType("code_barres", "static"); |
212 |
|
|
$form->setType("om_fichier_consultation", "static"); |
213 |
|
|
$form->setType("om_final_consultation", "checkboxstatic"); |
214 |
|
|
} |
215 |
|
|
|
216 |
|
|
} |
217 |
|
|
|
218 |
|
|
|
219 |
|
|
function setOnchange(&$form, $maj) { |
220 |
|
|
//javascript controle client |
221 |
|
|
$form->setOnchange('consultation','VerifNum(this)'); |
222 |
|
|
$form->setOnchange('date_envoi','fdate(this)'); |
223 |
|
|
$form->setOnchange('date_retour','fdate(this)'); |
224 |
|
|
$form->setOnchange('date_limite','fdate(this)'); |
225 |
|
|
$form->setOnchange('service','VerifNum(this)'); |
226 |
|
|
$form->setOnchange('avis_consultation','VerifNum(this)'); |
227 |
|
|
$form->setOnchange('date_reception','fdate(this)'); |
228 |
|
|
} |
229 |
|
|
/** |
230 |
|
|
* Methode setTaille |
231 |
|
|
*/ |
232 |
|
|
function setTaille(&$form, $maj) { |
233 |
|
|
$form->setTaille("consultation", 11); |
234 |
|
|
$form->setTaille("dossier", 30); |
235 |
|
|
$form->setTaille("date_envoi", 12); |
236 |
|
|
$form->setTaille("date_retour", 12); |
237 |
|
|
$form->setTaille("date_limite", 12); |
238 |
|
|
$form->setTaille("service", 11); |
239 |
|
|
$form->setTaille("avis_consultation", 11); |
240 |
|
|
$form->setTaille("date_reception", 12); |
241 |
|
|
$form->setTaille("motivation", 80); |
242 |
|
|
$form->setTaille("fichier", 30); |
243 |
|
|
$form->setTaille("lu", 1); |
244 |
|
|
$form->setTaille("code_barres", 12); |
245 |
|
|
$form->setTaille("om_fichier_consultation", 30); |
246 |
|
|
$form->setTaille("om_final_consultation", 1); |
247 |
|
|
} |
248 |
|
|
|
249 |
|
|
/** |
250 |
|
|
* Methode setMax |
251 |
|
|
*/ |
252 |
|
|
function setMax(&$form, $maj) { |
253 |
|
|
$form->setMax("consultation", 11); |
254 |
|
|
$form->setMax("dossier", 30); |
255 |
|
|
$form->setMax("date_envoi", 12); |
256 |
|
|
$form->setMax("date_retour", 12); |
257 |
|
|
$form->setMax("date_limite", 12); |
258 |
|
|
$form->setMax("service", 11); |
259 |
|
|
$form->setMax("avis_consultation", 11); |
260 |
|
|
$form->setMax("date_reception", 12); |
261 |
|
|
$form->setMax("motivation", 6); |
262 |
|
|
$form->setMax("fichier", 100); |
263 |
|
|
$form->setMax("lu", 1); |
264 |
|
|
$form->setMax("code_barres", 12); |
265 |
|
|
$form->setMax("om_fichier_consultation", 64); |
266 |
|
|
$form->setMax("om_final_consultation", 1); |
267 |
|
|
} |
268 |
|
|
|
269 |
|
|
|
270 |
|
|
function setLib(&$form, $maj) { |
271 |
|
|
//libelle des champs |
272 |
|
|
$form->setLib('consultation',_('consultation')); |
273 |
|
|
$form->setLib('dossier',_('dossier')); |
274 |
|
|
$form->setLib('date_envoi',_('date_envoi')); |
275 |
|
|
$form->setLib('date_retour',_('date_retour')); |
276 |
|
|
$form->setLib('date_limite',_('date_limite')); |
277 |
|
|
$form->setLib('service',_('service')); |
278 |
|
|
$form->setLib('avis_consultation',_('avis_consultation')); |
279 |
|
|
$form->setLib('date_reception',_('date_reception')); |
280 |
|
|
$form->setLib('motivation',_('motivation')); |
281 |
|
|
$form->setLib('fichier',_('fichier')); |
282 |
|
|
$form->setLib('lu',_('lu')); |
283 |
|
|
$form->setLib('code_barres',_('code_barres')); |
284 |
|
|
$form->setLib('om_fichier_consultation',_('om_fichier_consultation')); |
285 |
|
|
$form->setLib('om_final_consultation',_('om_final_consultation')); |
286 |
|
|
} |
287 |
|
|
/** |
288 |
|
|
* |
289 |
|
|
*/ |
290 |
|
|
function setSelect(&$form, $maj, &$dnu1 = null, $dnu2 = null) { |
291 |
|
|
|
292 |
|
|
// Inclusion du fichier de requêtes |
293 |
|
|
if (file_exists("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc.php")) { |
294 |
|
|
include "../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc.php"; |
295 |
|
|
} elseif (file_exists("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc")) { |
296 |
|
|
include "../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc"; |
297 |
|
|
} |
298 |
|
|
|
299 |
|
|
// avis_consultation |
300 |
|
|
$this->init_select($form, $this->f->db, $maj, null, "avis_consultation", $sql_avis_consultation, $sql_avis_consultation_by_id, true); |
301 |
|
|
// dossier |
302 |
|
|
$this->init_select($form, $this->f->db, $maj, null, "dossier", $sql_dossier, $sql_dossier_by_id, false); |
303 |
|
|
// service |
304 |
|
|
$this->init_select($form, $this->f->db, $maj, null, "service", $sql_service, $sql_service_by_id, true); |
305 |
|
|
} |
306 |
|
|
|
307 |
|
|
|
308 |
|
|
//================================== |
309 |
|
|
// sous Formulaire |
310 |
|
|
//================================== |
311 |
|
|
|
312 |
|
|
|
313 |
|
|
function setValsousformulaire(&$form, $maj, $validation, $idxformulaire, $retourformulaire, $typeformulaire, &$dnu1 = null, $dnu2 = null) { |
314 |
|
|
$this->retourformulaire = $retourformulaire; |
315 |
|
|
if($validation == 0) { |
316 |
|
|
if($this->is_in_context_of_foreign_key('avis_consultation', $this->retourformulaire)) |
317 |
|
|
$form->setVal('avis_consultation', $idxformulaire); |
318 |
|
|
if($this->is_in_context_of_foreign_key('dossier', $this->retourformulaire)) |
319 |
|
|
$form->setVal('dossier', $idxformulaire); |
320 |
|
|
if($this->is_in_context_of_foreign_key('service', $this->retourformulaire)) |
321 |
|
|
$form->setVal('service', $idxformulaire); |
322 |
|
|
}// fin validation |
323 |
|
|
$this->set_form_default_values($form, $maj, $validation); |
324 |
|
|
}// fin setValsousformulaire |
325 |
|
|
|
326 |
|
|
//================================== |
327 |
|
|
// cle secondaire |
328 |
|
|
//================================== |
329 |
|
|
|
330 |
|
|
|
331 |
|
|
} |
332 |
|
|
|
333 |
|
|
?> |