noalyss Version-9
Public Member Functions | Data Fields
Acc_Ledger_Info Class Reference

Manage the additionnal info for operation (from jrn), when an invoice is generated, the order or other info are going to be stored and used in the detail. this class maps the table jrn_info. More...

+ Collaboration diagram for Acc_Ledger_Info:

Public Member Functions

 __construct ($p_cn, $p_ji_id=0)
 
 count ()
 
 from_array ($p_array)
 
 insert ()
 
 load ()
 load the todo_list row thanks it's ID More...
 
 load_all ()
 load all the jrn_info thanks the jr_id More...
 
 save_extra ($p_jr_id, $p_array)
 save all extra information in once, called by compta_ven and compta_ach More...
 
 search_id_internal ($p_internal)
 
 set_id ($p_ji_id)
 
 set_jrn_id ($p_id)
 
 set_type ($p_id)
 
 set_value ($p_id)
 
 update ()
 

Data Fields

 $cn
 
 $id_type
 
 $ji_id
 
 $ji_value
 
 $jr_id
 

Detailed Description

Manage the additionnal info for operation (from jrn), when an invoice is generated, the order or other info are going to be stored and used in the detail. this class maps the table jrn_info.

Definition at line 32 of file acc_ledger_info.class.php.

Constructor & Destructor Documentation

◆ __construct()

Acc_Ledger_Info::__construct (   $p_cn,
  $p_ji_id = 0 
)

Definition at line 39 of file acc_ledger_info.class.php.

40 {
41 $this->cn=$p_cn;
42 $this->ji_id=$p_ji_id;
43 }
$input_from cn
Definition: balance.inc.php:66

References cn.

Member Function Documentation

◆ count()

Acc_Ledger_Info::count ( )

Definition at line 161 of file acc_ledger_info.class.php.

162 {
163 $sql="select ji_id from jrn_info where jr_id=".$this->jr_id;
164 return $this->cn->count_sql($sql);
165 }

References $sql, and cn.

◆ from_array()

Acc_Ledger_Info::from_array (   $p_array)

Definition at line 112 of file acc_ledger_info.class.php.

113 {
114 foreach (array("jr_id","id_type","ji_value") as $col)
115 {
116 $this->$col=$p_array[$col];
117 }
118 }

References $p_array.

Referenced by load().

◆ insert()

Acc_Ledger_Info::insert ( )

Definition at line 44 of file acc_ledger_info.class.php.

45 {
46 if ( ! isset ($this->jr_id) ||
47 ! isset ($this->ji_value) ||
48 ! isset ($this->id_type ) )
49 {
50 echo 'Appel incorrecte '.__FILE__.__LINE__;
51 var_dump($this);
52 throw new Exception(_('appel incorrect'));
53 }
54 try
55 {
56 $sql=$this->cn->exec_sql('insert into jrn_info(jr_id,id_type,ji_value) values ($1,$2,$3)'.
57 ' returning ji_id ',
58 array ($this->jr_id,$this->id_type,$this->ji_value)
59 );
60 $this->ji_id=Database::fetch_result($sql,0,0);
61 }
62 catch (Exception $e)
63 {
65 echo "Echec sauvegarde info additionnelles";
66 throw $e;
67 }
68 }
record_log($p_message)
Record an error message into the log file of the server.
Definition: ac_common.php:1342
$op jr_id
Definition: ajax_ledger.php:83
static fetch_result($ret, $p_row=0, $p_col=0)
wrapper for the function pg_fetch_all

References $e, $sql, cn, DatabaseCore\fetch_result(), jr_id, and record_log().

Referenced by save_extra().

+ Here is the call graph for this function:

◆ load()

Acc_Ledger_Info::load ( )

load the todo_list row thanks it's ID

Returns
boolean true if found else false

Definition at line 97 of file acc_ledger_info.class.php.

97 :bool
98 {
99 $sql="select jr_id,id_type,ji_value from jrn_info where ji_id=$1";
100 $r=$this->cn->exec_sql($sql,[$this->ji_id]);
101 if (Database::num_row ($r) > 0 )
102 {
104 return true;
105 }
106 else
107 {
108 return false;
109 }
110
111 }
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
static fetch_array($ret, $p_indice=0, $p_mode=PGSQL_ASSOC)
wrapper for the function pg_fetch_array
static num_row($ret)
wrapper for the function pg_num_rows

References $r, $sql, cn, DatabaseCore\fetch_array(), from_array(), and DatabaseCore\num_row().

+ Here is the call graph for this function:

◆ load_all()

Acc_Ledger_Info::load_all ( )

load all the jrn_info thanks the jr_id

Returns
an array of object

Definition at line 138 of file acc_ledger_info.class.php.

139 {
140 if ( ! isset ($this->jr_id) )
141 {
142 echo "jr_id is not set ".__FILE__.__LINE__;
143 throw new Exception('Error : jr_id not set');
144 }
145
146 $sql="select ji_id from jrn_info where jr_id=".$this->jr_id;
147 $r=$this->cn->exec_sql($sql);
148 if (Database::num_row($r) == 0 )
149 return array();
151 $ret=array();
152 foreach ($array as $row)
153 {
154 $o=new Acc_Ledger_Info($this->cn,$row['ji_id']);
155 $o->load();
156 $ret[]=clone $o;
157 }
158 return $ret;
159
160 }
Manage the additionnal info for operation (from jrn), when an invoice is generated,...
static fetch_all($ret)
wrapper for the function pg_fetch_all

References $array, $r, $ret, $row, $sql, cn, DatabaseCore\fetch_all(), jr_id, and DatabaseCore\num_row().

+ Here is the call graph for this function:

◆ save_extra()

Acc_Ledger_Info::save_extra (   $p_jr_id,
  $p_array 
)

save all extra information in once, called by compta_ven and compta_ach

Parameters
$p_jr_idis the jrn.jr_id concerned,
$p_arrayis the array with the data usually it is $_POST
Note
will change this->jr_id
See also
compta_ven.inc.php compta_ach.inc.php

Definition at line 188 of file acc_ledger_info.class.php.

189 {
190 $this->jr_id=$p_jr_id;
191 if (noalyss_strlentrim($p_array['bon_comm'] ) != 0 )
192 {
193 $this->set_type('BON_COMMANDE');
194 $this->set_value($p_array['bon_comm']);
195 $this->insert();
196 }
197 if (noalyss_strlentrim($p_array['other_info'] ) != 0 )
198 {
199 $this->set_type('OTHER');
200 $this->set_value($p_array['other_info']);
201 $this->insert();
202 }
203 }
noalyss_strlentrim($p_string)
Definition: ac_common.php:1549

References $p_array, insert(), jr_id, noalyss_strlentrim(), set_type(), and set_value().

+ Here is the call graph for this function:

◆ search_id_internal()

Acc_Ledger_Info::search_id_internal (   $p_internal)

Definition at line 166 of file acc_ledger_info.class.php.

167 {
168 $sql="select jr_id from jrn where jr_internal='$p_internal'";
169 $r=$this->cn->exec_sql($sql);
170 if (Database::num_row($r) > 0 )
171 {
172 $this->jr_id=Database::fetch_result($r,0,0);
173 return $this->jr_id;
174 }
175 else
176 {
177 $this->jr_id=-1;
178 return $this->jr_id;
179 }
180 }

References $jr_id, $r, $sql, cn, DatabaseCore\fetch_result(), jr_id, and DatabaseCore\num_row().

+ Here is the call graph for this function:

◆ set_id()

Acc_Ledger_Info::set_id (   $p_ji_id)

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

120 {
121 $this->$ji_id=$p_ji_id;
122 }

◆ set_jrn_id()

Acc_Ledger_Info::set_jrn_id (   $p_id)

Definition at line 123 of file acc_ledger_info.class.php.

124 {
125 $this->jr_id=$p_id;
126 }

References $p_id, and jr_id.

◆ set_type()

Acc_Ledger_Info::set_type (   $p_id)

Definition at line 127 of file acc_ledger_info.class.php.

128 {
129 $this->id_type=$p_id;
130 }

References $p_id.

Referenced by save_extra().

◆ set_value()

Acc_Ledger_Info::set_value (   $p_id)

Definition at line 131 of file acc_ledger_info.class.php.

132 {
133 $this->ji_value=$p_id;
134 }

References $p_id.

Referenced by save_extra().

◆ update()

Acc_Ledger_Info::update ( )

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

70 {
71 if ( ! isset ($this->jr_id) ||
72 ! isset ($this->ji_value) ||
73 ! isset ($this->jr_id ) )
74 {
75 echo 'Appel incorrecte '.__FILE__.__LINE__;
76 var_dump($this);
77 throw new Exception('appel incorrect');
78 }
79 try
80 {
81 $sql=$this->exec_sql('update jrn_info set jr_id=$1 ,id_type=$2,ji_value=$3 where ji_id=$4)'.
82 array ($this->jr_id,$this->id_type,$this->ji_value,$this->ji_id)
83 );
84 }
85 catch (Exception $e)
86 {
88 $this->cn->rollback();
89 echo "Echec sauvegarde info additionnelles";
90 throw $e;
91 }
92 }

References $e, $sql, cn, jr_id, and record_log().

+ Here is the call graph for this function:

Field Documentation

◆ $cn

Acc_Ledger_Info::$cn

connection

Definition at line 34 of file acc_ledger_info.class.php.

◆ $id_type

Acc_Ledger_Info::$id_type

type id

Definition at line 36 of file acc_ledger_info.class.php.

◆ $ji_id

Acc_Ledger_Info::$ji_id

primary key

Definition at line 35 of file acc_ledger_info.class.php.

◆ $ji_value

Acc_Ledger_Info::$ji_value

value for this

Definition at line 38 of file acc_ledger_info.class.php.

◆ $jr_id

Acc_Ledger_Info::$jr_id

primary key of the table jrn

Definition at line 37 of file acc_ledger_info.class.php.

Referenced by search_id_internal().


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