1 |
vpihour |
633 |
<?php |
2 |
|
|
//$Id$ |
3 |
softime |
2142 |
//gen openMairie le 08/08/2013 15:24 |
4 |
vpihour |
633 |
|
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 |
nhaye |
1232 |
"libelle", |
13 |
vpihour |
633 |
"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 |
nhaye |
1232 |
$this->valF['libelle'] = $val['libelle']; |
25 |
|
|
if ($val['dossier_autorisation'] == "") { |
26 |
|
|
$this->valF['dossier_autorisation'] = NULL; |
27 |
vpihour |
633 |
} else { |
28 |
nhaye |
1232 |
$this->valF['dossier_autorisation'] = $val['dossier_autorisation']; |
29 |
vpihour |
633 |
} |
30 |
nhaye |
2082 |
if ($val['dossier'] == "") { |
31 |
|
|
$this->valF['dossier'] = NULL; |
32 |
|
|
} else { |
33 |
|
|
$this->valF['dossier'] = $val['dossier']; |
34 |
|
|
} |
35 |
vpihour |
633 |
} |
36 |
|
|
|
37 |
|
|
//================================================= |
38 |
|
|
//cle primaire automatique [automatic primary key] |
39 |
|
|
//================================================== |
40 |
|
|
|
41 |
|
|
function setId(&$db) { |
42 |
|
|
//numero automatique |
43 |
|
|
$this->valF[$this->clePrimaire] = $db->nextId(DB_PREFIXE.$this->table); |
44 |
|
|
} |
45 |
|
|
|
46 |
|
|
function setValFAjout($val) { |
47 |
|
|
//numero automatique -> pas de controle ajout cle primaire |
48 |
|
|
} |
49 |
|
|
|
50 |
|
|
function verifierAjout() { |
51 |
|
|
//numero automatique -> pas de verfication de cle primaire |
52 |
|
|
} |
53 |
|
|
|
54 |
|
|
//========================== |
55 |
|
|
// Formulaire [form] |
56 |
|
|
//========================== |
57 |
|
|
|
58 |
|
|
function setType(&$form,$maj) { |
59 |
|
|
//type |
60 |
|
|
if ($maj==0){ //ajout |
61 |
|
|
$form->setType('lot','hidden');// cle automatique |
62 |
nhaye |
1232 |
$form->setType('libelle','text'); |
63 |
vpihour |
690 |
|
64 |
nhaye |
1232 |
if($this->retourformulaire=='dossier_autorisation' |
65 |
|
|
and $form->val['dossier_autorisation'] == $this->getParameter('idxformulaire')) { |
66 |
|
|
$form->setType('dossier_autorisation','selecthiddenstatic'); |
67 |
vpihour |
690 |
} else { |
68 |
nhaye |
1232 |
$form->setType('dossier_autorisation','select'); |
69 |
vpihour |
690 |
} |
70 |
nhaye |
2082 |
|
71 |
|
|
if($this->retourformulaire=='dossier' |
72 |
|
|
and $form->val['dossier'] == $this->getParameter('idxformulaire')) { |
73 |
|
|
$form->setType('dossier','selecthiddenstatic'); |
74 |
|
|
} else { |
75 |
|
|
$form->setType('dossier','select'); |
76 |
|
|
} |
77 |
vpihour |
633 |
}// fin ajout |
78 |
|
|
if ($maj==1){ //modifier |
79 |
|
|
$form->setType('lot','hiddenstatic'); |
80 |
nhaye |
1232 |
$form->setType('libelle','text'); |
81 |
vpihour |
690 |
|
82 |
nhaye |
1232 |
if($this->retourformulaire=='dossier_autorisation' |
83 |
|
|
and $form->val['dossier_autorisation'] == $this->getParameter('idxformulaire')) { |
84 |
|
|
$form->setType('dossier_autorisation','selecthiddenstatic'); |
85 |
vpihour |
690 |
} else { |
86 |
nhaye |
1232 |
$form->setType('dossier_autorisation','select'); |
87 |
vpihour |
690 |
} |
88 |
nhaye |
2082 |
|
89 |
|
|
if($this->retourformulaire=='dossier' |
90 |
|
|
and $form->val['dossier'] == $this->getParameter('idxformulaire')) { |
91 |
|
|
$form->setType('dossier','selecthiddenstatic'); |
92 |
|
|
} else { |
93 |
|
|
$form->setType('dossier','select'); |
94 |
|
|
} |
95 |
vpihour |
633 |
}// fin modifier |
96 |
|
|
if ($maj==2){ //supprimer |
97 |
|
|
$form->setType('lot','hiddenstatic'); |
98 |
nhaye |
1232 |
$form->setType('libelle','hiddenstatic'); |
99 |
|
|
$form->setType('dossier_autorisation','selectstatic'); |
100 |
nhaye |
2082 |
$form->setType('dossier','selectstatic'); |
101 |
vpihour |
633 |
}//fin supprimer |
102 |
|
|
if ($maj==3){ //consulter |
103 |
|
|
$form->setType('lot','static'); |
104 |
nhaye |
1232 |
$form->setType('libelle','static'); |
105 |
|
|
$form->setType('dossier_autorisation','selectstatic'); |
106 |
nhaye |
2082 |
$form->setType('dossier','selectstatic'); |
107 |
vpihour |
633 |
}//fin consulter |
108 |
|
|
} |
109 |
|
|
|
110 |
|
|
function setOnchange(&$form,$maj) { |
111 |
|
|
//javascript controle client |
112 |
|
|
$form->setOnchange('lot','VerifNum(this)'); |
113 |
|
|
} |
114 |
|
|
/** |
115 |
|
|
* Methode setTaille |
116 |
|
|
*/ |
117 |
|
|
function setTaille(&$form, $maj) { |
118 |
|
|
$form->setTaille("lot", 11); |
119 |
nhaye |
1232 |
$form->setTaille("libelle", 30); |
120 |
|
|
$form->setTaille("dossier_autorisation", 20); |
121 |
softime |
2142 |
$form->setTaille("dossier", 30); |
122 |
vpihour |
633 |
} |
123 |
|
|
|
124 |
|
|
/** |
125 |
|
|
* Methode setMax |
126 |
|
|
*/ |
127 |
|
|
function setMax(&$form, $maj) { |
128 |
|
|
$form->setMax("lot", 11); |
129 |
nhaye |
1232 |
$form->setMax("libelle", 80); |
130 |
|
|
$form->setMax("dossier_autorisation", 20); |
131 |
softime |
2142 |
$form->setMax("dossier", 30); |
132 |
vpihour |
633 |
} |
133 |
|
|
|
134 |
|
|
|
135 |
|
|
function setLib(&$form,$maj) { |
136 |
|
|
//libelle des champs |
137 |
|
|
$form->setLib('lot',_('lot')); |
138 |
nhaye |
1232 |
$form->setLib('libelle',_('libelle')); |
139 |
|
|
$form->setLib('dossier_autorisation',_('dossier_autorisation')); |
140 |
nhaye |
2082 |
$form->setLib('dossier',_('dossier')); |
141 |
vpihour |
633 |
} |
142 |
|
|
|
143 |
vpihour |
690 |
function setSelect(&$form, $maj,&$db,$debug) { |
144 |
|
|
if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc.php")) |
145 |
|
|
include ("../sql/".$db->phptype."/".$this->table.".form.inc.php"); |
146 |
|
|
elseif(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc")) |
147 |
|
|
include ("../sql/".$db->phptype."/".$this->table.".form.inc"); |
148 |
|
|
|
149 |
nhaye |
2082 |
// dossier |
150 |
|
|
$this->init_select($form, $db, $maj, $debug, "dossier", |
151 |
|
|
$sql_dossier, $sql_dossier_by_id, false); |
152 |
|
|
|
153 |
nhaye |
1232 |
// dossier_autorisation |
154 |
|
|
$this->init_select($form, $db, $maj, $debug, "dossier_autorisation", |
155 |
|
|
$sql_dossier_autorisation, $sql_dossier_autorisation_by_id, false); |
156 |
vpihour |
690 |
}// fin select |
157 |
|
|
|
158 |
vpihour |
633 |
//================================== |
159 |
|
|
// sous Formulaire [subform] |
160 |
|
|
//================================== |
161 |
|
|
|
162 |
|
|
function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire,&$db,$DEBUG=null){ |
163 |
|
|
$this->retourformulaire = $retourformulaire; |
164 |
vpihour |
690 |
if($validation == 0) { |
165 |
nhaye |
2082 |
if($retourformulaire =='dossier') |
166 |
|
|
$form->setVal('dossier', $idxformulaire); |
167 |
nhaye |
1232 |
if($retourformulaire =='dossier_autorisation') |
168 |
|
|
$form->setVal('dossier_autorisation', $idxformulaire); |
169 |
vpihour |
690 |
}// fin validation |
170 |
vpihour |
633 |
}// fin setValsousformulaire |
171 |
|
|
|
172 |
|
|
//================================== |
173 |
|
|
// cle secondaire [secondary key] |
174 |
|
|
//================================== |
175 |
|
|
/** |
176 |
|
|
* Methode clesecondaire |
177 |
|
|
*/ |
178 |
|
|
function cleSecondaire($id, &$db = NULL, $val = array(), $DEBUG = false) { |
179 |
|
|
// On appelle la methode de la classe parent |
180 |
|
|
parent::cleSecondaire($id, $db, $val, $DEBUG); |
181 |
vpihour |
1249 |
// Verification de la cle secondaire : donnees_techniques |
182 |
|
|
$this->rechercheTable($db, "donnees_techniques", "lot", $id); |
183 |
vpihour |
633 |
// Verification de la cle secondaire : lien_lot_demandeur |
184 |
|
|
$this->rechercheTable($db, "lien_lot_demandeur", "lot", $id); |
185 |
|
|
} |
186 |
|
|
|
187 |
|
|
|
188 |
|
|
}// fin classe |
189 |
|
|
?> |