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