1 |
<?php |
<?php |
2 |
//$Id$ |
//$Id$ |
3 |
//gen openMairie le 08/08/2013 15:24 |
//gen openMairie le 16/02/2015 10:30 |
4 |
|
|
5 |
require_once ("../obj/om_dbform.class.php"); |
require_once "../obj/om_dbform.class.php"; |
6 |
|
|
7 |
class lot_gen extends om_dbform { |
class lot_gen extends om_dbform { |
8 |
var $table="lot"; |
|
9 |
var $clePrimaire="lot"; |
var $table = "lot"; |
10 |
var $typeCle="N"; |
var $clePrimaire = "lot"; |
11 |
var $required_field=array( |
var $typeCle = "N"; |
12 |
|
var $required_field = array( |
13 |
"libelle", |
"libelle", |
14 |
"lot" |
"lot" |
15 |
); |
); |
16 |
var $retourformulaire; |
|
17 |
|
var $foreign_keys_extended = array( |
18 |
|
"dossier" => array("dossier", ), |
19 |
|
"dossier_autorisation" => array("dossier_autorisation", ), |
20 |
|
); |
21 |
|
|
22 |
|
|
23 |
|
|
24 |
function setvalF($val) { |
function setvalF($val) { |
25 |
//affectation valeur formulaire |
//affectation valeur formulaire |
45 |
//cle primaire automatique [automatic primary key] |
//cle primaire automatique [automatic primary key] |
46 |
//================================================== |
//================================================== |
47 |
|
|
48 |
function setId(&$db) { |
function setId(&$dnu1 = null) { |
49 |
//numero automatique |
//numero automatique |
50 |
$this->valF[$this->clePrimaire] = $db->nextId(DB_PREFIXE.$this->table); |
$this->valF[$this->clePrimaire] = $this->f->db->nextId(DB_PREFIXE.$this->table); |
51 |
} |
} |
52 |
|
|
53 |
function setValFAjout($val) { |
function setValFAjout($val) { |
61 |
//========================== |
//========================== |
62 |
// Formulaire [form] |
// Formulaire [form] |
63 |
//========================== |
//========================== |
64 |
|
/** |
65 |
|
* |
66 |
|
*/ |
67 |
|
function setType(&$form, $maj) { |
68 |
|
|
69 |
function setType(&$form,$maj) { |
// MODE AJOUTER |
70 |
//type |
if ($maj == 0) { |
71 |
if ($maj==0){ //ajout |
$form->setType("lot", "hidden"); |
72 |
$form->setType('lot','hidden');// cle automatique |
$form->setType("libelle", "text"); |
73 |
$form->setType('libelle','text'); |
if ($this->is_in_context_of_foreign_key("dossier_autorisation", $this->retourformulaire) |
74 |
|
&& $form->val["dossier_autorisation"] == $this->getParameter("idxformulaire")) { |
75 |
if($this->retourformulaire=='dossier_autorisation' |
$form->setType("dossier_autorisation", "selecthiddenstatic"); |
|
and $form->val['dossier_autorisation'] == $this->getParameter('idxformulaire')) { |
|
|
$form->setType('dossier_autorisation','selecthiddenstatic'); |
|
76 |
} else { |
} else { |
77 |
$form->setType('dossier_autorisation','select'); |
$form->setType("dossier_autorisation", "select"); |
78 |
} |
} |
79 |
|
if ($this->is_in_context_of_foreign_key("dossier", $this->retourformulaire) |
80 |
if($this->retourformulaire=='dossier' |
&& $form->val["dossier"] == $this->getParameter("idxformulaire")) { |
81 |
and $form->val['dossier'] == $this->getParameter('idxformulaire')) { |
$form->setType("dossier", "selecthiddenstatic"); |
|
$form->setType('dossier','selecthiddenstatic'); |
|
82 |
} else { |
} else { |
83 |
$form->setType('dossier','select'); |
$form->setType("dossier", "select"); |
84 |
} |
} |
85 |
}// fin ajout |
} |
86 |
if ($maj==1){ //modifier |
|
87 |
$form->setType('lot','hiddenstatic'); |
// MDOE MODIFIER |
88 |
$form->setType('libelle','text'); |
if ($maj == 1) { |
89 |
|
$form->setType("lot", "hiddenstatic"); |
90 |
if($this->retourformulaire=='dossier_autorisation' |
$form->setType("libelle", "text"); |
91 |
and $form->val['dossier_autorisation'] == $this->getParameter('idxformulaire')) { |
if ($this->is_in_context_of_foreign_key("dossier_autorisation", $this->retourformulaire) |
92 |
$form->setType('dossier_autorisation','selecthiddenstatic'); |
&& $form->val["dossier_autorisation"] == $this->getParameter("idxformulaire")) { |
93 |
|
$form->setType("dossier_autorisation", "selecthiddenstatic"); |
94 |
} else { |
} else { |
95 |
$form->setType('dossier_autorisation','select'); |
$form->setType("dossier_autorisation", "select"); |
96 |
} |
} |
97 |
|
if ($this->is_in_context_of_foreign_key("dossier", $this->retourformulaire) |
98 |
if($this->retourformulaire=='dossier' |
&& $form->val["dossier"] == $this->getParameter("idxformulaire")) { |
99 |
and $form->val['dossier'] == $this->getParameter('idxformulaire')) { |
$form->setType("dossier", "selecthiddenstatic"); |
|
$form->setType('dossier','selecthiddenstatic'); |
|
100 |
} else { |
} else { |
101 |
$form->setType('dossier','select'); |
$form->setType("dossier", "select"); |
102 |
} |
} |
103 |
}// fin modifier |
} |
104 |
if ($maj==2){ //supprimer |
|
105 |
$form->setType('lot','hiddenstatic'); |
// MODE SUPPRIMER |
106 |
$form->setType('libelle','hiddenstatic'); |
if ($maj == 2) { |
107 |
$form->setType('dossier_autorisation','selectstatic'); |
$form->setType("lot", "hiddenstatic"); |
108 |
$form->setType('dossier','selectstatic'); |
$form->setType("libelle", "hiddenstatic"); |
109 |
}//fin supprimer |
$form->setType("dossier_autorisation", "selectstatic"); |
110 |
if ($maj==3){ //consulter |
$form->setType("dossier", "selectstatic"); |
111 |
$form->setType('lot','static'); |
} |
112 |
$form->setType('libelle','static'); |
|
113 |
$form->setType('dossier_autorisation','selectstatic'); |
// MODE CONSULTER |
114 |
$form->setType('dossier','selectstatic'); |
if ($maj == 3) { |
115 |
}//fin consulter |
$form->setType("lot", "static"); |
116 |
|
$form->setType("libelle", "static"); |
117 |
|
$form->setType("dossier_autorisation", "selectstatic"); |
118 |
|
$form->setType("dossier", "selectstatic"); |
119 |
|
} |
120 |
|
|
121 |
} |
} |
122 |
|
|
123 |
function setOnchange(&$form,$maj) { |
|
124 |
|
function setOnchange(&$form, $maj) { |
125 |
//javascript controle client |
//javascript controle client |
126 |
$form->setOnchange('lot','VerifNum(this)'); |
$form->setOnchange('lot','VerifNum(this)'); |
127 |
} |
} |
140 |
*/ |
*/ |
141 |
function setMax(&$form, $maj) { |
function setMax(&$form, $maj) { |
142 |
$form->setMax("lot", 11); |
$form->setMax("lot", 11); |
143 |
$form->setMax("libelle", 80); |
$form->setMax("libelle", 250); |
144 |
$form->setMax("dossier_autorisation", 20); |
$form->setMax("dossier_autorisation", 20); |
145 |
$form->setMax("dossier", 30); |
$form->setMax("dossier", 30); |
146 |
} |
} |
147 |
|
|
148 |
|
|
149 |
function setLib(&$form,$maj) { |
function setLib(&$form, $maj) { |
150 |
//libelle des champs |
//libelle des champs |
151 |
$form->setLib('lot',_('lot')); |
$form->setLib('lot',_('lot')); |
152 |
$form->setLib('libelle',_('libelle')); |
$form->setLib('libelle',_('libelle')); |
153 |
$form->setLib('dossier_autorisation',_('dossier_autorisation')); |
$form->setLib('dossier_autorisation',_('dossier_autorisation')); |
154 |
$form->setLib('dossier',_('dossier')); |
$form->setLib('dossier',_('dossier')); |
155 |
} |
} |
156 |
|
/** |
157 |
|
* |
158 |
|
*/ |
159 |
|
function setSelect(&$form, $maj, &$dnu1 = null, $dnu2 = null) { |
160 |
|
|
161 |
function setSelect(&$form, $maj,&$db,$debug) { |
// Inclusion du fichier de requĂȘtes |
162 |
if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc.php")) |
if (file_exists("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc.php")) { |
163 |
include ("../sql/".$db->phptype."/".$this->table.".form.inc.php"); |
include "../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc.php"; |
164 |
elseif(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc")) |
} elseif (file_exists("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc")) { |
165 |
include ("../sql/".$db->phptype."/".$this->table.".form.inc"); |
include "../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc"; |
166 |
|
} |
167 |
|
|
168 |
// dossier |
// dossier |
169 |
$this->init_select($form, $db, $maj, $debug, "dossier", |
$this->init_select($form, $this->f->db, $maj, null, "dossier", $sql_dossier, $sql_dossier_by_id, false); |
|
$sql_dossier, $sql_dossier_by_id, false); |
|
|
|
|
170 |
// dossier_autorisation |
// dossier_autorisation |
171 |
$this->init_select($form, $db, $maj, $debug, "dossier_autorisation", |
$this->init_select($form, $this->f->db, $maj, null, "dossier_autorisation", $sql_dossier_autorisation, $sql_dossier_autorisation_by_id, false); |
172 |
$sql_dossier_autorisation, $sql_dossier_autorisation_by_id, false); |
} |
173 |
}// fin select |
|
174 |
|
|
175 |
//================================== |
//================================== |
176 |
// sous Formulaire [subform] |
// sous Formulaire |
177 |
//================================== |
//================================== |
178 |
|
|
179 |
|
|
180 |
function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire,&$db,$DEBUG=null){ |
function setValsousformulaire(&$form, $maj, $validation, $idxformulaire, $retourformulaire, $typeformulaire, &$dnu1 = null, $dnu2 = null) { |
181 |
$this->retourformulaire = $retourformulaire; |
$this->retourformulaire = $retourformulaire; |
182 |
if($validation == 0) { |
if($validation == 0) { |
183 |
if($retourformulaire =='dossier') |
if($this->is_in_context_of_foreign_key('dossier', $this->retourformulaire)) |
184 |
$form->setVal('dossier', $idxformulaire); |
$form->setVal('dossier', $idxformulaire); |
185 |
if($retourformulaire =='dossier_autorisation') |
if($this->is_in_context_of_foreign_key('dossier_autorisation', $this->retourformulaire)) |
186 |
$form->setVal('dossier_autorisation', $idxformulaire); |
$form->setVal('dossier_autorisation', $idxformulaire); |
187 |
}// fin validation |
}// fin validation |
188 |
|
$this->set_form_default_values($form, $maj, $validation); |
189 |
}// fin setValsousformulaire |
}// fin setValsousformulaire |
190 |
|
|
191 |
//================================== |
//================================== |
192 |
// cle secondaire [secondary key] |
// cle secondaire |
193 |
//================================== |
//================================== |
194 |
|
|
195 |
/** |
/** |
196 |
* Methode clesecondaire |
* Methode clesecondaire |
197 |
*/ |
*/ |
198 |
function cleSecondaire($id, &$db = NULL, $val = array(), $DEBUG = false) { |
function cleSecondaire($id, &$dnu1 = null, $val = array(), $dnu2 = null) { |
199 |
// On appelle la methode de la classe parent |
// On appelle la methode de la classe parent |
200 |
parent::cleSecondaire($id, $db, $val, $DEBUG); |
parent::cleSecondaire($id); |
201 |
// Verification de la cle secondaire : donnees_techniques |
// Verification de la cle secondaire : donnees_techniques |
202 |
$this->rechercheTable($db, "donnees_techniques", "lot", $id); |
$this->rechercheTable($this->f->db, "donnees_techniques", "lot", $id); |
203 |
// Verification de la cle secondaire : lien_lot_demandeur |
// Verification de la cle secondaire : lien_lot_demandeur |
204 |
$this->rechercheTable($db, "lien_lot_demandeur", "lot", $id); |
$this->rechercheTable($this->f->db, "lien_lot_demandeur", "lot", $id); |
205 |
} |
} |
206 |
|
|
207 |
|
|
|
}// fin classe |
|
|
?> |
|
208 |
|
} |
209 |
|
|
210 |
|
?> |