1 |
<?php |
2 |
/** |
3 |
* DBFORM - 'bailleur' - Surcharge obj. |
4 |
* |
5 |
* @package openads |
6 |
* @version SVN : $Id$ |
7 |
*/ |
8 |
require_once("../obj/demandeur.class.php"); |
9 |
|
10 |
|
11 |
/** |
12 |
* Les bailleurs héritent des demandeurs. |
13 |
*/ |
14 |
class bailleur extends demandeur { |
15 |
|
16 |
/** |
17 |
* |
18 |
*/ |
19 |
protected $_absolute_class_name = "bailleur"; |
20 |
|
21 |
/** |
22 |
* Définition des actions disponibles sur la classe. |
23 |
* |
24 |
* @return void |
25 |
*/ |
26 |
function init_class_actions() { |
27 |
|
28 |
parent::init_class_actions(); |
29 |
|
30 |
// ACTION - 003 - consulter |
31 |
// |
32 |
$this->class_actions[3]["condition"] = "is_user_from_allowed_collectivite"; |
33 |
|
34 |
|
35 |
// ACTION - 110 - recuperer_frequent |
36 |
// Récupère les bailleurs fréquents |
37 |
$this->class_actions[110] = array( |
38 |
"identifier" => "recuperer_frequent", |
39 |
"view" => "formulaire", |
40 |
"method" => "modifier", |
41 |
"button" => "valider", |
42 |
"permission_suffix" => "modifier", |
43 |
); |
44 |
} |
45 |
|
46 |
|
47 |
/** |
48 |
* Cache les champs de notification, fréquent et type_demandeur. |
49 |
* |
50 |
* @param formulaire $form Instance de la classe om_formulaire. |
51 |
* @param integer $maj Identifiant de l'action. |
52 |
*/ |
53 |
function setType(&$form, $maj) { |
54 |
parent::setType($form, $maj); |
55 |
|
56 |
$form->setType('type_demandeur', 'hidden'); |
57 |
$form->setType('notification', 'hidden'); |
58 |
|
59 |
// |
60 |
if($maj == 3) { |
61 |
// En consultation le bouton "Sauvegarder" n'a pas lieu d'être |
62 |
$form->setType('frequent','hidden'); |
63 |
} |
64 |
|
65 |
// Champs disabled pour la modif du bailleur frequent |
66 |
if ($maj==110 || $maj==1) { //modifier |
67 |
if($this->getVal('frequent') == 't') { |
68 |
$form->setType('qualite','selecthiddenstatic'); |
69 |
$form->setType('particulier_nom','static'); |
70 |
$form->setType('particulier_prenom','static'); |
71 |
$form->setType('particulier_date_naissance','datestatic'); |
72 |
$form->setType('particulier_commune_naissance','static'); |
73 |
$form->setType('particulier_departement_naissance','static'); |
74 |
$form->setType('particulier_pays_naissance','static'); |
75 |
$form->setType('personne_morale_denomination','static'); |
76 |
$form->setType('personne_morale_raison_sociale','static'); |
77 |
$form->setType('personne_morale_siret','static'); |
78 |
$form->setType('personne_morale_categorie_juridique','static'); |
79 |
$form->setType('personne_morale_nom','static'); |
80 |
$form->setType('personne_morale_prenom','static'); |
81 |
$form->setType('numero','static'); |
82 |
$form->setType('voie','static'); |
83 |
$form->setType('complement','static'); |
84 |
$form->setType('lieu_dit','static'); |
85 |
$form->setType('localite','static'); |
86 |
$form->setType('code_postal','static'); |
87 |
$form->setType('bp','static'); |
88 |
$form->setType('cedex','static'); |
89 |
$form->setType('pays','static'); |
90 |
$form->setType('division_territoriale','static'); |
91 |
$form->setType('telephone_fixe','static'); |
92 |
$form->setType('telephone_mobile','static'); |
93 |
$form->setType('fax','static'); |
94 |
$form->setType('indicatif','static'); |
95 |
$form->setType('courriel','static'); |
96 |
$form->setType('notification','checkboxstatic'); |
97 |
$form->setType('particulier_civilite','selecthiddenstatic'); |
98 |
$form->setType('personne_morale_civilite','selecthiddenstatic'); |
99 |
$form->setType('om_collectivite','selecthiddenstatic'); |
100 |
// on masque le bouton "Sauvegarder" |
101 |
$form->setType('frequent','hidden'); |
102 |
} |
103 |
}// fin modifier |
104 |
} |
105 |
|
106 |
/** |
107 |
* SETTER_FORM - setVal (setVal). |
108 |
* |
109 |
* @return void |
110 |
*/ |
111 |
function setVal(&$form, $maj, $validation, &$dnu1 = null, $dnu2 = null) { |
112 |
// parent::setVal($form, $maj, $validation); |
113 |
if ($maj == 0) { |
114 |
$form->setVal("type_demandeur", "bailleur"); |
115 |
} |
116 |
} |
117 |
|
118 |
/** |
119 |
* SETTER_FORM - setValsousformulaire (setVal). |
120 |
* |
121 |
* @return void |
122 |
*/ |
123 |
function setValsousformulaire(&$form, $maj, $validation, $idxformulaire, $retourformulaire, $typeformulaire, &$dnu1 = null, $dnu2 = null) { |
124 |
parent::setValsousformulaire($form, $maj, $validation, $idxformulaire, $retourformulaire, $typeformulaire); |
125 |
// |
126 |
$form->setVal("type_demandeur", "bailleur"); |
127 |
} |
128 |
|
129 |
/** |
130 |
* Permet de définir le libellé des champs. |
131 |
* |
132 |
* @param object $form Instance de la classe om_formulaire. |
133 |
* @param integer $maj Identifiant de l'action. |
134 |
*/ |
135 |
public function setLib(&$form, $maj) { |
136 |
parent::setLib($form, $maj); |
137 |
|
138 |
// Libellé pour la sauvegarde du bailleur en fréquent |
139 |
$form->setLib('frequent',"<span class=\"om-form-button copy-16\" |
140 |
title=\"".__("Sauvegarder ce bailleur")."\">".__("Sauvegarder (bailleur fréquent)")."</span>"); |
141 |
|
142 |
} |
143 |
|
144 |
} |