//
// Script javascript added in header of pages (in HEAD section)
+//
+
//
// \file htdocs/lib/lib_head.js
// \brief File that include javascript functions (included if option use_javascript activated)
-// \version $Revision$
-
+// \version $Id$
+//
function dolibarr_type_reload(param)
{
diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php
index 823aa4c9e5d..f11d9bfc565 100644
--- a/htdocs/master.inc.php
+++ b/htdocs/master.inc.php
@@ -374,7 +374,7 @@ if (! defined('NOREQUIREDB') && ! defined('NOREQUIRESOC'))
$mysoc->profid2=empty($conf->global->MAIN_INFO_SIRET)?'':$conf->global->MAIN_INFO_SIRET;
$mysoc->profid3=empty($conf->global->MAIN_INFO_APE)?'':$conf->global->MAIN_INFO_APE;
$mysoc->profid4=empty($conf->global->MAIN_INFO_RCS)?'':$conf->global->MAIN_INFO_RCS;
- $mysoc->tva_intra=$conf->global->MAIN_INFO_TVAINTRA;
+ $mysoc->tva_intra=$conf->global->MAIN_INFO_TVAINTRA; // VAT number, not necessarly INTRA.
$mysoc->capital=$conf->global->MAIN_INFO_CAPITAL;
$mysoc->forme_juridique_code=$conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE;
$mysoc->email=$conf->global->MAIN_INFO_SOCIETE_MAIL;
diff --git a/htdocs/soc.php b/htdocs/soc.php
index 76eb11fad7c..649e79408e2 100644
--- a/htdocs/soc.php
+++ b/htdocs/soc.php
@@ -104,9 +104,7 @@ if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"])
$soc->gencod = $_POST["gencod"];
$soc->tva_assuj = $_POST["assujtva_value"];
- $soc->tva_intra_code = $_POST["tva_intra_code"];
- $soc->tva_intra_num = $_POST["tva_intra_num"];
- $soc->tva_intra = $_POST["tva_intra_code"] . $_POST["tva_intra_num"];
+ $soc->tva_intra = $_POST["tva_intra"];
$soc->forme_juridique_code = $_POST["forme_juridique_code"];
$soc->effectif_id = $_POST["effectif_id"];
@@ -341,9 +339,8 @@ $_GET["action"] == 'create' || $_POST["action"] == 'create')
$soc->effectif_id=($_POST["effectif_id"]&&!$_POST["cleartype"])?$_POST["effectif_id_id"]:($_REQUEST["private"]?'EF1-5':'');
$soc->tva_assuj = $_POST["assujtva_value"];
- $soc->tva_intra_code=$_POST["tva_intra_code"];
- $soc->tva_intra_num=$_POST["tva_intra_num"];
-
+ $soc->tva_intra=$_POST["tva_intra"];
+
$soc->commercial_id=$_POST["commercial_id"];
// On positionne pays_id, pays_code et libelle du pays choisi
@@ -577,20 +574,19 @@ $_GET["action"] == 'create' || $_POST["action"] == 'create')
{
print "\n";
print '';
print "\n";
}
print '| '.$langs->trans('VATIntra').' | ';
print '';
- $s ='';
- $s.='';
+ $s.='';
$s.=' ';
if ($conf->use_javascript_ajax)
{
- $s.=''.$langs->trans("VATIntraCheck").'';
+ $s.=''.$langs->trans("VATIntraCheck").'';
print $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1);
}
else
@@ -693,9 +689,8 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit')
$soc->forme_juridique_code=$_POST["forme_juridique_code"];
$soc->tva_assuj = $_POST["assujtva_value"];
- $soc->tva_intra_code=$_POST["tva_intra_code"];
- $soc->tva_intra_num=$_POST["tva_intra_num"];
-
+ $soc->tva_intra=$_POST["tva_intra"];
+
// On positionne pays_id, pays_code et libelle du pays choisi
if ($soc->pays_id)
{
@@ -897,20 +892,19 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit')
{
print "\n";
print '';
print "\n";
}
print ' | '.$langs->trans('VATIntra').' | ';
print '';
- $s ='';
- $s.='';
+ $s ='';
$s.=' ';
if ($conf->use_javascript_ajax)
{
- $s.=''.$langs->trans("VATIntraCheck").'';
+ $s.=''.$langs->trans("VATIntraCheck").'';
print $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1);
}
else
@@ -1110,8 +1104,8 @@ else
{
print "\n";
print '';
print "\n";
@@ -1120,15 +1114,12 @@ else
if ($soc->tva_intra)
{
$s='';
- $code=substr($soc->tva_intra,0,2);
- $num=substr($soc->tva_intra,2);
$s.=$soc->tva_intra;
- $s.='';
- $s.='';
+ $s.='';
$s.=' ';
if ($conf->use_javascript_ajax)
{
- $s.=''.$langs->trans("VATIntraCheck").'';
+ $s.=''.$langs->trans("VATIntraCheck").'';
print $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1);
}
else
diff --git a/htdocs/societe.class.php b/htdocs/societe.class.php
index 1c45a8b92f3..5fcdb2580b4 100644
--- a/htdocs/societe.class.php
+++ b/htdocs/societe.class.php
@@ -601,8 +601,6 @@ class Societe extends CommonObject
$this->tva_assuj = $obj->tva_assuj;
$this->tva_intra = $obj->tva_intra;
- $this->tva_intra_code = substr($obj->tva_intra,0,2);
- $this->tva_intra_num = substr($obj->tva_intra,2);
$this->typent_id = $obj->typent_id;
$this->typent_code = $obj->typent_code;
diff --git a/htdocs/societe/checkvat/checkVatPopup.php b/htdocs/societe/checkvat/checkVatPopup.php
index c3a94a03445..e9b806fcec9 100644
--- a/htdocs/societe/checkvat/checkVatPopup.php
+++ b/htdocs/societe/checkvat/checkVatPopup.php
@@ -1,5 +1,5 @@
+/* Copyright (C) 2006-2009 Laurent Destailleur
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -17,11 +17,11 @@
*/
/**
-* \file htdocs/societe/checkvat/checkVatPopup.php
-* \ingroup societe
-* \brief Popup screen to validate VAT
-* \version $Id$
-*/
+ * \file htdocs/societe/checkvat/checkVatPopup.php
+ * \ingroup societe
+ * \brief Popup screen to validate VAT
+ * \version $Id$
+ */
require ("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
@@ -30,7 +30,7 @@ require_once(DOL_DOCUMENT_ROOT."/includes/nusoap/lib/nusoap.php");
$langs->load("companies");
$WS_DOL_URL='http://ec.europa.eu/taxation_customs/vies/api/checkVatPort';
-$WS_METHOD = 'checkVat';
+$WS_METHOD ='checkVat';
top_htmlhead("", $langs->trans("VATIntraCheckableOnEUSite"));
@@ -41,25 +41,22 @@ print ' ';
print_fiche_titre($langs->trans("VATIntraCheckableOnEUSite"),'','setup');
-if (! $_REQUEST["countryCode"])
-{
- print ' ';
- print ''.$langs->transnoentities("ErrorFieldRequired",$langs->trans("Country")).' ';
-}
-elseif (! $_REQUEST["vatNumber"])
+if (! $_REQUEST["vatNumber"])
{
print ' ';
print ''.$langs->transnoentities("ErrorFieldRequired",$langs->trans("VATIntraShort")).' ';
}
else
{
- print ''.$langs->trans("Country").': '.$_REQUEST["countryCode"].' ';
- print ''.$langs->trans("VATIntraShort").': '.$_REQUEST["vatNumber"].' ';
+ $countryCode=substr($_REQUEST["vatNumber"],0,2);
+ $vatNumber=substr($_REQUEST["vatNumber"],2);
+ print ''.$langs->trans("Country").': '.$countryCode.' ';
+ print ''.$langs->trans("VATIntraShort").': '.$vatNumber.' ';
print ' ';
// Set the parameters to send to the WebService
- $parameters = array("countryCode" => $_REQUEST["countryCode"],
- "vatNumber" => $_REQUEST["vatNumber"]);
+ $parameters = array("countryCode" => $countryCode,
+ "vatNumber" => $vatNumber);
// Set the WebService URL
dol_syslog("Create nusoap_client for URL=".$WS_DOL_URL);
@@ -69,10 +66,10 @@ else
dol_syslog("Call method ".$WS_METHOD);
$result = $soapclient->call($WS_METHOD,$parameters);
-// print "x".is_array($result)."i";
-// print_r($result);
-// print $soapclient->request.' ';
-// print $soapclient->response.' ';
+ // print "x".is_array($result)."i";
+ // print_r($result);
+ // print $soapclient->request.' ';
+ // print $soapclient->response.' ';
$messagetoshow='';
print ''.$langs->trans("Response").': ';
@@ -95,7 +92,7 @@ else
}
// Syntaxe ko
elseif (preg_match('/INVALID_INPUT/i',$result['faultstring'])
- || ($result['requestDate'] && ! $result['valid']))
+ || ($result['requestDate'] && ! $result['valid']))
{
if ($result['requestDate']) print $langs->trans("Date").': '.$result['requestDate'].' ';
print $langs->trans("VATIntraSyntaxIsValid").': '.$langs->trans("No").' (Might be a non europeen VAT) ';
@@ -110,7 +107,7 @@ else
print $langs->trans("VATIntraValueIsValid").': ';
if (preg_match('/MS_UNAVAILABLE/i',$result['faultstring']))
{
- print ''.$langs->trans("ErrorVATCheckMS_UNAVAILABLE",$_REQUEST["countryCode"]).' ';
+ print ''.$langs->trans("ErrorVATCheckMS_UNAVAILABLE",$countryCode).' ';
}
else
{
|