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

Contents of /trunk/obj/destination_shon.class.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 451 - (show annotations)
Wed Sep 26 09:01:26 2012 UTC (12 years, 4 months ago) by nhaye
File size: 5793 byte(s)
Régénération suite à la maj du core 4.3.0

1 <?php
2 //$Id$
3 //gen openMairie le 10/02/2011 20:32
4 require_once ("../gen/obj/destination_shon.class.php");
5
6 class destination_shon extends destination_shon_gen {
7
8 function destination_shon($id,&$db,$debug) {
9 $this->constructeur($id,$db,$debug);
10 }// fin constructeur
11
12 function setType(&$form,$maj) {
13 parent :: setType($form,$maj);
14 if ($maj < 2) { //ajouter et modifier
15 $form->setType('dossier', 'hiddenstatic');
16 $form->setType('shon', 'hiddenstatic');
17 }
18 }
19
20 function setLib(&$form,$maj) {
21 parent::setLib($form,$maj);
22 $form->setLib('shon_anterieure',_('shon existante avant travaux'));
23 $form->setLib('shon_demolie',_('shon demolie ou transformee en shob'));
24 $form->setLib('shon_anterieure_supprimee',_('shon supprimee par changement de destination'));
25 $form->setLib('shon_nouvelle_transformee',_('shon creee par changement de destination'));
26 $form->setLib('shon_nouvelle',_('shon construite'));
27 $form->setLib('shon_shob_transformee',_('shon creee par transformation de shob en shon'));
28 }
29
30 function setOnchange(&$form,$maj) {
31 parent::setOnchange($form,$maj);
32 $form->setOnchange('shon_anterieure','VerifNumdec(this)');
33 $form->setOnchange('shon_demolie','VerifNumdec(this)');
34 $form->setOnchange('shon_anterieure_supprimee','VerifNumdec(this)');
35 $form->setOnchange('shon_nouvelle_transformee','VerifNumdec(this)');
36 $form->setOnchange('shon_nouvelle','VerifNumdec(this)');
37 $form->setOnchange('shon_shob_transformee','VerifNumdec(this)');
38 }
39
40
41 function triggerajouter($id,&$db,$val,$DEBUG){
42 $this->calculshon($val);
43 }
44
45
46 function triggerajouterapres($id,&$db,$val,$DEBUG){
47 /// calcul shon dossier [calculate shon dossier]
48 $sql ="select sum(shon) as shon from ".DB_PREFIXE.
49 "destination_shon where dossier ='".$val['dossier']."'" ;
50 $res=$db->query($sql);
51 if (database :: isError($res))
52 die($res->getMessage()."erreur ".$sql);
53 while ($row=& $res->fetchRow( DB_FETCHMODE_ASSOC)){
54 $cle= " dossier = '".$val['dossier']."'";
55 if(!is_numeric($row['shon']))
56 $surface=0;
57 else
58 $surface = $row['shon'];
59 $valF['shon_calcul']= $surface;
60 $res1= $db->autoExecute(DB_PREFIXE.'dossier',$valF,DB_AUTOQUERY_UPDATE,$cle);
61 if (database::isError($res1))
62 die($res1->getMessage());
63 if ($DEBUG == 1)
64 echo "La requête de mise à jour est effectuée.<br>";
65 $this->msg=$this->msg."<br>"._('enregistrement').
66 " ".$val['dossier']." "._('table')." dossier "
67 ." [".$db->affectedRows()." "._('enregistrement')." ".
68 _('mis_a_jour')."]" ;
69 }
70 }
71
72 function triggermodifier($id,&$db,$val,$DEBUG){
73 $this->calculshon($val);
74 }
75
76
77 function triggermodifierapres($id,&$db,$val,$DEBUG)
78 {
79 // calcul shon dossier [calculate shon dossier]
80 $sql ="select sum(shon) as shon from ".DB_PREFIXE.
81 "destination_shon where dossier ='".$val['dossier']."'" ;
82 $res=$db->query($sql);
83 if (database::isError($res))
84 die($res->getMessage());
85 while ($row=& $res->fetchRow( DB_FETCHMODE_ASSOC)){
86 $cle= " dossier = '".$val['dossier']."'";
87 if(!is_numeric($row['shon']))
88 $surface=0;
89 else
90 $surface = $row['shon'];
91 $valF['shon_calcul']= $surface;
92 $res1= $db->autoExecute(DB_PREFIXE.'dossier',$valF,DB_AUTOQUERY_UPDATE,$cle);
93 if (database::isError($res1))
94 die($res1->getMessage());
95 if ($DEBUG == 1)
96 echo "La requête de mise à jour est effectuée.<br>";
97 $this->msg=$this->msg."<br>"._('enregistrement').
98 " ".$val['dossier']." "._('table')." dossier ".
99 " [".$db->affectedRows()." "._('enregistrement')." ".
100 _('mis_a_jour')."]" ;
101 }
102 }
103
104 function triggersupprimerapres($id,&$db,$val,$DEBUG)
105 {
106 // calcul shon dossier [calculate shon dossier]
107 $sql ="select sum(shon) as shon from ".DB_PREFIXE."destination_shon where dossier ='"
108 .$val['dossier']."'" ;
109 $res=$db->query($sql);
110 if (database::isError($res))
111 die($res->getMessage());
112 while ($row=& $res->fetchRow( DB_FETCHMODE_ASSOC)){
113 $cle= " dossier = '".$val['dossier']."'";
114 if(!is_numeric($row['shon']))
115 $surface=0;
116 else
117 $surface = $row['shon'];
118 $valF['shon_calcul']= $surface;
119 $res1= $db->autoExecute(DB_PREFIXE.'dossier',$valF,DB_AUTOQUERY_UPDATE,$cle);
120 if (database::isError($res1))
121 die($res1->getMessage());
122 if ($DEBUG == 1)
123 echo "La requête de mise à jour est effectuée.<br>";
124 $this->msg=$this->msg."<br>"._('enregistrement').
125 " ".$val['dossier']." "._('table')." dossier ".
126 " [".$db->affectedRows()." "._('enregistrement')." ".
127 _('mis_a_jour')."]" ;
128 }
129 }
130
131 function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire){
132 if ($validation==0) {
133 if ($maj == 0){
134 $form->setVal("dossier", $idxformulaire);
135 }
136 }
137 }
138
139 function calculshon($val){
140 $this->valF['shon']= $val['shon_nouvelle']+$val['shon_shob_transformee']+$val['shon_nouvelle_transformee']
141 - $val['shon_demolie']- $val['shon_anterieure_supprimee'];
142 //$val['shon']."***";
143 }
144
145
146
147
148 }// fin classe
149 ?>

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26