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 |
20 |
function setType(&$form,$maj) { |
13 |
|
|
parent :: setType($form,$maj); |
14 |
|
|
if ($maj < 2) { //ajouter et modifier |
15 |
|
|
$form->setType('dossier', 'hiddenstatic'); |
16 |
fraynaud |
174 |
$form->setType('shon', 'hiddenstatic'); |
17 |
nhaye |
451 |
} |
18 |
fraynaud |
20 |
} |
19 |
|
|
|
20 |
fraynaud |
271 |
function setLib(&$form,$maj) { |
21 |
|
|
parent::setLib($form,$maj); |
22 |
|
|
$form->setLib('shon_anterieure',_('shon existante avant travaux')); |
23 |
fraynaud |
272 |
$form->setLib('shon_demolie',_('shon demolie ou transformee en shob')); |
24 |
fraynaud |
271 |
$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 |
fraynaud |
20 |
|
41 |
fraynaud |
174 |
function triggerajouter($id,&$db,$val,$DEBUG){ |
42 |
|
|
$this->calculshon($val); |
43 |
|
|
} |
44 |
|
|
|
45 |
|
|
|
46 |
fraynaud |
20 |
function triggerajouterapres($id,&$db,$val,$DEBUG){ |
47 |
|
|
/// calcul shon dossier [calculate shon dossier] |
48 |
fraynaud |
242 |
$sql ="select sum(shon) as shon from ".DB_PREFIXE. |
49 |
|
|
"destination_shon where dossier ='".$val['dossier']."'" ; |
50 |
fraynaud |
20 |
$res=$db->query($sql); |
51 |
fraynaud |
38 |
if (database :: isError($res)) |
52 |
fraynaud |
20 |
die($res->getMessage()."erreur ".$sql); |
53 |
|
|
while ($row=& $res->fetchRow( DB_FETCHMODE_ASSOC)){ |
54 |
|
|
$cle= " dossier = '".$val['dossier']."'"; |
55 |
fraynaud |
38 |
if(!is_numeric($row['shon'])) |
56 |
|
|
$surface=0; |
57 |
|
|
else |
58 |
|
|
$surface = $row['shon']; |
59 |
|
|
$valF['shon_calcul']= $surface; |
60 |
fraynaud |
242 |
$res1= $db->autoExecute(DB_PREFIXE.'dossier',$valF,DB_AUTOQUERY_UPDATE,$cle); |
61 |
fraynaud |
20 |
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 |
fraynaud |
174 |
function triggermodifier($id,&$db,$val,$DEBUG){ |
73 |
|
|
$this->calculshon($val); |
74 |
|
|
} |
75 |
fraynaud |
20 |
|
76 |
fraynaud |
174 |
|
77 |
fraynaud |
20 |
function triggermodifierapres($id,&$db,$val,$DEBUG) |
78 |
|
|
{ |
79 |
|
|
// calcul shon dossier [calculate shon dossier] |
80 |
fraynaud |
242 |
$sql ="select sum(shon) as shon from ".DB_PREFIXE. |
81 |
|
|
"destination_shon where dossier ='".$val['dossier']."'" ; |
82 |
fraynaud |
20 |
$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 |
fraynaud |
38 |
if(!is_numeric($row['shon'])) |
88 |
|
|
$surface=0; |
89 |
|
|
else |
90 |
|
|
$surface = $row['shon']; |
91 |
|
|
$valF['shon_calcul']= $surface; |
92 |
fraynaud |
242 |
$res1= $db->autoExecute(DB_PREFIXE.'dossier',$valF,DB_AUTOQUERY_UPDATE,$cle); |
93 |
fraynaud |
20 |
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 |
fraynaud |
242 |
$sql ="select sum(shon) as shon from ".DB_PREFIXE."destination_shon where dossier ='" |
108 |
fraynaud |
20 |
.$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 |
fraynaud |
38 |
if(!is_numeric($row['shon'])) |
115 |
|
|
$surface=0; |
116 |
|
|
else |
117 |
|
|
$surface = $row['shon']; |
118 |
|
|
$valF['shon_calcul']= $surface; |
119 |
fraynaud |
242 |
$res1= $db->autoExecute(DB_PREFIXE.'dossier',$valF,DB_AUTOQUERY_UPDATE,$cle); |
120 |
fraynaud |
20 |
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 |
fraynaud |
174 |
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 |
fraynaud |
271 |
|
146 |
|
|
|
147 |
|
|
|
148 |
fraynaud |
3 |
}// fin classe |
149 |
|
|
?> |