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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

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

Legend:
Removed from v.3  
changed lines
  Added in v.169

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26