From ffaa8dc08fbf2d53a5edf8d73ae4101a329ab039 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Dec 2009 13:17:16 +0000 Subject: [PATCH] New: VAT number is saved in one field only. This is more "international". --- ChangeLog | 1 + htdocs/admin/company.php | 11 +++--- htdocs/lib/lib_head.js | 8 +++-- htdocs/master.inc.php | 2 +- htdocs/soc.php | 43 +++++++++-------------- htdocs/societe.class.php | 2 -- htdocs/societe/checkvat/checkVatPopup.php | 43 +++++++++++------------ 7 files changed, 48 insertions(+), 62 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2e38e5a3477..ccb7820d093 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,7 @@ For users: customer. - New: Can use {tttt} in numbering mask setup. It will be replaced with third party type. +- New: VAT number is stored in one field. This is more "international". - Fix: bug #28055 : Unable to modify the date of a cloned command - Fix: bug #27891 diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index e107bf242bd..9e533aa8d85 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -664,8 +664,8 @@ else { print "\n"; print ''; print "\n"; @@ -676,15 +676,12 @@ else if ($conf->global->MAIN_INFO_TVAINTRA) { $s=''; - $code=substr($conf->global->MAIN_INFO_TVAINTRA,0,2); - $num=substr($conf->global->MAIN_INFO_TVAINTRA,2); $s.=$conf->global->MAIN_INFO_TVAINTRA; - $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/lib/lib_head.js b/htdocs/lib/lib_head.js index 9352fa1a6af..f17b648f165 100644 --- a/htdocs/lib/lib_head.js +++ b/htdocs/lib/lib_head.js @@ -1,12 +1,14 @@ -// Copyright (C) 2005-2008 Laurent Destailleur +// Copyright (C) 2005-2010 Laurent Destailleur // Copyright (C) 2005-2009 Regis Houssin // // 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 {