2011-01-10 13:18:37 +00:00
|
|
|
<?php
|
2011-01-07 13:23:05 +00:00
|
|
|
class MTva
|
|
|
|
{
|
2011-01-10 13:18:37 +00:00
|
|
|
public $vatNumber = ''; // Numéro de TVA retourné
|
2011-01-07 13:23:05 +00:00
|
|
|
public $vatDefined = false; // Le numéro de TVA est il validé ?
|
|
|
|
public $errnum = 0; // Numéro de l'erreur en cas d'erreur
|
|
|
|
public $errmsg = ''; // Message de l'erreur en cas d'erreur
|
2009-02-17 13:14:53 +00:00
|
|
|
|
2011-01-07 13:23:05 +00:00
|
|
|
private $siren;
|
2009-02-17 13:14:53 +00:00
|
|
|
|
2011-01-07 13:23:05 +00:00
|
|
|
function __construct($siren) {
|
|
|
|
$this->siren = $siren;
|
2009-02-17 13:14:53 +00:00
|
|
|
|
2011-01-10 13:18:37 +00:00
|
|
|
require_once 'scoresws/scoresws.php';
|
|
|
|
$O = scoresws_getTVA($this->siren);
|
|
|
|
if ($O === false) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if ($O->error->errnum) {
|
|
|
|
$this->errnum = $O->error->errnum;
|
|
|
|
$this->errmsg = $O->error->errmsg;
|
2011-01-07 13:23:05 +00:00
|
|
|
return false;
|
2011-01-10 13:18:37 +00:00
|
|
|
} else {
|
|
|
|
$this->vatNumber = $O->result->Tva;
|
|
|
|
$this->vatDefined = $O->result->Tva != 'N/A';
|
2011-01-07 13:23:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|