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',"", "bloc_demandeur"); |
34 |
|
|
$form->setBloc('particulier_civilite','D',"", "particulier_fields"); |
35 |
|
|
|
36 |
|
|
$form->setBloc('particulier_civilite','D',""); |
37 |
|
|
$form->setBloc('particulier_civilite','F'); |
38 |
nhaye |
1118 |
if($this->getVal('frequent') != 't') { |
39 |
|
|
$form->setBloc('particulier_nom','D',"","group search_particulier_fields"); |
40 |
|
|
} else { |
41 |
|
|
$form->setBloc('particulier_nom','D',"","group"); |
42 |
|
|
} |
43 |
nhaye |
828 |
$form->setBloc('particulier_prenom','F'); |
44 |
|
|
|
45 |
|
|
$form->setBloc('particulier_date_naissance','D',"","group"); |
46 |
|
|
$form->setBloc('particulier_commune_naissance','F'); |
47 |
|
|
|
48 |
|
|
$form->setBloc('particulier_departement_naissance','D',""); |
49 |
|
|
$form->setBloc('particulier_departement_naissance','F'); |
50 |
|
|
|
51 |
|
|
$form->setBloc('particulier_departement_naissance','F'); |
52 |
|
|
|
53 |
|
|
$form->setBloc('personne_morale_denomination','D',"", "personne_morale_fields"); |
54 |
|
|
|
55 |
nhaye |
1118 |
$form->setBloc('personne_morale_denomination','D',"","group"); |
56 |
|
|
if($this->getVal('frequent') != 't') { |
57 |
|
|
$form->setBloc('personne_morale_denomination','D',"", "search_personne_morale_fields"); |
58 |
|
|
} else { |
59 |
|
|
$form->setBloc('personne_morale_denomination','D',"", ""); |
60 |
|
|
} |
61 |
nhaye |
828 |
$form->setBloc('personne_morale_denomination','F'); |
62 |
|
|
$form->setBloc('personne_morale_raison_sociale','F'); |
63 |
|
|
|
64 |
|
|
$form->setBloc('personne_morale_siret','D',""); |
65 |
|
|
$form->setBloc('personne_morale_siret','F'); |
66 |
|
|
|
67 |
|
|
$form->setBloc('personne_morale_categorie_juridique','D',""); |
68 |
|
|
$form->setBloc('personne_morale_categorie_juridique','F'); |
69 |
|
|
|
70 |
|
|
$form->setBloc('personne_morale_civilite','D',""); |
71 |
|
|
$form->setBloc('personne_morale_civilite','F'); |
72 |
|
|
|
73 |
|
|
$form->setBloc('personne_morale_nom','D',"", "group"); |
74 |
|
|
$form->setBloc('personne_morale_nom','D',"", "search_personne_morale_fields"); |
75 |
|
|
$form->setBloc('personne_morale_nom','F'); |
76 |
|
|
$form->setBloc('personne_morale_prenom','F'); |
77 |
|
|
|
78 |
|
|
$form->setBloc('personne_morale_prenom','F'); |
79 |
|
|
|
80 |
|
|
$form->setBloc('numero','D',""); |
81 |
|
|
|
82 |
|
|
$form->setBloc('numero','D',"","group"); |
83 |
|
|
$form->setBloc('voie','F'); |
84 |
|
|
|
85 |
|
|
$form->setBloc('complement','D',""); |
86 |
|
|
$form->setBloc('complement','F'); |
87 |
|
|
|
88 |
|
|
$form->setBloc('lieu_dit','D',"","group"); |
89 |
|
|
$form->setBloc('localite','F'); |
90 |
|
|
|
91 |
|
|
$form->setBloc('code_postal','D',"","group"); |
92 |
|
|
$form->setBloc('cedex','F'); |
93 |
|
|
|
94 |
|
|
$form->setBloc('pays','D',"", "","group"); |
95 |
|
|
$form->setBloc('division_territoriale','F'); |
96 |
|
|
|
97 |
|
|
$form->setBloc('telephone_fixe','D',"", "group"); |
98 |
|
|
$form->setBloc('indicatif','F'); |
99 |
|
|
|
100 |
|
|
$form->setBloc('frequent','F'); |
101 |
|
|
$form->setBloc('frequent','F'); |
102 |
|
|
} |
103 |
|
|
} |
104 |
|
|
/* |
105 |
vpihour |
799 |
* Met le champ type_demandeur à delegataire par défaut |
106 |
|
|
*/ |
107 |
|
|
function setVal(&$form, $maj, $validation, &$db) { |
108 |
nhaye |
1048 |
parent::setVal($form, $maj, $validation, $db); |
109 |
nhaye |
828 |
$form->setVal("type_demandeur","petitionnaire"); |
110 |
vpihour |
799 |
} |
111 |
nhaye |
819 |
/* |
112 |
|
|
* Met le champ type_demandeur à delegataire par défaut |
113 |
|
|
*/ |
114 |
|
|
function setValSousFormulaire(&$form, $maj, $validation, &$db) { |
115 |
nhaye |
1048 |
parent::setValSousFormulaire($form, $maj, $validation, $db); |
116 |
nhaye |
828 |
$form->setVal("type_demandeur","petitionnaire"); |
117 |
nhaye |
1048 |
if($maj == 0) { |
118 |
|
|
// Récupération des infos du demandeur passé en paramètre |
119 |
|
|
if($this->getParameter('idx_demandeur') != "") { |
120 |
|
|
include '../sql/pgsql/petitionnaire.form.inc.php'; |
121 |
|
|
$sql = "SELECT ".implode(", ",$champs)." FROM ".DB_PREFIXE."demandeur ". |
122 |
|
|
"WHERE demandeur=".$this->getParameter('idx_demandeur'); |
123 |
|
|
$res = $this->db->query($sql); |
124 |
|
|
$this->f->isDatabaseError(); |
125 |
|
|
$row = & $res->fetchRow(DB_FETCHMODE_ASSOC); |
126 |
|
|
foreach ($row as $key => $value) { |
127 |
|
|
$form->setVal($key, $value); |
128 |
|
|
} |
129 |
|
|
$form->setVal("frequent","f"); |
130 |
|
|
} |
131 |
|
|
} |
132 |
nhaye |
819 |
} |
133 |
nhaye |
1118 |
|
134 |
|
|
/** |
135 |
|
|
* Surcharge du bouton pour empécher l'utilisateur de modifier un fréquent |
136 |
|
|
*/ |
137 |
|
|
function boutonsousformulaire($datasubmit, $maj, $val=null) { |
138 |
|
|
if($this->getVal('frequent') != 't') { |
139 |
|
|
if (!$this->correct) { |
140 |
|
|
// |
141 |
|
|
switch ($maj) { |
142 |
|
|
case 0: |
143 |
|
|
$bouton = _("Ajouter"); |
144 |
|
|
break; |
145 |
|
|
case 1: |
146 |
|
|
$bouton = _("Modifier"); |
147 |
|
|
break; |
148 |
|
|
case 2: |
149 |
|
|
$bouton = _("Supprimer"); |
150 |
|
|
break; |
151 |
|
|
} |
152 |
|
|
// |
153 |
|
|
$bouton .= " "._("l'enregistrement de la table")." :"; |
154 |
|
|
$bouton .= " '".ucwords(_($this->table))."'"; |
155 |
|
|
// |
156 |
|
|
echo "<input type=\"button\" value=\"".$bouton."\" "; |
157 |
|
|
echo "onclick=\"affichersform('".get_class($this)."', '$datasubmit', this.form);\" "; |
158 |
|
|
echo "class=\"om-button\" />"; |
159 |
|
|
} |
160 |
|
|
} |
161 |
|
|
} |
162 |
nhaye |
787 |
}// fin classe |
163 |
|
|
?> |