1 |
fraynaud |
3 |
<?php |
2 |
|
|
//$Id$ |
3 |
|
|
//gen openMairie le 10/02/2011 20:36 |
4 |
|
|
require_once ("../gen/obj/terrain.class.php"); |
5 |
|
|
|
6 |
|
|
class terrain extends terrain_gen { |
7 |
|
|
|
8 |
fraynaud |
10 |
function terrain($id,&$db,$debug) { |
9 |
|
|
$this->constructeur($id,$db,$debug); |
10 |
|
|
}// fin constructeur |
11 |
fraynaud |
3 |
|
12 |
fraynaud |
10 |
function setType(&$form,$maj) { |
13 |
|
|
parent::setType($form,$maj); |
14 |
|
|
if ($maj < 2) { //ajouter et modifier |
15 |
|
|
$form->setType('parcelle','comboD2'); |
16 |
|
|
$form->setType('nom','comboG2'); |
17 |
fraynaud |
20 |
$form->setType('dossier','hiddenstatic'); |
18 |
fraynaud |
10 |
} |
19 |
nhaye |
430 |
if($maj==3) { |
20 |
|
|
$form->setType('dossier','hiddenstatic'); |
21 |
|
|
} |
22 |
fraynaud |
10 |
} |
23 |
|
|
|
24 |
|
|
function setSelect(&$form, $maj,$db,$debug) { |
25 |
fraynaud |
44 |
// parent:: setSelect($form, $maj,$db,$debug); |
26 |
|
|
// pb d optimisation et de chargement de 41.000 parcelles -> eliminer les select |
27 |
fraynaud |
10 |
// parcelle |
28 |
|
|
$contenu=""; |
29 |
|
|
$contenu[0][0]="parcelle";// table |
30 |
|
|
$contenu[0][1]="parcelle"; // zone origine |
31 |
|
|
$contenu[1][0]="proprietaire"; |
32 |
|
|
$contenu[1][1]="nom"; |
33 |
|
|
$form->setSelect("parcelle",$contenu); |
34 |
|
|
$contenu=""; |
35 |
|
|
$contenu[0][0]="parcelle";// table |
36 |
|
|
$contenu[0][1]="proprietaire"; // zone origine |
37 |
|
|
$contenu[1][0]="parcelle"; |
38 |
|
|
$contenu[1][1]="parcelle"; |
39 |
|
|
$form->setSelect("nom",$contenu); |
40 |
|
|
} |
41 |
|
|
|
42 |
|
|
function setGroupe(&$form,$maj){ |
43 |
|
|
$form->setGroupe('parcelle','D'); |
44 |
|
|
$form->setGroupe('nom','F'); |
45 |
|
|
} |
46 |
|
|
|
47 |
fraynaud |
20 |
function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire){ |
48 |
|
|
if ($validation==0) { |
49 |
|
|
if ($maj == 0){ |
50 |
|
|
$form->setVal("dossier", $idxformulaire); |
51 |
|
|
} |
52 |
|
|
} |
53 |
|
|
} |
54 |
fraynaud |
10 |
|
55 |
|
|
function triggerajouterapres($id,&$db,$val,$DEBUG){ |
56 |
|
|
// calcul terrain surface dossier |
57 |
fraynaud |
244 |
$sql ="select sum(surface) as surface from ".DB_PREFIXE."terrain inner join ".DB_PREFIXE."parcelle on terrain.parcelle =parcelle.parcelle where dossier ='" |
58 |
fraynaud |
10 |
.$val['dossier']."'" ; |
59 |
|
|
$res=$db->query($sql); |
60 |
fraynaud |
38 |
if (database::isError($res)) |
61 |
fraynaud |
20 |
die($res->getMessage()); |
62 |
fraynaud |
38 |
while ($row=& $res->fetchRow( DB_FETCHMODE_ASSOC)){ |
63 |
fraynaud |
20 |
$cle= " dossier = '".$val['dossier']."'"; |
64 |
fraynaud |
38 |
if(!is_numeric($row['surface'])) |
65 |
|
|
$surface=0; |
66 |
|
|
else |
67 |
|
|
$surface = $row['surface']; |
68 |
|
|
$valF['terrain_surface_calcul']= $surface; |
69 |
fraynaud |
244 |
$res1= $db->autoExecute(DB_PREFIXE.'dossier',$valF,DB_AUTOQUERY_UPDATE,$cle); |
70 |
fraynaud |
20 |
if (database::isError($res1)) |
71 |
|
|
die($res1->getMessage()); |
72 |
|
|
if ($DEBUG == 1) |
73 |
atreal |
316 |
echo _("requete_de_maj_effectuee")."<br>"; |
74 |
fraynaud |
45 |
$this->msg=$this->msg."<br>"._('enregistrement')." ".$val['dossier']." \"dossier\"" |
75 |
|
|
." [ ".$db->affectedRows()." "._('enregistrement')." "._('mis a jour')." ]" ; |
76 |
fraynaud |
20 |
} |
77 |
fraynaud |
10 |
} |
78 |
|
|
|
79 |
|
|
function triggermodifierapres($id,&$db,$val,$DEBUG){ |
80 |
|
|
// calcul terrain surface dossier |
81 |
fraynaud |
244 |
$sql ="select sum(surface) as surface from ".DB_PREFIXE."terrain inner join ".DB_PREFIXE."parcelle on terrain.parcelle =parcelle.parcelle where dossier ='" |
82 |
fraynaud |
20 |
.$val['dossier']."'" ; |
83 |
|
|
$res=$db->query($sql); |
84 |
fraynaud |
38 |
if (database::isError($res1)) |
85 |
fraynaud |
20 |
die($res->getMessage()."erreur ".$sql); |
86 |
|
|
while ($row=& $res->fetchRow( DB_FETCHMODE_ASSOC)){ |
87 |
|
|
$cle= " dossier = '".$val['dossier']."'"; |
88 |
fraynaud |
38 |
if(!is_numeric($row['surface'])) |
89 |
|
|
$surface=0; |
90 |
|
|
else |
91 |
|
|
$surface = $row['surface']; |
92 |
|
|
$valF['terrain_surface_calcul']= $surface; |
93 |
fraynaud |
244 |
$res1= $db->autoExecute(DB_PREFIXE.'dossier',$valF,DB_AUTOQUERY_UPDATE,$cle); |
94 |
fraynaud |
20 |
if (database::isError($res)) |
95 |
|
|
die($res->getMessage()); |
96 |
|
|
if ($DEBUG == 1) |
97 |
atreal |
316 |
echo _("requete_de_maj_effectuee")."<br>"; |
98 |
fraynaud |
45 |
$this->msg=$this->msg."<br>"._('enregistrement')." ".$val['dossier']." \"dossier\"" |
99 |
|
|
." [ ".$db->affectedRows()." "._('enregistrement')." "._('mis a jour')." ]" ; |
100 |
fraynaud |
20 |
} |
101 |
fraynaud |
10 |
} |
102 |
|
|
|
103 |
fraynaud |
20 |
|
104 |
fraynaud |
10 |
function triggersupprimerapres($id,&$db,$val,$DEBUG){ |
105 |
|
|
// calcul terrain surface dossier |
106 |
fraynaud |
244 |
$sql ="select sum(surface) as surface from ".DB_PREFIXE."terrain inner join ".DB_PREFIXE."parcelle on terrain.parcelle =parcelle.parcelle where dossier ='" |
107 |
fraynaud |
20 |
.$val['dossier']."'" ; |
108 |
|
|
$res=$db->query($sql); |
109 |
fraynaud |
38 |
if (database::isError($res1)) |
110 |
fraynaud |
20 |
die($res->getMessage()."erreur ".$sql); |
111 |
|
|
while ($row=& $res->fetchRow( DB_FETCHMODE_ASSOC)){ |
112 |
fraynaud |
10 |
$cle= " dossier = '".$val['dossier']."'"; |
113 |
fraynaud |
38 |
if(!is_numeric($row['surface'])) |
114 |
|
|
$surface=0; |
115 |
|
|
else |
116 |
|
|
$surface = $row['surface']; |
117 |
|
|
$valF['terrain_surface_calcul']= $surface; |
118 |
fraynaud |
244 |
$res1= $db->autoExecute(DB_PREFIXE.'dossier',$valF,DB_AUTOQUERY_UPDATE,$cle); |
119 |
fraynaud |
20 |
if (database::isError($res)) |
120 |
|
|
die($res->getMessage()); |
121 |
|
|
if ($DEBUG == 1) |
122 |
atreal |
316 |
echo _("requete_de_maj_effectuee")."<br>"; |
123 |
fraynaud |
45 |
$this->msg=$this->msg."<br>"._('enregistrement')." ".$val['dossier']." \"dossier\"" |
124 |
|
|
." [ ".$db->affectedRows()." "._('enregistrement')." "._('mis a jour')." ]" ; |
125 |
fraynaud |
20 |
} |
126 |
fraynaud |
10 |
} |
127 |
|
|
|
128 |
fraynaud |
3 |
}// fin classe |
129 |
|
|
?> |