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