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