phpcompta-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpcompta-dev] r529 - in trunk: . rapport_avance/include


From: phpcompta-dev
Subject: [Phpcompta-dev] r529 - in trunk: . rapport_avance/include
Date: Sun, 13 Oct 2013 16:06:04 +0200 (CEST)

Author: danydb
Date: 2013-10-13 16:06:04 +0200 (Sun, 13 Oct 2013)
New Revision: 529

Modified:
   trunk/
   trunk/rapport_avance/include/class_formulaire_param.php
Log:
Merged revisions 528 via svnmerge from 
svn+ssh://address@hidden/svn_extension/tag/rel660

........
  r528 | danydb | 2013-10-13 16:04:31 +0200 (dim., 13 oct. 2013) | 1 line
  
  Bug when restoring rapport
........



Property changes on: trunk
___________________________________________________________________
Name: svnmerge-integrated
   - /tag/rel660:1-526
   + /tag/rel660:1-528

Modified: trunk/rapport_avance/include/class_formulaire_param.php
===================================================================
--- trunk/rapport_avance/include/class_formulaire_param.php     2013-10-13 
14:04:31 UTC (rev 528)
+++ trunk/rapport_avance/include/class_formulaire_param.php     2013-10-13 
14:06:04 UTC (rev 529)
@@ -99,7 +99,7 @@
        {
                global $cn;
                $in = fopen($filename, "r");
-               $cn->start();
+               /* DEBUG $cn->start(); */
                try
                {
                        $a = fgetcsv($in, 0, ";");
@@ -149,17 +149,29 @@
                                VALUES ($1, $2, $3, $4, $5, $6, $7,$8, $9, $10, 
$11, $12)", $t);
                        }
                        /// 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')");
+                       /// $cn->exec_sql("update 
rapport_advanced.restore_formulaire_param set 
p_id=nextval('rapport_advanced.formulaire_param_p_id_seq')");
+                        
+                        // Insert row by row + detail 
+                        $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));
+                        // Prepare stmt for the details
+                        $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 
+                                    from  
rapport_advanced.restore_formulaire_param_detail where p_id=$1');
+                        $nb=count($array);
+                        for ($e=0;$e<$nb;$e++)
+                        {
+                            // Insert first into  
rapport_advanced.formulaire_param
+                               $new_pid=$cn->get_value("insert into 
rapport_advanced.formulaire_param (p_code, p_libelle, p_type, p_order, f_id, 
t_id)
+                                   select   p_code, p_libelle, p_type, 
p_order, f_id, t_id
+                               from rapport_advanced.restore_formulaire_param 
where p_id=$1 returning p_id",array($array[$e]['p_id']));
+                            // Insert detail 
+                                $cn->exec_sql("insert into 
rapport_advanced.formulaire_param_detail select 
nextval('rapport_advanced.formulaire_param_detail_fp_id_seq'), $new_pid, 
tmp_val, tva_id, fp_formula, fp_signed, jrn_def_type,
+                    tt_id, type_detail, with_tmp_val, type_sum_account, 
operation_pcm_val from  rapport_advanced.restore_formulaire_param_detail where 
p_id =$1
+                                ",array($array[$e]['p_id']));
+                        }
 
-                       $cn->exec_sql('insert into 
rapport_advanced.formulaire_param select  p_id, p_code, p_libelle, p_type, 
p_order, f_id, t_id
-                               from rapport_advanced.restore_formulaire_param 
where f_id=$1',array($form->f_id));
 
-                       $cn->exec_sql("insert into 
rapport_advanced.formulaire_param_detail select 
nextval('rapport_advanced.formulaire_param_detail_fp_id_seq'), 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 from  rapport_advanced.restore_formulaire_param_detail where 
p_id in (
-                       select p_id from 
rapport_advanced.restore_formulaire_param where f_id=$1)",array($form->f_id));
-
-                       $cn->exec_sql('delete from  
rapport_advanced.restore_formulaire_param where f_id=$1',array($form->f_id));
-                       $cn->commit();
+               /*DEBUG $cn->exec_sql('delete from  
rapport_advanced.restore_formulaire_param where f_id=$1',array($form->f_id));
+                       $cn->commit();*/
                }
                catch (Exception $exc)
                {



---
PhpCompta est un logiciel de comptabilité libre en ligne (full web)
Projet opensource http://www.phpcompta.eu



reply via email to

[Prev in Thread] Current Thread [Next in Thread]