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