/[openfoncier]/trunk/obj/bailleur.class.php
ViewVC logotype

Annotation of /trunk/obj/bailleur.class.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 7996 - (hide annotations)
Fri Jul 20 17:12:33 2018 UTC (6 years, 6 months ago) by softime
File size: 7525 byte(s)
* Merge de la branche d'intégration 4.7.0 vers le trunk

1 softime 6976 <?php
2     /**
3 softime 7996 * DBFORM - 'bailleur' - Surcharge obj.
4     *
5 softime 6976 * @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 softime 7996 protected $_absolute_class_name = "bailleur";
20 softime 6976
21     /**
22 softime 7013 * 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 softime 6976 * 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 softime 7013
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 softime 7996 $form->setType('particulier_pays_naissance','static');
75 softime 7013 $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 softime 6976 }
105    
106 softime 7013
107 softime 6976 /**
108     * Met le champ type_demandeur à bailleur par défaut.
109     *
110     * @param formulaire $form Instance de la classe om_formulaire.
111     * @param integer $maj Identifiant de l'action.
112     * @param integer $validation Nombre de validation du formulaire.
113     * @param database $db Instance de la classe om_database.
114     */
115     function setVal(&$form, $maj, $validation, &$db = null, $DEBUG = null) {
116     if ($maj == 0 ) {
117     $form->setVal("type_demandeur", "bailleur");
118     }
119     }
120    
121     /*
122     * Met le champ type_demandeur à bailleur par défaut
123     */
124     function setValsousformulaire(&$form, $maj, $validation, $idxformulaire, $retourformulaire, $typeformulaire, &$dnu1 = null, $dnu2 = null) {
125     parent::setValSousFormulaire($form, $maj, $validation, $idxformulaire, $retourformulaire, $typeformulaire, $dnu1, $dnu2);
126     $form->setVal("type_demandeur", "bailleur");
127     if ($maj == 0 ) {
128     // Récupération des infos du demandeur passé en paramètre
129     if ($this->getParameter('idx_demandeur') != "") {
130     include '../sql/pgsql/bailleur.form.inc.php';
131     $sql = "SELECT ".implode(", ", $champs)."
132     FROM ".DB_PREFIXE."demandeur ".
133     "WHERE demandeur=".$this->getParameter('idx_demandeur');
134     $res = $this->db->query($sql);
135     $this->f->addToLog(
136     "setValSousFormulaire() : db->query(\"".$sql."\")",
137     VERBOSE_MODE
138     );
139     if ( database::isError($res)) {
140     die();
141     }
142     $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     }
150 softime 7013
151    
152     /**
153     * Permet de définir le libellé des champs.
154     *
155     * @param object $form Instance de la classe om_formulaire.
156     * @param integer $maj Identifiant de l'action.
157     */
158     public function setLib(&$form, $maj) {
159     parent::setLib($form, $maj);
160    
161     // Libellé pour la sauvegarde du bailleur en fréquent
162     $form->setLib('frequent',"<span class=\"om-form-button copy-16\"
163     title=\""._("Sauvegarder ce bailleur")."\">"._("Sauvegarder (bailleur fréquent)")."</span>");
164    
165     }
166    
167    
168     /**
169     * Surcharge du bouton pour empécher l'utilisateur de modifier un fréquent
170     * Et ajout d'un bouton pour vider le formulaire
171     */
172     function boutonsousformulaire($datasubmit, $maj, $val=null) {
173     if($maj == 0 OR $this->getVal('frequent') != 't') {
174     if (!$this->correct) {
175     //
176     switch ($maj) {
177     case 0:
178     $bouton = _("Ajouter");
179     break;
180     case 1:
181     $bouton = _("Modifier");
182     break;
183     case 2:
184     $bouton = _("Supprimer");
185     break;
186     }
187     //
188     echo "<input type=\"button\" value=\"".$bouton."\" ";
189 softime 7996 echo "onclick=\"affichersform('".$this->get_absolute_class_name()."', '$datasubmit', this.form);\" ";
190 softime 7013 echo "class=\"om-button\" />";
191     }
192     }
193     if(!$this->correct) {
194     echo '<span class="om-form-button erase-bailleur delete-16" '.
195     'title="Supprimer le contenu">'._("Vider le formulaire").'</span>';
196     }
197     }
198    
199    
200 softime 6976 }

Properties

Name Value
svn:executable *
svn:keywords Id

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26