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