1 |
mbroquet |
3730 |
<?php |
2 |
softime |
7996 |
/** |
3 |
|
|
* DBFORM - 'demandeur' - Surcharge gen. |
4 |
|
|
* |
5 |
|
|
* Ce script définit la classe 'demandeur'. |
6 |
|
|
* |
7 |
|
|
* @package openads |
8 |
|
|
* @version SVN : $Id: demandeur.class.php 5056 2015-08-19 10:25:20Z nhaye $ |
9 |
|
|
*/ |
10 |
mbroquet |
3730 |
|
11 |
|
|
require_once ("../gen/obj/demandeur.class.php"); |
12 |
softime |
18436 |
require_once "../obj/task.class.php"; |
13 |
mbroquet |
3730 |
|
14 |
|
|
class demandeur extends demandeur_gen { |
15 |
|
|
|
16 |
|
|
var $required_tag = array("particulier_nom", |
17 |
softime |
6565 |
"personne_morale_denomination", |
18 |
|
|
"personne_morale_raison_sociale" |
19 |
|
|
); |
20 |
softime |
10573 |
|
21 |
|
|
function init_class_actions() { |
22 |
|
|
parent::init_class_actions(); |
23 |
|
|
// |
24 |
|
|
$this->class_actions[998] = array( |
25 |
|
|
"identifier" => "json_data", |
26 |
|
|
"view" => "view_json_data", |
27 |
|
|
"permission_suffix" => "consulter", |
28 |
|
|
); |
29 |
softime |
16749 |
// |
30 |
|
|
$this->class_actions[11] = array( |
31 |
|
|
"identifier" => "adresses_postale_values_json", |
32 |
|
|
"view" => "view_adresses_postale_values_json", |
33 |
|
|
"permission_suffix" => "consulter", |
34 |
|
|
); |
35 |
softime |
10573 |
} |
36 |
|
|
|
37 |
softime |
6565 |
/** |
38 |
softime |
8989 |
* Clause select pour la requête de sélection des données de l'enregistrement. |
39 |
softime |
6565 |
* |
40 |
softime |
7996 |
* @return array |
41 |
softime |
6565 |
*/ |
42 |
softime |
7996 |
function get_var_sql_forminc__champs() { |
43 |
|
|
return array( |
44 |
|
|
'demandeur', |
45 |
|
|
'type_demandeur', |
46 |
|
|
'qualite', |
47 |
|
|
'om_collectivite', |
48 |
|
|
'particulier_civilite', 'particulier_nom', 'particulier_prenom', |
49 |
|
|
'particulier_date_naissance', 'particulier_commune_naissance', |
50 |
|
|
'particulier_departement_naissance', 'particulier_pays_naissance', |
51 |
|
|
'personne_morale_denomination', |
52 |
|
|
'personne_morale_raison_sociale', 'personne_morale_siret', |
53 |
|
|
'personne_morale_categorie_juridique', |
54 |
|
|
'personne_morale_civilite', 'personne_morale_nom', 'personne_morale_prenom', |
55 |
|
|
'numero', |
56 |
|
|
'voie', |
57 |
|
|
'complement', |
58 |
|
|
'lieu_dit', |
59 |
|
|
'localite', |
60 |
|
|
'code_postal', |
61 |
|
|
'bp', |
62 |
|
|
'cedex', |
63 |
|
|
'pays', |
64 |
|
|
'division_territoriale', |
65 |
|
|
'telephone_fixe', |
66 |
|
|
'telephone_mobile', |
67 |
|
|
'indicatif', |
68 |
|
|
'fax', |
69 |
|
|
'courriel', |
70 |
|
|
'notification', |
71 |
|
|
'frequent', |
72 |
softime |
10573 |
'num_inscription', |
73 |
|
|
'nom_cabinet', |
74 |
|
|
'conseil_regional', |
75 |
softime |
15650 |
'titre_obt_diplo_spec', |
76 |
|
|
'date_obt_diplo_spec', |
77 |
|
|
'lieu_obt_diplo_spec', |
78 |
softime |
7996 |
); |
79 |
|
|
} |
80 |
softime |
6565 |
|
81 |
|
|
/** |
82 |
|
|
* Mise en page. |
83 |
|
|
* |
84 |
|
|
* @param formulaire $form Instance de la classe om_formulaire. |
85 |
|
|
* @param integer $maj Identifiant de l'action. |
86 |
|
|
*/ |
87 |
|
|
function setLayout(&$form, $maj){ |
88 |
|
|
|
89 |
|
|
// Gestion recherche pétitionnaire fréquent |
90 |
|
|
$search_fields = ''; |
91 |
|
|
if ($maj == 0 || $maj == 1) { |
92 |
|
|
if ($form->val['type_demandeur'] === 'petitionnaire' || |
93 |
softime |
7067 |
$form->val['type_demandeur'] === 'avocat' || |
94 |
|
|
$form->val['type_demandeur'] === 'bailleur') { |
95 |
softime |
6565 |
$search_fields = ' search_fields'; |
96 |
|
|
} |
97 |
|
|
} |
98 |
softime |
15973 |
// Container du formulaire |
99 |
|
|
$form->setBloc('qualite', 'D', '', 'formulaire-demandeur'); |
100 |
softime |
6565 |
|
101 |
softime |
15973 |
// Container des fieldset Qualité et Collectivité |
102 |
|
|
$form->setBloc('qualite', 'D', '', 'formulaire-demandeur--qualite-collectivite'); |
103 |
|
|
// Qualité |
104 |
|
|
$form->setFieldset('qualite','DF',_("Qualité")); |
105 |
|
|
// Collectivité |
106 |
|
|
// Renomme "collectivité" en "service" si l'option est activée |
107 |
|
|
$om_collectivite_libelle = __("Collectivité"); |
108 |
|
|
if ($this->f->is_option_renommer_collectivite_enabled() === true) { |
109 |
|
|
$om_collectivite_libelle = __("service"); |
110 |
|
|
} |
111 |
|
|
$form->setFieldset('om_collectivite','DF', $om_collectivite_libelle, $search_fields); |
112 |
|
|
$form->setBloc('om_collectivite', 'F'); |
113 |
|
|
// Fin - Container des fieldset Qualité et Collectivité |
114 |
softime |
6565 |
|
115 |
|
|
|
116 |
softime |
15973 |
// Début - Etat civil Particulier |
117 |
|
|
$form->setFieldset('particulier_civilite','D',_("Etat civil"), "group particulier_fields"); |
118 |
|
|
// Nom - prénom |
119 |
|
|
$form->setBloc('particulier_nom','D', "","group particulier--nom-prenom".$search_fields); |
120 |
softime |
6565 |
$form->setBloc('particulier_prenom', 'F'); |
121 |
softime |
15973 |
// Date + Commune de naissance |
122 |
|
|
$form->setBloc('particulier_date_naissance','D',_("Date et Lieu de Naissance"),"group particulier--naissance"); |
123 |
softime |
6565 |
$form->setBloc('particulier_commune_naissance', 'F'); |
124 |
softime |
15973 |
// Dpt + Pays de naissance |
125 |
|
|
$form->setBloc('particulier_departement_naissance','D', '',"group particulier--naissance-dpt-pays"); |
126 |
|
|
$form->setBloc('particulier_pays_naissance', 'F'); |
127 |
|
|
$form->setFieldset('particulier_pays_naissance','F'); |
128 |
|
|
// Fin - Etat civil Particulier |
129 |
softime |
6565 |
|
130 |
|
|
|
131 |
softime |
15973 |
// Début - État civil Personne morale |
132 |
|
|
$form->setFieldset('personne_morale_denomination','D',("Personne morale"),"personne_morale_fields"); |
133 |
|
|
// Denomination - Raison Sociale |
134 |
|
|
$form->setBloc('personne_morale_denomination','D',"", "group personne_morale--denom-rs"); |
135 |
|
|
$form->setBloc('personne_morale_raison_sociale', 'F'); |
136 |
|
|
// SIRET - Cat. juridique |
137 |
|
|
$form->setBloc('personne_morale_siret','D',"","group personne_morale--siret-cj"); |
138 |
|
|
$form->setBloc('personne_morale_categorie_juridique','F'); |
139 |
|
|
// Civilité |
140 |
|
|
$form->setBloc('personne_morale_civilite', 'DF', ""); |
141 |
|
|
// Nom - Prénom |
142 |
|
|
$form->setBloc('personne_morale_nom', 'D', "", "group personne_morale--nom-prenom".$search_fields); |
143 |
|
|
$form->setBloc('personne_morale_prenom', 'F'); |
144 |
|
|
$form->setFieldset('personne_morale_prenom', 'F'); |
145 |
|
|
// Fin - État Civil - Personne morale |
146 |
|
|
|
147 |
softime |
6565 |
// Adresse |
148 |
softime |
18876 |
$form->setFieldset('numero', 'D', __("Adresse"), "formulaire-demandeur--adresse"); |
149 |
softime |
6565 |
|
150 |
softime |
15973 |
$form->setBloc('numero', 'D', "", "group adresse--num-voie"); |
151 |
softime |
6565 |
$form->setBloc('voie', 'F'); |
152 |
|
|
|
153 |
softime |
15973 |
$form->setBloc('complement', 'DF', ""); |
154 |
softime |
6565 |
|
155 |
|
|
$form->setBloc('lieu_dit', 'D', "", "group"); |
156 |
|
|
$form->setBloc('localite', 'F'); |
157 |
|
|
|
158 |
|
|
$form->setBloc('code_postal', 'D', "", "group"); |
159 |
|
|
$form->setBloc('cedex', 'F'); |
160 |
|
|
|
161 |
|
|
$form->setBloc('pays', 'D', "", "", "group"); |
162 |
|
|
$form->setBloc('division_territoriale', 'F'); |
163 |
|
|
$form->setFieldset('division_territoriale', 'F'); |
164 |
|
|
|
165 |
|
|
// Coordonnées |
166 |
softime |
18876 |
$form->setFieldset('telephone_fixe', 'D', __("Coordonnees"), ""); |
167 |
softime |
15973 |
// Fixe + mobile + Indicatif |
168 |
softime |
18876 |
$form->setBloc('telephone_fixe', 'D', __("Téléphone"), "group"); |
169 |
softime |
6565 |
$form->setBloc('indicatif', 'F'); |
170 |
softime |
15973 |
// Fax |
171 |
|
|
$form->setBloc('fax', 'DF', "", "group"); |
172 |
softime |
6565 |
|
173 |
softime |
15973 |
$form->setBloc('courriel', 'DF', '', "group"); |
174 |
|
|
$form->setBloc('notification', 'DF'); |
175 |
softime |
6565 |
|
176 |
|
|
$form->setFieldset('notification', 'F'); |
177 |
softime |
10573 |
|
178 |
|
|
// Architecte |
179 |
|
|
$form->setFieldset('num_inscription', 'D', __("Architecte législation connexe"), ""); |
180 |
|
|
$form->setBloc('num_inscription', 'D', "", "group"); |
181 |
|
|
$form->setBloc('num_inscription', 'F'); |
182 |
|
|
$form->setBloc('nom_cabinet', 'D', "", "group"); |
183 |
|
|
$form->setBloc('nom_cabinet', 'F'); |
184 |
|
|
$form->setBloc('conseil_regional', 'D', "", "group"); |
185 |
|
|
$form->setBloc('conseil_regional', 'F'); |
186 |
softime |
15650 |
$form->setBloc('titre_obt_diplo_spec', 'D', __("Obtention du diplôme de spécialisation et d’approfondissement en architecture mention architecture et patrimoine ou équivalent"), "alignForm"); |
187 |
|
|
$form->setBloc('lieu_obt_diplo_spec', 'F'); |
188 |
|
|
$form->setFieldset('lieu_obt_diplo_spec', 'F'); |
189 |
softime |
15973 |
|
190 |
|
|
//Fin container |
191 |
|
|
$form->setBloc('lieu_obt_diplo_spec', 'F'); |
192 |
|
|
|
193 |
softime |
6565 |
} |
194 |
|
|
|
195 |
softime |
8989 |
/** |
196 |
|
|
* SETTER_FORM - setVal (setVal). |
197 |
|
|
* |
198 |
|
|
* @return void |
199 |
|
|
*/ |
200 |
|
|
function setVal(&$form, $maj, $validation, &$dnu1 = null, $dnu2 = null) { |
201 |
|
|
parent::setVal($form, $maj, $validation); |
202 |
|
|
// |
203 |
|
|
if ($maj == 0) { |
204 |
|
|
$form->setVal("pays", "France"); |
205 |
mbroquet |
3730 |
} |
206 |
|
|
} |
207 |
|
|
|
208 |
softime |
6565 |
/** |
209 |
|
|
* Lbellé des champs |
210 |
|
|
*/ |
211 |
|
|
function setLib(&$form,$maj) { |
212 |
|
|
parent::setLib($form,$maj); |
213 |
|
|
$form->setLib('qualite', ''); |
214 |
|
|
$form->setLib('om_collectivite', ''); |
215 |
softime |
15973 |
// État civil - Particulier |
216 |
|
|
$form->setLib('particulier_date_naissance', __("Date")); |
217 |
|
|
$form->setLib('particulier_commune_naissance', __("Commune")); |
218 |
|
|
$form->setLib('particulier_departement_naissance', __("Département")); |
219 |
|
|
$form->setLib('particulier_pays_naissance', __("Pays")); |
220 |
softime |
15650 |
|
221 |
softime |
15973 |
//Coordonnées |
222 |
|
|
$form->setLib('telephone_fixe', __("Fixe")); |
223 |
|
|
$form->setLib('telephone_mobile', __("Mobile")); |
224 |
softime |
18436 |
$form->setLib('notification', __("Le demandeur souhaite être notifié électroniquement")); |
225 |
softime |
15973 |
|
226 |
softime |
15650 |
// Dans le cas d’une intervention sur un immeuble classé au titre des monuments historiques |
227 |
|
|
$form->setLib('titre_obt_diplo_spec', __("Titre")); |
228 |
|
|
$form->setLib('date_obt_diplo_spec', __("Date")); |
229 |
|
|
$form->setLib('lieu_obt_diplo_spec', __("Établissement / ville / pays")); |
230 |
softime |
17542 |
|
231 |
|
|
// Architecte législation connexe |
232 |
|
|
$form->setLib('num_inscription', __("Numéro de récépissé de déclaration à l'ordre des architectes")); |
233 |
|
|
$form->setLib('conseil_regional', __("Conseil régional de l'ordre de")); |
234 |
softime |
6565 |
} |
235 |
|
|
|
236 |
softime |
8989 |
/** |
237 |
|
|
* SETTER_FORM - setValsousformulaire (setVal). |
238 |
|
|
* |
239 |
|
|
* @return void |
240 |
|
|
*/ |
241 |
mbroquet |
3730 |
function setValsousformulaire(&$form, $maj, $validation, $idxformulaire, $retourformulaire, $typeformulaire, &$dnu1 = null, $dnu2 = null) { |
242 |
softime |
8989 |
parent::setValsousformulaire($form, $maj, $validation, $idxformulaire, $retourformulaire, $typeformulaire); |
243 |
|
|
// |
244 |
softime |
6565 |
if ($maj == 0) { |
245 |
softime |
8989 |
$form->setVal("pays", "France"); |
246 |
mbroquet |
3730 |
} |
247 |
softime |
8989 |
// XXX L'objectif de cette portion de code n'est pas de faire un setVal |
248 |
softime |
7067 |
// Message d'information concernant la modification des demandeurs |
249 |
|
|
// fréquents |
250 |
softime |
8989 |
if ($maj == 1 && $this->getVal("frequent") == "t") { |
251 |
|
|
switch ($this->getVal("type_demandeur")) { |
252 |
|
|
case "petitionnaire": |
253 |
softime |
18876 |
$type_demandeur = __("Pétitionnaire"); |
254 |
softime |
7067 |
break; |
255 |
|
|
|
256 |
softime |
8989 |
case "avocat": |
257 |
softime |
18876 |
$type_demandeur = __("Avocat"); |
258 |
softime |
7067 |
break; |
259 |
|
|
|
260 |
softime |
8989 |
case "bailleur": |
261 |
softime |
18876 |
$type_demandeur = __("Bailleur"); |
262 |
softime |
7067 |
break; |
263 |
|
|
} |
264 |
softime |
18876 |
$message = sprintf(__("%s fréquent non modifiable"), $type_demandeur); |
265 |
softime |
7067 |
$this->f->displayMessage("info", $message); |
266 |
mbroquet |
3730 |
} |
267 |
|
|
} |
268 |
|
|
|
269 |
|
|
/** |
270 |
softime |
16749 |
* SURCHARGE |
271 |
|
|
* |
272 |
|
|
* Permet de modifier le fil d'Ariane depuis l'objet pour un sous-formulaire |
273 |
|
|
* @param string $ent Fil d'Ariane récupéréré |
274 |
|
|
* @return Fil d'Ariane |
275 |
|
|
*/ |
276 |
|
|
function getSubFormTitle($ent) { |
277 |
|
|
return ''; |
278 |
|
|
} |
279 |
|
|
|
280 |
|
|
/** |
281 |
|
|
* Surcharge du bouton pour empécher l'utilisateur de modifier un fréquent |
282 |
|
|
* Et ajout d'un bouton pour vider le formulaire |
283 |
|
|
*/ |
284 |
|
|
function boutonsousformulaire($datasubmit, $maj, $val=null) { |
285 |
|
|
// En mode ajout ou si le pétitionnaire n'est pas un fréquent |
286 |
|
|
if ($maj == 0 |
287 |
|
|
|| $this->getVal('frequent') != 't') { |
288 |
|
|
// Tant que le formulaire n'est pas validé et valide |
289 |
|
|
if (!$this->correct) { |
290 |
|
|
// Renomme les boutons |
291 |
|
|
switch ($maj) { |
292 |
|
|
case 0: |
293 |
|
|
$bouton = __("Ajouter le demandeur"); |
294 |
|
|
$title = __('Ajouter le demandeur sur la demande en cours de saisie'); |
295 |
|
|
break; |
296 |
|
|
case 1: |
297 |
|
|
$bouton = __("Modifier le demandeur"); |
298 |
|
|
$title = __('Modifier le demandeur sur la demande en cours de saisie'); |
299 |
|
|
break; |
300 |
|
|
case 2: |
301 |
|
|
$bouton = __("Supprimer le demandeur"); |
302 |
|
|
$title = __('Supprimer le demandeur sur la demande en cours de saisie'); |
303 |
|
|
break; |
304 |
|
|
default: |
305 |
|
|
$bouton = __('Valider'); |
306 |
|
|
$title = __('Valider le formulaire du demandeur'); |
307 |
|
|
break; |
308 |
|
|
} |
309 |
|
|
// Compose l'identifiant pour récupérer l'identifiant du demandeur |
310 |
|
|
// une fois ajouté |
311 |
|
|
$get_demandeur_id_type = $this->get_absolute_class_name(); |
312 |
|
|
if (strpos($datasubmit, 'principal=true') !== false) { |
313 |
|
|
$get_demandeur_id_type .= '_principal'; |
314 |
|
|
} |
315 |
|
|
// Compose le bouton de validation pour les différents mode de |
316 |
|
|
// formulaire (ajouter, modifier) |
317 |
|
|
printf( |
318 |
softime |
17036 |
'<input type="button" value="%s" title="%s" onclick="validateSformDemandeur(\'%s\', \'%s\', %s, \'%s\'%s)" class="%s" />', |
319 |
softime |
16749 |
$bouton, |
320 |
|
|
$title, |
321 |
|
|
$this->get_absolute_class_name(), |
322 |
|
|
$datasubmit, |
323 |
|
|
'this.form', |
324 |
|
|
$get_demandeur_id_type, |
325 |
|
|
$this->getVal($this->clePrimaire) !== '' ? ', \''.intval($this->getVal($this->clePrimaire)).'\'' : '', |
326 |
|
|
'om-button' |
327 |
|
|
); |
328 |
|
|
} |
329 |
|
|
} |
330 |
|
|
// Compose le bouton permettant de vider le formulaire |
331 |
|
|
if (!$this->correct && $this->getVal('frequent') !== 't') { |
332 |
|
|
printf( |
333 |
|
|
'<span class="om-form-button erase-%s delete-16" title="%s">%s</span>', |
334 |
|
|
$this->get_absolute_class_name(), |
335 |
|
|
__("Supprimer le contenu du formulaire du demandeur"), |
336 |
|
|
__("Vider le formulaire du demandeur") |
337 |
|
|
); |
338 |
|
|
} |
339 |
|
|
} |
340 |
|
|
|
341 |
|
|
/** |
342 |
softime |
8989 |
* @return void |
343 |
|
|
*/ |
344 |
|
|
function verifier($val = array(), &$dnu1 = null, $dnu2 = null) { |
345 |
|
|
parent::verifier($val); |
346 |
mbroquet |
3730 |
// le nom du particulier est obligatoire |
347 |
softime |
18876 |
if($this->valF['qualite'] == "particulier" && $this->valF['particulier_nom'] == "") { |
348 |
mbroquet |
3730 |
$this->correct = false; |
349 |
softime |
18876 |
$this->addToMessage(__("Le champ")." <span class=\"bold\">". |
350 |
|
|
__("particulier_nom")."</span> ".__("est obligatoire.")); |
351 |
mbroquet |
3730 |
} |
352 |
|
|
|
353 |
|
|
// la dénomination ou la raison sociale est obligatoire pour une personne morale |
354 |
|
|
if($this->valF['qualite'] == "personne_morale" |
355 |
softime |
18876 |
&& $this->valF['personne_morale_denomination'] == "" |
356 |
|
|
&& $this->valF['personne_morale_raison_sociale'] == "") { |
357 |
mbroquet |
3730 |
$this->correct = false; |
358 |
softime |
18876 |
$this->addToMessage(__("Un des champs")." <span class=\"bold\">". |
359 |
|
|
__("personne_morale_denomination")."</span> ou <span class=\"bold\">". |
360 |
|
|
__("personne_morale_raison_sociale")."</span> ".__("doit etre rempli.")); |
361 |
mbroquet |
3730 |
} |
362 |
|
|
|
363 |
softime |
10968 |
// Le numéro de SIRET doit contenir obligatoirement 14 caractères |
364 |
|
|
if ($this->valF['qualite'] == "personne_morale" |
365 |
|
|
&& $this->valF['personne_morale_siret'] != null |
366 |
|
|
&& strlen($this->valF['personne_morale_siret']) != 14) { |
367 |
|
|
$this->correct = false; |
368 |
softime |
18876 |
$this->addToMessage(__("Le champ")." <span class=\"bold\">".__("personne_morale_siret")."</span>".__(" doit contenir 14 caractères.")); |
369 |
softime |
10968 |
} |
370 |
|
|
|
371 |
mbroquet |
3730 |
} |
372 |
|
|
|
373 |
softime |
10968 |
/** |
374 |
softime |
16749 |
* Methode de récupération et affichage au format au json des champs de l'adresse postale |
375 |
|
|
* du demandeur pour être traiter par la méthode JS copy_demandeur_address() |
376 |
|
|
* |
377 |
|
|
* L'identifiant du demandeur est récupéré via l'url ($_GET) |
378 |
|
|
* |
379 |
|
|
* @return bool En cas d'erreur de traitement retourne false, sinon true |
380 |
|
|
*/ |
381 |
|
|
function view_adresses_postale_values_json(){ |
382 |
|
|
|
383 |
|
|
$demandeur_id = $this->f->get_submitted_get_value("demandeur_id"); |
384 |
|
|
|
385 |
|
|
if (empty($demandeur_id)){ |
386 |
|
|
return false; |
387 |
|
|
} |
388 |
|
|
|
389 |
|
|
$res = $this->f->get_all_results_from_db_query( |
390 |
|
|
sprintf( |
391 |
|
|
'SELECT |
392 |
|
|
numero, |
393 |
|
|
voie, |
394 |
|
|
lieu_dit, |
395 |
|
|
localite, |
396 |
|
|
code_postal, |
397 |
|
|
bp, |
398 |
|
|
cedex |
399 |
|
|
FROM |
400 |
|
|
%1$sdemandeur |
401 |
|
|
WHERE |
402 |
|
|
demandeur.demandeur = \'%2$d\'', |
403 |
|
|
DB_PREFIXE, |
404 |
|
|
intVal($demandeur_id) |
405 |
|
|
), |
406 |
|
|
array( |
407 |
|
|
"origin" => __METHOD__, |
408 |
|
|
) |
409 |
|
|
); |
410 |
|
|
|
411 |
|
|
// Retourne les valeurs en JSON |
412 |
|
|
echo json_encode($res['result'][0]); |
413 |
|
|
return true; |
414 |
|
|
} |
415 |
|
|
|
416 |
|
|
/** |
417 |
softime |
10968 |
* Methode setTaille |
418 |
|
|
*/ |
419 |
|
|
function setTaille(&$form, $maj) { |
420 |
|
|
parent::setTaille($form, $maj); |
421 |
|
|
$form->setTaille("personne_morale_siret", 14); |
422 |
|
|
} |
423 |
|
|
|
424 |
|
|
/** |
425 |
|
|
* Methode setMax |
426 |
|
|
*/ |
427 |
|
|
function setMax(&$form, $maj) { |
428 |
|
|
parent::setMax($form, $maj); |
429 |
|
|
$form->setMax("personne_morale_siret", 14); |
430 |
|
|
} |
431 |
|
|
|
432 |
mbroquet |
3730 |
/* |
433 |
|
|
* Select pour les champs qualite et type_demandeur |
434 |
|
|
*/ |
435 |
|
|
function setType(&$form,$maj) { |
436 |
|
|
parent::setType($form,$maj); |
437 |
softime |
10573 |
|
438 |
|
|
$form->setType('num_inscription', 'hidden'); |
439 |
|
|
$form->setType('nom_cabinet', 'hidden'); |
440 |
|
|
$form->setType('conseil_regional', 'hidden'); |
441 |
softime |
15650 |
$form->setType('titre_obt_diplo_spec', 'hidden'); |
442 |
|
|
$form->setType('date_obt_diplo_spec', 'hidden'); |
443 |
|
|
$form->setType('lieu_obt_diplo_spec', 'hidden'); |
444 |
softime |
10573 |
|
445 |
mbroquet |
3730 |
if ($maj < 2) { //ajouter et modifier |
446 |
|
|
|
447 |
|
|
$form->setType('type_demandeur', 'select'); |
448 |
|
|
$form->setType('qualite', 'select'); |
449 |
softime |
10573 |
if ($this->f->is_option_mode_service_consulte_enabled() === false) { |
450 |
|
|
if ($maj == 1){ |
451 |
|
|
if ($this->get_dossier_from_link() !== false && $this->get_dossier_from_link() !== null) { |
452 |
|
|
$id_dossier = null; |
453 |
|
|
if (empty($this->get_dossier_from_link())) { |
454 |
|
|
if ($this->f->get_submitted_get_value('idx_dossier') != null) { |
455 |
|
|
$id_dossier = $this->f->get_submitted_get_value('idx_dossier'); |
456 |
|
|
} |
457 |
|
|
} else { |
458 |
|
|
$id_dossier=$this->get_dossier_from_link()[0]['dossier']; |
459 |
|
|
} |
460 |
|
|
|
461 |
|
|
$inst_dossier = $this->f->get_inst__om_dbform(array( |
462 |
|
|
"obj" => "dossier", |
463 |
|
|
"idx" => $id_dossier, |
464 |
|
|
)); |
465 |
softime |
19307 |
if ($this->f->is_type_dossier_platau($id_dossier) === true |
466 |
softime |
10808 |
&& $inst_dossier->getVal('etat_transmission_platau') !== 'jamais_transmissible') { |
467 |
|
|
// |
468 |
softime |
15650 |
$required_fields_platau = $inst_dossier->get_list_platau_required_fields_dossier(); |
469 |
softime |
10573 |
foreach ($required_fields_platau as $required_field_platau) { |
470 |
|
|
$champ = explode('.', $required_field_platau)[1]; |
471 |
|
|
if (in_array($champ, $this->champs)) { |
472 |
|
|
$form->setType($champ ,$form->type[$champ].'_demat_color'); |
473 |
|
|
} |
474 |
|
|
} |
475 |
|
|
} |
476 |
|
|
} |
477 |
|
|
} |
478 |
|
|
if ($maj == 0) { |
479 |
|
|
$inst_dossier = $this->f->get_inst__om_dbform(array( |
480 |
|
|
"obj" => "dossier", |
481 |
|
|
"idx" => $this->f->get_submitted_get_value('idx_dossier'), |
482 |
|
|
)); |
483 |
softime |
19307 |
if ($this->f->is_type_dossier_platau($this->f->get_submitted_get_value('idx_dossier')) === true |
484 |
softime |
10808 |
&& $inst_dossier->getVal('etat_transmission_platau') !== 'jamais_transmissible') { |
485 |
|
|
// |
486 |
softime |
15650 |
$required_fields_platau = $inst_dossier->get_list_platau_required_fields_dossier(); |
487 |
softime |
10573 |
foreach ($required_fields_platau as $required_field_platau) { |
488 |
|
|
$champ = explode('.', $required_field_platau)[1]; |
489 |
|
|
if (in_array($champ, $this->champs)) { |
490 |
|
|
$form->setType($champ ,$form->type[$champ].'_demat_color'); |
491 |
|
|
} |
492 |
|
|
} |
493 |
|
|
} |
494 |
|
|
} |
495 |
|
|
} |
496 |
softime |
18876 |
if($maj == 0 && $this->getParameter("idx_demandeur") != "") { |
497 |
mbroquet |
3730 |
$form->setType('frequent','hidden'); |
498 |
|
|
$form->setType('qualite','selectdisabled'); |
499 |
|
|
$form->setType('particulier_nom','textdisabled'); |
500 |
|
|
$form->setType('particulier_prenom','textdisabled'); |
501 |
|
|
$form->setType('particulier_date_naissance','datedisabled'); |
502 |
|
|
$form->setType('particulier_commune_naissance','textdisabled'); |
503 |
|
|
$form->setType('particulier_departement_naissance','textdisabled'); |
504 |
softime |
7996 |
$form->setType('particulier_pays_naissance','textdisabled'); |
505 |
mbroquet |
3730 |
$form->setType('personne_morale_denomination','textdisabled'); |
506 |
|
|
$form->setType('personne_morale_raison_sociale','textdisabled'); |
507 |
|
|
$form->setType('personne_morale_siret','textdisabled'); |
508 |
|
|
$form->setType('personne_morale_categorie_juridique','textdisabled'); |
509 |
|
|
$form->setType('personne_morale_nom','textdisabled'); |
510 |
|
|
$form->setType('personne_morale_prenom','textdisabled'); |
511 |
|
|
$form->setType('particulier_civilite','selectdisabled'); |
512 |
|
|
$form->setType('personne_morale_civilite','selectdisabled'); |
513 |
|
|
$form->setType('telephone_fixe','textdisabled'); |
514 |
|
|
$form->setType('telephone_mobile','textdisabled'); |
515 |
|
|
$form->setType('fax','textdisabled'); |
516 |
|
|
$form->setType('indicatif','textdisabled'); |
517 |
|
|
$form->setType('courriel','textdisabled'); |
518 |
|
|
|
519 |
|
|
} |
520 |
|
|
} |
521 |
softime |
10573 |
|
522 |
mbroquet |
3730 |
$form->setType('demandeur', 'hidden'); |
523 |
|
|
|
524 |
|
|
} |
525 |
softime |
8989 |
|
526 |
softime |
6565 |
/** |
527 |
softime |
8989 |
* SETTER_FORM - setSelect. |
528 |
softime |
6565 |
* |
529 |
softime |
8989 |
* @return void |
530 |
mbroquet |
3730 |
*/ |
531 |
softime |
8989 |
function setSelect(&$form, $maj, &$dnu1 = null, $dnu2 = null) { |
532 |
|
|
parent::setSelect($form, $maj); |
533 |
softime |
6929 |
|
534 |
softime |
6565 |
// Type du demandeur |
535 |
mbroquet |
3730 |
$contenu=array(); |
536 |
|
|
|
537 |
|
|
$contenu[0][0]=""; |
538 |
softime |
18876 |
$contenu[1][0]=__('choisir')." ".__('type_demandeur'); |
539 |
mbroquet |
3730 |
$contenu[0][2]="petitionnaire"; |
540 |
softime |
18876 |
$contenu[1][2]=__('petitionnaire'); |
541 |
mbroquet |
3730 |
$contenu[0][1]="delegataire"; |
542 |
softime |
18876 |
$contenu[1][1]=__('autre correspondant'); |
543 |
softime |
6565 |
$contenu[0][3]="plaignant"; |
544 |
softime |
18876 |
$contenu[1][3]=__('Plaignant'); |
545 |
softime |
6565 |
$contenu[0][4]="contrevenant"; |
546 |
softime |
18876 |
$contenu[1][4]=__('Contrevenant'); |
547 |
softime |
6565 |
$contenu[0][5]="requerant"; |
548 |
softime |
18876 |
$contenu[1][5]=__('Requérant'); |
549 |
softime |
6565 |
$contenu[0][6]="avocat"; |
550 |
softime |
18876 |
$contenu[1][6]=__('Avocat'); |
551 |
softime |
7067 |
$contenu[0][7]="bailleur"; |
552 |
softime |
18876 |
$contenu[1][7]=__('Bailleur'); |
553 |
softime |
10573 |
$contenu[0][8] = "proprietaire"; |
554 |
|
|
$contenu[1][8] = __('Propriétaire'); |
555 |
|
|
$contenu[0][9] = "architecte_lc"; |
556 |
|
|
$contenu[1][9] = __('Architecte législation connexe'); |
557 |
|
|
$contenu[0][10] = "paysagiste"; |
558 |
|
|
$contenu[1][10] = __('Concepteur-Paysagiste'); |
559 |
mbroquet |
3730 |
|
560 |
softime |
6565 |
$form->setSelect("type_demandeur", $contenu); |
561 |
mbroquet |
3730 |
|
562 |
softime |
6565 |
// Qualité du demandeur |
563 |
mbroquet |
3730 |
$contenu=array(); |
564 |
|
|
|
565 |
|
|
$contenu[0][0]="particulier"; |
566 |
|
|
$contenu[1][0]=_('particulier'); |
567 |
|
|
$contenu[0][1]="personne_morale"; |
568 |
|
|
$contenu[1][1]=_('personne morale'); |
569 |
|
|
|
570 |
softime |
6565 |
$form->setSelect("qualite", $contenu); |
571 |
mbroquet |
3730 |
} |
572 |
|
|
|
573 |
|
|
/* |
574 |
|
|
* Ajoute l'action javascript sur le select de la qualité |
575 |
|
|
*/ |
576 |
|
|
function setOnchange(&$form,$maj){ |
577 |
|
|
parent::setOnchange($form,$maj); |
578 |
|
|
|
579 |
|
|
$form->setOnchange("qualite","changeDemandeurType('qualite');"); |
580 |
|
|
} |
581 |
|
|
|
582 |
|
|
/** |
583 |
|
|
* Ajout d'un champs caché permettant de linker l'id du demandeur |
584 |
|
|
* recement ajouté |
585 |
|
|
**/ |
586 |
|
|
function sousFormSpecificContent($maj) { |
587 |
softime |
16749 |
if ($this->correct === true || $this->getVal('frequent') === 't') { |
588 |
|
|
$id_demandeur = $this->getVal("demandeur"); |
589 |
softime |
18876 |
if(isset($this->valF["demandeur"]) && !empty($this->valF["demandeur"])) { |
590 |
softime |
16749 |
echo "<input id=\"id_retour\" name=\"idRetour\" type=\"hidden\" value=\"". |
591 |
|
|
$this->valF["demandeur"]."\" />"; |
592 |
softime |
18876 |
} elseif (isset($id_demandeur) && !empty($id_demandeur) && $maj == 110) { |
593 |
softime |
16749 |
echo "<input id=\"id_retour\" name=\"idRetour\" type=\"hidden\" value=\"". |
594 |
|
|
$this->getVal("demandeur")."\" />"; |
595 |
|
|
} |
596 |
mbroquet |
3730 |
} |
597 |
|
|
} |
598 |
|
|
/** |
599 |
|
|
* Surcharge du lien de retour permettant de linker l'id du demandeur |
600 |
|
|
* recement ajouté |
601 |
|
|
**/ |
602 |
softime |
6929 |
function retoursousformulaire($idxformulaire = NULL, $retourformulaire = NULL, $val = NULL, |
603 |
|
|
$objsf = NULL, $premiersf = NULL, $tricolsf = NULL, $validation = NULL, |
604 |
|
|
$idx = NULL, $maj = NULL, $retour = NULL) { |
605 |
softime |
16749 |
if ($retourformulaire === "demande") { |
606 |
|
|
return ''; |
607 |
mbroquet |
3730 |
} else { |
608 |
|
|
parent::retoursousformulaire($idxformulaire, $retourformulaire, $val, |
609 |
|
|
$objsf, $premiersf, $tricolsf, $validation, |
610 |
|
|
$idx, $maj, $retour); |
611 |
|
|
} |
612 |
|
|
} |
613 |
|
|
|
614 |
|
|
/** |
615 |
|
|
* Ajout du paramètre principal |
616 |
|
|
*/ |
617 |
|
|
function getDataSubmitSousForm() { |
618 |
|
|
/*Création du lien de validation du sous-formulaire*/ |
619 |
|
|
$datasubmit = ""; |
620 |
softime |
7996 |
$datasubmit .= OM_ROUTE_SOUSFORM; |
621 |
|
|
$datasubmit .= "&obj=".$this->get_absolute_class_name(); |
622 |
mbroquet |
3730 |
$datasubmit .= "&validation=".$this->getParameter("validation"); |
623 |
|
|
if ($this->getParameter("idx") != "]") { |
624 |
|
|
// |
625 |
|
|
if ($this->getParameter("maj") == 1) { // modifier |
626 |
|
|
$datasubmit .= "&action=1"; |
627 |
|
|
$datasubmit .= "&idx=".$this->getParameter("idx"); |
628 |
|
|
} else { // supprimer |
629 |
|
|
$datasubmit .= "&action=2"; |
630 |
|
|
$datasubmit .= "&idx=".$this->getParameter("idx"); |
631 |
|
|
} |
632 |
|
|
} |
633 |
|
|
$datasubmit .= "&premiersf=".$this->getParameter("premiersf"); |
634 |
|
|
$datasubmit .= "&retourformulaire=".$this->getParameter("retourformulaire"); |
635 |
|
|
$datasubmit .= "&trisf=".$this->getParameter("tricolsf"); |
636 |
|
|
$datasubmit .= "&idxformulaire=".$this->getParameter("idxformulaire"); |
637 |
|
|
$datasubmit .= "&principal=".$this->getParameter("principal"); |
638 |
|
|
// |
639 |
|
|
return $datasubmit; |
640 |
|
|
} |
641 |
|
|
|
642 |
|
|
/** |
643 |
softime |
6565 |
* Synthèse des demandeurs pour le formulaire de la demande. |
644 |
|
|
* |
645 |
|
|
* @param string $type Type de demandeur. |
646 |
|
|
* @param boolean $linkable Affiche le lien d'édition. |
647 |
mbroquet |
3730 |
*/ |
648 |
|
|
function afficherSynthese($type, $linkable) { |
649 |
softime |
16749 |
// Si le demandeur est le pétitionnaire principal |
650 |
|
|
$is_petitionnaire_principal = false; |
651 |
softime |
6565 |
// Récupération du type de demandeur pour l'affichage |
652 |
mbroquet |
3730 |
switch ($type) { |
653 |
|
|
case 'petitionnaire_principal': |
654 |
softime |
16749 |
$legend = __("Demandeur principal"); |
655 |
|
|
$is_petitionnaire_principal = true; |
656 |
mbroquet |
3730 |
break; |
657 |
|
|
|
658 |
|
|
case 'delegataire': |
659 |
softime |
16749 |
$legend = __("Autre correspondant"); |
660 |
mbroquet |
3730 |
break; |
661 |
softime |
16749 |
|
662 |
mbroquet |
3730 |
case 'petitionnaire': |
663 |
softime |
16749 |
$legend = __("Demandeur"); |
664 |
mbroquet |
3730 |
break; |
665 |
softime |
16749 |
|
666 |
softime |
6565 |
case 'contrevenant_principal': |
667 |
softime |
16749 |
$legend = __("Contrevenant principal"); |
668 |
|
|
$is_petitionnaire_principal = true; |
669 |
softime |
6565 |
break; |
670 |
softime |
16749 |
|
671 |
softime |
6565 |
case 'contrevenant': |
672 |
softime |
16749 |
$legend = __("Contrevenant"); |
673 |
softime |
6565 |
break; |
674 |
softime |
16749 |
|
675 |
softime |
6565 |
case 'plaignant_principal': |
676 |
softime |
16749 |
$legend = __("Plaignant principal"); |
677 |
|
|
$is_petitionnaire_principal = true; |
678 |
softime |
6565 |
break; |
679 |
softime |
16749 |
|
680 |
softime |
6565 |
case 'plaignant': |
681 |
softime |
16749 |
$legend = __("Plaignant"); |
682 |
softime |
6565 |
break; |
683 |
softime |
16749 |
|
684 |
softime |
6565 |
case 'requerant_principal': |
685 |
softime |
16749 |
$legend = __("Requérant principal"); |
686 |
|
|
$is_petitionnaire_principal = true; |
687 |
softime |
6565 |
break; |
688 |
softime |
16749 |
|
689 |
softime |
6565 |
case 'requerant': |
690 |
softime |
16749 |
$legend = __("Requérant"); |
691 |
softime |
6565 |
break; |
692 |
softime |
16749 |
|
693 |
softime |
6565 |
case 'avocat_principal': |
694 |
softime |
16749 |
$legend = __("Avocat principal"); |
695 |
|
|
$is_petitionnaire_principal = true; |
696 |
softime |
6565 |
break; |
697 |
softime |
16749 |
|
698 |
softime |
6565 |
case 'avocat': |
699 |
softime |
16749 |
$legend = __("Avocat"); |
700 |
softime |
6565 |
break; |
701 |
softime |
7067 |
|
702 |
|
|
case 'bailleur_principal': |
703 |
softime |
16749 |
$legend = __("Bailleur principal"); |
704 |
|
|
$is_petitionnaire_principal = true; |
705 |
softime |
7067 |
break; |
706 |
softime |
16749 |
|
707 |
softime |
7067 |
case 'bailleur': |
708 |
softime |
16749 |
$legend = __("Bailleur"); |
709 |
softime |
7067 |
break; |
710 |
softime |
10573 |
|
711 |
|
|
case 'proprietaire': |
712 |
|
|
$legend = __('Propriétaire'); |
713 |
|
|
break; |
714 |
|
|
|
715 |
|
|
case 'architecte_lc': |
716 |
|
|
$legend = __('Architecte législation connexe'); |
717 |
|
|
break; |
718 |
|
|
|
719 |
|
|
case 'paysagiste': |
720 |
|
|
$legend = __('Concepteur-Paysagiste'); |
721 |
|
|
break; |
722 |
mbroquet |
3730 |
} |
723 |
softime |
16749 |
|
724 |
|
|
$templateIconeNotification = ''; |
725 |
softime |
18436 |
|
726 |
softime |
10713 |
// Initialisation de tous les éléments à afficher |
727 |
|
|
foreach ($this->champs as $champs) { |
728 |
softime |
18436 |
$value = $this->val[array_search($champs, $this->champs)]; |
729 |
|
|
${$champs} = $value != "" ? $value : ''; |
730 |
softime |
10713 |
} |
731 |
softime |
18436 |
// Variable pour condition d'affichage des 2 différents messages de notification |
732 |
|
|
if ($notification === "t" ) { |
733 |
|
|
$decision = "souhaite"; |
734 |
|
|
$templateIconeNotification = 'icon-notif-accepte'; |
735 |
|
|
} else { |
736 |
|
|
$decision = "ne souhaite pas"; |
737 |
|
|
$templateIconeNotification = 'icon-notif-refuse'; |
738 |
|
|
} |
739 |
|
|
|
740 |
|
|
$notificationMessage = sprintf(' Le demandeur %1$s être notifié électroniquement', $decision); |
741 |
|
|
|
742 |
|
|
// Affichage du message de notification uniquement si le demandeur est de type "petitionnaire_principal" |
743 |
|
|
$notification = $type === "petitionnaire_principal" ? $notificationMessage : ""; |
744 |
softime |
10713 |
|
745 |
|
|
// Templates utilisés pour réaliser l'affichage |
746 |
softime |
16749 |
$templateFieldsetDemandeur = |
747 |
|
|
'<fieldset class="%1$s cadre col_6" id="%1$s_%2$s"> |
748 |
|
|
<legend class="ui-widget-content legend_synthese_demandeur"> |
749 |
softime |
10713 |
%3$s |
750 |
softime |
16749 |
</legend> |
751 |
|
|
<div class="fieldsetContent">'; |
752 |
softime |
10713 |
|
753 |
softime |
16749 |
$templateBlocNomAdresse = |
754 |
|
|
'<div class="bloc demande__demandeur--nom-adresse"> |
755 |
|
|
%1$s |
756 |
|
|
</div>'; |
757 |
softime |
10713 |
|
758 |
softime |
16749 |
$templateBlocCoordonnees = |
759 |
|
|
'<div class="bloc demande__demandeur--coordonnees"> |
760 |
|
|
%1$s |
761 |
|
|
</div>'; |
762 |
softime |
10713 |
|
763 |
softime |
16749 |
$templateBoutonSupprDemandeur = |
764 |
|
|
'<button type="button" class="button-remove button-danger-secondary" onclick="removeDemandeur(\'%1$s_%2$s\') ; return false;"> |
765 |
|
|
<i class="ri-delete-bin-line"></i> %3$s |
766 |
|
|
</button>'; |
767 |
|
|
|
768 |
|
|
$templateBoutonModifDemandeur = |
769 |
|
|
'<button type="button" class="button-edit button-secondary" onclick="editDemandeur(\'%1$s\',%2$s,\'%3$s\',\'%3$s_%2$s\'); return false;"> |
770 |
|
|
<i class="ri-edit-2-line"></i> %4$s |
771 |
|
|
</button>'; |
772 |
|
|
|
773 |
|
|
$templateParagraph = |
774 |
|
|
'<p class="%1$s">%2$s</p>'; |
775 |
|
|
|
776 |
|
|
$templateParagraphStrong = |
777 |
|
|
'<p class="%1$s"><strong>%2$s</strong></p>'; |
778 |
|
|
|
779 |
|
|
$templateParagraphNotification = |
780 |
softime |
18436 |
'<p class="%1$s"><i class="ri-mail-unread-line %2$s"></i>%3$s</p>'; |
781 |
softime |
16749 |
|
782 |
softime |
10713 |
printf( |
783 |
softime |
16749 |
$templateFieldsetDemandeur, |
784 |
softime |
10713 |
$type, |
785 |
|
|
$demandeur, |
786 |
|
|
$legend |
787 |
|
|
); |
788 |
softime |
16749 |
|
789 |
softime |
6565 |
$input_name = $type.'[]'; |
790 |
|
|
|
791 |
mbroquet |
3730 |
// Valeur de formulaire à retourner |
792 |
softime |
6565 |
printf( |
793 |
|
|
"<input type=\"hidden\" class=\"demandeur_id\" name=\"%s\" value=\"%s\" />\n", |
794 |
|
|
$input_name, |
795 |
|
|
$this->val[array_search('demandeur', $this->champs)] |
796 |
|
|
); |
797 |
mbroquet |
3730 |
|
798 |
softime |
10713 |
// Préparation des infos du demandeur qui seront affichées en les stockant dans un tableau |
799 |
|
|
// Chaque élement du tableau correspond a une ligne dans l'affichage |
800 |
|
|
$infosAffichage = array(); |
801 |
softime |
16749 |
$paragraphs_nom_adresse = ''; |
802 |
|
|
$paragraphs_coordonnees = ''; |
803 |
|
|
$paragraphs_action = ''; |
804 |
softime |
10713 |
if ($qualite == 'particulier') { |
805 |
|
|
$infosAffichage['particulier'] = $particulier_nom." ".$particulier_prenom; |
806 |
softime |
16749 |
|
807 |
softime |
10713 |
// S'il existe une civilité elle est ajoutée devant le nom du particulier |
808 |
|
|
if ( ! empty($particulier_civilite)) { |
809 |
softime |
14064 |
$inst_civilite = $this->f->get_inst__om_dbform(array( |
810 |
|
|
"obj" => "civilite", |
811 |
|
|
"idx" => $particulier_civilite, |
812 |
|
|
)); |
813 |
|
|
$infosAffichage['particulier'] = $inst_civilite->getVal("libelle")." ".$particulier_nom." ".$particulier_prenom; |
814 |
mbroquet |
3730 |
} |
815 |
softime |
16749 |
if (!empty($infosAffichage['particulier'])) $paragraphs_nom_adresse.= sprintf($templateParagraphStrong, "nom–prenom", $infosAffichage['particulier'] ); |
816 |
|
|
|
817 |
mbroquet |
3730 |
} else { |
818 |
softime |
10713 |
$infosAffichage['personne_morale'] = $personne_morale_raison_sociale." ".$personne_morale_denomination; |
819 |
softime |
16749 |
$infosAffichage['personne_morale_nom'] = $personne_morale_civilite ." ".$personne_morale_nom." ".$personne_morale_prenom; |
820 |
softime |
10713 |
// S'il existe une civilité elle est ajoutée devant le nom de la personne morale |
821 |
|
|
if (! empty($personne_morale_civilite)) { |
822 |
softime |
14064 |
$inst_civilite = $this->f->get_inst__om_dbform(array( |
823 |
|
|
"obj" => "civilite", |
824 |
|
|
"idx" => $personne_morale_civilite, |
825 |
|
|
)); |
826 |
|
|
$infosAffichage['personne_morale_nom'] = $inst_civilite->getVal("libelle")." ".$personne_morale_nom." ".$personne_morale_prenom; |
827 |
softime |
10713 |
} |
828 |
|
|
|
829 |
softime |
16749 |
if (!empty($infosAffichage['personne_morale'])) { |
830 |
|
|
$paragraphs_nom_adresse.= sprintf($templateParagraphStrong, "personne-morale-raison-sociale-denomination", $infosAffichage['personne_morale']); |
831 |
softime |
10713 |
} |
832 |
softime |
16749 |
|
833 |
|
|
if (!empty($infosAffichage['personne_morale_nom'])) { |
834 |
|
|
$paragraphs_nom_adresse.= sprintf($templateParagraph, "personne-morale-nom–prenom", "représenté(e) par ".$infosAffichage['personne_morale_nom']); |
835 |
|
|
} |
836 |
softime |
10713 |
} |
837 |
softime |
16749 |
|
838 |
|
|
// Limitation de l'affichage des informations personnelles des pétitionnaires au seul pétitionnaire principal |
839 |
|
|
if ($is_petitionnaire_principal) { |
840 |
|
|
$infosAffichage['adresse_1'] = $numero." ".$voie." ".$complement; |
841 |
|
|
$infosAffichage['adresse_2'] = $lieu_dit; |
842 |
|
|
$infosAffichage['adresse_3'] = $code_postal." ".$localite." ".$bp." ".$cedex; |
843 |
|
|
$infosAffichage['adresse_4'] = $division_territoriale." ".$pays; |
844 |
|
|
} |
845 |
|
|
if (!empty($infosAffichage['adresse_1'])) { |
846 |
|
|
$paragraphs_nom_adresse.= sprintf($templateParagraph, "adresse", $infosAffichage['adresse_1']); |
847 |
|
|
} |
848 |
|
|
if (!empty($infosAffichage['adresse_2'])) { |
849 |
|
|
$paragraphs_nom_adresse.= sprintf($templateParagraph, "adresse", $infosAffichage['adresse_2']); |
850 |
|
|
} |
851 |
|
|
if (!empty($infosAffichage['adresse_3'])) { |
852 |
|
|
$paragraphs_nom_adresse.= sprintf($templateParagraph, "adresse", $infosAffichage['adresse_3']); |
853 |
|
|
} |
854 |
|
|
if (!empty($infosAffichage['adresse_4'])) { |
855 |
|
|
$paragraphs_nom_adresse.= sprintf($templateParagraph, "adresse", $infosAffichage['adresse_4']); |
856 |
|
|
} |
857 |
softime |
10713 |
|
858 |
softime |
16749 |
if (!empty($paragraphs_nom_adresse)) { |
859 |
|
|
printf( |
860 |
|
|
$templateBlocNomAdresse, |
861 |
|
|
$paragraphs_nom_adresse |
862 |
|
|
); |
863 |
|
|
} |
864 |
|
|
|
865 |
|
|
$infosAffichage['notification'] = $notification; |
866 |
|
|
if ($is_petitionnaire_principal) { |
867 |
|
|
if ($telephone_fixe == "" && $telephone_mobile != "") { |
868 |
|
|
$infosAffichage['tel'] = $telephone_mobile; |
869 |
|
|
} elseif ($telephone_mobile == "" && $telephone_fixe != "" ) { |
870 |
|
|
$infosAffichage['tel'] = $telephone_fixe; |
871 |
|
|
} elseif ($telephone_fixe != "" && $telephone_mobile != "") { |
872 |
|
|
$infosAffichage['tel'] = $telephone_fixe . " - " . $telephone_mobile; |
873 |
softime |
10713 |
} |
874 |
softime |
16749 |
$infosAffichage['email'] = $courriel; |
875 |
softime |
10713 |
} |
876 |
softime |
16749 |
|
877 |
|
|
if (!empty($infosAffichage['notification'])) { |
878 |
|
|
$paragraphs_coordonnees.= sprintf($templateParagraphNotification, "notification", $templateIconeNotification, $infosAffichage['notification']); |
879 |
|
|
} |
880 |
|
|
if (!empty($infosAffichage['email'])) { |
881 |
|
|
$paragraphs_coordonnees.= sprintf($templateParagraph, "email", $infosAffichage['email']); |
882 |
|
|
} |
883 |
|
|
if (!empty($infosAffichage['tel'])) { |
884 |
|
|
$paragraphs_coordonnees.= sprintf($templateParagraph, "tel", $infosAffichage['tel']); |
885 |
|
|
} |
886 |
softime |
10713 |
|
887 |
softime |
16749 |
if (!empty($paragraphs_coordonnees)) { |
888 |
|
|
printf( |
889 |
|
|
$templateBlocCoordonnees, |
890 |
|
|
$paragraphs_coordonnees |
891 |
|
|
); |
892 |
|
|
} |
893 |
|
|
|
894 |
|
|
echo '<div class="bloc demande__demandeur--actions">'; |
895 |
|
|
|
896 |
|
|
// Lien de modification du demandeur |
897 |
softime |
6565 |
if ($linkable === true) { |
898 |
softime |
16749 |
printf( |
899 |
|
|
$templateBoutonModifDemandeur, |
900 |
|
|
$type_demandeur, |
901 |
|
|
$demandeur, |
902 |
|
|
$type, |
903 |
softime |
18876 |
__("ÉDITER") |
904 |
softime |
16749 |
); |
905 |
mbroquet |
3730 |
} |
906 |
softime |
16749 |
|
907 |
|
|
// Si le paramètre linkable est défini à true on ajoute les balises |
908 |
|
|
// de lien. Le pétitionnaire principal n'est pas supprimable |
909 |
|
|
if ($linkable === true) { |
910 |
|
|
printf( |
911 |
|
|
$templateBoutonSupprDemandeur, |
912 |
|
|
$type, |
913 |
|
|
$demandeur, |
914 |
softime |
18876 |
__("SUPPRIMER") |
915 |
softime |
16749 |
); |
916 |
|
|
} |
917 |
|
|
|
918 |
|
|
echo " |
919 |
|
|
</div> |
920 |
|
|
</div> |
921 |
|
|
</fieldset >\n"; |
922 |
mbroquet |
3730 |
} |
923 |
|
|
|
924 |
fmichon |
4708 |
/** |
925 |
|
|
* |
926 |
|
|
*/ |
927 |
|
|
function get_inst_civilite($civilite) { |
928 |
|
|
return $this->get_inst_common("civilite", $civilite); |
929 |
|
|
} |
930 |
|
|
|
931 |
|
|
/** |
932 |
|
|
* Retourne un tableau avec les données principales du demandeur. |
933 |
|
|
* |
934 |
|
|
* L'objectif est de mettre à disposition via un WS Reste un ensemble |
935 |
|
|
* de données exploitable par une autre application. |
936 |
|
|
*/ |
937 |
|
|
function get_datas() { |
938 |
|
|
|
939 |
|
|
/** |
940 |
|
|
* |
941 |
|
|
*/ |
942 |
|
|
$particulier_civilite = ""; |
943 |
|
|
$personne_morale_civilite = ""; |
944 |
|
|
if ($this->getVal('qualite') == 'particulier' |
945 |
|
|
&& $this->getVal('particulier_civilite') !== '') { |
946 |
|
|
// |
947 |
|
|
$inst_civilite = $this->get_inst_civilite($this->getVal('particulier_civilite')); |
948 |
|
|
$particulier_civilite = $inst_civilite->getVal("libelle"); |
949 |
|
|
} elseif ($this->getVal('qualite') == 'personne_morale' |
950 |
|
|
&& $this->getVal('personne_morale_civilite') !== '') { |
951 |
|
|
// |
952 |
|
|
$inst_civilite = $this->get_inst_civilite($this->getVal('personne_morale_civilite')); |
953 |
|
|
$personne_morale_civilite = $inst_civilite->getVal("libelle"); |
954 |
|
|
} |
955 |
|
|
|
956 |
|
|
/** |
957 |
|
|
* |
958 |
|
|
*/ |
959 |
|
|
// |
960 |
|
|
$datas = array( |
961 |
|
|
"demandeur" => $this->getVal($this->clePrimaire), |
962 |
|
|
"qualite" => $this->getVal("qualite"), |
963 |
|
|
); |
964 |
|
|
|
965 |
nhaye |
4777 |
if ($this->getVal('qualite') == 'particulier') { |
966 |
|
|
$datas["particulier_civilite"] = $particulier_civilite; |
967 |
|
|
$datas["particulier_nom"] = $this->getVal("particulier_nom"); |
968 |
|
|
$datas["particulier_prenom"] = $this->getVal("particulier_prenom"); |
969 |
|
|
$datas["particulier_date_naissance"] = $this->getVal("particulier_date_naissance"); |
970 |
|
|
$datas["particulier_commune_naissance"] = $this->getVal("particulier_commune_naissance"); |
971 |
|
|
$datas["particulier_departement_naissance"] = $this->getVal("particulier_departement_naissance"); |
972 |
softime |
7996 |
$datas["particulier_pays_naissance"] = $this->getVal("particulier_pays_naissance"); |
973 |
nhaye |
4777 |
} |
974 |
|
|
if ($this->getVal('qualite') == 'personne_morale') { |
975 |
|
|
$datas["personne_morale_civilite"] = $personne_morale_civilite; |
976 |
|
|
$datas["personne_morale_denomination"] = $this->getVal("personne_morale_denomination"); |
977 |
|
|
$datas["personne_morale_raison_sociale"] = $this->getVal("personne_morale_raison_sociale"); |
978 |
|
|
$datas["personne_morale_siret"] = $this->getVal("personne_morale_siret"); |
979 |
|
|
$datas["personne_morale_categorie_juridique"] = $this->getVal("personne_morale_categorie_juridique"); |
980 |
|
|
$datas["personne_morale_nom"] = $this->getVal("personne_morale_nom"); |
981 |
|
|
$datas["personne_morale_prenom"] = $this->getVal("personne_morale_prenom"); |
982 |
|
|
} |
983 |
|
|
// |
984 |
|
|
$datas["numero"] = $this->getVal("numero"); |
985 |
|
|
$datas["voie"] = $this->getVal("voie"); |
986 |
|
|
$datas["complement"] = $this->getVal("complement"); |
987 |
|
|
$datas["lieu_dit"] = $this->getVal("lieu_dit"); |
988 |
|
|
$datas["localite"] = $this->getVal("localite"); |
989 |
|
|
$datas["code_postal"] = $this->getVal("code_postal"); |
990 |
|
|
$datas["bp"] = $this->getVal("bp"); |
991 |
|
|
$datas["cedex"] = $this->getVal("cedex"); |
992 |
|
|
$datas["pays"] = $this->getVal("pays"); |
993 |
|
|
$datas["division_territoriale"] = $this->getVal("division_territoriale"); |
994 |
|
|
$datas["telephone_fixe"] = $this->getVal("telephone_fixe"); |
995 |
|
|
$datas["telephone_mobile"] = $this->getVal("telephone_mobile"); |
996 |
|
|
$datas["indicatif"] = $this->getVal("indicatif"); |
997 |
|
|
$datas["courriel"] = $this->getVal("courriel"); |
998 |
|
|
$datas["fax"] = $this->getVal("fax"); |
999 |
|
|
|
1000 |
fmichon |
4708 |
/** |
1001 |
|
|
* |
1002 |
|
|
*/ |
1003 |
|
|
return $datas; |
1004 |
|
|
} |
1005 |
|
|
|
1006 |
softime |
7685 |
|
1007 |
|
|
/** |
1008 |
|
|
* Indique si la redirection vers le lien de retour est activée ou non. |
1009 |
|
|
* |
1010 |
|
|
* L'objectif de cette méthode est de permettre d'activer ou de désactiver |
1011 |
|
|
* la redirection dans certains contextes. |
1012 |
|
|
* |
1013 |
|
|
* @return boolean |
1014 |
|
|
*/ |
1015 |
|
|
function is_back_link_redirect_activated() { |
1016 |
|
|
// |
1017 |
|
|
if ($this->getParameter("retourformulaire") === 'demande') { |
1018 |
|
|
// |
1019 |
|
|
return false; |
1020 |
|
|
} |
1021 |
|
|
|
1022 |
|
|
// |
1023 |
|
|
return true; |
1024 |
|
|
} |
1025 |
|
|
|
1026 |
softime |
10573 |
public function get_dossier_from_link() { |
1027 |
|
|
$query = sprintf(' |
1028 |
|
|
SELECT lien_dossier_demandeur.dossier |
1029 |
|
|
FROM %1$slien_dossier_demandeur |
1030 |
|
|
WHERE lien_dossier_demandeur.demandeur = \'%2$s\' |
1031 |
|
|
', |
1032 |
|
|
DB_PREFIXE, |
1033 |
|
|
$this->getVal($this->clePrimaire) |
1034 |
|
|
); |
1035 |
softime |
13137 |
$res = $this->f->get_all_results_from_db_query( |
1036 |
|
|
$query, |
1037 |
|
|
array( |
1038 |
|
|
"origin" => __METHOD__, |
1039 |
|
|
"force_return" => true, |
1040 |
|
|
) |
1041 |
|
|
); |
1042 |
softime |
10573 |
if ($res['code'] === 'KO') { |
1043 |
|
|
return false; |
1044 |
|
|
} |
1045 |
|
|
return $res['result']; |
1046 |
|
|
} |
1047 |
softime |
7685 |
|
1048 |
softime |
10573 |
public function triggermodifierapres($id, &$dnu1 = null, $val = array(), $dnu2 = null) { |
1049 |
|
|
parent::triggermodifierapres($id, $dnu1, $val, $dnu2); |
1050 |
|
|
if (count(array_diff_assoc($this->valF, array_combine($this->champs, $this->val))) > 0) { |
1051 |
|
|
/** |
1052 |
|
|
* Gestion des tâches pour la dématérialisation |
1053 |
|
|
*/ |
1054 |
|
|
$dossiers = $this->get_dossier_from_link(); |
1055 |
|
|
foreach ($dossiers as $dossier) { |
1056 |
|
|
// |
1057 |
|
|
$inst_dossier = $this->f->get_inst__om_dbform(array( |
1058 |
|
|
"obj" => "dossier", |
1059 |
|
|
"idx" => $dossier['dossier'], |
1060 |
|
|
)); |
1061 |
|
|
|
1062 |
|
|
if ($this->f->is_option_mode_service_consulte_enabled() === false |
1063 |
softime |
19307 |
&& $this->f->is_type_dossier_platau($dossier['dossier']) === true |
1064 |
softime |
10808 |
&& $inst_dossier->getVal('etat_transmission_platau') !== 'jamais_transmissible') { |
1065 |
softime |
13137 |
|
1066 |
|
|
$trigger_platau_required_fields = $inst_dossier->trigger_platau_required_fields($dossier['dossier']); |
1067 |
|
|
// Gestion de l'erreur |
1068 |
|
|
if (! $trigger_platau_required_fields) { |
1069 |
|
|
$this->addToMessage(sprintf('%s %s', |
1070 |
|
|
__("Une erreur s'est produite lors de la mise à jour de l'état de transmission du dossier."), |
1071 |
|
|
__("Veuillez contacter votre administrateur.") |
1072 |
|
|
)); |
1073 |
|
|
$this->correct = false; |
1074 |
|
|
return false; |
1075 |
|
|
} |
1076 |
softime |
10573 |
} |
1077 |
|
|
|
1078 |
softime |
19307 |
if ($this->f->is_type_dossier_platau($dossier['dossier']) |
1079 |
softime |
10808 |
&& $inst_dossier->getVal('etat_transmission_platau') !== 'jamais_transmissible' |
1080 |
softime |
10573 |
&& ($this->f->is_option_mode_service_consulte_enabled() !== true |
1081 |
|
|
|| ($this->f->is_option_mode_service_consulte_enabled() === true |
1082 |
softime |
13137 |
&& ($inst_dossier->get_source_depot_from_demande() === PLATAU |
1083 |
|
|
|| $inst_dossier->get_source_depot_from_demande() === PORTAL)))) { |
1084 |
softime |
10573 |
// |
1085 |
|
|
$inst_task = $this->f->get_inst__om_dbform(array( |
1086 |
|
|
"obj" => "task", |
1087 |
|
|
"idx" => 0, |
1088 |
|
|
)); |
1089 |
|
|
$task_val = array( |
1090 |
|
|
'type' => 'modification_DI', |
1091 |
|
|
'object_id' => $dossier['dossier'], |
1092 |
|
|
'dossier' => $dossier['dossier'], |
1093 |
|
|
); |
1094 |
|
|
// Change l'état de la tâche de notification en fonction de l'état de |
1095 |
|
|
// transmission du dossier d'instruction |
1096 |
|
|
if ($this->f->is_option_mode_service_consulte_enabled() === false |
1097 |
|
|
&& ($this->getVal('etat_transmission_platau') == 'non_transmissible' |
1098 |
|
|
|| $this->getVal('etat_transmission_platau') == 'transmis_mais_non_transmissible')) { |
1099 |
|
|
// |
1100 |
softime |
18436 |
$task_val['state'] = task::STATUS_DRAFT; |
1101 |
softime |
10573 |
} |
1102 |
|
|
$add_task = $inst_task->add_task(array('val' => $task_val)); |
1103 |
|
|
if ($add_task === false) { |
1104 |
|
|
$this->addToMessage(sprintf('%s %s', |
1105 |
|
|
__("Une erreur s'est produite lors de la création tâche."), |
1106 |
|
|
__("Veuillez contacter votre administrateur.") |
1107 |
|
|
)); |
1108 |
|
|
$this->correct = false; |
1109 |
|
|
return false; |
1110 |
|
|
} |
1111 |
|
|
// XXX Les données du DA sont mises à jour seulement lors de l'ajout ou modification |
1112 |
|
|
// d'une instruction du DI initial et lors de la décision sur le DI non initial. |
1113 |
|
|
// Sachant ce comportement, voir si cette tâche modification_DA est bien située. |
1114 |
softime |
10968 |
// $inst_task = $this->f->get_inst__om_dbform(array( |
1115 |
|
|
// "obj" => "task", |
1116 |
|
|
// "idx" => 0, |
1117 |
|
|
// )); |
1118 |
|
|
// $task_val = array( |
1119 |
|
|
// 'type' => 'modification_DA', |
1120 |
|
|
// 'object_id' => $inst_dossier->getVal('dossier_autorisation'), |
1121 |
|
|
// 'dossier' => $inst_dossier->getVal('dossier_autorisation'), |
1122 |
|
|
// ); |
1123 |
|
|
// // Change l'état de la tâche de notification en fonction de l'état de |
1124 |
|
|
// // transmission du dossier d'instruction |
1125 |
|
|
// if ($this->f->is_option_mode_service_consulte_enabled() === false |
1126 |
|
|
// && ($this->getVal('etat_transmission_platau') == 'non_transmissible' |
1127 |
|
|
// || $this->getVal('etat_transmission_platau') == 'transmis_mais_non_transmissible')) { |
1128 |
|
|
// // |
1129 |
softime |
18436 |
// $task_val['state'] = task::STATUS_DRAFT; |
1130 |
softime |
10968 |
// } |
1131 |
|
|
// $add_task = $inst_task->add_task(array('val' => $task_val)); |
1132 |
|
|
// if ($add_task === false) { |
1133 |
|
|
// $this->addToMessage(sprintf('%s %s', |
1134 |
|
|
// __("Une erreur s'est produite lors de la création tâche."), |
1135 |
|
|
// __("Veuillez contacter votre administrateur.") |
1136 |
|
|
// )); |
1137 |
|
|
// $this->correct = false; |
1138 |
|
|
// return false; |
1139 |
|
|
// } |
1140 |
softime |
10573 |
} |
1141 |
|
|
} |
1142 |
|
|
} |
1143 |
|
|
// |
1144 |
|
|
return true; |
1145 |
|
|
} |
1146 |
|
|
|
1147 |
|
|
public function view_json_data() { |
1148 |
|
|
$this->checkAccessibility(); |
1149 |
|
|
$this->f->disableLog(); |
1150 |
|
|
$view = $this->get_json_data(); |
1151 |
|
|
printf(json_encode($view)); |
1152 |
|
|
} |
1153 |
|
|
|
1154 |
|
|
public function get_json_data() { |
1155 |
|
|
$val = array_combine($this->champs, $this->val); |
1156 |
|
|
foreach ($val as $key => $value) { |
1157 |
|
|
$val[$key] = strip_tags($value); |
1158 |
|
|
} |
1159 |
|
|
return $val; |
1160 |
|
|
} |
1161 |
|
|
|
1162 |
mbroquet |
3730 |
}// fin classe |
1163 |
softime |
7996 |
|