Jump to content

Archived

This topic is now archived and is closed to further replies.

helohelo

invoice and VAT rules thats legal for European Uni

Recommended Posts

tehn i run an old version of your VAT script cuase in my case the vat number is INCLUDED with the 2 iso country code numbers.

In your last version this is split?

 

The pb is not in the source code but with the cgi program

so the cgi-program does not allow data extraction?


Keesjan

Share this post


Link to post
Share on other sites
tehn i run an old version of your VAT script cuase in my case the vat number is INCLUDED with the 2 iso country code numbers.

In your last version this is split?

For validation functions, no changes between the versions of the contribution....

The separation between the ISO and the numeric part of the VAT number is done in the tep_verif_tva() function (have a look at the code in validations.php) and this function never changed....

 

The pb is not in the source code but with the cgi program

so the cgi-program does not allow data extraction?

I suppose so, I'm not sure.

The pb is that now, the answer of europa site to request of the validation function is not the same as before....

 

There is few days( when first errors appears), the response was:

An error has occurred while processing your request.

> No content type was passed to uncgi.

> Un-CGI 1.9 \

So i thought there is a pb in europa site because the "content-type" is well send (have a look at the posttohost function in validation.php).

 

But now, with the same request (no changes at all), the response is:

Server: Netscape-Enterprise/4.1 Content-type: text/html Connection: close

No content type was passed to uncgi.

 

 

Un-CGI 1.9

So I think now that they are changing something to avoid our requests...


JeanLuc

OsC: MS2

Share this post


Link to post
Share on other sites

mmm, ok I see.

Meanwhile I have done some research, I looked at the FAQ's at

http://www.europa.eu.int/comm/taxation_cus...vies.htm#item16

 

there is en email adres under the question 16:

 

B]Q16: Is it possible to have an open interface to the Commission's web site?[/b

The Commission is currently considering the possibility of such a direct query system but it is subject to agreement from all national tax administrations.

We are interested to know the opinion from potential users and type of interface they would use.

For more information you can contact Mr. Nicolas Geuskens. email Nicolas.Geuskens@cec.eu.int

 

Call for action!

Please contact all mr Nicolas Geuskens from the EU to ask for an open interface! I think its redicullus that still not there, more then 2 years after they now the new regultions for electronic commerce would be implimented.Especaily because the entrepeneur is responsible for the verification of the VAT! The more entrepeneurs will ask for it, the sooner it will be here!!


Keesjan

Share this post


Link to post
Share on other sites

I have made some webshops for Dutch and Belgian entrepreneurs. They are very glad to have the opportunity to check the Europeam VAT-numbers on an open interface.

 

I hereby call upon the EU to keep the comnection open.

 

Regards

Han Wijman

 

This is my call upon the EU.

Share this post


Link to post
Share on other sites
I have made some webshops for Dutch and Belgian entrepreneurs. They are very glad to have the opportunity to check the Europeam VAT-numbers on an open interface.

 

I hereby call upon the EU to keep the comnection open.

 

Regards

Han Wijman

 

This is my call upon the EU.

Thank you for your help ;

Could you post here your mail to EU...


JeanLuc

OsC: MS2

Share this post


Link to post
Share on other sites
We experience the following issue after installing v3.82 and then upgrading to 3.9. When a new user tries to register (create_account.php), when all fields are completed (irrespective if company name and EU VAT number have been entered), we get the following popup:

 

Error: a runtime error has occured
Line: 91
Error: 'company' is undefined

 

And immediately after:

 

Query was empty - Query was empty

Query was empty

[TEP STOP]

 

We get the same results in address_book_process.php, but without the TEP STOP errors.

 

We double checked the code mod and it is as the instructions imply. Where should we check for a possible error?

Hi Jean-Luc,

 

Your update solved the runtime error issue. However, I still get

 

Query was empty - Query was empty

Query was empty

[TEP STOP]

 

after creating a new account (create_account.php).

 

Something to look out for?

Share this post


Link to post
Share on other sites

Hi Han Wijman and JeanLuc,

i got an answer of the EU (within 24 hour response!): :P

 

"Good morning,

 

We are currently bulding an open interface that will be made available to the public early 2005. This interface will be based on SOAP/XML exchanges.

 

Regards,

 

Nicoals Geuskens"

and on my reply:

"Dear mister N, Geuskens,

 

 

 

And what to do till then? Suppose its realy avaulible 'early' 2005?

 

Can you give us the parameters to quiry the cgi script for now?

 

Otherwise I cannot verify costumer vat numbers.

 

There was a working script from my (open source) eshopprovider but that does not work anymore since 1 week."

 

He replyed:

"Dear Sir,

 

Currently, the ony system available is the one you know, at http://europa.eu.int/vies, designed for human being, and not for application. You'll then have to wait to have a reliable application access to the VAT number verification system."

 

I think this is redicilious to ask online entrepeneurs to verify there electronic services on the one hand and on the other hand not providing the tool to do that! This makes me very angry! :angry:


Keesjan

Share this post


Link to post
Share on other sites
They are very glad to have the opportunity to check the Europeam VAT-numbers on an open interface.

You mean in the past? Or can they still?


Keesjan

Share this post


Link to post
Share on other sites

YEEEPEEE!!!

I think I have a solution.... :)

 

I get round with the cgi probl?me and I just read the result of the URL with GET parameters with fopen() PHP function...

 

In both catalog/includes/functions/validations.php and catalog/admin/includes/functions/validations.php, replace this function:

function tep_verif_tva($num_tva){
   $prefix = substr($num_tva, 0, 2);
   $tva = substr($num_tva, 2);	
   $data = array (	'MS' => $prefix,
 'Lang' => 'FR',
 'VAT' => $tva	);
   $verif = tep_post_to_host('http://www.europa.eu.int/comm/taxation_customs/vies/cgi-bin/viesquer', $data);    
   if (is_string($verif)) {	
       $str = str_replace("\n", "", $verif);	
       preg_match('/<\/form> *(Oui|Non)/i', $str, $a);
       if ($a[1] == 'Oui') {
           return 'true';
       } elseif ($a[1] == 'Non'){
           return 'false';
       } else {
           return 'no_verif';
       }
   } else {
       return 'no_verif';	// Site de v?rification indisponible
   }
}

by this one:

function tep_verif_tva($num_tva){
   $prefix = substr($num_tva, 0, 2);
   $tva = substr($num_tva, 2);
   $monfd = fopen('http://www.europa.eu.int/comm/taxation_customs/vies/cgi-bin/viesquer?MS=' . $prefix . '&Lang=FR&VAT=' . $tva, r);
   while (!feof ($monfd)) {
       $buffer = fgets($monfd, 4096);
       if ( eregi("TVA non valide", $buffer) ) {
           echo 'Non, numéro de TVA non valide<br>';      
           return 'false';
       } elseif ( eregi("TVA valide", $buffer) ){
           echo 'Oui, numéro de TVA valide<br>'; 	 
           return 'true';
       } else {
           $myVerif = 'no_verif';
       }
   }
   return $myVerif;
}

 

Try this and tell me if there is bug...

 

Enjoy... :)


JeanLuc

OsC: MS2

Share this post


Link to post
Share on other sites

Sorry, it stays some "bug" message for coding in the function I put above;

Here is the good function:

function tep_verif_tva($num_tva){
  $prefix = substr($num_tva, 0, 2);
  $tva = substr($num_tva, 2);
  $monfd = fopen('http://www.europa.eu.int/comm/taxation_customs/vies/cgi-bin/viesquer?MS=' . $prefix . '&Lang=FR&VAT=' . $tva, r);
  while (!feof ($monfd)) {
      $buffer = fgets($monfd, 4096);
      if ( eregi("TVA non valide", $buffer) ) {
          return 'false';
      } elseif ( eregi("TVA valide", $buffer) ){
          return 'true';
      } else {
          $myVerif = 'no_verif';
      }
  }
  return $myVerif;
}

 

enjoy...


JeanLuc

OsC: MS2

Share this post


Link to post
Share on other sites

I improve the function by adding a condition because if the customer enters a vat number with not the valid two first letters, there is a bug in the europa page (Normally, it is a dropdown menu which put these letters in the site).

 

function tep_verif_tva($num_tva){
 $prefix = substr($num_tva, 0, 2);
 $intracom_array = array('AT'=>'AT','BE'=>'BE','DK'=>'DK','FI'=>'FI','FR'=>'FR','FX'=>'FR','DE'=>'DE','GR'=>'EL','IE'=>'IE','IT'=>'IT','LU'=>'LU','NL'=>'NL','PT'=>'PT','ES'=>'ES','SE'=>'SE','GB'=>'GB','CY'=>'CY','EE'=>'EE','HU'=>'HU','LV'=>'LV','LT'=>'LT','MT'=>'MT','PL'=>'PL','SK'=>'SK','CZ'=>'CZ','SI'=>'SI');
 if (array_search($prefix, $intracom_array) === false) {
   return 'false';
 }
 $tva = substr($num_tva, 2);
 $monfd = fopen('http://www.europa.eu.int/comm/taxation_customs/vies/cgi-bin/viesquer?MS=' . $prefix . '&Lang=FR&VAT=' . $tva, r);
 while (!feof ($monfd)) {
     $buffer = fgets($monfd, 4096);
     if ( eregi("TVA non valide", $buffer) ) {
         return 'false';
     } elseif ( eregi("TVA valide", $buffer) ){
         return 'true';
     } else {
         $myVerif = 'no_verif';
     }
 }
 return $myVerif;
}


JeanLuc

OsC: MS2

Share this post


Link to post
Share on other sites

woow,

thanks jeanluc! I will test it.

 

is in this line

('AT'=>'AT','BE'=>'BE','DK'=>'DK','FI'=>'FI','FR'=>'FR','FX'=>'FR','DE'=>'DE','GR'=>'EL','IE'=>'IE','IT'=>'IT','LU'=>'LU','NL'=>'NL','PT'=>'PT','ES'=>'ES','SE'=>'SE','GB'=>'GB','CY'=>'CY','EE'=>'EE','HU'=>'HU','LV'=>'LV','LT'=>'LT','MT'=>'MT','PL'=>'PL','SK'=>'SK','CZ'=>'CZ','SI'=>'SI');

 

this:

'FX'=>'FR'

'GR'=>'EL'

 

 

right?


Keesjan

Share this post


Link to post
Share on other sites

Yes it's right... and what's more, this is the reason of this array...


JeanLuc

OsC: MS2

Share this post


Link to post
Share on other sites

having been away I am now back only to discover this beautiful contribution is no longer working :(:(

 

what has been happening?

 

Andrew

Share this post


Link to post
Share on other sites
having been away I am now back only to discover this beautiful contribution is no longer working :(:(

 

what has been happening?

 

Andrew

Did you make the changes on the tep_verif_TVA() function ?


JeanLuc

OsC: MS2

Share this post


Link to post
Share on other sites

Hi JeanLuc

 

I have just downloaded the alterations and amendments and will work through them now hopefully by lunchtime it will be fixed. I just called the EU website to find the new link and it has changed quite alot

EU VAT Checker english

EU VAT Checker French

 

well I guess i had better get started makingt he changes...

 

Andrew

Share this post


Link to post
Share on other sites

Hi JeanLuc

 

when you refer to the changes in the function check 3.93 i get errors with the code. Also I cant see what this is doing other than not checking the vat number?

 

what do you think the solution is going to be for this check? hav the eu checker site blocked extrernal checks?

 

Andrew

Share this post


Link to post
Share on other sites

The function just catch the code the server (here in the french one... :P ) send to a browser and check if the sentence "TVA valide" or "TVA non valide" is in.

 

I improve again the function, using "file_get_contents() function which is less greedy.

I also add a new function which gives the ISO code and prefix array.

I will place thesse improvements in the next version of the contribution (when I'll be sure it's OK.

Please, replace your existing tep_verif_TVA() functions (in catalog and admin) by these two new functions:

function tep_verif_tva($num_tva){
$prefix = substr($num_tva, 0, 2);
if (array_search($prefix, tep_get_tva_intracom_array() ) === false) {
?return 'false';
}
$tva = substr($num_tva, 2);	
$monfd = file_get_contents('http://www.europa.eu.int/comm/taxation_customs/vies/cgi-bin/viesquer?MS=' . $prefix . '&Lang=FR&VAT=' . $tva, r);
?if ( eregi("TVA non valide", $monfd) ) {
?	return 'false';
?} elseif ( eregi("TVA valide", $monfd) ){
?	return 'true';
?} else {
?	$myVerif = 'no_verif';
?}
return $myVerif;
}

function tep_get_tva_intracom_array() {
$intracom_array = array('AT'=>'AT', ? ?//Austria
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'BE'=>'BE', ? ?//Belgium
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'DK'=>'DK', ? ?//Denmark
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'FI'=>'FI', ? ?//Finland
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'FR'=>'FR', ? ?//France
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'FX'=>'FR', ? ?//France m?tropolitaine
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'DE'=>'DE', ? ?//Germany
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'GR'=>'EL', ? ?//Greece
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'IE'=>'IE', ? ?//Irland
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'IT'=>'IT', ? ?//Italy
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'LU'=>'LU', ? ?//Luxembourg
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'NL'=>'NL', ? ?//Netherlands
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'PT'=>'PT', ? ?//Portugal
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'ES'=>'ES', ? ?//Spain
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'SE'=>'SE', ? ?//Sweden
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'GB'=>'GB', ? ?//United Kingdom
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'CY'=>'CY', ? ?//Cyprus
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'EE'=>'EE', ? ?//Estonia
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'HU'=>'HU', ? ?//Hungary
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'LV'=>'LV', ? ?//Latvia
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'LT'=>'LT', ? ?//Lithuania
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'MT'=>'MT', ? ?//Malta
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'PL'=>'PL', ? ?//Poland
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'SK'=>'SK', ? ?//Slovakia
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'CZ'=>'CZ', ? ?//Czech Republic
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'SI'=>'SI'); ? //Slovania
return $intracom_array;
}

 

enjoy...


JeanLuc

OsC: MS2

Share this post


Link to post
Share on other sites

thanks JeanLuc

 

I am not clear on what this is now doing :( is the vat checker working? or just returning a colourful error mesage?

 

I dont want to make all the changes to the code only to find this isn't doing the check. The eu checker site has chnaged dramatically so I guess that mean all your (my) work is not wasted :(

 

Andrew

Share this post


Link to post
Share on other sites
its alive ;)

 

andrew

Is this means it's ok now for you?

 

Hellohello, did you try the new functions; is it ok for a new version..

 

Thank you for your answers...


JeanLuc

OsC: MS2

Share this post


Link to post
Share on other sites
its alive ;)

 

andrew

Is this means it's ok now for you?

 

Hellohello, did you try the new functions; is it ok for a new version..

 

Thank you for your answers...

Sorry for late repsons,

yust had time today to test:

and its working :P !!!!

 

Thank you thank you JeanLuc. You are the best!


Keesjan

Share this post


Link to post
Share on other sites
woow,

thanks jeanluc! I will test it.

 

is in this line

('AT'=>'AT','BE'=>'BE','DK'=>'DK','FI'=>'FI','FR'=>'FR','FX'=>'FR','DE'=>'DE','GR'=>'EL','IE'=>'IE','IT'=>'IT','LU'=>'LU','NL'=>'NL','PT'=>'PT','ES'=>'ES','SE'=>'SE','GB'=>'GB','CY'=>'CY','EE'=>'EE','HU'=>'HU','LV'=>'LV','LT'=>'LT','MT'=>'MT','PL'=>'PL','SK'=>'SK','CZ'=>'CZ','SI'=>'SI');

 

this:

'FX'=>'FR'

'GR'=>'EL'

 

 

right?

sorry,

yust read your upgrade from 3.3 text:

 

(for Greece or France metropolitaine , it's different)

good to mention this the prevent questions like I did ;)


Keesjan

Share this post


Link to post
Share on other sites

×