1 |
<?php |
2 |
/* |
3 |
$Id: destination.class.php,v 1.7 2010-07-28 10:58:48 fraynaud Exp $ |
4 |
*/ |
5 |
require_once ($path_om."formulairedyn.class.php"); |
6 |
require_once ($path_om."dbformdyn.class.php"); |
7 |
|
8 |
class destination extends dbForm { |
9 |
|
10 |
var $table="destination"; |
11 |
var $clePrimaire= "destination"; |
12 |
var $typeCle= "A" ; |
13 |
|
14 |
function destination($id,$db,$debug) { |
15 |
$this->constructeur($id,$db,$debug); |
16 |
} |
17 |
|
18 |
function cleSecondaire($id,$db,$val,$debug) { |
19 |
$this->correct=True; |
20 |
$this->rechercheDestination_shon($id,$db,$debug) ; |
21 |
} |
22 |
|
23 |
function verifier(){ |
24 |
$this->correct=True; |
25 |
$imgv=""; |
26 |
$f=" ! "; |
27 |
$imgv="<img src='../img/punaise.png' style='vertical-align:middle' hspace='2' border='0'>"; |
28 |
if ($this->valF['libelle']==""){ |
29 |
$this->correct=false; |
30 |
$this->msg= $this->msg.$imgv.$this->lang("libelle")." ".$this->lang("obligatoire").$f; |
31 |
} |
32 |
} |
33 |
|
34 |
function setType(&$form,$maj) { |
35 |
if ($maj < 2) { |
36 |
if ($maj==1){ |
37 |
$form->setType('destination', 'hiddenstatic'); |
38 |
} |
39 |
}else{ |
40 |
$form->setType('destination', 'hiddenstatic'); |
41 |
$form->setType('libelle', 'hiddenstatic'); |
42 |
}} |
43 |
|
44 |
function setLib(&$form,$maj) { |
45 |
$form->setLib('destination',$this->lang('destination')); |
46 |
$form->setLib('libelle',$this->lang('libelle')); |
47 |
} |
48 |
|
49 |
function setTaille(&$form,$maj){ |
50 |
$form->setTaille('destination', 2); |
51 |
$form->setTaille('libelle', 80); |
52 |
} |
53 |
|
54 |
function setMax(&$form,$maj){ |
55 |
$form->setMax('destination', 2); |
56 |
$form->setMax('libelle', 80); |
57 |
} |
58 |
|
59 |
function rechercheDestination_shon($id,$db,$debug){ |
60 |
$sql = "select * from destination_shon where destination ='".$id."'"; |
61 |
$res = $db->query($sql); |
62 |
if($debug==1) echo $sql; |
63 |
if (DB :: isError($res)) |
64 |
die($res->getMessage(). " => Echec ".$sql); |
65 |
else{ |
66 |
$nbligne=$res->numrows(); |
67 |
$this->msg = $this->msg."<br>".$this->lang('il_y_a')." ".$nbligne. |
68 |
" ".$this->lang('enregistrement').' '.$this->lang('table')." destination_shon ". |
69 |
$this->lang('destination')." [". |
70 |
$id."]<br>"; |
71 |
if ($nbligne>0) |
72 |
$this->correct=false; |
73 |
} |
74 |
} |
75 |
|
76 |
}// fin de classe |
77 |
?> |