/[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 38 by fraynaud, Thu Jul 21 14:47:33 2011 UTC revision 242 by fraynaud, Wed Nov 23 19:39:04 2011 UTC
# Line 12  class destination_shon extends destinati Line 12  class destination_shon extends destinati
12      function setvalF($val){      function setvalF($val){
13          parent::setvalF($val);            parent::setvalF($val);  
14          // colone numerique          // colone numerique
15            
16          if(!is_numeric($val['shon'])) unset ($this->valF['shon']);          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    
# Line 20  class destination_shon extends destinati Line 27  class destination_shon extends destinati
27          parent :: setType($form,$maj);          parent :: setType($form,$maj);
28          if ($maj < 2) { //ajouter et modifier          if ($maj < 2) { //ajouter et modifier
29            $form->setType('dossier', 'hiddenstatic');            $form->setType('dossier', 'hiddenstatic');
30              $form->setType('shon', 'hiddenstatic');
31          }else          }else
32               $form->setType('shon', 'text');               $form->setType('shon', 'text');
33      }      }
# Line 38  class destination_shon extends destinati Line 46  class destination_shon extends destinati
46          $form->setMax('dossier', 12);          $form->setMax('dossier', 12);
47      }      }
48            
49        function triggerajouter($id,&$db,$val,$DEBUG){
50            $this->calculshon($val);
51        }
52        
53        
54      function triggerajouterapres($id,&$db,$val,$DEBUG){      function triggerajouterapres($id,&$db,$val,$DEBUG){
55      /// calcul shon dossier  [calculate shon dossier]      /// calcul shon dossier  [calculate shon dossier]
56         $sql ="select sum(shon) as shon from destination_shon where dossier ='"         $sql ="select sum(shon) as shon from ".DB_PREFIXE.
57         .$val['dossier']."'" ;               "destination_shon where dossier ='".$val['dossier']."'" ;
58         $res=$db->query($sql);         $res=$db->query($sql);
59         if (database :: isError($res))         if (database :: isError($res))
60            die($res->getMessage()."erreur  ".$sql);            die($res->getMessage()."erreur  ".$sql);
# Line 52  class destination_shon extends destinati Line 65  class destination_shon extends destinati
65            else            else
66                $surface = $row['shon'];                $surface = $row['shon'];
67              $valF['shon_calcul']= $surface;              $valF['shon_calcul']= $surface;
68            $res1= $db->autoExecute('dossier',$valF,DB_AUTOQUERY_UPDATE,$cle);            $res1= $db->autoExecute(DB_PREFIXE.'dossier',$valF,DB_AUTOQUERY_UPDATE,$cle);
69            if (database::isError($res1))            if (database::isError($res1))
70              die($res1->getMessage());              die($res1->getMessage());
71                    if ($DEBUG == 1)                    if ($DEBUG == 1)
# Line 64  class destination_shon extends destinati Line 77  class destination_shon extends destinati
77            }            }
78      }      }
79            
80        function triggermodifier($id,&$db,$val,$DEBUG){
81            $this->calculshon($val);
82        }
83        
84            
85      function triggermodifierapres($id,&$db,$val,$DEBUG)      function triggermodifierapres($id,&$db,$val,$DEBUG)
86      {      {
87      // calcul shon dossier [calculate shon dossier]      // calcul shon dossier [calculate shon dossier]
88          $sql ="select sum(shon) as shon from destination_shon where dossier ='"          $sql ="select sum(shon) as shon from ".DB_PREFIXE.
89          .$val['dossier']."'" ;          "destination_shon where dossier ='".$val['dossier']."'" ;
90          $res=$db->query($sql);          $res=$db->query($sql);
91           if (database::isError($res))           if (database::isError($res))
92              die($res->getMessage());              die($res->getMessage());
# Line 80  class destination_shon extends destinati Line 97  class destination_shon extends destinati
97            else            else
98                $surface = $row['shon'];                $surface = $row['shon'];
99            $valF['shon_calcul']= $surface;            $valF['shon_calcul']= $surface;
100            $res1= $db->autoExecute('dossier',$valF,DB_AUTOQUERY_UPDATE,$cle);            $res1= $db->autoExecute(DB_PREFIXE.'dossier',$valF,DB_AUTOQUERY_UPDATE,$cle);
101            if (database::isError($res1))            if (database::isError($res1))
102              die($res1->getMessage());              die($res1->getMessage());
103            if ($DEBUG == 1)            if ($DEBUG == 1)
# Line 95  class destination_shon extends destinati Line 112  class destination_shon extends destinati
112      function triggersupprimerapres($id,&$db,$val,$DEBUG)      function triggersupprimerapres($id,&$db,$val,$DEBUG)
113      {      {
114      // calcul shon dossier [calculate shon dossier]      // calcul shon dossier [calculate shon dossier]
115          $sql ="select sum(shon) as shon from destination_shon where dossier ='"          $sql ="select sum(shon) as shon from ".DB_PREFIXE."destination_shon where dossier ='"
116          .$val['dossier']."'" ;          .$val['dossier']."'" ;
117          $res=$db->query($sql);          $res=$db->query($sql);
118          if (database::isError($res))          if (database::isError($res))
# Line 107  class destination_shon extends destinati Line 124  class destination_shon extends destinati
124              else              else
125                $surface = $row['shon'];                $surface = $row['shon'];
126              $valF['shon_calcul']= $surface;              $valF['shon_calcul']= $surface;
127              $res1= $db->autoExecute('dossier',$valF,DB_AUTOQUERY_UPDATE,$cle);              $res1= $db->autoExecute(DB_PREFIXE.'dossier',$valF,DB_AUTOQUERY_UPDATE,$cle);
128              if (database::isError($res1))              if (database::isError($res1))
129              die($res1->getMessage());              die($res1->getMessage());
130              if ($DEBUG == 1)              if ($DEBUG == 1)
# Line 127  class destination_shon extends destinati Line 144  class destination_shon extends destinati
144          }          }
145      }      }
146            
147        function calculshon($val){
148            $this->valF['shon']= $val['shon_nouvelle']+$val['shon_shob_transformee']+$val['shon_nouvelle_transformee']
149                    - $val['shon_demolie']- $val['shon_anterieure_supprimee'];
150            //$val['shon']."***";
151        }
152        
153        
154  }// fin classe  }// fin classe
155  ?>  ?>

Legend:
Removed from v.38  
changed lines
  Added in v.242

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26