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 |
if($maj==0){ |
19 |
|
|
$form->setType('sig','hidden'); |
20 |
|
|
}else{ |
21 |
|
|
$form->setType('sig','http'); |
22 |
|
|
} |
23 |
|
|
} |
24 |
|
|
} |
25 |
|
|
|
26 |
|
|
function setSelect(&$form, $maj,$db,$debug) { |
27 |
fraynaud |
44 |
// parent:: setSelect($form, $maj,$db,$debug); |
28 |
|
|
// pb d optimisation et de chargement de 41.000 parcelles -> eliminer les select |
29 |
fraynaud |
10 |
// parcelle |
30 |
|
|
$contenu=""; |
31 |
|
|
$contenu[0][0]="parcelle";// table |
32 |
|
|
$contenu[0][1]="parcelle"; // zone origine |
33 |
|
|
$contenu[1][0]="proprietaire"; |
34 |
|
|
$contenu[1][1]="nom"; |
35 |
|
|
$form->setSelect("parcelle",$contenu); |
36 |
|
|
$contenu=""; |
37 |
|
|
$contenu[0][0]="parcelle";// table |
38 |
|
|
$contenu[0][1]="proprietaire"; // zone origine |
39 |
|
|
$contenu[1][0]="parcelle"; |
40 |
|
|
$contenu[1][1]="parcelle"; |
41 |
|
|
$form->setSelect("nom",$contenu); |
42 |
|
|
// lien sig |
43 |
|
|
include ("../dyn/var.inc"); |
44 |
|
|
$contenu=array(); |
45 |
|
|
$contenu[0]="<img src='".$image_sig."'>"; |
46 |
|
|
$form->setSelect("sig",$contenu); |
47 |
|
|
} |
48 |
|
|
|
49 |
|
|
function setGroupe(&$form,$maj){ |
50 |
|
|
$form->setGroupe('parcelle','D'); |
51 |
|
|
$form->setGroupe('nom','F'); |
52 |
|
|
} |
53 |
|
|
|
54 |
|
|
function setTaille(&$form,$maj){ |
55 |
|
|
$form->setTaille('terrain', 8); |
56 |
|
|
$form->setTaille('dossier', 12); |
57 |
|
|
$form->setTaille('parcelle', 6); |
58 |
|
|
$form->setTaille('nom', 60); |
59 |
|
|
} |
60 |
|
|
|
61 |
|
|
function setMax(&$form,$maj){ |
62 |
|
|
$form->setMax('terrain', 8); |
63 |
|
|
$form->setMax('dossier', 12); |
64 |
|
|
$form->setMax('parcelle', 6); |
65 |
|
|
$form->setMax('nom', 60); |
66 |
|
|
} |
67 |
fraynaud |
20 |
|
68 |
|
|
function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire){ |
69 |
|
|
if ($validation==0) { |
70 |
|
|
if ($maj == 0){ |
71 |
|
|
$form->setVal("dossier", $idxformulaire); |
72 |
|
|
} |
73 |
|
|
} |
74 |
|
|
} |
75 |
fraynaud |
10 |
|
76 |
|
|
function triggerajouterapres($id,&$db,$val,$DEBUG){ |
77 |
|
|
// calcul terrain surface dossier |
78 |
|
|
$sql ="select sum(surface) as surface from terrain inner join parcelle on terrain.parcelle =parcelle.parcelle where dossier ='" |
79 |
|
|
.$val['dossier']."'" ; |
80 |
|
|
$res=$db->query($sql); |
81 |
fraynaud |
38 |
if (database::isError($res)) |
82 |
fraynaud |
20 |
die($res->getMessage()); |
83 |
fraynaud |
38 |
while ($row=& $res->fetchRow( DB_FETCHMODE_ASSOC)){ |
84 |
fraynaud |
20 |
$cle= " dossier = '".$val['dossier']."'"; |
85 |
fraynaud |
38 |
if(!is_numeric($row['surface'])) |
86 |
|
|
$surface=0; |
87 |
|
|
else |
88 |
|
|
$surface = $row['surface']; |
89 |
|
|
$valF['terrain_surface_calcul']= $surface; |
90 |
fraynaud |
20 |
$res1= $db->autoExecute('dossier',$valF,DB_AUTOQUERY_UPDATE,$cle); |
91 |
|
|
if (database::isError($res1)) |
92 |
|
|
die($res1->getMessage()); |
93 |
|
|
if ($DEBUG == 1) |
94 |
fraynaud |
38 |
echo _("requête_de_maj_effectuee")."<br>"; |
95 |
|
|
$this->msg=$this->msg."<br>"._('enregistrement')." ".$val['dossier']." "._('de')." "._('la').' '._('table')."\"dossier\"" |
96 |
|
|
." [ ".$db->affectedRows()." "._('enregistrement')._('pluriel')." "._('m_a_j')." ]" ; |
97 |
fraynaud |
20 |
} |
98 |
fraynaud |
10 |
} |
99 |
|
|
|
100 |
|
|
function triggermodifierapres($id,&$db,$val,$DEBUG){ |
101 |
|
|
// calcul terrain surface dossier |
102 |
fraynaud |
20 |
$sql ="select sum(surface) as surface from terrain inner join parcelle on terrain.parcelle =parcelle.parcelle where dossier ='" |
103 |
|
|
.$val['dossier']."'" ; |
104 |
|
|
$res=$db->query($sql); |
105 |
fraynaud |
38 |
if (database::isError($res1)) |
106 |
fraynaud |
20 |
die($res->getMessage()."erreur ".$sql); |
107 |
|
|
while ($row=& $res->fetchRow( DB_FETCHMODE_ASSOC)){ |
108 |
|
|
$cle= " dossier = '".$val['dossier']."'"; |
109 |
fraynaud |
38 |
if(!is_numeric($row['surface'])) |
110 |
|
|
$surface=0; |
111 |
|
|
else |
112 |
|
|
$surface = $row['surface']; |
113 |
|
|
$valF['terrain_surface_calcul']= $surface; |
114 |
fraynaud |
20 |
$res1= $db->autoExecute('dossier',$valF,DB_AUTOQUERY_UPDATE,$cle); |
115 |
|
|
if (database::isError($res)) |
116 |
|
|
die($res->getMessage()); |
117 |
|
|
if ($DEBUG == 1) |
118 |
fraynaud |
38 |
echo _("requête_de_maj_effectuee")."<br>"; |
119 |
|
|
$this->msg=$this->msg."<br>"._('enregistrement')." ".$val['dossier']." "._('de')." "._('la').' '._('table')."\"dossier\"" |
120 |
|
|
." [ ".$db->affectedRows()." "._('enregistrement')." "._('m_a_j')." ]" ; |
121 |
fraynaud |
20 |
} |
122 |
fraynaud |
10 |
} |
123 |
|
|
|
124 |
fraynaud |
20 |
|
125 |
fraynaud |
10 |
function triggersupprimerapres($id,&$db,$val,$DEBUG){ |
126 |
|
|
// calcul terrain surface dossier |
127 |
fraynaud |
20 |
$sql ="select sum(surface) as surface from terrain inner join parcelle on terrain.parcelle =parcelle.parcelle where dossier ='" |
128 |
|
|
.$val['dossier']."'" ; |
129 |
|
|
$res=$db->query($sql); |
130 |
fraynaud |
38 |
if (database::isError($res1)) |
131 |
fraynaud |
20 |
die($res->getMessage()."erreur ".$sql); |
132 |
|
|
while ($row=& $res->fetchRow( DB_FETCHMODE_ASSOC)){ |
133 |
fraynaud |
10 |
$cle= " dossier = '".$val['dossier']."'"; |
134 |
fraynaud |
38 |
if(!is_numeric($row['surface'])) |
135 |
|
|
$surface=0; |
136 |
|
|
else |
137 |
|
|
$surface = $row['surface']; |
138 |
|
|
$valF['terrain_surface_calcul']= $surface; |
139 |
fraynaud |
10 |
$res1= $db->autoExecute('dossier',$valF,DB_AUTOQUERY_UPDATE,$cle); |
140 |
fraynaud |
20 |
if (database::isError($res)) |
141 |
|
|
die($res->getMessage()); |
142 |
|
|
if ($DEBUG == 1) |
143 |
fraynaud |
38 |
echo _("requête_de_maj_effectuee")."<br>"; |
144 |
|
|
$this->msg=$this->msg."<br>"._('enregistrement')." ".$val['dossier']." "._('de')." "._('la').' '._('table')."\"dossier\"" |
145 |
|
|
." [ ".$db->affectedRows()." "._('enregistrement')." "._('m_a_j')." ]" ; |
146 |
fraynaud |
20 |
} |
147 |
fraynaud |
10 |
} |
148 |
|
|
|
149 |
fraynaud |
3 |
}// fin classe |
150 |
|
|
?> |