Merge branch 'develop'
This commit is contained in:
commit
2e81bcfc64
@ -6,7 +6,8 @@
|
||||
"geshi/geshi": "dev-master",
|
||||
"league/csv": "^8.1",
|
||||
"doctrine/dbal": "^2.5",
|
||||
"mikehaertl/phpwkhtmltopdf": "^2.2"
|
||||
"mikehaertl/phpwkhtmltopdf": "^2.2",
|
||||
"guzzlehttp/guzzle": "^6.2"
|
||||
},
|
||||
"include-path": ["library/"],
|
||||
"autoload": {
|
||||
|
286
composer.lock
generated
286
composer.lock
generated
@ -4,8 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"hash": "e99c2a7874dfdf3765c2593f120bbfb2",
|
||||
"content-hash": "0d51a8356b2f1dd421c52d81f2d1331b",
|
||||
"content-hash": "f1e440444eb2e2707d495c95551a35f6",
|
||||
"packages": [
|
||||
{
|
||||
"name": "doctrine/annotations",
|
||||
@ -73,20 +72,20 @@
|
||||
"docblock",
|
||||
"parser"
|
||||
],
|
||||
"time": "2015-08-31 12:32:49"
|
||||
"time": "2015-08-31T12:32:49+00:00"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/cache",
|
||||
"version": "v1.6.0",
|
||||
"version": "v1.6.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/doctrine/cache.git",
|
||||
"reference": "f8af318d14bdb0eff0336795b428b547bd39ccb6"
|
||||
"reference": "b6f544a20f4807e81f7044d31e679ccbb1866dc3"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/doctrine/cache/zipball/f8af318d14bdb0eff0336795b428b547bd39ccb6",
|
||||
"reference": "f8af318d14bdb0eff0336795b428b547bd39ccb6",
|
||||
"url": "https://api.github.com/repos/doctrine/cache/zipball/b6f544a20f4807e81f7044d31e679ccbb1866dc3",
|
||||
"reference": "b6f544a20f4807e81f7044d31e679ccbb1866dc3",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -143,7 +142,7 @@
|
||||
"cache",
|
||||
"caching"
|
||||
],
|
||||
"time": "2015-12-31 16:37:02"
|
||||
"time": "2016-10-29T11:16:17+00:00"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/collections",
|
||||
@ -209,20 +208,20 @@
|
||||
"collections",
|
||||
"iterator"
|
||||
],
|
||||
"time": "2015-04-14 22:21:58"
|
||||
"time": "2015-04-14T22:21:58+00:00"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/common",
|
||||
"version": "v2.6.1",
|
||||
"version": "v2.6.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/doctrine/common.git",
|
||||
"reference": "a579557bc689580c19fee4e27487a67fe60defc0"
|
||||
"reference": "7bce00698899aa2c06fe7365c76e4d78ddb15fa3"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/doctrine/common/zipball/a579557bc689580c19fee4e27487a67fe60defc0",
|
||||
"reference": "a579557bc689580c19fee4e27487a67fe60defc0",
|
||||
"url": "https://api.github.com/repos/doctrine/common/zipball/7bce00698899aa2c06fe7365c76e4d78ddb15fa3",
|
||||
"reference": "7bce00698899aa2c06fe7365c76e4d78ddb15fa3",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -282,7 +281,7 @@
|
||||
"persistence",
|
||||
"spl"
|
||||
],
|
||||
"time": "2015-12-25 13:18:31"
|
||||
"time": "2016-11-30T16:50:46+00:00"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/dbal",
|
||||
@ -353,7 +352,7 @@
|
||||
"persistence",
|
||||
"queryobject"
|
||||
],
|
||||
"time": "2016-09-09 19:13:33"
|
||||
"time": "2016-09-09T19:13:33+00:00"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/inflector",
|
||||
@ -420,7 +419,7 @@
|
||||
"singularize",
|
||||
"string"
|
||||
],
|
||||
"time": "2015-11-06 14:35:42"
|
||||
"time": "2015-11-06T14:35:42+00:00"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/lexer",
|
||||
@ -474,7 +473,7 @@
|
||||
"lexer",
|
||||
"parser"
|
||||
],
|
||||
"time": "2014-09-09 13:34:57"
|
||||
"time": "2014-09-09T13:34:57+00:00"
|
||||
},
|
||||
{
|
||||
"name": "geshi/geshi",
|
||||
@ -482,12 +481,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/GeSHi/geshi-1.0.git",
|
||||
"reference": "ac5c9c1f26eba2e6d0a9e374dc3d8316b586cdcc"
|
||||
"reference": "57e2186cea10332de1e59d03834a0863f981e1a4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/GeSHi/geshi-1.0/zipball/ac5c9c1f26eba2e6d0a9e374dc3d8316b586cdcc",
|
||||
"reference": "ac5c9c1f26eba2e6d0a9e374dc3d8316b586cdcc",
|
||||
"url": "https://api.github.com/repos/GeSHi/geshi-1.0/zipball/57e2186cea10332de1e59d03834a0863f981e1a4",
|
||||
"reference": "57e2186cea10332de1e59d03834a0863f981e1a4",
|
||||
"shasum": ""
|
||||
},
|
||||
"type": "library",
|
||||
@ -511,20 +510,191 @@
|
||||
],
|
||||
"description": "Generic Syntax Highlighter",
|
||||
"homepage": "http://qbnz.com/highlighter/",
|
||||
"time": "2016-02-01 23:14:34"
|
||||
"time": "2016-10-09 19:25:28"
|
||||
},
|
||||
{
|
||||
"name": "league/csv",
|
||||
"version": "8.1.1",
|
||||
"name": "guzzlehttp/guzzle",
|
||||
"version": "6.2.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/thephpleague/csv.git",
|
||||
"reference": "3b22a40804aa0bc5224ffb2f5e8248edf0a9a38c"
|
||||
"url": "https://github.com/guzzle/guzzle.git",
|
||||
"reference": "ebf29dee597f02f09f4d5bbecc68230ea9b08f60"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/thephpleague/csv/zipball/3b22a40804aa0bc5224ffb2f5e8248edf0a9a38c",
|
||||
"reference": "3b22a40804aa0bc5224ffb2f5e8248edf0a9a38c",
|
||||
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/ebf29dee597f02f09f4d5bbecc68230ea9b08f60",
|
||||
"reference": "ebf29dee597f02f09f4d5bbecc68230ea9b08f60",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"guzzlehttp/promises": "^1.0",
|
||||
"guzzlehttp/psr7": "^1.3.1",
|
||||
"php": ">=5.5"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-curl": "*",
|
||||
"phpunit/phpunit": "^4.0",
|
||||
"psr/log": "^1.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "6.2-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"src/functions_include.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"GuzzleHttp\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Michael Dowling",
|
||||
"email": "mtdowling@gmail.com",
|
||||
"homepage": "https://github.com/mtdowling"
|
||||
}
|
||||
],
|
||||
"description": "Guzzle is a PHP HTTP client library",
|
||||
"homepage": "http://guzzlephp.org/",
|
||||
"keywords": [
|
||||
"client",
|
||||
"curl",
|
||||
"framework",
|
||||
"http",
|
||||
"http client",
|
||||
"rest",
|
||||
"web service"
|
||||
],
|
||||
"time": "2016-10-08T15:01:37+00:00"
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/promises",
|
||||
"version": "v1.3.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/guzzle/promises.git",
|
||||
"reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646",
|
||||
"reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.5.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^4.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.4-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"GuzzleHttp\\Promise\\": "src/"
|
||||
},
|
||||
"files": [
|
||||
"src/functions_include.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Michael Dowling",
|
||||
"email": "mtdowling@gmail.com",
|
||||
"homepage": "https://github.com/mtdowling"
|
||||
}
|
||||
],
|
||||
"description": "Guzzle promises library",
|
||||
"keywords": [
|
||||
"promise"
|
||||
],
|
||||
"time": "2016-12-20T10:07:11+00:00"
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/psr7",
|
||||
"version": "1.3.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/guzzle/psr7.git",
|
||||
"reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/guzzle/psr7/zipball/5c6447c9df362e8f8093bda8f5d8873fe5c7f65b",
|
||||
"reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.4.0",
|
||||
"psr/http-message": "~1.0"
|
||||
},
|
||||
"provide": {
|
||||
"psr/http-message-implementation": "1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.4-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"GuzzleHttp\\Psr7\\": "src/"
|
||||
},
|
||||
"files": [
|
||||
"src/functions_include.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Michael Dowling",
|
||||
"email": "mtdowling@gmail.com",
|
||||
"homepage": "https://github.com/mtdowling"
|
||||
}
|
||||
],
|
||||
"description": "PSR-7 message implementation",
|
||||
"keywords": [
|
||||
"http",
|
||||
"message",
|
||||
"stream",
|
||||
"uri"
|
||||
],
|
||||
"time": "2016-06-24T23:00:38+00:00"
|
||||
},
|
||||
{
|
||||
"name": "league/csv",
|
||||
"version": "8.1.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/thephpleague/csv.git",
|
||||
"reference": "33447984f7a7038fefaa5a6177e8407b66bc85b4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/thephpleague/csv/zipball/33447984f7a7038fefaa5a6177e8407b66bc85b4",
|
||||
"reference": "33447984f7a7038fefaa5a6177e8407b66bc85b4",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -538,7 +708,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "8.0-dev"
|
||||
"dev-master": "8.1-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@ -568,7 +738,7 @@
|
||||
"read",
|
||||
"write"
|
||||
],
|
||||
"time": "2016-09-05 08:16:07"
|
||||
"time": "2016-10-27T11:21:24+00:00"
|
||||
},
|
||||
{
|
||||
"name": "mikehaertl/php-shellcommand",
|
||||
@ -604,7 +774,7 @@
|
||||
"keywords": [
|
||||
"shell"
|
||||
],
|
||||
"time": "2016-07-16 09:42:31"
|
||||
"time": "2016-07-16T09:42:31+00:00"
|
||||
},
|
||||
{
|
||||
"name": "mikehaertl/php-tmpfile",
|
||||
@ -640,7 +810,7 @@
|
||||
"keywords": [
|
||||
"files"
|
||||
],
|
||||
"time": "2016-07-07 05:59:42"
|
||||
"time": "2016-07-07T05:59:42+00:00"
|
||||
},
|
||||
{
|
||||
"name": "mikehaertl/phpwkhtmltopdf",
|
||||
@ -689,7 +859,57 @@
|
||||
"wkhtmltoimage",
|
||||
"wkhtmltopdf"
|
||||
],
|
||||
"time": "2016-06-02 08:06:45"
|
||||
"time": "2016-06-02T08:06:45+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/http-message",
|
||||
"version": "1.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-fig/http-message.git",
|
||||
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
|
||||
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Psr\\Http\\Message\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "PHP-FIG",
|
||||
"homepage": "http://www.php-fig.org/"
|
||||
}
|
||||
],
|
||||
"description": "Common interface for HTTP messages",
|
||||
"homepage": "https://github.com/php-fig/http-message",
|
||||
"keywords": [
|
||||
"http",
|
||||
"http-message",
|
||||
"psr",
|
||||
"psr-7",
|
||||
"request",
|
||||
"response"
|
||||
],
|
||||
"time": "2016-08-06T14:39:51+00:00"
|
||||
},
|
||||
{
|
||||
"name": "zendframework/zendframework1",
|
||||
@ -736,7 +956,7 @@
|
||||
"ZF1",
|
||||
"framework"
|
||||
],
|
||||
"time": "2016-09-08 14:50:34"
|
||||
"time": "2016-09-08T14:50:34+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [],
|
||||
|
@ -987,7 +987,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
e.adr_comp, LPAD(e.adr_cp,5,0) AS adr_cp, e.adr_ville, e.adr_dep, LPAD(e.adr_com,3,0) AS adr_com,
|
||||
LPAD(e.tel,10,0) AS tel, LPAD(e.fax,10,0) AS fax, e.cj, e.ape_etab, e.ape_entrep, e.teff_etab,
|
||||
CONCAT(e.siren, e.nic) AS siret, e.actif, e.identite_pre, IF(e.siege=2,0.5,e.siege) AS triSiege,
|
||||
IF (e.adr_dep=99, (SELECT libPays FROM jo.tabPays p WHERE p.codePaysInsee=e.adr_com) , 'France') AS libPays";
|
||||
IF (e.adr_dep=99, (SELECT libPays FROM jo.tabPays p WHERE p.codePaysInsee=e.adr_com LIMIT 0,1) , 'France') AS libPays";
|
||||
|
||||
$strActif = $strDep = '';
|
||||
if (intval($actif) == 1) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
require_once 'framework/common/curl.php';
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\RequestException;
|
||||
|
||||
class Metier_Partenaires_MTva
|
||||
{
|
||||
@ -85,19 +86,18 @@ class Metier_Partenaires_MTva
|
||||
|
||||
$info = $this->iDb->select('sdv1.siren_tva',
|
||||
"LPAD(cle,2,0) AS cle, DATE_FORMAT(dateMod,'%Y%m%d') as DateMAJ",
|
||||
"siren=$this->siren", false, MYSQL_ASSOC);
|
||||
if (count($tab) > 0) {
|
||||
"siren=".$this->siren, false, MYSQL_ASSOC);
|
||||
if (count($info) > 0) {
|
||||
$tab = $info[0];
|
||||
$cle = $tab['cle'];
|
||||
$dateRef = new DateTime();
|
||||
$dateRef->sub(new DateInterval('P6M'));
|
||||
$dateMaj = DateTime::createFromFormat('Ymd', $tab['DateMAJ']);
|
||||
$this->vatNumber = "FR".$cle.$this->siren;
|
||||
$this->vatNumber = "FR".$this->cle.$this->siren;
|
||||
if ($cle !== null) {
|
||||
$this->vatDefined = true;
|
||||
return true;
|
||||
} elseif ($cle === null && $dateMaj >= $dateRef) {
|
||||
$cle = $this->cle;
|
||||
$this->vatDefined = false;
|
||||
return true;
|
||||
}
|
||||
@ -141,103 +141,74 @@ class Metier_Partenaires_MTva
|
||||
*/
|
||||
protected function getRemoteVAT()
|
||||
{
|
||||
$nbIndispo = 0;
|
||||
while (true) {
|
||||
$postData = array(
|
||||
'memberStateCode' => "FR",
|
||||
'number' => $this->cle.$this->siren,
|
||||
'traderName' => "",
|
||||
'traderStreet' => "",
|
||||
'traderPostalCode' => "",
|
||||
'traderCity' => "",
|
||||
'requesterMemberStateCode' => "",
|
||||
'requesterNumber' => "",
|
||||
'action' => "check",
|
||||
'check' => "Vérifier",
|
||||
);
|
||||
$tdeb = microtime(true);
|
||||
$url = 'http://ec.europa.eu/taxation_customs/vies/vatRequest.html';
|
||||
$referer = 'http://ec.europa.eu/taxation_customs/vies/';
|
||||
$page = getUrl($url, '', $postData, $referer, false, 'ec.europa.eu', '', 15);
|
||||
$duree = round(microtime(true)-$tdeb, 3);
|
||||
if ($page['err_num'] != 0) {
|
||||
Metier_Util_Log::write('W', 'TVA Erreur CURL n°'. $page['err_num'] .', '. $page['err_msg'] ." sur le Siren $this->siren, numéro de TVA = FR $cle $this->siren. Durée = $duree s !", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
$this->vatNumber = "FR".$this->cle.$this->siren;
|
||||
$this->vatDefined = false;
|
||||
$url = 'http://ec.europa.eu/taxation_customs/vies/vatResponse.html';
|
||||
|
||||
return true;
|
||||
}
|
||||
$client = new Client();
|
||||
try {
|
||||
$timeStart = microtime(true);
|
||||
$response = $client->request('POST', $url, [
|
||||
'form_params' => [
|
||||
'memberStateCode' => "FR",
|
||||
'number' => $this->cle.$this->siren,
|
||||
'traderName' => "",
|
||||
'traderStreet' => "",
|
||||
'traderPostalCode' => "",
|
||||
'traderCity' => "",
|
||||
'requesterMemberStateCode' => "",
|
||||
'requesterNumber' => "",
|
||||
'action' => "check",
|
||||
'check' => "Vérifier",
|
||||
],
|
||||
]);
|
||||
$timeStop = microtime(true);
|
||||
$time = $timeStop - $timeStart;
|
||||
|
||||
$code = $page['code'];// Code réponse Serveur
|
||||
$body = $page['body'];
|
||||
$header = $page['header'];
|
||||
if (preg_match('/Yes, valid VAT number/i', $body) || preg_match('/Oui, numéro de TVA valide/i', $body)) {
|
||||
$tabInsert = array(
|
||||
'siren' => $this->siren,
|
||||
'cle' => $this->cle,
|
||||
'duree' => $duree
|
||||
);
|
||||
if (!$this->iDb->insert('sdv1.siren_tva', $tabInsert)) {
|
||||
$tabUpdate = array(
|
||||
'cle' => $this->cle,
|
||||
'duree' => $duree
|
||||
);
|
||||
if (!$this->iDb->update('sdv1.siren_tva', $tabUpdate, "siren=$this->siren")) {
|
||||
Metier_Util_Log::write('W', "Siren $this->siren, numéro de TVA = FR $this->cle $this->siren, impossible de MAJ la clef ($duree s) - ERREUR MySql n°". mysql_errno() .' : '. mysql_error(), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
}
|
||||
}
|
||||
Metier_Util_Log::write('I', "Siren $this->siren, numéro de TVA = FR $$this->cle $siren ($duree s)", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
$this->vatNumber = "FR".$this->cle.$this->siren;
|
||||
$this->vatDefined = true;
|
||||
return true;
|
||||
} elseif (strpos($body, 'Service non disponible') > 0 || strpos($body, 'ponse trop long.') > 0) {
|
||||
$nbIndispo++;
|
||||
if ($nbIndispo < 3) {
|
||||
Metier_Util_Log::write('I', "TVA Siren $this->siren, Service de l'état membre indisponible. Mise en sommeil...", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
sleep(rand(1, 2));
|
||||
$nbIndispo = 0;
|
||||
} else {
|
||||
$tabInsert = array(
|
||||
'siren' => $this->siren,
|
||||
'cle' => 'NULL',
|
||||
'duree' => $duree
|
||||
);
|
||||
$tabUpdate = array(
|
||||
'cle' => 'NULL',
|
||||
'duree' => $duree
|
||||
);
|
||||
if (!$this->iDb->insert('sdv1.siren_tva', $tabInsert)) {
|
||||
if (!$this->iDb->update('sdv1.siren_tva', $tabUpdate, "siren=$this->siren")) {
|
||||
Metier_Util_Log::write('W', "Siren $this->siren, numéro de TVA = FR $this->cle $this->siren, impossible de MAJ la clef ($duree s) - ERREUR MySql n°". mysql_errno() .' : '. mysql_error(), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
if ($response->getStatusCode() == 200) {
|
||||
$body = $response->getBody();
|
||||
if (preg_match('/Yes, valid VAT number/i', $body)
|
||||
|| preg_match('/Oui, numéro de TVA valide/i', $body)) {
|
||||
$tabInsert = array(
|
||||
'siren' => $this->siren,
|
||||
'cle' => $this->cle,
|
||||
'duree' => $time
|
||||
);
|
||||
if (!$this->iDb->insert('sdv1.siren_tva', $tabInsert)) {
|
||||
$tabUpdate = array(
|
||||
'cle' => $this->cle,
|
||||
'duree' => $time
|
||||
);
|
||||
if (!$this->iDb->update('sdv1.siren_tva', $tabUpdate, "siren=$this->siren")) {
|
||||
Metier_Util_Log::write('W', "Siren $this->siren, numéro de TVA = FR $this->cle $this->siren, impossible de MAJ la clef ($time s) - ERREUR MySql n°". mysql_errno() .' : '. mysql_error(), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
}
|
||||
}
|
||||
Metier_Util_Log::write('I', "Siren $this->siren, numéro de TVA = FR $this->cle $siren ($time s)", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
$this->vatNumber = "FR".$this->cle.$this->siren;
|
||||
$this->vatDefined = true;
|
||||
return true;
|
||||
}
|
||||
Metier_Util_Log::write('I', "Siren $this->siren, numéro de TVA = FR $this->cle $this->siren vérification non disponible ($duree s)", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
$this->vatNumber = "FR".$this->cle.$this->siren;
|
||||
$this->vatDefined = false;
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
$tabInsert = array(
|
||||
'siren' => $this->siren,
|
||||
'cle' => 'NULL',
|
||||
'duree' => $duree
|
||||
);
|
||||
if (!$this->iDb->insert('sdv1.siren_tva', $tabInsert)) {
|
||||
$tabUpdate = array(
|
||||
'cle' => 'NULL',
|
||||
'duree' => $duree
|
||||
);
|
||||
if (!$this->iDb->update('sdv1.siren_tva', $tabUpdate, "siren=$this->siren")) {
|
||||
Metier_Util_Log::write('W', "Siren $this->siren, numéro de TVA = FR $this->cle $this->siren, impossible de MAJ la clef ($duree s) - ERREUR MySql n°". mysql_errno() .' : '. mysql_error(), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
}
|
||||
}
|
||||
Metier_Util_Log::write('I', "Siren $this->siren, numéro de TVA = FR $this->cle $this->siren non attribué ($duree s)", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
$this->vatNumber = "FR".$this->cle.$this->siren;
|
||||
$this->vatDefined = false;
|
||||
}
|
||||
} catch (RequestException $e) {
|
||||
Metier_Util_Log::write('I', "TVA ".$e->getMessage(), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
}
|
||||
|
||||
return true;
|
||||
$tabInsert = array(
|
||||
'siren' => $this->siren,
|
||||
'cle' => 'NULL',
|
||||
'duree' => $time
|
||||
);
|
||||
$tabUpdate = array(
|
||||
'cle' => 'NULL',
|
||||
'duree' => $time
|
||||
);
|
||||
if (!$this->iDb->insert('sdv1.siren_tva', $tabInsert)) {
|
||||
if (!$this->iDb->update('sdv1.siren_tva', $tabUpdate, "siren=$this->siren")) {
|
||||
Metier_Util_Log::write('W', "Siren $this->siren, numéro de TVA = FR $this->cle $this->siren, impossible de MAJ la clef ($time s) - ERREUR MySql n°". mysql_errno() .' : '. mysql_error(), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
}
|
||||
}
|
||||
Metier_Util_Log::write('I', "Siren $this->siren, numéro de TVA = FR $this->cle $this->siren vérification non disponible ($time s)", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
$this->vatNumber = "FR".$this->cle.$this->siren;
|
||||
$this->vatDefined = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -543,6 +543,21 @@ class Scores_Extract_Dict
|
||||
'help' => "",
|
||||
'columns' => array()
|
||||
),
|
||||
'ZonePrioritaire' => array(
|
||||
'lib' => 'Zone Prioritaire',
|
||||
'help' => "",
|
||||
'columns' => array()
|
||||
),
|
||||
'AdresseDom'=> array(
|
||||
'lib' => 'AdresseDom',
|
||||
'help' => "",
|
||||
'columns' => array()
|
||||
),
|
||||
'Iris'=> array(
|
||||
'lib' => 'Iris',
|
||||
'help' => "",
|
||||
'columns' => array()
|
||||
),
|
||||
);
|
||||
|
||||
public function __construct()
|
||||
|
Loading…
Reference in New Issue
Block a user