noalyss  Version-6.7.2
Public Member Functions | Static Public Member Functions | 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...

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.
 get_info ()
 get_parameter ($p_string)
 insert ()
 load ()
 load_all ()
 retrieve all the details of an Follow_Up
 save ()
 set_parameter ($p_string, $p_value)
 update ()
 verify ()

Static Public Member Functions

static test_me ()

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 41 of file class_follow_up_detail.php.


Constructor & Destructor Documentation

Follow_Up_Detail::__construct ( p_cn,
p_id = 0 
)

Definition at line 54 of file class_follow_up_detail.php.

References db.

    {
        $this->db=$p_cn;
        $this->ad_id=$p_id;
    }

Member Function Documentation

Definition at line 188 of file class_follow_up_detail.php.

References $sql, and db.

    {
                $sql="delete from action_detail where ad_id=$1";
                $this->db->exec_sql($sql,array($this->ad_id));
        }
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 206 of file class_follow_up_detail.php.

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

    {
        $row=$array;
        $this->ad_id=(isset($row['ad_id'.$idx]))?$row['ad_id'.$idx]:0;

        $qcode=(isset($row['e_march'.$idx]))?$row['e_march'.$idx]:"";
        if (trim($qcode)=='')
        {
            $this->f_id=0;
        }
        else
        {
            $tmp=new Fiche($this->db);
            $tmp->get_by_qcode($qcode,false);
            $this->f_id=$tmp->id;
        }
        $this->ad_text=(isset($row['e_march'.$idx.'_label']))?$row['e_march'.$idx.'_label']:"";
        $this->ad_pu=(isset($row['e_march'.$idx.'_price']))?$row['e_march'.$idx.'_price']:0;
        $this->ad_quant=(isset($row['e_quant'.$idx]))?$row['e_quant'.$idx]:0;
        $this->ad_tva_id=(isset($row['e_march'.$idx.'_tva_id']))?$row['e_march'.$idx.'_tva_id']:0;
        $this->ad_tva_amount=(isset($row['e_march'.$idx.'_tva_amount']))?$row['e_march'.$idx.'_tva_amount']:0;
        $this->ad_total_amount=(isset($row['tvac_march'.$idx]))?$row['tvac_march'.$idx]:0;
        $this->ag_id=(isset($array['ag_id']))?$array['ag_id']:0;
        /* protect numeric */
        if (trim($this->ad_pu)=="" || isNumber($this->ad_pu)==0) $this->ad_pu=0;
        if (trim($this->ad_quant)=="" || isNumber($this->ad_quant)==0) $this->ad_quant=0;
        if (trim($this->ad_tva_amount)==""||isNumber($this->ad_tva_amount)==0) $this->ad_tva_amount=0;
        if (trim($this->ad_total_amount)==""||isNumber($this->ad_total_amount)==0) $this->ad_total_amount=0;
        if (trim($this->ad_tva_id)=="" || isNumber($this->ad_tva_id)==0) $this->ad_tva_id=0;
    }

Definition at line 81 of file class_follow_up_detail.php.

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

Definition at line 59 of file class_follow_up_detail.php.

References $idx, and exit.

    {
        if ( array_key_exists($p_string,self::$variable) )
        {
            $idx=self::$variable[$p_string];
            return $this->$idx;
        }
        else
            exit (__FILE__.":".__LINE__.'Erreur attribut inexistant');
    }

Definition at line 98 of file class_follow_up_detail.php.

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

Referenced by save().

    {
        if ( $this->verify() != 0 ) return;
        $sql='INSERT INTO action_detail('.
             ' f_id, ad_text, ad_pu, ad_quant, ad_tva_id, ad_tva_amount,'.
             '   ad_total_amount, ag_id)'.
             ' VALUES ($1, $2, $3, $4,$5,$6,$7,$8) returning ad_id';
        $this->ad_id=$this->db->get_value($sql,array(
                                              $this->f_id,
                                              $this->ad_text,
                                              $this->ad_pu,
                                              $this->ad_quant,
                                              $this->ad_tva_id,
                                              $this->ad_tva_amount,
                                              $this->ad_total_amount,
                                              $this->ag_id
                                          )
                                         );

    }

Definition at line 170 of file class_follow_up_detail.php.

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

    {
        $sql="SELECT ad_id, f_id, ad_text, ad_pu, ad_quant, ad_tva_id, ad_tva_amount,
             ad_total_amount, ag_id   FROM action_detail".
             " where ad_id=$1";

        $res=$this->db->get_array($this->db,
                                  $sql,
                                  array($this->ad_id)
                                 );
        if ( $this->db->count() == 0 ) return;
        $row=$res[0];
        foreach ($row as $idx=>$value)
        {
            $this->$idx=$value;
        }

    }

retrieve all the details of an Follow_Up

Returns:
array of Action_Detail
See also:
Follow_Up::get

Definition at line 146 of file class_follow_up_detail.php.

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

    {
        $sql="SELECT ad_id, f_id, ad_text, ad_pu, ad_quant, ad_tva_id, ad_tva_amount,
             ad_total_amount, ag_id   FROM action_detail ".
             " where ag_id=$1 order by ad_id";
        $res=$this->db->get_array(
                 $sql,
                 array($this->ag_id)
             );
        if ( $this->db->count() == 0 ) return;
        $aRet=array();
        for($i=0;$i<count($res);$i++)
        {
            $a=new Follow_Up_Detail($this->db);
            $row=$res[$i];
            foreach ($row as $idx=>$value)
            {
                $a->$idx=$value;
            }
            $aRet[$i]=clone $a;
        }
        return $aRet;
    }

Definition at line 90 of file class_follow_up_detail.php.

References insert(), and update().

    {
        if (  $this->ad_id == 0 )
            $this->insert();
        else
            $this->update();
    }
Follow_Up_Detail::set_parameter ( p_string,
p_value 
)

Definition at line 69 of file class_follow_up_detail.php.

References $idx, and exit.

    {
        if ( array_key_exists($p_string,self::$variable) )
        {
            $idx=self::$variable[$p_string];
            $this->$idx=$p_value;
        }
        else
            exit (__FILE__.":".__LINE__.'Erreur attribut inexistant');


    }
static Follow_Up_Detail::test_me ( ) [static]
Parameters:
\return
Note:
See also:

Definition at line 242 of file class_follow_up_detail.php.

{}

Definition at line 119 of file class_follow_up_detail.php.

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

Referenced by save().

    {
        if ( $this->verify() != 0 ) return;

        $sql='UPDATE action_detail '.
             ' SET f_id=$1, ad_text=$2, ad_pu=$3, ad_quant=$4, ad_tva_id=$5,'.
             '     ad_tva_amount=$6, ad_total_amount=$7, ag_id=$8'.
             ' WHERE ad_id=$9';
        $this->id=$this->db->exec_sql($sql,array(
                                          $this->f_id,
                                          $this->ad_text,
                                          $this->ad_pu,
                                          $this->ad_quant,
                                          $this->ad_tva_id,
                                          $this->ad_tva_amount,
                                          $this->ad_total_amount,
                                          $this->ag_id,
                                          $this->ad_id
                                      )
                                     );


    }

Definition at line 85 of file class_follow_up_detail.php.

Referenced by insert(), and update().

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

Field Documentation

Follow_Up_Detail::$variable [static, private]
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 43 of file class_follow_up_detail.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations