Correction format siren
This commit is contained in:
parent
41322b2459
commit
57361a0094
@ -65,27 +65,23 @@ class MTva {
|
||||
|
||||
private $siren;
|
||||
|
||||
function __construct($siren, $accesDist=true) {
|
||||
|
||||
function __construct($siren, $accesDist=true)
|
||||
{
|
||||
$sirenIn=$siren*1;
|
||||
if ($sirenIn<000001000) {
|
||||
/* $this->errnum=0;
|
||||
$this->errmsg=$O->error->errmsg;
|
||||
return false;
|
||||
} else {
|
||||
$val=$O->result;
|
||||
$this->vatNumber=$val->vatNumber;
|
||||
$this->vatDefined=$val->vatDefined;*/
|
||||
$this->vatNumber='FR00000000000';
|
||||
$this->vatDefined=false;
|
||||
return false;
|
||||
}elseif($sirenIn<000010000) $siren='00000'.$sirenIn;
|
||||
if ($sirenIn<000001000) {
|
||||
$this->vatNumber='FR00000000000';
|
||||
$this->vatDefined=false;
|
||||
return false;
|
||||
}
|
||||
elseif($sirenIn<000010000) $siren='00000'.$sirenIn;
|
||||
elseif ($sirenIn<000100000) $siren='0000'.$sirenIn;
|
||||
elseif ($sirenIn<001000000) $siren='000'.$sirenIn;
|
||||
elseif ($sirenIn<010000000) $siren='00'.$sirenIn;
|
||||
elseif ($sirenIn<100000000) $siren='0'.$sirenIn;
|
||||
else $siren=''.$sirenIn;
|
||||
|
||||
$siren = str_pad($siren, 9, '0', STR_PAD_LEFT);
|
||||
|
||||
$this->siren=$siren;
|
||||
$cleAlgo=$this->genereCleFr();
|
||||
|
||||
@ -121,10 +117,12 @@ class MTva {
|
||||
'iso'=>'FR',
|
||||
'vat'=>$cle.$siren,
|
||||
'BtnSubmitVat'=>'Verify');
|
||||
/* $postData=array( 'Lang'=>'FR',
|
||||
'VAT'=>$cle.$siren,
|
||||
'ISO'=>'FR',
|
||||
'MS'=>'FR');*/
|
||||
/*$postData=array(
|
||||
* 'Lang'=>'FR',
|
||||
'VAT'=>$cle.$siren,
|
||||
'ISO'=>'FR',
|
||||
'MS'=>'FR'
|
||||
);*/
|
||||
$tdeb = microtime_float();
|
||||
// $url='http://ec.europa.eu/taxation_customs/vies/cgi-bin/viesquer';
|
||||
// $referer='http://ec.europa.eu/taxation_customs/vies/fr/vieshome.htm';
|
||||
@ -133,8 +131,7 @@ class MTva {
|
||||
|
||||
$page=getUrl($url, '', $postData, $referer, false, 'ec.europa.eu', '', 15);
|
||||
$duree = round(microtime_float()-$tdeb, 3);
|
||||
//sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "classMTva sur $siren en $duree", print_r($page, true));
|
||||
|
||||
//sendMail('production@scores-decisions.com', 'mricois@scores-decisions.com', "classMTva sur $siren en $duree", print_r($page, true));
|
||||
if ($page['err_num']<>0) {
|
||||
debugLog('W', 'TVA Erreur CURL n°'. $page['err_num'] .', '. $page['err_msg'] ." sur le Siren $siren, numéro de TVA = FR $cle $siren. Durée = $duree s !", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
$this->vatNumber="FR$cle$siren";
|
||||
|
Loading…
x
Reference in New Issue
Block a user