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