noalyss Version-9
Public Member Functions | Static Public Member Functions | Data Fields | Static Private Attributes
Follow_Up_Detail Class Reference

Follow_Up Details are the details for an actions, it means the details of an order, delivery order, submit a quote... this class is linked to the table action_detail. More...

+ Collaboration diagram for Follow_Up_Detail:

Public Member Functions

 __construct ($p_cn, $p_id=0)
 
 delete ()
 
 from_array ($array, $idx)
 Fill an Action_Detail Object with the data contained in an array. More...
 
 get_info ()
 
 get_parameter ($p_string)
 
 insert ()
 
 load ()
 load the todo_list row thanks it's ID More...
 
 load_all ()
 retrieve all the details of an Follow_Up More...
 
 save ()
 
 set_parameter ($p_string, $p_value)
 
 update ()
 
 verify ()
 

Static Public Member Functions

static display (Follow_Up $p_follow_up, $p_view)
 

Data Fields

 $ad_id
 
 $ag_id
 
 $db
 

Static Private Attributes

static $variable
 

Detailed Description

Follow_Up Details are the details for an actions, it means the details of an order, delivery order, submit a quote... this class is linked to the table action_detail.

Definition at line 40 of file follow_up_detail.class.php.

Constructor & Destructor Documentation

◆ __construct()

Follow_Up_Detail::__construct (   $p_cn,
  $p_id = 0 
)

Definition at line 54 of file follow_up_detail.class.php.

55 {
56 $this->db=$p_cn;
57 $this->ad_id=$p_id;
58 }
$SecUser db

References $p_id, and db.

Member Function Documentation

◆ delete()

Follow_Up_Detail::delete ( )

Definition at line 191 of file follow_up_detail.class.php.

192 {
193 $sql="delete from action_detail where ad_id=$1";
194 $this->db->exec_sql($sql,array($this->ad_id));
195 }

References $sql, and db.

◆ display()

static Follow_Up_Detail::display ( Follow_Up  $p_follow_up,
  $p_view 
)
static

Definition at line 240 of file follow_up_detail.class.php.

241 {
242 $option=$p_follow_up->db->get_value("select do_option from document_option "
243 . " where document_type_id=$1 and do_code='detail_operation'",[$p_follow_up->dt_id]);
244
245 require NOALYSS_TEMPLATE."/follow_up_detail_display.php";
246 }

◆ from_array()

Follow_Up_Detail::from_array (   $array,
  $idx 
)

Fill an Action_Detail Object with the data contained in an array.

Parameters
$array
  • [ad_id7] => ad_id
  • [e_march7] => f_id
  • [e_march7_label] => ad_text
  • [e_march7_price] => ad_pu
  • [e_quant7] => ad_quant
  • [e_march7_tva_id] => ad_tva_id
  • [e_march7_tva_amount] => ad_tva_amount
  • [tvac_march7] => ad_total_amount
  • [ag_id] => ag_id
$idxis the idx (example 7)
Note

Definition at line 209 of file follow_up_detail.class.php.

210 {
211 $row=$array;
212 $this->ad_id=(isset($row['ad_id'.$idx]))?$row['ad_id'.$idx]:0;
213
214 $qcode=(isset($row['e_march'.$idx]))?$row['e_march'.$idx]:"";
215 if (trim($qcode)=='')
216 {
217 $this->f_id=0;
218 }
219 else
220 {
221 $tmp=new Fiche($this->db);
222 $tmp->get_by_qcode($qcode,false);
223 $this->f_id=$tmp->id;
224 }
225 $this->ad_text=(isset($row['e_march'.$idx.'_label']))?$row['e_march'.$idx.'_label']:"";
226 $this->ad_pu=(isset($row['e_march'.$idx.'_price']))?$row['e_march'.$idx.'_price']:0;
227 $this->ad_quant=(isset($row['e_quant'.$idx]))?$row['e_quant'.$idx]:0;
228 $this->ad_tva_id=(isset($row['e_march'.$idx.'_tva_id']))?$row['e_march'.$idx.'_tva_id']:0;
229 $this->ad_tva_amount=(isset($row['e_march'.$idx.'_tva_amount']))?$row['e_march'.$idx.'_tva_amount']:0;
230 $this->ad_total_amount=(isset($row['tvac_march'.$idx]))?$row['tvac_march'.$idx]:0;
231 $this->ag_id=(isset($array['ag_id']))?$array['ag_id']:0;
232 /* protect numeric */
233 if (trim($this->ad_pu)=="" || isNumber($this->ad_pu)==0) $this->ad_pu=0;
234 if (trim($this->ad_quant)=="" || isNumber($this->ad_quant)==0) $this->ad_quant=0;
235 if (trim($this->ad_tva_amount)==""||isNumber($this->ad_tva_amount)==0) $this->ad_tva_amount=0;
236 if (trim($this->ad_total_amount)==""||isNumber($this->ad_total_amount)==0) $this->ad_total_amount=0;
237 if (trim($this->ad_tva_id)=="" || isNumber($this->ad_tva_id)==0) $this->ad_tva_id=0;
238 }
isNumber($p_int)
Definition: ac_common.php:215
$idx
$fl ag_id
define Class fiche and fiche def, those class are using class attribut. When adding or modifing new c...
Definition: fiche.class.php:38

References $array, $idx, $qcode, $row, $tmp, ag_id, db, and isNumber().

+ Here is the call graph for this function:

◆ get_info()

Follow_Up_Detail::get_info ( )

Definition at line 81 of file follow_up_detail.class.php.

82 {
83 return var_export(self::$variable,true);
84 }

References $variable.

◆ get_parameter()

Follow_Up_Detail::get_parameter (   $p_string)

Definition at line 59 of file follow_up_detail.class.php.

60 {
61 if ( array_key_exists($p_string,self::$variable) )
62 {
63 $idx=self::$variable[$p_string];
64 return $this->$idx;
65 }
66 else
67 throw new Exception("Attribut inexistant $p_string");
68 }

References $idx, and $variable.

◆ insert()

Follow_Up_Detail::insert ( )

Definition at line 98 of file follow_up_detail.class.php.

99 {
100 if ( $this->verify() != 0 ) return;
101 $sql='INSERT INTO action_detail('.
102 ' f_id, ad_text, ad_pu, ad_quant, ad_tva_id, ad_tva_amount,'.
103 ' ad_total_amount, ag_id)'.
104 ' VALUES ($1, $2, $3, $4,$5,$6,$7,$8) returning ad_id';
105 $this->ad_id=$this->db->get_value($sql,array(
106 $this->f_id,
107 $this->ad_text,
108 $this->ad_pu,
109 $this->ad_quant,
110 $this->ad_tva_id,
111 $this->ad_tva_amount,
112 $this->ad_total_amount,
113 $this->ag_id
114 )
115 );
116
117 }

References $sql, ag_id, db, and verify().

Referenced by save().

+ Here is the call graph for this function:

◆ load()

Follow_Up_Detail::load ( )

load the todo_list row thanks it's ID

Returns
boolean true if found else false

Definition at line 173 of file follow_up_detail.class.php.

173 :bool
174 {
175 $sql="SELECT ad_id, f_id, ad_text, ad_pu, ad_quant, ad_tva_id, ad_tva_amount,
176 ad_total_amount, ag_id FROM action_detail".
177 " where ad_id=$1";
178
179 $res=$this->db->get_array(
180 $sql,
181 array($this->ad_id)
182 );
183 if ( $this->db->count() == 0 ) return false;
184 $row=$res[0];
185 foreach (self::$variable as $idx)
186 {
187 $this->$idx=$row[$idx];
188 }
189 return true;
190 }

References $idx, $res, $row, $sql, $variable, and db.

◆ load_all()

Follow_Up_Detail::load_all ( )

retrieve all the details of an Follow_Up

Returns
array of Action_Detail
See also
Follow_Up::get

Definition at line 146 of file follow_up_detail.class.php.

147 {
148 $sql="SELECT ad_id, f_id, ad_text, ad_pu, ad_quant, ad_tva_id, ad_tva_amount,
149 ad_total_amount, ag_id FROM action_detail ".
150 " where ag_id=$1 order by ad_id";
151 $res=$this->db->get_array(
152 $sql,
153 array($this->ag_id)
154 );
155 if ( $this->db->count() == 0 ) return array();
156 $aRet=array();
157 for($i=0;$i<count($res);$i++)
158 {
159 $a=new Follow_Up_Detail($this->db);
160 $row=$res[$i];
161 foreach ($row as $idx=>$value)
162 {
163 $a->$idx=$value;
164 }
165 $aRet[$i]=clone $a;
166 }
167 return $aRet;
168 }
Follow_Up Details are the details for an actions, it means the details of an order,...

References $a, $i, $idx, $res, $row, $sql, $value, ag_id, and db.

◆ save()

Follow_Up_Detail::save ( )

Definition at line 90 of file follow_up_detail.class.php.

91 {
92 if ( $this->ad_id == 0 )
93 $this->insert();
94 else
95 $this->update();
96 }

References insert(), and update().

+ Here is the call graph for this function:

◆ set_parameter()

Follow_Up_Detail::set_parameter (   $p_string,
  $p_value 
)

Definition at line 69 of file follow_up_detail.class.php.

70 {
71 if ( array_key_exists($p_string,self::$variable) )
72 {
73 $idx=self::$variable[$p_string];
74 $this->$idx=$p_value;
75 }
76 else
77 throw new Exception("Attribut inexistant $p_string");
78
79
80 }

References $idx, and $variable.

◆ update()

Follow_Up_Detail::update ( )

Definition at line 119 of file follow_up_detail.class.php.

120 {
121 if ( $this->verify() != 0 ) return;
122
123 $sql='UPDATE action_detail '.
124 ' SET f_id=$1, ad_text=$2, ad_pu=$3, ad_quant=$4, ad_tva_id=$5,'.
125 ' ad_tva_amount=$6, ad_total_amount=$7, ag_id=$8'.
126 ' WHERE ad_id=$9';
127 $this->id=$this->db->exec_sql($sql,array(
128 $this->f_id,
129 $this->ad_text,
130 $this->ad_pu,
131 $this->ad_quant,
132 $this->ad_tva_id,
133 $this->ad_tva_amount,
134 $this->ad_total_amount,
135 $this->ag_id,
136 $this->ad_id
137 )
138 );
139
140
141 }

References $sql, ag_id, db, and verify().

Referenced by save().

+ Here is the call graph for this function:

◆ verify()

Follow_Up_Detail::verify ( )

Definition at line 85 of file follow_up_detail.class.php.

86 {
87 // Verify that the elt we want to add is correct
88 return 0;
89 }

Referenced by insert(), and update().

Field Documentation

◆ $ad_id

Follow_Up_Detail::$ad_id

Definition at line 53 of file follow_up_detail.class.php.

◆ $ag_id

Follow_Up_Detail::$ag_id

Definition at line 53 of file follow_up_detail.class.php.

◆ $db

Follow_Up_Detail::$db

Definition at line 53 of file follow_up_detail.class.php.

◆ $variable

Follow_Up_Detail::$variable
staticprivate
Initial value:
=array(
"id"=>"ad_id",
"qcode"=>"f_id",
"text"=>"ad_text",
"price_unit"=>"ad_pu",
"quantity"=>"ad_quant",
"tva_id"=>"ad_tva_id",
"tva_amount"=>"ad_tva_amount",
"total"=>"ad_total_amount",
"ag_id"=>"ag_id"
)

Definition at line 42 of file follow_up_detail.class.php.


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