30 require_once NOALYSS_INCLUDE.
'/lib/class_iselect.php';
31 require_once NOALYSS_INCLUDE.
'/lib/class_ihidden.php';
32 require_once NOALYSS_INCLUDE.
'/class/class_pre_op_ach.php';
33 require_once NOALYSS_INCLUDE.
'/class/class_pre_op_ven.php';
34 require_once NOALYSS_INCLUDE.
'/class/class_pre_op_advanced.php';
46 $this->od_direct=
'false';
55 $r.=
'<p class="decale">';
56 $r.= _(
"Donnez un nom pour sauver cette opération comme modèle").
" <br>";
57 $opd_name =
new IText(
'opd_name');
58 $r.=
"Nom du modèle " . $opd_name->input();
60 $opd_description->style=
' class="itextarea" style="width:30em;height:4em;vertical-align:top"';
62 $r.=
'<p class="decale">';
63 $r.= _(
'Description (max 50 car.)');
73 $this->nb_item=
$_POST[
'nb_item'];
75 $this->jrn_type=
$_POST[
'jrn_type'];
80 $this->description=
$_POST[
'od_description'];
83 $n=$this->
db->get_next_seq(
'op_def_op_seq');
84 $this->
name=$this->jrn_type.$n;
90 $sql=
"delete from op_predef where od_id=".$this->od_id;
99 if ( $this->
db->count_sql(
"select * from op_predef ".
100 "where upper(od_name)=upper('".Database::escape_string($this->name).
"')".
101 "and jrn_def_id=".$this->p_jrn)
104 $this->
name=
"copy_".$this->name.
"_".microtime(
true);
108 echo
'<span class="notice">'.(
"Vous avez atteint le max. d'opération prédéfinie, désolé").
'</span>';
111 $sql=
'insert into op_predef (jrn_def_id,od_name,od_item,od_jrn_type,od_direct,od_description)'.
113 "($1,$2,$3,$4,$5 ,$6 )";
114 $this->
db->exec_sql(
$sql,array($this->p_jrn,
121 $this->od_id=$this->
db->get_current_seq(
'op_def_op_seq');
129 $sql=
"select od_id,jrn_def_id,od_name,od_item,od_jrn_type,od_description".
130 " from op_predef where od_id=".$this->od_id.
134 foreach (array(
'jrn_def_id',
'od_name',
'od_item',
'od_jrn_type',
'od_description') as $field) {
135 $this->$field=
$array[0][$field];
137 switch ($this->od_jrn_type) {
142 $this->detail=
new Pre_Op_ven($this->
db);
145 $this->detail=
new Pre_op_advanced($this->
db);
148 throw new Exception(
'Load PreOperatoin failed'.$this->od_jrn_type);
150 $this->detail->set_od_id($this->od_id);
151 $this->detail->jrn_def_id=$this->jrn_def_id;
162 "jrn_type"=>
$p_array[0][
"od_jrn_type"],
163 "od_description"=>
$p_array[
'0'][
'od_description']
174 $value=$this->
db->make_array(
"select od_id,od_name from op_predef ".
175 " where jrn_def_id=".$this->p_jrn.
176 " and od_direct ='".$this->od_direct.
"'".
177 " order by od_name");
179 if ( empty(
$value)==
true)
return "";
188 $a=$this->
db->count_sql(
"select od_id,od_name from op_predef ".
189 " where jrn_def_id=".$this->p_jrn.
190 " and od_direct ='".$this->od_direct.
"'".
191 " order by od_name");
199 $sql=
"select od_id,od_name,od_description from op_predef ".
200 " where jrn_def_id=".$this->p_jrn.
201 " and od_direct ='".$this->od_direct.
"'".
222 $array=$this->detail->compute_array();
223 echo $this->detail->display(
$array);
238 $this->valid=array(
'ledger'=>
'jrn_def_id',
'ledger_type'=>
'jrn_type',
'direct'=>
'od_direct');
239 $this->jrn_def_id=-1;
247 $r=
HtmlInput::button_action(_(
"Modèle d'opérations"),
' $(\'modele_op_div\').style.display=\'block\';$(\'lk_modele_op_tab\').focus();');
248 $r.=
'<div id="modele_op_div" class="noprint">';
251 $r.=
$hid->input(
"action",
"use_opd");
252 $r.=
$hid->input(
"jrn_type",$this->
get(
"ledger_type"));
254 $r.=
' <p style="text-align: center">'.
264 $a=$this->
db->count_sql(
"select od_id,od_name from op_predef ".
265 " where jrn_def_id=".$this->jrn_def_id.
266 " and od_direct ='".$this->od_direct.
"'".
267 " order by od_name");
275 $value=$this->
db->get_array(
"select od_id,od_name,od_description from op_predef ".
276 " where jrn_def_id=$1".
277 " and od_direct =$2".
279 array($this->jrn_def_id,$this->od_direct ));
281 if ( $this->jrn_def_id==
'')
$value=array();
284 $r.=
'<h2>'._(
"Choisissez un modèle").
'</h2>';
286 $r.=
'<table style="width:100%" id="modele_op_tab">';
288 $r.=
'<tr class="'.(($i%2==0)?
"even":
"odd").
'">';
289 $r.=
'<td style="font-weight:bold;vertical-align:top;text-decoration:underline">';
290 $r.=sprintf(
'<a href="%s&pre_def=%s" onclick="waiting_box()">%s</a> ',
293 $r.=
'<td>'.h(
$value[$i][
'od_description']).
'</td>';
301 if ( $this->jrn_def_id==
'')
return array();
302 $value=$this->
db->make_array(
"select od_id,od_name from op_predef ".
303 " where jrn_def_id=".
sql_string($this->jrn_def_id).
304 " and od_direct ='".
sql_string($this->od_direct).
"'".
305 " order by od_name",1);
310 if ( ! isset ($this->valid[$p_param] ) )
312 $msg=_(
" le parametre $p_param n'existe pas ".__FILE__.
':'.__LINE__);
313 throw new Exception(
$msg);
315 $attr=$this->valid[$p_param];
318 function get($p_param)
321 if ( ! isset ($this->valid[$p_param] ) )
323 $msg=_(
" le parametre $p_param n'existe pas ".__FILE__.
':'.__LINE__);
324 throw new Exception(
$msg);
326 $attr=$this->valid[$p_param];
332 $this->operation->get_post();
display()
display the detail of predefined operation, normally everything is loaded
static fetch_all($ret)
wrapper for the function pg_fetch_all
sql_string($p_string)
Fix the problem with the quote char for the database.
show_button()
show the button for selecting a predefined operation
__construct($p_cn, $p_id=0)
manage the predefined operation, link to the table op_def and op_def_detail
__construct($cn, $p_id=0)
count()
count the number of pred operation for a ledger
get_list_ledger()
get the list of the predef. operation of a ledger
concerns the predefined operation for ACH ledger
get_post()
fill the object with the $_POST variable
form_get($p_url)
show a form to use pre_op
save()
save the predef check first is the name is unique
function trim(s)
remove trailing and heading space
mother of the pre_op_XXX, it contains only one data : an object Pre_Operation. The child class contai...
count()
count the number of pred operation for a ledger
load()
load the data from the database and return an array
show_button($p_url)
show the button for selecting a predefined operation
const MAX_PREDEFINED_OPERATION
static save_propose()
Propose to save the operation into a predefined operation.
set_jrn($p_jrn)
set the ledger