/[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 20 - (show annotations)
Mon Jul 18 15:27:17 2011 UTC (13 years, 6 months ago) by fraynaud
File size: 4238 byte(s)
maj version 3.00


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 setType(&$form,$maj) {
13 parent :: setType($form,$maj);
14 if ($maj < 2) { //ajouter et modifier
15 $form->setType('dossier', 'hiddenstatic');
16 }
17 }
18
19 function setTaille(&$form,$maj){
20 $form->setTaille('destination_shon', 8);
21 $form->setTaille('shon', 12);
22 $form->setTaille('destination', 2);
23 $form->setTaille('dossier', 12);
24 }
25
26 function setMax(&$form,$maj){
27 $form->setMax('destination_shon', 8);
28 $form->setMax('shon', 12);
29 $form->setMax('destination', 2);
30 $form->setMax('dossier', 12);
31 }
32
33 function triggerajouterapres($id,&$db,$val,$DEBUG){
34 /// calcul shon dossier [calculate shon dossier]
35 $sql ="select sum(shon) as shon from destination_shon where dossier ='"
36 .$val['dossier']."'" ;
37 $res=$db->query($sql);
38 if (DB :: isError($res))
39 die($res->getMessage()."erreur ".$sql);
40 while ($row=& $res->fetchRow( DB_FETCHMODE_ASSOC)){
41 $cle= " dossier = '".$val['dossier']."'";
42 $valF['shon_calcul']= $row['shon'];
43 $res1= $db->autoExecute('dossier',$valF,DB_AUTOQUERY_UPDATE,$cle);
44 if (database::isError($res1))
45 die($res1->getMessage());
46 if ($DEBUG == 1)
47 echo "La requête de mise à jour est effectuée.<br>";
48 $this->msg=$this->msg."<br>"._('enregistrement').
49 " ".$val['dossier']." "._('table')." dossier "
50 ." [".$db->affectedRows()." "._('enregistrement')." ".
51 _('mis_a_jour')."]" ;
52 }
53 }
54
55
56 function triggermodifierapres($id,&$db,$val,$DEBUG)
57 {
58 // calcul shon dossier [calculate shon dossier]
59 $sql ="select sum(shon) as shon from destination_shon where dossier ='"
60 .$val['dossier']."'" ;
61 $res=$db->query($sql);
62 if (database::isError($res))
63 die($res->getMessage());
64 while ($row=& $res->fetchRow( DB_FETCHMODE_ASSOC)){
65 $cle= " dossier = '".$val['dossier']."'";
66 $valF['shon_calcul']= $row['shon'];
67 $res1= $db->autoExecute('dossier',$valF,DB_AUTOQUERY_UPDATE,$cle);
68 if (database::isError($res1))
69 die($res1->getMessage());
70 if ($DEBUG == 1)
71 echo "La requête de mise à jour est effectuée.<br>";
72 $this->msg=$this->msg."<br>"._('enregistrement').
73 " ".$val['dossier']." "._('table')." dossier ".
74 " [".$db->affectedRows()." "._('enregistrement')." ".
75 _('mis_a_jour')."]" ;
76 }
77 }
78
79 function triggersupprimerapres($id,&$db,$val,$DEBUG)
80 {
81 // calcul shon dossier [calculate shon dossier]
82 $sql ="select sum(shon) as shon from destination_shon where dossier ='"
83 .$val['dossier']."'" ;
84 $res=$db->query($sql);
85 if (database::isError($res))
86 die($res->getMessage());
87 while ($row=& $res->fetchRow( DB_FETCHMODE_ASSOC)){
88 $cle= " dossier = '".$val['dossier']."'";
89 $valF['shon_calcul']= $row['shon'];
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 setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire){
103 if ($validation==0) {
104 if ($maj == 0){
105 $form->setVal("dossier", $idxformulaire);
106 }
107 }
108 }
109
110 }// fin classe
111 ?>

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26