[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpcompta-dev] r675 - in trunk/transform: . include sql unit-test
From: |
phpcompta-dev |
Subject: |
[Phpcompta-dev] r675 - in trunk/transform: . include sql unit-test |
Date: |
Sat, 1 Feb 2014 00:15:23 +0100 (CET) |
Author: danydb
Date: 2014-02-01 00:15:23 +0100 (Sat, 01 Feb 2014)
New Revision: 675
Added:
trunk/transform/include/class_install_transform.php
trunk/transform/include/class_transform_sql.php
trunk/transform/include/intervat_listing_assujetti_step_1.inc.php
trunk/transform/include/intervat_listing_assujetti_step_2.inc.php
trunk/transform/include/intervat_listing_assujetti_step_3.inc.php
trunk/transform/sql/
trunk/transform/sql/install.sql
Modified:
trunk/transform/include/class_transform_declarant.php
trunk/transform/include/intervat_listing_assujetti.inc.php
trunk/transform/index.php
trunk/transform/unit-test/transform_IntervatTest.php
Log:
3 step for submiting a file + info for representative and declarant
add database script
Added: trunk/transform/include/class_install_transform.php
===================================================================
--- trunk/transform/include/class_install_transform.php
(rev 0)
+++ trunk/transform/include/class_install_transform.php 2014-01-31 23:15:23 UTC
(rev 675)
@@ -0,0 +1,57 @@
+<?php
+
+/*
+ * This file is part of NOALYSS.
+ *
+ * PhpCompta is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * PhpCompta is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with PhpCompta; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+/* $Revision$ */
+
+// Copyright Author Dany De Bontridder address@hidden
+
+/**
+ * @file
+ * @brief install the Transform (TRANSFORM plugin)
+ *
+ */
+class Install_Transform
+{
+
+ function __construct($cn)
+ {
+ $this->db = $cn;
+ }
+
+ function install()
+ {
+ $file = dirname(__FILE__);
+ $this->db->execute_script($file . '/../sql/install.sql');
+ }
+
+ function upgrade($p_version)
+ {
+ global $cn;
+ $cur_version = $cn->get_value('select max(version_id) from
transform.version');
+ $cur_version++;
+ $file = dirname(__FILE__);
+ for ($e = $cur_version; $e <= $p_version; $e++)
+ {
+ $this->db->execute_script($file . '/../sql/upgrade' . $e . '.sql');
+ }
+ }
+
+}
+
+?>
Modified: trunk/transform/include/class_transform_declarant.php
===================================================================
--- trunk/transform/include/class_transform_declarant.php 2014-01-31
22:27:43 UTC (rev 674)
+++ trunk/transform/include/class_transform_declarant.php 2014-01-31
23:15:23 UTC (rev 675)
@@ -68,25 +68,25 @@
var $vatnumber;
function fromPost()
{
- $this->name=HtmlInput::default_value_post("p_name",null);
- $this->street=HtmlInput::default_value_post("p_street",null);
- $this->postcode=HtmlInput::default_value_post("p_postcode",null);
- $this->city=HtmlInput::default_value_post("p_city",null);
- $this->countrycode=HtmlInput::default_value_post("p_countrycode",null);
- $this->email=HtmlInput::default_value_post("p_email",null);
- $this->phone=HtmlInput::default_value_post("p_phone",null);
- $this->vatnumber=HtmlInput::default_value_post("p_vatnumber",null);
+ $this->name=HtmlInput::default_value_post("p_dec_name",null);
+ $this->street=HtmlInput::default_value_post("p_dec_street",null);
+ $this->postcode=HtmlInput::default_value_post("p_dec_postcode",null);
+ $this->city=HtmlInput::default_value_post("p_dec_city",null);
+
$this->countrycode=HtmlInput::default_value_post("p_dec_countrycode",null);
+ $this->email=HtmlInput::default_value_post("p_dec_email",null);
+ $this->phone=HtmlInput::default_value_post("p_dec_phone",null);
+ $this->vatnumber=HtmlInput::default_value_post("p_dec_vatnumber",null);
}
function input()
{
- $h_name=new IText('p_name',$this->name);
- $h_vatnumber=new IText('p_vatnumber',$this->vatnumber);
- $h_street=new IText('p_street',$this->street);
- $h_postcode=new IText('p_postcode',$this->postcode);
- $h_city=new IText('p_city',$this->city);
- $h_countrycode=new IText('p_countrycode',$this->countrycode);
- $h_email=new IText('p_email',$this->email);
- $h_phone=new IText('p_phone',$this->phone);
+ $h_name=new IText('p_dec_name',$this->name);
+ $h_vatnumber=new IText('p_dec_vatnumber',$this->vatnumber);
+ $h_street=new IText('p_dec_street',$this->street);
+ $h_postcode=new IText('p_dec_postcode',$this->postcode);
+ $h_city=new IText('p_dec_city',$this->city);
+ $h_countrycode=new IText('p_dec_countrycode',$this->countrycode);
+ $h_email=new IText('p_dec_email',$this->email);
+ $h_phone=new IText('p_dec_phone',$this->phone);
require_once 'template/listing_assujetti_declarant.php';
}
Added: trunk/transform/include/class_transform_sql.php
===================================================================
--- trunk/transform/include/class_transform_sql.php
(rev 0)
+++ trunk/transform/include/class_transform_sql.php 2014-01-31 23:15:23 UTC
(rev 675)
@@ -0,0 +1,290 @@
+<?php
+
+/*
+ * This file is part of NOALYSS.
+ *
+ * NOALYSS 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.
+ *
+ * NOALYSS 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 NOALYSS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+// Copyright Author Dany De Bontridder address@hidden
+
+/**
+ * @file
+ * @brief Manage the tables of transform schema
+ *
+ */
+require_once('class_phpcompta_sql.php');
+
+/**
+ * @brief Manage the table transform.request
+ */
+class Transform_Request_SQL extends Phpcompta_SQL
+{
+
+ //------ Attributes-----
+ var $r_id;
+ var $r_date;
+
+ /* example private
$variable=array("easy_name"=>column_name,"email"=>"column_name_email","val3"=>0);
*/
+
+ function __construct($p_id = -1)
+ {
+
+
+ $this->table = "transform.request";
+ $this->primary_key = "r_id";
+
+ $this->name = array(
+ "r_id" => "r_id",
+ "r_date" => "r_date"
+ );
+
+ $this->type = array(
+ "r_id" => "numeric",
+ "r_date" => "date"
+ );
+
+ $this->default = array(
+ "r_id" => "auto"
+ ,"r_date"=>"auto"
+ );
+ global $cn;
+ $this->date_format = "DD.MM.YYYY";
+ parent::__construct($cn, $p_id);
+ }
+
+ /**
+ * @brief Add here your own code: verify is always call BEFORE insert or
update
+ */
+ public function verify()
+ {
+ parent::verify();
+ }
+
+}
+
+/**
+ * @brief Manage the table transform.intervat_representative
+ */
+class Intervat_Representative_SQL extends Phpcompta_SQL
+{
+
+ //------ Attributes-----
+ var $rp_id;
+ var $r_id;
+ var $rp_listing_id;
+ var $rp_issued;
+ var $rp_type;
+ var $rp_name;
+ var $rp_street;
+ var $rp_postcode;
+ var $rp_city;
+ var $rp_email;
+ var $rp_phone;
+ var $rp_countrycode;
+
+ /* example private
$variable=array("easy_name"=>column_name,"email"=>"column_name_email","val3"=>0);
*/
+
+ function __construct($p_id = -1)
+ {
+
+
+ $this->table = "transform.intervat_representative";
+ $this->primary_key = "rp_id";
+
+ $this->name = array(
+ "rp_id" => "rp_id"
+ , "r_id" => "r_id"
+ , "rp_listing_id" => "rp_listing_id"
+ , "rp_issued" => "rp_issued"
+ , "rp_type" => "rp_type"
+ , "rp_name" => "rp_name"
+ , "rp_street" => "rp_street"
+ , "rp_postcode" => "rp_postcode"
+ , "rp_city" => "rp_city"
+ , "rp_email" => "rp_email"
+ , "rp_phone" => "rp_phone"
+ , "rp_countrycode" => "rp_countrycode"
+ );
+
+ $this->type = array(
+ "rp_id" => "numeric"
+ , "r_id" => "numeric"
+ , "rp_listing_id" => "text"
+ , "rp_issued" => "text"
+ , "rp_type" => "text"
+ , "rp_name" => "text"
+ , "rp_street" => "text"
+ , "rp_postcode" => "text"
+ , "rp_city" => "text"
+ , "rp_email" => "text"
+ , "rp_phone" => "text"
+ , "rp_countrycode" => "text"
+ );
+
+ $this->default = array(
+ "rp_id" => "auto"
+ );
+ global $cn;
+ $this->date_format = "DD.MM.YYYY";
+ parent::__construct($cn, $p_id);
+ }
+
+ /**
+ * @brief Add here your own code: verify is always call BEFORE insert or
update
+ */
+ public function verify()
+ {
+ parent::verify();
+ }
+
+}
+
+/**
+ * @brief Manage the table transform.intervat_declarant
+ */
+class Intervat_Declarant_SQL extends Phpcompta_SQL
+{
+
+ //------ Attributes-----
+ var $d_id;
+ var $r_id;
+ var $d_name;
+ var $d_street;
+ var $d_postcode;
+ var $d_city;
+ var $d_email;
+ var $d_phone;
+ var $d_vat_number;
+ var $d_countrycode;
+ var $d_periode;
+
+ /* example private
$variable=array("easy_name"=>column_name,"email"=>"column_name_email","val3"=>0);
*/
+
+ function __construct($p_id = -1)
+ {
+
+
+ $this->table = "transform.intervat_declarant";
+ $this->primary_key = "d_id";
+
+ $this->name = array(
+ "d_id" => "d_id"
+ , "r_id" => "r_id"
+ , "d_name" => "d_name"
+ , "d_street" => "d_street"
+ , "d_postcode" => "d_postcode"
+ , "d_city" => "d_city"
+ , "d_email" => "d_email"
+ , "d_phone" => "d_phone"
+ , "d_vat_number" => "d_vat_number"
+ , "d_countrycode" => "d_countrycode"
+ , "d_periode" => "d_periode"
+ );
+
+ $this->type = array(
+ "d_id" => "numeric"
+ , "r_id" => "numeric"
+ , "d_name" => "text"
+ , "d_street" => "text"
+ , "d_postcode" => "text"
+ , "d_city" => "text"
+ , "d_email" => "text"
+ , "d_phone" => "text"
+ , "d_vat_number" => "text"
+ , "d_countrycode" => "text"
+ , "d_periode" => "text"
+ );
+
+ $this->default = array(
+ "d_id" => "auto"
+ );
+ global $cn;
+ $this->date_format = "DD.MM.YYYY";
+ parent::__construct($cn, $p_id);
+ }
+
+ /**
+ * @brief Add here your own code: verify is always call BEFORE insert or
update
+ */
+ public function verify()
+ {
+ parent::verify();
+ }
+
+}
+/**
+ * @brief Manage the table transform.intervat_client
+ */
+class Intervat_Client_SQL extends Phpcompta_SQL
+{
+
+ //------ Attributes-----
+ var $c_id;
+ var $d_id;
+ var $c_name;
+ var $c_vatnumber;
+ var $c_amount_vat;
+ var $c_amount_novat;
+ var $c_issuedby;
+
+ /* example private
$variable=array("easy_name"=>column_name,"email"=>"column_name_email","val3"=>0);
*/
+
+ function __construct($p_id = -1)
+ {
+
+
+ $this->table = "transform.intervat_client";
+ $this->primary_key = "c_id";
+
+ $this->name = array(
+ "c_id" => "c_id"
+ , "d_id" => "d_id"
+ , "c_name" => "c_name"
+ , "c_vatnumber" => "c_vatnumber"
+ , "c_amount_vat" => "c_amount_vat"
+ , "c_amount_novat" => "c_amount_novat"
+ , "c_issuedby" => "c_issuedby"
+ );
+
+ $this->type = array(
+ "c_id" => "numeric"
+ , "d_id" => "numeric"
+ , "c_name" => "text"
+ , "c_vatnumber" => "text"
+ , "c_amount_vat" => "text"
+ , "c_amount_novat" => "text"
+ , "c_issuedby" => "text"
+ );
+
+ $this->default = array(
+ "c_id" => "auto"
+ );
+ global $cn;
+ $this->date_format = "DD.MM.YYYY";
+ parent::__construct($cn, $p_id);
+ }
+
+ /**
+ * @brief Add here your own code: verify is always call BEFORE insert or
update
+ */
+ public function verify()
+ {
+ parent::verify();
+ }
+
+}
+
+?>
\ No newline at end of file
Modified: trunk/transform/include/intervat_listing_assujetti.inc.php
===================================================================
--- trunk/transform/include/intervat_listing_assujetti.inc.php 2014-01-31
22:27:43 UTC (rev 674)
+++ trunk/transform/include/intervat_listing_assujetti.inc.php 2014-01-31
23:15:23 UTC (rev 675)
@@ -18,32 +18,21 @@
*/
// Copyright Author Dany De Bontridder address@hidden
-require_once 'class_transform_representative.php';
-require_once 'class_transform_declarant.php';
-$representative=new Transform_Representative();
-$declarant=new Transform_Declarant();
?>
<h1>Listing Assujetti Intervat </h1>
-
-<form method="post" enctype="multipart/form-data">
- <h2><?php echo _('Mandataire');?></h2>
<?php
-$representative->input();
-?>
- <h2><?php echo _('Déclarant');?></h2>
-<?php
-$declarant->input();
-?>
- <p>
- <?php
- $file = new IFile('client_assujetti');
- echo $file->input();
- ?>
- </p>
- <p>
- <?php
- echo HtmlInput::request_to_hidden(array('gDossier', 'ac',
'plugin_code', 'sa'));
- echo HtmlInput::submit('send_list', 'Valider');
- ?>
- </p>
-</form>
+$step=HtmlInput::default_value_request('st_transf',0);
+
+if ($step == 0 )
+{
+ require 'intervat_listing_assujetti_step_1.inc.php';
+}
+if ($step == 1 )
+{
+ require 'intervat_listing_assujetti_step_2.inc.php';
+}
+if ($step == 2 )
+{
+ require 'intervat_listing_assujetti_step_3.inc.php';
+}
+?>
\ No newline at end of file
Added: trunk/transform/include/intervat_listing_assujetti_step_1.inc.php
===================================================================
--- trunk/transform/include/intervat_listing_assujetti_step_1.inc.php
(rev 0)
+++ trunk/transform/include/intervat_listing_assujetti_step_1.inc.php
2014-01-31 23:15:23 UTC (rev 675)
@@ -0,0 +1,50 @@
+<?php
+/*
+ * This file is part of NOALYSS.
+ *
+ * NOALYSS 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.
+ *
+ * NOALYSS 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 NOALYSS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+// Copyright Author Dany De Bontridder address@hidden
+
+require_once 'class_transform_representative.php';
+require_once 'class_transform_declarant.php';
+$representative=new Transform_Representative();
+$declarant=new Transform_Declarant();
+?>
+
+<form method="post" enctype="multipart/form-data">
+ <h2><?php echo _('Mandataire');?></h2>
+<?php
+$representative->input();
+?>
+ <h2><?php echo _('Déclarant');?></h2>
+<?php
+$declarant->input();
+?>
+ <p>
+ <?php
+ $file = new IFile('client_assujetti');
+ echo $file->input();
+ ?>
+ </p>
+ <p>
+ <?php
+ echo HtmlInput::request_to_hidden(array('gDossier', 'ac',
'plugin_code', 'sa'));
+ echo HtmlInput::hidden('st_transf',1);
+ echo HtmlInput::submit('send_list', 'Valider');
+ ?>
+ </p>
+</form>
Added: trunk/transform/include/intervat_listing_assujetti_step_2.inc.php
===================================================================
--- trunk/transform/include/intervat_listing_assujetti_step_2.inc.php
(rev 0)
+++ trunk/transform/include/intervat_listing_assujetti_step_2.inc.php
2014-01-31 23:15:23 UTC (rev 675)
@@ -0,0 +1,97 @@
+<?php
+
+/*
+ * This file is part of NOALYSS.
+ *
+ * NOALYSS 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.
+ *
+ * NOALYSS 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 NOALYSS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+// Copyright Author Dany De Bontridder address@hidden
+var_dump($_POST);
+/**
+ * save data into db and display them before creating the XML
+ */
+global $cn;
+require_once 'class_transform_sql.php';
+/**
+ * Save a new request
+ */
+$request = new Transform_Request_SQL();
+$request->insert();
+
+$representative = new Transform_Representative();
+$representative->data->r_id = $request->r_id;
+$representative->fromPost();
+$representative->insert();
+
+$declarant = new Transform_Declarant();
+$declarant->data->r_id = $request->r_id;
+$declarant->fromPost();
+$declarant->insert();
+
+/*
+ * Save the file
+ */
+if (count($_FILES) == 0)
+ throw new Exception(_('Aucun fichier donné'), 1);
+
+$name = $_FILES['client_assujetti']['name'];
+
+if (strlen($_FILES['client_assujetti']['tmp_name'][0]) != 0)
+{
+ $new_name = tempnam($_ENV['TMP'], 'client_assujetti');
+ if (!move_uploaded_file($_FILES['file_upload']['tmp_name'][$i], $new_name))
+ {
+ throw new Exception(_('Impossible de sauver ce fichier'), 2);
+ }
+ $file = fopen($new_name, "r");
+ $i = 0;
+ $o_data=array();
+ try
+ {
+ $cn->start();
+ while ($data = fgetcsv($file, 0, ";"))
+ {
+ $i++;
+ if (count($data) != 4)
+ {
+ $o_data[$i]= _('Ligne non importée'). join(' - ', $data);
+ continue;
+ }
+ /*
+ * insert into transform.intervat_client
+ */
+ $o_data[$i] = new Intervat_Client_SQL();
+ $o_data[$i]->d_id = $declarant->data->d_id;
+ $o_data[$i]->c_name = $data[0];
+ $o_data[$i]->c_issuedby = "BE";
+ $o_data[$i]->c_vatnumber = $data[1];
+ $o_data[$i]->c_amount_vat = $data[2];
+ $o_data[$i]->c_amount_novat = $data[3];
+ $o_data[$i]->insert();
+ }
+ $cn->commit();
+ } catch (Exception $ex)
+ {
+ $cn->rollback();
+ throw new Exception(_('Ne peut pas ajouter
').h($o_data[$i]->c_name).'-'.h($o_data[$i]->c_vatnumber),3);
+ }
+
+}
+/**
+ * Show the result
+ */
+?>
+
Added: trunk/transform/include/intervat_listing_assujetti_step_3.inc.php
===================================================================
--- trunk/transform/include/intervat_listing_assujetti_step_3.inc.php
(rev 0)
+++ trunk/transform/include/intervat_listing_assujetti_step_3.inc.php
2014-01-31 23:15:23 UTC (rev 675)
@@ -0,0 +1,24 @@
+<?php
+
+/*
+ * This file is part of NOALYSS.
+ *
+ * NOALYSS 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.
+ *
+ * NOALYSS 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 NOALYSS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+// Copyright Author Dany De Bontridder address@hidden
+
+
+
Modified: trunk/transform/index.php
===================================================================
--- trunk/transform/index.php 2014-01-31 22:27:43 UTC (rev 674)
+++ trunk/transform/index.php 2014-01-31 23:15:23 UTC (rev 675)
@@ -18,7 +18,25 @@
*/
// Copyright Author Dany De Bontridder address@hidden
+global $version_plugin;
+$version_plugin=SVNINFO;
+Extension::check_version(4400);
+$cn=new Database(dossier::id());
+$transform_version=1;
+if ( $cn->exist_schema('transform') == false)
+ {
+ require_once('include/class_install_transform.php');
+
+ $iplugn=new Install_Transform($cn);
+ $iplugn->install();
+ }
+ if ( $cn->get_value('select max(version_id) from transform.version') <
$transform_version)
+{
+ require_once('include/class_rapav_install.php');
+ $iplugn = new Rapav_Install($cn);
+ $iplugn->upgrade($rapav_version);
+}
echo '<div style="float:right"><a class="mtitle" style="font-size:140%"
href="http://wiki.phpcompta.eu/doku.php?id=transformateur"
target="_blank">Aide</a>'.
'<span style="font-size:0.8em;color:red;display:inline">vers:SVNINFO</span>'.
'</div>';
Added: trunk/transform/sql/install.sql
===================================================================
--- trunk/transform/sql/install.sql (rev 0)
+++ trunk/transform/sql/install.sql 2014-01-31 23:15:23 UTC (rev 675)
@@ -0,0 +1,49 @@
+create schema transform;
+
+create table transform.request(
+ r_id bigserial primary key,
+ r_date timestamp default now()
+);
+create table transform.version(
+ v_id bigint primary key,
+ v_note text);
+create table transform.intervat_representative
+(
+ rp_id bigserial primary key,
+ r_id bigint references transform.request(r_id) on update cascade on
delete cascade,
+ rp_listing_id text,
+ rp_issued text,
+ rp_type text
+ rp_name text,
+ rp_street text,
+ rp_postcode text,
+ rp_city text,
+ rp_email text,
+ rp_phone text,
+ rp_countrycode char(2) not null
+
+);
+create table transform.intervat_declarant
+(
+ d_id bigserial primary key,
+ r_id bigint references transform.request(r_id) on update cascade on
delete cascade,
+ d_name text,
+ d_street text,
+ d_postcode text,
+ d_city text,
+ d_email text,
+ d_phone text,
+ d_vat_number text,
+ d_countrycode char(2) not null,
+ d_periode text
+);
+create table transform.intervat_client
+(
+ c_id bigserial primary key,
+ d_id bigint references transform.intervat_declarant on update cascade
on delete cascade,
+ c_name text,
+ c_vatnumber text,
+ c_amount_vat text,
+ c_amount_novat text,
+ c_issuedby char(2) default 'BE'
+);
\ No newline at end of file
Modified: trunk/transform/unit-test/transform_IntervatTest.php
===================================================================
--- trunk/transform/unit-test/transform_IntervatTest.php 2014-01-31
22:27:43 UTC (rev 674)
+++ trunk/transform/unit-test/transform_IntervatTest.php 2014-01-31
23:15:23 UTC (rev 675)
@@ -3,7 +3,7 @@
/**
* Testing of class_intervat
* phpunit-skelgen --bootstrap bootstrap.php --test -- Intervat
../include/class_transform_intervat.php
- * phpunit --bootstrap bootstrap.php transform_IntervatTest.php
+ * phpunit --colors --bootstrap bootstrap.php transform_IntervatTest.php
* @author dany
* Expected result
* @code
@@ -187,10 +187,26 @@
public function testAppend_declarant()
{
$this->object->append_root();
- $this->object->append_representative($this->representative);
- $this->object->append_client_listing($this->declarant,array());
+ $dom=$this->object->domdoc->createElement("Listing");
+ $this->object->append_declarant($dom,$this->declarant,array());
+ $this->object->domdoc->appendChild($dom);
$result = $this->object->domdoc->saveXML();
- $this->assertEquals($this->result, $result);
+ $expected='<?xml version="1.0" encoding="ISO-8859-1"?>
+<ns2:ClientListingConsignment
xmlns:ns2="http://www.minfin.fgov.be/ClientListingConsignment"
xmlns="http://www.minfin.fgov.be/InputCommon" ClientListingsNbr="1"/>
+<Listing xmlns:ns2="http://www.minfin.fgov.be/ClientListingConsignment">
+ <ns2:Declarant
xmlns:ns2="http://www.minfin.fgov.be/ClientListingConsignment">
+ <VATNumber>0000000097</VATNumber>
+ <Name>Nom Declarant</Name>
+ <Street>Rue du declarant</Street>
+ <PostCode>9999</PostCode>
+ <City>TESTCITY</City>
+ <CountryCode>BE</CountryCode>
+ <EmailAddress>address@hidden</EmailAddress>
+ <Phone>000000000</Phone>
+ </ns2:Declarant>
+</Listing>
+';
+ $this->assertEquals($expected, $result);
}
---
PhpCompta est un logiciel de comptabilité libre en ligne (full web)
Projet opensource http://www.phpcompta.eu
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpcompta-dev] r675 - in trunk/transform: . include sql unit-test,
phpcompta-dev <=