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