Plugins  LAST
 All Data Structures Files Functions Variables Pages
Public Member Functions
Copro_key Class Reference
Collaboration diagram for Copro_key:
Collaboration graph

Public Member Functions

 verify ($p_array, $b_dupl=true)
 
 insert ($p_array)
 
 update ($p_array)
 
 load ()
 
 get_detail ()
 

Detailed Description

Definition at line 29 of file class_copro_key.php.

Member Function Documentation

Copro_key::get_detail ( )

Definition at line 110 of file class_copro_key.php.

References $array, and $cn.

111  {
112  global $cn;
113  $array=$cn->get_array("select * from coprop.clef_repartition_detail
114  where cr_id=$1",array($this->cr_id));
115  return $array;
116  }
if(isset($_POST['remove'])) $array
global $cn
Copro_key::insert (   $p_array)

Definition at line 46 of file class_copro_key.php.

References $cn, and verify().

47  {
48  global $cn;
49  extract($p_array);
50  try
51  {
52  $this->verify($p_array);
53  $cn->start();
54  $this->cr_id = $cn->get_value("insert into coprop.clef_repartition(cr_note,cr_name,cr_tantieme)
55  values($1,$2,$3) returning cr_id", array( strip_tags($cr_note), strip_tags($cr_name),$cr_tantieme));
56  for ($i = 0; $i < count($f_id); $i++)
57  {
58  if (${"part" . $f_id[$i]} == '')
59  ${"part" . $f_id[$i]} = 0;
60  $cn->exec_sql("insert into coprop.clef_repartition_detail(lot_fk,crd_amount,cr_id) values($1,$2,$3)", array($f_id[$i], ${"part" . $f_id[$i]}, $this->cr_id));
61  }
62  $cn->commit();
63  }
64  catch (Exception $exc)
65  {
66  $cn->rollback();
67  echo $exc->getTraceAsString();
68  }
69  }
verify($p_array, $b_dupl=true)
global $cn
Copro_key::load ( )

Definition at line 98 of file class_copro_key.php.

References $array, and $cn.

99  {
100  global $cn;
101  $array=$cn->get_array("select * from coprop.clef_repartition where
102  cr_id=$1",array($this->cr_id));
103  if ( $cn->count() == 1 )
104  {
105  foreach ( array("cr_id","cr_name","cr_note","cr_tantieme") as $k=>$e) {
106  $this->$e=$array[0][$e];
107  }
108  }
109  }
if(isset($_POST['remove'])) $array
global $cn
Copro_key::update (   $p_array)

Definition at line 71 of file class_copro_key.php.

References $cn, and verify().

72  {
73  global $cn;
74  extract($p_array);
75  try
76  {
77  $this->verify($p_array,false);
78  $cn->start();
79  $cn->exec_sql("update coprop.clef_repartition set
80  cr_note=$1,cr_name=$2,cr_tantieme=$3
81  where cr_id=$4",
82  array( strip_tags($cr_note), strip_tags($cr_name),$cr_tantieme,$this->cr_id));
83  $cn->exec_sql("delete from coprop.clef_repartition_detail where cr_id=$1",array($this->cr_id));
84  for ($i = 0; $i < count($f_id); $i++)
85  {
86  if (${"part" . $f_id[$i]} == '')
87  ${"part" . $f_id[$i]} = 0;
88  $cn->exec_sql("insert into coprop.clef_repartition_detail(lot_fk,crd_amount,cr_id) values($1,$2,$3)", array($f_id[$i], ${"part" . $f_id[$i]}, $this->cr_id));
89  }
90  $cn->commit();
91  }
92  catch (Exception $exc)
93  {
94  $cn->rollback();
95  echo $exc->getTraceAsString();
96  }
97  }
verify($p_array, $b_dupl=true)
global $cn
Copro_key::verify (   $p_array,
  $b_dupl = true 
)

Definition at line 31 of file class_copro_key.php.

References $cn.

Referenced by insert(), and update().

32  {
33  global $cn;
34  extract ($p_array);
35  if (strlen(trim ($cr_name))==0)
36  throw new Exception("Le nom est vide");
37  if ($b_dupl )
38  {
39  $dupl=$cn->count_sql("select * from coprop.clef_repartition where cr_name=$1",array($cr_name));
40  if ( $dupl >0 )
41  throw new Exception("Une clef avec ce nom existe déja");
42  }
43 
44  }
global $cn

The documentation for this class was generated from the following file: