1 |
nhaye |
787 |
<?php |
2 |
|
|
//$Id$ |
3 |
|
|
|
4 |
|
|
require_once ("../obj/demandeur.class.php"); |
5 |
|
|
|
6 |
vpihour |
795 |
/* |
7 |
|
|
* Classe qui hérite de la classe demandeur |
8 |
|
|
*/ |
9 |
nhaye |
787 |
class petitionnaire extends demandeur { |
10 |
|
|
|
11 |
|
|
function petitionnaire($id,&$db,$debug) { |
12 |
|
|
$this->constructeur($id,$db,$debug); |
13 |
|
|
}// fin constructeur |
14 |
|
|
|
15 |
vpihour |
799 |
/* |
16 |
|
|
* Cache le champ type_demandeur. |
17 |
|
|
*/ |
18 |
|
|
function setType(&$form,$maj) { |
19 |
|
|
parent::setType($form,$maj); |
20 |
nhaye |
1604 |
|
21 |
|
|
|
22 |
|
|
// XXX solution temporaire (pas l'endroit adéquat pour afficher un message) |
23 |
|
|
if($this->getVal('frequent') == 't' AND $maj < 2) { |
24 |
|
|
$this->addToMessage(_("Petitionnaire frequent non modifiable")); |
25 |
|
|
} |
26 |
|
|
|
27 |
vpihour |
799 |
$form->setType('type_demandeur', 'hidden'); |
28 |
nhaye |
850 |
|
29 |
|
|
} |
30 |
vpihour |
799 |
/* |
31 |
nhaye |
828 |
* Ajout du fielset |
32 |
|
|
* Add fieldset |
33 |
|
|
*/ |
34 |
|
|
function setLayout(&$form, $maj){ |
35 |
nhaye |
1598 |
$form->setBloc('particulier_civilite','D',"", "particulier_fields"); |
36 |
|
|
|
37 |
|
|
$form->setBloc('particulier_civilite','D',""); |
38 |
|
|
$form->setBloc('particulier_civilite','F'); |
39 |
|
|
if($this->getVal('frequent') != 't') { |
40 |
vpihour |
2113 |
$form->setBloc('particulier_nom','D',"","group ".($maj<2 ? "search_fields":"")); |
41 |
nhaye |
1598 |
} else { |
42 |
|
|
$form->setBloc('particulier_nom','D',"","group"); |
43 |
|
|
} |
44 |
|
|
$form->setBloc('particulier_prenom','F'); |
45 |
nhaye |
828 |
|
46 |
nhaye |
1598 |
$form->setFieldset('particulier_date_naissance','D',_("Etat civil"),"group"); |
47 |
|
|
$form->setBloc('particulier_date_naissance','D',"","group"); |
48 |
|
|
$form->setBloc('particulier_commune_naissance','F'); |
49 |
|
|
$form->setFieldset('particulier_departement_naissance','F'); |
50 |
|
|
|
51 |
|
|
|
52 |
|
|
$form->setBloc('particulier_departement_naissance','F'); |
53 |
|
|
|
54 |
|
|
$form->setBloc('personne_morale_denomination','D',"", "personne_morale_fields"); |
55 |
|
|
|
56 |
|
|
$form->setBloc('personne_morale_denomination','D',"","group"); |
57 |
|
|
if($this->getVal('frequent') != 't') { |
58 |
vpihour |
2113 |
$form->setBloc('personne_morale_denomination','D',"", ($maj<2 ? "search_fields":"")); |
59 |
nhaye |
1598 |
} else { |
60 |
|
|
$form->setBloc('personne_morale_denomination','D',"", ""); |
61 |
|
|
} |
62 |
|
|
$form->setBloc('personne_morale_denomination','F'); |
63 |
|
|
$form->setBloc('personne_morale_raison_sociale','F'); |
64 |
|
|
|
65 |
|
|
$form->setFieldset('personne_morale_siret','D',_("Personne morale")); |
66 |
|
|
|
67 |
|
|
$form->setBloc('personne_morale_siret','D',""); |
68 |
|
|
$form->setBloc('personne_morale_siret','F'); |
69 |
nhaye |
828 |
|
70 |
nhaye |
1598 |
$form->setBloc('personne_morale_categorie_juridique','D',""); |
71 |
|
|
$form->setBloc('personne_morale_categorie_juridique','F'); |
72 |
nhaye |
828 |
|
73 |
nhaye |
1598 |
$form->setBloc('personne_morale_civilite','D',""); |
74 |
|
|
$form->setBloc('personne_morale_civilite','F'); |
75 |
nhaye |
828 |
|
76 |
nhaye |
1598 |
$form->setBloc('personne_morale_nom','D',"", "group"); |
77 |
|
|
$form->setBloc('personne_morale_prenom','F'); |
78 |
nhaye |
1423 |
|
79 |
nhaye |
1598 |
$form->setFieldset('personne_morale_prenom','F'); |
80 |
nhaye |
828 |
|
81 |
nhaye |
1598 |
$form->setBloc('personne_morale_prenom','F'); |
82 |
|
|
|
83 |
|
|
$form->setFieldset('numero','D',_("Adresse"), ""); |
84 |
|
|
|
85 |
|
|
$form->setBloc('numero','D',"","group"); |
86 |
|
|
$form->setBloc('voie','F'); |
87 |
|
|
|
88 |
|
|
$form->setBloc('complement','D',""); |
89 |
|
|
$form->setBloc('complement','F'); |
90 |
|
|
|
91 |
|
|
$form->setBloc('lieu_dit','D',"","group"); |
92 |
|
|
$form->setBloc('localite','F'); |
93 |
|
|
|
94 |
|
|
$form->setBloc('code_postal','D',"","group"); |
95 |
|
|
$form->setBloc('cedex','F'); |
96 |
|
|
|
97 |
|
|
$form->setBloc('pays','D',"", "","group"); |
98 |
|
|
$form->setBloc('division_territoriale','F'); |
99 |
|
|
$form->setFieldset('division_territoriale','F'); |
100 |
nhaye |
1423 |
|
101 |
nhaye |
1598 |
$form->setFieldset('telephone_fixe','D',_("Coordonnees"), ""); |
102 |
|
|
$form->setBloc('telephone_fixe','D',"", "group"); |
103 |
|
|
$form->setBloc('indicatif','F'); |
104 |
nhaye |
1423 |
|
105 |
nhaye |
1598 |
$form->setBloc('courriel','D',"", "group"); |
106 |
|
|
$form->setBloc('notification','F'); |
107 |
nhaye |
1423 |
|
108 |
nhaye |
1598 |
$form->setFieldset('notification','F'); |
109 |
nhaye |
828 |
|
110 |
|
|
} |
111 |
nhaye |
1430 |
|
112 |
|
|
function setLib(&$form,$maj) { |
113 |
|
|
//libelle des champs |
114 |
|
|
parent::setLib($form, $maj); |
115 |
|
|
$form->setLib('frequent',"<span class=\"om-form-button copy-16\" |
116 |
|
|
title=\""._("Sauvegarder ce petitionnaire")."\">"._("Sauvegarder (petitionnaire frequent)")."</span>"); |
117 |
|
|
|
118 |
|
|
} |
119 |
nhaye |
828 |
/* |
120 |
vpihour |
799 |
* Met le champ type_demandeur à delegataire par défaut |
121 |
|
|
*/ |
122 |
|
|
function setVal(&$form, $maj, $validation, &$db) { |
123 |
nhaye |
1048 |
parent::setVal($form, $maj, $validation, $db); |
124 |
nhaye |
828 |
$form->setVal("type_demandeur","petitionnaire"); |
125 |
vpihour |
799 |
} |
126 |
nhaye |
819 |
/* |
127 |
|
|
* Met le champ type_demandeur à delegataire par défaut |
128 |
|
|
*/ |
129 |
|
|
function setValSousFormulaire(&$form, $maj, $validation, &$db) { |
130 |
nhaye |
1048 |
parent::setValSousFormulaire($form, $maj, $validation, $db); |
131 |
nhaye |
828 |
$form->setVal("type_demandeur","petitionnaire"); |
132 |
nhaye |
1048 |
if($maj == 0) { |
133 |
|
|
// Récupération des infos du demandeur passé en paramètre |
134 |
|
|
if($this->getParameter('idx_demandeur') != "") { |
135 |
|
|
include '../sql/pgsql/petitionnaire.form.inc.php'; |
136 |
|
|
$sql = "SELECT ".implode(", ",$champs)." FROM ".DB_PREFIXE."demandeur ". |
137 |
|
|
"WHERE demandeur=".$this->getParameter('idx_demandeur'); |
138 |
|
|
$res = $this->db->query($sql); |
139 |
vpihour |
1777 |
$this->f->addToLog("setValSousFormulaire() : db->query(\"".$sql."\")"); |
140 |
|
|
if ( database::isError($res)){ |
141 |
|
|
die(); |
142 |
|
|
} |
143 |
nhaye |
1048 |
$row = & $res->fetchRow(DB_FETCHMODE_ASSOC); |
144 |
|
|
foreach ($row as $key => $value) { |
145 |
|
|
$form->setVal($key, $value); |
146 |
|
|
} |
147 |
|
|
$form->setVal("frequent","f"); |
148 |
|
|
} |
149 |
|
|
} |
150 |
nhaye |
819 |
} |
151 |
nhaye |
1118 |
|
152 |
|
|
/** |
153 |
|
|
* Surcharge du bouton pour empécher l'utilisateur de modifier un fréquent |
154 |
nhaye |
1429 |
* Et ajout d'un bouton pour vider le formulaire |
155 |
nhaye |
1118 |
*/ |
156 |
|
|
function boutonsousformulaire($datasubmit, $maj, $val=null) { |
157 |
|
|
if($this->getVal('frequent') != 't') { |
158 |
|
|
if (!$this->correct) { |
159 |
|
|
// |
160 |
|
|
switch ($maj) { |
161 |
|
|
case 0: |
162 |
|
|
$bouton = _("Ajouter"); |
163 |
|
|
break; |
164 |
|
|
case 1: |
165 |
|
|
$bouton = _("Modifier"); |
166 |
|
|
break; |
167 |
|
|
case 2: |
168 |
|
|
$bouton = _("Supprimer"); |
169 |
|
|
break; |
170 |
|
|
} |
171 |
|
|
// |
172 |
|
|
echo "<input type=\"button\" value=\"".$bouton."\" "; |
173 |
|
|
echo "onclick=\"affichersform('".get_class($this)."', '$datasubmit', this.form);\" "; |
174 |
|
|
echo "class=\"om-button\" />"; |
175 |
|
|
} |
176 |
|
|
} |
177 |
nhaye |
1429 |
if(!$this->correct) { |
178 |
|
|
echo '<span class="om-form-button erase-petitionnaire delete-16" '. |
179 |
|
|
'title="Supprimer le contenu">'._("Vider le formulaire").'</span>'; |
180 |
|
|
} |
181 |
nhaye |
1118 |
} |
182 |
nhaye |
787 |
}// fin classe |
183 |
|
|
?> |