Merge remote-tracking branch 'origin/develop'
This commit is contained in:
commit
c1575a95f0
19
README
19
README
@ -1,19 +0,0 @@
|
||||
A FAIRE
|
||||
|
||||
- Un seul fichier autoload_classmap.php
|
||||
application/
|
||||
library/Application
|
||||
library/Metier
|
||||
library/Scores
|
||||
library/SdMetier
|
||||
library/Zend
|
||||
|
||||
- Revoir les services WsScores :
|
||||
Simplification des noms {Service}/v{Version}/Config.php, Service.php, Types.php
|
||||
todo : a supprimer les anciennes class, uniquement pour reperer les changements
|
||||
|
||||
- Modifier library/framework => librairie compatible PSR-autoloading et la placer dans Metier
|
||||
|
||||
- Nouveau batch genTypes.php : permet de générer automatiquement la config à partir du fichier type
|
||||
|
||||
- Faire la nouvelle librairie Scoring : Intégration plus modulaire
|
@ -9,11 +9,6 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||
define('MYSQL_HOST', $config->profil->db->metier->params->host);
|
||||
define('MYSQL_USER', $config->profil->db->metier->params->username);
|
||||
define('MYSQL_PASS', $config->profil->db->metier->params->password);
|
||||
define('MYSQL_DEFAULT_DB', 'jo');
|
||||
define('MYSQL_SQL_LOG', 'NONE');
|
||||
|
||||
define('DOC_WEB_LOCAL' , $config->profil->path->shared.'/files/');
|
||||
define('DOC_WEB_URL' , '/fichier/');
|
||||
define('LOG_PATH' , $config->profil->path->shared.'/log');
|
||||
|
||||
// Entreprise
|
||||
@ -40,12 +35,6 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||
define('SPHINX_HOST', $config->profil->sphinx->ent->host);
|
||||
define('SPHINX_PORT', intval($config->profil->sphinx->ent->port));
|
||||
|
||||
define('INFOGREFFE_DISPO_WEB', false);
|
||||
define('INFOGREFFE_DISPO_WS', false);
|
||||
define('INFOGREFFE_WS_URL', 'https://webservices.infogreffe.fr/WSContextInfogreffe/INFOGREFFE');
|
||||
define('INFOGREFFE_WS_USER', '85000109');
|
||||
define('INFOGREFFE_WS_PASS', '166');
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
@ -82,15 +71,15 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||
);
|
||||
|
||||
$view->headLink()
|
||||
->appendStylesheet('/libs/bootstrap-3.3.6/css/bootstrap.min.css', 'all')
|
||||
->appendStylesheet('/themes/default/css/docs.css', 'all')
|
||||
->appendStylesheet('/themes/default/css/main.css', 'all');
|
||||
->appendStylesheet('/assets/libs/bootstrap-3.3.7/css/bootstrap.min.css', 'all')
|
||||
->appendStylesheet('/assets/themes/default/css/docs.css', 'all')
|
||||
->appendStylesheet('/assets/themes/default/css/main.css', 'all');
|
||||
|
||||
$view->headScript()
|
||||
->appendFile('/libs/html5shiv.min.js', 'text/javascript', array('conditional' => 'lt IE 9'))
|
||||
->appendFile('/libs/respond.min.js', 'text/javascript', array('conditional' => 'lt IE 9'))
|
||||
->appendFile('/libs/jquery-1.12.0.min.js', 'text/javascript')
|
||||
->appendFile('/libs/bootstrap-3.3.6/js/bootstrap.min.js', 'text/javascript');
|
||||
->appendFile('/assets/libs/html5shiv.min.js', 'text/javascript', array('conditional' => 'lt IE 9'))
|
||||
->appendFile('/assets/libs/respond.min.js', 'text/javascript', array('conditional' => 'lt IE 9'))
|
||||
->appendFile('/assets/libs/jquery-1.12.4.min.js', 'text/javascript')
|
||||
->appendFile('/assets/libs/bootstrap-3.3.7/js/bootstrap.min.js', 'text/javascript');
|
||||
|
||||
$view->headTitle()->setSeparator(' - ');
|
||||
$view->headTitle('Web Service API - Scores & Decisions');
|
||||
@ -104,8 +93,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||
|
||||
//Lire les services disponibles et créer les routes
|
||||
$services = require_once APPLICATION_PATH . '/../library/WsScore/ServicesConfig.php';
|
||||
foreach( $services as $section => $params )
|
||||
{
|
||||
foreach( $services as $section => $params ) {
|
||||
if ($params['actif']) {
|
||||
$route = new Zend_Controller_Router_Route($section.'/:version', array(
|
||||
'controller' => 'service',
|
||||
@ -114,14 +102,6 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||
'version' => '',
|
||||
));
|
||||
$router->addRoute($section, $route);
|
||||
|
||||
$route = new Zend_Controller_Router_Route('jsonrpc/'.$section.'/:version', array(
|
||||
'controller' => 'jsonrpc',
|
||||
'action' => 'index',
|
||||
'service' => $section,
|
||||
'version' => '',
|
||||
));
|
||||
$router->addRoute('jsonrpc-'.$section, $route);
|
||||
}
|
||||
}
|
||||
|
||||
@ -157,30 +137,23 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||
exit;
|
||||
}
|
||||
|
||||
$pdo = new Metier_Util_PdoLib();
|
||||
if ($pdo === false) {
|
||||
if (APPLICATION_ENV == 'development') {
|
||||
echo '<pre>'; print_r($e); echo '</pre>';
|
||||
} else {
|
||||
echo "Le service rencontre actuellement un problème technique.";
|
||||
}
|
||||
exit;
|
||||
}
|
||||
Zend_Registry::set('pdo', $pdo);
|
||||
|
||||
/**
|
||||
* Set the default adapter to use with all model
|
||||
*/
|
||||
Zend_Db_Table::setDefaultAdapter($db);
|
||||
}
|
||||
|
||||
protected function _initWsDebug()
|
||||
{
|
||||
$autoloader = Zend_Loader_Autoloader::getInstance();
|
||||
$autoloader->registerNamespace('WsDebug');
|
||||
|
||||
$options = array(
|
||||
'plugins' => array(
|
||||
'Exception',
|
||||
),
|
||||
);
|
||||
|
||||
$debug = new WsDebug_Controller_Plugin_Debug($options);
|
||||
|
||||
$this->bootstrap('frontController');
|
||||
$frontController = $this->getResource('frontController');
|
||||
$frontController->registerPlugin($debug);
|
||||
}
|
||||
|
||||
protected function _initCache()
|
||||
{
|
||||
if ( APPLICATION_ENV!='development' ) {
|
||||
|
@ -1,78 +0,0 @@
|
||||
<?php
|
||||
class ImportController extends Zend_Controller_Action
|
||||
{
|
||||
|
||||
public function fileformAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
|
||||
$this->view->inlineScript()->appendFile('/scripts/jquery.form.js');
|
||||
$this->view->inlineScript()->appendFile('/scripts/jqueryprogressbar.js');
|
||||
|
||||
$this->view->assign('filesize', ini_get('upload_max_filesize'));
|
||||
|
||||
$request = $this->getRequest();
|
||||
$idClient = $request->getParam('idClient', null);
|
||||
$login = $request->getParam('login', null);
|
||||
|
||||
$this->view->assign('idClient', $idClient);
|
||||
$this->view->assign('login', $login);
|
||||
}
|
||||
|
||||
public function fileuploadAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$request = $this->getRequest();
|
||||
$idClient = $request->getParam('idClient');
|
||||
$login = $request->getParam('login');
|
||||
|
||||
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'path');
|
||||
$path = realpath($config->data).'/validation';
|
||||
if(!file_exists($path)) mkdir($path);
|
||||
|
||||
if ( isset($_FILES) && count($_FILES)==1 ){
|
||||
$n = $_FILES['fichier']['name'];
|
||||
$s = $_FILES['fichier']['size'];
|
||||
$tmp_name = $_FILES['fichier']['tmp_name'];
|
||||
|
||||
$extValide = array('csv');
|
||||
$extension = strrchr($n,'.');
|
||||
$extension = substr($extension,1);
|
||||
//Vérifier l'extension du fichier
|
||||
if(!in_array($extension, $extValide)){
|
||||
echo "Extension de fichier incorrect !";
|
||||
} elseif (move_uploaded_file($tmp_name, $path.'/'.$idClient.'-'.$name.'.'.$extension)){
|
||||
echo "Fichier envoyé, <a href=\"".
|
||||
$this->view->url(array(
|
||||
'controller' => 'import',
|
||||
'action' => 'checkfile',
|
||||
'file' => $idClient.'-'.$name.'.'.$extension,
|
||||
))."\">Vérifier le format</a>";
|
||||
} else {
|
||||
echo "Erreur : ".$_FILES['fichier']['error'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Etat de progression de l'upload du fichier
|
||||
*/
|
||||
public function fileprogressAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$request = $this->getRequest();
|
||||
$key = $request->getParam('key', '');
|
||||
if (!empty($key)) {
|
||||
//$rep sera égal à false si la clef n'existe pas dans le cache apc
|
||||
$rep = apc_fetch('upload_'.$key);
|
||||
echo json_encode($rep);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,7 +1,9 @@
|
||||
<?php
|
||||
use League\Csv\Writer;
|
||||
|
||||
class RefController extends Zend_Controller_Action
|
||||
{
|
||||
public function indexAction ()
|
||||
public function indexAction()
|
||||
{
|
||||
//Ne fait rien...
|
||||
}
|
||||
@ -9,7 +11,7 @@ class RefController extends Zend_Controller_Action
|
||||
/**
|
||||
* Donne accès au fichier
|
||||
*/
|
||||
public function fichierAction ()
|
||||
public function fichierAction()
|
||||
{
|
||||
//Lecture du nom du fichier
|
||||
$fichier = $this->_getParam('q','');
|
||||
@ -54,7 +56,7 @@ class RefController extends Zend_Controller_Action
|
||||
/**
|
||||
* Donne accès aux données contenues dans une table de base de données
|
||||
*/
|
||||
public function tableAction ()
|
||||
public function tableAction()
|
||||
{
|
||||
$requetesql = $this->_getParam('q','');
|
||||
$fichierCsv = $requetesql.'.csv';
|
||||
@ -64,33 +66,27 @@ class RefController extends Zend_Controller_Action
|
||||
$c = Zend_Registry::get('config');
|
||||
$path = $c->profil->path->shared . '/files/fichiers/';
|
||||
if (!is_dir($path)) { mkdir($path); }
|
||||
if (!empty($requetesql))
|
||||
{
|
||||
if (!file_exists($path . $fichierCsv))
|
||||
{
|
||||
if (file_exists('assets/sql/'.$fichierSql))
|
||||
{
|
||||
if (!empty($requetesql)) {
|
||||
if (!file_exists($path . $fichierCsv)) {
|
||||
if (file_exists('assets/sql/'.$fichierSql)) {
|
||||
//Connexion mysql
|
||||
$sql = file_get_contents('assets/sql/'.$fichierSql);
|
||||
$db = Zend_Db_Table_Abstract::getDefaultAdapter();
|
||||
$rows = $db->fetchAll($sql);
|
||||
if (count($rows) > 0) {
|
||||
$fp = fopen($path . $fichierCsv.'.tmp', 'w');
|
||||
//Write header
|
||||
$headers = array_keys($rows[0]);
|
||||
fputcsv($fp, $headers, ',', '"');
|
||||
//Write content
|
||||
$csv = Writer::createFromPath($path . $fichierCsv.'.tmp', 'w');
|
||||
$csv->setNewline("\r\n");
|
||||
$csv->insertOne($headers);
|
||||
foreach($rows as $fields) {
|
||||
fputcsv($fp, $fields, ',', '"');
|
||||
$csv->insertOne($fields);
|
||||
}
|
||||
fclose($fp);
|
||||
rename($path . $fichierCsv.'.tmp', $path . $fichierCsv);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists($path . $fichierCsv))
|
||||
{
|
||||
if (file_exists($path . $fichierCsv)) {
|
||||
$this->_helper->layout->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
//Distribution du fichier sur la sortie standard
|
||||
|
@ -10,7 +10,7 @@ class UserController extends Zend_Controller_Action
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
|
||||
$this->view->headLink()->appendStylesheet('/themes/default/css/signin.css', 'all');
|
||||
$this->view->headLink()->appendStylesheet('/assets/themes/default/css/signin.css', 'all');
|
||||
|
||||
$this->view->headTitle()->append('Connexion');
|
||||
$form = new Application_Form_Login();
|
||||
|
@ -3,7 +3,8 @@
|
||||
"description": "Webservice API",
|
||||
"require": {
|
||||
"zendframework/zendframework1": "^1.12",
|
||||
"geshi/geshi": "dev-master"
|
||||
"geshi/geshi": "dev-master",
|
||||
"league/csv": "^8.0"
|
||||
},
|
||||
"include-path": ["library/"],
|
||||
"autoload": {
|
||||
@ -11,8 +12,7 @@
|
||||
"application/",
|
||||
"library/Application/",
|
||||
"library/Metier/",
|
||||
"library/Scores/",
|
||||
"library/SdMetier/"
|
||||
"library/Scores/"
|
||||
]
|
||||
},
|
||||
"authors": [
|
||||
|
75
composer.lock
generated
75
composer.lock
generated
@ -4,8 +4,8 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"hash": "9dfabcd79bf953c5c15bfbcae71c1b8a",
|
||||
"content-hash": "afcae0beeea0527e5823708ba9a42a31",
|
||||
"hash": "dda6be5b69d5c318a8e33dd89df51d2c",
|
||||
"content-hash": "42e509fca9c9b79fd71b701521d202e1",
|
||||
"packages": [
|
||||
{
|
||||
"name": "geshi/geshi",
|
||||
@ -45,17 +45,74 @@
|
||||
"time": "2016-02-01 23:14:34"
|
||||
},
|
||||
{
|
||||
"name": "zendframework/zendframework1",
|
||||
"version": "1.12.18",
|
||||
"name": "league/csv",
|
||||
"version": "8.1.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/zendframework/zf1.git",
|
||||
"reference": "bc3f2652f305fc43565af1570db83dda05578e4f"
|
||||
"url": "https://github.com/thephpleague/csv.git",
|
||||
"reference": "3b22a40804aa0bc5224ffb2f5e8248edf0a9a38c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/zendframework/zf1/zipball/bc3f2652f305fc43565af1570db83dda05578e4f",
|
||||
"reference": "bc3f2652f305fc43565af1570db83dda05578e4f",
|
||||
"url": "https://api.github.com/repos/thephpleague/csv/zipball/3b22a40804aa0bc5224ffb2f5e8248edf0a9a38c",
|
||||
"reference": "3b22a40804aa0bc5224ffb2f5e8248edf0a9a38c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-mbstring": "*",
|
||||
"php": ">=5.5.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"friendsofphp/php-cs-fixer": "^1.9",
|
||||
"phpunit/phpunit": "^4.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "8.0-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"League\\Csv\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Ignace Nyamagana Butera",
|
||||
"email": "nyamsprod@gmail.com",
|
||||
"homepage": "https://github.com/nyamsprod/",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "Csv data manipulation made easy in PHP",
|
||||
"homepage": "http://csv.thephpleague.com",
|
||||
"keywords": [
|
||||
"csv",
|
||||
"export",
|
||||
"filter",
|
||||
"import",
|
||||
"read",
|
||||
"write"
|
||||
],
|
||||
"time": "2016-09-05 08:16:07"
|
||||
},
|
||||
{
|
||||
"name": "zendframework/zendframework1",
|
||||
"version": "1.12.20",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/zendframework/zf1.git",
|
||||
"reference": "737ef159654fbbef37cf9af742b2c8f9690c2ece"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/zendframework/zf1/zipball/737ef159654fbbef37cf9af742b2c8f9690c2ece",
|
||||
"reference": "737ef159654fbbef37cf9af742b2c8f9690c2ece",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -89,7 +146,7 @@
|
||||
"ZF1",
|
||||
"framework"
|
||||
],
|
||||
"time": "2016-04-13 15:32:30"
|
||||
"time": "2016-09-08 14:50:34"
|
||||
}
|
||||
],
|
||||
"packages-dev": [],
|
||||
|
26
docs/VHOST
26
docs/VHOST
@ -51,18 +51,6 @@ Development
|
||||
RewriteRule ^.*$ index.php [NC,L]
|
||||
</IfModule>
|
||||
</Directory>
|
||||
|
||||
<Directory /home/vhosts/webservice/public/themes/>
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine Off
|
||||
</IfModule>
|
||||
</Directory>
|
||||
|
||||
<Directory /home/vhosts/webservice/public/libs/>
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine Off
|
||||
</IfModule>
|
||||
</Directory>
|
||||
|
||||
<Directory /home/vhosts/webservice/public/assets/>
|
||||
<IfModule mod_rewrite.c>
|
||||
@ -114,19 +102,7 @@ Production
|
||||
RewriteRule ^.*$ index.php [NC,L]
|
||||
</IfModule>
|
||||
</Directory>
|
||||
|
||||
<Directory /home/vhosts/webservice/current/public/themes/>
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine Off
|
||||
</IfModule>
|
||||
</Directory>
|
||||
|
||||
<Directory /home/vhosts/webservice/current/public/libs/>
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine Off
|
||||
</IfModule>
|
||||
</Directory>
|
||||
|
||||
|
||||
<Directory /home/vhosts/webservice/current/public/assets/>
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine Off
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +0,0 @@
|
||||
<?php
|
||||
class Metier_Common_Chiffre
|
||||
{
|
||||
|
||||
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
<?php
|
||||
class Metier_Common_Date
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
<?php
|
||||
class Metier_Common_Debug
|
||||
{
|
||||
|
||||
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
<?php
|
||||
class Metier_Common_Ftp
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
<?php
|
||||
class Metier_Common_Mysql
|
||||
{
|
||||
|
||||
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
<?php
|
||||
class Metier_Common_String
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
<?php
|
||||
class Metier_Common_Utils
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
0
library/SdMetier/Ctx/AffaireStatus.php → library/Metier/Ctx/AffaireStatus.php
Normal file → Executable file
0
library/SdMetier/Ctx/AffaireStatus.php → library/Metier/Ctx/AffaireStatus.php
Normal file → Executable file
62
library/SdMetier/Defaillance/Detect.php → library/Metier/Defaillance/Detect.php
Normal file → Executable file
62
library/SdMetier/Defaillance/Detect.php → library/Metier/Defaillance/Detect.php
Normal file → Executable file
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
class SdMetier_Defaillance_Detect
|
||||
class Metier_Defaillance_Detect
|
||||
{
|
||||
protected $debug = false;
|
||||
|
||||
@ -8,37 +8,37 @@ class SdMetier_Defaillance_Detect
|
||||
* @var string
|
||||
*/
|
||||
protected $FJ;
|
||||
|
||||
|
||||
/**
|
||||
* Date de cloture du bilan (AAAAMMJJ)
|
||||
* @var string
|
||||
*/
|
||||
protected $BilanCloture;
|
||||
|
||||
|
||||
/**
|
||||
* Actif Insee
|
||||
* @var int
|
||||
*/
|
||||
protected $InseeActif;
|
||||
|
||||
|
||||
/**
|
||||
* Actif RCS
|
||||
* @var unknown
|
||||
*/
|
||||
protected $RcsActif;
|
||||
|
||||
|
||||
/**
|
||||
* Nombre d'établissement actif
|
||||
* @var int
|
||||
*/
|
||||
protected $EtabActifNb;
|
||||
|
||||
|
||||
/**
|
||||
* Rgsitre des métiers
|
||||
* @var int
|
||||
*/
|
||||
protected $NumRM;
|
||||
|
||||
|
||||
/**
|
||||
* RCS
|
||||
* @var int
|
||||
@ -63,7 +63,7 @@ class SdMetier_Defaillance_Detect
|
||||
protected $ProcolMaxYear = 12;
|
||||
|
||||
protected $Even;
|
||||
protected $EvenDateJugement;
|
||||
protected $EvenDateJugement;
|
||||
protected $EvenTxt;
|
||||
protected $EvenDelete = 0;
|
||||
|
||||
@ -110,18 +110,18 @@ class SdMetier_Defaillance_Detect
|
||||
{
|
||||
$this->RcsActif = $val;
|
||||
}
|
||||
|
||||
public function setEtabActif($val)
|
||||
|
||||
public function setEtabActif($val)
|
||||
{
|
||||
$this->EtabActifNb = $val;
|
||||
}
|
||||
|
||||
public function setRM($val)
|
||||
|
||||
public function setRM($val)
|
||||
{
|
||||
$this->IsRM = $val;
|
||||
}
|
||||
|
||||
public function setGreffe($val)
|
||||
|
||||
public function setGreffe($val)
|
||||
{
|
||||
$this->IsRCS = $val;
|
||||
}
|
||||
@ -161,7 +161,7 @@ class SdMetier_Defaillance_Detect
|
||||
*/
|
||||
public function planEnd()
|
||||
{
|
||||
$calc = \DateTime::createFromFormat('Ymd', $this->PlanDateStart);
|
||||
$calc = \DateTime::createFromFormat('Ymd', $this->PlanDateStart);
|
||||
$interval = new \DateInterval('P'.$this->PlanPeriod.'M');
|
||||
$calc->add($interval);
|
||||
$this->PlanDateEnd = $calc->format('Ymd');
|
||||
@ -192,9 +192,9 @@ class SdMetier_Defaillance_Detect
|
||||
public function parse($ann)
|
||||
{
|
||||
$this->Even = $ann->code;
|
||||
$this->EvenDateJugement = $ann->date;
|
||||
$this->EvenDateJugement = $ann->date;
|
||||
$this->EvenTxt = $ann->txt;
|
||||
|
||||
|
||||
if ($this->debug) {
|
||||
file_put_contents('procol.log', "Annonce : ".$ann->date . '-' . $ann->code."\n", FILE_APPEND);
|
||||
}
|
||||
@ -218,7 +218,7 @@ class SdMetier_Defaillance_Detect
|
||||
|
||||
// Lancement des règles
|
||||
$this->rules();
|
||||
|
||||
|
||||
if ($this->debug) {
|
||||
file_put_contents('procol.log', "\n", FILE_APPEND);
|
||||
}
|
||||
@ -233,7 +233,7 @@ class SdMetier_Defaillance_Detect
|
||||
$setSituation = false;
|
||||
// Parcours des règles
|
||||
foreach ($rules as $rule) {
|
||||
if ($this->debug) {
|
||||
if ($this->debug) {
|
||||
file_put_contents('procol.log', $rule['name']."\n", FILE_APPEND);
|
||||
}
|
||||
$result = $this->params($rule['params']);
|
||||
@ -251,13 +251,13 @@ class SdMetier_Defaillance_Detect
|
||||
);
|
||||
file_put_contents('procol.log', print_r($this->Timeline,1)."\n", FILE_APPEND);
|
||||
}
|
||||
|
||||
|
||||
if ($this->debug) {
|
||||
if ($result === true) {
|
||||
file_put_contents('procol.log', "=> OK\n", FILE_APPEND);
|
||||
} else {
|
||||
file_put_contents('procol.log', "=> PASS\n", FILE_APPEND);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -270,19 +270,19 @@ class SdMetier_Defaillance_Detect
|
||||
{
|
||||
$cNb = count($conditions);
|
||||
$cIncr = 1;
|
||||
foreach ($conditions as $cond)
|
||||
foreach ($conditions as $cond)
|
||||
{
|
||||
if ($this->debug) {
|
||||
file_put_contents('procol.log', "\t".$cond['var']." ".$cond['op']." ".$cond['value']."\n", FILE_APPEND);
|
||||
}
|
||||
$result = $this->paramEval($cond['var'], $cond['op'], $cond['value']);
|
||||
$result = $this->paramEval($cond['var'], $cond['op'], $cond['value']);
|
||||
if ($result === false) {
|
||||
return false;
|
||||
}
|
||||
if ($cNb == $cIncr) {
|
||||
return true;
|
||||
}
|
||||
$cIncr++;
|
||||
$cIncr++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -300,15 +300,15 @@ class SdMetier_Defaillance_Detect
|
||||
if ( is_array($val) ) {
|
||||
return $val;
|
||||
}
|
||||
|
||||
|
||||
if ( is_string($val) && property_exists($this, $val)) {
|
||||
return $this->{$val};
|
||||
}
|
||||
|
||||
|
||||
if ( is_string($val) && defined('self::'.$val) ) {
|
||||
return constant('self::'.$val);
|
||||
}
|
||||
|
||||
|
||||
if ( is_string($val) ) {
|
||||
return $val;
|
||||
}
|
||||
@ -324,10 +324,10 @@ class SdMetier_Defaillance_Detect
|
||||
* @return boolean|NULL
|
||||
*/
|
||||
protected function paramEval($var, $op, $value)
|
||||
{
|
||||
{
|
||||
// Operation
|
||||
switch ($op) {
|
||||
case 'SET':
|
||||
case 'SET':
|
||||
$this->{$var} = $value;
|
||||
if ($this->debug) {
|
||||
file_put_contents('procol.log', "\t\tSET ".$var." = ".$value."\n", FILE_APPEND);
|
||||
@ -363,10 +363,10 @@ class SdMetier_Defaillance_Detect
|
||||
if ($this->debug) {
|
||||
file_put_contents('procol.log', "\t".$this->{$var}." = ".$value."\n", FILE_APPEND);
|
||||
}
|
||||
if ( in_array($this->{$var}, $valueReal) ) {
|
||||
if ( in_array($this->{$var}, $valueReal) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ( $this->{$var} == $valueReal ) {
|
||||
if ($this->debug) {
|
||||
file_put_contents('procol.log', "\t".$this->{$var}." = ".$valueReal."\n", FILE_APPEND);
|
@ -8,6 +8,7 @@
|
||||
* PA : Appel de jugement
|
||||
* A : Absorbtion
|
||||
* D : Dissolution
|
||||
* CL : Cloture
|
||||
*/
|
||||
return array(
|
||||
// --- Départ du plan
|
||||
@ -295,7 +296,7 @@ return array(
|
||||
),
|
||||
),
|
||||
// Situation = ''
|
||||
// NumGreffe
|
||||
// NumGreffe
|
||||
// InseeActif = 0
|
||||
// SituationJuridique = RR
|
||||
|
||||
@ -307,14 +308,14 @@ return array(
|
||||
array( 'var' => 'Situation', 'op' => 'EGAL', 'value' => ''),
|
||||
array( 'var' => 'Even', 'op' => 'EGAL', 'value' => 'ListEvenRadiation'),
|
||||
array( 'var' => 'EtabActifNb', 'op' => 'EGAL', 'value' => 0),
|
||||
array( 'var' => 'Situation', 'op' => 'SET', 'value' => 'RP'),
|
||||
array( 'var' => 'Situation', 'op' => 'SET', 'value' => 'RP'),
|
||||
),
|
||||
),
|
||||
// Situation = ''
|
||||
// EtabActifNb = 0
|
||||
// Even = ListEvenRadiation
|
||||
// SituationJuridique = RP
|
||||
|
||||
|
||||
// Radiation Publié 2
|
||||
array(
|
||||
'name' => 'RADIATION-PUB2',
|
||||
@ -323,7 +324,7 @@ return array(
|
||||
array( 'var' => 'Situation', 'op' => 'EGAL', 'value' => ''),
|
||||
array( 'var' => 'Even', 'op' => 'EGAL', 'value' => 'ListEvenRadiation'),
|
||||
array( 'var' => 'InseeActif', 'op' => 'EGAL', 'value' => 0),
|
||||
array( 'var' => 'IsRCS', 'op' => 'EGAL', 'value' => 1),
|
||||
array( 'var' => 'IsRCS', 'op' => 'EGAL', 'value' => 1),
|
||||
array( 'var' => 'Situation', 'op' => 'SET', 'value' => 'RP'),
|
||||
),
|
||||
),
|
0
library/SdMetier/Defaillance/ProcolDelete.php → library/Metier/Defaillance/ProcolDelete.php
Normal file → Executable file
0
library/SdMetier/Defaillance/ProcolDelete.php → library/Metier/Defaillance/ProcolDelete.php
Normal file → Executable file
0
library/SdMetier/Graydon/README → library/Metier/Graydon/README
Normal file → Executable file
0
library/SdMetier/Graydon/README → library/Metier/Graydon/README
Normal file → Executable file
2
library/SdMetier/Graydon/Service.php → library/Metier/Graydon/Service.php
Normal file → Executable file
2
library/SdMetier/Graydon/Service.php → library/Metier/Graydon/Service.php
Normal file → Executable file
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
class SdMetier_Graydon_Service extends Zend_Soap_Client
|
||||
class Metier_Graydon_Service extends Zend_Soap_Client
|
||||
{
|
||||
protected $PartnerClientId = '32790';
|
||||
protected $PartnerUserId = 'SESS38R7';
|
0
library/SdMetier/Graydon/Wsdl/GraydonCompanyData.wsdl → library/Metier/Graydon/Wsdl/GraydonCompanyData.wsdl
Normal file → Executable file
0
library/SdMetier/Graydon/Wsdl/GraydonCompanyData.wsdl → library/Metier/Graydon/Wsdl/GraydonCompanyData.wsdl
Normal file → Executable file
0
library/SdMetier/Graydon/Wsdl/GraydonUKCommonTypes.xsd → library/Metier/Graydon/Wsdl/GraydonUKCommonTypes.xsd
Normal file → Executable file
0
library/SdMetier/Graydon/Wsdl/GraydonUKCommonTypes.xsd → library/Metier/Graydon/Wsdl/GraydonUKCommonTypes.xsd
Normal file → Executable file
0
library/SdMetier/Graydon/_sample/GraydonCompanyData.wsdl → library/Metier/Graydon/_sample/GraydonCompanyData.wsdl
Normal file → Executable file
0
library/SdMetier/Graydon/_sample/GraydonCompanyData.wsdl → library/Metier/Graydon/_sample/GraydonCompanyData.wsdl
Normal file → Executable file
0
library/SdMetier/Graydon/_sample/Readme.txt → library/Metier/Graydon/_sample/Readme.txt
Normal file → Executable file
0
library/SdMetier/Graydon/_sample/Readme.txt → library/Metier/Graydon/_sample/Readme.txt
Normal file → Executable file
0
library/SdMetier/Graydon/_sample/checkorders.php → library/Metier/Graydon/_sample/checkorders.php
Normal file → Executable file
0
library/SdMetier/Graydon/_sample/checkorders.php → library/Metier/Graydon/_sample/checkorders.php
Normal file → Executable file
0
library/SdMetier/Graydon/_sample/companyproducts.php → library/Metier/Graydon/_sample/companyproducts.php
Normal file → Executable file
0
library/SdMetier/Graydon/_sample/companyproducts.php → library/Metier/Graydon/_sample/companyproducts.php
Normal file → Executable file
0
library/SdMetier/Graydon/_sample/getCompanyMatchesByKeyword.php → library/Metier/Graydon/_sample/getCompanyMatchesByKeyword.php
Normal file → Executable file
0
library/SdMetier/Graydon/_sample/getCompanyMatchesByKeyword.php → library/Metier/Graydon/_sample/getCompanyMatchesByKeyword.php
Normal file → Executable file
2
library/SdMetier/Infogreffe/DocAC.php → library/Metier/Infogreffe/DocAC.php
Normal file → Executable file
2
library/SdMetier/Infogreffe/DocAC.php → library/Metier/Infogreffe/DocAC.php
Normal file → Executable file
@ -4,7 +4,7 @@ require_once dirname(__FILE__) . '/Service.php';
|
||||
/**
|
||||
* Infogreffe : Document Acte
|
||||
*/
|
||||
class SdMetier_Infogreffe_DocAC extends SdMetier_Infogreffe_Service
|
||||
class Metier_Infogreffe_DocAC extends Metier_Infogreffe_Service
|
||||
{
|
||||
|
||||
const INT = 1000;
|
2
library/SdMetier/Infogreffe/DocBI.php → library/Metier/Infogreffe/DocBI.php
Normal file → Executable file
2
library/SdMetier/Infogreffe/DocBI.php → library/Metier/Infogreffe/DocBI.php
Normal file → Executable file
@ -4,7 +4,7 @@ require_once dirname(__FILE__) . '/Service.php';
|
||||
/**
|
||||
* Infogreffe : Document Bilan
|
||||
*/
|
||||
class SdMetier_Infogreffe_DocBI extends SdMetier_Infogreffe_Service
|
||||
class Metier_Infogreffe_DocBI extends Metier_Infogreffe_Service
|
||||
{
|
||||
|
||||
const INT = 1000;
|
2
library/SdMetier/Infogreffe/DocST.php → library/Metier/Infogreffe/DocST.php
Normal file → Executable file
2
library/SdMetier/Infogreffe/DocST.php → library/Metier/Infogreffe/DocST.php
Normal file → Executable file
@ -4,7 +4,7 @@ require_once dirname(__FILE__) . '/Service.php';
|
||||
/**
|
||||
* Infogreffe : Document Statut
|
||||
*/
|
||||
class SdMetier_Infogreffe_DocST extends SdMetier_Infogreffe_Service
|
||||
class Metier_Infogreffe_DocST extends Metier_Infogreffe_Service
|
||||
{
|
||||
|
||||
/**
|
0
library/SdMetier/Infogreffe/README → library/Metier/Infogreffe/README
Normal file → Executable file
0
library/SdMetier/Infogreffe/README → library/Metier/Infogreffe/README
Normal file → Executable file
2
library/SdMetier/Infogreffe/Service.php → library/Metier/Infogreffe/Service.php
Normal file → Executable file
2
library/SdMetier/Infogreffe/Service.php → library/Metier/Infogreffe/Service.php
Normal file → Executable file
@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Infogreffe provider
|
||||
*/
|
||||
class SdMetier_Infogreffe_Service
|
||||
class Metier_Infogreffe_Service
|
||||
{
|
||||
|
||||
/**
|
0
library/SdMetier/Infogreffe/wsdl/prod.wsdl → library/Metier/Infogreffe/wsdl/prod.wsdl
Normal file → Executable file
0
library/SdMetier/Infogreffe/wsdl/prod.wsdl → library/Metier/Infogreffe/wsdl/prod.wsdl
Normal file → Executable file
0
library/SdMetier/Infogreffe/wsdl/test.wsdl → library/Metier/Infogreffe/wsdl/test.wsdl
Normal file → Executable file
0
library/SdMetier/Infogreffe/wsdl/test.wsdl → library/Metier/Infogreffe/wsdl/test.wsdl
Normal file → Executable file
@ -1,6 +1,4 @@
|
||||
<?php
|
||||
require_once 'framework/common/dates.php';
|
||||
|
||||
global $timer;
|
||||
|
||||
class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
@ -83,7 +81,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
public function __construct($db = null)
|
||||
{
|
||||
if ( $db === null ) {
|
||||
$this->iDb = new WDB();
|
||||
$this->iDb = new Metier_Util_Db();
|
||||
} else {
|
||||
$this->iDb = $db;
|
||||
}
|
||||
@ -113,59 +111,74 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
if (!empty($nic)) {
|
||||
$nic = str_pad($nic, 5, '0', STR_PAD_LEFT);
|
||||
}
|
||||
if (!valideData($siren, 9, 9,'N')) //Siren non précisé ou incorrect.
|
||||
//Siren non précisé ou incorrect.
|
||||
if (!Metier_Util_String::valideData($siren, 9, 9,'N')) {
|
||||
return $erreur;
|
||||
elseif ($siren*1==0) // Siren vide
|
||||
}
|
||||
// Siren vide
|
||||
elseif (intval($siren) == 0) {
|
||||
return $erreur;
|
||||
else
|
||||
{
|
||||
if (!isset($nic) || trim($nic)=='')
|
||||
{
|
||||
$somme=0;
|
||||
for ($i=0; $i<=8; $i+=2) // Traitement IMPAIR
|
||||
$somme+=(integer)substr($siren,$i,1);
|
||||
|
||||
for ($i=1; $i<=7; $i+=2)
|
||||
{ // Traitement PAIR
|
||||
$var_tmp=(string)(2*((integer)substr($siren,$i,1)));
|
||||
$som_tmp=0;
|
||||
for($j=0;$j<strlen($var_tmp);$j++)
|
||||
$som_tmp+=(integer)substr($var_tmp,$j,1);
|
||||
$somme+=$som_tmp;
|
||||
}
|
||||
else {
|
||||
if (!isset($nic) || trim($nic)=='') {
|
||||
$somme = 0;
|
||||
// Traitement IMPAIR
|
||||
for ($i=0; $i<=8; $i+=2) {
|
||||
$somme+= (integer) substr($siren,$i,1);
|
||||
}
|
||||
|
||||
if ((integer)($somme/10)!=($somme/10))
|
||||
{ // Le Siren est faux
|
||||
if (substr($siren,0,3)!='200') // Les siren débutant par 200 sont toujours valides (sirens provisoires de la BDF?!)
|
||||
return $erreur;
|
||||
}
|
||||
} else {
|
||||
if (!valideData($nic,1,5,'N')) // Nic de format incorrect.
|
||||
return $erreur;
|
||||
|
||||
$SIRET=$siren.$nic;
|
||||
if ($siren<>356000000) {
|
||||
$somme=0;
|
||||
for ($i=0; $i<=12; $i+=2)
|
||||
{ // Traitement PAIR
|
||||
$var_tmp=(string)(2*((integer)substr($SIRET,$i,1)));
|
||||
$som_tmp=0;
|
||||
for($j=0;$j<strlen($var_tmp);$j++)
|
||||
$som_tmp+=(integer)substr($var_tmp,$j,1);
|
||||
$somme+=$som_tmp;
|
||||
// Traitement PAIR
|
||||
for ($i=1; $i<=7; $i+=2) {
|
||||
$var_tmp = (string) (2*((integer)substr($siren,$i,1)));
|
||||
$som_tmp = 0;
|
||||
for($j=0; $j<strlen($var_tmp);$j++) {
|
||||
$som_tmp+= (integer)substr($var_tmp,$j,1);
|
||||
}
|
||||
for ($i=1; $i<=13; $i+=2) // Traitement IMPAIR
|
||||
$somme+=(integer)substr($SIRET,$i,1);
|
||||
$somme+= $som_tmp;
|
||||
}
|
||||
|
||||
if ((integer)($somme/10)!=($somme/10))// Le Siret est faux
|
||||
// Le Siren est faux
|
||||
if ((integer) ($somme/10) != ($somme/10)) {
|
||||
// Les siren débutant par 200 sont toujours valides (sirens provisoires de la BDF?!)
|
||||
if (substr($siren,0,3) != '200') {
|
||||
return $erreur;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Nic de format incorrect.
|
||||
if (!Metier_Util_String::valideData($nic,1,5,'N')) {
|
||||
return $erreur;
|
||||
}
|
||||
$SIRET = $siren.$nic;
|
||||
if ($siren != 356000000) {
|
||||
$somme=0;
|
||||
// Traitement PAIR
|
||||
for ($i=0; $i<=12; $i+=2) {
|
||||
$var_tmp = (string) (2*((integer)substr($SIRET,$i,1)));
|
||||
$som_tmp = 0;
|
||||
for($j=0; $j<strlen($var_tmp); $j++) {
|
||||
$som_tmp+= (integer) substr($var_tmp,$j,1);
|
||||
}
|
||||
$somme+= $som_tmp;
|
||||
}
|
||||
// Traitement IMPAIR
|
||||
for ($i=1; $i<=13; $i+=2) {
|
||||
$somme+= (integer) substr($SIRET,$i,1);
|
||||
}
|
||||
// Le Siret est faux
|
||||
if ((integer) ($somme/10) != ($somme/10)) {
|
||||
return $erreur;
|
||||
}
|
||||
} else {
|
||||
// Cas particulier du siren de LA POSTE : 356 000 000 00000
|
||||
$somme=14;
|
||||
for ($i=9; $i<=13; $i++)
|
||||
$somme+=(integer)substr($SIRET,$i,1);
|
||||
if ($somme%5!=0) // Le NIC de l'établissement de LA POSTE est faux !
|
||||
$somme = 14;
|
||||
for ($i=9; $i<=13; $i++) {
|
||||
$somme+= (integer)substr($SIRET,$i,1);
|
||||
}
|
||||
// Le NIC de l'établissement de LA POSTE est faux !
|
||||
if ($somme%5 != 0) {
|
||||
return $erreur;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -184,7 +197,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
{
|
||||
if (!$this->valideSiren($siren))
|
||||
return -1;
|
||||
elseif (!valideData($numEtab,1,4,'N')) // Nic de format incorrect.
|
||||
elseif (!Metier_Util_String::valideData($numEtab,1,4,'N')) // Nic de format incorrect.
|
||||
return -1;
|
||||
else {
|
||||
for ($cle=0; $cle<10; $cle++) {
|
||||
@ -278,7 +291,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
{
|
||||
$tabAdr = $this->structureVoie(strtoupper($adresse));
|
||||
$numAdresse = preg_replace('/^0+/','',''.$tabAdr['num']*1);
|
||||
$adresse = trimAccent($tabAdr['libVoie']);
|
||||
$adresse = Metier_Util_String::trimAccent($tabAdr['libVoie']);
|
||||
$formR = array(
|
||||
'type' => 'ent',
|
||||
'siret' => '',
|
||||
@ -316,7 +329,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
*/
|
||||
public function rechercheDir($nom, $prenom='', $fonction='', $dateNaiss='', $villeNaiss='', $deb=0, $nbRep=20, $maxRep=200, $pertinence=false)
|
||||
{
|
||||
debugLog('I',"rechercheDir de $nom, $prenom, $fonction, $dateNaiss, $villeNaiss (Max Rep=$nbRep)",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||
Metier_Util_Log::write('I',"rechercheDir de $nom, $prenom, $fonction, $dateNaiss, $villeNaiss (Max Rep=$nbRep)",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||
$jour=$mois=$annee='';
|
||||
if ($dateNaiss<>'' && $dateNaiss<>'//' && $dateNaiss<>'0/0/0') {
|
||||
$tabDateNaiss=explode('/', $dateNaiss);
|
||||
@ -376,8 +389,8 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
protected function setTabCodesNaf()
|
||||
{
|
||||
if (count($this->tabCodesNaf)==0) {
|
||||
$cacheNaf = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Cache' . DIRECTORY_SEPARATOR . 'CodesNaf.php';
|
||||
$cacheNace = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Cache' . DIRECTORY_SEPARATOR . 'CodesNace.php';
|
||||
$cacheNaf = dirname(__FILE__) . '/../Table/CodesNaf.php';
|
||||
$cacheNace = dirname(__FILE__) . '/../Table/CodesNace.php';
|
||||
if ( file_exists($cacheNaf) ) {
|
||||
$this->tabCodesNaf = include $cacheNaf;
|
||||
$this->tabCodesNace = include $cacheNace;
|
||||
@ -429,7 +442,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
protected function setTabCodesNafa()
|
||||
{
|
||||
if (count($this->tabCodesNafa)==0) {
|
||||
$cache = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Cache' . DIRECTORY_SEPARATOR . 'CodesNafa.php';
|
||||
$cache = dirname(__FILE__) . '/../Table/CodesNafa.php';
|
||||
if ( file_exists($cache) ) {
|
||||
$this->tabCodesNafa = include $cache;
|
||||
} else {
|
||||
@ -453,7 +466,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
if ($code == '') {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
$this->setTabCodesNafa();
|
||||
return $this->tabCodesNafa[$code];
|
||||
}
|
||||
@ -753,7 +766,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
public function getCodesFJ()
|
||||
{
|
||||
$tabFJ = array();
|
||||
$cache = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Cache' . DIRECTORY_SEPARATOR . 'CodesFJ.php';
|
||||
$cache = dirname(__FILE__) . '/../Table/CodesFJ.php';
|
||||
if ( file_exists($cache) ) {
|
||||
$tabFJ = include $cache;
|
||||
} else {
|
||||
@ -786,10 +799,10 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
if ($strLigneDAdresse=='') return $tabRet;
|
||||
$tabLignes=explode(',', preg_replace('/,$/', '', $strLigneDAdresse));
|
||||
foreach ($tabLignes as $strLigneDAdresse) {
|
||||
$strLigneDAdresse=trimAccent($strLigneDAdresse);
|
||||
$strLigneDAdresse=Metier_Util_String::trimAccent($strLigneDAdresse);
|
||||
$strLigneDAdresse=preg_replace('/[^0-9a-zA-Z]/', ' ', $strLigneDAdresse);
|
||||
$strLigneDAdresse=trim(preg_replace('/ +/', ' ', $strLigneDAdresse));
|
||||
//echo "1. Adresse nettoyées = $strLigneDAdresse".EOL;
|
||||
//echo "1. Adresse nettoyées = $strLigneDAdresse".PHP_EOL;
|
||||
$adrAvecCP=preg_match("/(.*)([0-9]{5,5}|[0-9][0-9] [0-9]{3,3})([\D]*)/", $strLigneDAdresse, $tabAdrTmp);
|
||||
if ($adrAvecCP) {
|
||||
//echo "Adresse avec Code Postal\n";
|
||||
@ -1032,7 +1045,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
}
|
||||
|
||||
if ($typeId=='TEL') {
|
||||
debugLog('I',"Recherche par TEL de $id avec un maximum de $nbRep réponses",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||
Metier_Util_Log::write('I',"Recherche par TEL de $id avec un maximum de $nbRep réponses",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||
|
||||
$tabTmp=$this->iDb->select('jo.etablissements', 'count(*)', "TEL=$id OR FAX=$id $filtreActif");
|
||||
$nbTot=$tabTmp[0][0];
|
||||
@ -1565,7 +1578,6 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
file_put_contents(LOG_PATH.'/accesDistant.log', date('YmdHis').";$siren;getIdentiteEntreprise Début ---\n", FILE_APPEND);
|
||||
}
|
||||
|
||||
$classWDate = new WDate();
|
||||
$siren = $siren*1;
|
||||
$nic = $nic*1;
|
||||
$id = $id*1;
|
||||
@ -1626,7 +1638,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
'ape_etab' => $etabG['NafEtab'],
|
||||
'ape_entrep' => $etabG['NafEnt'],
|
||||
'autre_id' => $etabG['NumRC'],
|
||||
'dateMAJ' => $classWDate->DateT('Ymd','Y-m-d',$lastMaj),
|
||||
'dateMAJ' => Metier_Util_Date::dateT('Ymd','Y-m-d',$lastMaj),
|
||||
);
|
||||
}
|
||||
$timer['accesInfogreffeCarInconnu'] = microtime(true);
|
||||
@ -2000,6 +2012,8 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
if ($tabInsee['CIVILITE']==1) $dir1Genre='M';
|
||||
elseif ($tabInsee['CIVILITE']==2) $dir1Genre='F';
|
||||
|
||||
$aprm = substr($tabInsee['APRM'], -1, 1) == 'Z' ? '' : $tabInsee['APRM'];
|
||||
|
||||
$tabRet = array(
|
||||
'id' => $etab['id'],
|
||||
'Siret' => $etab['siret'],
|
||||
@ -2098,8 +2112,8 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
'GeoInfos' => $repAmabis,
|
||||
'NonDiffusible' => $moisNonDiff,
|
||||
'TypeExploitation' => $typeExploitation,
|
||||
'DateMajINSEE' => str_replace('--','',$classWDate->dateT('Ymd','Y-m-d',$tabInsee['DATE_MAJ'])),
|
||||
'APRM' => $tabInsee['APRM'],
|
||||
'DateMajINSEE' => str_replace('--','',Metier_Util_Date::dateT('Ymd','Y-m-d',$tabInsee['DATE_MAJ'])),
|
||||
'APRM' => $aprm,
|
||||
'APRM_Lib' => $this->getLibelleNafa($tabInsee['APRM']),
|
||||
'AutreSiret' => $tabAssoc,
|
||||
'L1_NOMEN' => $tabInsee['insL1_NOMEN'], // Nom ou raison sociale de l'entreprise pour l'adressage
|
||||
@ -2172,7 +2186,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
$ret = $this->iDb->select('jo.tourisme', 'id, nom, adresse, adrCp, adrVille, nbEtoiles, typeClasse, categorie, dateClasse, tel, fax, mail, web, typeChambres, capacite', "siren=$siren AND nic=$nic", false, MYSQL_ASSOC);
|
||||
if (isset($ret[0])) {
|
||||
$tabRet['NafEtabLib'].=' ('.$ret[0]['nbEtoiles'].' étoiles le '.
|
||||
$classWDate->dateT('Y-m-d','d/m/Y',$ret[0]['dateClasse']).')';
|
||||
Metier_Util_Date::dateT('Y-m-d','d/m/Y',$ret[0]['dateClasse']).')';
|
||||
if ($tabRet['Tel']=='') $tabRet['Tel']=$ret[0]['tel'];
|
||||
if ($tabRet['Fax']=='') $tabRet['Fax']=$ret[0]['fax'];
|
||||
if ($tabRet['Web']=='') $tabRet['Web']=$ret[0]['web'];
|
||||
@ -2220,7 +2234,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
$tabRet['DateCreaEn']=$insee[0]['DCREN'];
|
||||
} else {
|
||||
$tmp=$this->getAvisInsee($siren);
|
||||
$dateCreaEn=$classWDate->dateT('Y-m-d','Ymd',$tmp['dateEtatEn']);
|
||||
$dateCreaEn=Metier_Util_Date::dateT('Y-m-d','Ymd',$tmp['dateEtatEn']);
|
||||
if (preg_match("/Prise d'activité/u", $tmp['etatEn']) &&
|
||||
$dateCreaEn>19000101) {
|
||||
$this->iDb->update('insee.identite', array(
|
||||
@ -2245,7 +2259,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
$domiciliataire=$matches[1];
|
||||
$tabRet['AdresseDom']=2;
|
||||
}
|
||||
$tabRet['AdresseDomEnt'][] = array( 'siren'=>$dom['siren'], 'nom'=>prepareString($dom['nom']) );
|
||||
$tabRet['AdresseDomEnt'][] = array( 'siren'=>$dom['siren'], 'nom'=>$dom['nom'] );
|
||||
}
|
||||
}
|
||||
$timer['adresseDom']=microtime(true);
|
||||
@ -2331,7 +2345,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
$tabDates[]=$ann['dateInsertionSD'];
|
||||
}
|
||||
rsort($tabDates);
|
||||
$tabRet['dateMajANN']=$classWDate->dateT('Y-m-d','Y-m-d',$tabDates[0]);
|
||||
$tabRet['dateMajANN']=Metier_Util_Date::dateT('Y-m-d','Y-m-d',$tabDates[0]);
|
||||
if ($tabRet['dateMajANN']=='--') $tabRet['dateMajANN']='';
|
||||
$timer['getAnnoncesLegales']=microtime(true);
|
||||
}
|
||||
@ -2649,7 +2663,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
$tabRet['numGreffe'] = $etabG['NumGreffe'];
|
||||
$tabRet['numRC'] = $etabG['NumRC2'];
|
||||
$tabRet['Enseigne'] = $etabG['Enseigne'];
|
||||
$iRncs=new Metier_Partenaires_MRncs($this->iDb);
|
||||
$iRncs = new Metier_Partenaires_MRncs($this->iDb);
|
||||
$tabRet['Tribunal'] = $iRncs->getCodeBodaccTribunal($etabG['NumGreffe']);
|
||||
}
|
||||
|
||||
@ -2858,8 +2872,8 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
}
|
||||
|
||||
$iGeffes = new Metier_Partenaires_MGreffes($this->iDb);
|
||||
$iRncs = new Metier_Partenaires_MRncs($this->iDb);
|
||||
$etabG = $iGeffes->getIdentite($siren);
|
||||
$iRncs = new Metier_Partenaires_MRncs($this->iDb);
|
||||
|
||||
if($this->debugtime) {
|
||||
$duree=round(microtime(1)-$tdeb,3);
|
||||
@ -2913,9 +2927,9 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
$tabRet['bilanMois'] = $entrep['dureeExercice'];
|
||||
$tabRet['bilanDevise'] = $entrep['monnaie'];
|
||||
if ($entrep['dateProvPartenaire']>0)
|
||||
$tabRet['bilanDateMaj']=$classWDate->dateT('Ymd','Y-m-d',$entrep['dateProvPartenaire']);
|
||||
$tabRet['bilanDateMaj']=Metier_Util_Date::dateT('Ymd','Y-m-d',$entrep['dateProvPartenaire']);
|
||||
else
|
||||
$tabRet['bilanDateMaj']=$classWDate->dateT('Y-m-d','Y-m-d',$entrep['dateInsert']);
|
||||
$tabRet['bilanDateMaj']=Metier_Util_Date::dateT('Y-m-d','Y-m-d',$entrep['dateInsert']);
|
||||
|
||||
switch (strtoupper(trim($entrep['unite']))) {
|
||||
case 'M': $unite='M'; break;
|
||||
@ -3020,7 +3034,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
$lastMaj=str_replace('-','',$tabRet['bilanDateMaj'])*1;
|
||||
if (str_replace('-','',$tabRet['dateMajANN'])*1>$lastMaj)
|
||||
$lastMaj=str_replace('-','',$tabRet['dateMajANN'])*1;
|
||||
$tabRet['dateMajIdentite']=$classWDate->dateT('Ymd','Y-m-d',$lastMaj);
|
||||
$tabRet['dateMajIdentite']=Metier_Util_Date::dateT('Ymd','Y-m-d',$lastMaj);
|
||||
|
||||
return $tabRet;
|
||||
}
|
||||
@ -3080,7 +3094,6 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
{
|
||||
$siren = intval($siren);
|
||||
$tabRet = array();
|
||||
$classWDate = new WDate();
|
||||
|
||||
if ($histo) {
|
||||
|
||||
@ -3145,13 +3158,13 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
'Prenom' => $tabDir['prenom'],
|
||||
'NomUsage' => $tabDir['nomUsage'],
|
||||
'Ancien' => $tabDir['depart'],
|
||||
'DateFct' => $classWDate->dateT('Ymd','Y-m-d', $ann['DATE']),
|
||||
'DateFct' => Metier_Util_Date::dateT('Ymd','Y-m-d', $ann['DATE']),
|
||||
);
|
||||
$this->iDb->insert('jo.bodacc_dirigeants_histo', array(
|
||||
'siren' => $siren,
|
||||
'id' => $ann['ANBASE'],
|
||||
'num' => $iDir,
|
||||
'dateEffet' => $classWDate->dateT('Ymd','Y-m-d', $ann['DATE']),
|
||||
'dateEffet' => Metier_Util_Date::dateT('Ymd','Y-m-d', $ann['DATE']),
|
||||
'fonction' => $tabDir['fonction'],
|
||||
'rs' => $tabDir['rs'],
|
||||
'nom' => $nom,
|
||||
@ -3178,15 +3191,15 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
|
||||
foreach ($dirs as $k=>$dir) {
|
||||
if ($dir['naissance_date']<>'0000-00-00') {
|
||||
$dateNaiss=$classWDate->dateT('Y-m-d','d/m/Y', $dir['naissance_date']);
|
||||
$dateNaiss=Metier_Util_Date::dateT('Y-m-d','d/m/Y', $dir['naissance_date']);
|
||||
} else {
|
||||
$dateNaiss='';
|
||||
}
|
||||
|
||||
if ($dir['flux']<>'0000-00-00') {
|
||||
$dateModif=$classWDate->dateT('Y-m-d','d/m/Y', $dir['flux']);
|
||||
$dateModif=Metier_Util_Date::dateT('Y-m-d','d/m/Y', $dir['flux']);
|
||||
} else {
|
||||
$dateModif=$classWDate->dateT('Y-m-d','d/m/Y', $dir['dateInsert']);
|
||||
$dateModif=Metier_Util_Date::dateT('Y-m-d','d/m/Y', $dir['dateInsert']);
|
||||
}
|
||||
|
||||
$nom = trim($dir['nom']);
|
||||
@ -3263,13 +3276,13 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
$dateUpdatePre=$dirs[0]['dateUpdate'];
|
||||
foreach ($dirs as $k=>$dir) {
|
||||
if ($dir['naissance_date']<>'0000-00-00')
|
||||
$dateNaiss=$classWDate->dateT('Y-m-d','d/m/Y', $dir['naissance_date']);
|
||||
$dateNaiss=Metier_Util_Date::dateT('Y-m-d','d/m/Y', $dir['naissance_date']);
|
||||
else
|
||||
$dateNaiss='';
|
||||
if ($dir['flux']<>'0000-00-00')
|
||||
$dateModif=$classWDate->dateT('Y-m-d','d/m/Y', $dir['flux']);
|
||||
$dateModif=Metier_Util_Date::dateT('Y-m-d','d/m/Y', $dir['flux']);
|
||||
else
|
||||
$dateModif=$classWDate->dateT('Y-m-d','d/m/Y', $dir['dateInsert']);
|
||||
$dateModif=Metier_Util_Date::dateT('Y-m-d','d/m/Y', $dir['dateInsert']);
|
||||
if ($dir['dateUpdate']<>$dateUpdatePre) break;
|
||||
$tabRet[] = array(
|
||||
'Fonction' => $dir['fonction_code'],
|
||||
@ -3317,7 +3330,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
'Nom' => trim($nom),
|
||||
'Prenom' => trim($prenom),
|
||||
'NomUsage' => '',
|
||||
'NaissDate' => $classWDate->dateT('Ymd', 'd/m/Y', $tabTmp['DIR_DATEN']),// 07/09/1961
|
||||
'NaissDate' => Metier_Util_Date::dateT('Ymd', 'd/m/Y', $tabTmp['DIR_DATEN']),// 07/09/1961
|
||||
'NaissVille' => $tabTmp['DIR_LIEUN'], // LE RUSSEY//,
|
||||
'NaissDepPays' => '', // 25
|
||||
'Ancien' => 0,
|
||||
@ -3980,9 +3993,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
*/
|
||||
public function getAnnoncesLegalesPlan($type, $fj, $annonce)
|
||||
{
|
||||
$classWDate = new WDate();
|
||||
|
||||
$evenDetect = array(
|
||||
$evenDetect = array(
|
||||
'1407', // Modification de plan
|
||||
'1409', // Modification du plan de continuation
|
||||
'1413', // Arrêt du plan de continuation
|
||||
@ -4019,7 +4030,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
$this->dureePlan = 120; // 10 ans = 120 mois
|
||||
}
|
||||
}
|
||||
$this->finPlan = $classWDate->period2Days($this->debutPlan, $this->dureePlan.' mois');
|
||||
$this->finPlan = Metier_Util_Date::period2Days($this->debutPlan, $this->dureePlan.' mois');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4041,7 +4052,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
$this->dureePlan = 120; // 10 ans = 120 mois
|
||||
}
|
||||
}
|
||||
$this->finPlan = $classWDate->period2Days($this->debutPlan, $this->dureePlan.' mois');
|
||||
$this->finPlan = Metier_Util_Date::period2Days($this->debutPlan, $this->dureePlan.' mois');
|
||||
}
|
||||
}
|
||||
|
||||
@ -4061,7 +4072,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
$this->dureePlan = 120; // 10 ans = 120 mois
|
||||
}
|
||||
}
|
||||
$this->finPlan = $classWDate->period2Days($this->debutPlan, $this->dureePlan.' mois');
|
||||
$this->finPlan = Metier_Util_Date::period2Days($this->debutPlan, $this->dureePlan.' mois');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4405,8 +4416,6 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
$tabRet = array();
|
||||
$this->dureePlan = 0; // Par défaut, on ne trouve aucune durée de plan
|
||||
|
||||
$classWDate = new WDate();
|
||||
|
||||
if ( !is_array($rubrique) && !in_array($rubrique, array('','P','PH','D','A','C','R','L','G','V','BODA','BODB','BODC')) ) {
|
||||
return false;
|
||||
}
|
||||
@ -4521,7 +4530,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
// Libellé générique
|
||||
$tabRetEven[] = array(
|
||||
'CodeEven' => '0000',
|
||||
'LibEven' => $ann['typeAnnonce']." de l'annonce du ".$classWDate->dateT('Y-m-d','d/m/Y',$ann['corrBodacc_Date_Parution'])
|
||||
'LibEven' => $ann['typeAnnonce']." de l'annonce du ".Metier_Util_Date::dateT('Y-m-d','d/m/Y',$ann['corrBodacc_Date_Parution'])
|
||||
);
|
||||
}
|
||||
// --- Annonce autre rubrique
|
||||
@ -4737,12 +4746,12 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
} else
|
||||
$strRCS = $ann['siren'] . ' RCS '. ucfirst(strtolower(strtr($ann['triNom'], array('TGIcc '=>'','TGI '=>'','TC '=>'','TI '=>'',)))).'. ';
|
||||
|
||||
$texteAnnonce = 'Date : '.strtolower($classWDate->dateT('Y-m-d','d M Y',$ann['dateJugement'])) .'. '. $this->iBodacc->getEvenement($ann['typeEven']).'. '.
|
||||
$texteAnnonce = 'Date : '.strtolower(Metier_Util_Date::dateT('Y-m-d','d M Y',$ann['dateJugement'])) .'. '. $this->iBodacc->getEvenement($ann['typeEven']).'. '.
|
||||
$strRCS . trim($ann['raisonSociale']). '. Adresse : '. $adresse.' '.$ann['codePostal'].' '.$ann['ville'].'. ';
|
||||
|
||||
if (trim($ann['numero'])<>'') $texteAnnonce.='Jugement Numéro : '.trim($ann['numero']).'. ';
|
||||
|
||||
if ($ann['dateCessationPaiement']*1<>0) $texteAnnonce.='Cessation des paiements le '.strtolower($classWDate->dateT('Y-m-d','d M Y',$ann['dateCessationPaiement'])).'. ';
|
||||
if ($ann['dateCessationPaiement']*1<>0) $texteAnnonce.='Cessation des paiements le '.strtolower(Metier_Util_Date::dateT('Y-m-d','d M Y',$ann['dateCessationPaiement'])).'. ';
|
||||
|
||||
if (trim($ann['inter1type'])<>'' && ($ann['inter1id']>0 || trim($ann['inter1nom'])<>'') ) {
|
||||
$texteAnnonce.=$tabInter[$ann['inter1type']].' : '.$ann['inter1nom'];
|
||||
@ -4804,9 +4813,9 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
|
||||
if ($ann['dateEffetFinP']*1<>'') {
|
||||
if ($depotComptes)
|
||||
$texteAnnonce.=' Comptes annuels et rapports de l\'exercice clos le : '.strtolower($classWDate->dateT('Y-m-d','d M Y',$ann['dateEffetFinP'])).'. ';
|
||||
$texteAnnonce.=' Comptes annuels et rapports de l\'exercice clos le : '.strtolower(Metier_Util_Date::dateT('Y-m-d','d M Y',$ann['dateEffetFinP'])).'. ';
|
||||
else
|
||||
$texteAnnonce.=' Date d\'effet : '.strtolower($classWDate->dateT('Y-m-d','d M Y',$ann['dateEffetFinP'])).'. ';
|
||||
$texteAnnonce.=' Date d\'effet : '.strtolower(Metier_Util_Date::dateT('Y-m-d','d M Y',$ann['dateEffetFinP'])).'. ';
|
||||
}
|
||||
|
||||
if (trim($ann['complement'])<>'') $texteAnnonce.=' Observations : '.trim($ann['complement']).'.';
|
||||
@ -5009,7 +5018,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
// --- Procédure trop ancienne plus de 12 ans et actif
|
||||
$dateTropAncienne = (date('Ymd')*1) - $MaxPeriodProcol;
|
||||
if ($evenProcolLastDate < $dateTropAncienne && $this->Identite['Actif']*1 > 0) {
|
||||
$derPr = $classWDate->dateT('Ymd','d/m/Y', $evenProcolLastDate);
|
||||
$derPr = Metier_Util_Date::dateT('Ymd','d/m/Y', $evenProcolLastDate);
|
||||
$tabRet = array();
|
||||
if ($this->debug) file_put_contents('procol.log', "Procédure trop ancienne plus de 12 ans et actif\n", FILE_APPEND);
|
||||
}
|
||||
@ -5029,8 +5038,8 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
if ($derExercice > $evenProcolLastDate) {
|
||||
if ($this->debug) file_put_contents('procol.log', "En Procol mais présence d'une annonce de cloture ou LJ avec Bilan publié ultérieurement\n", FILE_APPEND);
|
||||
if ($this->debug) file_put_contents('procol.log', "$derExercice > $evenProcolLastDate\n", FILE_APPEND);
|
||||
$derEx = $classWDate->dateT('Ymd', 'd/m/Y', $derExercice);
|
||||
$derPr = $classWDate->dateT('Ymd', 'd/m/Y', $evenProcolLastDate);
|
||||
$derEx = Metier_Util_Date::dateT('Ymd', 'd/m/Y', $derExercice);
|
||||
$derPr = Metier_Util_Date::dateT('Ymd', 'd/m/Y', $evenProcolLastDate);
|
||||
$tabRet = array();
|
||||
}
|
||||
}
|
||||
@ -5047,8 +5056,8 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
}
|
||||
}
|
||||
if ($derExercice > $evenProcolDateLast) {
|
||||
$derEx = $classWDate->dateT('Ymd','d/m/Y', $derExercice);
|
||||
$derPr = $classWDate->dateT('Ymd','d/m/Y', $evenProcolDateLast);
|
||||
$derEx = Metier_Util_Date::dateT('Ymd','d/m/Y', $derExercice);
|
||||
$derPr = Metier_Util_Date::dateT('Ymd','d/m/Y', $evenProcolDateLast);
|
||||
$tabRet = array();
|
||||
}
|
||||
}
|
||||
@ -5342,7 +5351,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
}
|
||||
}
|
||||
}
|
||||
debugLog('I', "getAnnoncesBoamp(siren=$siren, idAnnonce=$idAnnonce, $idA)", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
Metier_Util_Log::write('I', "getAnnoncesBoamp(siren=$siren, idAnnonce=$idAnnonce, $idA)", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
return $tabRet;
|
||||
}
|
||||
|
||||
@ -5384,7 +5393,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
*/
|
||||
public function getAnnoncesAsso($siren, $idAnnonce=0, $offset=0, $lignes=100)
|
||||
{
|
||||
debugLog('I', "Début getAnnoncesAsso(siren=$siren, idAnnonce=$idAnnonce)", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
Metier_Util_Log::write('I', "Début getAnnoncesAsso(siren=$siren, idAnnonce=$idAnnonce)", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
|
||||
$siretMin=$siren.'00000';
|
||||
$siretMax=$siren.'99999';
|
||||
@ -5399,8 +5408,6 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
$strIdAnn = "siren=$siren";
|
||||
}
|
||||
|
||||
$classWDate = new WDate();
|
||||
|
||||
$bodacc=$this->iDb->select('jo.asso', "id, Assoc_Nom, siren, nic, Waldec, Activite, Num_Annonce, Date_Parution, Num_Parution, Departement, Sous_Prefecture, Type_Annonce, Annonce_Html, Assoc_Objet, Assoc_Adresse, Assoc_NObjet, Assoc_AObjet, Assoc_NAdresse, Assoc_Fusion, Assoc_Annulation, Assoc_ANom, Assoc_NNom, Assoc_Date_Declaration, Assoc_Date_Declaration2, typeAnnonce, codEven, dateInsert", "$strIdAnn AND dateSuppr=0 ORDER BY Date_Parution DESC LIMIT $offset,$lignes", false, MYSQL_ASSOC);
|
||||
|
||||
$k=0;
|
||||
@ -5413,7 +5420,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
'LibEven'=> $ann['typeAnnonce'].' de l\'annonce './*n°'.
|
||||
$ann['corrNum_Annonce'].' BODACC n°'.
|
||||
$ann['corrNumParution'].*/' du '.
|
||||
$classWDate->dateT('Y-m-d','d/m/Y',$ann['corrDate_Parution'])/*.' (page '.
|
||||
Metier_Util_Date::dateT('Y-m-d','d/m/Y',$ann['corrDate_Parution'])/*.' (page '.
|
||||
$ann['corrPage'].')'*/);
|
||||
else {
|
||||
if (trim($ann['codEven'])<>'') {
|
||||
@ -5473,7 +5480,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
}
|
||||
}
|
||||
}
|
||||
debugLog('I', "Fin getAnnoncesAsso(siren=$siren, idAnnonce=$idAnnonce) : ".count($tabRet).' annonce(s)', __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
Metier_Util_Log::write('I', "Fin getAnnoncesAsso(siren=$siren, idAnnonce=$idAnnonce) : ".count($tabRet).' annonce(s)', __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
|
||||
return $tabRet;
|
||||
}
|
||||
@ -5971,8 +5978,6 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
|
||||
public function getAvisInsee($siren, $nic='')
|
||||
{
|
||||
$classWDate = new WDate();
|
||||
|
||||
if ($siren*1==0 || !$this->valideSiren($siren, $nic)) return false;
|
||||
if ($nic=='' || $nic*1==0 || $nic>99999)
|
||||
$strNic=" AND nic=nicSiege";
|
||||
@ -6035,7 +6040,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
}
|
||||
|
||||
if (preg_match("/Dernière mise à jour : (.*)<\/div>/Uis", $body, $matches))
|
||||
$tabInfos['dateMaj']=$classWDate->dateT('d/m/Y','Y-m-d',trim($matches[1]));
|
||||
$tabInfos['dateMaj']=Metier_Util_Date::dateT('d/m/Y','Y-m-d',trim($matches[1]));
|
||||
|
||||
$s1=substr($siren,0,3);
|
||||
$s2=substr($siren,3,3);
|
||||
@ -6049,7 +6054,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
|
||||
if (preg_match('/<label id="labelFiche">Etat : <\/label>(.*)depuis le(.*)<\/p>/Uis', $body, $matches)) {
|
||||
$tabInfos['etatEt'] = trim($matches[1]);
|
||||
$tabInfos['dateEtatEt']=$classWDate->dateT('d/m/Y','Y-m-d',trim($matches[2]));
|
||||
$tabInfos['dateEtatEt']=Metier_Util_Date::dateT('d/m/Y','Y-m-d',trim($matches[2]));
|
||||
}
|
||||
|
||||
if (preg_match('/<label id="labelFiche">Catégorie d\'établissement : <\/label>(.*)<\/p>/Uis', $body, $matches)) {
|
||||
@ -6123,7 +6128,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
|
||||
if (preg_match('/<label id="labelFiche">Etat : <\/label>(?:.*)<div id="adresse">(.*) le (.*)<\/div>/Uis', $body, $matches)) {
|
||||
$tabInfos['etatEn'] = str_replace(''',"'",trim($matches[1]));
|
||||
$tabInfos['dateEtatEn']=$classWDate->dateT('d/m/Y','Y-m-d',trim($matches[2]));
|
||||
$tabInfos['dateEtatEn']=Metier_Util_Date::dateT('d/m/Y','Y-m-d',trim($matches[2]));
|
||||
}
|
||||
|
||||
if (preg_match('/<label id="labelFiche">NIC siège \:(?:.*)<div id="adresse">(.*)<\/div>/Uisu', $body, $matches)) {
|
||||
@ -6204,17 +6209,17 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
if (count($ret)==1) {
|
||||
$limite=$tabCaisses['Limitations'];
|
||||
if ($tabCaisses['codeOPS']<>null) {
|
||||
//echo "Cas 1 : NAF $naf5 unique, annexe ".$tabCaisses['codeAnnexe']." - ".$tabCaisses['libInstitution']." (".$tabCaisses['Limitations'].")".EOL;
|
||||
//echo "Cas 1 : NAF $naf5 unique, annexe ".$tabCaisses['codeAnnexe']." - ".$tabCaisses['libInstitution']." (".$tabCaisses['Limitations'].")".PHP_EOL;
|
||||
//print_r($this->getInfoOPS($tabCaisses['codeOPS']));
|
||||
return $tabCaisses['codeOPS'];
|
||||
} elseif ($tabCaisses['Annexe']<>'') {
|
||||
$annexe=$tabCaisses['Annexe'];
|
||||
//echo "Cas 2 : NAF $naf5, Annexe $annexe".EOL;
|
||||
//echo "Cas 2 : NAF $naf5, Annexe $annexe".PHP_EOL;
|
||||
//print_r($this->getInfoOPS($idOPS));
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
echo "Cas 3.1 : Non géré $naf5 !".EOL;
|
||||
echo "Cas 3.1 : Non géré $naf5 !".PHP_EOL;
|
||||
//print_r($this->getInfoOPS($idOPS));
|
||||
print_r($tabCaisses);
|
||||
}
|
||||
@ -6230,16 +6235,16 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
foreach ($ret as $iRet=>$tabCaisses) {
|
||||
//if (count($ret)==1) {
|
||||
if ($tabCaisses['codeOPS']<>'') {
|
||||
// echo "Cas 2.1 : NAF $naf5, Annexe $annexe".EOL;
|
||||
//echo "Cas 2.1 : NAF $naf5, annexe ".$tabCaisses['codeAnnexe']." - ".$tabCaisses['libInstitution']." (".$tabCaisses['Limitations'].")".EOL;
|
||||
// echo "Cas 2.1 : NAF $naf5, Annexe $annexe".PHP_EOL;
|
||||
//echo "Cas 2.1 : NAF $naf5, annexe ".$tabCaisses['codeAnnexe']." - ".$tabCaisses['libInstitution']." (".$tabCaisses['Limitations'].")".PHP_EOL;
|
||||
//print_r($this->getInfoOPS($tabCaisses['codeOPS']));
|
||||
return $tabCaisses['codeOPS'];
|
||||
} else {
|
||||
//echo "Cas 2.2 : Non géré $naf5".EOL;
|
||||
//echo "Cas 2.2 : Non géré $naf5".PHP_EOL;
|
||||
//print_r($tabCaisses);
|
||||
}
|
||||
/*} else {
|
||||
echo "Cas 3.2 : Non géré $naf5".EOL;
|
||||
echo "Cas 3.2 : Non géré $naf5".PHP_EOL;
|
||||
print_r($tabCaisses);
|
||||
}*/
|
||||
}
|
||||
@ -6377,7 +6382,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
'dateEve' => $tabEve['insDATEVE'],
|
||||
'adrL1' => trim($adr1),
|
||||
'adrL2' => trim($adr2),
|
||||
'adrL3' => trim(prepareString($tabEve['insL3_CADR'])),
|
||||
'adrL3' => trim($tabEve['insL3_CADR']),
|
||||
'adrL4' => trim($adr4),
|
||||
'adrL5' => trim($tabEve['insL5_DISP']),
|
||||
'adrL6' => trim($tabEve['insL6_POST']),
|
||||
@ -6610,7 +6615,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
"codComInsee='$codeCommune' $strTypesVoies AND voieLib='$adrLibVoie2'", false, MYSQL_ASSOC);
|
||||
$nbRet = count($ret);
|
||||
if ($nbRet==0) {
|
||||
return '';//'Aucune correspondance Rivoli'.EOL;
|
||||
return '';//'Aucune correspondance Rivoli'.PHP_EOL;
|
||||
} else {
|
||||
foreach($ret as $i=>$iRet) {
|
||||
if (($iRet['voieNature']==$typeVoieOff || $iRet['voieNature']==$typeVoieNoff) && $iRet['voieLib']==$adrLibVoie) {
|
||||
|
@ -1,456 +0,0 @@
|
||||
<?php
|
||||
|
||||
require_once 'framework/common/curl.php';
|
||||
|
||||
define('HOST_INSEE', 'avis-situation-sirene.insee.fr');
|
||||
define('SITE_INSEE', 'http://'. HOST_INSEE .'/');
|
||||
|
||||
class Metier_Insee_MSirene
|
||||
{
|
||||
private $response1;
|
||||
|
||||
function __construct() {
|
||||
|
||||
/** Etape de connexion au site de l'INSEE pour simuler correctement un utilisateur WEB
|
||||
**/
|
||||
$this->response1=getUrl(SITE_INSEE,'','','',false,HOST_INSEE);
|
||||
$response=getUrl(SITE_INSEE .'REPERTOIRE/Interrogation/frame_interrogation.asp?ACTION=nouvelle&Niveau=siren', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'SIRENET_Script/Accueil/script_page_accueil.asp',false, HOST_INSEE);
|
||||
$response=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_menu.asp?niveau=siren', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/frame_interrogation.asp?ACTION=nouvelle&Niveau=siren',false, HOST_INSEE);
|
||||
$response=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_barre_haut.asp?niveau=siren', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/frame_interrogation.asp?ACTION=nouvelle&Niveau=siren',false, HOST_INSEE);
|
||||
$response=getUrl(SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_haut.asp?grille=siren&action=nouvelle', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/frame_interrogation.asp?ACTION=nouvelle&Niveau=siren',false, HOST_INSEE);
|
||||
$response=getUrl(SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?grille=siren&action=nouvelle', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/frame_interrogation.asp?ACTION=nouvelle&Niveau=siren',false, HOST_INSEE);
|
||||
$response=getUrl(SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_bas.asp?grille=siren&action=nouvelle', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/frame_interrogation.asp?ACTION=nouvelle&Niveau=siren',false, HOST_INSEE);
|
||||
$response=getUrl(SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_haut.asp?grille=siren&action=nouvelle', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?grille=siren&action=nouvelle',false, HOST_INSEE);
|
||||
$response=getUrl(SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_bas.asp?grille=siren&action=nouvelle', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?grille=siren&action=nouvelle',false, HOST_INSEE);
|
||||
//sleep(1);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupère les informations relatives à un établissement et son entreprise (par défaut le siège si pas de NIC)
|
||||
*
|
||||
* @param unknown_type $sirenLu
|
||||
* @param unknown_type $nicLu
|
||||
*/
|
||||
function getInfoEtab($sirenLu, $nicLu='') //if ($argv[1]=='id' || $argv[1]=='pj')
|
||||
{
|
||||
$tabRet=array();
|
||||
|
||||
/** Paramètre de requête "option" à l'insee :
|
||||
** 1: Fiche du siège + Données entreprises
|
||||
** 2: Tous les établissements de l'entreprise
|
||||
** 3: Un établissement particulier
|
||||
** 4: Département
|
||||
**/
|
||||
if ($nicLu<>'') $option=3;
|
||||
else $option=1;
|
||||
|
||||
// Requête d'interrogation
|
||||
$postData=array('siren'=>$sirenLu,
|
||||
'option'=>$option,
|
||||
'nic'=>$nicLu,
|
||||
'dep'=>'',
|
||||
'listeDep'=>'');
|
||||
|
||||
$response=getUrl(SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false', $this->response1["header"]["Set-Cookie"], $postData, SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?grille=siren&action=nouvelle',false, HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/reponse/question.asp?action=nouveau', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false',false,HOST_INSEE);
|
||||
if ($responseQ['code']==302)
|
||||
{
|
||||
//$libelleErreur='Erreur INSEE inconnue 1';
|
||||
|
||||
// Siren Invalide ou autre erreur non répertoriée !
|
||||
$header=$responseQ['header'];
|
||||
if (trim($header['Location'])=='/REPERTOIRE/Reponse/Frame_Reponse.asp?dest=erreur')
|
||||
{
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=erreur', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false',false,HOST_INSEE);
|
||||
$responseErreur=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Erreur_principal.asp', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=erreur',false,HOST_INSEE);
|
||||
$pos=strpos($responseErreur['body'], '<td valign=top bgcolor="#FFCC33"><font face=Arial size=2><b>');
|
||||
if ($pos>0){
|
||||
$posFin=strpos($responseErreur['body'], '</b></font></td>', $pos+60);
|
||||
$libelleErreur=trim(substr($responseErreur['body'], $pos+60, $posFin-($pos+60)));
|
||||
} else
|
||||
$tabRet['erreur']='Erreur INSEE inconnue';
|
||||
}
|
||||
else
|
||||
{ if (trim($header['Location'])=='/REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege')
|
||||
// L'établissement demandé est un siège !
|
||||
$option=1;
|
||||
|
||||
if ($option==3)
|
||||
{
|
||||
// On déroule les URLs d'appels établissement
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false',false,HOST_INSEE);
|
||||
//sleep(1);
|
||||
// Frames réponse niveau Etab
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_menu.asp?niveau=siren', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement',false,HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_barre_haut.asp?niveau=siren', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement',false,HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Reponse_haut.asp', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement',false,HOST_INSEE);
|
||||
$responseEtab=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_principal.asp?niveau=etablissement', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement', false,HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_bas.asp?niveau=etablissement', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement',false,HOST_INSEE);
|
||||
$responseEtab=$responseEtab['body'];
|
||||
// On recherche si on est bien sur un fiche établissement
|
||||
$pos=strpos($responseEtab, '<table cols="2" width="100%"><tr><td bgcolor="#FFCC33" align="left"><font face="Arial" size="2"><B>Fiche Etablissement</B>');
|
||||
if ($pos<1)
|
||||
$tabRet['erreur']='Erreur SCRIPT Fiche Etablissement non trouvée';
|
||||
$responseSiege=$responseEtab;
|
||||
}
|
||||
else
|
||||
{
|
||||
// On déroule les URLs d'appels Sièges
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false',false,HOST_INSEE);
|
||||
//sleep(1);
|
||||
// Frames réponse niveau sièges
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_menu.asp?niveau=siren', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege',false,HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_barre_haut.asp?niveau=siren', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege',false,HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Reponse_haut.asp', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege',false,HOST_INSEE);
|
||||
$responseSiege=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_principal.asp?niveau=siege', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege', false,HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_bas.asp?niveau=siege', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege',false,HOST_INSEE);
|
||||
$responseSiege=$responseSiege['body'];//strip_tags(html_entity_decode(), '<td>');
|
||||
// On recherche si on est bien sur un fiche siège
|
||||
$pos=strpos($responseSiege, '<table cols="2" width="100%"><tr><td bgcolor="#FFCC33" align="left"><font face="Arial" size="2"><B>Fiche siège</B>');
|
||||
if ($pos<1)
|
||||
$tabRet['erreur']='Erreur SCRIPT Fiche Siège non trouvée';
|
||||
}
|
||||
|
||||
// Niveau entreprise
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/reponse/frame_reponse.asp?niveau=entreprise&dest=detail', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Detail_principal.asp?niveau=siege',false,HOST_INSEE);
|
||||
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_menu.asp?niveau=siren', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/reponse/frame_reponse.asp?niveau=entreprise&dest=detail',false,HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_barre_haut.asp?niveau=siren', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=entreprise',false,HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Reponse_haut.asp', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/reponse/frame_reponse.asp?niveau=entreprise&dest=detail',false,HOST_INSEE);
|
||||
$responseEntreprise=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_principal.asp?niveau=entreprise', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/reponse/frame_reponse.asp?niveau=entreprise&dest=detail', false,HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_bas.asp?niveau=entreprise', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/reponse/frame_reponse.asp?niveau=entreprise&dest=detail',false,HOST_INSEE);
|
||||
$responseEntreprise=$responseEntreprise['body'];
|
||||
$pos=strpos($responseEntreprise, '<table cols="2" width="100%"><tr><td bgcolor="#FFCC33" align="left"><font face="Arial" size="2"><B>Fiche Entreprise</B>');
|
||||
if ($pos<1) {
|
||||
$tabRet['erreur']='Erreur SCRIPT Fiche Entreprise non trouvée';
|
||||
}
|
||||
|
||||
/** Recherche des données établissement
|
||||
**/
|
||||
$tabRet['etablissement']=$this->getDataEtablissement($responseSiege);
|
||||
|
||||
/** Recherche des données entreprise
|
||||
**/
|
||||
$tabRet['entreprise']=$this->getDataEntreprise($responseEntreprise);
|
||||
|
||||
return $tabRet;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupère la liste de tous les établissements d'une entreprise
|
||||
*
|
||||
* @param unknown_type $sirenLu
|
||||
*/
|
||||
function getListeEtabs($sirenLu)
|
||||
{
|
||||
// Requête d'interrogation
|
||||
$postData=array('siren'=>$sirenLu,
|
||||
'option'=>2,
|
||||
'nic'=>'',
|
||||
'dep'=>'',
|
||||
'listeDep'=>'');
|
||||
|
||||
$response=getUrl(SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false', $this->response1["header"]["Set-Cookie"], $postData, SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?grille=siren&action=nouvelle', false, HOST_INSEE);
|
||||
$action='nouveau';
|
||||
$referer=SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false';
|
||||
$nbRepTot=$pageCour=$nbTotPage=$nbRepParPage=$numEtab=0;
|
||||
$tabInfoEtab=array();
|
||||
$tabRet=array();
|
||||
|
||||
while(true)
|
||||
{
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/reponse/question.asp?action='.$action, $this->response1["header"]["Set-Cookie"], '', $referer, false, HOST_INSEE);
|
||||
if ($responseQ['code']==302)
|
||||
{
|
||||
//$libelleErreur='Erreur INSEE inconnue 1';
|
||||
|
||||
// Siren Invalide ou autre erreur non répertoriée !
|
||||
$header=$responseQ['header'];
|
||||
if (trim($header['Location'])=='/REPERTOIRE/Reponse/Frame_Reponse.asp?dest=erreur')
|
||||
{
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=erreur', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false', false, HOST_INSEE);
|
||||
$responseErreur=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Erreur_principal.asp', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=erreur', false, HOST_INSEE);
|
||||
$pos=strpos($responseErreur['body'], '<td valign=top bgcolor="#FFCC33"><font face=Arial size=2><b>');
|
||||
if ($pos>0){
|
||||
$posFin=strpos($responseErreur['body'], '</b></font></td>', $pos+60);
|
||||
$libelleErreur=trim(substr($responseErreur['body'], $pos+60, $posFin-($pos+60)));
|
||||
} else
|
||||
$libelleErreur='Erreur INSEE inconnue';
|
||||
}
|
||||
|
||||
// On déroule les URLs d'appels liste des établissements
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=liste', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false', false, HOST_INSEE);
|
||||
//sleep(1);
|
||||
// Frames réponse niveau Etab
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_menu.asp?niveau=siren', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=liste', false, HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_barre_haut.asp?niveau=siren', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=liste', false, HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Reponse_haut.asp', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=liste', false, HOST_INSEE);
|
||||
$responseListe=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Liste_principal.asp', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=liste', false, HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Liste_bas.asp', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=liste', false, HOST_INSEE);
|
||||
$responseListe=$responseListe['body'];
|
||||
|
||||
$pos=strpos($responseListe, 'Nombre total de réponses : '."\r\n\t\t\t".'<font face="Arial" size="2"><b>');
|
||||
if ($pos>0) {
|
||||
$posFin=strpos($responseListe, '</b></font>', $pos+73);
|
||||
$nbRepTot=trim(substr($responseListe, $pos+73, $posFin-($pos+73)));
|
||||
}
|
||||
$pos=strpos($responseListe, ' - Affichage de la page '."\r\n\t\t\t".'<font face="Arial" size="2"><b>');
|
||||
if ($pos>0) {
|
||||
$posFin=strpos($responseListe, ' - </b></font>', $pos+75);
|
||||
$strPages=trim(substr($responseListe, $pos+75, $posFin-($pos+75)));
|
||||
$tabPages=explode(' / ', $strPages);
|
||||
$pageCour=$tabPages[0];
|
||||
$nbTotPage=$tabPages[1];
|
||||
}
|
||||
$pos=strpos($responseListe, ' - </b></font>'."\r\n\t\t\t".'<font face="Arial" size="2"><b>');
|
||||
if ($pos>0) {
|
||||
$posFin=strpos($responseListe, '</b></font>', $pos+60);
|
||||
$nbRepParPage=trim(substr($responseListe, $pos+60, $posFin-($pos+60)));
|
||||
}
|
||||
|
||||
/* TODO = Récupérer les infos étab + entrep pour chaque ligne du tableau !!!*
|
||||
*/
|
||||
if ($libelleErreur=='Erreur SCRIPT Inconnue')
|
||||
$libelleErreur='';
|
||||
for ($i=1;$i<11; $i++)
|
||||
{
|
||||
if ($numEtab==$nbRepTot)
|
||||
break; // Il n'y a pas plus d'établissement à récupérer ! On sort...
|
||||
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/reponse/question.asp?action=detail&numtableau='.$i, $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Liste_principal.asp', false, HOST_INSEE);
|
||||
if ($responseQ['code']==302)
|
||||
{
|
||||
// Siren Invalide ou autre erreur non répertoriée !
|
||||
$header=$responseQ['header'];
|
||||
if (trim($header['Location'])=='/REPERTOIRE/Reponse/Frame_Reponse.asp?origine=liste&dest=detail&niveau=siege&numtableau='.$i)
|
||||
{
|
||||
// On déroule les URLs d'appels fiche siège
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege&numtableau='.$i, $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false', false, HOST_INSEE);
|
||||
//sleep(1);
|
||||
// Frames réponse niveau Etab
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_menu.asp?niveau=siren', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege', false, HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_barre_haut.asp?niveau=siren', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege', false, HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Reponse_haut.asp', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege', false, HOST_INSEE);
|
||||
$responseEtab=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_principal.asp?niveau=siege&numtableau='.$i.'&origine=liste', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?origine=liste&dest=detail&niveau=siege&numtableau='.$i, false, HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_bas.asp?niveau=siege&numtableau='.$i.'&origine=liste', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?origine=liste&dest=detail&niveau=siege&numtableau='.$i, false, HOST_INSEE);
|
||||
$responseEtab=$responseEtab['body'];
|
||||
|
||||
// Récupération de la fiche entreprise INSEE
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/reponse/frame_reponse.asp?niveau=entreprise&dest=detail&origine=liste&numtableau='.$i, $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Detail_principal.asp?niveau=siege&numtableau='.$i.'&origine=liste', false, HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_menu.asp?niveau=siren', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/reponse/frame_reponse.asp?niveau=entreprise&dest=detail&origine=liste&numtableau='.$i, false, HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_barre_haut.asp?niveau=siren', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?niveau=entreprise&dest=detail&origine=liste&numtableau='.$i, false, HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Reponse_haut.asp', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/reponse/frame_reponse.asp?niveau=entreprise&dest=detail&origine=liste&numtableau='.$i, false, HOST_INSEE);
|
||||
$responseEntreprise=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_principal.asp?niveau=entreprise&numtableau='.$i.'&origine=liste', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/reponse/Frame_Reponse.asp?niveau=entreprise&dest=detail&origine=liste&numtableau='.$i, false, HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_bas.asp?niveau=entreprise&numtableau='.$i.'&origine=liste', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/reponse/Frame_Reponse.asp?niveau=entreprise&dest=detail&origine=liste&numtableau='.$i, false, HOST_INSEE);
|
||||
$responseEntreprise=$responseEntreprise['body'];
|
||||
}
|
||||
elseif (trim($header['Location'])=='/REPERTOIRE/Reponse/Frame_Reponse.asp?origine=liste&dest=detail&niveau=etablissement&numtableau='.$i)
|
||||
{
|
||||
// On déroule les URLs d'appels établissement
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement&numtableau='.$i, $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false', false, HOST_INSEE);
|
||||
//sleep(1);
|
||||
// Frames réponse niveau Etab
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_menu.asp?niveau=siren', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement', false, HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_barre_haut.asp?niveau=siren', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement', false, HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Reponse_haut.asp', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement', false, HOST_INSEE);
|
||||
$responseEtab=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_principal.asp?niveau=etablissement&numtableau='.$i.'&origine=liste', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?origine=liste&dest=detail&niveau=etablissement&numtableau='.$i, false, HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_bas.asp?niveau=etablissement&numtableau='.$i.'&origine=liste', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?origine=liste&dest=detail&niveau=etablissement&numtableau='.$i, false, HOST_INSEE);
|
||||
$responseEtab=$responseEtab['body'];
|
||||
}
|
||||
$tabRet['etablissements'][$numEtab]=$this->getDataEtablissement($responseEtab);
|
||||
$tabRet['entreprise']=$this->getDataEntreprise($responseEntreprise);
|
||||
|
||||
if ($libelleErreur<>'' && $tabInfoEtab['siret'] =='') $siret=$sirenLu . $nicLu;
|
||||
else $siret=$tabInfoEtab['siret'];
|
||||
|
||||
/*$str= date('d/m/Y à H:i:s') .';'.
|
||||
$libelleErreur .';'.
|
||||
// Siège
|
||||
$siret .';'.
|
||||
$tabInfoEtab['active'] .';'.
|
||||
$tabInfoEtab['dateAbsActivite'] .';'.
|
||||
$tabInfoEtab['typeEtablissement'] .';'.
|
||||
$tabInfoEtab['dateMAJ'] .';'.
|
||||
$tabInfoEtab['dateCreation'] .';'.
|
||||
$tabInfoEtab['raisonSociale'] .';'.
|
||||
$tabInfoEtab['Enseigne'] .';'.
|
||||
$tabInfoEtab['NafCode'] .';'.
|
||||
$tabInfoEtab['NafLib'] .';'.
|
||||
$tabInfoEtab['AdresseLigne1'] .';'.
|
||||
$tabInfoEtab['AdresseLigne2'] .';'.
|
||||
$tabInfoEtab['AdresseLigne3'] .';'.
|
||||
$tabInfoEtab['etatJuridique'] .';'.
|
||||
$tabInfoEtab['dateEtatJuridique'] .';'.
|
||||
// Entreprise
|
||||
$tabInfoEntrep['dateCreationEntrep'] .';'.
|
||||
$tabInfoEntrep['raisonSocialeEntrep'] .';'.
|
||||
$tabInfoEntrep['sigle'] .';'.
|
||||
$tabInfoEntrep['NafCodeEntrep'] .';'.
|
||||
$tabInfoEntrep['NafLibEntrep'] .';'.
|
||||
$tabInfoEntrep['FJCodeEntrep'] .';'.
|
||||
$tabInfoEntrep['FJLibEntrep'] .';'.
|
||||
$tabInfoEntrep['nbEtabActifs'] .';';
|
||||
*/
|
||||
//fwrite($fpOUT, $str."\r\n");
|
||||
$numEtab++;
|
||||
$num=$key+1;
|
||||
$typeEtablissement=$tabInfoEtab['typeEtablissement'];
|
||||
//echo "Question $num/$nbLignes : Demande=$sirenLu$nicLu Etablissement $numEtab/$nbRepTot $typeEtablissement=$siret $libelleErreur\r\n";
|
||||
flush();
|
||||
sleep(1);
|
||||
|
||||
}//end for
|
||||
}//end if
|
||||
if ($pageCour==$nbTotPage) {
|
||||
// On sort de la boucle de passage à la page de liste suivante car il n'y a plus d'autres pages
|
||||
break;
|
||||
} else {
|
||||
$action='listeplus';
|
||||
$referer=SITE_INSEE .'REPERTOIRE/Reponse/Liste_principal.asp';
|
||||
}
|
||||
}
|
||||
} //Fin While
|
||||
return $tabRet;
|
||||
}
|
||||
|
||||
private function getDataEtablissement($pageHtml)
|
||||
{
|
||||
global $libelleErreur;
|
||||
|
||||
$responseSiege=$pageHtml;
|
||||
$tabRet=array();
|
||||
|
||||
// On recherche si on est sur un établissement siège ou secondaire
|
||||
$pos=strpos($pageHtml, '<table cols="2" width="100%"><tr><td bgcolor="#FFCC33" align="left"><font face="Arial" size="2"><B>Fiche Etablissement</B>');
|
||||
if ($pos>0)
|
||||
$tabRet['typeEtablissement']='secondaire';
|
||||
|
||||
$pos=strpos($pageHtml, '<table cols="2" width="100%"><tr><td bgcolor="#FFCC33" align="left"><font face="Arial" size="2"><B>Fiche siège</B>');
|
||||
if ($pos>0)
|
||||
$tabRet['typeEtablissement']='siège';
|
||||
|
||||
// Recherche Dernière MAJ / Activité
|
||||
$pos=strpos($responseSiege, '<font face="Arial" size="2">(dernière mise à jour :');
|
||||
if ($pos>0) {
|
||||
$tabRet['dateMAJ']=substr($responseSiege, $pos+51, 10);
|
||||
$tabRet['dateAbsActivite']='';
|
||||
$tabRet['active']='O';
|
||||
} else {
|
||||
$tabRet['active']='N';
|
||||
$tabRet['dateMAJ']='';
|
||||
$pos=strpos($responseSiege, '<font face="Arial" size="2">Absence d\'activité notée le : ');
|
||||
if ($pos>0) $tabRet['dateAbsActivite']=substr($responseSiege, $pos+78, 10);
|
||||
else {
|
||||
$pos=strpos($responseSiege, '<font face="Arial" size="2">Absence d\'activité');
|
||||
if ($pos>0) $tabRet['dateAbsActivite']='';
|
||||
}
|
||||
}
|
||||
|
||||
$pos=strpos($responseSiege, ' size="-1"> <B>n° SIRET :</B></FONT></td><td valign="top"><font face="Arial" size="-1">');
|
||||
$tabRet['siret']=str_replace(' ', '', html_entity_decode(substr($responseSiege, $pos+97, 32)));
|
||||
|
||||
$pos=strpos($responseSiege, 'size="-1"> <B>Date de création :</B></FONT></td><td valign="top"><font face="Arial" size="-1">');
|
||||
if ($pos>0) {
|
||||
$posFin=strpos($responseSiege, '</font>', $pos+109);
|
||||
$tabRet['dateCreation']=str_replace(' ', '', html_entity_decode(substr($responseSiege, $pos+109, $posFin-($pos+109))));
|
||||
}
|
||||
else $tabRet['dateCreation']='';
|
||||
|
||||
$pos=strpos($responseSiege, ' size="-1"> <B>Raison sociale et Enseigne :</B></FONT></td><td valign="top" colspan="3"><font face="Arial" size="-1">');
|
||||
$len=127;
|
||||
if ($pos==0){
|
||||
$pos=strpos($responseSiege, ' size="-1"> <B>Raison sociale et Enseigne :</B></FONT></td><td valign="top" colspan="3"><font face="Arial" size="-1">');
|
||||
$len=122;
|
||||
if ($pos==0){
|
||||
$pos=strpos($responseSiege, ' size="-1"> <B>Raison sociale et Enseigne :</B></FONT></td><td valign="top" colspan="3"><font face="Arial" size="-1">');
|
||||
$len=126;
|
||||
$libelleErreur='Informations INSEE non diffusables';
|
||||
}
|
||||
}
|
||||
if ($libelleErreur=='') {
|
||||
//LARGE*DOMINIQUE MICHEL/ <BR>GERANT SARL BIMAGIQUE </font>
|
||||
$posFin=strpos($responseSiege, '</font>', $pos+$len);
|
||||
$raisonSocialeStr=trim(substr($responseSiege, $pos+$len, $posFin-($pos+$len)));
|
||||
$raisonSocialeTabLigne=explode('<BR>', $raisonSocialeStr);
|
||||
$tabRet['raisonSociale']=trim(str_replace(' ', '', html_entity_decode($raisonSocialeTabLigne[0])));
|
||||
$tabRet['Enseigne']=trim(str_replace(' ', '', html_entity_decode(@$raisonSocialeTabLigne[1])));
|
||||
$pos=strpos($responseSiege, ' size="-1"> <B>Activité principale :</B></FONT></td><td valign="top" colspan="3"><font face="Arial" size="-1">');
|
||||
$tabRet['NafCode']=substr($responseSiege, $pos+120, 4);
|
||||
$tabRet['NafLib']=trim(substr($responseSiege, $pos+137, 70));
|
||||
|
||||
$pos=strpos($responseSiege, ' size="-1"> <B>Adresse :</B></FONT></td><td valign="top" colspan="3"><font face="Arial" size="-1">');
|
||||
$posFin=strpos($responseSiege, '</font>', $pos+103);
|
||||
$AdresseStr=substr($responseSiege, $pos+103, $posFin-($pos+103));
|
||||
$AdresseTabLigne=explode('<BR>', $AdresseStr);//'
|
||||
$tabRet['AdresseLigne1']=str_replace(' ', '/', $AdresseTabLigne[0]);
|
||||
$tabRet['AdresseLigne2']=str_replace(' ', '/', $AdresseTabLigne[1]);
|
||||
$tabRet['AdresseLigne3']=str_replace(' ', '/', $AdresseTabLigne[2]);
|
||||
/*
|
||||
$AdresseNum=$AdresseTabLigne1[0];
|
||||
$AdresseVoi=$AdresseTabLigne1[1];
|
||||
$AdresseRue=$AdresseTabLigne1[2];
|
||||
$AdresseCP=$AdresseTabLigne2[0];
|
||||
$AdresseVille=$AdresseTabLigne2[1];
|
||||
*/
|
||||
$pos=strpos($responseSiege, '<font face="Arial" size="-1"><b>L\'entreprise est connue au répertoire comme ');
|
||||
if ($pos>0) {
|
||||
$posFin=strpos($responseSiege, '</b>', $pos+106);
|
||||
$tabRet['etatJuridique']=html_entity_decode(substr($responseSiege, $pos+106, $posFin-($pos+106)));
|
||||
$tabRet['dateEtatJuridique']='';
|
||||
} else {
|
||||
$pos=strpos($responseSiege, '<font face="Arial" size="-1"><b>L\'entreprise est cessée le : ');
|
||||
$tabRet['dateEtatJuridique']=substr($responseSiege, $pos+86, 10);
|
||||
$tabRet['etatJuridique']='cessée';
|
||||
}
|
||||
//echo 'GetDataEtab="'.$libelleErreur."\"\r\n";
|
||||
return $tabRet;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function getDataEntreprise($pageHtml)
|
||||
{
|
||||
global $libelleErreur;
|
||||
|
||||
$responseEntreprise=$pageHtml;
|
||||
$tabRet=array();
|
||||
|
||||
if ($libelleErreur=='') {
|
||||
|
||||
$pos=strpos($responseEntreprise, 'size="-1"> <B>Date de création :</B></FONT></td><td valign="top"><font face="Arial" size="-1">');
|
||||
if ($pos>0)
|
||||
$tabRet['dateCreationEntrep']=substr($responseEntreprise, $pos+109, 10);
|
||||
else
|
||||
$tabRet['$dateCreationEntrep']='';
|
||||
|
||||
// Raison sociale et Sigle
|
||||
$pos=strpos($responseEntreprise, ' size="-1"> <B>Raison sociale et Sigle :</B></FONT></td><td valign="top" colspan="3"><font face="Arial" size="-1">');
|
||||
$posFin=strpos($responseEntreprise, '</font>', $pos+123);
|
||||
$raisonSocialeStr=trim(substr($responseEntreprise, $pos+123, $posFin-($pos+123)));
|
||||
$raisonSocialeTabLigne=explode('<BR>', $raisonSocialeStr);
|
||||
$tabRet['raisonSocialeEntrep']=trim(str_replace(' ', '', html_entity_decode($raisonSocialeTabLigne[0])));
|
||||
$tabRet['sigle']=trim(str_replace(' ', '', html_entity_decode(@$raisonSocialeTabLigne[1])));
|
||||
|
||||
// Activité prinicpale Entrep
|
||||
$pos=strpos($responseEntreprise, ' size="-1"> <B>Activité principale :</B></FONT></td><td valign="top" colspan="3"><font face="Arial" size="-1">');
|
||||
$tabRet['NafCodeEntrep']=substr($responseEntreprise, $pos+120, 4);
|
||||
$tabRet['NafLibEntrep']=trim(substr($responseEntreprise, $pos+137, 70));
|
||||
|
||||
// Forme Juridique
|
||||
$pos=strpos($responseEntreprise, ' size="-1"> <B>Forme juridique :</B></FONT></td><td valign="top" colspan="3"><font face="Arial" size="-1">');
|
||||
$tabRet['FJCodeEntrep']=substr($responseEntreprise, $pos+116, 4);
|
||||
$tabRet['FJLibEntrep']=trim(substr($responseEntreprise, $pos+133, 70));
|
||||
|
||||
// Nb Etab Actifs
|
||||
$tabRet['nbEtabActifs']=trim(str_replace(' ', '', html_entity_decode(@getTextInHtml($responseEntreprise, '<B>Nb établissements actifs :</B>', '<font face="Arial" size="-1">', '</font>'))));
|
||||
}
|
||||
return $tabRet;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
58
library/SdMetier/Intersud/Service.php → library/Metier/Intersud/Service.php
Normal file → Executable file
58
library/SdMetier/Intersud/Service.php → library/Metier/Intersud/Service.php
Normal file → Executable file
@ -1,36 +1,36 @@
|
||||
<?php
|
||||
class SdMetier_Intersud_Service
|
||||
class Metier_Intersud_Service
|
||||
{
|
||||
/**
|
||||
* Stockage du cookie
|
||||
* @var string
|
||||
*/
|
||||
protected $ckfile;
|
||||
|
||||
|
||||
protected $login = 'YLENA';
|
||||
protected $pass = 'WYLFE';
|
||||
|
||||
|
||||
/**
|
||||
* Gestion des demandes d'enquêtes au service Infogreffe
|
||||
*/
|
||||
public function __construct(){}
|
||||
|
||||
|
||||
public function setDemandeur()
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function setEnquete()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function call()
|
||||
{
|
||||
$this->ckfile = __DIR__.'/'.uniqid('cookie-');
|
||||
if (file_exists($ckfile)) unlink($ckfile);
|
||||
|
||||
|
||||
// --- Authentification
|
||||
$url = 'http://www.intersud.fr/espace_client/';
|
||||
$data = array(
|
||||
@ -38,12 +38,12 @@ class SdMetier_Intersud_Service
|
||||
'pwd' => $this->pass,
|
||||
);
|
||||
$result = $this->page($url, $data);
|
||||
|
||||
|
||||
|
||||
|
||||
// --- Post de la demande
|
||||
$url = 'http://intersud.fr/espace_client/demande_enquete.php';
|
||||
|
||||
|
||||
|
||||
|
||||
$data = array(
|
||||
//Expediteur - Email
|
||||
'email_exp' => 'support@scores-decisions.com',
|
||||
@ -51,20 +51,20 @@ class SdMetier_Intersud_Service
|
||||
'type_enk' => $enqType, // 0=Premier, 1=Gold, 2=Distrimat, 3=Star, 4=Avis bancaire, 5=Autre
|
||||
'delai_enk' => $enqDelai, // 6=24h, 7=72h, 8=+de5jours
|
||||
//Type enquete - Prestation Internationales
|
||||
|
||||
|
||||
//Société
|
||||
'soc' => $tabIdentite['Nom'],
|
||||
'cible_enk' => 9, // 9
|
||||
'siret' => $siren,
|
||||
'acti' => '',
|
||||
'soc_exp' => $tabInterSud['soc_exp'],
|
||||
|
||||
|
||||
'nom_diri' => '',
|
||||
'adr' => $tabIdentite['Adresse'],
|
||||
'ref_exp' => $tabInterSud['ref_exp'],
|
||||
'autre_type_enk' => '', // Texte libre
|
||||
'adr2' => $tabIdentite['Adresse2'],
|
||||
|
||||
|
||||
'ville' => $tabIdentite['Ville'],
|
||||
'cp' => $tabIdentite['CP'],
|
||||
'pays' => '', // International ?
|
||||
@ -77,17 +77,17 @@ class SdMetier_Intersud_Service
|
||||
'encours' => $infoEnq['Encours'],
|
||||
'nb_ech' => $infoEnq['NbEcheances'],
|
||||
'delai2_enk' => $tabInterSud['delai2_enk'], // International ?
|
||||
|
||||
|
||||
'cred' => '',
|
||||
'comment' => urlencode($comment),
|
||||
'val_ret' => $tabInterSud['val_ret'],
|
||||
);
|
||||
|
||||
|
||||
$result = $this->page($url, $data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
protected function page($url, $curl_data = '', $override = null)
|
||||
{
|
||||
//$user_agent = 'Mozilla/5.0 (Windows NT 5.1; rv:9.0.1) Gecko/20100101 Firefox/9.0.1';
|
||||
@ -103,7 +103,7 @@ class SdMetier_Intersud_Service
|
||||
rtrim($fields,'&');
|
||||
$post = true;
|
||||
}
|
||||
|
||||
|
||||
$options = array(
|
||||
CURLOPT_RETURNTRANSFER => true, // return web page
|
||||
CURLOPT_HEADER => false, // don't return headers
|
||||
@ -123,12 +123,12 @@ class SdMetier_Intersud_Service
|
||||
CURLOPT_COOKIEFILE => $ckfile,
|
||||
CURLOPT_COOKIEJAR => $ckfile, // Stockage du cookie de session
|
||||
);
|
||||
|
||||
|
||||
//Override define CURL option
|
||||
if (is_array($override) && count($override)>0 ) {
|
||||
$options = $override + $options;
|
||||
}
|
||||
|
||||
|
||||
$ch = curl_init($url);
|
||||
curl_setopt_array($ch,$options);
|
||||
$content = curl_exec($ch);
|
||||
@ -136,19 +136,19 @@ class SdMetier_Intersud_Service
|
||||
$errmsg = curl_error($ch) ;
|
||||
$header = curl_getinfo($ch);
|
||||
curl_close($ch);
|
||||
|
||||
|
||||
//Rewrite encoding to UTF-8
|
||||
//text/html; charset=ISO-8859-1
|
||||
//$encoding = getPageHeader('text\/html; charset=', '', $header['content_type']);
|
||||
//$encoding = 'ISO-8859-1';
|
||||
//$content = iconv($encoding, 'UTF-8//TRANSLIT', $content);
|
||||
|
||||
|
||||
// $header['errno'] = $err;
|
||||
// $header['errmsg'] = $errmsg;
|
||||
// $header['content'] = $content;
|
||||
return array('header'=>$header, 'content'=>$content);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
2
library/SdMetier/Liens/Base.php → library/Metier/Liens/Base.php
Normal file → Executable file
2
library/SdMetier/Liens/Base.php → library/Metier/Liens/Base.php
Normal file → Executable file
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
class SdMetier_Liens_Base
|
||||
class Metier_Liens_Base
|
||||
{
|
||||
/**
|
||||
* Company Reference id
|
@ -1,57 +0,0 @@
|
||||
<?php
|
||||
return array(
|
||||
'ACD' => "Action contre/relative au(x) dirigeant(s)",
|
||||
'ACT' => "Conflit d'actionnaires",
|
||||
'AFF' => "Demande relative à un affacturage",
|
||||
'APC' => "Assignation en procédure collective",
|
||||
'BAN' => "Demande relative au droit bancaire",
|
||||
'CAU' => "Demande d'intervention de la caution",
|
||||
'CBA' => "Demande relative au crédit bail",
|
||||
'CDL' => "Action en concurrence déloyale",
|
||||
'CES' => "Cession de titres ou de parts sociales",
|
||||
'COA' => "Demande relative à un contrat assurance",
|
||||
'CON' => "Demande relative à un contrat",
|
||||
'CPT' => "Injonction du président pour dépôt des comptes annuels",
|
||||
'CRN' => "Demande relative à cession/nantissement de créance",
|
||||
'CTX' => "Contentieux",
|
||||
'DBA' => "Demande formée contre une banque",
|
||||
'DCO' => "Action en garantie des vices caches ou en sanction du défaut de conformité",
|
||||
'DCP' => "Demande d'ouverture de procédure collective",
|
||||
'DIR' => "Demande(s) relative(s) au(x) dirigeant(s) de la société",
|
||||
'DIV' => "Divers",
|
||||
'DOC' => "Demande de production de document(s)",
|
||||
'DOM' => "Action en dommages et intérêts",
|
||||
'DSV' => "Demande d'ouverture de procédure de sauvegarde",
|
||||
'ERR' => "Rectification d'erreur matérielle",
|
||||
'EXP' => "Expulsion",
|
||||
'EXT' => "Expertise",
|
||||
'FCT' => "Demande relative au fonctionnement de l'entité/actionnaires",
|
||||
'HOC' => "Mandat ad hoc",
|
||||
'HOM' => "Homologation par le tribunal d'un compromis ou d'une transaction",
|
||||
'IMP' => "Impayé(s)",
|
||||
'IND' => "Demande de paiement des indemnités d'assurances dommages",
|
||||
'INJ' => "Injonction de payer",
|
||||
'LGF' => "Demande en matière de location gérance du fonds",
|
||||
'LIC' => "Ordonnance d'autorisation de licenciements",
|
||||
'LOC' => "Demande relative à un contrat de location (hors immobilier)",
|
||||
'LSQ' => "Séquestre / Désignation ou Levée de séquestre",
|
||||
'NAC' => "Nullité d'un acte",
|
||||
'NAN' => "Demande en matière de nantissement du fonds",
|
||||
'NCO' => "Nullité d'un contrat",
|
||||
'NOM' => "Demande de cessation d'utilisation d'un nom ou d'une enseigne",
|
||||
'NVT' => "Nullité d'une vente",
|
||||
'ODT' => "Opposition à dissolution entraînant T.U.P.",
|
||||
'PCL' => "Action, Demande ou Jugement en cours de procédure collective",
|
||||
'PCV' => "Vente en cours de procédure collective",
|
||||
'PRT' => "Privilèges",
|
||||
'RBT' => "Demande de remboursement de prêt ou du solde du compte bancaire",
|
||||
'RES' => "Action en restitution de la chose, inexécution ou du prix reçu indûment",
|
||||
'RIN' => "Demande relative/radiation inscription (priv/nantissement...)",
|
||||
'RRC' => "Demande en réparation suite à rupture brutale relation commerciale",
|
||||
'RSP' => "Demande en responsabilité",
|
||||
'SAN' => "Demande de sanctions commerciales",
|
||||
'TRA' => "Demande relative travaux en bâtiment",
|
||||
'TSP' => "Demande relative au transport",
|
||||
'VTE' => "Demande relatives à la vente",
|
||||
'' => "Affaires diverses",
|
||||
);
|
@ -10,11 +10,11 @@ class Metier_Partenaires_MAmabis
|
||||
public function __construct($db = null)
|
||||
{
|
||||
if ( $db === null ) {
|
||||
$this->iDb = new WDB();
|
||||
$this->iDb = new Metier_Util_Db();
|
||||
} else {
|
||||
$this->iDb = $db;
|
||||
}
|
||||
|
||||
|
||||
$this->client = new SoapClient(null, array(
|
||||
'location' => 'http://sw2.amabis.com:5100/',
|
||||
'uri' => 'http://www.amabis.com/ns.xsd',
|
||||
@ -28,133 +28,145 @@ class Metier_Partenaires_MAmabis
|
||||
|
||||
public function getZonage($adrNum, $adrIndRep, $adrTypeVoie, $adrLibVoie, $cp, $ville='', $codeRivoli='', $rnvp=false, $raisonSociale='TEST', $debug=false)
|
||||
{
|
||||
$tabRep=array();
|
||||
$tabRep = array();
|
||||
if (!$rnvp) {
|
||||
if ($cp<10000) $cp='0'.$cp;
|
||||
$dep2=substr($cp,0,2)*1;
|
||||
$dep3=substr($cp,0,3)*1;
|
||||
if ($cp < 10000) {
|
||||
$cp='0'.$cp;
|
||||
}
|
||||
$dep2 = substr($cp,0,2)*1;
|
||||
$dep3 = substr($cp,0,3)*1;
|
||||
switch ($dep2) {
|
||||
case 0:
|
||||
/*case 5:
|
||||
case 9:
|
||||
case 15:
|
||||
case 19:
|
||||
case 23:
|
||||
case 32:
|
||||
case 46:
|
||||
case 48:
|
||||
case 82:*/
|
||||
case 97: // DOM
|
||||
case 98: // TOM
|
||||
case 99: // Etranger
|
||||
return $tabRep;
|
||||
break;
|
||||
default:
|
||||
//if ($dep3==975) return $tabRep;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$adresse=addslashes(trim(preg_replace('/ +/',' ', "$adrNum $adrIndRep $adrTypeVoie $adrLibVoie")));
|
||||
$ville=addslashes($ville);
|
||||
$majForcee=false;
|
||||
$adresse = addslashes(trim(preg_replace('/ +/',' ', "$adrNum $adrIndRep $adrTypeVoie $adrLibVoie")));
|
||||
$ville = addslashes($ville);
|
||||
$majForcee = false;
|
||||
|
||||
$ret = $this->iDb->select('jo.zonage', 'zus, zru, zfu, cucs, rnvpStatut, rnvpCorr, rnvpTrt, adr3, adr4, adr5, adr6, adr7, numVoieA, indRepA,
|
||||
typeVoieAlong, typeVoieAcourt, corpVoie, motDir, motDirD, libVoieSec, adr4n32, adr4n38, clePostaleVoie,
|
||||
secteur, cleRoutage, cpx, cleAd, codPaysIso2, codPaysIso3, libPays, codeInsee',
|
||||
"address='$adresse' AND adr_cp='$cp' AND adr_ville='$ville'",false, MYSQL_ASSOC);
|
||||
$zones=@$ret[0];
|
||||
if (count($ret)>0) {
|
||||
$ret = $this->iDb->select(
|
||||
'jo.zonage', 'zus, zru, zfu, cucs, rnvpStatut, rnvpCorr, rnvpTrt, adr3, adr4, adr5, adr6, adr7, numVoieA, indRepA,
|
||||
typeVoieAlong, typeVoieAcourt, corpVoie, motDir, motDirD, libVoieSec, adr4n32, adr4n38, clePostaleVoie,
|
||||
secteur, cleRoutage, cpx, cleAd, codPaysIso2, codPaysIso3, libPays, codeInsee',
|
||||
"address='$adresse' AND adr_cp='$cp' AND adr_ville='$ville'",false, MYSQL_ASSOC);
|
||||
|
||||
if ($zones['rnvpStatut']===null && $rnvp) $majForcee=true;
|
||||
$tabRep['ZUS']=$tabRep['ZFU']=$tabRep['ZRU']=$tabRep['CUCS']='NON';
|
||||
//$tabRep['NZUS']=$tabRep['NZFU']=$tabRep['NZRU']=$tabRep['NCUCS']='';
|
||||
if (count($ret) > 0) {
|
||||
$zones = $ret[0];
|
||||
if ($zones['rnvpStatut'] === null && $rnvp) {
|
||||
$majForcee = true;
|
||||
}
|
||||
$tabRep['ZUS'] = $tabRep['ZFU'] = $tabRep['ZRU'] = $tabRep['CUCS'] = 'NON';
|
||||
|
||||
if (trim($zones['zus'])<>'') {
|
||||
if (trim($zones['zus'])=='NSP') $tabRep['ZUS']='NSP';
|
||||
else $tabRep['ZUS']='OUI';
|
||||
$tabRep['NZUS']=$zones['zus'];
|
||||
if (trim($zones['zus']) != '') {
|
||||
if (trim($zones['zus']) == 'NSP') {
|
||||
$tabRep['ZUS'] = 'NSP';
|
||||
}
|
||||
else {
|
||||
$tabRep['ZUS'] = 'OUI';
|
||||
}
|
||||
$tabRep['NZUS'] = $zones['zus'];
|
||||
}
|
||||
if (trim($zones['zru'])<>'') {
|
||||
if (trim($zones['zru'])=='NSP') $tabRep['ZRU']='NSP';
|
||||
else $tabRep['ZRU']='OUI';
|
||||
$tabRep['NZRU']=$zones['zru'];
|
||||
if (trim($zones['zru']) != '') {
|
||||
if (trim($zones['zru']) == 'NSP') {
|
||||
$tabRep['ZRU'] = 'NSP';
|
||||
}
|
||||
else {
|
||||
$tabRep['ZRU'] = 'OUI';
|
||||
}
|
||||
$tabRep['NZRU'] = $zones['zru'];
|
||||
}
|
||||
if (trim($zones['zfu'])<>'') {
|
||||
if (trim($zones['zfu'])=='NSP') $tabRep['ZFU']='NSP';
|
||||
else $tabRep['ZFU']='OUI';
|
||||
$tabRep['NZFU']=$zones['zfu'];
|
||||
if (trim($zones['zfu']) != '') {
|
||||
if (trim($zones['zfu']) == 'NSP') {
|
||||
$tabRep['ZFU'] = 'NSP';
|
||||
}
|
||||
else {
|
||||
$tabRep['ZFU'] = 'OUI';
|
||||
}
|
||||
$tabRep['NZFU'] = $zones['zfu'];
|
||||
}
|
||||
if (trim($zones['cucs'])<>'') {
|
||||
if (trim($zones['cucs'])=='NSP') $tabRep['CUCS']='NSP';
|
||||
else $tabRep['CUCS']='OUI';
|
||||
$tabRep['NCUCS']=$zones['cucs'];
|
||||
if (trim($zones['cucs']) != '') {
|
||||
if (trim($zones['cucs']) == 'NSP') {
|
||||
$tabRep['CUCS'] = 'NSP';
|
||||
}
|
||||
else {
|
||||
$tabRep['CUCS'] = 'OUI';
|
||||
}
|
||||
$tabRep['NCUCS'] = $zones['cucs'];
|
||||
}
|
||||
|
||||
/** Autres Informations de la RNVP **/
|
||||
if ($rnvp) {
|
||||
//$tabRep['ADR1']=@trim($tabZones['ADR1']);
|
||||
//$tabRep['ADR2']=@trim($tabZones['ADR2']);
|
||||
if (strtoupper(@trim($zones['adr7']))=='FRANCE') $zones['adr7']='';
|
||||
$tabRep['ADR3']=@trim($zones['adr3']);
|
||||
$tabRep['ADR4']=@trim($zones['adr4']);
|
||||
$tabRep['ADR5']=@trim($zones['adr5']);
|
||||
$tabRep['ADR6']=@trim($zones['adr6']);
|
||||
$tabRep['ADR7']=trim($zones['adr7']);
|
||||
if (strtoupper(@trim($zones['adr7'])) == 'FRANCE') {
|
||||
$zones['adr7'] = '';
|
||||
}
|
||||
$tabRep['ADR3'] = @trim($zones['adr3']);
|
||||
$tabRep['ADR4'] = @trim($zones['adr4']);
|
||||
$tabRep['ADR5'] = @trim($zones['adr5']);
|
||||
$tabRep['ADR6'] = @trim($zones['adr6']);
|
||||
$tabRep['ADR7'] = trim($zones['adr7']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (count($ret)==0 || $majForcee) {
|
||||
if (count($ret) == 0 || $majForcee) {
|
||||
try {
|
||||
// Le RNVP ne fonctionne pas sans la Raison Sociale qui est la 1ère ligne d'adresse
|
||||
if (trim($raisonSociale) == '') {
|
||||
$raisonSociale = 'TEST';
|
||||
}
|
||||
$rep = $this->client->zonage(
|
||||
new SoapParam(strtr(
|
||||
"$raisonSociale:$adresse:$cp:$ville",
|
||||
'¿°ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûýýþÿ??',
|
||||
' aaaaaaaceeeeiiiidnoooooouuuuybsaaaaaaaceeeeiiiidnoooooouuuyybyRr'),'adresse'),
|
||||
new SoapParam(':','separateur'),
|
||||
new SoapParam('type=M','options')
|
||||
);
|
||||
|
||||
try {
|
||||
if (trim($raisonSociale)=='') $raisonSociale='TEST'; // Le RNVP ne fonctionne pas sans la Raison Sociale qui est la 1ère ligne d'adresse
|
||||
$rep=$this->client->zonage( new SoapParam(strtr("$raisonSociale:$adresse:$cp:$ville",
|
||||
'¿°ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûýýþÿ??',
|
||||
' aaaaaaaceeeeiiiidnoooooouuuuybsaaaaaaaceeeeiiiidnoooooouuuyybyRr'),'adresse'),
|
||||
new SoapParam(':','separateur'),
|
||||
new SoapParam('type=M','options')
|
||||
);
|
||||
/*$rep=$this->client->zonage( "<adresse></adresse>".
|
||||
"<separateur>:</separateur>".
|
||||
"<options>type=M</options>");*/
|
||||
|
||||
/** Découpage des ZFU, CUCS etcs...
|
||||
**/
|
||||
$fp=fopen(LOG_PATH.'/amabis.log', 'a');
|
||||
fwrite($fp, date('d-m-Y H:i:s').' - '.implode("\n", $rep)."\n============================================================================\n");
|
||||
fclose($fp);
|
||||
/** Découpage des ZFU, CUCS etcs... **/
|
||||
$fp = fopen(LOG_PATH.'/amabis.log', 'a');
|
||||
fwrite($fp, date('d-m-Y H:i:s').' - '.implode("\n", $rep)."\n============================================================================\n");
|
||||
fclose($fp);
|
||||
|
||||
$tabZones=explode(',',$rep['zonage']); // ZUS=OUI,NZUS=1127020,ZFU=OUI,NZFU=11270ZF,CUCS=OUI,NCUCS=1127020
|
||||
foreach ($tabZones as $zone) {
|
||||
$tabTmp=explode('=',$zone);
|
||||
if (trim($tabTmp[0])<>'')
|
||||
$tabRep[$tabTmp[0]]=$tabTmp[1];
|
||||
}
|
||||
if (@$tabRep['ZUS']=='NSP') $tabRep['NZUS']='NSP';
|
||||
if (@$tabRep['ZRU']=='NSP') $tabRep['NZRU']='NSP';
|
||||
if (@$tabRep['ZFU']=='NSP') $tabRep['NZFU']='NSP';
|
||||
if (@$tabRep['CUCS']=='NSP') $tabRep['NCUCS']='NSP';
|
||||
$adresse=stripslashes(trim(preg_replace('/ +/',' ', "$adrNum $adrIndRep $adrTypeVoie $adrLibVoie")));
|
||||
$ville=stripslashes($ville);
|
||||
$tabRepTmp=array();
|
||||
$tabTmp=explode('=',utf8_decode($rep['objdesc']));
|
||||
//print_r($tabTmp);
|
||||
//die();
|
||||
$tabZones=array();
|
||||
foreach ($tabTmp as $iZone=>$zone) {
|
||||
$pos=strrpos($zone,',');
|
||||
if ($iZone==0) {
|
||||
$nomZoneSuiv=$zone;
|
||||
continue;
|
||||
}
|
||||
$tabZones[$nomZoneSuiv]=substr($zone,0,$pos);
|
||||
$nomZoneSuiv=substr($zone,$pos+1);
|
||||
}
|
||||
if (strtoupper(@trim($tabZones['ADR7']))=='FRANCE') $tabZones['ADR7']='';
|
||||
$tabTmp=explode('|', $tabZones['VOIEA']);
|
||||
$typeVoieAcourt=@trim($tabTmp[1]);
|
||||
$tabInsert=array(
|
||||
$tabZones = explode(',',$rep['zonage']); // ZUS=OUI,NZUS=1127020,ZFU=OUI,NZFU=11270ZF,CUCS=OUI,NCUCS=1127020
|
||||
foreach ($tabZones as $zone) {
|
||||
$tabTmp = explode('=',$zone);
|
||||
if (trim($tabTmp[0]) != '') {
|
||||
$tabRep[$tabTmp[0]]=$tabTmp[1];
|
||||
}
|
||||
}
|
||||
if (@$tabRep['ZUS']=='NSP') $tabRep['NZUS']='NSP';
|
||||
if (@$tabRep['ZRU']=='NSP') $tabRep['NZRU']='NSP';
|
||||
if (@$tabRep['ZFU']=='NSP') $tabRep['NZFU']='NSP';
|
||||
if (@$tabRep['CUCS']=='NSP') $tabRep['NCUCS']='NSP';
|
||||
$adresse=stripslashes(trim(preg_replace('/ +/',' ', "$adrNum $adrIndRep $adrTypeVoie $adrLibVoie")));
|
||||
$ville=stripslashes($ville);
|
||||
$tabRepTmp=array();
|
||||
$tabTmp=explode('=',utf8_decode($rep['objdesc']));
|
||||
//print_r($tabTmp);
|
||||
//die();
|
||||
$tabZones=array();
|
||||
foreach ($tabTmp as $iZone=>$zone) {
|
||||
$pos=strrpos($zone,',');
|
||||
if ($iZone==0) {
|
||||
$nomZoneSuiv=$zone;
|
||||
continue;
|
||||
}
|
||||
$tabZones[$nomZoneSuiv]=substr($zone,0,$pos);
|
||||
$nomZoneSuiv=substr($zone,$pos+1);
|
||||
}
|
||||
if (strtoupper(@trim($tabZones['ADR7']))=='FRANCE') $tabZones['ADR7']='';
|
||||
$tabTmp=explode('|', $tabZones['VOIEA']);
|
||||
$typeVoieAcourt=@trim($tabTmp[1]);
|
||||
$tabInsert=array(
|
||||
'address'=>$adresse,
|
||||
'adr_cp'=>$cp,
|
||||
'adr_ville'=>$ville,
|
||||
@ -162,8 +174,8 @@ class Metier_Partenaires_MAmabis
|
||||
'zru'=>@$tabRep['NZRU'],
|
||||
'zfu'=>@$tabRep['NZFU'],
|
||||
'cucs'=>@$tabRep['NCUCS'],
|
||||
);
|
||||
$tabUpdate=array(
|
||||
);
|
||||
$tabUpdate=array(
|
||||
'adrNum'=>$adrNum,
|
||||
'adrIndRep'=>$adrIndRep,
|
||||
'adrTypeVoie'=>$adrTypeVoie,
|
||||
@ -198,65 +210,57 @@ class Metier_Partenaires_MAmabis
|
||||
'libPays' => @trim($tabZones['NATREFLIB']),
|
||||
'codeInsee' => @trim($tabZones['LOCREFCLEO']),
|
||||
'source' => 'Amabis',
|
||||
);
|
||||
$dateInsert=0;
|
||||
if ($majForcee) {
|
||||
$adresseL=addslashes($adresse);
|
||||
$villeL=addslashes($ville);
|
||||
);
|
||||
$dateInsert=0;
|
||||
if ($majForcee) {
|
||||
$adresseL=addslashes($adresse);
|
||||
$villeL=addslashes($ville);
|
||||
|
||||
$ret = $this->iDb->select('jo.zonage', 'dateInsert*1 as dateInsert', "address='$adresseL' AND adr_cp='$cp' AND adr_ville='$villeL'", false);
|
||||
$dateInsert=@$ret[0]['dateInsert']*1;
|
||||
$this->iDb->update('jo.zonage', array_merge($tabUpdate,array('dateInsert'=>$dateInsert)), "address='$adresseL' AND adr_cp='$cp' AND adr_ville='$villeL'", false);
|
||||
//echo "Mise à jour de l'adresse du $dateInsert pour address='$adresseL' AND adr_cp='$cp' AND adr_ville='$villeL'".EOL;
|
||||
}
|
||||
$ret = $this->iDb->select('jo.zonage', 'dateInsert*1 as dateInsert', "address='$adresseL' AND adr_cp='$cp' AND adr_ville='$villeL'", false);
|
||||
$dateInsert=@$ret[0]['dateInsert']*1;
|
||||
$this->iDb->update('jo.zonage', array_merge($tabUpdate,array('dateInsert'=>$dateInsert)), "address='$adresseL' AND adr_cp='$cp' AND adr_ville='$villeL'", false);
|
||||
//echo "Mise à jour de l'adresse du $dateInsert pour address='$adresseL' AND adr_cp='$cp' AND adr_ville='$villeL'".PHP_EOL;
|
||||
}
|
||||
|
||||
if ($dateInsert==0) {
|
||||
$this->iDb->insert('jo.zonage', array_merge($tabInsert,$tabUpdate), false);
|
||||
//echo "Insertion de l'adresse (".$zones['rnvpStatut'].")!".EOL;
|
||||
}
|
||||
if ($dateInsert==0) {
|
||||
$this->iDb->insert('jo.zonage', array_merge($tabInsert,$tabUpdate), false);
|
||||
//echo "Insertion de l'adresse (".$zones['rnvpStatut'].")!".PHP_EOL;
|
||||
}
|
||||
|
||||
$tabTmp[0]=explode(',', $tabZones['LOCREFCLEP']);
|
||||
$tabTmp[1]=explode(',', $tabZones['LOCREFCP']);
|
||||
$tabTmp[2]=explode(',', $tabZones['LOCREFTYPP']);
|
||||
$tabTmp[3]=explode(',', $tabZones['LOCREFLIBD']);
|
||||
$tabTmp[4]=explode(',', $tabZones['LOCREFLIBD2']);
|
||||
foreach($tabTmp[0] as $iCleP=>$cleP) {
|
||||
$tabInsert=array(
|
||||
'codeInsee' => @trim($tabZones['LOCREFCLEO']),
|
||||
'villeLib' => @trim($tabZones['LOCREFLIBP']),
|
||||
'villePopu' => @trim($tabZones['LOCREFPOP']),
|
||||
'cleAchPost'=> $cleP,
|
||||
'codePostal'=> $tabTmp[1][$iCleP],
|
||||
'typePostal'=> $tabTmp[2][$iCleP],
|
||||
'libAchP32' => @preg_replace('/^\//','',$tabTmp[3][$iCleP]),
|
||||
'libAchP38' => @preg_replace('/^\//','',$tabTmp[4][$iCleP]),
|
||||
'source' => 'Amabis',
|
||||
'dateInsert'=> date('YmdHis'),
|
||||
);
|
||||
$this->iDb->insert('jo.villesCP', $tabInsert, false);
|
||||
//echo mysql_error().EOL;
|
||||
}
|
||||
$tabTmp[0]=explode(',', $tabZones['LOCREFCLEP']);
|
||||
$tabTmp[1]=explode(',', $tabZones['LOCREFCP']);
|
||||
$tabTmp[2]=explode(',', $tabZones['LOCREFTYPP']);
|
||||
$tabTmp[3]=explode(',', $tabZones['LOCREFLIBD']);
|
||||
$tabTmp[4]=explode(',', $tabZones['LOCREFLIBD2']);
|
||||
foreach($tabTmp[0] as $iCleP=>$cleP) {
|
||||
$tabInsert = array(
|
||||
'codeInsee' => @trim($tabZones['LOCREFCLEO']),
|
||||
'villeLib' => @trim($tabZones['LOCREFLIBP']),
|
||||
'villePopu' => @trim($tabZones['LOCREFPOP']),
|
||||
'cleAchPost'=> $cleP,
|
||||
'codePostal'=> $tabTmp[1][$iCleP],
|
||||
'typePostal'=> $tabTmp[2][$iCleP],
|
||||
'libAchP32' => @preg_replace('/^\//','',$tabTmp[3][$iCleP]),
|
||||
'libAchP38' => @preg_replace('/^\//','',$tabTmp[4][$iCleP]),
|
||||
'source' => 'Amabis',
|
||||
'dateInsert'=> date('YmdHis'),
|
||||
);
|
||||
$this->iDb->insert('jo.villesCP', $tabInsert, false);
|
||||
}
|
||||
|
||||
/** Autres Informations de la RNVP
|
||||
**/
|
||||
if ($rnvp) {
|
||||
//$tabRep['ADR1']=@trim($tabZones['ADR1']);
|
||||
//$tabRep['ADR2']=@trim($tabZones['ADR2']);
|
||||
$tabRep['ADR3']=@trim($tabZones['ADR3']);
|
||||
$tabRep['ADR4']=@trim($tabZones['ADR4']);
|
||||
$tabRep['ADR5']=@trim($tabZones['ADR5']);
|
||||
$tabRep['ADR6']=@trim($tabZones['ADR6']);
|
||||
$tabRep['ADR7']=trim($tabZones['ADR7']);
|
||||
}
|
||||
} catch (SoapFault $fault) {
|
||||
//echo 'ERREUR SOAP :'.EOL;
|
||||
//print_r($fault);
|
||||
//echo $this->client->__getLastRequest()."\n";
|
||||
//echo $this->client->__getLastResponse()."\n";
|
||||
$fp=fopen(LOG_PATH.'/amabis.log', 'a');
|
||||
fwrite($fp, date('d-m-Y H:i:s').' - ERREUR SOAP : Requete = '.$this->client->__getLastRequest()."\n Reponse = ".$this->client->__getLastResponse()."\n============================================================================\n");
|
||||
fclose($fp);
|
||||
}
|
||||
/** Autres Informations de la RNVP **/
|
||||
if ($rnvp) {
|
||||
$tabRep['ADR3'] = @trim($tabZones['ADR3']);
|
||||
$tabRep['ADR4'] = @trim($tabZones['ADR4']);
|
||||
$tabRep['ADR5'] = @trim($tabZones['ADR5']);
|
||||
$tabRep['ADR6'] = @trim($tabZones['ADR6']);
|
||||
$tabRep['ADR7'] = trim($tabZones['ADR7']);
|
||||
}
|
||||
} catch (SoapFault $fault) {
|
||||
$fp = fopen(LOG_PATH.'/amabis.log', 'a');
|
||||
fwrite($fp, date('d-m-Y H:i:s').' - ERREUR SOAP : Requete = '.$this->client->__getLastRequest()."\n Reponse = ".$this->client->__getLastResponse()."\n============================================================================\n");
|
||||
fclose($fp);
|
||||
}
|
||||
//return $tabRep;
|
||||
}
|
||||
|
||||
@ -275,26 +279,29 @@ class Metier_Partenaires_MAmabis
|
||||
return $tabRep;
|
||||
}
|
||||
|
||||
function searchByTelFax($tel) {
|
||||
public function searchByTelFax($tel)
|
||||
{
|
||||
return $this->getTelFax('','','','',$tel);
|
||||
}
|
||||
|
||||
function getTelFax($nom, $cp, $ville='', $prenom='', $tel='') {
|
||||
if (trim($tel)<>'')
|
||||
$query="<telep>$tel</telep><scoremini>10</scoremini><distinction>30</distinction>";
|
||||
elseif (trim($prenom)=='')
|
||||
$query="<rs>$nom</rs><cpville>$cp $ville</cpville><scoremini>90</scoremini><distinction>30</distinction>";
|
||||
else
|
||||
$query="<nom>$nom</nom><prenom>$prenom</prenom><cpville>$cp $ville</cpville><scoremini>90</scoremini><distinction>30</distinction>";
|
||||
public function getTelFax($nom, $cp, $ville='', $prenom='', $tel='')
|
||||
{
|
||||
if (trim($tel) != '') {
|
||||
$query = "<telep>$tel</telep><scoremini>10</scoremini><distinction>30</distinction>";
|
||||
}
|
||||
elseif (trim($prenom) == '') {
|
||||
$query = "<rs>$nom</rs><cpville>$cp $ville</cpville><scoremini>90</scoremini><distinction>30</distinction>";
|
||||
}
|
||||
else {
|
||||
$query = "<nom>$nom</nom><prenom>$prenom</prenom><cpville>$cp $ville</cpville><scoremini>90</scoremini><distinction>30</distinction>";
|
||||
}
|
||||
|
||||
$rep=$this->client->rechtel($query);
|
||||
$rep = $this->client->rechtel($query);
|
||||
|
||||
$fp=fopen(LOG_PATH.'/amabis.log', 'a');
|
||||
$fp = fopen(LOG_PATH.'/amabis.log', 'a');
|
||||
fwrite($fp, date('d-m-Y H:i:s')." - $query - ".implode("\n", $rep)."\n============================================================================\n");
|
||||
fwrite($fp, "Requête : ".$this->client->__getLastRequest()."\n");
|
||||
fwrite($fp, "Réponse : ".$this->client->__getLastResponse()."\n");
|
||||
fclose($fp);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
define ('ARTISANAT_DISPO_WEB', 1);
|
||||
include_once(FWK_PATH.'common/curl.php');
|
||||
|
||||
class Metier_Partenaires_MArtisanat {
|
||||
require_once 'framework/common/curl.php';
|
||||
|
||||
class Metier_Partenaires_MArtisanat
|
||||
{
|
||||
public $body = '';
|
||||
public $header = '';
|
||||
public $codeRetour = 0;
|
||||
@ -12,11 +12,11 @@ class Metier_Partenaires_MArtisanat {
|
||||
public $cookie='';
|
||||
public $iDb;
|
||||
public $enCache=false;
|
||||
|
||||
|
||||
function __construct() {
|
||||
$this->iDb=new WDB();
|
||||
$this->iDb=new Metier_Util_Db();
|
||||
}
|
||||
|
||||
|
||||
function getIdentite($siren, $refresh=false) {
|
||||
$siren=$siren*1;
|
||||
$res=$this->iDb->select('jo.artisanat', 'id, siren, actif, numRM, denomination, sigle, nomCommercial, enseigne, fj, effectif, aprm, debutActivite, activite, adresse, cp, ville, cessation, radiation, nbInscriptions, nom, prenom, nomUsage, dateNaiss, lieuNaiss, natio, qualite, qualif, dateQualif, dateFctDeb, dateFctFin, IF(dateInsert>dateUpdate,dateInsert,dateUpdate) AS dateUpdate', "siren=$siren", false, MYSQL_ASSOC);
|
||||
@ -35,7 +35,7 @@ class Metier_Partenaires_MArtisanat {
|
||||
}
|
||||
$this->cookie=$page['header']['Set-Cookie'];
|
||||
$this->referer=$url;
|
||||
|
||||
|
||||
$url='http://www.cma-paris.fr/CMP/rm_recherche.php?dom=Gerer&fonction=cherche';
|
||||
$postData=array( 'siren_op'=>'%3D',
|
||||
'siren'=>$siren,
|
||||
@ -53,7 +53,7 @@ class Metier_Partenaires_MArtisanat {
|
||||
'x'=>56,
|
||||
'y'=>14,
|
||||
);
|
||||
randsleep(1,2);
|
||||
sleep(rand(1, 2));
|
||||
$page=getUrl($url, $this->cookie, $postData, $this->referer, false, 'www.cma-paris.fr', false, '', '', 21);
|
||||
$this->body=$page['body'];
|
||||
$this->codeRetour=$page['code'];
|
||||
@ -62,7 +62,7 @@ class Metier_Partenaires_MArtisanat {
|
||||
return false;
|
||||
}
|
||||
$this->referer=$url;
|
||||
|
||||
|
||||
if (preg_match('/<span.class="rouge">aucune.entreprise.ne.correspond(?:.*)vos.crit(?:.*)de.recherche<\/span>/Uis', $this->body, $matches)) {
|
||||
$url='http://www.cma-paris.fr/CMP/rm_recherche.php?dom=Gerer&fonction=cherche';
|
||||
$postData=array( 'siren_op'=>'%3D',
|
||||
@ -81,7 +81,7 @@ class Metier_Partenaires_MArtisanat {
|
||||
'x'=>56,
|
||||
'y'=>14,
|
||||
);
|
||||
randsleep(1,2);
|
||||
sleep(rand(1, 2));
|
||||
$page=getUrl($url, $this->cookie, $postData, $this->referer, false, 'www.cma-paris.fr', false, '', '', 21);
|
||||
$this->body=$page['body'];
|
||||
$this->codeRetour=$page['code'];
|
||||
@ -91,7 +91,7 @@ class Metier_Partenaires_MArtisanat {
|
||||
}
|
||||
$this->referer=$url;
|
||||
}
|
||||
|
||||
|
||||
/** Gestion des multi-inscriptions au RM **/
|
||||
if (preg_match('/<b class="gris">(.*)entreprises.correspondent(?:.*)vos.crit(?:.*)de.recherche<\/span>/Uis', $this->body, $matches))
|
||||
{
|
||||
@ -113,10 +113,10 @@ class Metier_Partenaires_MArtisanat {
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($iRadMax==-1) die('$iRadMax==-1 Cas impossible !'.EOL.print_r($tabUrls,true).EOL.print_r($matches,true));
|
||||
if ($iRadMax==-1) die('$iRadMax==-1 Cas impossible !'.PHP_EOL.print_r($tabUrls,true).PHP_EOL.print_r($matches,true));
|
||||
// Accès à la dernière fiche
|
||||
$url='http://www.cma-paris.fr/CMP/'.strtr(trim($tabUrls[$iRadMax]),array('&'=>'&'));
|
||||
randsleep(1,2);
|
||||
sleep(rand(1, 2));
|
||||
$page=getUrl($url, $this->cookie, '', $this->referer, false, 'www.cma-paris.fr', false, '', '', 21);
|
||||
$this->body=$page['body'];
|
||||
$this->codeRetour=$page['code'];
|
||||
@ -126,9 +126,9 @@ class Metier_Partenaires_MArtisanat {
|
||||
}
|
||||
$this->referer=$url;
|
||||
}
|
||||
|
||||
|
||||
$tabInsert=array();
|
||||
|
||||
|
||||
if (preg_match('/n° d\'identification \(SIREN\)<\/span><\/td>(?:.*)<td align="left" nowrap>(.*) <\/td>((?:.*)n° de gestion rm<\/span><\/td>(?:.*)<td align="left" nowrap>(.*)<\/td>)?/Uis', $this->body, $matches)) {
|
||||
$sirenLu=$matches[1]*1;
|
||||
if ($siren==$sirenLu) {
|
||||
@ -146,7 +146,7 @@ class Metier_Partenaires_MArtisanat {
|
||||
$this->libErreur='Erreur Siren absent dans la page !';
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$actif=null;
|
||||
if (preg_match("/Renseignements.relatif(?:.*)entreprise(.*)<\/b>/Uis", $this->body, $matches)) {
|
||||
switch (trim(strtr($matches[1],array(chr(160)=>'')))) {
|
||||
@ -154,11 +154,11 @@ class Metier_Partenaires_MArtisanat {
|
||||
case 'radiée': $actif=0; break;
|
||||
default: print_r($matches);die(); break;
|
||||
}
|
||||
//die(EOL.'$actif='.$actif.EOL.print_r($matches));
|
||||
//die(PHP_EOL.'$actif='.$actif.PHP_EOL.print_r($matches));
|
||||
}
|
||||
$tabInsert['actif']=$actif;
|
||||
if ($actif===null) {
|
||||
//die("siren=$siren".EOL."sirenLu=$sirenLu".EOL.$this->body);
|
||||
//die("siren=$siren".PHP_EOL."sirenLu=$sirenLu".PHP_EOL.$this->body);
|
||||
$this->libErreur='Erreur Actif/Radié non trouvé !';
|
||||
return false;
|
||||
}
|
||||
@ -180,7 +180,7 @@ class Metier_Partenaires_MArtisanat {
|
||||
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">code APRM<\/span><\/td>(?:.*)<td align="left">(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches))
|
||||
$tabInsert['aprm']=$matches[1];
|
||||
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">début d\'activité<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches))
|
||||
$tabInsert['debutActivite']=WDate::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches[1]),chr(160),' ')));
|
||||
$tabInsert['debutActivite']=Metier_Util_Date::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches[1]),chr(160),' ')));
|
||||
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise"> activité\(s\) exercée\(s\) donnant lieu à immatriculation<\/span>(?:.*)<td colspan="5">(.*)<\/td>/Uis', $this->body, $matches))
|
||||
$tabInsert['activite']=trim($matches[1]);
|
||||
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">adresse de l\'entreprise<\/span><\/td>(?:.*)<td align="left" colspan="5">(.*)<\/td>/Uis', $this->body, $matches))
|
||||
@ -190,9 +190,9 @@ class Metier_Partenaires_MArtisanat {
|
||||
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">ville<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches))
|
||||
$tabInsert['ville']=trim($matches[1]);
|
||||
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">cessation d\'activité<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches))
|
||||
$tabInsert['cessation']=WDate::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches[1]),chr(160),' ')));
|
||||
$tabInsert['cessation']=Metier_Util_Date::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches[1]),chr(160),' ')));
|
||||
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">radiation du RM<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches))
|
||||
$tabInsert['radiation']=WDate::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches[1]),chr(160),' ')));
|
||||
$tabInsert['radiation']=Metier_Util_Date::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches[1]),chr(160),' ')));
|
||||
$tabEtabs=array();
|
||||
if (preg_match('/<!--deb Etablissements secondaires-->(?:.*)<b class="gris">Aucune inscription complémentaire<\/b>(?:.*)<!--fin Etablissements secondaires-->/Uis', $this->body, $matches))
|
||||
$tabInsert['nbInscriptions']=0;
|
||||
@ -205,8 +205,8 @@ class Metier_Partenaires_MArtisanat {
|
||||
$tabEtabs[$i]['adresse'] =trim(strtr(html_entity_decode($adresse),chr(160),' '));
|
||||
$tabEtabs[$i]['cpVille'] =trim(strtr(html_entity_decode($matches2[2][$i]),chr(160),' '));
|
||||
$tabEtabs[$i]['enseigne']=trim(strtr(html_entity_decode($matches2[3][$i]),chr(160),' '));
|
||||
$tabEtabs[$i]['actDeb'] =WDate::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches2[4][$i]),chr(160),' ')));
|
||||
$tabEtabs[$i]['actFin'] =WDate::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches2[5][$i]),chr(160),' ')));
|
||||
$tabEtabs[$i]['actDeb'] =Metier_Util_Date::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches2[4][$i]),chr(160),' ')));
|
||||
$tabEtabs[$i]['actFin'] =Metier_Util_Date::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches2[5][$i]),chr(160),' ')));
|
||||
$tabInsert['nbInscriptions']++;
|
||||
}
|
||||
}
|
||||
@ -216,7 +216,7 @@ class Metier_Partenaires_MArtisanat {
|
||||
if (preg_match('/<a class="turquoise" href="(rm\.php\?dom=Gerer&fonction=dirigeant&dept_re(.*))" onclick="window\.open\(this\.href/Uis', $this->body, $matches)) {
|
||||
$urlDir='http://www.cma-paris.fr/CMP/'.strtr(trim($matches[1]),array('&'=>'&'));
|
||||
//die($urlDir);
|
||||
randsleep(1,2);
|
||||
sleep(rand(1, 2));
|
||||
$page=getUrl($urlDir, $this->cookie, '', $this->referer, false, 'www.cma-paris.fr', false, '', '', 21);
|
||||
$this->body=$page['body'];
|
||||
$this->codeRetour=$page['code'];
|
||||
@ -225,7 +225,7 @@ class Metier_Partenaires_MArtisanat {
|
||||
return false;
|
||||
}
|
||||
$this->referer=$url;
|
||||
|
||||
|
||||
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">nom<\/span><\/td>(?:.*)<td align="left" nowrap>(.*)<\/td>/Uis', $this->body, $matches))
|
||||
$tabInsert['nom']=trim(strtr(html_entity_decode($matches[1]),chr(160),' '));
|
||||
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">prénom<\/span><\/td>(?:.*)<td align="left" nowrap>(.*)<\/td>/Uis', $this->body, $matches))
|
||||
@ -233,7 +233,7 @@ class Metier_Partenaires_MArtisanat {
|
||||
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">nom d\'usage<\/span><\/td>(?:.*)<td align="left" nowrap>(.*)<\/td>/Uis', $this->body, $matches))
|
||||
$tabInsert['nomUsage']=trim(strtr(html_entity_decode($matches[1]),chr(160),' '));
|
||||
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"(?:.*)<span class="turquoise"> date de naissance<\/span><\/td>(?:.*)-->(?:.*)<td(?: +)align="left">(.*)<\/td>/Uis', $this->body, $matches))
|
||||
$tabInsert['dateNaiss']=WDate::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches[1]),chr(160),' ')));
|
||||
$tabInsert['dateNaiss']=Metier_Util_Date::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches[1]),chr(160),' ')));
|
||||
// if (preg_match('/date de naissance(.*)<td background="inter\/pix3_turquoise\.gif" align="right"/Uis', $this->body, $matches))
|
||||
// die(print_r($matches));
|
||||
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise"> lieu de naissance<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches))
|
||||
@ -245,15 +245,15 @@ class Metier_Partenaires_MArtisanat {
|
||||
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right" nowrap><span class="turquoise">qualification artisanale<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches))
|
||||
$tabInsert['qualif']=trim(strtr(html_entity_decode($matches[1]),chr(160),' '));
|
||||
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">date d\'obtention<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches))
|
||||
$tabInsert['datequalif']=WDate::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches[1]),chr(160),' ')));
|
||||
$tabInsert['datequalif']=Metier_Util_Date::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches[1]),chr(160),' ')));
|
||||
|
||||
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">prise de fonction<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches))
|
||||
$tabInsert['dateFctDeb']=WDate::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches[1]),chr(160),' ')));
|
||||
$tabInsert['dateFctDeb']=Metier_Util_Date::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches[1]),chr(160),' ')));
|
||||
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">fin de fonction<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches))
|
||||
$tabInsert['dateFctFin']=WDate::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches[1]),chr(160),' ')));
|
||||
|
||||
$tabInsert['dateFctFin']=Metier_Util_Date::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches[1]),chr(160),' ')));
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Insertion en base de données
|
||||
$tabInsert['dateInsert']=date('Y-m-d H:i:s');
|
||||
$id=$this->iDb->insert('jo.artisanat', $tabInsert, true);
|
||||
@ -262,44 +262,9 @@ class Metier_Partenaires_MArtisanat {
|
||||
$tabInsert2['dateInsert']=$tabInsert['dateInsert'];
|
||||
$id2=$this->iDb->insert('jo.artisanat_etab', $tabInsert2, true);
|
||||
}
|
||||
|
||||
|
||||
$tabInsert['dateUpdate']=substr($tabInsert['dateInsert'],0,10);
|
||||
unset($tabInsert['dateInsert']);
|
||||
|
||||
/*
|
||||
$tabRet=array( 'id' => $id,// A calculer après insert
|
||||
'Pertinence' => 100,
|
||||
'Siret' => $siren.'00000',
|
||||
'Siege' => $siege,
|
||||
'Nom' => $nom,
|
||||
'Nom2' => $nomCom,
|
||||
'Sigle' => '',//prepareString($etab['Sigle']),
|
||||
'Enseigne' => $ens,
|
||||
'Adresse' => $adr,
|
||||
'Adresse2' => $adr2,//prepareString($etab['Adresse2']),
|
||||
'CP' => $cp,
|
||||
'Ville' => $ville,
|
||||
'Tel' => '',//$etab['Tel'],
|
||||
'Fax' => '',//$etab['Fax'],
|
||||
'FJ' => $cj,
|
||||
'FJLib' => $cjLib,
|
||||
'Siren' => $siren,
|
||||
'Nic' => '00000',
|
||||
'Actif' => 0,
|
||||
'NafEtab' => $naf,
|
||||
'NafEtabLib' => $nafLib,
|
||||
'NafEnt' => $naf,
|
||||
'NafEntLib' => $nafLib,
|
||||
'NumRC' => $numRC,
|
||||
'NumRC2' => $numRC2,
|
||||
'NumGreffe' => $greffe_num,
|
||||
'DateCreation' => $dateCre,
|
||||
'DateRadiation' => $dateRad,
|
||||
'DateCloture' => $dateCloture,
|
||||
'DateUpdate' => substr($dateInsert,0,10),
|
||||
);
|
||||
return $tabRet;
|
||||
*/
|
||||
}
|
||||
return $tabInsert;
|
||||
}
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?php
|
||||
require_once 'framework/common/dates.php';
|
||||
|
||||
class Metier_Partenaires_MBanques
|
||||
{
|
||||
public $tabActivite = array(
|
||||
@ -49,16 +47,16 @@ class Metier_Partenaires_MBanques
|
||||
|
||||
protected $iDb;
|
||||
|
||||
function __construct($db = null)
|
||||
public function __construct($db = null)
|
||||
{
|
||||
if ( $db === null ) {
|
||||
$this->iDb = new WDB();
|
||||
$this->iDb = new Metier_Util_Db();
|
||||
} else {
|
||||
$this->iDb = $db;
|
||||
}
|
||||
}
|
||||
|
||||
function getInfoBanque($codeBanque)
|
||||
public function getInfoBanque($codeBanque)
|
||||
{
|
||||
$ret = $this->iDb->select(
|
||||
'insee.BDF_Etabs',
|
||||
@ -69,7 +67,7 @@ class Metier_Partenaires_MBanques
|
||||
return $tabRet;
|
||||
}
|
||||
|
||||
function getInfoGuichet($codeBanque, $codeGuichet)
|
||||
public function getInfoGuichet($codeBanque, $codeGuichet)
|
||||
{
|
||||
$tabBanque=$this->getInfoBanque($codeBanque);
|
||||
$tabTel=$this->getTelGuichet($codeBanque,$codeGuichet);
|
||||
@ -86,66 +84,13 @@ class Metier_Partenaires_MBanques
|
||||
return array_merge($tabRet, $tabBanque, $tabTel);
|
||||
}
|
||||
|
||||
function getTelGuichet($codeBanque, $codeGuichet)
|
||||
public function getTelGuichet($codeBanque, $codeGuichet)
|
||||
{
|
||||
$ret = $this->iDb->select(
|
||||
'insee.Mandel_banques',
|
||||
'Tel, Fax',
|
||||
$ret = $this->iDb->select('insee.Mandel_banques', 'Tel, Fax',
|
||||
"CodeB=$codeBanque AND CodeG=$codeGuichet",false, MYSQL_ASSOC);
|
||||
if (isset($ret[0]))
|
||||
return $ret[0];
|
||||
else
|
||||
return array();
|
||||
}
|
||||
|
||||
function getListeBanques($siren)
|
||||
{
|
||||
$tabRet = array();
|
||||
if ($siren*1>1000) {
|
||||
$res=$this->iDb->select('insee.banques', 'codeBanque, codeGuichet, libBanqueGuichet, precis, dateSource*1 AS dateSource', "siren=$siren", false, MYSQL_ASSOC);
|
||||
$tmp=$this->iDb->select('insee.fedRib', "codeBanque, codeGuichet, CONCAT(libBanque,' ',libGuichet) AS libBanqueGuichet, 0 AS precis, IF (dateInfo='0000-00-00', dateDispo*1, dateInfo*1) AS dateSource", "siren=$siren", false, MYSQL_ASSOC);
|
||||
$res=array_merge($res, $tmp);
|
||||
foreach ($res as $tabBanque) {
|
||||
$dateSource=$tabBanque['dateSource'];
|
||||
$codBanque=$tabBanque['codeBanque'];
|
||||
$codGuichet=$tabBanque['codeGuichet'];
|
||||
$libBanque=trim($tabBanque['libBanqueGuichet']);
|
||||
$found=false;
|
||||
$adrBanque1=$adrBanque2=$adrBanqueCP=$adrBanqueVille='';
|
||||
|
||||
if ($codBanque>0 && $codGuichet>0 && $dateSource>(date('Y')-4)*10000+101 && $dateSource<date('Ymd')) {
|
||||
$tmp=$this->iDb->select('insee.BDF_Etabs b, insee.BDF_Guichets g', 'g.bdfFibCodeEtab AS banque, g.bdfFibCodeGuichet AS guichet, b.bdfFibDenom40 AS nomBanque, b.bdfFibDenom10 AS sigleBanque, g.bdfFibDenom20 AS nomGuichet, g.bdfFibAdresse1 AS adresse1, g.bdfFibAdresse2 AS adresse2, g.bdfFibAdresse3 AS adresse3, g.CP, g.Ville', "g.bdfFibCodeEtab=$codBanque AND g.bdfFibCodeGuichet=$codGuichet AND b.bdfFibCodeEtab=g.bdfFibCodeEtab", false, MYSQL_ASSOC);
|
||||
if (isset($tmp[0])) {
|
||||
$libBanque=trim($tmp[0]['nomBanque'].' '.$tmp[0]['nomGuichet']);
|
||||
$adrBanque1=$tmp[0]['adresse1'];
|
||||
$adrBanque2=trim($tmp[0]['adresse2'].' '.$tmp[0]['adresse3']);
|
||||
$adrBanqueCP=$tmp[0]['CP'];
|
||||
$adrBanqueVille=$tmp[0]['Ville'];
|
||||
$found=true;
|
||||
};
|
||||
}
|
||||
if (!$found && $codBanque>0 && $dateSource>(date('Y')-4)*10000+101 && $dateSource<date('Ymd')) {
|
||||
$tmp=$this->iDb->select('insee.BDF_Etabs', "bdfFibCodeEtab AS banque, '' AS guichet, bdfFibDenom40 AS nomBanque, '' AS nomGuichet, '' AS adresse1, '' AS adresse2, '' AS adresse3, '' AS CP, '' AS Ville", "bdfFibCodeEtab=$codBanque", false, MYSQL_ASSOC);
|
||||
if (isset($tmp[0])) {
|
||||
$libBanque=trim($tmp[0]['nomBanque'].' '.$tmp[0]['nomGuichet']);
|
||||
$adrBanque1=$tmp[0]['adresse1'];
|
||||
$adrBanque2=trim($tmp[0]['adresse2'].' '.$tmp[0]['adresse3']);
|
||||
$adrBanqueCP=$tmp[0]['CP'];
|
||||
$adrBanqueVille=$tmp[0]['Ville'];
|
||||
} else continue;
|
||||
} else continue;
|
||||
|
||||
$tabRet[] = array(
|
||||
'codeBanque' => $codBanque,
|
||||
'codeGuichet' => $codGuichet,
|
||||
'libBanque' => $libBanque,
|
||||
'adresse1' => $adrBanque1,
|
||||
'adresse2' => $adrBanque2,
|
||||
'cp' => $adrBanqueCP,
|
||||
'ville' => $adrBanqueVille,
|
||||
);
|
||||
}
|
||||
}
|
||||
return $tabRet;
|
||||
}
|
||||
}
|
@ -1,7 +1,4 @@
|
||||
<?php
|
||||
require_once 'framework/common/curl.php';
|
||||
require_once 'framework/common/dates.php';
|
||||
|
||||
class Metier_Partenaires_MBilans
|
||||
{
|
||||
/**
|
||||
@ -278,7 +275,7 @@ class Metier_Partenaires_MBilans
|
||||
public function __construct($siren, $db = null)
|
||||
{
|
||||
if ( $db === null ) {
|
||||
$this->iDb = new WDB();
|
||||
$this->iDb = new Metier_Util_Db();
|
||||
} else {
|
||||
$this->iDb = $db;
|
||||
}
|
||||
@ -307,10 +304,10 @@ class Metier_Partenaires_MBilans
|
||||
}
|
||||
$result = $this->iDb->select('jo.bodacc_detail', 'Bodacc_Date_Parution, dateEffet, typeEven', $where, false, MYSQL_ASSOC);
|
||||
if ( count($result) > 0 ) {
|
||||
$dateDerDepot = $classWDate->dateT('Y-m-d','Ymd',$result[0]['dateEffet'])*1;
|
||||
$dateDerDepot = Metier_Util_Date::dateT('Y-m-d','Ymd',$result[0]['dateEffet'])*1;
|
||||
if ($dateDerDepot != 0) {
|
||||
$this->dernierExerciceDepose = $classWDate->dateT('Y-m-d','d/m/Y',$result[0]['dateEffet']);
|
||||
$this->dernierExerciceDeposeLe = $classWDate->dateT('Y-m-d','d/m/Y',$result[0]['Bodacc_Date_Parution']);
|
||||
$this->dernierExerciceDepose = Metier_Util_Date::dateT('Y-m-d','d/m/Y',$result[0]['dateEffet']);
|
||||
$this->dernierExerciceDeposeLe = Metier_Util_Date::dateT('Y-m-d','d/m/Y',$result[0]['Bodacc_Date_Parution']);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -325,7 +322,6 @@ class Metier_Partenaires_MBilans
|
||||
*/
|
||||
public function listeBilans($accesPartenaire = false, $nbMaxBilans = 0)
|
||||
{
|
||||
$classWDate = new WDate();
|
||||
$dateDerDepot = 0;
|
||||
$tabRet = $tabRet2 = $tabRet3 = array();
|
||||
|
||||
@ -340,24 +336,11 @@ class Metier_Partenaires_MBilans
|
||||
'typeBilan, dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaieOrigine, dateInsert, partenaire',
|
||||
$where, false, MYSQL_ASSOC);
|
||||
|
||||
if ($accesPartenaire) {
|
||||
$iGreffe = new Metier_Partenaires_MGreffes($this->iDb);
|
||||
$tabRet = $tabRet2 = $iGreffe->getListeBilans($this->siren);
|
||||
}
|
||||
|
||||
$tabTri = array();
|
||||
|
||||
if ( count($tabRet)>0 ) {
|
||||
foreach ($tabRet as $millesime => $bil) {
|
||||
$typeBilan = substr($millesime,0,1);
|
||||
$dateExercice = $classWDate->dateT('d/m/Y','Ymd', substr($millesime,1,10));
|
||||
$tabTri[''.$dateExercice.'-'.$typeBilan] = $millesime;
|
||||
}
|
||||
}
|
||||
|
||||
if ( count($ret) > 0 ) {
|
||||
foreach ($ret as $i => $bil) {
|
||||
$millesime = $classWDate->dateT('Ymd','d/m/Y',$bil['dateExercice']);
|
||||
$millesime = Metier_Util_Date::dateT('Ymd','d/m/Y',$bil['dateExercice']);
|
||||
$tabRet[''.$bil['typeBilan'].$millesime] = array(
|
||||
'dateProvPartenaire' => $bil['dateProvPartenaire'],
|
||||
'dateInsert' => strtr($bil['dateInsert'], array(' '=>'',':'=>'','-'=>'')),
|
||||
@ -425,9 +408,8 @@ class Metier_Partenaires_MBilans
|
||||
return $this->Bilans[$typeBilan.$millesime];
|
||||
}
|
||||
|
||||
$classWDate = new WDate();
|
||||
$clotureDate = new Zend_Date($millesime, 'dd/MM/yyyy');
|
||||
$clotureDateSql = $clotureDate->toString('yyyyMMdd');
|
||||
$clotureDate = DateTime::createFromFormat('d/m/Y', $millesime);
|
||||
$clotureDateSql = $clotureDate->format('Ymd');
|
||||
if ($accesPartenaire) {
|
||||
// On ne veut pas de bilans "Téléchargés" directement sur Internet
|
||||
$strSansBilansWeb=' AND partenaire<>7 ';
|
||||
@ -441,59 +423,6 @@ class Metier_Partenaires_MBilans
|
||||
'dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaie, typeBilan, monnaieOrigine, unite, postes, partenaire, id, confidentiel, dateInsert',
|
||||
"siren='$this->siren' AND typeBilan='$typeBilan' AND dateExercice='$clotureDateSql' $strSansBilansWeb", false, MYSQL_ASSOC);
|
||||
|
||||
if ( $accesPartenaire ) {
|
||||
$iGreffe = new Metier_Partenaires_MGreffes($this->iDb);
|
||||
if ( count($ret) == 0 ) {
|
||||
if ($refPart=='' || $refPart==0) {
|
||||
$tabTmp = $iGreffe->getListeBilans($this->siren);
|
||||
foreach ($tabTmp as $idx=>$bil)
|
||||
{
|
||||
$typeBil=substr($idx,0,1);
|
||||
$millBil=substr($idx,1,10);
|
||||
if ($typeBil==$typeBilan && $millBil==$millesime)
|
||||
{
|
||||
$refPart=$bil['ref'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$tabBilan = $iGreffe->getBilan($this->siren, $refPart);
|
||||
|
||||
if ($tabBilan)
|
||||
{
|
||||
$strPostes='';
|
||||
foreach ($tabBilan['POSTES'] as $poste=>$valeur) {
|
||||
$strPostes.="$poste=$valeur;";
|
||||
}
|
||||
|
||||
$tabInsert=array(
|
||||
'siren' => $this->siren,
|
||||
'dateProvPartenaire'=> $tabBilan['DATE_FRAICHE_BILAN'],
|
||||
'dateExercice' => $classWDate->dateT('d/m/Y','Ymd',$tabBilan['DATE_CLOTURE']),
|
||||
'dateExercicePre' => $classWDate->dateT('d/m/Y','Ymd',$tabBilan['DATE_CLOTURE_PRE']),
|
||||
'dureeExercice' => $tabBilan['DUREE_MOIS'],
|
||||
'dureeExercicePre' => $tabBilan['DUREE_MOIS_PRE'],
|
||||
'monnaie' => $tabBilan['MONNAIE'],
|
||||
'typeBilan' => $tabBilan['TYPE_BILAN'],
|
||||
'monnaieOrigine' => $tabBilan['MONNAIE_ORI'],
|
||||
'unite' => $tabBilan['MONNAIE_LIV_UNITE'],
|
||||
'postes' => $strPostes,
|
||||
'partenaire' => $tabBilan['SOURCE'],
|
||||
);
|
||||
if (!$this->iDb->insert('jo.bilans', $tabInsert, true)) {
|
||||
$this->iDb->update('jo.bilans', $tabInsert, "siren='$this->siren' AND typeBilan='$typeBilan' AND dateExercice='$clotureDateSql'");
|
||||
}
|
||||
|
||||
$ret = $this->iDb->select('jo.bilans',
|
||||
'dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaie, typeBilan, monnaieOrigine, unite, postes, partenaire, id, confidentiel, dateInsert',
|
||||
"siren='$this->siren' AND typeBilan='$typeBilan' AND dateExercice='$clotureDateSql'", true);
|
||||
if (count($ret) > 0) {
|
||||
$bilan = $ret[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --- Selection du premier bilan
|
||||
if (count($ret) > 0) {
|
||||
$bilan = $ret[0];
|
||||
@ -621,8 +550,8 @@ class Metier_Partenaires_MBilans
|
||||
|| ( ($tabBilan['N15']*1==0 || $tabBilan['N32']*1==0) && $tabBilan['CONSOLIDE']=='S' ) // Réel Simplifié
|
||||
) {
|
||||
|
||||
$cloturePreDate = $clotureDate->subMonth($bilan['dureeExercice']);
|
||||
$cloturePreDateSql = $cloturePreDate->toString('yyyyMM');
|
||||
$cloturePreDate = $clotureDate->sub(new DateInterval('P'.$bilan['dureeExercice'].'M'));
|
||||
$cloturePreDateSql = $cloturePreDate->format('Ym');
|
||||
|
||||
// --- Recherche des infos du bilan précédent
|
||||
$ret = $this->iDb->select('jo.bilans',
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?php
|
||||
require_once 'framework/common/curl.php';
|
||||
|
||||
class Metier_Partenaires_MBourse
|
||||
{
|
||||
protected $siren = false;
|
||||
@ -11,89 +9,120 @@ class Metier_Partenaires_MBourse
|
||||
$this->siren = $siren;
|
||||
|
||||
if ( $db === null ) {
|
||||
$this->iDb = new WDB();
|
||||
$this->iDb = new Metier_Util_Db();
|
||||
} else {
|
||||
$this->iDb = $db;
|
||||
}
|
||||
}
|
||||
|
||||
public function getLibSource($source)
|
||||
/**
|
||||
* Libellé de la source
|
||||
*
|
||||
* @param string $source
|
||||
* @return string
|
||||
*/
|
||||
public function getLibSource($code)
|
||||
{
|
||||
switch ($source) {
|
||||
case 'B': return 'Business Wire'; break;
|
||||
case 'H': return 'Hugin'; break;
|
||||
case 'A': return 'ActusNews'; break;
|
||||
case 'D': return 'DiRelease'; break;
|
||||
case 'E': return 'Les Echos'; break;
|
||||
default: return 'N/C'; break;
|
||||
switch ($code) {
|
||||
case 'B':
|
||||
return 'Business Wire';
|
||||
break;
|
||||
case 'H':
|
||||
return 'Hugin';
|
||||
break;
|
||||
case 'A':
|
||||
return 'ActusNews';
|
||||
break;
|
||||
case 'D':
|
||||
return 'DiRelease';
|
||||
break;
|
||||
case 'E':
|
||||
return 'Les Echos';
|
||||
break;
|
||||
default:
|
||||
return 'N/C';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/** Vérifie la validité de la structure d'un code ISIN
|
||||
**
|
||||
** @param string $isin
|
||||
** @return bool
|
||||
**/
|
||||
function isIsin($isin)
|
||||
/**
|
||||
* Vérifie la validité de la structure d'un code ISIN
|
||||
*
|
||||
* @param string $isin
|
||||
* @return boolean
|
||||
*/
|
||||
public function isIsin($isin)
|
||||
{
|
||||
if (strlen(trim($isin))) {
|
||||
$cle = substr($isin, -1);
|
||||
$isinLeft = substr($isin, 0, strlen($isin)-1);
|
||||
$letter2number = array('A'=>10, 'B'=>11, 'C'=>12, 'D'=>13, 'E'=>14, 'F'=>15, 'G'=>16, 'H'=>17, 'I'=>18, 'J'=>19, 'K'=>20, 'L'=>21, 'M'=>22, 'N'=>23, 'O'=>24, 'P'=>25, 'Q'=>26, 'R'=>27, 'S'=>28, 'T'=>29, 'U'=>30, 'V'=>31, 'W'=>32, 'X'=>33, 'Y'=>34, 'Z'=>35);
|
||||
$letter2number = array(
|
||||
'A'=>10, 'B'=>11, 'C'=>12, 'D'=>13, 'E'=>14,
|
||||
'F'=>15, 'G'=>16, 'H'=>17, 'I'=>18, 'J'=>19,
|
||||
'K'=>20, 'L'=>21, 'M'=>22, 'N'=>23, 'O'=>24,
|
||||
'P'=>25, 'Q'=>26, 'R'=>27, 'S'=>28, 'T'=>29,
|
||||
'U'=>30, 'V'=>31, 'W'=>32, 'X'=>33, 'Y'=>34, 'Z'=>35
|
||||
);
|
||||
$isinConvertion = strtr($isinLeft, $letter2number);
|
||||
$sum = '';
|
||||
$sumFinal = 0;
|
||||
for($i=0; $i<strlen($isinConvertion); ++$i) $sum .= (($i % 2) ? 1 : 2)*$isinConvertion[$i];
|
||||
for($i=0; $i<strlen($sum); ++$i) $sumFinal += $sum[$i];
|
||||
for($i=0; $i<strlen($isinConvertion); ++$i) {
|
||||
$sum .= (($i % 2) ? 1 : 2) * $isinConvertion[$i];
|
||||
}
|
||||
for($i=0; $i<strlen($sum); ++$i) {
|
||||
$sumFinal += $sum[$i];
|
||||
}
|
||||
if ($sumFinal % 10){
|
||||
$cleVerif = ((int)($sumFinal/10) + 1)*10-$sumFinal;
|
||||
$cleVerif = ((int)($sumFinal / 10) + 1) * 10 - $sumFinal;
|
||||
} else {
|
||||
$cleVerif = 0;
|
||||
}
|
||||
if ($cle == $cleVerif) {
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else return false;
|
||||
}
|
||||
|
||||
/** Obtenir le code ISIN à partir d'un siren
|
||||
**
|
||||
** @param integer $siren
|
||||
** @return string
|
||||
**/
|
||||
function getCodeIsin($siren=false)
|
||||
/**
|
||||
* Obtenir le code ISIN à partir d'un siren
|
||||
* @param string $siren
|
||||
* @return string
|
||||
*/
|
||||
public function getCodeIsin($siren=false)
|
||||
{
|
||||
if (!$siren)
|
||||
$siren=$this->siren;
|
||||
if (!$siren) {
|
||||
$siren = $this->siren;
|
||||
}
|
||||
|
||||
$tabTmp = $this->iDb->select('jo.infos_entrep', 'isin', "siren=$siren AND isin<>''", false, MYSQL_ASSOC);
|
||||
$tabTmp = $this->iDb->select('jo.infos_entrep', 'isin', "siren=$siren AND isin!=''", false, MYSQL_ASSOC);
|
||||
return trim(@$tabTmp[0]['isin']);
|
||||
}
|
||||
|
||||
/** Obtenir le SIREN à partir d'un code ISIN
|
||||
**
|
||||
** @param string $isin Code ISIN
|
||||
** @return integer
|
||||
**/
|
||||
function getCodeSiren($isin)
|
||||
/**
|
||||
* Obtenir le SIREN à partir d'un code ISIN
|
||||
* @param string $isin
|
||||
* @return string
|
||||
*/
|
||||
public function getCodeSiren($isin)
|
||||
{
|
||||
$tabTmp = $this->iDb->select('jo.infos_entrep', 'siren', "isin='$isin' AND siren<>0", false, MYSQL_ASSOC);
|
||||
$tabTmp = $this->iDb->select('jo.infos_entrep', 'siren', "isin='$isin' AND siren!=0", false, MYSQL_ASSOC);
|
||||
return trim($tabTmp[0]['siren']);
|
||||
}
|
||||
|
||||
/** A partir d'un siren, récupère les informations règlementés
|
||||
**
|
||||
** @param integer $siren
|
||||
** @param integer $id
|
||||
** @return unknown
|
||||
**/
|
||||
function getInfosReg($siren=false, $id=null)
|
||||
/**
|
||||
* A partir d'un siren, récupère les informations règlementés
|
||||
* @param string $siren
|
||||
* @param integer $id
|
||||
* @return array
|
||||
*/
|
||||
public function getInfosReg($siren=false, $id=null)
|
||||
{
|
||||
if (!$siren) $siren = $this->siren;
|
||||
|
||||
$isin = $this->getCodeIsin($siren);
|
||||
$tabRet=array();
|
||||
$tabRet = array();
|
||||
if ($isin!='') {
|
||||
|
||||
$sqlID = '';
|
||||
@ -138,22 +167,22 @@ class Metier_Partenaires_MBourse
|
||||
return $tabRet;
|
||||
}
|
||||
|
||||
/** A partir d'un siren, récupère les informations boursières
|
||||
**
|
||||
** @param integer $siren
|
||||
** @return unknown
|
||||
**/
|
||||
function getInfosBourse($siren=false)
|
||||
/**
|
||||
* A partir d'un siren, récupère les informations boursières
|
||||
*
|
||||
* @param string $siren
|
||||
* @return array
|
||||
*/
|
||||
public function getInfosBourse($siren=false)
|
||||
{
|
||||
global $timer;
|
||||
if (!$siren) {
|
||||
$siren = $this->siren;
|
||||
}
|
||||
|
||||
if (!$siren)
|
||||
$siren=$this->siren;
|
||||
$isin = $this->getCodeIsin($siren);
|
||||
|
||||
$isin=$this->getCodeIsin($siren);
|
||||
$timer['infosBoursieres-getCodeIsin']=microtime(true);
|
||||
$tabRet=array();
|
||||
if ($isin<>'') {
|
||||
$tabRet = array();
|
||||
if ($isin != '') {
|
||||
$tabRes = $this->iDb->select(
|
||||
'sdv1.bourse_isin b, sdv1.bourse_cours c',
|
||||
'siren, raisonSociale, adresse, effectif, code_sicovam, code_mnemo, code_bloomberg, code_datastream, code_isin, logo, code_ric, '.
|
||||
@ -161,18 +190,18 @@ class Metier_Partenaires_MBourse
|
||||
'marche, placeCotation, description, secteur, activite, activiteDet, dirigeants, actionnaires, chiffresTrim, '.
|
||||
'c.autre, c.`date`, c.`heure`, c.`open` , c.`high` , c.`low` , c.`close` , c.`volume`',
|
||||
"code_isin='$isin' /*OR siren=$siren)*/ AND b.code_isin=c.isin AND c.autre IN('','e','f','g','m','s','u') ORDER BY c.`date` DESC, c.`heure` DESC LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
|
||||
$tabRet=$tabRes[0];
|
||||
$timer['infosBoursieres-infosIsin']=microtime(true);
|
||||
|
||||
$tabRes = $this->iDb->select('sdv1.bourse_cours',
|
||||
'min(close) AS coursMin, avg(close) AS coursMoy, max(close) AS coursMax',
|
||||
"isin='$isin' GROUP BY isin", false, MYSQL_ASSOC);
|
||||
$tabTmp=$tabRes[0];
|
||||
$tabRet['coursMin']=$tabTmp['coursMin'];
|
||||
$tabRet['coursMoy']=$tabTmp['coursMoy'];
|
||||
$tabRet['coursMax']=$tabTmp['coursMax'];
|
||||
$timer['infosBoursieres-derniersCours']=microtime(true);
|
||||
if (count($tabRes) > 0) {
|
||||
$tabRet = $tabRes[0];
|
||||
$tabRes = $this->iDb->select('sdv1.bourse_cours',
|
||||
'min(close) AS coursMin, avg(close) AS coursMoy, max(close) AS coursMax',
|
||||
"isin='$isin' GROUP BY isin", false, MYSQL_ASSOC);
|
||||
if (count($tabRes) > 0) {
|
||||
$tabTmp = $tabRes[0];
|
||||
$tabRet['coursMin'] = $tabTmp['coursMin'];
|
||||
$tabRet['coursMoy'] = $tabTmp['coursMoy'];
|
||||
$tabRet['coursMax'] = $tabTmp['coursMax'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $tabRet;
|
||||
|
@ -1,280 +1,476 @@
|
||||
<?php
|
||||
class Metier_Partenaires_MCadastre
|
||||
{
|
||||
protected $siren = false;
|
||||
protected $iDb;
|
||||
/**
|
||||
* Siren
|
||||
* @var string
|
||||
*/
|
||||
protected $siren = null;
|
||||
|
||||
/** Droits des locaux **/
|
||||
private static $tabCodeDroit=array(
|
||||
'P'=>'Propriétaire',
|
||||
'U'=>'Usufruitier', // (associé avec N)
|
||||
'N'=>'Nu-propriétaire', // (associé avec U)
|
||||
'B'=>'Bailleur à construction', // (associé avec R)
|
||||
'R'=>'Preneur à construction', // (associé avec B)
|
||||
'F'=>'Foncier', // (associé avec D ou T)
|
||||
'T'=>'Tenuyer', // (associé avec F)
|
||||
'D'=>'Domanier', // (associé avec F)
|
||||
'V'=>'Bailleur d\'un bail à réhabilitation', // (associé avec W)
|
||||
'W'=>'Preneur d\'un bail à réhabilitation', // (associé avec V)
|
||||
'A'=>'Locataire-Attributaire', // (associé avec P)
|
||||
'E'=>'Emphytéote', // (associé avec P)
|
||||
'K'=>'Antichrésiste', // (associé avec P)
|
||||
'L'=>'Fonctionnaire logé',
|
||||
'G'=>'Gérant, mandataire, gestionnaire',
|
||||
'S'=>'Syndic de copropriété',
|
||||
'H'=>'Associé dans une société en transparence fiscale',// (associé avec P)
|
||||
'O'=>'Autorisation d\'occupation temporaire (70 ans)',
|
||||
'J'=>'Jeune agriculteur',
|
||||
'Q'=>'Gestionnaire taxe sur les bureaux (Ile-de-France)',
|
||||
'X'=>'La Poste Occupant et propriétaire',
|
||||
'Y'=>'La Poste Occupant et non propriétaire',
|
||||
'C'=>'Fiduciaire',
|
||||
/**
|
||||
* Database
|
||||
* @var Metier_Util_Db
|
||||
*/
|
||||
protected $iDb;
|
||||
|
||||
/**
|
||||
* Droits des locaux
|
||||
* @var array
|
||||
*/
|
||||
private static $codeDroit = array(
|
||||
'A' => 'Locataire-Attributaire', // (associé avec P)
|
||||
'B' => 'Bailleur à construction', // (associé avec R)
|
||||
'C' => 'Fiduciaire',
|
||||
'D' => 'Domanier', // (associé avec F)
|
||||
'E' => 'Emphytéote', // (associé avec P)
|
||||
'F' => 'Foncier', // (associé avec D ou T)
|
||||
'G' => 'Gérant, mandataire, gestionnaire',
|
||||
'H' => 'Associé dans une société en transparence fiscale', // (associé avec P)
|
||||
'J' => 'Jeune agriculteur',
|
||||
'K' => 'Antichrésiste', // (associé avec P)
|
||||
'L' => 'Fonctionnaire logé',
|
||||
'M' => 'Occupant d\'une parcelle appartenant au département de Mayotte ou à l\'Etat', // (associé avec P)
|
||||
'N' => 'Nu-propriétaire', // (associé avec U)
|
||||
'O' => 'Autorisation d\'occupation temporaire (70 ans)',
|
||||
'P' => 'Propriétaire',
|
||||
'Q' => 'Gestionnaire taxe sur les bureaux (Ile-de-France)',
|
||||
'R' => 'Preneur à construction', // (associé avec B)
|
||||
'S' => 'Syndic de copropriété',
|
||||
'T' => 'Tenuyer', // (associé avec F)
|
||||
'U' => 'Usufruitier', // (associé avec N)
|
||||
'V' => 'Bailleur d\'un bail à réhabilitation', // (associé avec W)
|
||||
'W' => 'Preneur d\'un bail à réhabilitation', // (associé avec V)
|
||||
'X' => 'La Poste Occupant et propriétaire',
|
||||
'Y' => 'La Poste Occupant et non propriétaire',
|
||||
);
|
||||
|
||||
/** Nature des locaux **/
|
||||
private static $tabNatureLoc=array(
|
||||
'AP'=>'Appartement',
|
||||
'AT'=>'Antenne téléphone',
|
||||
'AU'=>'Autoroute',
|
||||
'CA'=>'Commerce sans boutique',
|
||||
'CB'=>'Local divers',
|
||||
'CD'=>'Dépendance commerciale',
|
||||
'CH'=>'Chantier',
|
||||
'CM'=>'Commerce avec boutique',
|
||||
'DC'=>'Dépendance lieux communs',
|
||||
'DE'=>'Dépendance bâtie isolée',
|
||||
'LC'=>'Local commun',
|
||||
'MA'=>'Maison',
|
||||
'ME'=>'Maison exceptionnelle',
|
||||
'MP'=>'Maison partagée par une limite territoriale',
|
||||
'SM'=>'Sol de maison',
|
||||
'U' =>'Etablissement industriel',
|
||||
'U1'=>'Gare',
|
||||
'U2'=>'Gare - Triage',
|
||||
'U3'=>'Gare - Atelier matériel',
|
||||
'U4'=>'Gare - Atelier magasin',
|
||||
'U5'=>'Gare - Dépôt Titulaire',
|
||||
'U6'=>'Gare - Dépôt Réel',
|
||||
'U7'=>'Gare - Matériel transport',
|
||||
'U8'=>'Gare - Entretien matériel roulant',
|
||||
'U9'=>'Gare - Station usine',
|
||||
'UE'=>'Transformateur électrique',
|
||||
'UG'=>'Appareil à gaz',
|
||||
'UN'=>'Usine nucléaire',
|
||||
'US'=>'Etablissement industriel',
|
||||
/**
|
||||
* Nature des locaux
|
||||
* @var array
|
||||
*/
|
||||
private static $natureLocaux = array(
|
||||
'AP' => 'Appartement',
|
||||
'AT' => 'Antenne téléphone',
|
||||
'AU' => 'Autoroute',
|
||||
'CA' => 'Commerce sans boutique',
|
||||
'CB' => 'Local divers',
|
||||
'CD' => 'Dépendance commerciale',
|
||||
'CH' => 'Chantier',
|
||||
'CM' => 'Commerce avec boutique',
|
||||
'DC' => 'Dépendance lieux communs',
|
||||
'DE' => 'Dépendance bâtie isolée',
|
||||
'LC' => 'Local commun',
|
||||
'MA' => 'Maison',
|
||||
'ME' => 'Maison exceptionnelle',
|
||||
'MP' => 'Maison partagée par une limite territoriale',
|
||||
'PP' => 'ND',
|
||||
'SM' => 'Sol de maison',
|
||||
'U' => 'Etablissement industriel',
|
||||
'U1' => 'Gare',
|
||||
'U2' => 'Gare - Triage',
|
||||
'U3' => 'Gare - Atelier matériel',
|
||||
'U4' => 'Gare - Atelier magasin',
|
||||
'U5' => 'Gare - Dépôt Titulaire',
|
||||
'U6' => 'Gare - Dépôt Réel',
|
||||
'U7' => 'Gare - Matériel transport',
|
||||
'U8' => 'Gare - Entretien matériel roulant',
|
||||
'U9' => 'Gare - Station usine',
|
||||
'UE' => 'Transformateur électrique',
|
||||
'UG' => 'Appareil à gaz',
|
||||
'UN' => 'Usine nucléaire',
|
||||
'US' => 'Etablissement industriel',
|
||||
);
|
||||
|
||||
/** Code Affectation des PEV (Partie d'EValuation) **/
|
||||
private static $tabCodePEV=array(
|
||||
'B'=>'Bâtiment industriel',
|
||||
'C'=>'Commerce',
|
||||
'H'=>'Habitation',
|
||||
'K'=>'Locaux administratifs non passibles de la Taxe d\'Habitation',
|
||||
'L'=>'Hôtel',
|
||||
'P'=>'Professionnel',
|
||||
'S'=>'Biens divers passibles de la Taxe d\'Habitation',
|
||||
'T'=>'Terrain industriel',
|
||||
/**
|
||||
* Code Affectation des PEV (Partie d'EValuation)
|
||||
* @var array
|
||||
*/
|
||||
private static $PEV = array(
|
||||
'A' => 'Locaux commerciaux/Biens divers passibles de la TH', // Nouveau en 2014
|
||||
'B' => 'Bâtiment industriel', // lié à CCOEVA = A OU E
|
||||
'C' => 'Commerce',
|
||||
'E' => 'Locaux commerciaux/Biens divers non passibles de TH et TP', // Nouveau en 2014
|
||||
'H' => 'Habitation',
|
||||
'K' => 'Locaux administratifs non passibles de la TH',
|
||||
'L' => 'Hôtel',
|
||||
'P' => 'Professionnel',
|
||||
'S' => 'Biens divers passibles de la TH',
|
||||
'T' => 'Terrain industriel', // lié à CCOEVA = A OU E
|
||||
);
|
||||
|
||||
/** Code Groupes Personnes Morales **/
|
||||
private static $tabGrpPerMor=array(
|
||||
0=>'Personne morale', // non remarquable
|
||||
1=>'Etat',
|
||||
2=>'Région',
|
||||
3=>'Département',
|
||||
4=>'Commune',
|
||||
5=>'Office HLM',
|
||||
6=>'Personne morale représentant des sociétés',
|
||||
7=>'Copropriétaire',
|
||||
8=>'Associé',
|
||||
9=>'Etablissement public ou organismes assimilés',
|
||||
|
||||
/**
|
||||
* Code Groupes Personnes Morales
|
||||
* @var array
|
||||
*/
|
||||
private static $grpPersonnesMorales = array(
|
||||
// Si suivi de la lettre "A" : personnes soumises à la CAAA (caisses d'assurance accidents agricoles) en Alsace et en Moselle
|
||||
0 => 'Personne morale', // non remarquable
|
||||
1 => 'Etat',
|
||||
2 => 'Région',
|
||||
3 => 'Département',
|
||||
4 => 'Commune',
|
||||
5 => 'Office HLM',
|
||||
6 => 'Personne morale représentant des sociétés',
|
||||
7 => 'Copropriétaire',
|
||||
8 => 'Associé',
|
||||
9 => 'Etablissement public ou organismes assimilés',
|
||||
);
|
||||
|
||||
/** Nature des parcelles (cultures) **/
|
||||
private static $tabNaturePar=array(
|
||||
'AB'=>'Terrains à batir',
|
||||
'AG'=>'Terrains d\'agrément',
|
||||
'B' =>'Bois',
|
||||
'BF'=>'Futaies feuillues',
|
||||
'BM'=>'Futaies mixtes',
|
||||
'BO'=>'Oseraies',
|
||||
'BP'=>'Peupleraies',
|
||||
'BR'=>'Futaies résineuses',
|
||||
'BS'=>'Taillies sous futaies',
|
||||
'BT'=>'Taillies simples',
|
||||
'CA'=>'Carrières',
|
||||
'CH'=>'Chemins de fer, Canaux de Navigation',
|
||||
'E' =>'Eaux',
|
||||
'J' =>'Jardins',
|
||||
'L' =>'Landes',
|
||||
'LB'=>'Landes Boisées',
|
||||
'P' =>'Prés',
|
||||
'PA'=>'Pâtures ou Pâturages',
|
||||
'PC'=>'Pacages ou Pâtis',
|
||||
'PE'=>'Prés d\'embouche',
|
||||
'PH'=>'Herbages',
|
||||
'PP'=>'Prés, Pâtures ou Herbages plantes',
|
||||
'S' =>'Sols',
|
||||
'T' =>'Terre',
|
||||
'TP'=>'Terres plantées',
|
||||
'VE'=>'Vergers',
|
||||
'VI'=>'Vignes',
|
||||
/**
|
||||
* Code Formes Juridiques spécifiques du Cadastre
|
||||
* @var array
|
||||
*/
|
||||
private static $FjCad = array(
|
||||
'F001' => 'Les copropriétaires',
|
||||
'F002' => 'Les associés de la SCI (en transparence fiscale)',
|
||||
'F003' => 'Professionnels très pauvres du foncier',
|
||||
);
|
||||
|
||||
public function __construct($siren=0, $db = null)
|
||||
/**
|
||||
* Nature des parcelles (cultures)
|
||||
* @var array
|
||||
*/
|
||||
private static $natureParcelles = array(
|
||||
'AB' => 'Terrains à batir',
|
||||
'AG' => 'Terrains d\'agrément',
|
||||
'B' => 'Bois',
|
||||
'BF' => 'Futaies feuillues',
|
||||
'BM' => 'Futaies mixtes',
|
||||
'BO' => 'Oseraies',
|
||||
'BP' => 'Peupleraies',
|
||||
'BR' => 'Futaies résineuses',
|
||||
'BS' => 'Taillies sous futaies',
|
||||
'BT' => 'Taillies simples',
|
||||
'CA' => 'Carrières',
|
||||
'CH' => 'Chemins de fer, Canaux de Navigation',
|
||||
'E' => 'Eaux',
|
||||
'J' => 'Jardins',
|
||||
'L' => 'Landes',
|
||||
'LB' => 'Landes Boisées',
|
||||
'P' => 'Prés',
|
||||
'PA' => 'Pâtures ou Pâturages',
|
||||
'PC' => 'Pacages ou Pâtis',
|
||||
'PE' => 'Prés d\'embouche',
|
||||
'PH' => 'Herbages',
|
||||
'PP' => 'Prés, Pâtures ou Herbages plantes',
|
||||
'S' => 'Sols',
|
||||
'T' => 'Terre',
|
||||
'TP' => 'Terres plantées',
|
||||
'VE' => 'Vergers',
|
||||
'VI' => 'Vignes',
|
||||
);
|
||||
|
||||
/**
|
||||
* Cadastre
|
||||
* @param string $siren
|
||||
* @param Metier_Util_Db $db
|
||||
*/
|
||||
public function __construct($siren = null, $db = null)
|
||||
{
|
||||
$this->siren = $siren;
|
||||
if ( $db === null ) {
|
||||
$this->iDb = new WDB();
|
||||
$this->iDb = new Metier_Util_Db();
|
||||
} else {
|
||||
$this->iDb = $db;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Type de personne morale au cadastre
|
||||
* @param string $ccogrm
|
||||
* @return string
|
||||
*/
|
||||
public function getTypeRM($ccogrm)
|
||||
{
|
||||
$ccogrm = trim($ccogrm);
|
||||
|
||||
if (array_key_exists($ccogrm, self::$grpPersonnesMorales)) {
|
||||
$lib = self::$grpPersonnesMorales[$ccogrm];
|
||||
} elseif (array_key_exists(intval(substr($ccogrm,0,1)), self::$grpPersonnesMorales)) {
|
||||
$lib = self::$grpPersonnesMorales[intval(substr($ccogrm,0,1))];
|
||||
if (substr($ccogrm,1,1) == 'A') {
|
||||
$lib.= " soumis à CAAA (Caisses d'Assurance Accidents Agricoles) en Alsace et en Moselle";
|
||||
}
|
||||
} else {
|
||||
$lib = '';
|
||||
}
|
||||
|
||||
return $lib;
|
||||
}
|
||||
|
||||
/**
|
||||
* Nature des locaux ou parcelles
|
||||
* @param string $code
|
||||
* @param string $type
|
||||
* @return string
|
||||
*/
|
||||
public function getNatureLabel($code, $type = 'local')
|
||||
{
|
||||
if ($type == 'local') {
|
||||
if (array_key_exists($code, self::$PEV)) {
|
||||
return self::$PEV[$code];
|
||||
}
|
||||
} elseif ($type == 'parcelle') {
|
||||
if (array_key_exists($code, self::$natureParcelles)) {
|
||||
return self::$natureParcelles[$code];
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Locaux : Propriétés baties
|
||||
* @param string $siren
|
||||
* @return array
|
||||
*/
|
||||
public function getLocaux($siren = null)
|
||||
{
|
||||
if ($siren === null) {
|
||||
$siren = $this->siren;
|
||||
}
|
||||
|
||||
$results = $this->iDb->select(
|
||||
'sdv1.cad_perloc l, sdv1.cad_permor e',
|
||||
'e.INTCIF, e.DNUPER, e.CCOGRM, e.DDENPM, e.DSIPMO, e.DFORME, e.DSIREN, e.DLIGN3, e.DLIGN4, e.DLIGN5, e.DLIGN6, e.CCODEP, e.CCOCOM AS companyCCOCOM,
|
||||
l.CCODRO, l.CCOCOM, l.CCOPRF, l.CCOSEC, l.DNUPLA, l.DNUBAT, l.DESC, l.DNIV, l.DPOR, l.CCONLC, l.CCOAFF0, l.DSUPOD0, l.CCOAFF1, l.DSUPOD1, l.CCOAFF2, l.DSUPOD2, l.CCOAFF3, l.DSUPOD3, l.CCOAFF4, l.DSUPOD4, l.CCOAFF5, l.DSUPOD5, l.CCOAFF6, l.DSUPOD6, l.CCOAFF7, l.DSUPOD7, l.CCOAFF8, l.DSUPOD8, l.CCOAFF9, l.DSUPOD9, l.CCODEP, l.DLICOM, l.CCORIV, l.CNAVOI, l.DLIVOI, l.DNUVOI, l.DLTNUV',
|
||||
"e.DSIREN='$siren' AND e.INTCIF=l.INTCIF AND e.DNUPER=l.DNUPER", false, MYSQL_ASSOC);
|
||||
|
||||
$locaux = array();
|
||||
if (count($results) > 0) {
|
||||
foreach ($results as $i => $loc) {
|
||||
$format = array(
|
||||
'idCentre' => $loc['INTCIF'],
|
||||
'idPmMajic' => $loc['DNUPER'],
|
||||
'pmGroupe' => trim($loc['CCOGRM']),
|
||||
'pmGroupeLib' => $this->getTypeRM(trim($loc['CCOGRM'])),
|
||||
'pmNom' => trim($loc['DDENPM']),
|
||||
'pmSigle' => trim($loc['DSIPMO']),
|
||||
'pmFJ' => $loc['DFORME'],
|
||||
'siren' => trim($loc['DSIREN']),
|
||||
'pmAdrL3' => trim($loc['DLIGN3']),
|
||||
'pmAdrL4' => trim($loc['DLIGN4']),
|
||||
'pmAdrL5' => trim($loc['DLIGN5']),
|
||||
'pmAdrL6' => trim($loc['DLIGN6']),
|
||||
'pmAdrDep' => trim($loc['CCODEP']),
|
||||
'pmAdrCom' => trim($loc['companyCCOCOM']),
|
||||
'localDroit' => trim($loc['CCODRO']),
|
||||
'localDroitLib' => self::$codeDroit[trim($loc['CCODRO'])],
|
||||
'localDep' => trim($loc['CCODEP']),
|
||||
'localCom' => trim($loc['CCOCOM']),
|
||||
'localComLib' => trim($loc['DLICOM']),
|
||||
'localComAbs' => trim($loc['CCOPRF']),
|
||||
'localRivoli' => trim($loc['CCORIV']),
|
||||
'localNumVoie' => trim($loc['DNUVOI']),
|
||||
'localIndVoie' => trim($loc['DLTNUV']),
|
||||
'localTypVoie' => trim($loc['CNAVOI']),
|
||||
'localLibVoie' => trim($loc['DLIVOI']),
|
||||
'localSection' => trim($loc['CCOSEC']),
|
||||
'localNumPlan' => trim($loc['DNUPLA']),
|
||||
'localNumBat' => trim($loc['DNUBAT']),
|
||||
'localEntEsc' => trim($loc['DESC']),
|
||||
'localNiveau' => trim($loc['DNIV']),
|
||||
'localEntEsc' => trim($loc['CCONLC']),
|
||||
'localPEV' => array(),
|
||||
);
|
||||
// Calcul de surface
|
||||
$surface = 0;
|
||||
for($j = 0; $j < 10; $j++) {
|
||||
$pevCode = trim($loc['CCOAFF'.$j]);
|
||||
$pevSurf = intval(trim($loc['DSUPOD'.$j]));
|
||||
if ($pevCode != '' && $pevSurf > 0) {
|
||||
$format['localPEV'][$j] = array(
|
||||
'pevCode' => $pevCode,
|
||||
'pevType' => self::$PEV[$pevCode],
|
||||
'pevSurface' => $pevSurf,
|
||||
);
|
||||
$surface+= $pevSurf;
|
||||
}
|
||||
}
|
||||
$format['localSurface'] = $surface;
|
||||
$locaux[] = $format;
|
||||
}
|
||||
}
|
||||
|
||||
return $locaux;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parcelles : Propriétés non baties
|
||||
* @param string $siren
|
||||
* @return array
|
||||
*/
|
||||
function getLocaux($siren=false)
|
||||
public function getParcelles($siren = null)
|
||||
{
|
||||
if (!$siren) $siren=$this->siren;
|
||||
if ($siren === null) {
|
||||
$siren = $this->siren;
|
||||
};
|
||||
|
||||
$tabTmp=$this->iDb->select(
|
||||
'sdv1.cad_perloc l, sdv1.cad_permor e',
|
||||
'e.INTCIF, e.DNUPER, e.CCOGRM, e.DDENPM, e.DSIPMO, e.DFORME, e.FILLER, e.DSIREN, e.DLIGN3, e.DLIGN4, e.DLIGN5, e.DLIGN6, e.CCODEP, e.CCOCOM,
|
||||
l.CCODRO, l.CCOCOM, l.CCOPRF, l.CCOSEC, l.DNUPLA, l.DNUBAT, l.DESC, l.DNIV, l.DPOR, l.CCONLC, l.CCOAFF0, l.DSUPOD0, l.CCOAFF1, l.DSUPOD1, l.CCOAFF2, l.DSUPOD2, l.CCOAFF3, l.DSUPOD3, l.CCOAFF4, l.DSUPOD4, l.CCOAFF5, l.DSUPOD5, l.CCOAFF6, l.DSUPOD6, l.CCOAFF7, l.DSUPOD7, l.CCOAFF8, l.DSUPOD8, l.CCOAFF9, l.DSUPOD9, l.CCODEP, l.DLICOM, l.CCORIV, l.CNAVOI, l.DLIVOI, l.DNUVOI, l.DLTNUV',
|
||||
"e.DSIREN='$siren' AND e.INTCIF=l.INTCIF AND e.DNUPER=l.DNUPER", false, MYSQL_ASSOC);
|
||||
$tabRet=array();
|
||||
if (count($tabTmp)>0 ) {
|
||||
foreach ($tabTmp as $i=>$loc) {
|
||||
$tabLoc = array(
|
||||
'idCentre'=>$loc['INTCIF'],
|
||||
'idPmMajic'=>$loc['DNUPER'],
|
||||
'pmGroupe'=>trim($loc['CCOGRM']),
|
||||
'pmGroupeLib'=>self::$tabGrpPerMor[trim($loc['CCOGRM'])],
|
||||
'pmNom'=>trim($loc['DDENPM']),
|
||||
'pmSigle'=>trim($loc['DSIPMO']),
|
||||
'pmFJ'=>$loc['DFORME'], // $loc['FILLER'],
|
||||
'siren'=>trim($loc['DSIREN']),
|
||||
'pmAdrL3'=>trim($loc['DLIGN3']),
|
||||
'pmAdrL4'=>trim($loc['DLIGN4']),
|
||||
'pmAdrL5'=>trim($loc['DLIGN5']),
|
||||
'pmAdrL6'=>trim($loc['DLIGN6']),
|
||||
'pmAdrDep'=>trim($loc['CCODEP']),
|
||||
'pmAdrCom'=>trim($loc['CCOCOM']),
|
||||
'localDroit'=>trim($loc['CCODRO']),
|
||||
'localDroitLib'=>self::$tabCodeDroit[trim($loc['CCODRO'])],
|
||||
'localDep'=>trim($loc['CCODEP']),
|
||||
'localCom'=>trim($loc['CCOCOM']),
|
||||
'localComLib'=>trim($loc['DLICOM']),
|
||||
'localComAbs'=>trim($loc['CCOPRF']),
|
||||
'localRivoli'=>trim($loc['CCORIV']),
|
||||
'localNumVoie'=>trim($loc['DNUVOI']),
|
||||
'localIndVoie'=>trim($loc['DLTNUV']),
|
||||
'localTypVoie'=>trim($loc['CNAVOI']),
|
||||
'localLibVoie'=>trim($loc['DLIVOI']),
|
||||
'localSection'=>trim($loc['CCOSEC']),
|
||||
'localNumPlan'=>trim($loc['DNUPLA']),
|
||||
'localNumBat'=>trim($loc['DNUBAT']),
|
||||
'localEntEsc'=>trim($loc['DESC']),
|
||||
'localNumPlan'=>trim($loc['DNIV']),
|
||||
'localNumBat'=>trim($loc['DPOR']),
|
||||
'localEntEsc'=>trim($loc['CCONLC']),
|
||||
'localPEV'=>array(),
|
||||
);
|
||||
$surface=0;
|
||||
for($j=0;$j<10;$j++) {
|
||||
$pevCode=trim($loc['CCOAFF'.$j]);
|
||||
$pevSurf=trim($loc['DSUPOD'.$j])*1;
|
||||
if ($pevCode<>'' && $pevSurf>0) {
|
||||
$tabLoc['localPEV'][$j]=array(
|
||||
'pevCode'=>$pevCode,
|
||||
'pevType'=>self::$tabCodePEV[$pevCode],
|
||||
'pevSurface'=>$pevSurf,
|
||||
);
|
||||
$surface+=$pevSurf;
|
||||
}
|
||||
}
|
||||
$tabLoc['localSurface']=$surface;
|
||||
$tabRet[]=$tabLoc;
|
||||
/**
|
||||
* CADBAT_NB_TOT nombre Cadastre nombre de postes BATIMENT du SIREN toutes addresses
|
||||
* CADTER_NB_TOT nombre Cadastre nombre de postes TERRAIN du SIREN toutes addresses
|
||||
* CADBAT_NB_PROP nombre Cadastre nombre de postes BATIMENT à l'adresse dont elle est propriétaire
|
||||
* CADTER_NB_PROP nombre Cadastre nombre de postes TERRAIN à l'adresse dont elle est propriétaire
|
||||
* CADBAT_NB_NONPROP nombre Cadastre nombre de postes BATIMENT à l'adresse dont elle n'est pas propriétaire
|
||||
* CADTER_NB_NONPROP nombre Cadastre nombre de postes TERRAINS à l'adresse dont elle n'est pas propriétaire
|
||||
* CADBAT_SURF_CUM nombre Cadastre Cumul Surfaces des batiments à l'addresse
|
||||
* CADBAT_SURF_TOT nombre Cadastre Surface totale des batiments du SIREN
|
||||
* CADTER_SURF_CUM nombre Cadastre Cumul Surfaces des terrains à l'addresse
|
||||
* CADTER_SURF_TOT nombre Cadastre Surface totale des terrains du SIREN
|
||||
*/
|
||||
}
|
||||
}
|
||||
return $tabRet;
|
||||
}
|
||||
|
||||
function getParcelles($siren=false) {
|
||||
if (!$siren)
|
||||
$siren=$this->siren;
|
||||
|
||||
$tabTmp=$this->iDb->select(
|
||||
$results = $this->iDb->select(
|
||||
'sdv1.cad_perpar p, sdv1.cad_permor e',
|
||||
'e.INTCIF, e.DNUPER, e.CCOGRM, e.DDENPM, e.DSIPMO, e.DFORME, e.FILLER, e.DSIREN, e.DLIGN3, e.DLIGN4, e.DLIGN5, e.DLIGN6, e.CCODEP, e.CCOCOM,
|
||||
'e.INTCIF, e.DNUPER, e.CCOGRM, e.DDENPM, e.DSIPMO, e.DFORME, e.DSIREN, e.DLIGN3, e.DLIGN4, e.DLIGN5, e.DLIGN6, e.CCODEP, e.CCOCOM AS companyCCOCOM,
|
||||
p.CCODRO, p.CCOCOM, p.CCOPRF, p.CCOSEC, p.DNUPLA, p.DCNPAR, p.DSGRPF0, p.DCNSUF0, p.DSGRPF1, p.DCNSUF1, p.DSGRPF2, p.DCNSUF2, p.DSGRPF3, p.DCNSUF3, p.DSGRPF4, p.DCNSUF4, p.DSGRPF5, p.DCNSUF5, p.DSGRPF6, p.DCNSUF6, p.DSGRPF7, p.DCNSUF7, p.DSGRPF8, p.DCNSUF8, p.DSGRPF9, p.DCNSUF9, p.CCODEP, p.DLICOM, p.CCORIV, p.CNAVOI, p.DLIVOI, p.DNUVOI, p.DLTNUV',
|
||||
"e.DSIREN='$siren' AND e.INTCIF=p.INTCIF AND e.DNUPER=p.DNUPER", false, MYSQL_ASSOC);
|
||||
$tabRet=array();
|
||||
foreach ($tabTmp as $i=>$loc) {
|
||||
$tabLoc=array( 'idCentre'=>$loc['INTCIF'],
|
||||
'idPmMajic'=>$loc['DNUPER'],
|
||||
'pmGroupe'=>trim($loc['CCOGRM']),
|
||||
'pmGroupeLib'=>self::$tabGrpPerMor[trim($loc['CCOGRM'])],
|
||||
'pmNom'=>trim($loc['DDENPM']),
|
||||
'pmSigle'=>trim($loc['DSIPMO']),
|
||||
'pmFJ'=>$loc['DFORME'], // $loc['FILLER'],
|
||||
'siren'=>trim($loc['DSIREN']),
|
||||
'pmAdrL3'=>trim($loc['DLIGN3']),
|
||||
'pmAdrL4'=>trim($loc['DLIGN4']),
|
||||
'pmAdrL5'=>trim($loc['DLIGN5']),
|
||||
'pmAdrL6'=>trim($loc['DLIGN6']),
|
||||
'pmAdrDep'=>trim($loc['CCODEP']),
|
||||
'pmAdrCom'=>trim($loc['CCOCOM']),
|
||||
'parcelDroit'=>trim($loc['CCODRO']),
|
||||
'parcelDroitLib'=>self::$tabCodeDroit[trim($loc['CCODRO'])],
|
||||
'parcelDep'=>trim($loc['CCODEP']),
|
||||
'parcelCom'=>trim($loc['CCOCOM']),
|
||||
'parcelComLib'=>trim($loc['DLICOM']),
|
||||
'parcelComAbs'=>trim($loc['CCOPRF']),
|
||||
'parcelRivoli'=>trim($loc['CCORIV']),
|
||||
'parcellNumVoie'=>trim($loc['DNUVOI']),
|
||||
'parcelIndVoie'=>trim($loc['DLTNUV']),
|
||||
'parcelTypVoie'=>trim($loc['CNAVOI']),
|
||||
'parcelLibVoie'=>trim($loc['DLIVOI']),
|
||||
'parcelSection'=>trim($loc['CCOSEC']),
|
||||
'parcelNumPlan'=>trim($loc['DNUPLA']),
|
||||
'parcelSurface'=>trim($loc['DCNPAR'])*1,
|
||||
'parcelTer'=>array(),
|
||||
);
|
||||
$surface=0;
|
||||
for($j=0;$j<10;$j++) {
|
||||
$pevCode=trim($loc['DSGRPF'.$j]);
|
||||
$pevSurf=trim($loc['DCNSUF'.$j])*1;
|
||||
if ($pevCode<>'' && $pevSurf>0) {
|
||||
$tabLoc['parcelTer'][$j]=array( 'terCode'=>$pevCode,
|
||||
'terType'=>self::$tabCodePEV[$pevCode],
|
||||
'terSurface'=>$pevSurf,
|
||||
);
|
||||
$surface+=$pevSurf;
|
||||
}
|
||||
}
|
||||
$tabLoc['parcelSurfaceCalc']=$surface;
|
||||
$tabRet[]=$tabLoc;
|
||||
|
||||
$parcelles = array();
|
||||
if (count($results) > 0) {
|
||||
foreach ($results as $i => $loc) {
|
||||
$format = array(
|
||||
'idCentre' => $loc['INTCIF'],
|
||||
'idPmMajic' => $loc['DNUPER'],
|
||||
'pmGroupe' => trim($loc['CCOGRM']),
|
||||
'pmGroupeLib' => $this->getTypeRM(trim($loc['CCOGRM'])),
|
||||
'pmNom' => trim($loc['DDENPM']),
|
||||
'pmSigle' => trim($loc['DSIPMO']),
|
||||
'pmFJ' => $loc['DFORME'],
|
||||
'siren' => trim($loc['DSIREN']),
|
||||
'pmAdrL3' => trim($loc['DLIGN3']),
|
||||
'pmAdrL4' => trim($loc['DLIGN4']),
|
||||
'pmAdrL5' => trim($loc['DLIGN5']),
|
||||
'pmAdrL6' => trim($loc['DLIGN6']),
|
||||
'pmAdrDep' => trim($loc['CCODEP']),
|
||||
'pmAdrCom' => trim($loc['companyCCOCOM']),
|
||||
'parcelDroit' => trim($loc['CCODRO']),
|
||||
'parcelDroitLib' => self::$codeDroit[trim($loc['CCODRO'])],
|
||||
'parcelDep' => trim($loc['CCODEP']),
|
||||
'parcelCom' => trim($loc['CCOCOM']),
|
||||
'parcelComLib' => trim($loc['DLICOM']),
|
||||
'parcelComAbs' => trim($loc['CCOPRF']),
|
||||
'parcelRivoli' => trim($loc['CCORIV']),
|
||||
'parcelNumVoie' => trim($loc['DNUVOI']),
|
||||
'parcelIndVoie' => trim($loc['DLTNUV']),
|
||||
'parcelTypVoie' => trim($loc['CNAVOI']),
|
||||
'parcelLibVoie' => trim($loc['DLIVOI']),
|
||||
'parcelSection' => trim($loc['CCOSEC']),
|
||||
'parcelNumPlan' => trim($loc['DNUPLA']),
|
||||
'parcelSurface' => trim($loc['DCNPAR'])*1,
|
||||
'parcelTer' => array(),
|
||||
);
|
||||
// Calcul de surface
|
||||
$surface = 0;
|
||||
for($j = 0; $j < 10; $j++) {
|
||||
$pevCode = trim($loc['DSGRPF'.$j]);
|
||||
$pevSurf = trim($loc['DCNSUF'.$j])*1;
|
||||
if ($pevCode != '' && $pevSurf > 0) {
|
||||
$format['parcelTer'][$j] = array(
|
||||
'terCode' => $pevCode,
|
||||
'terType' => self::$natureParcelles[$pevCode],
|
||||
'terSurface' => $pevSurf,
|
||||
);
|
||||
$surface+= $pevSurf;
|
||||
}
|
||||
}
|
||||
$format['parcelSurfaceCalc'] = $surface;
|
||||
$parcelles[] = $format;
|
||||
}
|
||||
}
|
||||
return $tabRet;
|
||||
|
||||
return $parcelles;
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* List des éléments du patrimoine
|
||||
* @return array
|
||||
*/
|
||||
public function patrimoine()
|
||||
{
|
||||
$locauxSql = "SELECT 'local' AS type, " .
|
||||
"l.CCODRO AS role, " .
|
||||
"l.DNUVOI AS adresseNum, " .
|
||||
"l.DLTNUV AS adresseInd, " .
|
||||
"l.CNAVOI AS adresseType, " .
|
||||
"l.DLIVOI AS adresseLib, " .
|
||||
"l.CCODEP AS departement, " .
|
||||
"l.CCOCOM AS communeCode, " .
|
||||
"l.DLICOM AS communeLib, " .
|
||||
"l.CCOSEC AS section, " .
|
||||
"l.DNUPLA AS planNum, " .
|
||||
"l.CCORIV AS fantoir, " .
|
||||
"l.DNUBAT AS batiment, " .
|
||||
"l.DESC AS ent, " .
|
||||
"l.DNIV AS niveau, " .
|
||||
"(l.DSUPOD0 + l.DSUPOD1 + l.DSUPOD2 + l.DSUPOD3 + l.DSUPOD4 + l.DSUPOD5 + l.DSUPOD7 + l.DSUPOD8 + l.DSUPOD9) AS surfaceTotal, " .
|
||||
"l.CCOAFF0 AS nature0, " .
|
||||
"l.DSUPOD0 AS surface0, " .
|
||||
"l.CCOAFF1 AS nature1, " .
|
||||
"l.DSUPOD1 AS surface1, " .
|
||||
"l.CCOAFF2 AS nature2, " .
|
||||
"l.DSUPOD2 AS surface2, " .
|
||||
"l.CCOAFF3 AS nature3, " .
|
||||
"l.DSUPOD3 AS surface3, " .
|
||||
"l.CCOAFF4 AS nature4, " .
|
||||
"l.DSUPOD4 AS surface4, " .
|
||||
"l.CCOAFF5 AS nature5, " .
|
||||
"l.DSUPOD5 AS surface5, " .
|
||||
"l.CCOAFF6 AS nature6, " .
|
||||
"l.DSUPOD6 AS surface6, " .
|
||||
"l.CCOAFF7 AS nature7, " .
|
||||
"l.DSUPOD7 AS surface7, " .
|
||||
"l.CCOAFF8 AS nature8, " .
|
||||
"l.DSUPOD8 AS surface8, " .
|
||||
"l.CCOAFF9 AS nature9, " .
|
||||
"l.DSUPOD9 AS surface9, " .
|
||||
"l.dateInsert " .
|
||||
"FROM sdv1.cad_perloc l, sdv1.cad_permor e " .
|
||||
"WHERE e.DSIREN='$this->siren' AND e.INTCIF=l.INTCIF AND e.DNUPER=l.DNUPER";
|
||||
|
||||
?>
|
||||
$parcellesSql = "SELECT 'parcelle' AS type, " .
|
||||
"p.CCODRO AS role, " .
|
||||
"p.DNUVOI AS adresseNum, " .
|
||||
"p.DLTNUV AS adresseInd, " .
|
||||
"p.CNAVOI AS adresseType, " .
|
||||
"p.DLIVOI AS adresseLib ," .
|
||||
"p.CCODEP AS departement, " .
|
||||
"p.CCOCOM AS communeCode, " .
|
||||
"p.DLICOM AS communeLib, " .
|
||||
"p.CCOSEC AS section, " .
|
||||
"p.DNUPLA AS planNum, " .
|
||||
"p.CCORIV AS fantoir, " .
|
||||
"'' AS batiment, " .
|
||||
"'' AS ent, " .
|
||||
"'' AS niveau, " .
|
||||
"p.DCNPAR AS surfaceTotal, " .
|
||||
"p.DSGRPF0 AS nature0, " .
|
||||
"p.DCNSUF0 AS surface0, " .
|
||||
"p.DSGRPF1 AS nature1, " .
|
||||
"p.DCNSUF1 AS surface1, " .
|
||||
"p.DSGRPF2 AS nature2, " .
|
||||
"p.DCNSUF2 AS surface2, " .
|
||||
"p.DSGRPF3 AS nature3, " .
|
||||
"p.DCNSUF3 AS surface3, " .
|
||||
"p.DSGRPF4 AS nature4, " .
|
||||
"p.DCNSUF4 AS surface4, " .
|
||||
"p.DSGRPF5 AS nature5, " .
|
||||
"p.DCNSUF5 AS surface5, " .
|
||||
"p.DSGRPF6 AS nature6, " .
|
||||
"p.DCNSUF6 AS surface6, " .
|
||||
"p.DSGRPF7 AS nature7, " .
|
||||
"p.DCNSUF7 AS surface7, " .
|
||||
"p.DSGRPF8 AS nature8, " .
|
||||
"p.DCNSUF8 AS surface8, " .
|
||||
"p.DSGRPF9 AS nature9, " .
|
||||
"p.DCNSUF9 AS surface9, " .
|
||||
"p.dateInsert " .
|
||||
"FROM sdv1.cad_perpar p, sdv1.cad_permor e " .
|
||||
"WHERE e.DSIREN='$this->siren' AND e.INTCIF=p.INTCIF AND e.DNUPER=p.DNUPER";
|
||||
|
||||
$sql = "SELECT * FROM ( ($locauxSql) UNION ALL ($parcellesSql) ) results";
|
||||
|
||||
$db = Zend_Db_Table::getDefaultAdapter();
|
||||
|
||||
//$results = $this->iDb->query($sql, true);
|
||||
$results = $db->fetchAll($sql, null, Zend_Db::FETCH_ASSOC);
|
||||
|
||||
$list = array();
|
||||
if (count($results) > 0) {
|
||||
foreach ($results as $result) {
|
||||
// Libellé role
|
||||
$result['roleLib'] = self::$codeDroit[trim($result['role'])];
|
||||
$list[] = $result;
|
||||
}
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
}
|
@ -1,389 +0,0 @@
|
||||
<?php
|
||||
|
||||
require_once 'framework/common/curl.php';
|
||||
|
||||
class Metier_Partenaires_MCoface {
|
||||
|
||||
public $body = '';
|
||||
public $header = '';
|
||||
public $codeRetour = 0;
|
||||
|
||||
public $nscrl = 0; // Numéro interne SCRL
|
||||
public $rcsVille='';
|
||||
public $rcsType='';
|
||||
|
||||
public $rSocAdrCPVille=''; // RaisonSocialeAdresseVille (utile pour le débug)
|
||||
public $raisonSociale=''; // Raison Sociale
|
||||
public $adresse=''; // Adresse complète (avec CP et Cille)
|
||||
|
||||
public $sigle='';
|
||||
public $enseigne='';
|
||||
public $nbEtab='';
|
||||
|
||||
public $adrNumVoie;
|
||||
public $adrIndRep;
|
||||
public $adrTypeVoie;
|
||||
public $adrLibVoie;
|
||||
public $adrCP;
|
||||
public $adrVille;
|
||||
|
||||
public $tel='';
|
||||
public $fax='';
|
||||
public $web='';
|
||||
public $mail='';
|
||||
public $activite=''; // Activité Déclarée au bodacc
|
||||
public $naf=''; // NAF
|
||||
public $nafLib='';
|
||||
|
||||
public $bourseIsin='';
|
||||
public $bourseMarche='';
|
||||
public $bourseVille='';
|
||||
|
||||
public $tabInfos=array();
|
||||
public $tabBilans=array();
|
||||
|
||||
public $infoEco=false;
|
||||
public $capitalType='';
|
||||
public $capitalMontant='';
|
||||
public $capitalDevise ='';
|
||||
public $steInactive = '';
|
||||
public $dateCreation=''; // Notion INSEE
|
||||
public $dateImmatriculation=''; // Notion Greffe et RNCS uniquement
|
||||
public $fj='';
|
||||
public $nationalite='';
|
||||
public $enBourse='';
|
||||
public $effectif='';
|
||||
public $tabDirigeants=array();
|
||||
public $strLiensFi='';
|
||||
public $strElemsFi='';
|
||||
|
||||
public $derExerciceAnnee='';
|
||||
public $derExerciceDuree='';
|
||||
public $derExerciceDClot='';
|
||||
public $derExerciceCA='';
|
||||
public $derExerciceResultat='';
|
||||
public $derExerciceDevise='';
|
||||
|
||||
public $dateFermeture='';
|
||||
public $score_pouey='';
|
||||
public $score_conan='';
|
||||
public $score_afdcc='';
|
||||
public $vigilance='';
|
||||
public $tabJug=array();
|
||||
public $tabAct=array();
|
||||
public $tabFil=array();
|
||||
public $tabEtab=array();
|
||||
|
||||
function __construct($siren)
|
||||
{
|
||||
$referer='';
|
||||
$url='http://www.cofacerating.fr/portail/entreprise_identite/identite.asp?ip=pagespro&lg=fr&nsiren='.$siren;
|
||||
$page=getUrl($url, '', '', $referer, false, 'www.cofacerating.fr', '', 10);
|
||||
$this->body=$page['body'];
|
||||
$this->codeRetour=$page['code'];
|
||||
$this->header=$page['header'];
|
||||
$this->nscrl=@getTextInHtml($this->body, '&nscrl=', '=','&');
|
||||
$this->rSocAdrCPVille=trim(str_replace(chr(160), ' ', html_entity_decode(utf8_encode(@getTextInHtml($this->body, '<td WIDTH="40%" bgcolor="#F3E5CC" class="tabligne"> <b> Raison sociale<br>', '<td WIDTH="60%" bgcolor="#FFF3DE" class="tabval"><b>','</tr>')))));
|
||||
$tmp=explode('<br>', $this->rSocAdrCPVille);
|
||||
$this->raisonSociale=trim($tmp[0]);
|
||||
unset($tmp[0]);
|
||||
$this->adresse=trim(strip_tags(implode(',', $tmp)));
|
||||
$this->tel=trim(@getTextInHtml($this->body, '<td bgcolor="#F3E5CC" class="tabligne"><b>Téléphone<br>', '<td bgcolor="#FFF3DE" class="tabval" valign="top">', '<br>'));
|
||||
$this->fax=trim(@getTextInHtml($this->body, 'Télécopie</b></td>', '<br>', '</td>'));
|
||||
$this->web=trim(@getTextInHtml($this->body, '<td bgcolor="#F3E5CC" class="tabligne"><b>Adresse internet <br>', ' class="tabval"><a class="tabval" HREF="', '" target="_new">'));
|
||||
$this->mail=trim(@getTextInHtml($this->body, '<a class="tabval" href="mailto:', ':', '">'));
|
||||
|
||||
$bourse=trim(@getTextInHtml($this->body, 'Ville Bourse</b></td>', 'class="tabval">', '</td>'));
|
||||
$tmp=explode('<br>', $bourse);
|
||||
$this->bourseIsin=trim($tmp[0]);
|
||||
$this->bourseMarche=trim($tmp[1]);
|
||||
$this->bourseVille=trim($tmp[2]);
|
||||
|
||||
$infosDispo=trim(@getTextInHtml($this->body, '<b>Liste Produits</b><br></td>', '<br></td><td class="menu3"><img src="../images/vide.gif" border="0"><br></td><td colspan="2" class="menu3">', 'Un secteur ou une région en France</a><br></td>'));
|
||||
$tabTmp=explode('<a href="', $infosDispo);
|
||||
foreach ($tabTmp as $k=>$lien) {
|
||||
preg_match('/^(.*)">(.*)<\/a>/i', $lien, $matches);
|
||||
if ($matches[2]<>'') $this->tabInfos[$matches[2]]=$matches[1];
|
||||
if (substr($matches[2], 0, 12)=='rapport éco.') $this->infoEco='http://www.cofacerating.fr/portail/entreprise_identite/'.$matches[1];//ip=pagespro&
|
||||
elseif (substr($matches[2], 0, 6)=='bilan ') $this->tabBilans[]=substr($matches[2], 6,strlen($matches[2])-6);
|
||||
}
|
||||
$this->activite=trim(str_replace(chr(160), ' ', html_entity_decode(utf8_encode(@getTextInHtml($this->body, '<td WIDTH="40%" bgcolor="#F3E5CC" class="tabligne" valign="top"><b>Libellé code activité </b></td>', '<td WIDTH="60%" bgcolor="#FFF3DE" class="tabval">', '</td>')))));
|
||||
$this->naf=trim(@getTextInHtml($this->body, '<a href="../chaineeco_dynaeco/DynaEco.asp?cnaf=', 'cnaf=', '&'));
|
||||
|
||||
/**
|
||||
** Recherche du NIC sur Société .com
|
||||
**/
|
||||
|
||||
/*
|
||||
$refererS='http://www.societe.com/';
|
||||
$urlS='http://www.societe.com/cgi-bin/recherche?rncs='.$siren.'&vu=1';
|
||||
$page=getUrl($urlS, '', '', $refererS, false, 'www.societe.com');
|
||||
$ste=$page['body'];
|
||||
$this->nic=trim(@getTextInHtml($ste, 'SIRET</div><div class="ficheAltCol2 size11">', $siren, '</div>'));
|
||||
|
||||
$strTmp=trim(@getTextInHtml($ste, '<b><span class="size10">RCS', 'RCS ', ' '.substr($siren,0,3)));
|
||||
$tabTmp=explode(' ', $strTmp);
|
||||
$this->rcsVille=$tabTmp[0];//<td class="txtBlanc" align="left"><b><span class="size10">RCS Paris B 552 144 503<br></span></b></td>
|
||||
$this->rcsType=$tabTmp[1];
|
||||
|
||||
$strTmp=trim(@getTextInHtml($ste, '<div class="ficheAltCol1 size11">Code activité</div>', '<div class="ficheAltCol2 size11">', '</div>'));
|
||||
$tabTmp=explode(' - ', $strTmp);
|
||||
$this->naf=$tabTmp[0];
|
||||
$this->nafLib=$tabTmp[1];
|
||||
|
||||
// <div class="ficheAltCol1 size11">Siège social</div><div class="ficheAltCol2 size11">75 Avenue la Grande Armee - 75116 PARIS 16</div>
|
||||
|
||||
$strTmp=trim(@getTextInHtml($ste, '<div class="ficheAltCol1 size11">Capital social', '<div class="ficheAltCol2 size11">', '</div>'));
|
||||
$this->capitalType='social';
|
||||
$tabTmp=explode(' ', $strTmp);
|
||||
$this->capitalMontant=str_replace(',', '.', str_replace('.', '', $tabTmp[0]));
|
||||
$this->capitalDevise =$tabTmp[1];
|
||||
|
||||
$this->fj=trim(@getTextInHtml($ste, '<div class="ficheAltCol1 size11">Forme juridique', '<div class="ficheAltCol2 size11">', '</div>'));
|
||||
$this->nationalite=trim(@getTextInHtml($ste, '<div class="ficheAltCol1 size11">Nationalité</div>', '<div class="ficheAltCol2 size11">', '</div>'));
|
||||
|
||||
$strTmp=trim(@getTextInHtml($ste, ' DIRIGEANT(S) </span></span></div>', '<div class="ficheCadre" style="min-height:85px;">', '<div class="spacer"></div>'));
|
||||
$tabTmp=explode('<div class="h1bleu2"></div>', $strTmp);
|
||||
foreach ($tabTmp as $k=>$dir) {
|
||||
if (trim($dir)=='') break;
|
||||
$tabTmp1=explode('</div><div class="ficheAltCol2 size11">', $dir);
|
||||
$tabTmp2=explode('représenté par', $tabTmp1[1]);
|
||||
if (isset($tabTmp2[1]) && $tabTmp2[1]<>'') {
|
||||
$soc=trim($tabTmp2[0]);
|
||||
$diri=trim($tabTmp2[1]);
|
||||
} else {
|
||||
$soc='';
|
||||
$diri=trim($tabTmp1[1]);
|
||||
}
|
||||
preg_match("/^(Mme|M\.|Mlle|Mle|M) ([A-Z\s]*) ([A-Z][a-z\s]*)/", $diri, $matches);
|
||||
//print_r($matches);
|
||||
$this->tabDirigeants[]=array('FONCTION'=>trim(strip_tags($tabTmp1[0])), 'SOCIETE'=>$soc, 'GENRE'=>$matches[1], 'PRENOM'=>trim($matches[3]), 'NOM'=>trim($matches[2]));
|
||||
}
|
||||
|
||||
$this->dateImmatriculation=trim(@getTextInHtml($ste, '<div class="ficheAltCol1 size11"> Immatriculation', '<div class="ficheAltCol2 size11">', '</div>'));
|
||||
//06-03-2007</div>
|
||||
/* Date Creation = ""
|
||||
En bourse = ""
|
||||
Effectif societe = ""
|
||||
Dirigeants :
|
||||
**/
|
||||
$urlRacine='http://infobilan.decideur.com/';
|
||||
$tabPost=array( 'choix'=>'1',
|
||||
'pagePrecedente'=>'recherche_entreprise.html',
|
||||
'nomsocRech'=>'',
|
||||
'cpRech'=>'',
|
||||
'villeRech'=>'',
|
||||
'nomdirRech'=>'',
|
||||
'predirRech'=>'',
|
||||
'sirenRech'=>$siren,
|
||||
'telRech'=>'',);
|
||||
// 'Rechercher'=>'',
|
||||
$url=$urlRacine.'liste_result.html';
|
||||
$referer=$urlRacine.'recherche_entreprise.html';
|
||||
$page=getUrl($url,'', $tabPost, $referer, false, 'infobilan.decideur.com');
|
||||
$this->body=$page['body'];
|
||||
$strCookie=$page['header']['Set-Cookie'];
|
||||
$refererInfoD=$url;
|
||||
|
||||
if(preg_match_all('/<a href="choix_pdt\.html\?(.*)" class="tt1">(.*)<\/a><\/span><br>/i', $page['body'], $matches))
|
||||
$urlInfoD=$urlRacine.'choix_pdt.html?'.$matches[1][0];
|
||||
else
|
||||
$urlInfoD='';
|
||||
|
||||
$page=getUrl($this->infoEco, '', '', $url, false, 'www.cofacerating.fr');
|
||||
if (strpos($page['body'], '<b>Choix du mode de paiement</b>')===false) { // Le rapport éco. est cadeau !!!
|
||||
$this->infoEco=true;
|
||||
$eco=$page['body'];
|
||||
//die ($eco);
|
||||
$strTmp=strip_tags(@getTextInHtml($eco, ' class="tabligne" > Capital   (', '(', '</tr><tr>'));
|
||||
$tabTmp=explode(')', $strTmp);
|
||||
$this->capitalType=$tabTmp[0];
|
||||
$tabTmp=explode(' ', $tabTmp[1]);
|
||||
$this->capitalMontant=trim(str_replace(chr(160), '', $tabTmp[0]));
|
||||
$this->capitalDevise =trim(str_replace(chr(160), '', $tabTmp[1]));
|
||||
|
||||
$this->steInactive=trim(@getTextInHtml($eco, ' class="tabligne" > Société inactive</td>', 'class="tabval" >', '</td>'));
|
||||
|
||||
$this->dateCreation=trim(@getTextInHtml($eco, ' class="tabligne" > Date de création</td>', 'class="tabval" >', '</td>'));
|
||||
$this->fj=trim(@getTextInHtml($eco, ' class="tabligne" > Forme juridique</td>', 'class="tabval" >', '</td>'));
|
||||
$this->effectif=trim(@getTextInHtml($eco, ' class="tabligne" > Effectif', 'class="tabval" >', '</td>'));
|
||||
|
||||
if (count($this->tabDirigeants)==0) { // Si il y a déjà des dirigeants on garde ceux de Société.com !!!
|
||||
$strTmp=trim(@getTextInHtml($eco, ' class="tabligne" > Cotation en bourse</td>', '<td bgcolor="#F3E5CC" class="tabligne" >', '<td bgcolor="#F3E5CC" class="tabligne" > Effectif'));
|
||||
$tabTmp=explode('<td bgcolor="#F3E5CC" class="tabligne" >', $strTmp);
|
||||
foreach ($tabTmp as $k=>$dir) {
|
||||
$tabTmp1=explode('<td bgcolor="#FFF3DE" class="tabval" >', $dir);
|
||||
$tabTmp2=explode(' ', trim(strip_tags($tabTmp1[1])));
|
||||
$this->tabDirigeants[]=array('FONCTION'=>trim(strip_tags($tabTmp1[0])), 'GENRE'=>trim($tabTmp2[0]), 'PRENOM'=>trim($tabTmp2[1]), 'NOM'=>trim($tabTmp2[2]));
|
||||
}
|
||||
}
|
||||
|
||||
$this->strLiensFi=trim(strip_tags(@getTextInHtml($eco, '<td class="tabtot">LIENS FINANCIERS</td>', '<tr>', '</td></tr>')));
|
||||
$this->strElemsFi=trim(strip_tags(@getTextInHtml($eco, '<td class="tabtot">ELEMENTS FINANCIERS</td>', '<tr>', '</td></tr>')));
|
||||
}
|
||||
|
||||
$refererP='http://www.score3.fr/';
|
||||
$urlP='http://www.score3.fr/entreprise.shtml?siren='.$siren;
|
||||
$page=getUrl($urlP, '', '', $refererP, false, 'www.score3.fr');
|
||||
$pou=$page['body'];
|
||||
$fp=fopen('./pouet.html', 'w');
|
||||
fwrite($fp, $pou);
|
||||
fclose($fp);
|
||||
|
||||
if ($urlInfoD<>'') {
|
||||
$page=getUrl($urlInfoD,$strCookie,'', $refererInfoD, false, 'infobilan.decideur.com');
|
||||
$referer=$urlInfoD;
|
||||
if ($this->nscrl==0) $this->nscrl=@getTextInHtml($url, 'nscrlP=', '=','&');
|
||||
|
||||
$url=$urlRacine.'fiche_ident.html';
|
||||
$page=getUrl($url,$strCookie,'', $referer, false, 'infobilan.decideur.com');
|
||||
$this->body=$page['body'];
|
||||
|
||||
if ($this->raisonSociale=='')
|
||||
$this->raisonSociale=trim(@getTextInHtml($this->body, '<span class="libelle2">Société', ' :', '</span>'));
|
||||
|
||||
if ($this->adresse=='')
|
||||
$this->adresse=trim(@getTextInHtml($this->body, '<span class="libelle2">Adresse</span> <strong>:', '</strong>', '</td>'));
|
||||
|
||||
if ($this->tel=='')
|
||||
$this->tel=trim(@getTextInHtml($this->body, '<td valign="top"><span class="libelle2">Tél', '</span>', '<br>'));
|
||||
if ($this->fax=='')
|
||||
$this->fax=trim(@getTextInHtml($this->body, '<span class="libelle2">Fax</span>', ' :', '<br>'));
|
||||
if ($this->web=='')
|
||||
$this->web=trim(@getTextInHtml($this->body, '<span class="libelle2">Site Web</span>', '<a href="', '" target="_blank">'));
|
||||
if ($this->mail=='')
|
||||
$this->mail=trim(@getTextInHtml($this->body, '<span class="libelle2">E-mail</span>', '<a href="mailto:', '">'));
|
||||
if ($this->naf=='')
|
||||
$this->naf=trim(@getTextInHtml($this->body, '<span class="libelle2">Code NAF</span>', ' :', '</td>'));
|
||||
|
||||
if(preg_match('/<td valign="top"><span class="libelle2">Capital social<\/span> : (\d*)(.*)<br>/isU', $this->body, $matches)
|
||||
&& ($this->capitalMontant=='' || $this->capitalDevise=='')) {
|
||||
$this->capitalMontant=trim($matches[1]);
|
||||
$this->capitalDevise=trim($matches[2]);
|
||||
}
|
||||
|
||||
if ($this->fj=='')
|
||||
$this->fj=trim(@getTextInHtml($this->body, '<span class="libelle2">Forme juridique</span>', ' :', '<br>'));
|
||||
if ($this->nationalite=='')
|
||||
$this->nationalite=trim(@getTextInHtml($this->body, '<span class="libelle2">Nationalité</span>', ' :', '</td>'));
|
||||
if ($this->effectif=='')
|
||||
$this->effectif=trim(@getTextInHtml($this->body, '<td valign="top"><span class="libelle2">Effectif</span>', ' :', '<br>'));
|
||||
if ($this->activite=='')
|
||||
$this->activite=trim(@getTextInHtml($this->body, '<span class="libelle2">Activité</span>', ' :', '<br>'));
|
||||
|
||||
/** Actionnaires **/
|
||||
$strTmp=trim(@getTextInHtml($this->body, 'ACTIONNAIRES<br>', '</div></h1>', '<h1>'));
|
||||
if(preg_match_all('/<p><span class="libelle2">(.*)<\/span> - <span class="libelle2">Participation<\/span> : (.*) %<br>(.*)<\/p>/isU', $strTmp, $matches)) {
|
||||
foreach ($matches[1] as $i=>$nom) {
|
||||
$this->tabAct[$i]['nom']=trim($nom);
|
||||
$this->tabAct[$i]['pct']=trim($matches[2][$i]);
|
||||
$this->tabAct[$i]['rcs']=trim(str_replace('RCS : ','',strip_tags($matches[3][$i])));
|
||||
}
|
||||
}
|
||||
|
||||
/** Filiales **/
|
||||
$strTmp=trim(@getTextInHtml($this->body, 'FILIALES<br>', '</div></h1>', '<h1>'));
|
||||
if(preg_match_all('/<p><span class="libelle2">(.*)<\/span> - <span class="libelle2">Participation<\/span> :(.*)%<br>(.*)<\/p>/isU', $strTmp, $matches)) {
|
||||
foreach ($matches[1] as $i=>$nom) {
|
||||
$this->tabFil[$i]['nom']=trim($nom);
|
||||
$this->tabFil[$i]['pct']=trim($matches[2][$i]);
|
||||
$this->tabFil[$i]['rcs']=trim(str_replace('RCS :','',strip_tags($matches[3][$i])));
|
||||
}
|
||||
}
|
||||
|
||||
/** CA et Résultat **/
|
||||
$strTmp=trim(@getTextInHtml($this->body, '<h1>PRINCIPAUX ELEMENTS FINANCIERS<br>', '</div></h1>', '</p>'));
|
||||
if(preg_match('/<p><span class="libelle2">CA (.*)<\/span>(.*)<br>/isU', $strTmp, $matches)) {
|
||||
$this->derExerciceAnnee=trim($matches[1]);
|
||||
$this->derExerciceCA=trim(str_replace(':',' ', $matches[2]));
|
||||
}
|
||||
if(preg_match('/<span class="libelle2">Résultat(.*)<\/span>(.*)$/isU', $strTmp, $matches)) {
|
||||
$this->derExerciceResultat=trim(str_replace(':',' ', $matches[2]));
|
||||
}
|
||||
|
||||
$infoBilan=print_r($page, true);
|
||||
$fp=fopen('./infobilan.html', 'w');
|
||||
fwrite($fp, $infoBilan);
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
if ($this->nbEtab=='' || $this->nbEtab=='0') {
|
||||
$this->nbEtab=trim(strip_tags(str_replace('afficher la liste...', '', @getTextInHtml($pou, '<tr><td class="ligne1_2">Etablissements </td>', '<td class="ligne2_2">', '</td></tr>'))));
|
||||
$urlPEtab='http://www.score3.fr/etablissements.shtml?page=1&siren='.$siren;
|
||||
$refererPEtab=$urlP;
|
||||
$page=getUrl($urlPEtab, '', '', $refererPEtab, false, 'www.score3.fr');
|
||||
$pou2=$page['body'];
|
||||
if(preg_match_all('/<tr bgcolor="(?:\S*)"><td class="ligne1b" align="center" width="10%">(\d*)<\/td><td class="ligne2" height="50"><table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td class="infos">(.*)<\/td><\/tr><\/table>/isU', $pou2, $matches)) {
|
||||
foreach ($matches[1] as $i=>$nic) {
|
||||
$strEtab=$matches[2][$i];
|
||||
$this->tabEtab[$i]['siren']=$siren;
|
||||
$this->tabEtab[$i]['nic']=$nic;
|
||||
$this->tabEtab[$i]['siret']=$siren.$nic;
|
||||
|
||||
$this->tabEtab[$i]['enseigne']=trim(str_replace(chr(160),' ',utf8_decode(strip_tags(@getTextInHtml($strEtab, '<span class="titre3">', '">', '</span>')))));
|
||||
$this->tabEtab[$i]['adresse']=trim(str_replace(chr(160),' ',utf8_decode(strip_tags(@getTextInHtml($strEtab, '<span class="infos">', '">', '<br>')))));
|
||||
$strTmp=trim(str_replace(chr(160),' ',utf8_decode(strip_tags(@getTextInHtml($strEtab, '<span class="infos">', '<br>', '</span>')))));
|
||||
$tabTmp=explode(' ', $strTmp);
|
||||
$this->tabEtab[$i]['cp']=$tabTmp[0];
|
||||
unset($tabTmp[0]);
|
||||
$this->tabEtab[$i]['ville']=implode(' ',$tabTmp);
|
||||
$strTmp=trim(strip_tags(@getTextInHtml($strEtab, '<td class="infos" align="right" valign="top">', '">', ')')));
|
||||
$tabTmp=explode('(', $strTmp);
|
||||
$this->tabEtab[$i]['naf_code']=$tabTmp[1];
|
||||
$this->tabEtab[$i]['naf_lib']=trim(str_replace(chr(160),' ',utf8_decode($tabTmp[0])));
|
||||
if (preg_match('/<br>T.l\.(.*)$/i',$strEtab,$matches2))
|
||||
$this->tabEtab[$i]['tel']=trim(str_replace(chr(160),' ',utf8_decode($matches2[1])));
|
||||
else $this->tabEtab[$i]['tel']='';
|
||||
}
|
||||
}
|
||||
$this->nbEtab=count($this->tabEtab);
|
||||
$fp=fopen('./pouet_etab.html', 'w');
|
||||
fwrite($fp, $pou2);
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
if ($this->effectif=='' || $this->effectif=='0' || $this->effectif=='NC')
|
||||
$this->effectif=trim(@getTextInHtml($pou, '<tr><td class="ligne1_2">Effectifs</td>', '<td class="ligne2_2">', '</td></tr>'));
|
||||
|
||||
if ($this->dateImmatriculation=='' || $this->dateImmatriculation=='0')
|
||||
$this->dateImmatriculation=trim(@getTextInHtml($pou, '<tr><td class="ligne1_2">Date d\'immatriculation</td>', '<td class="ligne2_2">', '</td></tr>'));
|
||||
if ($this->dateFermeture=='' || $this->dateFermeture=='0')
|
||||
$this->dateFermeture=trim(@getTextInHtml($pou, '<tr><td class="ligne1_2">Date de fin d\'exploitation</td>', '<td class="ligne2_2">', '</td></tr>'));
|
||||
|
||||
if ($this->tel=='' || $this->tel=='0')
|
||||
$this->tel=trim(@getTextInHtml($pou, '<tr><td class="ligne1_2">Téléphone</td>', '<td class="ligne2_2">', '</td></tr>'));
|
||||
|
||||
if ($this->fax=='' || $this->fax=='0')
|
||||
$this->fax=trim(@getTextInHtml($pou, '<tr><td class="ligne1_2">Fax</td>', '<td class="ligne2_2">', '</td></tr>'));
|
||||
|
||||
$strTmp=trim(@getTextInHtml($pou, 'Procédures collectives</td></tr>', '</table></td>', '</td><td background'));
|
||||
if(preg_match_all('/<tr><td class="ligne1_2">(.*)<\/td><td class="ligne2_2">(.*)<\/td><\/tr>/isU', $strTmp, $matches)) {
|
||||
foreach ($matches[1] as $i=>$jug) {
|
||||
$this->tabJug[$i]['date']=$matches[1][$i];
|
||||
$this->tabJug[$i]['juge']=$matches[2][$i];
|
||||
}
|
||||
}
|
||||
|
||||
$this->score_pouey=trim(@getTextInHtml($pou, '<param name="movie" value="cadran.swf?rotation=', '&type=pouey&valeur=', '">'));
|
||||
$this->score_conan=trim(@getTextInHtml($pou, '<param name="movie" value="cadran.swf?rotation=', '&type=ch&valeur=', '">'));
|
||||
$this->score_afdcc=trim(@getTextInHtml($pou, '<param name="movie" value="cadran.swf?rotation=', '&type=afdcc&valeur=', '">'));
|
||||
$this->vigilance =trim(@getTextInHtml($pou, '<param name="movie" value="vigilance.swf', 'degre=', '">'));
|
||||
|
||||
if(preg_match('/Date de l\'exercice<\/td><td class="ligne2_2">(.*) sur (\d*) mois<\/td><\/tr>/isU', $pou, $matches)) {
|
||||
$this->derExerciceDClot=trim($matches[1]);
|
||||
$this->derExerciceDuree=trim($matches[2]);
|
||||
}
|
||||
|
||||
/* Siret SIEGE
|
||||
2 Fonction, Nom Prénoù ET Date NAissance du PP
|
||||
5 Liste des actes
|
||||
*/
|
||||
if ($this->codeRetour==200)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -1,279 +0,0 @@
|
||||
<?php
|
||||
|
||||
define('CREDITSAFE_WS_URL', 'https://www.creditsafe.fr/getdata/service/CSFRServices.asmx');
|
||||
define('CREDITSAFE_WS_URI', 'https://www.creditsafe.fr/getdata/service/');
|
||||
|
||||
define('CREDITSAFE_WS_USER', 'scores_decisions');
|
||||
define('CREDITSAFE_WS_PASS', 'yoann1306');
|
||||
|
||||
define('CREDITSAFE_WS_REF', 'ref');
|
||||
|
||||
|
||||
if (!$_SESSION['connected']) die();
|
||||
|
||||
function formatPct($pct) {
|
||||
$pct=round($pct/10,0)*10;
|
||||
if ($pct==0) $pct=10;
|
||||
return $pct;
|
||||
}
|
||||
|
||||
$siret=trim(preg_replace('/[^0-9]/', '', $_REQUEST['siret']));
|
||||
if (strlen($siret)<>9 && strlen($siret)<>14) die('Paramètres incorrects !');
|
||||
if (strlen($siret)==9) $siret=$tabInfo['entrep']['siret'];
|
||||
|
||||
$id=trim(preg_replace('/[^0-9]/', '', $_REQUEST['id']))*1; // Si id=0 alors non communiqué
|
||||
if (($siret*1)==0 && $id==0) die('Paramètres incorrects !');
|
||||
$siren=substr($siret,0,9);
|
||||
|
||||
$action=$_REQUEST['action'];
|
||||
if ($action<>'' && $action<>'commande') die('Paramètres incorrects !');
|
||||
|
||||
$raisonSociale=$tabInfo['entrep']['raisonSociale'];
|
||||
|
||||
require_once 'framework/common/dates.php';
|
||||
|
||||
/** Utilisation du WS **/
|
||||
|
||||
$client = new SoapClient(null, array( 'trace' => 1,
|
||||
'soap_version' => SOAP_1_1,
|
||||
'location' => WEBSERVICE_URL,
|
||||
'uri' => WEBSERVICE_URI,
|
||||
'login' => $_SESSION['tabInfo']['login'],
|
||||
'password' => $_SESSION['tabInfo']['password']));
|
||||
|
||||
/*$client = new SoapClient('https://www.creditsafe.fr/getdata/service/CSFRServices.asmx?WSDL',
|
||||
array( 'location' => CREDITSAFE_WS_URL,
|
||||
'uri' => CREDITSAFE_WS_URI,
|
||||
'soap_version' => SOAP_1_1,
|
||||
'trace' => 1,
|
||||
//'style' => SOAP_RPC,
|
||||
//'use' => SOAP_ENCODED,
|
||||
));
|
||||
*/
|
||||
|
||||
$req='<xmlrequest>'.
|
||||
'<header>'.
|
||||
'<username>'.CREDITSAFE_WS_USER.'</username>'.
|
||||
'<password>'.CREDITSAFE_WS_PASS.'</password>'.
|
||||
//'<operation>getcompanyinformation</operation>'.
|
||||
'<operation>getratinglimit</operation>'.
|
||||
'<country>FR</country>'.
|
||||
'<language>FR</language>'.
|
||||
'<chargereference>'.CREDITSAFE_WS_REF.'</chargereference>'.
|
||||
'</header>'.
|
||||
'<body>'.
|
||||
//'<package>standard</package>'.
|
||||
'<package>ratinglimit</package>'.
|
||||
"<companynumber>$siret</companynumber>".
|
||||
'</body>'.
|
||||
'</xmlrequest>';
|
||||
|
||||
$success=true;
|
||||
$date=date('Ymd');
|
||||
$fichier="$siret-$date.xml";
|
||||
|
||||
if (!file_exists('/var/www/site_extranet/www/creditsafe/xml/'.$fichier)) {
|
||||
/* try {
|
||||
$O=$client->GetData('<RequestXmlString><xmlrequest>'.
|
||||
'<header>'.
|
||||
'<username>'.CREDITSAFE_WS_USER.'</username>'.
|
||||
'<password>'.CREDITSAFE_WS_PASS.'</password>'.
|
||||
'<operation>getcompanyinformation</operation>'.
|
||||
'<country>FR</country>'.
|
||||
'<language>FR</language>'.
|
||||
'<chargereference>'.CREDITSAFE_WS_REF.'</chargereference>'.
|
||||
'</header>'.
|
||||
'<body>'.
|
||||
'<package>standard</package>'.
|
||||
"<companynumber>$siret</companynumber>".
|
||||
'</body>'.
|
||||
'</xmlrequest></RequestXmlString>');
|
||||
//die(print_r($O));
|
||||
$xml=implode('', (array)$O);
|
||||
}
|
||||
catch (SoapFault $soapFault) {// echo "ERROR :\n", var_dump($soapFault), "\n"; echo "Request :\n", $client->__getLastRequest(), "\n";
|
||||
$success=false;
|
||||
$response=$client->__getLastResponse();
|
||||
$response=str_replace("<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'><SOAP-ENV:Body><ns0:getProduitsWebServicesXMLResponse xmlns:ns0='urn:local' SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'><return xsi:type='xsd:string'>",'', $response);
|
||||
$xml=str_replace('</return></ns0:getProduitsWebServicesXMLResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>','', $response);
|
||||
}*/
|
||||
//https://www.creditsafe.fr/getdata/service/CSFRServices.asmx/GetData
|
||||
//$url='https://www.creditsafe.fr/getdata/service/CSFRServices.asmx/GetData?RequestXmlString='.$req;
|
||||
$url='https://www.creditsafe.fr/getdata/service/CSFRServices.asmx/GetData?RequestXmlStr='.$req;//.'&RequestXmlString='.$req;
|
||||
//requestXmlStr.
|
||||
$referer=$cookie='';
|
||||
$page=getUrl($url, $cookie, '', $referer, false, '', '');
|
||||
$referer=$url;
|
||||
$xml=html_entity_decode($page['body'], ENT_QUOTES, 'UTF-8');
|
||||
|
||||
/** Enregistrement du fichier XML en provenance des greffes
|
||||
**/
|
||||
$fp=@fopen('/var/www/site_extranet/www/creditsafe/xml/'.$fichier, 'w');
|
||||
@fwrite($fp, $xml);
|
||||
@fclose($fp);
|
||||
|
||||
$O = $client->setLog('scorecsf', $siret);
|
||||
|
||||
} else {
|
||||
/** Lecture du fichier XML en provenance des greffes
|
||||
**/
|
||||
$xml=file_get_contents('/var/www/site_extranet/www/creditsafe/xml/'.$fichier);
|
||||
$O = $client->setLog('scorecsf', $siret, 0, 'local');
|
||||
}
|
||||
/*<>100</rating>
|
||||
2000000</creditlimit>*/
|
||||
|
||||
$dom_object = new DomDocument2();
|
||||
$dom_object->load('/var/www/site_extranet/www/creditsafe/xml/'.$fichier);
|
||||
/* create DOMXPath object with our DOMObject
|
||||
$xpath = new Domxpath($dom_object);
|
||||
$result = $xpath->query("//liste_depot_acte/depot_acte/.");
|
||||
foreach ($result as $annonce) {
|
||||
// N° Gestion
|
||||
$title = $xpath->query ("num_gest/greffe", $annonce);
|
||||
$num_gest_greffe=$title->item(0)->nodeValue;
|
||||
*/
|
||||
$companyname=$dom_object->getValueFromTag('companyname');
|
||||
$rating=$dom_object->getValueFromTag('rating');
|
||||
$ratingdesc1=str_replace('?',"'",$dom_object->getValueFromTag('ratingdesc1'));
|
||||
$ratingdesc2=str_replace('?',"'",$dom_object->getValueFromTag('ratingdesc2'));
|
||||
$creditlimit=$dom_object->getValueFromTag('creditlimit');
|
||||
$libelle='';
|
||||
if (strtoupper($creditlimit)<>strtolower($creditlimit) || $creditlimit=='')
|
||||
$strCreditlimit=$creditlimit;
|
||||
else
|
||||
$strCreditlimit=number_format($creditlimit,null,null,' '). ' €';
|
||||
|
||||
if ($rating>=40) {
|
||||
$fontColor='green';
|
||||
$imgFeux='<img src="/creditsafe/img/feux_vert.png"/>';
|
||||
if ($rating>=71) $libelle='Très bonne cote de crédit/solvabilité';
|
||||
elseif ($rating>=51) $libelle='Bonne cote de crédit/solvabilité';
|
||||
else $libelle='Solvable';
|
||||
|
||||
} elseif ($rating>=20) {
|
||||
$fontColor='yellow';//#f2be2c';
|
||||
$imgFeux='<img src="/creditsafe/img/feux_orange.png"/>';
|
||||
$libelle='Précautions recommandées';
|
||||
} elseif (strtoupper($rating)<>strtolower($rating)) {
|
||||
$fontColor='black';
|
||||
$imgFeux=' ';
|
||||
}
|
||||
elseif ($rating=='') {
|
||||
$fontColor='black';
|
||||
$imgFeux=' ';
|
||||
}
|
||||
else {
|
||||
$fontColor='red';
|
||||
$imgFeux='<img src="/creditsafe/img/feux_rouge.png"/>';
|
||||
if ($rating==0) $libelle='Entreprise en situation de défaillance et ayant un très fort risque de radiation';
|
||||
else $libelle='Avertissement - Crédit à votre discrétion';
|
||||
}
|
||||
|
||||
?><table width="580" border="0" align="left" bgcolor="#FFFFFF">
|
||||
<tr>
|
||||
<td colspan="3"><img src="./img/rub_evaluation.png" width="577" height="36"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="30"> </td>
|
||||
<td width="200" class="StyleInfoLib">Numéro identifiant Siren</td>
|
||||
<td width="350" class="StyleInfoData"><?=substr($siret,0,3).' '.substr($siret,3,3).' '.substr($siret,6,3)?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="30"> </td>
|
||||
<td width="200" class="StyleInfoLib">Raison Sociale</td>
|
||||
<td width="350" class="StyleInfoData"><?if ($companyname<>'') echo $companyname;
|
||||
else echo $raisonSociale;
|
||||
?></td>
|
||||
</tr>
|
||||
<? if ($etab['NumRC']*1<>0) { ?>
|
||||
<tr>
|
||||
<td width="30"> </td>
|
||||
<td width="200" class="StyleInfoLib">Numéro R.C.</td>
|
||||
<td width="350" class="StyleInfoData"><?=$etab['NumRC']?></td>
|
||||
</tr>
|
||||
<? } ?>
|
||||
<tr>
|
||||
<td colspan="3"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3"><img src="./img/srub_scorescf.png" width="576" height="27"></td>
|
||||
</tr>
|
||||
|
||||
<!--#a5a5a5; }
|
||||
.grey_gradiant .v20 { background: #bcbcbc; }
|
||||
.grey_gradiant .v10 { background: #c8c8c8;-->
|
||||
<tr><td colspan="3">
|
||||
|
||||
<table cellspacing="0">
|
||||
<tr>
|
||||
<td width="20"> </td>
|
||||
<td width="10" bgcolor="#bebebe"> </td>
|
||||
<td width="200" bgcolor="#bebebe"><font size="2"><b>Note à ce jour [0 - 100]</b></font></td>
|
||||
<td width="250" bgcolor="#bebebe"><font color="<?=$fontColor?>" size="2"><?=$rating;?></font></td>
|
||||
<td width="100" bgcolor="#bebebe"><?=$imgFeux?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="20"> </td>
|
||||
<td width="10" bgcolor="#e7e7e7"> </td>
|
||||
<td width="200" bgcolor="#e7e7e7"><font size="2"><b>Limite à ce jour [€]</b></font></td>
|
||||
<td width="350" colspan="2" bgcolor="#e7e7e7"><font size="2"><?=$strCreditlimit?></font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="20"> </td>
|
||||
<td width="10" bgcolor="#bebebe"> </td>
|
||||
<td width="200" bgcolor="#bebebe"><font size="2"><b>Informations complémentaires</b></font></td>
|
||||
<td width="350" colspan="2" bgcolor="#bebebe"><font color="<?=$fontColor?>" size="2"><?=$libelle.'<br/>'.$ratingdesc1; if (trim($ratingdesc2)<>'') echo '<br/>'.$ratingdesc2;?></font></td>
|
||||
</tr>
|
||||
<!-- <tr>
|
||||
<td colspan="5" align="right"><img src="/creditsafe/img/logo_creditsafe.png"/></td>
|
||||
</tr>-->
|
||||
</table>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
if ($action<>'commande') {
|
||||
?>
|
||||
<tr>
|
||||
<td width="30"> </td>
|
||||
<td width="550" colspan="2" class="StyleInfoData"><br/><br/><form action="./?page=scorescf&action=commande&siret=<?=$siret?>&id=<?=$id?>" method="POST"><input type="checkbox"/> Mettre cette entreprise sous surveillance scoring partenaire<br/><br/>Adresse email du destinataire <input name="email" type="text" value="<? if ($_SESSION['tabInfo']['login']<>'testreunica' && $_SESSION['tabInfo']['login']<>'reunicacsf') echo $tabInfo['email']?>" size="20"/> <input class="imgButton" type="image" src="./img/boutton_valider_off.gif" name="submit" onmouseover="this.src='./img/boutton_valider_on.gif'" onmouseout="this.src='./img/boutton_valider_off.gif'" title="Surveiller le score partenaire de cette entreprise..."></form></td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
} else {
|
||||
if (preg_match('#^[\w.-]+@[\w.-]+\.[a-zA-Z]{2,5}$#',$_REQUEST['email'])) {
|
||||
$message='Entreprise mise sous surveillance scoring partenaire !';
|
||||
mail( 'contact@scores-decisions.com',"Demande de surveillance score CreditSafe pour $siren à ".$_REQUEST['email'],
|
||||
'REQUEST='.EOL.print_r($_REQUEST,true).'EOL'.
|
||||
'SERVER='.EOL.print_r($_SERVER,true).'EOL'.
|
||||
'SESSION='.EOL.print_r($_SESSION,true).'EOL'.
|
||||
'ENV='.EOL.print_r($_ENV,true).'EOL'.
|
||||
'tabInfo='.print_r($tabInfo,true));
|
||||
$fp=fopen(PATH_LOGS.'surveillance_scf.csv', 'a');
|
||||
fwrite($fp, date('Y/m/d H:i:s').";$siren;".$_REQUEST['email'].';'.$tabInfo['login'].';'.$tabInfo['email'].';'.$tabInfo['ip']."\n");
|
||||
fclose($fp);
|
||||
} else {
|
||||
$message="ERREUR : Veuillez saisir une adresse email valide pour la mise sous surveillance";
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td width="30"> </td>
|
||||
<td width="550" colspan="2" class="StyleInfoData"><br/><br/><h3><?=$message;?></h3></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
class DomDocument2 extends DOMDocument {
|
||||
|
||||
function getValueFromTag($tagName) {
|
||||
$items=$this->getElementsByTagName($tagName);
|
||||
foreach ($items as $item) {
|
||||
|
||||
return utf8_decode($item->nodeValue);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
File diff suppressed because it is too large
Load Diff
@ -88,7 +88,7 @@ class Metier_Partenaires_MFacto
|
||||
public function __construct($db = null)
|
||||
{
|
||||
if ( $db === null ) {
|
||||
$this->iDb = new WDB();
|
||||
$this->iDb = new Metier_Util_Db();
|
||||
} else {
|
||||
$this->iDb = $db;
|
||||
}
|
||||
@ -313,11 +313,10 @@ class Metier_Partenaires_MFacto
|
||||
AND ABS(DATEDIFF(dateAjout, NOW()))<365
|
||||
ORDER BY dateConf DESC, dateAjout DESC", false, MYSQL_ASSOC);
|
||||
foreach ($ret as $i=>$tabCS) {
|
||||
$classWDate = new WDate();
|
||||
$dateMAJ = $classWDate->dateT('Y-m-d', 'M Y', $tabCS['dateAjout']);
|
||||
$dateMAJ = Metier_Util_Date::dateT('Y-m-d', 'M Y', $tabCS['dateAjout']);
|
||||
$libProfil="En date du $dateMAJ : Contentieux importants.";
|
||||
$this->risqueImpaye=true;
|
||||
$this->risqueImpayeMois=$classWDate->dateT('Y-m', 'Ym', $tabCS['dateAjout']);
|
||||
$this->risqueImpayeMois=Metier_Util_Date::dateT('Y-m', 'Ym', $tabCS['dateAjout']);
|
||||
$this->profilPayeur=4;
|
||||
break;
|
||||
}
|
||||
@ -342,7 +341,7 @@ class Metier_Partenaires_MFacto
|
||||
@$tabNbr[$tabPai['trimestre']]['d='.$tabPai['tranchePaiement']]+=$tabPai['nbPieces'];
|
||||
@$tabNbr[$tabPai['trimestre']]['all']+=$tabPai['nbPieces'];
|
||||
$mt=$tabPai['mtPieces']/$tabPai['nbPieces'];
|
||||
//echo "$i\t".$tabPai['trimestre']." (".$tabPai['tranchePaiement']." j)\t$mt=".$tabPai['mtPieces'].'/'.$tabPai['nbPieces'].EOL;
|
||||
//echo "$i\t".$tabPai['trimestre']." (".$tabPai['tranchePaiement']." j)\t$mt=".$tabPai['mtPieces'].'/'.$tabPai['nbPieces'].PHP_EOL;
|
||||
if ($mt<500) { @$tabMtAn[1]['d='.$tabPai['tranchePaiement']]++; @$tabMtAn[1]['all']++; }
|
||||
elseif ($mt<2000) { @$tabMtAn[2]['d='.$tabPai['tranchePaiement']]++; @$tabMtAn[2]['all']++; }
|
||||
elseif ($mt<10000) { @$tabMtAn[10]['d='.$tabPai['tranchePaiement']]++; @$tabMtAn[10]['all']++; }
|
||||
|
@ -1,244 +0,0 @@
|
||||
<?php
|
||||
class Metier_Partenaires_MFedaso {
|
||||
|
||||
private $tabCodeRetour=array(0 => 'Traitement OK',
|
||||
100 => 'Document illisible',
|
||||
101 => 'Document partiellement lisible',
|
||||
102 => 'Document inattendu',
|
||||
103 => 'Page blanche',
|
||||
104 => 'Fichier absent',
|
||||
105 => 'page partiellement scannée',
|
||||
106 => 'Document complémentaire concernant une autre société',
|
||||
107 => 'Page(s) manquante(s)',//NEW
|
||||
108 => 'Document(s) non Francophone',
|
||||
200 => 'Aucune information dirigeants',
|
||||
210 => 'Aucune information actionnaire',
|
||||
211 => 'Aucune information capitalistique',
|
||||
220 => 'Aucune information RIB',
|
||||
221 => 'Code guichet inconnu',
|
||||
250 => 'Raison Sociale absente',//NEW
|
||||
251 => 'Raison Sociale en double : entête retenue',//NEW
|
||||
252 => 'Raison Sociale en double : entête non retenue',//NEW
|
||||
300 => 'Code pays absent du réferentiel',
|
||||
301 => 'Code devise absent du référentiel',
|
||||
201 => 'Code fonction inexistant',
|
||||
);
|
||||
|
||||
public function getRefCodeRetour($sep=',', $eol=EOL) {
|
||||
$str='codRetour'.$sep.'libRetour'.$eol;
|
||||
foreach ($this->tabCodeRetour as $key=>$value)
|
||||
$str.=$key.$sep.$value.$eol;
|
||||
return $str;
|
||||
}
|
||||
|
||||
public function getRefCodeVoie($sep=',', $eol=EOL) {
|
||||
$tabCodeVoie = array(
|
||||
'ABE' => "Abbaye",
|
||||
'AGL' => "Agglomération",
|
||||
'AIRE' => "Aire",
|
||||
'ALL' => "Allée",
|
||||
'ALL' => "Allee",
|
||||
'ACH' => "Ancien chemin",
|
||||
'ART' => "Ancienne route",
|
||||
'ANSE' => "Anse",
|
||||
'ARC' => "Arcade",
|
||||
'AUT' => "Autoroute",
|
||||
'AV' => "Avenue",
|
||||
'BRE' => "Barrière",
|
||||
'BCH' => "Bas chemin",
|
||||
'BSTD' => "Bastide",
|
||||
'BAST' => "Baston",
|
||||
'BEGI' => "Beguinage",
|
||||
'BER' => "Berge",
|
||||
'BOIS' => "Bois",
|
||||
'BCLE' => "Boucle",
|
||||
'BD' => "Boulevard",
|
||||
'BRG' => "Bourg",
|
||||
'BUT' => "Butte",
|
||||
'CALE' => "Cale",
|
||||
'CAMP' => "Camp",
|
||||
'CGNE' => "Campagne",
|
||||
'CPG' => "Camping",
|
||||
'CARR' => "Carré",
|
||||
'CAU' => "Carreau",
|
||||
'CAR' => "Carrefour",
|
||||
'CARE' => "Carrière",
|
||||
'CST' => "Castel",
|
||||
'CAV' => "Cavée",
|
||||
'CTRE' => "Central",
|
||||
'CTRE' => "Centre",
|
||||
'CHL' => "Chalet",
|
||||
'CHP' => "Chapelle",
|
||||
'CHI' => "Charmille",
|
||||
'CHT' => "Château",
|
||||
'CHS' => "Chaussée",
|
||||
'CHE' => "Chemin",
|
||||
'CHV' => "Chemin vicinaux",
|
||||
'CHV' => "Chemin vicinal",
|
||||
'CHEM' => "Cheminement",
|
||||
'CITE' => "Cîte",
|
||||
'CLOI' => "Cloître",
|
||||
'CLOS' => "Clos",
|
||||
'COL' => "Col",
|
||||
'COLI' => "Colline",
|
||||
'CTR' => "Contour",
|
||||
'COR' => "Corniche",
|
||||
'COTE' => "Côte",
|
||||
'COTT' => "Cottage",
|
||||
'COUR' => "Cour",
|
||||
'CRS' => "Cours",
|
||||
'DARS' => "Darse",
|
||||
'DEG' => "Degré",
|
||||
'DSG' => "Descente",
|
||||
'DSC' => "Descente",
|
||||
'DIG' => "Digue",
|
||||
'DOM' => "Domaine",
|
||||
'ECA' => "Ecart",
|
||||
'ECL' => "Ecluse",
|
||||
'EGL' => "Eglise",
|
||||
'EN' => "Enceinte",
|
||||
'ENV' => "Enclave",
|
||||
'ENC' => "Enclos",
|
||||
'ESC' => "Escalier",
|
||||
'ESPA' => "Espace",
|
||||
'ESP' => "Esplanade",
|
||||
'ETING' => "Etang",
|
||||
'FG' => "Faubourg",
|
||||
'FRM' => "Ferme",
|
||||
'FON' => "Fontaine",
|
||||
'FORT' => "Fort",
|
||||
'FORM' => "Forum",
|
||||
'FOS' => "Fosse",
|
||||
'FOYR' => "Foyer",
|
||||
'GAL' => "Galerie",
|
||||
'GARE' => "Gare",
|
||||
'GARN' => "Garenne",
|
||||
'GBD' => "Grand boulevard",
|
||||
'GDEN' => "Grande ensemble",
|
||||
'GR' => "Grande rue",
|
||||
'GRI' => "Grille",
|
||||
'GRIM' => "Grimpette",
|
||||
'GPE' => "Groupe",
|
||||
'GPT' => "Groupement",
|
||||
'HLE' => "Halle",
|
||||
'HAM' => "Hameau",
|
||||
'HCH' => "Haut chemin",
|
||||
'HIP' => "Hippodrome",
|
||||
'HLM' => "HLM",
|
||||
'ILE' => "Ile",
|
||||
'IMM' => "Immeuble",
|
||||
'IMP' => "Impasse",
|
||||
'JARD' => "Jardin",
|
||||
'JTE' => "Jetée",
|
||||
'LEVE' => "Levée",
|
||||
'LD' => "Lieu dit",
|
||||
'LD' => "Lieudit",
|
||||
'LOT' => "Lotissement",
|
||||
'MAIL' => "Mail",
|
||||
'MF' => "Maison forestière",
|
||||
'MAN' => "Manoir",
|
||||
'MAR' => "Marche",
|
||||
'MAS' => "Mas",
|
||||
'MET' => "Métro",
|
||||
'MTE' => "Montée",
|
||||
'MLN' => "Moulin",
|
||||
'MUS' => "Musée",
|
||||
'NTE' => "Nouvelle route",
|
||||
'PAL' => "Palais",
|
||||
'PARC' => "Parc",
|
||||
'PKG' => "Parking",
|
||||
'PRV' => "Parvis",
|
||||
'PAS' => "Passage",
|
||||
'PN' => "Passage à niveau",
|
||||
'PASS' => "Passe",
|
||||
'PLE' => "Passerelle",
|
||||
'PAT' => "Patio",
|
||||
'PAV' => "Pavillon",
|
||||
'PERI' => "Périphérique",
|
||||
'PSTY' => "Péristyle",
|
||||
'PTA' => "Petites allée",
|
||||
'PCH' => "Petit chemin",
|
||||
'PAE' => "Petite avenue",
|
||||
'PIM' => "Petite impasse",
|
||||
'PRT' => "Petite route",
|
||||
'PTR' => "Petite rue",
|
||||
'PL' => "Place",
|
||||
'PLCI' => "Placis",
|
||||
'PLAG' => "Plage",
|
||||
'PLN' => "Plaine",
|
||||
'PLAN' => "Plan",
|
||||
'PLT' => "Plateau",
|
||||
'PNT' => "Pointe",
|
||||
'PONT' => "Pont",
|
||||
'PCH' => "Porche",
|
||||
'PORT' => "Port",
|
||||
'PTE' => "Porte",
|
||||
'PORQ' => "Portique",
|
||||
'POT' => "Poterne",
|
||||
'POUR' => "Pourtour",
|
||||
'PRE' => "Pré",
|
||||
'PRQ' => "Presqu'île",
|
||||
'PROM' => "Promenade",
|
||||
'QU' => "Quai",
|
||||
'QUAI' => "Quai",
|
||||
'QUA' => "Quartier",
|
||||
'RAC' => "Raccourci",
|
||||
'RAID' => "Raidillon",
|
||||
'RPE' => "Rampe",
|
||||
'REM' => "Rempart",
|
||||
'RES' => "Résidence",
|
||||
'ROC' => "Roc",
|
||||
'ROC' => "Rocade",
|
||||
'RPT' => "Rond point",
|
||||
'ROQT' => "Roquet",
|
||||
'RTD' => "Rotonde",
|
||||
'RTE' => "Route",
|
||||
'R' => "Rue",
|
||||
'RUE' => "Rue",
|
||||
'RLE' => "Ruelle",
|
||||
'SEN' => "Sente",
|
||||
'SEN' => "Sentier",
|
||||
'SQ' => "Square",
|
||||
'STDE' => "Stade",
|
||||
'STA' => "Station",
|
||||
'TPL' => "Terre plein",
|
||||
'TRN' => "Terrain",
|
||||
'TSSE' => "Terrasse",
|
||||
'TRT' => "Tertre",
|
||||
'TOUR' => "Tour",
|
||||
'TRA' => "Traverse",
|
||||
'VAL' => "Vallon",
|
||||
'VAL' => "Vallée",
|
||||
'VEN' => "Venelle",
|
||||
'VIA' => "Via",
|
||||
'VTE' => "Vieille route",
|
||||
'VCHE' => "Vieux chemin",
|
||||
'VLA' => "Villa",
|
||||
'VGE' => "Village",
|
||||
'VLGE' => "Village",
|
||||
'VOI' => "Voie",
|
||||
'VOIE' => "Voie",
|
||||
'ZONE' => "Zone",
|
||||
'ZAC' => "Zone d'aménagement concerté",
|
||||
'Z A C' => "Zone d'aménagement concerté",
|
||||
'ZAD' => "Zone d'aménagement différé",
|
||||
'Z A D' => "Zone d'aménagement différé",
|
||||
'ZA' => "Zone artisanale",
|
||||
'Z A' => "Zone artisanale",
|
||||
'ZI' => "Zone industrielle",
|
||||
'Z I' => "Zone industrielle",
|
||||
'ZUP' => "Zone à urbaniser en priorité",
|
||||
'Z U P' => "Zone à urbaniser en priorité",
|
||||
);
|
||||
|
||||
$str='codVoie'.$sep.'libVoie'.$eol;
|
||||
foreach ($tabCodeVoie as $k => $v) {
|
||||
$str.=$k.$sep.$v.$eol;
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -1,354 +0,0 @@
|
||||
<?php
|
||||
|
||||
require_once 'framework/common/curl.php';
|
||||
|
||||
class Metier_Partenaires_MGlobal {
|
||||
|
||||
function __construct($siren) {
|
||||
|
||||
$timeout=5;
|
||||
|
||||
$c_cof = curl_init();
|
||||
$c_soc = curl_init();
|
||||
$c_pou = curl_init();
|
||||
|
||||
// Définit l'URL ainsi que d'autres options
|
||||
curl_setopt($c_cof, CURLOPT_URL, 'http://www.cofacerating.fr/portail/entreprise_identite/identite.asp?ip=pagespro&lg=fr&nsiren='.$siren);
|
||||
curl_setopt($c_cof, CURLOPT_HEADER, 0);
|
||||
curl_setopt($c_cof, CURLOPT_TIMEOUT, $timeout);
|
||||
curl_setopt($c_cof, CURLOPT_REFERER, '');
|
||||
|
||||
curl_setopt($ch2, CURLOPT_URL, "http://www.php.net/");
|
||||
curl_setopt($ch2, CURLOPT_HEADER, 0);
|
||||
|
||||
// Création du gestionnaire multiple
|
||||
$mh = curl_multi_init();
|
||||
|
||||
// Ajoute les deux gestionnaires
|
||||
curl_multi_add_handle($mh,$ch1);
|
||||
curl_multi_add_handle($mh,$ch2);
|
||||
|
||||
$running=null;
|
||||
// Exécute le gestionnaire
|
||||
do {
|
||||
curl_multi_exec($mh,$running);
|
||||
} while($running > 0);
|
||||
|
||||
// Ferme tous les gestionnaires
|
||||
curl_multi_remove_handle($ch1);
|
||||
curl_multi_remove_handle($ch2);
|
||||
curl_multi_close($mh);
|
||||
|
||||
|
||||
$referer='';
|
||||
$url='http://www.cofacerating.fr/portail/entreprise_identite/identite.asp?ip=pagespro&lg=fr&nsiren='.$siren;
|
||||
$page=getUrl($url, '', '', $referer, false, 'www.cofacerating.fr', '', 10);
|
||||
$this->body=$page['body'];
|
||||
$this->codeRetour=$page['code'];
|
||||
$this->header=$page['header'];
|
||||
$this->nscrl=@getTextInHtml($this->body, '&nscrl=', '=','&');
|
||||
$this->rSocAdrCPVille=trim(str_replace(chr(160), ' ', html_entity_decode(utf8_encode(@getTextInHtml($this->body, '<td WIDTH="40%" bgcolor="#F3E5CC" class="tabligne"> <b> Raison sociale<br>', '<td WIDTH="60%" bgcolor="#FFF3DE" class="tabval"><b>','</tr>')))));
|
||||
$tmp=explode('<br>', $this->rSocAdrCPVille);
|
||||
$this->raisonSociale=trim($tmp[0]);
|
||||
unset($tmp[0]);
|
||||
$this->adresse=trim(strip_tags(implode(',', $tmp)));
|
||||
$this->tel=trim(@getTextInHtml($this->body, '<td bgcolor="#F3E5CC" class="tabligne"><b>Téléphone<br>', '<td bgcolor="#FFF3DE" class="tabval" valign="top">', '<br>'));
|
||||
$this->fax=trim(@getTextInHtml($this->body, 'Télécopie</b></td>', '<br>', '</td>'));
|
||||
$this->web=trim(@getTextInHtml($this->body, '<td bgcolor="#F3E5CC" class="tabligne"><b>Adresse internet <br>', ' class="tabval"><a class="tabval" HREF="', '" target="_new">'));
|
||||
$this->mail=trim(@getTextInHtml($this->body, '<a class="tabval" href="mailto:', ':', '">'));
|
||||
|
||||
$bourse=trim(@getTextInHtml($this->body, 'Ville Bourse</b></td>', 'class="tabval">', '</td>'));
|
||||
$tmp=explode('<br>', $bourse);
|
||||
$this->bourseIsin=trim($tmp[0]);
|
||||
$this->bourseMarche=trim($tmp[1]);
|
||||
$this->bourseVille=trim($tmp[2]);
|
||||
|
||||
$infosDispo=trim(@getTextInHtml($this->body, '<b>Liste Produits</b><br></td>', '<br></td><td class="menu3"><img src="../images/vide.gif" border="0"><br></td><td colspan="2" class="menu3">', 'Un secteur ou une région en France</a><br></td>'));
|
||||
$tabTmp=explode('<a href="', $infosDispo);
|
||||
foreach ($tabTmp as $k=>$lien) {
|
||||
preg_match('/^(.*)">(.*)<\/a>/i', $lien, $matches);
|
||||
if ($matches[2]<>'') $this->tabInfos[$matches[2]]=$matches[1];
|
||||
if (substr($matches[2], 0, 12)=='rapport éco.') $this->infoEco='http://www.cofacerating.fr/portail/entreprise_identite/'.$matches[1];//ip=pagespro&
|
||||
elseif (substr($matches[2], 0, 6)=='bilan ') $this->tabBilans[]=substr($matches[2], 6,strlen($matches[2])-6);
|
||||
}
|
||||
$this->activite=trim(str_replace(chr(160), ' ', html_entity_decode(utf8_encode(@getTextInHtml($this->body, '<td WIDTH="40%" bgcolor="#F3E5CC" class="tabligne" valign="top"><b>Libellé code activité </b></td>', '<td WIDTH="60%" bgcolor="#FFF3DE" class="tabval">', '</td>')))));
|
||||
$this->naf=trim(@getTextInHtml($this->body, '<a href="../chaineeco_dynaeco/DynaEco.asp?cnaf=', 'cnaf=', '&'));
|
||||
|
||||
/**
|
||||
** Recherche du NIC sur Société .com
|
||||
**/
|
||||
|
||||
/*
|
||||
$refererS='http://www.societe.com/';
|
||||
$urlS='http://www.societe.com/cgi-bin/recherche?rncs='.$siren.'&vu=1';
|
||||
$page=getUrl($urlS, '', '', $refererS, false, 'www.societe.com');
|
||||
$ste=$page['body'];
|
||||
$this->nic=trim(@getTextInHtml($ste, 'SIRET</div><div class="ficheAltCol2 size11">', $siren, '</div>'));
|
||||
|
||||
$strTmp=trim(@getTextInHtml($ste, '<b><span class="size10">RCS', 'RCS ', ' '.substr($siren,0,3)));
|
||||
$tabTmp=explode(' ', $strTmp);
|
||||
$this->rcsVille=$tabTmp[0];//<td class="txtBlanc" align="left"><b><span class="size10">RCS Paris B 552 144 503<br></span></b></td>
|
||||
$this->rcsType=$tabTmp[1];
|
||||
|
||||
$strTmp=trim(@getTextInHtml($ste, '<div class="ficheAltCol1 size11">Code activité</div>', '<div class="ficheAltCol2 size11">', '</div>'));
|
||||
$tabTmp=explode(' - ', $strTmp);
|
||||
$this->naf=$tabTmp[0];
|
||||
$this->nafLib=$tabTmp[1];
|
||||
|
||||
// <div class="ficheAltCol1 size11">Siège social</div><div class="ficheAltCol2 size11">75 Avenue la Grande Armee - 75116 PARIS 16</div>
|
||||
|
||||
$strTmp=trim(@getTextInHtml($ste, '<div class="ficheAltCol1 size11">Capital social', '<div class="ficheAltCol2 size11">', '</div>'));
|
||||
$this->capitalType='social';
|
||||
$tabTmp=explode(' ', $strTmp);
|
||||
$this->capitalMontant=str_replace(',', '.', str_replace('.', '', $tabTmp[0]));
|
||||
$this->capitalDevise =$tabTmp[1];
|
||||
|
||||
$this->fj=trim(@getTextInHtml($ste, '<div class="ficheAltCol1 size11">Forme juridique', '<div class="ficheAltCol2 size11">', '</div>'));
|
||||
$this->nationalite=trim(@getTextInHtml($ste, '<div class="ficheAltCol1 size11">Nationalité</div>', '<div class="ficheAltCol2 size11">', '</div>'));
|
||||
|
||||
$strTmp=trim(@getTextInHtml($ste, ' DIRIGEANT(S) </span></span></div>', '<div class="ficheCadre" style="min-height:85px;">', '<div class="spacer"></div>'));
|
||||
$tabTmp=explode('<div class="h1bleu2"></div>', $strTmp);
|
||||
foreach ($tabTmp as $k=>$dir) {
|
||||
if (trim($dir)=='') break;
|
||||
$tabTmp1=explode('</div><div class="ficheAltCol2 size11">', $dir);
|
||||
$tabTmp2=explode('représenté par', $tabTmp1[1]);
|
||||
if (isset($tabTmp2[1]) && $tabTmp2[1]<>'') {
|
||||
$soc=trim($tabTmp2[0]);
|
||||
$diri=trim($tabTmp2[1]);
|
||||
} else {
|
||||
$soc='';
|
||||
$diri=trim($tabTmp1[1]);
|
||||
}
|
||||
preg_match("/^(Mme|M\.|Mlle|Mle|M) ([A-Z\s]*) ([A-Z][a-z\s]*)/", $diri, $matches);
|
||||
//print_r($matches);
|
||||
$this->tabDirigeants[]=array('FONCTION'=>trim(strip_tags($tabTmp1[0])), 'SOCIETE'=>$soc, 'GENRE'=>$matches[1], 'PRENOM'=>trim($matches[3]), 'NOM'=>trim($matches[2]));
|
||||
}
|
||||
|
||||
$this->dateImmatriculation=trim(@getTextInHtml($ste, '<div class="ficheAltCol1 size11"> Immatriculation', '<div class="ficheAltCol2 size11">', '</div>'));
|
||||
//06-03-2007</div>
|
||||
/* Date Creation = ""
|
||||
En bourse = ""
|
||||
Effectif societe = ""
|
||||
Dirigeants :
|
||||
**/
|
||||
$urlRacine='http://infobilan.decideur.com/';
|
||||
$tabPost=array( 'choix'=>'1',
|
||||
'pagePrecedente'=>'recherche_entreprise.html',
|
||||
'nomsocRech'=>'',
|
||||
'cpRech'=>'',
|
||||
'villeRech'=>'',
|
||||
'nomdirRech'=>'',
|
||||
'predirRech'=>'',
|
||||
'sirenRech'=>$siren,
|
||||
'telRech'=>'',
|
||||
'Rechercher.x'=>round(79),
|
||||
'Rechercher.y'=>round(19),);
|
||||
$url=$urlRacine.'liste_result.html';
|
||||
$referer=$urlRacine.'recherche_entreprise.html';
|
||||
$page=getUrl($url,'', $tabPost, $referer, false, 'infobilan.decideur.com');
|
||||
$this->body=$page['body'];
|
||||
$strCookie=$page['header']['Set-Cookie'];
|
||||
$refererInfoD=$url;
|
||||
|
||||
if(preg_match_all('/<a href="choix_pdt\.html\?(.*)" class="tt1">(.*)<\/a><\/span><br>/i', $page['body'], $matches))
|
||||
$urlInfoD=$urlRacine.'choix_pdt.html?'.$matches[1][0];
|
||||
else
|
||||
$urlInfoD='';
|
||||
|
||||
$page=getUrl($this->infoEco, '', '', $url, false, 'www.cofacerating.fr');
|
||||
if (strpos($page['body'], '<b>Choix du mode de paiement</b>')===false) { // Le rapport éco. est cadeau !!!
|
||||
$this->infoEco=true;
|
||||
$eco=$page['body'];
|
||||
//die ($eco);
|
||||
$strTmp=strip_tags(@getTextInHtml($eco, ' class="tabligne" > Capital   (', '(', '</tr><tr>'));
|
||||
$tabTmp=explode(')', $strTmp);
|
||||
$this->capitalType=$tabTmp[0];
|
||||
$tabTmp=explode(' ', $tabTmp[1]);
|
||||
$this->capitalMontant=trim(str_replace(chr(160), '', $tabTmp[0]));
|
||||
$this->capitalDevise =trim(str_replace(chr(160), '', $tabTmp[1]));
|
||||
|
||||
$this->steInactive=trim(@getTextInHtml($eco, ' class="tabligne" > Société inactive</td>', 'class="tabval" >', '</td>'));
|
||||
|
||||
$this->dateCreation=trim(@getTextInHtml($eco, ' class="tabligne" > Date de création</td>', 'class="tabval" >', '</td>'));
|
||||
$this->fj=trim(@getTextInHtml($eco, ' class="tabligne" > Forme juridique</td>', 'class="tabval" >', '</td>'));
|
||||
$this->effectif=trim(@getTextInHtml($eco, ' class="tabligne" > Effectif', 'class="tabval" >', '</td>'));
|
||||
|
||||
if (count($this->tabDirigeants)==0) { // Si il y a déjà des dirigeants on garde ceux de Société.com !!!
|
||||
$strTmp=trim(@getTextInHtml($eco, ' class="tabligne" > Cotation en bourse</td>', '<td bgcolor="#F3E5CC" class="tabligne" >', '<td bgcolor="#F3E5CC" class="tabligne" > Effectif'));
|
||||
$tabTmp=explode('<td bgcolor="#F3E5CC" class="tabligne" >', $strTmp);
|
||||
foreach ($tabTmp as $k=>$dir) {
|
||||
$tabTmp1=explode('<td bgcolor="#FFF3DE" class="tabval" >', $dir);
|
||||
$tabTmp2=explode(' ', trim(strip_tags($tabTmp1[1])));
|
||||
$this->tabDirigeants[]=array('FONCTION'=>trim(strip_tags($tabTmp1[0])), 'GENRE'=>trim($tabTmp2[0]), 'PRENOM'=>trim($tabTmp2[1]), 'NOM'=>trim($tabTmp2[2]));
|
||||
}
|
||||
}
|
||||
|
||||
$this->strLiensFi=trim(strip_tags(@getTextInHtml($eco, '<td class="tabtot">LIENS FINANCIERS</td>', '<tr>', '</td></tr>')));
|
||||
$this->strElemsFi=trim(strip_tags(@getTextInHtml($eco, '<td class="tabtot">ELEMENTS FINANCIERS</td>', '<tr>', '</td></tr>')));
|
||||
}
|
||||
|
||||
$refererP='http://www.score3.fr/';
|
||||
$urlP='http://www.score3.fr/entreprise.shtml?siren='.$siren;
|
||||
$page=getUrl($urlP, '', '', $refererP, false, 'www.score3.fr');
|
||||
$pou=$page['body'];
|
||||
$fp=fopen('./pouet.html', 'w');
|
||||
fwrite($fp, $pou);
|
||||
fclose($fp);
|
||||
|
||||
if ($urlInfoD<>'') {
|
||||
$page=getUrl($urlInfoD,$strCookie,'', $refererInfoD, false, 'infobilan.decideur.com');
|
||||
$referer=$urlInfoD;
|
||||
if ($this->nscrl==0) $this->nscrl=@getTextInHtml($url, 'nscrlP=', '=','&');
|
||||
|
||||
$url=$urlRacine.'fiche_ident.html';
|
||||
$page=getUrl($url,$strCookie,'', $referer, false, 'infobilan.decideur.com');
|
||||
$this->body=$page['body'];
|
||||
|
||||
if ($this->raisonSociale=='')
|
||||
$this->raisonSociale=trim(@getTextInHtml($this->body, '<span class="libelle2">Société', ' :', '</span>'));
|
||||
|
||||
if ($this->adresse=='')
|
||||
$this->adresse=trim(@getTextInHtml($this->body, '<span class="libelle2">Adresse</span> <strong>:', '</strong>', '</td>'));
|
||||
|
||||
if ($this->tel=='')
|
||||
$this->tel=trim(@getTextInHtml($this->body, '<td valign="top"><span class="libelle2">Tél', '</span>', '<br>'));
|
||||
if ($this->fax=='')
|
||||
$this->fax=trim(@getTextInHtml($this->body, '<span class="libelle2">Fax</span>', ' :', '<br>'));
|
||||
if ($this->web=='')
|
||||
$this->web=trim(@getTextInHtml($this->body, '<span class="libelle2">Site Web</span>', '<a href="', '" target="_blank">'));
|
||||
if ($this->mail=='')
|
||||
$this->mail=trim(@getTextInHtml($this->body, '<span class="libelle2">E-mail</span>', '<a href="mailto:', '">'));
|
||||
if ($this->naf=='')
|
||||
$this->naf=trim(@getTextInHtml($this->body, '<span class="libelle2">Code NAF</span>', ' :', '</td>'));
|
||||
|
||||
if(preg_match('/<td valign="top"><span class="libelle2">Capital social<\/span> : (\d*)(.*)<br>/isU', $this->body, $matches)
|
||||
&& ($this->capitalMontant=='' || $this->capitalDevise=='')) {
|
||||
$this->capitalMontant=trim($matches[1]);
|
||||
$this->capitalDevise=trim($matches[2]);
|
||||
}
|
||||
|
||||
if ($this->fj=='')
|
||||
$this->fj=trim(@getTextInHtml($this->body, '<span class="libelle2">Forme juridique</span>', ' :', '<br>'));
|
||||
if ($this->nationalite=='')
|
||||
$this->nationalite=trim(@getTextInHtml($this->body, '<span class="libelle2">Nationalité</span>', ' :', '</td>'));
|
||||
if ($this->effectif=='')
|
||||
$this->effectif=trim(@getTextInHtml($this->body, '<td valign="top"><span class="libelle2">Effectif</span>', ' :', '<br>'));
|
||||
if ($this->activite=='')
|
||||
$this->activite=trim(@getTextInHtml($this->body, '<span class="libelle2">Activité</span>', ' :', '<br>'));
|
||||
|
||||
/** Actionnaires **/
|
||||
$strTmp=trim(@getTextInHtml($this->body, 'ACTIONNAIRES<br>', '</div></h1>', '<h1>'));
|
||||
if(preg_match_all('/<p><span class="libelle2">(.*)<\/span> - <span class="libelle2">Participation<\/span> : (.*) %<br>(.*)<\/p>/isU', $strTmp, $matches)) {
|
||||
foreach ($matches[1] as $i=>$nom) {
|
||||
$this->tabAct[$i]['nom']=trim($nom);
|
||||
$this->tabAct[$i]['pct']=trim($matches[2][$i]);
|
||||
$this->tabAct[$i]['rcs']=trim(str_replace('RCS : ','',strip_tags($matches[3][$i])));
|
||||
}
|
||||
}
|
||||
|
||||
/** Filiales **/
|
||||
$strTmp=trim(@getTextInHtml($this->body, 'FILIALES<br>', '</div></h1>', '<h1>'));
|
||||
if(preg_match_all('/<p><span class="libelle2">(.*)<\/span> - <span class="libelle2">Participation<\/span> :(.*)%<br>(.*)<\/p>/isU', $strTmp, $matches)) {
|
||||
foreach ($matches[1] as $i=>$nom) {
|
||||
$this->tabFil[$i]['nom']=trim($nom);
|
||||
$this->tabFil[$i]['pct']=trim($matches[2][$i]);
|
||||
$this->tabFil[$i]['rcs']=trim(str_replace('RCS :','',strip_tags($matches[3][$i])));
|
||||
}
|
||||
}
|
||||
|
||||
/** CA et Résultat **/
|
||||
$strTmp=trim(@getTextInHtml($this->body, '<h1>PRINCIPAUX ELEMENTS FINANCIERS<br>', '</div></h1>', '</p>'));
|
||||
if(preg_match('/<p><span class="libelle2">CA (.*)<\/span>(.*)<br>/isU', $strTmp, $matches)) {
|
||||
$this->derExerciceAnnee=trim($matches[1]);
|
||||
$this->derExerciceCA=trim(str_replace(':',' ', $matches[2]));
|
||||
}
|
||||
if(preg_match('/<span class="libelle2">Résultat(.*)<\/span>(.*)$/isU', $strTmp, $matches)) {
|
||||
$this->derExerciceResultat=trim(str_replace(':',' ', $matches[2]));
|
||||
}
|
||||
|
||||
$infoBilan=print_r($page, true);
|
||||
$fp=fopen('./infobilan.html', 'w');
|
||||
fwrite($fp, $infoBilan);
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
if ($this->nbEtab=='' || $this->nbEtab=='0') {
|
||||
$this->nbEtab=trim(strip_tags(str_replace('afficher la liste...', '', @getTextInHtml($pou, '<tr><td class="ligne1_2">Etablissements </td>', '<td class="ligne2_2">', '</td></tr>'))));
|
||||
$urlPEtab='http://www.score3.fr/etablissements.shtml?page=1&siren='.$siren;
|
||||
$refererPEtab=$urlP;
|
||||
$page=getUrl($urlPEtab, '', '', $refererPEtab, false, 'www.score3.fr');
|
||||
$pou2=$page['body'];
|
||||
if(preg_match_all('/<tr bgcolor="(?:\S*)"><td class="ligne1b" align="center" width="10%">(\d*)<\/td><td class="ligne2" height="50"><table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td class="infos">(.*)<\/td><\/tr><\/table>/isU', $pou2, $matches)) {
|
||||
foreach ($matches[1] as $i=>$nic) {
|
||||
$strEtab=$matches[2][$i];
|
||||
$this->tabEtab[$i]['siren']=$siren;
|
||||
$this->tabEtab[$i]['nic']=$nic;
|
||||
$this->tabEtab[$i]['siret']=$siren.$nic;
|
||||
|
||||
$this->tabEtab[$i]['enseigne']=trim(str_replace(chr(160),' ',utf8_decode(strip_tags(@getTextInHtml($strEtab, '<span class="titre3">', '">', '</span>')))));
|
||||
$this->tabEtab[$i]['adresse']=trim(str_replace(chr(160),' ',utf8_decode(strip_tags(@getTextInHtml($strEtab, '<span class="infos">', '">', '<br>')))));
|
||||
$strTmp=trim(str_replace(chr(160),' ',utf8_decode(strip_tags(@getTextInHtml($strEtab, '<span class="infos">', '<br>', '</span>')))));
|
||||
$tabTmp=explode(' ', $strTmp);
|
||||
$this->tabEtab[$i]['cp']=$tabTmp[0];
|
||||
unset($tabTmp[0]);
|
||||
$this->tabEtab[$i]['ville']=implode(' ',$tabTmp);
|
||||
$strTmp=trim(strip_tags(@getTextInHtml($strEtab, '<td class="infos" align="right" valign="top">', '">', ')')));
|
||||
$tabTmp=explode('(', $strTmp);
|
||||
$this->tabEtab[$i]['naf_code']=$tabTmp[1];
|
||||
$this->tabEtab[$i]['naf_lib']=trim(str_replace(chr(160),' ',utf8_decode($tabTmp[0])));
|
||||
if (preg_match('/<br>T.l\.(.*)$/i',$strEtab,$matches2))
|
||||
$this->tabEtab[$i]['tel']=trim(str_replace(chr(160),' ',utf8_decode($matches2[1])));
|
||||
else $this->tabEtab[$i]['tel']='';
|
||||
}
|
||||
}
|
||||
$this->nbEtab=count($this->tabEtab);
|
||||
$fp=fopen('./pouet_etab.html', 'w');
|
||||
fwrite($fp, $pou2);
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
if ($this->effectif=='' || $this->effectif=='0' || $this->effectif=='NC')
|
||||
$this->effectif=trim(@getTextInHtml($pou, '<tr><td class="ligne1_2">Effectifs</td>', '<td class="ligne2_2">', '</td></tr>'));
|
||||
|
||||
if ($this->dateImmatriculation=='' || $this->dateImmatriculation=='0')
|
||||
$this->dateImmatriculation=trim(@getTextInHtml($pou, '<tr><td class="ligne1_2">Date d\'immatriculation</td>', '<td class="ligne2_2">', '</td></tr>'));
|
||||
if ($this->dateFermeture=='' || $this->dateFermeture=='0')
|
||||
$this->dateFermeture=trim(@getTextInHtml($pou, '<tr><td class="ligne1_2">Date de fin d\'exploitation</td>', '<td class="ligne2_2">', '</td></tr>'));
|
||||
|
||||
if ($this->tel=='' || $this->tel=='0')
|
||||
$this->tel=trim(@getTextInHtml($pou, '<tr><td class="ligne1_2">Téléphone</td>', '<td class="ligne2_2">', '</td></tr>'));
|
||||
|
||||
if ($this->fax=='' || $this->fax=='0')
|
||||
$this->fax=trim(@getTextInHtml($pou, '<tr><td class="ligne1_2">Fax</td>', '<td class="ligne2_2">', '</td></tr>'));
|
||||
|
||||
$strTmp=trim(@getTextInHtml($pou, 'Procédures collectives</td></tr>', '</table></td>', '</td><td background'));
|
||||
if(preg_match_all('/<tr><td class="ligne1_2">(.*)<\/td><td class="ligne2_2">(.*)<\/td><\/tr>/isU', $strTmp, $matches)) {
|
||||
foreach ($matches[1] as $i=>$jug) {
|
||||
$this->tabJug[$i]['date']=$matches[1][$i];
|
||||
$this->tabJug[$i]['juge']=$matches[2][$i];
|
||||
}
|
||||
}
|
||||
|
||||
$this->score_pouey=trim(@getTextInHtml($pou, '<param name="movie" value="cadran.swf?rotation=', '&type=pouey&valeur=', '">'));
|
||||
$this->score_conan=trim(@getTextInHtml($pou, '<param name="movie" value="cadran.swf?rotation=', '&type=ch&valeur=', '">'));
|
||||
$this->score_afdcc=trim(@getTextInHtml($pou, '<param name="movie" value="cadran.swf?rotation=', '&type=afdcc&valeur=', '">'));
|
||||
$this->vigilance =trim(@getTextInHtml($pou, '<param name="movie" value="vigilance.swf', 'degre=', '">'));
|
||||
|
||||
if(preg_match('/Date de l\'exercice<\/td><td class="ligne2_2">(.*) sur (\d*) mois<\/td><\/tr>/isU', $pou, $matches)) {
|
||||
$this->derExerciceDClot=trim($matches[1]);
|
||||
$this->derExerciceDuree=trim($matches[2]);
|
||||
}
|
||||
|
||||
/* Siret SIEGE
|
||||
2 Fonction, Nom Prénoù ET Date NAissance du PP
|
||||
5 Liste des actes
|
||||
*/
|
||||
if ($this->codeRetour==200)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
File diff suppressed because it is too large
Load Diff
@ -1,365 +0,0 @@
|
||||
<?php
|
||||
require_once 'framework/common/curl.php';
|
||||
/** @todo A faire et sortir du coup la méthode de commande d'enquêtes du WS **/
|
||||
class Metier_Partenaires_MIntersud {
|
||||
|
||||
private $body = '';
|
||||
private $header = '';
|
||||
private $codeRetour = 0;
|
||||
private $cookie=false;
|
||||
private $reference = 0;
|
||||
private $timeOut=0;
|
||||
private $url='';
|
||||
private $urlRacine='http://www.intersud.fr';
|
||||
private $referer='';
|
||||
private $curPage='';
|
||||
public $siren;
|
||||
|
||||
function __construct() {
|
||||
$this->partGetSession();
|
||||
$this->partConnection();
|
||||
}
|
||||
|
||||
function __destruct() {
|
||||
$this->partSaveSession();
|
||||
}
|
||||
|
||||
function getInfosDisponbiles($siren) {
|
||||
$this->siren=$siren;
|
||||
$this->partConnection();
|
||||
return $this->partVitrine(true);
|
||||
}
|
||||
|
||||
private function partConnection() {
|
||||
if (!$this->wrncsrv2 || time()>$this->timeOut) {
|
||||
$this->timeOut=time()+900;
|
||||
|
||||
$this->url=$this->urlRacine.'/index.ow';
|
||||
$page=getUrl($this->url, '', '', $this->urlRacine, false, 'www.euridile.com');
|
||||
$this->referer=$this->url;
|
||||
$this->body=$page['body'];
|
||||
$this->codeRetour=$page['code'];
|
||||
$this->header=$page['header'];
|
||||
//echo date('Y/m/d - H:i:s') ." - Initialisation URL = $this->url (Code retour = $this->codeRetour)<br/>".EOL;
|
||||
$fp=fopen('./euridile_connexion1.log', 'w');
|
||||
fwrite($fp,print_r($page,true));
|
||||
fclose($fp);
|
||||
if (preg_match('/<META HTTP-EQUIV="Refresh" CONTENT="0; URL=(.*)">/i', $this->body, $matches))
|
||||
$this->url=$this->urlRacine.'/'.$matches[1];
|
||||
else debugLog('E',"Erreur de communication - Redirection impossible sur ".$this->url,__LINE__,__FILE__,__FUNCTION__,__CLASS__);
|
||||
debugLog('I','Redirection trouv<75>e sur la page '.$this->url,__LINE__,__FILE__,__FUNCTION__,__CLASS__);
|
||||
|
||||
if (preg_match('/\.ow\?WRNCSRV2=(.*)$/i', $matches[1], $matches)) {
|
||||
$this->wrncsrv2=$matches[1];
|
||||
debugLog('I','Session partenaire WRNCSRV2='.$this->wrncsrv2,__LINE__,__FILE__,__FUNCTION__,__CLASS__);
|
||||
}
|
||||
else debugLog('E','Impossible d\'identifier le num<75>ro de session partenaire',__LINE__,__FILE__,__FUNCTION__,__CLASS__);
|
||||
|
||||
$page=getUrl($this->url, '', '',$this->referer, false, 'www.euridile.com');
|
||||
$this->referer=$this->url;
|
||||
$this->body=$page['body'];
|
||||
$this->codeRetour=$page['code'];
|
||||
$this->header=$page['header'];
|
||||
debugLog('D',"Page d'accueil URL = $this->url (Code retour = $this->codeRetour)",__LINE__,__FILE__,__FUNCTION__,__CLASS__);
|
||||
$fp=fopen('./euridile_connexion2.log', 'w');
|
||||
fwrite($fp,print_r($page,true));
|
||||
fclose($fp);
|
||||
|
||||
if (preg_match('/<form method="POST" name="abonnement" ACTION="(.*)" /i', $this->body, $matches)) {
|
||||
$postData=array('IDENT'=>'OK',
|
||||
'MDP'=>'3180',
|
||||
'cliref'=>'K5K3X5',
|
||||
'PASS'=>'3180',
|
||||
'WRNCSRV2'=>$this->wrncsrv2);
|
||||
/** @todo Fair une fonction qui g<EFBFBD>re les URL commen<EFBFBD>ant par ./ ou ../ ou / afin de pouvoir les concatener
|
||||
**/
|
||||
$this->url=$this->urlRacine.str_replace('..','',$matches[1]);
|
||||
debugLog('D',"Authentification possible vers $this->url",__LINE__,__FILE__,__FUNCTION__,__CLASS__);
|
||||
}
|
||||
else debugLog('E',"Authentification impossible car formulaire indisponible",__LINE__,__FILE__,__FUNCTION__,__CLASS__);
|
||||
|
||||
sleep(1);
|
||||
$page=getUrl($this->url,'', $postData, $this->referer, false, 'www.euridile.com');
|
||||
$this->referer=$this->url;
|
||||
$this->body=$page['body'];
|
||||
$this->codeRetour=$page['code'];
|
||||
$this->header=$page['header'];
|
||||
//echo date('Y/m/d - H:i:s') ." - Apr<70>s authentification = $this->url (Code retour = $this->codeRetour)<br/>".EOL;
|
||||
$fp=fopen('./euridile_connexion3.log', 'w');
|
||||
fwrite($fp,print_r($page,true));
|
||||
fclose($fp);
|
||||
|
||||
if(preg_match('/\/'.$this->weur.'\/iden_evaluation_type_(.*)/i', $this->body, $matches))
|
||||
{ $tabTmp=explode('"', $matches[0]);
|
||||
$this->url=$this->urlRacine.$tabTmp[0];
|
||||
debugLog('D',"Page de recherche recherche trouv<75>e = $this->url>",__LINE__,__FILE__,__FUNCTION__,__CLASS__);
|
||||
} else debugLog('E',"Erreur de communication - Recherche introuvable !",__LINE__,__FILE__,__FUNCTION__,__CLASS__);
|
||||
|
||||
$this->curPage='recherche';
|
||||
} //else echo date('Y/m/d - H:i:s') ." - Deja connecte !<br/>".EOL;
|
||||
return true;
|
||||
}
|
||||
|
||||
private function partIdentite() {
|
||||
if ($this->curPage<>'vitrine')
|
||||
$this->partVitrine();
|
||||
|
||||
$iDb=new WDB();
|
||||
$ret=$iDb->select( 'jo.rncs_entrep',
|
||||
'siren, rcs, nom, adresse1, adresse2, adresse3, cp, ville, naiss_date, naiss_lieu, sexe, enseigne, sigle, '.
|
||||
'fj_lib, naf_code, naf_lib, date_crea, date_imma, greffe, num_gestion, capital_mnt, capital_dev, nationalite, '.
|
||||
'nb_etab, indRadiation, date_radiation, indProcol, dateUpdate, procedures, dirigeants, etablissements',
|
||||
"siren=$this->siren ORDER BY dateUpdate DESC LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
if (count($ret)) {
|
||||
/** On v<EFBFBD>rifie qu'aucune annonce n'a <EFBFBD>t<EFBFBD> publi<EFBFBD> depuis au bodacc
|
||||
**/
|
||||
$tabRet=$ret[0];
|
||||
$ret=$iDb->select( 'jo.bodacc_detail', 'count(*)',
|
||||
"siren=$this->siren AND Bodacc_Date_Parution>='".$tabRet['dateUpdate']."'");
|
||||
if ($ret[0][0]==0) {
|
||||
$tabRet['procedures']=unserialize($tabRet['procedures']);
|
||||
$tabRet['dirigeants']=unserialize($tabRet['dirigeants']);
|
||||
$tabRet['etablissements']=unserialize($tabRet['etablissements']);
|
||||
return $tabRet;
|
||||
}
|
||||
}
|
||||
|
||||
$url=$this->urlRacine.'/'.$this->weur.'/paie_abonnes_livraison_directe_informations.ow?flag_type_acces_direct_infos=FIC&WRNCSRV2='.$this->wrncsrv2;
|
||||
$page=getUrl($url, '', '', $this->referer, false, 'www.euridile.com');
|
||||
$this->body=$page['body'];
|
||||
$this->codeRetour=$page['code'];
|
||||
$this->header=$page['header'];
|
||||
//echo date('Y/m/d - H:i:s') ." - Fiche d'identit<69> = $url (Code retour = $this->codeRetour)<br/>".EOL;
|
||||
//$this->curPage='vitrine';
|
||||
$tabRet=array();
|
||||
|
||||
/**@todo Traiter le cas donn<EFBFBD>es provisoires :
|
||||
<TR><TD bgcolor='#fff0d0'><FONT COLOR=#100070 FACE=ARIAL SIZE=2><B><!-- Donn<6E>es provisoires --> En cours d'immatriculation, donn<6E>es provisoires</B></FONT></TD></TR><TR><TD bgcolor=#fff0d0><FONT COLOR=#100070 FACE=ARIAL SIZE=2>Nombre d'<27>tablissements : <FONT COLOR=#100070 FACE=ARIAL SIZE=2><B></B></TD></TR>
|
||||
</TABLE>
|
||||
*/
|
||||
// Identit<69>
|
||||
$tabRet['siren']=$this->siren;
|
||||
$tabRet['codeRetour']=$this->codeRetour;
|
||||
$tabRet['rcs']=@getTextInHtml($this->body, 'FACE="ARIAL,HELVETICA" SIZE=2>RCS : ', '<b>','</b>');
|
||||
$strTmp=@getTextInHtml($this->body, 'FACE="ARIAL,HELVETICA" SIZE=2>RCS : <b>', 'FACE="ARIAL,HELVETICA" SIZE=2><b>', '<img src=\'images/rouge.gif\'');
|
||||
$tabTmp=explode('</TD>', $strTmp);
|
||||
$tabRet['nom']=strip_tags($tabTmp[0]);
|
||||
// ... adresse
|
||||
for ($i=1; $i<5; $i++) {
|
||||
if (strpos($tabTmp[$i], 'Nom commercial - Enseigne :')===false &&
|
||||
strpos($tabTmp[$i], 'Sigle :')===false ) {
|
||||
$ligne=trim(strip_tags($tabTmp[$i]));
|
||||
if (preg_match("/^([0-9]{5,5})([\D]*)/i", $ligne, $matches)) {
|
||||
$tabRet['cp']=trim($matches[1]);
|
||||
$tabRet['ville']=trim($matches[2]);
|
||||
break;
|
||||
} else $tabRet['adresse'.$i]=$ligne;
|
||||
}
|
||||
}
|
||||
|
||||
$pp_nais=trim(strip_tags(@getTextInHtml($this->body, 'FACE=\'ARIAL,HELVETICA\' SIZE=2>Date et lieu de naissance :', '<B>','</B>')));
|
||||
$tabTmp=explode(' <20> ', $pp_nais);
|
||||
$tabRet['naiss_date']=trim(str_replace('N<>(e) le ', '', strip_tags($tabTmp[0])));
|
||||
$tabRet['naiss_lieu']=trim(strip_tags($tabTmp[1]));
|
||||
$tabRet['sexe']=trim(strip_tags(@getTextInHtml($this->body, 'FACE=\'ARIAL,HELVETICA\' SIZE=2>Sexe :', '<B>','</B>')));
|
||||
|
||||
$tabRet['enseigne']=trim(strip_tags(@getTextInHtml($this->body, 'FACE=ARIAL SIZE=2>Nom commercial - Enseigne :', '<B>','</B>')));
|
||||
$tabRet['sigle']=trim(strip_tags(@getTextInHtml($this->body, 'FACE=ARIAL SIZE=2>Sigle :', '<B>','</B>')));
|
||||
$tabRet['fj_lib']=@getTextInHtml($this->body, 'FACE=\'ARIAL,HELVETICA\' SIZE=2>Forme juridique :', '<B>','</B>');
|
||||
$strTmp=@getTextInHtml($this->body, 'FACE=\'ARIAL,HELVETICA\' SIZE=2>Activité :', '<B>','</B>');
|
||||
$tabTmp=explode(' - ', $strTmp);
|
||||
$tabRet['naf_code']=$tabTmp[0];
|
||||
$tabRet['naf_lib']=$tabTmp[1];
|
||||
$tabRet['date_crea']=trim(strip_tags(@getTextInHtml($this->body, 'FACE=ARIAL SIZE=2>Date de création :', '<B>','</B>')));
|
||||
$tabRet['date_imma']=trim(strip_tags(@getTextInHtml($this->body, 'FACE=ARIAL SIZE=2>Date d\'immatriculation :', '<B>','</B>')));
|
||||
$tabRet['greffe']=trim(strip_tags(@getTextInHtml($this->body, 'FACE=ARIAL SIZE=2>Greffe :', '<B>','</B>')));
|
||||
$tabRet['num_gestion']=trim(strip_tags(@getTextInHtml($this->body, 'FACE=ARIAL SIZE=2>N<>de gestion :', '<B>','</B>')));
|
||||
$strTmp=@getTextInHtml($this->body, 'FACE=ARIAL SIZE=2>Capital :', '<B>','</B>');
|
||||
if (preg_match('/([0-9\.,\s]*)([\D]*)/i', $strTmp, $matches)) {
|
||||
$tabRet['capital_mnt']=trim(str_replace(' ','',str_replace(',','.',$matches[1])));
|
||||
$tabRet['capital_dev']=$matches[2];
|
||||
}
|
||||
else {
|
||||
$tabRet['capital_mnt']=0;
|
||||
$tabRet['capital_dev']='';
|
||||
}
|
||||
$tabRet['nationalite']=trim(strip_tags(@getTextInHtml($this->body, 'FACE=ARIAL SIZE=2>Nationalité :', '<B>','</B>')));
|
||||
$tabRet['nb_etab']=trim(strip_tags(@getTextInHtml($this->body, 'FACE=ARIAL SIZE=2>Nombre d\'<27>tablissements :', '<B>','</B>')));
|
||||
if (strpos($this->body,'FACE=ARIAL SIZE=2><B>Radiation</B>')>0) {
|
||||
$tabRet['indRadiation']=true;
|
||||
$tabRet['date_radiation']=trim(strip_tags(@getTextInHtml($this->body, 'FACE=ARIAL SIZE=2>Entreprise radi<64>e le :', '<B>','</B>')));
|
||||
} else
|
||||
$tabRet['indRadiation']=false;
|
||||
|
||||
// Proc<6F>dures collectives
|
||||
if (strpos($this->body,'FACE=ARIAL SIZE=2><B>Les proc<6F>dures collectives</B>')>0) {
|
||||
$tabRet['indProcol']=true;
|
||||
$strTmp=@getTextInHtml($this->body, '<B>Les proc<6F>dures collectives</B></FONT>', "<img src='./images/rouge.gif' width=4 height=4 border='0'>",
|
||||
'</TABLE>');
|
||||
$tabTmp=explode("<img src='./images/rouge.gif' width=4 height=4 border='0'>", $strTmp);
|
||||
foreach ($tabTmp as $nproc=>$proc) {
|
||||
$tabTmp2=explode('</TD></TR>', $proc);
|
||||
$tabTmp3=explode(' du ', $tabTmp2[0]);
|
||||
$tabTmp2=explode('<TD WIDTH=99% ALIGN=LEFT BGCOLOR=#fff0d0 colspan=2><FONT COLOR=#100070 FACE=ARIAL SIZE=2>', $proc);
|
||||
$tabInter=array();
|
||||
for($nInter=1; isset($tabTmp2[$nInter]); $nInter++) {
|
||||
$tabTmp4=explode('</TD></TR>', $tabTmp2[$nInter]);
|
||||
$tabInter[]=array( 'type'=>trim(strip_tags($tabTmp4[0])),
|
||||
'nom'=>trim(str_replace(' ','',strip_tags($tabTmp4[1]))),
|
||||
'adresse'=>trim(str_replace(' ','',strip_tags($tabTmp4[2]))),
|
||||
'cpVille'=>trim(str_replace(' ','',strip_tags($tabTmp4[3]))));
|
||||
}
|
||||
$tabRet['procedures'][$nproc]=array('type'=>trim(strip_tags($tabTmp3[0])),
|
||||
'date'=>trim(strip_tags($tabTmp3[1])),
|
||||
'intervenant'=>$tabInter);
|
||||
}
|
||||
}
|
||||
else $tabRet['indProcol']=false;
|
||||
|
||||
// Dirigeants
|
||||
$strTmp=@getTextInHtml($this->body, '<B>Les dirigeants</B></FONT>', "<img src='./images/rouge.gif' width=4 height=4 border='0'>",'</TABLE>');
|
||||
$tabTmp=explode("<img src='./images/rouge.gif' width=4 height=4 border='0'>", $strTmp);
|
||||
foreach ($tabTmp as $ndir=>$dir) {
|
||||
$tabTmp2=explode('</TD>', $dir);
|
||||
$tabTmp3=explode('</B> ', $tabTmp2[1]);
|
||||
$nom=trim(strip_tags($tabTmp3[0]));
|
||||
$prenom=trim(strip_tags($tabTmp3[1]));
|
||||
$naiss=trim(strip_tags($tabTmp2[3]));
|
||||
if (strpos($naiss, 'N<>(e) le')===false) {
|
||||
$fonction=$naiss;
|
||||
} else {
|
||||
$tabTmp3=explode(' <20> ', $naiss);
|
||||
$naiss_date=trim(str_replace('N<>(e) le ', '', strip_tags($tabTmp3[0])));
|
||||
$naiss=trim(strip_tags($tabTmp3[1]));
|
||||
$tabTmp3=explode('(', $naiss);
|
||||
$naiss_ville=trim(strip_tags($tabTmp3[0]));
|
||||
$naiss_depPays=trim(str_replace(')','', strip_tags($tabTmp3[1])));
|
||||
$fonction=trim(strip_tags($tabTmp2[5]));
|
||||
}
|
||||
$tabTmp=explode(' n<>e ', $prenom);
|
||||
$prenom=$tabTmp[0];
|
||||
$naiss_nom=$tabTmp[1];
|
||||
$tabRet['dirigeants'][$ndir]=array( 'nom'=>$nom,
|
||||
'prenom'=>$prenom,
|
||||
'naiss_nom'=>$naiss_nom,
|
||||
'naiss_date'=>$naiss_date,
|
||||
'naiss_ville'=>$naiss_ville,
|
||||
'naiss_depPays'=>$naiss_depPays,
|
||||
'fonction'=>$fonction);
|
||||
}
|
||||
|
||||
// Dirigeants - Administrateurs
|
||||
$strTmp=trim(@getTextInHtml($this->body, '<B>Les administrateurs</B></FONT>', "<img src='./images/rouge.gif' width=4 height=4 border='0'>",'</TABLE>'));
|
||||
if ($strTmp<>'') {
|
||||
$tabTmp=explode("<img src='./images/rouge.gif' width=4 height=4 border='0'>", $strTmp);
|
||||
foreach ($tabTmp as $nadm=>$dir) {
|
||||
$tabTmp2=explode('</TD>', $dir);
|
||||
$tabTmp3=explode('</B> ', $tabTmp2[1]);
|
||||
$nom=trim(strip_tags($tabTmp3[0]));
|
||||
$prenom=trim(strip_tags($tabTmp3[1]));
|
||||
$naiss=trim(strip_tags($tabTmp2[3]));
|
||||
if (strpos($naiss, 'N<>(e) le')===false) {
|
||||
$naiss_date=$naiss_ville=$naiss_depPays='';
|
||||
$fonction=$naiss;
|
||||
} else {
|
||||
$tabTmp3=explode(' <20> ', $naiss);
|
||||
$naiss_date=trim(str_replace('N<>(e) le ', '', strip_tags($tabTmp3[0])));
|
||||
$naiss=trim(strip_tags($tabTmp3[1]));
|
||||
$tabTmp3=explode('(', $naiss);
|
||||
$naiss_ville=trim(strip_tags($tabTmp3[0]));
|
||||
$naiss_depPays=trim(str_replace(')','', strip_tags($tabTmp3[1])));
|
||||
$fonction=trim(strip_tags($tabTmp2[5]));
|
||||
}
|
||||
$tabTmp=explode(' n<>e ', $prenom);
|
||||
$prenom=$tabTmp[0];
|
||||
$naiss_nom=$tabTmp[1];
|
||||
$tabRet['dirigeants'][$nadm+$ndir+1]=array( 'nom'=>$nom,
|
||||
'prenom'=>$prenom,
|
||||
'naiss_nom'=>$naiss_nom,
|
||||
'naiss_date'=>$naiss_date,
|
||||
'naiss_ville'=>$naiss_ville,
|
||||
'naiss_depPays'=>$naiss_depPays,
|
||||
'fonction'=>$fonction);
|
||||
}
|
||||
}
|
||||
|
||||
// Etablissements
|
||||
$strTmp=@getTextInHtml($this->body, '<B>Les <20>tablissements</B></FONT>', "<img src='./images/rouge.gif' width=4 height=4 border='0'>",'</TABLE>');
|
||||
$tabTmp=explode("<img src='./images/rouge.gif' width=4 height=4 border='0'>", $strTmp);
|
||||
foreach ($tabTmp as $netab=>$dir) {
|
||||
$cp=$ville=$ensEtab=''; $j=0;
|
||||
$tabTmp2=explode('</TD>', $dir);
|
||||
for($i=1; $i<=9; $i=$i+2) {
|
||||
$next=$i+2;
|
||||
$strTmp=trim(strip_tags($tabTmp2[$i]));
|
||||
if (preg_match("/^([0-9]{5,5})([\D]*)/i", $strTmp, $matches)) {
|
||||
$adresse[$j]='';
|
||||
$cp=trim($matches[1]);
|
||||
$ville=trim($matches[2]);
|
||||
break;
|
||||
} else
|
||||
$adresse[$j]=$strTmp;
|
||||
|
||||
$j++;
|
||||
}
|
||||
/** Gestion des cas o<> la 1<>re ligne d'adresse contient l'enseigne de l'<27>tablissement */
|
||||
if (strtoupper($adresse[0])==strtoupper($tabRet['enseigne'])) {
|
||||
$ensEtab=$adresse[0];
|
||||
array_shift($adresse);
|
||||
}
|
||||
$strTmp=trim(strip_tags($tabTmp2[$next]));
|
||||
$tabTmp3=explode(' - ', $strTmp);
|
||||
$tabRet['etablissements'][$netab]=array( 'enseigne'=>$ensEtab,
|
||||
'adresse1'=>$adresse[0],
|
||||
'adresse2'=>$adresse[1],
|
||||
'adresse3'=>$adresse[2],
|
||||
'cp'=>$cp,
|
||||
'ville'=>$ville,
|
||||
'naf_code'=>$tabTmp3[0],
|
||||
'naf_lib'=>$tabTmp3[1]);
|
||||
}
|
||||
|
||||
$fp=fopen('./euridile_identite.log', 'w');
|
||||
fwrite($fp,print_r($page,true));
|
||||
fclose($fp);
|
||||
|
||||
$tabInsert=$tabRet;
|
||||
$tabInsert['procedures']=serialize($tabRet['procedures']);
|
||||
$tabInsert['dirigeants']=serialize($tabRet['dirigeants']);
|
||||
$tabInsert['etablissements']=serialize($tabRet['etablissements']);
|
||||
|
||||
$iDb->insert( 'jo.rncs_entrep', $tabInsert);
|
||||
|
||||
return $tabRet;
|
||||
}
|
||||
|
||||
private function partSaveSession() {
|
||||
$fp=fopen('/tmp/php_rncs_session.id', 'w');
|
||||
fwrite($fp,$this->wrncsrv2.'^'.$this->timeOut.'^'.$this->curPage.'^'.$this->siren.'^'.$this->url.'^'.$this->referer);
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
private function partGetSession() {
|
||||
$strTmp=@file_get_contents('/tmp/php_rncs_session.id');
|
||||
if ($strTmp) {
|
||||
$tabTmp=explode('^', $strTmp);
|
||||
$this->wrncsrv2=$tabTmp[0];
|
||||
$this->timeOut=$tabTmp[1];
|
||||
$this->curPage=$tabTmp[2];
|
||||
$this->siren=$tabTmp[3];
|
||||
$this->url=$tabTmp[4];
|
||||
$this->referer=$tabTmp[5];
|
||||
} else $this->timeOut=0;
|
||||
}
|
||||
|
||||
private function logEuridileError($message) {
|
||||
$fp=fopen('./euridile_error.log', 'w');
|
||||
fwrite($fp,date('Y/m/d H:i:s')." - Erreur : $message (".$this->wrncsrv2.'^'.$this->timeOut.'^'.$this->curPage.'^'.$this->siren.'^'.$this->url.'^'.$this->referer.')'.EOL);
|
||||
fwrite($fp,$this->body.EOL.'-------------------------------------------------------------------------------------'.EOL);
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
391
library/Metier/Partenaires/MMapFunctions.php
Normal file
391
library/Metier/Partenaires/MMapFunctions.php
Normal file
@ -0,0 +1,391 @@
|
||||
<?php
|
||||
function supprDecimales($dec) {
|
||||
if ($dec>0 )
|
||||
return floor($dec);
|
||||
else
|
||||
return ceil($dec);
|
||||
}
|
||||
|
||||
function dec2dms($dec) {
|
||||
$d = supprDecimales($dec);
|
||||
$m = supprDecimales(($dec - $d) * 60);
|
||||
$s = abs(round(((($dec - $d) * 60) - $m) * 60));
|
||||
$m = abs($m);
|
||||
return $d.'°'.$m."'".$s.'"';
|
||||
}
|
||||
|
||||
/**/
|
||||
function ALG0001($phi,$e) {
|
||||
$temp = ( 1 - ( $e * sin( $phi ) ) ) / ( 1 + ( $e * sin( $phi ) ) );
|
||||
$L = log ( tan ( (pi()/4) + ($phi/2) ) * pow ($temp, ($e/2) ));
|
||||
return $L;
|
||||
}
|
||||
|
||||
/** Calcul de la latitude à partir de la latitude isométrique
|
||||
**/
|
||||
function ALG0002($L,$e,$epsilon) {
|
||||
$phi[0] = 2 * atan(exp($L)) - (pi()/2);
|
||||
|
||||
$i=0;
|
||||
do {
|
||||
$i++;
|
||||
$temp = ( 1 + ( $e * sin( $phi[$i-1] ) ) ) / ( 1 - ( $e * sin( $phi[$i-1] ) ) );
|
||||
$phi[$i] = 2 * atan ( pow ($temp, ($e/2)) * exp ($L) ) - pi()/2;
|
||||
}
|
||||
while (abs($phi[$i] - $phi[$i - 1]) >= $epsilon);
|
||||
|
||||
return $phi[$i];
|
||||
}
|
||||
|
||||
/** Transformation de coordonnées en projection conique conforme de Lambert, en coordonnées géographiques
|
||||
** @param double $X Coordonnée X en projection conique conforme de Lambert du point
|
||||
** @param double $Y Coordonnée Y en projection conique conforme de Lambert du point
|
||||
** @param double $n Exposant de la projection
|
||||
** @param double $c Constante de la projection
|
||||
** @param double $Xs Coordonnée Xs en projection du pôle
|
||||
** @param double $Ys Coordonnée Ys en projection du pôle
|
||||
** @param double $lambdac Longitude de l'origine par rapport au méridien origine
|
||||
** @param double $e Première excentricité de l'ellipsoïde
|
||||
** @param double $epsilon Tolérance de convergence
|
||||
** @return array lambda Longitude par rapport au méridien origine
|
||||
** phi Latitude
|
||||
**/
|
||||
function ALG0004($X,$Y,$n,$c,$Xs,$Ys,$lambdac,$e,$epsilon) {
|
||||
$R = sqrt( pow(($X - $Xs),2) + pow(($Y - $Ys),2) );
|
||||
$gamma = atan(($X - $Xs)/($Ys - $Y));
|
||||
|
||||
$lambda = $lambdac + ($gamma / $n);
|
||||
|
||||
$L = (-1 / $n) * log(abs($R/$c));
|
||||
|
||||
$phi = ALG0002($L,$e,$epsilon);
|
||||
|
||||
$coords['lambda']=$lambda;
|
||||
$coords['phi']=$phi;
|
||||
|
||||
return $coords;
|
||||
}
|
||||
|
||||
/** Transformation des coordonnées géographiques ellipsoïdales en coordonnées cartésiennes
|
||||
**
|
||||
**/
|
||||
function ALG0009($lambda,$phi,$he,$a,$e) {
|
||||
$N = ALG0021($phi,$a,$e);
|
||||
|
||||
$X = ($N + $he) * cos($phi) * cos($lambda);
|
||||
|
||||
$Y = ($N + $he) * cos($phi) * sin($lambda);
|
||||
|
||||
$Z = ($N * (1 - $e*$e) + $he) * sin ($phi);
|
||||
|
||||
$coords['X']=$X;
|
||||
$coords['Y']=$Y;
|
||||
$coords['Z']=$Z;
|
||||
|
||||
return $coords;
|
||||
}
|
||||
|
||||
/**/
|
||||
function ALG0012($X,$Y,$Z,$a,$e,$epsilon) {
|
||||
$lambda = atan ($Y/$X);
|
||||
|
||||
$P = sqrt($X*$X + $Y*$Y);
|
||||
$phi[0] = atan ($Z/ ($P * (1 - ( ($a*$e*$e)/sqrt($X*$X + $Y*$Y + $Z*$Z) ) ) ) );
|
||||
|
||||
$i = 0;
|
||||
do
|
||||
{
|
||||
$i++;
|
||||
$temp = pow((1 - ( $a * $e*$e * cos($phi[$i - 1] )/( $P * sqrt(1 - $e*$e * sin($phi[$i - 1])*sin($phi[$i - 1]))))),-1);
|
||||
$phi[$i] = atan( $temp * $Z / $P );
|
||||
}
|
||||
while (abs($phi[$i] - $phi[$i - 1]) >= $epsilon);
|
||||
|
||||
$phix = $phi[$i];
|
||||
|
||||
$he = ($P/cos($phix)) - ($a/sqrt(1 - $e*$e * sin($phix)*sin($phix)));
|
||||
|
||||
$coords['lambda']=$lambda;
|
||||
$coords['phi']=$phix;
|
||||
$coords['he']=$he;
|
||||
|
||||
return $coords;
|
||||
}
|
||||
|
||||
/** Transformation d'un jeu de 7 paramètres entre 2 systèmes géodésiques
|
||||
** @param double $Tx Translation suivant l'axe des X (de 1 vers 2)
|
||||
** @param double $Ty Translation suivant l'axe des Y (de 1 vers 2)
|
||||
** @param double $Tz Translation suivant l'axe des Z (de 1 vers 2)
|
||||
** @param double $D Facteur d'échelle de 1 vers 2
|
||||
** @param double $Rx Angle de rotation autour de l'axe des X en radian (de 1 vers 2)
|
||||
** @param double $Ry Angle de rotation autour de l'axe des Y en radian (de 1 vers 2)
|
||||
** @param double $Rz Angle de rotation autour de l'axe des Z en radian (de 1 vers 2)
|
||||
** @param double $U Vecteur de coordonnées cartésiennes tridimensionnelles dans le système 1 : U=(Ux,Uy,Uz)
|
||||
** @return array Vecteur de coordonnées cartésiennes tridimensionnelles dans le système 2, V=(Vx,Vy,Vz)
|
||||
*/
|
||||
function ALG0013($Tx,$Ty,$Tz,$D,$Rx,$Ry,$Rz,$U) {
|
||||
$V=array();
|
||||
$V['X'] = $Tx + $U['X'] * (1 + $D) + $U['Z'] * $Ry - $U['Y'] * $Rz;
|
||||
$V['Y'] = $Ty + $U['Y'] * (1 + $D) + $U['X'] * $Rz - $U['Z'] * $Rx;
|
||||
$V['Z'] = $Tz + $U['Z'] * (1 + $D) + $U['Y'] * $Rx - $U['X'] * $Ry;
|
||||
return $V;
|
||||
}
|
||||
|
||||
/** Détermination des paramètres de calcul d'une projection Lambert conique
|
||||
** dans le cas tangent, avec ou sans facteur d'échelle en fonction des paramètres de définition usuels
|
||||
** @return array n, C, lambdac, Xs, Ys
|
||||
**/
|
||||
function ALG0019($lambda0,$phi0,$k0,$X0,$Y0,$a,$e) {
|
||||
$lambdac = $lambda0;
|
||||
$n = sin($phi0);
|
||||
$C = $k0 * ALG0021($phi0,$a,$e) * tan (pi()/2 - $phi0) * exp ( $n * ALG0001($phi0,$e) );
|
||||
$Xs = $X0;
|
||||
$Ys = $Y0 + $k0 * ALG0021($phi0,$a,$e) * tan (pi()/2 - $phi0) ;
|
||||
|
||||
$tab ['e'] = $e;
|
||||
$tab ['n'] = $n;
|
||||
$tab ['C'] = $C;
|
||||
$tab ['lambdac'] = $lambdac;
|
||||
$tab ['Xs'] = $Xs;
|
||||
$tab ['Ys'] = $Ys;
|
||||
|
||||
return $tab;
|
||||
|
||||
}
|
||||
|
||||
/** Calcul de la grande normale de l'ellipsoïde
|
||||
** @param double $phi Latitude
|
||||
** @param double $a Demi-grand axe de l'ellipsoïde
|
||||
** @param double $e Première excentricité de l'ellipsoïde
|
||||
** @return double
|
||||
**/
|
||||
function ALG0021($phi,$a,$e) {
|
||||
$N = $a/sqrt( 1 - $e * $e * sin($phi) * sin($phi) );
|
||||
return $N;
|
||||
}
|
||||
|
||||
/** Calcul des constantes d'une projection Lambert conique conforme dans le cas sécant
|
||||
** @param double $lambda0 Longitude origine en radian par rapport au méridien origine
|
||||
** @param double $phi0 Latitude origine
|
||||
** @param double $X0 Coordonnée X en projection du point origine
|
||||
** @param double $Y0 Coordonnée Y en projection du point origine
|
||||
** @param double $phi1 Latitude en radian du 1er parallèle automécoïque
|
||||
** @param double $phi2 Latitude en radian du 2ème parallèle automécoïque
|
||||
** @param double $a Demi-grand axe de l'ellipsoïde
|
||||
** @param double $e Première excentricité de l'ellipsoïde
|
||||
** @return array n, C, lambdac, Xs, Ys
|
||||
**/
|
||||
function ALG0054($lambda0,$phi0,$X0,$Y0,$phi1,$phi2,$a,$e) {
|
||||
$lambdac = $lambda0;
|
||||
$n = ( (log( (ALG0021($phi2,$a,$e)*cos($phi2))/(ALG0021($phi1,$a,$e)*cos($phi1)) ))/(ALG0001($phi1,$e) - ALG0001($phi2,$e) ));
|
||||
$C = ((ALG0021($phi1,$a,$e)* cos($phi1))/$n) * exp($n * ALG0001($phi1,$e));
|
||||
|
||||
if ($phi0 == (pi()/2)) {
|
||||
$Xs = $X0;
|
||||
$Ys = $Y0;
|
||||
} else {
|
||||
$Xs = $X0;
|
||||
$Ys = $Y0 + $C * exp(-1 * $n * ALG0001($phi0,$e));
|
||||
}
|
||||
$tab=array( 'e' => $e,
|
||||
'n' => $n,
|
||||
'C' => $C,
|
||||
'lambdac' => $lambdac,
|
||||
'Xs'=> $Xs,
|
||||
'Ys'=> $Ys);
|
||||
return $tab;
|
||||
}
|
||||
|
||||
function Lambert2WGS84($X,$Y,$orig='L93') {
|
||||
$epsilon = 0.00000000001;
|
||||
|
||||
$lambdac = 0.04079234433; // pour greenwich
|
||||
$e = 0.08248325676; // première excentricité de l ellipsoïde Clarke 1880 français
|
||||
$he = 100;
|
||||
$a = 6378249.2; // demi-grand axe de l'ellipsoide
|
||||
|
||||
$Tx = -168;
|
||||
$Ty = -60;
|
||||
$Tz = +320;
|
||||
$D = 0;
|
||||
$Rx = $Ry = $Rz = 0;
|
||||
|
||||
$orig=strtoupper($orig);
|
||||
switch ($orig) {
|
||||
case 'LI':
|
||||
case 'L1': $n = 0.7604059656;
|
||||
$c = 11603796.98;
|
||||
$Xs = 600000;
|
||||
$Ys = 5657616.674;
|
||||
break;
|
||||
case 'LII':
|
||||
case 'LIIE':
|
||||
case 'L2E':
|
||||
case 'L2': $n = 0.7289686274;
|
||||
$c = 11745793.39;
|
||||
$Xs = 600000;
|
||||
if ($orig=='L2E' || $orig=='LIIE')
|
||||
$Ys = 8199695.768;
|
||||
else $Ys = 6199695.768;
|
||||
break;
|
||||
case 'LIII':
|
||||
case 'L3': $n = 0.6959127966;
|
||||
$c = 11947992.52;
|
||||
$Xs = 600000;
|
||||
$Ys = 6791905.085;
|
||||
break;
|
||||
case 'LIV':
|
||||
case 'L4': $n = 0.6712679322;
|
||||
$c = 12136281.99;
|
||||
$Xs = 234.358;
|
||||
$Ys = 7239161.542;
|
||||
break;
|
||||
case 'L93':
|
||||
default: $n = 0.7256077650;
|
||||
$c = 11745255.426;
|
||||
$Xs = 700000;
|
||||
$Ys = 12655612.050;
|
||||
break;
|
||||
}
|
||||
|
||||
$coords = ALG0004($X,$Y,$n,$c,$Xs,$Ys,$lambdac,$e,$epsilon);
|
||||
|
||||
$coords = ALG0009($coords['lambda'],$coords['phi'],$he,$a,$e);
|
||||
|
||||
$coords = ALG0013($Tx,$Ty,$Tz,$D,$Rx,$Ry,$Rz,$coords);
|
||||
|
||||
$a = 6378137.0; // ellipsoïdes WGS84
|
||||
$f = 1/298.257223563;
|
||||
$b = $a*(1-$f);
|
||||
$e = sqrt(($a*$a - $b*$b)/($a*$a));
|
||||
|
||||
$X = $coords['X'];
|
||||
$Y = $coords['Y'];
|
||||
$Z = $coords['Z'];
|
||||
$coords = ALG0012($X,$Y,$Z,$a,$e,$epsilon);
|
||||
|
||||
$xy['long'] = rad2deg($coords['lambda']);
|
||||
$xy['lat'] = rad2deg($coords['phi']);
|
||||
return $xy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to convert geographic coordinates to "lambert 2 etendue" coordinates
|
||||
* from: http://www.forumsig.org/showthread.php?p=64050#post64050
|
||||
**/
|
||||
function geos2lambert($latitude,$longitude) {
|
||||
//0)degres-minutes-secondes + orientation (d,m,s,o) en radian
|
||||
$lambda_w = $longitude * pi()/180 ;
|
||||
$phi_w = $latitude * pi()/180 ;
|
||||
|
||||
//1) coordonnées géographiques WGS84 (phi_w,lambda_w) en coordonnées cartésiennes WGS84 (X_w,Y_w,Z_w)
|
||||
$a_w = 6378137.0;
|
||||
$b_w = 6356752.314;
|
||||
|
||||
$e2_w = ($a_w*$a_w-$b_w*$b_w)/($a_w*$a_w);
|
||||
|
||||
//et on a la grande normale de l'ellipsoide WGS84
|
||||
$N = $a_w/sqrt(1-$e2_w*pow(sin($phi_w),2));
|
||||
|
||||
//ainsi on obtient
|
||||
$X_w = $N * cos($phi_w) * cos($lambda_w);
|
||||
$Y_w = $N * cos($phi_w) * sin($lambda_w);
|
||||
$Z_w = $N * (1-$e2_w) * sin($phi_w);
|
||||
//Ref.: http://www.ign.fr/telechargement/MPr...RCE/NTG_80.pdf and http://de.wikipedia.org/wiki/WGS84
|
||||
|
||||
//2) coordonnées cartésiennes WGS84 (X_w,Y_w,Z_w) en coordonnées cartésiennes NTF (X_n,Y_n,Z_n)
|
||||
|
||||
$dX = 168.0;
|
||||
$dY = 60.0;
|
||||
$dZ = -320.0;
|
||||
|
||||
$X_n = $X_w + $dX;
|
||||
$Y_n = $Y_w + $dY;
|
||||
$Z_n = $Z_w + $dZ;
|
||||
//ref.: http://support.esrifrance.fr/Documents/Generalites/Projections/Generalites/Generalites.htm#2
|
||||
|
||||
//3) coordonnées cartésiennes NTF (X_n,Y_n,Z_n) en coordonnées géographiques NTF (phi_n,lambda_n)
|
||||
$a_n = 6378249.2;
|
||||
$b_n = 6356515.0;
|
||||
|
||||
$e2_n = ($a_n*$a_n-$b_n*$b_n)/($a_n*$a_n);
|
||||
//on définit une tolérance de convergence
|
||||
$epsilon = pow(10,-10);
|
||||
|
||||
//puis on amorce une boucle de calcul
|
||||
$p0=atan($Z_n/sqrt($X_n*$X_n+$Y_n*$Y_n)*(1-($a_n*$e2_n)/(sqrt($X_n*$X_n+$Y_n*$Y_n+$Z_n*$Z_n))));
|
||||
$p1=atan(($Z_n/sqrt($X_n*$X_n+$Y_n*$Y_n))/(1-($a_n*$e2_n*cos($p0))/(sqrt(($X_n*$X_n+$Y_n*$Y_n)*(1-$e2_n*pow(sin($p0),2))))));
|
||||
while(!(abs($p1-$p0)<$epsilon)){
|
||||
$p0 = $p1;
|
||||
$p1 = atan(($Z_n/sqrt($X_n*$X_n+$Y_n*$Y_n))/(1-($a_n*$e2_n*cos($p0))/(sqrt(($X_n*$X_n+$Y_n*$Y_n)*(1-$e2_n*pow(sin($p0),2))))));
|
||||
}
|
||||
$phi_n = $p1;
|
||||
$lambda_n = atan($Y_n/$X_n);
|
||||
|
||||
//4) coordonnées géographiques NTF (phi_n,lambda_n) en coordonnées projetées en Lambert II étendu (X_l2e, Y_l2e)
|
||||
$n = 0.7289686274;
|
||||
$c = 11745793.39;
|
||||
$Xs = 600000.0;
|
||||
$Ys = 8199695.768;
|
||||
|
||||
$e_n = sqrt($e2_n);
|
||||
$lambda0 = 0.04079234433198; //correspond à la longitude en radian de Paris (2°20'14.025" E) par rapport à Greenwich
|
||||
//puis on calcule la latitude isométrique
|
||||
$L = log(tan(pi()/4 + $phi_n/2) * pow(((1-$e_n*sin($phi_n))/(1+$e_n*sin($phi_n))),($e_n/2)));
|
||||
|
||||
//enfin on projette
|
||||
$X_l2e = $Xs + $c*exp((-$n*$L))*sin($n*($lambda_n-$lambda0));
|
||||
$Y_l2e = $Ys - $c*exp((-$n*$L))*cos($n*($lambda_n-$lambda0));
|
||||
|
||||
return array("x_l2e"=>$X_l2e,"y_l2e"=>$Y_l2e);
|
||||
}
|
||||
|
||||
|
||||
/** Conversion WGS84 en Lambert93
|
||||
** NTG_71.pdf
|
||||
** http://www.ign.fr/affiche_rubrique.asp?rbr_id=1700&lng_id=FR
|
||||
**/
|
||||
function geos2lambert93($latitude,$longitude) {
|
||||
|
||||
// Système WGS84
|
||||
$a=6378137; // demi grand axe de l'ellipsoide (m)
|
||||
$e=0.08181919106; // première excentricitè de l'ellipsoide
|
||||
|
||||
// Paramètres de projections
|
||||
$l0=$lc=deg2rad(3); // longitude de référence
|
||||
$phi0=deg2rad(46.5); // latitude d'origine en radian
|
||||
$phi1=deg2rad(44); // 1er parallele automécoïque
|
||||
$phi2=deg2rad(49); // 2eme parallele automécoïque
|
||||
|
||||
$x0=700000; //coordonnées à l'origine
|
||||
$y0=6600000; //coordonnées à l'origine
|
||||
|
||||
// coordonnées du point à traduire
|
||||
$phi=deg2rad($latitude);
|
||||
$l=deg2rad($longitude);
|
||||
|
||||
// calcul des grandes normales
|
||||
$gN1=$a/sqrt(1-$e*$e*sin($phi1)*sin($phi1));
|
||||
$gN2=$a/sqrt(1-$e*$e*sin($phi2)*sin($phi2));
|
||||
|
||||
//calculs de slatitudes isométriques
|
||||
$gl1=log(tan(pi()/4+$phi1/2)*pow((1-$e*sin($phi1))/(1+$e*sin($phi1)),$e/2));
|
||||
$gl2=log(tan(pi()/4+$phi2/2)*pow((1-$e*sin($phi2))/(1+$e*sin($phi2)),$e/2));
|
||||
$gl0=log(tan(pi()/4+$phi0/2)*pow((1-$e*sin($phi0))/(1+$e*sin($phi0)),$e/2));
|
||||
$gl=log(tan(pi()/4+$phi/2)*pow((1-$e*sin($phi))/(1+$e*sin($phi)),$e/2));
|
||||
|
||||
//calcul de l'exposant de la projection
|
||||
$n=(log(($gN2*cos($phi2))/($gN1*cos($phi1))))/($gl1-$gl2);//ok
|
||||
|
||||
//calcul de la constante de projection
|
||||
$c=(($gN1*cos($phi1))/$n)*exp($n*$gl1);//ok
|
||||
|
||||
//calcul des coordonnées
|
||||
$ys=$y0+$c*exp(-1*$n*$gl0);
|
||||
|
||||
//calcul des coordonnées lambert
|
||||
$x93=$x0+$c*exp(-1*$n*$gl)*sin($n*($l-$lc));
|
||||
$y93=$ys-$c*exp(-1*$n*$gl)*cos($n*($l-$lc));
|
||||
|
||||
return array("x_93"=>$x93,"y_93"=>$y93);
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,6 @@
|
||||
<?php
|
||||
require_once 'framework/common/curl.php';
|
||||
|
||||
class Metier_Partenaires_MOrias
|
||||
{
|
||||
private $referer ='';
|
||||
@ -14,276 +16,276 @@ class Metier_Partenaires_MOrias
|
||||
public $annee=0;
|
||||
public $erreur='';
|
||||
|
||||
function __construct($accesDist = true, $db = null)
|
||||
public function __construct($accesDist = true, $db = null)
|
||||
{
|
||||
$this->accesDist = $accesDist;
|
||||
|
||||
if ( $db === null ) {
|
||||
$this->iDb = new WDB();
|
||||
$this->iDb = new Metier_Util_Db();
|
||||
} else {
|
||||
$this->iDb = $db;
|
||||
}
|
||||
}
|
||||
|
||||
public function getMaxOrias($annee=0)
|
||||
public function getMaxOrias($annee = 0)
|
||||
{
|
||||
if ($annee*1>0 && $annee*1<100) {
|
||||
$this->annee='20'.$annee;
|
||||
if ($annee*1 > 0 && $annee*1 < 100) {
|
||||
$this->annee = '20'.$annee;
|
||||
$annee++;
|
||||
$strWhere="(numOrias/1000000)<=$annee";
|
||||
} elseif ($annee*1>1900 && $annee*1<9999) {
|
||||
$this->annee=$annee;
|
||||
$annee=substr(''.$annee,2,2)*1+1;
|
||||
$strWhere="(numOrias/1000000)<=$annee";
|
||||
$strWhere = "(numOrias/1000000)<=$annee";
|
||||
} elseif ($annee*1 > 1900 && $annee*1 < 9999) {
|
||||
$this->annee = $annee;
|
||||
$annee = substr(''.$annee,2,2)*1+1;
|
||||
$strWhere = "(numOrias/1000000)<=$annee";
|
||||
} else {
|
||||
$strWhere='1';
|
||||
$this->annee=date('Y')*1;
|
||||
$strWhere = '1';
|
||||
$this->annee = date('Y')*1;
|
||||
}
|
||||
|
||||
$ret=$this->iDb->select('sdv1.orias','MAX(numOrias) AS numOrias', $strWhere, false, MYSQL_ASSOC);
|
||||
//die($strWhere);
|
||||
$ret = $this->iDb->select('sdv1.orias','MAX(numOrias) AS numOrias', $strWhere, false, MYSQL_ASSOC);
|
||||
|
||||
return sprintf('%08d',$ret[0]['numOrias']);
|
||||
}
|
||||
|
||||
public function getInfosOrias($siren, $numOrias=0)
|
||||
{
|
||||
//die('numOrias 1:"'.$numOrias.'"');
|
||||
if ($siren*1>1000)
|
||||
$strWhere="siren=$siren";
|
||||
elseif ($numOrias*1>0) {
|
||||
// $numOrias=preg_replace('/[^0-9]/','',$numOrias);
|
||||
// $numOrias=substr($numOrias,0,2).' '.substr($numOrias,2,3).' '.substr($numOrias,5,3);
|
||||
$strWhere="numOrias=$numOrias";
|
||||
// die($strWhere);
|
||||
//die('numOrias 2:"'.$numOrias.'"');
|
||||
} else return false;
|
||||
if ($siren*1 > 1000) {
|
||||
$strWhere = "siren=$siren";
|
||||
}
|
||||
elseif ($numOrias*1 > 0) {
|
||||
$strWhere = "numOrias=$numOrias";
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* echo "=================================================================================================".EOL;
|
||||
echo "==== SELECT siren, id, nom, cp, ville, adresse, numOrias FROM orias WHERE $strWhere;".EOL;
|
||||
echo "=================================================================================================".EOL;
|
||||
*/
|
||||
$ret=$this->iDb->select('sdv1.orias','siren, id, nom, cp, ville, adresse, numOrias, numOriasAttribue', $strWhere, false, MYSQL_ASSOC);
|
||||
if (!$this->force && count($ret)>0) {
|
||||
$this->enCache=true;
|
||||
$tabRet=$ret[0];//array();
|
||||
$ret=$this->iDb->select('sdv1.orias','categorie, cat, dateInscription, typeStatut, rcsVille, rcsCode, rcsSiren, contact, encaissement, nature, paysPresta, paysEtab',$strWhere, false, MYSQL_ASSOC);
|
||||
foreach ($ret as $i=>$tabTmp)
|
||||
$tabRet['categories'][]=$tabTmp;
|
||||
//die('numOrias 3:"'.$numOrias.'"');
|
||||
} elseif ($this->accesDist==true) {
|
||||
$this->enCache=false;
|
||||
$ret = $this->iDb->select('sdv1.orias','siren, id, nom, cp, ville, adresse, numOrias, numOriasAttribue',
|
||||
$strWhere, false, MYSQL_ASSOC);
|
||||
if (!$this->force && count($ret) > 0) {
|
||||
$this->enCache = true;
|
||||
$tabRet = $ret[0];//array();
|
||||
$ret = $this->iDb->select('sdv1.orias','categorie, cat, dateInscription, typeStatut, rcsVille, rcsCode, rcsSiren, contact, encaissement, nature, paysPresta, paysEtab',$strWhere, false, MYSQL_ASSOC);
|
||||
foreach ($ret as $i=>$tabTmp) {
|
||||
$tabRet['categories'][]=$tabTmp;
|
||||
}
|
||||
}
|
||||
elseif ($this->accesDist == true) {
|
||||
$this->enCache = false;
|
||||
|
||||
// Initialisation Cookies
|
||||
if ($numOrias>0) $this->referer='http://www.orias.fr/orias/public/index.jsp';
|
||||
else $this->referer='http://www.orias.fr/orias/public/rechercheavance.html';
|
||||
$page=getUrl($this->referer, '', '', '', false, '', '', 15);
|
||||
//print_r($page);
|
||||
if ($page['code']==200) {
|
||||
$this->cookie=str_replace(' Path=/orias', '',$page['header']['Set-Cookie']);
|
||||
if ($numOrias>0) {
|
||||
$this->referer='http://www.orias.fr/orias/public/index.jsp';
|
||||
}
|
||||
else {
|
||||
$this->referer='http://www.orias.fr/orias/public/rechercheavance.html';
|
||||
}
|
||||
$page = getUrl($this->referer, '', '', '', false, '', '', 15);
|
||||
if ($page['code'] == 200) {
|
||||
$this->cookie = str_replace(' Path=/orias', '',$page['header']['Set-Cookie']);
|
||||
if(preg_match('/id="javax\.faces\.ViewState" value="(.*)"/Ui', $page['body'], $matches))
|
||||
$this->codeRetour=$matches[1];
|
||||
$this->codeRetour = $matches[1];
|
||||
else {
|
||||
echo 'Erreur Url='.$this->referer.EOL;
|
||||
echo 'Erreur Url='.$this->referer.PHP_EOL;
|
||||
print_r($page['body']);
|
||||
return false;
|
||||
}
|
||||
} else return false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($numOrias>0) {
|
||||
$url='http://www.orias.fr/orias/public/index.html';
|
||||
$post=array('menu%3AiasSearchForm'=>'menu%3AiasSearchForm',
|
||||
'menu%3AiasSearchForm%3AiasInputText'=>sprintf('%08s',$numOrias),
|
||||
'javax.faces.ViewState'=>$this->codeRetour,
|
||||
'menu%3AiasSearchForm%3AiasSearch'=>'menu%3AiasSearchForm%3AiasSearch',
|
||||
);
|
||||
$url = 'http://www.orias.fr/orias/public/index.html';
|
||||
$post = array(
|
||||
'menu%3AiasSearchForm'=>'menu%3AiasSearchForm',
|
||||
'menu%3AiasSearchForm%3AiasInputText'=>sprintf('%08s',$numOrias),
|
||||
'javax.faces.ViewState'=>$this->codeRetour,
|
||||
'menu%3AiasSearchForm%3AiasSearch'=>'menu%3AiasSearchForm%3AiasSearch',
|
||||
);
|
||||
} else {
|
||||
// Recherche avec Siren
|
||||
$url='http://www.orias.fr/orias/public/rechercheavance.html';
|
||||
$post=array('j_id_id45'=>'j_id_id45',
|
||||
'j_id_id45%3Aj_id_id52'=>'',
|
||||
'j_id_id45%3AtagRCS'=>'',
|
||||
'j_id_id45%3AtagSIREN'=>$siren,//441921574,
|
||||
'j_id_id45%3Aj_id_id160'=>'',
|
||||
'j_id_id45%3Aj_id_id167'=>'',
|
||||
'j_id_id45%3Aj_id_id175'=>'',
|
||||
'javax.faces.ViewState'=>$this->codeRetour,
|
||||
'j_id_id45%3Aj_id_id203'=>'j_id_id45%3Aj_id_id203');
|
||||
$this->referer='http://www.orias.fr/orias/public/list.html';
|
||||
$url = 'http://www.orias.fr/orias/public/rechercheavance.html';
|
||||
$post = array(
|
||||
'j_id_id45'=>'j_id_id45',
|
||||
'j_id_id45%3Aj_id_id52'=>'',
|
||||
'j_id_id45%3AtagRCS'=>'',
|
||||
'j_id_id45%3AtagSIREN'=>$siren,//441921574,
|
||||
'j_id_id45%3Aj_id_id160'=>'',
|
||||
'j_id_id45%3Aj_id_id167'=>'',
|
||||
'j_id_id45%3Aj_id_id175'=>'',
|
||||
'javax.faces.ViewState'=>$this->codeRetour,
|
||||
'j_id_id45%3Aj_id_id203'=>'j_id_id45%3Aj_id_id203'
|
||||
);
|
||||
$this->referer = 'http://www.orias.fr/orias/public/list.html';
|
||||
}
|
||||
sleep(rand(1, 2));
|
||||
$page = getUrl($url, $this->cookie, $post, $this->referer, false, '', '', 15);
|
||||
$this->referer = $url;
|
||||
if ($page['code'] == 302) {
|
||||
$url = $page['header']['Location'];
|
||||
}
|
||||
randsleep(1,2);
|
||||
$page=getUrl($url, $this->cookie, $post, $this->referer, false, '', '', 15);
|
||||
$this->referer=$url;
|
||||
if ($page['code']==302) $url=$page['header']['Location'];
|
||||
else {
|
||||
if (preg_match("/Le numéro d'immatriculation n'existe pas/", $page['body'])) {
|
||||
$tabInsert=array( 'actif'=>0,
|
||||
'numOrias'=>$numOrias,
|
||||
'numOriasAttribue'=>0,
|
||||
'dateInsert'=>date('YmdHis'));
|
||||
$this->erreur='Numéro Orias inexistant';
|
||||
$tabInsert = array(
|
||||
'actif' => 0,
|
||||
'numOrias' => $numOrias,
|
||||
'numOriasAttribue' => 0,
|
||||
'dateInsert' => date('YmdHis')
|
||||
);
|
||||
$this->erreur = 'Numéro Orias inexistant';
|
||||
// On enregistre ce numéro comme non attribué si < au dernier numéro attribué
|
||||
if ($numOrias<$this->getMaxOrias())
|
||||
$this->iDb->insert('sdv1.orias', $tabInsert);
|
||||
if ($numOrias < $this->getMaxOrias()) {
|
||||
$this->iDb->insert('sdv1.orias', $tabInsert);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($url=='http://www.orias.fr/orias/public/intermediaire.html') {
|
||||
$page=getUrl($url, $this->cookie, '', $this->referer, false, '', '', 24);
|
||||
$this->referer=$url;
|
||||
$this->body=$page['body'];
|
||||
echo "Recherche par Orias : url=$url".EOL;
|
||||
if ($url == 'http://www.orias.fr/orias/public/intermediaire.html') {
|
||||
$page = getUrl($url, $this->cookie, '', $this->referer, false, '', '', 24);
|
||||
$this->referer = $url;
|
||||
$this->body = $page['body'];
|
||||
echo "Recherche par Orias : url=$url".PHP_EOL;
|
||||
die(print_r($page));
|
||||
} /* else { */
|
||||
}
|
||||
|
||||
// Liste contenant l'entreprise
|
||||
$url='http://www.orias.fr/orias/public/list.html';
|
||||
randsleep(1,2);
|
||||
$page=getUrl($url, $this->cookie, '', $this->referer, false, '', '', 24);
|
||||
$this->referer=$url;
|
||||
$this->body=$page['body'];
|
||||
$url = 'http://www.orias.fr/orias/public/list.html';
|
||||
sleep(rand(1, 2));
|
||||
$page = getUrl($url, $this->cookie, '', $this->referer, false, '', '', 24);
|
||||
$this->referer = $url;
|
||||
$this->body = $page['body'];
|
||||
|
||||
if (preg_match('/<td>R\é\;sultat\(s\) de votre recherche \:(?:.*)<strong>(.*)<(?:.*)Interm\é\;diaire\(s\)/Uis',$this->body, $matches)) {
|
||||
$nbInter=trim($matches[1])*1;
|
||||
if ($nbInter==0) return false;
|
||||
if ($nbInter>1) {
|
||||
$nbInter = trim($matches[1])*1;
|
||||
if ($nbInter == 0) {
|
||||
return false;
|
||||
}
|
||||
if ($nbInter > 1) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Initalisation du tableau retour
|
||||
$tabRet=array('siren'=>$siren);
|
||||
$tabRet = array('siren'=>$siren);
|
||||
|
||||
//id="formResult:intermediariesList:13910
|
||||
|
||||
if (preg_match('/<td class="dr-table-cell rich-table-cell haut " id="formResult\:intermediariesList\:(.*)\:j_id_id117">(?:.*)<center>(.*)<\/center>/Uis',$this->body, $matches)) {
|
||||
$tabRet['id']=trim($matches[1]);
|
||||
$tabRet['nom']=html_entity_decode(trim($matches[2]));
|
||||
$tabRet['id'] = trim($matches[1]);
|
||||
$tabRet['nom'] = html_entity_decode(trim($matches[2]));
|
||||
}
|
||||
if (preg_match('/<td class="dr-table-cell rich-table-cell r.cp_ville " id="formResult\:intermediariesList\:(?:.*)\:j_id_id124">(?:.*)<center>(.*)<\/center>/Uis',$this->body, $matches)) {
|
||||
$tabTmp=explode(' ',$matches[1]);
|
||||
$tabRet['cp']=trim($tabTmp[0]);
|
||||
$tabRet['ville']=html_entity_decode(trim($tabTmp[1]));
|
||||
//$tabRet['cpVille']=explotrim(str_replace(' ',' ',$matches[1]));
|
||||
$tabTmp = explode(' ',$matches[1]);
|
||||
$tabRet['cp'] = trim($tabTmp[0]);
|
||||
$tabRet['ville'] = html_entity_decode(trim($tabTmp[1]));
|
||||
}
|
||||
if (preg_match('/<td class="dr-table-cell rich-table-cell r.adresse " id="formResult\:intermediariesList\:(?:.*)\:j_id_id133">(.*)<\/td>/Uis',$this->body, $matches))
|
||||
$tabRet['adresse']=html_entity_decode(trim($matches[1]));
|
||||
$tabRet['adresse'] = html_entity_decode(trim($matches[1]));
|
||||
|
||||
$tabRet['actif']=1;
|
||||
$tabRet['numOriasAttribue']=1;
|
||||
$tabRet['actif'] = 1;
|
||||
$tabRet['numOriasAttribue'] = 1;
|
||||
if (preg_match('/<td class="dr-table-cell rich-table-cell r.immat " id="formResult\:intermediariesList\:(?:.*)\:j_id_id138">(?:.*|)(<span style="white-space\: no-wrap;">|Radi\é\; le \:)(.*)(?:<\/span>|<\/td>)/Uis',$this->body, $matches)) {
|
||||
$str=trim(strtr($matches[2],array(' '=>'',' '=>'')));
|
||||
if (html_entity_decode(trim(str_replace(':','', $matches[1])))=='Radié le') {
|
||||
$tabRet['actif']=0;
|
||||
$tabRet['numOrias']=$numOrias;
|
||||
$tabRet['dateRadiation']=$str;
|
||||
$str = trim(strtr($matches[2],array(' '=>'',' '=>'')));
|
||||
if (html_entity_decode(trim(str_replace(':','', $matches[1]))) == 'Radié le') {
|
||||
$tabRet['actif'] = 0;
|
||||
$tabRet['numOrias'] = $numOrias;
|
||||
$tabRet['dateRadiation'] = $str;
|
||||
}
|
||||
else {
|
||||
$tabRet['numOrias'] = $str;
|
||||
}
|
||||
else
|
||||
$tabRet['numOrias']=$str;
|
||||
}
|
||||
|
||||
if (preg_match('/ id="javax\.faces\.ViewState" value="(.*)" /Uis',$this->body, $matches))
|
||||
$this->codeRetour=$matches[1];
|
||||
if (preg_match('/ id="javax\.faces\.ViewState" value="(.*)" /Uis',$this->body, $matches)) {
|
||||
$this->codeRetour = $matches[1];
|
||||
}
|
||||
|
||||
$tabTmp=explode("<a href=\"#\" onclick=\"if(typeof jsfcljs == 'function'){jsfcljs(document.getElementById('formResult'),{'", $this->body);
|
||||
// die($this->body);
|
||||
$tabTmp = explode("<a href=\"#\" onclick=\"if(typeof jsfcljs == 'function'){jsfcljs(document.getElementById('formResult'),{'", $this->body);
|
||||
|
||||
foreach ($tabTmp as $i=>$strCat) {
|
||||
if ($i==0) {
|
||||
if (count($tabTmp)==1) {
|
||||
$tabInsert=array_merge($tabRet, array('dateInsert'=>date('YmdHis')));
|
||||
//print_r($tabInsert);
|
||||
foreach ($tabTmp as $i => $strCat) {
|
||||
if ($i == 0) {
|
||||
if (count($tabTmp) == 1) {
|
||||
$tabInsert = array_merge($tabRet, array('dateInsert'=>date('YmdHis')));
|
||||
$this->iDb->insert('sdv1.orias', $tabInsert);
|
||||
}
|
||||
$tabRet['categories']=array();
|
||||
$tabRet['categories'] = array();
|
||||
continue;
|
||||
}
|
||||
$tabCat=array();
|
||||
//echo "$i:$strCat";
|
||||
//die();
|
||||
//:formResult:intermediariesList:107501:j_id_id159:0:j_id_id166':'formResult:intermediariesList:107501:j_id_id159:0:j_id_id166','intermediaryIdParam':'107501','intermediaryRoleIdParam':'Mia'},'');}return false">
|
||||
$tabCat = array();
|
||||
|
||||
if (preg_match('/<span style="text-align\: left">(.*)<\/span>/Ui',$strCat, $matches))
|
||||
$tabCat['categorie']=html_entity_decode(trim($matches[1]));
|
||||
if (preg_match('/intermediaryRoleIdParam\'\:\'(.*)\'/Uis',$strCat, $matches))
|
||||
$tabCat['cat']=$matches[1];
|
||||
//print_r($tabCat);
|
||||
if (preg_match('/<span style="text-align\: left">(.*)<\/span>/Ui',$strCat, $matches)) {
|
||||
$tabCat['categorie'] = html_entity_decode(trim($matches[1]));
|
||||
}
|
||||
if (preg_match('/intermediaryRoleIdParam\'\:\'(.*)\'/Uis',$strCat, $matches)) {
|
||||
$tabCat['cat'] = $matches[1];
|
||||
}
|
||||
|
||||
if ($i==1) { // Tout est dans la même page Html
|
||||
|
||||
// Tout est dans la même page Html
|
||||
if ($i==1) {
|
||||
// Construction du lien vers la fiche d'identité de l'entreprise
|
||||
$url='http://www.orias.fr/orias/public/list.html';
|
||||
$post=array('formResult'=>'formResult',
|
||||
'formResult%3AajaxLoadingModalBoxOpenedState'=>'',
|
||||
'javax.faces.ViewState'=>$this->codeRetour,
|
||||
'intermediaryIdParam'=>$tabRet['id'],
|
||||
'intermediaryRoleIdParam'=>$tabCat['cat'],
|
||||
);
|
||||
if (preg_match('/(formResult\:intermediariesList\:(?:.*)),intermediaryIdParam,/Ui',$strCat, $matches)) {
|
||||
$tabTmp2=explode(',', $matches[1]);
|
||||
$post[urlencode($tabTmp2[0])]=urlencode($tabTmp2[1]);
|
||||
/* echo "$i";
|
||||
print_r($tabCat);
|
||||
print_r($matches);*/
|
||||
$url = 'http://www.orias.fr/orias/public/list.html';
|
||||
$post = array(
|
||||
'formResult' => 'formResult',
|
||||
'formResult%3AajaxLoadingModalBoxOpenedState' => '',
|
||||
'javax.faces.ViewState' => $this->codeRetour,
|
||||
'intermediaryIdParam' => $tabRet['id'],
|
||||
'intermediaryRoleIdParam' => $tabCat['cat'],
|
||||
);
|
||||
if (preg_match('/(formResult\:intermediariesList\:(?:.*)),intermediaryIdParam,/Ui', $strCat, $matches)) {
|
||||
$tabTmp2 = explode(',', $matches[1]);
|
||||
$post[urlencode($tabTmp2[0])] = urlencode($tabTmp2[1]);
|
||||
}
|
||||
randsleep(1,2);
|
||||
$page=getUrl($url, $this->cookie, $post, $this->referer, false, '', '', 24);
|
||||
//$this->referer=$url;
|
||||
$tmpCat=explode('class="dr-tbpnl-cntnt-pstn rich-tabpanel-content-position"', $page['body']);
|
||||
//die(print_r($page,1));
|
||||
sleep(rand(1, 2));
|
||||
$page = getUrl($url, $this->cookie, $post, $this->referer, false, '', '', 24);
|
||||
$tmpCat = explode('class="dr-tbpnl-cntnt-pstn rich-tabpanel-content-position"', $page['body']);
|
||||
}
|
||||
|
||||
if (preg_match('/<dd class="col3">Date d\'inscription \: <strong>(.*)<\/strong><\/dd>/Uis',$tmpCat[$i], $matches))
|
||||
$tabCat['dateInscription']=/*Wdate::dateT('d/m/y', 'Y-m-d', */trim($matches[1]);//);
|
||||
if (preg_match('/<td align="right"(?: |)>Statut \:<\/td>(.*)<\/strong>/Uis',$tmpCat[$i], $matches))
|
||||
$tabCat['typeStatut']=trim(strip_tags($matches[1]));
|
||||
if (preg_match('/<dd class="col3">Date d\'inscription \: <strong>(.*)<\/strong><\/dd>/Uis',$tmpCat[$i], $matches)) {
|
||||
$tabCat['dateInscription'] = trim($matches[1]);
|
||||
}
|
||||
if (preg_match('/<td align="right"(?: |)>Statut \:<\/td>(.*)<\/strong>/Uis',$tmpCat[$i], $matches)) {
|
||||
$tabCat['typeStatut'] = trim(strip_tags($matches[1]));
|
||||
}
|
||||
if (preg_match('/<td align="right">RCS \:<\/td>(?:.*)<td width="5%"><\/td>(?:.*)<td width="70%"><strong>(.*)<\/strong>(.*)SIREN \:(?:.*)<strong>(.*)<\/strong>/Uis',$tmpCat[$i], $matches)) {
|
||||
$tabCat['rcsVille']=trim($matches[1]);
|
||||
$tabCat['rcsCode']=trim(strtr(strip_tags($matches[2]), array(' '=>'',' '=>'',chr(160)=>'',"\r"=>'',"\n"=>'')));
|
||||
$tabCat['rcsSiren']=trim($matches[3]);
|
||||
if ($siren==0) $tabRet['siren']=$tabCat['rcsSiren'];
|
||||
$tabCat['rcsVille'] = trim($matches[1]);
|
||||
$tabCat['rcsCode'] = trim(strtr(strip_tags($matches[2]), array(' '=>'',' '=>'',chr(160)=>'',"\r"=>'',"\n"=>'')));
|
||||
$tabCat['rcsSiren'] = trim($matches[3]);
|
||||
if ($siren == 0) {
|
||||
$tabRet['siren'] = $tabCat['rcsSiren'];
|
||||
}
|
||||
}
|
||||
/*<td align="right">Contact</td>
|
||||
<td></td>
|
||||
<td><strong> François Meunier
|
||||
</strong></td>
|
||||
*/
|
||||
if (preg_match('/<td align="right">Contact<\/td>(.*)<\/tr>/Uis',$tmpCat[$i], $matches)) {
|
||||
$tabCat['contact']=html_entity_decode(trim(strip_tags($matches[1])));
|
||||
/* <td></td>
|
||||
<td>
|
||||
<strong>
|
||||
JEAN-PIERRE CHAUSSAT
|
||||
</strong>
|
||||
</td>
|
||||
</table>*/
|
||||
|
||||
if (preg_match('/<td align="right">Contact<\/td>(.*)<\/tr>/Uis', $tmpCat[$i], $matches)) {
|
||||
$tabCat['contact'] = html_entity_decode(trim(strip_tags($matches[1])));
|
||||
}
|
||||
//print_r($tmpCat[$i]);
|
||||
if (preg_match("/<strong>(.*)Cet intermédiaire n'est pas autorisé à encaisser les primes ou cotisations d'assurances(.*)<\/strong>/Uis", $tmpCat[$i]))
|
||||
$tabCat['encaissement']=0;
|
||||
else
|
||||
$tabCat['encaissement']=1;
|
||||
|
||||
if (preg_match('/<span class="txt_ssTitre">(?:.*)Nature de l\'activit\é\; d\'interm\é\;diation(.*)<\/dd>/Uis',$tmpCat[$i], $matches))
|
||||
$tabCat['nature']=html_entity_decode(trim(strip_tags($matches[1])));
|
||||
if (preg_match("/<strong>(.*)Cet intermédiaire n'est pas autorisé à encaisser les primes ou cotisations d'assurances(.*)<\/strong>/Uis", $tmpCat[$i])) {
|
||||
$tabCat['encaissement'] = 0;
|
||||
}
|
||||
else {
|
||||
$tabCat['encaissement'] = 1;
|
||||
}
|
||||
|
||||
if (preg_match('/<td width="50%" valign="top" align="left">\- Etats dans lesquels cet interm\é\;diaire exerce en libre prestation de service(.*)<\/table>(.*)<\/tr>/Uis',$tmpCat[$i], $matches))
|
||||
$tabCat['paysPresta']=trim(strip_tags($matches[1]));
|
||||
if (preg_match('/<span class="txt_ssTitre">(?:.*)Nature de l\'activit\é\; d\'interm\é\;diation(.*)<\/dd>/Uis',$tmpCat[$i], $matches)) {
|
||||
$tabCat['nature'] = html_entity_decode(trim(strip_tags($matches[1])));
|
||||
}
|
||||
|
||||
if (preg_match('/<td width="222" align="left">\- Etats dans lesquels cet interm\é\;diaire exerce en libert\é\; d\'\é\;tablissement(.*)<\/table>(.*)<\/tr>/Uis',$tmpCat[$i], $matches))
|
||||
$tabCat['paysEtab']=trim(strip_tags($matches[1]));
|
||||
if (preg_match('/<td width="50%" valign="top" align="left">\- Etats dans lesquels cet interm\é\;diaire exerce en libre prestation de service(.*)<\/table>(.*)<\/tr>/Uis',$tmpCat[$i], $matches)) {
|
||||
$tabCat['paysPresta'] = trim(strip_tags($matches[1]));
|
||||
}
|
||||
|
||||
$tabRet['categories'][]=$tabCat;
|
||||
if (preg_match('/<td width="222" align="left">\- Etats dans lesquels cet interm\é\;diaire exerce en libert\é\; d\'\é\;tablissement(.*)<\/table>(.*)<\/tr>/Uis',$tmpCat[$i], $matches)) {
|
||||
$tabCat['paysEtab'] =trim(strip_tags($matches[1]));
|
||||
}
|
||||
|
||||
$tabInsert=$tabRet;
|
||||
$tabRet['categories'][] = $tabCat;
|
||||
|
||||
$tabInsert = $tabRet;
|
||||
unset($tabInsert['categories']);
|
||||
$tabInsert=array_merge($tabInsert, $tabCat, array('dateInsert'=>date('YmdHis')));
|
||||
//print_r($tabInsert);
|
||||
$tabInsert = array_merge($tabInsert, $tabCat, array('dateInsert'=>date('YmdHis')));
|
||||
$this->iDb->insert('sdv1.orias', $tabInsert);
|
||||
//echo $tmpCat[$i];
|
||||
}
|
||||
}
|
||||
return $tabRet;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,85 +1,95 @@
|
||||
<?php
|
||||
class Metier_Partenaires_MPrivileges
|
||||
{
|
||||
protected $iDb;
|
||||
public $tabCodeAR = array(
|
||||
'00'=>"Surveillance RCS posée/Demande de suppression acceptée/Surveillance PRIV posée : pas d'inscription existante sur le dossier",
|
||||
'01'=>"Surveillance PRIV posée : inscription existante sur le dossier",
|
||||
'02'=>"GAGI,GREFTEL,INTERGREFFE-code 1-surveillance acceptée mais qui n'a pas encore fait l'objet d'un AR",
|
||||
'03'=>"GAGI,GREFTEL,INTERGREFFE-code 2 - surveillance acceptée avec CREATION d'une fiche débiteur, qui n'a pas fait l'objet d'un AR",
|
||||
'04'=>"GAGI-surveillance en attente envoyée au GAGI",
|
||||
'05'=>"Surveillance en attente de validation au greffe",
|
||||
'06'=>"Erreur de chargement",
|
||||
'10'=>"Surveillance impossible car société radiée",
|
||||
'11'=>"Surveillance impossible car société transférée dans un autre greffe",
|
||||
'12'=>"SIREN inconnu",
|
||||
'13'=>"Raison sociale erronée",
|
||||
'14'=>"Adresse erronée",
|
||||
'15'=>"Surveillance impossible sur un établissement secondaire",
|
||||
'16'=>"Demande incomplète ou incorrecte",
|
||||
'17'=>"Surveillance Privilège impossible",
|
||||
'18'=>"Surveillance impossible par le greffe",
|
||||
'19'=>"Surveillance RCS impossible",
|
||||
'20'=>"Cette surveillance concerne un autre Greffe",
|
||||
'21'=>"Surveillance BILAN impossible car la ste n'est pas tenue de déposer ses Comptes Annuels (ste de droit étranger)",
|
||||
'22'=>"Plusieurs Bottins (débiteurs) (GAGI)",
|
||||
'23'=>"Société de fait (GAGI) : Société non enregistrée au Registre du Commerce",
|
||||
'24'=>"Surveillance impossible car société en liquidation judiciaire",
|
||||
'25'=>"Greffe inconnu",
|
||||
'26'=>"Millésime bilan à surveiller incorrect",
|
||||
'27'=>"Références EXTELIA erronées ou incomplètes (ces reférences sont obligatoires en cas de demande de suppression)",
|
||||
'28'=>"Surveillance impossible sur un dossier non informatisé (dossier dit non repris ou figé)",
|
||||
'30'=>"Siren absent (ne concerne que les surveillances de type WebService)",
|
||||
'31'=>"Surveillance BILAN impossible sur une société non commerciale (statut <> B)",
|
||||
'50'=>"Ce greffe ne traite pas les surveillances car le groupement de ce greffe n'est pas surveillé",
|
||||
'51'=>"Etablissement non trouvé",
|
||||
'52'=>"Code catalogue de la surveillance non renseigné ou incorrect",
|
||||
'53'=>"le siren est déjà sous surveillance",
|
||||
'54'=>"DOSSIER AGORA : votre prestation ne comprend pas la couverture de ce groupement",
|
||||
'55'=>"DOSSIER INTERGREFFE : votre prestation ne comprend pas la couverture de ce groupement de greffes",
|
||||
'56'=>"Le siren est déjà en attente de validation par le greffe",
|
||||
'57'=>"Surveillance impossible sur un dossier dit non inscrit au RCS (statut F:artisan)",
|
||||
'58'=>"Surveillance impossible sur un agent commercial (statut P ou M)",
|
||||
'59'=>'Surveillance impossible sur une société non RCS ?',
|
||||
'88'=>"Rejet temporaire : surveillance sur un greffe absorbé rejetée pendant la phase de rechargement",
|
||||
'99'=>"Surveillance impossible pour raisons à examiner",
|
||||
'00' => "Surveillance RCS posée/Demande de suppression acceptée/Surveillance PRIV posée : pas d'inscription existante sur le dossier",
|
||||
'01' => "Surveillance PRIV posée : inscription existante sur le dossier",
|
||||
'02' => "GAGI,GREFTEL,INTERGREFFE-code 1-surveillance acceptée mais qui n'a pas encore fait l'objet d'un AR",
|
||||
'03' => "GAGI,GREFTEL,INTERGREFFE-code 2 - surveillance acceptée avec CREATION d'une fiche débiteur, qui n'a pas fait l'objet d'un AR",
|
||||
'04' => "GAGI-surveillance en attente envoyée au GAGI",
|
||||
'05' => "Surveillance en attente de validation au greffe",
|
||||
'06' => "Erreur de chargement",
|
||||
'10' => "Surveillance impossible car société radiée",
|
||||
'11' => "Surveillance impossible car société transférée dans un autre greffe",
|
||||
'12' => "SIREN inconnu",
|
||||
'13' => "Raison sociale erronée",
|
||||
'14' => "Adresse erronée",
|
||||
'15' => "Surveillance impossible sur un établissement secondaire",
|
||||
'16' => "Demande incomplète ou incorrecte",
|
||||
'17' => "Surveillance Privilège impossible",
|
||||
'18' => "Surveillance impossible par le greffe",
|
||||
'19' => "Surveillance RCS impossible",
|
||||
'20' => "Cette surveillance concerne un autre Greffe",
|
||||
'21' => "Surveillance BILAN impossible car la ste n'est pas tenue de déposer ses Comptes Annuels (ste de droit étranger)",
|
||||
'22' => "Plusieurs Bottins (débiteurs) (GAGI)",
|
||||
'23' => "Société de fait (GAGI) : Société non enregistrée au Registre du Commerce",
|
||||
'24' => "Surveillance impossible car société en liquidation judiciaire",
|
||||
'25' => "Greffe inconnu",
|
||||
'26' => "Millésime bilan à surveiller incorrect",
|
||||
'27' => "Références EXTELIA erronées ou incomplètes (ces reférences sont obligatoires en cas de demande de suppression)",
|
||||
'28' => "Surveillance impossible sur un dossier non informatisé (dossier dit non repris ou figé)",
|
||||
'30' => "Siren absent (ne concerne que les surveillances de type WebService)",
|
||||
'31' => "Surveillance BILAN impossible sur une société non commerciale (statut <> B)",
|
||||
'50' => "Ce greffe ne traite pas les surveillances car le groupement de ce greffe n'est pas surveillé",
|
||||
'51' => "Etablissement non trouvé",
|
||||
'52' => "Code catalogue de la surveillance non renseigné ou incorrect",
|
||||
'53' => "le siren est déjà sous surveillance",
|
||||
'54' => "DOSSIER AGORA : votre prestation ne comprend pas la couverture de ce groupement",
|
||||
'55' => "DOSSIER INTERGREFFE : votre prestation ne comprend pas la couverture de ce groupement de greffes",
|
||||
'56' => "Le siren est déjà en attente de validation par le greffe",
|
||||
'57' => "Surveillance impossible sur un dossier dit non inscrit au RCS (statut F:artisan)",
|
||||
'58' => "Surveillance impossible sur un agent commercial (statut P ou M)",
|
||||
'59' => 'Surveillance impossible sur une société non RCS ?',
|
||||
'88' => "Rejet temporaire : surveillance sur un greffe absorbé rejetée pendant la phase de rechargement",
|
||||
'99' => "Surveillance impossible pour raisons à examiner",
|
||||
);
|
||||
|
||||
public $tabTypePriv = array(
|
||||
'01'=>"NANTISSEMENTS DU FONDS DE COMMERCE",
|
||||
'02'=>"PRIVILEGES DE VENDEUR ET ACTION RESOLUTOIRE",
|
||||
'03'=>"PRIVILEGES DE LA SECURITE SOCIALE ET DES REGIMES COMPLEMENTAIRES",
|
||||
'04'=>"PRIVILEGES DU TRESOR PUBLIC",
|
||||
'05'=>"OPERATIONS DE CREDIT-BAIL EN MATIERE MOBILIERE",
|
||||
'06'=>"PROTETS",
|
||||
'07'=>"NANTISSEMENTS DE L'OUTILLAGE, MATERIEL ET EQUIPEMENT",
|
||||
'08'=>"WARRANTS (HOTELIER, PETROLIER, INDUSTRIEL OU AGRICOLE)",
|
||||
'10'=>"NANTISSEMENTS DE PARTS DE SOCIETE CIVILE",
|
||||
'17'=>"PUBLICITES DE CONTRATS DE LOCATION",
|
||||
'18'=>"PUBLICITES DE CLAUSES DE RESERVE DE PROPRIETE",
|
||||
'19'=>"PRETS ET DELAIS",
|
||||
'20'=>"DECLARATIONS DE CREANCES",
|
||||
'21'=>"NANTISSEMENTS JUDICIAIRES",
|
||||
'23'=>"BIENS INALIENABLES",
|
||||
'24'=>"HYPOTHEQUES FLUVIALES",
|
||||
'25'=>"NANTISSEMENTS DU FONDS ARTISANAL",
|
||||
'27'=>"GAGE SANS DEPOSSESSION",
|
||||
'28'=>"GAGE DES STOCKS",
|
||||
'01' => "NANTISSEMENTS DU FONDS DE COMMERCE",
|
||||
'02' => "PRIVILEGES DE VENDEUR ET ACTION RESOLUTOIRE",
|
||||
'03' => "PRIVILEGES DE LA SECURITE SOCIALE ET DES REGIMES COMPLEMENTAIRES",
|
||||
'04' => "PRIVILEGES DU TRESOR PUBLIC",
|
||||
'05' => "OPERATIONS DE CREDIT-BAIL EN MATIERE MOBILIERE",
|
||||
'06' => "PROTETS",
|
||||
'07' => "NANTISSEMENTS DE L'OUTILLAGE, MATERIEL ET EQUIPEMENT",
|
||||
'08' => "WARRANTS (HOTELIER, PETROLIER, INDUSTRIEL OU AGRICOLE)",
|
||||
'10' => "NANTISSEMENTS DE PARTS DE SOCIETE CIVILE",
|
||||
'17' => "PUBLICITES DE CONTRATS DE LOCATION",
|
||||
'18' => "PUBLICITES DE CLAUSES DE RESERVE DE PROPRIETE",
|
||||
'19' => "PRETS ET DELAIS",
|
||||
'20' => "DECLARATIONS DE CREANCES",
|
||||
'21' => "NANTISSEMENTS JUDICIAIRES",
|
||||
'23' => "BIENS INALIENABLES",
|
||||
'24' => "HYPOTHEQUES FLUVIALES",
|
||||
'25' => "NANTISSEMENTS DU FONDS ARTISANAL",
|
||||
'27' => "GAGE SANS DEPOSSESSION",
|
||||
'28' => "GAGE DES STOCKS",
|
||||
);
|
||||
|
||||
protected $iDb;
|
||||
|
||||
public function __construct($db = null)
|
||||
{
|
||||
if ( $db === null ) {
|
||||
$this->iDb = new WDB();
|
||||
$this->iDb = new Metier_Util_Db();
|
||||
} else {
|
||||
$this->iDb = $db;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Détail des privileges
|
||||
*
|
||||
* @param string $siren
|
||||
* @param array $tabTypes
|
||||
* @return array
|
||||
*/
|
||||
public function getPrivilegesDetail($siren, $tabTypes=array('03','04'))
|
||||
{
|
||||
$strTypes=implode("','", $tabTypes);
|
||||
if ($strTypes<>'') $strTypes=" AND i.insType IN ('$strTypes') ";
|
||||
$strTypes = implode("','", $tabTypes);
|
||||
if ($strTypes != '') {
|
||||
$strTypes=" AND i.insType IN ('$strTypes') ";
|
||||
}
|
||||
$fields = "i.id, i.dateEven, i.greffe , i.numDebiteur, i.sirenage, i.typeEven, i.dateFraiche, i.codeRev , i.debRaisonSociale , i.debSigle , i.debCiv , i.debNom , i.debPrenom , i.debConjoint , i.debUsage , i.debEnseigne , i.debActivite , i.debFj , i.debFjLib , i.debResidence , i.debNumVoie , i.debTypVoie , i.debLibVoie , i.debAdrComp , i.debCP , i.debVille , i.debPays , i.insType , i.insLib , i.insNum , i.insDate , i.insObjet , i.insMontant , i.insDev , i.insDateEch , i.insDateFin , i.insNanTx , i.insNanTitre , i.insNanOppo , i.insProNat , i.insProHui , i.insProRep , i.insNSCA , i.insNSCParts , i.insNSCSigni , i.creNom , i.creNumVoi, i.creTypVoi, i.creLibVoi, i.creAdrComp1, i.creAdrComp2, i.creCP, i.creVille, i.crePays, i.creAutres, i.radDate, i.radMention, i.radPartiel, i.radPartMt, i.radDev, i.radDiv, i.idFichier, i.dateInsert";
|
||||
$where = "i.siren=$siren $strTypes AND ( (i.insType='03' AND DATEDIFF(NOW(),i.insDate)<=900) /** Durée de vie PRIV Sécu **/ OR (i.insType='04' AND DATEDIFF(NOW(),i.insDate)<=1460) /** Durée de vie PRIV Trésor **/ )";
|
||||
$where.= " ORDER BY i.dateFraiche DESC, i.insType ASC, i.insDate ASC;";
|
||||
@ -88,68 +98,84 @@ class Metier_Partenaires_MPrivileges
|
||||
$iRncs = new Metier_Partenaires_MRncs($this->iDb);
|
||||
$tabRet = array();
|
||||
$tabPriv = $this->iDb->select($tables, $fields, $where, true, MYSQL_ASSOC);
|
||||
foreach ($tabPriv as $i=>$priv) {
|
||||
if ($i>0 && $priv['dateFraiche']<>$dateFraiche) break;
|
||||
$tabRet[] = array(
|
||||
'numDebiteur' => $priv['numDebiteur'],
|
||||
'greffe' => $priv['greffe'],
|
||||
'greffeLib' => $iRncs->getLibTribunal($priv['greffe']),
|
||||
'dateEven' => $priv['dateEven'],
|
||||
'dateFraiche' => $priv['dateFraiche'],
|
||||
'dateSD' => $priv['dateInsert'],
|
||||
'insType' => $priv['insType'],
|
||||
'insTypeLib' => prepareString($this->tabTypePriv[$priv['insType']]),
|
||||
'insNum' => $priv['insNum'],
|
||||
'insDate' => $priv['insDate'],
|
||||
'insDateEch' => $priv['insDateEch'],
|
||||
'insObjet' => prepareString($priv['insObjet']),
|
||||
'insMontant' => $priv['insMontant'],
|
||||
'insDev' => $priv['insDev'],
|
||||
'insDateFin' => $priv['insDateFin'],
|
||||
'radDate' => $priv['radDate'],
|
||||
'radMention' => $priv['radMention'],
|
||||
'radPartiel' => prepareString($priv['radPartiel']),
|
||||
'radPartMt' => $priv['radPartMt'],
|
||||
'radDev' => $priv['radDev'],
|
||||
'creNom' => prepareString($priv['creNom']),
|
||||
'creAdresse1' => prepareString(trim(preg_replace('/ +/', ' ', $priv['creNumVoi'].' '.$priv['creTypVoi'].' '.$priv['creLibVoi']))),
|
||||
'creAdresse2' => prepareString($priv['creAdrComp1']),
|
||||
'creAdresse3' => prepareString($priv['creAdrComp2']),
|
||||
'creCP' => $priv['creCP'],
|
||||
'creVille' => prepareString($priv['creVille']),
|
||||
'crePays' => prepareString($priv['crePays']),
|
||||
'creAutres' => prepareString($priv['creAutres']),
|
||||
);
|
||||
/* debRaisonSociale , debSigle, debEnseigne
|
||||
debCiv, debNom, debPrenom , debConjoint, debUsage,
|
||||
debActivite , debFj, debFjLib
|
||||
debResidence, debNumVoie, debTypVoie, debLibVoie
|
||||
debAdrComp , debCP, debVille, debPays
|
||||
|
||||
insNanTx, insNanTitre, insNanOppo,
|
||||
insProNat, insProHui, insProRep , insNSCA, insNSCParts, insNSCSigni
|
||||
*/
|
||||
$dateFraiche=$priv['dateFraiche'];
|
||||
if (count($tabPriv) > 0) {
|
||||
foreach ($tabPriv as $i => $priv) {
|
||||
if ($i >0 && $priv['dateFraiche'] != $dateFraiche) {
|
||||
break;
|
||||
}
|
||||
$tabRet[] = array(
|
||||
'numDebiteur' => $priv['numDebiteur'],
|
||||
'greffe' => $priv['greffe'],
|
||||
'greffeLib' => $iRncs->getLibTribunal($priv['greffe']),
|
||||
'dateEven' => $priv['dateEven'],
|
||||
'dateFraiche' => $priv['dateFraiche'],
|
||||
'dateSD' => $priv['dateInsert'],
|
||||
'insType' => $priv['insType'],
|
||||
'insTypeLib' => $this->tabTypePriv[$priv['insType']],
|
||||
'insNum' => $priv['insNum'],
|
||||
'insDate' => $priv['insDate'],
|
||||
'insDateEch' => $priv['insDateEch'],
|
||||
'insObjet' => $priv['insObjet'],
|
||||
'insMontant' => $priv['insMontant'],
|
||||
'insDev' => $priv['insDev'],
|
||||
'insDateFin' => $priv['insDateFin'],
|
||||
'radDate' => $priv['radDate'],
|
||||
'radMention' => $priv['radMention'],
|
||||
'radPartiel' => $priv['radPartiel'],
|
||||
'radPartMt' => $priv['radPartMt'],
|
||||
'radDev' => $priv['radDev'],
|
||||
'creNom' => $priv['creNom'],
|
||||
'creAdresse1' => trim(preg_replace('/ +/', ' ', $priv['creNumVoi'].' '.$priv['creTypVoi'].' '.$priv['creLibVoi'])),
|
||||
'creAdresse2' => $priv['creAdrComp1'],
|
||||
'creAdresse3' => $priv['creAdrComp2'],
|
||||
'creCP' => $priv['creCP'],
|
||||
'creVille' => $priv['creVille'],
|
||||
'crePays' => $priv['crePays'],
|
||||
'creAutres' => $priv['creAutres'],
|
||||
);
|
||||
$dateFraiche = $priv['dateFraiche'];
|
||||
}
|
||||
}
|
||||
|
||||
return $tabRet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cummul des privilèges
|
||||
*
|
||||
* @param string $siren
|
||||
* @param array $tabTypes
|
||||
* @return array
|
||||
*/
|
||||
public function getPrivilegesCumul($siren, $tabTypes=array('03','04'))
|
||||
{
|
||||
$iRncs = new Metier_Partenaires_MRncs($this->iDb);
|
||||
$tabRet = array();
|
||||
$tabTmp = $this->getPrivilegesDetail($siren, $tabTypes);
|
||||
foreach($tabTmp as $i=>$priv) {
|
||||
@$tabRet[$priv['insType']]['nb']++;
|
||||
$tabRet[$priv['insType']]['insTypeLib'] = $priv['insTypeLib'];
|
||||
$tabRet[$priv['insType']]['dateFraiche'] = $priv['dateFraiche'];
|
||||
$tabRet[$priv['insType']]['dateDerInsc'] = $priv['insDate'];
|
||||
$tabRet[$priv['insType']]['nomDerCre'] = $priv['creNom'];
|
||||
$tabRet[$priv['insType']]['numDebiteur'] = $priv['numDebiteur'];
|
||||
$tabRet[$priv['insType']]['greffeLib'] = $iRncs->getLibTribunal($priv['greffe']);
|
||||
$tabRet[$priv['insType']]['dateMajSD'] = $priv['dateSD'];
|
||||
@$tabRet[$priv['insType']]['insCumul'] += $priv['insMontant'];
|
||||
|
||||
if (count($tabTmp) > 0) {
|
||||
foreach($tabTmp as $i => $priv) {
|
||||
$type = $priv['insType'];
|
||||
if (array_key_exists($type, $tabRet)) {
|
||||
$tStock = $tabRet[$type];
|
||||
$tStock['nb'] ++;
|
||||
$tStock['insCumul'] += $priv['insMontant'];
|
||||
} else {
|
||||
$tStock['nb'] = 1;
|
||||
$tStock['insCumul'] = $priv['insMontant'];
|
||||
}
|
||||
$tStock['insTypeLib'] = $priv['insTypeLib'];
|
||||
$tStock['dateFraiche'] = $priv['dateFraiche'];
|
||||
$tStock['dateDerInsc'] = $priv['insDate'];
|
||||
$tStock['nomDerCre'] = $priv['creNom'];
|
||||
$tStock['numDebiteur'] = $priv['numDebiteur'];
|
||||
$tStock['greffeLib'] = $iRncs->getLibTribunal($priv['greffe']);
|
||||
$tStock['dateMajSD'] = $priv['dateSD'];
|
||||
|
||||
$tabRet[$type] = $tStock;
|
||||
}
|
||||
}
|
||||
|
||||
return $tabRet;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
class Metier_Partenaires_MQualibat {
|
||||
|
||||
class Metier_Partenaires_MQualibat
|
||||
{
|
||||
private $referer ='';
|
||||
private $body = '';
|
||||
private $header = '';
|
||||
@ -16,328 +16,324 @@ class Metier_Partenaires_MQualibat {
|
||||
public $force=false;
|
||||
public $annee=0;
|
||||
|
||||
function __construct($accesDist=true) {// $adresse, $cp, $ville, $pays='France') {
|
||||
$this->accesDist=$accesDist;
|
||||
$this->iDb=new WDB();
|
||||
$this->iBodacc=new Metier_Bodacc_MBodacc();
|
||||
$this->$iInsee=new Metier_Insee_MInsee();
|
||||
public function __construct($accesDist = true)
|
||||
{
|
||||
$this->accesDist = $accesDist;
|
||||
$this->iDb = new Metier_Util_Db();
|
||||
$this->iBodacc = new Metier_Bodacc_MBodacc();
|
||||
$this->iInsee = new Metier_Insee_MInsee();
|
||||
}
|
||||
|
||||
private function getCodeFctDirigeant($strLibDirigeant, $siren=0) {
|
||||
$tabTmp=$this->iBodacc->getDirigeants($strLibDirigeant);
|
||||
if (isset($tabTmp[0]['fonction']) && $tabTmp[0]['fonction']>0)
|
||||
return $tabTmp[0]['fonction'];
|
||||
else {
|
||||
if (preg_match("/directeur.{1,6}agence/iu")) return 8;
|
||||
elseif (preg_match("/directeur.{1,6}ETABLISSEMENT/iu")) return 8;
|
||||
elseif (preg_match("/directeur.{1,6}technique/iu")) return 19;
|
||||
elseif (preg_match("/chef.{1,8}agence/iu")) return 38;
|
||||
elseif (preg_match("/cadre.{1,8}Comptable/iu")) return 55;
|
||||
elseif (preg_match("/Charg.{1,6}affair/iu")) return 60;
|
||||
elseif (preg_match("/chef.{1,8}Atelier/iu")) return 60;
|
||||
elseif (preg_match("/(conducteur|chef).{1,9}travaux/iu")) return 61;
|
||||
elseif (preg_match("/directeur.{1,6}technique/iu")) return 19;
|
||||
elseif (preg_match("/resp.{1,16}technique/iu")) return 49;
|
||||
elseif (preg_match("/resp.{1,16}Expl/iu")) return 37;
|
||||
elseif (preg_match("/di.{1,16}Expl/iu")) return 7;
|
||||
elseif (preg_match("/Chef.{1,6}Ent/iu")) {
|
||||
$tabTmp=$this->iInsee->getIdentiteLight($siren);
|
||||
if ($tabTmp['FJ']>=1000 && $tabTmp['FJ']<2000) return 1050;
|
||||
else die($tabTmp);
|
||||
}
|
||||
else return false;
|
||||
private function getCodeFctDirigeant($strLibDirigeant, $siren = 0)
|
||||
{
|
||||
$tabTmp = $this->iBodacc->getDirigeants($strLibDirigeant);
|
||||
if (isset($tabTmp[0]['fonction']) && $tabTmp[0]['fonction'] > 0) {
|
||||
return $tabTmp[0]['fonction'];
|
||||
}
|
||||
else {
|
||||
if (preg_match("/directeur.{1,6}agence/iu")) {
|
||||
return 8;
|
||||
}
|
||||
elseif (preg_match("/directeur.{1,6}ETABLISSEMENT/iu")) {
|
||||
return 8;
|
||||
}
|
||||
elseif (preg_match("/directeur.{1,6}technique/iu")) {
|
||||
return 19;
|
||||
}
|
||||
elseif (preg_match("/chef.{1,8}agence/iu")) {
|
||||
return 38;
|
||||
}
|
||||
elseif (preg_match("/cadre.{1,8}Comptable/iu")) {
|
||||
return 55;
|
||||
}
|
||||
elseif (preg_match("/Charg.{1,6}affair/iu")) {
|
||||
return 60;
|
||||
}
|
||||
elseif (preg_match("/chef.{1,8}Atelier/iu")) {
|
||||
return 60;
|
||||
}
|
||||
elseif (preg_match("/(conducteur|chef).{1,9}travaux/iu")) {
|
||||
return 61;
|
||||
}
|
||||
elseif (preg_match("/directeur.{1,6}technique/iu")) {
|
||||
return 19;
|
||||
}
|
||||
elseif (preg_match("/resp.{1,16}technique/iu")) {
|
||||
return 49;
|
||||
}
|
||||
elseif (preg_match("/resp.{1,16}Expl/iu")) {
|
||||
return 37;
|
||||
}
|
||||
elseif (preg_match("/di.{1,16}Expl/iu")) {
|
||||
return 7;
|
||||
}
|
||||
elseif (preg_match("/Chef.{1,6}Ent/iu")) {
|
||||
$tabTmp = $this->iInsee->getIdentiteLight($siren);
|
||||
if ($tabTmp['FJ']>=1000 && $tabTmp['FJ']<2000) {
|
||||
return 1050;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
"1","- DIRECTEUR GENERAL"
|
||||
"1","- P.d.g."
|
||||
"1","- PRESIDENT CONSEIL D''ADMINISTRATION"
|
||||
"2","-co-gerant"
|
||||
"1","Administrateur"
|
||||
"2","Artisan"
|
||||
"1","AssociÉ"
|
||||
"1","Associes"
|
||||
"24","Co Gerant"
|
||||
"1","Co Gerante"
|
||||
"1","CO GERANTS"
|
||||
"109","Co-gérant"
|
||||
"12","Co-gérante"
|
||||
"1","Dg Delegue"
|
||||
"1","Dir. General Delegue"
|
||||
"32","Directeur"
|
||||
"1","Directeur Adjoint"
|
||||
"1","Directeur Administratif et Financier"
|
||||
"1","Directeur Gal DÉlÉguÉ"
|
||||
"61","Directeur Général"
|
||||
"11","DIRECTEUR GENERAL DELEGUE"
|
||||
"1","Directeur Général Unique"
|
||||
"1","Directrice"
|
||||
"2","DIRIG."
|
||||
"4","Dirigeant"
|
||||
"38","Gér"
|
||||
"857","Gerant"
|
||||
"3","Gerant -"
|
||||
"13","Gérant Associé"
|
||||
"1","Gérant Associé En Non Collectif"
|
||||
"1","GERANT MAJORITAIRE"
|
||||
"2","Gérant Non Associé"
|
||||
"56","Gérante"
|
||||
"4","P D G"
|
||||
"1","P.d.g"
|
||||
"1","PCA"
|
||||
"168","PRESIDENT"
|
||||
"1","President Conseil De Surveillance"
|
||||
"1","PRESIDENT CONSEIL SURVEILLANCE"
|
||||
"63","Président Directeur Général"
|
||||
"1","PRESIDENT DIRECTOIRE"
|
||||
"16","Président du conseil d'administration"
|
||||
"1","Président Du Conseil De Surveillance"
|
||||
"5","President Du Directoire"
|
||||
"10","Presidente"
|
||||
"1","ReprÉsentant SociÉtÉ PrÉsidente"
|
||||
"1","Vice-président"
|
||||
|
||||
Gérer en fonction du code CJ
|
||||
"128","Chef D'entreprise"
|
||||
"2","Chef Ent."
|
||||
"3","Chef Entr."
|
||||
|
||||
"1","Conjoint Collaborateur"=>0500
|
||||
|
||||
|
||||
|
||||
"1","Metreur"
|
||||
"1","Président De Commission"
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function getMaxQualibat() {
|
||||
$ret=$this->iDb->select('sdv1.qualibat','MAX(id) AS id', '1', false, MYSQL_ASSOC);
|
||||
public function getMaxQualibat()
|
||||
{
|
||||
$ret = $this->iDb->select('sdv1.qualibat','MAX(id) AS id', '1', false, MYSQL_ASSOC);
|
||||
return $ret[0]['id'];
|
||||
}
|
||||
|
||||
public function getTabQualibatManquants() {
|
||||
$tabRet=$tabQualibatCalc=$tabQualibatBase=array();
|
||||
public function getTabQualibatManquants()
|
||||
{
|
||||
$tabRet = $tabQualibatCalc = $tabQualibatBase = array();
|
||||
// Liste des Qualibat Calculés
|
||||
$maxQualibat=$this->getMaxQualibat();
|
||||
for($i=1; $i<=$maxQualibat; $i++)
|
||||
$tabQualibatCalc[]=$i;
|
||||
$maxQualibat = $this->getMaxQualibat();
|
||||
for($i=1; $i<=$maxQualibat; $i++) {
|
||||
$tabQualibatCalc[]=$i;
|
||||
}
|
||||
|
||||
// Liste des Qualibat en base
|
||||
$ret=$this->iDb->select('sdv1.qualibat','id', '1 ORDER BY id ASC', false, MYSQL_ASSOC);
|
||||
foreach ($ret as $i=>$res)
|
||||
$tabQualibatBase[]=$res['id'];
|
||||
$ret = $this->iDb->select('sdv1.qualibat','id', '1 ORDER BY id ASC', false, MYSQL_ASSOC);
|
||||
foreach ($ret as $i=>$res) {
|
||||
$tabQualibatBase[]=$res['id'];
|
||||
}
|
||||
|
||||
return array_diff($tabQualibatCalc, $tabQualibatBase);
|
||||
}
|
||||
|
||||
public function getInfosQualibat($siren, $idQualibat=0) {
|
||||
if ($siren*1>1000)
|
||||
$strWhere="siren=$siren";
|
||||
elseif ($idQualibat*1>0) {
|
||||
$strWhere="id=$idQualibat";
|
||||
} else return false;
|
||||
public function getInfosQualibat($siren, $idQualibat=0)
|
||||
{
|
||||
if ($siren*1 > 1000) {
|
||||
$strWhere = "siren=$siren";
|
||||
}
|
||||
elseif ($idQualibat*1 > 0) {
|
||||
$strWhere = "id=$idQualibat";
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
$ret=$this->iDb->select('sdv1.qualibat','siren, actif, id, nom, adresse, cp, ville, tel, fax, email, web,
|
||||
eff, teff, ca, tca, libFJ, nace, dateFondation, dateDeb, dateFin, dateInsert', $strWhere, false, MYSQL_ASSOC);
|
||||
if (!$this->force && count($ret)>0) {
|
||||
$ret = $this->iDb->select(
|
||||
'sdv1.qualibat','siren, actif, id, nom, adresse, cp, ville, tel, fax, email, web,
|
||||
eff, teff, ca, tca, libFJ, nace, dateFondation, dateDeb, dateFin, dateInsert',
|
||||
$strWhere, false, MYSQL_ASSOC);
|
||||
// In database
|
||||
if (!$this->force && count($ret) > 0) {
|
||||
$this->enCache=true;
|
||||
$tabRet=$ret[0];//array();
|
||||
$tabRet = $ret[0];//array();
|
||||
|
||||
// Ajout des qualifications
|
||||
$ret=$this->iDb->select('sdv1.qualibatqualif','code, periodQualif, niveauQualif, mentions, nomQualif, dateAttrib, dateEch', $strWhere, false, MYSQL_ASSOC);
|
||||
foreach ($ret as $i=>$tabTmp)
|
||||
$tabRet['qualifications'][]=$tabTmp;
|
||||
$ret = $this->iDb->select(
|
||||
'sdv1.qualibatqualif','code, periodQualif, niveauQualif, mentions, nomQualif, dateAttrib, dateEch',
|
||||
$strWhere, false, MYSQL_ASSOC);
|
||||
foreach ($ret as $i => $tabTmp) {
|
||||
$tabRet['qualifications'][] = $tabTmp;
|
||||
}
|
||||
|
||||
// Ajout des dirigeants
|
||||
$ret=$this->iDb->select('sdv1.qualibatdir','civNomPrenom, civilite, nom, prenom, fonction', $strWhere, false, MYSQL_ASSOC);
|
||||
foreach ($ret as $i=>$tabTmp)
|
||||
$tabRet['dirigeants'][]=$tabTmp;
|
||||
} elseif ($this->accesDist==true) {
|
||||
$this->enCache=false;
|
||||
|
||||
// Initialisation Cookies
|
||||
$this->referer='http://www.qualibat.com/Views/EntreprisesRechercheDetail.aspx?id='.$idQualibat;
|
||||
$page=getUrl($this->referer, '', '', '', false, '', '', 3);
|
||||
if ($page['code']<>200) {
|
||||
if ($page['code']==500) {
|
||||
$tabInsert=array( 'actif'=>0,
|
||||
'id'=>$idQualibat,
|
||||
'idQualibatAttribue'=>0,
|
||||
'dateInsert'=>date('YmdHis'));
|
||||
$this->erreur='Numéro Qualibat inexistant';
|
||||
// On enregistre ce numéro comme non attribué si < au dernier numéro attribué
|
||||
if ($idQualibat<$this->getMaxQualibat())
|
||||
$this->iDb->insert('sdv1.qualibat', $tabInsert);
|
||||
}
|
||||
$ret = $this->iDb->select(
|
||||
'sdv1.qualibatdir','civNomPrenom, civilite, nom, prenom, fonction',
|
||||
$strWhere, false, MYSQL_ASSOC);
|
||||
foreach ($ret as $i => $tabTmp) {
|
||||
$tabRet['dirigeants'][] = $tabTmp;
|
||||
}
|
||||
}
|
||||
// WebSite
|
||||
elseif ($this->accesDist == true) {
|
||||
$this->enCache = false;
|
||||
$url = 'http://www.qualibat.com/Views/EntreprisesRechercheDetail.aspx?id='.$idQualibat;
|
||||
$page = getUrl($url, '', '', '', false, '', '', 3);
|
||||
if ($page['code'] != 200) {
|
||||
return false;
|
||||
}
|
||||
$body=$page['body'];
|
||||
//die($body);
|
||||
$tabRet['id']=$idQualibat;
|
||||
$body = $page['body'];
|
||||
$tabRet['id'] = $idQualibat;
|
||||
|
||||
if (preg_match('/<th>(?:.*)Raison sociale(?:.*)<\/th>(?:.*)<td>(.*)<\/td>/Uis',$body, $matches))
|
||||
$tabRet['nom']=utf8_decode(trim(strip_tags($matches[1])));
|
||||
if (preg_match('/<th>(?:.*)Raison sociale(?:.*)<\/th>(?:.*)<td>(.*)<\/td>/Uis', $body, $matches)) {
|
||||
$tabRet['nom'] = trim(strip_tags($matches[1]));
|
||||
|
||||
if (preg_match('/<th>(?:.*)Adresse(?:.*)<\/th>(?:.*)<td>(.*)<br \/>(.*)<\/td>/Uis',$body, $matches)) {
|
||||
$tabRet['adresse']=strtoupper(utf8_decode(trim($matches[1])));
|
||||
$adresse2=trim(preg_replace('/ +/',' ',strtr(strip_tags($matches[2]),"\r\n\t".chr(160),' ')));
|
||||
$tabRet['cp']=substr($adresse2,0,5);
|
||||
$tabRet['ville']=utf8_decode(trim(substr($adresse2,5)));
|
||||
}
|
||||
if (preg_match('/<th>(?:.*)Adresse(?:.*)<\/th>(?:.*)<td>(.*)<br \/>(.*)<\/td>/Uis', $body, $matches)) {
|
||||
$tabRet['adresse'] =strtoupper(trim($matches[1]));
|
||||
$adresse2 = trim(preg_replace('/ +/',' ',strtr(strip_tags($matches[2]),"\r\n\t".chr(160),' ')));
|
||||
$tabRet['cp'] = substr($adresse2,0,5);
|
||||
$tabRet['ville'] = trim(substr($adresse2,5));
|
||||
}
|
||||
|
||||
if (preg_match('/<th>(?:.*)Téléphone(?:.*)<\/th>(?:.*)<td>(.*)<\/td>/Uisu',$body, $matches))
|
||||
$tabRet['tel']=trim(str_replace(' ','',$matches[1]));
|
||||
if (preg_match('/<th>(?:.*)Téléphone(?:.*)<\/th>(?:.*)<td>(.*)<\/td>/Uisu', $body, $matches)) {
|
||||
$tabRet['tel'] = trim(str_replace(' ','',$matches[1]));
|
||||
}
|
||||
|
||||
if (preg_match('/<th>(?:.*)Fax(?:.*)<\/th>(?:.*)<td>(.*)<\/td>/Uis',$body, $matches))
|
||||
$tabRet['fax']=trim(str_replace(' ','',$matches[1]));
|
||||
if (preg_match('/<th>(?:.*)Fax(?:.*)<\/th>(?:.*)<td>(.*)<\/td>/Uis', $body, $matches)) {
|
||||
$tabRet['fax'] = trim(str_replace(' ','',$matches[1]));
|
||||
}
|
||||
|
||||
if (preg_match('/<th>E-mail<\/th><td>(?:.*)<a href= "mailto\:(.*)">/Uis',$body, $matches))
|
||||
$tabRet['email']=utf8_decode(trim($matches[1]));
|
||||
if (preg_match('/<th>E-mail<\/th><td>(?:.*)<a href= "mailto\:(.*)">/Uis', $body, $matches)) {
|
||||
$tabRet['email'] = trim($matches[1]);
|
||||
}
|
||||
|
||||
if (preg_match('/<th>(?:.*)SIREN(?:.*)<\/th>(?:.*)<td>(.*)<\/td>/Uis',$body, $matches))
|
||||
$tabRet['siren']=$siren=trim(str_replace(' ','',$matches[1]));
|
||||
if (preg_match('/<th>(?:.*)SIREN(?:.*)<\/th>(?:.*)<td>(.*)<\/td>/Uis', $body, $matches)) {
|
||||
$tabRet['siren']= $siren = trim(str_replace(' ','',$matches[1]));
|
||||
}
|
||||
|
||||
if (preg_match('/<th>(?:.*)Effectif total(?:.*)<\/th>(?:.*)<td>(.*)\(Classification - (.*)\)(?:.*)<\/td>/Uis',$body, $matches)) {
|
||||
$tabRet['eff']=trim(str_replace(' ','',$matches[1]));
|
||||
$tabRet['teff']=trim($matches[2]);
|
||||
}
|
||||
if (preg_match('/<th>(?:.*)Effectif total(?:.*)<\/th>(?:.*)<td>(.*)\(Classification - (.*)\)(?:.*)<\/td>/Uis', $body, $matches)) {
|
||||
$tabRet['eff'] = trim(str_replace(' ','',$matches[1]));
|
||||
$tabRet['teff'] = trim($matches[2]);
|
||||
}
|
||||
|
||||
if (preg_match('/<th>(?:.*)CA total(?:.*)<\/th>(?:.*)<td >(.*)\(Classification - (.*)\)(?:.*)<\/td>/Uis',$body, $matches)) {
|
||||
$tabRet['ca']=trim(str_replace(' ','',$matches[1]));
|
||||
if ($tabRet['ca']=='') $tabRet['ca']=NULL;
|
||||
$tabRet['tca']=trim($matches[2]);
|
||||
if ($tabRet['tca']=='') $tabRet['tca']=NULL;
|
||||
}
|
||||
if (preg_match('/<th>(?:.*)CA total(?:.*)<\/th>(?:.*)<td >(.*)\(Classification - (.*)\)(?:.*)<\/td>/Uis', $body, $matches)) {
|
||||
$tabRet['ca'] = trim(str_replace(' ','',$matches[1]));
|
||||
if ($tabRet['ca'] == '') {
|
||||
$tabRet['ca'] = null;
|
||||
}
|
||||
$tabRet['tca'] = trim($matches[2]);
|
||||
if ($tabRet['tca'] == '') {
|
||||
$tabRet['tca'] = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (preg_match('/<th>(?:.*)Forme Juridique(?:.*)<\/th>(?:.*)<td>(.*)<\/td>/Uis',$body, $matches))
|
||||
$tabRet['libFJ']=utf8_decode(trim($matches[1]));
|
||||
if (preg_match('/<th>(?:.*)Forme Juridique(?:.*)<\/th>(?:.*)<td>(.*)<\/td>/Uis', $body, $matches)) {
|
||||
$tabRet['libFJ'] = trim($matches[1]);
|
||||
}
|
||||
|
||||
if (preg_match('/<th>(?:.*)NACE(?:.*)<\/th>(?:.*)<td>(.*)<\/td>/Uis',$body, $matches))
|
||||
$tabRet['nace']=trim($matches[1]);
|
||||
if (preg_match('/<th>(?:.*)NACE(?:.*)<\/th>(?:.*)<td>(.*)<\/td>/Uis', $body, $matches)) {
|
||||
$tabRet['nace'] = trim($matches[1]);
|
||||
}
|
||||
|
||||
if (preg_match('/<th>(?:.*)Fondation(?:.*)<\/th>(?:.*)<td>(.*)<\/td>/Uis',$body, $matches))
|
||||
$tabRet['dateFondation']=Wdate::dateT('d/m/Y', 'Y-m-d', trim($matches[1]));
|
||||
if (preg_match('/<th>(?:.*)Fondation(?:.*)<\/th>(?:.*)<td>(.*)<\/td>/Uis', $body, $matches)) {
|
||||
$tabRet['dateFondation'] = Metier_Util_Date::dateT('d/m/Y', 'Y-m-d', trim($matches[1]));
|
||||
}
|
||||
|
||||
if (preg_match('/<tr><td align="center"><img src="(?:.*)internet_contact\.gif(?:.*)<\/td><td> <a href= "(.*)" target="_blank">/Uis',$body, $matches))
|
||||
$tabRet['web']=utf8_decode(trim($matches[1]));
|
||||
if (preg_match('/<tr><td align="center"><img src="(?:.*)internet_contact\.gif(?:.*)<\/td><td> <a href= "(.*)" target="_blank">/Uis', $body, $matches)) {
|
||||
$tabRet['web'] = trim($matches[1]);
|
||||
}
|
||||
|
||||
/** Qualifications ? **/
|
||||
$qualifs='';
|
||||
if (preg_match('/<table class="recherche_entreprise_detail">(?:.*)<th colspan="4">(?:.*)(Qualifications professionnelles|Certifications m..tier)(?:.*)<tbody>(.*)<\/table>/Uisu',$body, $matches)) {
|
||||
$typeQualifs=trim(utf8_decode($matches[1]));
|
||||
$qualifs=trim($matches[2]);
|
||||
}
|
||||
/** Qualifications ? **/
|
||||
$qualifs = '';
|
||||
if (preg_match('/<table class="recherche_entreprise_detail">(?:.*)<th colspan="4">(?:.*)(Qualifications professionnelles|Certifications m..tier)(?:.*)<tbody>(.*)<\/table>/Uisu', $body, $matches)) {
|
||||
$typeQualifs = trim($matches[1]);
|
||||
$qualifs = trim($matches[2]);
|
||||
}
|
||||
|
||||
if (preg_match('/<th>(?:.*)Fondation(?:.*)<\/th>(?:.*)<td>(.*)<\/td>(.*)<div class="buttons">/Uis',$body, $matches)) {
|
||||
$tabRet['tmpDirQualif']=trim($matches[2]);
|
||||
$tabRet['tmpLenDirQualif']=strlen(trim($matches[2]));
|
||||
}
|
||||
if (preg_match('/<th>(?:.*)Fondation(?:.*)<\/th>(?:.*)<td>(.*)<\/td>(.*)<div class="buttons">/Uis', $body, $matches)) {
|
||||
$tabRet['tmpDirQualif'] = trim($matches[2]);
|
||||
$tabRet['tmpLenDirQualif'] = strlen(trim($matches[2]));
|
||||
}
|
||||
|
||||
$tabDateAttrib=$tabDateFin=array();
|
||||
if (preg_match_all('/<tr>(?:.*)<td>(.*)<\/td>(?:.*)<td>(.*)<\/td>(?:.*)<td>(.*)<\/td>(?:.*)<td>(.*)<\/td>(?:.*)<\/tr>/Uis',$qualifs, $matches)) {
|
||||
foreach ($matches[1] as $i=>$code) {
|
||||
$tabTmp=explode(' ',trim($code));
|
||||
$nomQualif=utf8_decode(trim($matches[2][$i]));
|
||||
if (preg_match("/\(Tech?nicit. (.*)\)/Uiu", $nomQualif, $matches2))
|
||||
$niveau=trim($matches2[1]);
|
||||
else $niveau='';
|
||||
$tabMentions=array();
|
||||
if (preg_match_all('/Mention (.*)(?:,|$)/Uis',$nomQualif, $matches2)) {
|
||||
foreach ($matches2[1] as $i2=>$mention)
|
||||
$tabMentions[]=$mention;
|
||||
}
|
||||
$tabRet['qualifications'][$i]=array(
|
||||
'code'=>trim($tabTmp[0]),
|
||||
'periodQualif'=>trim($tabTmp[1]),
|
||||
'nomQualif'=>$nomQualif,
|
||||
'niveauQualif'=>$niveau,
|
||||
'typeQualif'=>$typeQualifs,
|
||||
'mentions'=>implode(', ', $tabMentions),
|
||||
'dateAttrib'=>Wdate::dateT('d/m/Y', 'Y-m-d', trim($matches[3][$i])),
|
||||
'dateEch'=>Wdate::dateT('d/m/Y', 'Y-m-d', trim($matches[4][$i])));
|
||||
$tabDateAttrib[]=Wdate::dateT('d/m/Y', 'Ymd', trim($matches[3][$i]))*1;
|
||||
$tabDateFin[]=Wdate::dateT('d/m/Y', 'Ymd', trim($matches[4][$i]))*1;
|
||||
}
|
||||
}
|
||||
sort($tabDateAttrib);
|
||||
rsort($tabDateFin);
|
||||
$tabDateAttrib = $tabDateFin = array();
|
||||
if (preg_match_all('/<tr>(?:.*)<td>(.*)<\/td>(?:.*)<td>(.*)<\/td>(?:.*)<td>(.*)<\/td>(?:.*)<td>(.*)<\/td>(?:.*)<\/tr>/Uis', $qualifs, $matches)) {
|
||||
foreach ($matches[1] as $i => $code) {
|
||||
$tabTmp = explode(' ', trim($code));
|
||||
$nomQualif = trim($matches[2][$i]);
|
||||
if (preg_match("/\(Tech?nicit. (.*)\)/Uiu", $nomQualif, $matches2)) {
|
||||
$niveau = trim($matches2[1]);
|
||||
}
|
||||
else {
|
||||
$niveau = '';
|
||||
}
|
||||
$tabMentions = array();
|
||||
if (preg_match_all('/Mention (.*)(?:,|$)/Uis', $nomQualif, $matches2)) {
|
||||
foreach ($matches2[1] as $i2 => $mention) {
|
||||
$tabMentions[] = $mention;
|
||||
}
|
||||
}
|
||||
$tabRet['qualifications'][$i] = array(
|
||||
'code' => trim($tabTmp[0]),
|
||||
'periodQualif' => trim($tabTmp[1]),
|
||||
'nomQualif' => $nomQualif,
|
||||
'niveauQualif' => $niveau,
|
||||
'typeQualif' => $typeQualifs,
|
||||
'mentions' => implode(', ', $tabMentions),
|
||||
'dateAttrib' => Metier_Util_Date::dateT('d/m/Y', 'Y-m-d', trim($matches[3][$i])),
|
||||
'dateEch' => Metier_Util_Date::dateT('d/m/Y', 'Y-m-d', trim($matches[4][$i]))
|
||||
);
|
||||
$tabDateAttrib[] = Metier_Util_Date::dateT('d/m/Y', 'Ymd', trim($matches[3][$i]))*1;
|
||||
$tabDateFin[] = Metier_Util_Date::dateT('d/m/Y', 'Ymd', trim($matches[4][$i]))*1;
|
||||
}
|
||||
}
|
||||
sort($tabDateAttrib);
|
||||
rsort($tabDateFin);
|
||||
|
||||
/** Dirigeants ? **/
|
||||
$dirs='';
|
||||
if (preg_match('/<table class="recherche_entreprise_detail">(?:.*)<th colspan="2">(?:.*)Dirigeants(?:.*)<tbody>(.*)<\/table>/Uis',$body, $matches))
|
||||
$dirs=trim($matches[1]);
|
||||
/* <tr>
|
||||
<td>
|
||||
Monsieur EPP Olivier
|
||||
</td>
|
||||
<td>
|
||||
Gérant
|
||||
</td>
|
||||
</tr>*/
|
||||
if (preg_match_all('/<tr>(?:.*)<td>(.*)<\/td>(?:.*)<td>(.*)<\/td>(?:.*)<\/tr>/Uis',$dirs, $matches)) {
|
||||
foreach ($matches[1] as $i=>$nom) {
|
||||
$strNom=utf8_decode(trim($nom));
|
||||
switch(strtoupper(substr($strNom,0,6))) {
|
||||
case 'MONSIE': $civ='M'; $pDeb=8; break;
|
||||
case 'MADAME': $civ='MME'; $pDeb=6; break;
|
||||
case 'MADEMO': $civ='MLLE';$pDeb=12; break;
|
||||
default: $civ=''; $pDeb=0; break;
|
||||
}
|
||||
$libFonction=ucwords(strtolower(utf8_decode(trim($matches[2][$i]))));
|
||||
$tabRet['dirigeants'][$i]=array(
|
||||
'civNomPrenom'=>$strNom,
|
||||
'civilite'=>$civ,
|
||||
'nom'=>strtoupper(trim(substr($strNom,$pDeb,65))),
|
||||
'prenom'=>ucwords(strtolower(trim(substr($strNom,$pDeb+66)))),
|
||||
'fonction'=>$libFonction,
|
||||
'fonctionCode'=>$this->getCodeFctDirigeant($libFonction, $siren),
|
||||
);
|
||||
}
|
||||
//print_r($tabRet['dirigeants']);
|
||||
//die();
|
||||
}
|
||||
/** Dirigeants ? **/
|
||||
$dirs='';
|
||||
if (preg_match('/<table class="recherche_entreprise_detail">(?:.*)<th colspan="2">(?:.*)Dirigeants(?:.*)<tbody>(.*)<\/table>/Uis', $body, $matches)) {
|
||||
$dirs = trim($matches[1]);
|
||||
}
|
||||
|
||||
/** Insertion de l'entreprise
|
||||
**/
|
||||
$tabInsert=array_merge($tabRet,
|
||||
array( 'idQualibatAttribue'=>1,
|
||||
'dateInsert'=>date('YmdHis'),
|
||||
'dateDeb'=>@$tabDateAttrib[0],
|
||||
'dateFin'=>@$tabDateFin[0]));
|
||||
unset($tabInsert['qualifications']);
|
||||
if (!$this->iDb->insert('sdv1.qualibat', $tabInsert)) {
|
||||
$this->iDb->update('sdv1.qualibat', $tabInsert, "id=$idQualibat");
|
||||
}
|
||||
if (preg_match_all('/<tr>(?:.*)<td>(.*)<\/td>(?:.*)<td>(.*)<\/td>(?:.*)<\/tr>/Uis', $dirs, $matches)) {
|
||||
foreach ($matches[1] as $i => $nom) {
|
||||
$strNom = trim($nom);
|
||||
switch (strtoupper(substr($strNom, 0, 6))) {
|
||||
case 'MONSIE': $civ='M'; $pDeb=8; break;
|
||||
case 'MADAME': $civ='MME'; $pDeb=6; break;
|
||||
case 'MADEMO': $civ='MLLE';$pDeb=12; break;
|
||||
default: $civ=''; $pDeb=0; break;
|
||||
}
|
||||
$libFonction = ucwords(strtolower(trim($matches[2][$i])));
|
||||
$tabRet['dirigeants'][$i] = array(
|
||||
'civNomPrenom' => $strNom,
|
||||
'civilite' => $civ,
|
||||
'nom' => strtoupper(trim(substr($strNom,$pDeb,65))),
|
||||
'prenom' => ucwords(strtolower(trim(substr($strNom,$pDeb+66)))),
|
||||
'fonction' => $libFonction,
|
||||
'fonctionCode' => $this->getCodeFctDirigeant($libFonction, $siren),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/** Insertion de l'entreprise **/
|
||||
$tabInsert = array_merge($tabRet, array(
|
||||
'idQualibatAttribue' => 1,
|
||||
'dateInsert' => date('YmdHis'),
|
||||
'dateDeb' => @$tabDateAttrib[0],
|
||||
'dateFin' => @$tabDateFin[0]));
|
||||
unset($tabInsert['qualifications']);
|
||||
if (!$this->iDb->insert('sdv1.qualibat', $tabInsert)) {
|
||||
$this->iDb->update('sdv1.qualibat', $tabInsert, "id=$idQualibat");
|
||||
}
|
||||
|
||||
/** Insertion des qualifications
|
||||
**/
|
||||
if (isset($tabRet['qualifications']) && count($tabRet['qualifications'])>0)
|
||||
foreach ($tabRet['qualifications'] as $i=>$tabInsert) {
|
||||
$tabInsert['id']=$idQualibat;
|
||||
$tabInsert['siren']=$siren;
|
||||
$tabInsert['dateInsert']=date('YmdHis');
|
||||
if (!$this->iDb->insert('sdv1.qualibatqualif', $tabInsert)) {
|
||||
$this->iDb->update('sdv1.qualibatqualif', $tabInsert, "id=$idQualibat AND code='".$tabInsert['code']."' AND periodQualif='".$tabInsert['periodQualif']."'");
|
||||
}
|
||||
}
|
||||
/** Insertion des qualifications **/
|
||||
if (isset($tabRet['qualifications']) && count($tabRet['qualifications']) > 0)
|
||||
foreach ($tabRet['qualifications'] as $i => $tabInsert) {
|
||||
$tabInsert['id'] = $idQualibat;
|
||||
$tabInsert['siren'] = $siren;
|
||||
$tabInsert['dateInsert'] = date('YmdHis');
|
||||
if (!$this->iDb->insert('sdv1.qualibatqualif', $tabInsert)) {
|
||||
$this->iDb->update('sdv1.qualibatqualif', $tabInsert, "id=$idQualibat AND code='".$tabInsert['code']."' AND periodQualif='".$tabInsert['periodQualif']."'");
|
||||
}
|
||||
}
|
||||
|
||||
/** Insertion des dirigeants **/
|
||||
if (isset($tabRet['dirigeants']) && count($tabRet['dirigeants']) > 0) {
|
||||
foreach ($tabRet['dirigeants'] as $i => $tabInsert) {
|
||||
$tabInsert['id'] = $idQualibat;
|
||||
$tabInsert['siren'] = $siren;
|
||||
$tabInsert['dateInsert'] = date('YmdHis');
|
||||
if (!$this->iDb->insert('sdv1.qualibatdir', $tabInsert)) {
|
||||
$this->iDb->update('sdv1.qualibatdir', $tabInsert, "id=$idQualibat AND civNomPrenom='".addslashes($tabInsert['civNomPrenom'])."' AND fonction='".addslashes($tabInsert['fonction'])."'");
|
||||
}
|
||||
unset($tabRet['dirigeants'][$i]['civNomPrenom']);
|
||||
}
|
||||
}
|
||||
return $tabRet;
|
||||
}
|
||||
else {
|
||||
|
||||
$tabInsert = array(
|
||||
'actif' => 0,
|
||||
'id' => $idQualibat,
|
||||
'idQualibatAttribue' => 0,
|
||||
'dateInsert' => date('YmdHis')
|
||||
);
|
||||
$this->erreur = 'Numéro Qualibat inexistant';
|
||||
// On enregistre ce numéro comme non attribué si < au dernier numéro attribué
|
||||
if ($idQualibat < $this->getMaxQualibat()) {
|
||||
$this->iDb->insert('sdv1.qualibat', $tabInsert);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Insertion des dirigeants
|
||||
**/
|
||||
if (isset($tabRet['dirigeants']) && count($tabRet['dirigeants'])>0)
|
||||
foreach ($tabRet['dirigeants'] as $i=>$tabInsert) {
|
||||
$tabInsert['id']=$idQualibat;
|
||||
$tabInsert['siren']=$siren;
|
||||
$tabInsert['dateInsert']=date('YmdHis');
|
||||
if (!$this->iDb->insert('sdv1.qualibatdir', $tabInsert)) {
|
||||
$this->iDb->update('sdv1.qualibatdir', $tabInsert, "id=$idQualibat AND civNomPrenom='".addslashes($tabInsert['civNomPrenom'])."' AND fonction='".addslashes($tabInsert['fonction'])."'");
|
||||
}
|
||||
unset($tabRet['dirigeants'][$i]['civNomPrenom']);
|
||||
}
|
||||
}
|
||||
return $tabRet;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -3,37 +3,37 @@
|
||||
class Metier_Partenaires_MRncs
|
||||
{
|
||||
public $tabFctDir=array(
|
||||
100 =>array('codeSd'=>'1300', 'lib'=>'Président'),
|
||||
110 =>array('codeSd'=>'1306', 'lib'=>'Président du conseil d\'administration'),
|
||||
120 =>array('codeSd'=>'1301', 'lib'=>'Président directeur Général'),
|
||||
140 =>array('codeSd'=>'1650', 'lib'=>'Gouverneur'),
|
||||
150 =>array('codeSd'=>'1651', 'lib'=>'Sous-gouverneur'),
|
||||
200 =>array('codeSd'=>'0900', 'lib'=>'Gérant'),
|
||||
210 =>array('codeSd'=>'0912', 'lib'=>'Gérant non associé'),
|
||||
300 =>array('codeSd'=>'0400', 'lib'=>'Co-gérant'),
|
||||
400 =>array('codeSd'=>'0709', 'lib'=>'Directeur général'),
|
||||
410 =>array('codeSd'=>'0713', 'lib'=>'Directeur général non administrateur'),
|
||||
420 =>array('codeSd'=>'0708', 'lib'=>'Directeur général unique'),
|
||||
430 =>array('codeSd'=>'0704', 'lib'=>'Directeur général délégué'),
|
||||
500 =>array('codeSd'=>'1800', 'lib'=>'Vice-président'),
|
||||
600 =>array('codeSd'=>'0100', 'lib'=>'Administrateur'),
|
||||
610 =>array('codeSd'=>'0101', 'lib'=>'Administrateur délégué'),
|
||||
700 =>array('codeSd'=>'1308', 'lib'=>'Président du directoire'),
|
||||
900 =>array('codeSd'=>'1307', 'lib'=>'Président du conseil de surveillance'),
|
||||
1200=>array('codeSd'=>'0209', 'lib'=>'Associé-gérant'),
|
||||
1300=>array('codeSd'=>'0603', 'lib'=>'Contrôleur de gestion'),
|
||||
4000=>array('codeSd'=>'A', 'lib'=>'Administrateur judiciaire'),
|
||||
4100=>array('codeSd'=>'1900', 'lib'=>'Liquidateur'),
|
||||
4300=>array('codeSd'=>'0108', 'lib'=>'Administrateur provisoire'),
|
||||
4400=>array('codeSd'=>'1401', 'lib'=>'Représentant en France d\'une société étrangère'),
|
||||
7000=>array('codeSd'=>'U', 'lib'=>'Curateur'),
|
||||
7100=>array('codeSd'=>'C', 'lib'=>'Commissaire au plan'),
|
||||
7200=>array('codeSd'=>'S', 'lib'=>'Syndic'),
|
||||
7300=>array('codeSd'=>'D', 'lib'=>'Commissaire au concordat'),
|
||||
7500=>array('codeSd'=>'R', 'lib'=>'Représentant des créanciers'),
|
||||
7600=>array('codeSd'=>'M', 'lib'=>'Mandataire judiciaire'),
|
||||
7800=>array('codeSd'=>'M', 'lib'=>'Mandataire judiciaire'),
|
||||
9100=>array('codeSd'=>'T', 'lib'=>'Conciliateur'),
|
||||
100 => array('codeSd'=>'1300', 'lib'=>'Président'),
|
||||
110 => array('codeSd'=>'1306', 'lib'=>'Président du conseil d\'administration'),
|
||||
120 => array('codeSd'=>'1301', 'lib'=>'Président directeur Général'),
|
||||
140 => array('codeSd'=>'1650', 'lib'=>'Gouverneur'),
|
||||
150 => array('codeSd'=>'1651', 'lib'=>'Sous-gouverneur'),
|
||||
200 => array('codeSd'=>'0900', 'lib'=>'Gérant'),
|
||||
210 => array('codeSd'=>'0912', 'lib'=>'Gérant non associé'),
|
||||
300 => array('codeSd'=>'0400', 'lib'=>'Co-gérant'),
|
||||
400 => array('codeSd'=>'0709', 'lib'=>'Directeur général'),
|
||||
410 => array('codeSd'=>'0713', 'lib'=>'Directeur général non administrateur'),
|
||||
420 => array('codeSd'=>'0708', 'lib'=>'Directeur général unique'),
|
||||
430 => array('codeSd'=>'0704', 'lib'=>'Directeur général délégué'),
|
||||
500 => array('codeSd'=>'1800', 'lib'=>'Vice-président'),
|
||||
600 => array('codeSd'=>'0100', 'lib'=>'Administrateur'),
|
||||
610 => array('codeSd'=>'0101', 'lib'=>'Administrateur délégué'),
|
||||
700 => array('codeSd'=>'1308', 'lib'=>'Président du directoire'),
|
||||
900 => array('codeSd'=>'1307', 'lib'=>'Président du conseil de surveillance'),
|
||||
1200 => array('codeSd'=>'0209', 'lib'=>'Associé-gérant'),
|
||||
1300 => array('codeSd'=>'0603', 'lib'=>'Contrôleur de gestion'),
|
||||
4000 => array('codeSd'=>'A', 'lib'=>'Administrateur judiciaire'),
|
||||
4100 => array('codeSd'=>'1900', 'lib'=>'Liquidateur'),
|
||||
4300 => array('codeSd'=>'0108', 'lib'=>'Administrateur provisoire'),
|
||||
4400 => array('codeSd'=>'1401', 'lib'=>'Représentant en France d\'une société étrangère'),
|
||||
7000 => array('codeSd'=>'U', 'lib'=>'Curateur'),
|
||||
7100 => array('codeSd'=>'C', 'lib'=>'Commissaire au plan'),
|
||||
7200 => array('codeSd'=>'S', 'lib'=>'Syndic'),
|
||||
7300 => array('codeSd'=>'D', 'lib'=>'Commissaire au concordat'),
|
||||
7500 => array('codeSd'=>'R', 'lib'=>'Représentant des créanciers'),
|
||||
7600 => array('codeSd'=>'M', 'lib'=>'Mandataire judiciaire'),
|
||||
7800 => array('codeSd'=>'M', 'lib'=>'Mandataire judiciaire'),
|
||||
9100 => array('codeSd'=>'T', 'lib'=>'Conciliateur'),
|
||||
);
|
||||
|
||||
public $tabDevises=array();
|
||||
@ -56,7 +56,7 @@ class Metier_Partenaires_MRncs
|
||||
public function __construct($db = null)
|
||||
{
|
||||
if ( $db === null ) {
|
||||
$this->iDb = new WDB();
|
||||
$this->iDb = new Metier_Util_Db();
|
||||
} else {
|
||||
$this->iDb = $db;
|
||||
}
|
||||
@ -69,13 +69,13 @@ class Metier_Partenaires_MRncs
|
||||
|
||||
public function getLibFctDir($codeFonctionDirectionRncs)
|
||||
{
|
||||
$codeFonctionDirectionRncs=$codeFonctionDirectionRncs*1;
|
||||
$codeFonctionDirectionRncs = $codeFonctionDirectionRncs*1;
|
||||
return $this->tabFctDir[$codeFonctionDirectionRncs]['lib'];
|
||||
}
|
||||
|
||||
public function getCodFctBodaccFctDir($codeFonctionDirectionRncs)
|
||||
{
|
||||
$codeFonctionDirectionRncs=$codeFonctionDirectionRncs*1;
|
||||
$codeFonctionDirectionRncs = $codeFonctionDirectionRncs*1;
|
||||
return $this->tabFctDir[$codeFonctionDirectionRncs]['codeSd'];
|
||||
}
|
||||
|
||||
@ -85,29 +85,33 @@ class Metier_Partenaires_MRncs
|
||||
*/
|
||||
private function getTabDevisesInpi()
|
||||
{
|
||||
$cache = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Cache' . DIRECTORY_SEPARATOR . 'DevisesInpi.php';
|
||||
$cache = dirname(__FILE__) . '/../Table/DevisesInpi.php';
|
||||
if ( file_exists($cache) ) {
|
||||
return include $cache;
|
||||
} else {
|
||||
$rep=$this->iDb->select('jo.tabDevises', 'devInpi, devIso', 'devInpi>0', false, MYSQL_ASSOC);
|
||||
$tabDevises=array();
|
||||
foreach($rep as $k=>$dev)
|
||||
$tabDevises[$dev['devInpi']*1]=$dev['devIso'];
|
||||
$rep = $this->iDb->select('jo.tabDevises', 'devInpi, devIso', 'devInpi>0', false, MYSQL_ASSOC);
|
||||
$tabDevises = array();
|
||||
foreach($rep as $k=>$dev) {
|
||||
$tabDevises[$dev['devInpi']*1]=$dev['devIso'];
|
||||
}
|
||||
|
||||
return $tabDevises;
|
||||
}
|
||||
}
|
||||
|
||||
/** Récupération du code ISO de la devise numérique de l'Inpi
|
||||
**
|
||||
** @param integer $devise
|
||||
** @return string Devise ISO
|
||||
**/
|
||||
public function getDeviseInpi($numDeviseInpi) {
|
||||
if ($numDeviseInpi*1>0 && isset($this->tabDevises[$numDeviseInpi*1]))
|
||||
return $this->tabDevises[$numDeviseInpi*1];
|
||||
else
|
||||
return '';
|
||||
/**
|
||||
* Récupération du code ISO de la devise numérique de l'Inpi
|
||||
* @param string $numDeviseInpi
|
||||
* @return string
|
||||
*/
|
||||
public function getDeviseInpi($numDeviseInpi)
|
||||
{
|
||||
if ($numDeviseInpi*1 > 0 && isset($this->tabDevises[$numDeviseInpi*1])) {
|
||||
return $this->tabDevises[$numDeviseInpi*1];
|
||||
}
|
||||
else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -116,24 +120,28 @@ class Metier_Partenaires_MRncs
|
||||
*/
|
||||
public function getTabJugements()
|
||||
{
|
||||
$cache = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Cache' . DIRECTORY_SEPARATOR . 'Jugements.php';
|
||||
$cache = dirname(__FILE__) . '/../Table/Jugements.php';
|
||||
if ( file_exists($cache) ) {
|
||||
return include $cache;
|
||||
} else {
|
||||
$rep=$this->iDb->select('jo.tabJugeRncs', 'codJugement, codEven', '1', false, MYSQL_ASSOC);
|
||||
$tabJug=array();
|
||||
foreach($rep as $k=>$dev)
|
||||
$tabJug[$dev['codJugement']*1]=$dev['codEven'];
|
||||
$rep = $this->iDb->select('jo.tabJugeRncs', 'codJugement, codEven', '1', false, MYSQL_ASSOC);
|
||||
$tabJug = array();
|
||||
foreach($rep as $k => $dev) {
|
||||
$tabJug[$dev['codJugement']*1] = $dev['codEven'];
|
||||
}
|
||||
|
||||
return $tabJug;
|
||||
}
|
||||
}
|
||||
|
||||
public function getCodeEvenJugementInpi($codJugementInpi) {
|
||||
if ($codJugementInpi*1>0 && isset($this->tabJugements[$codJugementInpi*1]))
|
||||
return $this->tabJugements[$codJugementInpi*1];
|
||||
else
|
||||
return $codJugementInpi;
|
||||
public function getCodeEvenJugementInpi($codJugementInpi)
|
||||
{
|
||||
if ($codJugementInpi*1 > 0 && isset($this->tabJugements[$codJugementInpi*1])) {
|
||||
return $this->tabJugements[$codJugementInpi*1];
|
||||
}
|
||||
else {
|
||||
return $codJugementInpi;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -142,38 +150,45 @@ class Metier_Partenaires_MRncs
|
||||
*/
|
||||
private function getTabPaysInpi()
|
||||
{
|
||||
$cache = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Cache' . DIRECTORY_SEPARATOR . 'PaysInpi.php';
|
||||
$cache = dirname(__FILE__) . '/../Table/PaysInpi.php';
|
||||
if ( file_exists($cache) ) {
|
||||
return include $cache;
|
||||
} else {
|
||||
$rep=$this->iDb->select('jo.tabPays', 'codePaysInpi, codPays', 'codePaysInpi>0', false, MYSQL_ASSOC);
|
||||
$tabPays=array();
|
||||
foreach($rep as $k=>$dev)
|
||||
$tabPays[$dev['codePaysInpi']*1]=$dev['codPays'];
|
||||
$rep = $this->iDb->select('jo.tabPays', 'codePaysInpi, codPays', 'codePaysInpi>0', false, MYSQL_ASSOC);
|
||||
$tabPays = array();
|
||||
foreach($rep as $k => $dev) {
|
||||
$tabPays[$dev['codePaysInpi']*1] = $dev['codPays'];
|
||||
}
|
||||
|
||||
return $tabPays;
|
||||
}
|
||||
}
|
||||
|
||||
/** Tableau des mandataires suceptibles d'être tranmis par l'INPI
|
||||
**/
|
||||
private function getTabMandataires() {
|
||||
$tabTmp=$this->iDb->select('jo.tabMandataires', "UPPER(CONCAT(SUBSTRING(Nom,1,4),'-',SUBSTRING(Prenom,1,3))) AS NomPre, SUBSTRING(cp,1,2) AS dep, COUNT(*) AS Nb, sirenMand, id, sirenGrp, Nom, Prenom, type, coursAppel, tribunal, Statut, adresse, adresseComp, cp, ville, tel, fax, email, web, contact", "TYPE IN ('A', 'M') GROUP BY NomPre, dep, sirenMand ORDER BY NomPre ASC", true, MYSQL_ASSOC);
|
||||
$tabMandSD=array();
|
||||
/**
|
||||
* Tableau des mandataires suceptibles d'être tranmis par l'INPI
|
||||
* @return array
|
||||
*/
|
||||
private function getTabMandataires()
|
||||
{
|
||||
$tabTmp = $this->iDb->select('jo.tabMandataires',
|
||||
"UPPER(CONCAT(SUBSTRING(Nom,1,4),'-',SUBSTRING(Prenom,1,3))) AS NomPre, SUBSTRING(cp,1,2) AS dep, COUNT(*) AS Nb, sirenMand, id, sirenGrp, Nom, Prenom, type, coursAppel, tribunal, Statut, adresse, adresseComp, cp, ville, tel, fax, email, web, contact",
|
||||
"TYPE IN ('A', 'M') GROUP BY NomPre, dep, sirenMand ORDER BY NomPre ASC", true, MYSQL_ASSOC);
|
||||
$tabMandSD = array();
|
||||
foreach ($tabTmp as $mand) {
|
||||
$tabMandSD[]=array( 'id' => $mand['id'],
|
||||
'siren' => $mand['sirenMand'],
|
||||
'nom' => $mand['Nom'],
|
||||
'prenom'=> $mand['Prenom'],
|
||||
'type' => $mand['type'],
|
||||
'adr1' => $mand['adresse'],
|
||||
'adr2' => $mand['adresseComp'],
|
||||
'cp' => $mand['cp'],
|
||||
'ville' => $mand['ville'],
|
||||
'tel' => $mand['tel'],
|
||||
'fax' => $mand['fax'],
|
||||
'email' => $mand['email'],
|
||||
);
|
||||
$tabMandSD[] = array(
|
||||
'id' => $mand['id'],
|
||||
'siren' => $mand['sirenMand'],
|
||||
'nom' => $mand['Nom'],
|
||||
'prenom'=> $mand['Prenom'],
|
||||
'type' => $mand['type'],
|
||||
'adr1' => $mand['adresse'],
|
||||
'adr2' => $mand['adresseComp'],
|
||||
'cp' => $mand['cp'],
|
||||
'ville' => $mand['ville'],
|
||||
'tel' => $mand['tel'],
|
||||
'fax' => $mand['fax'],
|
||||
'email' => $mand['email'],
|
||||
);
|
||||
}
|
||||
return $tabMandSD;
|
||||
}
|
||||
@ -189,32 +204,36 @@ class Metier_Partenaires_MRncs
|
||||
*/
|
||||
public function getIdMandataireInpi($strNomPrenom, $adresse='', $cp='', $ville='', $debug=false)
|
||||
{
|
||||
$id=false;
|
||||
$cp2=substr($cp,0,2);
|
||||
$this->matching=NULL;
|
||||
if (trim($strNomPrenom)=='') return false;
|
||||
$id = false;
|
||||
$cp2 = substr($cp,0,2);
|
||||
$this->matching = null;
|
||||
if (trim($strNomPrenom) == '') {
|
||||
return false;
|
||||
}
|
||||
|
||||
//echo "Recherche de '$strNomPrenom, $adresse, $cp $ville' dans les mandataires S&D :".EOL;
|
||||
|
||||
$tabTmp=$this->iDb->select( 'jo.tabMandataires',
|
||||
"id, Nom, Prenom, adresse, adresseComp, cp, ville, MATCH (Nom, Prenom, adresse, adresseComp, ville) AGAINST ('$strNomPrenom $adresse $ville' IN NATURAL LANGUAGE MODE) AS score",
|
||||
"TYPE IN ('A', 'M') AND (Nom<>'' OR Prenom <>'') AND MATCH (Nom, Prenom, adresse, adresseComp, ville) AGAINST ('$strNomPrenom $adresse $ville' IN NATURAL LANGUAGE MODE) ORDER BY score DESC LIMIT 0,10",false, MYSQL_ASSOC);
|
||||
$nbRet=count($tabTmp);
|
||||
if ($nbRet==0) {
|
||||
$tabTmp = $this->iDb->select(
|
||||
'jo.tabMandataires',
|
||||
"id, Nom, Prenom, adresse, adresseComp, cp, ville, MATCH (Nom, Prenom, adresse, adresseComp, ville) AGAINST ('$strNomPrenom $adresse $ville' IN NATURAL LANGUAGE MODE) AS score",
|
||||
"TYPE IN ('A', 'M') AND (Nom<>'' OR Prenom <>'') AND MATCH (Nom, Prenom, adresse, adresseComp, ville) AGAINST ('$strNomPrenom $adresse $ville' IN NATURAL LANGUAGE MODE) ORDER BY score DESC LIMIT 0,10",false, MYSQL_ASSOC);
|
||||
$nbRet = count($tabTmp);
|
||||
if ($nbRet == 0) {
|
||||
return false;
|
||||
} elseif($nbRet==1) {
|
||||
//print_r($tabTmp);
|
||||
$this->matching=$tabTmp[0]['score'];
|
||||
}
|
||||
elseif($nbRet == 1) {
|
||||
$this->matching = $tabTmp[0]['score'];
|
||||
return $tabTmp[0]['id'];
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
foreach($tabTmp as $i=>$iRet) {
|
||||
// echo "Recherche de '$strNomPrenom, $adresse, $cp $ville' dans les mandataires S&D :".EOL;
|
||||
if ($debug) echo "je compare '$cp' avec '".$iRet['cp']."' et '$ville' avec '".$iRet["ville"]."' (score=".$iRet['score'].")".EOL;
|
||||
if ((($iRet['cp']==$cp || substr($iRet['cp'],0,2)==$cp2) && ($iRet["ville"]==$ville || preg_replace('/ 0/', ' ',$iRet["ville"])==$ville) || (strpos($iRet["ville"],$ville)>0 && $nbRet==1) || $iRet["score"]>17 ) ||
|
||||
($cp=='' && $ville=='' && $iRet["score"]>6.88 )) {
|
||||
//print_r($iRet);
|
||||
$this->matching=$iRet['score'];
|
||||
return $iRet['id'];
|
||||
if ($debug) {
|
||||
echo "je compare '$cp' avec '".$iRet['cp']."' et '$ville' avec '".$iRet["ville"]."' (score=".$iRet['score'].")".PHP_EOL;
|
||||
}
|
||||
if ((($iRet['cp'] == $cp || substr($iRet['cp'],0,2) == $cp2)
|
||||
&& ($iRet["ville"] == $ville || preg_replace('/ 0/', ' ',$iRet["ville"]) == $ville)
|
||||
|| (strpos($iRet["ville"], $ville) > 0 && $nbRet == 1) || $iRet["score"] > 17)
|
||||
|| ($cp == '' && $ville == '' && $iRet["score"] >6.88)) {
|
||||
$this->matching = $iRet['score'];
|
||||
return $iRet['id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -222,16 +241,18 @@ class Metier_Partenaires_MRncs
|
||||
return $id;
|
||||
}
|
||||
|
||||
/** Récupération du code ISO du code pays numérique de l'Inpi
|
||||
**
|
||||
** @param integer $pays
|
||||
** @return string Devise ISO
|
||||
**/
|
||||
public function getPaysInpi($numPays) {
|
||||
if ($numPays*1>0)
|
||||
return $this->tabPays[$numPays*1];
|
||||
else
|
||||
return '';
|
||||
/**
|
||||
* Récupération du code ISO du code pays numérique de l'Inpi
|
||||
* @param string $numPays
|
||||
* @return string
|
||||
*/
|
||||
public function getPaysInpi($numPays)
|
||||
{
|
||||
if ($numPays*1 > 0) {
|
||||
return $this->tabPays[$numPays*1];
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -240,7 +261,7 @@ class Metier_Partenaires_MRncs
|
||||
*/
|
||||
private function getTabTribunaux()
|
||||
{
|
||||
$cache = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Cache' . DIRECTORY_SEPARATOR . 'Tribunaux.php';
|
||||
$cache = dirname(__FILE__) . '/../Table/RncsTribunaux.php';
|
||||
if ( file_exists($cache) ) {
|
||||
return include $cache;
|
||||
} else {
|
||||
@ -262,12 +283,13 @@ class Metier_Partenaires_MRncs
|
||||
*/
|
||||
private function getLibelleFJ($code_forme_juridique)
|
||||
{
|
||||
$fj=$code_forme_juridique*1;
|
||||
if ($fj>0 && $fj<10000) {
|
||||
$tmp=$this->iDb->select('jo.tabFJur', 'libelle AS LibFJ', "code=$fj");
|
||||
$fj = $code_forme_juridique*1;
|
||||
if ($fj > 0 && $fj < 10000) {
|
||||
$tmp = $this->iDb->select('jo.tabFJur', 'libelle AS LibFJ', "code=$fj");
|
||||
return @$tmp[0][0];
|
||||
} else
|
||||
return 'En instance de chiffrement';
|
||||
}
|
||||
|
||||
return 'En instance de chiffrement';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -283,43 +305,49 @@ class Metier_Partenaires_MRncs
|
||||
return $res['LibNaf'];
|
||||
}
|
||||
|
||||
/** Récupération du libellé du code numérique du tribunal Greffe ou Inpi
|
||||
**
|
||||
** @param integer $numTribunal
|
||||
** @return string Nom du tribunal
|
||||
**/
|
||||
/**
|
||||
* Récupération du libellé du code numérique du tribunal Greffe ou Inpi
|
||||
* @param integer $numTribunal
|
||||
* @return string
|
||||
*/
|
||||
public function getLibTribunal($numTribunal) {
|
||||
if ($numTribunal*1>0)
|
||||
return $this->tabTribunaux[$numTribunal*1]['Nom'];
|
||||
else
|
||||
return '';
|
||||
if ($numTribunal*1>0) {
|
||||
return $this->tabTribunaux[$numTribunal*1]['Nom'];
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/** Récupération du code Bodacc du code numérique du tribunal Greffe ou Inpi
|
||||
**
|
||||
** @param integer $numTribunal
|
||||
** @return string Code Bodacc du tribunal
|
||||
**/
|
||||
public function getCodeBodaccTribunal($numTribunal) {
|
||||
if ($numTribunal*1>0)
|
||||
return $this->tabTribunaux[$numTribunal*1]['Code'];
|
||||
else
|
||||
return '';
|
||||
/**
|
||||
* Récupération du code Bodacc du code numérique du tribunal Greffe ou Inpi
|
||||
* @param integer $numTribunal
|
||||
* @return string
|
||||
*/
|
||||
public function getCodeBodaccTribunal($numTribunal)
|
||||
{
|
||||
if ($numTribunal*1>0) {
|
||||
return $this->tabTribunaux[$numTribunal*1]['Code'];
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/** Récupération de l'identifiant S&D du code numérique du tribunal Greffe ou Inpi
|
||||
**
|
||||
** @param integer $numTribunal
|
||||
** @return string Numéro interne de tribunal S&D
|
||||
**/
|
||||
public function getIdTribunal($numTribunal) {
|
||||
if ($numTribunal*1>0)
|
||||
return $this->tabTribunaux[$numTribunal*1]['Id'];
|
||||
else
|
||||
return '';
|
||||
/**
|
||||
* Récupération de l'identifiant S&D du code numérique du tribunal Greffe ou Inpi
|
||||
* @param integer $numTribunal
|
||||
* @return string
|
||||
*/
|
||||
public function getIdTribunal($numTribunal)
|
||||
{
|
||||
if ($numTribunal*1>0) {
|
||||
return $this->tabTribunaux[$numTribunal*1]['Id'];
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/** Retourne les informations de l'établissements demandé ou du siège actif ou dernier siège inactif
|
||||
/**
|
||||
* Retourne les informations de l'établissements demandé ou du siège actif ou dernier siège inactif
|
||||
*
|
||||
* @param integer $siren Siren de l'entreprise
|
||||
* @param integer $nic Nic de l'établissement. Si absent, renvoi les informations du siège actif ou du dernier siège actif
|
||||
@ -571,62 +599,65 @@ class Metier_Partenaires_MRncs
|
||||
|
||||
public function getIntervenants($siren)
|
||||
{
|
||||
$tabJuge=$this->getListeJugements($siren);
|
||||
$tabDepots=$tabDeja=array();
|
||||
$tabAdm=array( 'A'=>'Administrateur judiciaire',
|
||||
'C'=>'Commissaire au plan',
|
||||
'D'=>'Commissaire au concordat',
|
||||
'H'=>'Huissier',
|
||||
'J'=>'Juge Commissaire',
|
||||
'K'=>'Juge Commissaire suppléant',
|
||||
'L'=>'Liquidateur',
|
||||
'M'=>'Mandataire judiciaire',
|
||||
'N'=>'Notaire',
|
||||
'O'=>'Opposition',
|
||||
'R'=>'Représentant des créanciers',
|
||||
'S'=>'Syndic',
|
||||
'T'=>'Conciliateur',
|
||||
'U'=>'Curateur',
|
||||
'V'=>'Avocat',
|
||||
);
|
||||
foreach ($tabJuge as $iDepot=>$depot) {
|
||||
$tabJuge = $this->getListeJugements($siren);
|
||||
$tabDepots =$tabDeja = array();
|
||||
$tabAdm = array(
|
||||
'A'=>'Administrateur judiciaire',
|
||||
'C'=>'Commissaire au plan',
|
||||
'D'=>'Commissaire au concordat',
|
||||
'H'=>'Huissier',
|
||||
'J'=>'Juge Commissaire',
|
||||
'K'=>'Juge Commissaire suppléant',
|
||||
'L'=>'Liquidateur',
|
||||
'M'=>'Mandataire judiciaire',
|
||||
'N'=>'Notaire',
|
||||
'O'=>'Opposition',
|
||||
'R'=>'Représentant des créanciers',
|
||||
'S'=>'Syndic',
|
||||
'T'=>'Conciliateur',
|
||||
'U'=>'Curateur',
|
||||
'V'=>'Avocat',
|
||||
);
|
||||
foreach ($tabJuge as $iDepot => $depot) {
|
||||
if ($depot['adm1code']>0 && !in_array($depot['adm1code'], $tabDeja)) {
|
||||
$tabDepots[]=array( 'codEven' => $depot['codEven'],
|
||||
'libEven' => $depot['libEven'],
|
||||
'dateEffet' => $depot['dateEffet'],
|
||||
'admid' => $depot['adm1id'],
|
||||
'admcode' => $depot['adm1code'],
|
||||
'admtype' => $depot['adm1type'],
|
||||
'admfonction' => $depot['adm1fonction'],
|
||||
'admnom' => $depot['adm1nom'],
|
||||
'admadrNum' => $depot['adm1adrNum'],
|
||||
'admadrInd' => $depot['adm1adrInd'],
|
||||
'admadrType' => $depot['adm1adrType'],
|
||||
'admadrVoie' => $depot['adm1adrVoie'], // @todo : adm1adr1, adm1adr2, adm1adr3,
|
||||
'admadr2' => $depot['adm1adr2'],
|
||||
'admadrCP' => $depot['adm1adrCP'],
|
||||
'admadrVille' => $depot['adm1adrVille'],
|
||||
);
|
||||
$tabDeja[]=$depot['adm1code'];
|
||||
$tabDepots[] = array(
|
||||
'codEven' => $depot['codEven'],
|
||||
'libEven' => $depot['libEven'],
|
||||
'dateEffet' => $depot['dateEffet'],
|
||||
'admid' => $depot['adm1id'],
|
||||
'admcode' => $depot['adm1code'],
|
||||
'admtype' => $depot['adm1type'],
|
||||
'admfonction' => $depot['adm1fonction'],
|
||||
'admnom' => $depot['adm1nom'],
|
||||
'admadrNum' => $depot['adm1adrNum'],
|
||||
'admadrInd' => $depot['adm1adrInd'],
|
||||
'admadrType' => $depot['adm1adrType'],
|
||||
'admadrVoie' => $depot['adm1adrVoie'], // @todo : adm1adr1, adm1adr2, adm1adr3,
|
||||
'admadr2' => $depot['adm1adr2'],
|
||||
'admadrCP' => $depot['adm1adrCP'],
|
||||
'admadrVille' => $depot['adm1adrVille'],
|
||||
);
|
||||
$tabDeja[] = $depot['adm1code'];
|
||||
}
|
||||
if ($depot['adm2code']>0 && !in_array($depot['adm2code'], $tabDeja)) {
|
||||
$tabDepots[]=array( 'codEven' => $depot['codEven'],
|
||||
'libEven' => $depot['libEven'],
|
||||
'dateEffet' => $depot['dateEffet'],
|
||||
'admid' => $depot['adm2id'],
|
||||
'admcode' => $depot['adm2code'],
|
||||
'admtype' => $depot['adm2type'],
|
||||
'admfonction' => $depot['adm2fonction'],
|
||||
'admnom' => $depot['adm2nom'],
|
||||
'admadrNum' => $depot['adm2adrNum'],
|
||||
'admadrInd' => $depot['adm2adrInd'],
|
||||
'admadrType' => $depot['adm2adrType'],
|
||||
'admadrVoie' => $depot['adm2adrVoie'], // @todo : adm1adr1, adm1adr2, adm1adr3,
|
||||
'admadr2' => $depot['adm2adr2'],
|
||||
'admadrCP' => $depot['adm2adrCP'],
|
||||
'admadrVille' => $depot['adm2adrVille'],
|
||||
);
|
||||
$tabDeja[]=$depot['adm2code'];
|
||||
$tabDepots[]=array(
|
||||
'codEven' => $depot['codEven'],
|
||||
'libEven' => $depot['libEven'],
|
||||
'dateEffet' => $depot['dateEffet'],
|
||||
'admid' => $depot['adm2id'],
|
||||
'admcode' => $depot['adm2code'],
|
||||
'admtype' => $depot['adm2type'],
|
||||
'admfonction' => $depot['adm2fonction'],
|
||||
'admnom' => $depot['adm2nom'],
|
||||
'admadrNum' => $depot['adm2adrNum'],
|
||||
'admadrInd' => $depot['adm2adrInd'],
|
||||
'admadrType' => $depot['adm2adrType'],
|
||||
'admadrVoie' => $depot['adm2adrVoie'], // @todo : adm1adr1, adm1adr2, adm1adr3,
|
||||
'admadr2' => $depot['adm2adr2'],
|
||||
'admadrCP' => $depot['adm2adrCP'],
|
||||
'admadrVille' => $depot['adm2adrVille'],
|
||||
);
|
||||
$tabDeja[] =$depot['adm2code'];
|
||||
}
|
||||
}
|
||||
if (count($tabDepots)>0) {
|
||||
@ -639,8 +670,9 @@ class Metier_Partenaires_MRncs
|
||||
$strDates='';
|
||||
}
|
||||
|
||||
$tabTmp=$this->iDb->select('jo.annonces', 'id, siren, typeEven, dateJugement, dateCessationPaiement, inter1type, inter1id, inter1nom, inter2type, inter2id, inter2nom, inter3type, inter3id, inter3nom, inter4type, inter4id, inter4nom,
|
||||
dateSource, dateInsert, source, tribunal, raisonSociale',"siren=$siren $strDates AND ( inter1type $strTypes OR inter2type $strTypes OR inter3type $strTypes OR inter4type $strTypes ) AND typeEven BETWEEN 1000 AND 2000 ORDER BY dateJugement DESC", false, MYSQL_ASSOC);
|
||||
$tabTmp=$this->iDb->select('jo.annonces',
|
||||
'id, siren, typeEven, dateJugement, dateCessationPaiement, inter1type, inter1id, inter1nom, inter2type, inter2id, inter2nom, inter3type, inter3id, inter3nom, inter4type, inter4id, inter4nom, dateSource, dateInsert, source, tribunal, raisonSociale',
|
||||
"siren=$siren $strDates AND ( inter1type $strTypes OR inter2type $strTypes OR inter3type $strTypes OR inter4type $strTypes ) AND typeEven BETWEEN 1000 AND 2000 ORDER BY dateJugement DESC", false, MYSQL_ASSOC);
|
||||
if (isset($tabTmp[0])) {
|
||||
$depot=$tabTmp[0];
|
||||
$tabRet['dateCessationPaiement']=$depot['dateCessationPaiement'];
|
||||
@ -672,13 +704,14 @@ class Metier_Partenaires_MRncs
|
||||
return $tabDepots;
|
||||
}
|
||||
|
||||
/** Mettre à jour un dossier IMR dans le prochain Flux
|
||||
/**
|
||||
* Mettre à jour un dossier IMR dans le prochain Flux
|
||||
* @param $siren Siren de l'entreprise à mettre à jour dans les IMR
|
||||
* @param $origineDemande Origine de la demande ('client', 'interne', 'privileges', 'ancienort')
|
||||
* @param $focerMAJ Forcer la mise à jour même si dossier déjà transmit
|
||||
*/
|
||||
public function majDossierIMR($siren, $origineDemande='', $focerMAJ=false) {
|
||||
|
||||
public function majDossierIMR($siren, $origineDemande='', $focerMAJ=false)
|
||||
{
|
||||
$this->infoIMR=array();
|
||||
if ($siren*1==0) {
|
||||
$this->libErreur='Siren invalide !';
|
||||
@ -693,10 +726,10 @@ class Metier_Partenaires_MRncs
|
||||
/** Accueil **/
|
||||
$url='http://www.infogreffe.fr/ged-extranet/accueil.do';
|
||||
while (1) {
|
||||
//echo date('YmdHis')." - 1. Deb $url ".$this->codeRetour.EOL;
|
||||
//echo date('YmdHis')." - 1. Deb $url ".$this->codeRetour.PHP_EOL;
|
||||
$page=getUrl($url, '', '', $this->referer, false, 'www.infogreffe.fr', false, '', $query_proxy, $query_timeout);
|
||||
$this->codeRetour=$page['code'];
|
||||
//echo date('YmdHis')." - 1. FIN $url ".$this->codeRetour.EOL;
|
||||
//echo date('YmdHis')." - 1. FIN $url ".$this->codeRetour.PHP_EOL;
|
||||
if ($this->codeRetour<>'400') break;
|
||||
sleep(1);
|
||||
}
|
||||
@ -713,9 +746,9 @@ class Metier_Partenaires_MRncs
|
||||
/** Formulaire de login **/
|
||||
$url='http://www.infogreffe.fr/ged-extranet/connexion.do';
|
||||
while (1) {
|
||||
//echo date('YmdHis')." - 2. Deb $url ".$this->codeRetour.EOL;
|
||||
//echo date('YmdHis')." - 2. Deb $url ".$this->codeRetour.PHP_EOL;
|
||||
$page=getUrl($url, '', '', $this->referer, false, 'www.infogreffe.fr', false, '', $query_proxy, $query_timeout);
|
||||
//echo date('YmdHis')." - 2. FIN $url ".$this->codeRetour.EOL;
|
||||
//echo date('YmdHis')." - 2. FIN $url ".$this->codeRetour.PHP_EOL;
|
||||
$this->codeRetour=$page['code'];
|
||||
if ($this->codeRetour<>'400') break;
|
||||
sleep(1);
|
||||
@ -736,10 +769,10 @@ class Metier_Partenaires_MRncs
|
||||
'password'=>'369852',
|
||||
);
|
||||
while (1) {
|
||||
//echo date('YmdHis')." - 3. Deb $url ".$this->codeRetour.EOL;
|
||||
//echo date('YmdHis')." - 3. Deb $url ".$this->codeRetour.PHP_EOL;
|
||||
$page=getUrl($url, $this->cookie, $postData, $this->referer, false, 'www.infogreffe.fr', false, '', $query_proxy, $query_timeout);
|
||||
$this->codeRetour=$page['code'];
|
||||
//echo date('YmdHis')." - 3. FIN $url ".$this->codeRetour.EOL;
|
||||
//echo date('YmdHis')." - 3. FIN $url ".$this->codeRetour.PHP_EOL;
|
||||
if ($this->codeRetour<>'400') break;
|
||||
sleep(1);
|
||||
}
|
||||
@ -759,10 +792,10 @@ class Metier_Partenaires_MRncs
|
||||
/** Page de formulaire de demande de réémission de dossier IMR **/
|
||||
$url='http://www.infogreffe.fr/ged-extranet/demandeReemissions.do';
|
||||
while (1) {
|
||||
//echo date('YmdHis')." - 4. Deb $url ".$this->codeRetour.EOL;
|
||||
//echo date('YmdHis')." - 4. Deb $url ".$this->codeRetour.PHP_EOL;
|
||||
$page=getUrl($url, $this->cookie, '', $this->referer, false, 'www.infogreffe.fr', false, '', $query_proxy, $query_timeout);
|
||||
$this->codeRetour=$page['code'];
|
||||
//echo date('YmdHis')." - 4. FIN $url ".$this->codeRetour.EOL;
|
||||
//echo date('YmdHis')." - 4. FIN $url ".$this->codeRetour.PHP_EOL;
|
||||
if ($this->codeRetour<>'400') break;
|
||||
sleep(1);
|
||||
}
|
||||
@ -780,10 +813,10 @@ class Metier_Partenaires_MRncs
|
||||
$postData=array('siren'=>$siren);
|
||||
//$page=getUrl($url, $this->cookie, $postData, $this->referer, false, 'www.infogreffe.fr', false, '', '', 5);
|
||||
while (1) {
|
||||
//echo date('YmdHis')." - 5. Deb $url ".$this->codeRetour.EOL;
|
||||
//echo date('YmdHis')." - 5. Deb $url ".$this->codeRetour.PHP_EOL;
|
||||
$page=getUrl($url, $this->cookie, $postData, $this->referer, false, 'www.infogreffe.fr', false, '', $query_proxy, $query_timeout);
|
||||
$this->codeRetour=$page['code'];
|
||||
//echo date('YmdHis')." - 5. FIN $url ".$this->codeRetour.EOL;
|
||||
//echo date('YmdHis')." - 5. FIN $url ".$this->codeRetour.PHP_EOL;
|
||||
if ($this->codeRetour<>'400') break;
|
||||
sleep(1);
|
||||
}
|
||||
@ -837,10 +870,10 @@ class Metier_Partenaires_MRncs
|
||||
$postData=array('numIdentification'=>$siren);
|
||||
//$page=getUrl($url, $this->cookie, $postData, $this->referer, false, 'www.infogreffe.fr', false, '', '', 5);
|
||||
while (1) {
|
||||
//echo date('YmdHis')." - 6. Deb $url ".$this->codeRetour.EOL;
|
||||
//echo date('YmdHis')." - 6. Deb $url ".$this->codeRetour.PHP_EOL;
|
||||
$page=getUrl($url, $this->cookie, $postData, $this->referer, false, 'www.infogreffe.fr', false, '', $query_proxy, $query_timeout);
|
||||
$this->codeRetour=$page['code'];
|
||||
//echo date('YmdHis')." - 6. FIN $url ".$this->codeRetour.EOL;
|
||||
//echo date('YmdHis')." - 6. FIN $url ".$this->codeRetour.PHP_EOL;
|
||||
if ($this->codeRetour<>'400') break;
|
||||
sleep(1);
|
||||
}
|
||||
@ -870,90 +903,103 @@ class Metier_Partenaires_MRncs
|
||||
|
||||
return true;
|
||||
}
|
||||
} else
|
||||
$this->libErreur='Infogreffe indisponible !';
|
||||
} else {
|
||||
$this->libErreur='Infogreffe indisponible !';
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function getDirigeantsPrin($siren, $nbDirs=2) {
|
||||
$siren=$siren*1;
|
||||
$tabRet=array();
|
||||
$dirs=$this->iDb->select(
|
||||
public function getDirigeantsPrin($siren, $nbDirs=2)
|
||||
{
|
||||
$siren = $siren*1;
|
||||
$tabRet = array();
|
||||
$dirs = $this->iDb->select(
|
||||
'jo.rncs_dirigeants',
|
||||
'siren, raisonSociale, dirRS, civilite, nom, prenom, naissance_nom, naissance_date, naissance_lieu, fonction_code, fonction_lib, cinf, dateFin, flux, dateInsert',
|
||||
"siren=$siren AND actif%10=1 ORDER BY fonction_code DESC", true, MYSQL_ASSOC);
|
||||
$numDir=0;
|
||||
foreach ($dirs as $k=>$dir) {
|
||||
$numDir = 0;
|
||||
foreach ($dirs as $k => $dir) {
|
||||
$numDir++;
|
||||
if ($dir['naissance_date']<>'0000-00-00')
|
||||
$dateNaiss=Wdate::dateT('Y-m-d','d/m/Y', $dir['naissance_date']);
|
||||
else
|
||||
$dateNaiss='';
|
||||
if ($dir['flux']<>'0000-00-00')
|
||||
$dateModif=Wdate::dateT('Y-m-d','d/m/Y', $dir['flux']);
|
||||
else
|
||||
$dateModif=Wdate::dateT('Y-m-d','d/m/Y', $dir['dateInsert']);
|
||||
$nom=trim($dir['nom']);
|
||||
$nomUsage='';
|
||||
if (trim($dir['naissance_nom'])<>'') {
|
||||
$nom=trim($dir['naissance_nom']);
|
||||
$nomUsage=trim($dir['nom']);
|
||||
if ($dir['naissance_date']<>'0000-00-00') {
|
||||
$dateNaiss = Metier_Util_Date::dateT('Y-m-d','d/m/Y', $dir['naissance_date']);
|
||||
}
|
||||
$tabRet[]=array( 'Fonction' =>$dir['fonction_code'],
|
||||
'Titre' =>$dir['fonction_lib'],
|
||||
'Societe' =>$dir['dirRS'],
|
||||
'Civilite' =>$dir['civilite'],
|
||||
'Nom' =>$nom,
|
||||
'Prenom' =>$dir['prenom'],
|
||||
'NomUsage' =>$nomUsage,
|
||||
'NaissDate' =>$dateNaiss,
|
||||
'NaissVille' =>$dir['naissance_lieu'],
|
||||
'NaissDepPays' =>'', // 25
|
||||
'Ancien' =>0,
|
||||
'DateFct' =>$dateModif,
|
||||
'Cinf' =>$dir['cinf'],
|
||||
else {
|
||||
$dateNaiss = '';
|
||||
}
|
||||
if ($dir['flux']<>'0000-00-00') {
|
||||
$dateModif = Metier_Util_Date::dateT('Y-m-d','d/m/Y', $dir['flux']);
|
||||
}
|
||||
else{
|
||||
$dateModif = Metier_Util_Date::dateT('Y-m-d','d/m/Y', $dir['dateInsert']);
|
||||
}
|
||||
$nom = trim($dir['nom']);
|
||||
$nomUsage = '';
|
||||
if (trim($dir['naissance_nom']) != '') {
|
||||
$nom = trim($dir['naissance_nom']);
|
||||
$nomUsage = trim($dir['nom']);
|
||||
}
|
||||
$tabRet[] = array(
|
||||
'Fonction' => $dir['fonction_code'],
|
||||
'Titre' => $dir['fonction_lib'],
|
||||
'Societe' => $dir['dirRS'],
|
||||
'Civilite' => $dir['civilite'],
|
||||
'Nom' => $nom,
|
||||
'Prenom' => $dir['prenom'],
|
||||
'NomUsage' => $nomUsage,
|
||||
'NaissDate' => $dateNaiss,
|
||||
'NaissVille' => $dir['naissance_lieu'],
|
||||
'NaissDepPays' => '', // 25
|
||||
'Ancien' => 0,
|
||||
'DateFct' => $dateModif,
|
||||
'Cinf' => $dir['cinf'],
|
||||
);
|
||||
if ($numDir>=$nbDirs) break;
|
||||
if ($numDir >= $nbDirs) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($numDir==0) {
|
||||
$dirs=$this->iDb->select(
|
||||
'jo.rncs_entrep',
|
||||
"siren, raisonSociale, '' AS dirRS, IF(sexe='M', 'M', IF(sexe='F', 'MME', '')) AS civilite, nom, prenom, nomUsage AS naissance_nom, dateNaiss AS naissance_date, lieuNaiss AS naissance_lieu, 1050 AS fonction_code, 'Personne Physique' AS fonction_lib, 0 AS cinf, dateFer AS dateFin, flux, dateInsert",
|
||||
"siren=$siren", true, MYSQL_ASSOC);
|
||||
$numDir=0;
|
||||
foreach ($dirs as $k=>$dir) {
|
||||
if ($numDir == 0) {
|
||||
$dirs = $this->iDb->select(
|
||||
'jo.rncs_entrep',
|
||||
"siren, raisonSociale, '' AS dirRS, IF(sexe='M', 'M', IF(sexe='F', 'MME', '')) AS civilite, nom, prenom, nomUsage AS naissance_nom, dateNaiss AS naissance_date, lieuNaiss AS naissance_lieu, 1050 AS fonction_code, 'Personne Physique' AS fonction_lib, 0 AS cinf, dateFer AS dateFin, flux, dateInsert",
|
||||
"siren=$siren", true, MYSQL_ASSOC);
|
||||
$numDir = 0;
|
||||
foreach ($dirs as $k => $dir) {
|
||||
$numDir++;
|
||||
if ($dir['naissance_date']<>'0000-00-00')
|
||||
$dateNaiss=Wdate::dateT('Y-m-d','d/m/Y', $dir['naissance_date']);
|
||||
else
|
||||
$dateNaiss='';
|
||||
if ($dir['flux']<>'0000-00-00')
|
||||
$dateModif=Wdate::dateT('Y-m-d','d/m/Y', $dir['flux']);
|
||||
else
|
||||
$dateModif=Wdate::dateT('Y-m-d','d/m/Y', $dir['dateInsert']);
|
||||
$nom=trim($dir['nom']);
|
||||
$nomUsage='';
|
||||
if (trim($dir['naissance_nom'])<>'') {
|
||||
$nom=trim($dir['naissance_nom']);
|
||||
$nomUsage=trim($dir['nom']);
|
||||
if ($dir['naissance_date'] != '0000-00-00') {
|
||||
$dateNaiss = Metier_Util_Date::dateT('Y-m-d','d/m/Y', $dir['naissance_date']);
|
||||
}
|
||||
$tabRet[]=array( 'Fonction' =>$dir['fonction_code'],
|
||||
'Titre' =>$dir['fonction_lib'],
|
||||
'Societe' =>$dir['dirRS'],
|
||||
'Civilite' =>$dir['civilite'],
|
||||
'Nom' =>$nom,
|
||||
'Prenom' =>$dir['prenom'],
|
||||
'NomUsage' =>$nomUsage,
|
||||
'NaissDate' =>$dateNaiss,
|
||||
'NaissVille' =>$dir['naissance_lieu'],
|
||||
'NaissDepPays' =>'', // 25
|
||||
'Ancien' =>0,
|
||||
'DateFct' =>$dateModif,
|
||||
'Cinf' =>$dir['cinf'],
|
||||
else {
|
||||
$dateNaiss = '';
|
||||
}
|
||||
if ($dir['flux']<>'0000-00-00') {
|
||||
$dateModif = Metier_Util_Date::dateT('Y-m-d','d/m/Y', $dir['flux']);
|
||||
}
|
||||
else {
|
||||
$dateModif = Metier_Util_Date::dateT('Y-m-d','d/m/Y', $dir['dateInsert']);
|
||||
}
|
||||
$nom = trim($dir['nom']);
|
||||
$nomUsage = '';
|
||||
if (trim($dir['naissance_nom']) != '') {
|
||||
$nom = trim($dir['naissance_nom']);
|
||||
$nomUsage = trim($dir['nom']);
|
||||
}
|
||||
$tabRet[] = array(
|
||||
'Fonction' => $dir['fonction_code'],
|
||||
'Titre' => $dir['fonction_lib'],
|
||||
'Societe' => $dir['dirRS'],
|
||||
'Civilite' => $dir['civilite'],
|
||||
'Nom' => $nom,
|
||||
'Prenom' => $dir['prenom'],
|
||||
'NomUsage' => $nomUsage,
|
||||
'NaissDate' => $dateNaiss,
|
||||
'NaissVille' => $dir['naissance_lieu'],
|
||||
'NaissDepPays' => '', // 25
|
||||
'Ancien' => 0,
|
||||
'DateFct' => $dateModif,
|
||||
'Cinf' => $dir['cinf'],
|
||||
);
|
||||
}
|
||||
}
|
||||
return $tabRet;
|
||||
}
|
||||
}
|
||||
?>
|
@ -1,922 +0,0 @@
|
||||
<?php
|
||||
global $tabOrt2Sd;
|
||||
$tabOrt2Sd=array( '_130000001'=>'SIREN',
|
||||
'_103000040'=>'CONSOLIDE',
|
||||
'_103000033'=>'DATE_CLOTURE',
|
||||
'_103000023'=>'DUREE_MOIS',
|
||||
'_103000202'=>'MONNAIE_ORI',
|
||||
'_103000205'=>'MONNAIE_ORI_UNITE',
|
||||
'_103000211'=>'MONNAIE',
|
||||
'_103000214'=>'MONNAIE_LIV_UNITE',
|
||||
'_103000029'=>'AVIS_CAC',
|
||||
'_130000009'=>'CODE_NAF',
|
||||
'_103101001'=>'AA',
|
||||
'_103101002'=>'AB',
|
||||
'_103101003'=>'AC',
|
||||
'_103101004'=>'AC1',
|
||||
'_103101005'=>'AD',
|
||||
'_103101006'=>'AE',
|
||||
'_103101007'=>'AE1',
|
||||
'_103101008'=>'AF',
|
||||
'_103101009'=>'AG',
|
||||
'_103101010'=>'AG1',
|
||||
'_103101011'=>'AH',
|
||||
'_103101012'=>'AI',
|
||||
'_103101013'=>'AI1',
|
||||
'_103101014'=>'AJ',
|
||||
'_103101015'=>'AK',
|
||||
'_103101016'=>'AK1',
|
||||
'_103101017'=>'AL',
|
||||
'_103101018'=>'AM',
|
||||
'_103101019'=>'AM1',
|
||||
'_103101020'=>'AN',
|
||||
'_103101021'=>'AO',
|
||||
'_103101022'=>'AO1',
|
||||
'_103101023'=>'AP',
|
||||
'_103101024'=>'AQ',
|
||||
'_103101025'=>'AQ1',
|
||||
'_103101026'=>'AR',
|
||||
'_103101027'=>'AS',
|
||||
'_103101028'=>'AS1',
|
||||
'_103101029'=>'AT',
|
||||
'_103101030'=>'AU',
|
||||
'_103101031'=>'AU1',
|
||||
'_103101032'=>'AV',
|
||||
'_103101033'=>'AW',
|
||||
'_103101034'=>'AW1',
|
||||
'_103101035'=>'AX',
|
||||
'_103101036'=>'AY',
|
||||
'_103101037'=>'AY1',
|
||||
'_103101038'=>'CS',
|
||||
'_103101039'=>'CT',
|
||||
'_103101040'=>'CT1',
|
||||
'_103101041'=>'CU',
|
||||
'_103101042'=>'CV',
|
||||
'_103101043'=>'CV1',
|
||||
'_103101044'=>'BB',
|
||||
'_103101045'=>'BC',
|
||||
'_103101046'=>'BC1',
|
||||
'_103101047'=>'BD',
|
||||
'_103101048'=>'BE',
|
||||
'_103101049'=>'BE1',
|
||||
'_103101050'=>'BF',
|
||||
'_103101051'=>'BG',
|
||||
'_103101052'=>'BG1',
|
||||
'_103101053'=>'BH',
|
||||
'_103101054'=>'BI',
|
||||
'_103101055'=>'BI1',
|
||||
'_103101056'=>'BJ',
|
||||
'_103101057'=>'BK',
|
||||
'_103101058'=>'BK1',
|
||||
'_103101059'=>'BL',
|
||||
'_103101060'=>'BM',
|
||||
'_103101061'=>'BM1',
|
||||
'_103101062'=>'BN',
|
||||
'_103101063'=>'BO',
|
||||
'_103101064'=>'BO1',
|
||||
'_103101065'=>'BP',
|
||||
'_103101066'=>'BQ',
|
||||
'_103101067'=>'BQ1',
|
||||
'_103101068'=>'BR',
|
||||
'_103101069'=>'BS',
|
||||
'_103101070'=>'BS1',
|
||||
'_103101071'=>'BT',
|
||||
'_103101072'=>'BU',
|
||||
'_103101073'=>'BU1',
|
||||
'_103101074'=>'BV',
|
||||
'_103101075'=>'BW',
|
||||
'_103101076'=>'BW1',
|
||||
'_103101077'=>'BX',
|
||||
'_103101078'=>'BY',
|
||||
'_103101079'=>'BY1',
|
||||
'_103101080'=>'BZ',
|
||||
'_103101081'=>'CA',
|
||||
'_103101082'=>'CA1',
|
||||
'_103101083'=>'CB',
|
||||
'_103101084'=>'CC',
|
||||
'_103101085'=>'CC1',
|
||||
'_103101086'=>'CD',
|
||||
'_103101087'=>'CE',
|
||||
'_103101088'=>'CE1',
|
||||
'_103101089'=>'CF',
|
||||
'_103101090'=>'CG',
|
||||
'_103101091'=>'CG1',
|
||||
'_103101092'=>'CH',
|
||||
'_103101093'=>'CI',
|
||||
'_103101094'=>'CI1',
|
||||
'_103101095'=>'CJ',
|
||||
'_103101096'=>'CK',
|
||||
'_103101097'=>'CK1',
|
||||
'_103101098'=>'CL',
|
||||
'_103101099'=>'CM',
|
||||
'_103101100'=>'CN',
|
||||
'_103101101'=>'CO',
|
||||
'_103101102'=>'1A',
|
||||
'_103101103'=>'1A1',
|
||||
'_103101104'=>'CP',
|
||||
'_103101105'=>'CR',
|
||||
'_103102001'=>'DA',
|
||||
'_103102002'=>'DB',
|
||||
'_103102003'=>'EK',
|
||||
'_103102004'=>'DC',
|
||||
'_103102005'=>'DD',
|
||||
'_103102006'=>'DE',
|
||||
'_103102007'=>'DF',
|
||||
'_103102008'=>'DG',
|
||||
'_103102009'=>'DH',
|
||||
'_103102010'=>'DI',
|
||||
'_103102011'=>'DJ',
|
||||
'_103102012'=>'DK',
|
||||
'_103102013'=>'DL',
|
||||
'_103102014'=>'DM',
|
||||
'_103102015'=>'DN',
|
||||
'_103102016'=>'DO',
|
||||
'_103102017'=>'DP',
|
||||
'_103102018'=>'DQ',
|
||||
'_103102019'=>'DR',
|
||||
'_103102020'=>'DS',
|
||||
'_103102021'=>'DT',
|
||||
'_103102022'=>'DU',
|
||||
'_103102023'=>'DV',
|
||||
'_103102024'=>'DW',
|
||||
'_103102025'=>'DX',
|
||||
'_103102026'=>'DY',
|
||||
'_103102027'=>'DZ',
|
||||
'_103102028'=>'EA',
|
||||
'_103102029'=>'EB',
|
||||
'_103102030'=>'EC',
|
||||
'_103102031'=>'ED',
|
||||
'_103102032'=>'EE',
|
||||
'_103102033'=>'EF',
|
||||
'_103102034'=>'EG',
|
||||
'_103102035'=>'EH',
|
||||
'_103102036'=>'EI',
|
||||
'_103103001'=>'FA',
|
||||
'_103103002'=>'FB',
|
||||
'_103103003'=>'FC',
|
||||
'_103103004'=>'FD',
|
||||
'_103103005'=>'FE',
|
||||
'_103103006'=>'FF',
|
||||
'_103103007'=>'FG',
|
||||
'_103103008'=>'FH',
|
||||
'_103103009'=>'FI',
|
||||
'_103103010'=>'FJ',
|
||||
'_103103011'=>'FK',
|
||||
'_103103012'=>'FL',
|
||||
'_103103013'=>'FM',
|
||||
'_103103014'=>'FN',
|
||||
'_103103015'=>'FO',
|
||||
'_103103016'=>'FP',
|
||||
'_103103017'=>'FQ',
|
||||
'_103103018'=>'FR',
|
||||
'_103103019'=>'FS',
|
||||
'_103103020'=>'FT',
|
||||
'_103103021'=>'FU',
|
||||
'_103103022'=>'FV',
|
||||
'_103103023'=>'FW',
|
||||
'_103103024'=>'FX',
|
||||
'_103103025'=>'FY',
|
||||
'_103103026'=>'FZ',
|
||||
'_103103027'=>'GA',
|
||||
'_103103028'=>'GB',
|
||||
'_103103029'=>'GC',
|
||||
'_103103030'=>'GD',
|
||||
'_103103031'=>'GE',
|
||||
'_103103032'=>'GF',
|
||||
'_103103033'=>'GG',
|
||||
'_103103034'=>'GH',
|
||||
'_103103035'=>'GI',
|
||||
'_103103036'=>'GJ',
|
||||
'_103103037'=>'GK',
|
||||
'_103103038'=>'GL',
|
||||
'_103103039'=>'GM',
|
||||
'_103103040'=>'GN',
|
||||
'_103103041'=>'GO',
|
||||
'_103103042'=>'GP',
|
||||
'_103103043'=>'GQ',
|
||||
'_103103044'=>'GR',
|
||||
'_103103045'=>'GS',
|
||||
'_103103046'=>'GT',
|
||||
'_103103047'=>'GU',
|
||||
'_103103048'=>'GV',
|
||||
'_103103049'=>'GW',
|
||||
'_103103050'=>'HA',
|
||||
'_103103051'=>'HB',
|
||||
'_103103052'=>'HC',
|
||||
'_103103053'=>'HD',
|
||||
'_103103054'=>'HE',
|
||||
'_103103055'=>'HF',
|
||||
'_103103056'=>'HG',
|
||||
'_103103057'=>'HH',
|
||||
'_103103058'=>'HI',
|
||||
'_103103059'=>'HJ',
|
||||
'_103103060'=>'HK',
|
||||
'_103103061'=>'HL',
|
||||
'_103103062'=>'HM',
|
||||
'_103103063'=>'HN',
|
||||
'_103103064'=>'HP',
|
||||
'_103103065'=>'HQ',
|
||||
'_103104077'=>'A1',
|
||||
'_103104078'=>'A2',
|
||||
'_103104079'=>'A3',
|
||||
'_103104080'=>'A4',
|
||||
'_103104001'=>'KF',
|
||||
'_103104002'=>'LP',
|
||||
'_103104003'=>'0J',
|
||||
'_103104004'=>'MY',
|
||||
'_103104005'=>'NC',
|
||||
'_103104006'=>'2E',
|
||||
'_103104007'=>'0K',
|
||||
'_103104008'=>'PD',
|
||||
'_103104009'=>'PH',
|
||||
'_103104010'=>'QX',
|
||||
'_103104011'=>'ON',
|
||||
'_103104012'=>'OP',
|
||||
'_103104013'=>'OQ',
|
||||
'_103104014'=>'OR',
|
||||
'_103104015'=>'SM',
|
||||
'_103104016'=>'SP',
|
||||
'_103104017'=>'5R',
|
||||
'_103104018'=>'5S',
|
||||
'_103104019'=>'5T',
|
||||
'_103104020'=>'5U',
|
||||
'_103104021'=>'7B',
|
||||
'_103104022'=>'TY',
|
||||
'_103104023'=>'TZ',
|
||||
'_103104024'=>'UA',
|
||||
'_103104025'=>'UF',
|
||||
'_103104026'=>'UH',
|
||||
'_103104027'=>'UK',
|
||||
'_103104028'=>'UM',
|
||||
'_103104029'=>'UR',
|
||||
'_103104030'=>'UV',
|
||||
'_103104031'=>'VA',
|
||||
'_103104032'=>'UY',
|
||||
'_103104033'=>'UZ',
|
||||
'_103104034'=>'VB',
|
||||
'_103104035'=>'VN',
|
||||
'_103104036'=>'VT',
|
||||
'_103104037'=>'VU',
|
||||
'_103104038'=>'VV',
|
||||
'_103104039'=>'7Y1',
|
||||
'_103104040'=>'7Z1',
|
||||
'_103104041'=>'VG',
|
||||
'_103104042'=>'VG1',
|
||||
'_103104043'=>'VH',
|
||||
'_103104044'=>'VH1',
|
||||
'_103104045'=>'8A1',
|
||||
'_103104046'=>'8B1',
|
||||
'_103104047'=>'8C',
|
||||
'_103104048'=>'8C1',
|
||||
'_103104049'=>'8D',
|
||||
'_103104050'=>'8D1',
|
||||
'_103104051'=>'8E1',
|
||||
'_103104052'=>'VW',
|
||||
'_103104053'=>'VW1',
|
||||
'_103104054'=>'VX',
|
||||
'_103104055'=>'VX1',
|
||||
'_103104056'=>'VQ',
|
||||
'_103104057'=>'VQ1',
|
||||
'_103104058'=>'8J1',
|
||||
'_103104059'=>'VI',
|
||||
'_103104060'=>'VI1',
|
||||
'_103104061'=>'8K1',
|
||||
'_103104062'=>'SZ1',
|
||||
'_103104063'=>'8L1',
|
||||
'_103104064'=>'VY',
|
||||
'_103104065'=>'VZ',
|
||||
'_103104066'=>'VZ1',
|
||||
'_103104067'=>'VZ2',
|
||||
'_103104068'=>'YQ',
|
||||
'_103104069'=>'YR',
|
||||
'_103104070'=>'YS',
|
||||
'_103104071'=>'YT',
|
||||
'_103104072'=>'YU',
|
||||
'_103104073'=>'YV',
|
||||
'_103104074'=>'YY',
|
||||
'_103104075'=>'YZ',
|
||||
'_103104076'=>'YP',
|
||||
'_103104081'=>'CZ',
|
||||
'_103104082'=>'KB',
|
||||
'_103104083'=>'KC',
|
||||
'_103104084'=>'KD',
|
||||
'_103104085'=>'KE',
|
||||
'_103104086'=>'LN',
|
||||
'_103104087'=>'LO',
|
||||
'_103104088'=>'LQ',
|
||||
'_103104089'=>'LR',
|
||||
'_103104090'=>'LS',
|
||||
'_103104091'=>'0G',
|
||||
'_103104092'=>'0H',
|
||||
'_103104093'=>'NL',
|
||||
'_103104094'=>'LT',
|
||||
'_103104095'=>'LU',
|
||||
'_103104096'=>'NO',
|
||||
'_103104097'=>'LV',
|
||||
'_103104098'=>'LW',
|
||||
'_103104099'=>'NN',
|
||||
'_103104100'=>'NG',
|
||||
'_103104101'=>'NH',
|
||||
'_103104102'=>'NM',
|
||||
'_103104103'=>'NJ',
|
||||
'_103104104'=>'NK',
|
||||
'_103104105'=>'NP',
|
||||
'_103104106'=>'0L',
|
||||
'_103104107'=>'PA',
|
||||
'_103104108'=>'PB',
|
||||
'_103104109'=>'PC',
|
||||
'_103104110'=>'PE',
|
||||
'_103104111'=>'PF',
|
||||
'_103104112'=>'PG',
|
||||
'_103104113'=>'QU',
|
||||
'_103104114'=>'QV',
|
||||
'_103104115'=>'QW',
|
||||
'_103104116'=>'Z91',
|
||||
'_103104117'=>'Z92',
|
||||
'_103104118'=>'SN',
|
||||
'_103104119'=>'SP_1',
|
||||
'_103104120'=>'SP_2',
|
||||
'_103104121'=>'SR',
|
||||
'_103104122'=>'TO',
|
||||
'_103104123'=>'3Z',
|
||||
'_103104124'=>'TS',
|
||||
'_103104125'=>'TT',
|
||||
'_103104126'=>'TU',
|
||||
'_103104127'=>'4D',
|
||||
'_103104128'=>'4H',
|
||||
'_103104129'=>'4M',
|
||||
'_103104130'=>'4S',
|
||||
'_103104131'=>'4W',
|
||||
'_103104132'=>'5A',
|
||||
'_103104133'=>'5E',
|
||||
'_103104134'=>'5K',
|
||||
'_103104135'=>'5P',
|
||||
'_103104136'=>'5Y',
|
||||
'_103104137'=>'5Z',
|
||||
'_103104138'=>'TV',
|
||||
'_103104139'=>'TW',
|
||||
'_103104140'=>'TX',
|
||||
'_103104141'=>'6A',
|
||||
'_103104142'=>'6B',
|
||||
'_103104143'=>'6C',
|
||||
'_103104144'=>'6D',
|
||||
'_103104145'=>'6E',
|
||||
'_103104146'=>'6F',
|
||||
'_103104147'=>'6G',
|
||||
'_103104148'=>'6H',
|
||||
'_103104149'=>'02',
|
||||
'_103104150'=>'03',
|
||||
'_103104151'=>'04',
|
||||
'_103104152'=>'05',
|
||||
'_103104153'=>'06',
|
||||
'_103104154'=>'07',
|
||||
'_103104155'=>'08',
|
||||
'_103104156'=>'09',
|
||||
'_103104157'=>'6N',
|
||||
'_103104158'=>'6P',
|
||||
'_103104159'=>'6R',
|
||||
'_103104160'=>'6S',
|
||||
'_103104161'=>'6T',
|
||||
'_103104162'=>'6U',
|
||||
'_103104163'=>'6V',
|
||||
'_103104164'=>'6W',
|
||||
'_103104165'=>'6X',
|
||||
'_103104166'=>'6Y',
|
||||
'_103104167'=>'6Z',
|
||||
'_103104168'=>'7A',
|
||||
'_103104169'=>'7C',
|
||||
'_103104170'=>'UB',
|
||||
'_103104171'=>'UC',
|
||||
'_103104172'=>'UD',
|
||||
'_103104173'=>'UE',
|
||||
'_103104174'=>'UG',
|
||||
'_103104175'=>'UJ',
|
||||
'_103104176'=>'UL',
|
||||
'_103104177'=>'UP',
|
||||
'_103104178'=>'UT',
|
||||
'_103104179'=>'UX',
|
||||
'_103104180'=>'UQ',
|
||||
'_103104181'=>'UU',
|
||||
'_103104182'=>'VM',
|
||||
'_103104183'=>'VP',
|
||||
'_103104184'=>'VC',
|
||||
'_103104185'=>'VR',
|
||||
'_103104186'=>'VS',
|
||||
'_103104187'=>'7Y',
|
||||
'_103104188'=>'7Y2',
|
||||
'_103104189'=>'7Z',
|
||||
'_103104190'=>'7Z2',
|
||||
'_103104191'=>'VG2',
|
||||
'_103104192'=>'VH2',
|
||||
'_103104193'=>'8A',
|
||||
'_103104194'=>'8A2',
|
||||
'_103104195'=>'8B',
|
||||
'_103104196'=>'8B2',
|
||||
'_103104197'=>'8C2',
|
||||
'_103104198'=>'8D2',
|
||||
'_103104199'=>'8E',
|
||||
'_103104200'=>'8E2',
|
||||
'_103104201'=>'VW2',
|
||||
'_103104202'=>'VX2',
|
||||
'_103104203'=>'VQ2',
|
||||
'_103104204'=>'8J',
|
||||
'_103104205'=>'8J2',
|
||||
'_103104206'=>'8J3',
|
||||
'_103104207'=>'VI2',
|
||||
'_103104208'=>'VI3',
|
||||
'_103104209'=>'8K',
|
||||
'_103104210'=>'8K2',
|
||||
'_103104211'=>'SZ',
|
||||
'_103104212'=>'SZ2',
|
||||
'_103104213'=>'8L',
|
||||
'_103104214'=>'8L2',
|
||||
'_103104215'=>'VJ',
|
||||
'_103104216'=>'VK',
|
||||
'_103104217'=>'ZE',
|
||||
'_103104218'=>'XQ',
|
||||
'_103104219'=>'SS',
|
||||
'_103104220'=>'ST',
|
||||
'_103104221'=>'ZJ',
|
||||
'_103104222'=>'YW',
|
||||
'_103104223'=>'9Z',
|
||||
'_103104224'=>'YX',
|
||||
'_103104225'=>'9X',
|
||||
'_103102037'=>'B1',
|
||||
'_103102038'=>'EJ',
|
||||
);
|
||||
|
||||
require_once 'framework/common/curl.php';
|
||||
|
||||
define('RNCS_WS_URL', 'http://www.services.ort.fr/ProtocoleRNCS/access');
|
||||
define('RNCS_WS_USER', '167260');
|
||||
define('RNCS_WS_PASS', '100356');
|
||||
|
||||
class Metier_Partenaires_MRncsFlux {
|
||||
|
||||
public $body = '';
|
||||
public $header = '';
|
||||
public $codeRetour = 0;
|
||||
public $errMsgInpi='';
|
||||
public $errNumInpi='';
|
||||
public $cookie='';
|
||||
public $iDb;
|
||||
public $tabVitrine=array();
|
||||
|
||||
|
||||
public $tabErreurInpi=array(0=>"Aucune erreur",
|
||||
10=>"Erreur de protocole avec système distant",
|
||||
11=>"Système distant inaccessible",
|
||||
101=>"Type de requête invalide",
|
||||
102=>"Code d'erreur appelant invalide",
|
||||
103=>"Identification non reconnue",
|
||||
107=>"Date invalide",
|
||||
108=>"Heure invalide",
|
||||
110=>"Code produit inconnu",
|
||||
115=>"Numéro de champ invalide",
|
||||
116=>"Longueur de champ invalide",
|
||||
121=>"Code de protocole invalide",
|
||||
122=>"Code base de données invalide",
|
||||
900=>"Erreur applicative",
|
||||
990100=>"+ de 50 entreprises trouvées",
|
||||
990101=>"Recherche complexe",
|
||||
990102=>"Critères saisis insuffisants",
|
||||
990103=>"Requête trop imprécise",
|
||||
990104=>"Dénomination non significative",
|
||||
990105=>"Critère commune non générall",
|
||||
990106=>"Critère voie trop général",
|
||||
990107=>"Commune obligatoire avec rue",
|
||||
990108=>"Commune non identifiée",
|
||||
990109=>"Entreprise non identifiée",
|
||||
990110=>"Erreur système",
|
||||
990111=>"Devise incorrecte",
|
||||
990112=>"Autre erreur",
|
||||
990113=>"Donnée incorrecte",
|
||||
990114=>"Valeur incohérente",
|
||||
990115=>"Surveillance impossible",
|
||||
990116=>"Entreprise non surveillée",
|
||||
990117=>"Entreprise déjà surveillée",
|
||||
990118=>"Produit indisponible",
|
||||
990119=>"Erreur base de données",
|
||||
990120=>"Erreur facturation",
|
||||
);
|
||||
|
||||
function __construct() {
|
||||
$this->iDb=new WDB();
|
||||
}
|
||||
|
||||
function getVitrine($siren) {
|
||||
$this->tabVitrine=$this->query($siren, array('Type'=>'QVIT'));
|
||||
return $this->tabVitrine;
|
||||
}
|
||||
|
||||
/*
|
||||
$cmdPages=$cmdNom='';
|
||||
|
||||
if (isset($_REQUEST['pages'])) $cmdPages=$_REQUEST['pages'];
|
||||
if (isset($_REQUEST['nom'])) $cmdNom=$_REQUEST['nom'];
|
||||
if (isset($_REQUEST['vue'])) $vue=$_REQUEST['vue'];
|
||||
|
||||
if ($vue=='bilans') $presta='12004';
|
||||
else $presta='12003';
|
||||
|
||||
if ($cmdNom && $cmdPages) $type='QDOC';
|
||||
else $type='QVIT';
|
||||
$prod=array('Type'=>$type,
|
||||
'Presta'=>$presta,
|
||||
'Num'=>'2',//2,
|
||||
'Ver'=>'2',//2,
|
||||
'Siren'=>$siren,
|
||||
'CmdNom'=>$cmdNom,
|
||||
'CmdPages'=>$cmdPages,
|
||||
'CmdBilan'=>'',
|
||||
);
|
||||
|
||||
$ref='';
|
||||
*/
|
||||
|
||||
public function query($siren, $prod=array()) {
|
||||
/*$prod=array('Type'=>$type,
|
||||
'Presta'=>$presta,
|
||||
'Siren'=>$siren,
|
||||
'CmdNom'=>$cmdNom,
|
||||
'CmdPages'=>$cmdPages,
|
||||
'CmdBilan'=>'',
|
||||
'Ref'=>'',
|
||||
);
|
||||
*/
|
||||
$option='';
|
||||
if ( ($prod['Type']=='QDOC' || $prod['Presta']==12004 || $prod['Presta']==12003) && !isset($prod['Num'])) {
|
||||
$prod['Num']=2;
|
||||
$prod['Ver']=2;
|
||||
} elseif (!isset($prod['Num'])) {
|
||||
$prod['Num']=1;
|
||||
$prod['Ver']=3;
|
||||
}
|
||||
|
||||
$req= '<?xml version="1.0" ?>'. "\n".
|
||||
'<ort:message xmlns:ort="http://www.ort.fr/NEWPORT/V2">'. "\n".
|
||||
' <ort:_1 type="110">'. "\n".
|
||||
' <ort:_7 type="010">NPORT</ort:_7>'. "\n".
|
||||
' <ort:_8 type="010">2</ort:_8>'. "\n". // Version du protocole
|
||||
' <ort:_9 type="010">1</ort:_9>'. "\n". // Version du dictionnaire
|
||||
' <ort:_10 type="010">1</ort:_10>'. "\n". // Code protocole/version application
|
||||
' <ort:_11 type="010">PROTORNCS</ort:_11>'. "\n".
|
||||
' <ort:_12 type="010">'.$prod['Type'].'</ort:_12>'. "\n". // Prestation souhaitée QVIT / QDOC
|
||||
' <ort:_13 type="010">0</ort:_13>'. "\n". // Code retour/erreur
|
||||
' <ort:_14 type="010">'.RNCS_WS_USER.RNCS_WS_PASS.'</ort:_14>'."\n". // User Password concaténés
|
||||
' <ort:_15 type="010">'.$prod['Ref'].'</ort:_15>'. "\n". // Réf.
|
||||
' <ort:_16 type="010">'.date('Ymd').'</ort:_16>'. "\n". // Date SSAAMMJJ
|
||||
' <ort:_17 type="010">'.date('His').'</ort:_17>'. "\n". // Heure HHMMSS
|
||||
' <ort:_19 type="010">ORT</ort:_19>'. "\n".
|
||||
' </ort:_1>'. "\n".
|
||||
' <ort:_2 type="110">'. "\n".
|
||||
' <ort:_1 type="110">'. "\n".
|
||||
' <ort:_26 type="010">'.$prod['Prod'].'</ort:_26>'. "\n". // Type de produit (vide pour QVIT)
|
||||
' <ort:_27 type="010">'.$prod['Num'].'</ort:_27>'. "\n". // Numéro de produit souhaité 1 2
|
||||
' <ort:_28 type="010">'.$prod['Ver'].'</ort:_28>'. "\n". // Version du produit 3 2
|
||||
' <ort:_31 type="010">'.$prod['Presta'].'</ort:_31>'. "\n". // Code prestation (vide pour QVIT)
|
||||
' </ort:_1>'. "\n";
|
||||
if ($prod['Presta']==12004 || $prod['Presta']==12003) {
|
||||
$req.='
|
||||
<ort:_2 type="110">
|
||||
<ort:_100 type="111">
|
||||
<ort:_101 type="110">
|
||||
<ort:_120000031 type="010">'.$prod['Presta'].'</ort:_120000031>
|
||||
<ort:_100700010 type="010">FTP</ort:_100700010>
|
||||
<ort:_100701000 type="010">NTIF</ort:_100701000>
|
||||
<ort:_120000015 type="010" />
|
||||
</ort:_101>
|
||||
</ort:_100>
|
||||
<ort:_200 type="111">
|
||||
<ort:_210 type="110">
|
||||
<ort:_130000001 type="010">'.$siren.'</ort:_130000001>
|
||||
<ort:_103000402 type="010">'.$prod['CmdNom'].'</ort:_103000402>
|
||||
<ort:_103000403 type="010">'.$prod['CmdPages'].'</ort:_103000403>
|
||||
<ort:_190000025 type="010">'.$prod['CmdBilan'].'</ort:_190000025>
|
||||
</ort:_210>
|
||||
</ort:_200>
|
||||
</ort:_2>'; //
|
||||
$option=$prod['CmdNom'].'-'.$prod['CmdPages'].'-'.$prod['CmdBilan'];
|
||||
} elseif ($prod['Type']=='QINF') {
|
||||
$req.=' <ort:_2 type="110">'."\n".'<ort:_130000001 type="010">'.$siren.'</ort:_130000001>';
|
||||
if ($prod['Presta']=='2000' || $prod['Presta']=='2001' || $prod['Presta']=='2002' || $prod['Presta']=='2003') {
|
||||
// Liste années bilans
|
||||
$req.='<ort:_190000025 type="010">'.$prod['Millesime'].'</ort:_190000025>'."\n";
|
||||
$option=$prod['Millesime'];
|
||||
}
|
||||
elseif ($prod['Presta']=='12001')
|
||||
// Flag limitation du nombre détablissement
|
||||
$req.='<ort:_109105002 type="010">N</ort:_109105002>'."\n";
|
||||
$req.='</ort:_2>';
|
||||
} else {
|
||||
$req.=' <ort:_2 type="110">
|
||||
<ort:_130000001 type="010">'.$siren.'</ort:_130000001>
|
||||
<ort:_120000031 type="010">'.$prod['Presta'].'</ort:_120000031>
|
||||
</ort:_2>';// 12003 Actes et statuts 12004 Bilans
|
||||
}
|
||||
$req.=' </ort:_2>
|
||||
</ort:message>';
|
||||
echo $req.'<hr/>';
|
||||
$postData=array(''=>$req);
|
||||
$cookie=$referer='';
|
||||
$enCache=false;
|
||||
$params=md5(serialize($prod));
|
||||
//die($params);
|
||||
/*if ($prod['CmdNom']<>'' || $prod['CmdPages']<>'' || $prod['CmdBilan']<>'' || $prod['Millesime']<>'')
|
||||
$strOption=*/
|
||||
//AND params='$params'
|
||||
$res=$this->iDb->select('rncs_requetes', 'dateRequete, strXml, codeErreur, libErreur', "siren=$siren AND params='$params' ORDER BY dateRequete DESC");
|
||||
//type='".$prod['Type']."' AND presta ='".$prod['Presta']."' $strOption ORDER BY dateRequete DESC");
|
||||
if (count($res)>0) {
|
||||
$tabRes=$res[0];
|
||||
$dateReq=$tabRes['dateRequete'];
|
||||
$this->body=$tabRes['strXml'];
|
||||
$this->errNumInpi=$tabRes['codeErreur'];
|
||||
$this->errMsgInpi=$tabRes['libErreur'];
|
||||
$enCache=true;
|
||||
echo 'Une requête dans le cache <br/>';
|
||||
//die();
|
||||
} else {
|
||||
echo 'Pas de requête dans le cache <br/>';
|
||||
//die();
|
||||
$page=getUrl(RNCS_WS_URL, $cookie, $postData, $referer, false, 'www.services.ort.fr');
|
||||
$this->body=$page['body'];
|
||||
/**
|
||||
** ERREUR PROTOCOL
|
||||
**/
|
||||
preg_match('/<ort:_13 type="020">(.*)<\/ort:_13>/Uis',$this->body, $matches);
|
||||
if ($matches[1]*1<>0) {
|
||||
$this->errNumInpi=$matches[1];
|
||||
$this->errMsgInpi=$tabErreurInpi[$this->errNumInpi];
|
||||
//echo "<!-- ERREUR INPI 13 n°$errNumInpi = $errMsgInpi !!! -->\n";
|
||||
}
|
||||
|
||||
/**
|
||||
** ERREUR APPLICATIVES NUMERIQUES
|
||||
**/
|
||||
preg_match('/<ort:_96 type="020">(.*)<\/ort:_96>/Uis',$this->body, $matches);
|
||||
if ($matches[1]*1<>0) {
|
||||
$this->errNumInpi=$matches[1];
|
||||
$this->errMsgInpi=$tabErreurInpi[$this->errNumInpi];
|
||||
//echo "<!-- ERREUR INPI 96 n°$errNumInpi = $errMsgInpi !!! -->\n";
|
||||
}
|
||||
|
||||
/**
|
||||
** ERREUR APPLICATIVES TEXTE
|
||||
**/
|
||||
preg_match('/<ort:_97 type="010">(.*)<\/ort:_97>/Uis',$this->body, $matches);
|
||||
if ($matches[1]*1<>0) {
|
||||
$this->errMsgInpi=$matches[1];
|
||||
//echo "<!-- ERREUR INPI 97 : $errMsgInpi !!! -->\n";
|
||||
}
|
||||
|
||||
$tabInsert=array( 'siren' => $siren,
|
||||
'dateRequete' => date('YmdHis'),
|
||||
'strXml' => $this->body,
|
||||
'params' => md5(serialize($prod)),
|
||||
'type' => $prod['Type'],
|
||||
'presta' => $prod['Presta'],
|
||||
'option' => $option,
|
||||
'codeErreur' => $this->errNumInpi,
|
||||
'libErreur' => $this->errMsgInpi,
|
||||
);
|
||||
$this->iDb->insert('jo.rncs_requetes', $tabInsert, true);
|
||||
}
|
||||
|
||||
if ($prod['Presta']==12004)
|
||||
// bilans image
|
||||
$pregmatch=preg_match_all('/<ort\:_201 type="110">(?:.*)<ort\:_103000040 type="010">(.*)<\/ort:_103000040>(?:.*)<ort\:_103000452 type="010">(.*)<\/ort:_103000452>(?:.*)<ort\:_103000402 type="010">(.*)<\/ort:_103000402>(?:.*)<ort\:_103000403 type="010">(.*)<\/ort:_103000403>(?:.*)<ort\:_103000404 type="010">(.*)<\/ort:_103000404>(?:.*)<\/ort:_201>/Uis',$this->body, $matches);
|
||||
elseif ($prod['Presta']==12003)
|
||||
// actes image
|
||||
$pregmatch=preg_match_all('/<ort\:_201 type="110">(?:.*)<ort\:_103000452 type="010">(.*)<\/ort:_103000452>(?:.*)<ort\:_103000402 type="010">(.*)<\/ort:_103000402>(?:.*)<ort\:_103000403 type="010">(.*)<\/ort:_103000403>(?:.*)<ort\:_103000404 type="010">(.*)<\/ort:_103000404>(?:.*)<\/ort:_201>/Uis',$this->body, $matches);
|
||||
elseif ($prod['Presta']==2000)
|
||||
// bilan simplifiés ou normaux saisi
|
||||
$pregmatch=preg_match('/<ort\:_2 type="110">(?:.*)<ort\:_2 type="110">(.*)<\/ort\:_2>(?:.*)<\/ort\:_2>/Uis',$this->body, $matches);
|
||||
elseif ($prod['Presta']==12001)
|
||||
// Fiche Identite
|
||||
$pregmatch=preg_match('/<ort\:_2 type="110">(?:.*)<ort\:_2 type="110">(.*)<\/ort\:_2>(?:.*)<\/ort\:_2>/Uis',$this->body, $matches);
|
||||
else {
|
||||
// Prestation Vitrine
|
||||
$tabVitrine=array();
|
||||
|
||||
// Bilans dispos
|
||||
$tabBilans=array();
|
||||
// Type de Bilans saisis disponible
|
||||
for ($typeBilan=2000; $typeBilan<2004; $typeBilan++) {
|
||||
$pregmatch=preg_match('/<ort:_'.$typeBilan.' type="110">(?:.*)<ort\:_120000026 type="010">(.*)<\/ort\:_120000026>(?:.*)<ort\:_120000027 type="010">(.*)<\/ort\:_120000027>(?:.*)<ort\:_120000028 type="010">(.*)<\/ort\:_120000028>(?:.*)<ort\:_120000029 type="010">(.*)<\/ort:_120000029>(?:.*)<ort\:_120000031 type="010">(.*)<\/ort\:_120000031>(?:.*)<ort\:_109104002 type="010">(.*)<\/ort\:_109104002>(?:.*)<ort\:_109104003 type="010">(.*)<\/ort\:_109104003>(.*)<\/ort:_'.$typeBilan.'>/Uis',$this->body, $matches);
|
||||
$numProduit=$matches[1]; // 52
|
||||
$numProduit=$matches[2]; // 52
|
||||
$verProduit=$matches[3]; // 1
|
||||
$libProduit=$matches[4]; // Comptes sociaux
|
||||
$typProduit=$matches[5]; // 2000 : Bilans sociaux
|
||||
// 2001 : Bilans consolidés (70)
|
||||
// 2002 : Bilans de banques (71)
|
||||
// 2003 : Bilans d'assurances (72)
|
||||
$synProduit=$matches[6]; // 109104002 : Disponibilité synchrone
|
||||
$asyProduit=$matches[7]; // 109104003 : Disponibilité asynchrone
|
||||
$pregmatch=preg_match_all('/<ort\:_103000038 type="010">(.*)<\/ort:_103000038>/Uis',$matches[8], $matches);
|
||||
if ($typeBilan==2000) $tabBilans['N']=$matches[1]; // Réel normal SC
|
||||
elseif ($typeBilan==2001) $tabBilans['C']=$matches[1]; // Consolidé CC
|
||||
elseif ($typeBilan==2002) $tabBilans['B']=$matches[1]; // Banque SB
|
||||
elseif ($typeBilan==2003) $tabBilans['A']=$matches[1]; // Assurance SA
|
||||
else $tabBilans['S']=$matches[1]; // Réel Simplifié SS
|
||||
}
|
||||
$tabVitrine['bilans']=$tabBilans;
|
||||
|
||||
// Fiche d'identité
|
||||
$pregmatch=preg_match('/<ort:_12001 type="110">(?:.*)<ort\:_120000027 type="010">(.*)<\/ort\:_120000027>(?:.*)<ort\:_120000028 type="010">(.*)<\/ort\:_120000028>(?:.*)<ort\:_120000029 type="010">(.*)<\/ort:_120000029>(?:.*)<ort\:_120000031 type="010">(.*)<\/ort\:_120000031>(?:.*)<ort\:_109104002 type="010">(.*)<\/ort\:_109104002>(?:.*)<ort\:_109104003 type="010">(.*)<\/ort\:_109104003>(?:.*)<ort\:_130000401 type="010">(.*)<\/ort\:_130000401>(?:.*)<\/ort:_12001>/Uis',$this->body, $matches);
|
||||
$numProduit=$matches[1]; // 52
|
||||
$verProduit=$matches[2]; // 1
|
||||
$libProduit=$matches[3]; // Comptes sociaux
|
||||
$typProduit=$matches[4]; // 2000 : Bilans sociaux
|
||||
$synProduit=$matches[5]; // 109104002 : Disponibilité synchrone
|
||||
$asyProduit=$matches[6]; // 109104003 : Disponibilité asynchrone
|
||||
$nbEtab=$matches[7]; // Nombre d'établissements recensés
|
||||
$tabVitrine['identite']=array( 'numProduit'=>$numProduit,
|
||||
'verProduit'=>$verProduit,
|
||||
'libProduit'=>$libProduit,
|
||||
'typProduit'=>$typProduit,
|
||||
'synProduit'=>$synProduit,
|
||||
'asyProduit'=>$asyProduit,
|
||||
'nbEtab' =>$nbEtab);
|
||||
|
||||
return $tabVitrine;
|
||||
}
|
||||
|
||||
echo $this->body;
|
||||
|
||||
//print_r($tabBilans);
|
||||
return $matches;
|
||||
}
|
||||
|
||||
function getListeBilans($siren, $type='*') {
|
||||
$tabVitrine=$this->getVitrine($siren);
|
||||
foreach ($tabVitrine['bilans'] as $type => $tabMillesime) {
|
||||
foreach ($tabMillesime as $num=>$millesime) {
|
||||
$delta1=round((Wdate::dateT('d/m/Y','Y',$millesime)-Wdate::dateT('d/m/Y','Y',$tabMillesime[$num+1]))*12)
|
||||
+round(Wdate::dateT('d/m/Y','m',$millesime)-Wdate::dateT('d/m/Y','m',$tabMillesime[$num+1]));
|
||||
if ($delta1>23) $delta1=0;
|
||||
$delta2=round((Wdate::dateT('d/m/Y','Y',$tabMillesime[$num+1])-Wdate::dateT('d/m/Y','Y',$tabMillesime[$num+2]))*12)
|
||||
+round(Wdate::dateT('d/m/Y','m',$tabMillesime[$num+1])-Wdate::dateT('d/m/Y','m',$tabMillesime[$num+2]));
|
||||
if ($delta2>23) $delta2=0;
|
||||
$tabRet[$type.$millesime]=array( 'dateProvPartenaire'=>date('Ymd'),
|
||||
'dureeExercice' =>$delta1,
|
||||
'dateExercicePre' =>Wdate::dateT('d/m/Y','Ymd',$tabMillesime[$num+1]),
|
||||
'dureeExercicePre' =>$delta2,
|
||||
'monnaie' =>'EUR',
|
||||
'source' =>100,
|
||||
'ref' =>'',
|
||||
);
|
||||
}
|
||||
}
|
||||
return $tabRet;
|
||||
}
|
||||
|
||||
function getBilan($siren, $millesime, $type='N') {
|
||||
global $tabOrt2Sd;
|
||||
$tabRet=$tabPostes=array();
|
||||
if ($type=='N') $presta=2000;
|
||||
elseif ($type=='C') $presta=2001;
|
||||
elseif ($type=='B') $presta=2002;
|
||||
elseif ($type=='A') $presta=2003;
|
||||
$prod=array( 'Prod'=>'RNCS',
|
||||
'Num'=>'52',
|
||||
'Ver'=>'1',
|
||||
'Presta'=>$presta,
|
||||
'Millesime'=>Wdate::dateT('d/m/Y','mY',$millesime),
|
||||
'Type'=>'QINF');
|
||||
$ret=$this->query($siren, $prod);
|
||||
|
||||
/* $fp=fopen(LOG_PATH.'/debugBilansRncs.log','a');
|
||||
fwrite($fp, print_r($ret,true));
|
||||
fclose($fp);*/
|
||||
|
||||
$pregmatch=preg_match_all('/<ort\:_(.*) type="010">(.*)<\/ort\:_(.*)>/Uis', $ret[1], $matches);
|
||||
foreach ($matches[1] as $i=>$poste) {
|
||||
//echo "$i : $poste<br/>";
|
||||
if ('_'.$poste=='_103000040') { // CONSOLIDE
|
||||
switch ($matches[2][$i]) {
|
||||
case 'SC': $tabRet[$tabOrt2Sd['_'.$poste]]='N'; break;
|
||||
case 'CC': $tabRet[$tabOrt2Sd['_'.$poste]]='C'; break;
|
||||
case 'SB': $tabRet[$tabOrt2Sd['_'.$poste]]='B'; break;
|
||||
case 'SA': $tabRet[$tabOrt2Sd['_'.$poste]]='A'; break;
|
||||
case 'SS': $tabRet[$tabOrt2Sd['_'.$poste]]='S'; break;
|
||||
default: break;
|
||||
}
|
||||
} elseif ('_'.$poste=='_103000214') { // MONNAIE_LIV_UNITE
|
||||
switch ($matches[2][$i]*1) {
|
||||
case 0: $tabRet[$tabOrt2Sd['_'.$poste]]=''; break;
|
||||
case 3: $tabRet[$tabOrt2Sd['_'.$poste]]='k'; break;
|
||||
case 6: $tabRet[$tabOrt2Sd['_'.$poste]]='m'; break;
|
||||
default: break;
|
||||
}
|
||||
} elseif ('_'.$poste=='_130000001' || // SIREN
|
||||
'_'.$poste=='_103000033' || // DATE_CLOTURE
|
||||
'_'.$poste=='_103000023' || // DUREE_MOIS
|
||||
'_'.$poste=='_103000202' || // MONNAIE_ORI
|
||||
'_'.$poste=='_103000205' || // MONNAIE_ORI_UNITE
|
||||
'_'.$poste=='_103000211' || // MONNAIE
|
||||
'_'.$poste=='_103000029' || // AVIS_CAC
|
||||
'_'.$poste=='_130000009') { // CODE_NAF
|
||||
$tabRet[$tabOrt2Sd['_'.$poste]]=$matches[2][$i];
|
||||
} else
|
||||
$tabPostes[$tabOrt2Sd['_'.$poste]]=$matches[2][$i];
|
||||
}
|
||||
$tabRet['POSTES']=$tabPostes;
|
||||
$tabRet['DATE_FRAICHE_BILAN']=date('Ymd');
|
||||
$tabRet['TYPE_BILAN']=$tabRet['CONSOLIDE'];
|
||||
//$tabRet['DATE_CLOTURE_PRE']
|
||||
//$tabRet['DUREE_MOIS_PRE']
|
||||
$fp=fopen(LOG_PATH.'/debugBilansRncs.log','a');
|
||||
fwrite($fp, print_r($tabRet,true));
|
||||
fclose($fp);
|
||||
|
||||
return $tabRet;
|
||||
}
|
||||
|
||||
function getIdentite($siren) {
|
||||
$tabVitrine=$this->getVitrine($siren);
|
||||
|
||||
$fp=fopen(LOG_PATH.'/debugVitrineRncs.log','a');
|
||||
fwrite($fp, print_r($tabVitrine,true));
|
||||
fclose($fp);
|
||||
|
||||
$prod=array( 'Prod'=>'RNCS',
|
||||
'Num'=>$tabVitrine['identite']['numProduit'],
|
||||
'Ver'=>$tabVitrine['identite']['verProduit'],
|
||||
'Presta'=>12001,
|
||||
'Type'=>'QINF');
|
||||
$ret=$this->query($siren, $prod);
|
||||
if ($this->errNumInpi>0 && $this->errMsgInpi<>'') {
|
||||
return false;
|
||||
} else {
|
||||
$pregmatch=preg_match_all('/<ort\:_((?:1300|13011|13016|130100403).*) type="010">(.*)<\/ort\:_((?:1300|13011|13016|130100403).*)>/Uis', $ret[1], $matchesIden);
|
||||
foreach ($matchesIden[1] as $i=>$rubrique) {
|
||||
if ($rubrique==130000300) $tabIdentite['Nom']=$matchesIden[2][$i];
|
||||
elseif ($rubrique==130000008) $tabIdentite['FJ']=$matchesIden[2][$i];
|
||||
elseif ($rubrique==130000303) $tabIdentite['Sigle']=$matchesIden[2][$i];
|
||||
elseif ($rubrique==130100015) $tabIdentite['Enseigne']=$matchesIden[2][$i];
|
||||
elseif ($rubrique==130000500) $tabIdentite['CapitalMont']=$matchesIden[2][$i];
|
||||
elseif ($rubrique==130000501) $tabIdentite['CapitalType']=$matchesIden[2][$i];
|
||||
elseif ($rubrique==130000508) $tabIdentite['CapitalDev']=$matchesIden[2][$i];
|
||||
elseif ($rubrique==130000509) $tabIdentite['CapitalUnite']=$matchesIden[2][$i];
|
||||
elseif ($rubrique==130000513) $tabIdentite['CapitalMontCts']=$matchesIden[2][$i];
|
||||
elseif ($rubrique==130000102) $tabIdentite['DateCrea']=$matchesIden[2][$i];
|
||||
elseif ($rubrique==130001002) $tabIdentite['DateImma']=$matchesIden[2][$i];
|
||||
elseif ($rubrique==130000013) $tabIdentite['CodeGreffe']=$matchesIden[2][$i];
|
||||
elseif ($rubrique==130000014) $tabIdentite['NumRC']=$matchesIden[2][$i];
|
||||
elseif ($rubrique==130001102) $tabIdentite['DateRad']=$matchesIden[2][$i];
|
||||
elseif ($rubrique==130000025) $tabIdentite['Provisoire']=$matchesIden[2][$i];
|
||||
elseif ($rubrique==130000401) $tabIdentite['NbEtab']=$matchesIden[2][$i];
|
||||
}
|
||||
|
||||
/** DIRIGEANTS **/
|
||||
$tabDir=array();
|
||||
if (preg_match('/<ort\:_130300015 type="010">(.*)<\/ort:_130300015>(?:.*)<ort:_200 type="111">(.*)<\/ort\:_200>/Uis', $ret[1], $matchesDirs)) {
|
||||
$nbDirs=$matchesDirs[1];
|
||||
$strDir=$matchesDirs[2];
|
||||
$strMatch= '<ort\:_210 type="110">(?:.*)'.
|
||||
'<ort\:_130300005 type="010">(.*)<\/ort\:_130300005>(?:.*)'.
|
||||
'<ort\:_130301003 type="010">(.*)<\/ort\:_130301003>(?:.*)'.
|
||||
'<ort\:_130300016 type="010">(.*)<\/ort\:_130300016>(?:.*)'.
|
||||
'<ort\:_130301006 type="010">(.*)<\/ort\:_130301006>(?:.*)'.
|
||||
'<ort\:_130301007 type="010">(.*)<\/ort\:_130301007>(?:.*)'.
|
||||
'<ort\:_130301009 type="010">(.*)<\/ort\:_130301009>(?:.*)'.
|
||||
'<ort\:_130301004 type="010">(.*)<\/ort\:_130301004>(?:.*)'.
|
||||
'<ort\:_130301008 type="010">(.*)<\/ort\:_130301008>(?:.*)'.
|
||||
'<ort\:_130301012 type="010">(.*)<\/ort\:_130301012>(?:.*)'.
|
||||
'<ort\:_130301100 type="010">(.*)<\/ort\:_130301100>(?:.*)'.
|
||||
'<ort\:_130301102 type="010">(.*)<\/ort\:_130301102>(?:.*)'.
|
||||
'<ort\:_130302002 type="010">(.*)<\/ort\:_130302002>(?:.*)'.
|
||||
'<ort\:_130302003 type="010">(.*)<\/ort\:_130302003>(?:.*)'.
|
||||
'<ort\:_130302004 type="010">(.*)<\/ort\:_130302004>(?:.*)<\/ort\:_210>';
|
||||
$pregmatch=preg_match_all("/$strMatches/Uis", $strDir, $matchesDirs);
|
||||
foreach ($matchesDirs[1] as $i=>$dir) {
|
||||
$tabDir[$i]=array( 'Fonc'=>$dir[1],
|
||||
'Sexe'=>$dir[2],
|
||||
'Nom'=>$dir[3],
|
||||
'Prenom'=>$dir[4],
|
||||
'Prenom2'=>$dir[5],
|
||||
'NomJF'=>$dir[6],
|
||||
'NaissDept'=>$dir[7],
|
||||
'NaissLieu'=>$dir[8],
|
||||
'NaissNati'=>$dir[9],
|
||||
'NaissDate'=>$dir[10],
|
||||
'ReprNom'=>$dir[11],
|
||||
'ReprPrenom'=>$dir[12],
|
||||
'ReprPrenom2'=>$dir[13],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$fp=fopen(LOG_PATH.'/debugIdentiteRncs.log','a');
|
||||
fwrite($fp, print_r($matchesIden,true).EOL.print_r($matchesEtab,true).EOL.print_r($matchesDirs,true));
|
||||
fclose($fp);
|
||||
|
||||
return $tabIdentite;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -1,34 +1,36 @@
|
||||
<?php
|
||||
class Metier_Partenaires_MRnvp
|
||||
{
|
||||
protected $iDb;
|
||||
protected $iInsee;
|
||||
public $tabDevises = array();
|
||||
|
||||
public $tabDevises=array();
|
||||
public $nomTronque=0;
|
||||
public $nomTronque = 0;
|
||||
|
||||
protected $tabAdrCQ=array(
|
||||
10=>'Adresse correcte',
|
||||
20=>'Adresse correcte (Voie non reconue dans un CEDEX ou BP)',
|
||||
21=>'Adresse correcte mais numéro de facade hors borne (petite ville)',
|
||||
22=>'Adresse correcte mais numéro de facade absent (petite ville)',
|
||||
23=>'Adresse correcte mais numéro de facade hors borne (grande ville)',
|
||||
24=>'Adresse correcte mais numéro de facade absent (grande ville)',
|
||||
30=>'Voie non reconnue (petite ville)',
|
||||
31=>'Voie non reconnue (petite ville, quartier reconnu)',
|
||||
40=>'Voie absente (petite ville, quartier reconnu)',
|
||||
41=>'Voie absente (petite ville)',
|
||||
50=>'Voie non reconnue (grande ville)',
|
||||
51=>'Voie non reconnue (grande ville, quartier reconnu)',
|
||||
60=>'Voie absente (grande ville, quartier reconnu)',
|
||||
61=>'Voie absente (grande ville)',
|
||||
70=>'Voie présente mais Cp/Ville non corrigeable',
|
||||
80=>'Voie absente et Cp/Ville non corrigeable',
|
||||
90=>'Adresse à l\'étranger',
|
||||
10 => 'Adresse correcte',
|
||||
20 => 'Adresse correcte (Voie non reconue dans un CEDEX ou BP)',
|
||||
21 => 'Adresse correcte mais numéro de facade hors borne (petite ville)',
|
||||
22 => 'Adresse correcte mais numéro de facade absent (petite ville)',
|
||||
23 => 'Adresse correcte mais numéro de facade hors borne (grande ville)',
|
||||
24 => 'Adresse correcte mais numéro de facade absent (grande ville)',
|
||||
30 => 'Voie non reconnue (petite ville)',
|
||||
31 => 'Voie non reconnue (petite ville, quartier reconnu)',
|
||||
40 => 'Voie absente (petite ville, quartier reconnu)',
|
||||
41 => 'Voie absente (petite ville)',
|
||||
50 => 'Voie non reconnue (grande ville)',
|
||||
51 => 'Voie non reconnue (grande ville, quartier reconnu)',
|
||||
60 => 'Voie absente (grande ville, quartier reconnu)',
|
||||
61 => 'Voie absente (grande ville)',
|
||||
70 => 'Voie présente mais Cp/Ville non corrigeable',
|
||||
80 => 'Voie absente et Cp/Ville non corrigeable',
|
||||
90 => 'Adresse à l\'étranger',
|
||||
);
|
||||
|
||||
function __construct() {
|
||||
$this->iDb = new WDB();
|
||||
protected $iInsee;
|
||||
|
||||
protected $iDb;
|
||||
|
||||
public function __construct() {
|
||||
$this->iDb = new Metier_Util_Db();
|
||||
$this->iInsee = new Metier_Insee_MInsee($this->iDb);
|
||||
}
|
||||
|
||||
@ -38,10 +40,11 @@ class Metier_Partenaires_MRnvp
|
||||
*/
|
||||
protected function getTabDevisesInpi()
|
||||
{
|
||||
$rep=$this->iDb->select('jo.tabDevises', 'devInpi, devIso', 'devInpi>0', false, MYSQL_ASSOC);
|
||||
$tabDevises=array();
|
||||
foreach($rep as $k=>$dev)
|
||||
$tabDevises[$dev['devInpi']*1]=$dev['devIso'];
|
||||
$rep = $this->iDb->select('jo.tabDevises', 'devInpi, devIso', 'devInpi>0', false, MYSQL_ASSOC);
|
||||
$tabDevises = array();
|
||||
foreach($rep as $k=>$dev) {
|
||||
$tabDevises[$dev['devInpi']*1] = $dev['devIso'];
|
||||
}
|
||||
|
||||
return $tabDevises;
|
||||
}
|
||||
@ -87,13 +90,13 @@ class Metier_Partenaires_MRnvp
|
||||
|
||||
$adrL=$tabRetI=$tabRetV=$tabRetR=$tabRetE=array();
|
||||
$L1tr=$L2tr=$L3tr=0; // Par défaut, les lignes ne sont pas indiquées comme tronquées
|
||||
$adrL[1]=$adrL1=trim(preg_replace('/\s+/',' ',preg_replace('/[^a-z\d ]/i', ' ', strtoupper(trimAccent($adrL1)))));
|
||||
$adrL[2]=$adrL2=trim(preg_replace('/\s+/',' ',preg_replace('/[^a-z\d ]/i', ' ', strtoupper(trimAccent($adrL2)))));
|
||||
$adrL[3]=$adrL3=trim(preg_replace('/\s+/',' ',preg_replace('/[^a-z\d ]/i', ' ', strtoupper(trimAccent($adrL3)))));
|
||||
$adrL[4]=$adrL4=trim(preg_replace('/\s+/',' ',preg_replace('/[^a-z\d ]/i', ' ', strtoupper(trimAccent($adrL4)))));
|
||||
$adrL[5]=$adrL5=trim(preg_replace('/\s+/',' ',preg_replace('/[^a-z\d ]/i', ' ', strtoupper(trimAccent($adrL5)))));
|
||||
$adrL[6]=$adrL6=trim(preg_replace('/\s+/',' ',preg_replace('/[^a-z\d ]/i', ' ', strtoupper(trimAccent($adrL6)))));
|
||||
$adrL[7]=$adrL7=trim(preg_replace('/\s+/',' ',preg_replace('/[^a-z\d ]/i', ' ', strtoupper(trimAccent($adrL7)))));
|
||||
$adrL[1]=$adrL1=trim(preg_replace('/\s+/',' ',preg_replace('/[^a-z\d ]/i', ' ', strtoupper(Metier_Util_String::trimAccent($adrL1)))));
|
||||
$adrL[2]=$adrL2=trim(preg_replace('/\s+/',' ',preg_replace('/[^a-z\d ]/i', ' ', strtoupper(Metier_Util_String::trimAccent($adrL2)))));
|
||||
$adrL[3]=$adrL3=trim(preg_replace('/\s+/',' ',preg_replace('/[^a-z\d ]/i', ' ', strtoupper(Metier_Util_String::trimAccent($adrL3)))));
|
||||
$adrL[4]=$adrL4=trim(preg_replace('/\s+/',' ',preg_replace('/[^a-z\d ]/i', ' ', strtoupper(Metier_Util_String::trimAccent($adrL4)))));
|
||||
$adrL[5]=$adrL5=trim(preg_replace('/\s+/',' ',preg_replace('/[^a-z\d ]/i', ' ', strtoupper(Metier_Util_String::trimAccent($adrL5)))));
|
||||
$adrL[6]=$adrL6=trim(preg_replace('/\s+/',' ',preg_replace('/[^a-z\d ]/i', ' ', strtoupper(Metier_Util_String::trimAccent($adrL6)))));
|
||||
$adrL[7]=$adrL7=trim(preg_replace('/\s+/',' ',preg_replace('/[^a-z\d ]/i', ' ', strtoupper(Metier_Util_String::trimAccent($adrL7)))));
|
||||
$dureeM=round(microtime(1)-$tDeb,3);
|
||||
if ($adrL7<>'' || $adrL7<>'FRANCE' || $adrL7<>'MONACO')
|
||||
|
||||
@ -147,7 +150,7 @@ class Metier_Partenaires_MRnvp
|
||||
$erreur=true;
|
||||
} else {
|
||||
foreach($ret as $i=>$iRet) {
|
||||
if ($debug) echo "je compare '$cp' avec '".$iRet['codePostal']."' et '$ville' avec '".$iRet["libCom$norme"]."' (".$iRet['idAdr56'].", score=".$iRet['score'].")".EOL;
|
||||
if ($debug) echo "je compare '$cp' avec '".$iRet['codePostal']."' et '$ville' avec '".$iRet["libCom$norme"]."' (".$iRet['idAdr56'].", score=".$iRet['score'].")".PHP_EOL;
|
||||
if (($iRet['codePostal']==$cp || substr($iRet['codePostal'],0,2)==$cp2) && ($iRet["libCom$norme"]==$ville || preg_replace('/ 0/', ' ',$iRet["libCom$norme"])==$ville) || (strpos($iRet["libCom$norme"],$ville)>0 && $nbRet==1)) {
|
||||
$idAdr56=$iRet['idAdr56'];
|
||||
$dateMajHexavia=$iRet["dateMaj$norme"];
|
||||
@ -174,13 +177,12 @@ class Metier_Partenaires_MRnvp
|
||||
'libLigne6'=> $iRet["libLigne6n$norme"],
|
||||
'dureeV'=> round(microtime(1)-$tD,3),
|
||||
);
|
||||
// if ($iRet['score']>17) break;
|
||||
}
|
||||
}
|
||||
if (!$idAdr56) {
|
||||
$iRet=$ret[0];
|
||||
if ($debug) echo "On prend le score le + élevé s'il est > à 15 : je compare '$cp' avec '".$iRet['codePostal']."' et '$ville' avec '".$iRet["libCom$norme"]."' (".$iRet['idAdr56'].")".EOL;
|
||||
//echo '['.trim(preg_replace('/ (1ER|2EME|3EME|\d+)/', ' ',$iRet["libCom$norme"])) .'-v/s-'.trim(preg_replace('/ (1ER|2EME|3EME|\d+)/', ' ',$ville)).']'.EOL;
|
||||
if ($debug) echo "On prend le score le + élevé s'il est > à 15 : je compare '$cp' avec '".$iRet['codePostal']."' et '$ville' avec '".$iRet["libCom$norme"]."' (".$iRet['idAdr56'].")".PHP_EOL;
|
||||
//echo '['.trim(preg_replace('/ (1ER|2EME|3EME|\d+)/', ' ',$iRet["libCom$norme"])) .'-v/s-'.trim(preg_replace('/ (1ER|2EME|3EME|\d+)/', ' ',$ville)).']'.PHP_EOL;
|
||||
if (($iRet['codePostal']==$cp || substr($iRet['codePostal'],0,2)==$cp2) && ($iRet["libCom$norme"]==$ville || (substr(trim(preg_replace('/ (1ER|2EME|3EME|\d+)/', ' ',$iRet["libCom$norme"])),0,26)==trim(preg_replace('/ (1ER|2EME|3EME|\d+)/', ' ',$ville)) && $iRet['score']>15) || (strpos($iRet["libCom$norme"],$ville)>0 && $nbRet==1))) {
|
||||
$idAdr56=$iRet['idAdr56'];
|
||||
$dateMajHexavia=$iRet["dateMaj$norme"];
|
||||
@ -214,7 +216,6 @@ class Metier_Partenaires_MRnvp
|
||||
'errRNVPcode'=>'V2',
|
||||
'errRNVPlib'=>"Plusieurs correspondances CP VILLE pour $cp $ville"
|
||||
);
|
||||
//return 'Plusieurs correspondances CP VILLE'.EOL;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -249,7 +250,7 @@ class Metier_Partenaires_MRnvp
|
||||
$nbVoiesCom=count($ret);
|
||||
if ($nbVoiesCom==0) {
|
||||
$erreur=true;
|
||||
if ($debug) echo "Aucune Voie recensée dans cette commune ('$strAdr56') !".EOL;
|
||||
if ($debug) echo "Aucune Voie recensée dans cette commune ('$strAdr56') !".PHP_EOL;
|
||||
$tabRetE=array(
|
||||
'dureeRnvp'=>round(microtime(1)-$tDeb,3),
|
||||
'errRNVPcode'=>'R0',
|
||||
@ -273,7 +274,7 @@ class Metier_Partenaires_MRnvp
|
||||
$L4=preg_replace('/\s+/', ' ', trim($numVoie.' '.$indRep.' '.$iRet["libVoie$norme"]));
|
||||
$L4=preg_replace('/^0+/','',$L4);
|
||||
$hexaViaVoie=$iRet["libVoie$norme"];
|
||||
if (strlen($L4)>$norme) return "Taille de la ligne 4 générée en sortie plus longue que $norme !".EOL;
|
||||
if (strlen($L4)>$norme) return "Taille de la ligne 4 générée en sortie plus longue que $norme !".PHP_EOL;
|
||||
$matriculeHexavia=$iRet['codeVoie'];
|
||||
$codeRoudis=$iRet['codeRoudis'];
|
||||
$L5=$tabAdr56L['_'.$idAdr56]['L5'];
|
||||
@ -288,8 +289,8 @@ class Metier_Partenaires_MRnvp
|
||||
|
||||
if (!$matriculeHexavia) {
|
||||
if ($debug) print_r($ret);
|
||||
if ($debug) echo ("Plusieurs correspondances Voies pour $adrL4 $adrL6 dans cette commune ('$strAdr56') !".EOL);
|
||||
//die("Plusieurs correspondances Voies pour $adrL4 $adrL6 dans cette commune ('$strAdr56') !".EOL);
|
||||
if ($debug) echo ("Plusieurs correspondances Voies pour $adrL4 $adrL6 dans cette commune ('$strAdr56') !".PHP_EOL);
|
||||
//die("Plusieurs correspondances Voies pour $adrL4 $adrL6 dans cette commune ('$strAdr56') !".PHP_EOL);
|
||||
$tabRetE=array( 'dureeRnvp'=>round(microtime(1)-$tDeb,3),
|
||||
'errRNVPcode'=>'R2',
|
||||
'errRNVPlib'=>"Plusieurs correspondances Voies pour $adrL4 $adrL6 dans cette commune ('$strAdr56')");
|
||||
@ -330,9 +331,6 @@ class Metier_Partenaires_MRnvp
|
||||
'errRNVPlib'=>"Normalisation OK"
|
||||
);
|
||||
if (count($tabMaxLen)>0) {
|
||||
/*foreach($tabMaxLen as $j) {
|
||||
echo "La ligne n°$j fait ".$tabLen[$j]." caractères : '".$adrL[$j]."'".EOL;
|
||||
}*/
|
||||
if ($j>1) {
|
||||
$tabRetE = array(
|
||||
'dureeRnvp'=>round(microtime(1)-$tDeb,3),
|
||||
@ -369,226 +367,280 @@ class Metier_Partenaires_MRnvp
|
||||
return $tabRet;
|
||||
}
|
||||
|
||||
/** Retourne le tableau des abbréviations existantes par type d'abréviation
|
||||
/**
|
||||
* Tableau des abbréviations existantes par type d'abréviation
|
||||
* @param string $typeAbrev
|
||||
* @return array
|
||||
*/
|
||||
function getAbreviations($typeAbrev)
|
||||
public function getAbreviations($typeAbrev)
|
||||
{
|
||||
$tabRet=array();
|
||||
if ($typeAbrev=='P') {
|
||||
$ret=$this->iDb->select('villes.tabPrenoms',
|
||||
"prenom",
|
||||
"LENGTH(prenom)>3 AND nbTot>0 ORDER BY LENGTH(prenom) DESC",false, MYSQL_ASSOC);
|
||||
$tabRet = array();
|
||||
if ($typeAbrev == 'P') {
|
||||
$ret = $this->iDb->select(
|
||||
'villes.tabPrenoms',
|
||||
"prenom",
|
||||
"LENGTH(prenom)>3 AND nbTot>0 ORDER BY LENGTH(prenom) DESC",false, MYSQL_ASSOC);
|
||||
foreach($ret as $iRet) {
|
||||
$tabTmp=explode('-',$iRet['prenom']);
|
||||
$tabTmp2=array();
|
||||
foreach($tabTmp as $subPrenom)
|
||||
$tabTmp = explode('-',$iRet['prenom']);
|
||||
$tabTmp2 = array();
|
||||
foreach($tabTmp as $subPrenom) {
|
||||
$tabTmp2[]=substr($subPrenom,0,1);
|
||||
$tabRet[$iRet['prenom']]=implode('-', $tabTmp2);
|
||||
}
|
||||
$tabRet[$iRet['prenom']] = implode('-', $tabTmp2);
|
||||
}
|
||||
} else {
|
||||
$ret=$this->iDb->select('villes.tabAbreviations',
|
||||
"abrCode, abrLib",
|
||||
"abrType='$typeAbrev' AND dateSuppr=0 AND idSuppr=0 ORDER BY LENGTH(abrLib) DESC, LENGTH(abrCode) ASC",false, MYSQL_ASSOC);
|
||||
}
|
||||
else {
|
||||
$ret = $this->iDb->select(
|
||||
'villes.tabAbreviations',
|
||||
"abrCode, abrLib",
|
||||
"abrType='$typeAbrev' AND dateSuppr=0 AND idSuppr=0 ORDER BY LENGTH(abrLib) DESC, LENGTH(abrCode) ASC",false, MYSQL_ASSOC);
|
||||
foreach($ret as $iRet) {
|
||||
$tabTmp=explode('/', $iRet['abrLib']);
|
||||
$tabTmp = explode('/', $iRet['abrLib']);
|
||||
foreach($tabTmp as $abrLib) {
|
||||
if ($typeAbrev=='A')
|
||||
$tabRet[$abrLib]='';
|
||||
else
|
||||
$tabRet[$abrLib]=$iRet['abrCode'];
|
||||
if ($typeAbrev == 'A') {
|
||||
$tabRet[$abrLib] = '';
|
||||
} else {
|
||||
$tabRet[$abrLib] = $iRet['abrCode'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//print_r($tabRet);die();
|
||||
return $tabRet;
|
||||
}
|
||||
|
||||
/** Normalise une raison sociale ou un nom
|
||||
**/
|
||||
function normaliseRS($nomLong, $taille=38, $debug=false)
|
||||
/**
|
||||
* Normalise une raison sociale ou un nom
|
||||
* @param string $nomLong
|
||||
* @param number $taille
|
||||
* @param string $debug
|
||||
* @return mixed
|
||||
*/
|
||||
public function normaliseRS($nomLong, $taille=38, $debug=false)
|
||||
{
|
||||
$nomCourt=preg_replace('/[^A-Z0-9%@&\'\(\)\"\-\*\/\s\+]/','',trim(strtoupper($nomLong)));
|
||||
$tabMots=split("[^[:alpha:]]+", $nomCourt);
|
||||
$passage=0;
|
||||
$this->nomTronque=0;
|
||||
echo $nomCourt.EOL;
|
||||
while (strlen($nomCourt)>$taille) {
|
||||
$nomCourt = preg_replace('/[^A-Z0-9%@&\'\(\)\"\-\*\/\s\+]/','',trim(strtoupper($nomLong)));
|
||||
$tabMots = split("[^[:alpha:]]+", $nomCourt);
|
||||
$passage = 0;
|
||||
$this->nomTronque = 0;
|
||||
while (strlen($nomCourt) > $taille) {
|
||||
// 1. Remplacement des Libellés de Voies par leurs code Voie
|
||||
$tabTmp=$this->getAbreviations('V');
|
||||
$tabTmp = $this->getAbreviations('V');
|
||||
foreach ($tabTmp as $lib=>$abr) {
|
||||
$nomCourt=trim(str_replace(" $lib".'ES ', ' '.$abr.' ', " $nomCourt "));
|
||||
$nomCourt=trim(str_replace(" $lib".'E ', ' '.$abr.' ', " $nomCourt "));
|
||||
$nomCourt=trim(str_replace(" $lib".'S ', ' '.$abr.' ', " $nomCourt "));
|
||||
$nomCourt=trim(str_replace(" $lib ", ' '.$abr.' ', " $nomCourt "));
|
||||
if (strlen($nomCourt)<=$taille) break;
|
||||
$nomCourt = trim(str_replace(" $lib".'ES ', ' '.$abr.' ', " $nomCourt "));
|
||||
$nomCourt = trim(str_replace(" $lib".'E ', ' '.$abr.' ', " $nomCourt "));
|
||||
$nomCourt = trim(str_replace(" $lib".'S ', ' '.$abr.' ', " $nomCourt "));
|
||||
$nomCourt = trim(str_replace(" $lib ", ' '.$abr.' ', " $nomCourt "));
|
||||
if (strlen($nomCourt) <= $taille) break;
|
||||
}
|
||||
if ($debug) echo "1-Voies=$nomCourt".EOL;
|
||||
if (strlen($nomCourt)<=$taille) break;
|
||||
if ($debug) {
|
||||
echo "1-Voies=$nomCourt".PHP_EOL;
|
||||
}
|
||||
if (strlen($nomCourt) <= $taille) break;
|
||||
|
||||
//print_r($tabMots);
|
||||
// 2. Remplacement des Titres par leurs abréviation
|
||||
$tabTmp=$this->getAbreviations('T');
|
||||
$tabTmp = $this->getAbreviations('T');
|
||||
foreach ($tabTmp as $lib=>$abr) {
|
||||
$nomCourt=trim(str_replace(" $lib".'ES ', ' '.$abr.' ', " $nomCourt "));
|
||||
$nomCourt=trim(str_replace(" $lib".'E ', ' '.$abr.' ', " $nomCourt "));
|
||||
$nomCourt=trim(str_replace(" $lib".'S ', ' '.$abr.' ', " $nomCourt "));
|
||||
$nomCourt=trim(str_replace(" $lib ", ' '.$abr.' ', " $nomCourt "));
|
||||
if (strlen($nomCourt)<=$taille) break;
|
||||
$nomCourt = trim(str_replace(" $lib".'ES ', ' '.$abr.' ', " $nomCourt "));
|
||||
$nomCourt = trim(str_replace(" $lib".'E ', ' '.$abr.' ', " $nomCourt "));
|
||||
$nomCourt = trim(str_replace(" $lib".'S ', ' '.$abr.' ', " $nomCourt "));
|
||||
$nomCourt = trim(str_replace(" $lib ", ' '.$abr.' ', " $nomCourt "));
|
||||
if (strlen($nomCourt) <= $taille) break;
|
||||
}
|
||||
if ($debug) echo "2a-Titres=$nomCourt".EOL;
|
||||
if (strlen($nomCourt)<=$taille) break;
|
||||
if ($debug) {
|
||||
echo "2a-Titres=$nomCourt".PHP_EOL;
|
||||
}
|
||||
if (strlen($nomCourt) <= $taille) break;
|
||||
|
||||
// 2. Remplacement des Formes Juridiques
|
||||
$tabTmp=$this->getAbreviations('J');
|
||||
foreach ($tabTmp as $lib=>$abr)
|
||||
$nomCourt=trim(str_replace(" $lib ", ' '.$abr.' ', " $nomCourt "));
|
||||
if ($debug) echo "2b-FJ=$nomCourt".EOL;
|
||||
if (strlen($nomCourt)<=$taille) break;
|
||||
$tabTmp = $this->getAbreviations('J');
|
||||
foreach ($tabTmp as $lib => $abr) {
|
||||
$nomCourt = trim(str_replace(" $lib ", ' '.$abr.' ', " $nomCourt "));
|
||||
}
|
||||
if ($debug) {
|
||||
echo "2b-FJ=$nomCourt".PHP_EOL;
|
||||
}
|
||||
if (strlen($nomCourt) <= $taille) break;
|
||||
|
||||
// 4. Suppression des articles
|
||||
$tabTmp=$this->getAbreviations('A');
|
||||
foreach ($tabTmp as $lib=>$abr) {
|
||||
if (strpos($lib,"'")>0)
|
||||
$nomCourt=trim(str_replace(' '.$lib, ' ', " $nomCourt "));
|
||||
else
|
||||
$nomCourt=trim(str_replace(" $lib ", ' ', " $nomCourt "));
|
||||
if (strlen($nomCourt)<=$taille) break;
|
||||
$tabTmp = $this->getAbreviations('A');
|
||||
foreach ($tabTmp as $lib => $abr) {
|
||||
if (strpos($lib,"'") > 0) {
|
||||
$nomCourt = trim(str_replace(' '.$lib, ' ', " $nomCourt "));
|
||||
} else {
|
||||
$nomCourt = trim(str_replace(" $lib ", ' ', " $nomCourt "));
|
||||
}
|
||||
if (strlen($nomCourt) <= $taille) break;
|
||||
}
|
||||
if ($debug) echo "4-Articles=$nomCourt".EOL;
|
||||
if (strlen($nomCourt)<=$taille) break;
|
||||
if ($debug) {
|
||||
echo "4-Articles=$nomCourt".PHP_EOL;
|
||||
}
|
||||
if (strlen($nomCourt) <= $taille) break;
|
||||
|
||||
// 3. Remplacement des Prénoms par leurs initiales
|
||||
$tabTmp=$this->getAbreviations('P');
|
||||
foreach ($tabTmp as $lib=>$abr) {
|
||||
$nomCourt=trim(str_replace(" $lib ", ' '.$abr.' ', " $nomCourt "));
|
||||
if (strlen($nomCourt)<=$taille) break;
|
||||
$tabTmp = $this->getAbreviations('P');
|
||||
foreach ($tabTmp as $lib => $abr) {
|
||||
$nomCourt = trim(str_replace(" $lib ", ' '.$abr.' ', " $nomCourt "));
|
||||
if (strlen($nomCourt) <= $taille) break;
|
||||
}
|
||||
if ($debug) echo "3-Prenoms=$nomCourt".EOL;
|
||||
if (strlen($nomCourt)<=$taille) break;
|
||||
|
||||
$tabTmp=$this->getAbreviations('N');
|
||||
foreach ($tabTmp as $lib=>$abr) {
|
||||
$nomCourt=trim(str_replace(" $lib".'ES ', ' '.$abr.' ', " $nomCourt "));
|
||||
$nomCourt=trim(str_replace(" $lib".'E ', ' '.$abr.' ', " $nomCourt "));
|
||||
$nomCourt=trim(str_replace(" $lib".'S ', ' '.$abr.' ', " $nomCourt "));
|
||||
$nomCourt=trim(str_replace(" $lib ", ' '.$abr.' ', " $nomCourt "));
|
||||
if (strlen($nomCourt)<=$taille) break;
|
||||
if ($debug) {
|
||||
echo "3-Prenoms=$nomCourt".PHP_EOL;
|
||||
}
|
||||
if ($debug) echo "5-Autres Noms=$nomCourt".EOL;
|
||||
if (strlen($nomCourt)<=$taille) break;
|
||||
if (strlen($nomCourt) <= $taille) break;
|
||||
|
||||
$nomCourt=substr($nomCourt,0,$taille);
|
||||
$this->nomTronque=1;
|
||||
$tabTmp = $this->getAbreviations('N');
|
||||
foreach ($tabTmp as $lib => $abr) {
|
||||
$nomCourt = trim(str_replace(" $lib".'ES ', ' '.$abr.' ', " $nomCourt "));
|
||||
$nomCourt = trim(str_replace(" $lib".'E ', ' '.$abr.' ', " $nomCourt "));
|
||||
$nomCourt = trim(str_replace(" $lib".'S ', ' '.$abr.' ', " $nomCourt "));
|
||||
$nomCourt = trim(str_replace(" $lib ", ' '.$abr.' ', " $nomCourt "));
|
||||
if (strlen($nomCourt) <= $taille) break;
|
||||
}
|
||||
if ($debug) {
|
||||
echo "5-Autres Noms=$nomCourt".PHP_EOL;
|
||||
}
|
||||
if (strlen($nomCourt) <= $taille) break;
|
||||
|
||||
//die($nomCourt);
|
||||
/** @todo A finir
|
||||
Tronquer ou abréger dans cette ordre
|
||||
- type de voie
|
||||
- titres
|
||||
- initiale du prénom
|
||||
- supprimez les articles (mais pas les particules dans un nom propre)
|
||||
- tronquer à 4 caractères les types de voie non normalisés
|
||||
- tronquer les extensions de voie
|
||||
- réduire le nom de la voie en supprimant les mots de la gauche vers la droite
|
||||
$nomCourt = substr($nomCourt, 0, $taille);
|
||||
$this->nomTronque = 1;
|
||||
|
||||
Gérer les pluriels pour les voies, nom, titres, et formes juridiques
|
||||
**/
|
||||
$passage++;
|
||||
}
|
||||
|
||||
return $nomCourt;
|
||||
}
|
||||
|
||||
|
||||
// Code Insee de la commune libCom32 Libellé de la commune (Ancienne norme 32) libCom38 Libellé
|
||||
function getLibCommune($codeInsee, $norme=38) {
|
||||
if ($norme<>32 && $norme<>38) {
|
||||
return 'La norme doit être 32 ou 38 caractères (38 par défaut)'.EOL;
|
||||
/**
|
||||
* Code Insee de la commune libCom32 Libellé de la commune (Ancienne norme 32) libCom38 Libellé
|
||||
* @param string $codeInsee
|
||||
* @param number $norme
|
||||
* @return string
|
||||
*/
|
||||
public function getLibCommune($codeInsee, $norme = 38)
|
||||
{
|
||||
if ($norme != 32 && $norme != 38) {
|
||||
return 'La norme doit être 32 ou 38 caractères (38 par défaut)'.PHP_EOL;
|
||||
}
|
||||
|
||||
$ret=$this->iDb->select('villes.hexaviaVilles',
|
||||
"libCom32 , libCom38",
|
||||
"codeInseeCom='$codeInsee' LIMIT 0,1",false, MYSQL_ASSOC);
|
||||
$nbRet=count($ret);
|
||||
if ($nbRet==0 && $codeInsee>99000) {
|
||||
$codePaysInsee=substr($codeInsee,2,3);
|
||||
$ret=$this->iDb->select('jo.tabPays',
|
||||
"SUBSTRING(libPays,1,32) AS libCom32, SUBSTRING(libPays,1,38) AS libCom38",
|
||||
"codePaysInsee='$codeInsee' ORDER BY dependance ASC LIMIT 0,1",false, MYSQL_ASSOC);
|
||||
$nbRet=count($ret);
|
||||
$ret = $this->iDb->select(
|
||||
'villes.hexaviaVilles',
|
||||
"libCom32 , libCom38",
|
||||
"codeInseeCom='$codeInsee' LIMIT 0,1",false, MYSQL_ASSOC);
|
||||
$nbRet = count($ret);
|
||||
if ($nbRet == 0 && $codeInsee > 99000) {
|
||||
$codePaysInsee = substr($codeInsee,2,3);
|
||||
$ret = $this->iDb->select(
|
||||
'jo.tabPays',
|
||||
"SUBSTRING(libPays,1,32) AS libCom32, SUBSTRING(libPays,1,38) AS libCom38",
|
||||
"codePaysInsee='$codeInsee' ORDER BY dependance ASC LIMIT 0,1",false, MYSQL_ASSOC);
|
||||
$nbRet = count($ret);
|
||||
}
|
||||
if ($nbRet == 0) {
|
||||
return 'Aucune correspondance VILLE';
|
||||
}
|
||||
elseif ($norme == 32) {
|
||||
return $ret[0]['libCom32'];
|
||||
}
|
||||
else {
|
||||
return $ret[0]['libCom38'];
|
||||
}
|
||||
if ($nbRet==0) return 'Aucune correspondance VILLE';
|
||||
elseif ($norme==32) return $ret[0]['libCom32'];
|
||||
else return $ret[0]['libCom38'];
|
||||
}
|
||||
|
||||
function getCPCommune($codeInsee)
|
||||
/**
|
||||
* Code postal depuis le code Insee
|
||||
* @param string $codeInsee
|
||||
* @return boolean
|
||||
*/
|
||||
public function getCPCommune($codeInsee)
|
||||
{
|
||||
$ret=$this->iDb->select('villes.hexaviaVilles',
|
||||
"codePostal",
|
||||
$ret = $this->iDb->select('villes.hexaviaVilles', "codePostal",
|
||||
"codeInseeCom='$codeInsee' GROUP BY codePostal",false, MYSQL_ASSOC);
|
||||
$nbRet=count($ret);
|
||||
if ($nbRet==1) return $ret[0]['codePostal'];
|
||||
$nbRet = count($ret);
|
||||
if ($nbRet == 1) {
|
||||
return $ret[0]['codePostal'];
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function getCodCommune($libelleCommune, $depOuCp='', $debug=false)
|
||||
/**
|
||||
*
|
||||
* @param unknown $libelleCommune
|
||||
* @param string $depOuCp
|
||||
* @param string $debug
|
||||
* @return string
|
||||
*/
|
||||
public function getCodCommune($libelleCommune, $depOuCp = '', $debug = false)
|
||||
{
|
||||
$norme=38;
|
||||
$codeCommune=false;
|
||||
$cp=$depOuCp;
|
||||
$cp2=substr($cp,0,2);
|
||||
$ret=$this->iDb->select('villes.hexaviaVilles',
|
||||
"idAdr56, codeInseeCom, libCom$norme, codeInseeGlobal, indPluridis, libLigne5n$norme, indRoudis, codePostal, libLigne6n$norme, codeInseePre, codeMaj$norme, dateMaj$norme, MATCH (codePostal, libCom38) AGAINST ('$depOuCp $libelleCommune' IN NATURAL LANGUAGE MODE) AS score",
|
||||
"MATCH (codePostal, libCom38) AGAINST ('$depOuCp $libelleCommune' IN NATURAL LANGUAGE MODE) ORDER BY score DESC",false, MYSQL_ASSOC);
|
||||
// print_r($ret);
|
||||
$nbRet=count($ret);
|
||||
if ($nbRet==0)
|
||||
return false;
|
||||
$norme = 38;
|
||||
$codeCommune = false;
|
||||
$cp = $depOuCp;
|
||||
$cp2 = substr($cp,0,2);
|
||||
$ret = $this->iDb->select('villes.hexaviaVilles',
|
||||
"idAdr56, codeInseeCom, libCom$norme, codeInseeGlobal, indPluridis, libLigne5n$norme, indRoudis, codePostal, libLigne6n$norme, codeInseePre, codeMaj$norme, dateMaj$norme, MATCH (codePostal, libCom38) AGAINST ('$depOuCp $libelleCommune' IN NATURAL LANGUAGE MODE) AS score",
|
||||
"MATCH (codePostal, libCom38) AGAINST ('$depOuCp $libelleCommune' IN NATURAL LANGUAGE MODE) ORDER BY score DESC",false, MYSQL_ASSOC);
|
||||
$nbRet = count($ret);
|
||||
if ($nbRet == 0) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
foreach($ret as $i=>$iRet) {
|
||||
if ($debug) echo "je compare '$depOuCp' avec '".$iRet['codePostal']."' et '$libelleCommune' avec '".$iRet["libCom$norme"]."' (".$iRet['idAdr56'].", score=".$iRet['score'].")".EOL;
|
||||
if (($depOuCp<>'' && ($iRet['codePostal']==$cp || substr($iRet['codePostal'],0,2)==$cp2)) && ($iRet["libCom$norme"]==$libelleCommune || preg_replace('/ 0/', ' ',$iRet["libCom$norme"])==$libelleCommune) || (strpos($iRet["libCom$norme"],$libelleCommune)>0 && $nbRet==1)) {
|
||||
$codeCommune=$iRet['codeInseeCom'];
|
||||
if ($debug) echo "je compare '$depOuCp' avec '".$iRet['codePostal']."' et '$libelleCommune' avec '".$iRet["libCom$norme"]."' (".$iRet['idAdr56'].", score=".$iRet['score'].")".PHP_EOL;
|
||||
if (($depOuCp!='' && ($iRet['codePostal']==$cp || substr($iRet['codePostal'],0,2)==$cp2)) && ($iRet["libCom$norme"]==$libelleCommune || preg_replace('/ 0/', ' ',$iRet["libCom$norme"])==$libelleCommune) || (strpos($iRet["libCom$norme"],$libelleCommune)>0 && $nbRet==1)) {
|
||||
$codeCommune = $iRet['codeInseeCom'];
|
||||
if ($iRet['score']>17) break;
|
||||
}
|
||||
}
|
||||
if (!$codeCommune) {
|
||||
$iRet=$ret[0];
|
||||
if ($debug) echo "On prend le score le + élevé s'il est > à 15 : je compare '$cp' avec '".$iRet['codePostal']."' et '$libelleCommune' avec '".$iRet["libCom$norme"]."' (".$iRet['idAdr56'].")".EOL;
|
||||
if ($debug) echo '['.trim(preg_replace('/ (1ER|2EME|3EME|\d+)/', ' ',$iRet["libCom$norme"])) .'-v/s-'.trim(preg_replace('/ (1ER|2EME|3EME|\d+)/', ' ',$libelleCommune)).']'.EOL;
|
||||
if (($depOuCp<>'' && ($iRet['codePostal']==$cp || substr($iRet['codePostal'],0,2)==$cp2)) && ($iRet["libCom$norme"]==$libelleCommune || (substr(trim(preg_replace('/ (1ER|2EME|3EME|\d+)/', ' ',$iRet["libCom$norme"])),0,26)==trim(preg_replace('/ (1ER|2EME|3EME|\d+)/', ' ',$libelleCommune)) && $iRet['score']>15) || (strpos($iRet["libCom$norme"],$libelleCommune)>0 && $nbRet==1))) {
|
||||
$iRet = $ret[0];
|
||||
if ($debug) {
|
||||
echo "On prend le score le + élevé s'il est > à 15 : je compare '$cp' avec '".$iRet['codePostal']."' et '$libelleCommune' avec '".$iRet["libCom$norme"]."' (".$iRet['idAdr56'].")".PHP_EOL;
|
||||
}
|
||||
if ($debug) {
|
||||
echo '['.trim(preg_replace('/ (1ER|2EME|3EME|\d+)/', ' ',$iRet["libCom$norme"])) .'-v/s-'.trim(preg_replace('/ (1ER|2EME|3EME|\d+)/', ' ',$libelleCommune)).']'.PHP_EOL;
|
||||
}
|
||||
if (($depOuCp != '' && ($iRet['codePostal']==$cp || substr($iRet['codePostal'],0,2)==$cp2)) && ($iRet["libCom$norme"]==$libelleCommune || (substr(trim(preg_replace('/ (1ER|2EME|3EME|\d+)/', ' ',$iRet["libCom$norme"])),0,26)==trim(preg_replace('/ (1ER|2EME|3EME|\d+)/', ' ',$libelleCommune)) && $iRet['score']>15) || (strpos($iRet["libCom$norme"],$libelleCommune)>0 && $nbRet==1))) {
|
||||
$codeCommune=$iRet['codeInseeCom'];
|
||||
}
|
||||
}
|
||||
//die("Code commune de $libelleCommune ($depOuCp) = $codeCommune".EOL);
|
||||
}
|
||||
|
||||
return $codeCommune;
|
||||
}
|
||||
|
||||
function normaliseAdresse76310($L1,$L2,$L3,$L4,$L5,$L6,$L7='')
|
||||
/**
|
||||
*
|
||||
* @param unknown $L1
|
||||
* @param unknown $L2
|
||||
* @param unknown $L3
|
||||
* @param unknown $L4
|
||||
* @param unknown $L5
|
||||
* @param unknown $L6
|
||||
* @param string $L7
|
||||
*/
|
||||
public function normaliseAdresse76310($L1, $L2, $L3, $L4, $L5, $L6, $L7 = '')
|
||||
{
|
||||
$tDeb=microtime(1);
|
||||
$tabRetR=$tabRetE=array();
|
||||
$tDeb = microtime(1);
|
||||
$tabRetR = $tabRetE = array();
|
||||
|
||||
$cp=substr(trim($L6),0,5);
|
||||
$cp2=substr($cp,0,2);
|
||||
$ville=trim(strtr(substr($L6,5),array(' SAINT '=>' ST ',' SAINTE '=>' STE ')));
|
||||
$ville=preg_replace('/ CEDEX\s?.*$/ui','',$ville);
|
||||
$tabRetI=array( 'operateurRnvp'=>'76310WEB',
|
||||
'in_cp'=>$cp,
|
||||
'in_dep'=>$cp2,
|
||||
'in_ville'=>$ville,
|
||||
'in_L1'=>trim($L1),
|
||||
'in_L2'=>trim($L2),
|
||||
'in_L3'=>trim($L3),
|
||||
'in_L4'=>trim($L4),
|
||||
'in_L5'=>trim($L5),
|
||||
'in_L6'=>trim($L6),
|
||||
'in_L7'=>trim($L7));
|
||||
$cp = substr(trim($L6),0,5);
|
||||
$cp2 = substr($cp,0,2);
|
||||
$ville = trim(strtr(substr($L6,5),array(' SAINT '=>' ST ',' SAINTE '=>' STE ')));
|
||||
$ville = preg_replace('/ CEDEX\s?.*$/ui','',$ville);
|
||||
$tabRetI = array(
|
||||
'operateurRnvp'=>'76310WEB',
|
||||
'in_cp'=>$cp,
|
||||
'in_dep'=>$cp2,
|
||||
'in_ville'=>$ville,
|
||||
'in_L1'=>trim($L1),
|
||||
'in_L2'=>trim($L2),
|
||||
'in_L3'=>trim($L3),
|
||||
'in_L4'=>trim($L4),
|
||||
'in_L5'=>trim($L5),
|
||||
'in_L6'=>trim($L6),
|
||||
'in_L7'=>trim($L7)
|
||||
);
|
||||
|
||||
//$client = new SoapClient('http://www.rnvp-en-ligne.com/service.asmx?wsdl');
|
||||
$client = new SoapClient('http://www.rnvp-en-ligne.com/service_v5.asmx?wsdl');
|
||||
$nbEssais=1;
|
||||
$nbEssais = 1;
|
||||
|
||||
$array = array (
|
||||
'pi_session' => '-1',
|
||||
@ -597,66 +649,55 @@ class Metier_Partenaires_MRnvp
|
||||
'pi_codedossier' => '0001',
|
||||
'pi_numfichier' => '1',
|
||||
'pi_rsoc' => utf8_encode($L1),
|
||||
//'pio_civ' => '',
|
||||
//'pio_nom' => '',
|
||||
//'pio_prenom' => '',
|
||||
'pio_cnom' => utf8_encode($L2), // Ligne 2
|
||||
'pio_cadrs' => utf8_encode($L3), // Ligne 3
|
||||
'pio_adresse' => utf8_encode($L4), // Ligne 4
|
||||
'pio_lieudit' => utf8_encode($L5), // Ligne 5
|
||||
'pio_cpville' => utf8_encode($L6), // Ligne 6
|
||||
'pio_pays' => utf8_encode($L7), // Ligne 7
|
||||
/* 'po_tnp' => '',
|
||||
'po_sex' => '',
|
||||
'po_civlong' => '',
|
||||
'po_cp' => '',
|
||||
'po_ville' => '',
|
||||
'po_insee' => '',
|
||||
'po_cqtnp' => '',
|
||||
'po_cqadrs' => '',
|
||||
'po_risquerestru' => '',
|
||||
'po_poidsmodif' => '',
|
||||
'po_rejet' => '',
|
||||
'po_etranger' => ''*/
|
||||
);
|
||||
while(1) {
|
||||
try {
|
||||
//$result = $client->Elfyweb_RNVP_Standard($array);
|
||||
$result = $client->Elfyweb_RNVP_Expert_V50($array);
|
||||
//print_r($result);
|
||||
$tabRetR=array( 'L1'=>$L1,
|
||||
'L2'=>$L2,
|
||||
'L3'=>strtoupper(utf8_decode($result->pio_cadrs)),
|
||||
'L4'=>strtoupper(utf8_decode($result->pio_adresse)),
|
||||
'L5'=>strtoupper(utf8_decode($result->pio_lieudit)),
|
||||
'L6'=>strtoupper(utf8_decode($result->pio_cpville)),
|
||||
/* [po_risquerestru] => 0
|
||||
[po_poidsmodif] => 0
|
||||
[po_rejet] =>
|
||||
[po_etranger] =>*/
|
||||
'Cp'=>$result->po_cp,
|
||||
'Ville'=>$result->po_ville,
|
||||
'Insee'=>$result->po_insee,
|
||||
/*'CQadrs'=>$result->po_cqadrs,
|
||||
'CQadrsLib'=>$this->tabAdrCQ[$result->po_cqadrs],
|
||||
'CQAdrRnvp'=>$this->getLibQualiteAdresse76310($result->po_cqadrs, $result->rejet),*/
|
||||
'dureeRnvp'=>round(microtime(1)-$tDeb,3),
|
||||
);
|
||||
if (@$result->pio_pays<>'FRA') $tabRet['L7']=$result->pio_pays;
|
||||
$tabRetR=array(
|
||||
'L1' => $L1,
|
||||
'L2' => $L2,
|
||||
'L3' => strtoupper(utf8_decode($result->pio_cadrs)),
|
||||
'L4' => strtoupper(utf8_decode($result->pio_adresse)),
|
||||
'L5' => strtoupper(utf8_decode($result->pio_lieudit)),
|
||||
'L6' => strtoupper(utf8_decode($result->pio_cpville)),
|
||||
'Cp' => $result->po_cp,
|
||||
'Ville' => $result->po_ville,
|
||||
'Insee' => $result->po_insee,
|
||||
'dureeRnvp' => round(microtime(1)-$tDeb,3),
|
||||
);
|
||||
if (@$result->pio_pays != 'FRA') {
|
||||
$tabRet['L7'] = $result->pio_pays;
|
||||
}
|
||||
break;
|
||||
} catch (SoapFault $fault) {
|
||||
$nbEssais++;
|
||||
if ($nbEssai<5) continue;
|
||||
$tabRetE=array( 'dureeRnvp'=>round(microtime(1)-$tDeb,3),
|
||||
'errRNVPcode'=>'S0',
|
||||
'errRNVPlib'=>"Erreur SOAP : ".print_r($fault,1));
|
||||
if ($nbEssai < 5) {
|
||||
continue;
|
||||
}
|
||||
$tabRetE = array(
|
||||
'dureeRnvp' => round(microtime(1)-$tDeb,3),
|
||||
'errRNVPcode' => 'S0',
|
||||
'errRNVPlib' => "Erreur SOAP : ".print_r($fault,1));
|
||||
}
|
||||
}
|
||||
$tabRet=array_merge($tabRetI,$tabRetR,$tabRetE);
|
||||
$tabRet = array_merge($tabRetI,$tabRetR,$tabRetE);
|
||||
|
||||
return $tabRet;
|
||||
}
|
||||
|
||||
function getLibQualiteAdresse76310($cqadrs, $correctionDouteuse)
|
||||
/**
|
||||
*
|
||||
* @param string $cqadrs
|
||||
* @param string $correctionDouteuse
|
||||
* @return number
|
||||
*/
|
||||
public function getLibQualiteAdresse76310($cqadrs, $correctionDouteuse)
|
||||
{
|
||||
switch ($cqadrs*1) {
|
||||
case 10: // Adresse correcte
|
||||
@ -665,49 +706,58 @@ class Metier_Partenaires_MRnvp
|
||||
case 22: // Adresse correcte mais numéro de facade absent (petite ville)
|
||||
case 23: // Adresse correcte mais numéro de facade hors borne (grande ville)
|
||||
case 24: // Adresse correcte mais numéro de facade absent (grande ville)
|
||||
$cqRnvpSed=1;
|
||||
$cqRnvpSed = 1;
|
||||
break;
|
||||
case 31: // Voie non reconnue (petite ville, quartier reconnu)
|
||||
case 51: // Voie non reconnue (grande ville, quartier reconnu)
|
||||
$cqRnvpSed=2;
|
||||
$cqRnvpSed = 2;
|
||||
break;
|
||||
case 30: // Voie non reconnue (petite ville)
|
||||
case 50: // Voie non reconnue (grande ville)
|
||||
$cqRnvpSed=3;
|
||||
$cqRnvpSed = 3;
|
||||
break;
|
||||
case 40: // Voie absente (petite ville, quartier reconnu)
|
||||
case 41: // Voie absente (petite ville)
|
||||
case 60: // Voie absente (grande ville, quartier reconnu)
|
||||
case 61: // Voie absente (grande ville)
|
||||
$cqRnvpSed=4;
|
||||
$cqRnvpSed = 4;
|
||||
break;
|
||||
case 70: // Voie présente mais Cp/Ville non corrigeable
|
||||
case 80: // Voie absente et Cp/Ville non corrigeable
|
||||
$cqRnvpSed=5;
|
||||
$cqRnvpSed = 5;
|
||||
break;
|
||||
default:
|
||||
$cqRnvpSed=0;
|
||||
$cqRnvpSed = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if ($correctionDouteuse=='D') $cqRnvpSed=0;
|
||||
if ($correctionDouteuse == 'D') {
|
||||
$cqRnvpSed = 0;
|
||||
}
|
||||
|
||||
return $cqRnvpSed;
|
||||
}
|
||||
|
||||
function getAdresseRnvpSource($source, $source_id, $num=0)
|
||||
/**
|
||||
* Adresse RNVP
|
||||
* @param int $source
|
||||
* @param int $source_id
|
||||
* @param number $num
|
||||
* @return array
|
||||
*/
|
||||
public function getAdresseRnvpSource($source, $source_id, $num=0)
|
||||
{
|
||||
$ret=$this->iDb->select(
|
||||
'villes.rnvpSources',
|
||||
$ret = $this->iDb->select('villes.rnvpSources',
|
||||
'id, source, source_id, num, L1rnvp, L2rnvp, L3rnvp, L4rnvp, L5rnvp, L6rnvp, L7rnvp, Pays, dateInsert,
|
||||
operateurRnvp, dateEnvoiRnvp, dateRetourRnvp, codeRetour, NumVoie, BisTer, TypeVoieCourt, TypeVoieLong, LibVoie,
|
||||
Cp, Ville, Insee, CQadrs, CorrectionImportante, CorrectionDouteuse, HexaCle, CQL3, InseeGlobal, OldInsee,
|
||||
IsInseeReconstitue, NumDept, IdHexavia, IdHexaposte, Iris_Rivoli, Iris_Ilot99, Iris_CodeIris, Iris_Canton,
|
||||
Iris_Zus, Iris_Zfu, CqIris, dateUpdate',
|
||||
"source=$source AND source_id=$source_id AND num=$num LIMIT 0,1",false, MYSQL_ASSOC);
|
||||
$tabRet=$ret[0];
|
||||
$tabRet['CQadrsLib']=$this->tabAdrCQ[$tabRet['CQadrs']];
|
||||
$tabRet = $ret[0];
|
||||
|
||||
$tabRet['CQAdrRnvp']=$this->getLibQualiteAdresse76310($tabRet['CQadrs'], $tabRet['CorrectionDouteuse']);
|
||||
$tabRet['CQadrsLib'] = $this->tabAdrCQ[$tabRet['CQadrs']];
|
||||
$tabRet['CQAdrRnvp'] = $this->getLibQualiteAdresse76310($tabRet['CQadrs'], $tabRet['CorrectionDouteuse']);
|
||||
|
||||
return $tabRet;
|
||||
}
|
||||
|
@ -1,225 +0,0 @@
|
||||
<?php
|
||||
class Metier_Partenaires_MSigVille
|
||||
{
|
||||
private $client;
|
||||
|
||||
private $url='http://sig.ville.gouv.fr/recherche-adresses-zus-zfu-quartiers-des-cucs';
|
||||
private $referer='';
|
||||
private $codeRetour;
|
||||
private $page;
|
||||
private $body;
|
||||
private $cookie='';
|
||||
private $timeout=5;
|
||||
private $duree=false;
|
||||
|
||||
function __construct() {
|
||||
if ($this->cookie=='') {
|
||||
$tdeb=microtime(1);
|
||||
$this->page=getUrl($this->url, $this->cookie, '', $this->referer, false, 'sig.ville.gouv.fr', '', $this->timeout);
|
||||
$this->duree=round(microtime(1)-$tdeb,3);
|
||||
$this->referer=$this->url;
|
||||
$this->body=$page['body'];
|
||||
$this->codeRetour=$page['code'];
|
||||
$this->header=$page['header'];
|
||||
$this->cookie=$this->header['Cookie'];
|
||||
if ($this->codeRetour<>200) return false;
|
||||
}
|
||||
}
|
||||
|
||||
function getZonage($adrNum, $adrIndRep, $adrTypeVoie, $adrLibVoie, $cp, $ville='', $codeRivoli='', $rnvp=false, $raisonSociale='TEST', $debug=false) {
|
||||
if ($this->cookie<>'') {
|
||||
$tdeb=microtime(1);
|
||||
$post=array('insee_com'=>'01053',
|
||||
'code_postal'=>'01000',
|
||||
'nom_commune'=>'Bourg-en-Bresse',
|
||||
'num_adresse'=>'8',
|
||||
'id_voie'=>28,
|
||||
'nom_voie'=>'RUE+DES+BLANCHISSERIES',
|
||||
'x'=>33,
|
||||
'y'=>19,
|
||||
);
|
||||
$this->page=getUrl($this->url, $this->cookie, $post, $this->referer, false, 'sig.ville.gouv.fr', '', $this->timeout);
|
||||
$this->duree=round(microtime(1)-$tdeb,3);
|
||||
$this->referer=$this->url;
|
||||
$this->body=$page['body'];
|
||||
$this->codeRetour=$page['code'];
|
||||
$this->header=$page['header'];
|
||||
$this->cookie=$this->header['Cookie'];
|
||||
if ($this->codeRetour<>200) return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$tabRep=array();
|
||||
if (!$rnvp) {
|
||||
if ($cp<10000) $cp='0'.$cp;
|
||||
$dep2=substr($cp,0,2)*1;
|
||||
$dep3=substr($cp,0,3)*1;
|
||||
switch ($dep2) {
|
||||
case 0:
|
||||
case 5:
|
||||
case 9:
|
||||
case 15:
|
||||
case 19:
|
||||
case 23:
|
||||
case 32:
|
||||
case 46:
|
||||
case 48:
|
||||
case 82:
|
||||
case 97: // DOM
|
||||
case 98: // TOM
|
||||
case 99: // Etranger
|
||||
return $tabRep;
|
||||
break;
|
||||
default:
|
||||
//if ($dep3==975) return $tabRep;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$iDb=new WDB();
|
||||
$adresse=addslashes(trim(preg_replace('/ +/',' ', "$adrNum $adrIndRep $adrTypeVoie $adrLibVoie")));
|
||||
$ville=addslashes($ville);
|
||||
$ret=$iDb->select( 'jo.zonage', 'zus, zru, zfu, cucs', "address='$adresse' AND adr_cp='$cp' AND adr_ville='$ville'",false, MYSQL_ASSOC);
|
||||
if (count($ret)>0) {
|
||||
$zones=$ret[0];
|
||||
$tabRep['ZUS']=$tabRep['ZFU']=$tabRep['ZRU']=$tabRep['CUCS']='NON';
|
||||
if (trim($zones['zus'])<>'') {
|
||||
if (trim($zones['zus'])=='NSP') $tabRep['ZUS']='NSP';
|
||||
else $tabRep['ZUS']='OUI';
|
||||
$tabRep['NZUS']=$zones['zus'];
|
||||
}
|
||||
if (trim($zones['zru'])<>'') {
|
||||
if (trim($zones['zru'])=='NSP') $tabRep['ZRU']='NSP';
|
||||
else $tabRep['ZRU']='OUI';
|
||||
$tabRep['NZRU']=$zones['zru'];
|
||||
}
|
||||
if (trim($zones['zfu'])<>'') {
|
||||
if (trim($zones['zfu'])=='NSP') $tabRep['ZFU']='NSP';
|
||||
else $tabRep['ZFU']='OUI';
|
||||
$tabRep['NZFU']=$zones['zfu'];
|
||||
}
|
||||
if (trim($zones['cucs'])<>'') {
|
||||
if (trim($zones['cucs'])=='NSP') $tabRep['CUCS']='NSP';
|
||||
else $tabRep['CUCS']='OUI';
|
||||
$tabRep['NCUCS']=$zones['cucs'];
|
||||
}
|
||||
//return $tabRep;
|
||||
} else {
|
||||
|
||||
try {
|
||||
if (trim($raisonSociale)=='') $raisonSociale='TEST'; // Le RNVP ne fonctionne pas sans la Raison Sociale qui est la 1ère ligne d'adresse
|
||||
$rep=$this->client->zonage( new SoapParam(strtr("$raisonSociale:$adresse:$cp:$ville",
|
||||
'¿°ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûýýþÿ??',
|
||||
' aaaaaaaceeeeiiiidnoooooouuuuybsaaaaaaaceeeeiiiidnoooooouuuyybyRr'),'adresse'),
|
||||
new SoapParam(':','separateur'),
|
||||
new SoapParam('type=M','options')
|
||||
);
|
||||
/*$rep=$this->client->zonage( "<adresse></adresse>".
|
||||
"<separateur>:</separateur>".
|
||||
"<options>type=M</options>");*/
|
||||
|
||||
/** Découpage des ZFU, CUCS etcs...
|
||||
**/
|
||||
$fp=fopen(LOG_PATH.'/amabis.log', 'a');
|
||||
fwrite($fp, date('d-m-Y H:i:s').' - '.implode("\n", $rep)."\n============================================================================\n");
|
||||
fclose($fp);
|
||||
|
||||
$tabZones=explode(',',$rep['zonage']); // ZUS=OUI,NZUS=1127020,ZFU=OUI,NZFU=11270ZF,CUCS=OUI,NCUCS=1127020
|
||||
foreach ($tabZones as $zone) {
|
||||
$tabTmp=explode('=',$zone);
|
||||
if (trim($tabTmp[0])<>'')
|
||||
$tabRep[$tabTmp[0]]=$tabTmp[1];
|
||||
}
|
||||
if ($tabRep['ZUS']=='NSP') $tabRep['NZUS']='NSP';
|
||||
if ($tabRep['ZRU']=='NSP') $tabRep['NZRU']='NSP';
|
||||
if ($tabRep['ZFU']=='NSP') $tabRep['NZFU']='NSP';
|
||||
if ($tabRep['CUCS']=='NSP') $tabRep['NCUCS']='NSP';
|
||||
$adresse=stripslashes(trim(preg_replace('/ +/',' ', "$adrNum $adrIndRep $adrTypeVoie $adrLibVoie")));
|
||||
$ville=stripslashes($ville);
|
||||
$tabInsert=array( 'address'=>$adresse,
|
||||
'adr_cp'=>$cp,
|
||||
'adr_ville'=>$ville,
|
||||
'zus'=>$tabRep['NZUS'],
|
||||
'zru'=>$tabRep['NZRU'],
|
||||
'zfu'=>$tabRep['NZFU'],
|
||||
'cucs'=>$tabRep['NCUCS'],
|
||||
'adrNum'=>$adrNum,
|
||||
'adrIndRep'=>$adrIndRep,
|
||||
'adrTypeVoie'=>$adrTypeVoie,
|
||||
'adrLibVoie'=>$adrLibVoie,
|
||||
'rivoli'=>$codeRivoli,
|
||||
);
|
||||
$iDb->insert('jo.zonage', $tabInsert);
|
||||
|
||||
/** Autres Informations de la RNVP
|
||||
**/
|
||||
if ($rnvp || $debug) {
|
||||
$tabRepTmp=array();
|
||||
$tabZones=explode(',',$rep['objdesc']);
|
||||
foreach ($tabZones as $zone) {
|
||||
$tabTmp=explode('=',$zone);
|
||||
if (trim($tabTmp[0])<>'')
|
||||
$tabRepTmp[$tabTmp[0]]=$tabTmp[1];
|
||||
}
|
||||
if (!$debug) {
|
||||
$tabRep['ADR1']=@$tabRepTmp['ADR1'];
|
||||
$tabRep['ADR2']=@$tabRepTmp['ADR2'];
|
||||
$tabRep['ADR3']=@$tabRepTmp['ADR3'];
|
||||
$tabRep['ADR4']=@$tabRepTmp['ADR4'];
|
||||
$tabRep['ADR5']=@$tabRepTmp['ADR5'];
|
||||
$tabRep['ADR6']=@$tabRepTmp['ADR6'];
|
||||
$tabRep['ADR7']=@$tabRepTmp['ADR7'];
|
||||
} else {
|
||||
$tabRep=array_merge($tabRep, $tabRepTmp);
|
||||
}
|
||||
}
|
||||
} catch (SoapFault $fault) {
|
||||
echo 'ERREUR SOAP :'.EOL;
|
||||
print_r($fault);
|
||||
echo $this->client->__getLastRequest()."\n";
|
||||
echo $this->client->__getLastResponse()."\n";
|
||||
$fp=fopen(LOG_PATH.'/amabis.log', 'a');
|
||||
fwrite($fp, date('d-m-Y H:i:s').' - ERREUR SOAP : Requete = '.$this->client->__getLastRequest()."\n Reponse = ".$this->client->__getLastResponse()."\n============================================================================\n");
|
||||
fclose($fp);
|
||||
}
|
||||
//return $tabRep;
|
||||
}
|
||||
$codeInsee=substr($codeRivoli,0,5);
|
||||
$ret=$iDb->select( 'jo.zonageInsee', 'typeZone, arreteDate, decretDate, decretNum, decretModifieDate, decretModifieNum, dateDebut, dateFin', "codeInsee='$codeInsee'",false, MYSQL_ASSOC);
|
||||
$tabRep['ZRR']=$tabRep['AFR']='NON';
|
||||
foreach ($ret as $zones)
|
||||
switch ($zones['typeZone']) {
|
||||
case 'ZRR': $tabRep['ZRR']='OUI'; $tabRep['NZRR']=$codeInsee; break;
|
||||
case 'ZAFR': $tabRep['AFR']='OUI'; $tabRep['NAFR']=$codeInsee; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
return $tabRep;
|
||||
}
|
||||
|
||||
function searchByTelFax($tel) {
|
||||
return $this->getTelFax('','','','',$tel);
|
||||
}
|
||||
|
||||
function getTelFax($nom, $cp, $ville='', $prenom='', $tel='') {
|
||||
if (trim($tel)<>'')
|
||||
$query="<telep>$tel</telep><scoremini>10</scoremini><distinction>30</distinction>";
|
||||
elseif (trim($prenom)=='')
|
||||
$query="<rs>$nom</rs><cpville>$cp $ville</cpville><scoremini>90</scoremini><distinction>30</distinction>";
|
||||
else
|
||||
$query="<nom>$nom</nom><prenom>$prenom</prenom><cpville>$cp $ville</cpville><scoremini>90</scoremini><distinction>30</distinction>";
|
||||
|
||||
$rep=$this->client->rechtel($query);
|
||||
|
||||
$fp=fopen(LOG_PATH.'/amabis.log', 'a');
|
||||
fwrite($fp, date('d-m-Y H:i:s')." - $query - ".implode("\n", $rep)."\n============================================================================\n");
|
||||
fwrite($fp, "Requête : ".$this->client->__getLastRequest()."\n");
|
||||
fwrite($fp, "Réponse : ".$this->client->__getLastResponse()."\n");
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -1,7 +1,5 @@
|
||||
<?php
|
||||
require_once 'framework/common/mysql.php';
|
||||
require_once 'framework/common/curl.php';
|
||||
require_once 'framework/common/strings.php';
|
||||
|
||||
class Metier_Partenaires_MTel
|
||||
{
|
||||
@ -31,7 +29,7 @@ class Metier_Partenaires_MTel
|
||||
$this->codeRetour=$page['code'];
|
||||
}
|
||||
if ( $db === null ) {
|
||||
$this->iDb = new WDB();
|
||||
$this->iDb = new Metier_Util_Db();
|
||||
} else {
|
||||
$this->iDb = $db;
|
||||
}
|
||||
@ -259,7 +257,7 @@ class Metier_Partenaires_MTel
|
||||
$tabRet[]=array(
|
||||
'siren'=>$siren,
|
||||
'nic'=>substr($res['siret'],-5),
|
||||
'typeTel'=>trimAccent($tabT['telFax']),
|
||||
'typeTel'=>Metier_Util_String::trimAccent($tabT['telFax']),
|
||||
'infoTel'=>$tabT['type'],
|
||||
'telephone'=>$tabT['telNum'],
|
||||
'actif'=>1,
|
||||
@ -268,7 +266,7 @@ class Metier_Partenaires_MTel
|
||||
'siren'=>$siren,
|
||||
'nic'=>substr($res['siret'],-5),
|
||||
'dateProvPartenaire'=>date('Ymd'),
|
||||
'typeTel'=>trimAccent($tabT['telFax']),
|
||||
'typeTel'=>Metier_Util_String::trimAccent($tabT['telFax']),
|
||||
'infoTel'=>$tabT['type'],
|
||||
'telephone'=>$tabT['telNum'],
|
||||
'actif'=>1,
|
||||
|
@ -1,4 +1,6 @@
|
||||
<?php
|
||||
require_once 'framework/common/curl.php';
|
||||
|
||||
class Metier_Partenaires_MTva
|
||||
{
|
||||
public $vatNumber = ''; // Numéro de TVA retourné
|
||||
@ -19,7 +21,7 @@ class Metier_Partenaires_MTva
|
||||
}
|
||||
|
||||
if ( $db === null ) {
|
||||
$this->iDb = new WDB();
|
||||
$this->iDb = new Metier_Util_Db();
|
||||
} else {
|
||||
$this->iDb = $db;
|
||||
}
|
||||
@ -66,16 +68,16 @@ class Metier_Partenaires_MTva
|
||||
'ISO'=>'FR',
|
||||
'MS'=>'FR'
|
||||
);*/
|
||||
$tdeb = microtime_float();
|
||||
$tdeb = microtime(true);
|
||||
// $url='http://ec.europa.eu/taxation_customs/vies/cgi-bin/viesquer';
|
||||
// $referer='http://ec.europa.eu/taxation_customs/vies/fr/vieshome.htm';
|
||||
$url='http://ec.europa.eu/taxation_customs/vies/viesquer.do';
|
||||
$referer='http://ec.europa.eu/taxation_customs/vies/';
|
||||
|
||||
$page=getUrl($url, '', $postData, $referer, false, 'ec.europa.eu', '', 15);
|
||||
$duree = round(microtime_float()-$tdeb, 3);
|
||||
$duree = round(microtime(true)-$tdeb, 3);
|
||||
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__);
|
||||
Metier_Util_Log::write('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";
|
||||
$this->vatDefined=false;
|
||||
return true;
|
||||
@ -88,9 +90,9 @@ class Metier_Partenaires_MTva
|
||||
$tabUpdate=array('cle'=>$cle, 'duree'=>$duree);
|
||||
if (!$this->iDb->insert('sdv1.siren_tva', $tabInsert))
|
||||
if (!$this->iDb->update('sdv1.siren_tva', $tabUpdate, "siren=$siren"))
|
||||
debugLog('W', "Siren $siren, numéro de TVA = FR $cle $siren, impossible de MAJ la clef ($duree s) - ERREUR MySql n°". mysql_errno() .' : '. mysql_error(), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
Metier_Util_Log::write('W', "Siren $siren, numéro de TVA = FR $cle $siren, impossible de MAJ la clef ($duree s) - ERREUR MySql n°". mysql_errno() .' : '. mysql_error(), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
//echo date ('Y/m/d - H:i:s') ." - Ligne $k/$nbk, N°TVA FR $cle $siren validé .".$eol;
|
||||
debugLog('I', "Siren $siren, numéro de TVA = FR $cle $siren ($duree s)", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
Metier_Util_Log::write('I', "Siren $siren, numéro de TVA = FR $cle $siren ($duree s)", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
$this->vatNumber="FR$cle$siren";
|
||||
$this->vatDefined=true;
|
||||
return true;
|
||||
@ -99,8 +101,8 @@ class Metier_Partenaires_MTva
|
||||
$nbIndispo++;
|
||||
if ($nbIndispo<3) {
|
||||
//echo date ('Y/m/d - H:i:s') .' - '.$eol;
|
||||
debugLog('I', "TVA Siren $siren, Service de l'état membre indisponible. Mise en sommeil...", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
randsleep(1,2);
|
||||
Metier_Util_Log::write('I', "TVA Siren $siren, Service de l'état membre indisponible. Mise en sommeil...", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
sleep(rand(1, 2));
|
||||
$nbIndispo=0;
|
||||
//echo date ('Y/m/d - H:i:s') .' - Reprise du Siren = '. $siren . $eol;
|
||||
} else {
|
||||
@ -108,8 +110,8 @@ class Metier_Partenaires_MTva
|
||||
$tabUpdate=array('cle'=>'NULL', 'duree'=>$duree);
|
||||
if (!$this->iDb->insert('sdv1.siren_tva', $tabInsert))
|
||||
if (!$this->iDb->update('sdv1.siren_tva', $tabUpdate, "siren=$siren"))
|
||||
debugLog('W', "Siren $siren, numéro de TVA = FR $cle $siren, impossible de MAJ la clef ($duree s) - ERREUR MySql n°". mysql_errno() .' : '. mysql_error(), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
debugLog('I', "Siren $siren, numéro de TVA = FR $cle $siren vérification non disponible ($duree s)", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
Metier_Util_Log::write('W', "Siren $siren, numéro de TVA = FR $cle $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 $siren, numéro de TVA = FR $cle $siren vérification non disponible ($duree s)", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
$this->vatNumber="FR$cle$siren";
|
||||
$this->vatDefined=false;
|
||||
return true;
|
||||
@ -120,8 +122,8 @@ class Metier_Partenaires_MTva
|
||||
$tabUpdate=array('cle'=>'NULL', 'duree'=>$duree);
|
||||
if (!$this->iDb->insert('sdv1.siren_tva', $tabInsert))
|
||||
if (!$this->iDb->update('sdv1.siren_tva', $tabUpdate, "siren=$siren"))
|
||||
debugLog('W', "Siren $siren, numéro de TVA = FR $cle $siren, impossible de MAJ la clef ($duree s) - ERREUR MySql n°". mysql_errno() .' : '. mysql_error(), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
debugLog('I', "Siren $siren, numéro de TVA = FR $cle $siren non attribué ($duree s)", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
Metier_Util_Log::write('W', "Siren $siren, numéro de TVA = FR $cle $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 $siren, numéro de TVA = FR $cle $siren non attribué ($duree s)", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
$this->vatNumber="FR$cle$siren";
|
||||
$this->vatDefined=false;
|
||||
return true;
|
||||
@ -134,132 +136,147 @@ class Metier_Partenaires_MTva
|
||||
$this->vatDefined=false;
|
||||
return true;
|
||||
}
|
||||
debugLog('W', "Erreur impossible (car l'algo ne devrait pas passer par ici) sur le Siren $siren, numéro de TVA = FR $cle $siren. Durée = $duree s. Cas impossible !", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
Metier_Util_Log::write('W', "Erreur impossible (car l'algo ne devrait pas passer par ici) sur le Siren $siren, numéro de TVA = FR $cle $siren. Durée = $duree s. Cas impossible !", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
return true;//array('error'=>array('errnum'=>800, 'errmsg'=>'Erreur SGBDR'), 'result'=>$tabRet);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
** Génère la clé du numéro de TVA pour le siren fournit
|
||||
** (la validité du numéro de siren et son existance n'est pas effectué par cette méthode)
|
||||
**
|
||||
** @param integer $siren Siren dont il faut générer la clé
|
||||
** @return La clé du numéro de TVA
|
||||
**/
|
||||
private function genereCleFr() {
|
||||
|
||||
$siren=$this->siren;
|
||||
|
||||
* Génère la clé du numéro de TVA pour le siren fournit
|
||||
* (la validité du numéro de siren et son existance n'est pas effectué par cette méthode)
|
||||
*
|
||||
* @return number
|
||||
* La clé du numéro de TVA
|
||||
*/
|
||||
private function genereCleFr()
|
||||
{
|
||||
// Position du chiffre SIREN (1 à 9)
|
||||
$tabFirst=array();
|
||||
$tabFirst[0]=array( 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
$tabFirst[1]=array(62,47,94,89,40,06,22,43,16);
|
||||
$tabFirst[2]=array(14,81,78,68,67,96,31,73,19);
|
||||
$tabFirst[3]=array(63,18,62,47,94,89,40,06,22);
|
||||
$tabFirst[4]=array(15,52,46,26,24,82,49,36,25);
|
||||
$tabFirst[5]=array(64,86,30,05,51,75,58,66,28);
|
||||
$tabFirst[6]=array(16,23,14,81,78,68,67,96,31);
|
||||
$tabFirst[7]=array(65,57,95,60,08,61,76,29,34);
|
||||
$tabFirst[8]=array(17,91,79,39,35,54,85,59,37);
|
||||
$tabFirst[9]=array(66,28,63,18,62,47,94,89,40);
|
||||
$tabFirst = array(
|
||||
array( 0, 0, 0, 0, 0, 0, 0, 0, 0),
|
||||
array(62,47,94,89,40,06,22,43,16),
|
||||
array(14,81,78,68,67,96,31,73,19),
|
||||
array(63,18,62,47,94,89,40,06,22),
|
||||
array(15,52,46,26,24,82,49,36,25),
|
||||
array(64,86,30,05,51,75,58,66,28),
|
||||
array(16,23,14,81,78,68,67,96,31),
|
||||
array(65,57,95,60,08,61,76,29,34),
|
||||
array(17,91,79,39,35,54,85,59,37),
|
||||
array(66,28,63,18,62,47,94,89,40),
|
||||
);
|
||||
|
||||
// Chiffre 0 à 9
|
||||
$tabPoids=array(1,34,-16,-21,27,-7,9,30,3);
|
||||
$cle=$first=0;
|
||||
$tabPoids = array(1,34,-16,-21,27,-7,9,30,3);
|
||||
$cle = $first = 0;
|
||||
for($pos=0; $pos<9; $pos++) {
|
||||
$chiffre=$siren[$pos];
|
||||
if ($first==0) {
|
||||
$first=$cle=$tabFirst[$chiffre][$pos];
|
||||
$chiffre = $this->siren[$pos];
|
||||
if ($first == 0) {
|
||||
$first = $cle = $tabFirst[$chiffre][$pos];
|
||||
} else {
|
||||
$cle+=$tabPoids[$pos]*$chiffre;
|
||||
$cle += $tabPoids[$pos] * $chiffre;
|
||||
}
|
||||
}
|
||||
while(true) {
|
||||
if ($cle>96) $cle=$cle-97;
|
||||
elseif ($cle<0) $cle=$cle+97;
|
||||
else break;
|
||||
if ($cle > 96) {
|
||||
$cle = $cle - 97;
|
||||
}
|
||||
elseif ($cle < 0) {
|
||||
$cle = $cle + 97;
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($cle == 0) {
|
||||
return 96;
|
||||
}
|
||||
if ($cle==0) return 96;
|
||||
return ($cle-1);
|
||||
}
|
||||
|
||||
|
||||
/** Test de la validité du siren demandé
|
||||
** @param int SIREN à tester
|
||||
** @param int NIC (facultatif)
|
||||
** @param mixed Message textuel d'erreur à afficher en cas d'erreur ou false
|
||||
** @return mixed true, false ou Message d'erreur passé en paramètre
|
||||
**/
|
||||
private function valideSiren($siren, $nic='', $erreur=false) {
|
||||
/**
|
||||
* Test de la validité du siren demandé
|
||||
*
|
||||
* @param int SIREN à tester
|
||||
* @param int NIC (facultatif)
|
||||
* @param mixed Message textuel d'erreur à afficher en cas d'erreur ou false
|
||||
* @return mixed true, false ou Message d'erreur passé en paramètre
|
||||
*/
|
||||
private function valideSiren($siren, $nic='', $erreur=false)
|
||||
{
|
||||
$siren = str_pad($siren, 9, '0', STR_PAD_LEFT);
|
||||
if (!empty($nic)) {
|
||||
$nic = str_pad($nic, 5, '0', STR_PAD_LEFT);
|
||||
}
|
||||
//Siren non précisé ou incorrect.
|
||||
if (!Metier_Util_String::valideData($siren, 9, 9,'N')) {
|
||||
return $erreur;
|
||||
}
|
||||
// Siren vide
|
||||
elseif (intval($siren) == 0) {
|
||||
return $erreur;
|
||||
}
|
||||
else {
|
||||
if (!isset($nic) || trim($nic)=='') {
|
||||
$somme = 0;
|
||||
// Traitement IMPAIR
|
||||
for ($i=0; $i<=8; $i+=2) {
|
||||
$somme+= (integer) substr($siren,$i,1);
|
||||
}
|
||||
// Traitement PAIR
|
||||
for ($i=1; $i<=7; $i+=2) {
|
||||
$var_tmp = (string) (2*((integer)substr($siren,$i,1)));
|
||||
$som_tmp = 0;
|
||||
for($j=0; $j<strlen($var_tmp);$j++) {
|
||||
$som_tmp+= (integer)substr($var_tmp,$j,1);
|
||||
}
|
||||
$somme+= $som_tmp;
|
||||
}
|
||||
|
||||
/** Si le siren est de taille < à 9, on ajoute des 0 significatifs **/
|
||||
switch (strlen($siren)) {
|
||||
case 1: $siren='00000000'.$siren; break;
|
||||
case 2: $siren='0000000'.$siren; break;
|
||||
case 3: $siren='000000'.$siren; break;
|
||||
case 4: $siren='00000'.$siren; break;
|
||||
case 5: $siren='0000'.$siren; break;
|
||||
case 6: $siren='000'.$siren; break;
|
||||
case 7: $siren='00'.$siren; break;
|
||||
case 8: $siren='0'.$siren; break;
|
||||
}
|
||||
|
||||
if (strlen($nic)>0) {
|
||||
switch (strlen($nic)) {
|
||||
case 1: $nic='0000'.$nic; break;
|
||||
case 2: $nic='000'.$nic; break;
|
||||
case 3: $nic='00'.$nic; break;
|
||||
case 4: $nic='0'.$nic; break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!valideData($siren, 9, 9,'N')) //Siren non précisé ou incorrect.
|
||||
return $erreur;
|
||||
elseif ($siren*1==0) // Siren vide
|
||||
return $erreur;
|
||||
else
|
||||
{
|
||||
if (!isset($nic) || trim($nic)=='')
|
||||
{
|
||||
$somme=0;
|
||||
for ($i=0; $i<=8; $i+=2) // Traitement IMPAIR
|
||||
$somme+=(integer)substr($siren,$i,1);
|
||||
|
||||
for ($i=1; $i<=7; $i+=2)
|
||||
{ // Traitement PAIR
|
||||
$var_tmp=(string)(2*((integer)substr($siren,$i,1)));
|
||||
$som_tmp=0;
|
||||
for($j=0;$j<strlen($var_tmp);$j++)
|
||||
$som_tmp+=(integer)substr($var_tmp,$j,1);
|
||||
$somme+=$som_tmp;
|
||||
}
|
||||
|
||||
if ((integer)($somme/10)!=($somme/10))
|
||||
{ // Le Siren est faux
|
||||
if (substr($siren,0,3)!='200') // Les siren débutant par 200 sont toujours valides (sirens provisoires de la BDF?!)
|
||||
return $erreur;
|
||||
}
|
||||
} else {
|
||||
if (!valideData($nic,1,5,'N')) // Nic de format incorrect.
|
||||
return $erreur;
|
||||
|
||||
$SIRET=$siren.$nic;
|
||||
$somme=0;
|
||||
for ($i=0; $i<=12; $i+=2)
|
||||
{ // Traitement PAIR
|
||||
$var_tmp=(string)(2*((integer)substr($SIRET,$i,1)));
|
||||
$som_tmp=0;
|
||||
for($j=0;$j<strlen($var_tmp);$j++)
|
||||
$som_tmp+=(integer)substr($var_tmp,$j,1);
|
||||
$somme+=$som_tmp;
|
||||
}
|
||||
for ($i=1; $i<=13; $i+=2) // Traitement IMPAIR
|
||||
$somme+=(integer)substr($SIRET,$i,1);
|
||||
|
||||
if ((integer)($somme/10)!=($somme/10))// Le Siret est faux
|
||||
return $erreur;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// Le Siren est faux
|
||||
if ((integer) ($somme/10) != ($somme/10)) {
|
||||
// Les siren débutant par 200 sont toujours valides (sirens provisoires de la BDF?!)
|
||||
if (substr($siren,0,3) != '200') {
|
||||
return $erreur;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Nic de format incorrect.
|
||||
if (!Metier_Util_String::valideData($nic,1,5,'N')) {
|
||||
return $erreur;
|
||||
}
|
||||
$SIRET = $siren.$nic;
|
||||
if ($siren == '356000000') {
|
||||
// Cas particulier du siren de LA POSTE : 356 000 000 00000
|
||||
$somme = 14;
|
||||
for ($i=9; $i<=13; $i++) {
|
||||
$somme+= (integer)substr($SIRET,$i,1);
|
||||
}
|
||||
// Le NIC de l'établissement de LA POSTE est faux !
|
||||
if ($somme%5 != 0) {
|
||||
return $erreur;
|
||||
}
|
||||
} else {
|
||||
$somme=0;
|
||||
// Traitement PAIR
|
||||
for ($i=0; $i<=12; $i+=2) {
|
||||
$var_tmp = (string) (2*((integer)substr($SIRET,$i,1)));
|
||||
$som_tmp = 0;
|
||||
for($j=0; $j<strlen($var_tmp); $j++) {
|
||||
$som_tmp+= (integer) substr($var_tmp,$j,1);
|
||||
}
|
||||
$somme+= $som_tmp;
|
||||
}
|
||||
// Traitement IMPAIR
|
||||
for ($i=1; $i<=13; $i+=2) {
|
||||
$somme+= (integer) substr($SIRET,$i,1);
|
||||
}
|
||||
// Le Siret est faux
|
||||
if ((integer) ($somme/10) != ($somme/10)) {
|
||||
return $erreur;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,772 +0,0 @@
|
||||
<?
|
||||
|
||||
class Metier_Partenaires_MSitesWeb {
|
||||
|
||||
private $whois_serveurs = array(
|
||||
"ac" => "whois.nic.ac",
|
||||
"al" => "whois.ripe.net",
|
||||
"am" => "whois.amnic.net",
|
||||
"as" => "whois.nic.as",
|
||||
"at" => "whois.ripe.net",
|
||||
"au" => "whois.aunic.net",
|
||||
"az" => "whois.ripe.net",
|
||||
"ba" => "whois.ripe.net",
|
||||
"be" => "whois.ripe.net",
|
||||
"bg" => "whois.ripe.net",
|
||||
"biz" => "whois.nic.biz",
|
||||
"br" => "whois.registro.br",
|
||||
"by" => "whois.ripe.net",
|
||||
"ca" => "whois.cira.ca",
|
||||
"cc" => "whois.nic.cc",
|
||||
"ch" => "whois.nic.ch",
|
||||
"ck" => "whois.ck-nic.org.ck",
|
||||
"cn" => "whois.cnnic.net.cn",
|
||||
"com" => "whois.crsnic.net",
|
||||
"cx" => "whois.nic.cx",
|
||||
"cy" => "whois.ripe.net",
|
||||
"cz" => "whois.nic.cz",
|
||||
"de" => "whois.denic.de",
|
||||
"dk" => "whois.dk-hostmaster.dk",
|
||||
"dz" => "whois.ripe.net",
|
||||
"edu" => "rs.internic.net",
|
||||
"ee" => "whois.ripe.net",
|
||||
"eg" => "whois.ripe.net",
|
||||
"es" => "whois.ripe.net",
|
||||
"eu" => "whois.eu",
|
||||
"fi" => "whois.ripe.net",
|
||||
"fj" => "whois.usp.ac.fj",
|
||||
"fo" => "whois.ripe.net",
|
||||
"fr" => "whois.nic.fr",
|
||||
"gb" => "whois.ripe.net",
|
||||
"ge" => "whois.ripe.net",
|
||||
"gov" => "whois.nic.gov",
|
||||
"gr" => "whois.ripe.net",
|
||||
"gs" => "whois.adamsnames.tc",
|
||||
"hk" => "whois.hknic.net.hk",
|
||||
"hm" => "whois.registry.hm",
|
||||
"hr" => "whois.ripe.net",
|
||||
"hu" => "whois.ripe.net",
|
||||
"id" => "whois.idnic.net.id",
|
||||
"ie" => "whois.domainregistry.ie",
|
||||
"info" => "whois.afilias.net",
|
||||
"int" => "whois.isi.edu",
|
||||
"il" => "whois.ripe.net",
|
||||
"is" => "whois.isnet.is",
|
||||
"it" => "whois.nic.it",
|
||||
"jp" => "whois.nic.ad.jp",
|
||||
"ke" => "whois.rg.net",
|
||||
"kg" => "whois.domain.kg",
|
||||
"kr" => "whois.nic.or.kr",
|
||||
"kz" => "whois.domain.kz",
|
||||
"li" => "whois.nic.li",
|
||||
"lk" => "whois.nic.lk",
|
||||
"lt" => "whois.ripe.net",
|
||||
"lu" => "whois.ripe.net",
|
||||
"lv" => "whois.ripe.net",
|
||||
"ma" => "whois.ripe.net",
|
||||
"md" => "whois.ripe.net",
|
||||
"mil" => "whois.nic.mil",
|
||||
"mk" => "whois.ripe.net",
|
||||
"mm" => "whois.nic.mm",
|
||||
"ms" => "whois.adamsnames.tc",
|
||||
"mt" => "whois.ripe.net",
|
||||
"mx" => "whois.nic.mx",
|
||||
"net" => "rs.internic.net",
|
||||
"nl" => "whois.domain-registry.nl",
|
||||
"no" => "whois.norid.no",
|
||||
"nu" => "whois.nic.nu",
|
||||
"nz" => "whois.domainz.net.nz",
|
||||
"org" => "whois.pir.org",
|
||||
"pl" => "whois.ripe.net",
|
||||
"pk" => "whois.pknic.net.pk",
|
||||
"pt" => "whois.ripe.net",
|
||||
"ro" => "whois.ripe.net",
|
||||
"ru" => "whois.ripn.ru",
|
||||
"se" => "whois.nic-se.se",
|
||||
"sg" => "whois.nic.net.sg",
|
||||
"si" => "whois.ripe.net",
|
||||
"sh" => "whois.nic.sh",
|
||||
"sk" => "whois.ripe.net",
|
||||
"sm" => "whois.ripe.net",
|
||||
"st" => "whois.nic.st",
|
||||
"su" => "whois.ripe.net",
|
||||
"tc" => "whois.adamsnames.tc",
|
||||
"tf" => "whois.adamsnames.tc",
|
||||
"tj" => "whois.nic.tj",
|
||||
"th" => "whois.thnic.net",
|
||||
"tm" => "whois.nic.tm",
|
||||
"tn" => "whois.ripe.net",
|
||||
"to" => "whois.tonic.to",
|
||||
"tr" => "whois.ripe.net",
|
||||
"tw" => "whois.twnic.net",
|
||||
"ua" => "whois.ripe.net",
|
||||
"uk" => "whois.nic.uk",
|
||||
"us" => "whois.isi.edu",
|
||||
"va" => "whois.ripe.net",
|
||||
"vg" => "whois.adamsnames.tc",
|
||||
"ws" => "whois.nic.ws",
|
||||
"yu" => "whois.ripe.net",
|
||||
"za" => "whois.frd.ac.za");
|
||||
|
||||
private $iInsee;
|
||||
private $iDb;
|
||||
|
||||
function __construct(/*$siren, $accesDist=true*/) {
|
||||
$this->iInsee=new Metier_Insee_MInsee();
|
||||
$this->iDb=new WDB();
|
||||
}
|
||||
|
||||
/** L'adresse IP est elle valide ?
|
||||
* @param $ip Adresse IP v4
|
||||
*/
|
||||
function isIpValide($ip) {
|
||||
$ip_explode = explode('.',$ip);
|
||||
$nb_valide = 0;
|
||||
foreach ($ip_explode as $element)
|
||||
if ($element>=0 && $element<255)
|
||||
$nb_valide++;
|
||||
if ($nb_valide==4) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
function getInfosSiteWeb($url) {
|
||||
$tabRet=array('url'=>$url, 'url_valide'=>0);
|
||||
// Est-ce une URL valide en paramètre ?
|
||||
if(preg_match('|^(http(s)?://)?[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $url)) {
|
||||
//$tabRet['url']=preg_replace('/^http\/\//', 'http://', $url);
|
||||
$tabRet['url_valide']=1;
|
||||
$info=parse_url($url);
|
||||
$host=@preg_replace('/\/$/','',$info['host']);
|
||||
$ext=getFileExtension($host);
|
||||
$domaine=getFileExtension(preg_replace("/\.$ext$/",'','.'.$host));
|
||||
$tabRet['url_scheme']=@$info['scheme'];
|
||||
$tabRet['url_host']=@$info['host'];
|
||||
$tabRet['url_path']=@$info['path'];
|
||||
$tabRet['url_query']=@$info['query'];
|
||||
$tabRet['url_fragment']=@$info['fragment'];
|
||||
|
||||
$tabRet['domaine']="$domaine.$ext";
|
||||
$tabRet['domaine_valide']=0;
|
||||
// Le nom de domaine est il actif ?
|
||||
if (checkdnsrr("$domaine.$ext")) {
|
||||
$tabRet['domaine_valide']=1;
|
||||
$ip=gethostbyname("$domaine.$ext");
|
||||
if ($this->isIpValide($ip)) $tabRet['ip']=$ip;
|
||||
$page=getUrl("http://$host", '', '', '', false, "$domaine.$ext", '', 3, 0);
|
||||
// Le site est il actif ?
|
||||
if ($page['code']==400 || $page['code']==408) {
|
||||
$tabRet['erreur_num']=@$page['header']['curl_errno'];
|
||||
$tabRet['erreur_txt']=@$page['header']['curl_error'];
|
||||
} else {
|
||||
/** @todo Vérifier les pages de parking et les sites non encore terminés **/
|
||||
$tabRet['code']=$page['code'];
|
||||
//$tabRet['header']=$page['header'];
|
||||
$tabRet['header_server']=trim($page['header']['Server']);
|
||||
$tabRet['header_location']=trim($page['header']['Location']);
|
||||
$tabRet['header_powerby']=trim($page['header']['X-Powered-By']);
|
||||
$tabRet['header_content']=trim($page['header']['Content-Type']);
|
||||
$tabRet['html_size']=strlen($page['body']);
|
||||
if (preg_match('/<head>(.*)<\/head>/Uis',$page['body'],$matches)) {
|
||||
$html_head=$matches[1];
|
||||
$tabRet['html_head']=$html_head;
|
||||
if (preg_match('/<title>(.*)<\/title>/Uis',$html_head,$matches))
|
||||
$tabRet['html_title']=utf8_decode(trim($matches[1]));
|
||||
if (preg_match_all('/<meta\s+name(?:\s+|)=(.*)\scontent(?:\s+|)=(.*)>/Uis',$html_head,$matches)) {
|
||||
foreach ($matches[1] as $i=>$metaName) {
|
||||
$meta=strtolower(trim(strtr($metaName, array('"'=>'', "'"=>''))));
|
||||
$content=utf8_decode(preg_replace('/^(?:\s+|)("|\')/Uis','',
|
||||
preg_replace('/("|\')(?:\s+|)(?:\/|)$/Uis','',
|
||||
$matches[2][$i])));
|
||||
switch ($meta) {
|
||||
case 'title':
|
||||
$meta='metatitle';
|
||||
case 'content-language':
|
||||
$meta='language';
|
||||
case 'languages':
|
||||
$meta='language';
|
||||
case 'language':
|
||||
case 'revisit-after':
|
||||
case 'coverage':
|
||||
case 'copyright':
|
||||
case 'author':
|
||||
case 'rating':
|
||||
case 'resource-type':
|
||||
case 'classification':
|
||||
case 'distribution':
|
||||
case 'doc-rights':
|
||||
case 'doc-type':
|
||||
case 'robots':
|
||||
case 'keywords':
|
||||
case 'description':
|
||||
case 'generator':
|
||||
case 'category':
|
||||
case 'owner':
|
||||
case 'identifier-url':
|
||||
$tabRet['html_'.$meta]=utf8_decode(trim($content));
|
||||
break;
|
||||
default:
|
||||
echo "$meta='$content'".EOL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $tabRet;
|
||||
}
|
||||
|
||||
function getInfosAfnic($siteWeb) {
|
||||
$referer='http://www.afnic.fr/';
|
||||
$url='http://www.afnic.fr/outils/whois/'.$siteWeb;
|
||||
$page=getUrl($url, '', '', $referer);
|
||||
if ($page['code']==200) {
|
||||
$tabRet=array();
|
||||
if (preg_match('/<b>Bureau d’enregistrement \: <\/b>.*">(.*)<\/a><br>/Uis',$page['body'],$matches))
|
||||
$tabRet['registrar']=$matches[1];
|
||||
if (preg_match('/<\/noscript><b>État \:<\/b>(.*)<\/b>/Uis',$page['body'],$matches)) {
|
||||
$tabRet['etat']=trim($matches[1]); /*
|
||||
Actif (consultez aussi le <b><a href="http://www.decideo.fr" class="ext" target="_BLANC">Site web</a>*/
|
||||
if (preg_match('/<b><a href="(.*)"/Uis',$tabRet['etat'],$matches))
|
||||
$tabRet['siteWeb']=trim($matches[1]);
|
||||
$tmp=explode(' (', $tabRet['etat']);
|
||||
$tabRet['etat']=$tmp[0];
|
||||
}
|
||||
if (preg_match('/<b>Date de création \: <\/b>(.*)<br>/Uisu',$page['body'],$matches))
|
||||
$tabRet['dateCrea']=$matches[1];
|
||||
if (preg_match('/<b>Date anniversaire \: <\/b>(.*)<br>/Uis',$page['body'],$matches))
|
||||
$tabRet['dateAnniv']=trim($matches[1]);
|
||||
|
||||
if (preg_match("/<span class=h1>Titulaire \: <\/span>(.*)<br><div style='clear\: both;'><\/div>/Uis",$page['body'],$matches)) {
|
||||
$strTitu=trim($matches[1]);
|
||||
if (preg_match("/<span class=bleuvif>(.*)<\/span><\/h2>/Uis",$strTitu,$matches))
|
||||
$tabRet['tituNom']=trim($matches[1]);
|
||||
if (preg_match("/<noscript><div id='Layer2' style='display\: block;'><\/noscript>(.*)<b>/Uis",$strTitu,$matches)) {
|
||||
$tabRet['tituAdr']=strip_tags(trim($matches[1]));
|
||||
$tmp=$this->iInsee->structureVoie($tabRet['tituAdr']);
|
||||
$tabRet['tituAdrNum']=$tmp['num'];
|
||||
$tabRet['tituAdrCp']=$tmp['cp'];
|
||||
$tabRet['tituAdrVille']=preg_replace('/ FRANCE$/','',trim($tmp['ville']));
|
||||
$tabRet['tituAdrTypVoie']=$tmp['typeVoie'];
|
||||
$tabRet['tituAdrLibVoie']=$tmp['libVoie'];
|
||||
$tabRet['tituAdrComp']=$tmp['adrComp0'];
|
||||
}
|
||||
if (preg_match("/<b>Téléphone \: <\/b>(.*)<br>/Uisu",$strTitu,$matches))
|
||||
$tabRet['tituTel']=trim($matches[1]);
|
||||
if (preg_match('/<b>Courrier électronique \: <\/b> <a href="mailto:(.*)">/Uisu',$strTitu,$matches))
|
||||
$tabRet['tituMel']=trim($matches[1]);
|
||||
}
|
||||
|
||||
if(preg_match('/<li>Identifié grâce au numéro de SIREN <a href="(?:.*) target="_blank" class="ext">(.*)<\/a><\/li>/Uisu', $page['body'], $matches))
|
||||
$tabRet['siren']=html_entity_decode($matches[1]);
|
||||
elseif (preg_match('/<li>Identifié grâce à la marque française \((.*)\) <\/li>/Uisu', $page['body'], $matches))
|
||||
$tabRet['marquefr']=html_entity_decode($matches[1]);
|
||||
} else
|
||||
return $page['code'];
|
||||
|
||||
return $tabRet;
|
||||
}
|
||||
|
||||
function findSiteWeb($siren, $nomEntrep='') {
|
||||
// Recherche BING
|
||||
$appId = '56D6CBA671C986D3EA11B1B48F97507BC5A00D51';
|
||||
$numResults = 50;
|
||||
$cultureInfo = 'fr-FR';
|
||||
|
||||
$siren2=implode(' ', str_split($siren, 3));
|
||||
if ($nomEntrep<>'') $rs2="OR \"$nomEntrep\"";
|
||||
$tabSitesExclus=array('societe.com','bilans.net','gouv.fr','info-financiere.fr','bodacc.fr','manageo.fr','bilansgratuits.fr','lesechos.fr','google.fr');
|
||||
|
||||
$rs="$siren OR \"$siren2\" $rs2 -site:".implode(' -site:', $tabSitesExclus);
|
||||
|
||||
$query=stripslashes(urlencode($rs));
|
||||
|
||||
$tabSources=array( 'web'=>'Web page results',
|
||||
/*'image'=>'Full-size image and thumbnail image information, including the file size in bytes (if available), height and width in pixels (if available), and the URI to the full-size image or thumbnail',
|
||||
'instantAnswer'=>'Answers. The result fields returned for requests that specify InstantAnswer vary based on the value or values specified for the Query property. InstantAnswer results can include Encarta, FlightStatus, Finance, Music, Sports, Weather, and Movie ShowTimes. For the Version 2.0 release, results include Encarta and FlightStatus only. Other results are available by invitation',
|
||||
'mobileWeb'=>'Mobile Web page results (primarily Extensible Hypertext Markup Language (XHTML) and Wireless Markup Language (WML)',
|
||||
'phoneBook'=>'Results from online White Pages (residential) and Yellow Pages (commercial) entries',
|
||||
'relatedSearch'=>'Suggestions for other searches related to the query term or terms',
|
||||
'spell'=>'Spelling suggestions',
|
||||
'translation'=>'Translated results for a queried',
|
||||
'video'=>'Video results',*/
|
||||
//'news'=>'Results from online news services',
|
||||
);
|
||||
$source=implode('+', array_keys($tabSources));
|
||||
|
||||
$url="http://api.bing.net/json.aspx?AppId=$appId&Version=2.2&Market=$cultureInfo&Query=$query&Sources=$source&Web.Count=$numResults&JsonType=raw";
|
||||
$page=getUrl($url, '', '', $referer, false);
|
||||
$json=$page['body'];
|
||||
|
||||
$tabJson=json_decode($json, true);
|
||||
$tabJson=$tabJson['SearchResponse'];
|
||||
|
||||
$levMin=100;
|
||||
$pctMin=0;
|
||||
$urlLev=$urlPct='';
|
||||
$urlapprox="http://www.$nomEntrep.fr/";
|
||||
|
||||
foreach ($tabJson['Web']['Results'] as $i=> $result) {
|
||||
|
||||
$title=utf8_decode($result['Title']); // SCORES & DECISIONS - Accueil
|
||||
$desc=utf8_decode($result['Description']); // Scores et Décisions - Le nouvel acteur de l'information sur les entreprises et leurs dirigeants avec une approche innovante
|
||||
$url=$result['Url']; // http://www3.scores-decisions.com/
|
||||
|
||||
$lev=@levenshtein ($urlapprox,$url);
|
||||
if ($lev>0 && $lev<$levMin) {
|
||||
$levMin=$lev;
|
||||
$urlLev=$url;
|
||||
}
|
||||
$sim=similar_text($urlapprox,$url,$pct);
|
||||
if ($pct>$pctMin && strpos($url, 'zonebourse')===false) {
|
||||
$pctMin=$pct;
|
||||
$urlPct=$url;
|
||||
}
|
||||
if (preg_match('/\.(.*\.fr)\//', $url, $matches2)) {
|
||||
}
|
||||
|
||||
$info=parse_url($url);
|
||||
$host=preg_replace('/\/$/','',$info['host']);
|
||||
$ext=getFileExtension($host);
|
||||
$domaine=getFileExtension(preg_replace("/\.$ext$/",'','.'.$host));
|
||||
echo "RECHERCHE DE '$nomEntrep' ($siren) : Trouvé $domaine.$ext".EOL;
|
||||
if ($ext=='fr') {
|
||||
$rep=$this->iDb->select('jo.sitesWeb', 'siren, web', "web=$url");
|
||||
if (@$rep[0]['siren']*1==0) {
|
||||
$tabAfnic=$this->getInfosAfnic("$domaine.$ext");
|
||||
$siren=$tabAfnic['siren']*1;
|
||||
if ($siren>0) {
|
||||
$tabInsert=array('siren'=>$siren,
|
||||
'web'=>$url,
|
||||
'dateInsert'=>date('YmdHis'));
|
||||
$this->iDb->insert('jo.sitesWeb', $tabInsert);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($levMin<15 && $pctMin>44 && $urlLev==$urlPct) {
|
||||
echo date('Y-m-d H:i:s') .' - '. $page['code'] . " - $rs - $i - $lev (Min=$levMin) - $pct (Min=$pctMin) - $urlLev - $urlPct - $url !!! RETURNED !!!".EOL;
|
||||
return $urlLev;
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
[0] => Array
|
||||
(
|
||||
[Title] => SCORES & DECISIONS - Accueil
|
||||
[Description] => Scores et Décisions - Le nouvel acteur de l'information sur les entreprises et leurs dirigeants avec une approche innovante
|
||||
[Url] => http://www3.scores-decisions.com/
|
||||
[CacheUrl] => http://cc.bingj.com/cache.aspx?q=scores+decisions&d=5004075153885515&mkt=fr-FR&w=881d2897,4f2fff68
|
||||
[DisplayUrl] => www3.scores-decisions.com
|
||||
[DateTime] => 2011-02-14T12:24:00Z
|
||||
[DeepLinks] => Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[Title] => Partenaires
|
||||
[Url] => http://www3.scores-decisions.com/partenaires.php
|
||||
)
|
||||
[1] => Array
|
||||
(
|
||||
[Title] => Contact
|
||||
[Url] => http://www3.scores-decisions.com/contact.php
|
||||
)
|
||||
)
|
||||
)
|
||||
[1] => Array
|
||||
(
|
||||
[Title] => SCORES & DECISIONS - Société
|
||||
[Description] => Scores et Décisions - Le nouvel acteur de l'information sur les entreprises et leurs dirigeants avec une approche innovante
|
||||
[Url] => http://www3.scores-decisions.com/societe.php
|
||||
[CacheUrl] => http://cc.bingj.com/cache.aspx?q=scores+decisions&d=4747772983970513&mkt=fr-FR&w=10f5cd33,9b81f773
|
||||
[DisplayUrl] => www3.scores-decisions.com/societe.php
|
||||
[DateTime] => 2011-02-13T02:17:00Z
|
||||
)*/
|
||||
return false;
|
||||
}
|
||||
|
||||
function whois($domaine) {
|
||||
$parseur=explode(".", $domaine);
|
||||
$hote=$this->whois_serveurs[strtolower($parseur[count($parseur)-1])];
|
||||
$msg='';
|
||||
|
||||
if (empty($hote)) {
|
||||
$msg="Extension du domaine '$domaine' inconnue";
|
||||
} else {
|
||||
$fp = fsockopen($hote, 43, $errno, $errstr, 10);
|
||||
if (!$fp) {
|
||||
$msg="Erreur de socket no$errno : $errstr";
|
||||
} else {
|
||||
fputs($fp, $domaine . "\r\n");
|
||||
$buf=$server='';
|
||||
while (!feof($fp)) {
|
||||
$row=fgets($fp, 128);
|
||||
$buf.=$row;
|
||||
if (eregi("Whois Server:", $row))
|
||||
$server = trim(str_replace('Whois Server:', '', $row));
|
||||
}
|
||||
fclose($fp);
|
||||
if (ereg("No match for", $buf) ||
|
||||
ereg("NOT FOUND", $buf) ||
|
||||
ereg("Status: FREE", $buf) ||
|
||||
ereg("No entries found", $buf) ||
|
||||
ereg("Not found", $buf) ||
|
||||
ereg("AVAIL", $buf)) {
|
||||
$msg="Domaine '$domaine' libre";
|
||||
} else {
|
||||
//echo "<p><strong>Le nom de domaine <font color=\"red\">" . $_POST['domaine'] . "</font> est déjà pris</strong></p>";
|
||||
if ($server<>'') {
|
||||
$msg="Domaine '$domaine' enregistré chez '$server'";
|
||||
$fp = fsockopen($server, 43, $errno, $errstr, 10);
|
||||
fputs($fp, $domaine."\r\n");
|
||||
$buf2='';
|
||||
while (!feof($fp))
|
||||
$buf2.=fgets($fp, 128);
|
||||
fclose($fp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return array( 'error'=>$msg,
|
||||
'whoisSrv'=>$hote,
|
||||
'whoisSrv2'=>$server,
|
||||
'whoisTxt'=>$buf,
|
||||
'whoisTxt2'=>$buf2);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/** Retourne l'extension d'un domaine ou du fichier !!! **/
|
||||
function getFileExtension($filepath) {
|
||||
preg_match('/[^?]*/', $filepath, $matches);
|
||||
$string = $matches[0];
|
||||
$pattern = preg_split('/\./', $string, -1, PREG_SPLIT_OFFSET_CAPTURE);
|
||||
|
||||
// check if there is any extension
|
||||
if(count($pattern) == 1)
|
||||
return false;
|
||||
|
||||
if(count($pattern)>1) {
|
||||
$filenamepart = $pattern[count($pattern)-1][0];
|
||||
preg_match('/[^?]*/', $filenamepart, $matches);
|
||||
return $matches[0];
|
||||
}
|
||||
}
|
||||
|
||||
function ShowFileName($filepath)
|
||||
{
|
||||
preg_match('/[^?]*/', $filepath, $matches);
|
||||
$string = $matches[0];
|
||||
#split the string by the literal dot in the filename
|
||||
$pattern = preg_split('/\./', $string, -1, PREG_SPLIT_OFFSET_CAPTURE);
|
||||
#get the last dot position
|
||||
$lastdot = $pattern[count($pattern)-1][1];
|
||||
#now extract the filename using the basename function
|
||||
$filename = basename(substr($string, 0, $lastdot-1));
|
||||
#return the filename part
|
||||
return $filename;
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************************
|
||||
* @proto (array) $page get_web_file( (string) $url[, (string) $user_agent ] )
|
||||
|
||||
* @desc cURL va chercher $url en temps que $user_agent
|
||||
* @desc et retourne entre autre $page['content']
|
||||
|
||||
* @comm -régler le timeout
|
||||
* @comm a du mal à renvoyer des bin dans $header['content']
|
||||
********************************************************************************/
|
||||
|
||||
function get_web_file( $url, $user_agent = 'Opera/9.64 (X11; Linux i686; U; en) Presto/2.1.1' )
|
||||
{
|
||||
$options = array(
|
||||
//CURLOPT_SSL_VERIFYPEER => false, // Ne vérifie pas les certificats
|
||||
CURLOPT_RETURNTRANSFER => true, // return plutôt que echo|print
|
||||
CURLOPT_HEADER => true, // Renvoie les headers
|
||||
//CURLOPT_FOLLOWLOCATION => true, // Suivre les redirections, limité par...
|
||||
CURLOPT_MAXREDIRS => 500, // ...le max de redirections
|
||||
CURLOPT_ENCODING => '', // Accepte tous les encodages
|
||||
CURLOPT_USERAGENT => $user_agent,// Qui Je Suis (avec Jackie Chan)
|
||||
CURLOPT_AUTOREFERER => true, // Set referer on redirect
|
||||
CURLOPT_CONNECTTIMEOUT => 5,
|
||||
CURLOPT_TIMEOUT => 3, // Temps maximum d'utilisation de cURL (s)
|
||||
);
|
||||
|
||||
$ch = curl_init($url);
|
||||
curl_setopt_array($ch, $options);
|
||||
$content = curl_exec($ch); // contenu de la page
|
||||
$page['errno'] = curl_errno($ch); // code d'erreur cURL
|
||||
$page['errmsg'] = curl_error($ch); // message d'erreur cURL
|
||||
$curl = curl_getinfo($ch);
|
||||
curl_close($ch);
|
||||
|
||||
$page['url'] = $curl['url']; // possibles redirections = dernière url
|
||||
$page['http_code'] = $curl['http_code'];
|
||||
$page['total_time'] = $curl['total_time'];
|
||||
$page['redirect_count'] = $curl['redirect_count'];
|
||||
$page['content'] = $content;
|
||||
|
||||
return $page;
|
||||
}
|
||||
/* $page return as below:
|
||||
Array
|
||||
(
|
||||
[url] => l'url
|
||||
[http_code] => l'erreur http
|
||||
[redirect_count] => nombre de redirections
|
||||
[total_time] => temps d'execution
|
||||
[errno] => numéro d'erreur cURL
|
||||
[errmsg] => message d'erreur
|
||||
[content] => fichier en string :p
|
||||
)
|
||||
*/
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/********************************************************************************
|
||||
* @proto (integer) $http_error get_http_error( (string) $url )
|
||||
********************************************************************************/
|
||||
|
||||
function get_http_error( $url )
|
||||
{
|
||||
$options = array(
|
||||
//CURLOPT_SSL_VERIFYPEER => false,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_HEADER => true,
|
||||
CURLOPT_NOBODY => true, // get_http_error() doit être faster than get_web_file()
|
||||
//CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_MAXREDIRS => 500,
|
||||
CURLOPT_ENCODING => '',
|
||||
CURLOPT_USERAGENT => 'Opera/9.64 (X11; Linux i686; U; en) Presto/2.1.1',
|
||||
CURLOPT_AUTOREFERER => true,
|
||||
CURLOPT_CONNECTTIMEOUT => 120,
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
);
|
||||
|
||||
$ch = curl_init($url);
|
||||
curl_setopt_array($ch, $options);
|
||||
curl_exec($ch);
|
||||
$errmsg = curl_error($ch);
|
||||
$curl = curl_getinfo($ch);
|
||||
curl_close($ch);
|
||||
|
||||
return ( $curl['http_code'] === 0 ) ? $errmsg : $curl['http_code'];
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/********************************************************************************
|
||||
* @proto (string) $cleansed_url resolve_url( (string) $raw_url, (string) $url )
|
||||
* @link http://en.wikipedia.org/wiki/Uniform_Resource_Locator
|
||||
* @desc reconstruit $raw_url à partir de $url et en déduit des $res['url']
|
||||
* @comm gère les mails
|
||||
********************************************************************************/
|
||||
|
||||
function resolve_url( $raw_url, $url )
|
||||
{
|
||||
$cleansed_url = '';
|
||||
|
||||
// Met un slash à la fin des racines si yen a pas
|
||||
if ( preg_match('#^[^:/]+:/+[^/]+$#', $url) ) $url = $url.'/';
|
||||
if ( preg_match('#^[^:/]+:/+[^/]+$#', $raw_url) ) $raw_url = $raw_url.'/';
|
||||
|
||||
// Racine du site
|
||||
preg_match('#^([^:/]+:/+[^/]+/)#', $url, $preg_racine);
|
||||
$racine = $preg_racine[1];
|
||||
// Dossier courant
|
||||
preg_match('#(.+/)[^/]*$#', $url, $preg_courant);
|
||||
$courant = $preg_courant[1];
|
||||
/* On sait qu'un dossier en est un quand il se termine par un /
|
||||
Pour cette même raison, on ne peut déterminer avec certitude si on a un fichier plutôt qu'un dossier.
|
||||
Sauf (dans un contexte initial : sans URL-Rewriting) quand il y a une ancre : c'est un fichier. */
|
||||
// Non-dossier courant
|
||||
$sub_nondir_courant = substr($url, strlen($courant) - 1);
|
||||
$nondir_courant = ( $sub_nondir_courant === false ) ? '' : $sub_nondir_courant;
|
||||
//Scheme et slashs
|
||||
|
||||
|
||||
/* Modif's */
|
||||
|
||||
if ( $raw_url[0] == '/' ) // Si $raw_url commence par un /
|
||||
$cleansed_url = $racine . substr($raw_url, 1); // substr() empêche le double slash
|
||||
|
||||
else if ( $raw_url[0] == '.' ) // Pour ./ et ../
|
||||
$cleansed_url = $courant . $raw_url;
|
||||
|
||||
else if ( $raw_url[0] == '?' || $raw_url[0] == '&' ) // Si c'est une query
|
||||
$cleansed_url = $url . $raw_url; // Le '&' : espoir
|
||||
|
||||
else if ( $raw_url[0] == '#' ) // Si c'est une ancre et que n'en a pas déjà une
|
||||
$cleansed_url = ( !preg_match('%#[^#]*$%', $url) ) ? $url.$raw_url : '';
|
||||
|
||||
else if ( preg_match('#^javascript\s*:#i', $raw_url) ) // Quand du javascript est déclaré
|
||||
$cleansed_url = '';
|
||||
|
||||
else if ( preg_match('#^mailto\s*:\s*((?:[^i]|i)+)$#i', $raw_url, $mail) ) // Quand c'est un mail
|
||||
$cleansed_url = '';
|
||||
|
||||
else if ( preg_match('#^[^:/]+:/#', $raw_url) ) // Quand raw_url est une url normale
|
||||
$cleansed_url = $raw_url;
|
||||
|
||||
else if ( !preg_match('#^[^:/]+:/#', $raw_url) ) // Quand c'est tout sauf ce qu'on a dit et une url
|
||||
$cleansed_url = $courant . $raw_url;
|
||||
|
||||
else { } // Tous les autres cas ne conviennent pas
|
||||
|
||||
|
||||
/* Après toutes les modif's */
|
||||
|
||||
// Supprime les résultats qui ne commencent pas par xxx://
|
||||
if (
|
||||
!preg_match('#^[^:/]+:/+#', $cleansed_url) //$cleansed_url != ^http://$
|
||||
//|| $raw_url[0] == '#' //$raw_url ^#
|
||||
|| preg_match('#^[^:/]+:/+\s*$#', $cleansed_url) //$cleansed_url == ^http:// $
|
||||
|| !is_string($cleansed_url)
|
||||
)
|
||||
$cleansed_url = '';
|
||||
|
||||
if ( !empty($cleansed_url) )
|
||||
{
|
||||
$cleansed_url = trim($cleansed_url);
|
||||
|
||||
/*** remplace /./ par / ***/
|
||||
$cleansed_url = str_replace('/./', '/', $cleansed_url);
|
||||
|
||||
/*** remplace // par / s'ils ne commencent pas par : comme dans 'file:///' ***/
|
||||
$cleansed_url = preg_replace('#(?<!\:)//#', '/', $cleansed_url); //does work!!!
|
||||
|
||||
/*** supprime les /../ ***/
|
||||
while ( substr_count($cleansed_url, "../") ) //tant qu'il y a des /../
|
||||
{
|
||||
$cleansed_url = preg_replace('#/[^/]+/\.\.#', '', $cleansed_url); // But : see PHP.net online manual comment
|
||||
}
|
||||
}
|
||||
|
||||
return $cleansed_url;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/********************************************************************************
|
||||
* @proto (array) $urls get_urls( (string) $raw_page_content, (string) $url )
|
||||
* @desc extrait les urls de $raw_page_content et les reconstruits à l'aide de $url
|
||||
********************************************************************************/
|
||||
|
||||
function get_urls( $raw_page_content, $url )
|
||||
{
|
||||
$raw_page_content .= PHP_EOL;
|
||||
$matches = $urls = array();
|
||||
|
||||
$regexs = array( // À réécrire avec % ... %x et % ... %u
|
||||
/* Fais chier : un jour que j'améliorais *grave* mes regexs, le ventirad s'est décroché et mon /home/ est devenu illisible...
|
||||
Tout marchait *très bien* et j'avais rajouté des captures ! Me disant même "Heureusement que je l'ai vu ça, ça aurait pu m'échapper !" */
|
||||
|
||||
// (string) '#regex#Z' => (int) parenthesized subpattern,
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Catch Abstrait Symétrique
|
||||
// Cas général - ko
|
||||
// '%(["\'])([^\1:/\s]+:/+[^\1]+)\1#%' => 2,
|
||||
// Thèmes récurrents en (x)?HTML - ok
|
||||
'%(?:href|src|ur[li]|path|action|role|xmlns(?::[^:=]+)?)\s*=\s*(["\'])\s*([^\1]+)\s*\1%Ui' => 2,
|
||||
|
||||
/// Exceptions
|
||||
// Instructions de robots.txt - ok
|
||||
'%(?:Disallow|Sitemap)\s*:\s+(\S+)\s*%i' => 1,
|
||||
// Image en CSS - ok - ok
|
||||
'%url\s*\((["\']|)(?(1)([^\1]+)\1|([^()]+))\)%Ui' => 2,
|
||||
'%url\s*(["\'])([^\1])\1%iU' => 2,
|
||||
// Meta refresh - ok
|
||||
'%content=(["\'])[^\1\D]*;\s*url=([^\1]+)\1%iU' => 2,
|
||||
|
||||
/// Catch Abstrait Asymétrique
|
||||
// Parenthèses
|
||||
/// '\( , ... \)' => ,
|
||||
// XML - (antislash pour php-> ?\>) . Ungreedy réduit l'execution - ok
|
||||
'%<([^<>\s]+)(?:\s+[^>]+)?\>\s*([^>\s:/]+:/+[^<]+)\s*</\1>%' => 2,
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// '' => ,
|
||||
);
|
||||
|
||||
foreach ( $regexs as $regex => $parenthesized_subpattern )
|
||||
{
|
||||
preg_match_all($regex, $raw_page_content, $reg_sult, PREG_PATTERN_ORDER); // Éxécute les regular expressions
|
||||
$matches = array_merge($matches, $reg_sult[ $parenthesized_subpattern ]); // Regroupe les résultats des regex
|
||||
}
|
||||
|
||||
$matches = array_unique($matches); // Supprime les doubles
|
||||
$matches = array_values($matches); // Repart de zéro
|
||||
|
||||
$url = trim($url); // Enlève les espaces des côtés
|
||||
$nbUrl_=count($matches);
|
||||
foreach ( $matches as $iUrl_=>$raw_url )
|
||||
{
|
||||
$raw_url = trim($raw_url);
|
||||
|
||||
if ( !empty($raw_url) ) // Supprime les cases vides
|
||||
{
|
||||
$res = resolve_url($raw_url, $url); // Résoud massivement les URL trouvées
|
||||
|
||||
/* Déduit des urls : énumère l'arborescence */
|
||||
if ( !empty($res) ) // URL néttoyées
|
||||
{
|
||||
preg_match('#^([^:/]+:/+[^/]+/)(.*)$#', $res, $preg_url);
|
||||
if (!isset($preg_url[1])) {
|
||||
echo ("$iUrl_/$nbUrl_: Type d'URL non gérée : '$res'".EOL);
|
||||
break;
|
||||
}
|
||||
$str = $preg_url[1]; // = début de l'url suivie d'un slash
|
||||
|
||||
$urls[] = $str; // Enregistre déjà ce début (utile de le mettre ici au cas ou la condition sur \2 serait false)
|
||||
|
||||
if ( !empty($preg_url[2]) ) // Si il y a un path (!= root | host)
|
||||
{
|
||||
// Éclate le path par le slash (-> array)
|
||||
$exp = explode('/', $preg_url[2]); // Compte à partir de 0
|
||||
$k = count($exp); // Compte à partir de 1
|
||||
|
||||
for ( $i = 0; $i < $k; $i++ ) // Déduit des urls
|
||||
{
|
||||
// Si on est au dernier, on ne met pas de slash à la fin (: cela peut-être un fichier)
|
||||
$str .= ($i == $k -1) ? $exp[$i] : $exp[$i].'/';
|
||||
|
||||
$urls[] = $str; // Enregistre
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$urls = array_unique($urls); //moins doubles
|
||||
$urls = array_values($urls); //orde num (des key)
|
||||
if ( empty($urls[ count($urls) - 1 ]) ) // Si il y a une URL vide, elle est à la fin du tableau
|
||||
array_pop($urls);
|
||||
|
||||
return $urls;
|
||||
}
|
||||
function crawler($q) {
|
||||
if ( preg_match('#[^:/\s]://.+#', $q) && !preg_match('#[<>"\']#', $q) ) // Si l'URL semble correcte
|
||||
{
|
||||
$urls = array();
|
||||
if ( preg_match('#^[^:/]+:/+[^/]+$#', $q) )
|
||||
$q .= '/'; // Rajoute le slash si c'est le root et qu'il est sans / à la fin
|
||||
|
||||
/* if ( !empty($c) ) /* HTTP ERROR */ /*** Ne pas echo avant cette ligne ***
|
||||
{
|
||||
header("Content-Type: text/plain");
|
||||
echo get_http_error($q); // get_http_error() devrait moins consommer que curl_web_file()
|
||||
die;
|
||||
}
|
||||
*/
|
||||
$curl = get_web_file($q); // Met l'élément du Web ciblé dans une variable
|
||||
$urls = get_urls($curl['content'], $q); // URL trouvées
|
||||
|
||||
natcasesort($urls); // Tri par ordre alphanumérique
|
||||
$nombresult = count($urls);
|
||||
}
|
||||
return $urls;
|
||||
}
|
||||
|
||||
?>
|
6
library/SdMetier/Rnvp/Adresse.php → library/Metier/Rnvp/Adresse.php
Normal file → Executable file
6
library/SdMetier/Rnvp/Adresse.php → library/Metier/Rnvp/Adresse.php
Normal file → Executable file
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
class SdMetier_Rnvp_Adresse
|
||||
class Metier_Rnvp_Adresse
|
||||
{
|
||||
protected $source;
|
||||
protected $sourceId;
|
||||
@ -102,7 +102,7 @@ class SdMetier_Rnvp_Adresse
|
||||
$rnvp->L7 = $rnvpResult->L7rnvp;
|
||||
|
||||
$rnvp->ProcessCode = $rnvpResult->codeRetour;
|
||||
$process = new SdMetier_Rnvp_Process();
|
||||
$process = new Metier_Rnvp_Process();
|
||||
$correction = '';
|
||||
if ($rnvpResult->CorrectionImportante == 'I') {
|
||||
$correction = $rnvpResult->CorrectionImportante;
|
||||
@ -115,7 +115,7 @@ class SdMetier_Rnvp_Adresse
|
||||
|
||||
// Label CQadrs
|
||||
$rnvp->QualityCode = $rnvpResult->CQadrs;
|
||||
$quality = new SdMetier_Rnvp_Quality();
|
||||
$quality = new Metier_Rnvp_Quality();
|
||||
$rnvp->QualityLabel = $quality->getLabel($rnvp->QualityCode);
|
||||
|
||||
$rnvp->GeoInseeCommune = $rnvpResult->Insee;
|
2
library/SdMetier/Rnvp/Process.php → library/Metier/Rnvp/Process.php
Normal file → Executable file
2
library/SdMetier/Rnvp/Process.php → library/Metier/Rnvp/Process.php
Normal file → Executable file
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
class SdMetier_Rnvp_Process
|
||||
class Metier_Rnvp_Process
|
||||
{
|
||||
public function __construct() {}
|
||||
|
2
library/SdMetier/Rnvp/Quality.php → library/Metier/Rnvp/Quality.php
Normal file → Executable file
2
library/SdMetier/Rnvp/Quality.php → library/Metier/Rnvp/Quality.php
Normal file → Executable file
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
class SdMetier_Rnvp_Quality
|
||||
class Metier_Rnvp_Quality
|
||||
{
|
||||
/**
|
||||
* Libellé des codes qualités
|
@ -24,7 +24,7 @@ class Metier_Scores_ICotation
|
||||
function __construct($tabBilan, $retraitementAutomatique = true, $db = null)
|
||||
{
|
||||
if ( $db === null ) {
|
||||
$this->iDb = new WDB();
|
||||
$this->iDb = new Metier_Util_Db();
|
||||
} else {
|
||||
$this->iDb = $db;
|
||||
}
|
||||
@ -2639,12 +2639,12 @@ class Metier_Scores_ICotation
|
||||
function getInfosNotation ($notation, $format='html') {
|
||||
switch ($format) {
|
||||
case 'html':
|
||||
$str ='Situation financière : '. htmlentities($this->tabNotation[$notation][0]).'<br/>'.EOL;
|
||||
$str.='Notation : '. htmlentities($this->tabNotation[$notation][1]).'<br/>'.EOL;
|
||||
$str.='Equivalence BDF : '. $this->tabNotation[$notation][2].'<br/>'.EOL;
|
||||
$str.='Grades Moody\'s : '. $this->tabNotation[$notation][3].'<br/>'.EOL;
|
||||
$str.='Grades S&P : '. $this->tabNotation[$notation][4].'<br/>'.EOL;
|
||||
$str.='Probabilité de défaillance : '.$this->tabNotation[$notation][5].' %<br/>'.EOL;
|
||||
$str ='Situation financière : '. htmlentities($this->tabNotation[$notation][0]).'<br/>'.PHP_EOL;
|
||||
$str.='Notation : '. htmlentities($this->tabNotation[$notation][1]).'<br/>'.PHP_EOL;
|
||||
$str.='Equivalence BDF : '. $this->tabNotation[$notation][2].'<br/>'.PHP_EOL;
|
||||
$str.='Grades Moody\'s : '. $this->tabNotation[$notation][3].'<br/>'.PHP_EOL;
|
||||
$str.='Grades S&P : '. $this->tabNotation[$notation][4].'<br/>'.PHP_EOL;
|
||||
$str.='Probabilité de défaillance : '.$this->tabNotation[$notation][5].' %<br/>'.PHP_EOL;
|
||||
break;
|
||||
case 'csv':
|
||||
$str = $this->tabNotation[$notation][0] .';'. // Situation financi<63>re
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/** Auto generated class 2016-05-25 10:19:54*/
|
||||
/** Auto generated class 2016-08-09 11:48:55*/
|
||||
class Metier_Scores_MRatios
|
||||
{
|
||||
|
||||
@ -215,7 +215,7 @@ class Metier_Scores_MRatios
|
||||
public function __construct($db = null)
|
||||
{
|
||||
if ( $db === null ) {
|
||||
$this->iDb = new WDB();
|
||||
$this->iDb = new Metier_Util_Db();
|
||||
} else {
|
||||
$this->iDb = $db;
|
||||
}
|
||||
@ -473,7 +473,7 @@ class Metier_Scores_MRatios
|
||||
$R[85]=$p['DY'];
|
||||
if (!isset($R[85])) { $R[85] = 'NS'; }
|
||||
|
||||
$R[86]=$p['DZ']+ $p['EA']+ $p['EB']+ $R[80];
|
||||
$R[86]=$p['DZ']+$p['EA']+$p['EB'];
|
||||
if (!isset($R[86])) { $R[86] = 'NS'; }
|
||||
|
||||
$R[87]=$p['YS']+ $p['EH'];
|
||||
@ -515,13 +515,13 @@ class Metier_Scores_MRatios
|
||||
$R[120]=$R[111]+$R[112];
|
||||
if (!isset($R[120])) { $R[120] = 'NS'; }
|
||||
|
||||
$R[121]=$p['FT']+ $p['FV'];
|
||||
$R[121]=$p['FT']+$p['FV'];
|
||||
if (!isset($R[121])) { $R[121] = 'NS'; }
|
||||
|
||||
$R[122]=$R[101]+$R[112]-$R[102]-$R[121];
|
||||
if (!isset($R[122])) { $R[122] = 'NS'; }
|
||||
|
||||
$R[123]=$p['FW']- $p['HP']- $p['HQ'];
|
||||
$R[123]=$p['FW']-$p['HP']-$p['HQ'];
|
||||
if (!isset($R[123])) { $R[123] = 'NS'; }
|
||||
|
||||
$R[124]=($R[120]*12)/$nm;
|
||||
@ -551,7 +551,7 @@ class Metier_Scores_MRatios
|
||||
$R[143]=$p['FP'];
|
||||
if (!isset($R[143])) { $R[143] = 'NS'; }
|
||||
|
||||
$R[144]=($p['HP']+ $p['HQ'])*0.7;
|
||||
$R[144]=($p['HP']+$p['HQ'])*0.7;
|
||||
if (!isset($R[144])) { $R[144] = 'NS'; }
|
||||
|
||||
$R[145]=$p['GA']+$p['GB']+$p['GC']+$p['GD']+$R[144];
|
||||
|
@ -19,7 +19,7 @@ function getIndiscoreHisto($siren)
|
||||
WHERE siren=$siren
|
||||
GROUP BY indiScoreDate
|
||||
ORDER BY indiScoreDate DESC";
|
||||
$iDb = new WDB();
|
||||
$iDb = new Metier_Util_Db();
|
||||
$ret = $iDb->query($query);
|
||||
$tabRet = array();
|
||||
while( $ret = $iDb->fetch(MYSQL_ASSOC) ) {
|
||||
@ -73,7 +73,7 @@ function getIndiscoreCache($siren)
|
||||
FROM jo.scores_surveillance
|
||||
WHERE siren=$siren
|
||||
ORDER BY indiScoreDate DESC";
|
||||
$iDb = new WDB();
|
||||
$iDb = new Metier_Util_Db();
|
||||
$ret = $iDb->query($query);
|
||||
$tabRet = array();
|
||||
while( $ret = $iDb->fetch(MYSQL_ASSOC) ) {
|
||||
@ -282,8 +282,6 @@ function formatRatio($ratio, $id, $unite, $forceSigne='')
|
||||
*/
|
||||
function formatValeur($variable, $longeur=0, $fonction='')
|
||||
{
|
||||
$classWdate = new WDate();
|
||||
|
||||
$valeur = strtr($variable, array('{'=>'','}'=>''));
|
||||
$nomVar = strtr($valeur, array('$'=>''));
|
||||
|
||||
@ -322,18 +320,18 @@ function formatValeur($variable, $longeur=0, $fonction='')
|
||||
// --- Formattage variable [...]DATE
|
||||
elseif (preg_match('/DATE$/', $nomVar)) {
|
||||
$strTmp = eval("return $valeur;");
|
||||
return preg_replace('/00\//','01/', $classWdate->dateT('Ymd','d/m/Y', substr(str_replace('-','',$strTmp),0,8)));
|
||||
return preg_replace('/00\//','01/', Metier_Util_Date::dateT('Ymd','d/m/Y', substr(str_replace('-','',$strTmp),0,8)));
|
||||
}
|
||||
// --- Formattage variable [...]DATEp[NNNN]
|
||||
elseif (preg_match('/DATEp[0-9]{0,}$/', $nomVar)) {
|
||||
$strTmp=eval("return $valeur;");
|
||||
return preg_replace('/00\//','01/', $classWdate->dateT('Ymd','d/m/Y', substr(str_replace('-','',$strTmp),0,8)));
|
||||
return preg_replace('/00\//','01/', Metier_Util_Date::dateT('Ymd','d/m/Y', substr(str_replace('-','',$strTmp),0,8)));
|
||||
}
|
||||
// --- Formattage variable [...]MMAA
|
||||
elseif (preg_match('/MMAA$/', $nomVar)) {
|
||||
//DELAIPAY_MMAA ne marche pas !
|
||||
$strTmp=eval("return $valeur;");
|
||||
return $classWdate->dateT('Y-m','M Y', $strTmp);
|
||||
return Metier_Util_Date::dateT('Y-m','M Y', $strTmp);
|
||||
}
|
||||
// --- Formattage variable [...]_MT
|
||||
elseif (preg_match('/_MT$/', $nomVar)) {
|
||||
@ -393,11 +391,11 @@ function formatValeur($variable, $longeur=0, $fonction='')
|
||||
}
|
||||
// --- Formattage variable [...]DIMMAT
|
||||
elseif (preg_match('/DIMMAT$/', $nomVar)) {
|
||||
return preg_replace('/00\//','01/', $classWdate->dateT('Ymd','d/m/Y', substr(str_replace('-','',$DIMMAT),0,8)));
|
||||
return preg_replace('/00\//','01/', Metier_Util_Date::dateT('Ymd','d/m/Y', substr(str_replace('-','',$DIMMAT),0,8)));
|
||||
}
|
||||
// --- Formattage variable [...]DCREN
|
||||
elseif (preg_match('/DCREN$/',$nomVar)) {
|
||||
return preg_replace('/00\//','01/', $classWdate->dateT('Ymd','d/m/Y', substr(str_replace('-','',$DCREN),0,8)));
|
||||
return preg_replace('/00\//','01/', Metier_Util_Date::dateT('Ymd','d/m/Y', substr(str_replace('-','',$DCREN),0,8)));
|
||||
}
|
||||
// --- Formattage variable [...]MARCHEVOL
|
||||
elseif (preg_match('/MARCHEVOL$/', $nomVar)) {
|
||||
@ -618,7 +616,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
{
|
||||
$timer = array('debutIndiscore'=>microtime(true));
|
||||
if (strlen($siren)>9 || (substr(''.$siren,0,9)*1)<100 ) {
|
||||
debugLog('W', "Siren $siren incorrect", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
Metier_Util_Log::write('W', "Siren $siren incorrect", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -649,7 +647,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$NIVEAU = $cycleClient; // 1, 2, 3 ou 5 Niveau de version des commentaires
|
||||
|
||||
if ( $db === null ) {
|
||||
$iDb = new WDB();
|
||||
$iDb = new Metier_Util_Db();
|
||||
} else {
|
||||
$iDb = $db;
|
||||
}
|
||||
@ -663,7 +661,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$timer['identite']=microtime(true);
|
||||
|
||||
if (empty($tabIdentite)) {
|
||||
debugLog('W', "Siren $siren non présent en base", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
Metier_Util_Log::write('W', "Siren $siren non présent en base", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -678,8 +676,6 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$genereComment = true;
|
||||
}
|
||||
|
||||
$classWdate = new WDate();
|
||||
|
||||
//Initialisation tabFormules depuis le cache
|
||||
$tabVariables = include __DIR__ . '/Data/Variables.php';
|
||||
$tabFormules = include __DIR__ . '/Data/Formules.php';
|
||||
@ -968,7 +964,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
}
|
||||
$DCREN=$dateCrea;
|
||||
$DCREN_AA=substr($dateCrea,0,4);
|
||||
$AGE=$classWdate->nbMoisEntre($dateCrea, date('Ymd'));
|
||||
$AGE=Metier_Util_Date::nbMoisEntre($dateCrea, date('Ymd'));
|
||||
|
||||
// --- Liste des bilans
|
||||
$tabBilan = $tabBil = $tabRegX = array();
|
||||
@ -1013,7 +1009,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$nmp = $tabBilan[0]['DUREE_MOIS_PRE'];
|
||||
if ($BILANANNEEp > 0) {
|
||||
$BILANp = 1;
|
||||
$nbMoisBilDate = $classWdate->nbMoisEntre($BILANDATEp, $BILANDATE);
|
||||
$nbMoisBilDate = Metier_Util_Date::nbMoisEntre($BILANDATEp, $BILANDATE);
|
||||
$nbMoisBilCumul += $nmp;
|
||||
}
|
||||
}
|
||||
@ -1025,7 +1021,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$nmp2=$tabBilan[2]['DUREE_MOIS'];
|
||||
if ($BILANANNEEp2 > 0) {
|
||||
$BILANp2 = 1;
|
||||
$nbMoisBilDate = $classWdate->nbMoisEntre($BILANDATEp2, $BILANDATE);
|
||||
$nbMoisBilDate = Metier_Util_Date::nbMoisEntre($BILANDATEp2, $BILANDATE);
|
||||
$nbMoisBilCumul += $nmp2;
|
||||
}
|
||||
}
|
||||
@ -1036,7 +1032,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$nmp3 = $tabBilan[3]['DUREE_MOIS'];
|
||||
if ($BILANANNEEp3 > 0) {
|
||||
$BILANp3 = 1;
|
||||
$nbMoisBilDate = $classWdate->nbMoisEntre($BILANDATEp3, $BILANDATE);
|
||||
$nbMoisBilDate = Metier_Util_Date::nbMoisEntre($BILANDATEp3, $BILANDATE);
|
||||
$nbMoisBilCumul += $nmp3;
|
||||
}
|
||||
}
|
||||
@ -1047,7 +1043,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$nmp4=$tabBilan[4]['DUREE_MOIS'];
|
||||
if ($BILANANNEEp4 > 0) {
|
||||
$BILANp4 = 1;
|
||||
$nbMoisBilDate = $classWdate->nbMoisEntre($BILANDATEp4, $BILANDATE);
|
||||
$nbMoisBilDate = Metier_Util_Date::nbMoisEntre($BILANDATEp4, $BILANDATE);
|
||||
//$nbMoisBilCumul+=$nmp4;
|
||||
}
|
||||
}
|
||||
@ -1381,15 +1377,15 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
// Date de l'annonce
|
||||
$ANNONCEDATE = $depot['DateParution'];
|
||||
$ANNONCEBODCDATE = $depot['DateParution'];
|
||||
$BILANDERANNEE = date('Y', mktime(0, 0, 0, $classWdate->dateT('Y-m-d', 'm', $depot['dateEffet']), $classWdate->dateT('Y-m-d', 'd', $depot['dateEffet']), $classWdate->dateT('Y-m-d', 'Y', $depot['dateEffet'])+1));
|
||||
$BILANDERANNEE = date('Y', mktime(0, 0, 0, Metier_Util_Date::dateT('Y-m-d', 'm', $depot['dateEffet']), Metier_Util_Date::dateT('Y-m-d', 'd', $depot['dateEffet']), Metier_Util_Date::dateT('Y-m-d', 'Y', $depot['dateEffet'])+1));
|
||||
$ANNONCEBODDATE = $depot['DateParution']; //dateEffet
|
||||
if ($nbDepotCpt==1 && // 1 seul dépôt des comptes
|
||||
abs($classWdate->nbMoisEntre(date('Y-m-d'), $dateCrea))<60) {// Entreprise de moins de 5 ans (60 mois)
|
||||
$nbMoisMax=abs($classWdate->nbMoisEntre($dateCrea,$depot['dateEffet']));
|
||||
abs(Metier_Util_Date::nbMoisEntre(date('Y-m-d'), $dateCrea))<60) {// Entreprise de moins de 5 ans (60 mois)
|
||||
$nbMoisMax=abs(Metier_Util_Date::nbMoisEntre($dateCrea,$depot['dateEffet']));
|
||||
}
|
||||
} else {
|
||||
if (abs($classWdate->nbMoisEntre($lastDepot, $depot['dateEffet']))>$nbMoisMax) {
|
||||
$nbMoisMax=abs($classWdate->nbMoisEntre($lastDepot, $depot['dateEffet']));
|
||||
if (abs(Metier_Util_Date::nbMoisEntre($lastDepot, $depot['dateEffet']))>$nbMoisMax) {
|
||||
$nbMoisMax=abs(Metier_Util_Date::nbMoisEntre($lastDepot, $depot['dateEffet']));
|
||||
if ($nbMoisMax>24 && $ANNONCEBODCMANQDATE==false) {
|
||||
/** @todo Annomalie Bilans 1 mois sur 976320309
|
||||
** $ANNONCEBODCREGUL 0 Pas de publication régulière des comptes
|
||||
@ -1403,7 +1399,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$nmp3=$tabBilan[3]['DUREE_MOIS'];
|
||||
$nmp4
|
||||
**/
|
||||
$ANNONCEBODCMANQDATE=date('Y-m-d', mktime(0, 0, 0, $classWdate->dateT('Y-m-d', 'm', $depot['dateEffet']), $classWdate->dateT('Y-m-d', 'd', $depot['dateEffet']), $classWdate->dateT('Y-m-d', 'Y', $depot['dateEffet'])+1));
|
||||
$ANNONCEBODCMANQDATE=date('Y-m-d', mktime(0, 0, 0, Metier_Util_Date::dateT('Y-m-d', 'm', $depot['dateEffet']), Metier_Util_Date::dateT('Y-m-d', 'd', $depot['dateEffet']), Metier_Util_Date::dateT('Y-m-d', 'Y', $depot['dateEffet'])+1));
|
||||
$ANNONCEBODCMANQ_AA=substr($ANNONCEBODCMANQDATE,0,4);
|
||||
}
|
||||
}
|
||||
@ -1443,7 +1439,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
foreach ($tabDepotCpt as $iDep => $depot) {
|
||||
if ($iDep == 0) {
|
||||
$ANNONCEBODADATE=$depot['DateParution'];
|
||||
if ($classWdate->dateT('Y-m-d', 'Ymd',$ANNONCEBODADATE) > $classWdate->dateT('Y-m-d', 'Ymd',$ANNONCEBODDATE)) {
|
||||
if (Metier_Util_Date::dateT('Y-m-d', 'Ymd',$ANNONCEBODADATE) > Metier_Util_Date::dateT('Y-m-d', 'Ymd',$ANNONCEBODDATE)) {
|
||||
$ANNONCEBODDATE = $depot['DateParution'];
|
||||
$tabTmp = array();
|
||||
foreach ($depot['evenements'] as $even) {
|
||||
@ -1476,7 +1472,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
foreach ($tabDepotCpt as $iDep => $depot) {
|
||||
if ($iDep == 0) {
|
||||
$ANNONCEBODBDATE = $depot['DateParution'];
|
||||
if ($classWdate->dateT('Y-m-d', 'Ymd',$ANNONCEBODBDATE) > $classWdate->dateT('Y-m-d', 'Ymd',$ANNONCEBODDATE)) {
|
||||
if (Metier_Util_Date::dateT('Y-m-d', 'Ymd',$ANNONCEBODBDATE) > Metier_Util_Date::dateT('Y-m-d', 'Ymd',$ANNONCEBODDATE)) {
|
||||
$ANNONCEBODDATE=$depot['DateParution'];
|
||||
$tabTmp = array();
|
||||
foreach ($depot['evenements'] as $even) {
|
||||
@ -2033,7 +2029,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$RJMERE=$RJFILLE=false;
|
||||
$SITUACT=$NICMERE=$SIRENMERE=$SIRETMERE=$NOMMERE='';
|
||||
|
||||
$lienM = new SdMetier_Liens_Base($siren, 'siren');
|
||||
$lienM = new Metier_Liens_Base($siren, 'siren');
|
||||
|
||||
//Actionnaire
|
||||
$tabA = $lienM->getActionnaires(null, true);
|
||||
@ -2299,8 +2295,8 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
6=>'MargeExploitation',
|
||||
);
|
||||
for($iTmp=1; $iTmp<7; $iTmp++)
|
||||
$strNote.=$tabTmp[$iTmp]." : ".$numerateur[$iTmp].'/'.$denominateur[$iTmp].'='.$note[$iTmp].' (Borné à '.$noteB[$iTmp].')'.EOL;
|
||||
$strNote.="Note Financière=$noteFin Conan Holder=$scoreConanH Afdcc1=$scoreAfdcc1 Afdcc2=$scoreAfdcc2note (Classe $scoreAfdcc2) Z=$scoreZ CCF=$valeurCCF ($pDef36) Altman=$scoreAltman AltmanCote=$scoreAltmanB".EOL.print_r($tabInfosNotation,true);
|
||||
$strNote.=$tabTmp[$iTmp]." : ".$numerateur[$iTmp].'/'.$denominateur[$iTmp].'='.$note[$iTmp].' (Borné à '.$noteB[$iTmp].')'.PHP_EOL;
|
||||
$strNote.="Note Financière=$noteFin Conan Holder=$scoreConanH Afdcc1=$scoreAfdcc1 Afdcc2=$scoreAfdcc2note (Classe $scoreAfdcc2) Z=$scoreZ CCF=$valeurCCF ($pDef36) Altman=$scoreAltman AltmanCote=$scoreAltmanB".PHP_EOL.print_r($tabInfosNotation,true);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -2328,11 +2324,11 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$SCORECONF=100;
|
||||
|
||||
// Présence d'un bilan mais trop vieux
|
||||
if ($NBBILAN>0 && $classWdate->nbMoisEntre($BILANDATE,date('Ymd'))>=24) $BILANVIEUX=true;
|
||||
if ($NBBILAN>0 && Metier_Util_Date::nbMoisEntre($BILANDATE,date('Ymd'))>=24) $BILANVIEUX=true;
|
||||
else $BILANVIEUX=false;
|
||||
|
||||
// Présence d'un bilan mais trop vieux et c'est anormal
|
||||
if ($NBBILAN>0 && $classWdate->nbMoisEntre($BILANDATE,date('Ymd'))>=30) $BILANMANQUE=true;
|
||||
if ($NBBILAN>0 && Metier_Util_Date::nbMoisEntre($BILANDATE,date('Ymd'))>=30) $BILANMANQUE=true;
|
||||
else $BILANMANQUE=false;
|
||||
|
||||
if ( (@$tabBil[0]['Millesime']+20000<date('Ymd')*1) && // Le dernier bilan date de + de 2 ans
|
||||
@ -2349,7 +2345,6 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
|
||||
if ($tabIdentite['NonDiffusible']>0) { // Entreprise FJ=1xxx ayant demandé à sortir du champ de diffusion INSEE
|
||||
$SCORECONF-=5;
|
||||
//$tabCommentaires['gen'][]=prepareString("Cette affaire personnelle à demandée son retrait du champs de diffusion commercial de la base SIRENE.");
|
||||
$PPNONDIFF=true;
|
||||
} else {
|
||||
$PPNONDIFF=false;
|
||||
@ -2372,7 +2367,6 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
if ($valeur=='OUI')
|
||||
$zonesPri[]=$zone;
|
||||
$ZONEPRI=implode(', ', $zonesPri);
|
||||
//$tabCommentaires['gen'][]=prepareString("Cette entreprise est située en Zone Prioritaire.");
|
||||
}
|
||||
|
||||
/** Domiciliation d'entreprise **/
|
||||
@ -2391,7 +2385,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$ANNONCEINTERDIT=0;
|
||||
$dirs = $iInsee->getDirigeants($siren, false);
|
||||
$timer['getDirigeants'] = microtime(true);
|
||||
//debugLog('I', 'SCOREDIR = '. print_r($dirs,1), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
//Metier_Util_Log::write('I', 'SCOREDIR = '. print_r($dirs,1), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
$DIR_NB=$NBDIRLIENS=$NBDIRSCI=$NBDIRSCIADR=0;
|
||||
if (count($dirs) > 0 ) {
|
||||
foreach ($dirs as $nb => $dir)
|
||||
@ -2400,12 +2394,12 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$DIR_NB++;
|
||||
if ($DIR_NB==1) {
|
||||
$DIR1_NOM=preg_replace('/ +/',' ',$dir['Civilite'].' '.$dir['Nom'].' '.$dir['Prenom']);
|
||||
$DIR1_AGE=floor($classWdate->nbMoisEntre($classWdate->dateT('d/m/Y','Ymd',$dir['NaissDate']))/12);
|
||||
$DIR1_AGE=floor(Metier_Util_Date::nbMoisEntre(Metier_Util_Date::dateT('d/m/Y','Ymd',$dir['NaissDate']))/12);
|
||||
$DIR1_FONC=$dir['Titre'];
|
||||
$DIR1_TYPE='PP';
|
||||
} elseif ($DIR_NB==2) {
|
||||
$DIR2_NOM=preg_replace('/ +/',' ',$dir['Civilite'].' '.$dir['Nom'].' '.$dir['Prenom']);
|
||||
$DIR2_AGE=floor($classWdate->nbMoisEntre($classWdate->dateT('d/m/Y','Ymd',$dir['NaissDate']))/12);
|
||||
$DIR2_AGE=floor(Metier_Util_Date::nbMoisEntre(Metier_Util_Date::dateT('d/m/Y','Ymd',$dir['NaissDate']))/12);
|
||||
$DIR2_FONC=$dir['Titre'];
|
||||
$DIR2_TYPE='PP';
|
||||
}
|
||||
@ -2459,7 +2453,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
|
||||
}
|
||||
$ANNONCEINTERDIT++;
|
||||
$ANNONCEINTERDITDATE=$classWdate->dateT('d/m/Y','Y-m-d', $dir['DateFct']);
|
||||
$ANNONCEINTERDITDATE=Metier_Util_Date::dateT('d/m/Y','Y-m-d', $dir['DateFct']);
|
||||
break(2);
|
||||
case 15:
|
||||
case 16: // Procédure collective dans l'historique du dirigeant
|
||||
@ -2518,41 +2512,41 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
switch ($infoFacto[0]['CodeRisque']) {
|
||||
case 'OK':
|
||||
$COTEOK=true;
|
||||
$COTEOK_MMAA=$CSFACTO_MMAA=$classWdate->dateT('Y-m-d', 'Ym', $infoFacto[0]['DateEven']);
|
||||
$COTEOK_MMAA=$CSFACTO_MMAA=Metier_Util_Date::dateT('Y-m-d', 'Ym', $infoFacto[0]['DateEven']);
|
||||
if ($noteSolvabilite>=40 && $noteSolvabilite<=45) $noteSolvabilite+=5;
|
||||
$CSFACTO=0;
|
||||
break;
|
||||
case 'IP':
|
||||
$IMPAYE=true;
|
||||
$IMPAYE_MMAA=$CSFACTO_MMAA=$classWdate->dateT('Y-m-d', 'Ym', $infoFacto[0]['DateEven']);
|
||||
$IMPAYE_MMAA=$CSFACTO_MMAA=Metier_Util_Date::dateT('Y-m-d', 'Ym', $infoFacto[0]['DateEven']);
|
||||
$CSFACTO='I';
|
||||
$profilPayeur=5;
|
||||
break;
|
||||
case 'PR':
|
||||
$PRIVILEGES=true;
|
||||
$PRIVILEGES_MMAA=$CSFACTO_MMAA=$classWdate->dateT('Y-m-d', 'Ym', $infoFacto[0]['DateEven']);
|
||||
$PRIVILEGES_MMAA=$CSFACTO_MMAA=Metier_Util_Date::dateT('Y-m-d', 'Ym', $infoFacto[0]['DateEven']);
|
||||
$CSFACTO='P';
|
||||
$profilPayeur=5;
|
||||
break;
|
||||
case 'RG':
|
||||
$RISQUEGROUPE=true;
|
||||
$RISQUEGROUPE_MMAA=$CSFACTO_MMAA=$classWdate->dateT('Y-m-d', 'Ym', $infoFacto[0]['DateEven']);
|
||||
$RISQUEGROUPE_MMAA=$CSFACTO_MMAA=Metier_Util_Date::dateT('Y-m-d', 'Ym', $infoFacto[0]['DateEven']);
|
||||
$CSFACTO=24; $SCOREDIRI-=10;
|
||||
break;
|
||||
case 'DEF':
|
||||
$DEFAUT=true;
|
||||
$DEFAUT_MMAA=$CSFACTO_MMAA=$classWdate->dateT('Y-m-d', 'Ym', $infoFacto[0]['DateEven']);
|
||||
$DEFAUT_MMAA=$CSFACTO_MMAA=Metier_Util_Date::dateT('Y-m-d', 'Ym', $infoFacto[0]['DateEven']);
|
||||
$CSFACTO='D';
|
||||
break;
|
||||
case 'LC':
|
||||
$LCASSUR=true;
|
||||
$LCASSUR_MMAA=$CSFACTO_MMAA=$classWdate->dateT('Y-m-d', 'Ym', $infoFacto[0]['DateEven']);
|
||||
$LCASSUR_MMAA=$CSFACTO_MMAA=Metier_Util_Date::dateT('Y-m-d', 'Ym', $infoFacto[0]['DateEven']);
|
||||
$CSFACTO='T';
|
||||
break;
|
||||
case 'KO':
|
||||
$noteSolvabilite=$SCORECONF=$SCOREDIRI=0;
|
||||
$CSFACTO=50;
|
||||
$CSFACTO_MMAA=$classWdate->dateT('Y-m-d', 'Ym', $infoFacto[0]['DateEven']);
|
||||
$CSFACTO_MMAA=Metier_Util_Date::dateT('Y-m-d', 'Ym', $infoFacto[0]['DateEven']);
|
||||
break;
|
||||
default:
|
||||
if ($iFacto->risqueImpaye) {
|
||||
@ -2560,15 +2554,15 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$RISQUEIMPAYE=true;
|
||||
} else {
|
||||
$CSFACTO=$infoFacto[0]['CoteCS']*1;
|
||||
$CSFACTO_MMAA=$classWdate->dateT('Y-m-d', 'Ym', $infoFacto[0]['DateEven']);
|
||||
$CSFACTO_MMAA=Metier_Util_Date::dateT('Y-m-d', 'Ym', $infoFacto[0]['DateEven']);
|
||||
}
|
||||
break;
|
||||
}
|
||||
$CSFACTOFIN_MMAA=$classWdate->dateT('Y-m-d', 'Ym', $infoFacto[0]['DateFin']);
|
||||
$CSFACTOFIN_MMAA=Metier_Util_Date::dateT('Y-m-d', 'Ym', $infoFacto[0]['DateFin']);
|
||||
if ($infoFacto[0]['CoteCS']*1>0)
|
||||
$libInfoPaiement='Courant '.$classWdate->dateT('Y-m-d', 'M Y', $infoFacto[0]['DateEven']).' : '.$infoFacto[0]['LibCS'];
|
||||
$libInfoPaiement='Courant '.Metier_Util_Date::dateT('Y-m-d', 'M Y', $infoFacto[0]['DateEven']).' : '.$infoFacto[0]['LibCS'];
|
||||
else {
|
||||
$libInfoPaiement=trim('Depuis '.$classWdate->dateT('Y-m-d', 'M Y', $infoFacto[0]['DateEven']).' : '.$infoFacto[0]['LibCS'].' '.$libProfilPayeur);
|
||||
$libInfoPaiement=trim('Depuis '.Metier_Util_Date::dateT('Y-m-d', 'M Y', $infoFacto[0]['DateEven']).' : '.$infoFacto[0]['LibCS'].' '.$libProfilPayeur);
|
||||
$encoursCS=7500;
|
||||
}
|
||||
} else {
|
||||
@ -2579,7 +2573,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$libInfoPaiement='Aucun retard de paiement significatif n\'a été porté à notre connaissance par l\'ensemble de nos partenaires.';
|
||||
}
|
||||
if ($iFacto->risqueImpaye) {
|
||||
$RISQUEIMPAYE_MMAA=$classWdate->dateT('Y-m', 'Ym', $iFacto->risqueImpayeDate);
|
||||
$RISQUEIMPAYE_MMAA=Metier_Util_Date::dateT('Y-m', 'Ym', $iFacto->risqueImpayeDate);
|
||||
if ((''.$iFacto->risqueImpayeDate.'-01')>$MODIFPAIDATE)
|
||||
$MODIFPAIDATE=''.$iFacto->risqueImpayeDate.'-01';
|
||||
}
|
||||
@ -2599,11 +2593,11 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$PRIVILEGES=true;
|
||||
$PRIVILEGESECU=$tabPriv['03']['nb'];
|
||||
$PRIVILEGESECU_MT=$tabPriv['03']['insCumul'];
|
||||
$PRIVILEGES_MMAA=$classWdate->dateT('Y-m-d', 'Ym', $tabPriv['03']['dateFraiche']);
|
||||
$PRIVILEGES_MMAA=Metier_Util_Date::dateT('Y-m-d', 'Ym', $tabPriv['03']['dateFraiche']);
|
||||
if ($tabPriv['03']['dateFraiche']>$MODIFPAIDATE)
|
||||
$MODIFPAIDATE=$tabPriv['03']['dateFraiche'];
|
||||
if ($infoFacto[0]['CoteCS']*1==0)
|
||||
$libInfoPaiement=trim('Depuis le '.$classWdate->dateT('Y-m-d', 'd/m/Y', $tabPriv['03']['dateFraiche'])." : $PRIVILEGESECU inscription(s) URSSAF pour un montant de ".number_format($PRIVILEGESECU_MT,2,',',' ')." euros. $libProfilPayeur");
|
||||
$libInfoPaiement=trim('Depuis le '.Metier_Util_Date::dateT('Y-m-d', 'd/m/Y', $tabPriv['03']['dateFraiche'])." : $PRIVILEGESECU inscription(s) URSSAF pour un montant de ".number_format($PRIVILEGESECU_MT,2,',',' ')." euros. $libProfilPayeur");
|
||||
if ($PRIVILEGESECU==1 && $PRIVILEGESECU_MT<15000) {
|
||||
if (($NBBILAN==0||$BILANVIEUX||$BILANMANQUE) && $CAPITAL<750000) $noteSolvMax=42;
|
||||
elseif (($NBBILAN==0||$BILANVIEUX||$BILANMANQUE) && $CAPITAL>=750000) $noteSolvMax=45;
|
||||
@ -2619,14 +2613,14 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$PRIVILEGES=true;
|
||||
$PRIVILEGETRES=$tabPriv['04']['nb'];
|
||||
$PRIVILEGETRES_MT=$tabPriv['04']['insCumul'];
|
||||
$PRIVILEGES_MMAA=$classWdate->dateT('Y-m-d', 'Ym', $tabPriv['04']['dateFraiche']);
|
||||
$PRIVILEGES_MMAA=Metier_Util_Date::dateT('Y-m-d', 'Ym', $tabPriv['04']['dateFraiche']);
|
||||
if ($tabPriv['04']['dateFraiche']>$MODIFPAIDATE)
|
||||
$MODIFPAIDATE=$tabPriv['04']['dateFraiche'];
|
||||
if ($infoFacto[0]['CoteCS']*1==0)
|
||||
if ($PRIVILEGESECU<1)
|
||||
$libInfoPaiement=trim('Depuis le '.$classWdate->dateT('Y-m-d', 'd/m/Y', $tabPriv['04']['dateFraiche'])." : $PRIVILEGETRES inscription(s) TRESOR pour un montant de ".number_format($PRIVILEGETRES_MT,2,',',' ')." euros. $libProfilPayeur");
|
||||
$libInfoPaiement=trim('Depuis le '.Metier_Util_Date::dateT('Y-m-d', 'd/m/Y', $tabPriv['04']['dateFraiche'])." : $PRIVILEGETRES inscription(s) TRESOR pour un montant de ".number_format($PRIVILEGETRES_MT,2,',',' ')." euros. $libProfilPayeur");
|
||||
else
|
||||
$libInfoPaiement.='<br/>'.trim('Depuis le '.$classWdate->dateT('Y-m-d', 'd/m/Y', $tabPriv['04']['dateFraiche'])." : $PRIVILEGETRES inscription(s) TRESOR pour un montant de ".number_format($PRIVILEGETRES_MT,2,',',' ')." euros. $libProfilPayeur");
|
||||
$libInfoPaiement.='<br/>'.trim('Depuis le '.Metier_Util_Date::dateT('Y-m-d', 'd/m/Y', $tabPriv['04']['dateFraiche'])." : $PRIVILEGETRES inscription(s) TRESOR pour un montant de ".number_format($PRIVILEGETRES_MT,2,',',' ')." euros. $libProfilPayeur");
|
||||
if ($PRIVILEGETRES==1 && $PRIVILEGETRES_MT<15000) {
|
||||
if ($PRIVILEGESECU>0) $seuil=45;
|
||||
else $seuil=55;
|
||||
@ -2727,7 +2721,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$dateMaj = $tabTmp[0]['dateInsert'];
|
||||
}
|
||||
// Si pas plus vieux que 6 mois
|
||||
if ($classWdate->nbMoisEntre($dateMaj, date('Ymd')) <= $ENQUETELIM) {
|
||||
if (Metier_Util_Date::nbMoisEntre($dateMaj, date('Ymd')) <= $ENQUETELIM) {
|
||||
$tabLibCS = $iFacto->getLibInfoCS($tabTmp[0]['paiement']);
|
||||
$libInfoPaiement = $tabLibCS['LibCS'];
|
||||
$encoursForce=$tabTmp[0]['encours'];
|
||||
@ -2868,7 +2862,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
else $plafondEstime=$plafond/25;
|
||||
if ($encoursEstime>$plafondEstime) $encoursEstime=$plafondEstime;
|
||||
|
||||
// debugLog('I', "INDISCORE B $encoursIni $encoursEstime $encours", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
// Metier_Util_Log::write('I', "INDISCORE B $encoursIni $encoursEstime $encours", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
|
||||
// Si l'entreprise à moins de 12 mois, on divise son encours estimé par 2
|
||||
if ($encoursEstime>0) {
|
||||
@ -2947,9 +2941,9 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$BILANDATE=$tabTmp[0]['dateClotureNum'];
|
||||
if ($BILANDATE>0 && $tabIdentite['SituationJuridique']=='' && $tabIdentite['Actif']==1) {
|
||||
$BILAN=true;
|
||||
if ($classWdate->nbMoisEntre($BILANDATE,date('Ymd'))>=24) $BILANVIEUX=true;
|
||||
if (Metier_Util_Date::nbMoisEntre($BILANDATE,date('Ymd'))>=24) $BILANVIEUX=true;
|
||||
else $BILANVIEUX=false;
|
||||
if ($classWdate->nbMoisEntre($BILANDATE,date('Ymd'))>=30) $BILANMANQUE=true;
|
||||
if (Metier_Util_Date::nbMoisEntre($BILANDATE,date('Ymd'))>=30) $BILANMANQUE=true;
|
||||
else $BILANMANQUE=false;
|
||||
$ENCOURS=$CAESTIME/72;
|
||||
if ($noteSolvabilite>=40 && $ENCOURS<5000) $ENCOURS=5000;
|
||||
@ -3413,25 +3407,33 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$CADTER_SURF_CUM=0; // Cumul Surfaces des terrains à l'addresse
|
||||
*/
|
||||
// Locaux
|
||||
$iCadastre = new Metier_Partenaires_MCadastre($iDb);
|
||||
$tabTmp=$iCadastre->getLocaux($siren);
|
||||
if(count($tabTmp)>0 ) {
|
||||
foreach ($tabTmp as $iTmp=>$cad) {
|
||||
$CADBAT_NB_TOT++;
|
||||
if ($cad['localDroit']=='P') $CADBAT_NB_PROP++;
|
||||
else $CADBAT_NB_NONPROP++;
|
||||
$CADBAT_SURF_TOT+=$cad['localSurface'];
|
||||
}
|
||||
$iCadastre = new Metier_Partenaires_MCadastre($siren, $iDb);
|
||||
$tabTmp = $iCadastre->getLocaux();
|
||||
if(count($tabTmp) > 0) {
|
||||
foreach ($tabTmp as $iTmp => $cad) {
|
||||
$CADBAT_NB_TOT++;
|
||||
if ($cad['localDroit'] == 'P'){
|
||||
$CADBAT_NB_PROP++;
|
||||
}
|
||||
else {
|
||||
$CADBAT_NB_NONPROP++;
|
||||
}
|
||||
$CADBAT_SURF_TOT+= $cad['localSurface'];
|
||||
}
|
||||
}
|
||||
// Parcelles
|
||||
$tabTmp = $iCadastre->getParcelles($siren);
|
||||
foreach ($tabTmp as $iTmp=>$cad) {
|
||||
$CADTER_NB_TOT++;
|
||||
if ($cad['parcelDroit']=='P') $CADTER_NB_PROP++;
|
||||
else $CADTER_NB_NONPROP++;
|
||||
$CADTER_SURF_TOT+=$cad['parcelSurface'];
|
||||
$tabTmp = $iCadastre->getParcelles();
|
||||
foreach ($tabTmp as $iTmp => $cad) {
|
||||
$CADTER_NB_TOT++;
|
||||
if ($cad['parcelDroit'] == 'P') {
|
||||
$CADTER_NB_PROP++;
|
||||
}
|
||||
else {
|
||||
$CADTER_NB_NONPROP++;
|
||||
}
|
||||
$CADTER_SURF_TOT+= $cad['parcelSurface'];
|
||||
}
|
||||
$timer['cadastre']=microtime(true);
|
||||
$timer['cadastre'] = microtime(true);
|
||||
|
||||
/** RPS : Entreprise avec négociations ou accord sur les RPS ? **/
|
||||
$tabTmp = $iDb->select(
|
||||
@ -3671,7 +3673,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
//@eval('\$strTmp="'.$strTmp2.'";');
|
||||
$strTmp=eval("return \"$strTmp2\";");
|
||||
|
||||
$tabComment[$idxC]=preg_replace('/<\/i>(?:<br\/>)<\/i>/i','</i>', $debLigne.prepareString($strTmp).$finLigne);//." ($idxC, $ordre)";
|
||||
$tabComment[$idxC]=preg_replace('/<\/i>(?:<br\/>)<\/i>/i','</i>', $debLigne.$strTmp.$finLigne);//." ($idxC, $ordre)";
|
||||
if (substr($strTmp,0,17)=='ERREUR DE FORMULE') {
|
||||
|
||||
}
|
||||
@ -3694,37 +3696,37 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
{
|
||||
if (isset(${$var})) {
|
||||
if (is_array(${$var})) {
|
||||
$variables.="$var=".print_r(${$var}).EOL;
|
||||
$variables.="$var=".print_r(${$var}).PHP_EOL;
|
||||
} else {
|
||||
$variables.="$var='${$var}'".EOL;
|
||||
$variables.="$var='${$var}'".PHP_EOL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$variables.="$var='${$var}' NON DEFINIE !!!".EOL;
|
||||
$variables.="$var='${$var}' NON DEFINIE !!!".PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
||||
file_put_contents($SIREN.'_'.$type.'.log',
|
||||
"Indiscore sur $siren : Commentaires".EOL.
|
||||
"Liste des variables :\n$variables".EOL.
|
||||
'CA_COEF='.$CA_COEF.EOL.
|
||||
'CA_Y='.print_r($CA_Y,true).EOL.EOL.
|
||||
'RCAI_COEF='.$RCAI_COEF.EOL.
|
||||
'RCAI_Y='.print_r($RCAI_Y,true).EOL.
|
||||
"PROJECCOEF=$PROJECCOEF".EOL.
|
||||
"PROJECTAUX=$PROJECTAUX".EOL.
|
||||
"Y=".print_r($Y,true).EOL.
|
||||
"Yaff=".print_r($Yaff,true).EOL.
|
||||
"tabRegX=".print_r($tabRegX,true).EOL.
|
||||
print_r($tabComment, true).EOL.
|
||||
"Liste des commentaires a trier :\n".print_r($tabCommentairesATrier,true).EOL.
|
||||
"Tableau des codes de tri pour calcul :\n".print_r($tabTri,true).EOL.
|
||||
"Tableau des codes de tri pour affichage :\n".print_r($tabTriAff,true).EOL.
|
||||
$debugFormule.EOL.'-----------------------'.EOL.
|
||||
"Liste des Bilans :\n".print_r($tabBilans, true).EOL.
|
||||
"tabBil=".print_r($tabBil,true).EOL.
|
||||
"Liste des Ratios :\n".print_r($tabRatios, true).EOL.
|
||||
"Liste des ratios Evolutions :\n". print_r($tabRatiosEvol, true).EOL
|
||||
"Indiscore sur $siren : Commentaires".PHP_EOL.
|
||||
"Liste des variables :\n$variables".PHP_EOL.
|
||||
'CA_COEF='.$CA_COEF.PHP_EOL.
|
||||
'CA_Y='.print_r($CA_Y,true).PHP_EOL.PHP_EOL.
|
||||
'RCAI_COEF='.$RCAI_COEF.PHP_EOL.
|
||||
'RCAI_Y='.print_r($RCAI_Y,true).PHP_EOL.
|
||||
"PROJECCOEF=$PROJECCOEF".PHP_EOL.
|
||||
"PROJECTAUX=$PROJECTAUX".PHP_EOL.
|
||||
"Y=".print_r($Y,true).PHP_EOL.
|
||||
"Yaff=".print_r($Yaff,true).PHP_EOL.
|
||||
"tabRegX=".print_r($tabRegX,true).PHP_EOL.
|
||||
print_r($tabComment, true).PHP_EOL.
|
||||
"Liste des commentaires a trier :\n".print_r($tabCommentairesATrier,true).PHP_EOL.
|
||||
"Tableau des codes de tri pour calcul :\n".print_r($tabTri,true).PHP_EOL.
|
||||
"Tableau des codes de tri pour affichage :\n".print_r($tabTriAff,true).PHP_EOL.
|
||||
$debugFormule.PHP_EOL.'-----------------------'.PHP_EOL.
|
||||
"Liste des Bilans :\n".print_r($tabBilans, true).PHP_EOL.
|
||||
"tabBil=".print_r($tabBil,true).PHP_EOL.
|
||||
"Liste des Ratios :\n".print_r($tabRatios, true).PHP_EOL.
|
||||
"Liste des ratios Evolutions :\n". print_r($tabRatiosEvol, true).PHP_EOL
|
||||
);
|
||||
|
||||
$i=0; $strTime='';
|
||||
@ -3739,7 +3741,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
}
|
||||
$duree=round($time-$timeDeb,3);
|
||||
$strTime.="---------------------\nTOTAL : $duree secondes\n";
|
||||
file_put_contents('time.log', "Indiscore sur $siren : Durées ".$strTime.EOL.$strNote.EOL.$variables.EOL.print_r($tabRatiosInfos,true));
|
||||
file_put_contents('time.log', "Indiscore sur $siren : Durées ".$strTime.PHP_EOL.$strNote.PHP_EOL.$variables.PHP_EOL.print_r($tabRatiosInfos,true));
|
||||
}
|
||||
|
||||
// EntActiveRCS
|
||||
@ -3903,7 +3905,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
{
|
||||
$tabUpdate2 = array('sourceModif'=>$sourceModif, 'nbModifs'=>$nbModifs);
|
||||
if (!$iDb->update('jo.scores_surveillance', $tabUpdate2, "siren=$siren", false, 0, true)) {
|
||||
debugLog('W', 'Erreur lors de la MAJ du score en surveillance pour '. $tabIdentite['Nom'], __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
Metier_Util_Log::write('W', 'Erreur lors de la MAJ du score en surveillance pour '. $tabIdentite['Nom'], __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -3911,18 +3913,12 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$EffectifEn = $tabIdentite['Effectif'];
|
||||
$bilanAgeMax = 3 * 12; //Age maximum du dernier bilan en mois
|
||||
if (!empty($tabIdentite['bilanDate']) && intval($tabIdentite['bilanYP'])>0 ) {
|
||||
|
||||
Zend_Date::setOptions(array('extend_month' => true));
|
||||
$dateBilan = new Zend_Date($tabIdentite['bilanDate'], 'yyyyMMdd');
|
||||
$dateNow = new Zend_Date();
|
||||
$difference = $dateNow->sub($dateBilan);
|
||||
$measure = new Zend_Measure_Time($difference->toValue(), Zend_Measure_Time::SECOND);
|
||||
$measure->convertTo(Zend_Measure_Time::MONTH);
|
||||
$nbMonth = $measure->getValue();
|
||||
|
||||
if ( $nbMonth < $bilanAgeMax ) {
|
||||
$EffectifEn = $tabIdentite['bilanYP'];
|
||||
}
|
||||
$dateBilan = DateTime::createFromFormat('Ymd', $tabIdentite['bilanDate']);
|
||||
$dateCompare = new DateTime();
|
||||
$dateCompare->sub(new DateInterval('P'.$bilanAgeMax.'M'));
|
||||
if ($dateBilan > $dateCompare) {
|
||||
$EffectifEn = $tabIdentite['bilanYP'];
|
||||
}
|
||||
}
|
||||
|
||||
//Insertion ou mise à jour du score
|
||||
@ -3996,22 +3992,22 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
// --- Sauvegarde et Historisation du score
|
||||
if ( $actionHisto == 'insert' ) {
|
||||
if (!$iDb->insert('jo.scores_surveillance', $tabUpdate, false, true)) {
|
||||
debugLog('W', "Erreur lors de l'ajout du score en surveillance pour ". $tabIdentite['Nom']." - ".mysql_error(), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
Metier_Util_Log::write('W', "Erreur lors de l'ajout du score en surveillance pour ". $tabIdentite['Nom']." - ".mysql_error(), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!$iDb->update('jo.scores_surveillance', $tabUpdate, "siren=$siren", false, 0, true)) {
|
||||
debugLog('W', "Erreur lors de mise à jour du score en surveillance pour ". $tabIdentite['Nom']." - ".mysql_error(), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
Metier_Util_Log::write('W', "Erreur lors de mise à jour du score en surveillance pour ". $tabIdentite['Nom']." - ".mysql_error(), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
}
|
||||
}
|
||||
|
||||
// --- Historisation du score
|
||||
if (!$iDb->insert('historiques.scores_surveillance', $tabUpdate)) {
|
||||
debugLog('W', "Erreur lors de l'historisation du score pour ". $tabIdentite['Nom'], __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
Metier_Util_Log::write('W', "Erreur lors de l'historisation du score pour ". $tabIdentite['Nom'], __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
}
|
||||
}
|
||||
|
||||
debugLog('I', 'Etablissement retourné FIN = '. $tabIdentite['Nom'], __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
Metier_Util_Log::write('I', 'Etablissement retourné FIN = '. $tabIdentite['Nom'], __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
|
||||
return $tabRet;
|
||||
}
|
||||
|
@ -1042,7 +1042,7 @@ class Metier_Scores_MSolvabilite
|
||||
public function __construct($siren, $naf='', $trancheEff='', $effectifReel='', $depSiege_CodePosSiege='', $fj='', $capital='', $capitalDev='', $dateCreaEn='', $dateCreaSiege='', $singularite='', $recme=0, $db = null)
|
||||
{
|
||||
if ( $db === null ) {
|
||||
$this->iDb = new WDB();
|
||||
$this->iDb = new Metier_Util_Db();
|
||||
} else {
|
||||
$this->iDb = $db;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
class Metier_Scoring_Base extends Metier_Scoring_Vars
|
||||
{
|
||||
/**
|
||||
* Activation du debug
|
||||
@ -72,7 +72,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
public function __construct($db = null)
|
||||
{
|
||||
if ( $db === null ) {
|
||||
$this->db = new WDB();
|
||||
$this->db = new Metier_Util_Db();
|
||||
}
|
||||
|
||||
// --- Initialisation tableau libellé des variables
|
||||
@ -124,7 +124,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
WHERE siren=$siren
|
||||
GROUP BY indiScoreDate
|
||||
ORDER BY indiScoreDate DESC";
|
||||
$iDb = new WDB();
|
||||
$iDb = new Metier_Util_Db();
|
||||
$ret = $iDb->query($query);
|
||||
$tabRet = array();
|
||||
while( $ret = $iDb->fetch(MYSQL_ASSOC) ) {
|
||||
@ -178,10 +178,9 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
FROM jo.scores_surveillance
|
||||
WHERE siren=$siren
|
||||
ORDER BY indiScoreDate DESC";
|
||||
$iDb = new WDB();
|
||||
$ret = $iDb->query($query);
|
||||
$ret = $this->db->query($query);
|
||||
$tabRet = array();
|
||||
while( $ret = $iDb->fetch(MYSQL_ASSOC) ) {
|
||||
while( $ret = $this->db->fetch(MYSQL_ASSOC) ) {
|
||||
$tabRet[] = array (
|
||||
'siren' => $ret['siren'],
|
||||
'actif' => $ret['actif'],
|
||||
@ -387,7 +386,6 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
*/
|
||||
public function formatValeur($var, $longeur=0, $fonction='')
|
||||
{
|
||||
$classWdate = new WDate();
|
||||
$varValue = strtr($var, array('{'=>'','}'=>''));
|
||||
$varLabel = strtr($varValue, array('$'=>''));
|
||||
|
||||
@ -421,16 +419,16 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
// --- Formattage variable [...]DATE
|
||||
elseif (preg_match('/DATE$/', $varLabel)) {
|
||||
return preg_replace('/00\//','01/',
|
||||
$classWdate->dateT('Ymd','d/m/Y', substr(str_replace('-','',$this->{$varValue}),0,8)));
|
||||
Metier_Util_Date::dateT('Ymd','d/m/Y', substr(str_replace('-','',$this->{$varValue}),0,8)));
|
||||
}
|
||||
// --- Formattage variable [...]DATEp[NNNN]
|
||||
elseif (preg_match('/DATEp[0-9]{0,}$/', $varLabel)) {
|
||||
return preg_replace('/00\//','01/',
|
||||
$classWdate->dateT('Ymd','d/m/Y', substr(str_replace('-','',$this->{$varValue}),0,8)));
|
||||
Metier_Util_Date::dateT('Ymd','d/m/Y', substr(str_replace('-','',$this->{$varValue}),0,8)));
|
||||
}
|
||||
// --- Formattage variable [...]MMAA
|
||||
elseif (preg_match('/MMAA$/', $varLabel)) {
|
||||
return $classWdate->dateT('Y-m','M Y', $this->{$varValue});
|
||||
return Metier_Util_Date::dateT('Y-m','M Y', $this->{$varValue});
|
||||
}
|
||||
// --- Formattage variable [...]_MT
|
||||
elseif (preg_match('/_MT$/', $varLabel)) {
|
||||
@ -489,12 +487,12 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
// --- Formattage variable [...]DIMMAT
|
||||
elseif (preg_match('/DIMMAT$/', $varLabel)) {
|
||||
return preg_replace('/00\//','01/',
|
||||
$classWdate->dateT('Ymd','d/m/Y', substr(str_replace('-','',$this->DIMMAT),0,8)));
|
||||
Metier_Util_Date::dateT('Ymd','d/m/Y', substr(str_replace('-','',$this->DIMMAT),0,8)));
|
||||
}
|
||||
// --- Formattage variable [...]DCREN
|
||||
elseif (preg_match('/DCREN$/',$varLabel)) {
|
||||
return preg_replace('/00\//','01/',
|
||||
$classWdate->dateT('Ymd','d/m/Y', substr(str_replace('-','',$this->DCREN),0,8)));
|
||||
Metier_Util_Date::dateT('Ymd','d/m/Y', substr(str_replace('-','',$this->DCREN),0,8)));
|
||||
}
|
||||
// --- Formattage variable [...]MARCHEVOL
|
||||
elseif (preg_match('/MARCHEVOL$/', $varLabel))
|
||||
@ -759,7 +757,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
$timer['identite']=microtime(true);
|
||||
|
||||
if (empty($tabIdentite)) {
|
||||
debugLog('W', "Siren $siren non présent en base", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
Metier_Util_Log::write('W', "Siren $siren non présent en base", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -774,8 +772,6 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
$genereComment = true;
|
||||
}
|
||||
|
||||
$classWdate = new WDate();
|
||||
|
||||
//Initialisation tabFormules depuis le cache
|
||||
$tabFormules = include __DIR__ . '/Data/Formules.php';
|
||||
|
||||
@ -944,7 +940,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
}
|
||||
$this->DCREN = $dateCrea;
|
||||
$this->DCREN_AA = substr($dateCrea,0,4);
|
||||
$this->AGE = $classWdate->nbMoisEntre($dateCrea, date('Ymd'));
|
||||
$this->AGE = Metier_Util_Date::nbMoisEntre($dateCrea, date('Ymd'));
|
||||
|
||||
// --- Liste des bilans
|
||||
$tabBilan = $tabBil = $this->tabRegX = array();
|
||||
@ -992,7 +988,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
$this->nmp = $tabBilan[0]['DUREE_MOIS_PRE'];
|
||||
if ($this->BILANANNEEp > 0) {
|
||||
$this->BILANp = 1;
|
||||
$nbMoisBilDate = $classWdate->nbMoisEntre($this->BILANDATEp, $this->BILANDATE);
|
||||
$nbMoisBilDate = Metier_Util_Date::nbMoisEntre($this->BILANDATEp, $this->BILANDATE);
|
||||
$nbMoisBilCumul += $this->nmp;
|
||||
}
|
||||
}
|
||||
@ -1004,7 +1000,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
$this->nmp2=$tabBilan[2]['DUREE_MOIS'];
|
||||
if ($this->BILANANNEEp2 > 0) {
|
||||
$this->BILANp2 = 1;
|
||||
$nbMoisBilDate = $classWdate->nbMoisEntre($this->BILANDATEp2, $this->BILANDATE);
|
||||
$nbMoisBilDate = Metier_Util_Date::nbMoisEntre($this->BILANDATEp2, $this->BILANDATE);
|
||||
$nbMoisBilCumul += $this->nmp2;
|
||||
}
|
||||
}
|
||||
@ -1015,7 +1011,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
$this->nmp3 = $tabBilan[3]['DUREE_MOIS'];
|
||||
if ($this->BILANANNEEp3 > 0) {
|
||||
$this->BILANp3 = 1;
|
||||
$nbMoisBilDate = $classWdate->nbMoisEntre($this->BILANDATEp3, $this->BILANDATE);
|
||||
$nbMoisBilDate = Metier_Util_Date::nbMoisEntre($this->BILANDATEp3, $this->BILANDATE);
|
||||
$nbMoisBilCumul += $this->nmp3;
|
||||
}
|
||||
}
|
||||
@ -1026,7 +1022,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
$this->nmp4=$tabBilan[4]['DUREE_MOIS'];
|
||||
if ($this->BILANANNEEp4 > 0) {
|
||||
$this->BILANp4 = 1;
|
||||
$nbMoisBilDate = $classWdate->nbMoisEntre($this->BILANDATEp4, $this->BILANDATE);
|
||||
$nbMoisBilDate = Metier_Util_Date::nbMoisEntre($this->BILANDATEp4, $this->BILANDATE);
|
||||
//$nbMoisBilCumul+=$this->nmp4;
|
||||
}
|
||||
}
|
||||
@ -1362,15 +1358,15 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
// Date de l'annonce
|
||||
$this->ANNONCEDATE=$depot['DateParution'];
|
||||
$this->ANNONCEBODCDATE=$depot['DateParution'];
|
||||
$this->BILANDERANNEE=date('Y', mktime(0, 0, 0, $classWdate->dateT('Y-m-d', 'm', $depot['dateEffet']), $classWdate->dateT('Y-m-d', 'd', $depot['dateEffet']), $classWdate->dateT('Y-m-d', 'Y', $depot['dateEffet'])+1));
|
||||
$this->BILANDERANNEE=date('Y', mktime(0, 0, 0, Metier_Util_Date::dateT('Y-m-d', 'm', $depot['dateEffet']), Metier_Util_Date::dateT('Y-m-d', 'd', $depot['dateEffet']), Metier_Util_Date::dateT('Y-m-d', 'Y', $depot['dateEffet'])+1));
|
||||
$this->ANNONCEBODDATE=$depot['DateParution'];//dateEffet
|
||||
if ($nbDepotCpt==1 && // 1 seul dépôt des comptes
|
||||
abs($classWdate->nbMoisEntre(date('Y-m-d'), $dateCrea))<60) {// Entreprise de moins de 5 ans (60 mois)
|
||||
$nbMoisMax=abs($classWdate->nbMoisEntre($dateCrea,$depot['dateEffet']));
|
||||
abs(Metier_Util_Date::nbMoisEntre(date('Y-m-d'), $dateCrea))<60) {// Entreprise de moins de 5 ans (60 mois)
|
||||
$nbMoisMax=abs(Metier_Util_Date::nbMoisEntre($dateCrea,$depot['dateEffet']));
|
||||
}
|
||||
} else {
|
||||
if (abs($classWdate->nbMoisEntre($lastDepot, $depot['dateEffet']))>$nbMoisMax) {
|
||||
$nbMoisMax=abs($classWdate->nbMoisEntre($lastDepot, $depot['dateEffet']));
|
||||
if (abs(Metier_Util_Date::nbMoisEntre($lastDepot, $depot['dateEffet']))>$nbMoisMax) {
|
||||
$nbMoisMax=abs(Metier_Util_Date::nbMoisEntre($lastDepot, $depot['dateEffet']));
|
||||
if ($nbMoisMax>24 && $this->ANNONCEBODCMANQDATE==false) {
|
||||
/** @todo Annomalie Bilans 1 mois sur 976320309
|
||||
** $ANNONCEBODCREGUL 0 Pas de publication régulière des comptes
|
||||
@ -1384,7 +1380,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
$nmp3=$tabBilan[3]['DUREE_MOIS'];
|
||||
$nmp4
|
||||
**/
|
||||
$this->ANNONCEBODCMANQDATE=date('Y-m-d', mktime(0, 0, 0, $classWdate->dateT('Y-m-d', 'm', $depot['dateEffet']), $classWdate->dateT('Y-m-d', 'd', $depot['dateEffet']), $classWdate->dateT('Y-m-d', 'Y', $depot['dateEffet'])+1));
|
||||
$this->ANNONCEBODCMANQDATE=date('Y-m-d', mktime(0, 0, 0, Metier_Util_Date::dateT('Y-m-d', 'm', $depot['dateEffet']), Metier_Util_Date::dateT('Y-m-d', 'd', $depot['dateEffet']), Metier_Util_Date::dateT('Y-m-d', 'Y', $depot['dateEffet'])+1));
|
||||
$this->ANNONCEBODCMANQ_AA=substr($this->ANNONCEBODCMANQDATE,0,4);
|
||||
}
|
||||
}
|
||||
@ -1423,7 +1419,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
foreach ($tabDepotCpt as $iDep=>$depot) {
|
||||
if ($iDep==0) {
|
||||
$this->ANNONCEBODADATE=$depot['DateParution'];
|
||||
if ($classWdate->dateT('Y-m-d', 'Ymd',$this->ANNONCEBODADATE)>$classWdate->dateT('Y-m-d', 'Ymd',$this->ANNONCEBODDATE)) {
|
||||
if (Metier_Util_Date::dateT('Y-m-d', 'Ymd',$this->ANNONCEBODADATE)>Metier_Util_Date::dateT('Y-m-d', 'Ymd',$this->ANNONCEBODDATE)) {
|
||||
$this->ANNONCEBODDATE=$depot['DateParution'];
|
||||
$tabTmp=array();
|
||||
foreach ($depot['evenements'] as $even) {
|
||||
@ -1456,7 +1452,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
foreach ($tabDepotCpt as $iDep=>$depot) {
|
||||
if ($iDep==0) {
|
||||
$this->ANNONCEBODBDATE=$depot['DateParution'];
|
||||
if ($classWdate->dateT('Y-m-d', 'Ymd',$this->ANNONCEBODBDATE)>$classWdate->dateT('Y-m-d', 'Ymd',$this->ANNONCEBODDATE)) {
|
||||
if (Metier_Util_Date::dateT('Y-m-d', 'Ymd',$this->ANNONCEBODBDATE)>Metier_Util_Date::dateT('Y-m-d', 'Ymd',$this->ANNONCEBODDATE)) {
|
||||
$this->ANNONCEBODDATE=$depot['DateParution'];
|
||||
$tabTmp=array();
|
||||
foreach ($depot['evenements'] as $even) {
|
||||
@ -2016,7 +2012,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
$this->RJMERE=$this->RJFILLE=false;
|
||||
$this->SITUACT=$this->NICMERE=$this->SIRENMERE=$this->SIRETMERE=$this->NOMMERE='';
|
||||
|
||||
$lienM = new SdMetier_Liens_Base($siren, 'siren');
|
||||
$lienM = new Metier_Liens_Base($siren, 'siren');
|
||||
|
||||
// Actionnaire
|
||||
$tabA = $lienM->getActionnaires(null, true);
|
||||
@ -2282,8 +2278,8 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
6=>'MargeExploitation',
|
||||
);
|
||||
for($iTmp=1; $iTmp<7; $iTmp++)
|
||||
$strNote.=$tabTmp[$iTmp]." : ".$numerateur[$iTmp].'/'.$denominateur[$iTmp].'='.$note[$iTmp].' (Borné à '.$noteB[$iTmp].')'.EOL;
|
||||
$strNote.="Note Financière=$noteFin Conan Holder=$scoreConanH Afdcc1=$scoreAfdcc1 Afdcc2=$scoreAfdcc2note (Classe $scoreAfdcc2) Z=$scoreZ CCF=$valeurCCF ($pDef36) Altman=$scoreAltman AltmanCote=$scoreAltmanB".EOL.print_r($tabInfosNotation,true);
|
||||
$strNote.=$tabTmp[$iTmp]." : ".$numerateur[$iTmp].'/'.$denominateur[$iTmp].'='.$note[$iTmp].' (Borné à '.$noteB[$iTmp].')'.PHP_EOL;
|
||||
$strNote.="Note Financière=$noteFin Conan Holder=$scoreConanH Afdcc1=$scoreAfdcc1 Afdcc2=$scoreAfdcc2note (Classe $scoreAfdcc2) Z=$scoreZ CCF=$valeurCCF ($pDef36) Altman=$scoreAltman AltmanCote=$scoreAltmanB".PHP_EOL.print_r($tabInfosNotation,true);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -2311,11 +2307,11 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
$this->SCORECONF=100;
|
||||
|
||||
// Présence d'un bilan mais trop vieux
|
||||
if ($this->NBBILAN>0 && $classWdate->nbMoisEntre($this->BILANDATE,date('Ymd'))>=24) $this->BILANVIEUX=true;
|
||||
if ($this->NBBILAN>0 && Metier_Util_Date::nbMoisEntre($this->BILANDATE,date('Ymd'))>=24) $this->BILANVIEUX=true;
|
||||
else $this->BILANVIEUX=false;
|
||||
|
||||
// Présence d'un bilan mais trop vieux et c'est anormal
|
||||
if ($this->NBBILAN>0 && $classWdate->nbMoisEntre($this->BILANDATE,date('Ymd'))>=30) $this->BILANMANQUE=true;
|
||||
if ($this->NBBILAN>0 && Metier_Util_Date::nbMoisEntre($this->BILANDATE,date('Ymd'))>=30) $this->BILANMANQUE=true;
|
||||
else $this->BILANMANQUE=false;
|
||||
|
||||
if ( (@$tabBil[0]['Millesime']+20000<date('Ymd')*1) && // Le dernier bilan date de + de 2 ans
|
||||
@ -2332,7 +2328,6 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
|
||||
if ($tabIdentite['NonDiffusible']>0) { // Entreprise FJ=1xxx ayant demandé à sortir du champ de diffusion INSEE
|
||||
$this->SCORECONF-=5;
|
||||
//$tabCommentaires['gen'][]=prepareString("Cette affaire personnelle à demandée son retrait du champs de diffusion commercial de la base SIRENE.");
|
||||
$this->PPNONDIFF=true;
|
||||
} else {
|
||||
$this->PPNONDIFF=false;
|
||||
@ -2355,7 +2350,6 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
if ($valeur=='OUI')
|
||||
$zonesPri[]=$zone;
|
||||
$this->ZONEPRI=implode(', ', $zonesPri);
|
||||
//$tabCommentaires['gen'][]=prepareString("Cette entreprise est située en Zone Prioritaire.");
|
||||
}
|
||||
|
||||
/** Domiciliation d'entreprise **/
|
||||
@ -2374,7 +2368,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
$this->ANNONCEINTERDIT=0;
|
||||
$dirs = $iInsee->getDirigeants($siren, false);
|
||||
$timer['getDirigeants'] = microtime(true);
|
||||
//debugLog('I', 'SCOREDIR = '. print_r($dirs,1), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
//Metier_Util_Log::write('I', 'SCOREDIR = '. print_r($dirs,1), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
$this->DIR_NB=$this->NBDIRLIENS=$this->NBDIRSCI=$this->NBDIRSCIADR=0;
|
||||
if (count($dirs) > 0 ) {
|
||||
foreach ($dirs as $nb => $dir) {
|
||||
@ -2382,12 +2376,12 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
$this->DIR_NB++;
|
||||
if ($this->DIR_NB==1) {
|
||||
$this->DIR1_NOM=preg_replace('/ +/',' ',$dir['Civilite'].' '.$dir['Nom'].' '.$dir['Prenom']);
|
||||
$this->DIR1_AGE=floor($classWdate->nbMoisEntre($classWdate->dateT('d/m/Y','Ymd',$dir['NaissDate']))/12);
|
||||
$this->DIR1_AGE=floor(Metier_Util_Date::nbMoisEntre(Metier_Util_Date::dateT('d/m/Y','Ymd',$dir['NaissDate']))/12);
|
||||
$this->DIR1_FONC=$dir['Titre'];
|
||||
$this->DIR1_TYPE='PP';
|
||||
} elseif ($this->DIR_NB==2) {
|
||||
$this->DIR2_NOM=preg_replace('/ +/',' ',$dir['Civilite'].' '.$dir['Nom'].' '.$dir['Prenom']);
|
||||
$this->DIR2_AGE=floor($classWdate->nbMoisEntre($classWdate->dateT('d/m/Y','Ymd',$dir['NaissDate']))/12);
|
||||
$this->DIR2_AGE=floor(Metier_Util_Date::nbMoisEntre(Metier_Util_Date::dateT('d/m/Y','Ymd',$dir['NaissDate']))/12);
|
||||
$this->DIR2_FONC=$dir['Titre'];
|
||||
$this->DIR2_TYPE='PP';
|
||||
}
|
||||
@ -2442,7 +2436,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
|
||||
}
|
||||
$this->ANNONCEINTERDIT++;
|
||||
$this->ANNONCEINTERDITDATE=$classWdate->dateT('d/m/Y','Y-m-d', $dir['DateFct']);
|
||||
$this->ANNONCEINTERDITDATE=Metier_Util_Date::dateT('d/m/Y','Y-m-d', $dir['DateFct']);
|
||||
break(2);
|
||||
case 15:
|
||||
case 16: // Procédure collective dans l'historique du dirigeant
|
||||
@ -2502,40 +2496,40 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
switch ($infoFacto[0]['CodeRisque']) {
|
||||
case 'OK':
|
||||
$this->COTEOK=true;
|
||||
$this->COTEOK_MMAA=$this->CSFACTO_MMAA=$classWdate->dateT('Y-m-d', 'Ym', $infoFacto[0]['DateEven']);
|
||||
$this->COTEOK_MMAA=$this->CSFACTO_MMAA=Metier_Util_Date::dateT('Y-m-d', 'Ym', $infoFacto[0]['DateEven']);
|
||||
if ($noteSolvabilite>=40 && $noteSolvabilite<=45) $noteSolvabilite+=5;
|
||||
$this->CSFACTO=0;
|
||||
break;
|
||||
case 'IP': $this->IMPAYE=true;
|
||||
$this->IMPAYE_MMAA=$this->CSFACTO_MMAA=$classWdate->dateT('Y-m-d', 'Ym', $infoFacto[0]['DateEven']);
|
||||
$this->IMPAYE_MMAA=$this->CSFACTO_MMAA=Metier_Util_Date::dateT('Y-m-d', 'Ym', $infoFacto[0]['DateEven']);
|
||||
$this->CSFACTO='I';
|
||||
$profilPayeur=5;
|
||||
break;
|
||||
case 'PR':
|
||||
$this->PRIVILEGES=true;
|
||||
$this->PRIVILEGES_MMAA=$this->CSFACTO_MMAA=$classWdate->dateT('Y-m-d', 'Ym', $infoFacto[0]['DateEven']);
|
||||
$this->PRIVILEGES_MMAA=$this->CSFACTO_MMAA=Metier_Util_Date::dateT('Y-m-d', 'Ym', $infoFacto[0]['DateEven']);
|
||||
$this->CSFACTO='P';
|
||||
$profilPayeur=5;
|
||||
break;
|
||||
case 'RG':
|
||||
$this->RISQUEGROUPE=true;
|
||||
$this->RISQUEGROUPE_MMAA=$this->CSFACTO_MMAA=$classWdate->dateT('Y-m-d', 'Ym', $infoFacto[0]['DateEven']);
|
||||
$this->RISQUEGROUPE_MMAA=$this->CSFACTO_MMAA=Metier_Util_Date::dateT('Y-m-d', 'Ym', $infoFacto[0]['DateEven']);
|
||||
$this->CSFACTO=24; $this->SCOREDIRI-=10;
|
||||
break;
|
||||
case 'DEF':
|
||||
$this->DEFAUT=true;
|
||||
$this->DEFAUT_MMAA=$this->CSFACTO_MMAA=$classWdate->dateT('Y-m-d', 'Ym', $infoFacto[0]['DateEven']);
|
||||
$this->DEFAUT_MMAA=$this->CSFACTO_MMAA=Metier_Util_Date::dateT('Y-m-d', 'Ym', $infoFacto[0]['DateEven']);
|
||||
$this->CSFACTO='D';
|
||||
break;
|
||||
case 'LC':
|
||||
$this->LCASSUR=true;
|
||||
$this->LCASSUR_MMAA=$this->CSFACTO_MMAA=$classWdate->dateT('Y-m-d', 'Ym', $infoFacto[0]['DateEven']);
|
||||
$this->LCASSUR_MMAA=$this->CSFACTO_MMAA=Metier_Util_Date::dateT('Y-m-d', 'Ym', $infoFacto[0]['DateEven']);
|
||||
$this->CSFACTO='T';
|
||||
break;
|
||||
case 'KO':
|
||||
$noteSolvabilite=$this->SCORECONF=$this->SCOREDIRI=0;
|
||||
$this->CSFACTO=50;
|
||||
$this->CSFACTO_MMAA=$classWdate->dateT('Y-m-d', 'Ym', $infoFacto[0]['DateEven']);
|
||||
$this->CSFACTO_MMAA=Metier_Util_Date::dateT('Y-m-d', 'Ym', $infoFacto[0]['DateEven']);
|
||||
break;
|
||||
default:
|
||||
if ($iFacto->risqueImpaye) {
|
||||
@ -2543,15 +2537,15 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
$this->RISQUEIMPAYE=true;
|
||||
} else {
|
||||
$this->CSFACTO=$infoFacto[0]['CoteCS']*1;
|
||||
$this->CSFACTO_MMAA=$classWdate->dateT('Y-m-d', 'Ym', $infoFacto[0]['DateEven']);
|
||||
$this->CSFACTO_MMAA=Metier_Util_Date::dateT('Y-m-d', 'Ym', $infoFacto[0]['DateEven']);
|
||||
}
|
||||
break;
|
||||
}
|
||||
$this->CSFACTOFIN_MMAA=$classWdate->dateT('Y-m-d', 'Ym', $infoFacto[0]['DateFin']);
|
||||
$this->CSFACTOFIN_MMAA=Metier_Util_Date::dateT('Y-m-d', 'Ym', $infoFacto[0]['DateFin']);
|
||||
if ($infoFacto[0]['CoteCS']*1>0)
|
||||
$libInfoPaiement='Courant '.$classWdate->dateT('Y-m-d', 'M Y', $infoFacto[0]['DateEven']).' : '.$infoFacto[0]['LibCS'];
|
||||
$libInfoPaiement='Courant '.Metier_Util_Date::dateT('Y-m-d', 'M Y', $infoFacto[0]['DateEven']).' : '.$infoFacto[0]['LibCS'];
|
||||
else {
|
||||
$libInfoPaiement=trim('Depuis '.$classWdate->dateT('Y-m-d', 'M Y', $infoFacto[0]['DateEven']).' : '.$infoFacto[0]['LibCS'].' '.$libProfilPayeur);
|
||||
$libInfoPaiement=trim('Depuis '.Metier_Util_Date::dateT('Y-m-d', 'M Y', $infoFacto[0]['DateEven']).' : '.$infoFacto[0]['LibCS'].' '.$libProfilPayeur);
|
||||
$encoursCS=7500;
|
||||
}
|
||||
} else {
|
||||
@ -2562,7 +2556,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
$libInfoPaiement='Aucun retard de paiement significatif n\'a été porté à notre connaissance par l\'ensemble de nos partenaires.';
|
||||
}
|
||||
if ($iFacto->risqueImpaye) {
|
||||
$this->RISQUEIMPAYE_MMAA=$classWdate->dateT('Y-m', 'Ym', $iFacto->risqueImpayeDate);
|
||||
$this->RISQUEIMPAYE_MMAA=Metier_Util_Date::dateT('Y-m', 'Ym', $iFacto->risqueImpayeDate);
|
||||
if ((''.$iFacto->risqueImpayeDate.'-01')>$this->MODIFPAIDATE)
|
||||
$this->MODIFPAIDATE=''.$iFacto->risqueImpayeDate.'-01';
|
||||
}
|
||||
@ -2582,11 +2576,11 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
$this->PRIVILEGES=true;
|
||||
$this->PRIVILEGESECU=$tabPriv['03']['nb'];
|
||||
$this->PRIVILEGESECU_MT=$tabPriv['03']['insCumul'];
|
||||
$this->PRIVILEGES_MMAA=$classWdate->dateT('Y-m-d', 'Ym', $tabPriv['03']['dateFraiche']);
|
||||
$this->PRIVILEGES_MMAA=Metier_Util_Date::dateT('Y-m-d', 'Ym', $tabPriv['03']['dateFraiche']);
|
||||
if ($tabPriv['03']['dateFraiche']>$this->MODIFPAIDATE)
|
||||
$this->MODIFPAIDATE=$tabPriv['03']['dateFraiche'];
|
||||
if ($infoFacto[0]['CoteCS']*1==0)
|
||||
$libInfoPaiement=trim('Depuis le '.$classWdate->dateT('Y-m-d', 'd/m/Y', $tabPriv['03']['dateFraiche'])." : $this->PRIVILEGESECU inscription(s) URSSAF pour un montant de ".number_format($this->PRIVILEGESECU_MT,2,',',' ')." euros. $libProfilPayeur");
|
||||
$libInfoPaiement=trim('Depuis le '.Metier_Util_Date::dateT('Y-m-d', 'd/m/Y', $tabPriv['03']['dateFraiche'])." : $this->PRIVILEGESECU inscription(s) URSSAF pour un montant de ".number_format($this->PRIVILEGESECU_MT,2,',',' ')." euros. $libProfilPayeur");
|
||||
if ($this->PRIVILEGESECU==1 && $this->PRIVILEGESECU_MT<15000) {
|
||||
if (($this->NBBILAN==0||$this->BILANVIEUX||$this->BILANMANQUE) && $this->CAPITAL<750000) $noteSolvMax=42;
|
||||
elseif (($this->NBBILAN==0||$this->BILANVIEUX||$this->BILANMANQUE) && $this->CAPITAL>=750000) $noteSolvMax=45;
|
||||
@ -2602,14 +2596,14 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
$this->PRIVILEGES=true;
|
||||
$this->PRIVILEGETRES=$tabPriv['04']['nb'];
|
||||
$this->PRIVILEGETRES_MT=$tabPriv['04']['insCumul'];
|
||||
$this->PRIVILEGES_MMAA=$classWdate->dateT('Y-m-d', 'Ym', $tabPriv['04']['dateFraiche']);
|
||||
$this->PRIVILEGES_MMAA=Metier_Util_Date::dateT('Y-m-d', 'Ym', $tabPriv['04']['dateFraiche']);
|
||||
if ($tabPriv['04']['dateFraiche']>$this->MODIFPAIDATE)
|
||||
$this->MODIFPAIDATE=$tabPriv['04']['dateFraiche'];
|
||||
if ($infoFacto[0]['CoteCS']*1==0)
|
||||
if ($this->PRIVILEGESECU<1)
|
||||
$libInfoPaiement=trim('Depuis le '.$classWdate->dateT('Y-m-d', 'd/m/Y', $tabPriv['04']['dateFraiche'])." : $this->PRIVILEGETRES inscription(s) TRESOR pour un montant de ".number_format($this->PRIVILEGETRES_MT,2,',',' ')." euros. $libProfilPayeur");
|
||||
$libInfoPaiement=trim('Depuis le '.Metier_Util_Date::dateT('Y-m-d', 'd/m/Y', $tabPriv['04']['dateFraiche'])." : $this->PRIVILEGETRES inscription(s) TRESOR pour un montant de ".number_format($this->PRIVILEGETRES_MT,2,',',' ')." euros. $libProfilPayeur");
|
||||
else
|
||||
$libInfoPaiement.='<br/>'.trim('Depuis le '.$classWdate->dateT('Y-m-d', 'd/m/Y', $tabPriv['04']['dateFraiche'])." : $this->PRIVILEGETRES inscription(s) TRESOR pour un montant de ".number_format($this->PRIVILEGETRES_MT,2,',',' ')." euros. $libProfilPayeur");
|
||||
$libInfoPaiement.='<br/>'.trim('Depuis le '.Metier_Util_Date::dateT('Y-m-d', 'd/m/Y', $tabPriv['04']['dateFraiche'])." : $this->PRIVILEGETRES inscription(s) TRESOR pour un montant de ".number_format($this->PRIVILEGETRES_MT,2,',',' ')." euros. $libProfilPayeur");
|
||||
if ($this->PRIVILEGETRES==1 && $this->PRIVILEGETRES_MT<15000) {
|
||||
if ($this->PRIVILEGESECU>0) $seuil=45;
|
||||
else $seuil=55;
|
||||
@ -2711,7 +2705,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
$dateMaj = $tabTmp[0]['dateInsert'];
|
||||
}
|
||||
// Si pas plus vieux que 6 mois
|
||||
if ($classWdate->nbMoisEntre($dateMaj, date('Ymd')) <= $this->ENQUETELIM) {
|
||||
if (Metier_Util_Date::nbMoisEntre($dateMaj, date('Ymd')) <= $this->ENQUETELIM) {
|
||||
$encoursForce=$tabTmp[0]['encours'];
|
||||
if ($tabTmp[0]['scoreConf'] !== null) {
|
||||
$this->SCORECONF = $tabTmp[0]['scoreConf'];
|
||||
@ -2847,7 +2841,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
|
||||
if ($encoursEstime>$plafondEstime) $encoursEstime=$plafondEstime;
|
||||
|
||||
// debugLog('I', "INDISCORE B $encoursIni $encoursEstime $encours", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
// Metier_Util_Log::write('I', "INDISCORE B $encoursIni $encoursEstime $encours", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
|
||||
// Si l'entreprise à moins de 12 mois, on divise son encours estimé par 2
|
||||
if ($encoursEstime>0) {
|
||||
@ -2926,9 +2920,9 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
$this->BILANDATE=$tabTmp[0]['dateClotureNum'];
|
||||
if ($this->BILANDATE>0 && $tabIdentite['SituationJuridique']=='' && $tabIdentite['Actif']==1) {
|
||||
$this->BILAN=true;
|
||||
if ($classWdate->nbMoisEntre($this->BILANDATE,date('Ymd'))>=24) $this->BILANVIEUX=true;
|
||||
if (Metier_Util_Date::nbMoisEntre($this->BILANDATE,date('Ymd'))>=24) $this->BILANVIEUX=true;
|
||||
else $this->BILANVIEUX=false;
|
||||
if ($classWdate->nbMoisEntre($this->BILANDATE,date('Ymd'))>=30) $this->BILANMANQUE=true;
|
||||
if (Metier_Util_Date::nbMoisEntre($this->BILANDATE,date('Ymd'))>=30) $this->BILANMANQUE=true;
|
||||
else $this->BILANMANQUE=false;
|
||||
$this->ENCOURS=$this->CAESTIME/72;
|
||||
if ($noteSolvabilite>=40 && $this->ENCOURS<5000) $this->ENCOURS=5000;
|
||||
@ -2957,10 +2951,10 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
$libEncours='Aucun risque de défaillance sur les administrations ou institutions.';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Encours à 0 car score < 40
|
||||
else {
|
||||
|
||||
|
||||
$this->ENCOURSCALC=$this->ENCOURS;
|
||||
$this->ENCOURS=0;
|
||||
$libEncours='Aucun encours conseillé par rapport à notre évaluation.';
|
||||
@ -3392,25 +3386,33 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
$CADTER_SURF_CUM=0; // Cumul Surfaces des terrains à l'addresse
|
||||
*/
|
||||
// Locaux
|
||||
$iCadastre = new Metier_Partenaires_MCadastre($this->db);
|
||||
$tabTmp=$iCadastre->getLocaux($siren);
|
||||
if(count($tabTmp)>0 ) {
|
||||
foreach ($tabTmp as $iTmp=>$cad) {
|
||||
$iCadastre = new Metier_Partenaires_MCadastre($siren, $this->db);
|
||||
$tabTmp = $iCadastre->getLocaux();
|
||||
if(count($tabTmp) > 0) {
|
||||
foreach ($tabTmp as $iTmp => $cad) {
|
||||
$this->CADBAT_NB_TOT++;
|
||||
if ($cad['localDroit']=='P') $this->CADBAT_NB_PROP++;
|
||||
else $this->CADBAT_NB_NONPROP++;
|
||||
$this->CADBAT_SURF_TOT+=$cad['localSurface'];
|
||||
if ($cad['localDroit'] == 'P'){
|
||||
$this->CADBAT_NB_PROP++;
|
||||
}
|
||||
else {
|
||||
$this->CADBAT_NB_NONPROP++;
|
||||
}
|
||||
$this->CADBAT_SURF_TOT+= $cad['localSurface'];
|
||||
}
|
||||
}
|
||||
// Parcelles
|
||||
$tabTmp = $iCadastre->getParcelles($siren);
|
||||
foreach ($tabTmp as $iTmp=>$cad) {
|
||||
$tabTmp = $iCadastre->getParcelles();
|
||||
foreach ($tabTmp as $iTmp => $cad) {
|
||||
$this->CADTER_NB_TOT++;
|
||||
if ($cad['parcelDroit']=='P') $this->CADTER_NB_PROP++;
|
||||
else $this->CADTER_NB_NONPROP++;
|
||||
$this->CADTER_SURF_TOT+=$cad['parcelSurface'];
|
||||
if ($cad['parcelDroit'] == 'P') {
|
||||
$this->CADTER_NB_PROP++;
|
||||
}
|
||||
else {
|
||||
$this->CADTER_NB_NONPROP++;
|
||||
}
|
||||
$this->CADTER_SURF_TOT+= $cad['parcelSurface'];
|
||||
}
|
||||
$timer['cadastre']=microtime(true);
|
||||
$timer['cadastre'] = microtime(true);
|
||||
|
||||
/** RPS : Entreprise avec négociations ou accord sur les RPS ? **/
|
||||
$tabTmp = $this->db->select(
|
||||
@ -3650,7 +3652,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
//@eval('\$strTmp="'.$strTmp2.'";');
|
||||
$strTmp=eval("return \"$strTmp2\";");
|
||||
|
||||
$tabComment[$idxC]=preg_replace('/<\/i>(?:<br\/>)<\/i>/i','</i>', $debLigne.prepareString($strTmp).$finLigne);//." ($idxC, $ordre)";
|
||||
$tabComment[$idxC]=preg_replace('/<\/i>(?:<br\/>)<\/i>/i','</i>', $debLigne.$strTmp.$finLigne);//." ($idxC, $ordre)";
|
||||
if (substr($strTmp,0,17)=='ERREUR DE FORMULE') {
|
||||
|
||||
}
|
||||
@ -3673,37 +3675,37 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
{
|
||||
if (isset(${$var})) {
|
||||
if (is_array(${$var})) {
|
||||
$variables.="$var=".print_r(${$var}).EOL;
|
||||
$variables.="$var=".print_r(${$var}).PHP_EOL;
|
||||
} else {
|
||||
$variables.="$var='${$var}'".EOL;
|
||||
$variables.="$var='${$var}'".PHP_EOL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$variables.="$var='${$var}' NON DEFINIE !!!".EOL;
|
||||
$variables.="$var='${$var}' NON DEFINIE !!!".PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
||||
file_put_contents($this->SIREN.'_'.$type.'.log',
|
||||
"Indiscore sur $siren : Commentaires".EOL.
|
||||
"Liste des variables :\n$variables".EOL.
|
||||
'CA_COEF='.$this->CA_COEF.EOL.
|
||||
'CA_Y='.print_r($this->CA_Y,true).EOL.EOL.
|
||||
'RCAI_COEF='.$this->RCAI_COEF.EOL.
|
||||
'RCAI_Y='.print_r($this->RCAI_Y,true).EOL.
|
||||
"PROJECCOEF=$this->PROJECCOEF".EOL.
|
||||
"PROJECTAUX=$this->PROJECTAUX".EOL.
|
||||
"Y=".print_r($this->Y,true).EOL.
|
||||
"Yaff=".print_r($this->Yaff,true).EOL.
|
||||
"tabRegX=".print_r($this->tabRegX,true).EOL.
|
||||
print_r($tabComment, true).EOL.
|
||||
"Liste des commentaires a trier :\n".print_r($tabCommentairesATrier,true).EOL.
|
||||
"Tableau des codes de tri pour calcul :\n".print_r($tabTri,true).EOL.
|
||||
"Tableau des codes de tri pour affichage :\n".print_r($tabTriAff,true).EOL.
|
||||
$debugFormule.EOL.'-----------------------'.EOL.
|
||||
"Liste des Bilans :\n".print_r($tabBilans, true).EOL.
|
||||
"tabBil=".print_r($tabBil,true).EOL.
|
||||
"Liste des Ratios :\n".print_r($tabRatios, true).EOL.
|
||||
"Liste des ratios Evolutions :\n". print_r($tabRatiosEvol, true).EOL
|
||||
"Indiscore sur $siren : Commentaires".PHP_EOL.
|
||||
"Liste des variables :\n$variables".PHP_EOL.
|
||||
'CA_COEF='.$this->CA_COEF.PHP_EOL.
|
||||
'CA_Y='.print_r($this->CA_Y,true).PHP_EOL.PHP_EOL.
|
||||
'RCAI_COEF='.$this->RCAI_COEF.PHP_EOL.
|
||||
'RCAI_Y='.print_r($this->RCAI_Y,true).PHP_EOL.
|
||||
"PROJECCOEF=$this->PROJECCOEF".PHP_EOL.
|
||||
"PROJECTAUX=$this->PROJECTAUX".PHP_EOL.
|
||||
"Y=".print_r($this->Y,true).PHP_EOL.
|
||||
"Yaff=".print_r($this->Yaff,true).PHP_EOL.
|
||||
"tabRegX=".print_r($this->tabRegX,true).PHP_EOL.
|
||||
print_r($tabComment, true).PHP_EOL.
|
||||
"Liste des commentaires a trier :\n".print_r($tabCommentairesATrier,true).PHP_EOL.
|
||||
"Tableau des codes de tri pour calcul :\n".print_r($tabTri,true).PHP_EOL.
|
||||
"Tableau des codes de tri pour affichage :\n".print_r($tabTriAff,true).PHP_EOL.
|
||||
$debugFormule.PHP_EOL.'-----------------------'.PHP_EOL.
|
||||
"Liste des Bilans :\n".print_r($tabBilans, true).PHP_EOL.
|
||||
"tabBil=".print_r($tabBil,true).PHP_EOL.
|
||||
"Liste des Ratios :\n".print_r($tabRatios, true).PHP_EOL.
|
||||
"Liste des ratios Evolutions :\n". print_r($tabRatiosEvol, true).PHP_EOL
|
||||
);
|
||||
|
||||
$i=0; $strTime='';
|
||||
@ -3718,7 +3720,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
}
|
||||
$duree=round($time-$timeDeb,3);
|
||||
$strTime.="---------------------\nTOTAL : $duree secondes\n";
|
||||
file_put_contents('time.log', "Indiscore sur $siren : Durées ".$strTime.EOL.$strNote.EOL.$variables.EOL.print_r($tabRatiosInfos,true));
|
||||
file_put_contents('time.log', "Indiscore sur $siren : Durées ".$strTime.PHP_EOL.$strNote.PHP_EOL.$variables.PHP_EOL.print_r($tabRatiosInfos,true));
|
||||
}
|
||||
|
||||
// EntActiveRCS
|
||||
@ -3881,7 +3883,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
if ($indiScore==$indiScorePre && $this->ENCOURS==$encoursPre && $dateScore<>0 ) {
|
||||
$tabUpdate2 = array('sourceModif'=>$sourceModif, 'nbModifs'=>$nbModifs);
|
||||
if (!$this->db->update('jo.scores_surveillance', $tabUpdate2, "siren=$siren", false, 0, true)) {
|
||||
debugLog('W', 'Erreur lors de la MAJ du score en surveillance pour '. $tabIdentite['Nom'], __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
Metier_Util_Log::write('W', 'Erreur lors de la MAJ du score en surveillance pour '. $tabIdentite['Nom'], __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -3889,16 +3891,10 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
$EffectifEn = $tabIdentite['Effectif'];
|
||||
$bilanAgeMax = 3 * 12; //Age maximum du dernier bilan en mois
|
||||
if (!empty($tabIdentite['bilanDate']) && intval($tabIdentite['bilanYP'])>0 ) {
|
||||
|
||||
Zend_Date::setOptions(array('extend_month' => true));
|
||||
$dateBilan = new Zend_Date($tabIdentite['bilanDate'], 'yyyyMMdd');
|
||||
$dateNow = new Zend_Date();
|
||||
$difference = $dateNow->sub($dateBilan);
|
||||
$measure = new Zend_Measure_Time($difference->toValue(), Zend_Measure_Time::SECOND);
|
||||
$measure->convertTo(Zend_Measure_Time::MONTH);
|
||||
$nbMonth = $measure->getValue();
|
||||
|
||||
if ( $nbMonth < $bilanAgeMax ) {
|
||||
$dateBilan = DateTime::createFromFormat('Ymd', $tabIdentite['bilanDate']);
|
||||
$dateCompare = new DateTime();
|
||||
$dateCompare->sub(new DateInterval('P'.$bilanAgeMax.'M'));
|
||||
if ($dateBilan > $dateCompare) {
|
||||
$EffectifEn = $tabIdentite['bilanYP'];
|
||||
}
|
||||
}
|
||||
@ -3974,23 +3970,23 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
// --- Sauvegarde et Historisation du score
|
||||
if ( $actionHisto == 'insert' ) {
|
||||
if (!$this->db->insert('jo.scores_surveillance', $tabUpdate, false, true)) {
|
||||
debugLog('W', "Erreur lors de l'ajout du score en surveillance pour ". $tabIdentite['Nom']." - ".mysql_error(), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
Metier_Util_Log::write('W', "Erreur lors de l'ajout du score en surveillance pour ". $tabIdentite['Nom']." - ".mysql_error(), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!$this->db->update('jo.scores_surveillance', $tabUpdate, "siren=$siren", false, 0, true)) {
|
||||
debugLog('W', "Erreur lors de mise à jour du score en surveillance pour ". $tabIdentite['Nom']." - ".mysql_error(), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
Metier_Util_Log::write('W', "Erreur lors de mise à jour du score en surveillance pour ". $tabIdentite['Nom']." - ".mysql_error(), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
}
|
||||
}
|
||||
|
||||
// --- Historisation du score
|
||||
if (!$this->db->insert('historiques.scores_surveillance', $tabUpdate)) {
|
||||
debugLog('W', "Erreur lors de l'historisation du score pour ". $tabIdentite['Nom'], __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
Metier_Util_Log::write('W', "Erreur lors de l'historisation du score pour ". $tabIdentite['Nom'], __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
debugLog('I', 'Etablissement retourné FIN = '. $tabIdentite['Nom'], __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
Metier_Util_Log::write('I', 'Etablissement retourné FIN = '. $tabIdentite['Nom'], __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
|
||||
return $tabRet;
|
||||
}
|
0
library/SdMetier/Scoring/Comment/ScoreTri405N2.php → library/Metier/Scoring/Comment/ScoreTri405N2.php
Normal file → Executable file
0
library/SdMetier/Scoring/Comment/ScoreTri405N2.php → library/Metier/Scoring/Comment/ScoreTri405N2.php
Normal file → Executable file
0
library/SdMetier/Scoring/Comment/ScoreTri408N2.php → library/Metier/Scoring/Comment/ScoreTri408N2.php
Normal file → Executable file
0
library/SdMetier/Scoring/Comment/ScoreTri408N2.php → library/Metier/Scoring/Comment/ScoreTri408N2.php
Normal file → Executable file
0
library/SdMetier/Scoring/Comment/ScoreTri409N2.php → library/Metier/Scoring/Comment/ScoreTri409N2.php
Normal file → Executable file
0
library/SdMetier/Scoring/Comment/ScoreTri409N2.php → library/Metier/Scoring/Comment/ScoreTri409N2.php
Normal file → Executable file
0
library/SdMetier/Scoring/Comment/ScoreTri411N2.php → library/Metier/Scoring/Comment/ScoreTri411N2.php
Normal file → Executable file
0
library/SdMetier/Scoring/Comment/ScoreTri411N2.php → library/Metier/Scoring/Comment/ScoreTri411N2.php
Normal file → Executable file
0
library/SdMetier/Scoring/Comment/ScoreTri414N2.php → library/Metier/Scoring/Comment/ScoreTri414N2.php
Normal file → Executable file
0
library/SdMetier/Scoring/Comment/ScoreTri414N2.php → library/Metier/Scoring/Comment/ScoreTri414N2.php
Normal file → Executable file
0
library/SdMetier/Scoring/Comment/ScoreTxt405N2.php → library/Metier/Scoring/Comment/ScoreTxt405N2.php
Normal file → Executable file
0
library/SdMetier/Scoring/Comment/ScoreTxt405N2.php → library/Metier/Scoring/Comment/ScoreTxt405N2.php
Normal file → Executable file
0
library/SdMetier/Scoring/Comment/ScoreTxt408N2.php → library/Metier/Scoring/Comment/ScoreTxt408N2.php
Normal file → Executable file
0
library/SdMetier/Scoring/Comment/ScoreTxt408N2.php → library/Metier/Scoring/Comment/ScoreTxt408N2.php
Normal file → Executable file
0
library/SdMetier/Scoring/Comment/ScoreTxt409N2.php → library/Metier/Scoring/Comment/ScoreTxt409N2.php
Normal file → Executable file
0
library/SdMetier/Scoring/Comment/ScoreTxt409N2.php → library/Metier/Scoring/Comment/ScoreTxt409N2.php
Normal file → Executable file
0
library/SdMetier/Scoring/Comment/ScoreTxt411N2.php → library/Metier/Scoring/Comment/ScoreTxt411N2.php
Normal file → Executable file
0
library/SdMetier/Scoring/Comment/ScoreTxt411N2.php → library/Metier/Scoring/Comment/ScoreTxt411N2.php
Normal file → Executable file
0
library/SdMetier/Scoring/Comment/ScoreTxt414N2.php → library/Metier/Scoring/Comment/ScoreTxt414N2.php
Normal file → Executable file
0
library/SdMetier/Scoring/Comment/ScoreTxt414N2.php → library/Metier/Scoring/Comment/ScoreTxt414N2.php
Normal file → Executable file
0
library/SdMetier/Scoring/Comment/ValoTri24N2.php → library/Metier/Scoring/Comment/ValoTri24N2.php
Normal file → Executable file
0
library/SdMetier/Scoring/Comment/ValoTri24N2.php → library/Metier/Scoring/Comment/ValoTri24N2.php
Normal file → Executable file
0
library/SdMetier/Scoring/Comment/ValoTri26N2.php → library/Metier/Scoring/Comment/ValoTri26N2.php
Normal file → Executable file
0
library/SdMetier/Scoring/Comment/ValoTri26N2.php → library/Metier/Scoring/Comment/ValoTri26N2.php
Normal file → Executable file
0
library/SdMetier/Scoring/Comment/ValoTri28N2.php → library/Metier/Scoring/Comment/ValoTri28N2.php
Normal file → Executable file
0
library/SdMetier/Scoring/Comment/ValoTri28N2.php → library/Metier/Scoring/Comment/ValoTri28N2.php
Normal file → Executable file
0
library/SdMetier/Scoring/Comment/ValoTriv209N2.php → library/Metier/Scoring/Comment/ValoTriv209N2.php
Normal file → Executable file
0
library/SdMetier/Scoring/Comment/ValoTriv209N2.php → library/Metier/Scoring/Comment/ValoTriv209N2.php
Normal file → Executable file
0
library/SdMetier/Scoring/Comment/ValoTriv209N3.php → library/Metier/Scoring/Comment/ValoTriv209N3.php
Normal file → Executable file
0
library/SdMetier/Scoring/Comment/ValoTriv209N3.php → library/Metier/Scoring/Comment/ValoTriv209N3.php
Normal file → Executable file
0
library/SdMetier/Scoring/Comment/ValoTxt24N2.php → library/Metier/Scoring/Comment/ValoTxt24N2.php
Normal file → Executable file
0
library/SdMetier/Scoring/Comment/ValoTxt24N2.php → library/Metier/Scoring/Comment/ValoTxt24N2.php
Normal file → Executable file
0
library/SdMetier/Scoring/Comment/ValoTxt26N2.php → library/Metier/Scoring/Comment/ValoTxt26N2.php
Normal file → Executable file
0
library/SdMetier/Scoring/Comment/ValoTxt26N2.php → library/Metier/Scoring/Comment/ValoTxt26N2.php
Normal file → Executable file
0
library/SdMetier/Scoring/Comment/ValoTxt28N2.php → library/Metier/Scoring/Comment/ValoTxt28N2.php
Normal file → Executable file
0
library/SdMetier/Scoring/Comment/ValoTxt28N2.php → library/Metier/Scoring/Comment/ValoTxt28N2.php
Normal file → Executable file
0
library/SdMetier/Scoring/Comment/ValoTxtv209N2.php → library/Metier/Scoring/Comment/ValoTxtv209N2.php
Normal file → Executable file
0
library/SdMetier/Scoring/Comment/ValoTxtv209N2.php → library/Metier/Scoring/Comment/ValoTxtv209N2.php
Normal file → Executable file
0
library/SdMetier/Scoring/Comment/ValoTxtv209N3.php → library/Metier/Scoring/Comment/ValoTxtv209N3.php
Normal file → Executable file
0
library/SdMetier/Scoring/Comment/ValoTxtv209N3.php → library/Metier/Scoring/Comment/ValoTxtv209N3.php
Normal file → Executable file
0
library/SdMetier/Scoring/Data/Formules.php → library/Metier/Scoring/Data/Formules.php
Normal file → Executable file
0
library/SdMetier/Scoring/Data/Formules.php → library/Metier/Scoring/Data/Formules.php
Normal file → Executable file
0
library/SdMetier/Scoring/Data/Infla.php → library/Metier/Scoring/Data/Infla.php
Normal file → Executable file
0
library/SdMetier/Scoring/Data/Infla.php → library/Metier/Scoring/Data/Infla.php
Normal file → Executable file
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user