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