1 |
vpihour |
633 |
<?php |
2 |
|
|
//$Id$ |
3 |
|
|
//gen openMairie le 08/11/2012 14:59 |
4 |
|
|
|
5 |
|
|
require_once ("../gen/obj/demandeur.class.php"); |
6 |
|
|
|
7 |
|
|
class demandeur extends demandeur_gen { |
8 |
|
|
|
9 |
|
|
function demandeur($id,&$db,$debug) { |
10 |
|
|
$this->constructeur($id,$db,$debug); |
11 |
|
|
}// fin constructeur |
12 |
vpihour |
703 |
|
13 |
vpihour |
805 |
/* |
14 |
|
|
* Pays par défaut : France |
15 |
|
|
*/ |
16 |
|
|
function setVal(&$form, $maj, $validation, &$db) { |
17 |
|
|
if($maj == 0) { |
18 |
|
|
$form->setVal("pays",'France'); |
19 |
|
|
} |
20 |
|
|
} |
21 |
vpihour |
799 |
|
22 |
|
|
/* |
23 |
nhaye |
1048 |
* Pays par défaut : France |
24 |
|
|
*/ |
25 |
|
|
function setValSousFormulaire(&$form, $maj, $validation, &$db) { |
26 |
|
|
if($maj == 0) { |
27 |
|
|
$form->setVal("pays",'France'); |
28 |
|
|
} |
29 |
|
|
} |
30 |
|
|
|
31 |
|
|
/* |
32 |
vpihour |
799 |
* Select pour les champs qualite et type_demandeur |
33 |
|
|
*/ |
34 |
|
|
function setType(&$form,$maj) { |
35 |
|
|
parent::setType($form,$maj); |
36 |
|
|
if ($maj < 2) { //ajouter et modifier |
37 |
|
|
|
38 |
|
|
$form->setType('type_demandeur', 'select'); |
39 |
|
|
$form->setType('qualite', 'select'); |
40 |
nhaye |
1048 |
if($maj == 0 AND $this->getParameter("idx_demandeur") != "") { |
41 |
|
|
$form->setType('frequent','hidden'); |
42 |
|
|
$form->setType('qualite','selectdisabled'); |
43 |
|
|
$form->setType('particulier_nom','textdisabled'); |
44 |
|
|
$form->setType('particulier_prenom','textdisabled'); |
45 |
|
|
$form->setType('particulier_date_naissance','datedisabled'); |
46 |
|
|
$form->setType('particulier_commune_naissance','textdisabled'); |
47 |
|
|
$form->setType('particulier_departement_naissance','textdisabled'); |
48 |
|
|
$form->setType('personne_morale_denomination','textdisabled'); |
49 |
|
|
$form->setType('personne_morale_raison_sociale','textdisabled'); |
50 |
|
|
$form->setType('personne_morale_siret','textdisabled'); |
51 |
|
|
$form->setType('personne_morale_categorie_juridique','textdisabled'); |
52 |
|
|
$form->setType('personne_morale_nom','textdisabled'); |
53 |
|
|
$form->setType('personne_morale_prenom','textdisabled'); |
54 |
|
|
$form->setType('particulier_civilite','selectdisabled'); |
55 |
|
|
$form->setType('personne_morale_civilite','selectdisabled'); |
56 |
|
|
$form->setType('telephone_fixe','textdisabled'); |
57 |
|
|
$form->setType('telephone_mobile','textdisabled'); |
58 |
|
|
$form->setType('indicatif','textdisabled'); |
59 |
|
|
$form->setType('courriel','textdisabled'); |
60 |
|
|
|
61 |
|
|
} |
62 |
nhaye |
1042 |
// Champs disabled pour la modif de petitionnaires frequents |
63 |
|
|
// Solution temporaire |
64 |
|
|
if ($maj==1){ //modifier |
65 |
|
|
if($this->getVal('frequent') == 't') { |
66 |
|
|
$form->setType('qualite','selectdisabled'); |
67 |
|
|
$form->setType('particulier_nom','textdisabled'); |
68 |
|
|
$form->setType('particulier_prenom','textdisabled'); |
69 |
|
|
$form->setType('particulier_date_naissance','datedisabled'); |
70 |
|
|
$form->setType('particulier_commune_naissance','textdisabled'); |
71 |
|
|
$form->setType('particulier_departement_naissance','textdisabled'); |
72 |
|
|
$form->setType('personne_morale_denomination','textdisabled'); |
73 |
|
|
$form->setType('personne_morale_raison_sociale','textdisabled'); |
74 |
|
|
$form->setType('personne_morale_siret','textdisabled'); |
75 |
|
|
$form->setType('personne_morale_categorie_juridique','textdisabled'); |
76 |
|
|
$form->setType('personne_morale_nom','textdisabled'); |
77 |
|
|
$form->setType('personne_morale_prenom','textdisabled'); |
78 |
|
|
$form->setType('numero','textdisabled'); |
79 |
|
|
$form->setType('voie','textdisabled'); |
80 |
|
|
$form->setType('complement','textdisabled'); |
81 |
|
|
$form->setType('lieu_dit','textdisabled'); |
82 |
|
|
$form->setType('localite','textdisabled'); |
83 |
|
|
$form->setType('code_postal','textdisabled'); |
84 |
|
|
$form->setType('bp','textdisabled'); |
85 |
|
|
$form->setType('cedex','textdisabled'); |
86 |
|
|
$form->setType('pays','textdisabled'); |
87 |
|
|
$form->setType('division_territoriale','textdisabled'); |
88 |
|
|
$form->setType('telephone_fixe','textdisabled'); |
89 |
|
|
$form->setType('telephone_mobile','textdisabled'); |
90 |
|
|
$form->setType('indicatif','textdisabled'); |
91 |
|
|
$form->setType('courriel','textdisabled'); |
92 |
|
|
$form->setType('notification','checkboxdisabled'); |
93 |
|
|
$form->setType('frequent','checkboxdisabled'); |
94 |
|
|
$form->setType('particulier_civilite','selectdisabled'); |
95 |
|
|
$form->setType('personne_morale_civilite','selectdisabled'); |
96 |
|
|
} |
97 |
|
|
}// fin modifier |
98 |
vpihour |
799 |
} |
99 |
nhaye |
850 |
$form->setType('demandeur', 'hidden'); |
100 |
nhaye |
1042 |
|
101 |
vpihour |
799 |
} |
102 |
|
|
|
103 |
|
|
/* |
104 |
|
|
* Select pour le type_demandeur et qualite |
105 |
|
|
*/ |
106 |
|
|
function setSelect(&$form, $maj,&$db,$debug) { |
107 |
|
|
parent::setSelect($form, $maj,$db,$debug); |
108 |
|
|
|
109 |
|
|
/*Lors d'un ajout ou d'une modification*/ |
110 |
|
|
if( $maj < 2 ){ |
111 |
|
|
|
112 |
|
|
/* type_demandeur*/ |
113 |
|
|
$contenu=array(); |
114 |
|
|
|
115 |
|
|
$contenu[0][0]=""; |
116 |
|
|
$contenu[1][0]=_('choisir')." "._('type_demandeur'); |
117 |
|
|
$contenu[0][1]="petitionnaire"; |
118 |
|
|
$contenu[1][1]=_('petitionnaire'); |
119 |
|
|
$contenu[0][2]="delegataire"; |
120 |
|
|
$contenu[1][2]=_('delegataire'); |
121 |
|
|
|
122 |
|
|
$form->setSelect("type_demandeur",$contenu); |
123 |
|
|
|
124 |
|
|
/* qualite*/ |
125 |
|
|
$contenu=array(); |
126 |
|
|
|
127 |
vpihour |
805 |
$contenu[0][0]="particulier"; |
128 |
|
|
$contenu[1][0]=_('particulier'); |
129 |
|
|
$contenu[0][1]="personne_morale"; |
130 |
|
|
$contenu[1][1]=_('personne morale'); |
131 |
vpihour |
799 |
|
132 |
|
|
$form->setSelect("qualite",$contenu); |
133 |
|
|
} |
134 |
|
|
} |
135 |
|
|
|
136 |
|
|
/* |
137 |
vpihour |
1058 |
* Ajoute l'action javascript sur le select de la qualité |
138 |
vpihour |
799 |
*/ |
139 |
|
|
function setOnchange(&$form,$maj){ |
140 |
|
|
parent::setOnchange($form,$maj); |
141 |
|
|
|
142 |
|
|
$form->setOnchange("qualite","changeDemandeurType('qualite');"); |
143 |
|
|
} |
144 |
nhaye |
802 |
|
145 |
|
|
/** |
146 |
nhaye |
807 |
* Ajout d'un champs caché permettant de linker l'id du demandeur |
147 |
|
|
* recement ajouté |
148 |
|
|
**/ |
149 |
|
|
function sousFormSpecificContent($maj) { |
150 |
|
|
if(isset($this->valF['demandeur']) AND !empty($this->valF['demandeur'])) { |
151 |
|
|
echo "<input id=\"id_retour\" name=\"idRetour\" type=\"hidden\" value=\"". |
152 |
|
|
$this->valF['demandeur']."\" />"; |
153 |
|
|
} |
154 |
|
|
} |
155 |
|
|
/** |
156 |
nhaye |
802 |
* Surcharge du lien de retour permettant de linker l'id du demandeur |
157 |
|
|
* recement ajouté |
158 |
|
|
**/ |
159 |
|
|
function retoursousformulaire($idxformulaire, $retourformulaire, $val, |
160 |
|
|
$objsf, $premiersf, $tricolsf, $validation, |
161 |
|
|
$idx, $maj, $retour) { |
162 |
nhaye |
807 |
if($retourformulaire === "demande") { |
163 |
nhaye |
802 |
echo "\n<a class=\"retour\" "; |
164 |
nhaye |
807 |
echo "href=\"#\">"; |
165 |
nhaye |
802 |
// |
166 |
|
|
echo _("Retour"); |
167 |
|
|
// |
168 |
|
|
echo "</a>\n"; |
169 |
|
|
} else { |
170 |
|
|
parent::retoursousformulaire($idxformulaire, $retourformulaire, $val, |
171 |
|
|
$objsf, $premiersf, $tricolsf, $validation, |
172 |
|
|
$idx, $maj, $retour); |
173 |
|
|
} |
174 |
|
|
} |
175 |
nhaye |
807 |
|
176 |
|
|
/** |
177 |
|
|
* Ajout du paramètre principal |
178 |
|
|
*/ |
179 |
|
|
function getDataSubmitSousForm() { |
180 |
vpihour |
1058 |
/*Création du lien de validation du sous-formulaire*/ |
181 |
nhaye |
807 |
$datasubmit = ""; |
182 |
|
|
$datasubmit .= "../scr/sousform.php"; |
183 |
|
|
$datasubmit .= "?"; |
184 |
|
|
$datasubmit .= "obj=".get_class($this); |
185 |
|
|
$datasubmit .= "&validation=".$this->getParameter("validation"); |
186 |
|
|
if ($this->getParameter("idx") != "]") { |
187 |
|
|
// |
188 |
|
|
if ($this->getParameter("maj") == 1) { // modifier |
189 |
|
|
$datasubmit .= "&action=1"; |
190 |
|
|
$datasubmit .= "&idx=".$this->getParameter("idx"); |
191 |
|
|
} else { // supprimer |
192 |
|
|
$datasubmit .= "&action=2"; |
193 |
|
|
$datasubmit .= "&idx=".$this->getParameter("idx"); |
194 |
|
|
} |
195 |
|
|
} |
196 |
|
|
$datasubmit .= "&premiersf=".$this->getParameter("premiersf"); |
197 |
|
|
$datasubmit .= "&retourformulaire=".$this->getParameter("retourformulaire"); |
198 |
|
|
$datasubmit .= "&trisf=".$this->getParameter("tricolsf"); |
199 |
|
|
$datasubmit .= "&idxformulaire=".$this->getParameter("idxformulaire"); |
200 |
|
|
$datasubmit .= "&principal=".$this->getParameter("principal"); |
201 |
|
|
// |
202 |
|
|
return $datasubmit; |
203 |
|
|
} |
204 |
nhaye |
828 |
|
205 |
|
|
/** |
206 |
|
|
* Synthèse des demandeurs pour le formulaire de la demande |
207 |
|
|
*/ |
208 |
nhaye |
838 |
function afficherSynthese($type, $linkable) { |
209 |
|
|
|
210 |
|
|
// Conteneur du demandeur |
211 |
|
|
echo "<div class=\"".$type."\" id=\"".$type."_".$this->val[array_search('demandeur', $this->champs)]."\">\n"; |
212 |
|
|
if($linkable) { |
213 |
|
|
echo "<a href=\"#\" onclick=\"removeDemandeur('". |
214 |
|
|
$type."_".$this->val[array_search('demandeur', $this->champs)]. |
215 |
|
|
"'); return false;\"> |
216 |
|
|
<span class=\"demandeur_del om-icon om-icon-16 om-icon-fix delete-16\" title=\"". |
217 |
|
|
_("Supprimer le demandeur")."\">"._("Supprimer le demandeur")."</span> |
218 |
|
|
</a>"; |
219 |
|
|
} |
220 |
vpihour |
1058 |
|
221 |
nhaye |
838 |
// Valeur de formulaire à retourner |
222 |
nhaye |
1062 |
echo "<input type=\"hidden\" class=\"demandeur_id\" name=\"".$type. |
223 |
nhaye |
838 |
(($type == "petitionnaire")? "[]":"" ). |
224 |
|
|
"\" value=\"".$this->val[array_search('demandeur', $this->champs)]."\" />\n"; |
225 |
vpihour |
1058 |
|
226 |
nhaye |
838 |
// Lien de modification du demandeur |
227 |
|
|
if($linkable) { |
228 |
|
|
echo "<a class=\"edit_demandeur\" href=\"#\" |
229 |
nhaye |
931 |
onclick=\"editDemandeur('".$this->val[array_search('type_demandeur', $this->champs)]."',". |
230 |
|
|
$this->val[array_search('demandeur', $this->champs)].",'". |
231 |
|
|
$type."',". |
232 |
nhaye |
838 |
$type."_".$this->val[array_search('demandeur', $this->champs)]. |
233 |
|
|
");return false;\">\n"; |
234 |
|
|
} |
235 |
vpihour |
1058 |
|
236 |
nhaye |
838 |
// Affichage des infos du demandeur |
237 |
nhaye |
828 |
if($this->val[array_search('qualite', $this->champs)] == 'particulier') { |
238 |
nhaye |
847 |
if(!empty($this->val[array_search('civilite', $this->champs)])) { |
239 |
fmichon |
926 |
$sql = "SELECT libelle FROM ".DB_PREFIXE."civilite WHERE civilite=". |
240 |
nhaye |
847 |
$this->val[array_search('civilite', $this->champs)]; |
241 |
|
|
$civilite = $this->f->db->getone($sql); |
242 |
|
|
$this->f->addToLog("db->getone(\"".$sql."\");", VERBOSE_MODE); |
243 |
|
|
$this->f->isDatabaseError($civilite); |
244 |
|
|
echo $civilite." "; |
245 |
|
|
} |
246 |
|
|
echo $this->val[array_search('particulier_nom', $this->champs)]." ". |
247 |
nhaye |
838 |
$this->val[array_search('particulier_prenom', $this->champs)]."<br/>\n"; |
248 |
nhaye |
828 |
} else { |
249 |
|
|
echo $this->val[array_search('personne_morale_raison_sociale', $this->champs)]." ". |
250 |
nhaye |
838 |
$this->val[array_search('personne_morale_denomination', $this->champs)]."<br/>\n"; |
251 |
nhaye |
847 |
if(!empty($this->val[array_search('personne_morale_civilite', $this->champs)])) { |
252 |
fmichon |
926 |
$sql = "SELECT libelle FROM ".DB_PREFIXE."civilite WHERE civilite=". |
253 |
nhaye |
847 |
$this->val[array_search('personne_morale_civilite', $this->champs)]; |
254 |
|
|
$civilite = $this->f->db->getone($sql); |
255 |
|
|
$this->f->addToLog("db->getone(\"".$sql."\");", VERBOSE_MODE); |
256 |
|
|
$this->f->isDatabaseError($civilite); |
257 |
|
|
echo $civilite." "; |
258 |
|
|
} |
259 |
|
|
echo $this->val[array_search('personne_morale_nom', $this->champs)]." ". |
260 |
nhaye |
838 |
$this->val[array_search('personne_morale_nom', $this->champs)]."<br/>\n"; |
261 |
nhaye |
828 |
} |
262 |
|
|
echo (($this->val[array_search('numero', $this->champs)] != "")? |
263 |
|
|
$this->val[array_search('numero', $this->champs)]." " : ""). |
264 |
|
|
(($this->val[array_search('voie', $this->champs)] != "")? |
265 |
|
|
$this->val[array_search('voie', $this->champs)]." " : ""). |
266 |
|
|
(($this->val[array_search('complement', $this->champs)] != "")? |
267 |
nhaye |
839 |
$this->val[array_search('complement', $this->champs)]." " : "")."<br/>\n". |
268 |
nhaye |
828 |
(($this->val[array_search('code_postal', $this->champs)] != "")? |
269 |
|
|
$this->val[array_search('code_postal', $this->champs)]." " : ""). |
270 |
|
|
(($this->val[array_search('localite', $this->champs)] != "")? |
271 |
|
|
$this->val[array_search('localite', $this->champs)]." " : ""). |
272 |
|
|
(($this->val[array_search('bp', $this->champs)] != "")? |
273 |
|
|
$this->val[array_search('bp', $this->champs)]." " : ""). |
274 |
|
|
(($this->val[array_search('cedex', $this->champs)] != "")? |
275 |
nhaye |
838 |
$this->val[array_search('cedex', $this->champs)]." " : "")."<br/>\n". |
276 |
nhaye |
828 |
(($this->val[array_search('telephone_fixe', $this->champs)] != "")? |
277 |
|
|
$this->val[array_search('telephone_fixe', $this->champs)]." " : ""). |
278 |
|
|
(($this->val[array_search('telephone_mobile', $this->champs)] != "")? |
279 |
|
|
$this->val[array_search('telephone_mobile', $this->champs)]." " : ""); |
280 |
nhaye |
838 |
if($linkable) { |
281 |
|
|
echo "</a>\n"; |
282 |
|
|
} |
283 |
|
|
echo "</div>\n"; |
284 |
nhaye |
828 |
} |
285 |
|
|
|
286 |
vpihour |
633 |
}// fin classe |
287 |
|
|
?> |