1 |
nhaye |
5043 |
<?php |
2 |
|
|
/** |
3 |
softime |
7996 |
* DBFORM - 'avocat' - Surcharge obj. |
4 |
|
|
* |
5 |
nhaye |
5043 |
* @package openads |
6 |
softime |
6929 |
* @version SVN : $Id: avocat.class.php 6565 2017-04-21 16:14:15Z softime $ |
7 |
nhaye |
5043 |
*/ |
8 |
|
|
require_once("../obj/demandeur.class.php"); |
9 |
|
|
|
10 |
|
|
|
11 |
|
|
/** |
12 |
|
|
* Les avodats héritent des demandeurs. |
13 |
|
|
*/ |
14 |
nhaye |
5051 |
class avocat extends demandeur { |
15 |
nhaye |
5043 |
|
16 |
|
|
/** |
17 |
|
|
* |
18 |
|
|
*/ |
19 |
softime |
7996 |
protected $_absolute_class_name = "avocat"; |
20 |
|
|
|
21 |
nhaye |
6184 |
// {{{ Gestion de la confidentialité des données spécifiques |
22 |
|
|
|
23 |
nhaye |
5051 |
/** |
24 |
nhaye |
6184 |
* Définition des actions disponibles sur la classe. |
25 |
|
|
* |
26 |
|
|
* @return void |
27 |
|
|
*/ |
28 |
|
|
function init_class_actions() { |
29 |
|
|
|
30 |
|
|
parent::init_class_actions(); |
31 |
|
|
|
32 |
|
|
// ACTION - 003 - consulter |
33 |
|
|
// |
34 |
|
|
$this->class_actions[3]["condition"] = "is_user_from_allowed_collectivite"; |
35 |
|
|
|
36 |
|
|
|
37 |
|
|
// ACTION - 110 - recuperer_frequent |
38 |
|
|
// Finalise l'enregistrement |
39 |
|
|
$this->class_actions[110] = array( |
40 |
|
|
"identifier" => "recuperer_frequent", |
41 |
|
|
"view" => "formulaire", |
42 |
|
|
"method" => "modifier", |
43 |
|
|
"button" => "valider", |
44 |
|
|
"permission_suffix" => "modifier", |
45 |
|
|
); |
46 |
|
|
} |
47 |
|
|
|
48 |
|
|
//}}} |
49 |
|
|
|
50 |
|
|
/** |
51 |
nhaye |
5051 |
* Cache les champs de notification, fréquent et type_demandeur. |
52 |
|
|
* |
53 |
|
|
* @param formulaire $form Instance de la classe om_formulaire. |
54 |
|
|
* @param integer $maj Identifiant de l'action. |
55 |
|
|
*/ |
56 |
|
|
function setType(&$form, $maj) { |
57 |
|
|
parent::setType($form, $maj); |
58 |
nhaye |
5043 |
|
59 |
nhaye |
5051 |
$form->setType('type_demandeur', 'hidden'); |
60 |
|
|
$form->setType('notification', 'hidden'); |
61 |
nhaye |
6184 |
|
62 |
|
|
if($maj == 3) { |
63 |
|
|
// En consultation le bouton "Sauvegarder" n'a pas lieu d'être |
64 |
|
|
$form->setType('frequent','hidden'); |
65 |
|
|
// Gestion de la catégorie de personne |
66 |
|
|
if ($this->getVal('qualite') == 'particulier') { |
67 |
|
|
$form->setType('personne_morale_denomination','hidden'); |
68 |
|
|
$form->setType('personne_morale_raison_sociale','hidden'); |
69 |
|
|
$form->setType('personne_morale_siret','hidden'); |
70 |
|
|
$form->setType('personne_morale_categorie_juridique','hidden'); |
71 |
|
|
$form->setType('personne_morale_nom','hidden'); |
72 |
|
|
$form->setType('personne_morale_prenom','hidden'); |
73 |
|
|
$form->setType('personne_morale_civilite','hidden'); |
74 |
|
|
} else { |
75 |
|
|
$form->setType('particulier_civilite','hidden'); |
76 |
|
|
$form->setType('particulier_nom','hidden'); |
77 |
|
|
$form->setType('particulier_prenom','hidden'); |
78 |
|
|
$form->setType('particulier_date_naissance','hidden'); |
79 |
|
|
$form->setType('particulier_commune_naissance','hidden'); |
80 |
|
|
$form->setType('particulier_departement_naissance','hidden'); |
81 |
softime |
7996 |
$form->setType('particulier_pays_naissance','hidden'); |
82 |
nhaye |
6184 |
} |
83 |
|
|
} |
84 |
|
|
|
85 |
|
|
// Champs disabled pour la modif d'avocat frequents |
86 |
|
|
if ($maj==110 or $maj==1) { //modifier |
87 |
|
|
if($this->getVal('frequent') == 't') { |
88 |
|
|
$form->setType('qualite','selecthiddenstatic'); |
89 |
|
|
$form->setType('particulier_nom','static'); |
90 |
|
|
$form->setType('particulier_prenom','static'); |
91 |
|
|
$form->setType('particulier_date_naissance','datestatic'); |
92 |
|
|
$form->setType('particulier_commune_naissance','static'); |
93 |
|
|
$form->setType('particulier_departement_naissance','static'); |
94 |
|
|
$form->setType('personne_morale_denomination','static'); |
95 |
|
|
$form->setType('personne_morale_raison_sociale','static'); |
96 |
|
|
$form->setType('personne_morale_siret','static'); |
97 |
|
|
$form->setType('personne_morale_categorie_juridique','static'); |
98 |
|
|
$form->setType('personne_morale_nom','static'); |
99 |
|
|
$form->setType('personne_morale_prenom','static'); |
100 |
|
|
$form->setType('numero','static'); |
101 |
|
|
$form->setType('voie','static'); |
102 |
|
|
$form->setType('complement','static'); |
103 |
|
|
$form->setType('lieu_dit','static'); |
104 |
|
|
$form->setType('localite','static'); |
105 |
|
|
$form->setType('code_postal','static'); |
106 |
|
|
$form->setType('bp','static'); |
107 |
|
|
$form->setType('cedex','static'); |
108 |
|
|
$form->setType('pays','static'); |
109 |
|
|
$form->setType('division_territoriale','static'); |
110 |
|
|
$form->setType('telephone_fixe','static'); |
111 |
|
|
$form->setType('telephone_mobile','static'); |
112 |
|
|
$form->setType('fax','static'); |
113 |
|
|
$form->setType('indicatif','static'); |
114 |
|
|
$form->setType('courriel','static'); |
115 |
|
|
$form->setType('notification','checkboxstatic'); |
116 |
|
|
$form->setType('particulier_civilite','selecthiddenstatic'); |
117 |
|
|
$form->setType('personne_morale_civilite','selecthiddenstatic'); |
118 |
|
|
$form->setType('om_collectivite','selecthiddenstatic'); |
119 |
|
|
// on masque le bouton "Sauvegarder" |
120 |
|
|
$form->setType('frequent','hidden'); |
121 |
|
|
} |
122 |
|
|
}// fin modifier |
123 |
|
|
|
124 |
|
|
$form->setType('type_demandeur', 'hidden'); |
125 |
nhaye |
5051 |
} |
126 |
|
|
|
127 |
|
|
|
128 |
|
|
/** |
129 |
|
|
* Met le champ type_demandeur à avocat par défaut. |
130 |
|
|
* |
131 |
|
|
* @param formulaire $form Instance de la classe om_formulaire. |
132 |
|
|
* @param integer $maj Identifiant de l'action. |
133 |
|
|
* @param integer $validation Nombre de validation du formulaire. |
134 |
|
|
* @param database $db Instance de la classe om_database. |
135 |
|
|
*/ |
136 |
softime |
6929 |
function setVal(&$form, $maj, $validation, &$db = null, $DEBUG = null) { |
137 |
nhaye |
5051 |
if ($maj == 0 ) { |
138 |
|
|
$form->setVal("type_demandeur", "avocat"); |
139 |
|
|
} |
140 |
|
|
} |
141 |
|
|
|
142 |
nhaye |
6184 |
function setLib(&$form,$maj) { |
143 |
|
|
//libelle des champs |
144 |
|
|
parent::setLib($form, $maj); |
145 |
|
|
$form->setLib('frequent',"<span class=\"om-form-button copy-16\" |
146 |
nhaye |
6395 |
title=\""._("Sauvegarder cet avocat")."\">"._("Sauvegarder (avocat fréquent)")."</span>"); |
147 |
nhaye |
6184 |
|
148 |
|
|
} |
149 |
|
|
|
150 |
nhaye |
5051 |
/* |
151 |
|
|
* Met le champ type_demandeur à avocat par défaut. |
152 |
|
|
*/ |
153 |
|
|
function setValsousformulaire(&$form, $maj, $validation, $idxformulaire, $retourformulaire, $typeformulaire, &$dnu1 = null, $dnu2 = null) { |
154 |
|
|
parent::setValSousFormulaire($form, $maj, $validation, $idxformulaire, $retourformulaire, $typeformulaire, $dnu1, $dnu2); |
155 |
|
|
$form->setVal("type_demandeur", "avocat"); |
156 |
|
|
if ($maj == 0 ) { |
157 |
|
|
// Récupération des infos du demandeur passé en paramètre |
158 |
|
|
if ($this->getParameter('idx_demandeur') != "") { |
159 |
|
|
include '../sql/pgsql/delegataire.form.inc.php'; |
160 |
|
|
$sql = "SELECT ".implode(", ", $champs)." |
161 |
|
|
FROM ".DB_PREFIXE."demandeur ". |
162 |
|
|
"WHERE demandeur=".$this->getParameter('idx_demandeur'); |
163 |
|
|
$res = $this->db->query($sql); |
164 |
|
|
$this->f->addToLog( |
165 |
|
|
"setValSousFormulaire() : db->query(\"".$sql."\")", |
166 |
|
|
VERBOSE_MODE |
167 |
|
|
); |
168 |
|
|
if ( database::isError($res)) { |
169 |
|
|
die(); |
170 |
|
|
} |
171 |
|
|
$row = & $res->fetchRow(DB_FETCHMODE_ASSOC); |
172 |
|
|
foreach ($row as $key => $value) { |
173 |
|
|
$form->setVal($key, $value); |
174 |
|
|
} |
175 |
|
|
$form->setVal("frequent", "f"); |
176 |
|
|
} |
177 |
|
|
} |
178 |
|
|
} |
179 |
nhaye |
6184 |
|
180 |
|
|
|
181 |
|
|
/** |
182 |
|
|
* Surcharge du bouton pour empécher l'utilisateur de modifier un fréquent |
183 |
|
|
* Et ajout d'un bouton pour vider le formulaire |
184 |
|
|
*/ |
185 |
|
|
function boutonsousformulaire($datasubmit, $maj, $val=null) { |
186 |
|
|
if($maj == 0 OR $this->getVal('frequent') != 't') { |
187 |
|
|
if (!$this->correct) { |
188 |
|
|
// |
189 |
|
|
switch ($maj) { |
190 |
|
|
case 0: |
191 |
|
|
$bouton = _("Ajouter"); |
192 |
|
|
break; |
193 |
|
|
case 1: |
194 |
|
|
$bouton = _("Modifier"); |
195 |
|
|
break; |
196 |
|
|
case 2: |
197 |
|
|
$bouton = _("Supprimer"); |
198 |
|
|
break; |
199 |
|
|
} |
200 |
|
|
// |
201 |
|
|
echo "<input type=\"button\" value=\"".$bouton."\" "; |
202 |
softime |
7996 |
echo "onclick=\"affichersform('".$this->get_absolute_class_name()."', '$datasubmit', this.form);\" "; |
203 |
nhaye |
6184 |
echo "class=\"om-button\" />"; |
204 |
|
|
} |
205 |
|
|
} |
206 |
|
|
if(!$this->correct) { |
207 |
|
|
echo '<span class="om-form-button erase-avocat delete-16" '. |
208 |
|
|
'title="Supprimer le contenu">'._("Vider le formulaire").'</span>'; |
209 |
|
|
} |
210 |
|
|
} |
211 |
nhaye |
5051 |
|
212 |
nhaye |
5043 |
} |