/[openfoncier]/trunk/obj/demandeur.class.php
ViewVC logotype

Annotation of /trunk/obj/demandeur.class.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3333 - (hide annotations)
Tue Mar 10 17:36:04 2015 UTC (9 years, 10 months ago) by vpihour
File size: 15612 byte(s)
Correction de la civilité du pétitionnaire affichée dans la visualisation du dossier.

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 nhaye 1105 var $required_tag = array("particulier_nom",
10     "personne_morale_denomination",
11     "personne_morale_raison_sociale");
12 vpihour 633 function demandeur($id,&$db,$debug) {
13     $this->constructeur($id,$db,$debug);
14     }// fin constructeur
15 vpihour 703
16 vpihour 805 /*
17     * Pays par défaut : France
18     */
19     function setVal(&$form, $maj, $validation, &$db) {
20     if($maj == 0) {
21     $form->setVal("pays",'France');
22     }
23     }
24 vpihour 799
25     /*
26 nhaye 1048 * Pays par défaut : France
27     */
28     function setValSousFormulaire(&$form, $maj, $validation, &$db) {
29     if($maj == 0) {
30     $form->setVal("pays",'France');
31     }
32     }
33    
34 nhaye 1105 /**
35     * Surcharge de la méthode de vérification
36     **/
37     function verifier($val, &$db, $DEBUG) {
38     parent::verifier($val, $db, $DEBUG);
39     // le nom du particulier est obligatoire
40     if($this->valF['qualite'] == "particulier" AND $this->valF['particulier_nom'] == "") {
41     $this->correct = false;
42     $this->addToMessage(_("Le champ")." <span class=\"bold\">".
43     _("particulier_nom")."</span> "._("est obligatoire."));
44     }
45    
46     // la dénomination ou la raison sociale est obligatoire pour une personne morale
47     if($this->valF['qualite'] == "personne_morale"
48 vpihour 1456 AND $this->valF['personne_morale_denomination'] == ""
49     AND $this->valF['personne_morale_raison_sociale'] == "") {
50 nhaye 1105 $this->correct = false;
51     $this->addToMessage(_("Un des champs")." <span class=\"bold\">".
52     _("personne_morale_denomination")."</span> ou <span class=\"bold\">".
53     _("personne_morale_raison_sociale")."</span> "._("doit etre rempli."));
54     }
55    
56     }
57    
58 nhaye 1048 /*
59 vpihour 799 * Select pour les champs qualite et type_demandeur
60     */
61     function setType(&$form,$maj) {
62     parent::setType($form,$maj);
63     if ($maj < 2) { //ajouter et modifier
64    
65     $form->setType('type_demandeur', 'select');
66     $form->setType('qualite', 'select');
67 nhaye 1048 if($maj == 0 AND $this->getParameter("idx_demandeur") != "") {
68     $form->setType('frequent','hidden');
69     $form->setType('qualite','selectdisabled');
70     $form->setType('particulier_nom','textdisabled');
71     $form->setType('particulier_prenom','textdisabled');
72     $form->setType('particulier_date_naissance','datedisabled');
73     $form->setType('particulier_commune_naissance','textdisabled');
74     $form->setType('particulier_departement_naissance','textdisabled');
75     $form->setType('personne_morale_denomination','textdisabled');
76     $form->setType('personne_morale_raison_sociale','textdisabled');
77     $form->setType('personne_morale_siret','textdisabled');
78     $form->setType('personne_morale_categorie_juridique','textdisabled');
79     $form->setType('personne_morale_nom','textdisabled');
80     $form->setType('personne_morale_prenom','textdisabled');
81     $form->setType('particulier_civilite','selectdisabled');
82     $form->setType('personne_morale_civilite','selectdisabled');
83     $form->setType('telephone_fixe','textdisabled');
84     $form->setType('telephone_mobile','textdisabled');
85 nmeucci 2810 $form->setType('fax','textdisabled');
86 nhaye 1048 $form->setType('indicatif','textdisabled');
87     $form->setType('courriel','textdisabled');
88    
89     }
90 nhaye 1617 // XXX
91 nhaye 1042 // Champs disabled pour la modif de petitionnaires frequents
92     // Solution temporaire
93     if ($maj==1){ //modifier
94     if($this->getVal('frequent') == 't') {
95 nhaye 1118 $form->setType('qualite','selecthiddenstatic');
96     $form->setType('particulier_nom','static');
97     $form->setType('particulier_prenom','static');
98     $form->setType('particulier_date_naissance','datestatic');
99     $form->setType('particulier_commune_naissance','static');
100     $form->setType('particulier_departement_naissance','static');
101     $form->setType('personne_morale_denomination','static');
102     $form->setType('personne_morale_raison_sociale','static');
103     $form->setType('personne_morale_siret','static');
104     $form->setType('personne_morale_categorie_juridique','static');
105     $form->setType('personne_morale_nom','static');
106     $form->setType('personne_morale_prenom','static');
107     $form->setType('numero','static');
108     $form->setType('voie','static');
109     $form->setType('complement','static');
110     $form->setType('lieu_dit','static');
111     $form->setType('localite','static');
112     $form->setType('code_postal','static');
113     $form->setType('bp','static');
114     $form->setType('cedex','static');
115     $form->setType('pays','static');
116     $form->setType('division_territoriale','static');
117     $form->setType('telephone_fixe','static');
118     $form->setType('telephone_mobile','static');
119 nmeucci 2810 $form->setType('fax','static');
120 nhaye 1118 $form->setType('indicatif','static');
121     $form->setType('courriel','static');
122     $form->setType('notification','checkboxstatic');
123     $form->setType('frequent','checkboxstatic');
124     $form->setType('particulier_civilite','selecthiddenstatic');
125     $form->setType('personne_morale_civilite','selecthiddenstatic');
126 nhaye 1042 }
127     }// fin modifier
128 vpihour 799 }
129 nhaye 850 $form->setType('demandeur', 'hidden');
130 nhaye 1042
131 vpihour 799 }
132    
133     /*
134     * Select pour le type_demandeur et qualite
135     */
136     function setSelect(&$form, $maj,&$db,$debug) {
137     parent::setSelect($form, $maj,$db,$debug);
138    
139     /*Lors d'un ajout ou d'une modification*/
140     if( $maj < 2 ){
141    
142     /* type_demandeur*/
143     $contenu=array();
144    
145     $contenu[0][0]="";
146     $contenu[1][0]=_('choisir')." "._('type_demandeur');
147 nhaye 2316 $contenu[0][2]="petitionnaire";
148     $contenu[1][2]=_('petitionnaire');
149     $contenu[0][1]="delegataire";
150 nmeucci 2846 $contenu[1][1]=_('autre correspondant');
151 vpihour 799
152     $form->setSelect("type_demandeur",$contenu);
153    
154     /* qualite*/
155     $contenu=array();
156    
157 vpihour 805 $contenu[0][0]="particulier";
158     $contenu[1][0]=_('particulier');
159     $contenu[0][1]="personne_morale";
160     $contenu[1][1]=_('personne morale');
161 vpihour 799
162     $form->setSelect("qualite",$contenu);
163     }
164     }
165    
166     /*
167 vpihour 1058 * Ajoute l'action javascript sur le select de la qualité
168 vpihour 799 */
169     function setOnchange(&$form,$maj){
170     parent::setOnchange($form,$maj);
171    
172     $form->setOnchange("qualite","changeDemandeurType('qualite');");
173     }
174 nhaye 802
175     /**
176 nhaye 807 * Ajout d'un champs caché permettant de linker l'id du demandeur
177     * recement ajouté
178     **/
179     function sousFormSpecificContent($maj) {
180 nhaye 1429 $id_demandeur = $this->getVal("demandeur");
181     if(isset($this->valF["demandeur"]) AND !empty($this->valF["demandeur"])) {
182 nhaye 807 echo "<input id=\"id_retour\" name=\"idRetour\" type=\"hidden\" value=\"".
183 nhaye 1429 $this->valF["demandeur"]."\" />";
184     } elseif(isset($id_demandeur) AND !empty($id_demandeur) AND $maj == 1) {
185     echo "<input id=\"id_retour\" name=\"idRetour\" type=\"hidden\" value=\"".
186     $this->getVal("demandeur")."\" />";
187 nhaye 807 }
188     }
189     /**
190 nhaye 802 * Surcharge du lien de retour permettant de linker l'id du demandeur
191     * recement ajouté
192     **/
193     function retoursousformulaire($idxformulaire, $retourformulaire, $val,
194     $objsf, $premiersf, $tricolsf, $validation,
195     $idx, $maj, $retour) {
196 nhaye 807 if($retourformulaire === "demande") {
197 nhaye 802 echo "\n<a class=\"retour\" ";
198 nhaye 807 echo "href=\"#\">";
199 nhaye 802 //
200     echo _("Retour");
201     //
202     echo "</a>\n";
203     } else {
204     parent::retoursousformulaire($idxformulaire, $retourformulaire, $val,
205     $objsf, $premiersf, $tricolsf, $validation,
206     $idx, $maj, $retour);
207     }
208     }
209 nhaye 807
210     /**
211     * Ajout du paramètre principal
212     */
213     function getDataSubmitSousForm() {
214 vpihour 1058 /*Création du lien de validation du sous-formulaire*/
215 nhaye 807 $datasubmit = "";
216     $datasubmit .= "../scr/sousform.php";
217     $datasubmit .= "?";
218     $datasubmit .= "obj=".get_class($this);
219     $datasubmit .= "&amp;validation=".$this->getParameter("validation");
220     if ($this->getParameter("idx") != "]") {
221     //
222     if ($this->getParameter("maj") == 1) { // modifier
223     $datasubmit .= "&amp;action=1";
224     $datasubmit .= "&amp;idx=".$this->getParameter("idx");
225     } else { // supprimer
226     $datasubmit .= "&amp;action=2";
227     $datasubmit .= "&amp;idx=".$this->getParameter("idx");
228     }
229     }
230     $datasubmit .= "&amp;premiersf=".$this->getParameter("premiersf");
231     $datasubmit .= "&amp;retourformulaire=".$this->getParameter("retourformulaire");
232     $datasubmit .= "&amp;trisf=".$this->getParameter("tricolsf");
233     $datasubmit .= "&amp;idxformulaire=".$this->getParameter("idxformulaire");
234     $datasubmit .= "&amp;principal=".$this->getParameter("principal");
235     //
236     return $datasubmit;
237     }
238 nhaye 828
239     /**
240     * Synthèse des demandeurs pour le formulaire de la demande
241     */
242 nhaye 838 function afficherSynthese($type, $linkable) {
243 nhaye 1108 switch ($type) {
244     case 'petitionnaire_principal':
245     $legend = _("Petitionnaire principal :");
246     break;
247 nhaye 838
248 nhaye 1108 case 'delegataire':
249 nmeucci 2846 $legend = _("Autre correspondant :");
250 nhaye 1108 break;
251    
252     case 'petitionnaire':
253     $legend = _("Petitionnaire :");
254     break;
255     }
256 nhaye 1118
257     // Conteneur du demandeur
258     echo "<div class=\"".$type." col_3\" id=\"".$type."_".$this->val[array_search('demandeur', $this->champs)]."\">\n";
259     echo "<div class=\"legend_synthese_demandeur\">\n";
260 nhaye 1108 echo $legend;
261 nhaye 1118 echo "</div>\n";
262     echo "<div class=\"synthese_demandeur\">\n";
263 nhaye 838 if($linkable) {
264     echo "<a href=\"#\" onclick=\"removeDemandeur('".
265     $type."_".$this->val[array_search('demandeur', $this->champs)].
266     "'); return false;\">
267     <span class=\"demandeur_del om-icon om-icon-16 om-icon-fix delete-16\" title=\"".
268     _("Supprimer le demandeur")."\">"._("Supprimer le demandeur")."</span>
269     </a>";
270     }
271 vpihour 1058
272 nhaye 838 // Valeur de formulaire à retourner
273 nhaye 1062 echo "<input type=\"hidden\" class=\"demandeur_id\" name=\"".$type.
274 nhaye 838 (($type == "petitionnaire")? "[]":"" ).
275     "\" value=\"".$this->val[array_search('demandeur', $this->champs)]."\" />\n";
276 vpihour 1058
277 nhaye 838 // Lien de modification du demandeur
278     if($linkable) {
279     echo "<a class=\"edit_demandeur\" href=\"#\"
280 nhaye 931 onclick=\"editDemandeur('".$this->val[array_search('type_demandeur', $this->champs)]."',".
281     $this->val[array_search('demandeur', $this->champs)].",'".
282     $type."',".
283 nhaye 838 $type."_".$this->val[array_search('demandeur', $this->champs)].
284     ");return false;\">\n";
285     }
286 vpihour 1058
287 nhaye 838 // Affichage des infos du demandeur
288 nhaye 828 if($this->val[array_search('qualite', $this->champs)] == 'particulier') {
289 vpihour 3333 if(!empty($this->val[array_search('particulier_civilite', $this->champs)])) {
290 fmichon 926 $sql = "SELECT libelle FROM ".DB_PREFIXE."civilite WHERE civilite=".
291 vpihour 3333 $this->val[array_search('particulier_civilite', $this->champs)];
292 vpihour 1777 $civilite = $this->db->getone($sql);
293     $this->f->addToLog("afficherSynthese() : db->getone(\"".$sql."\");", VERBOSE_MODE);
294     if ( database::isError($civilite)){
295     die();
296     }
297 nhaye 847 echo $civilite." ";
298     }
299     echo $this->val[array_search('particulier_nom', $this->champs)]." ".
300 nhaye 838 $this->val[array_search('particulier_prenom', $this->champs)]."<br/>\n";
301 nhaye 828 } else {
302     echo $this->val[array_search('personne_morale_raison_sociale', $this->champs)]." ".
303 nhaye 838 $this->val[array_search('personne_morale_denomination', $this->champs)]."<br/>\n";
304 nhaye 847 if(!empty($this->val[array_search('personne_morale_civilite', $this->champs)])) {
305 fmichon 926 $sql = "SELECT libelle FROM ".DB_PREFIXE."civilite WHERE civilite=".
306 nhaye 847 $this->val[array_search('personne_morale_civilite', $this->champs)];
307     $civilite = $this->f->db->getone($sql);
308 vpihour 1777 $this->f->addToLog("afficherSynthese() : db->getone(\"".$sql."\");", VERBOSE_MODE);
309     if ( database::isError($civilite)){
310     die();
311     }
312 nhaye 847 echo $civilite." ";
313     }
314     echo $this->val[array_search('personne_morale_nom', $this->champs)]." ".
315 vpihour 2069 $this->val[array_search('personne_morale_prenom', $this->champs)]."<br/>\n";
316 nhaye 828 }
317     echo (($this->val[array_search('numero', $this->champs)] != "")?
318     $this->val[array_search('numero', $this->champs)]." " : "").
319     (($this->val[array_search('voie', $this->champs)] != "")?
320     $this->val[array_search('voie', $this->champs)]." " : "").
321     (($this->val[array_search('complement', $this->champs)] != "")?
322 nhaye 839 $this->val[array_search('complement', $this->champs)]." " : "")."<br/>\n".
323 nhaye 828 (($this->val[array_search('code_postal', $this->champs)] != "")?
324     $this->val[array_search('code_postal', $this->champs)]." " : "").
325     (($this->val[array_search('localite', $this->champs)] != "")?
326     $this->val[array_search('localite', $this->champs)]." " : "").
327     (($this->val[array_search('bp', $this->champs)] != "")?
328     $this->val[array_search('bp', $this->champs)]." " : "").
329     (($this->val[array_search('cedex', $this->champs)] != "")?
330 nhaye 838 $this->val[array_search('cedex', $this->champs)]." " : "")."<br/>\n".
331 nhaye 828 (($this->val[array_search('telephone_fixe', $this->champs)] != "")?
332     $this->val[array_search('telephone_fixe', $this->champs)]." " : "").
333     (($this->val[array_search('telephone_mobile', $this->champs)] != "")?
334     $this->val[array_search('telephone_mobile', $this->champs)]." " : "");
335 nhaye 838 if($linkable) {
336     echo "</a>\n";
337     }
338     echo "</div>\n";
339 nhaye 1118 echo "</div>\n";
340 nhaye 828 }
341    
342 vpihour 633 }// fin classe
343     ?>

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26