manage the table rapport_avance.formulaire_param
More...
|
static | factory (Formulaire_Param_Sql $form) |
| Factory, create an object following the $form->p_type,. More...
|
|
static | to_csv ($p_id) |
| export a form to CSV to stdout type $cn database connx More...
|
|
static | from_csv ($filename) |
|
manage the table rapport_avance.formulaire_param
Definition at line 35 of file class_formulaire_param.php.
static Formulaire_Param::factory |
( |
Formulaire_Param_Sql |
$form | ) |
|
|
static |
static Formulaire_Param::from_csv |
( |
|
$filename | ) |
|
|
static |
Update now the table rapport_advanced.restore_formulaire_param and set the correct pk $cn->exec_sql("update rapport_advanced.restore_formulaire_param set p_id=nextval('rapport_advanced.formulaire_param_p_id_seq')");
Definition at line 100 of file class_formulaire_param.php.
References $a, $array, $cn, $form, and $rapav_version.
103 $in = fopen($filename,
"r");
107 $a = fgetcsv($in, 0,
";");
108 if (
$a[0] !=
"RAPAV")
110 throw new Exception(
'Formulaire invalide');
116 $first = fgetcsv($in, 0,
";");
117 $form->f_title = $first[0];
118 if (isset($first[1]))
119 $form->f_description = $first[1];
122 while (($csv = fgetcsv($in, 0,
";")) != FALSE)
124 if ($csv[0] !=
"RAPAV_DETAIL")
130 $cn->get_array(
"INSERT INTO rapport_advanced.restore_formulaire_param(
131 p_id, p_code, p_libelle, p_type, p_order, f_id, t_id)
132 VALUES ($1, $2, $3, $4, $5, $6, $7)", $csv);
136 while (($csv = fgetcsv($in, 0,
";")) != FALSE)
139 for ($o = 0; $o < count($csv); $o++)
152 $cn->get_array(
"INSERT INTO rapport_advanced.restore_formulaire_param_detail(
153 fp_id, p_id, tmp_val, tva_id, fp_formula, fp_signed, jrn_def_type,
154 tt_id, type_detail, with_tmp_val, type_sum_account, operation_pcm_val,date_paid)
155 VALUES ($1, $2, $3, $4, $5, $6, $7,$8, $9, $10, $11, $12,$13)", $t);
161 $array=$cn->get_array(
"select p_id,p_code,p_libelle,p_order,f_id,t_id from rapport_advanced.restore_formulaire_param where f_id=$1",array(
$form->f_id));
163 $cn->prepare(
'detail',
'select p_id,tmp_val,tva_id,fp_formula,fp_signed, jrn_def_type,tt_id,type_detail,with_tmp_val,type_sum_account,operation_pcm_val,date_paid
164 from rapport_advanced.restore_formulaire_param_detail where p_id=$1');
166 for ($e=0;$e<$nb;$e++)
169 $new_pid=$cn->get_value(
"insert into rapport_advanced.formulaire_param (p_code, p_libelle, p_type, p_order, f_id, t_id)
170 select p_code, p_libelle, p_type, p_order, f_id, t_id
171 from rapport_advanced.restore_formulaire_param where p_id=$1 returning p_id",array(
$array[$e][
'p_id']));
173 $cn->exec_sql(
"insert into rapport_advanced.formulaire_param_detail
190 nextval('rapport_advanced.formulaire_param_detail_fp_id_seq'),
205 rapport_advanced.restore_formulaire_param_detail where p_id =$1
206 ",array(
$array[$e][
'p_id']));
210 $cn->exec_sql(
'delete from rapport_advanced.restore_formulaire_param where f_id=$1',array(
$form->f_id));
213 catch (Exception $exc)
215 echo $exc->getMessage();
216 error_log($exc->getMessage());
217 error_log($exc->getTraceAsString());
if(isset($_POST['remove'])) $array
static Formulaire_Param::to_csv |
( |
|
$p_id | ) |
|
|
static |
export a form to CSV to stdout type $cn database connx
- Parameters
-
type | $p_id | the formulaire.f_id |
Definition at line 69 of file class_formulaire_param.php.
References $array, $cn, $form, and $title.
75 $title = str_replace(array(
'/',
'*',
'<',
'>',
'*',
'.',
'+',
':',
'?',
'!',
" ",
";"),
"_",
$title);
77 $out = fopen(
"php://output",
"w");
78 header(
'Pragma: public');
79 header(
'Content-type: application/bin');
80 header(
'Content-Disposition: attachment;filename="' .
$title .
'.bin"', FALSE);
81 fputcsv($out, array(
"RAPAV",
'4'),
";");
82 fputcsv($out, array(
$form->f_title,
$form->f_description),
";");
83 $array = $cn->get_array(
"select p_id,p_code, p_libelle, p_type, p_order, f_id, t_id
84 from rapport_advanced.formulaire_param where f_id=$1", array($p_id));
85 for ($i = 0; $i < count(
$array); $i++)
87 fputcsv($out,
$array[$i],
";");
89 fputcsv($out, array(
'RAPAV_DETAIL'),
";");
90 $array = $cn->get_array(
"select
91 fp_id, p_id, tmp_val, tva_id, fp_formula, fp_signed, jrn_def_type,
92 tt_id, type_detail, with_tmp_val, type_sum_account, operation_pcm_val,date_paid
93 from rapport_advanced.formulaire_param_detail where p_id in (select p_id from rapport_advanced.formulaire_param where f_id=$1)", array($p_id));
94 for ($i = 0; $i < count(
$array); $i++)
96 fputcsv($out,
$array[$i],
";");
if(isset($_POST['remove'])) $array
The documentation for this class was generated from the following file: