From MAILER-DAEMON Thu Jan 03 15:24:23 2013
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1TqrKx-0004xL-EA
	for mharc-phpcompta-dev@gnu.org; Thu, 03 Jan 2013 15:24:23 -0500
To: phpcompta-dev@nongnu.org
Content-Type: text/plain; charset=UTF-8
Date: Thu,  3 Jan 2013 21:15:42 +0100 (CET)
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 91.121.80.190
Message-ID: <mailman.989265.1357244662.854.phpcompta-dev@nongnu.org>
From: phpcompta-dev@nongnu.org
Subject: [Phpcompta-dev] r5170 - phpcompta/tags/rel650/include
X-BeenThere: phpcompta-dev@nongnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: phpcompta-dev@nongnu.org
List-Id: <phpcompta-dev.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/phpcompta-dev>,
	<mailto:phpcompta-dev-request@nongnu.org?subject=unsubscribe>
List-Archive: <http://lists.nongnu.org/archive/html/phpcompta-dev>
List-Post: <mailto:phpcompta-dev@nongnu.org>
List-Help: <mailto:phpcompta-dev-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/phpcompta-dev>,
	<mailto:phpcompta-dev-request@nongnu.org?subject=subscribe>
X-List-Received-Date: Thu, 03 Jan 2013 20:24:22 -0000

Author: danydb
Date: 2013-01-03 21:15:40 +0100 (Thu, 03 Jan 2013)
New Revision: 5170

Modified:
   phpcompta/tags/rel650/include/class_fiche.php
Log:
0000773: Bug sur fiches avec double postes comptables

Modified: phpcompta/tags/rel650/include/class_fiche.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- phpcompta/tags/rel650/include/class_fiche.php	2012-12-14 18:58:23 UTC=
 (rev 5169)
+++ phpcompta/tags/rel650/include/class_fiche.php	2013-01-03 20:15:40 UTC=
 (rev 5170)
@@ -780,7 +780,19 @@
=20
                         if ( strlen(trim($v)) !=3D 0)
                         {
-							$v=3D$this->cn->get_value("select format_account($1)",array($valu=
e));
+							if( strpos($value,',')=3D=3D0)
+							{
+								$v=3D$this->cn->get_value("select format_account($1)",array($val=
ue));
+							} else {
+								$ac_array =3D explode(",", $value);
+								if (count($ac_array) <> 2)
+									throw new Exception('D=C3=A9sol=C3=A9, il y a trop de virgule d=
ans le poste comptable ' . h($value));
+								$part1 =3D $ac_array[0];
+								$part2 =3D $ac_array[1];
+								$part1 =3D $this->cn->get_value('select format_account($1)', arr=
ay($part1));
+								$part2 =3D $this->cn->get_value('select format_account($1)', arr=
ay($part2));
+								$v =3D $part1 . ',' . $part2;
+							}
                             $parameter=3Darray($this->id,$v);
                         }
                         else



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


From MAILER-DAEMON Sat Jan 05 19:49:16 2013
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1TreQO-0005hF-9z
	for mharc-phpcompta-dev@gnu.org; Sat, 05 Jan 2013 19:49:16 -0500
To: phpcompta-dev@nongnu.org
Content-Type: text/plain; charset=UTF-8
Date: Sun,  6 Jan 2013 01:40:24 +0100 (CET)
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 91.121.80.190
Message-ID: <mailman.992663.1357433355.854.phpcompta-dev@nongnu.org>
From: phpcompta-dev@nongnu.org
Subject: [Phpcompta-dev] r458 - in trunk: . rapport_avance
	rapport_avance/doc rapport_avance/include rapport_avance/sql
X-BeenThere: phpcompta-dev@nongnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: phpcompta-dev@nongnu.org
List-Id: <phpcompta-dev.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/phpcompta-dev>,
	<mailto:phpcompta-dev-request@nongnu.org?subject=unsubscribe>
List-Archive: <http://lists.nongnu.org/archive/html/phpcompta-dev>
List-Post: <mailto:phpcompta-dev@nongnu.org>
List-Help: <mailto:phpcompta-dev-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/phpcompta-dev>,
	<mailto:phpcompta-dev-request@nongnu.org?subject=subscribe>
X-List-Received-Date: Sun, 06 Jan 2013 00:49:15 -0000

Author: danydb
Date: 2013-01-06 01:40:23 +0100 (Sun, 06 Jan 2013)
New Revision: 458

Added:
   trunk/rapport_avance/doc/rapav.odt
   trunk/rapport_avance/sql/upgrade2.sql
Removed:
   trunk/rapport_avance/class_ext_list_assujetti.php
   trunk/rapport_avance/class_ext_list_intra.php
   trunk/rapport_avance/class_ext_tva.php
   trunk/rapport_avance/class_ext_tvagen.php
   trunk/rapport_avance/class_install_plugin.php
   trunk/rapport_avance/class_listing.php
   trunk/rapport_avance/class_tva_amount.php
   trunk/rapport_avance/class_tva_parameter.php
   trunk/rapport_avance/decl_tva.inc.php
   trunk/rapport_avance/form_decl.php
   trunk/rapport_avance/form_decl_info.php
   trunk/rapport_avance/form_parameter.php
   trunk/rapport_avance/form_periode.php
   trunk/rapport_avance/js_scripts.js
   trunk/rapport_avance/list_assujetti.inc.php
   trunk/rapport_avance/list_intra.inc.php
   trunk/rapport_avance/list_tva.inc.php
   trunk/rapport_avance/tva_constant.php
   trunk/rapport_avance/tva_param.inc.php
Modified:
   trunk/
   trunk/rapport_avance/include/class_rapav_install.php
   trunk/rapport_avance/index.php
   trunk/rapport_avance/rapav_constant.php
Log:
Merged revisions 454-457 via svnmerge from=20
svn+ssh://danydb@ns352270.ovh.net/svn_extension/tag/rel652

........
  r454 | danydb | 2012-12-27 01:10:12 +0100 (Thu, 27 Dec 2012) | 1 line
 =20
  add upgrade script
........
  r455 | danydb | 2012-12-27 01:27:39 +0100 (Thu, 27 Dec 2012) | 1 line
 =20
  add documentation
........
  r456 | danydb | 2012-12-27 02:26:31 +0100 (Thu, 27 Dec 2012) | 1 line
 =20
  remove obsolete files
........
  r457 | danydb | 2012-12-27 02:30:05 +0100 (Thu, 27 Dec 2012) | 1 line
 =20
  remove obsolete files
........



Property changes on: trunk
___________________________________________________________________
Name: svnmerge-integrated
   - /tag/rel652:1-452
   + /tag/rel652:1-457

Deleted: trunk/rapport_avance/class_ext_list_assujetti.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/rapport_avance/class_ext_list_assujetti.php	2012-12-27 01:30:05=
 UTC (rev 457)
+++ trunk/rapport_avance/class_ext_list_assujetti.php	2013-01-06 00:40:23=
 UTC (rev 458)
@@ -1,327 +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-1=
307  USA
-   */
-  /* $Revision$ */
-
-  // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
-
-  /*!\file
-   * \brief
-   */
-
-require_once('class_listing.php');
-require_once('class_fiche.php');
-require_once('class_tva_parameter.php');
-class Ext_List_Assujetti extends Listing {
-  protected $variable =3D array(
-			      "id"=3D>"a_id",
-			      "date_decl"=3D>"date_decl",
-			      "start_periode"=3D>"start_periode",
-			      "end_periode"=3D>"end_periode",
-			      "xml_file"=3D>"xml_file",
-			      "num_tva"=3D>"num_tva",
-			      "name"=3D>"tva_name",
-			      "adress"=3D>"adress",
-			      "country"=3D>"country",
-			      "flag_periode"=3D>"flag_periode",
-			      "exercice"=3D>"exercice",
-			      "periode_dec"=3D>"periode_dec"
-			      );
-  private $aChild=3Darray();
-  static function choose_periode($by_year=3Dfalse) {
-
-    // year
-    $year =3D new IText('year');
-    $year->size=3D4;
-    $str_year=3D$year->input();
-
-
-    $str_submit=3DHtmlInput::submit('decl',_('Afficher'));
-    $str_hidden=3DHtmlInput::extension().dossier::hidden();
-    if (isset($_REQUEST['sa']))
-      $str_hidden.=3DHtmlInput::hidden('sa',$_REQUEST['sa']);
-    $r=3D'<form class=3D"print" method=3D"get">';
-    $r.=3D"Ann=C3=A9e :".$str_year;
-    $r.=3D$str_submit;
-    $r.=3D$str_hidden;
-	$r.=3DHtmlInput::request_to_hidden(array('ac'));
-    $r.=3D'</form>';
-    return $r;
-  }
-
-  function from_array($p_array){
-    if ( isset($p_array['name_child'])) {
-      $name=3D$p_array['name_child'];
-      $qcode=3D$p_array['qcode'];
-      $code=3D$p_array['plugin_code'];
-      $tva_num=3D$p_array['tva_num_child'];
-      $amount=3D$p_array['amount'];
-      $amount_vat=3D$p_array['amount_vat'];
-
-      // retrieve missing and compute an array
-      for ($i=3D0;$i<count($name);$i++){
-	$child=3Dnew Ext_List_Assujetti_Child($this->db);
-	$child->set_parameter('amount',$amount[$i]);
-	$child->set_parameter('amount_vat',$amount_vat[$i]);
-	$child->set_parameter('qcode',$qcode[$i]);
-	$child->set_parameter('name_child',$name[$i]);
-	$child->set_parameter('tva_num',$tva_num[$i]);
-
-	$array[]=3D$child;
-      }//end for
-      $this->aChild=3D$array;
-    } else
-      $this->aChild=3Darray();
-
-    $this->start_periode=3D$p_array['start_periode'];
-    $this->end_periode=3D$p_array['end_periode'];
-    $this->flag_periode=3D$p_array['flag_periode'];
-    $this->tva_name=3D$p_array['name'];
-    $this->num_tva=3D$p_array['num_tva'];
-    $this->adress=3D$p_array['adress'];
-    $this->country=3D$p_array['country'];
-    $this->periode_dec=3D$p_array['periode_dec'];
-    $this->exercice=3D$p_array['exercice'];
-  }
-  function display() {
-    $r=3D '<form class=3D"print" id=3D"readonly">';
-	$r.=3DHtmlInput::request_to_hidden(array('ac'));
-    $r.=3D$this->display_info();
-    $r.=3D$this->display_declaration_amount(true);
-    $r.=3D'</form>';
-    $js_remove=3Dsprintf("onclick=3D\"if ( confirm('%s')){remove_form('%=
s',%d,%d,'lc');}\"",
-		       "Vous confirmez vouloir effacer ?",
-			$_REQUEST['plugin_code'],
-			dossier::id(),
-			$this->a_id);
-    $r.=3DHtmlInput::button('Effacer','Effacer',$js_remove);
-
-    $r.=3D create_script("$('readonly').disable();");
-    return $r;
-  }
-  function load() {
-    $sql=3D"select * from tva_belge.assujetti where a_id=3D$1";
-
-    $res=3D$this->db->get_array(
-			      $sql,
-			      array($this->a_id)
-			      );
-    if ( $this->db->count() =3D=3D 0 ) return 0;
-    foreach ($res[0] as $idx=3D>$value) { $this->$idx=3D$value; }
-    // load child
-    $sql=3D"select * from tva_belge.assujetti_chld where a_id=3D$1";
-    $res=3D$this->db->get_array(
-			      $sql,
-			      array($this->a_id)
-			      );
-    $nb=3D$this->db->count();
-    $array=3Darray();
-    // retrieve missing and compute an array
-    for ($i=3D0;$i<$nb;$i++){
-      $child=3Dnew Ext_List_Assujetti_Child($this->db);
-      foreach ($res[$i] as $idx=3D>$value){
-	$child->$idx=3D$value;
-      }
-      $array[]=3D$child;
-    }//end for
-    $this->aChild=3D$array;
-
-    return 1;
-  }
-  function verify() {
-    return 0;
-  }
-  function insert() {
-    $this->db->start();
-
-    /* insert into the first table */
-    $sql=3D<<<EOF
-      INSERT INTO tva_belge.assujetti(
-				      start_date, end_date,  periodicity, tva_name,
-				      num_tva, adress, country,  periode_dec,exercice)
-      VALUES (to_date($1,'DD.MM.YYYY'),to_date($2,'DD.MM.YYYY'),$3,$4,$5=
,$6,$7,$8,$9) returning a_id;
-EOF;
-    $this->a_id=3D$this->db->get_value($sql,
-				     array(
-					   $this->start_periode, /* 1 */
-					   $this->end_periode,
-					   $this->flag_periode, /* 3 */
-					   $this->tva_name,
-					   $this->num_tva, /* 5 */
-					   $this->adress,
-					   $this->country, /* 7 */
-					   $this->periode_dec,
-					   $this->exercice /* 9 */
-					   )
-				     );
-    /* insert into the child table */
-    for ($e=3D0;$e<count($this->aChild);$e++){
-      $this->aChild[$e]->set_parameter('depend',$this->a_id);
-      $this->aChild[$e]->insert();
-    }
-    $this->db->commit();
-
-  }
-  function update() {
-  }
-
-  function compute(){
-    /* retrieve accounting customer */
-    $code_customer=3Dnew Acc_Parm_Code($this->db);
-    $code_customer->p_code=3D'CUSTOMER';
-    $code_customer->load();
-    $a=3D$this->find_tva_code('ASSUJETTI');
-    if (trim($a)=3D=3D'') $a=3D-1;
-    $sql=3D<<<EOF
-      select sum(j_montant) as amount,j_qcode
-      from jrnx
-      where j_grpt in (select distinct j_grpt from quant_sold join jrnx =
using (j_id) where qs_vat_code in ($a) )
-      and j_poste::text like $1||'%'
-      and (j_date >=3D to_date($2,'DD.MM.YYYY') and j_date <=3D to_date(=
$3,'DD.MM.YYYY'))
-      group by j_qcode
-EOF;
-    // get all of them
-    $all=3D$this->db->get_array($sql,array($code_customer->p_value,
-					 $this->start_periode,
-					 $this->end_periode
-					 )
-			      );
-    $array=3Darray();
-
-    // retrieve missing and compute an array
-    for ($i=3D0;$i<count($all);$i++){
-      $child=3Dnew Ext_List_Assujetti_Child($this->db);
-
-
-      $child->set_parameter('qcode',$all[$i]['j_qcode']);
-      $fiche=3Dnew Fiche($this->db);
-      $fiche->get_by_qcode($all[$i]['j_qcode'],false);
-      $num_tva=3D$fiche->strAttribut(ATTR_DEF_NUMTVA);
-      $child->set_parameter('tva_num',$num_tva);
-      $sq=3D"select sum(qs_vat) from quant_sold
-where qs_client =3D $1 and j_id in (select distinct j_id from jrnx where=
  j_date >=3D to_date($2,'DD.MM.YYYY')
-                                  and j_date <=3D to_date($3,'DD.MM.YYYY=
')
-                                  )
-     and qs_vat_code in ($a)
-";
-      // if in the same operation, we use 2 different tva code, the amou=
nt is incorrect if one of them is
-      // excluded
-      $exclude=3D"select coalesce(sum(qs_price),0) from quant_sold
-where qs_client =3D $1 and j_id in (select distinct j_id from jrnx where=
  j_date >=3D to_date($2,'DD.MM.YYYY')
-                                  and j_date <=3D to_date($3,'DD.MM.YYYY=
')
-                                  )
-     and qs_vat_code not in ($a)
-";
-      $excl=3D$this->db->get_value($exclude,array($fiche->id,
-						$this->start_periode,
-						$this->end_periode));
-      $amount_vat=3D$this->db->get_value($sq,array($fiche->id,
-						 $this->start_periode,
-						 $this->end_periode));
-      $amount=3D$all[$i]['amount']-$amount_vat-$excl;
-      $child->set_parameter('amount',$amount);
-      $child->set_parameter('amount_vat',$amount_vat);
-
-      $child->set_parameter('name_child',$fiche->strAttribut(ATTR_DEF_NA=
ME));
-
-      $array[]=3D$child;
-    }//end for
-    $this->aChild=3D$array;
-  }
-  /**
-   *@todo finish it
-   */
-  function display_declaration_amount($readonly=3Dfalse) {
-    $res=3D'<fieldset><legend>Listing</legend>';
-    $res.=3D '<table id=3D"tb_dsp" class=3D"result" style=3D"width:80%;"=
>';
-    $clean=3Dnew IButton('rm_b');
-    $clean->label=3D'Efface ligne';
-    $clean->javascript=3D"deleteRow('tb_dsp',this);";
-
-    $r=3D'';
-    $r.=3Dth('QuickCode');
-    $r.=3Dth('Name');
-    $r.=3Dth('Code Pays et num=C3=A9ro de TVA');
-    $r.=3Dth('montant CA');
-    $r.=3Dth('montant TVA');
-    $r.=3Dth('');
-    $amount=3D0;$amount_vat=3D0;
-    $res.=3Dtr($r);
-    for ($i=3D0;$i<count($this->aChild);$i++) {
-      $a=3Dnew IText('qcode[]',$this->aChild[$i]->get_parameter('qcode')=
);
-      $b=3Dnew IText('name_child[]',$this->aChild[$i]->get_parameter('na=
me_child'));
-      $c=3Dnew IText('tva_num_child[]',$this->aChild[$i]->get_parameter(=
'tva_num'));
-      $e=3Dnew INum('amount[]',$this->aChild[$i]->get_parameter('amount'=
));
-      $d=3Dnew INum('amount_vat[]',$this->aChild[$i]->get_parameter('amo=
unt_vat'));
-
-      $amount+=3Dround($this->aChild[$i]->get_parameter('amount'),2);
-      $amount_vat+=3Dround($this->aChild[$i]->get_parameter('amount_vat'=
),2);
-      $r=3Dtd($a->input());
-      $r.=3Dtd($b->input());
-      $r.=3Dtd($c->input());
-      $r.=3Dtd($e->input());
-      $r.=3Dtd($d->input());
-     if (! $readonly) $r.=3Dtd($clean->input());
-      $res.=3Dtr($r);
-
-    }
-	if ( $readonly )
-	{
-		$r=3Dtd('');
-		$r.=3Dtd('');
-		$r.=3Dtd(hb('Total'));
-		$r.=3Dtd(hb(sprintf('%.02f',$amount)));
-		$r.=3Dtd(hb(sprintf('%.02f',$amount_vat)));
-		$res.=3Dtr($r);
-	}
-
-    $res.=3D'</table>';
-    $res.=3D'</fieldset>';
-    return $res;
-  }
-}
-
-class Ext_List_Assujetti_Child extends Ext_List_Assujetti {
-  protected $variable=3Darray(
-			    "id"=3D>"ac_id",
-			    "tva_num"=3D>"ac_tvanum",
-			    "amount"=3D>"ac_amount",
-			    "amount_vat"=3D>"ac_vat",
-			    "depend"=3D>"a_id",
-			    "qcode"=3D>"ac_qcode",
-			    "name_child"=3D>'ac_name'
-			    );
-  function insert() {
-
-    $sql=3D<<<EOF
-      INSERT INTO tva_belge.assujetti_chld(
-					   a_id, ac_tvanum, ac_amount, ac_vat,  ac_qcode,
-					   ac_name)
-      VALUES ($1, $2, $3, $4, $5, $6) returning ac_id;
-EOF;
-    $this->ic_id=3D$this->db->get_value($sql,array(
-						 $this->a_id,
-						 $this->ac_tvanum,
-						 $this->ac_amount,
-						 $this->ac_vat,
-						 $this->ac_qcode,
-						 $this->ac_name
-						 ));
-  }
-
-}

Deleted: trunk/rapport_avance/class_ext_list_intra.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/rapport_avance/class_ext_list_intra.php	2012-12-27 01:30:05 UTC=
 (rev 457)
+++ trunk/rapport_avance/class_ext_list_intra.php	2013-01-06 00:40:23 UTC=
 (rev 458)
@@ -1,309 +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 b=
y
- *   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-130=
7  USA
-*/
-/* $Revision$ */
-
-// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
-
-/*!\file
- * \brief
- */
-
-require_once('class_listing.php');
-require_once('class_fiche.php');
-require_once('class_tva_parameter.php');
-class Ext_List_Intra extends Listing {
-  protected $variable =3D array(
-			      "id"=3D>"i_id",
-			      "date"=3D>"i_date",
-			      "date_decl"=3D>"date_decl",
-			      "start_periode"=3D>"start_periode",
-			      "end_periode"=3D>"end_periode",
-			      "xml_file"=3D>"xml_file",
-			      "num_tva"=3D>"num_tva",
-			      "name"=3D>"tva_name",
-			      "adress"=3D>"adress",
-			      "country"=3D>"country",
-			      "flag_periode"=3D>"flag_periode",
-			      "exercice"=3D>"exercice",
-			      "periode_dec"=3D>"periode_dec"
-			      );
-  private $aChild=3Darray();
-
-  function from_array($p_array){
-    if( isset($p_array['name_child'])) {
-      $name=3D$p_array['name_child'];
-     $qcode=3D$p_array['qcode'];
-     $code=3D$p_array['tvacode'];
-     $tva_num=3D$p_array['tva_num_child'];
-     $amount=3D$p_array['amount'];
-     $periode=3D$p_array['periode'];
-     $array=3Darray();
-    // retrieve missing and compute an array
-    for ($i=3D0;$i<count($name);$i++){
-      $child=3Dnew Ext_List_Intra_Child($this->db);
-      $child->set_parameter('amount',$amount[$i]);
-      $child->set_parameter('periode',$periode[$i]);
-      $child->set_parameter('qcode',$qcode[$i]);
-      $child->set_parameter('code',$code[$i]);
-      $child->set_parameter('name_child',$name[$i]);
-      $child->set_parameter('tva_num',$tva_num[$i]);
-
-      $array[]=3D$child;
-    }//end for
-    $this->aChild=3D$array;
-    } else
-      $this->aChild=3Darray();
-
-    $this->start_periode=3D$p_array['start_periode'];
-    $this->end_periode=3D$p_array['end_periode'];
-    $this->flag_periode=3D$p_array['flag_periode'];
-    $this->tva_name=3D$p_array['name'];
-    $this->num_tva=3D$p_array['num_tva'];
-    $this->adress=3D$p_array['adress'];
-    $this->country=3D$p_array['country'];
-    $this->periode_dec=3D$p_array['periode_dec'];
-    $this->exercice=3D$p_array['exercice'];
-
-  }
-  function display() {
-     $r=3D '<form class=3D"print" id=3D"readonly">';
-     $r.=3D$this->display_info();
-	 $r.=3DHtmlInput::request_to_hidden(array('ac'));
-     $r.=3D$this->display_declaration_amount();
-     $r.=3D'</form>';
-     $js_remove=3Dsprintf("onclick=3D\"if ( confirm('%s')){remove_form('=
%s',%d,%d,'li');}\"",
-		       "Vous confirmez vouloir effacer ?",
-			$_REQUEST['plugin_code'],
-			dossier::id(),
-			$this->i_id);
-
-     $r.=3DHtmlInput::button('Effacer','Effacer',$js_remove);
-     $r.=3D create_script("$('readonly').disable();");
-     return $r;
-  }
-  function load() {
-    $sql=3D"select * from tva_belge.intracomm where i_id=3D$1";
-
-   $res=3D$this->db->get_array(
-			    $sql,
-			    array($this->i_id)
-			    );
-   if ( $this->db->count() =3D=3D 0 ) return 0;
-   foreach ($res[0] as $idx=3D>$value) { $this->$idx=3D$value; }
-   // load child
-   $sql=3D"select * from tva_belge.intracomm_chld where i_id=3D$1";
-   $res=3D$this->db->get_array(
-			    $sql,
-			    array($this->i_id)
-			    );
-   $nb=3D$this->db->count();
-   $array=3Darray();
-   // retrieve missing and compute an array
-   for ($i=3D0;$i<$nb;$i++){
-     $child=3Dnew Ext_List_Intra_Child($this->db);
-     foreach ($res[$i] as $idx=3D>$value){
-       $child->$idx=3D$value;
-     }
-     $array[]=3D$child;
-   }//end for
-   $this->aChild=3D$array;
-
-   return 1;
-  }
-  function verify() {
-    return 0;
-  }
-  function insert() {
-    $this->db->start();
-
-    /* insert into the first table */
-    $sql=3D<<<EOF
-INSERT INTO tva_belge.intracomm(
-            start_date, end_date,  periodicity, tva_name,
-            num_tva, adress, country,  periode_dec,exercice)
-      VALUES (to_date($1,'DD.MM.YYYY'),to_date($2,'DD.MM.YYYY'),$3,$4,$5=
,$6,$7,$8,$9) returning i_id;
-EOF;
-$this->i_id=3D$this->db->get_value($sql,
-		     array(
-			   $this->start_periode,
-			   $this->end_periode,
-			   $this->flag_periode,
-			   $this->tva_name,
-			   $this->num_tva,
-			   $this->adress,
-			   $this->country,
-			   $this->periode_dec,
-			   $this->exercice
-			   )
-		     );
-/* insert into the child table */
-for ($e=3D0;$e<count($this->aChild);$e++){
-  $this->aChild[$e]->set_parameter('depend',$this->i_id);
-  $this->aChild[$e]->insert();
-}
-  $this->db->commit();
-
-  }
-  function update() {
-  }
-
-  function compute(){
-    /* retrieve accounting customer */
-    $code_customer=3Dnew Acc_Parm_Code($this->db);
-    $code_customer->p_code=3D'CUSTOMER';
-    $code_customer->load();
-    $a=3D$this->find_tva_code('CLINTRA');
-
-    if (trim($a)=3D=3D'') $a=3D-1;
-    $sql=3D<<<EOF
-      select sum(j_montant) as amount,j_qcode
-      from jrnx
-      where j_grpt in (select distinct j_grpt from quant_sold join jrnx =
using (j_id) where qs_vat_code in ($a) )
-      and j_poste::text like $1||'%'
-      and (j_date >=3D to_date($2,'DD.MM.YYYY') and j_date <=3D to_date(=
$3,'DD.MM.YYYY'))
-      group by j_qcode
-EOF;
-    // get all of them
-    $all=3D$this->db->get_array($sql,array($code_customer->p_value,
-					$this->start_periode,
-					$this->end_periode
-					)
-			     );
-    $array=3Darray();
-
-    // retrieve missing and compute an array
-    for ($i=3D0;$i<count($all);$i++){
-		$child=3Dnew Ext_List_Intra_Child($this->db);
-		$child->set_parameter('amount',$all[$i]['amount']);
-		switch ($this->flag_periode) {
-		case 1:
-		// by month
-		$child->set_parameter('periode',sprintf('%02d%s',$this->periode_dec,$t=
his->exercice));
-		break;
-		case 2:
-		/* quaterly */
-		$child->set_parameter('periode',sprintf('3%d%s',$this->periode_dec,$th=
is->exercice));
-		break;
-		case 3:
-		/* yearly */
-		$child->set_parameter('periode',sprintf('00%s',$this->periode_dec,$thi=
s->exercice));
-		break;
-      } // end switch
-
-      $child->set_parameter('qcode',$all[$i]['j_qcode']);
-      $fiche=3Dnew Fiche($this->db);
-      $fiche->get_by_qcode($all[$i]['j_qcode'],false);
-      $num_tva=3D$fiche->strAttribut(ATTR_DEF_NUMTVA);
-
-      if ( trim($num_tva) =3D=3D=3D "") {continue;}
-      $child->set_parameter('tva_num',$num_tva);
-
-      $child->set_parameter('name_child',$fiche->strAttribut(ATTR_DEF_NA=
ME));
-      $child->set_parameter('code','L');
-
-      $array[]=3D$child;
-    }//end for
-    $this->aChild=3D$array;
-  }
-  /**
-   *@todo finish it
-   */
-  function display_declaration_amount($p_readonly=3Dfalse) {
-    $res=3D'<fieldset><legend>Listing</legend>';
-
-    $res.=3D '<table id=3D"tb_dsp" class=3D"result" style=3D"width:80%;"=
>';
-    $clean=3Dnew IButton();
-    $clean->label=3D'Efface ligne';
-    $clean->javascript=3D"deleteRow('tb_dsp',this);";
-
-    $r=3D'';
-    $r.=3Dth('QuickCode');
-    $r.=3Dth('Name');
-    $r.=3Dth('Code Pays et num=C3=A9ro de TVA');
-    $r.=3Dth('Code Pays et num=C3=A9ro de TVA');
-    $r.=3Dth('montant');
-    $r.=3Dth('periode');
-    $r.=3Dth('');
-    $amount=3D0;
-    $res.=3Dtr($r);
-    for ($i=3D0;$i<count($this->aChild);$i++) {
-      $a=3Dnew IText('qcode[]',$this->aChild[$i]->get_parameter('qcode')=
);
-      $b=3Dnew IText('name_child[]',$this->aChild[$i]->get_parameter('na=
me_child'));
-      $c=3Dnew IText('tva_num_child[]',$this->aChild[$i]->get_parameter(=
'tva_num'));
-      $d=3Dnew IText('tvacode[]',$this->aChild[$i]->get_parameter('code'=
));
-      $e=3Dnew INum('amount[]',$this->aChild[$i]->get_parameter('amount'=
));
-      $f=3Dnew IText('periode[]',$this->aChild[$i]->get_parameter('perio=
de'));
-
-      $amount+=3Dround($this->aChild[$i]->get_parameter('amount'),2);
-      $r=3Dtd($a->input());
-      $r.=3Dtd($b->input());
-      $r.=3Dtd($c->input());
-      $r.=3Dtd($d->input());
-      $r.=3Dtd($e->input());
-      $r.=3Dtd($f->input());
-      if (! $p_readonly) $r.=3Dtd($clean->input());
-      $res.=3Dtr($r);
-
-    }
-	if ( $p_readonly)
-	{
-		$r=3Dtd('');
-		$r.=3Dtd('');
-		$r.=3Dtd('');
-		$r.=3Dtd(hb('Total'));
-		$r.=3Dtd(hb(sprintf('%.02f',$amount)));
-		$r.=3Dtd('');
-		$r.=3Dtd('');
-		$res.=3Dtr($r);
-	}
-	$res.=3D'</table>';
-    $res.=3D'</fieldset>';
-    return $res;
-  }
-}
-
-class Ext_List_Intra_Child extends Ext_List_Intra {
-  protected $variable=3Darray(
-			    "id"=3D>"ic_id",
-			    "tva_num"=3D>"ic_tvanum",
-			    "amount"=3D>"ic_amount",
-			    "code"=3D>"ic_code",
-			    "periode"=3D>"ic_periode",
-			    "depend"=3D>"i_id",
-			    "qcode"=3D>"ic_qcode",
-			    "name_child"=3D>'ic_name'
-			    );
-  function insert() {
-$sql=3D<<<EOF
-INSERT INTO tva_belge.intracomm_chld(
-            i_id, ic_tvanum, ic_amount, ic_code, ic_periode, ic_qcode,
-            ic_name)
-  VALUES ($1, $2, $3, $4, $5, $6, $7) returning ic_id;
-EOF;
-$this->ic_id=3D$this->db->get_value($sql,array(
-					     $this->i_id,
-					     $this->ic_tvanum,
-					     $this->ic_amount,
-					     $this->ic_code,
-					     $this->ic_periode,
-					     $this->ic_qcode,
-					     $this->ic_name));
-  }
-
-}

Deleted: trunk/rapport_avance/class_ext_tva.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/rapport_avance/class_ext_tva.php	2012-12-27 01:30:05 UTC (rev 4=
57)
+++ trunk/rapport_avance/class_ext_tva.php	2013-01-06 00:40:23 UTC (rev 4=
58)
@@ -1,546 +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 b=
y
- *   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-130=
7  USA
-*/
-/* $Revision$ */
-
-// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
-
-/*!\file
- * \brief
- */
-require_once('class_ext_tvagen.php');
-require_once('class_tva_parameter.php');
-require_once('class_tva_amount.php');
-require_once('class_html_input.php');
-class Ext_Tva extends Ext_Tva_Gen
-{
-    protected   $variable=3Darray(
-			   "d00"=3D>"d00",
-			   "d01"=3D>"d01",
-			   "d02"=3D>"d02",
-			   "d03"=3D>"d03",
-			   "d44"=3D>"d44",
-			   "d45"=3D>"d45",
-			   "d46"=3D>"d46",
-			   "d47"=3D>"d47",
-			   "d48"=3D>"d48",
-			   "d49"=3D>"d49",
-			   "d81"=3D>"d81",
-			   "d82"=3D>"d82",
-			   "d83"=3D>"d83",
-			   "d84"=3D>"d84",
-			   "d85"=3D>"d85",
-			   "d86"=3D>"d86",
-			   "d54"=3D>"d54",
-			   "d55"=3D>"d55",
-			   "d56"=3D>"d56",
-			   "d57"=3D>"d57",
-			   "d63"=3D>"d63",
-			   "dxx"=3D>"dxx",
-			   "d59"=3D>"d59",
-			   "d61"=3D>"d61",
-			   "d62"=3D>"d62",
-			   "d64"=3D>"d64",
-			   "dyy"=3D>"dyy",
-			   "d71"=3D>"d71",
-			   "d72"=3D>"d72",
-			   "d82"=3D>"d82",
-			   "d87"=3D>"d87",
-			   "d88"=3D>"d88",
-			   "d91"=3D>"d91",
-			   "id"=3D>"da_id",
-			   "date_decl"=3D>"date_decl",
-			   "start_periode"=3D>"start_periode",
-			   "end_periode"=3D>"end_periode",
-			   "xml_file"=3D>"xml_file",
-			   "num_tva"=3D>"num_tva",
-			   "name"=3D>"tva_name",
-			   "adress"=3D>"adress",
-			   "country"=3D>"country",
-			   "flag_periode"=3D>"flag_periode",
-			   "exercice"=3D>"exercice",
-			   "periode_dec"=3D>"periode_dec"
-			   );
-
-  /**
-   *@brief retrieve * row thanks a condition
-   */
-   public function seek($cond,$p_array=3Dnull)
-   {
-   }
-   public function from_array($p_array) {
-     $val=3D$p_array['val'];
-     $code=3D$p_array['tvacode'];
-     for ($i=3D0;$i<count($val);$i++) {
-       $this->$code[$i]=3D$val[$i];
-     }
-     $this->start_periode=3D$p_array['start_periode'];
-     $this->end_periode=3D$p_array['end_periode'];
-     $this->flag_periode=3D$p_array['flag_periode'];
-     $this->tva_name=3D$p_array['name'];
-     $this->num_tva=3D$p_array['num_tva'];
-     $this->adress=3D$p_array['adress'];
-     $this->country=3D$p_array['country'];
-     $this->periode_dec=3D$p_array['periode_dec'];
-     $this->exercice=3D$p_array['exercice'];
-
-   }
-  public function insert() {
-
-    if ( $this->verify() !=3D 0 ) return;
-    $sql=3D"INSERT INTO tva_belge.declaration_amount(
-             d00, d01, d02, d03, d44, d45, d46, d47, d48, d49, d81,
-            d82, d83, d84, d85, d86, d87, d88, d54, d55, d56, d57, d61, =
d63,
-            dxx, d59, d62, d64, dyy, d71, d72, d91, start_date, end_date=
,
-             periodicity,tva_name,num_tva,adress,country,periode_dec,exe=
rcice)
-    VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12,
-            $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, =
$25,
-            $26, $27, $28, $29, $30, $31, $32, to_date($33,'DD.MM.YYYY')=
, to_date($34,'DD.MM.YYYY'), $35,$36,
-            $37,$38,$39,$40,$41)
-             returning da_id;";
-      $this->da_id=3D$this->db->get_value($sql,
-				     array($this->d00, /* 1 */
-					   $this->d01, /* 2 */
-					   $this->d02, /* 3 */
-					   $this->d03, /* 4 */
-					   $this->d44, /* 5 */
-					   $this->d45, /* 6 */
-					   $this->d46, /* 7 */
-					   $this->d47, /* 8 */
-					   $this->d48, /* 9 */
-					   $this->d49, /* 10 */
-					   $this->d81, /* 11 */
-					   $this->d82, /* 12 */
-					   $this->d83, /* 13 */
-					   $this->d84, /* 14 */
-					   $this->d85, /* 15 */
-					   $this->d86, /* 16 */
-					   $this->d87, /* 17 */
-					   $this->d88, /* 18 */
-					   $this->d54, /* 19 */
-					   $this->d55, /* 20 */
-					   $this->d56, /* 21 */
-					   $this->d57, /* 22 */
-					   $this->d61, /* 23 */
-					   $this->d63, /* 24 */
-					   $this->dxx, /* 25 */
-					   $this->d59, /* 26 */
-					   $this->d62, /* 27 */
-					   $this->d64, /* 28 */
-					   $this->dyy, /* 29 */
-					   $this->d71, /* 30 */
-					   $this->d72, /* 31 */
-					   $this->d91, /* 32 */
-					   $this->start_periode, /* 33 */
-					   $this->end_periode, /* 34 */
-					   $this->flag_periode, /* 35 */
-					   $this->tva_name,	/* 36 */
-					   $this->num_tva,	/* 37 */
-					   $this->adress,	/* 38 */
-					   $this->country,	/* 39 */
-					   $this->periode_dec,	/* 40 */
-					   $this->exercice,	/* 41 */
-
-					   ));
-  }
-
-  public function update() {
-    if ( $this->verify() !=3D 0 ) return;
-
-  }
-
-  public function load() {
-
-   $sql=3D"select * from tva_belge.declaration_amount where da_id=3D$1";
-
-   $res=3D$this->db->get_array(
-			    $sql,
-			    array($this->da_id)
-			    );
-   if ( $this->db->count() =3D=3D 0 ) return;
-   foreach ($res[0] as $idx=3D>$value) { $this->$idx=3D$value; }
-  }
-  public function delete() {
-/*    $sql=3D"delete from tva_rate where tva_id=3D$1";
-    $res=3D$this->cn->exec_sql($sql,array($this->tva_id));
-*/
-  }
-
-  function verify() {
-    /**
-     *@todo
-     * MY_NAME can not be empty
-     * MY_TVA contains BE and has 10 digits
-     * this->adress and $this->country can not be empty
-     */
-    return 0;
-  }
-
-  /**
-   *@brief compute the amount
-   */
-  function compute() {
-    // check that this exercice exist
-    $exist=3D$this->db->get_value('select count(*) from jrn join parm_pe=
riode on (p_id=3Djr_tech_per) where date_part(\'year\',p_start)=3D$1',arr=
ay($this->exercice));
-    if ( $exist=3D=3D0 ) { alert(_("Cette exercice comptable n'est pas d=
ans ce dossier")); throw  new Exception('INVALYEAR',1 ) ;}
-
-    // set default value 0 for all
-    $keys=3Darray_keys($this->variable);
-    for ($i =3D 0;$i < count($this->variable);$i++) {
-      $idx=3D$keys[$i];
-      $this->$idx=3D0;
-      if ( $idx=3D=3D'd91') break;
-    }
-
-    $ctva=3Dnew Tva_Parameter($this->db);
-    /**
-     *@todo on ne peut pas calculer de cette fa=C3=A7on =C3=A0 cause des=
 op=C3=A9rations qui comprennent plusieurs taux de tva diff.
-     *il faut aller chercher les montants dans les tables quant_*
-     */
-    $array=3Darray('00','01','02','03','44','45','46','47','48','49');
-    for ($e=3D0;$e<count($array);$e++) {
-      // Compute frame 2
-      $oTva=3Dnew Tva_amount($this->db,'out',$this->start_periode,$this-=
>end_periode);
-      $oTva->set_parameter('grid','GRIL'.$array[$e]);
-      $amount=3D$oTva->amount_operation();
-      $this->set_parameter('d'.$array[$e],$amount);
-    }
-
-    $array=3Darray('81','82','83','84','85','86','87','88');
-    for ($e=3D0;$e<count($array);$e++) {
-      // Compute frame 3
-      $oTva=3Dnew Tva_amount($this->db,'in',$this->start_periode,$this->=
end_periode);
-      $oTva->set_parameter('grid','GRIL'.$array[$e]);
-      $amount=3D$oTva->amount_operation();
-      $this->set_parameter('d'.$array[$e],$amount);
-
-    }
-    //Frame IV
-    $array=3Darray('54','55','56','57','61','63');
-    for ($e=3D0;$e<count($array);$e++) {
-      $oTva=3Dnew Tva_amount($this->db,'out',$this->start_periode,$this-=
>end_periode);
-      $oTva->set_parameter('grid','GRIL'.$array[$e]);
-      $amount=3D$oTva->amount_vat();
-      $this->set_parameter('d'.$array[$e],$amount);
-
-    }
-
-
-    $array=3Darray('59','62','64');
-    for ($e=3D0;$e<count($array);$e++) {
-      $oTva=3Dnew Tva_amount($this->db,'in',$this->start_periode,$this->=
end_periode);
-      $oTva->set_parameter('grid','GRIL'.$array[$e]);
-      $amount=3D$oTva->amount_vat();
-      $this->set_parameter('d'.$array[$e],$amount);
-
-    }
-    // for intracom, we compute a false VAT, have to paid it and deduce
-    $this->d55=3Dround($this->d86*0.21+$this->d88*0.21,2);
-    $this->d59+=3D$this->d55;
-    /**
-     *@todo
-     * GRIL56 - GRIL57 - GRIL61 - GRIL63
-     */
-
-    //GRILXX
-    $amount=3D$this->d54+$this->d55+$this->d56+$this->d57+$this->d61+$th=
is->d63;
-    $this->set_parameter('dxx',$amount);
-
-
-    // GRILYY
-    $this->dyy=3Dround($this->d59+$this->d62+$this->d64,2);
-
-
-    //Fram VI
-    if ( $this->dxx > $this->dyy ) $this->d71=3D$this->dxx-$this->dyy;
-    if ( $this->dxx < $this->dyy ) $this->d72=3D$this->dyy-$this->dxx;
-
-   }
-  /**
-   *@brief get into the table quant_purchase or quant_sold the amount
-   * of VAT
-   *@param
-   *@param
-   *@return
-   *@see
-   */
-
-   function display_declaration_amount() {
-     $itext_00=3Dnew INum('val[]',$this->get_parameter('d00')); $str_00=3D=
$itext_00->input().HtmlInput::hidden('tvacode[]','d00');
-     $itext_01=3Dnew INum('val[]',$this->get_parameter('d01')); $str_01=3D=
$itext_01->input().HtmlInput::hidden('tvacode[]','d01');
-     $itext_02=3Dnew INum('val[]',$this->get_parameter('d02')); $str_02=3D=
$itext_02->input().HtmlInput::hidden('tvacode[]','d02');
-     $itext_03=3Dnew INum('val[]',$this->get_parameter('d03')); $str_03=3D=
$itext_03->input().HtmlInput::hidden('tvacode[]','d03');
-     $itext_44=3Dnew INum('val[]',$this->get_parameter('d44')); $str_44=3D=
$itext_44->input().HtmlInput::hidden('tvacode[]','d44');
-     $itext_45=3Dnew INum('val[]',$this->get_parameter('d45')); $str_45=3D=
$itext_45->input().HtmlInput::hidden('tvacode[]','d45');
-     $itext_46=3Dnew INum('val[]',$this->get_parameter('d46')); $str_46=3D=
$itext_46->input().HtmlInput::hidden('tvacode[]','d46');
-     $itext_47=3Dnew INum('val[]',$this->get_parameter('d47')); $str_47=3D=
$itext_47->input().HtmlInput::hidden('tvacode[]','d47');
-     $itext_48=3Dnew INum('val[]',$this->get_parameter('d48')); $str_48=3D=
$itext_48->input().HtmlInput::hidden('tvacode[]','d48');
-     $itext_49=3Dnew INum('val[]',$this->get_parameter('d49')); $str_49=3D=
$itext_49->input().HtmlInput::hidden('tvacode[]','d49');
-     $itext_81=3Dnew INum('val[]',$this->get_parameter('d81')); $str_81=3D=
$itext_81->input().HtmlInput::hidden('tvacode[]','d81');
-     $itext_82=3Dnew INum('val[]',$this->get_parameter('d82')); $str_82=3D=
$itext_82->input().HtmlInput::hidden('tvacode[]','d82');
-     $itext_83=3Dnew INum('val[]',$this->get_parameter('d83')); $str_83=3D=
$itext_83->input().HtmlInput::hidden('tvacode[]','d83');
-     $itext_84=3Dnew INum('val[]',$this->get_parameter('d84')); $str_84=3D=
$itext_84->input().HtmlInput::hidden('tvacode[]','d84');
-     $itext_85=3Dnew INum('val[]',$this->get_parameter('d85')); $str_85=3D=
$itext_85->input().HtmlInput::hidden('tvacode[]','d85');
-     $itext_86=3Dnew INum('val[]',$this->get_parameter('d86')); $str_86=3D=
$itext_86->input().HtmlInput::hidden('tvacode[]','d86');
-     $itext_87=3Dnew INum('val[]',$this->get_parameter('d87')); $str_87=3D=
$itext_87->input().HtmlInput::hidden('tvacode[]','d87');
-     $itext_88=3Dnew INum('val[]',$this->get_parameter('d88')); $str_88=3D=
$itext_88->input().HtmlInput::hidden('tvacode[]','d88');
-
-     $itext_54=3Dnew INum('val[]',$this->get_parameter('d54')); $str_54=3D=
$itext_54->input().HtmlInput::hidden('tvacode[]','d54');
-     $itext_55=3Dnew INum('val[]',$this->get_parameter('d55')); $str_55=3D=
$itext_55->input().HtmlInput::hidden('tvacode[]','d55');
-     $itext_56=3Dnew INum('val[]',$this->get_parameter('d56')); $str_56=3D=
$itext_56->input().HtmlInput::hidden('tvacode[]','d56');
-     $itext_57=3Dnew INum('val[]',$this->get_parameter('d57')); $str_57=3D=
$itext_57->input().HtmlInput::hidden('tvacode[]','d57');
-     $itext_63=3Dnew INum('val[]',$this->get_parameter('d63')); $str_63=3D=
$itext_63->input().HtmlInput::hidden('tvacode[]','d63');
-     $itext_61=3Dnew INum('val[]',$this->get_parameter('d61')); $str_61=3D=
$itext_61->input().HtmlInput::hidden('tvacode[]','d61');
-     $itext_xx=3Dnew INum('val[]',$this->get_parameter('dxx')); $str_xx=3D=
$itext_xx->input().HtmlInput::hidden('tvacode[]','dxx');
-     $itext_59=3Dnew INum('val[]',$this->get_parameter('d59')); $str_59=3D=
$itext_59->input().HtmlInput::hidden('tvacode[]','d59');
-     $itext_62=3Dnew INum('val[]',$this->get_parameter('d62')); $str_62=3D=
$itext_62->input().HtmlInput::hidden('tvacode[]','d62');
-     $itext_64=3Dnew INum('val[]',$this->get_parameter('d64')); $str_64=3D=
$itext_64->input().HtmlInput::hidden('tvacode[]','d64');
-     $itext_yy=3Dnew INum('val[]',$this->get_parameter('dyy')); $str_yy=3D=
$itext_yy->input().HtmlInput::hidden('tvacode[]','dyy');
-     $itext_71=3Dnew INum('val[]',$this->get_parameter('d71')); $str_71=3D=
$itext_71->input().HtmlInput::hidden('tvacode[]','d71');
-     $itext_72=3Dnew INum('val[]',$this->get_parameter('d72')); $str_72=3D=
$itext_72->input().HtmlInput::hidden('tvacode[]','d72');
-     $itext_91=3Dnew INum('val[]',$this->get_parameter('d91')); $str_91=3D=
$itext_91->input().HtmlInput::hidden('tvacode[]','d91');
-
-
-     ob_start();
-     require_once('form_decl.php');
-     $r=3Dob_get_contents();
-     ob_end_clean();
-     $r.=3DHtmlInput::hidden('periode_dec',$this->periode_dec);
-     return $r;
-
-   }
-   function menu() {
-     $r=3D'';
-     $js_record=3Dsprintf("onclick=3D\"record_writing('%s',%d,%d)\"",
-			$_REQUEST['plugin_code'],
-			dossier::id(),
-			$this->da_id);
-    $js_remove=3Dsprintf("onclick=3D\"if ( confirm('%s')){remove_form('%=
s',%d,%d,'da');}\"",
-		       "Vous confirmez vouloir effacer ?",
-			$_REQUEST['plugin_code'],
-			dossier::id(),
-			$this->da_id);
-
-     $array=3Darray (
-		   array("javascript:void(0)",_("Ecriture comptable"),_("Cr=C3=A9ation=
 de l'=C3=A9criture comptable"),1,$js_record),
-		   array("javascript:void(0)",_("G=C3=A9n=C3=A9rer fichier"),_("Cr=C3=A9=
ation du fichier xml"),2),
-		   array("javascript:void(0)",_("Effacement d=C3=A9claration"),_("Effa=
cement d=C3=A9claration"),3,$js_remove)
-		   );
-     $r.=3DShowItem($array,'V',"mtitle","mtitle");
-     return $r;
-
-   }
-   function propose_form() {
-     $r=3D'';
-     /* take all the vat code */
-     $array=3D$this->db->get_array("select tva_poste from tva_rate");
-
-     if ( empty($array)) return 'aucun compte pour la tva';
-
-	 $str_tva=3D"";$sep=3D"";
-	 for ($i=3D0;$i<count($array);$i++) {
-		 $str_tva.=3D$sep.$array[$i]['tva_poste'];
-		 $sep=3D',';
-	 }
-
-	 $array=3Dexplode(',',$str_tva);
-	 $array=3Darray_unique($array);
-
-     $max=3Dcount($array);
-     $periode=3Dnew Periode($this->db);
-     $per=3D$periode->limit_year($this->exercice);
-     $periode->p_id=3D$per['start'];
-
-     $first_day=3D$periode->first_day();
-     $idx=3D0;
-     $amount_vat=3D0;
-     $r.=3D'<table class=3D"result">';
-     for ( $i=3D0;$i<$max;$i++){
-       /* for each rate explode the accounting */
-      // list($deb,$cred)=3Dexplode(',',$array[$i]['tva_poste']);
-		 $deb=3D$array[$i];
-       /* get saldo for DEBIT*/
-       $saldo=3Dnew Acc_Account_Ledger($this->db,$deb);
-
-       /* get label */
-       $lib=3D$this->db->get_value('select pcm_lib from tmp_pcmn where p=
cm_val=3D$1',array($deb));
-
-       $cond=3Dsprintf(" j_date >=3Dto_date('%s','DD.MM.YYYY') and j_dat=
e <=3D '%s'",
-		     $first_day,
-		     $this->end_date);
-
-       $result=3D$saldo->get_solde_detail($cond);
-       if ( $result['solde']=3D=3D0) continue;
-
-       $account=3Dnew IText('account['.$idx.']');
-       $account->value=3D$deb;
-       $amount=3Dnew INum('amount['.$idx.']');
-       $amount->value=3Dabs($result['solde']);
-
-       $ICheckBox=3Dnew ICheckBox('deb['.$idx.']');
-       if ( $result['debit'] < $result['credit'] ) {
-			 $amount_vat-=3D$result['solde'];	 $ICheckBox->selected=3Dtrue;}
-       else {
-			$amount_vat+=3D$result['solde'];	 $ICheckBox->selected=3Dfalse;
-       }
-       $idx++;
-       /* display row */
-       $r.=3Dtr(td($account->input()).td($lib).td($amount->input()).td($=
ICheckBox->input()));
-
-     }
-     /* ATVA */
-     $atva=3D$this->db->get_value("select pcm_val  from tva_belge.parame=
ter_chld where pcode=3D'ATVA'");
-     if ( $atva !=3D ''  ) {
-       /* get saldo */
-       $saldo=3Dnew Acc_Account_Ledger($this->db,$atva);
-       /* get label */
-       $lib=3D$this->db->get_value('select pcm_lib from tmp_pcmn where p=
cm_val=3D$1',array($atva));
-
-       $cond=3Dsprintf(" j_date >=3Dto_date('%s','DD.MM.YYYY') and j_dat=
e <=3D '%s'",
-		     $first_day,
-		     $this->end_date);
-       $result=3D$saldo->get_solde_detail($cond);
-       $ICheckBox=3Dnew ICheckBox('atva_ic');
-       $account=3Dnew IText('atva');
-       $account->value=3D$atva;
-       $amount=3Dnew INum('atva_amount');
-       $amount->value=3Dabs($result['solde']);
-
-       if ( $result['debit'] < $result['credit'] ) {
-	 $amount_vat-=3D$result['solde'];	 $ICheckBox->selected=3Dtrue;}
-       else {
-	 $ICheckBox->selected=3Dfalse;
-	 $amount_vat+=3D$result['solde'];
-       }
-       /* display row */
-       if ( $result['solde'] !=3D 0)       $r.=3Dtr(td($account->input()=
).td('Avance TVA').td($amount->input()).td($ICheckBox->input()));
-
-     }
-     /* creance sur tva*/
-     /* CRTVA */
-     $crtva=3D$this->db->get_value("select pcm_val  from tva_belge.param=
eter_chld where pcode=3D'CRTVA'");
-     if ( $crtva !=3D ''  ) {
-       /* get saldo */
-       $saldo=3Dnew Acc_Account_Ledger($this->db,$crtva);
-       /* get label */
-       $lib=3D$this->db->get_value('select pcm_lib from tmp_pcmn where p=
cm_val=3D$1',array($crtva));
-
-       $cond=3Dsprintf(" j_date >=3Dto_date('%s','DD.MM.YYYY') and j_dat=
e <=3D '%s'",
-		     $first_day,
-		     $this->end_date);
-       $result=3D$saldo->get_solde_detail($cond);
-       $ICheckBox=3Dnew ICheckBox('crtva_ic');
-       $account=3Dnew IText('crtva');
-       $account->value=3D$crtva;
-       $amount=3Dnew INum('crtva_amount');
-       $amount->value=3Dabs($result['solde']);
-
-       if ( $result['debit'] > $result['credit']) {
-	 $amount_vat+=3D$result['solde'];
-	 $ICheckBox->selected=3Dfalse;
-       } else {
-	 $amount_vat-=3D$result['solde'];
-	 $ICheckBox->selected=3Dtrue;
-
-       }
-       /* display row */
-       if ( $result['solde'] !=3D 0)  $r.=3Dtr(td($account->input()).td(=
'Cr=C3=A9ance compte TVA').td($amount->input()).td($ICheckBox->input()));
-
-     }
-     /* dette tva */
-     $dttva=3D$this->db->get_value("select pcm_val  from tva_belge.param=
eter_chld where pcode=3D'DTTVA'");
-     if ( $dttva !=3D ''  ) {
-       /* get saldo */
-       $saldo=3Dnew Acc_Account_Ledger($this->db,$dttva);
-       /* get label */
-       $lib=3D$this->db->get_value('select pcm_lib from tmp_pcmn where p=
cm_val=3D$1',array($dttva));
-
-       $cond=3Dsprintf(" j_date >=3Dto_date('%s','DD.MM.YYYY') and j_dat=
e <=3D '%s'",
-		     $first_day,
-		     $this->end_date);
-       $result=3D$saldo->get_solde_detail($cond);
-       $ICheckBox=3Dnew ICheckBox('dttva_ic');
-       $account=3Dnew IText('dttva');
-       $account->value=3D$dttva;
-       $amount=3Dnew INum('dttva_amount');
-       $amount->value=3Dabs($result['solde']);
-
-       if ( $result['credit'] > $result['debit'] ) {
-	 $amount_vat-=3D$result['solde'];
-	 $ICheckBox->selected=3Dtrue;
-       } else {
-	 $ICheckBox->selected=3Dfalse;
-	 $amount_vat+=3D$result['solde'];
-       }
-       /* display row */
-       if ( $result['solde'] !=3D 0)       $r.=3Dtr(td($account->input()=
).td('Dette Compte TVA').td($amount->input()).td($ICheckBox->input()));
-
-     }
-     /* if amount_vat > 0 then we have to pay */
-     if ( $amount_vat < 0 ) {
-       /* dette tva */
-       if ( $dttva !=3D ''  ) {
-	 /* get label */
-	 $lib=3D$this->db->get_value('select pcm_lib from tmp_pcmn where pcm_va=
l=3D$1',array($dttva));
-
-	 $ICheckBox=3Dnew ICheckBox('solde_ic');
-	 $ICheckBox->selected=3Dfalse;
-	 $account=3Dnew IText('solde');
-	 $account->value=3D$dttva;
-	 $amount=3Dnew INum('solde_amount');
-	 $amount->value=3Dabs($amount_vat);
-
-	 /* display row */
-	 $r.=3Dtr(td($account->input()).td('Dette Compte TVA').td($amount->inpu=
t()).td($ICheckBox->input()));
-       }
-     }else {
-       /* creance tva */
-       if ( $crtva !=3D ''  ) {
-	 /* get label */
-	 $lib=3D$this->db->get_value('select pcm_lib from tmp_pcmn where pcm_va=
l=3D$1',array($crtva));
-
-	 $ICheckBox=3Dnew ICheckBox('solde_ic');
-	 $ICheckBox->selected=3Dtrue;
-	 $account=3Dnew IText('solde');
-	 $account->value=3D$crtva;
-	 $amount=3Dnew INum('solde_amount');
-	 $amount->value=3Dabs($amount_vat);
-
-	 /* display row */
-	 $r.=3Dtr(td($account->input()).td('Cr=C3=A9ance Compte TVA').td($amoun=
t->input()).td($ICheckBox->input()));
-       }
-
-     }
-     $r.=3D'</table>';
-
-     return $r;
-   }
-   function display() {
-     $r=3D '<form class=3D"print" id=3D"readonly">';
-	 $r.=3DHtmlInput::request_to_hidden(array('ac'));
-     $r.=3D'<div style=3D"position:absolute;top:150;right:0;width:200;ri=
ght-margin:3%">';
-     $r.=3D$this->menu();
-     $r.=3D'</div>';
-     $r.=3D$this->display_info();
-     $r.=3D$this->display_declaration_amount();
-     $r.=3D'</form>';
-     $r.=3D create_script("$('readonly').disable();");
-     return $r;
-   }
-
-}

Deleted: trunk/rapport_avance/class_ext_tvagen.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/rapport_avance/class_ext_tvagen.php	2012-12-27 01:30:05 UTC (re=
v 457)
+++ trunk/rapport_avance/class_ext_tvagen.php	2013-01-06 00:40:23 UTC (re=
v 458)
@@ -1,207 +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 b=
y
- *   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-130=
7  USA
-*/
-/* $Revision$ */
-
-// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
-
-/*!\file
- * \brief
- */
-
-require_once('tva_constant.php');
-require_once('class_own.php');
-/**
- *@brief transform a string into an arrau without empty element and  dup=
licate
- * the array is sorted
- *@param $p_string string containing a comma a separator
- *@return array
- *
- */
-function get_array_nodup($p_string) {
-  $array=3Dexplode(',',$p_string);
-  sort($array);
-  $array=3Darray_unique($array);
-  $result=3Darray();
-  foreach ($array as $val) {
-    if ( $val =3D=3D '') continue;
-    $result[]=3D$val;
-  }
-  $r=3Djoin(',',$result);
-  return $result;
-}
-
-class Ext_Tva_Gen
-{
-  function __construct($p_cn) {
-    $this->db=3D$p_cn;
-  }
-  public function get_parameter($p_string) {
-    if ( array_key_exists($p_string,$this->variable) ) {
-      $idx=3D$this->variable[$p_string];
-      return $this->$idx;
-    }
-    else
-      throw new Exception (__FILE__.":".__LINE__.'Erreur attribut inexis=
tant');
-  }
-  public function set_parameter($p_string,$p_value) {
-    if ( array_key_exists($p_string,$this->variable) ) {
-      $idx=3D$this->variable[$p_string];
-      $this->$idx=3D$p_value;
-    }
-    else
-      throw new Exception (__FILE__.":".__LINE__.'Erreur attribut inexis=
tant');
-
-
-  }
-  public function get_info() {    return var_export(self::$variable,true=
);  }
-
-  public function save() {
-  /* please adapt */
-    if (  $this->get_parameter("id") =3D=3D 0 )
-      $this->insert();
-    else
-      $this->update();
-  }
-
-  static function choose_periode($by_year=3Dfalse) {
-    require_once('class_iradio.php');
-    $monthly=3Dnew IRadio('periodic');
-    $monthly->value=3D1;
-
-    // month
-    $month=3Dnew ISelect('bymonth');
-    $array=3Darray ();
-    for ($i=3D0;$i<12;$i++) {
-      $array[$i]['value']=3D$i+1; $array[$i]['label']=3Dsprintf('%02d',(=
$i+1));
-    }
-    $month->value=3D$array;
-    $monthly->selected=3Dtrue;
-    $str_monthly=3D$monthly->input();
-    $str_month=3D$month->input();
-    // year
-    $year =3D new IText('year');
-    $year->size=3D4;
-    $str_year=3D$year->input();
-
-    // Tri
-    $quater=3Dnew ISelect('byquaterly');
-    $array=3Darray();
-    for ($i=3D0;$i<4;$i++) {
-      $array[$i]['value']=3D$i+1; $array[$i]['label']=3Dsprintf('%02d',(=
$i+1));
-    }
-    $quater->value=3D$array;
-    $quaterly=3Dnew IRadio('periodic');
-    $quaterly->value=3D2;
-    $str_quaterly=3D$quaterly->input();
-    $str_quater=3D$quater->input();
-
-    $str_submit=3DHtmlInput::submit('decl',_('Afficher'));
-    $str_hidden=3DHtmlInput::extension().dossier::hidden();
-    if (isset($_REQUEST['sa']))
-      $str_hidden.=3DHtmlInput::hidden('sa',$_REQUEST['sa']);
-	$str_hidden.=3DHtmlInput::request_to_hidden(array('ac'));
-    $str_byyear=3D'';
-    if ( $by_year =3D=3D true ) {
-      $yearly=3Dnew IRadio('periodic');
-      $yearly->value=3D3;
-      $str_byyear=3D$yearly->input();
-    }
-    ob_start();
-    require_once('form_periode.php');
-    $r=3Dob_get_contents();
-    ob_end_clean();
-    return $r;
-  }
-
-  function blank($p_year,$p_periode,$p_flag_quaterly) {
-    // load parameter from myown
-    $own=3Dnew Own($this->db);
-    $this->set_parameter("name",$own->MY_NAME);
-    $this->set_parameter("num_tva",$own->MY_TVA);
-    $this->set_parameter('adress',$own->MY_STREET.",".$own->MY_NUMBER);
-    $this->set_parameter('country',$own->MY_COUNTRY." ".$own->MY_CP." ".=
$own->MY_COMMUNE);
-    $this->set_parameter('flag_periode',$p_flag_quaterly);
-    $this->set_parameter('periode_dec',$p_periode);
-    $this->set_parameter('exercice',$p_year);
-
-    try {
-      $this->verify() ;
-    } catch ( Exception $e) {
-      echo $e->getMessage();
-      throw $e;
-    }
-    // by month
-    if ( $p_flag_quaterly =3D=3D 1) {
-      // start periode =3D 01 to 31, $p_periode contains the month
-      $per_start=3D"01.".$p_periode.".".$p_year;
-      $day=3D31;
-      $per_end=3D"31".".".$p_periode.".".$p_year;
-      while ( checkdate($p_periode,$day,$p_year) =3D=3D false && $day > =
25) {
-	$day--;
-	$per_end=3D$day.".".$p_periode.".".$p_year;
-      }
-      if ($day < 28 ) { echo __FILE__.__LINE__." Erreur de date $day"; e=
xit;}
-    }
-
-    if ( $p_flag_quaterly =3D=3D 2 ) {
-      // compute start periode
-      $per_start=3D$GLOBALS['quaterly_limit'][$p_periode][0].".".$p_year=
;
-      $per_end=3D$GLOBALS['quaterly_limit'][$p_periode][1].".".$p_year;
-
-    }
-    if ( $p_flag_quaterly =3D=3D 3 ) {
-      // compute start periode
-      $per_start=3D'01.01.'.$p_year;
-      $per_end=3D'31.12.'.$p_year;
-    }
-
-    $this->set_parameter('start_periode',$per_start);
-    $this->set_parameter('end_periode',$per_end);
-
-  }
-
-  /**
-   *@brief display the information about the company
-   */
-  function display_info(){
-    $itva=3Dnew IText('num_tva',$this->num_tva);$str_tva=3D$itva->input(=
);
-    $iname=3Dnew IText('name',$this->tva_name); $str_name=3D$iname->inpu=
t();
-    $iadress=3Dnew IText('adress',$this->adress);$str_adress=3D$iadress-=
>input();
-    $icountry=3Dnew IText('country',$this->country);$str_country=3D$icou=
ntry->input();
-
-    /* date */
-
-    if (isset($this->date_decl)) { $idate=3Dnew IText('date',format_date=
($this->date_decl));$str_date=3D$idate->input();}
-
-    /* periode */
-
-    if ( isset($this->start_date) ){
-      $str_start=3Dformat_date($this->start_date);
-      $str_end=3Dformat_date($this->end_date);
-
-    }
-    $ianne=3D$this->exercice;
-    ob_start();
-    require_once('form_decl_info.php');
-    $r=3Dob_get_contents();
-    ob_end_clean();
-    return $r;
-  }
-
-}

Deleted: trunk/rapport_avance/class_install_plugin.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/rapport_avance/class_install_plugin.php	2012-12-27 01:30:05 UTC=
 (rev 457)
+++ trunk/rapport_avance/class_install_plugin.php	2013-01-06 00:40:23 UTC=
 (rev 458)
@@ -1,241 +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 b=
y
- *   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-130=
7  USA
-*/
-/* $Revision$ */
-
-// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
-
-/*!\file
- * \brief this class manages the installation and the patch of the plugi=
n
- */
-
-class Install_Plugin
-{
-
-  function __construct($p_cn) {
-    $this->cn=3D$p_cn;
-  }
-
-  /**
-   *@brief install the plugin, create all the needed schema, tables, pro=
c
-   * in the database
-   *@param $p_dossier is the dossier id
-   */
-  function install() {
-    $this->cn->start();
-    // create the schema
-    $this->create_schema();
-    // create table + put default values
-    $this->create_table_parameter();
-    $this->create_table_declaration_amount();
-    $this->create_table_intra();
-    $this->create_table_intra_child();
-    $this->create_table_assujetti();
-    $this->create_table_assujetti_child();
-
-    $this->cn->commit();
-  }
-  function create_schema() {
-    $this->cn->exec_sql('create schema tva_belge');
-  }
-  function create_table_assujetti() {
-    $sql=3D"
-CREATE TABLE tva_belge.assujetti
-(
-  a_id serial NOT NULL,
-  start_date date NOT NULL,
-  end_date date NOT NULL,
-  xml_oid oid,
-  periodicity character(1) NOT NULL,
-  tva_name text,
-  num_tva text,
-  adress text,
-  country text,
-  date_decl date DEFAULT now(),
-  periode_dec integer,
-  CONSTRAINT assujetti_pk PRIMARY KEY (a_id)
-)
-";
-    $this->cn->exec_sql($sql);
-  }
-  function create_table_assujetti_child() {
-   $sql=3D"
-CREATE TABLE tva_belge.assujetti_chld
-(
-  ac_id serial NOT NULL,
-  a_id bigint,
-  ac_tvanum text NOT NULL,
-  ac_amount numeric(20,4) NOT NULL,
-  ac_vat numeric(20,4) NOT NULL,
-  ac_qcode text NOT NULL,
-  ac_name text NOT NULL,
-  CONSTRAINT assujetti_chld_pk PRIMARY KEY (ac_id),
-  CONSTRAINT assujetti_fk FOREIGN KEY (a_id)
-      REFERENCES tva_belge.assujetti (a_id) MATCH SIMPLE
-      ON UPDATE NO ACTION ON DELETE CASCADE
-)
-";
-    $this->cn->exec_sql($sql);
-  }
-  function create_table_intra() {
-    $sql=3D<<<EOF
-
-CREATE TABLE tva_belge.intracomm
-(
-  i_id serial NOT NULL,
-  start_date date not null,
-  end_date date not null,
-  xml_oid oid,
-  periodicity char(1) not null,
-  tva_name text,
-  num_tva text,
-  adress text,
-  country text,
-  date_decl date default now(),
-  periode_dec integer,
-  CONSTRAINT intracom_pk PRIMARY KEY (i_id)
-)
-EOF;
-    $this->cn->exec_sql($sql);
-  }
-  function create_table_intra_child() {
-$sql=3D<<<EOF
-
-CREATE TABLE tva_belge.intracomm_chld
-(
-  ic_id serial,
-  i_id bigint,
-  ic_tvanum text NOT NULL,
-  ic_amount numeric(20,4) NOT NULL,
-  ic_code character varying(1) NOT NULL,
-  ic_periode character varying(6) NOT NULL,
-  ic_qcode text not null,
-  ic_name text not null,
-  CONSTRAINT intracom_chld_pk PRIMARY KEY (ic_id),
- CONSTRAINT intracom_fk FOREIGN KEY (i_id)
-      REFERENCES tva_belge.intracomm (i_id) MATCH SIMPLE
-      ON UPDATE NO ACTION ON DELETE CASCADE
-)
-EOF;
-$this->cn->exec_sql($sql);
-  }
-  /**
-   *@brief create the table tva_belge.declaration_amount
-   */
-  function create_table_declaration_amount() {
-    $sql=3D<<<EOF
-      create table tva_belge.declaration_amount
-(
- da_id serial,
- d00 numeric(20,4) default 0.0 not null,
- d01 numeric(20,4) default 0.0 not null,
- d02 numeric(20,4) default 0.0 not null,
- d03 numeric(20,4) default 0.0 not null,
- d44 numeric(20,4) default 0.0 not null,
- d45 numeric(20,4) default 0.0 not null,
- d46 numeric(20,4) default 0.0 not null,
- d47 numeric(20,4) default 0.0 not null,
- d48 numeric(20,4) default 0.0 not null,
- d49 numeric(20,4) default 0.0 not null,
- d81 numeric(20,4) default 0.0 not null,
- d82 numeric(20,4) default 0.0 not null,
- d83 numeric(20,4) default 0.0 not null,
- d84 numeric(20,4) default 0.0 not null,
- d85 numeric(20,4) default 0.0 not null,
- d86 numeric(20,4) default 0.0 not null,
- d87 numeric(20,4) default 0.0 not null,
- d88 numeric(20,4) default 0.0 not null,
- d54 numeric(20,4) default 0.0 not null,
- d55 numeric(20,4) default 0.0 not null,
- d56 numeric(20,4) default 0.0 not null,
- d57 numeric(20,4) default 0.0 not null,
- d61 numeric(20,4) default 0.0 not null,
- d63 numeric(20,4) default 0.0 not null,
- dxx numeric(20,4) default 0.0 not null,
- d59 numeric(20,4) default 0.0 not null,
- d62 numeric(20,4) default 0.0 not null,
- d64 numeric(20,4) default 0.0 not null,
- dyy numeric(20,4) default 0.0 not null,
- d71 numeric(20,4) default 0.0 not null,
- d72 numeric(20,4) default 0.0 not null,
- d91 numeric(20,4) default 0.0 not null,
- start_date date not null,
- end_date date not null,
- xml_oid oid,
- periodicity char(1) not null,
- tva_name text,
- num_tva text,
- adress text,
- country text,
- date_decl date default now(),
- periode_dec integer,
-  CONSTRAINT declaration_amount_pkey PRIMARY KEY (da_id)
- );
-EOF;
-$this->cn->exec_sql($sql);
-
-  }
-  function create_table_parameter() {
-$sql=3D<<<EOF
-CREATE TABLE tva_belge.parameter
-(
-  pcode text NOT NULL,
-  pvalue text,
-  paccount text,
-  CONSTRAINT parameter_pkey PRIMARY KEY (pcode)
- );
-EOF;
-$this->cn->exec_sql($sql);
-// load default value
-$array=3Darray(
-	     'GRIL00'=3D>array('6',''),
-	     'GRIL01'=3D>array('3',''),
-	     'GRIL02'=3D>array('2',''),
-	     'GRIL03'=3D>array('1',''),
-	     'GRIL44'=3D>array('',''),
-	     'GRIL45'=3D>array('',''),
-	     'GRIL46'=3D>array('5','70%,71%'),
-	     'GRIL47'=3D>array('',''),
-	     'GRIL48'=3D>array('','7091'),
-	     'GRIL49'=3D>array('','7092'),
-	     'GRIL81'=3D>array('1,2,3','60%'),
-	     'GRIL82'=3D>array('1,2,3','61%'),
-	     'GRIL83'=3D>array('1,2,3','22%,23%,24%,25%'),
-	     'GRIL84'=3D>array('1,2,3,4','6091'),
-	     'GRIL85'=3D>array('',''),
-	     'GRIL86'=3D>array('5','61%,22%,23%,24%,25%,60%'),
-	     'GRIL87'=3D>array('',''),
-	     'GRIL88'=3D>array('',''),
-	     'GRIL54'=3D>array('1,2,3','7%'),
-	     'GRIL55'=3D>array('',''),
-	     'GRIL56'=3D>array('',''),
-	     'GRIL57'=3D>array('',''),
-	     'GRIL61'=3D>array('',''),
-	     'GRIL63'=3D>array('',''),
-	     'GRIL59'=3D>array('1,2,3','6%,22%,23%,24%,25%'),
-	     'GRIL62'=3D>array('',''),
-	     'GRIL64'=3D>array('',''),
-	     'ATVA'=3D>array('','4117')
-	     );
-
-foreach ($array as $code=3D>$value) {
-  $this->cn->exec_sql('insert into tva_belge.parameter(pcode,pvalue,pacc=
ount) values ($1,$2,$3)',
-		      array($code,$value[0],$value[1]));
-  }
-}
-}

Deleted: trunk/rapport_avance/class_listing.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/rapport_avance/class_listing.php	2012-12-27 01:30:05 UTC (rev 4=
57)
+++ trunk/rapport_avance/class_listing.php	2013-01-06 00:40:23 UTC (rev 4=
58)
@@ -1,40 +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-1=
307  USA
-   */
-  /* $Revision$ */
-
-  // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
-
-  /*!\file
-   * \brief
-   */
-require_once('class_ext_tvagen.php');
-require_once('class_acc_parm_code.php');
-class Listing extends Ext_Tva_Gen {
-  function find_tva_code($p_array)
-	{
-		$array=3D$this->db->make_list("
-			select distinct tva_id  from tva_belge.parameter_chld
-			where
-			pcode=3D$1",
-				array($p_array));
-
-		return $array;
-	}
-
-}
\ No newline at end of file

Deleted: trunk/rapport_avance/class_tva_amount.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/rapport_avance/class_tva_amount.php	2012-12-27 01:30:05 UTC (re=
v 457)
+++ trunk/rapport_avance/class_tva_amount.php	2013-01-06 00:40:23 UTC (re=
v 458)
@@ -1,204 +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 b=
y
- *   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-130=
7  USA
-*/
-/* $Revision$ */
-
-// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
-
-/*!\file
- * \brief
- */
-
-
-/*!\brief
- *
- *
- */
-class Tva_Amount
-{
-
-  private static $variable=3Darray('amount'=3D>'amount',
-				 'amount_tva'=3D>'amount_tva',
-				 'param'=3D>'param',
-				 'dir'=3D>'dir',
-				 'start_periode'=3D>'start_periode',
-				 'end_periode'=3D>'end_periode',
-				 'grid'=3D>'grid'
-				 );
-  function __construct ($p_init,$p_dir,$p_start_periode,$p_end_periode) =
{
-    $this->db=3D$p_init;
-    $this->start_periode=3D$p_start_periode;
-    $this->end_periode=3D$p_end_periode;
-    $this->dir=3D$p_dir;
-  }
-  public function get_parameter($p_string) {
-    if ( array_key_exists($p_string,self::$variable) ) {
-      $idx=3Dself::$variable[$p_string];
-      return $this->$idx;
-    }
-    else
-      exit (__FILE__.":".__LINE__.'Erreur attribut inexistant');
-  }
-  public function set_parameter($p_string,$p_value) {
-    if ( array_key_exists($p_string,self::$variable) ) {
-      $idx=3Dself::$variable[$p_string];
-      $this->$idx=3D$p_value;
-    }
-    else
-      exit (__FILE__.":".__LINE__.'Erreur attribut inexistant');
-
-
-  }
-  public function get_info() {    return var_export(self::$variable,true=
);  }
-  public function verify() {
-    // Verify that the elt we want to add is correct
-  }
-  /**
-   *@brief load parameters and set param to a array of value from parame=
ter_chld
-   */
-  public function load_parameter() {
-    //  get the vat code
-     $ctva=3D$this->db->get_array("select tva_id,pcm_val from tva_belge.=
parameter_chld where pcode=3D$1",array($this->grid));
-     if ( count($ctva)=3D=3D 0 ) {
-       $this->param=3Dnull;
-     }
-     $this->param=3D$ctva;
-  }
-  /**
-   *@brief get the amount of vat thanks its code
-   *@param $p_gril is the gril code
-   *@param $p_dir is out or in in for the table quant_purchase and
-   * out for the table quant_sold
-   *@return a number
-   */
-  function amount_operation() {
-    // get the VAT code
-    $this->load_parameter();
-    $result=3D0;
-	bcscale(4);
-	for ($i=3D0;$i<count($this->param);$i++)
-	{
-		$tmp_calc=3D$this->get_amount_filter($this->param[$i]['tva_id'],$this-=
>param[$i]['pcm_val']);
-		$result=3Dbcadd($result,$tmp_calc);
-
-	}
-    return round($result,2);
-
-
-  }
-  function amount_vat() {
-    // get the VAT code
-   $this->load_parameter();
-    $result=3D0;
-	bcscale(4);
-	for ($i=3D0;$i<count($this->param);$i++)
-	{
-		$tmp_calc=3D$this->get_vat_filter($this->param[$i]['tva_id'],$this->pa=
ram[$i]['pcm_val']);
-		$result=3Dbcadd($result,$tmp_calc);
-
-	}
-    return round($result,2);
-
-
-  }
-
-  /**
-   *@brief get the amount of operation from the table quant_sold or quan=
t_purchase
-   *@return amount
-   */
-  private function get_amount_filter($p_code,$p_account) {
-    if ( $this->dir =3D=3D 'out' && trim($p_account) !=3D'' && trim($p_c=
ode) !=3D'' ) {
-      $sql=3D"select coalesce(sum(qs_price),0) as amount from quant_sold
-		  join jrnx using (j_id)
-           where qs_vat_code=3D$1 and  (j_date >=3D to_date($2,'DD.MM.YY=
YY') and j_date <=3D to_date($3,'DD.MM.YYYY'))
-           and j_poste::text like ($4)";
-      $res=3D$this->db->get_array($sql,array($p_code,
-					   $this->start_periode,
-					   $this->end_periode,
-					   $p_account));
-      return $res[0]['amount'];
-    }
-
-    if ( $this->dir =3D=3D 'in' && trim($p_account) !=3D'' && trim($p_co=
de) !=3D'' ) {
-      $sql=3D"select coalesce(sum(qp_price),0) as amount from quant_purc=
hase join jrnx using (j_id)
-           where qp_vat_code=3D$1 and  (j_date >=3D to_date($2,'DD.MM.YY=
YY') and j_date <=3D to_date($3,'DD.MM.YYYY'))
-           and j_poste::text like ($4)";
-      $res=3D$this->db->get_array($sql,array($p_code,
-					   $this->start_periode,
-					   $this->end_periode,
-					   $p_account));
-      return $res[0]['amount'];
-    }
-
-
-    return 0;
-  }
-
-  /**
-   *@brief get the amount of VAT from the table quant_sold or quant_purc=
hase
-   *@return amount
-   */
-  private function get_vat_filter($p_code,$p_account) {
-    if ( $this->dir =3D=3D 'out' && trim($p_account) !=3D'' && trim($p_c=
ode) !=3D'' ) {
-      $sql=3D"select coalesce(sum(qs_vat),0) as amount from quant_sold j=
oin jrnx using (j_id)
-           where qs_vat_code=3D$1 and  (j_date >=3D to_date($2,'DD.MM.YY=
YY') and j_date <=3D to_date($3,'DD.MM.YYYY'))
-           and j_poste::text like ($4)";
-      $res=3D$this->db->get_array($sql,array($p_code,
-					   $this->start_periode,
-					   $this->end_periode,
-					   $p_account));
-      return $res[0]['amount'];
-    }
-
-    if ( $this->dir =3D=3D 'in' && trim($p_account) !=3D'' && trim($p_co=
de) !=3D'' ) {
-      $sql=3D"select coalesce(sum(qp_vat),0) as amount from quant_purcha=
se join jrnx using (j_id)
-           where qp_vat_code=3D$1 and  (j_date >=3D to_date($2,'DD.MM.YY=
YY') and j_date <=3D to_date($3,'DD.MM.YYYY'))
-           and j_poste::text like ($4)";
-      $res=3D$this->db->get_array($sql,array($p_code,
-					   $this->start_periode,
-					   $this->end_periode,
-					   $p_account));
-      return $res[0]['amount'];
-    }
-
-
-    return 0;
-  }
-
-/**
- *@brief
- * record into the ledger the operation for purging the
- * the vat accouting
- */
-function record_ledger() {
-
-}
-
-  /*!\brief
-   *\param
-   *\return
-   *\note
-   *\see
-   *\todo
-   */
-  static function test_me() {
-  }
-
-}
-
-/* test::test_me(); */

Deleted: trunk/rapport_avance/class_tva_parameter.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/rapport_avance/class_tva_parameter.php	2012-12-27 01:30:05 UTC =
(rev 457)
+++ trunk/rapport_avance/class_tva_parameter.php	2013-01-06 00:40:23 UTC =
(rev 458)
@@ -1,146 +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 b=
y
- *   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-130=
7  USA
-*/
-/* $Revision$ */
-
-// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
-
-/*!\file
- * \brief
- */
-
-
-/*!\brief
- *
- *
- */
-class  Tva_Parameter
-{
-  private static $variable=3Darray("code"=3D>"pcode","value"=3D>"pvalue"=
,"account"=3D>'paccount');
-  function __construct ($p_init) {
-    $this->cn=3D$p_init;
-  }
-  public function get_parameter($p_string) {
-    if ( array_key_exists($p_string,self::$variable) ) {
-      $idx=3Dself::$variable[$p_string];
-      return $this->$idx;
-    }
-    else
-      exit (__FILE__.":".__LINE__.$p_string.' Erreur attribut inexistant=
');
-  }
-  public function set_parameter($p_string,$p_value) {
-    if ( array_key_exists($p_string,self::$variable) ) {
-      $idx=3Dself::$variable[$p_string];
-      $this->$idx=3D$p_value;
-    }
-    else
-      exit (__FILE__.":".__LINE__.$p_string.' Erreur attribut inexistant=
');
-
-
-  }
-  public function get_info() {    return var_export(self::$variable,true=
);  }
-  public function verify() {
-    // Verify that the elt we want to add is correct
-  }
-  /**
-   *@brief retrieve * row thanks a condition
-   */
-   public function seek($cond,$p_array=3Dnull)
-   {
-   /*
-     $sql=3D"select * from * where $cond";
-     return $this->cn->get_array($cond,$p_array)
-  */
-   }
-  public function insert() {
-    if ( $this->verify() !=3D 0 ) return;
-
-    $sql=3D"insert into tva_belge.parameter (pcode,pvalue,paccount) ".
-      " values ($1,$2) ";
-    $this->tva_id=3D$this->cn->exec_sql(
-				       $sql,
-				       array($this->pcode,
-					     $this->pvalue,
-					     $this->paccount)
-				       );
-
-  }
-
-  public function update() {
-    if ( $this->verify() !=3D 0 ) return;
-
-    $sql=3D"update tva_belge.parameter  set pvalue=3D$1,paccount=3D$2 ".
-      " where pcode =3D $3";
-    $res=3D$this->cn->exec_sql(
-		 $sql,
-		 array($this->pvalue,
-		       $this->paccount,
-		       $this->pcode)
-		 );
-
-  }
-
-  public function load() {
-
-   $sql=3D"select pcode from tva_belge.parameter where pcode=3D$1";
-
-    $res=3D$this->cn->get_array(
-		 $sql,
-		 array($this->pcode)
-		 );
-
-    if ( count($res) =3D=3D 0 ) return -1;
-    for ($i=3D0;$i<count($res);$i++) { $this->pcode=3D$res[$i]['pcode'];=
$this->pvalue=3D$res[$i]['pvalue'];$this->paccount=3D$res[$i]['paccount']=
; }
-    return 0;
-  }
-  /**
-   *@brief check that this accounting does exist in the accounting plan
-   *@param $p_code code to check
-   *@return the number of row found (0 if none)
-   */
-  public function exist_pcmn($p_code) {
-    $count=3D$this->cn->get_value('select count(*) from tmp_pcmn where p=
cm_val::text like $1',array($p_code));
-    return $count;
-  }
-  /**
-   *@brief show the content of the table tva_belge.parameter
-   */
-  public function display() {
-	 global $cn;$cn=3D$this->cn;
-
-	$res=3D$this->cn->get_array("select pcode from tva_belge.parameter");
-
-    ob_start();
-    require_once('form_parameter.php');
-    $r=3Dob_get_contents();
-    ob_end_clean();
-    return $r;
-  }
-  /*!\brief
-   *\param
-   *\return
-   *\note
-   *\see
-   *\todo
-   */
-  static function test_me() {
-  }
-
-}
-
-/* test::test_me(); */

Deleted: trunk/rapport_avance/decl_tva.inc.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/rapport_avance/decl_tva.inc.php	2012-12-27 01:30:05 UTC (rev 45=
7)
+++ trunk/rapport_avance/decl_tva.inc.php	2013-01-06 00:40:23 UTC (rev 45=
8)
@@ -1,111 +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 b=
y
- *   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-130=
7  USA
-*/
-/* $Revision$ */
-
-// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
-
-/*!\file
- * \brief this file is included to create a  new VAT declaration
- *=20
- */
-require_once('class_ext_tva.php');
-echo '<div class=3D"content" style=3D"width:80%;margin-left:10%">';
-
-// verify the year
-if ( isset($_REQUEST['year']) && (trim(strlen($_REQUEST['year'])) < 4 ||=
 isNumber($_REQUEST['year'] ) =3D=3D 0 ||$_REQUEST['year'] < 2000||$_REQU=
EST['year']>2100)) {
-  alert(j(_('Ann=C3=A9e invalide'.' ['.$_REQUEST['year'].']')));
-  echo Ext_Tva::choose_periode();
-  echo '</div>';
-  exit;
-}
-
-  // if the periode is not set we have to ask it
-if ( ! isset($_REQUEST['decl']) ){
-  echo Ext_Tva::choose_periode();
-  echo '</div>';
-  exit;
-}
-$cn=3Dnew Database(Dossier::id());
-if (isset($_POST['save'] )) {
-  $save=3Dnew Ext_Tva($cn);
-  $save->from_array($_POST);
-  $save->insert();
-  echo h2info(_('D=C3=A9claration sauv=C3=A9e'));
-  echo $save->display();
-  /**
-   *@todo add a div for the button generate, get_xml, create ODS, print.=
..
-   */
-//   echo '<div style=3D"position:absolute;z-index:14;top:25%;right:30" =
class=3D"noprint">aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</d=
iv>';
-  echo '</div>';
-  exit;
-}
-
-$tva=3Dnew Ext_Tva($cn);
-
-/* by month */
-if ( $_REQUEST['periodic']=3D=3D1) {
-  $str_monthly=3D'';
-  $str_month=3D$_GET['bymonth'];$str_year=3D$_GET['year'];$str_quaterly=3D=
"";$str_hidden=3D'';$str_submit=3D'';$str_quater=3D'-';
-  $tva->blank($_REQUEST['year'],$_GET['bymonth'],1);
-
-}
-
-/* by quater */
-if ($_REQUEST['periodic'] =3D=3D 2) {
-  $str_quaterly=3D'';
-  $str_month=3D"-";
-  $str_year=3D$_GET['year'];
-  $str_quater=3D$_REQUEST['byquaterly'];
-  $str_hidden=3D'';$str_submit=3D'';$str_monthly=3D'';
-  $tva->blank($_REQUEST['year'],$_GET['byquaterly'],2);
-}
-try {
-  $r=3D$tva->compute();
-} catch (Exception $e) {
-
-  echo '<div class=3D"content" style=3D"width:80%;margin-left:10%">';
-  echo Ext_Tva::choose_periode();
-  echo '</div>';
-  exit();
-  }
-require_once('form_periode.php');
-echo '<form class=3D"print" method=3D"post">';
-echo dossier::hidden();
-echo HtmlInput::extension();
-echo HtmlInput::hidden('start_periode',$tva->start_periode);
-echo HtmlInput::hidden('end_periode',$tva->end_periode);
-echo HtmlInput::hidden('flag_periode',$tva->flag_periode);
-echo HtmlInput::hidden('name',$tva->tva_name);
-echo HtmlInput::hidden('num_tva',$tva->num_tva);
-echo HtmlInput::hidden('adress',$tva->adress);
-echo HtmlInput::hidden('country',$tva->country);
-echo HtmlInput::hidden('exercice',$tva->exercice);
-
-
-
-echo $tva->display_info();
-echo $r;
-echo $tva->display_declaration_amount();
-echo HtmlInput::submit('save',_('Sauvegarde'));
-echo '</form>';
-echo '</div>';
-  // create the XML files and the OD operation, validate it to save it i=
nto the vat history
-
-
-?>

Copied: trunk/rapport_avance/doc/rapav.odt (from rev 457, tag/rel652/rapp=
ort_avance/doc/rapav.odt)
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
(Binary files differ)

Deleted: trunk/rapport_avance/form_decl.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/rapport_avance/form_decl.php	2012-12-27 01:30:05 UTC (rev 457)
+++ trunk/rapport_avance/form_decl.php	2013-01-06 00:40:23 UTC (rev 458)
@@ -1,237 +0,0 @@
-<style type=3D"text/css">
-   h1 {
- color : blue;
- font-size:120%;
- }
-   table tr {
-     font-size:12px;
-   }
-</style>
-<h1>Cadre II : Op=C3=A9rations =C3=A0 la sortie </h1>
-<table>
-<tr>
-<td>
-A. Op=C3=A9rations soumises =C3=A0 un r=C3=A9gime particulier [00]
-</td>
-<td>
-<?=3D$str_00;?>
-</td>
-</tr><tr>
-<td>
- B. Op=C3=A9rations pour lesquelles la T.V.A. est due par le d=C3=A9clar=
ant :</td></td>
- </tr><tr>
- <td>&nbsp;&nbsp;&nbsp;&nbsp;- au taux de 6% [01]</td>
-<td>
-<?=3D$str_01;?>
-</td>
- </tr><tr><td>&nbsp;&nbsp;&nbsp;&nbsp;- au taux de 12% [02]</td>
-<td>
-<?=3D$str_02;?>
-</td>
- </tr><tr><td>&nbsp;&nbsp;&nbsp;&nbsp;- au taux de 21% [03] </td>
-<td>
-<?=3D$str_03;?>
-</td>
-</tr><tr>
-<td>
-C. Services pour lesquels la T.V.A. =C3=A9trang=C3=A8re est due par le c=
ocontractant [44]
-</td>
-<td>
-<?=3D$str_44;?>
-</td>
-</tr><tr>
-<td>
-D. Op=C3=A9rations pour lesquelles la T.V.A. est due par le cocontractan=
t [45]
-</td>
-<td>
-<?=3D$str_45;?>
-</td>
-</tr><tr>
-<td>
-E. Livraisons intracommunautaires exempt=C3=A9es effectu=C3=A9es en Belg=
ique et ventes ABC [46]
-</td>
-<td>
-<?=3D$str_46;?>
-</td>
-</tr><tr>
-<td>
- F. Autres op=C3=A9rations exempt=C3=A9es et autres op=C3=A9rations effe=
ctu=C3=A9es =C3=A0 l'=C3=A9tranger [47]
-</td>
-<td>
-<?=3D$str_47;?>
-</td>
-</tr><tr>
-<td>
-G. Montant des notes de cr=C3=A9dit d=C3=A9livr=C3=A9es et des correctio=
ns n=C3=A9gatives : </td>
- </tr><tr>
- <td>&nbsp;&nbsp;&nbsp;&nbsp;- relatif aux op=C3=A9rations inscrites en =
grilles 44 et 46 [48] </td>
-<td>
-<?=3D$str_48;?>
-</td>
-
- </tr><tr>
- <td>&nbsp;&nbsp;&nbsp;&nbsp;- relatif aux autres op=C3=A9rations du cad=
re II [49]</td>
-<td>
-<?=3D$str_49;?>
-</td>
-
- </tr><tr>
- </table>
-
-<h1>Cadre III : Op=C3=A9rations =C3=A0 l'entr=C3=A9e</h1>
-<table>
-<tr>
-<td>A. Montant des op=C3=A9rations =C3=A0 l'entr=C3=A9e compte tenu des =
notes de cr=C3=A9dit re=C3=A7ues et autres corrections : </td>
-</tr>
-<tr>
-<td>&nbsp;&nbsp;&nbsp;&nbsp;- marchandises, mati=C3=A8res premi=C3=A8res=
 et mati=C3=A8res auxiliaires [81] </td>
-<td>
-<?=3D$str_81;?>
-</td>
-</tr>
-<tr>
-<td>&nbsp;&nbsp;&nbsp;&nbsp;- services et biens divers [82]  </td>
-<td>
-<?=3D$str_82;?>
-</td>
-</tr>
-<tr>
-<td>&nbsp;&nbsp;&nbsp;&nbsp;- biens d'investissement [83]  </td>
-<td>
-<?=3D$str_83;?>
-</td>
-</tr>
-<tr>
-<td>B. Montant des notes de cr=C3=A9dit re=C3=A7ues et des corrections n=
=C3=A9gatives : </td>
-</tr>
-<tr>
-<td>&nbsp;&nbsp;&nbsp;&nbsp;- relatif aux op=C3=A9rations inscrites en g=
rilles 86 et 88 [84]  </td>
-<td>
-<?=3D$str_84;?>
-</td>
-</tr>
-<tr>
-<td>&nbsp;&nbsp;&nbsp;&nbsp;- relatif aux autres op=C3=A9rations du cadr=
e III [85]  </td>
-<td>
-<?=3D$str_85;?>
-</td>
-</tr>
-<tr>
-<td>C. Acquisitions intracommunautaires effectu=C3=A9es en Belgique et v=
entes ABC [86] </td>
-<td>
-<?=3D$str_86;?>
-</td>
-</tr>
-<tr>
-<td>
-D. Autres op=C3=A9rations =C3=A0 l'entr=C3=A9e pour lesquelles la T.V.A.=
 est due par le d=C3=A9clarant [87] </td>
-<td><?=3D$str_87?></td>
-</tr><tr>
-<td> E. Services intracommunautaires avec report de perception [88]</td>
-<td>
-<?=3D$str_88?>
-</td>
-</table>
-
-<h1>Cadre IV : Taxe due</h1>
-<table>
-<tr><TD> A. T.V.A. relative aux op=C3=A9rations d=C3=A9clar=C3=A9es en=C2=
=A0: </td>
-</tr>
-<tr>
-<tr><td>&nbsp;&nbsp;&nbsp;&nbsp;-grilles 01, 02 et 03 [54]</td>
-<td>
-<?=3D$str_54;?>
-</td>
-</tr>
-<td>&nbsp;&nbsp;&nbsp;&nbsp;- grilles 86 et 88 [55] </td>
-<td>
-<?=3D$str_55;?>
-</td>
-</tr>
-<tr>
-<tr>
-<td>&nbsp;&nbsp;&nbsp;&nbsp;- grille 87, =C3=A0 l'exception des importat=
ions avec report de perception [56] </td>
-<td><?=3D$str_56;?></td>
-</tr>
-<tr>
-<td>
-B. T.V.A. relative aux importations avec report de perception [57] </td>
-<td><?=3D$str_57;?></td>
-</tr>
-<tr>
-<td>
-
-C. Diverses r=C3=A9gularisations T.V.A. en faveur de l'Etat [61]</td>
-<td><?=3D$str_61?></td>
-</tr>
-<tr>
-<td>
-D. T.V.A. =C3=A0 reverser mentionn=C3=A9e sur les notes de cr=C3=A9dit r=
e=C3=A7ues [63]
-</td>
-<td><?=3D$str_63;?></td>
-</tr>
-<tr>
-<td>
-Total des grilles 54, 55, 56, 57, 61 et 63 [XX]
-</td>
-<td>
-<?=3D$str_xx;?>
-</td>
-</tr>
-</table>
-<h1>Cadre V : Taxes d=C3=A9ductibles, solde et acompte</h1>
-<table>
-<tr>
-<td>
-A.T.V.A. d=C3=A9ductible  [59]
-</td>
-<td>
-<?=3D$str_59;?>
-</td>
-</tr>
-<tr>
-<td>B.Diverses r=C3=A9gularisations T.V.A. en faveur du d=C3=A9clarant  =
[62]
-</td>
-<td>
-<?=3D$str_62;?>
-</td>
-</tr>
-<tr>
-<td>C.T.V.A. =C3=A0 r=C3=A9cup=C3=A9rer mentionn=C3=A9e sur les notes de=
 cr=C3=A9dit d=C3=A9livr=C3=A9es [64]
-</td>
-<td>
-<?=3D$str_64;?>
-</td>
-</tr>
-<tr>
-<td>
-Total des grilles 59, 62 et 64[yy]
-</td>
-<td><?=3D$str_yy;?></td>
-</tr>
-</table>
-
-<h1>Cadre VI : Solde*</h1>
-<table>
-<tr>
-<td>Taxe due =C3=A0 l'Etat : grille xx - grille yy [71]</td>
-<td><?=3D$str_71;?></td>
-</tr>
-<tr>
-<td>Sommes dues par l'Etat : grille yy - grille xx [72]</td>
-<td><?=3D$str_72;?></td>
-</tr>
-</table>
-<span class=3D"notice">*Une seule des grilles 71 ou 72 peut =C3=AAtre re=
mplie </span>
-
-<h1>Cadre VII : Acompte*</h1>
-<table>
-<tr>
-<td>
-T.V.A. r=C3=A9ellement due pour la p=C3=A9riode du 1er au 20 d=C3=A9cemb=
re[91]
-</td>
-<td><?=3D$str_91;?></td>
-</tr>
-</table>
-<span class=3D"notice">*Concerne uniquement la d=C3=A9claration mensuell=
e de d=C3=A9cembre</span>
-

Deleted: trunk/rapport_avance/form_decl_info.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/rapport_avance/form_decl_info.php	2012-12-27 01:30:05 UTC (rev =
457)
+++ trunk/rapport_avance/form_decl_info.php	2013-01-06 00:40:23 UTC (rev =
458)
@@ -1,31 +0,0 @@
-<h1>Cadre I : renseignements g=C3=A9n=C3=A9raux</h1>
-
-<table>
-<tr>
-<td>Ann=C3=A9e</td><td> <?=3D$ianne?></td>
-</tr>
-<?if (isset ($str_date)) :?>
-<tr>
-<td>Date </td><td><?=3D$str_date?></td>
-</tr>
-<tr>
-<td>P=C3=A9riode d=C3=A9but </td><td><?=3D$str_start?></td>
-</tr>
-<tr>
-<td>P=C3=A9riode fin </td><td><?=3D$str_end?></td>
-</tr>
-<?
-endif;
-?>
-<td>N=C2=B0 de tva </td>
-<td><?=3D$str_tva?></td>
-</tr><tr>
-<td>Nom</td><td><?=3D$str_name?></td>
-</tr><tr>
-<td>Adresse</td><td><?=3D$str_adress?></td>
-</tr><tr>
-<td>Pays code postal et localite BE</td><td><?=3D$str_country?></td>
-</tr>
-</tr>
-
-</table>

Deleted: trunk/rapport_avance/form_parameter.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/rapport_avance/form_parameter.php	2012-12-27 01:30:05 UTC (rev =
457)
+++ trunk/rapport_avance/form_parameter.php	2013-01-06 00:40:23 UTC (rev =
458)
@@ -1,195 +0,0 @@
-<?php
-global $tab;
-function show($p_code,$p_desc) {
-	global $cn,$tab;
-	echo "<h2>".h($p_code)." ".$p_desc."</h2>";
-	$plugin_code=3D$_REQUEST['plugin_code'];
-	$dossier=3DDossier::id();
-	$a_code=3D$cn->get_array("
-			select pi_id, pc.tva_id,tva_label,tva_comment,tva_rate, pcm_val
-			from tva_belge.parameter_chld as pc
-			left join tva_rate as tv on (pc.tva_id=3Dtv.tva_id)
-			where pcode=3D$1 order by pi_id",
-			array($p_code));
-	if (sizeof($a_code) =3D=3D 0) {
-		echo '<span class=3D"notice" style=3D"display:block">Aucun param=C3=A8=
tre donn=C3=A9 </span>';
-
-		echo HtmlInput::button("add_param","Ajout param=C3=A8tre","onclick=3D\=
"show_addparam('$p_code','$plugin_code','$dossier','$tab');\"");
-		return;
-	}
-	$n_max=3Dsizeof($a_code);
-	echo "<table class=3D\"result\">";
-	echo "<tr>";
-	echo th("Code TVA");
-	echo th("Label");
-	echo th("Description");
-	echo th("Taux");
-	echo th("utilisant le poste comptable");
-	echo "</tr>";
-	for ($i=3D0;$i<$n_max;$i++)
-	{
-		echo "<tr>";
-		echo td($a_code[$i]['tva_id']);
-		echo td($a_code[$i]['tva_label']);
-		echo td($a_code[$i]['tva_comment']);
-		echo td($a_code[$i]['tva_rate']);
-		echo td("Poste comptable :".$a_code[$i]['pcm_val']);
-		echo '<td>';
-		echo '<form id=3D"f'.$a_code[$i]['pi_id'].'" method=3D"POST">';
-		echo HtmlInput::hidden("pi_id",$a_code[$i]['pi_id']);
-		echo HtmlInput::hidden("tab",$tab);
-		echo HtmlInput::anchor("Effacer","","onclick=3D\"if ( confirm('Vous co=
nfirmez?')) { $('f".$a_code[$i]['pi_id']."').submit(this);} else {return =
false;}\"");
-		echo "</form>";
-		echo '</td>';
-		echo "</tr>";
-	}
-	echo "</table>";
-	echo HtmlInput::button("add_param","Ajout param=C3=A8tre","onclick=3D\"=
show_addparam('$p_code','$plugin_code','$dossier','$tab');\"");
-}
-?>
-<?
-	$tab_default=3D(isset ($_REQUEST['tab']))?$_REQUEST['tab']:'opout';
-?>
-<a href=3D"javascript:void(0)" class=3D"line" onclick=3D"tva_show_param(=
'opout')">Op=C3=A9ration =C3=A0 la sortie</a>&nbsp;
-<a href=3D"javascript:void(0)" class=3D"line" style=3D"" onclick=3D"tva_=
show_param('opin')">Op=C3=A9ration =C3=A0 l'entr=C3=A9e </a>&nbsp;
-<a href=3D"javascript:void(0)" class=3D"line" onclick=3D"tva_show_param(=
'tvadue')">TVA Due</a>&nbsp;
-<a href=3D"javascript:void(0)" class=3D"line" onclick=3D"tva_show_param(=
'tvaded')">TVA D=C3=A9ductible</a>&nbsp;
-<a href=3D"javascript:void(0)" class=3D"line" onclick=3D"tva_show_param(=
'lintra')">Listing Client Intracomm.</a>&nbsp;
-<a href=3D"javascript:void(0)" class=3D"line" onclick=3D"tva_show_param(=
'assujetti')">Listing Client assujetti.</a>&nbsp;
-<a href=3D"javascript:void(0)" class=3D"line" onclick=3D"tva_show_param(=
'divers')">Divers</a>
-<form method=3D"POST">
-	<?
-	echo HtmlInput::hidden('tab',$tab_default);
-	echo HtmlInput::request_to_hidden(array('gDossier','ac','plugin_code','=
sa'));
-	?>
-<div style=3D"display:none" id=3D"opout">
-<h1><?=3D_("Op=C3=A9ration =C3=A0 la sortie");?></h1>
-<? $tab=3D"opout";?>
-<?=3Dshow("GRIL00",_("Grille 00 : op=C3=A9rations soumises =C3=A0 un r=C3=
=A9gime particulier"))?>
-<?=3Dshow("GRIL01",_("Grille 01 : Op=C3=A9rations pour lesquelles la TVA=
 est due (6%)"))?>
-<?=3Dshow("GRIL02",_("Grille 02 : Op=C3=A9rations pour lesquelles la TVA=
 est due (12%)"))?>
-<?=3Dshow("GRIL03",_("Grille 03 : Op=C3=A9rations pour lesquelles la TVA=
 est due (21%)"))?>
-<?=3Dshow("GRIL44",_("Grille 44 : Op=C3=A9rations pour lesquelles la TVA=
 =C3=A9trang=C3=A8re est due par le cocontractant"))?>
-<?=3Dshow("GRIL45",_("Grille 45 : Op=C3=A9rations pour lesquelles la TVA=
 est due par le cocontractant"))?>
-<?=3Dshow("GRIL46",_("Grille 46 : Livraisons intracommunautaires exempt=C3=
=A9es effectu=C3=A9es en Belgique et ventes ABC"))?>
-<?=3Dshow("GRIL47",_("Grille 47 :Autres op=C3=A9rations exempt=C3=A9es e=
t autres op=C3=A9rations effectu=C3=A9es =C3=A0 l=E2=80=99=C3=A9tranger")=
)?>
-<?=3Dshow("GRIL48",_("Grille 48 : Op=C3=A9rations relatives aux notes de=
 cr=C3=A9dit des grilles 44 et 48"))?>
-<?=3Dshow("GRIL49",_("Grille 49 : Op=C3=A9rations relatives aux notes de=
 cr=C3=A9dit"))?>
-</div>
-<div style=3D"display:none" id=3D"opin">
-	<? $tab=3D"opin";?>
-<h1><?=3D_("Op=C3=A9ration =C3=A0 l'entr=C3=A9e");?></h1>
-<?=3Dshow("GRIL81",_("Grille 81 : Op=C3=A9ration sur les marchandises, m=
ati=C3=A8res premi=C3=A8res..."))?>
-<?=3Dshow("GRIL82",_("Grille 82 : Op=C3=A9ration sur les services et bie=
ns divers"))?>
-<?=3Dshow("GRIL83",_("Grille 83 : Op=C3=A9ration sur les biens d'investi=
ssements"))?>
-<?=3Dshow("GRIL84",_("Grille 84 : Montant des notes de cr=C3=A9dit re=C3=
=A7ues et des corrections n=C3=A9gatives relatif aux op=C3=A9rations insc=
rites en grilles 86 et 88"))?>
-<?=3Dshow("GRIL85",_("Grille 85 : Montant des notes de cr=C3=A9dit re=C3=
=A7ues et des corrections n=C3=A9gatives relatif aux autres op=C3=A9ratio=
ns du cadre III  "))?>
-<?=3Dshow("GRIL86",_("Grille 86 : Acquisitions intracommunautaires effec=
tu=C3=A9es en Belgique et ventes ABC  "))?>
-<?=3Dshow("GRIL87",_(" Autres op=C3=A9rations =C3=A0 l'entr=C3=A9e pour =
lesquelles la T.V.A. est due par le d=C3=A9clarant "))?>
-<?=3Dshow("GRIL88",_("Services intracommunautaires avec report de percep=
tion"))?>
-</div>
-<div style=3D"display:none" id=3D"tvadue">
-<? $tab=3D"tvadue";?>
-<h1><?=3D_("TVA Due");?></h1>
-<?=3Dshow("GRIL54",_("Grille 54 : tva due sur op=C3=A9ration grille 01,0=
2 et 03"))?>
-<?=3Dshow("GRIL55",_("Grille 55 : tva due sur op=C3=A9ration grille 86 e=
t 88"))?>
-<?=3Dshow("GRIL56",_("Grille 56 : tva due sur op=C3=A9ration grille 87")=
)?>
-<?=3Dshow("GRIL57",_("Grille 57 :T.V.A. relative aux importations avec r=
eport de perception "))?>
-<?=3Dshow("GRIL61",_("Grille 61 :Diverses r=C3=A9gularisations T.V.A. en=
 faveur de l'Etat"))?>
-<?=3Dshow("GRIL63",_("Grille 63 :T.V.A. =C3=A0 reverser mentionn=C3=A9e =
sur les notes de cr=C3=A9dit re=C3=A7ues"))?>
-</div>
-<div style=3D"display:none" id=3D"tvaded">
-	<? $tab=3D"tvaded";?>
-<h1> <?=3D_("TVA D=C3=A9ductible");?></h1>
-<?=3Dshow("GRIL59",_("Grille 59 : taxe d=C3=A9ductible"))?>
-<?=3Dshow("GRIL62",_("Grille 62 : Diverses r=C3=A9gularisations T.V.A. e=
n faveur du d=C3=A9clarant"))?>
-<?=3Dshow("GRIL64",_("Grille 56 : T.V.A. =C3=A0 r=C3=A9cup=C3=A9rer ment=
ionn=C3=A9e sur les notes de cr=C3=A9dit d=C3=A9livr=C3=A9es "))?>
-</div>
-<div style=3D"display:none" id=3D"divers">
-	<? $tab=3D"divers";?>
-<fieldset>
-<legend><?=3D_('Divers')?></legend>
-
-
-<TABLE class=3D"result">
-<TR>
-	<TH><?=3D_('Poste comptable')?></TH>
-	<TH><?=3D_('Description')?></TH>
-	<th></th>
-</TR>
-<TR>
-
-	<TD>
-	<?
-	$atva=3D$cn->get_value("select pcm_val from tva_belge.parameter_chld wh=
ere pcode=3D'ATVA'");
-	$ip_tva=3Dnew IPoste('ATVA',$atva);
-	$ip_tva->set_attribute('gDossier',Dossier::id());
-	$ip_tva->set_attribute('jrn',0);
-	$ip_tva->set_attribute('account','ATVA');
-	$ip_tva->set_attribute('label','ATVA_label');
-	echo $ip_tva->input();
-	$lib=3D$cn->get_value("select pcm_lib from tmp_pcmn where pcm_val=3D$1"=
,array($atva));
-	?>
-	</TD>
-	<TD>
-		<SPAN ID=3D"ATVA_label"><?=3Dh($lib)?></SPAN>
-	</td>
-	<?=3Dtd(_("Poste comptable utilis=C3=A9 pour les avances faites =C3=A0 =
la TVA"))?>
-</tr>
-<TR>
-	<TD>
-	<?
-	$crtva=3D$cn->get_value("select pcm_val from tva_belge.parameter_chld w=
here pcode=3D'CRTVA'");
-	$ip_tva=3Dnew IPoste('CRTVA',$crtva);
-	$ip_tva->set_attribute('gDossier',Dossier::id());
-	$ip_tva->set_attribute('jrn',0);
-	$ip_tva->set_attribute('account','CRTVA');
-	$ip_tva->set_attribute('label','CRTVA_label');
-	echo $ip_tva->input();
-	$lib=3D$cn->get_value("select pcm_lib from tmp_pcmn where pcm_val=3D$1"=
,array($crtva));
-	?>
-	</TD>
-	<TD>
-		<SPAN ID=3D"CRTVA_label"><?=3Dh($lib)?></SPAN>
-	</td>
-<?=3Dtd(("Poste comptable utilis=C3=A9 pour les cr=C3=A9ances sur la  TV=
A"))?>
-</tr>
-<TR>
-<TD>
-	<?
-	$dttva=3D$cn->get_value("select pcm_val from tva_belge.parameter_chld w=
here pcode=3D'DTTVA'");
-	$ip_tva=3Dnew IPoste('DTTVA',$dttva);
-	$ip_tva->set_attribute('gDossier',Dossier::id());
-	$ip_tva->set_attribute('jrn',0);
-	$ip_tva->set_attribute('account','DTTVA');
-	$ip_tva->set_attribute('label','DTTVA_label');
-	echo $ip_tva->input();
-	$lib=3D$cn->get_value("select pcm_lib from tmp_pcmn where pcm_val=3D$1"=
,array($dttva));
-	?>
-	</TD>
-	<TD>
-		<SPAN ID=3D"DTTVA_label"><?=3Dh($lib)?></SPAN>
-	</td>
-	<?=3Dtd(_("Poste comptable utilis=C3=A9 pour les dettes envers la TVA")=
)?>
-</tr>
-
-</TABLE>
-	<?=3DHtmlInput::submit("save_misc","Sauver")?>
-</fieldset>
-</div>
-<div style=3D"display:none" id=3D"lintra">
-	<? $tab=3D"lintra";?>
-<fieldset><legend>Listing intracommunautaires</legend>
-<?=3Dshow("CLINTRA",_("Code TVA pour clients  Intracommunataire"))?>
-</fieldset>
-</div>
-	<div style=3D"display:none" id=3D"assujetti">
-	<? $tab=3D"assujetti";?>
-<fieldset><legend>Listing Client nationaux</legend>
-<?=3Dshow("ASSUJETTI",_("Code TVA pour clients  nationaux"))?>
-</fieldset>
-</div>
-	</form>
-<script charset=3D"UTF-8" lang=3D"javascript">
-	tva_show_param('<?=3D$tab_default?>');
-	</script>

Deleted: trunk/rapport_avance/form_periode.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/rapport_avance/form_periode.php	2012-12-27 01:30:05 UTC (rev 45=
7)
+++ trunk/rapport_avance/form_periode.php	2013-01-06 00:40:23 UTC (rev 45=
8)
@@ -1,21 +0,0 @@
-<fieldset>
-<legend>
-   <?=3D_('Entrez la p=C3=A9riode de la d=C3=A9claration')?>
-</legend>
-<form class=3D"print" method=3D"GET">
-<?=3D_('Ann=C3=A9e')?> <?=3D$str_year?><br/>
-<?=3D$str_monthly?>   <?=3D_('Mois')?> : <?=3D$str_month?><br/>
-<?=3D$str_quaterly?>   <?=3D_('Trimestre')?> : <?=3D$str_quater?><br/>
-<?=3D$str_hidden?>
-<?php
-if (isset ($by_year) && $by_year =3D=3D true ) :
-?>
-<?=3D_('Par ann=C3=A9e')?> <?=3D$str_byyear?><br/>
-<?php
-echo HtmlInput::request_to_hidden(array('ac'));
-endif;
-?>
-<br>
-<?=3D$str_submit?>
-</form>
-</fieldset>
\ No newline at end of file

Modified: trunk/rapport_avance/include/class_rapav_install.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/rapport_avance/include/class_rapav_install.php	2012-12-27 01:30=
:05 UTC (rev 457)
+++ trunk/rapport_avance/include/class_rapav_install.php	2013-01-06 00:40=
:23 UTC (rev 458)
@@ -37,6 +37,16 @@
 		$file=3Ddirname(__FILE__);
 		$this->db->execute_script($file.'/../sql/install.sql');
 	}
+		function upgrade($p_version)
+	{
+		global $cn;
+		$cur_version=3D$cn->get_value('select max(version_id) from rapport_adv=
anced.version');
+		$cur_version++;
+		$file=3Ddirname(__FILE__);
+		for ($e=3D$cur_version;$e<=3D$p_version;$e++) {
+			$this->db->execute_script($file.'/../sql/upgrade'.$e.'.sql');
+		}
+	}
 }
=20
 ?>

Modified: trunk/rapport_avance/index.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/rapport_avance/index.php	2012-12-27 01:30:05 UTC (rev 457)
+++ trunk/rapport_avance/index.php	2013-01-06 00:40:23 UTC (rev 458)
@@ -38,6 +38,12 @@
 	$iplugn->install();
 	echo_warning(_("L'extension est install=C3=A9e, pourriez-vous en v=C3=A9=
rifier le param=C3=A8trage ?"));
 }
+if ( $cn->get_value('select max(version_id) from rapport_advanced.versio=
n') < $rapav_version )
+{
+	require_once('include/class_rapav_install.php');
+	$iplugn =3D new Rapav_Install($cn);
+	$iplugn->upgrade($rapav_version);
+}
 /*
  * load javascript
  */

Deleted: trunk/rapport_avance/js_scripts.js
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/rapport_avance/js_scripts.js	2012-12-27 01:30:05 UTC (rev 457)
+++ trunk/rapport_avance/js_scripts.js	2013-01-06 00:40:23 UTC (rev 458)
@@ -1,164 +0,0 @@
-function show_declaration(p_type,p_id) {
-    try {
-	$('detail').innerHTML=3D'<image src=3D"image/loading.gif" border=3D"0" =
alt=3D"Chargement...">';
-	$('detail').show();
-	$('main').hide();
-	var gDossier=3D$('gDossier').value;var code=3D$('plugin_code').value;
-	var queryString=3D'act=3Ddsp_decl&gDossier=3D'+gDossier+'&plugin_code=3D=
'+code;
-	queryString+=3D'&type=3D'+p_type+'&id=3D'+p_id;
-	var action=3Dnew Ajax.Request ( 'ajax.php',
-				  {
-				 method:'get',
-				 parameters:queryString,
-				 onFailure:error_show_declaration,
-				 onSuccess:success_show_declaration
-			       }
-			       );
-    } catch(e) {alert('show_declaration '+e.message);}
-}
-function success_show_declaration(answer) {
-    try {
-	var xml=3Danswer.responseXML;
-	var html=3Dxml.getElementsByTagName('code');
-	if ( html.length =3D=3D 0 ) {var rec=3Danswer.responseText;alert ('erre=
ur :'+rec);}
-	var code_html=3DgetNodeText(html[0]);
-	code_html=3Dunescape_xml(code_html);
-	$('detail').innerHTML=3Dcode_html;
-	code_html.evalScripts();
-
-    } catch(e) {alert('success_show_declaration '+e.message);}
-}
-function error_show_declaration() {
-    alert('error_show_declaration : ajax not supported');
-}
-function record_writing(plugin,dossier,p_id) {
-    // call ajax to fill with form
-    query=3D'gDossier=3D'+dossier+'&plugin_code=3D'+plugin+'&act=3Drw&p_=
id=3D'+p_id;
-
-    // add a section
-    show_box({id:'record_write',html:loading(),cssclass:'inner_box',styl=
e:'position:absolute;top:0;left:0%;margin-top:10%;height:80%;margin-left:=
10%;width:80%;',js_error:null,js_success:success_record_writing,qs:query,=
fixed:1,callback:'ajax.php'});
-}
-function remove_form(plugin,dossier,p_id,type) {
-    // call ajax to fill with form
-    query=3D'gDossier=3D'+dossier+'&plugin_code=3D'+plugin+'&act=3Drm_fo=
rm&p_id=3D'+p_id+"&type=3D"+type;
-
-    // add a section
-    show_box({id:'remove_form',html:loading(),cssclass:'inner_box',style=
:'position:absolute;top:0;left:20%;margin-top:10%;',js_error:null,js_succ=
ess:success_box,qs:query,callback:'ajax.php'});
-}
-
-function success_record_writing(req) {
-    try{
-	var answer=3Dreq.responseXML;
-	var a=3Danswer.getElementsByTagName('ctl');
-	var html=3Danswer.getElementsByTagName('code');
-	if ( a.length =3D=3D 0 ) {var rec=3Dreq.responseText;alert ('erreur :'+=
rec);}
-	var name_ctl=3Da[0].firstChild.nodeValue;
-	var code_html=3DgetNodeText(html[0]);
-
-	code_html=3Dunescape_xml(code_html);
-	g(name_ctl).innerHTML=3Dcode_html;
-    }
-    catch (e) {
-	alert("success_box"+e.message);}
-    try{
-	code_html.evalScripts();}
-    catch(e){
-	alert("answer_box Impossible executer script de la reponse\n"+e.message=
);}
-}
-function save_write(obj) {
-    var query=3D"act=3Dsw&"+$(obj).serialize();
-    var action=3Dnew Ajax.Request ( 'ajax.php',
-				  {
-				      method:'get',
-				      parameters:query,
-				      onFailure:null,
-				      onSuccess:success_save_write
-				  });
-    return false;
-}
-function success_save_write(req){
-
-    try{
-	var answer=3Dreq.responseXML;
-	var a=3Danswer.getElementsByTagName('ctl');
-	var html=3Danswer.getElementsByTagName('code');
-	if ( a.length =3D=3D 0 ) {var rec=3Dreq.responseText;alert ('erreur :'+=
rec);}
-	var name_ctl=3Da[0].firstChild.nodeValue;
-	var code_html=3DgetNodeText(html[0]);
-
-	code_html=3Dunescape_xml(code_html);
-	g(name_ctl).innerHTML=3Dcode_html;
-    }
-    catch (e) {
-	alert("success_box"+e.message);}
-    try{
-	code_html.evalScripts();}
-    catch(e){
-	alert("answer_box Impossible executer script de la reponse\n"+e.message=
);}
-}
-function show_addparam(pcode,plugin_code,dossier,tab)
-{
-	try {
-		waiting_box();
-		 var action=3Dnew Ajax.Request ( 'ajax.php',
-				  {
-				      method:'get',
-				      parameters:"act=3Dadd_param&pcode=3D"+pcode+"&gDossier=3D"+dos=
sier+"&plugin_code=3D"+plugin_code+'&tab=3D'+tab,
-				      onFailure:null,
-				      onSuccess:success_showaddparam
-				  });
-	}catch (e){
-		alert(e.message);
-	}
-}
-
-function success_showaddparam(req) {
-  try{
-		remove_waiting_box();
-		var sx=3D0;
-		if ( window.scrollY)
-		{
-			sx=3Dwindow.scrollY+120;
-		}
-		else
-		{
-			sx=3Ddocument.body.scrollTop+120;
-		}
-
-		var div_style=3D"top:"+sx+";width:60%;heigth:80%";
-		removeDiv("paramadd_id");
-		add_div({
-			"id":'paramadd_id',
-			"drag":"1",
-			"cssclass":"inner_box",
-			"style":div_style
-		});
-		var answer=3Dreq.responseXML;
-		var html=3Danswer.getElementsByTagName('code');
-		var code_html=3DgetNodeText(html[0]);
-		code_html=3Dunescape_xml(code_html);
-		g("paramadd_id").innerHTML=3Dcode_html;
-	}
-	catch (e) {
-		alert("success_box "+e.message);
-	}
-	try{
-		code_html.evalScripts();
-	}
-	catch(e){
-		alert("answer_box Impossible executer script de la reponse\n"+e.messag=
e);
-	}
-}
-
-function tva_show_param(p_div)
-{
-	try{
-		var div=3D['opin','opout','tvadue','tvaded','divers','lintra','assujet=
ti'];
-		for (var r =3D0;r<div.length;r++ ) {$(div[r]).hide();  }
-		$(p_div).show();
-		$('tab').value=3Dp_div;
-	} catch(e)
-	{
-		alert(e.message)
-	}
-}
\ No newline at end of file

Deleted: trunk/rapport_avance/list_assujetti.inc.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/rapport_avance/list_assujetti.inc.php	2012-12-27 01:30:05 UTC (=
rev 457)
+++ trunk/rapport_avance/list_assujetti.inc.php	2013-01-06 00:40:23 UTC (=
rev 458)
@@ -1,99 +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 b=
y
- *   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-130=
7  USA
-*/
-/* $Revision$ */
-
-// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
-
-/*!\file
- * \brief listing intracom
- */
-echo '<div class=3D"content" style=3D"width:80%;margin-left:10%">';
-require_once('class_ext_list_assujetti.php');
-// verify the year
-if ( isset($_REQUEST['year']) && (trim(strlen($_REQUEST['year'])) < 4 ||=
 isNumber($_REQUEST['year'] ) =3D=3D 0 ||$_REQUEST['year'] < 2000||$_REQU=
EST['year']>2100)) {
-  alert(j(_('Ann=C3=A9e invalide'.' ['.$_REQUEST['year'].']')));
-  echo Ext_List_Assujetti::choose_periode();
-  echo '</div>';
-  exit;
-}
-
-// if the periode is not set we have to ask it
-if ( ! isset($_REQUEST['decl']) ){
-  echo Ext_List_Assujetti::choose_periode(true);
-  echo '</div>';
-  exit;
-}
-
-$cn=3Dnew Database(Dossier::id());
-if (isset($_POST['save'] )) {
-  $save=3Dnew Ext_List_Assujetti($cn);
-  $save->from_array($_POST);
-  $save->insert();
-  echo h2info(_('D=C3=A9claration sauv=C3=A9e'));
-  echo $save->display();
-
-  /**
-   *@todo add a div for the button generate, get_xml, create ODS, print.=
..
-   */
-//   echo '<div style=3D"position:absolute;z-index:14;top:25%;right:30" =
class=3D"noprint">aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</d=
iv>';
-  echo '</div>';
-  exit;
-}
-
-$tva=3Dnew Ext_List_Assujetti($cn);
-
-$str_quaterly=3D'';
-$str_month=3D"";
-$str_year=3D$_GET['year'];
-$str_byyear=3D'1';
-$str_quater=3D'';
-$str_hidden=3D'';$str_submit=3D'';$str_monthly=3D'';
-$by_year=3Dtrue;
-$tva->blank($_REQUEST['year'],1,3);
-
-
-// xdebug_disable();
-try {
-  $r=3D$tva->compute();
-} catch (Exception $e) {
-
-  echo Ext_List_Assujetti::choose_periode();
-  echo '</div>';
-  exit();
-  }
-require_once('form_periode.php');
-echo '<form class=3D"print" method=3D"post">';
-echo dossier::hidden();
-echo HtmlInput::extension();
-echo HtmlInput::hidden('start_periode',$tva->start_periode);
-echo HtmlInput::hidden('end_periode',$tva->end_periode);
-echo HtmlInput::hidden('flag_periode',$tva->flag_periode);
-echo HtmlInput::hidden('name',$tva->tva_name);
-echo HtmlInput::hidden('num_tva',$tva->num_tva);
-echo HtmlInput::hidden('adress',$tva->adress);
-echo HtmlInput::hidden('country',$tva->country);
-echo HtmlInput::hidden('periode_dec',$tva->periode_dec);
-echo HtmlInput::hidden('exercice',$tva->exercice);
-echo $tva->display_info();
-echo $r;
-echo $tva->display_declaration_amount();
-echo HtmlInput::submit('save',_('Sauvegarde'));
-echo '</form>';
-echo '</div>';
-

Deleted: trunk/rapport_avance/list_intra.inc.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/rapport_avance/list_intra.inc.php	2012-12-27 01:30:05 UTC (rev =
457)
+++ trunk/rapport_avance/list_intra.inc.php	2013-01-06 00:40:23 UTC (rev =
458)
@@ -1,119 +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 b=
y
- *   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-130=
7  USA
-*/
-/* $Revision$ */
-
-// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
-
-/*!\file
- * \brief listing intracom
- */
-require_once('class_ext_list_intra.php');
-echo '<div class=3D"content" style=3D"width:80%;margin-left:10%">';
-
-// verify the year
-if ( isset($_REQUEST['year']) && (trim(strlen($_REQUEST['year'])) < 4 ||=
 isNumber($_REQUEST['year'] ) =3D=3D 0 ||$_REQUEST['year'] < 2000||$_REQU=
EST['year']>2100)) {
-  alert(j(_('Ann=C3=A9e invalide'.' ['.$_REQUEST['year'].']')));
-  echo Ext_List_Intra::choose_periode();
-  echo '</div>';
-  exit;
-}
-
-// if the periode is not set we have to ask it
-if ( ! isset($_REQUEST['decl']) ){
-  echo Ext_List_Intra::choose_periode(true);
-  echo '</div>';
-  exit;
-}
-
-$cn=3Dnew Database(Dossier::id());
-if (isset($_POST['save'] )) {
-  $save=3Dnew Ext_List_Intra($cn);
-  $save->from_array($_POST);
-  $save->insert();
-  echo h2info(_('D=C3=A9claration sauv=C3=A9e'));
-  echo $save->display();
-
-  /**
-   *@todo add a div for the button generate, get_xml, create ODS, print.=
..
-   */
-//   echo '<div style=3D"position:absolute;z-index:14;top:25%;right:30" =
class=3D"noprint">aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</d=
iv>';
-  echo '</div>';
-  exit;
-}
-
-$tva=3Dnew Ext_List_Intra($cn);
-
-/* by month */
-if ( $_REQUEST['periodic']=3D=3D1) {
-  $str_monthly=3D'';
-  $str_month=3D$_GET['bymonth'];$str_year=3D$_GET['year'];$str_quaterly=3D=
"";$str_hidden=3D'';$str_submit=3D'';$str_quater=3D'-';
-  $tva->blank($_REQUEST['year'],$_GET['bymonth'],1);
-
-}
-
-/* by quater */
-if ($_REQUEST['periodic'] =3D=3D 2) {
-  $str_quaterly=3D'';
-  $str_month=3D"-";
-  $str_year=3D$_GET['year'];
-  $str_quater=3D$_REQUEST['byquaterly'];
-  $str_hidden=3D'';$str_submit=3D'';$str_monthly=3D'';
-  $tva->blank($_REQUEST['year'],$_GET['byquaterly'],2);
-}
-/* by year */
-if ($_REQUEST['periodic'] =3D=3D 3) {
-  $str_quaterly=3D'';
-  $str_month=3D"";
-  $str_year=3D$_GET['year'];
-  $str_byyear=3D'1';
-  $str_quater=3D'';
-  $str_hidden=3D'';$str_submit=3D'';$str_monthly=3D'';
-  $by_year=3Dtrue;
-  $tva->blank($_REQUEST['year'],$_GET['byquaterly'],3);
-}
-
-try {
-  $r=3D$tva->compute();
-} catch (Exception $e) {
-
-  echo Ext_List_Intra::choose_periode();
-  echo '</div>';
-  exit();
-  }
-
-require_once('form_periode.php');
-
-echo '<form class=3D"print" method=3D"post">';
-echo dossier::hidden();
-echo HtmlInput::extension();
-echo HtmlInput::hidden('start_periode',$tva->start_periode);
-echo HtmlInput::hidden('end_periode',$tva->end_periode);
-echo HtmlInput::hidden('flag_periode',$tva->flag_periode);
-echo HtmlInput::hidden('name',$tva->tva_name);
-echo HtmlInput::hidden('num_tva',$tva->num_tva);
-echo HtmlInput::hidden('adress',$tva->adress);
-echo HtmlInput::hidden('country',$tva->country);
-echo HtmlInput::hidden('periode_dec',$tva->periode_dec);
-echo HtmlInput::hidden('exercice',$tva->exercice);
-echo $tva->display_info();
-echo $r;
-echo $tva->display_declaration_amount();
-echo HtmlInput::submit('save',_('Sauvegarde'));
-echo '</form>';
-echo '</div>';

Deleted: trunk/rapport_avance/list_tva.inc.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/rapport_avance/list_tva.inc.php	2012-12-27 01:30:05 UTC (rev 45=
7)
+++ trunk/rapport_avance/list_tva.inc.php	2013-01-06 00:40:23 UTC (rev 45=
8)
@@ -1,143 +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 b=
y
- *   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-130=
7  USA
- */
-/* $Revision$ */
-
-// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
-require_once('class_iselect.php');
-require_once 'class_sort_table.php';
-
-echo '<div id=3D"detail" style=3D"display:none; width:80%;margin-left:10=
%">';
-echo '<image src=3D"image/loading.gif" border=3D"0" alt=3D"Chargement...=
">';
-echo '</div>';
-/* !\file
- * \brief show all the declaration by date
- */
-
-echo '<div id=3D"main" class=3D"content" style=3D"width:80%;margin-left:=
10%">';
-echo '<form method=3D"get">';
-echo HtmlInput::request_to_hidden(array('ac'));
-echo _('Filtrer par ');
-$choice =3D new ISelect('type');
-$choice->value =3D array(
-	array('label' =3D> 'Toutes', 'value' =3D> 0),
-	array('label' =3D> 'D=C3=A9clarations', 'value' =3D> 1),
-	array('label' =3D> 'Listings assujetti', 'value' =3D> 2),
-	array('label' =3D> 'Listings intracom', 'value' =3D> 3)
-);
-$choice->selected =3D (isset($_REQUEST['type'])) ? $_REQUEST['type'] : 0=
;
-$choice->javascript =3D ' onchange=3D"submit(this)"';
-echo HtmlInput::extension();
-echo HtmlInput::hidden('sa', 'ltva');
-echo dossier::hidden();
-echo $choice->input();
-echo HtmlInput::submit('rc', 'Recharger');
-echo '</form>';
-
-$url =3D HtmlInput::request_to_string(array('ac', 'plugin_code', 'gDossi=
er', 'sa', 'type'));
-$sort=3D new Sort_Table();
-$sort->add('Date d=C3=A9claration	', $url, ' order by date_decl asc', ' =
order by date_decl desc', 'da', 'dd');
-$sort->add('P=C3=A9riode	', $url, ' order by exercice asc,periode_dec as=
c', ' order by exercice desc,periode_dec desc', 'pa', 'pd');
-
-$option_order =3D (isset($_GET['ord'])) ? $_GET['ord'] : 'dd';
-
-$sql_order =3D $sort->get_sql_order($option_order);
-
-switch ($choice->selected)
-{
-	case 0:
-		$sql =3D "
-select da_id as id, 'D=C3=A9claration trim/mens' as type_title,1 as type=
_decl,to_char(date_decl,'DD.MM.YYYY') as date_fmt,date_decl,
-case when periodicity =3D'1' then 'Mensuel'
-when periodicity =3D '2' then 'Trimestriel'
-end as fmt_periodicity,
-periode_dec,exercice
-from tva_belge.declaration_amount
-union all
-select i_id as id, 'Listing Intracom' as type_title, 3 as type_decl, to_=
char(date_decl,'DD.MM.YYYY') as date_fmt,date_decl,
-case when periodicity =3D'1' then 'Mensuel'
-when periodicity =3D '2' then 'Trimestriel'
-when periodicity =3D '3' then 'Annuel'
-end as fmt_periodicity,
-periode_dec,exercice
-from tva_belge.intracomm
-union all
-select a_id as id, 'Listing assujetti' as type_title, 2 as type_decl, to=
_char(date_decl,'DD.MM.YYYY') as date_fmt,date_decl,
- 'Annuel' as fmt_periodicity,
-periode_dec,exercice
-from tva_belge.assujetti
-";
-
-		break;
-
-	case 1:
-
-		$sql =3D "
-select da_id as id, 'D=C3=A9claration trim/mens' as type_title,1 as type=
_decl,to_char(date_decl,'DD.MM.YYYY') as date_fmt,
-case when periodicity =3D'1' then 'Mensuel'
-when periodicity =3D '2' then 'Trimestriel'
-end as fmt_periodicity,
-periode_dec,exercice
-from tva_belge.declaration_amount=20
-";
-		break;
-	case 2:
-		$sql =3D "
-select a_id as id, 'Listing assujetti' as type_title, 2 as type_decl, to=
_char(date_decl,'DD.MM.YYYY') as date_fmt,date_decl,
- 'Annuel' as fmt_periodicity,
-periode_dec,exercice
-from tva_belge.assujetti
-";
-		break;
-	case 3:
-		$sql =3D "
-select i_id as id, 'Listing Intracom' as type_title, 3 as type_decl, to_=
char(date_decl,'DD.MM.YYYY') as date_fmt,date_decl,
-case when periodicity =3D'1' then 'Mensuel'
-when periodicity =3D '2' then 'Trimestriel'
-when periodicity =3D '3' then 'Annuel'
-end as fmt_periodicity,
-periode_dec,exercice
-from tva_belge.intracomm
-";
-		break;
-}
-$sql =3D $sql . $sql_order;
-$res =3D $cn->get_array($sql);
-?>
-<table class=3D"result" >
-	<tr>
-		<th>Type de d=C3=A9claration</th>
-		<th>Periodicit=C3=A9</th>
-		<th> <?=3D$sort->get_header(1)?></th>
-		<th><?=3D$sort->get_header(0)?></th>
-
-		<? for ($i =3D 0; $i < count($res); $i++):?>
-		<tr>
-			<?
-			$aref =3D sprintf('<a href=3D"javascript:void(0)" onclick=3D"show_dec=
laration(\'%s\',\'%s\')">', $res[$i]['type_decl'], $res[$i]['id']);
-			echo td($aref . $res[$i]['type_title'] . '</a>');
-			echo td($aref . $res[$i]['fmt_periodicity'] . '</a>');
-			echo td($aref.$res[$i]['periode_dec'].' - '.$res[$i]['exercice'].'</a=
>');
-			echo td($aref.$res[$i]['date_fmt'].'</a>');
-			?>
-		</tr>
-	<? endfor;?>
-</table>
-</div>
-
-

Modified: trunk/rapport_avance/rapav_constant.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/rapport_avance/rapav_constant.php	2012-12-27 01:30:05 UTC (rev =
457)
+++ trunk/rapport_avance/rapav_constant.php	2013-01-06 00:40:23 UTC (rev =
458)
@@ -9,6 +9,7 @@
=20
 require_once ('class_database.php');
=20
-global $cn;
+global $cn,$rapav_version;
 $cn=3Dnew Database (dossier::id());
+$rapav_version=3D2;
 ?>
\ No newline at end of file

Copied: trunk/rapport_avance/sql/upgrade2.sql (from rev 457, tag/rel652/r=
apport_avance/sql/upgrade2.sql)
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/rapport_avance/sql/upgrade2.sql	                        (rev 0)
+++ trunk/rapport_avance/sql/upgrade2.sql	2013-01-06 00:40:23 UTC (rev 45=
8)
@@ -0,0 +1,62 @@
+begin;
+insert into rapport_advanced.type_row_detail values (4,'Poste comptable'=
);
+insert into rapport_advanced.type_row_detail  (tr_id,tr_description) val=
ues (5,'Op=C3=A9ration r=C3=A9concil=C3=A9e');
+insert into rapport_advanced.periode_type (t_id,t_description) values (6=
,'Depuis d=C3=A9but exercice courant N');
+
+ALTER TABLE rapport_advanced.formulaire_param_detail ADD COLUMN with_tmp=
_val account_type;
+ALTER TABLE rapport_advanced.formulaire_param_detail ADD COLUMN type_sum=
_account bigint;
+ALTER TABLE rapport_advanced.formulaire_param_detail ADD COLUMN operatio=
n_pcm_val account_type;
+
+
+CREATE TABLE rapport_advanced.total_type_account
+(
+  tt_id serial NOT NULL,
+  tt_label text,
+  CONSTRAINT total_type_account_pkey PRIMARY KEY (tt_id )
+);
+INSERT INTO rapport_advanced.total_type_account (tt_id, tt_label) VALUES=
 (1, 'Solde (d=C3=A9bit-cr=C3=A9dit)');
+INSERT INTO rapport_advanced.total_type_account (tt_id, tt_label) VALUES=
 (2, 'Solde (cr=C3=A9dit-d=C3=A9bit)');
+INSERT INTO rapport_advanced.total_type_account (tt_id, tt_label) VALUES=
 (3, 'D=C3=A9bit');
+INSERT INTO rapport_advanced.total_type_account (tt_id, tt_label) VALUES=
 (4, 'Cr=C3=A9dit');
+
+
+
+CREATE TABLE rapport_advanced.restore_formulaire_param
+(
+  p_id integer NOT NULL,
+  p_code text,
+  p_libelle text,
+  p_type integer,
+  p_order integer NOT NULL,
+  f_id integer,
+  p_info text, -- si non vide affiche infobulle
+  t_id integer,
+  CONSTRAINT restore_formulaire_param_pkey PRIMARY KEY (p_id )
+
+);
+CREATE TABLE rapport_advanced.restore_formulaire_param_detail
+(
+  fp_id integer NOT NULL,
+  p_id integer,
+  tmp_val account_type,
+  tva_id integer,
+  fp_formula text,
+  fp_signed integer,
+  jrn_def_type character(3),
+  tt_id integer,
+  type_detail integer,
+  with_tmp_val account_type,
+  type_sum_account bigint,
+  operation_pcm_val account_type,
+  CONSTRAINT restore_formulaire_param_detail_pkey PRIMARY KEY (fp_id ),
+  CONSTRAINT formulaire_param_detail_p_id_fkey FOREIGN KEY (p_id)
+      REFERENCES rapport_advanced.formulaire_param (p_id) MATCH SIMPLE
+      ON UPDATE CASCADE ON DELETE CASCADE
+);
+insert into rapport_advanced.version(version_id,version_note) values (2,=
'Ajout formules, export CSV des d=C3=A9clarations et des formulaires');
+
+ALTER TABLE rapport_advanced.formulaire_param_detail
+  ADD CONSTRAINT formulaire_param_detail_type_sum_account_fkey FOREIGN K=
EY (type_sum_account)
+      REFERENCES rapport_advanced.total_type_account (tt_id) MATCH SIMPL=
E
+      ON UPDATE SET NULL ON DELETE SET NULL;
+commit;
\ No newline at end of file

Deleted: trunk/rapport_avance/tva_constant.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/rapport_avance/tva_constant.php	2012-12-27 01:30:05 UTC (rev 45=
7)
+++ trunk/rapport_avance/tva_constant.php	2013-01-06 00:40:23 UTC (rev 45=
8)
@@ -1,32 +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 b=
y
- *   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-130=
7  USA
-*/
-/* $Revision$ */
-
-// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
-
-/*!\file
- * \brief
- */
-
-  $GLOBALS['quaterly_limit']=3Darray(
-				   1 =3D> array('01.01','31.03'),
-				   2 =3D> array('01.04','30.06'),
-				   3 =3D> array('01.07','30.09'),
-				   4 =3D> array('01.10','31.12')
-			);

Deleted: trunk/rapport_avance/tva_param.inc.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/rapport_avance/tva_param.inc.php	2012-12-27 01:30:05 UTC (rev 4=
57)
+++ trunk/rapport_avance/tva_param.inc.php	2013-01-06 00:40:23 UTC (rev 4=
58)
@@ -1,77 +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 b=
y
- *   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-130=
7  USA
-*/
-/* $Revision$ */
-
-// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
-
-/*!\file
- * \brief set up the parameters
- */
-require_once('class_tva_parameter.php');
-$cn=3Dnew Database(dossier::id());
-
-// save all the parameters
-if ( isset ($_POST['save_misc']))  {
-	extract($_POST);
-
-	foreach ( array('CRTVA','ATVA','DTTVA') as $i){
-		$value=3D${$i};
-		if ( trim(${$i})=3D=3D'') $value=3Dnull;
-		if ( $cn->get_value("select count(*) from tva_belge.parameter_chld whe=
re pcode=3D$1",array($i))=3D=3D0)
-		{
-			$cn->exec_sql("insert into tva_belge.parameter_chld(pcode,pcm_val) va=
lues($1,$2) ",
-					array($i,$value));
-		}else {
-
-		$cn->exec_sql("update tva_belge.parameter_chld set pcm_val=3D$1::accou=
nt_type where pcode=3D$2",
-				array($value,$i));
-		}
-	}
-
-	unset($_POST['save_misc']);
-}
-
-if ( isset ($_POST['save_addparam'])){
-	extract ($_POST);
-	try {
-		if ( trim($tva_id)=3D=3D"")			throw new Exception("TVA n'existe pas");
-		if ( trim($paccount)=3D=3D"")			throw new Exception("Poste comptable v=
ide");
-		if ( $cn->get_value("select count(tva_id) from tva_rate where tva_id=3D=
$1",array($tva_id))=3D=3D0) throw new Exception("TVA $tva_id n'existe pas=
");
-		$cn->exec_sql("insert into tva_belge.parameter_chld(pcode,tva_id,pcm_v=
al) values ($1,$2,$3::account_type)",
-		array($pcode,$tva_id,$paccount));
-	} catch(Exception $e) {
-		alert("Ne peut sauver : ".$e->getMessage());
-	}
-}
-if ( isset ($_POST['pi_id'])){
-	$cn->exec_sql("delete from tva_belge.parameter_chld where pi_id=3D$1",a=
rray($_POST['pi_id']));
-}
-/* show all the possible parameters */
-$tvap=3Dnew Tva_Parameter($cn);
-require_once('class_itva_popup.php');
-$a=3Dnew IPopup('popup_tva');
-$a->set_title('Choississez la tva qui convient');
-echo $a->input();
-require_once('class_iposte.php');
-echo IPoste::ipopup('ipop_account');
-
-echo dossier::hidden();
-echo HtmlInput::extension();
-echo $tvap->display();
-



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


From MAILER-DAEMON Sat Jan 05 19:49:31 2013
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1TreQd-0005k0-EN
	for mharc-phpcompta-dev@gnu.org; Sat, 05 Jan 2013 19:49:31 -0500
To: phpcompta-dev@nongnu.org
Content-Type: text/plain; charset=UTF-8
Date: Sun,  6 Jan 2013 01:40:57 +0100 (CET)
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 91.121.80.190
Message-ID: <mailman.992666.1357433370.854.phpcompta-dev@nongnu.org>
From: phpcompta-dev@nongnu.org
Subject: [Phpcompta-dev] r459 - trunk
X-BeenThere: phpcompta-dev@nongnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: phpcompta-dev@nongnu.org
List-Id: <phpcompta-dev.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/phpcompta-dev>,
	<mailto:phpcompta-dev-request@nongnu.org?subject=unsubscribe>
List-Archive: <http://lists.nongnu.org/archive/html/phpcompta-dev>
List-Post: <mailto:phpcompta-dev@nongnu.org>
List-Help: <mailto:phpcompta-dev-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/phpcompta-dev>,
	<mailto:phpcompta-dev-request@nongnu.org?subject=subscribe>
X-List-Received-Date: Sun, 06 Jan 2013 00:49:29 -0000

Author: danydb
Date: 2013-01-06 01:40:57 +0100 (Sun, 06 Jan 2013)
New Revision: 459

Added:
   trunk/import_account/
Log:
New plugin : import acc

Copied: trunk/import_account (from rev 457, trunk/import_doli)



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


From MAILER-DAEMON Sat Jan 05 19:58:51 2013
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1TreZf-0006jY-Ba
	for mharc-phpcompta-dev@gnu.org; Sat, 05 Jan 2013 19:58:51 -0500
To: phpcompta-dev@nongnu.org
Content-Type: text/plain; charset=UTF-8
Date: Sun,  6 Jan 2013 01:50:09 +0100 (CET)
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 91.121.80.190
Message-ID: <mailman.992669.1357433930.854.phpcompta-dev@nongnu.org>
From: phpcompta-dev@nongnu.org
Subject: [Phpcompta-dev] r460 - in trunk/import_account: . include
X-BeenThere: phpcompta-dev@nongnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: phpcompta-dev@nongnu.org
List-Id: <phpcompta-dev.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/phpcompta-dev>,
	<mailto:phpcompta-dev-request@nongnu.org?subject=unsubscribe>
List-Archive: <http://lists.nongnu.org/archive/html/phpcompta-dev>
List-Post: <mailto:phpcompta-dev@nongnu.org>
List-Help: <mailto:phpcompta-dev-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/phpcompta-dev>,
	<mailto:phpcompta-dev-request@nongnu.org?subject=subscribe>
X-List-Received-Date: Sun, 06 Jan 2013 00:58:50 -0000

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=20

Modified: trunk/import_account/README.txt
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- 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_accoun=
t/impdol.js)
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- 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]=3D"le taux est compris entre 0 et 100";
\ No newline at end of file

Deleted: trunk/import_account/impdol.js
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- 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]=3D"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)
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- 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 b=
y
+ *   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-130=
7  USA
+ */
+/* $Revision$ */
+
+// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
+
+/**
+ * @file
+ * @brief
+ *
+ */
+require_once 'class_sql_impacc.php';
+
+class Impacc_Operation
+{
+
+	function save_file()
+	{
+		if (trim($_FILES['csv_operation']['name']) =3D=3D '')
+		{
+			alert('Pas de fichier donn=C3=A9');
+			return -1;
+		}
+		$this->filename =3D tempnam($_ENV['TMP'], 'upload_');
+		move_uploaded_file($_FILES["csv_operation"]["tmp_name"], $this->filena=
me);
+
+		$imp =3D new Impacc_Import_sql();
+		$imp->setp('temp_file', $this->filename);
+		$imp->setp('send_file', $_FILES['csv_operation']['name']);
+		$imp->insert();
+		$this->impid =3D $imp->getp("id");
+	}
+
+	function record()
+	{
+		$foperation =3D fopen($this->filename, 'r');
+		$this->row_count =3D 0;
+		$max =3D 0;
+		while (($row =3D fgetcsv($foperation, 0, ";", '"')) !=3D=3D false)
+		{
+			if (count($row) !=3D 11)
+			{
+				$str_row =3D implode($row, ";");
+				echo "Attention " . h($str_row) . " ne contient pas 11 colonnes";
+				continue;
+			}
+			$r =3D 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=C3=A9es : " . $this->row_count;
+		$import =3D 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 =3D ok N no ok)
+	 * Put in o_message the reason of the problem
+	 */
+	function check()
+	{
+		global $cn;
+		try
+		{
+			$cn->start();
+			$array =3D $cn->get_array("select o_id from impacc.operation_tmp wher=
e i_id=3D$1 order by o_id", array($this->impid));
+			$nb_row =3D count($array);
+			for ($i =3D 0; $i < $nb_row; $i++)
+			{
+				$msg =3D "";
+				$operation =3D new impacc_operation_tmp_sql();
+				$operation->setp("id", $array[$i]['o_id']);
+				$operation->load();
+				$operation->setp("code", 'T');
+				$dol =3D $operation->getp("dolibarr");
+				/*
+				 * detect duplicate
+				 */
+				$db =3D $cn->get_value("select count(*) from impacc.operation_tmp wh=
ere o_doli=3D$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=C3=A9ration d=C3=A9j=C3=A0 transf=C3=
=A9r=C3=A9e : doublon ");
+					$operation->update();
+					continue;
+				}
+				if (trim($dol) =3D=3D "" || isNumber($dol) =3D=3D 0)
+				{
+					$operation->setp("code", 'N');
+					$msg.=3D" le num=C3=A9ro de ligne pour dolibarr est invalide";
+				}
+				if (isDate($operation->getp("date")) =3D=3D null)
+				{
+					$operation->setp("code", 'N');
+					$msg.=3D" La date est invalide, format n'est pas JJ.MM.AAAA";
+				}
+				$fiche =3D new Fiche($cn);
+				$fiche->get_by_qcode(trim($operation->getp("qcode")));
+
+				if ($fiche->id =3D=3D 0)
+				{
+					$operation->setp("code", 'N');
+					$msg.=3D" Cette fiche n'existe pas";
+				}
+				else
+				{
+					$operation->setp("fiche", $fiche->id);
+				}
+				/**
+				 * check if card as a valid accounting
+				 */
+				$poste =3D $fiche->strAttribut(ATTR_DEF_ACCOUNT);
+				if (trim($poste) =3D=3D '' || $cn->get_value("select count(*) from t=
mp_pcmn where pcm_val=3D$1", array($poste)) =3D=3D 0)
+				{
+					$operation->setp("code", 'N');
+					$msg.=3D" Cette fiche n'a pas de poste comptable valide";
+				}
+				$operation->setp("poste", $poste);
+				$a =3D array("rate" =3D> " Taux de TVA", "amount_total" =3D> "Montan=
t total", "number_unit" =3D> 'Nombre d\'unit=C3=A9', "amount_vat" =3D> "M=
ontant TVA");
+
+				foreach ($a as $key =3D> $value)
+				{
+					$v =3D $operation->getp($key);
+					$v =3D str_replace(",", ".", $v);
+
+					if (trim($v) !=3D "" && isNumber($v) =3D=3D 0)
+					{
+						$operation->setp("code", 'N');
+						$msg.=3D" $value n'est pas un nombre";
+						continue;
+					}
+
+					$operation->setp($key, $v);
+				}
+
+				if ($operation->getp("type") !=3D "T")
+				{
+					$tva_id =3D $cn->get_array("select tva_id from impacc.parameter_tva=
 where pt_rate/100=3D$1", array($operation->getp("rate")));
+					if (count($tva_id) > 1)
+					{
+						$operation->setp("code", 'N');
+						$msg.=3D" Plusieurs code TVA correspondent =C3=A0 ce taux";
+					}
+					elseif (empty($tva_id))
+					{
+						$operation->setp("code", 'N');
+						$msg.=3D" Aucun code TVA ne correspond =C3=A0 ce taux";
+					}
+					else
+					{
+						$operation->setp("tva_id", $tva_id[0]['tva_id']);
+					}
+				}
+				// a supplier and one service at least is needed
+				$code_op =3D $operation->getp("dolibarr");
+				$nb_customer =3D $cn->get_value("select count(*) from impacc.operati=
on_tmp where o_type=3D'T' and o_doli=3D$1 and i_id=3D$2", array($code_op,=
 $this->impid));
+				$nb_good =3D $cn->get_value("select count(*) from impacc.operation_t=
mp where o_type=3D'S' and o_doli=3D$1 and i_id=3D$2", array($code_op, $th=
is->impid));
+				if ($nb_customer =3D=3D 0)
+				{
+					$operation->setp("code", 'N');
+					$msg.=3D" Aucun client ou fournisseur";
+				}
+				if ($nb_good =3D=3D 0)
+				{
+					$operation->setp("code", 'N');
+					$msg.=3D" Aucune marchandise ou service";
+				}
+
+				// check if in a opened period
+				$op_date =3D $operation->getp('date');
+				$periode =3D new Periode($cn);
+				try
+				{
+					$periode->find_periode($op_date);
+				}
+				catch (Exception $e)
+				{
+					$msg.=3D$e->getMessage();
+					$operation->setp('code', 'N');
+				}
+
+				$operation->setp("message", $msg);
+				$operation->update();
+			}
+			/*
+			 *  If a part is N then the whole operation is N
+			 */
+			$sql =3D "update impadd.operation_tmp  set o_result=3D'N' where i_id=3D=
$1 and
+				o_doli in (select o_doli from impacc.operation_tmp  where o_result=3D=
'N' and i_id=3D$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 =3D " 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=3D'T' then '" . $g_succeed . "' else '" . $g_faile=
d . "' end as result,
+			o_message
+			from impacc.operation_tmp where i_id=3D" . $this->impid . " order by =
o_id";
+		echo Html_Table::sql2table($cn, array(
+			array('name' =3D> 'n=C2=B0 ligne',
+				'style' =3D> 'style=3D"text-align:right"'),
+			array('name' =3D> 'Date',
+				'style' =3D> 'text-align:right'),
+			array('name' =3D> 'QuickCode'),
+			array('name' =3D> 'Libell=C3=A9'),
+			array('name' =3D> 'n=C2=B0 pj'),
+			array('name' =3D> 'Montant / unit=C3=A9', 'style' =3D> 'style=3D"text=
-align:right"'),
+			array('name' =3D> 'Montant Total TVA', 'style' =3D> 'style=3D"text-al=
ign:right"'),
+			array('name' =3D> 'Nbre unit=C3=A9s', 'style' =3D> 'style=3D"text-ali=
gn:right"'),
+			array('name' =3D> 'taux TVA', 'style' =3D> 'style=3D"text-align:right=
"'),
+			array('name' =3D> 'Montant total TVAC', 'style' =3D> 'style=3D"text-a=
lign:right"'),
+			array('name' =3D> 'Transfert', 'style' =3D> 'style=3D"text-align:righ=
t"', 'raw' =3D> 1),
+			array('name' =3D> 'Message')
+				)
+				, $sql, 'style=3D"width:100%" class=3D"result"'
+		);
+	}
+
+	function transfer()
+	{
+		global $cn;
+		$jrn =3D $_POST['p_jrn'];
+		$ledger =3D new Acc_Ledger($cn, $jrn);
+		$type =3D $ledger->get_type();
+		switch ($type)
+		{
+			case 'ACH':
+				$ledger =3D new Acc_Ledger_Purchase($cn, $jrn);
+				$tiers_side =3D 'c';
+				$oth_side =3D 'd';
+				break;
+			case 'VEN':
+				$ledger =3D new Acc_Ledger_Sold($cn, $jrn);
+				$tiers_side =3D 'd';
+				$oth_side =3D 'c';
+				break;
+			default:
+				die('Erreur ce type journal n\' est pas encore support=C3=A9');
+		}
+		/**
+		 * Loop in table operation_tmp, get all the record to transfer
+		 */
+		$array =3D $cn->get_array("select
+					distinct o_doli
+				from impacc.operation_tmp
+				where i_id=3D$1 and o_result=3D'T'
+				order by o_doli  asc", array($this->impid));
+		$nb_row =3D count($array);
+		bcscale(2);
+		try
+		{
+			$cn->start();
+			for ($i =3D 0; $i < $nb_row; $i++)
+			{
+				/*
+				 * For each operation (same o_doli code)
+				 */
+				$adetail =3D $cn->get_array("select o_id from impacc.operation_tmp w=
here o_doli=3D$1 and i_id=3D$2 and o_type=3D'S'", array($array[$i]['o_dol=
i'], $this->impid));
+				$atiers =3D $cn->get_array("select o_id from impacc.operation_tmp wh=
ere o_doli=3D$1 and i_id=3D$2  and o_type=3D'T'", array($array[$i]['o_dol=
i'], $this->impid));
+				if (count($atiers) > 1)
+				{
+					echo "Plusieurs clients pour l' op=C3=A9ration, code " . $array[$i]=
['o_doli'];
+					continue;
+				}
+				if (count($atiers) =3D=3D 0)
+				{
+					echo "Pas de client pour une op=C3=A9ration, code " . $array[$i]['o=
_doli'];
+					continue;
+				}
+
+				$oper_tiers =3D new Impacc_Operation_Tmp_Sql($atiers[0]['o_id']);
+				$nb_detail =3D count($adetail);
+				$sum =3D 0;
+				$grpt =3D $cn->get_value("select nextval('s_grpt');");
+				$internal =3D $ledger->compute_internal_code($grpt);
+
+				$tva =3D array();
+				/* record all S record */
+				for ($e =3D 0; $e < $nb_detail; $e++)
+				{
+					/* Record service */
+					$oper =3D new Impacc_Operation_Tmp_Sql($adetail[$e]['o_id']);
+					$oper->from_array($array[$i]);
+					$date =3D format_date($oper->getp("date"), "YYYY-MM-DD", "DD.MM.YYY=
Y");
+					$oper->setp("date", $date);
+					$jrnx =3D new Acc_Operation($cn);
+					$jrnx->date =3D $date;
+					$amount_tva =3D $oper->getp("amount_vat");
+					$amount_tvac =3D $oper->getp("amount_total");
+					$jrnx->amount =3D bcsub($amount_tvac, $amount_tva);
+					$jrnx->poste =3D $oper->getp('poste');
+					$jrnx->grpt =3D $grpt;
+					$jrnx->type =3D $oth_side;
+					$jrnx->jrn =3D $jrn;
+					$jrnx->user =3D $_SESSION['g_user'];
+					$jrnx->periode =3D 0;
+					$jrnx->qcode =3D $oper->getp("qcode");
+					$jrnx->desc =3D mb_substr($oper->getp("desc"),0,80,'UTF8');
+					$id =3D $jrnx->insert_jrnx();
+
+					$transfer =3D new impacc_operation_transfer_sql();
+					$transfer->setp("j_id", $id);
+					$transfer->setp("o_id", $oper->getp("id"));
+					$transfer->insert();
+
+					$tva_id =3D $oper->getp("tva_id");
+
+					/*
+					 * Save into quant_purchase or quant_sale
+					 */
+					switch ($type)
+					{
+						case 'ACH':
+							$sql =3D "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->g=
etp("fiche")));
+							break;
+						case 'VEN':
+							$cn->exec_sql("insert into quant_sold
+                                        (qs_internal,qs_fiche,qs_quantit=
e,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] =3D bcadd($tva[$tva_id], $amount_tva);
+					}
+					else
+					{
+						$tva[$tva_id] =3D $amount_tva;
+					}
+					$sum =3D bcadd($sum, $amount_tvac);
+				}  // loop e
+				// Record the tiers
+
+				$jtiers =3D new Acc_Operation($cn);
+				$jtiers->date =3D $date;
+				$jtiers->amount =3D $sum;
+				$jtiers->poste =3D $oper_tiers->getp('poste');
+				$jtiers->grpt =3D $grpt;
+				$jtiers->type =3D $tiers_side;
+				$jtiers->jrn =3D $jrn;
+				$jtiers->user =3D $_SESSION['g_user'];
+				$jtiers->periode =3D 0;
+				$jtiers->qcode =3D $oper_tiers->getp("qcode");
+				$jtiers->desc =3D mb_substr($oper_tiers->getp("desc"),0,80,'UTF8');
+				$jtiers->insert_jrnx();
+
+				/* Record the vat 1 */
+				foreach ($tva as $key =3D> $value)
+				{
+					$tva =3D new Acc_TVA($cn, $key);
+					$tva->load();
+					$poste =3D $tva->get_side($oth_side);
+					$op_tva =3D new Acc_Operation($cn);
+					$op_tva->date =3D $date;
+					$op_tva->amount =3D $value;
+					$op_tva->poste =3D $poste;
+					$op_tva->grpt =3D $grpt;
+					$op_tva->type =3D $oth_side;
+					$op_tva->jrn =3D $jrn;
+					$op_tva->user =3D $_SESSION['g_user'];
+					$op_tva->periode =3D 0;
+					$op_tva->qcode =3D null;
+					$op_tva->desc =3D $tva->tva_label;
+					$op_tva->insert_jrnx();
+				}
+
+				/* record into jrn */
+				$acc_jrn =3D new Acc_Operation($cn);
+				$acc_jrn->jrn =3D $jrn;
+				$acc_jrn->amount =3D $sum;
+				$acc_jrn->desc =3D mb_substr($oper_tiers->getp("desc"),0,80,'UTF8');
+				$acc_jrn->date =3D $date;
+				$acc_jrn->grpt =3D $grpt;
+				$acc_jrn->periode =3D 0;
+				$acc_jrn->insert_jrn();
+				$cn->exec_sql('update jrn set jr_pj_number=3D$1 where jr_id=3D$2',ar=
ray($oper->getp('pj'),$acc_jrn->jr_id));
+
+				/* Update info */
+				$ledger->grpt_id =3D $grpt;
+				$ledger->update_internal_code($internal);
+				/*
+				 * Update internal code in quant_*
+				 */
+				switch ($type)
+				{
+					case 'ACH':
+						$cn->exec_sql('update quant_purchase set qp_internal =3D $1 where =
j_id in (select j_id from jrnx where j_grpt=3D$2)', array($internal, $grp=
t));
+						break;
+					case 'VEN':
+						$cn->exec_sql('update quant_sold set qs_internal =3D $1 where j_id=
 in (select j_id from jrnx where j_grpt=3D$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 =3D " select distinct jr_id, jr_pj,jr_date, jr_comment,jr_interna=
l
+
+		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 =3D otmp.o_id) join jrnx on (jrnx.j_id =3D ot.j_id)
+		and i_id=3D$1  ) order by jr_date ";
+		$arow=3D$cn->get_array($sql,array($this->impid));
+		echo h2("Op=C3=A9rations sauv=C3=A9es",'info');
+		echo '<table class=3D"result">';
+		echo '<tr>';
+		echo th("Date");
+		echo th("Libell=C3=A9");
+		echo th("Pi=C3=A8ce");
+		echo th("N=C2=B0 op=C3=A9ration");
+		echo '</tr>';
+		for ($i=3D0;$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_int=
ernal']).'</td>';
+			echo '</tr>';
+		}
+		echo '</table>';
+	}
+
+}
+
+?>

Deleted: trunk/import_account/include/class_impdol_operation.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- 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 b=
y
- *   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-130=
7  USA
- */
-/* $Revision$ */
-
-// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
-
-/**
- * @file
- * @brief
- *
- */
-require_once 'class_sql_impdol.php';
-
-class Impdol_Operation
-{
-
-	function save_file()
-	{
-		if (trim($_FILES['csv_operation']['name']) =3D=3D '')
-		{
-			alert('Pas de fichier donn=C3=A9');
-			return -1;
-		}
-		$this->filename =3D tempnam($_ENV['TMP'], 'upload_');
-		move_uploaded_file($_FILES["csv_operation"]["tmp_name"], $this->filena=
me);
-
-		$imp =3D new Impdol_Import_sql();
-		$imp->setp('temp_file', $this->filename);
-		$imp->setp('send_file', $_FILES['csv_operation']['name']);
-		$imp->insert();
-		$this->impid =3D $imp->getp("id");
-	}
-
-	function record()
-	{
-		$foperation =3D fopen($this->filename, 'r');
-		$this->row_count =3D 0;
-		$max =3D 0;
-		while (($row =3D fgetcsv($foperation, 0, ";", '"')) !=3D=3D false)
-		{
-			if (count($row) !=3D 11)
-			{
-				$str_row =3D implode($row, ";");
-				echo "Attention " . h($str_row) . " ne contient pas 11 colonnes";
-				continue;
-			}
-			$r =3D 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=C3=A9es : " . $this->row_count;
-		$import =3D 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 =3D ok N no ok)
-	 * Put in o_message the reason of the problem
-	 */
-	function check()
-	{
-		global $cn;
-		try
-		{
-			$cn->start();
-			$array =3D $cn->get_array("select o_id from impdol.operation_tmp wher=
e i_id=3D$1 order by o_id", array($this->impid));
-			$nb_row =3D count($array);
-			for ($i =3D 0; $i < $nb_row; $i++)
-			{
-				$msg =3D "";
-				$operation =3D new impdol_operation_tmp_sql();
-				$operation->setp("id", $array[$i]['o_id']);
-				$operation->load();
-				$operation->setp("code", 'T');
-				$dol =3D $operation->getp("dolibarr");
-				/*
-				 * detect duplicate
-				 */
-				$db =3D $cn->get_value("select count(*) from impdol.operation_tmp wh=
ere o_doli=3D$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=C3=A9ration d=C3=A9j=C3=A0 transf=C3=
=A9r=C3=A9e : doublon ");
-					$operation->update();
-					continue;
-				}
-				if (trim($dol) =3D=3D "" || isNumber($dol) =3D=3D 0)
-				{
-					$operation->setp("code", 'N');
-					$msg.=3D" le num=C3=A9ro de ligne pour dolibarr est invalide";
-				}
-				if (isDate($operation->getp("date")) =3D=3D null)
-				{
-					$operation->setp("code", 'N');
-					$msg.=3D" La date est invalide, format n'est pas JJ.MM.AAAA";
-				}
-				$fiche =3D new Fiche($cn);
-				$fiche->get_by_qcode(trim($operation->getp("qcode")));
-
-				if ($fiche->id =3D=3D 0)
-				{
-					$operation->setp("code", 'N');
-					$msg.=3D" Cette fiche n'existe pas";
-				}
-				else
-				{
-					$operation->setp("fiche", $fiche->id);
-				}
-				/**
-				 * check if card as a valid accounting
-				 */
-				$poste =3D $fiche->strAttribut(ATTR_DEF_ACCOUNT);
-				if (trim($poste) =3D=3D '' || $cn->get_value("select count(*) from t=
mp_pcmn where pcm_val=3D$1", array($poste)) =3D=3D 0)
-				{
-					$operation->setp("code", 'N');
-					$msg.=3D" Cette fiche n'a pas de poste comptable valide";
-				}
-				$operation->setp("poste", $poste);
-				$a =3D array("rate" =3D> " Taux de TVA", "amount_total" =3D> "Montan=
t total", "number_unit" =3D> 'Nombre d\'unit=C3=A9', "amount_vat" =3D> "M=
ontant TVA");
-
-				foreach ($a as $key =3D> $value)
-				{
-					$v =3D $operation->getp($key);
-					$v =3D str_replace(",", ".", $v);
-
-					if (trim($v) !=3D "" && isNumber($v) =3D=3D 0)
-					{
-						$operation->setp("code", 'N');
-						$msg.=3D" $value n'est pas un nombre";
-						continue;
-					}
-
-					$operation->setp($key, $v);
-				}
-
-				if ($operation->getp("type") !=3D "T")
-				{
-					$tva_id =3D $cn->get_array("select tva_id from impdol.parameter_tva=
 where pt_rate/100=3D$1", array($operation->getp("rate")));
-					if (count($tva_id) > 1)
-					{
-						$operation->setp("code", 'N');
-						$msg.=3D" Plusieurs code TVA correspondent =C3=A0 ce taux";
-					}
-					elseif (empty($tva_id))
-					{
-						$operation->setp("code", 'N');
-						$msg.=3D" Aucun code TVA ne correspond =C3=A0 ce taux";
-					}
-					else
-					{
-						$operation->setp("tva_id", $tva_id[0]['tva_id']);
-					}
-				}
-				// a supplier and one service at least is needed
-				$code_op =3D $operation->getp("dolibarr");
-				$nb_customer =3D $cn->get_value("select count(*) from impdol.operati=
on_tmp where o_type=3D'T' and o_doli=3D$1 and i_id=3D$2", array($code_op,=
 $this->impid));
-				$nb_good =3D $cn->get_value("select count(*) from impdol.operation_t=
mp where o_type=3D'S' and o_doli=3D$1 and i_id=3D$2", array($code_op, $th=
is->impid));
-				if ($nb_customer =3D=3D 0)
-				{
-					$operation->setp("code", 'N');
-					$msg.=3D" Aucun client ou fournisseur";
-				}
-				if ($nb_good =3D=3D 0)
-				{
-					$operation->setp("code", 'N');
-					$msg.=3D" Aucune marchandise ou service";
-				}
-
-				// check if in a opened period
-				$op_date =3D $operation->getp('date');
-				$periode =3D new Periode($cn);
-				try
-				{
-					$periode->find_periode($op_date);
-				}
-				catch (Exception $e)
-				{
-					$msg.=3D$e->getMessage();
-					$operation->setp('code', 'N');
-				}
-
-				$operation->setp("message", $msg);
-				$operation->update();
-			}
-			/*
-			 *  If a part is N then the whole operation is N
-			 */
-			$sql =3D "update impdol.operation_tmp  set o_result=3D'N' where i_id=3D=
$1 and
-				o_doli in (select o_doli from impdol.operation_tmp  where o_result=3D=
'N' and i_id=3D$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 =3D " 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=3D'T' then '" . $g_succeed . "' else '" . $g_faile=
d . "' end as result,
-			o_message
-			from impdol.operation_tmp where i_id=3D" . $this->impid . " order by =
o_id";
-		echo Html_Table::sql2table($cn, array(
-			array('name' =3D> 'n=C2=B0 ligne',
-				'style' =3D> 'style=3D"text-align:right"'),
-			array('name' =3D> 'Date',
-				'style' =3D> 'text-align:right'),
-			array('name' =3D> 'QuickCode'),
-			array('name' =3D> 'Libell=C3=A9'),
-			array('name' =3D> 'n=C2=B0 pj'),
-			array('name' =3D> 'Montant / unit=C3=A9', 'style' =3D> 'style=3D"text=
-align:right"'),
-			array('name' =3D> 'Montant Total TVA', 'style' =3D> 'style=3D"text-al=
ign:right"'),
-			array('name' =3D> 'Nbre unit=C3=A9s', 'style' =3D> 'style=3D"text-ali=
gn:right"'),
-			array('name' =3D> 'taux TVA', 'style' =3D> 'style=3D"text-align:right=
"'),
-			array('name' =3D> 'Montant total TVAC', 'style' =3D> 'style=3D"text-a=
lign:right"'),
-			array('name' =3D> 'Transfert', 'style' =3D> 'style=3D"text-align:righ=
t"', 'raw' =3D> 1),
-			array('name' =3D> 'Message')
-				)
-				, $sql, 'style=3D"width:100%" class=3D"result"'
-		);
-	}
-
-	function transfer()
-	{
-		global $cn;
-		$jrn =3D $_POST['p_jrn'];
-		$ledger =3D new Acc_Ledger($cn, $jrn);
-		$type =3D $ledger->get_type();
-		switch ($type)
-		{
-			case 'ACH':
-				$ledger =3D new Acc_Ledger_Purchase($cn, $jrn);
-				$tiers_side =3D 'c';
-				$oth_side =3D 'd';
-				break;
-			case 'VEN':
-				$ledger =3D new Acc_Ledger_Sold($cn, $jrn);
-				$tiers_side =3D 'd';
-				$oth_side =3D 'c';
-				break;
-			default:
-				die('Erreur ce type journal n\' est pas encore support=C3=A9');
-		}
-		/**
-		 * Loop in table operation_tmp, get all the record to transfer
-		 */
-		$array =3D $cn->get_array("select
-					distinct o_doli
-				from impdol.operation_tmp
-				where i_id=3D$1 and o_result=3D'T'
-				order by o_doli  asc", array($this->impid));
-		$nb_row =3D count($array);
-		bcscale(2);
-		try
-		{
-			$cn->start();
-			for ($i =3D 0; $i < $nb_row; $i++)
-			{
-				/*
-				 * For each operation (same o_doli code)
-				 */
-				$adetail =3D $cn->get_array("select o_id from impdol.operation_tmp w=
here o_doli=3D$1 and i_id=3D$2 and o_type=3D'S'", array($array[$i]['o_dol=
i'], $this->impid));
-				$atiers =3D $cn->get_array("select o_id from impdol.operation_tmp wh=
ere o_doli=3D$1 and i_id=3D$2  and o_type=3D'T'", array($array[$i]['o_dol=
i'], $this->impid));
-				if (count($atiers) > 1)
-				{
-					echo "Plusieurs clients pour l' op=C3=A9ration, code " . $array[$i]=
['o_doli'];
-					continue;
-				}
-				if (count($atiers) =3D=3D 0)
-				{
-					echo "Pas de client pour une op=C3=A9ration, code " . $array[$i]['o=
_doli'];
-					continue;
-				}
-
-				$oper_tiers =3D new Impdol_Operation_Tmp_Sql($atiers[0]['o_id']);
-				$nb_detail =3D count($adetail);
-				$sum =3D 0;
-				$grpt =3D $cn->get_value("select nextval('s_grpt');");
-				$internal =3D $ledger->compute_internal_code($grpt);
-
-				$tva =3D array();
-				/* record all S record */
-				for ($e =3D 0; $e < $nb_detail; $e++)
-				{
-					/* Record service */
-					$oper =3D new Impdol_Operation_Tmp_Sql($adetail[$e]['o_id']);
-					$oper->from_array($array[$i]);
-					$date =3D format_date($oper->getp("date"), "YYYY-MM-DD", "DD.MM.YYY=
Y");
-					$oper->setp("date", $date);
-					$jrnx =3D new Acc_Operation($cn);
-					$jrnx->date =3D $date;
-					$amount_tva =3D $oper->getp("amount_vat");
-					$amount_tvac =3D $oper->getp("amount_total");
-					$jrnx->amount =3D bcsub($amount_tvac, $amount_tva);
-					$jrnx->poste =3D $oper->getp('poste');
-					$jrnx->grpt =3D $grpt;
-					$jrnx->type =3D $oth_side;
-					$jrnx->jrn =3D $jrn;
-					$jrnx->user =3D $_SESSION['g_user'];
-					$jrnx->periode =3D 0;
-					$jrnx->qcode =3D $oper->getp("qcode");
-					$jrnx->desc =3D mb_substr($oper->getp("desc"),0,80,'UTF8');
-					$id =3D $jrnx->insert_jrnx();
-
-					$transfer =3D new impdol_operation_transfer_sql();
-					$transfer->setp("j_id", $id);
-					$transfer->setp("o_id", $oper->getp("id"));
-					$transfer->insert();
-
-					$tva_id =3D $oper->getp("tva_id");
-
-					/*
-					 * Save into quant_purchase or quant_sale
-					 */
-					switch ($type)
-					{
-						case 'ACH':
-							$sql =3D "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->g=
etp("fiche")));
-							break;
-						case 'VEN':
-							$cn->exec_sql("insert into quant_sold
-                                        (qs_internal,qs_fiche,qs_quantit=
e,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] =3D bcadd($tva[$tva_id], $amount_tva);
-					}
-					else
-					{
-						$tva[$tva_id] =3D $amount_tva;
-					}
-					$sum =3D bcadd($sum, $amount_tvac);
-				}  // loop e
-				// Record the tiers
-
-				$jtiers =3D new Acc_Operation($cn);
-				$jtiers->date =3D $date;
-				$jtiers->amount =3D $sum;
-				$jtiers->poste =3D $oper_tiers->getp('poste');
-				$jtiers->grpt =3D $grpt;
-				$jtiers->type =3D $tiers_side;
-				$jtiers->jrn =3D $jrn;
-				$jtiers->user =3D $_SESSION['g_user'];
-				$jtiers->periode =3D 0;
-				$jtiers->qcode =3D $oper_tiers->getp("qcode");
-				$jtiers->desc =3D mb_substr($oper_tiers->getp("desc"),0,80,'UTF8');
-				$jtiers->insert_jrnx();
-
-				/* Record the vat 1 */
-				foreach ($tva as $key =3D> $value)
-				{
-					$tva =3D new Acc_TVA($cn, $key);
-					$tva->load();
-					$poste =3D $tva->get_side($oth_side);
-					$op_tva =3D new Acc_Operation($cn);
-					$op_tva->date =3D $date;
-					$op_tva->amount =3D $value;
-					$op_tva->poste =3D $poste;
-					$op_tva->grpt =3D $grpt;
-					$op_tva->type =3D $oth_side;
-					$op_tva->jrn =3D $jrn;
-					$op_tva->user =3D $_SESSION['g_user'];
-					$op_tva->periode =3D 0;
-					$op_tva->qcode =3D null;
-					$op_tva->desc =3D $tva->tva_label;
-					$op_tva->insert_jrnx();
-				}
-
-				/* record into jrn */
-				$acc_jrn =3D new Acc_Operation($cn);
-				$acc_jrn->jrn =3D $jrn;
-				$acc_jrn->amount =3D $sum;
-				$acc_jrn->desc =3D mb_substr($oper_tiers->getp("desc"),0,80,'UTF8');
-				$acc_jrn->date =3D $date;
-				$acc_jrn->grpt =3D $grpt;
-				$acc_jrn->periode =3D 0;
-				$acc_jrn->insert_jrn();
-				$cn->exec_sql('update jrn set jr_pj_number=3D$1 where jr_id=3D$2',ar=
ray($oper->getp('pj'),$acc_jrn->jr_id));
-
-				/* Update info */
-				$ledger->grpt_id =3D $grpt;
-				$ledger->update_internal_code($internal);
-				/*
-				 * Update internal code in quant_*
-				 */
-				switch ($type)
-				{
-					case 'ACH':
-						$cn->exec_sql('update quant_purchase set qp_internal =3D $1 where =
j_id in (select j_id from jrnx where j_grpt=3D$2)', array($internal, $grp=
t));
-						break;
-					case 'VEN':
-						$cn->exec_sql('update quant_sold set qs_internal =3D $1 where j_id=
 in (select j_id from jrnx where j_grpt=3D$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 =3D " select distinct jr_id, jr_pj,jr_date, jr_comment,jr_interna=
l
-
-		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 =3D otmp.o_id) join jrnx on (jrnx.j_id =3D ot.j_id)
-		and i_id=3D$1  ) order by jr_date ";
-		$arow=3D$cn->get_array($sql,array($this->impid));
-		echo h2("Op=C3=A9rations sauv=C3=A9es",'info');
-		echo '<table class=3D"result">';
-		echo '<tr>';
-		echo th("Date");
-		echo th("Libell=C3=A9");
-		echo th("Pi=C3=A8ce");
-		echo th("N=C2=B0 op=C3=A9ration");
-		echo '</tr>';
-		for ($i=3D0;$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_int=
ernal']).'</td>';
-			echo '</tr>';
-		}
-		echo '</table>';
-	}
-
-}
-
-?>

Copied: trunk/import_account/include/class_install_impacc.php (from rev 4=
59, trunk/import_account/include/class_install_impdol.php)
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/import_account/include/class_install_impacc.php	               =
         (rev 0)
+++ trunk/import_account/include/class_install_impacc.php	2013-01-06 00:5=
0: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 b=
y
+ *   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-130=
7  USA
+ */
+/* $Revision$ */
+
+// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
+
+/**
+ * @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 b=
e transferrable, N cannot be transferrable';
+			");
+
+			$p_cn->exec_sql("
+			COMMENT ON COLUMN impacc.operation_tmp.o_type IS 'S =3D marchandise, =
serviceT =3D 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
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/import_account/include/class_install_impdol.php	2013-01-06 00:4=
0:57 UTC (rev 459)
+++ trunk/import_account/include/class_install_impdol.php	2013-01-06 00:5=
0: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 b=
y
- *   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-130=
7  USA
- */
-/* $Revision$ */
-
-// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
-
-/**
- * @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 b=
e transferrable, N cannot be transferrable';
-			");
-
-			$p_cn->exec_sql("
-			COMMENT ON COLUMN impdol.operation_tmp.o_type IS 'S =3D marchandise, =
serviceT =3D 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)
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- 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 =3D -1)
+	{
+		$this->cn =3D $p_cn;
+		$pk=3D$this->primary_key;
+		$this->$pk=3D $p_id;
+
+		if ($p_id =3D=3D -1)
+		{
+			/* Initialize an empty object */
+			foreach ($this->name as $key )
+			{
+				$this->$key=3D null;
+			}
+			$this->$pk=3D $p_id;
+		}
+		else
+		{
+			/* load it */
+			$this->load();
+		}
+	}
+
+	public function getp($p_string)
+	{
+		if (array_key_exists( $p_string,$this->name))
+		{
+			$idx =3D $this->name[$p_string];
+			return $this->$idx;
+		}
+		else
+			throw new Exception(__FILE__ . ":" . __LINE__ . $p_string . 'Erreur a=
ttribut inexistant '.$p_string);
+	}
+
+	public function setp($p_string, $p_value)
+	{
+		if (array_key_exists( $p_string,$this->name))
+		{
+			$idx =3D $this->name[$p_string];
+			$this->$idx =3D $p_value;
+		}
+		else
+			throw new Exception(__FILE__ . ":" . __LINE__ . $p_string . 'Erreur a=
ttribut inexistant '.$p_string);
+	}
+
+	public function insert()
+	{
+		$this->verify();
+		$sql =3D "insert into " . $this->table . " ( ";
+		$sep =3D "";
+		$par =3D "";
+		$idx =3D 1;
+		$array =3D array();
+		foreach ($this->name as $key=3D>$value)
+		{
+			if (isset($this->default[$value]) && $this->default[$value] =3D=3D "a=
uto" && $this->$value =3D=3Dnull )
+				continue;
+			if ( $value=3D=3D$this->primary_key && $this->$value =3D=3D -1 ) cont=
inue;
+			$sql.=3D$sep.$value;
+			switch ($this->type[$value])
+			{
+				case "date":
+					$par .=3D$sep. 'to_date($' . $idx . ",'" . $this->date_format . "')=
" ;
+					break;
+				default:
+					$par .=3D $sep."$" . $idx ;
+			}
+
+			$array[] =3D $this->$value;
+			$sep =3D ",";
+			$idx++;
+		}
+		$sql.=3D") values (" . $par . ") returning " . $this->primary_key;
+		$pk=3D$this->primary_key;
+		$this->$pk =3D $this->cn->get_value($sql, $array);
+	}
+
+	public function delete()
+	{
+		$pk=3D$this->primary_key;
+		$sql =3D " delete from " . $this->table . " where " . $this->primary_k=
ey . "=3D" . sql_string($this->$pk);
+		$this->cn->exec_sql($sql);
+	}
+
+	public function update()
+	{
+		$this->verify();
+		$pk=3D$this->primary_key;
+		$sql =3D "update " . $this->table . "  ";
+		$sep =3D "";
+		$idx =3D 1;
+		$array =3D array();
+		$set=3D" set ";
+		foreach ($this->name as $key=3D>$value)
+		{
+			if (isset($this->default[$value]) && $this->default[$value] =3D=3D "a=
uto"  )
+				continue;
+			switch ($this->type[$value])
+			{
+				case "date":
+					$par =3D$value. '=3Dto_date($' . $idx . ",'" . $this->date_format .=
 "')" ;
+					break;
+				default:
+					$par =3D $value."=3D $" . $idx ;
+			}
+			$sql.=3D$sep." $set " . $par ;
+			$array[] =3D $this->$value;
+			$sep =3D ",";$set=3D"";$idx++;
+		}
+		$sql.=3D" where " . $this->primary_key . " =3D" . $this->$pk;
+	    $this->cn->exec_sql($sql, $array);
+
+	}
+
+	public function load()
+	{
+		$sql =3D " select ";
+		$sep=3D"";$par=3D"";
+
+		foreach ($this->name as $key)
+		{
+
+			switch ($this->type[$key])
+			{
+				case "date":
+					$sql .=3D $sep.'to_char(' . $key . ",'" . $this->date_format . "') =
as ".$key ;
+					break;
+				default:
+					$sql.=3D$sep.$key ;
+			}
+			$sep =3D ",";
+		}
+		$pk=3D$this->primary_key;
+		$sql.=3D" from ".$this->table;
+		$sql.=3D" where " . $this->primary_key . " =3D " . $this->$pk;
+		$result =3D $this->cn->get_array($sql);
+		if ($this->cn->count() =3D=3D 0 ) {
+			$this->$pk=3D-1;
+			return;
+		}
+
+		foreach ($result[0] as $key=3D>$value) {
+			$this->$key=3D$value;
+		}
+	}
+
+	public function get_info()
+	{
+		return var_export($this, true);
+	}
+
+	public function verify()
+	{
+		foreach($this->name as $key){
+			if ( trim($this->$key)=3D=3D'') $this->$key=3Dnull;
+		}
+		return 0;
+	}
+	public function from_array($p_array)
+	{
+		foreach ($this->name as $key=3D>$value)
+		{
+			if ( isset ($p_array[$value]))
+			{
+				$this->$value=3D$p_array[$value];
+			}
+		}
+	}
+	public function next($ret,$i) {
+		global $cn;
+		$array=3D$this->cn->fetch_array($ret,$i);
+		$this->from_array($array);
+	}
+
+}
+
+class impacc_operation_sql extends sql_impacc
+{
+
+	function __construct($p_id=3D-1)
+	{
+		$this->table =3D "impacc.operation";
+		$this->primary_key =3D "o_id";
+
+		$this->name=3Darray(
+			"id"=3D>"o_id",
+			"dolibarr"=3D>"o_doli",
+			"date"=3D>"o_date",
+			"qcode"=3D>"o_qcode",
+			"fiche"=3D>"f_id",
+			"desc"=3D>"o_label",
+			"pj"=3D>"o_pj",
+			"amount_unit"=3D>"amount_unit",
+			"amount_vat"=3D>"amount_vat",
+			"number_unit"=3D>"number_unit",
+			"rate"=3D>"vat_rate",
+			"amount_total"=3D>"amount_total",
+			"jrn_def_id"=3D>"jrn_def_id",
+			"o_message"=3D>"o_message",
+			"import_id"=3D>"i_id",
+			"status"=3D>"o_status"
+
+		);
+
+		$this->type =3D array(
+			"o_id"=3D>"numeric",
+			"o_doli"=3D>"numeric",
+			"o_date"=3D>"date",
+			"o_qcode"=3D>"text",
+			"f_id"=3D>"numeric",
+			"o_label"=3D>"text",
+			"o_pj"=3D>"text",
+			"amount_unit"=3D>"numeric",
+			"amount_vat"=3D>"numeric",
+			"number_unit"=3D>"numeric",
+			"vat_rate"=3D>"numeric",
+			"amount_total"=3D>"numeric",
+			"jrn_def_id"=3D>"numeric",
+			"o_message"=3D>"text",
+			"i_id"=3D>"numeric",
+			"o_status"=3D>"text"
+			);
+
+		$this->default =3D array(
+			"o_id" =3D> "auto",
+		);
+		$this->date_format =3D "DD.MM.YYYY";
+		global $cn;
+
+		parent::__construct($cn,$p_id);
+	}
+
+}
+
+class impacc_operation_tmp_sql extends sql_impacc
+{
+
+	function __construct($p_id=3D-1)
+	{
+		$this->table =3D "impacc.operation_tmp";
+		$this->primary_key =3D "o_id";
+
+		$this->name=3Darray(
+			"id"=3D>"o_id",
+			"dolibarr"=3D>"o_doli",
+			"date"=3D>"o_date",
+			"qcode"=3D>"o_qcode",
+			"fiche"=3D>"f_id",
+			"desc"=3D>"o_label",
+			"pj"=3D>"o_pj",
+			"amount_unit"=3D>"amount_unit",
+			"amount_vat"=3D>"amount_vat",
+			"number_unit"=3D>"number_unit",
+			"rate"=3D>"vat_rate",
+			"amount_total"=3D>"amount_total",
+			"jrn_def_id"=3D>"jrn_def_id",
+			"message"=3D>"o_message",
+			"import_id"=3D>"i_id",
+			"code"=3D>"o_result",
+			"tva_id"=3D>"tva_id",
+			"type"=3D>"o_type",
+			"poste"=3D>"o_poste"
+
+		);
+
+		$this->type =3D array(
+			"o_id"=3D>"numeric",
+			"o_doli"=3D>"text",
+			"o_date"=3D>"text",
+			"o_qcode"=3D>"text",
+			"f_id"=3D>"text",
+			"o_label"=3D>"text",
+			"o_pj"=3D>"text",
+			"amount_unit"=3D>"text",
+			"amount_vat"=3D>"text",
+			"number_unit"=3D>"text",
+			"vat_rate"=3D>"text",
+			"amount_total"=3D>"text",
+			"jrn_def_id"=3D>"text",
+			"o_message"=3D>"text",
+			"i_id"=3D>"numeric",
+			"o_result"=3D>'text',
+			"tva_id"=3D>'numeric',
+			"o_type"=3D>'text',
+			"o_poste"=3D>"text"
+			);
+
+		$this->default =3D array(
+			"o_id" =3D> "auto",
+		);
+		$this->date_format =3D "DD.MM.YYYY";
+		global $cn;
+
+		parent::__construct($cn,$p_id);
+	}
+
+}
+
+class impacc_import_sql extends sql_impacc
+{
+	function __construct($p_id=3D-1)
+	{
+		$this->table =3D "impacc.import";
+		$this->primary_key =3D "i_id";
+
+		$this->name=3Darray(
+			"id"=3D>"i_id",
+			"send_file"=3D>"send_file",
+			"temp_file"=3D>"temp_file",
+			"date"=3D>"i_date",
+			"nbrow"=3D>"i_row"
+		);
+
+		$this->type =3D array(
+			"i_id"=3D>"numeric",
+			"send_file"=3D>"text",
+			"temp_file"=3D>"text",
+			"i_date"=3D>"date",
+			"i_row"=3D>"numeric"
+			);
+
+		$this->default =3D array(
+			"i_id" =3D> "auto",
+			"i_date" =3D> "auto"
+		);
+		$this->date_format =3D "DD.MM.YYYY";
+		global $cn;
+
+		parent::__construct($cn,$p_id);
+	}
+}
+
+
+class impacc_operation_transfer_sql extends sql_impacc
+{
+	function __construct($p_id=3D-1)
+	{
+		$this->table =3D "impacc.operation_transfer";
+		$this->primary_key =3D "ot_id";
+
+		$this->name=3Darray(
+			"id"=3D>"ot_id",
+			"j_id"=3D>"j_id",
+			"o_id"=3D>"o_id"
+		);
+
+		$this->type =3D array(
+			"ot_id"=3D>'numeric',
+			"j_id"=3D>'numeric',
+			"o_id"=3D>'numeric',
+			);
+
+		$this->default =3D array(
+			"i_id" =3D> "auto"
+		);
+		$this->date_format =3D "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
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- 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 =3D -1)
-	{
-		$this->cn =3D $p_cn;
-		$pk=3D$this->primary_key;
-		$this->$pk=3D $p_id;
-
-		if ($p_id =3D=3D -1)
-		{
-			/* Initialize an empty object */
-			foreach ($this->name as $key )
-			{
-				$this->$key=3D null;
-			}
-			$this->$pk=3D $p_id;
-		}
-		else
-		{
-			/* load it */
-			$this->load();
-		}
-	}
-
-	public function getp($p_string)
-	{
-		if (array_key_exists( $p_string,$this->name))
-		{
-			$idx =3D $this->name[$p_string];
-			return $this->$idx;
-		}
-		else
-			throw new Exception(__FILE__ . ":" . __LINE__ . $p_string . 'Erreur a=
ttribut inexistant '.$p_string);
-	}
-
-	public function setp($p_string, $p_value)
-	{
-		if (array_key_exists( $p_string,$this->name))
-		{
-			$idx =3D $this->name[$p_string];
-			$this->$idx =3D $p_value;
-		}
-		else
-			throw new Exception(__FILE__ . ":" . __LINE__ . $p_string . 'Erreur a=
ttribut inexistant '.$p_string);
-	}
-
-	public function insert()
-	{
-		$this->verify();
-		$sql =3D "insert into " . $this->table . " ( ";
-		$sep =3D "";
-		$par =3D "";
-		$idx =3D 1;
-		$array =3D array();
-		foreach ($this->name as $key=3D>$value)
-		{
-			if (isset($this->default[$value]) && $this->default[$value] =3D=3D "a=
uto" && $this->$value =3D=3Dnull )
-				continue;
-			if ( $value=3D=3D$this->primary_key && $this->$value =3D=3D -1 ) cont=
inue;
-			$sql.=3D$sep.$value;
-			switch ($this->type[$value])
-			{
-				case "date":
-					$par .=3D$sep. 'to_date($' . $idx . ",'" . $this->date_format . "')=
" ;
-					break;
-				default:
-					$par .=3D $sep."$" . $idx ;
-			}
-
-			$array[] =3D $this->$value;
-			$sep =3D ",";
-			$idx++;
-		}
-		$sql.=3D") values (" . $par . ") returning " . $this->primary_key;
-		$pk=3D$this->primary_key;
-		$this->$pk =3D $this->cn->get_value($sql, $array);
-	}
-
-	public function delete()
-	{
-		$pk=3D$this->primary_key;
-		$sql =3D " delete from " . $this->table . " where " . $this->primary_k=
ey . "=3D" . sql_string($this->$pk);
-		$this->cn->exec_sql($sql);
-	}
-
-	public function update()
-	{
-		$this->verify();
-		$pk=3D$this->primary_key;
-		$sql =3D "update " . $this->table . "  ";
-		$sep =3D "";
-		$idx =3D 1;
-		$array =3D array();
-		$set=3D" set ";
-		foreach ($this->name as $key=3D>$value)
-		{
-			if (isset($this->default[$value]) && $this->default[$value] =3D=3D "a=
uto"  )
-				continue;
-			switch ($this->type[$value])
-			{
-				case "date":
-					$par =3D$value. '=3Dto_date($' . $idx . ",'" . $this->date_format .=
 "')" ;
-					break;
-				default:
-					$par =3D $value."=3D $" . $idx ;
-			}
-			$sql.=3D$sep." $set " . $par ;
-			$array[] =3D $this->$value;
-			$sep =3D ",";$set=3D"";$idx++;
-		}
-		$sql.=3D" where " . $this->primary_key . " =3D" . $this->$pk;
-	    $this->cn->exec_sql($sql, $array);
-
-	}
-
-	public function load()
-	{
-		$sql =3D " select ";
-		$sep=3D"";$par=3D"";
-
-		foreach ($this->name as $key)
-		{
-
-			switch ($this->type[$key])
-			{
-				case "date":
-					$sql .=3D $sep.'to_char(' . $key . ",'" . $this->date_format . "') =
as ".$key ;
-					break;
-				default:
-					$sql.=3D$sep.$key ;
-			}
-			$sep =3D ",";
-		}
-		$pk=3D$this->primary_key;
-		$sql.=3D" from ".$this->table;
-		$sql.=3D" where " . $this->primary_key . " =3D " . $this->$pk;
-		$result =3D $this->cn->get_array($sql);
-		if ($this->cn->count() =3D=3D 0 ) {
-			$this->$pk=3D-1;
-			return;
-		}
-
-		foreach ($result[0] as $key=3D>$value) {
-			$this->$key=3D$value;
-		}
-	}
-
-	public function get_info()
-	{
-		return var_export($this, true);
-	}
-
-	public function verify()
-	{
-		foreach($this->name as $key){
-			if ( trim($this->$key)=3D=3D'') $this->$key=3Dnull;
-		}
-		return 0;
-	}
-	public function from_array($p_array)
-	{
-		foreach ($this->name as $key=3D>$value)
-		{
-			if ( isset ($p_array[$value]))
-			{
-				$this->$value=3D$p_array[$value];
-			}
-		}
-	}
-	public function next($ret,$i) {
-		global $cn;
-		$array=3D$this->cn->fetch_array($ret,$i);
-		$this->from_array($array);
-	}
-
-}
-
-class impdol_operation_sql extends sql_impdol
-{
-
-	function __construct($p_id=3D-1)
-	{
-		$this->table =3D "impdol.operation";
-		$this->primary_key =3D "o_id";
-
-		$this->name=3Darray(
-			"id"=3D>"o_id",
-			"dolibarr"=3D>"o_doli",
-			"date"=3D>"o_date",
-			"qcode"=3D>"o_qcode",
-			"fiche"=3D>"f_id",
-			"desc"=3D>"o_label",
-			"pj"=3D>"o_pj",
-			"amount_unit"=3D>"amount_unit",
-			"amount_vat"=3D>"amount_vat",
-			"number_unit"=3D>"number_unit",
-			"rate"=3D>"vat_rate",
-			"amount_total"=3D>"amount_total",
-			"jrn_def_id"=3D>"jrn_def_id",
-			"o_message"=3D>"o_message",
-			"import_id"=3D>"i_id",
-			"status"=3D>"o_status"
-
-		);
-
-		$this->type =3D array(
-			"o_id"=3D>"numeric",
-			"o_doli"=3D>"numeric",
-			"o_date"=3D>"date",
-			"o_qcode"=3D>"text",
-			"f_id"=3D>"numeric",
-			"o_label"=3D>"text",
-			"o_pj"=3D>"text",
-			"amount_unit"=3D>"numeric",
-			"amount_vat"=3D>"numeric",
-			"number_unit"=3D>"numeric",
-			"vat_rate"=3D>"numeric",
-			"amount_total"=3D>"numeric",
-			"jrn_def_id"=3D>"numeric",
-			"o_message"=3D>"text",
-			"i_id"=3D>"numeric",
-			"o_status"=3D>"text"
-			);
-
-		$this->default =3D array(
-			"o_id" =3D> "auto",
-		);
-		$this->date_format =3D "DD.MM.YYYY";
-		global $cn;
-
-		parent::__construct($cn,$p_id);
-	}
-
-}
-
-class impdol_operation_tmp_sql extends sql_impdol
-{
-
-	function __construct($p_id=3D-1)
-	{
-		$this->table =3D "impdol.operation_tmp";
-		$this->primary_key =3D "o_id";
-
-		$this->name=3Darray(
-			"id"=3D>"o_id",
-			"dolibarr"=3D>"o_doli",
-			"date"=3D>"o_date",
-			"qcode"=3D>"o_qcode",
-			"fiche"=3D>"f_id",
-			"desc"=3D>"o_label",
-			"pj"=3D>"o_pj",
-			"amount_unit"=3D>"amount_unit",
-			"amount_vat"=3D>"amount_vat",
-			"number_unit"=3D>"number_unit",
-			"rate"=3D>"vat_rate",
-			"amount_total"=3D>"amount_total",
-			"jrn_def_id"=3D>"jrn_def_id",
-			"message"=3D>"o_message",
-			"import_id"=3D>"i_id",
-			"code"=3D>"o_result",
-			"tva_id"=3D>"tva_id",
-			"type"=3D>"o_type",
-			"poste"=3D>"o_poste"
-
-		);
-
-		$this->type =3D array(
-			"o_id"=3D>"numeric",
-			"o_doli"=3D>"text",
-			"o_date"=3D>"text",
-			"o_qcode"=3D>"text",
-			"f_id"=3D>"text",
-			"o_label"=3D>"text",
-			"o_pj"=3D>"text",
-			"amount_unit"=3D>"text",
-			"amount_vat"=3D>"text",
-			"number_unit"=3D>"text",
-			"vat_rate"=3D>"text",
-			"amount_total"=3D>"text",
-			"jrn_def_id"=3D>"text",
-			"o_message"=3D>"text",
-			"i_id"=3D>"numeric",
-			"o_result"=3D>'text',
-			"tva_id"=3D>'numeric',
-			"o_type"=3D>'text',
-			"o_poste"=3D>"text"
-			);
-
-		$this->default =3D array(
-			"o_id" =3D> "auto",
-		);
-		$this->date_format =3D "DD.MM.YYYY";
-		global $cn;
-
-		parent::__construct($cn,$p_id);
-	}
-
-}
-
-class impdol_import_sql extends sql_impdol
-{
-	function __construct($p_id=3D-1)
-	{
-		$this->table =3D "impdol.import";
-		$this->primary_key =3D "i_id";
-
-		$this->name=3Darray(
-			"id"=3D>"i_id",
-			"send_file"=3D>"send_file",
-			"temp_file"=3D>"temp_file",
-			"date"=3D>"i_date",
-			"nbrow"=3D>"i_row"
-		);
-
-		$this->type =3D array(
-			"i_id"=3D>"numeric",
-			"send_file"=3D>"text",
-			"temp_file"=3D>"text",
-			"i_date"=3D>"date",
-			"i_row"=3D>"numeric"
-			);
-
-		$this->default =3D array(
-			"i_id" =3D> "auto",
-			"i_date" =3D> "auto"
-		);
-		$this->date_format =3D "DD.MM.YYYY";
-		global $cn;
-
-		parent::__construct($cn,$p_id);
-	}
-}
-
-
-class impdol_operation_transfer_sql extends sql_impdol
-{
-	function __construct($p_id=3D-1)
-	{
-		$this->table =3D "impdol.operation_transfer";
-		$this->primary_key =3D "ot_id";
-
-		$this->name=3Darray(
-			"id"=3D>"ot_id",
-			"j_id"=3D>"j_id",
-			"o_id"=3D>"o_id"
-		);
-
-		$this->type =3D array(
-			"ot_id"=3D>'numeric',
-			"j_id"=3D>'numeric',
-			"o_id"=3D>'numeric',
-			);
-
-		$this->default =3D array(
-			"i_id" =3D> "auto"
-		);
-		$this->date_format =3D "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
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/import_account/include/imd_operation.inc.php	2013-01-06 00:40:5=
7 UTC (rev 459)
+++ trunk/import_account/include/imd_operation.inc.php	2013-01-06 00:50:0=
9 UTC (rev 460)
@@ -26,7 +26,7 @@
  * @brief upload operation
  *
  */
-require_once 'class_impdol_operation.php';
+require_once 'class_impacc_operation.php';
=20
 // 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=3Dnew Impdol_Operation();
+	$io=3Dnew Impacc_Operation();
 	$io->save_file();
=20
 	// record the file into the table operation

Modified: trunk/import_account/index.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- 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 @@
=20
 // Javascript
  ob_start();
- require_once('impdol.js');
+ require_once('impacc.js');
 $j=3Dob_get_contents();
 ob_end_clean();
 echo create_script($j);
@@ -75,9 +75,9 @@
     $default=3D0;
   }
=20
-  if ($cn->exist_schema('impdol') =3D=3D false)
+  if ($cn->exist_schema('impacc') =3D=3D false)
   {
-    require_once('include/class_install_impdol.php');
+    require_once('include/class_install_impacc.php');
=20
     $iplugn=3Dnew Install_Impdol();
     $iplugn->install($cn);



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


From MAILER-DAEMON Tue Jan 15 15:26:21 2013
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1TvD5R-0002u7-Gy
	for mharc-phpcompta-dev@gnu.org; Tue, 15 Jan 2013 15:26:21 -0500
To: phpcompta-dev@nongnu.org
Content-Type: text/plain; charset=UTF-8
Date: Tue, 15 Jan 2013 21:18:17 +0100 (CET)
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 91.121.80.190
Message-ID: <mailman.1020000.1358281581.854.phpcompta-dev@nongnu.org>
From: phpcompta-dev@nongnu.org
Subject: [Phpcompta-dev] r461 - in trunk/import_account: . include
X-BeenThere: phpcompta-dev@nongnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: phpcompta-dev@nongnu.org
List-Id: <phpcompta-dev.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/phpcompta-dev>,
	<mailto:phpcompta-dev-request@nongnu.org?subject=unsubscribe>
List-Archive: <http://lists.nongnu.org/archive/html/phpcompta-dev>
List-Post: <mailto:phpcompta-dev@nongnu.org>
List-Help: <mailto:phpcompta-dev-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/phpcompta-dev>,
	<mailto:phpcompta-dev-request@nongnu.org?subject=subscribe>
X-List-Received-Date: Tue, 15 Jan 2013 20:26:20 -0000

Author: danydb
Date: 2013-01-15 21:18:16 +0100 (Tue, 15 Jan 2013)
New Revision: 461

Modified:
   trunk/import_account/include/class_impacc_operation.php
   trunk/import_account/include/imd_parameter.inc.php
   trunk/import_account/index.php
Log:
Fix bug=20

Modified: trunk/import_account/include/class_impacc_operation.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/import_account/include/class_impacc_operation.php	2013-01-06 00=
:50:09 UTC (rev 460)
+++ trunk/import_account/include/class_impacc_operation.php	2013-01-15 20=
:18:16 UTC (rev 461)
@@ -215,7 +215,7 @@
 			/*
 			 *  If a part is N then the whole operation is N
 			 */
-			$sql =3D "update impadd.operation_tmp  set o_result=3D'N' where i_id=3D=
$1 and
+			$sql =3D "update impacc.operation_tmp  set o_result=3D'N' where i_id=3D=
$1 and
 				o_doli in (select o_doli from impacc.operation_tmp  where o_result=3D=
'N' and i_id=3D$1)";
 			$cn->exec_sql($sql, array($this->impid));
 			$cn->commit();

Modified: trunk/import_account/include/imd_parameter.inc.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/import_account/include/imd_parameter.inc.php	2013-01-06 00:50:0=
9 UTC (rev 460)
+++ trunk/import_account/include/imd_parameter.inc.php	2013-01-15 20:18:1=
6 UTC (rev 461)
@@ -39,7 +39,7 @@
 		$tva =3D new Acc_Tva($cn, $tva_id);
 		if ($tva->load() =3D=3D -1)
 			throw new Exception('Cette tva est invalide');
-		$sql =3D "insert into impdol.parameter_tva(tva_id,pt_rate) values ($1,=
$2)";
+		$sql =3D "insert into impacc.parameter_tva(tva_id,pt_rate) values ($1,=
$2)";
 		$cn->exec_sql($sql, array($_POST['tva_id'], $_POST['pt_rate']));
 	}
 	catch (Exception $e)
@@ -50,7 +50,7 @@
 if (isset($_POST['mod']))
 {
 	extract ($_POST);
-	$aparm =3D $cn->get_array("select pt_id from impdol.parameter_tva");
+	$aparm =3D $cn->get_array("select pt_id from impacc.parameter_tva");
 	try
 	{
 		for ($i =3D 0; $i < count($aparm); $i++)
@@ -66,7 +66,7 @@
 				$tva =3D new Acc_Tva($cn, $tva_id);
 				if ($tva->load() =3D=3D -1)
 					throw new Exception('Cette tva est invalide');
-				$sql =3D "update impdol.parameter_tva set tva_id =3D $1, pt_rate =3D=
 $2 where pt_id=3D$3";
+				$sql =3D "update impacc.parameter_tva set tva_id =3D $1, pt_rate =3D=
 $2 where pt_id=3D$3";
 				$cn->exec_sql($sql, array($tva_id, $pt_rate,$aparm[$i]['pt_id']));
 			}
 		}
@@ -79,7 +79,7 @@
 /**
  * get data from database
  */
-$atva =3D $cn->get_array("select * from impdol.parameter_tva order by pt=
_rate");
+$atva =3D $cn->get_array("select * from impacc.parameter_tva order by pt=
_rate");
 require 'template/parameter_tva_add.php';
 echo '<form method=3D"POST">';
 require 'template/parameter.php';

Modified: trunk/import_account/index.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/import_account/index.php	2013-01-06 00:50:09 UTC (rev 460)
+++ trunk/import_account/index.php	2013-01-15 20:18:16 UTC (rev 461)
@@ -79,7 +79,7 @@
   {
     require_once('include/class_install_impacc.php');
=20
-    $iplugn=3Dnew Install_Impdol();
+    $iplugn=3Dnew Install_ImpAcc();
     $iplugn->install($cn);
=20
   }



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


From MAILER-DAEMON Fri Jan 18 18:36:48 2013
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1TwLUO-0006qF-PI
	for mharc-phpcompta-dev@gnu.org; Fri, 18 Jan 2013 18:36:48 -0500
To: phpcompta-dev@nongnu.org
Content-Type: text/plain; charset=UTF-8
Date: Sat, 19 Jan 2013 00:28:53 +0100 (CET)
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 91.121.80.190
Message-ID: <mailman.1029293.1358552207.854.phpcompta-dev@nongnu.org>
From: phpcompta-dev@nongnu.org
Subject: [Phpcompta-dev] r5171 - phpcompta/tags/rel650/include
X-BeenThere: phpcompta-dev@nongnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: phpcompta-dev@nongnu.org
List-Id: <phpcompta-dev.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/phpcompta-dev>,
	<mailto:phpcompta-dev-request@nongnu.org?subject=unsubscribe>
List-Archive: <http://lists.nongnu.org/archive/html/phpcompta-dev>
List-Post: <mailto:phpcompta-dev@nongnu.org>
List-Help: <mailto:phpcompta-dev-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/phpcompta-dev>,
	<mailto:phpcompta-dev-request@nongnu.org?subject=subscribe>
X-List-Received-Date: Fri, 18 Jan 2013 23:36:47 -0000

Author: danydb
Date: 2013-01-19 00:28:52 +0100 (Sat, 19 Jan 2013)
New Revision: 5171

Modified:
   phpcompta/tags/rel650/include/dossier.inc.php
Log:
0000778: Si dossier n'existe pas alors il y a une erreur dans administrat=
ion > dossier

Modified: phpcompta/tags/rel650/include/dossier.inc.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- phpcompta/tags/rel650/include/dossier.inc.php	2013-01-03 20:15:40 UTC=
 (rev 5170)
+++ phpcompta/tags/rel650/include/dossier.inc.php	2013-01-18 23:28:52 UTC=
 (rev 5171)
@@ -195,22 +195,31 @@
             echo "<TR $cl><TD style=3D\"vertical-align:top\"> ".
 	      $Dossier['dos_id']."</td><td> <B>".h($Dossier['dos_name'])."</B> =
</TD>";
 	    $str_name=3Ddomaine.'dossier'.$Dossier['dos_id'];
-	    $size=3D$repocn->get_value("select pg_database_size($1)/(1024*1024)=
::float",
-				 array($str_name));
+           =20
 	    echo "<TD><I>  ".h($Dossier['dos_description'])."</I></td>";
-	    echo td(nbm($size)."MB",' style=3D"text-align:right"');
-
+            $database_exist=3D$repocn->get_value('select count(*)=20
+                from pg_catalog.pg_database where datname =3D lower($1)'=
,array($str_name));
+            if ($database_exist > 0 )
+            {
+                $size=3D$repocn->get_value("select pg_database_size($1)/=
(1024*1024)::float",
+                                     array($str_name));
+                echo td(nbm($size)."MB",' style=3D"text-align:right"');
+            } else {
+                echo td(_("Dossier inexistant"),'style=3D"color:red"');
+            }
 	    echo td($str_name);
             echo "<TD>";
-            echo td(HtmlInput::button_anchor(_('Effacer'),'?action=3Ddos=
sier_mgt&sa=3Ddel&d=3D'.$Dossier['dos_id']));
+            if ( $database_exist > 0)
+            {
+                echo td(HtmlInput::button_anchor(_('Effacer'),'?action=3D=
dossier_mgt&sa=3Ddel&d=3D'.$Dossier['dos_id']));
=20
-	    echo td(HtmlInput::button_anchor(_('Modifier'),'?action=3Ddossier_m=
gt&sa=3Dmod&d=3D'
-					     .$Dossier['dos_id']));
+                echo td(HtmlInput::button_anchor(_('Modifier'),'?action=3D=
dossier_mgt&sa=3Dmod&d=3D'
+                                                 .$Dossier['dos_id']));
=20
-	    echo td(HtmlInput::button_anchor(_('Backup'),'backup.php?action=3Db=
ackup&sa=3Db&t=3Dd&d=3D'
-					  .$Dossier['dos_id']));
-	    echo '</td>';
-
+                echo td(HtmlInput::button_anchor(_('Backup'),'backup.php=
?action=3Dbackup&sa=3Db&t=3Dd&d=3D'
+                                              .$Dossier['dos_id']));
+                echo '</td>';
+            }
             echo '<tr>';
             $compteur++;
=20



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


From MAILER-DAEMON Sun Jan 20 10:05:31 2013
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1TwwSh-0000TX-0f
	for mharc-phpcompta-dev@gnu.org; Sun, 20 Jan 2013 10:05:31 -0500
To: phpcompta-dev@nongnu.org
Content-Type: text/plain; charset=UTF-8
Date: Sun, 20 Jan 2013 15:57:40 +0100 (CET)
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 91.121.80.190
Message-ID: <mailman.1031859.1358694330.854.phpcompta-dev@nongnu.org>
From: phpcompta-dev@nongnu.org
Subject: [Phpcompta-dev] r5172 - in phpcompta/tags/rel650: html/admin include
X-BeenThere: phpcompta-dev@nongnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: phpcompta-dev@nongnu.org
List-Id: <phpcompta-dev.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/phpcompta-dev>,
	<mailto:phpcompta-dev-request@nongnu.org?subject=unsubscribe>
List-Archive: <http://lists.nongnu.org/archive/html/phpcompta-dev>
List-Post: <mailto:phpcompta-dev@nongnu.org>
List-Help: <mailto:phpcompta-dev-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/phpcompta-dev>,
	<mailto:phpcompta-dev-request@nongnu.org?subject=subscribe>
X-List-Received-Date: Sun, 20 Jan 2013 15:05:29 -0000

Author: danydb
Date: 2013-01-20 15:57:40 +0100 (Sun, 20 Jan 2013)
New Revision: 5172

Modified:
   phpcompta/tags/rel650/html/admin/setup.php
   phpcompta/tags/rel650/include/class_database.php
   phpcompta/tags/rel650/include/dossier.inc.php
Log:
0000778: Si dossier n'existe pas alors il y a une erreur dans administrat=
ion > dossier

Modified: phpcompta/tags/rel650/html/admin/setup.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- phpcompta/tags/rel650/html/admin/setup.php	2013-01-18 23:28:52 UTC (r=
ev 5171)
+++ phpcompta/tags/rel650/html/admin/setup.php	2013-01-20 14:57:40 UTC (r=
ev 5172)
@@ -463,8 +463,17 @@
 for ($e=3D0;$e < $MaxDossier;$e++) {
   $db_row=3D$cn->fetch($e);
   echo "<h3>Patching ".$db_row['dos_name'].'</h3>';
-  $db=3Dnew Database($db_row['dos_id'],'dos');
-  $db->apply_patch($db_row['dos_name']);
+ =20
+  $name=3D$cn->format_name($db_row['dos_id'],'dos');
+ =20
+  if ( $cn->exist_database($name)> 0 )
+  {
+    $db=3Dnew Database($db_row['dos_id'],'dos');
+    $db->apply_patch($db_row['dos_name']);
+  } else=20
+  {
+      echo_warning(_("Dossier inexistant")." $name");
+  }
   Dossier::synchro_admin($db_row['dos_id']);
  }
=20
@@ -478,8 +487,16 @@
 for ($e=3D0;$e < $MaxDossier;$e++) {
   $db_row=3D$cn->fetch($e);
   echo "<h3>Patching ".$db_row['mod_name']."</h3>";
-  $db=3Dnew Database($db_row['mod_id'],'mod');
-  $db->apply_patch($db_row['mod_name']);
+  $name=3D$cn->format_name($db_row['mod_id'],'mod');
+ =20
+  if ( $cn->exist_database($name)> 0 )
+  {
+    $db=3Dnew Database($db_row['mod_id'],'mod');
+    $db->apply_patch($db_row['mod_name']);
+   } else=20
+  {
+      echo_warning(_("Mod=C3=A8le inexistant")." $name");
+  }
  }
=20
 //----------------------------------------------------------------------

Modified: phpcompta/tags/rel650/include/class_database.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- phpcompta/tags/rel650/include/class_database.php	2013-01-18 23:28:52 =
UTC (rev 5171)
+++ phpcompta/tags/rel650/include/class_database.php	2013-01-20 14:57:40 =
UTC (rev 5172)
@@ -550,6 +550,38 @@
         return false;
     }
     /**
+     * return the name of the database with the domain name
+     * @param $p_id of the folder WITHOUT the domain name
+     * @param $p_type dos for folder mod for template
+     * @return formatted name
+     */
+    function format_name($p_id,$p_type)
+    {
+        switch ($p_type)
+        {
+            case 'dos':
+                $sys_name=3Dsprintf("%sdossier%d",strtolower(domaine),$p=
_name);
+                break;
+            case 'mod':
+                $sys_name=3Dsprintf("%smod%d",strtolower(domaine),$p_nam=
e);
+                break;
+            default:
+                echo_error(__FILE__." format_name invalid type ".$p_type=
, __LINE__);
+        }
+        return $sys_name;
+    }
+    /**
+     * Count the database name in a system view
+     * @param $p_name string database name
+     * @return number of database found (normally 0 or 1)
+     */
+    function exist_database($p_name)
+    {
+        $database_exist=3D$this->get_value('select count(*)=20
+                from pg_catalog.pg_database where datname =3D lower($1)'=
,array($p_name));
+        return $database_exist;
+    }
+    /**
      *@brief check if the large object exists
      *@param $p_oid of the large object
      *@return return true if the large obj exist or false if not

Modified: phpcompta/tags/rel650/include/dossier.inc.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- phpcompta/tags/rel650/include/dossier.inc.php	2013-01-18 23:28:52 UTC=
 (rev 5171)
+++ phpcompta/tags/rel650/include/dossier.inc.php	2013-01-20 14:57:40 UTC=
 (rev 5172)
@@ -197,8 +197,9 @@
 	    $str_name=3Ddomaine.'dossier'.$Dossier['dos_id'];
            =20
 	    echo "<TD><I>  ".h($Dossier['dos_description'])."</I></td>";
-            $database_exist=3D$repocn->get_value('select count(*)=20
-                from pg_catalog.pg_database where datname =3D lower($1)'=
,array($str_name));
+           =20
+            $database_exist=3D$repocn->exist_database($str_name);
+           =20
             if ($database_exist > 0 )
             {
                 $size=3D$repocn->get_value("select pg_database_size($1)/=
(1024*1024)::float",



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


From MAILER-DAEMON Wed Jan 23 16:46:15 2013
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Ty899-0000MI-PR
	for mharc-phpcompta-dev@gnu.org; Wed, 23 Jan 2013 16:46:15 -0500
To: phpcompta-dev@nongnu.org
Content-Type: text/plain; charset=UTF-8
Date: Wed, 23 Jan 2013 22:38:29 +0100 (CET)
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 91.121.80.190
Message-ID: <mailman.1042931.1358977575.854.phpcompta-dev@nongnu.org>
From: phpcompta-dev@nongnu.org
Subject: [Phpcompta-dev] r5173 - in phpcompta/tags/rel650:
	contrib/document_test html/admin/sql/patch include sql
X-BeenThere: phpcompta-dev@nongnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: phpcompta-dev@nongnu.org
List-Id: <phpcompta-dev.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/phpcompta-dev>,
	<mailto:phpcompta-dev-request@nongnu.org?subject=unsubscribe>
List-Archive: <http://lists.nongnu.org/archive/html/phpcompta-dev>
List-Post: <mailto:phpcompta-dev@nongnu.org>
List-Help: <mailto:phpcompta-dev-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/phpcompta-dev>,
	<mailto:phpcompta-dev-request@nongnu.org?subject=subscribe>
X-List-Received-Date: Wed, 23 Jan 2013 21:46:14 -0000

Author: danydb
Date: 2013-01-23 22:38:28 +0100 (Wed, 23 Jan 2013)
New Revision: 5173

Added:
   phpcompta/tags/rel650/html/admin/sql/patch/upgrade104.sql
Modified:
   phpcompta/tags/rel650/contrib/document_test/
   phpcompta/tags/rel650/include/constant.php
   phpcompta/tags/rel650/sql/upgrade.sql
Log:

#780 & #776 forbids some character in the quickcode


Property changes on: phpcompta/tags/rel650/contrib/document_test
___________________________________________________________________
Name: svn:ignore
   + .~lock.all_tags.odt#


Added: phpcompta/tags/rel650/html/admin/sql/patch/upgrade104.sql
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- phpcompta/tags/rel650/html/admin/sql/patch/upgrade104.sql	           =
             (rev 0)
+++ phpcompta/tags/rel650/html/admin/sql/patch/upgrade104.sql	2013-01-23 =
21:38:28 UTC (rev 5173)
@@ -0,0 +1,105 @@
+begin;
+CREATE OR REPLACE FUNCTION comptaproc.insert_quick_code(nf_id integer, t=
av_text text)
+  RETURNS integer AS
+$BODY$
+	declare
+	ns integer;
+	nExist integer;
+	tText text;
+	begin
+	tText :=3D lower(trim(tav_text));
+	tText :=3D replace(tText,' ','');
+	tText :=3D translate(tText,E' $=E2=82=AC=C2=B5=C2=A3%.+-/\\!(){}(),;_&|=
"#''^<>*','');
+	tText :=3D translate(tText,E'=C3=A9=C3=A8=C3=AA=C3=AB=C3=A0=C3=A2=C3=A4=
=C3=AF=C3=AE=C3=BC=C3=BB=C3=B9=C3=B6=C3=B4=C3=A7','eeeeaaaiiuuuooc');
+
+
+	loop
+		-- take the next sequence
+		select nextval('s_jnt_fic_att_value') into ns;
+		if length (tText) =3D 0 or tText is null then
+			tText :=3D 'FID'||ns;
+		end if;
+		-- av_text already used ?
+		select count(*) into nExist
+			from fiche_detail
+		where
+			ad_id=3D23 and  ad_value=3Dupper(tText);
+
+		if nExist =3D 0 then
+			exit;
+		end if;
+		tText:=3D'FID'||ns;
+	end loop;
+
+
+	insert into fiche_detail(jft_id,f_id,ad_id,ad_value) values (ns,nf_id,2=
3,upper(tText));
+	return ns;
+	end;
+$BODY$
+LANGUAGE plpgsql;
+
+
+
+CREATE OR REPLACE FUNCTION comptaproc.update_quick_code(njft_id integer,=
 tav_text text)
+  RETURNS integer AS
+$BODY$
+	declare
+	ns integer;
+	nExist integer;
+	tText text;
+	old_qcode varchar;
+	begin
+	-- get current value
+	select ad_value into old_qcode from fiche_detail where jft_id=3Dnjft_id=
;
+	-- av_text didn't change so no update
+	if tav_text =3D upper( trim(old_qcode)) then
+		return 0;
+	end if;
+
+	tText :=3D trim(lower(tav_text));
+	tText :=3D replace(tText,' ','');
+	tText :=3D translate(tText,E' $=E2=82=AC=C2=B5=C2=A3%.+-/\\!(){}(),;_&|=
"#''^<>*','');
+	tText :=3D translate(tText,E'=C3=A9=C3=A8=C3=AA=C3=AB=C3=A0=C3=A2=C3=A4=
=C3=AF=C3=AE=C3=BC=C3=BB=C3=B9=C3=B6=C3=B4=C3=A7','eeeeaaaiiuuuooc');
+	tText :=3D upper(tText);
+	if length ( tText) =3D 0 or tText is null then
+		return 0;
+	end if;
+
+	ns :=3D njft_id;
+
+	loop
+		-- av_text already used ?
+		select count(*) into nExist
+			from fiche_detail
+		where
+			ad_id=3D23 and ad_value=3DtText;
+
+		if nExist =3D 0 then
+			exit;
+		end if;
+		if tText =3D 'FID'||ns then
+			-- take the next sequence
+			select nextval('s_jnt_fic_att_value') into ns;
+		end if;
+		tText  :=3D'FID'||ns;
+
+	end loop;
+	update fiche_detail set ad_value =3D tText where jft_id=3Dnjft_id;
+
+	-- update also the contact
+	update fiche_detail set ad_value =3D tText
+		where jft_id in
+			( select jft_id
+				from fiche_detail
+			where ad_id=3D25 and ad_value=3Dold_qcode);
+
+
+	update jrnx set j_qcode=3DtText where j_qcode =3D old_qcode;
+	return ns;
+	end;
+$BODY$
+LANGUAGE plpgsql;
+
+update version set val=3D105;
+
+commit;
\ No newline at end of file

Modified: phpcompta/tags/rel650/include/constant.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- phpcompta/tags/rel650/include/constant.php	2013-01-20 14:57:40 UTC (r=
ev 5172)
+++ phpcompta/tags/rel650/include/constant.php	2013-01-23 21:38:28 UTC (r=
ev 5173)
@@ -47,7 +47,7 @@
 define ("SITE_UPDATE_PLUGIN",'http://www.phpcompta.eu/plugin_last_versio=
n.txt');
=20
=20
-define ("DBVERSION",104);
+define ("DBVERSION",105);
=20
 define ("DBVERSIONREPO",14);
 define ('NOTFOUND','--not found--');

Modified: phpcompta/tags/rel650/sql/upgrade.sql
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- phpcompta/tags/rel650/sql/upgrade.sql	2013-01-20 14:57:40 UTC (rev 51=
72)
+++ phpcompta/tags/rel650/sql/upgrade.sql	2013-01-23 21:38:28 UTC (rev 51=
73)
@@ -1,33 +1,99 @@
-CREATE OR REPLACE FUNCTION comptaproc.format_account(p_account account_t=
ype)
-  RETURNS account_type AS
+
+CREATE OR REPLACE FUNCTION comptaproc.insert_quick_code(nf_id integer, t=
av_text text)
+  RETURNS integer AS
 $BODY$
+	declare
+	ns integer;
+	nExist integer;
+	tText text;
+	begin
+	tText :=3D lower(trim(tav_text));
+	tText :=3D replace(tText,' ','');
+	tText :=3D translate(tText,E' $=E2=82=AC=C2=B5=C2=A3%.+-/\\!(){}(),;_&|=
"#''^<>*','');
+	tText :=3D translate(tText,E'=C3=A9=C3=A8=C3=AA=C3=AB=C3=A0=C3=A2=C3=A4=
=C3=AF=C3=AE=C3=BC=C3=BB=C3=B9=C3=B6=C3=B4=C3=A7','eeeeaaaiiuuuooc');
=20
-declare
=20
-sResult account_type;
+	loop
+		-- take the next sequence
+		select nextval('s_jnt_fic_att_value') into ns;
+		if length (tText) =3D 0 or tText is null then
+			tText :=3D 'FID'||ns;
+		end if;
+		-- av_text already used ?
+		select count(*) into nExist
+			from fiche_detail
+		where
+			ad_id=3D23 and  ad_value=3Dupper(tText);
=20
-begin
-sResult :=3D lower(p_account);
+		if nExist =3D 0 then
+			exit;
+		end if;
+		tText:=3D'FID'||ns;
+	end loop;
=20
-sResult :=3D translate(sResult,E'=C3=A9=C3=A8=C3=AA=C3=AB=C3=A0=C3=A2=C3=
=A4=C3=AF=C3=AE=C3=BC=C3=BB=C3=B9=C3=B6=C3=B4=C3=A7','eeeeaaaiiuuuooc');
-sResult :=3D translate(sResult,E' $=E2=82=AC=C2=B5=C2=A3%.+-/\\!(){}(),;=
_&|"#''^<>*','');
=20
-return upper(sResult);
+	insert into fiche_detail(jft_id,f_id,ad_id,ad_value) values (ns,nf_id,2=
3,upper(tText));
+	return ns;
+	end;
+$BODY$
+  LANGUAGE plpgsql;
=20
-end;
+CREATE OR REPLACE FUNCTION comptaproc.update_quick_code(njft_id integer,=
 tav_text text)
+  RETURNS integer AS
 $BODY$
-  LANGUAGE plpgsql ;
+	declare
+	ns integer;
+	nExist integer;
+	tText text;
+	old_qcode varchar;
+	begin
+	-- get current value
+	select ad_value into old_qcode from fiche_detail where jft_id=3Dnjft_id=
;
+	-- av_text didn't change so no update
+	if tav_text =3D upper( trim(old_qcode)) then
+		return 0;
+	end if;
=20
-COMMENT ON FUNCTION comptaproc.format_account(account_type) IS 'format t=
he accounting :
-- upper case
-- remove space and special char.
-';
+	tText :=3D trim(lower(tav_text));
+	tText :=3D replace(tText,' ','');
+	tText :=3D translate(tText,E' $=E2=82=AC=C2=B5=C2=A3%.+-/\\!(){}(),;_&|=
"#''^<>*','');
+	tText :=3D translate(tText,E'=C3=A9=C3=A8=C3=AA=C3=AB=C3=A0=C3=A2=C3=A4=
=C3=AF=C3=AE=C3=BC=C3=BB=C3=B9=C3=B6=C3=B4=C3=A7','eeeeaaaiiuuuooc');
+	tText :=3D upper(tText);
+	if length ( tText) =3D 0 or tText is null then
+		return 0;
+	end if;
=20
-update tmp_pcmn  set pcm_val_parent  =3D '62' where pcm_val=3D'6202';
+	ns :=3D njft_id;
=20
-update fiche_detail set ad_value =3D (to_number(ad_value,'9.99')*100)::t=
ext where ad_id in  (21,22,20,31) and ad_value is not null and ad_value <=
> '';
+	loop
+		-- av_text already used ?
+		select count(*) into nExist
+			from fiche_detail
+		where
+			ad_id=3D23 and ad_value=3DtText;
=20
-update menu_ref set me_code=3D'ACHISTO' WHERE me_code=3D'ACHIMP';
-update menu_ref set me_code=3D'VEHISTO' WHERE me_code=3D'VENIMP';
-update menu_ref set me_code=3D'FIHISTO' WHERE me_code=3D'FIMP';
-update menu_ref set me_code=3D'ODHISTO' WHERE me_code=3D'ODSIMP';
+		if nExist =3D 0 then
+			exit;
+		end if;
+		if tText =3D 'FID'||ns then
+			-- take the next sequence
+			select nextval('s_jnt_fic_att_value') into ns;
+		end if;
+		tText  :=3D'FID'||ns;
+
+	end loop;
+	update fiche_detail set ad_value =3D tText where jft_id=3Dnjft_id;
+
+	-- update also the contact
+	update fiche_detail set ad_value =3D tText
+		where jft_id in
+			( select jft_id
+				from fiche_detail
+			where ad_id=3D25 and ad_value=3Dold_qcode);
+
+
+	update jrnx set j_qcode=3DtText where j_qcode =3D old_qcode;
+	return ns;
+	end;
+$BODY$
+  LANGUAGE plpgsql;



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


From MAILER-DAEMON Wed Jan 23 17:06:35 2013
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Ty8Sp-0007Xc-BJ
	for mharc-phpcompta-dev@gnu.org; Wed, 23 Jan 2013 17:06:35 -0500
To: phpcompta-dev@nongnu.org
Content-Type: text/plain; charset=UTF-8
Date: Wed, 23 Jan 2013 22:58:53 +0100 (CET)
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 91.121.80.190
Message-ID: <mailman.1042984.1358978795.854.phpcompta-dev@nongnu.org>
From: phpcompta-dev@nongnu.org
Subject: [Phpcompta-dev] r5174 - phpcompta/tags/rel650/include
X-BeenThere: phpcompta-dev@nongnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: phpcompta-dev@nongnu.org
List-Id: <phpcompta-dev.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/phpcompta-dev>,
	<mailto:phpcompta-dev-request@nongnu.org?subject=unsubscribe>
List-Archive: <http://lists.nongnu.org/archive/html/phpcompta-dev>
List-Post: <mailto:phpcompta-dev@nongnu.org>
List-Help: <mailto:phpcompta-dev-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/phpcompta-dev>,
	<mailto:phpcompta-dev-request@nongnu.org?subject=subscribe>
X-List-Received-Date: Wed, 23 Jan 2013 22:06:34 -0000

Author: danydb
Date: 2013-01-23 22:58:53 +0100 (Wed, 23 Jan 2013)
New Revision: 5174

Modified:
   phpcompta/tags/rel650/include/class_database.php
Log:
Improve format_name=20

Modified: phpcompta/tags/rel650/include/class_database.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- phpcompta/tags/rel650/include/class_database.php	2013-01-23 21:38:28 =
UTC (rev 5173)
+++ phpcompta/tags/rel650/include/class_database.php	2013-01-23 21:58:53 =
UTC (rev 5174)
@@ -560,13 +560,14 @@
         switch ($p_type)
         {
             case 'dos':
-                $sys_name=3Dsprintf("%sdossier%d",strtolower(domaine),$p=
_name);
+                $sys_name=3Dsprintf("%sdossier%d",strtolower(domaine),$p=
_id);
                 break;
             case 'mod':
-                $sys_name=3Dsprintf("%smod%d",strtolower(domaine),$p_nam=
e);
+                $sys_name=3Dsprintf("%smod%d",strtolower(domaine),$p_id)=
;
                 break;
             default:
                 echo_error(__FILE__." format_name invalid type ".$p_type=
, __LINE__);
+		exit();
         }
         return $sys_name;
     }



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


From MAILER-DAEMON Wed Jan 23 17:07:37 2013
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Ty8Tp-0007iz-Nl
	for mharc-phpcompta-dev@gnu.org; Wed, 23 Jan 2013 17:07:37 -0500
To: phpcompta-dev@nongnu.org
Content-Type: text/plain; charset=UTF-8
Date: Wed, 23 Jan 2013 22:59:52 +0100 (CET)
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 91.121.80.190
Message-ID: <mailman.1042991.1358978856.854.phpcompta-dev@nongnu.org>
From: phpcompta-dev@nongnu.org
Subject: [Phpcompta-dev] r5175 - phpcompta/tags/rel650/html/admin
X-BeenThere: phpcompta-dev@nongnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: phpcompta-dev@nongnu.org
List-Id: <phpcompta-dev.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/phpcompta-dev>,
	<mailto:phpcompta-dev-request@nongnu.org?subject=unsubscribe>
List-Archive: <http://lists.nongnu.org/archive/html/phpcompta-dev>
List-Post: <mailto:phpcompta-dev@nongnu.org>
List-Help: <mailto:phpcompta-dev-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/phpcompta-dev>,
	<mailto:phpcompta-dev-request@nongnu.org?subject=subscribe>
X-List-Received-Date: Wed, 23 Jan 2013 22:07:36 -0000

Author: danydb
Date: 2013-01-23 22:59:52 +0100 (Wed, 23 Jan 2013)
New Revision: 5175

Modified:
   phpcompta/tags/rel650/html/admin/setup.php
Log:
#778 skip the unexisting folder=20

Modified: phpcompta/tags/rel650/html/admin/setup.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- phpcompta/tags/rel650/html/admin/setup.php	2013-01-23 21:58:53 UTC (r=
ev 5174)
+++ phpcompta/tags/rel650/html/admin/setup.php	2013-01-23 21:59:52 UTC (r=
ev 5175)
@@ -461,20 +461,21 @@
 //----------------------------------------------------------------------
=20
 for ($e=3D0;$e < $MaxDossier;$e++) {
-  $db_row=3D$cn->fetch($e);
+   $db_row=3DDatabase::fetch_array($Resdossier,$e);
   echo "<h3>Patching ".$db_row['dos_name'].'</h3>';
- =20
+
   $name=3D$cn->format_name($db_row['dos_id'],'dos');
- =20
+
   if ( $cn->exist_database($name)> 0 )
   {
     $db=3Dnew Database($db_row['dos_id'],'dos');
     $db->apply_patch($db_row['dos_name']);
-  } else=20
+    Dossier::synchro_admin($db_row['dos_id']);
+
+  } else
   {
       echo_warning(_("Dossier inexistant")." $name");
   }
-  Dossier::synchro_admin($db_row['dos_id']);
  }
=20
 //----------------------------------------------------------------------
@@ -485,15 +486,15 @@
 echo "<h2>Mise &agrave; jour mod&egrave;le</h2>";
=20
 for ($e=3D0;$e < $MaxDossier;$e++) {
-  $db_row=3D$cn->fetch($e);
+  $db_row=3DDatabase::fetch_array($Resdossier,$e);
   echo "<h3>Patching ".$db_row['mod_name']."</h3>";
   $name=3D$cn->format_name($db_row['mod_id'],'mod');
- =20
+
   if ( $cn->exist_database($name)> 0 )
   {
     $db=3Dnew Database($db_row['mod_id'],'mod');
     $db->apply_patch($db_row['mod_name']);
-   } else=20
+   } else
   {
       echo_warning(_("Mod=C3=A8le inexistant")." $name");
   }



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


