23 require_once
'class_copro_appel_fond_detail.php';
31 function verify ($p_array,$b_dupl=
true)
35 if (strlen(trim ($cr_name))==0)
36 throw new Exception(
"Le nom est vide");
39 $dupl=$cn->count_sql(
"select * from coprop.clef_repartition where cr_name=$1",array($cr_name));
41 throw new Exception(
"Une clef avec ce nom existe déja");
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++)
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));
64 catch (Exception $exc)
67 echo $exc->getTraceAsString();
77 $this->
verify($p_array,
false);
79 $cn->exec_sql(
"update coprop.clef_repartition set
80 cr_note=$1,cr_name=$2,cr_tantieme=$3
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++)
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));
92 catch (Exception $exc)
95 echo $exc->getTraceAsString();
101 $array=$cn->get_array(
"select * from coprop.clef_repartition where
102 cr_id=$1",array($this->cr_id));
103 if ( $cn->count() == 1 )
105 foreach ( array(
"cr_id",
"cr_name",
"cr_note",
"cr_tantieme") as $k=>$e) {
113 $array=$cn->get_array(
"select * from coprop.clef_repartition_detail
114 where cr_id=$1",array($this->cr_id));
verify($p_array, $b_dupl=true)
if(isset($_POST['remove'])) $array