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