/[openfoncier]/trunk/obj/destination_shon.class.php
ViewVC logotype

Contents of /trunk/obj/destination_shon.class.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 38 - (show annotations)
Thu Jul 21 14:47:33 2011 UTC (13 years, 6 months ago) by fraynaud
File size: 4810 byte(s)
mise au pt pgsql


1 <?php
2 //$Id$
3 //gen openMairie le 10/02/2011 20:32
4 require_once ("../gen/obj/destination_shon.class.php");
5
6 class destination_shon extends destination_shon_gen {
7
8 function destination_shon($id,&$db,$debug) {
9 $this->constructeur($id,$db,$debug);
10 }// fin constructeur
11
12 function setvalF($val){
13 parent::setvalF($val);
14 // colone numerique
15 if(!is_numeric($val['shon'])) unset ($this->valF['shon']);
16 }
17
18
19 function setType(&$form,$maj) {
20 parent :: setType($form,$maj);
21 if ($maj < 2) { //ajouter et modifier
22 $form->setType('dossier', 'hiddenstatic');
23 }else
24 $form->setType('shon', 'text');
25 }
26
27 function setTaille(&$form,$maj){
28 $form->setTaille('destination_shon', 8);
29 $form->setTaille('shon', 12);
30 $form->setTaille('destination', 2);
31 $form->setTaille('dossier', 12);
32 }
33
34 function setMax(&$form,$maj){
35 $form->setMax('destination_shon', 8);
36 $form->setMax('shon', 12);
37 $form->setMax('destination', 2);
38 $form->setMax('dossier', 12);
39 }
40
41 function triggerajouterapres($id,&$db,$val,$DEBUG){
42 /// calcul shon dossier [calculate shon dossier]
43 $sql ="select sum(shon) as shon from destination_shon where dossier ='"
44 .$val['dossier']."'" ;
45 $res=$db->query($sql);
46 if (database :: isError($res))
47 die($res->getMessage()."erreur ".$sql);
48 while ($row=& $res->fetchRow( DB_FETCHMODE_ASSOC)){
49 $cle= " dossier = '".$val['dossier']."'";
50 if(!is_numeric($row['shon']))
51 $surface=0;
52 else
53 $surface = $row['shon'];
54 $valF['shon_calcul']= $surface;
55 $res1= $db->autoExecute('dossier',$valF,DB_AUTOQUERY_UPDATE,$cle);
56 if (database::isError($res1))
57 die($res1->getMessage());
58 if ($DEBUG == 1)
59 echo "La requête de mise à jour est effectuée.<br>";
60 $this->msg=$this->msg."<br>"._('enregistrement').
61 " ".$val['dossier']." "._('table')." dossier "
62 ." [".$db->affectedRows()." "._('enregistrement')." ".
63 _('mis_a_jour')."]" ;
64 }
65 }
66
67
68 function triggermodifierapres($id,&$db,$val,$DEBUG)
69 {
70 // calcul shon dossier [calculate shon dossier]
71 $sql ="select sum(shon) as shon from destination_shon where dossier ='"
72 .$val['dossier']."'" ;
73 $res=$db->query($sql);
74 if (database::isError($res))
75 die($res->getMessage());
76 while ($row=& $res->fetchRow( DB_FETCHMODE_ASSOC)){
77 $cle= " dossier = '".$val['dossier']."'";
78 if(!is_numeric($row['shon']))
79 $surface=0;
80 else
81 $surface = $row['shon'];
82 $valF['shon_calcul']= $surface;
83 $res1= $db->autoExecute('dossier',$valF,DB_AUTOQUERY_UPDATE,$cle);
84 if (database::isError($res1))
85 die($res1->getMessage());
86 if ($DEBUG == 1)
87 echo "La requête de mise à jour est effectuée.<br>";
88 $this->msg=$this->msg."<br>"._('enregistrement').
89 " ".$val['dossier']." "._('table')." dossier ".
90 " [".$db->affectedRows()." "._('enregistrement')." ".
91 _('mis_a_jour')."]" ;
92 }
93 }
94
95 function triggersupprimerapres($id,&$db,$val,$DEBUG)
96 {
97 // calcul shon dossier [calculate shon dossier]
98 $sql ="select sum(shon) as shon from destination_shon where dossier ='"
99 .$val['dossier']."'" ;
100 $res=$db->query($sql);
101 if (database::isError($res))
102 die($res->getMessage());
103 while ($row=& $res->fetchRow( DB_FETCHMODE_ASSOC)){
104 $cle= " dossier = '".$val['dossier']."'";
105 if(!is_numeric($row['shon']))
106 $surface=0;
107 else
108 $surface = $row['shon'];
109 $valF['shon_calcul']= $surface;
110 $res1= $db->autoExecute('dossier',$valF,DB_AUTOQUERY_UPDATE,$cle);
111 if (database::isError($res1))
112 die($res1->getMessage());
113 if ($DEBUG == 1)
114 echo "La requête de mise à jour est effectuée.<br>";
115 $this->msg=$this->msg."<br>"._('enregistrement').
116 " ".$val['dossier']." "._('table')." dossier ".
117 " [".$db->affectedRows()." "._('enregistrement')." ".
118 _('mis_a_jour')."]" ;
119 }
120 }
121
122 function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire){
123 if ($validation==0) {
124 if ($maj == 0){
125 $form->setVal("dossier", $idxformulaire);
126 }
127 }
128 }
129
130 }// fin classe
131 ?>

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26