phpcompta-dev
[Top][All Lists]
Advanced

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

[Phpcompta-dev] r460 - in trunk/import_account: . include


From: phpcompta-dev
Subject: [Phpcompta-dev] r460 - in trunk/import_account: . include
Date: Sun, 6 Jan 2013 01:50:09 +0100 (CET)

Author: danydb
Date: 2013-01-06 01:50:09 +0100 (Sun, 06 Jan 2013)
New Revision: 460

Added:
   trunk/import_account/impacc.js
   trunk/import_account/include/class_impacc_operation.php
   trunk/import_account/include/class_install_impacc.php
   trunk/import_account/include/class_sql_impacc.php
Removed:
   trunk/import_account/impdol.js
   trunk/import_account/include/class_impdol_operation.php
   trunk/import_account/include/class_install_impdol.php
   trunk/import_account/include/class_sql_impdol.php
Modified:
   trunk/import_account/README.txt
   trunk/import_account/include/imd_operation.inc.php
   trunk/import_account/index.php
Log:
Adapt plugin : rename function, class,schema 

Modified: trunk/import_account/README.txt
===================================================================
--- trunk/import_account/README.txt     2013-01-06 00:40:57 UTC (rev 459)
+++ trunk/import_account/README.txt     2013-01-06 00:50:09 UTC (rev 460)
@@ -1 +1 @@
-Import data from dolibarr
\ No newline at end of file
+Import data from CSV files

Copied: trunk/import_account/impacc.js (from rev 459, 
trunk/import_account/impdol.js)
===================================================================
--- trunk/import_account/impacc.js                              (rev 0)
+++ trunk/import_account/impacc.js      2013-01-06 00:50:09 UTC (rev 460)
@@ -0,0 +1,7 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+
+content[50]="le taux est compris entre 0 et 100";
\ No newline at end of file

Deleted: trunk/import_account/impdol.js
===================================================================
--- trunk/import_account/impdol.js      2013-01-06 00:40:57 UTC (rev 459)
+++ trunk/import_account/impdol.js      2013-01-06 00:50:09 UTC (rev 460)
@@ -1,7 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-
-
-content[50]="le taux est compris entre 0 et 100";
\ No newline at end of file

Copied: trunk/import_account/include/class_impacc_operation.php (from rev 459, 
trunk/import_account/include/class_impdol_operation.php)
===================================================================
--- trunk/import_account/include/class_impacc_operation.php                     
        (rev 0)
+++ trunk/import_account/include/class_impacc_operation.php     2013-01-06 
00:50:09 UTC (rev 460)
@@ -0,0 +1,498 @@
+<?php
+
+/*
+ *   This file is part of PhpCompta.
+ *
+ *   PhpCompta is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   PhpCompta is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with PhpCompta; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+/* $Revision$ */
+
+// Copyright Author Dany De Bontridder address@hidden
+
+/**
+ * @file
+ * @brief
+ *
+ */
+require_once 'class_sql_impacc.php';
+
+class Impacc_Operation
+{
+
+       function save_file()
+       {
+               if (trim($_FILES['csv_operation']['name']) == '')
+               {
+                       alert('Pas de fichier donné');
+                       return -1;
+               }
+               $this->filename = tempnam($_ENV['TMP'], 'upload_');
+               move_uploaded_file($_FILES["csv_operation"]["tmp_name"], 
$this->filename);
+
+               $imp = new Impacc_Import_sql();
+               $imp->setp('temp_file', $this->filename);
+               $imp->setp('send_file', $_FILES['csv_operation']['name']);
+               $imp->insert();
+               $this->impid = $imp->getp("id");
+       }
+
+       function record()
+       {
+               $foperation = fopen($this->filename, 'r');
+               $this->row_count = 0;
+               $max = 0;
+               while (($row = fgetcsv($foperation, 0, ";", '"')) !== false)
+               {
+                       if (count($row) != 11)
+                       {
+                               $str_row = implode($row, ";");
+                               echo "Attention " . h($str_row) . " ne contient 
pas 11 colonnes";
+                               continue;
+                       }
+                       $r = new impacc_Operation_tmp_Sql();
+                       $r->setp('dolibarr', $row[0]);
+                       $r->setp('date', $row[1]);
+                       $r->setp('type', $row[2]);
+                       $r->setp('qcode', $row[3]);
+                       $r->setp('desc', $row[4]);
+                       $r->setp('pj', $row[5]);
+                       $r->setp('amount_unit', $row[6]);
+                       $r->setp('amount_vat', $row[7]);
+                       $r->setp('number_unit', $row[8]);
+                       $r->setp('rate', $row[9]);
+                       $r->setp('amount_total', $row[10]);
+                       $r->setp("import_id", $this->impid);
+                       $r->insert();
+                       $this->row_count++;
+               }
+               echo "Nombre de lignes enregistrées : " . $this->row_count;
+               $import = new impacc_import_sql($this->impid);
+               $import->setp("nbrow", $this->row_count);
+               $import->update();
+       }
+
+       /**
+        * Check data contained into impacc.operation_tmp. Update the column 
o_result (T = ok N no ok)
+        * Put in o_message the reason of the problem
+        */
+       function check()
+       {
+               global $cn;
+               try
+               {
+                       $cn->start();
+                       $array = $cn->get_array("select o_id from 
impacc.operation_tmp where i_id=$1 order by o_id", array($this->impid));
+                       $nb_row = count($array);
+                       for ($i = 0; $i < $nb_row; $i++)
+                       {
+                               $msg = "";
+                               $operation = new impacc_operation_tmp_sql();
+                               $operation->setp("id", $array[$i]['o_id']);
+                               $operation->load();
+                               $operation->setp("code", 'T');
+                               $dol = $operation->getp("dolibarr");
+                               /*
+                                * detect duplicate
+                                */
+                               $db = $cn->get_value("select count(*) from 
impacc.operation_tmp where o_doli=$1 and o_id in (select o_id from 
impacc.operation_transfer)", array($dol));
+                               if ($db > 0)
+                               {
+                                       $operation->setp("code", "N");
+                                       $operation->setp("message", " Opération 
déjà transférée : doublon ");
+                                       $operation->update();
+                                       continue;
+                               }
+                               if (trim($dol) == "" || isNumber($dol) == 0)
+                               {
+                                       $operation->setp("code", 'N');
+                                       $msg.=" le numéro de ligne pour 
dolibarr est invalide";
+                               }
+                               if (isDate($operation->getp("date")) == null)
+                               {
+                                       $operation->setp("code", 'N');
+                                       $msg.=" La date est invalide, format 
n'est pas JJ.MM.AAAA";
+                               }
+                               $fiche = new Fiche($cn);
+                               
$fiche->get_by_qcode(trim($operation->getp("qcode")));
+
+                               if ($fiche->id == 0)
+                               {
+                                       $operation->setp("code", 'N');
+                                       $msg.=" Cette fiche n'existe pas";
+                               }
+                               else
+                               {
+                                       $operation->setp("fiche", $fiche->id);
+                               }
+                               /**
+                                * check if card as a valid accounting
+                                */
+                               $poste = $fiche->strAttribut(ATTR_DEF_ACCOUNT);
+                               if (trim($poste) == '' || 
$cn->get_value("select count(*) from tmp_pcmn where pcm_val=$1", array($poste)) 
== 0)
+                               {
+                                       $operation->setp("code", 'N');
+                                       $msg.=" Cette fiche n'a pas de poste 
comptable valide";
+                               }
+                               $operation->setp("poste", $poste);
+                               $a = array("rate" => " Taux de TVA", 
"amount_total" => "Montant total", "number_unit" => 'Nombre d\'unité', 
"amount_vat" => "Montant TVA");
+
+                               foreach ($a as $key => $value)
+                               {
+                                       $v = $operation->getp($key);
+                                       $v = str_replace(",", ".", $v);
+
+                                       if (trim($v) != "" && isNumber($v) == 0)
+                                       {
+                                               $operation->setp("code", 'N');
+                                               $msg.=" $value n'est pas un 
nombre";
+                                               continue;
+                                       }
+
+                                       $operation->setp($key, $v);
+                               }
+
+                               if ($operation->getp("type") != "T")
+                               {
+                                       $tva_id = $cn->get_array("select tva_id 
from impacc.parameter_tva where pt_rate/100=$1", 
array($operation->getp("rate")));
+                                       if (count($tva_id) > 1)
+                                       {
+                                               $operation->setp("code", 'N');
+                                               $msg.=" Plusieurs code TVA 
correspondent à ce taux";
+                                       }
+                                       elseif (empty($tva_id))
+                                       {
+                                               $operation->setp("code", 'N');
+                                               $msg.=" Aucun code TVA ne 
correspond à ce taux";
+                                       }
+                                       else
+                                       {
+                                               $operation->setp("tva_id", 
$tva_id[0]['tva_id']);
+                                       }
+                               }
+                               // a supplier and one service at least is needed
+                               $code_op = $operation->getp("dolibarr");
+                               $nb_customer = $cn->get_value("select count(*) 
from impacc.operation_tmp where o_type='T' and o_doli=$1 and i_id=$2", 
array($code_op, $this->impid));
+                               $nb_good = $cn->get_value("select count(*) from 
impacc.operation_tmp where o_type='S' and o_doli=$1 and i_id=$2", 
array($code_op, $this->impid));
+                               if ($nb_customer == 0)
+                               {
+                                       $operation->setp("code", 'N');
+                                       $msg.=" Aucun client ou fournisseur";
+                               }
+                               if ($nb_good == 0)
+                               {
+                                       $operation->setp("code", 'N');
+                                       $msg.=" Aucune marchandise ou service";
+                               }
+
+                               // check if in a opened period
+                               $op_date = $operation->getp('date');
+                               $periode = new Periode($cn);
+                               try
+                               {
+                                       $periode->find_periode($op_date);
+                               }
+                               catch (Exception $e)
+                               {
+                                       $msg.=$e->getMessage();
+                                       $operation->setp('code', 'N');
+                               }
+
+                               $operation->setp("message", $msg);
+                               $operation->update();
+                       }
+                       /*
+                        *  If a part is N then the whole operation is N
+                        */
+                       $sql = "update impadd.operation_tmp  set o_result='N' 
where i_id=$1 and
+                               o_doli in (select o_doli from 
impacc.operation_tmp  where o_result='N' and i_id=$1)";
+                       $cn->exec_sql($sql, array($this->impid));
+                       $cn->commit();
+               }
+               catch (Exception $e)
+               {
+                       print_r($e->getTraceAsString());
+                       $cn->rollback;
+               }
+       }
+
+       /**
+        * Show the result in a table
+        */
+       function result()
+       {
+               require_once 'class_html_table.php';
+               global $cn, $g_failed, $g_succeed;
+               $sql = " select o_doli,o_date,o_qcode,o_label,o_pj,amount_unit,
+                       amount_vat,
+                       number_unit,
+                       vat_rate,
+                       amount_total,
+                       case when o_result='T' then '" . $g_succeed . "' else 
'" . $g_failed . "' end as result,
+                       o_message
+                       from impacc.operation_tmp where i_id=" . $this->impid . 
" order by o_id";
+               echo Html_Table::sql2table($cn, array(
+                       array('name' => 'n° ligne',
+                               'style' => 'style="text-align:right"'),
+                       array('name' => 'Date',
+                               'style' => 'text-align:right'),
+                       array('name' => 'QuickCode'),
+                       array('name' => 'Libellé'),
+                       array('name' => 'n° pj'),
+                       array('name' => 'Montant / unité', 'style' => 
'style="text-align:right"'),
+                       array('name' => 'Montant Total TVA', 'style' => 
'style="text-align:right"'),
+                       array('name' => 'Nbre unités', 'style' => 
'style="text-align:right"'),
+                       array('name' => 'taux TVA', 'style' => 
'style="text-align:right"'),
+                       array('name' => 'Montant total TVAC', 'style' => 
'style="text-align:right"'),
+                       array('name' => 'Transfert', 'style' => 
'style="text-align:right"', 'raw' => 1),
+                       array('name' => 'Message')
+                               )
+                               , $sql, 'style="width:100%" class="result"'
+               );
+       }
+
+       function transfer()
+       {
+               global $cn;
+               $jrn = $_POST['p_jrn'];
+               $ledger = new Acc_Ledger($cn, $jrn);
+               $type = $ledger->get_type();
+               switch ($type)
+               {
+                       case 'ACH':
+                               $ledger = new Acc_Ledger_Purchase($cn, $jrn);
+                               $tiers_side = 'c';
+                               $oth_side = 'd';
+                               break;
+                       case 'VEN':
+                               $ledger = new Acc_Ledger_Sold($cn, $jrn);
+                               $tiers_side = 'd';
+                               $oth_side = 'c';
+                               break;
+                       default:
+                               die('Erreur ce type journal n\' est pas encore 
supporté');
+               }
+               /**
+                * Loop in table operation_tmp, get all the record to transfer
+                */
+               $array = $cn->get_array("select
+                                       distinct o_doli
+                               from impacc.operation_tmp
+                               where i_id=$1 and o_result='T'
+                               order by o_doli  asc", array($this->impid));
+               $nb_row = count($array);
+               bcscale(2);
+               try
+               {
+                       $cn->start();
+                       for ($i = 0; $i < $nb_row; $i++)
+                       {
+                               /*
+                                * For each operation (same o_doli code)
+                                */
+                               $adetail = $cn->get_array("select o_id from 
impacc.operation_tmp where o_doli=$1 and i_id=$2 and o_type='S'", 
array($array[$i]['o_doli'], $this->impid));
+                               $atiers = $cn->get_array("select o_id from 
impacc.operation_tmp where o_doli=$1 and i_id=$2  and o_type='T'", 
array($array[$i]['o_doli'], $this->impid));
+                               if (count($atiers) > 1)
+                               {
+                                       echo "Plusieurs clients pour l' 
opération, code " . $array[$i]['o_doli'];
+                                       continue;
+                               }
+                               if (count($atiers) == 0)
+                               {
+                                       echo "Pas de client pour une opération, 
code " . $array[$i]['o_doli'];
+                                       continue;
+                               }
+
+                               $oper_tiers = new 
Impacc_Operation_Tmp_Sql($atiers[0]['o_id']);
+                               $nb_detail = count($adetail);
+                               $sum = 0;
+                               $grpt = $cn->get_value("select 
nextval('s_grpt');");
+                               $internal = 
$ledger->compute_internal_code($grpt);
+
+                               $tva = array();
+                               /* record all S record */
+                               for ($e = 0; $e < $nb_detail; $e++)
+                               {
+                                       /* Record service */
+                                       $oper = new 
Impacc_Operation_Tmp_Sql($adetail[$e]['o_id']);
+                                       $oper->from_array($array[$i]);
+                                       $date = 
format_date($oper->getp("date"), "YYYY-MM-DD", "DD.MM.YYYY");
+                                       $oper->setp("date", $date);
+                                       $jrnx = new Acc_Operation($cn);
+                                       $jrnx->date = $date;
+                                       $amount_tva = $oper->getp("amount_vat");
+                                       $amount_tvac = 
$oper->getp("amount_total");
+                                       $jrnx->amount = bcsub($amount_tvac, 
$amount_tva);
+                                       $jrnx->poste = $oper->getp('poste');
+                                       $jrnx->grpt = $grpt;
+                                       $jrnx->type = $oth_side;
+                                       $jrnx->jrn = $jrn;
+                                       $jrnx->user = $_SESSION['g_user'];
+                                       $jrnx->periode = 0;
+                                       $jrnx->qcode = $oper->getp("qcode");
+                                       $jrnx->desc = 
mb_substr($oper->getp("desc"),0,80,'UTF8');
+                                       $id = $jrnx->insert_jrnx();
+
+                                       $transfer = new 
impacc_operation_transfer_sql();
+                                       $transfer->setp("j_id", $id);
+                                       $transfer->setp("o_id", 
$oper->getp("id"));
+                                       $transfer->insert();
+
+                                       $tva_id = $oper->getp("tva_id");
+
+                                       /*
+                                        * Save into quant_purchase or 
quant_sale
+                                        */
+                                       switch ($type)
+                                       {
+                                               case 'ACH':
+                                                       $sql = "insert into 
quant_purchase(qp_internal,j_id,qp_fiche,qp_quantite,qp_price,qp_vat,qp_vat_code,qp_supplier)
+                                                       
values($1,$2,$3,$4,$5,$6,$7,$8)";
+                                                       $cn->exec_sql($sql, 
array(null, $id, $oper->getp("fiche"), $oper->getp("number_unit"), 
$jrnx->amount, $amount_tva, $tva_id, $oper_tiers->getp("fiche")));
+                                                       break;
+                                               case 'VEN':
+                                                       $cn->exec_sql("insert 
into quant_sold
+                                        
(qs_internal,qs_fiche,qs_quantite,qs_price,qs_vat,qs_vat_code,qs_client,j_id,qs_vat_sided,qs_valid)
+                                        values
+                                        ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10)", 
array(null, /* 1 qs_internal */
+                                                               
$oper->getp("fiche"), /* 2 qs_fiche */
+                                                               
$oper->getp("number_unit"), /* 3 qs_quantite */
+                                                               $jrnx->amount, 
/* 4 qs_price */
+                                                               $amount_tva, /* 
5 qs_vat */
+                                                               $tva_id, /* 6 
qs_vat_code */
+                                                               
$oper_tiers->getp('fiche'), /* 7 qs_client */
+                                                               $id, /* 8 j_id 
*/
+                                                               0, /* 9 
qs_vat_sided */
+                                                               'Y' /* 10 
qs_valid */
+                                                       ));
+
+                                                       break;
+                                       }
+                                       /* save VAT into an array */
+                                       if (isset($tva[$tva_id]))
+                                       {
+                                               $tva[$tva_id] = 
bcadd($tva[$tva_id], $amount_tva);
+                                       }
+                                       else
+                                       {
+                                               $tva[$tva_id] = $amount_tva;
+                                       }
+                                       $sum = bcadd($sum, $amount_tvac);
+                               }  // loop e
+                               // Record the tiers
+
+                               $jtiers = new Acc_Operation($cn);
+                               $jtiers->date = $date;
+                               $jtiers->amount = $sum;
+                               $jtiers->poste = $oper_tiers->getp('poste');
+                               $jtiers->grpt = $grpt;
+                               $jtiers->type = $tiers_side;
+                               $jtiers->jrn = $jrn;
+                               $jtiers->user = $_SESSION['g_user'];
+                               $jtiers->periode = 0;
+                               $jtiers->qcode = $oper_tiers->getp("qcode");
+                               $jtiers->desc = 
mb_substr($oper_tiers->getp("desc"),0,80,'UTF8');
+                               $jtiers->insert_jrnx();
+
+                               /* Record the vat 1 */
+                               foreach ($tva as $key => $value)
+                               {
+                                       $tva = new Acc_TVA($cn, $key);
+                                       $tva->load();
+                                       $poste = $tva->get_side($oth_side);
+                                       $op_tva = new Acc_Operation($cn);
+                                       $op_tva->date = $date;
+                                       $op_tva->amount = $value;
+                                       $op_tva->poste = $poste;
+                                       $op_tva->grpt = $grpt;
+                                       $op_tva->type = $oth_side;
+                                       $op_tva->jrn = $jrn;
+                                       $op_tva->user = $_SESSION['g_user'];
+                                       $op_tva->periode = 0;
+                                       $op_tva->qcode = null;
+                                       $op_tva->desc = $tva->tva_label;
+                                       $op_tva->insert_jrnx();
+                               }
+
+                               /* record into jrn */
+                               $acc_jrn = new Acc_Operation($cn);
+                               $acc_jrn->jrn = $jrn;
+                               $acc_jrn->amount = $sum;
+                               $acc_jrn->desc = 
mb_substr($oper_tiers->getp("desc"),0,80,'UTF8');
+                               $acc_jrn->date = $date;
+                               $acc_jrn->grpt = $grpt;
+                               $acc_jrn->periode = 0;
+                               $acc_jrn->insert_jrn();
+                               $cn->exec_sql('update jrn set jr_pj_number=$1 
where jr_id=$2',array($oper->getp('pj'),$acc_jrn->jr_id));
+
+                               /* Update info */
+                               $ledger->grpt_id = $grpt;
+                               $ledger->update_internal_code($internal);
+                               /*
+                                * Update internal code in quant_*
+                                */
+                               switch ($type)
+                               {
+                                       case 'ACH':
+                                               $cn->exec_sql('update 
quant_purchase set qp_internal = $1 where j_id in (select j_id from jrnx where 
j_grpt=$2)', array($internal, $grpt));
+                                               break;
+                                       case 'VEN':
+                                               $cn->exec_sql('update 
quant_sold set qs_internal = $1 where j_id in (select j_id from jrnx where 
j_grpt=$2)', array($internal, $grpt));
+                                               break;
+                               }
+                       }// loop i
+                       $cn->commit();
+               }
+               catch (Exception $e)
+               {
+                       print_r($e->getTraceAsString());
+                       $cn->rollback();
+               }
+       }
+
+       function result_transfer()
+       {
+               require_once 'class_html_table.php';
+               global $cn, $g_failed, $g_succeed;
+               $sql = " select distinct jr_id, jr_pj,jr_date, 
jr_comment,jr_internal
+
+               from jrn
+               where jr_grpt_id in (
+               select j_grpt
+               from impacc.operation_tmp as otmp join 
impacc.operation_transfer as ot on (ot.o_id = otmp.o_id) join jrnx on 
(jrnx.j_id = ot.j_id)
+               and i_id=$1  ) order by jr_date ";
+               $arow=$cn->get_array($sql,array($this->impid));
+               echo h2("Opérations sauvées",'info');
+               echo '<table class="result">';
+               echo '<tr>';
+               echo th("Date");
+               echo th("Libellé");
+               echo th("Pièce");
+               echo th("N° opération");
+               echo '</tr>';
+               for ($i=0;$i<count($arow);$i++)
+               {
+                       echo '<tr>';
+                       echo td($arow[$i]['jr_date']);
+                       echo td($arow[$i]['jr_comment']);
+                       echo td($arow[$i]['jr_pj']);
+                       echo 
'<td>'.HtmlInput::detail_op($arow[$i]['jr_id'],$arow[$i]['jr_internal']).'</td>';
+                       echo '</tr>';
+               }
+               echo '</table>';
+       }
+
+}
+
+?>

Deleted: trunk/import_account/include/class_impdol_operation.php
===================================================================
--- trunk/import_account/include/class_impdol_operation.php     2013-01-06 
00:40:57 UTC (rev 459)
+++ trunk/import_account/include/class_impdol_operation.php     2013-01-06 
00:50:09 UTC (rev 460)
@@ -1,498 +0,0 @@
-<?php
-
-/*
- *   This file is part of PhpCompta.
- *
- *   PhpCompta is free software; you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation; either version 2 of the License, or
- *   (at your option) any later version.
- *
- *   PhpCompta is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with PhpCompta; if not, write to the Free Software
- *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-/* $Revision$ */
-
-// Copyright Author Dany De Bontridder address@hidden
-
-/**
- * @file
- * @brief
- *
- */
-require_once 'class_sql_impdol.php';
-
-class Impdol_Operation
-{
-
-       function save_file()
-       {
-               if (trim($_FILES['csv_operation']['name']) == '')
-               {
-                       alert('Pas de fichier donné');
-                       return -1;
-               }
-               $this->filename = tempnam($_ENV['TMP'], 'upload_');
-               move_uploaded_file($_FILES["csv_operation"]["tmp_name"], 
$this->filename);
-
-               $imp = new Impdol_Import_sql();
-               $imp->setp('temp_file', $this->filename);
-               $imp->setp('send_file', $_FILES['csv_operation']['name']);
-               $imp->insert();
-               $this->impid = $imp->getp("id");
-       }
-
-       function record()
-       {
-               $foperation = fopen($this->filename, 'r');
-               $this->row_count = 0;
-               $max = 0;
-               while (($row = fgetcsv($foperation, 0, ";", '"')) !== false)
-               {
-                       if (count($row) != 11)
-                       {
-                               $str_row = implode($row, ";");
-                               echo "Attention " . h($str_row) . " ne contient 
pas 11 colonnes";
-                               continue;
-                       }
-                       $r = new impdol_Operation_tmp_Sql();
-                       $r->setp('dolibarr', $row[0]);
-                       $r->setp('date', $row[1]);
-                       $r->setp('type', $row[2]);
-                       $r->setp('qcode', $row[3]);
-                       $r->setp('desc', $row[4]);
-                       $r->setp('pj', $row[5]);
-                       $r->setp('amount_unit', $row[6]);
-                       $r->setp('amount_vat', $row[7]);
-                       $r->setp('number_unit', $row[8]);
-                       $r->setp('rate', $row[9]);
-                       $r->setp('amount_total', $row[10]);
-                       $r->setp("import_id", $this->impid);
-                       $r->insert();
-                       $this->row_count++;
-               }
-               echo "Nombre de lignes enregistrées : " . $this->row_count;
-               $import = new impdol_import_sql($this->impid);
-               $import->setp("nbrow", $this->row_count);
-               $import->update();
-       }
-
-       /**
-        * Check data contained into impdol.operation_tmp. Update the column 
o_result (T = ok N no ok)
-        * Put in o_message the reason of the problem
-        */
-       function check()
-       {
-               global $cn;
-               try
-               {
-                       $cn->start();
-                       $array = $cn->get_array("select o_id from 
impdol.operation_tmp where i_id=$1 order by o_id", array($this->impid));
-                       $nb_row = count($array);
-                       for ($i = 0; $i < $nb_row; $i++)
-                       {
-                               $msg = "";
-                               $operation = new impdol_operation_tmp_sql();
-                               $operation->setp("id", $array[$i]['o_id']);
-                               $operation->load();
-                               $operation->setp("code", 'T');
-                               $dol = $operation->getp("dolibarr");
-                               /*
-                                * detect duplicate
-                                */
-                               $db = $cn->get_value("select count(*) from 
impdol.operation_tmp where o_doli=$1 and o_id in (select o_id from 
impdol.operation_transfer)", array($dol));
-                               if ($db > 0)
-                               {
-                                       $operation->setp("code", "N");
-                                       $operation->setp("message", " Opération 
déjà transférée : doublon ");
-                                       $operation->update();
-                                       continue;
-                               }
-                               if (trim($dol) == "" || isNumber($dol) == 0)
-                               {
-                                       $operation->setp("code", 'N');
-                                       $msg.=" le numéro de ligne pour 
dolibarr est invalide";
-                               }
-                               if (isDate($operation->getp("date")) == null)
-                               {
-                                       $operation->setp("code", 'N');
-                                       $msg.=" La date est invalide, format 
n'est pas JJ.MM.AAAA";
-                               }
-                               $fiche = new Fiche($cn);
-                               
$fiche->get_by_qcode(trim($operation->getp("qcode")));
-
-                               if ($fiche->id == 0)
-                               {
-                                       $operation->setp("code", 'N');
-                                       $msg.=" Cette fiche n'existe pas";
-                               }
-                               else
-                               {
-                                       $operation->setp("fiche", $fiche->id);
-                               }
-                               /**
-                                * check if card as a valid accounting
-                                */
-                               $poste = $fiche->strAttribut(ATTR_DEF_ACCOUNT);
-                               if (trim($poste) == '' || 
$cn->get_value("select count(*) from tmp_pcmn where pcm_val=$1", array($poste)) 
== 0)
-                               {
-                                       $operation->setp("code", 'N');
-                                       $msg.=" Cette fiche n'a pas de poste 
comptable valide";
-                               }
-                               $operation->setp("poste", $poste);
-                               $a = array("rate" => " Taux de TVA", 
"amount_total" => "Montant total", "number_unit" => 'Nombre d\'unité', 
"amount_vat" => "Montant TVA");
-
-                               foreach ($a as $key => $value)
-                               {
-                                       $v = $operation->getp($key);
-                                       $v = str_replace(",", ".", $v);
-
-                                       if (trim($v) != "" && isNumber($v) == 0)
-                                       {
-                                               $operation->setp("code", 'N');
-                                               $msg.=" $value n'est pas un 
nombre";
-                                               continue;
-                                       }
-
-                                       $operation->setp($key, $v);
-                               }
-
-                               if ($operation->getp("type") != "T")
-                               {
-                                       $tva_id = $cn->get_array("select tva_id 
from impdol.parameter_tva where pt_rate/100=$1", 
array($operation->getp("rate")));
-                                       if (count($tva_id) > 1)
-                                       {
-                                               $operation->setp("code", 'N');
-                                               $msg.=" Plusieurs code TVA 
correspondent à ce taux";
-                                       }
-                                       elseif (empty($tva_id))
-                                       {
-                                               $operation->setp("code", 'N');
-                                               $msg.=" Aucun code TVA ne 
correspond à ce taux";
-                                       }
-                                       else
-                                       {
-                                               $operation->setp("tva_id", 
$tva_id[0]['tva_id']);
-                                       }
-                               }
-                               // a supplier and one service at least is needed
-                               $code_op = $operation->getp("dolibarr");
-                               $nb_customer = $cn->get_value("select count(*) 
from impdol.operation_tmp where o_type='T' and o_doli=$1 and i_id=$2", 
array($code_op, $this->impid));
-                               $nb_good = $cn->get_value("select count(*) from 
impdol.operation_tmp where o_type='S' and o_doli=$1 and i_id=$2", 
array($code_op, $this->impid));
-                               if ($nb_customer == 0)
-                               {
-                                       $operation->setp("code", 'N');
-                                       $msg.=" Aucun client ou fournisseur";
-                               }
-                               if ($nb_good == 0)
-                               {
-                                       $operation->setp("code", 'N');
-                                       $msg.=" Aucune marchandise ou service";
-                               }
-
-                               // check if in a opened period
-                               $op_date = $operation->getp('date');
-                               $periode = new Periode($cn);
-                               try
-                               {
-                                       $periode->find_periode($op_date);
-                               }
-                               catch (Exception $e)
-                               {
-                                       $msg.=$e->getMessage();
-                                       $operation->setp('code', 'N');
-                               }
-
-                               $operation->setp("message", $msg);
-                               $operation->update();
-                       }
-                       /*
-                        *  If a part is N then the whole operation is N
-                        */
-                       $sql = "update impdol.operation_tmp  set o_result='N' 
where i_id=$1 and
-                               o_doli in (select o_doli from 
impdol.operation_tmp  where o_result='N' and i_id=$1)";
-                       $cn->exec_sql($sql, array($this->impid));
-                       $cn->commit();
-               }
-               catch (Exception $e)
-               {
-                       print_r($e->getTraceAsString());
-                       $cn->rollback;
-               }
-       }
-
-       /**
-        * Show the result in a table
-        */
-       function result()
-       {
-               require_once 'class_html_table.php';
-               global $cn, $g_failed, $g_succeed;
-               $sql = " select o_doli,o_date,o_qcode,o_label,o_pj,amount_unit,
-                       amount_vat,
-                       number_unit,
-                       vat_rate,
-                       amount_total,
-                       case when o_result='T' then '" . $g_succeed . "' else 
'" . $g_failed . "' end as result,
-                       o_message
-                       from impdol.operation_tmp where i_id=" . $this->impid . 
" order by o_id";
-               echo Html_Table::sql2table($cn, array(
-                       array('name' => 'n° ligne',
-                               'style' => 'style="text-align:right"'),
-                       array('name' => 'Date',
-                               'style' => 'text-align:right'),
-                       array('name' => 'QuickCode'),
-                       array('name' => 'Libellé'),
-                       array('name' => 'n° pj'),
-                       array('name' => 'Montant / unité', 'style' => 
'style="text-align:right"'),
-                       array('name' => 'Montant Total TVA', 'style' => 
'style="text-align:right"'),
-                       array('name' => 'Nbre unités', 'style' => 
'style="text-align:right"'),
-                       array('name' => 'taux TVA', 'style' => 
'style="text-align:right"'),
-                       array('name' => 'Montant total TVAC', 'style' => 
'style="text-align:right"'),
-                       array('name' => 'Transfert', 'style' => 
'style="text-align:right"', 'raw' => 1),
-                       array('name' => 'Message')
-                               )
-                               , $sql, 'style="width:100%" class="result"'
-               );
-       }
-
-       function transfer()
-       {
-               global $cn;
-               $jrn = $_POST['p_jrn'];
-               $ledger = new Acc_Ledger($cn, $jrn);
-               $type = $ledger->get_type();
-               switch ($type)
-               {
-                       case 'ACH':
-                               $ledger = new Acc_Ledger_Purchase($cn, $jrn);
-                               $tiers_side = 'c';
-                               $oth_side = 'd';
-                               break;
-                       case 'VEN':
-                               $ledger = new Acc_Ledger_Sold($cn, $jrn);
-                               $tiers_side = 'd';
-                               $oth_side = 'c';
-                               break;
-                       default:
-                               die('Erreur ce type journal n\' est pas encore 
supporté');
-               }
-               /**
-                * Loop in table operation_tmp, get all the record to transfer
-                */
-               $array = $cn->get_array("select
-                                       distinct o_doli
-                               from impdol.operation_tmp
-                               where i_id=$1 and o_result='T'
-                               order by o_doli  asc", array($this->impid));
-               $nb_row = count($array);
-               bcscale(2);
-               try
-               {
-                       $cn->start();
-                       for ($i = 0; $i < $nb_row; $i++)
-                       {
-                               /*
-                                * For each operation (same o_doli code)
-                                */
-                               $adetail = $cn->get_array("select o_id from 
impdol.operation_tmp where o_doli=$1 and i_id=$2 and o_type='S'", 
array($array[$i]['o_doli'], $this->impid));
-                               $atiers = $cn->get_array("select o_id from 
impdol.operation_tmp where o_doli=$1 and i_id=$2  and o_type='T'", 
array($array[$i]['o_doli'], $this->impid));
-                               if (count($atiers) > 1)
-                               {
-                                       echo "Plusieurs clients pour l' 
opération, code " . $array[$i]['o_doli'];
-                                       continue;
-                               }
-                               if (count($atiers) == 0)
-                               {
-                                       echo "Pas de client pour une opération, 
code " . $array[$i]['o_doli'];
-                                       continue;
-                               }
-
-                               $oper_tiers = new 
Impdol_Operation_Tmp_Sql($atiers[0]['o_id']);
-                               $nb_detail = count($adetail);
-                               $sum = 0;
-                               $grpt = $cn->get_value("select 
nextval('s_grpt');");
-                               $internal = 
$ledger->compute_internal_code($grpt);
-
-                               $tva = array();
-                               /* record all S record */
-                               for ($e = 0; $e < $nb_detail; $e++)
-                               {
-                                       /* Record service */
-                                       $oper = new 
Impdol_Operation_Tmp_Sql($adetail[$e]['o_id']);
-                                       $oper->from_array($array[$i]);
-                                       $date = 
format_date($oper->getp("date"), "YYYY-MM-DD", "DD.MM.YYYY");
-                                       $oper->setp("date", $date);
-                                       $jrnx = new Acc_Operation($cn);
-                                       $jrnx->date = $date;
-                                       $amount_tva = $oper->getp("amount_vat");
-                                       $amount_tvac = 
$oper->getp("amount_total");
-                                       $jrnx->amount = bcsub($amount_tvac, 
$amount_tva);
-                                       $jrnx->poste = $oper->getp('poste');
-                                       $jrnx->grpt = $grpt;
-                                       $jrnx->type = $oth_side;
-                                       $jrnx->jrn = $jrn;
-                                       $jrnx->user = $_SESSION['g_user'];
-                                       $jrnx->periode = 0;
-                                       $jrnx->qcode = $oper->getp("qcode");
-                                       $jrnx->desc = 
mb_substr($oper->getp("desc"),0,80,'UTF8');
-                                       $id = $jrnx->insert_jrnx();
-
-                                       $transfer = new 
impdol_operation_transfer_sql();
-                                       $transfer->setp("j_id", $id);
-                                       $transfer->setp("o_id", 
$oper->getp("id"));
-                                       $transfer->insert();
-
-                                       $tva_id = $oper->getp("tva_id");
-
-                                       /*
-                                        * Save into quant_purchase or 
quant_sale
-                                        */
-                                       switch ($type)
-                                       {
-                                               case 'ACH':
-                                                       $sql = "insert into 
quant_purchase(qp_internal,j_id,qp_fiche,qp_quantite,qp_price,qp_vat,qp_vat_code,qp_supplier)
-                                                       
values($1,$2,$3,$4,$5,$6,$7,$8)";
-                                                       $cn->exec_sql($sql, 
array(null, $id, $oper->getp("fiche"), $oper->getp("number_unit"), 
$jrnx->amount, $amount_tva, $tva_id, $oper_tiers->getp("fiche")));
-                                                       break;
-                                               case 'VEN':
-                                                       $cn->exec_sql("insert 
into quant_sold
-                                        
(qs_internal,qs_fiche,qs_quantite,qs_price,qs_vat,qs_vat_code,qs_client,j_id,qs_vat_sided,qs_valid)
-                                        values
-                                        ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10)", 
array(null, /* 1 qs_internal */
-                                                               
$oper->getp("fiche"), /* 2 qs_fiche */
-                                                               
$oper->getp("number_unit"), /* 3 qs_quantite */
-                                                               $jrnx->amount, 
/* 4 qs_price */
-                                                               $amount_tva, /* 
5 qs_vat */
-                                                               $tva_id, /* 6 
qs_vat_code */
-                                                               
$oper_tiers->getp('fiche'), /* 7 qs_client */
-                                                               $id, /* 8 j_id 
*/
-                                                               0, /* 9 
qs_vat_sided */
-                                                               'Y' /* 10 
qs_valid */
-                                                       ));
-
-                                                       break;
-                                       }
-                                       /* save VAT into an array */
-                                       if (isset($tva[$tva_id]))
-                                       {
-                                               $tva[$tva_id] = 
bcadd($tva[$tva_id], $amount_tva);
-                                       }
-                                       else
-                                       {
-                                               $tva[$tva_id] = $amount_tva;
-                                       }
-                                       $sum = bcadd($sum, $amount_tvac);
-                               }  // loop e
-                               // Record the tiers
-
-                               $jtiers = new Acc_Operation($cn);
-                               $jtiers->date = $date;
-                               $jtiers->amount = $sum;
-                               $jtiers->poste = $oper_tiers->getp('poste');
-                               $jtiers->grpt = $grpt;
-                               $jtiers->type = $tiers_side;
-                               $jtiers->jrn = $jrn;
-                               $jtiers->user = $_SESSION['g_user'];
-                               $jtiers->periode = 0;
-                               $jtiers->qcode = $oper_tiers->getp("qcode");
-                               $jtiers->desc = 
mb_substr($oper_tiers->getp("desc"),0,80,'UTF8');
-                               $jtiers->insert_jrnx();
-
-                               /* Record the vat 1 */
-                               foreach ($tva as $key => $value)
-                               {
-                                       $tva = new Acc_TVA($cn, $key);
-                                       $tva->load();
-                                       $poste = $tva->get_side($oth_side);
-                                       $op_tva = new Acc_Operation($cn);
-                                       $op_tva->date = $date;
-                                       $op_tva->amount = $value;
-                                       $op_tva->poste = $poste;
-                                       $op_tva->grpt = $grpt;
-                                       $op_tva->type = $oth_side;
-                                       $op_tva->jrn = $jrn;
-                                       $op_tva->user = $_SESSION['g_user'];
-                                       $op_tva->periode = 0;
-                                       $op_tva->qcode = null;
-                                       $op_tva->desc = $tva->tva_label;
-                                       $op_tva->insert_jrnx();
-                               }
-
-                               /* record into jrn */
-                               $acc_jrn = new Acc_Operation($cn);
-                               $acc_jrn->jrn = $jrn;
-                               $acc_jrn->amount = $sum;
-                               $acc_jrn->desc = 
mb_substr($oper_tiers->getp("desc"),0,80,'UTF8');
-                               $acc_jrn->date = $date;
-                               $acc_jrn->grpt = $grpt;
-                               $acc_jrn->periode = 0;
-                               $acc_jrn->insert_jrn();
-                               $cn->exec_sql('update jrn set jr_pj_number=$1 
where jr_id=$2',array($oper->getp('pj'),$acc_jrn->jr_id));
-
-                               /* Update info */
-                               $ledger->grpt_id = $grpt;
-                               $ledger->update_internal_code($internal);
-                               /*
-                                * Update internal code in quant_*
-                                */
-                               switch ($type)
-                               {
-                                       case 'ACH':
-                                               $cn->exec_sql('update 
quant_purchase set qp_internal = $1 where j_id in (select j_id from jrnx where 
j_grpt=$2)', array($internal, $grpt));
-                                               break;
-                                       case 'VEN':
-                                               $cn->exec_sql('update 
quant_sold set qs_internal = $1 where j_id in (select j_id from jrnx where 
j_grpt=$2)', array($internal, $grpt));
-                                               break;
-                               }
-                       }// loop i
-                       $cn->commit();
-               }
-               catch (Exception $e)
-               {
-                       print_r($e->getTraceAsString());
-                       $cn->rollback();
-               }
-       }
-
-       function result_transfer()
-       {
-               require_once 'class_html_table.php';
-               global $cn, $g_failed, $g_succeed;
-               $sql = " select distinct jr_id, jr_pj,jr_date, 
jr_comment,jr_internal
-
-               from jrn
-               where jr_grpt_id in (
-               select j_grpt
-               from impdol.operation_tmp as otmp join 
impdol.operation_transfer as ot on (ot.o_id = otmp.o_id) join jrnx on 
(jrnx.j_id = ot.j_id)
-               and i_id=$1  ) order by jr_date ";
-               $arow=$cn->get_array($sql,array($this->impid));
-               echo h2("Opérations sauvées",'info');
-               echo '<table class="result">';
-               echo '<tr>';
-               echo th("Date");
-               echo th("Libellé");
-               echo th("Pièce");
-               echo th("N° opération");
-               echo '</tr>';
-               for ($i=0;$i<count($arow);$i++)
-               {
-                       echo '<tr>';
-                       echo td($arow[$i]['jr_date']);
-                       echo td($arow[$i]['jr_comment']);
-                       echo td($arow[$i]['jr_pj']);
-                       echo 
'<td>'.HtmlInput::detail_op($arow[$i]['jr_id'],$arow[$i]['jr_internal']).'</td>';
-                       echo '</tr>';
-               }
-               echo '</table>';
-       }
-
-}
-
-?>

Copied: trunk/import_account/include/class_install_impacc.php (from rev 459, 
trunk/import_account/include/class_install_impdol.php)
===================================================================
--- trunk/import_account/include/class_install_impacc.php                       
        (rev 0)
+++ trunk/import_account/include/class_install_impacc.php       2013-01-06 
00:50:09 UTC (rev 460)
@@ -0,0 +1,131 @@
+<?php
+
+/*
+ *   This file is part of PhpCompta.
+ *
+ *   PhpCompta is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   PhpCompta is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with PhpCompta; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+/* $Revision$ */
+
+// Copyright Author Dany De Bontridder address@hidden
+
+/**
+ * @file
+ * @brief
+ *
+ */
+class install_impacc
+{
+
+       function install($p_cn)
+       {
+               try
+               {
+                       $p_cn->start();
+                       $p_cn->exec_sql("create schema impacc");
+                       $p_cn->exec_sql("
+                       create table impacc.version (
+                               v_id bigint primary key,
+                               v_date date default now(),
+                               v_text text
+                       )
+                               ");
+                       $p_cn->exec_sql("insert into 
impacc.version(v_id,v_text) values ($1,$2)", array(1, "Installation"));
+
+                       $p_cn->exec_sql("
+                               CREATE TABLE impacc.import
+                                       (
+                                       i_id serial NOT NULL,
+                                       temp_file text,
+                                       send_file text,
+                                       i_date timestamp with time zone DEFAULT 
now(),
+                                       i_row bigint,
+                                       CONSTRAINT import_pkey PRIMARY KEY 
(i_id )
+                                       )");
+
+                       $p_cn->exec_sql('
+                       CREATE TABLE impacc.parameter_tva
+                               (
+                                       pt_id serial NOT NULL,
+                                       tva_id bigint,
+                                       pt_rate numeric(20,4) DEFAULT 0,
+                                       CONSTRAINT parameter_tva_pkey PRIMARY 
KEY (pt_id )
+                                       )
+                       ');
+                       $p_cn->exec_sql("
+                       CREATE TABLE impacc.operation_tmp
+                                       (
+                                       o_id bigserial NOT NULL,
+                                       o_doli text,
+                                       o_date text,
+                                       o_qcode text,
+                                       f_id text,
+                                       o_label text,
+                                       o_pj text,
+                                       amount_unit text,
+                                       amount_vat text,
+                                       number_unit text,
+                                       vat_rate text,
+                                       amount_total text,
+                                       jrn_def_id text,
+                                       o_message text,
+                                       i_id bigint,
+                                       o_result char,
+                                       tva_id bigint,
+                                       o_type char,
+                                       o_poste text,
+                                       CONSTRAINT operation_tmp_pkey PRIMARY 
KEY (o_id ),
+                                       CONSTRAINT operation_tmp_i_id_fkey 
FOREIGN KEY (i_id)
+                                               REFERENCES impacc.import (i_id) 
MATCH SIMPLE
+                                               ON UPDATE CASCADE ON DELETE 
CASCADE
+                                       )
+                       ");
+
+                       $p_cn->exec_sql("
+                       CREATE TABLE impacc.operation_transfer
+                               (
+                               ot_id serial NOT NULL,
+                               j_id bigint,
+                               o_id bigint,
+                               CONSTRAINT operation_transfer_pkey PRIMARY KEY 
(ot_id ),
+                               CONSTRAINT operation_transfer_j_id_fkey FOREIGN 
KEY (j_id)
+                                       REFERENCES jrnx (j_id) MATCH SIMPLE
+                                       ON UPDATE CASCADE ON DELETE CASCADE,
+                               CONSTRAINT operation_transfer_o_id_fkey FOREIGN 
KEY (o_id)
+                                       REFERENCES impacc.operation_tmp (o_id) 
MATCH SIMPLE
+                                       ON UPDATE CASCADE ON DELETE CASCADE
+                               )");
+
+
+
+                       $p_cn->exec_sql("
+                       COMMENT ON COLUMN impacc.operation_tmp.o_result IS 
'result is T can be transferrable, N cannot be transferrable';
+                       ");
+
+                       $p_cn->exec_sql("
+                       COMMENT ON COLUMN impacc.operation_tmp.o_type IS 'S = 
marchandise, serviceT = tiers (fournisseurs, client)'
+                       ");
+                       $p_cn->commit();
+               }
+               catch (Exception $e)
+               {
+                       $p_cn->rollback();
+                       print_r($e->getTraceAsString());
+               }
+       }
+
+}
+
+?>

Deleted: trunk/import_account/include/class_install_impdol.php
===================================================================
--- trunk/import_account/include/class_install_impdol.php       2013-01-06 
00:40:57 UTC (rev 459)
+++ trunk/import_account/include/class_install_impdol.php       2013-01-06 
00:50:09 UTC (rev 460)
@@ -1,131 +0,0 @@
-<?php
-
-/*
- *   This file is part of PhpCompta.
- *
- *   PhpCompta is free software; you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation; either version 2 of the License, or
- *   (at your option) any later version.
- *
- *   PhpCompta is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with PhpCompta; if not, write to the Free Software
- *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-/* $Revision$ */
-
-// Copyright Author Dany De Bontridder address@hidden
-
-/**
- * @file
- * @brief
- *
- */
-class install_impdol
-{
-
-       function install($p_cn)
-       {
-               try
-               {
-                       $p_cn->start();
-                       $p_cn->exec_sql("create schema impdol");
-                       $p_cn->exec_sql("
-                       create table impdol.version (
-                               v_id bigint primary key,
-                               v_date date default now(),
-                               v_text text
-                       )
-                               ");
-                       $p_cn->exec_sql("insert into 
impdol.version(v_id,v_text) values ($1,$2)", array(1, "Installation"));
-
-                       $p_cn->exec_sql("
-                               CREATE TABLE impdol.import
-                                       (
-                                       i_id serial NOT NULL,
-                                       temp_file text,
-                                       send_file text,
-                                       i_date timestamp with time zone DEFAULT 
now(),
-                                       i_row bigint,
-                                       CONSTRAINT import_pkey PRIMARY KEY 
(i_id )
-                                       )");
-
-                       $p_cn->exec_sql('
-                       CREATE TABLE impdol.parameter_tva
-                               (
-                                       pt_id serial NOT NULL,
-                                       tva_id bigint,
-                                       pt_rate numeric(20,4) DEFAULT 0,
-                                       CONSTRAINT parameter_tva_pkey PRIMARY 
KEY (pt_id )
-                                       )
-                       ');
-                       $p_cn->exec_sql("
-                       CREATE TABLE impdol.operation_tmp
-                                       (
-                                       o_id bigserial NOT NULL,
-                                       o_doli text,
-                                       o_date text,
-                                       o_qcode text,
-                                       f_id text,
-                                       o_label text,
-                                       o_pj text,
-                                       amount_unit text,
-                                       amount_vat text,
-                                       number_unit text,
-                                       vat_rate text,
-                                       amount_total text,
-                                       jrn_def_id text,
-                                       o_message text,
-                                       i_id bigint,
-                                       o_result char,
-                                       tva_id bigint,
-                                       o_type char,
-                                       o_poste text,
-                                       CONSTRAINT operation_tmp_pkey PRIMARY 
KEY (o_id ),
-                                       CONSTRAINT operation_tmp_i_id_fkey 
FOREIGN KEY (i_id)
-                                               REFERENCES impdol.import (i_id) 
MATCH SIMPLE
-                                               ON UPDATE CASCADE ON DELETE 
CASCADE
-                                       )
-                       ");
-
-                       $p_cn->exec_sql("
-                       CREATE TABLE impdol.operation_transfer
-                               (
-                               ot_id serial NOT NULL,
-                               j_id bigint,
-                               o_id bigint,
-                               CONSTRAINT operation_transfer_pkey PRIMARY KEY 
(ot_id ),
-                               CONSTRAINT operation_transfer_j_id_fkey FOREIGN 
KEY (j_id)
-                                       REFERENCES jrnx (j_id) MATCH SIMPLE
-                                       ON UPDATE CASCADE ON DELETE CASCADE,
-                               CONSTRAINT operation_transfer_o_id_fkey FOREIGN 
KEY (o_id)
-                                       REFERENCES impdol.operation_tmp (o_id) 
MATCH SIMPLE
-                                       ON UPDATE CASCADE ON DELETE CASCADE
-                               )");
-
-
-
-                       $p_cn->exec_sql("
-                       COMMENT ON COLUMN impdol.operation_tmp.o_result IS 
'result is T can be transferrable, N cannot be transferrable';
-                       ");
-
-                       $p_cn->exec_sql("
-                       COMMENT ON COLUMN impdol.operation_tmp.o_type IS 'S = 
marchandise, serviceT = tiers (fournisseurs, client)'
-                       ");
-                       $p_cn->commit();
-               }
-               catch (Exception $e)
-               {
-                       $p_cn->rollback();
-                       print_r($e->getTraceAsString());
-               }
-       }
-
-}
-
-?>

Copied: trunk/import_account/include/class_sql_impacc.php (from rev 459, 
trunk/import_account/include/class_sql_impdol.php)
===================================================================
--- trunk/import_account/include/class_sql_impacc.php                           
(rev 0)
+++ trunk/import_account/include/class_sql_impacc.php   2013-01-06 00:50:09 UTC 
(rev 460)
@@ -0,0 +1,366 @@
+<?php
+
+class Sql_Impacc
+{
+
+       function __construct($p_cn, $p_id = -1)
+       {
+               $this->cn = $p_cn;
+               $pk=$this->primary_key;
+               $this->$pk= $p_id;
+
+               if ($p_id == -1)
+               {
+                       /* Initialize an empty object */
+                       foreach ($this->name as $key )
+                       {
+                               $this->$key= null;
+                       }
+                       $this->$pk= $p_id;
+               }
+               else
+               {
+                       /* load it */
+                       $this->load();
+               }
+       }
+
+       public function getp($p_string)
+       {
+               if (array_key_exists( $p_string,$this->name))
+               {
+                       $idx = $this->name[$p_string];
+                       return $this->$idx;
+               }
+               else
+                       throw new Exception(__FILE__ . ":" . __LINE__ . 
$p_string . 'Erreur attribut inexistant '.$p_string);
+       }
+
+       public function setp($p_string, $p_value)
+       {
+               if (array_key_exists( $p_string,$this->name))
+               {
+                       $idx = $this->name[$p_string];
+                       $this->$idx = $p_value;
+               }
+               else
+                       throw new Exception(__FILE__ . ":" . __LINE__ . 
$p_string . 'Erreur attribut inexistant '.$p_string);
+       }
+
+       public function insert()
+       {
+               $this->verify();
+               $sql = "insert into " . $this->table . " ( ";
+               $sep = "";
+               $par = "";
+               $idx = 1;
+               $array = array();
+               foreach ($this->name as $key=>$value)
+               {
+                       if (isset($this->default[$value]) && 
$this->default[$value] == "auto" && $this->$value ==null )
+                               continue;
+                       if ( $value==$this->primary_key && $this->$value == -1 
) continue;
+                       $sql.=$sep.$value;
+                       switch ($this->type[$value])
+                       {
+                               case "date":
+                                       $par .=$sep. 'to_date($' . $idx . ",'" 
. $this->date_format . "')" ;
+                                       break;
+                               default:
+                                       $par .= $sep."$" . $idx ;
+                       }
+
+                       $array[] = $this->$value;
+                       $sep = ",";
+                       $idx++;
+               }
+               $sql.=") values (" . $par . ") returning " . $this->primary_key;
+               $pk=$this->primary_key;
+               $this->$pk = $this->cn->get_value($sql, $array);
+       }
+
+       public function delete()
+       {
+               $pk=$this->primary_key;
+               $sql = " delete from " . $this->table . " where " . 
$this->primary_key . "=" . sql_string($this->$pk);
+               $this->cn->exec_sql($sql);
+       }
+
+       public function update()
+       {
+               $this->verify();
+               $pk=$this->primary_key;
+               $sql = "update " . $this->table . "  ";
+               $sep = "";
+               $idx = 1;
+               $array = array();
+               $set=" set ";
+               foreach ($this->name as $key=>$value)
+               {
+                       if (isset($this->default[$value]) && 
$this->default[$value] == "auto"  )
+                               continue;
+                       switch ($this->type[$value])
+                       {
+                               case "date":
+                                       $par =$value. '=to_date($' . $idx . 
",'" . $this->date_format . "')" ;
+                                       break;
+                               default:
+                                       $par = $value."= $" . $idx ;
+                       }
+                       $sql.=$sep." $set " . $par ;
+                       $array[] = $this->$value;
+                       $sep = ",";$set="";$idx++;
+               }
+               $sql.=" where " . $this->primary_key . " =" . $this->$pk;
+           $this->cn->exec_sql($sql, $array);
+
+       }
+
+       public function load()
+       {
+               $sql = " select ";
+               $sep="";$par="";
+
+               foreach ($this->name as $key)
+               {
+
+                       switch ($this->type[$key])
+                       {
+                               case "date":
+                                       $sql .= $sep.'to_char(' . $key . ",'" . 
$this->date_format . "') as ".$key ;
+                                       break;
+                               default:
+                                       $sql.=$sep.$key ;
+                       }
+                       $sep = ",";
+               }
+               $pk=$this->primary_key;
+               $sql.=" from ".$this->table;
+               $sql.=" where " . $this->primary_key . " = " . $this->$pk;
+               $result = $this->cn->get_array($sql);
+               if ($this->cn->count() == 0 ) {
+                       $this->$pk=-1;
+                       return;
+               }
+
+               foreach ($result[0] as $key=>$value) {
+                       $this->$key=$value;
+               }
+       }
+
+       public function get_info()
+       {
+               return var_export($this, true);
+       }
+
+       public function verify()
+       {
+               foreach($this->name as $key){
+                       if ( trim($this->$key)=='') $this->$key=null;
+               }
+               return 0;
+       }
+       public function from_array($p_array)
+       {
+               foreach ($this->name as $key=>$value)
+               {
+                       if ( isset ($p_array[$value]))
+                       {
+                               $this->$value=$p_array[$value];
+                       }
+               }
+       }
+       public function next($ret,$i) {
+               global $cn;
+               $array=$this->cn->fetch_array($ret,$i);
+               $this->from_array($array);
+       }
+
+}
+
+class impacc_operation_sql extends sql_impacc
+{
+
+       function __construct($p_id=-1)
+       {
+               $this->table = "impacc.operation";
+               $this->primary_key = "o_id";
+
+               $this->name=array(
+                       "id"=>"o_id",
+                       "dolibarr"=>"o_doli",
+                       "date"=>"o_date",
+                       "qcode"=>"o_qcode",
+                       "fiche"=>"f_id",
+                       "desc"=>"o_label",
+                       "pj"=>"o_pj",
+                       "amount_unit"=>"amount_unit",
+                       "amount_vat"=>"amount_vat",
+                       "number_unit"=>"number_unit",
+                       "rate"=>"vat_rate",
+                       "amount_total"=>"amount_total",
+                       "jrn_def_id"=>"jrn_def_id",
+                       "o_message"=>"o_message",
+                       "import_id"=>"i_id",
+                       "status"=>"o_status"
+
+               );
+
+               $this->type = array(
+                       "o_id"=>"numeric",
+                       "o_doli"=>"numeric",
+                       "o_date"=>"date",
+                       "o_qcode"=>"text",
+                       "f_id"=>"numeric",
+                       "o_label"=>"text",
+                       "o_pj"=>"text",
+                       "amount_unit"=>"numeric",
+                       "amount_vat"=>"numeric",
+                       "number_unit"=>"numeric",
+                       "vat_rate"=>"numeric",
+                       "amount_total"=>"numeric",
+                       "jrn_def_id"=>"numeric",
+                       "o_message"=>"text",
+                       "i_id"=>"numeric",
+                       "o_status"=>"text"
+                       );
+
+               $this->default = array(
+                       "o_id" => "auto",
+               );
+               $this->date_format = "DD.MM.YYYY";
+               global $cn;
+
+               parent::__construct($cn,$p_id);
+       }
+
+}
+
+class impacc_operation_tmp_sql extends sql_impacc
+{
+
+       function __construct($p_id=-1)
+       {
+               $this->table = "impacc.operation_tmp";
+               $this->primary_key = "o_id";
+
+               $this->name=array(
+                       "id"=>"o_id",
+                       "dolibarr"=>"o_doli",
+                       "date"=>"o_date",
+                       "qcode"=>"o_qcode",
+                       "fiche"=>"f_id",
+                       "desc"=>"o_label",
+                       "pj"=>"o_pj",
+                       "amount_unit"=>"amount_unit",
+                       "amount_vat"=>"amount_vat",
+                       "number_unit"=>"number_unit",
+                       "rate"=>"vat_rate",
+                       "amount_total"=>"amount_total",
+                       "jrn_def_id"=>"jrn_def_id",
+                       "message"=>"o_message",
+                       "import_id"=>"i_id",
+                       "code"=>"o_result",
+                       "tva_id"=>"tva_id",
+                       "type"=>"o_type",
+                       "poste"=>"o_poste"
+
+               );
+
+               $this->type = array(
+                       "o_id"=>"numeric",
+                       "o_doli"=>"text",
+                       "o_date"=>"text",
+                       "o_qcode"=>"text",
+                       "f_id"=>"text",
+                       "o_label"=>"text",
+                       "o_pj"=>"text",
+                       "amount_unit"=>"text",
+                       "amount_vat"=>"text",
+                       "number_unit"=>"text",
+                       "vat_rate"=>"text",
+                       "amount_total"=>"text",
+                       "jrn_def_id"=>"text",
+                       "o_message"=>"text",
+                       "i_id"=>"numeric",
+                       "o_result"=>'text',
+                       "tva_id"=>'numeric',
+                       "o_type"=>'text',
+                       "o_poste"=>"text"
+                       );
+
+               $this->default = array(
+                       "o_id" => "auto",
+               );
+               $this->date_format = "DD.MM.YYYY";
+               global $cn;
+
+               parent::__construct($cn,$p_id);
+       }
+
+}
+
+class impacc_import_sql extends sql_impacc
+{
+       function __construct($p_id=-1)
+       {
+               $this->table = "impacc.import";
+               $this->primary_key = "i_id";
+
+               $this->name=array(
+                       "id"=>"i_id",
+                       "send_file"=>"send_file",
+                       "temp_file"=>"temp_file",
+                       "date"=>"i_date",
+                       "nbrow"=>"i_row"
+               );
+
+               $this->type = array(
+                       "i_id"=>"numeric",
+                       "send_file"=>"text",
+                       "temp_file"=>"text",
+                       "i_date"=>"date",
+                       "i_row"=>"numeric"
+                       );
+
+               $this->default = array(
+                       "i_id" => "auto",
+                       "i_date" => "auto"
+               );
+               $this->date_format = "DD.MM.YYYY";
+               global $cn;
+
+               parent::__construct($cn,$p_id);
+       }
+}
+
+
+class impacc_operation_transfer_sql extends sql_impacc
+{
+       function __construct($p_id=-1)
+       {
+               $this->table = "impacc.operation_transfer";
+               $this->primary_key = "ot_id";
+
+               $this->name=array(
+                       "id"=>"ot_id",
+                       "j_id"=>"j_id",
+                       "o_id"=>"o_id"
+               );
+
+               $this->type = array(
+                       "ot_id"=>'numeric',
+                       "j_id"=>'numeric',
+                       "o_id"=>'numeric',
+                       );
+
+               $this->default = array(
+                       "i_id" => "auto"
+               );
+               $this->date_format = "DD.MM.YYYY";
+               global $cn;
+
+               parent::__construct($cn,$p_id);
+       }
+}
+?>
\ No newline at end of file

Deleted: trunk/import_account/include/class_sql_impdol.php
===================================================================
--- trunk/import_account/include/class_sql_impdol.php   2013-01-06 00:40:57 UTC 
(rev 459)
+++ trunk/import_account/include/class_sql_impdol.php   2013-01-06 00:50:09 UTC 
(rev 460)
@@ -1,366 +0,0 @@
-<?php
-
-class sql_impdol
-{
-
-       function __construct($p_cn, $p_id = -1)
-       {
-               $this->cn = $p_cn;
-               $pk=$this->primary_key;
-               $this->$pk= $p_id;
-
-               if ($p_id == -1)
-               {
-                       /* Initialize an empty object */
-                       foreach ($this->name as $key )
-                       {
-                               $this->$key= null;
-                       }
-                       $this->$pk= $p_id;
-               }
-               else
-               {
-                       /* load it */
-                       $this->load();
-               }
-       }
-
-       public function getp($p_string)
-       {
-               if (array_key_exists( $p_string,$this->name))
-               {
-                       $idx = $this->name[$p_string];
-                       return $this->$idx;
-               }
-               else
-                       throw new Exception(__FILE__ . ":" . __LINE__ . 
$p_string . 'Erreur attribut inexistant '.$p_string);
-       }
-
-       public function setp($p_string, $p_value)
-       {
-               if (array_key_exists( $p_string,$this->name))
-               {
-                       $idx = $this->name[$p_string];
-                       $this->$idx = $p_value;
-               }
-               else
-                       throw new Exception(__FILE__ . ":" . __LINE__ . 
$p_string . 'Erreur attribut inexistant '.$p_string);
-       }
-
-       public function insert()
-       {
-               $this->verify();
-               $sql = "insert into " . $this->table . " ( ";
-               $sep = "";
-               $par = "";
-               $idx = 1;
-               $array = array();
-               foreach ($this->name as $key=>$value)
-               {
-                       if (isset($this->default[$value]) && 
$this->default[$value] == "auto" && $this->$value ==null )
-                               continue;
-                       if ( $value==$this->primary_key && $this->$value == -1 
) continue;
-                       $sql.=$sep.$value;
-                       switch ($this->type[$value])
-                       {
-                               case "date":
-                                       $par .=$sep. 'to_date($' . $idx . ",'" 
. $this->date_format . "')" ;
-                                       break;
-                               default:
-                                       $par .= $sep."$" . $idx ;
-                       }
-
-                       $array[] = $this->$value;
-                       $sep = ",";
-                       $idx++;
-               }
-               $sql.=") values (" . $par . ") returning " . $this->primary_key;
-               $pk=$this->primary_key;
-               $this->$pk = $this->cn->get_value($sql, $array);
-       }
-
-       public function delete()
-       {
-               $pk=$this->primary_key;
-               $sql = " delete from " . $this->table . " where " . 
$this->primary_key . "=" . sql_string($this->$pk);
-               $this->cn->exec_sql($sql);
-       }
-
-       public function update()
-       {
-               $this->verify();
-               $pk=$this->primary_key;
-               $sql = "update " . $this->table . "  ";
-               $sep = "";
-               $idx = 1;
-               $array = array();
-               $set=" set ";
-               foreach ($this->name as $key=>$value)
-               {
-                       if (isset($this->default[$value]) && 
$this->default[$value] == "auto"  )
-                               continue;
-                       switch ($this->type[$value])
-                       {
-                               case "date":
-                                       $par =$value. '=to_date($' . $idx . 
",'" . $this->date_format . "')" ;
-                                       break;
-                               default:
-                                       $par = $value."= $" . $idx ;
-                       }
-                       $sql.=$sep." $set " . $par ;
-                       $array[] = $this->$value;
-                       $sep = ",";$set="";$idx++;
-               }
-               $sql.=" where " . $this->primary_key . " =" . $this->$pk;
-           $this->cn->exec_sql($sql, $array);
-
-       }
-
-       public function load()
-       {
-               $sql = " select ";
-               $sep="";$par="";
-
-               foreach ($this->name as $key)
-               {
-
-                       switch ($this->type[$key])
-                       {
-                               case "date":
-                                       $sql .= $sep.'to_char(' . $key . ",'" . 
$this->date_format . "') as ".$key ;
-                                       break;
-                               default:
-                                       $sql.=$sep.$key ;
-                       }
-                       $sep = ",";
-               }
-               $pk=$this->primary_key;
-               $sql.=" from ".$this->table;
-               $sql.=" where " . $this->primary_key . " = " . $this->$pk;
-               $result = $this->cn->get_array($sql);
-               if ($this->cn->count() == 0 ) {
-                       $this->$pk=-1;
-                       return;
-               }
-
-               foreach ($result[0] as $key=>$value) {
-                       $this->$key=$value;
-               }
-       }
-
-       public function get_info()
-       {
-               return var_export($this, true);
-       }
-
-       public function verify()
-       {
-               foreach($this->name as $key){
-                       if ( trim($this->$key)=='') $this->$key=null;
-               }
-               return 0;
-       }
-       public function from_array($p_array)
-       {
-               foreach ($this->name as $key=>$value)
-               {
-                       if ( isset ($p_array[$value]))
-                       {
-                               $this->$value=$p_array[$value];
-                       }
-               }
-       }
-       public function next($ret,$i) {
-               global $cn;
-               $array=$this->cn->fetch_array($ret,$i);
-               $this->from_array($array);
-       }
-
-}
-
-class impdol_operation_sql extends sql_impdol
-{
-
-       function __construct($p_id=-1)
-       {
-               $this->table = "impdol.operation";
-               $this->primary_key = "o_id";
-
-               $this->name=array(
-                       "id"=>"o_id",
-                       "dolibarr"=>"o_doli",
-                       "date"=>"o_date",
-                       "qcode"=>"o_qcode",
-                       "fiche"=>"f_id",
-                       "desc"=>"o_label",
-                       "pj"=>"o_pj",
-                       "amount_unit"=>"amount_unit",
-                       "amount_vat"=>"amount_vat",
-                       "number_unit"=>"number_unit",
-                       "rate"=>"vat_rate",
-                       "amount_total"=>"amount_total",
-                       "jrn_def_id"=>"jrn_def_id",
-                       "o_message"=>"o_message",
-                       "import_id"=>"i_id",
-                       "status"=>"o_status"
-
-               );
-
-               $this->type = array(
-                       "o_id"=>"numeric",
-                       "o_doli"=>"numeric",
-                       "o_date"=>"date",
-                       "o_qcode"=>"text",
-                       "f_id"=>"numeric",
-                       "o_label"=>"text",
-                       "o_pj"=>"text",
-                       "amount_unit"=>"numeric",
-                       "amount_vat"=>"numeric",
-                       "number_unit"=>"numeric",
-                       "vat_rate"=>"numeric",
-                       "amount_total"=>"numeric",
-                       "jrn_def_id"=>"numeric",
-                       "o_message"=>"text",
-                       "i_id"=>"numeric",
-                       "o_status"=>"text"
-                       );
-
-               $this->default = array(
-                       "o_id" => "auto",
-               );
-               $this->date_format = "DD.MM.YYYY";
-               global $cn;
-
-               parent::__construct($cn,$p_id);
-       }
-
-}
-
-class impdol_operation_tmp_sql extends sql_impdol
-{
-
-       function __construct($p_id=-1)
-       {
-               $this->table = "impdol.operation_tmp";
-               $this->primary_key = "o_id";
-
-               $this->name=array(
-                       "id"=>"o_id",
-                       "dolibarr"=>"o_doli",
-                       "date"=>"o_date",
-                       "qcode"=>"o_qcode",
-                       "fiche"=>"f_id",
-                       "desc"=>"o_label",
-                       "pj"=>"o_pj",
-                       "amount_unit"=>"amount_unit",
-                       "amount_vat"=>"amount_vat",
-                       "number_unit"=>"number_unit",
-                       "rate"=>"vat_rate",
-                       "amount_total"=>"amount_total",
-                       "jrn_def_id"=>"jrn_def_id",
-                       "message"=>"o_message",
-                       "import_id"=>"i_id",
-                       "code"=>"o_result",
-                       "tva_id"=>"tva_id",
-                       "type"=>"o_type",
-                       "poste"=>"o_poste"
-
-               );
-
-               $this->type = array(
-                       "o_id"=>"numeric",
-                       "o_doli"=>"text",
-                       "o_date"=>"text",
-                       "o_qcode"=>"text",
-                       "f_id"=>"text",
-                       "o_label"=>"text",
-                       "o_pj"=>"text",
-                       "amount_unit"=>"text",
-                       "amount_vat"=>"text",
-                       "number_unit"=>"text",
-                       "vat_rate"=>"text",
-                       "amount_total"=>"text",
-                       "jrn_def_id"=>"text",
-                       "o_message"=>"text",
-                       "i_id"=>"numeric",
-                       "o_result"=>'text',
-                       "tva_id"=>'numeric',
-                       "o_type"=>'text',
-                       "o_poste"=>"text"
-                       );
-
-               $this->default = array(
-                       "o_id" => "auto",
-               );
-               $this->date_format = "DD.MM.YYYY";
-               global $cn;
-
-               parent::__construct($cn,$p_id);
-       }
-
-}
-
-class impdol_import_sql extends sql_impdol
-{
-       function __construct($p_id=-1)
-       {
-               $this->table = "impdol.import";
-               $this->primary_key = "i_id";
-
-               $this->name=array(
-                       "id"=>"i_id",
-                       "send_file"=>"send_file",
-                       "temp_file"=>"temp_file",
-                       "date"=>"i_date",
-                       "nbrow"=>"i_row"
-               );
-
-               $this->type = array(
-                       "i_id"=>"numeric",
-                       "send_file"=>"text",
-                       "temp_file"=>"text",
-                       "i_date"=>"date",
-                       "i_row"=>"numeric"
-                       );
-
-               $this->default = array(
-                       "i_id" => "auto",
-                       "i_date" => "auto"
-               );
-               $this->date_format = "DD.MM.YYYY";
-               global $cn;
-
-               parent::__construct($cn,$p_id);
-       }
-}
-
-
-class impdol_operation_transfer_sql extends sql_impdol
-{
-       function __construct($p_id=-1)
-       {
-               $this->table = "impdol.operation_transfer";
-               $this->primary_key = "ot_id";
-
-               $this->name=array(
-                       "id"=>"ot_id",
-                       "j_id"=>"j_id",
-                       "o_id"=>"o_id"
-               );
-
-               $this->type = array(
-                       "ot_id"=>'numeric',
-                       "j_id"=>'numeric',
-                       "o_id"=>'numeric',
-                       );
-
-               $this->default = array(
-                       "i_id" => "auto"
-               );
-               $this->date_format = "DD.MM.YYYY";
-               global $cn;
-
-               parent::__construct($cn,$p_id);
-       }
-}
-?>
\ No newline at end of file

Modified: trunk/import_account/include/imd_operation.inc.php
===================================================================
--- trunk/import_account/include/imd_operation.inc.php  2013-01-06 00:40:57 UTC 
(rev 459)
+++ trunk/import_account/include/imd_operation.inc.php  2013-01-06 00:50:09 UTC 
(rev 460)
@@ -26,7 +26,7 @@
  * @brief upload operation
  *
  */
-require_once 'class_impdol_operation.php';
+require_once 'class_impacc_operation.php';
 
 // step 1, select a file
 if ( ! isset ($_POST['upload']) && ! isset ($_POST['check']) && ! 
isset($_POST['transfer']))
@@ -39,7 +39,7 @@
 if ( isset ($_POST['upload']))
 {
        // save the file
-       $io=new Impdol_Operation();
+       $io=new Impacc_Operation();
        $io->save_file();
 
        // record the file into the table operation

Modified: trunk/import_account/index.php
===================================================================
--- trunk/import_account/index.php      2013-01-06 00:40:57 UTC (rev 459)
+++ trunk/import_account/index.php      2013-01-06 00:50:09 UTC (rev 460)
@@ -44,7 +44,7 @@
 
 // Javascript
  ob_start();
- require_once('impdol.js');
+ require_once('impacc.js');
 $j=ob_get_contents();
 ob_end_clean();
 echo create_script($j);
@@ -75,9 +75,9 @@
     $default=0;
   }
 
-  if ($cn->exist_schema('impdol') == false)
+  if ($cn->exist_schema('impacc') == false)
   {
-    require_once('include/class_install_impdol.php');
+    require_once('include/class_install_impacc.php');
 
     $iplugn=new Install_Impdol();
     $iplugn->install($cn);



---
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]