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 |
nhaye |
1118 |
if($this->getVal('frequent') == 't') { |
14 |
|
|
$this->addToMessage(_("Petitionnaire frequent non modifiable")); |
15 |
|
|
} |
16 |
nhaye |
787 |
}// fin constructeur |
17 |
|
|
|
18 |
vpihour |
799 |
/* |
19 |
|
|
* Cache le champ type_demandeur. |
20 |
|
|
*/ |
21 |
|
|
function setType(&$form,$maj) { |
22 |
|
|
parent::setType($form,$maj); |
23 |
|
|
$form->setType('type_demandeur', 'hidden'); |
24 |
nhaye |
850 |
|
25 |
|
|
} |
26 |
vpihour |
799 |
/* |
27 |
nhaye |
828 |
* Ajout du fielset |
28 |
|
|
* Add fieldset |
29 |
|
|
*/ |
30 |
|
|
function setLayout(&$form, $maj){ |
31 |
|
|
if ( $maj < 2 OR $maj == 3 ) { |
32 |
|
|
|
33 |
|
|
$form->setBloc('particulier_civilite','D',"", "particulier_fields"); |
34 |
|
|
|
35 |
|
|
$form->setBloc('particulier_civilite','D',""); |
36 |
|
|
$form->setBloc('particulier_civilite','F'); |
37 |
nhaye |
1118 |
if($this->getVal('frequent') != 't') { |
38 |
|
|
$form->setBloc('particulier_nom','D',"","group search_particulier_fields"); |
39 |
|
|
} else { |
40 |
|
|
$form->setBloc('particulier_nom','D',"","group"); |
41 |
|
|
} |
42 |
nhaye |
828 |
$form->setBloc('particulier_prenom','F'); |
43 |
|
|
|
44 |
nhaye |
1423 |
$form->setFieldset('particulier_date_naissance','D',_("Etat civile"),"group"); |
45 |
|
|
$form->setBloc('particulier_date_naissance','D',"","group"); |
46 |
|
|
$form->setBloc('particulier_commune_naissance','F'); |
47 |
|
|
$form->setFieldset('particulier_departement_naissance','F'); |
48 |
nhaye |
828 |
|
49 |
|
|
|
50 |
|
|
$form->setBloc('particulier_departement_naissance','F'); |
51 |
|
|
|
52 |
|
|
$form->setBloc('personne_morale_denomination','D',"", "personne_morale_fields"); |
53 |
|
|
|
54 |
nhaye |
1118 |
$form->setBloc('personne_morale_denomination','D',"","group"); |
55 |
|
|
if($this->getVal('frequent') != 't') { |
56 |
|
|
$form->setBloc('personne_morale_denomination','D',"", "search_personne_morale_fields"); |
57 |
|
|
} else { |
58 |
|
|
$form->setBloc('personne_morale_denomination','D',"", ""); |
59 |
|
|
} |
60 |
nhaye |
828 |
$form->setBloc('personne_morale_denomination','F'); |
61 |
|
|
$form->setBloc('personne_morale_raison_sociale','F'); |
62 |
|
|
|
63 |
nhaye |
1423 |
$form->setFieldset('personne_morale_siret','D',_("Personne morale")); |
64 |
|
|
|
65 |
|
|
$form->setBloc('personne_morale_siret','D',""); |
66 |
|
|
$form->setBloc('personne_morale_siret','F'); |
67 |
|
|
|
68 |
|
|
$form->setBloc('personne_morale_categorie_juridique','D',""); |
69 |
|
|
$form->setBloc('personne_morale_categorie_juridique','F'); |
70 |
|
|
|
71 |
|
|
$form->setBloc('personne_morale_civilite','D',""); |
72 |
|
|
$form->setBloc('personne_morale_civilite','F'); |
73 |
|
|
|
74 |
|
|
$form->setBloc('personne_morale_nom','D',"", "group"); |
75 |
|
|
$form->setBloc('personne_morale_prenom','F'); |
76 |
|
|
|
77 |
|
|
$form->setFieldset('personne_morale_prenom','F'); |
78 |
nhaye |
828 |
|
79 |
|
|
$form->setBloc('personne_morale_prenom','F'); |
80 |
|
|
|
81 |
nhaye |
1423 |
$form->setFieldset('numero','D',_("Adresse"), ""); |
82 |
nhaye |
828 |
|
83 |
|
|
$form->setBloc('numero','D',"","group"); |
84 |
|
|
$form->setBloc('voie','F'); |
85 |
|
|
|
86 |
|
|
$form->setBloc('complement','D',""); |
87 |
|
|
$form->setBloc('complement','F'); |
88 |
|
|
|
89 |
|
|
$form->setBloc('lieu_dit','D',"","group"); |
90 |
|
|
$form->setBloc('localite','F'); |
91 |
|
|
|
92 |
|
|
$form->setBloc('code_postal','D',"","group"); |
93 |
|
|
$form->setBloc('cedex','F'); |
94 |
|
|
|
95 |
|
|
$form->setBloc('pays','D',"", "","group"); |
96 |
|
|
$form->setBloc('division_territoriale','F'); |
97 |
nhaye |
1423 |
$form->setFieldset('division_territoriale','F'); |
98 |
|
|
|
99 |
|
|
$form->setFieldset('telephone_fixe','D',_("Coordonnees"), ""); |
100 |
nhaye |
828 |
$form->setBloc('telephone_fixe','D',"", "group"); |
101 |
|
|
$form->setBloc('indicatif','F'); |
102 |
nhaye |
1423 |
|
103 |
|
|
$form->setBloc('courriel','D',"", "group"); |
104 |
|
|
$form->setBloc('notification','F'); |
105 |
|
|
|
106 |
|
|
$form->setFieldset('notification','F'); |
107 |
nhaye |
828 |
|
108 |
nhaye |
1423 |
|
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 |
|
|
$this->f->isDatabaseError(); |
140 |
|
|
$row = & $res->fetchRow(DB_FETCHMODE_ASSOC); |
141 |
|
|
foreach ($row as $key => $value) { |
142 |
|
|
$form->setVal($key, $value); |
143 |
|
|
} |
144 |
|
|
$form->setVal("frequent","f"); |
145 |
|
|
} |
146 |
|
|
} |
147 |
nhaye |
819 |
} |
148 |
nhaye |
1118 |
|
149 |
|
|
/** |
150 |
|
|
* Surcharge du bouton pour empécher l'utilisateur de modifier un fréquent |
151 |
nhaye |
1429 |
* Et ajout d'un bouton pour vider le formulaire |
152 |
nhaye |
1118 |
*/ |
153 |
|
|
function boutonsousformulaire($datasubmit, $maj, $val=null) { |
154 |
|
|
if($this->getVal('frequent') != 't') { |
155 |
|
|
if (!$this->correct) { |
156 |
|
|
// |
157 |
|
|
switch ($maj) { |
158 |
|
|
case 0: |
159 |
|
|
$bouton = _("Ajouter"); |
160 |
|
|
break; |
161 |
|
|
case 1: |
162 |
|
|
$bouton = _("Modifier"); |
163 |
|
|
break; |
164 |
|
|
case 2: |
165 |
|
|
$bouton = _("Supprimer"); |
166 |
|
|
break; |
167 |
|
|
} |
168 |
|
|
// |
169 |
|
|
$bouton .= " "._("l'enregistrement de la table")." :"; |
170 |
fmichon |
1417 |
$bouton .= " '"._($this->table)."'"; |
171 |
nhaye |
1118 |
// |
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 |
|
|
?> |