Merge remote-tracking branch 'origin/develop'
This commit is contained in:
commit
ac8d185c6e
@ -1,4 +1,8 @@
|
||||
<?php
|
||||
use Monolog\Logger;
|
||||
use Monolog\Handler\StreamHandler;
|
||||
use Monolog\Processor\IntrospectionProcessor;
|
||||
|
||||
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||
{
|
||||
protected function _initConfig()
|
||||
@ -96,10 +100,10 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||
foreach ($services as $section => $params) {
|
||||
if ($params['actif']) {
|
||||
$route = new Zend_Controller_Router_Route($section.'/:version', array(
|
||||
'controller' => 'service',
|
||||
'action' => 'index',
|
||||
'service' => $section,
|
||||
'version' => '',
|
||||
'controller' => 'service',
|
||||
'action' => 'index',
|
||||
'service' => $section,
|
||||
'version' => '',
|
||||
));
|
||||
$router->addRoute($section, $route);
|
||||
}
|
||||
@ -107,17 +111,17 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||
|
||||
// Route pour WS Clients
|
||||
$route = new Zend_Controller_Router_Route('clients/:client/:version', array(
|
||||
'controller' => 'service',
|
||||
'action' => 'index',
|
||||
'service' => 'clients',
|
||||
'client' => '',
|
||||
'version' => ''
|
||||
'controller' => 'service',
|
||||
'action' => 'index',
|
||||
'service' => 'clients',
|
||||
'client' => '',
|
||||
'version' => ''
|
||||
));
|
||||
$router->addRoute('client', $route);
|
||||
|
||||
$fichierRoute = new Zend_Controller_Router_Route('fichier/:action/:fichier', array(
|
||||
'controller' => 'fichier',
|
||||
'fichier' => '',
|
||||
'controller' => 'fichier',
|
||||
'fichier' => '',
|
||||
));
|
||||
$router->addRoute('fichier', $fichierRoute);
|
||||
return $router;
|
||||
@ -194,4 +198,21 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||
Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);
|
||||
}
|
||||
}
|
||||
|
||||
protected function _initLogger()
|
||||
{
|
||||
$config = new Zend_Config($this->getOptions());
|
||||
$logFile = $config->profil->path->shared.'/log/application.log';
|
||||
|
||||
$log = new Logger('APP');
|
||||
if (APPLICATION_ENV == 'development') {
|
||||
$level = Logger::DEBUG;
|
||||
} else {
|
||||
$level = Logger::INFO;
|
||||
}
|
||||
$log->pushHandler(new StreamHandler($logFile), $level);
|
||||
$log->pushProcessor(new IntrospectionProcessor());
|
||||
|
||||
Zend_Registry::set('logger', $log);
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,8 @@
|
||||
"league/csv": "^8.1",
|
||||
"doctrine/dbal": "^2.5",
|
||||
"mikehaertl/phpwkhtmltopdf": "^2.2",
|
||||
"guzzlehttp/guzzle": "^6.2"
|
||||
"guzzlehttp/guzzle": "^6.2",
|
||||
"monolog/monolog": "^1.22"
|
||||
},
|
||||
"include-path": ["library/"],
|
||||
"autoload": {
|
||||
|
161
composer.lock
generated
161
composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "f1e440444eb2e2707d495c95551a35f6",
|
||||
"content-hash": "1b530fbc9321c88cb523070b302fe495",
|
||||
"packages": [
|
||||
{
|
||||
"name": "doctrine/annotations",
|
||||
@ -285,20 +285,20 @@
|
||||
},
|
||||
{
|
||||
"name": "doctrine/dbal",
|
||||
"version": "v2.5.5",
|
||||
"version": "v2.5.11",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/doctrine/dbal.git",
|
||||
"reference": "9f8c05cd5225a320d56d4bfdb4772f10d045a0c9"
|
||||
"reference": "1b1effbddbdc0f40d1c8f849f44bcddac4f52a48"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/doctrine/dbal/zipball/9f8c05cd5225a320d56d4bfdb4772f10d045a0c9",
|
||||
"reference": "9f8c05cd5225a320d56d4bfdb4772f10d045a0c9",
|
||||
"url": "https://api.github.com/repos/doctrine/dbal/zipball/1b1effbddbdc0f40d1c8f849f44bcddac4f52a48",
|
||||
"reference": "1b1effbddbdc0f40d1c8f849f44bcddac4f52a48",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"doctrine/common": ">=2.4,<2.7-dev",
|
||||
"doctrine/common": ">=2.4,<2.8-dev",
|
||||
"php": ">=5.3.2"
|
||||
},
|
||||
"require-dev": {
|
||||
@ -352,7 +352,7 @@
|
||||
"persistence",
|
||||
"queryobject"
|
||||
],
|
||||
"time": "2016-09-09T19:13:33+00:00"
|
||||
"time": "2017-02-04T21:20:13+00:00"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/inflector",
|
||||
@ -685,16 +685,16 @@
|
||||
},
|
||||
{
|
||||
"name": "league/csv",
|
||||
"version": "8.1.2",
|
||||
"version": "8.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/thephpleague/csv.git",
|
||||
"reference": "33447984f7a7038fefaa5a6177e8407b66bc85b4"
|
||||
"reference": "ef7eef710810c8bd0cf9371582ccd0123ff96d4b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/thephpleague/csv/zipball/33447984f7a7038fefaa5a6177e8407b66bc85b4",
|
||||
"reference": "33447984f7a7038fefaa5a6177e8407b66bc85b4",
|
||||
"url": "https://api.github.com/repos/thephpleague/csv/zipball/ef7eef710810c8bd0cf9371582ccd0123ff96d4b",
|
||||
"reference": "ef7eef710810c8bd0cf9371582ccd0123ff96d4b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -708,7 +708,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "8.1-dev"
|
||||
"dev-master": "8.2-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@ -738,20 +738,20 @@
|
||||
"read",
|
||||
"write"
|
||||
],
|
||||
"time": "2016-10-27T11:21:24+00:00"
|
||||
"time": "2017-01-25T13:32:07+00:00"
|
||||
},
|
||||
{
|
||||
"name": "mikehaertl/php-shellcommand",
|
||||
"version": "1.2.2",
|
||||
"version": "1.2.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mikehaertl/php-shellcommand.git",
|
||||
"reference": "0de4e2cce17936ec7cef60a62c722a4aaa56c18c"
|
||||
"reference": "a628505cd99b201375dd6bcd0b062ee07c8ba556"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/mikehaertl/php-shellcommand/zipball/0de4e2cce17936ec7cef60a62c722a4aaa56c18c",
|
||||
"reference": "0de4e2cce17936ec7cef60a62c722a4aaa56c18c",
|
||||
"url": "https://api.github.com/repos/mikehaertl/php-shellcommand/zipball/a628505cd99b201375dd6bcd0b062ee07c8ba556",
|
||||
"reference": "a628505cd99b201375dd6bcd0b062ee07c8ba556",
|
||||
"shasum": ""
|
||||
},
|
||||
"type": "library",
|
||||
@ -774,7 +774,7 @@
|
||||
"keywords": [
|
||||
"shell"
|
||||
],
|
||||
"time": "2016-07-16T09:42:31+00:00"
|
||||
"time": "2017-01-26T08:29:31+00:00"
|
||||
},
|
||||
{
|
||||
"name": "mikehaertl/php-tmpfile",
|
||||
@ -861,6 +861,84 @@
|
||||
],
|
||||
"time": "2016-06-02T08:06:45+00:00"
|
||||
},
|
||||
{
|
||||
"name": "monolog/monolog",
|
||||
"version": "1.22.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Seldaek/monolog.git",
|
||||
"reference": "bad29cb8d18ab0315e6c477751418a82c850d558"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/bad29cb8d18ab0315e6c477751418a82c850d558",
|
||||
"reference": "bad29cb8d18ab0315e6c477751418a82c850d558",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0",
|
||||
"psr/log": "~1.0"
|
||||
},
|
||||
"provide": {
|
||||
"psr/log-implementation": "1.0.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"aws/aws-sdk-php": "^2.4.9 || ^3.0",
|
||||
"doctrine/couchdb": "~1.0@dev",
|
||||
"graylog2/gelf-php": "~1.0",
|
||||
"jakub-onderka/php-parallel-lint": "0.9",
|
||||
"php-amqplib/php-amqplib": "~2.4",
|
||||
"php-console/php-console": "^3.1.3",
|
||||
"phpunit/phpunit": "~4.5",
|
||||
"phpunit/phpunit-mock-objects": "2.3.0",
|
||||
"ruflin/elastica": ">=0.90 <3.0",
|
||||
"sentry/sentry": "^0.13",
|
||||
"swiftmailer/swiftmailer": "~5.3"
|
||||
},
|
||||
"suggest": {
|
||||
"aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
|
||||
"doctrine/couchdb": "Allow sending log messages to a CouchDB server",
|
||||
"ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
|
||||
"ext-mongo": "Allow sending log messages to a MongoDB server",
|
||||
"graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
|
||||
"mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver",
|
||||
"php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib",
|
||||
"php-console/php-console": "Allow sending log messages to Google Chrome",
|
||||
"rollbar/rollbar": "Allow sending log messages to Rollbar",
|
||||
"ruflin/elastica": "Allow sending log messages to an Elastic Search server",
|
||||
"sentry/sentry": "Allow sending log messages to a Sentry server"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Monolog\\": "src/Monolog"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jordi Boggiano",
|
||||
"email": "j.boggiano@seld.be",
|
||||
"homepage": "http://seld.be"
|
||||
}
|
||||
],
|
||||
"description": "Sends your logs to files, sockets, inboxes, databases and various web services",
|
||||
"homepage": "http://github.com/Seldaek/monolog",
|
||||
"keywords": [
|
||||
"log",
|
||||
"logging",
|
||||
"psr-3"
|
||||
],
|
||||
"time": "2016-11-26T00:15:39+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/http-message",
|
||||
"version": "1.0.1",
|
||||
@ -911,6 +989,53 @@
|
||||
],
|
||||
"time": "2016-08-06T14:39:51+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/log",
|
||||
"version": "1.0.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-fig/log.git",
|
||||
"reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
|
||||
"reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Psr\\Log\\": "Psr/Log/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "PHP-FIG",
|
||||
"homepage": "http://www.php-fig.org/"
|
||||
}
|
||||
],
|
||||
"description": "Common interface for logging libraries",
|
||||
"homepage": "https://github.com/php-fig/log",
|
||||
"keywords": [
|
||||
"log",
|
||||
"psr",
|
||||
"psr-3"
|
||||
],
|
||||
"time": "2016-10-10T12:19:37+00:00"
|
||||
},
|
||||
{
|
||||
"name": "zendframework/zendframework1",
|
||||
"version": "1.12.20",
|
||||
|
17
docs/README
17
docs/README
@ -27,16 +27,13 @@ WebService
|
||||
|
||||
- Créer les repertoires de données nécessaires
|
||||
|
||||
[WORKSPACE]/data/backoffice/
|
||||
- clients => lien symbolique vers les fichiers clients
|
||||
- conso => données à conserver, dossier persistent
|
||||
- datafile => lien symbolique vers les fichiers PDF, et autres des partenaires
|
||||
- export
|
||||
- import
|
||||
- log
|
||||
- sources => lien symbolique vers les données des sources
|
||||
- stats
|
||||
- upload
|
||||
[WORKSPACE]/data/webservice/
|
||||
- cache
|
||||
- logs
|
||||
- sessions
|
||||
- wsdl
|
||||
- files
|
||||
- greffes
|
||||
|
||||
|
||||
Fonctionnement
|
||||
|
@ -38,22 +38,22 @@ profil.infogreffe.cache.time = 8
|
||||
profil.infogreffe.storage.path = "PROJECT_DIR/shared/datafile/greffes"
|
||||
|
||||
; Sphinx configuration
|
||||
profil.sphinx.ent.host = "192.168.78.249"
|
||||
profil.sphinx.ent.host = "172.18.8.5"
|
||||
profil.sphinx.ent.port = 9312
|
||||
profil.sphinx.ent.version = 2
|
||||
profil.sphinx.dir.host = "192.168.78.249"
|
||||
profil.sphinx.ent.version = "2.2.10"
|
||||
profil.sphinx.dir.host = "172.18.8.5"
|
||||
profil.sphinx.dir.port = 9312
|
||||
profil.sphinx.dir.version = 2
|
||||
profil.sphinx.act.host = "192.168.78.249"
|
||||
profil.sphinx.dir.version = "2.2.10"
|
||||
profil.sphinx.act.host = "172.18.8.5"
|
||||
profil.sphinx.act.port = 9312
|
||||
profil.sphinx.act.version = 2
|
||||
profil.sphinx.histo.host = "192.168.78.249"
|
||||
profil.sphinx.act.version = "2.2.10"
|
||||
profil.sphinx.histo.host = "172.18.8.5"
|
||||
profil.sphinx.histo.port = 9312
|
||||
profil.sphinx.histo.version = 2
|
||||
profil.sphinx.histo.version = "2.2.10"
|
||||
|
||||
; For old configuration - see Configure.php
|
||||
profil.db.metier.adapter=mysqli
|
||||
profil.db.metier.params.host=192.168.78.249
|
||||
profil.db.metier.params.host=172.18.8.5
|
||||
profil.db.metier.params.username=wsuser
|
||||
profil.db.metier.params.password=scores
|
||||
profil.db.metier.params.dbname=sdv1
|
||||
|
@ -493,6 +493,12 @@ class Metier_Bodacc_MBodacc
|
||||
*/
|
||||
protected $conn;
|
||||
|
||||
/**
|
||||
* Logger
|
||||
* @var \Monolog\Logger
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
/**
|
||||
* Bodacc
|
||||
* @param \Doctrine\DBAL\Connection $conn
|
||||
@ -505,6 +511,10 @@ class Metier_Bodacc_MBodacc
|
||||
$this->conn = $conn;
|
||||
}
|
||||
|
||||
if (Zend_Registry::isRegistered('logger')) {
|
||||
$this->logger = Zend_Registry::get('logger');
|
||||
}
|
||||
|
||||
/* Charge toute la table des tribunaux pour ne pas lancer systématiquement des
|
||||
* requètes sur le serveur MySQL lors des intégrations de Bodacc
|
||||
*/
|
||||
@ -545,11 +555,18 @@ class Metier_Bodacc_MBodacc
|
||||
return include $cache;
|
||||
} else {
|
||||
$tribunaux = array();
|
||||
|
||||
$sql = "SELECT triCode, triNom, triCP, triSiret FROM jo.tribunaux WHERE triCode IS NOT NULL";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount()) {
|
||||
$stmtNb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($stmtNb > 0) {
|
||||
while ($t = $stmt->fetch(\PDO::FETCH_OBJ)) {
|
||||
$dep = intval(substr($t->triCP, 0, 2));
|
||||
if ($dep == 97 || $dep == 98) {
|
||||
@ -578,11 +595,18 @@ class Metier_Bodacc_MBodacc
|
||||
return include $cache;
|
||||
} else {
|
||||
$result = array();
|
||||
|
||||
$sql = "SELECT codeFct, libelle FROM jo.bodacc_fonctions";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount()) {
|
||||
$stmtNb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($stmtNb > 0) {
|
||||
while ($row = $stmt->fetch(\PDO::FETCH_OBJ)) {
|
||||
$result[intval($row->codeFct)] = $row->libelle;
|
||||
}
|
||||
@ -619,10 +643,18 @@ class Metier_Bodacc_MBodacc
|
||||
FROM jo.tribunaux t, jo.tribunauxInsee i
|
||||
WHERE i.CodeInsee= :inseeCode AND i.triId=t.triId
|
||||
ORDER BY t.triNumGreffe DESC, t.triId ASC";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('inseeCode', $codeInseeCommune);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount()) {
|
||||
$stmtNb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('inseeCode', $codeInseeCommune);
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($stmtNb > 0) {
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
@ -643,16 +675,24 @@ class Metier_Bodacc_MBodacc
|
||||
t.triSiret, t.triAdrNum, t.triAdrIndRep, t.triAdrTypeVoie, t.triAdrVoie, t.triAdrComp,
|
||||
t.triVille, t.triStatut, t.triDateCessation, t.triCommentaire, t.triNumGreffe
|
||||
FROM jo.tribunaux t WHERE t.triCP BETWEEN :dep1 AND :dep2 ORDER BY t.triType ASC";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
if ($dep < 96) {
|
||||
$stmt->bindValue('dep1', $dep.'000');
|
||||
$stmt->bindValue('dep2', $dep.'999');
|
||||
} else {
|
||||
$stmt->bindValue('dep1', $dep.'00');
|
||||
$stmt->bindValue('dep2', $dep.'99');
|
||||
$stmtNb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
if ($dep < 96) {
|
||||
$stmt->bindValue('dep1', $dep.'000');
|
||||
$stmt->bindValue('dep2', $dep.'999');
|
||||
} else {
|
||||
$stmt->bindValue('dep1', $dep.'00');
|
||||
$stmt->bindValue('dep2', $dep.'99');
|
||||
}
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount()) {
|
||||
if ($stmtNb > 0) {
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
@ -666,10 +706,18 @@ class Metier_Bodacc_MBodacc
|
||||
public function getTribunalIdCA($codeTribunal)
|
||||
{
|
||||
$sql = "SELECT triIdSup FROM jo.tribunaux WHERE triCode = :code";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('code', $codeTribunal);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount()) {
|
||||
$stmtNb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('code', $codeTribunal);
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($stmtNb > 0) {
|
||||
return $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
@ -695,11 +743,18 @@ class Metier_Bodacc_MBodacc
|
||||
return include $cache;
|
||||
} else {
|
||||
$result = array();
|
||||
|
||||
$sql = "SELECT codEven, libEven, Bodacc_Code, Rubrique, version, lienEtab FROM jo.tabEvenements";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount()) {
|
||||
$stmtNb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($stmtNb > 0) {
|
||||
while ($row = $stmt->fetch(\PDO::FETCH_OBJ)) {
|
||||
$result[$row->codEven] = array(
|
||||
'libEven' => $row->libEven,
|
||||
@ -726,11 +781,17 @@ class Metier_Bodacc_MBodacc
|
||||
return include $cache;
|
||||
} else {
|
||||
$result = array();
|
||||
|
||||
$sql = "SELECT libDeviseBodacc, devIso FROM jo.bodacc_devises";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount()) {
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($stmtNb > 0) {
|
||||
while ($row = $stmt->fetch(\PDO::FETCH_OBJ)) {
|
||||
$result[$row->libDeviseBodacc] = $row->devIso;
|
||||
}
|
||||
@ -1170,7 +1231,7 @@ class Metier_Bodacc_MBodacc
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
continue;
|
||||
}
|
||||
if ($stmt->rowCount()) {
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$tabPrenom = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
// C'est plutôt le nom de famille au début de la chaîne
|
||||
if ($i == 0) {
|
||||
@ -1209,12 +1270,20 @@ class Metier_Bodacc_MBodacc
|
||||
|
||||
$sql = "SELECT Bodacc_Code, Bodacc_Annee_Parution, Bodacc_Num, Num_Annonce, Tribunal_Dept, Tribunal_Code, Rubrique_Bodacc, length(annonce) as Long
|
||||
FROM jo.bodacc WHERE Bodacc_Code=:code AND Bodacc_Annee_Parution=:annee AND Bodacc_Num=:num";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('code', $bodaccCode);
|
||||
$stmt->bindValue('annee', $annee);
|
||||
$stmt->bindValue('num', $num);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount()) {
|
||||
$stmtNb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('code', $bodaccCode);
|
||||
$stmt->bindValue('annee', $annee);
|
||||
$stmt->bindValue('num', $num);
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($stmtNb > 0) {
|
||||
while ($row = $stmt->fetch(\PDO::FETCH_OBJ)) {
|
||||
$result[] = array(
|
||||
'BodaccCode' => $ann->Bodacc_Code,
|
||||
@ -1301,10 +1370,18 @@ class Metier_Bodacc_MBodacc
|
||||
|
||||
$sql = "SELECT id, dep, nomJal, siteWeb, email, adresse, cp, ville, tel, fax, parution, aboAnnuel, infos
|
||||
FROM jo.tabJAL WHERE dep = :dep";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('dep', $dep);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount()) {
|
||||
$stmtNb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('dep', $dep);
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($stmtNb > 0) {
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
@ -1316,10 +1393,18 @@ class Metier_Bodacc_MBodacc
|
||||
$result = array();
|
||||
|
||||
$sql = "SELECT id, nomJal FROM jo.tabJAL WHERE sedDateAbo!=0 GROUP BY nomJal ORDER BY nomJal ASC";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('dep', $dep);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount()) {
|
||||
$stmtNb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('dep', $dep);
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($stmtNb > 0) {
|
||||
while ($row = $stmt->fetch(\PDO::FETCH_OBJ)) {
|
||||
$result['_'.$row->id] = $row->nomJal;
|
||||
}
|
||||
@ -1338,37 +1423,69 @@ class Metier_Bodacc_MBodacc
|
||||
{
|
||||
$strEvenVtLg = " AND Rubrique!='ventes' AND typeEven NOT LIKE '%2700%' AND typeEven NOT LIKE '%2701%' AND typeEven NOT LIKE '%2702%' AND typeEven NOT LIKE '%2703%' AND typeEven NOT LIKE '%2710%' AND typeEven NOT LIKE '%2720%' AND typeEven NOT LIKE '%2721%' AND typeEven NOT LIKE '%2725%' AND typeEven NOT LIKE '%2730%' AND typeEven NOT LIKE '%2740%' AND typeEven NOT LIKE '%2750%' AND typeEven NOT LIKE '%2800%' AND typeEven NOT LIKE '%2840%' AND typeEven NOT LIKE '%2850%' AND typeEven NOT LIKE '%2851%' AND typeEven NOT LIKE '%2860%' AND typeEven NOT LIKE '%2870%' AND typeEven NOT LIKE '%2875%' AND typeEven NOT LIKE '%2880%' AND typeEven NOT LIKE '%2881%' AND typeEven NOT LIKE '%2885%' AND typeEven NOT LIKE '%2890%' AND typeEven NOT LIKE '%2891%' AND typeEven NOT LIKE '%2892%' ";
|
||||
$sql = "SELECT Activite FROM jo.bodacc_detail WHERE siren=:siren AND Activite<>'' AND Activite NOT LIKE 'non precis%' $strEvenVtLg ORDER BY Bodacc_Date_Parution DESC LIMIT 0,1";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
$annCap = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
if ($fj < 7000 || $fj > 7999) {
|
||||
$activite = trim($annCap['Activite']);
|
||||
}
|
||||
|
||||
if ($activite == '' && ($fj > 90 && $fj < 94 || $fj > 9000 && $fj < 9400)) {
|
||||
$sql = "SELECT Assoc_Objet, Assoc_NObjet FROM jo.asso WHERE siren=:siren AND (Assoc_Objet!='' OR Assoc_NObjet!='') ORDER BY Date_Parution DESC LIMIT 0,1";
|
||||
$stmtNb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($stmtNb > 0) {
|
||||
$annCap = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
$activite = trim($annCap['Assoc_NObjet']);
|
||||
if ($activite == '') {
|
||||
$activite = trim($annCap['Assoc_Objet']);
|
||||
if ($fj < 7000 || $fj > 7999) {
|
||||
$activite = trim($annCap['Activite']);
|
||||
}
|
||||
}
|
||||
|
||||
if ($activite == '' && ($fj > 90 && $fj < 94 || $fj > 9000 && $fj < 9400)) {
|
||||
$sql = "SELECT Assoc_Objet, Assoc_NObjet FROM jo.asso
|
||||
WHERE siren=:siren AND (Assoc_Objet!='' OR Assoc_NObjet!='')
|
||||
ORDER BY Date_Parution DESC LIMIT 0,1";
|
||||
$stmtNb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($stmtNb > 0) {
|
||||
$annCap = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
$activite = trim($annCap['Assoc_NObjet']);
|
||||
if ($activite == '') {
|
||||
$activite = trim($annCap['Assoc_Objet']);
|
||||
}
|
||||
}
|
||||
} elseif ($activite == '' && ($fj < 7000 || $fj > 7999)) {
|
||||
$sql = "SELECT e.ANBASE, e.NOBOD, e.CODTRI, e.JAL, e.DATE, e.CODEVE, e.SSCODE, e.DEPT, e.NOANN, e.ROLE, e.SIREN, e.E1GSIR, e.E1GNIC, x.annonceNum, x.annonceTxt
|
||||
FROM historiques.entrep e, historiques.texte x
|
||||
WHERE e.E1GSIR=:siren AND e.ANBASE=x.annonceNum AND e.DATE BETWEEN 19890101 AND 20041231 AND x.annonceTxt LIKE '%ctivit%'
|
||||
GROUP BY e.ANBASE ORDER BY e.DATE DESC";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount()) {
|
||||
$stmtNb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($stmtNb > 0) {
|
||||
while ($ann = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
if (($ann['CODEVE'] < 20) || ($ann['CODEVE'] >= 30 && $ann['CODEVE'] < 42) || ($ann['CODEVE'] >= 51 && $ann['CODEVE'] < 80)) {
|
||||
if (($ann['CODEVE'] < 20) || ($ann['CODEVE'] >= 30 && $ann['CODEVE'] < 42)
|
||||
|| ($ann['CODEVE'] >= 51 && $ann['CODEVE'] < 80)) {
|
||||
if (preg_match('/(.*)Activit(?:e|é)(?:.|)\:(.*)(?:Adresse(?:.*|)|Commentaires?|Administration|Etablissement principal|Date d\'effet|Date.de.d.but d.activit.|Capital|Nom commercial)(?:.|)\:/Uisu', $ann['annonceTxt'], $matches)) {
|
||||
if (strpos(substr($matches[1], -20), 'cess') === false && strpos(substr($matches[1], -20), 'date') === false) {
|
||||
if (strpos(substr($matches[1], -20), 'cess') === false
|
||||
&& strpos(substr($matches[1], -20), 'date') === false) {
|
||||
$activite = $matches[2];
|
||||
break;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -12,10 +12,20 @@ class Metier_Partenaires_MAmabis
|
||||
*/
|
||||
protected $conn;
|
||||
|
||||
/**
|
||||
* Logger
|
||||
* @var \Monolog\Logger
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->conn = Zend_Registry::get('doctrine');
|
||||
|
||||
if (Zend_Registry::isRegistered('logger')) {
|
||||
$this->logger = Zend_Registry::get('logger');
|
||||
}
|
||||
|
||||
$this->client = new SoapClient(null, array(
|
||||
'location' => 'http://sw2.amabis.com:5100/',
|
||||
'uri' => 'http://www.amabis.com/ns.xsd',
|
||||
@ -51,16 +61,23 @@ class Metier_Partenaires_MAmabis
|
||||
$adresse = addslashes(trim(preg_replace('/ +/', ' ', "$adrNum $adrIndRep $adrTypeVoie $adrLibVoie")));
|
||||
$ville = addslashes($ville);
|
||||
$majForcee = false;
|
||||
$stmtNb = 0;
|
||||
try {
|
||||
$sql = "SELECT 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
|
||||
FROM jo.zonage WHERE address='$adresse' AND adr_cp='$cp' AND adr_ville='$ville'";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "SELECT 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
|
||||
FROM jo.zonage WHERE address='$adresse' AND adr_cp='$cp' AND adr_ville='$ville'";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
|
||||
if ($stmt->rowCount() > 0) {
|
||||
if ($stmtNb > 0) {
|
||||
$zones = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
if ($zones['rnvpStatut'] === null && $rnvp) {
|
||||
$majForcee = true;
|
||||
@ -113,7 +130,7 @@ class Metier_Partenaires_MAmabis
|
||||
}
|
||||
}
|
||||
|
||||
if ($stmt->rowCount() == 0 || $majForcee) {
|
||||
if ($stmtNb == 0 || $majForcee) {
|
||||
try {
|
||||
// Le RNVP ne fonctionne pas sans la Raison Sociale qui est la 1ère ligne d'adresse
|
||||
if (trim($raisonSociale) == '') {
|
||||
@ -128,7 +145,6 @@ class Metier_Partenaires_MAmabis
|
||||
new SoapParam('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");
|
||||
@ -225,25 +241,45 @@ class Metier_Partenaires_MAmabis
|
||||
$villeL = addslashes($ville);
|
||||
$sql = "SELECT dateInsert*1 as dateInsert FROM jo.zonage
|
||||
WHERE address='$adresseL' AND adr_cp='$cp' AND adr_ville='$villeL'";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$majNb = 0;
|
||||
try {
|
||||
$majStmt = $this->conn->prepare($sql);
|
||||
$majStmt->execute();
|
||||
$majNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($majNb > 0) {
|
||||
$result = $stmt->fetch(\PDO::FETCH_OBJ);
|
||||
$dateInsert = $result->dateInsert;
|
||||
if ($dateInsert != 0) {
|
||||
$this->conn->update('jo.zonage', array_merge($tabUpdate,
|
||||
array('dateInsert' => $dateInsert)),
|
||||
array(
|
||||
'address' => $adresseL,
|
||||
'adr_cp' => $cp,
|
||||
'adr_ville' => $villeL,
|
||||
));
|
||||
try {
|
||||
$this->conn->update('jo.zonage', array_merge($tabUpdate,
|
||||
array('dateInsert' => $dateInsert)),
|
||||
array(
|
||||
'address' => $adresseL,
|
||||
'adr_cp' => $cp,
|
||||
'adr_ville' => $villeL,
|
||||
));
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($dateInsert == 0) {
|
||||
$this->conn->insert('jo.zonage', array_merge($tabInsert, $tabUpdate));
|
||||
try {
|
||||
$this->conn->insert('jo.zonage', array_merge($tabInsert, $tabUpdate));
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$tabTmp[0] = explode(',', $tabZones['LOCREFCLEP']);
|
||||
@ -264,7 +300,13 @@ class Metier_Partenaires_MAmabis
|
||||
'source' => 'Amabis',
|
||||
'dateInsert' => date('YmdHis'),
|
||||
);
|
||||
$this->conn->insert('jo.villesCP', $tabInsert);
|
||||
try {
|
||||
$this->conn->insert('jo.villesCP', $tabInsert);
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Autres Informations de la RNVP **/
|
||||
@ -286,11 +328,19 @@ class Metier_Partenaires_MAmabis
|
||||
$codeInsee = substr($codeRivoli, 0, 5);
|
||||
$sql = "SELECT typeZone, arreteDate, decretDate, decretNum, decretModifieDate, decretModifieNum, dateDebut, dateFin
|
||||
FROM jo.zonageInsee WHERE codeInsee=:code";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('code', $codeInsee);
|
||||
$stmt->execute();
|
||||
$zonageNb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('code', $codeInsee);
|
||||
$stmt->execute();
|
||||
$zonageNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
$tabRep['ZRR'] = $tabRep['AFR'] = 'NON';
|
||||
if ($stmt->rowCount() > 0) {
|
||||
if ($zonageNb > 0) {
|
||||
while ($zones = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
switch ($zones['typeZone']) {
|
||||
case 'ZRR':
|
||||
|
@ -63,9 +63,22 @@ class Metier_Partenaires_MBanques
|
||||
*/
|
||||
protected $conn;
|
||||
|
||||
/**
|
||||
* Logger
|
||||
* @var \Monolog\Logger
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
/**
|
||||
* Banque
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->conn = Zend_Registry::get('doctrine');
|
||||
|
||||
if (Zend_Registry::isRegistered('logger')) {
|
||||
$this->logger = Zend_Registry::get('logger');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -76,15 +89,25 @@ class Metier_Partenaires_MBanques
|
||||
public function getInfoBanque($codeBanque)
|
||||
{
|
||||
$result = array();
|
||||
$sql = "SELECT bdfFibCodeEtab, bdfFibCodeSituation, bdfFibDenom40,
|
||||
bdfFibDenom10, bdfFibCodeActivite, bdfFibCodeOrganeRepr, bdfFibDateAgrement, *
|
||||
bdfFibDateRetraitAgr, bdfFibDateFinDiffus, bdfFibAdresse1, bdfFibAdresse2,
|
||||
bdfFibAdresse3, CP, Ville, bdfFibCodeEtabAbsorb, bdfFibOptionIdInvar,
|
||||
bdfFibDateOptIdInvar FROM insee.BDF_Etabs WHERE bdfFibCodeEtab=:code LIMIT 0,1";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('code', $codeBanque);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
|
||||
$stmtNb = 0;
|
||||
try {
|
||||
$sql = "SELECT bdfFibCodeEtab, bdfFibCodeSituation, bdfFibDenom40,
|
||||
bdfFibDenom10, bdfFibCodeActivite, bdfFibCodeOrganeRepr, bdfFibDateAgrement, *
|
||||
bdfFibDateRetraitAgr, bdfFibDateFinDiffus, bdfFibAdresse1, bdfFibAdresse2,
|
||||
bdfFibAdresse3, CP, Ville, bdfFibCodeEtabAbsorb, bdfFibOptionIdInvar,
|
||||
bdfFibDateOptIdInvar FROM insee.BDF_Etabs WHERE bdfFibCodeEtab=:code LIMIT 0,1";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('code', $codeBanque);
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if ($stmtNb > 0) {
|
||||
$result = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
@ -103,19 +126,28 @@ class Metier_Partenaires_MBanques
|
||||
$tabBanque = $this->getInfoBanque($codeBanque);
|
||||
$tabTel = $this->getTelGuichet($codeBanque, $codeGuichet);
|
||||
|
||||
$sql = "SELECT bdfFibCodeEtab, bdfFibCodeGuichet, bdfFibCodeSituation AS guichetCodeSituation,
|
||||
bdfFibDenom40 AS guichetDenom40, bdfFibDenom20 AS guichetDenom20, bdfFibCodeEtabCible,
|
||||
bdfFibCodeGuichetRepr, bdfFibCodeGeoInsee, bdfFibCodeLocalite1, bdfFibCodeLocalite2,
|
||||
bdfFibComptoirBDF, bdfFibAdresse1 AS guichetAdresse1, bdfFibAdresse2 AS guichetAdresse2,
|
||||
bdfFibAdresse3 AS guichetAdresse3, CP AS guichetCP, Ville AS guichetVille,
|
||||
bdfFibAdresseSWIFT, bdfFibDateOuverture, bdfFibDateFermeture, bdfFibDateFinDiffus,
|
||||
bdfFibCodeRoutage, bdfFibLibelleRIB, bdfFibNatureGuichet, bdfFibCodeAchOperBDF,
|
||||
bdfFibNomComptoirBDF FROM WHERE bdfFibCodeEtab=:banque AND bdfFibCodeGuichet=:guichet LIMIT 0,1";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('banque', $codeBanque);
|
||||
$stmt->bindValue('guichet', $codeGuichet);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$stmtNb = 0;
|
||||
try {
|
||||
$sql = "SELECT bdfFibCodeEtab, bdfFibCodeGuichet, bdfFibCodeSituation AS guichetCodeSituation,
|
||||
bdfFibDenom40 AS guichetDenom40, bdfFibDenom20 AS guichetDenom20, bdfFibCodeEtabCible,
|
||||
bdfFibCodeGuichetRepr, bdfFibCodeGeoInsee, bdfFibCodeLocalite1, bdfFibCodeLocalite2,
|
||||
bdfFibComptoirBDF, bdfFibAdresse1 AS guichetAdresse1, bdfFibAdresse2 AS guichetAdresse2,
|
||||
bdfFibAdresse3 AS guichetAdresse3, CP AS guichetCP, Ville AS guichetVille,
|
||||
bdfFibAdresseSWIFT, bdfFibDateOuverture, bdfFibDateFermeture, bdfFibDateFinDiffus,
|
||||
bdfFibCodeRoutage, bdfFibLibelleRIB, bdfFibNatureGuichet, bdfFibCodeAchOperBDF,
|
||||
bdfFibNomComptoirBDF FROM WHERE bdfFibCodeEtab=:banque AND bdfFibCodeGuichet=:guichet LIMIT 0,1";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('banque', $codeBanque);
|
||||
$stmt->bindValue('guichet', $codeGuichet);
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if ($stmtNb > 0) {
|
||||
$result = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
@ -130,12 +162,21 @@ class Metier_Partenaires_MBanques
|
||||
public function getTelGuichet($codeBanque, $codeGuichet)
|
||||
{
|
||||
$result = array();
|
||||
$sql = "SELECT Tel, Fax FROM insee.Mandel_banques WHERE CodeB=:banque AND CodeG=:guichet LIMIT 0,1";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('banque', $codeBanque);
|
||||
$stmt->bindValue('guichet', $codeGuichet);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$stmtNb = 0;
|
||||
try {
|
||||
$sql = "SELECT Tel, Fax FROM insee.Mandel_banques WHERE CodeB=:banque AND CodeG=:guichet LIMIT 0,1";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('banque', $codeBanque);
|
||||
$stmt->bindValue('guichet', $codeGuichet);
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if ($stmtNb > 0) {
|
||||
$result = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
|
@ -271,12 +271,22 @@ class Metier_Partenaires_MBilans
|
||||
*/
|
||||
protected $conn;
|
||||
|
||||
/**
|
||||
* Logger
|
||||
* @var \Monolog\Logger
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
/**
|
||||
* MBilans
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->conn = Zend_Registry::get('doctrine');
|
||||
|
||||
if (Zend_Registry::isRegistered('logger')) {
|
||||
$this->logger = Zend_Registry::get('logger');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -310,13 +320,18 @@ class Metier_Partenaires_MBilans
|
||||
}
|
||||
$where.= " ORDER BY dateEffet DESC LIMIT 0,1";
|
||||
$listeSql = "SELECT $fields FROM jo.bodacc_detail WHERE $where";
|
||||
$listeNb = 0;
|
||||
try {
|
||||
$listeStmt = $this->conn->prepare($listeSql);
|
||||
$listeStmt->bindValue('siren', $this->siren);
|
||||
$listeStmt->execute();
|
||||
} catch(\Doctrine\DBAL\DBALException $e) {
|
||||
$listeNb = $listeStmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($listeStmt->rowCount() > 0) {
|
||||
if ($listeNb > 0) {
|
||||
$listResult = $listeStmt->fetch(\PDO::FETCH_ASSOC);
|
||||
$dateDerDepot = Metier_Util_Date::dateT('Y-m-d', 'Ymd', $listResult['dateEffet'])*1;
|
||||
if ($dateDerDepot != 0) {
|
||||
@ -337,7 +352,7 @@ class Metier_Partenaires_MBilans
|
||||
public function listeBilans($accesPartenaire = false, $nbMaxBilans = 0)
|
||||
{
|
||||
$dateDerDepot = 0;
|
||||
$tabRet = $tabRet2 = $tabRet3 = array();
|
||||
$tabRet = $tabRet2 = $tabRet3 = $tabRet = array();
|
||||
|
||||
$where = "siren=:siren";
|
||||
if ($this->companyEvenDateStop !== null) {
|
||||
@ -349,17 +364,20 @@ class Metier_Partenaires_MBilans
|
||||
}
|
||||
|
||||
$fields = "typeBilan, dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaieOrigine, dateInsert, partenaire";
|
||||
$listeNb = 0;
|
||||
try {
|
||||
$listeSql = "SELECT $fields FROM jo.bilans WHERE $where";
|
||||
$listeStmt = $this->conn->prepare($listeSql);
|
||||
$listeStmt->bindValue('siren', $this->siren);
|
||||
$listeStmt->execute();
|
||||
} catch(\Doctrine\DBAL\DBALException $e) {
|
||||
$listeNb = $listeStmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
$tabTri = array();
|
||||
|
||||
if ($listeStmt->rowCount() > 0) {
|
||||
if ($listeNb > 0) {
|
||||
while($bil = $listeStmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$millesime = Metier_Util_Date::dateT('Ymd', 'd/m/Y', $bil['dateExercice']);
|
||||
$tabRet[''.$bil['typeBilan'].$millesime] = array(
|
||||
@ -439,6 +457,7 @@ class Metier_Partenaires_MBilans
|
||||
}
|
||||
|
||||
// --- Selection du premier bilan
|
||||
$bilanNb = 0;
|
||||
try {
|
||||
$bilanSql = "SELECT $fields FROM jo.bilans WHERE $where LIMIT 0,1";
|
||||
$bilanStmt = $this->conn->prepare($bilanSql);
|
||||
@ -446,12 +465,16 @@ class Metier_Partenaires_MBilans
|
||||
$bilanStmt->bindValue('typeBilan', $typeBilan);
|
||||
$bilanStmt->bindValue('clotureDate', $clotureDateSql);
|
||||
$bilanStmt->execute();
|
||||
$bilanNb = $bilanStmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
$tabBilan = $tabBilanPre = $bilanPre = array();
|
||||
|
||||
if ($bilanStmt->rowCount() > 0) {
|
||||
if ($bilanNb > 0) {
|
||||
$bilan = $bilanStmt->fetch(\PDO::FETCH_ASSOC);
|
||||
$tabBilan['SIREN'] = $this->siren;
|
||||
$tabBilan['DATE_FRAICHE_BILAN'] = $bilan['dateProvPartenaire']; // SSAAMMJJ
|
||||
@ -684,6 +707,7 @@ class Metier_Partenaires_MBilans
|
||||
$cloturePreDate = $clotureDate->sub(new DateInterval('P'.$bilan['dureeExercice'].'M'));
|
||||
$cloturePreDateSql = $cloturePreDate->format('Ym');
|
||||
// --- Recherche des infos du bilan précédent
|
||||
$bilanpreNb = 0;
|
||||
try {
|
||||
$fields = "dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaie, typeBilan, monnaieOrigine, unite, postes";
|
||||
$where = "siren=:siren AND typeBilan=:typeBilan AND dateExercice BETWEEN :clotureDateBegin AND :clotureDateEnd";
|
||||
@ -694,9 +718,13 @@ class Metier_Partenaires_MBilans
|
||||
$bilanpreStmt->bindValue('clotureDateBegin', $cloturePreDateSql.'01');
|
||||
$bilanpreStmt->bindValue('clotureDateEnd', $cloturePreDateSql.'31');
|
||||
$bilanpreStmt->execute();
|
||||
$bilanpreNb = $bilanpreStmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($bilanpreStmt->rowCount() > 0) {
|
||||
if ($bilanpreNb > 0) {
|
||||
$bilanPre = $bilanpreStmt->fetch(\PDO::FETCH_ASSOC);
|
||||
$tabBilan['DATE_CLOTURE_PRE'] = $bilanPre['dateExercice']; // SSAAMMJJ
|
||||
$tabBilan['DUREE_MOIS_PRE'] = $bilanPre['dureeExercice'];
|
||||
|
@ -13,9 +13,19 @@ class Metier_Partenaires_MBourse
|
||||
*/
|
||||
protected $conn;
|
||||
|
||||
/**
|
||||
* Logger
|
||||
* @var \Monolog\Logger
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->conn = Zend_Registry::get('doctrine');
|
||||
|
||||
if (Zend_Registry::isRegistered('logger')) {
|
||||
$this->logger = Zend_Registry::get('logger');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -110,11 +120,19 @@ class Metier_Partenaires_MBourse
|
||||
$siren = $this->siren;
|
||||
}
|
||||
|
||||
$sql = "SELECT isin FROM jo.infos_entrep WHERE siren=:siren AND isin!='' LIMIT 0,1";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$nb = 0;
|
||||
try {
|
||||
$sql = "SELECT isin FROM jo.infos_entrep WHERE siren=:siren AND isin!='' LIMIT 0,1";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
$nb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($nb > 0) {
|
||||
$result = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
return trim($result['isin']);
|
||||
}
|
||||
@ -129,11 +147,19 @@ class Metier_Partenaires_MBourse
|
||||
*/
|
||||
public function getCodeSiren($isin)
|
||||
{
|
||||
$sql = "SELECT siren FROM jo.infos_entrep WHERE isin=:isin AND siren!=0 LIMIT 0,1";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('isin', $isin);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$nb = 0;
|
||||
try {
|
||||
$sql = "SELECT siren FROM jo.infos_entrep WHERE isin=:isin AND siren!=0 LIMIT 0,1";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('isin', $isin);
|
||||
$stmt->execute();
|
||||
$nb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($nb > 0) {
|
||||
$result = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
return trim($result['siren']);
|
||||
}
|
||||
@ -165,11 +191,19 @@ class Metier_Partenaires_MBourse
|
||||
pressReleaseAttachments, pressReleaseUrl, source, dateInsert
|
||||
FROM presse.articles
|
||||
WHERE companyIsin=:isin $sqlID ORDER BY pressReleaseDate DESC";
|
||||
$bodaccStmt = $this->conn->prepare($bodaccSql);
|
||||
$bodaccStmt->bindValue('isin', $isin);
|
||||
$bodaccStmt->execute();
|
||||
|
||||
if ($bodaccStmt->rowCount() > 0) {
|
||||
$nb = 0;
|
||||
try {
|
||||
$bodaccStmt = $this->conn->prepare($bodaccSql);
|
||||
$bodaccStmt->bindValue('isin', $isin);
|
||||
$bodaccStmt->execute();
|
||||
$nb = $bodaccStmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($nb > 0) {
|
||||
while($ann = $bodaccStmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$format = array(
|
||||
'id' => $ann['id'],
|
||||
@ -219,10 +253,18 @@ class Metier_Partenaires_MBourse
|
||||
FROM sdv1.bourse_isin b, sdv1.bourse_cours c
|
||||
WHERE code_isin=:isin 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";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('isin', $isin);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$nb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('isin', $isin);
|
||||
$stmt->execute();
|
||||
$nb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($nb > 0) {
|
||||
$result = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
$courSql = "SELECT min(close) AS coursMin, avg(close) AS coursMoy,
|
||||
max(close) AS coursMax FROM sdv1.bourse_cours
|
||||
|
@ -13,6 +13,12 @@ class Metier_Partenaires_MCadastre
|
||||
*/
|
||||
protected $conn;
|
||||
|
||||
/**
|
||||
* Logger
|
||||
* @var \Monolog\Logger
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
/**
|
||||
* Droits des locaux
|
||||
* @var array
|
||||
@ -65,7 +71,7 @@ class Metier_Partenaires_MCadastre
|
||||
'MP' => 'Maison partagée par une limite territoriale',
|
||||
'PP' => 'ND',
|
||||
'SM' => 'Sol de maison',
|
||||
'U' => 'Etablissement industriel',
|
||||
'U' => 'Etablissement industriel',
|
||||
'U1' => 'Gare',
|
||||
'U2' => 'Gare - Triage',
|
||||
'U3' => 'Gare - Atelier matériel',
|
||||
@ -133,7 +139,7 @@ class Metier_Partenaires_MCadastre
|
||||
private static $natureParcelles = array(
|
||||
'AB' => 'Terrains à batir',
|
||||
'AG' => 'Terrains d\'agrément',
|
||||
'B' => 'Bois',
|
||||
'B' => 'Bois',
|
||||
'BF' => 'Futaies feuillues',
|
||||
'BM' => 'Futaies mixtes',
|
||||
'BO' => 'Oseraies',
|
||||
@ -143,18 +149,18 @@ class Metier_Partenaires_MCadastre
|
||||
'BT' => 'Taillies simples',
|
||||
'CA' => 'Carrières',
|
||||
'CH' => 'Chemins de fer, Canaux de Navigation',
|
||||
'E' => 'Eaux',
|
||||
'J' => 'Jardins',
|
||||
'L' => 'Landes',
|
||||
'E' => 'Eaux',
|
||||
'J' => 'Jardins',
|
||||
'L' => 'Landes',
|
||||
'LB' => 'Landes Boisées',
|
||||
'P' => 'Prés',
|
||||
'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',
|
||||
'S' => 'Sols',
|
||||
'T' => 'Terre',
|
||||
'TP' => 'Terres plantées',
|
||||
'VE' => 'Vergers',
|
||||
'VI' => 'Vignes',
|
||||
@ -167,6 +173,10 @@ class Metier_Partenaires_MCadastre
|
||||
public function __construct($conn = null)
|
||||
{
|
||||
$this->conn = Zend_Registry::get('doctrine');
|
||||
|
||||
if (Zend_Registry::isRegistered('logger')) {
|
||||
$this->logger = Zend_Registry::get('logger');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -233,13 +243,22 @@ class Metier_Partenaires_MCadastre
|
||||
$siren = $this->siren;
|
||||
}
|
||||
|
||||
$locaux = array();
|
||||
|
||||
$sql = "SELECT 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
|
||||
FROM sdv1.cad_perloc l, sdv1.cad_permor e WHERE e.DSIREN='$siren' AND e.INTCIF=l.INTCIF AND e.DNUPER=l.DNUPER";
|
||||
$stmt = $this->conn->executeQuery($sql);
|
||||
|
||||
$locaux = array();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$nb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->executeQuery($sql);
|
||||
$nb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($nb > 0) {
|
||||
while ($loc = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$format = array(
|
||||
'idCentre' => $loc['INTCIF'],
|
||||
@ -307,15 +326,23 @@ class Metier_Partenaires_MCadastre
|
||||
if ($siren === null) {
|
||||
$siren = $this->siren;
|
||||
};
|
||||
$parcelles = array();
|
||||
|
||||
$sql = "SELECT 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
|
||||
FROM sdv1.cad_perpar p, sdv1.cad_permor e
|
||||
WHERE e.DSIREN='$siren' AND e.INTCIF=p.INTCIF AND e.DNUPER=p.DNUPER";
|
||||
$stmt = $this->conn->executeQuery($sql);
|
||||
|
||||
$parcelles = array();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$nb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->executeQuery($sql);
|
||||
$nb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($nb > 0) {
|
||||
while ($loc = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$format = array(
|
||||
'idCentre' => $loc['INTCIF'],
|
||||
@ -387,8 +414,6 @@ class Metier_Partenaires_MCadastre
|
||||
$sql = "SELECT count(*) AS itemTotal, (SUM(l.DSUPOD0) + SUM(l.DSUPOD1) + SUM(l.DSUPOD2) + SUM(l.DSUPOD3) + SUM(l.DSUPOD4) + SUM(l.DSUPOD5) + SUM(l.DSUPOD7) + SUM(l.DSUPOD8) + SUM(l.DSUPOD9)) AS surfaceTotal
|
||||
FROM sdv1.cad_perloc l, sdv1.cad_permor e
|
||||
WHERE e.DSIREN='".$this->siren."' AND e.INTCIF=l.INTCIF AND e.DNUPER=l.DNUPER".$droitSql;
|
||||
$stmt = $this->conn->executeQuery($sql);
|
||||
$results = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
} elseif ($type == 'parcelle') {
|
||||
$droitSql = " AND p.CCODRO='P'";
|
||||
if ($droit != 'P') {
|
||||
@ -397,7 +422,19 @@ class Metier_Partenaires_MCadastre
|
||||
$sql = "SELECT count(*) AS itemTotal, sum(p.DCNPAR) AS surfaceTotal
|
||||
FROM sdv1.cad_perpar p, sdv1.cad_permor e
|
||||
WHERE e.DSIREN='".$this->siren."' AND e.INTCIF=p.INTCIF AND e.DNUPER=p.DNUPER".$droitSql;
|
||||
}
|
||||
|
||||
$results = array();
|
||||
$nb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->executeQuery($sql);
|
||||
$nb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($nb > 0) {
|
||||
$results = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
@ -491,10 +528,19 @@ class Metier_Partenaires_MCadastre
|
||||
"WHERE e.DSIREN='$this->siren' AND e.INTCIF=p.INTCIF AND e.DNUPER=p.DNUPER";
|
||||
|
||||
$sql = "SELECT * FROM ( ($locauxSql) UNION ALL ($parcellesSql) ) results";
|
||||
$stmt = $this->conn->executeQuery($sql);
|
||||
|
||||
$nb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->executeQuery($sql);
|
||||
$nb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
$list = array();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
if ($nb > 0) {
|
||||
while ($result = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
// Libellé role
|
||||
$result['roleLib'] = self::$codeDroit[trim($result['role'])];
|
||||
|
@ -16,6 +16,12 @@ D. 067 200 329 I 2010-06-30 La CS est valide jusq'au 30/06/2010... Quid
|
||||
*/
|
||||
class Metier_Partenaires_MFacto
|
||||
{
|
||||
/**
|
||||
* Logger
|
||||
* @var \Monolog\Logger
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
public $risqueImpaye = false; // Y a t'il un risque d'impayé ?
|
||||
public $risqueImpayeMois = 0;
|
||||
public $profilPayeur = 0; // 0:N/D, 1:Excellent, 2=Bon, 3=Normal, 4=Lent, 5=Mauvais ou Défaut
|
||||
@ -93,6 +99,10 @@ class Metier_Partenaires_MFacto
|
||||
public function __construct()
|
||||
{
|
||||
$this->conn = Zend_Registry::get('doctrine');
|
||||
|
||||
if (Zend_Registry::isRegistered('logger')) {
|
||||
$this->logger = Zend_Registry::get('logger');
|
||||
}
|
||||
}
|
||||
|
||||
public function setTypeFic($typeFic)
|
||||
@ -150,11 +160,19 @@ class Metier_Partenaires_MFacto
|
||||
WHERE siren=:siren AND (dateSuppr=0 OR dateConf>dateSuppr)
|
||||
AND (dateFin=0 OR dateFin>NOW()) AND cs NOT IN (20,22,27,33,34)
|
||||
ORDER BY dateConf DESC, dateInsert DESC";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
$stmtNb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
$tabRet = array();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
if ($stmtNb > 0) {
|
||||
while ($tabCS = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$dateEven = $tabCS['dateConf'];
|
||||
if ($dateEven == '0000-00-00') {
|
||||
@ -179,15 +197,23 @@ class Metier_Partenaires_MFacto
|
||||
|
||||
public function getCoteSpecialeOld($siren)
|
||||
{
|
||||
$sql = "SELECT DATMAJ1, NUMGFH, CSAVAN, CSAPRE, SIRENE
|
||||
$sql = "SELECT DATMAJ1, NUMGFH, CSAVAN, CSAPRE, SIRENE
|
||||
FROM sdv1.ge_cs c LEFT JOIN sdv1.ge_acheteurs a ON a.NUMACH=c.NUMGFH
|
||||
WHERE a.SIRENE=:siren ORDER BY a.SIRENE ASC, c.DATMAJ1 DESC";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
$stmtNb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
$tabRet = array();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
if ($stmtNb > 0) {
|
||||
while ($tabCS = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$tabRet[] = array(
|
||||
'DateEven' => $tabCS['DATMAJ1'],
|
||||
@ -228,10 +254,18 @@ class Metier_Partenaires_MFacto
|
||||
p.CODDEV, a.SIRENE, a.RAISOC, a.CODPOS, a.VILLE
|
||||
FROM sdv1.ge_paiements p LEFT JOIN sdv1.ge_acheteurs a ON a.NUMACH=p.NUMACH
|
||||
WHERE a.SIRENE=:siren AND DATEDIFF(NOW(),p.DATECH)<736 AND p.DATECH<NOW() $strGroupBy ORDER BY p.DATPIE DESC";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$stmtNb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($stmtNb > 0) {
|
||||
while ($tabPai = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$nbJoursMoyen = $tabPai['nbJourRetard'] - $tabPai['nbJourPaiement'];
|
||||
if ($nbJoursMoyen < 6) {
|
||||
@ -387,10 +421,18 @@ class Metier_Partenaires_MFacto
|
||||
WHERE idClient='SURBODPRDFTSRECOCASH' AND siren=:siren AND dateSuppr=0
|
||||
AND ABS(DATEDIFF(dateAjout, NOW()))<365
|
||||
ORDER BY dateConf DESC, dateAjout DESC";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$stmtNb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($stmtNb > 0) {
|
||||
while ($tabCS = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$dateMAJ = Metier_Util_Date::dateT('Y-m-d', 'M Y', $tabCS['dateAjout']);
|
||||
$libProfil = "En date du $dateMAJ : Contentieux importants.";
|
||||
|
@ -7,12 +7,22 @@ class Metier_Partenaires_MGreffes
|
||||
*/
|
||||
protected $conn;
|
||||
|
||||
/**
|
||||
* Logger
|
||||
* @var \Monolog\Logger
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
/**
|
||||
* Greffes
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->conn = Zend_Registry::get('doctrine');
|
||||
|
||||
if (Zend_Registry::isRegistered('logger')) {
|
||||
$this->logger = Zend_Registry::get('logger');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -26,50 +36,52 @@ class Metier_Partenaires_MGreffes
|
||||
dateRadiation, dateCloture, ca, res, eff, dateInsert
|
||||
FROM jo.greffes_identite WHERE siren=:siren";
|
||||
|
||||
|
||||
$nb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
return array(
|
||||
'id' => $result['id'],
|
||||
'Pertinence' => 100,
|
||||
'Siret' => $result['siren'].'00000',
|
||||
'Siege' => $result['siege'],
|
||||
'Nom' => $result['nom'],
|
||||
'Nom2' => $result['nomCommercial'],
|
||||
'Sigle' => '',
|
||||
'Enseigne' => $result['ens'],
|
||||
'Adresse' => $result['adresse'],
|
||||
'Adresse2' => $result['adresse2'],
|
||||
'CP' => $result['cp'],
|
||||
'Ville' => $result['ville'],
|
||||
'Tel' => '',
|
||||
'Fax' => '',
|
||||
'FJ' => $result['fj'],
|
||||
'FJLib' => $result['fjLib'],
|
||||
'Siren' => $result['siren'],
|
||||
'Nic' => '00000',
|
||||
'Actif' => 0,
|
||||
'NafEtab' => $result['naf'],
|
||||
'NafEtabLib' => $result['nafLib'],
|
||||
'NafEnt' => $result['naf'],
|
||||
'NafEntLib' => $result['nafLib'],
|
||||
'NumRC' => $result['numRC'],
|
||||
'NumRC2' => $result['numRC2'],
|
||||
'NumGreffe' => $result['numGreffe'],
|
||||
'DateCreation' => $result['dateCreation'],
|
||||
'DateRadiation' => $result['dateRadiation'],
|
||||
'DateCloture' => $result['dateCloture'],
|
||||
'DateUpdate' => substr($result['dateInsert'], 0, 10),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
$nb = $stmt->rowCount();
|
||||
} catch(\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if ($nb > 0) {
|
||||
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
return array(
|
||||
'id' => $result['id'],
|
||||
'Pertinence' => 100,
|
||||
'Siret' => $result['siren'].'00000',
|
||||
'Siege' => $result['siege'],
|
||||
'Nom' => $result['nom'],
|
||||
'Nom2' => $result['nomCommercial'],
|
||||
'Sigle' => '',
|
||||
'Enseigne' => $result['ens'],
|
||||
'Adresse' => $result['adresse'],
|
||||
'Adresse2' => $result['adresse2'],
|
||||
'CP' => $result['cp'],
|
||||
'Ville' => $result['ville'],
|
||||
'Tel' => '',
|
||||
'Fax' => '',
|
||||
'FJ' => $result['fj'],
|
||||
'FJLib' => $result['fjLib'],
|
||||
'Siren' => $result['siren'],
|
||||
'Nic' => '00000',
|
||||
'Actif' => 0,
|
||||
'NafEtab' => $result['naf'],
|
||||
'NafEtabLib' => $result['nafLib'],
|
||||
'NafEnt' => $result['naf'],
|
||||
'NafEntLib' => $result['nafLib'],
|
||||
'NumRC' => $result['numRC'],
|
||||
'NumRC2' => $result['numRC2'],
|
||||
'NumGreffe' => $result['numGreffe'],
|
||||
'DateCreation' => $result['dateCreation'],
|
||||
'DateRadiation' => $result['dateRadiation'],
|
||||
'DateCloture' => $result['dateCloture'],
|
||||
'DateUpdate' => substr($result['dateInsert'], 0, 10),
|
||||
);
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -85,34 +97,40 @@ class Metier_Partenaires_MGreffes
|
||||
dateLJS, dateInventaire, dateBodacc, caDeclare, effectif, descriptif, pdfLink, pdfSize,
|
||||
pdfVer, pdfPage, descDateDepot, dateLimite, mandataire, dateInsert
|
||||
FROM jo.greffes_cessions WHERE siren=:siren";
|
||||
|
||||
$nb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
|
||||
if ($stmt->rowCount() > 0) {
|
||||
if ($stmt->rowCount() > 1) {
|
||||
$mail = new Metier_Common_Mail();
|
||||
$mail->send('debug@scores-decisions.com', 'ylenaour@scores-decisions.com',
|
||||
"classMGreffes.php : Debug getInfosCessions $siren", "Plus de 1 cession pour ce siren");
|
||||
}
|
||||
$result = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
return array(
|
||||
'cessJuge' => $result['etat'],
|
||||
'cessDateJuge' => $result['dateJuge'],
|
||||
'cessDateConv' => $result['dateConv'],
|
||||
'cessDateLJS' => $result['dateLJS'],
|
||||
'cessDateInv' => $result['dateInventaire'],
|
||||
'cessDateBod' => $result['dateBodacc'],
|
||||
'cessCAdec' => $result['caDeclare'],
|
||||
'cessEffectif' => $result['effectif'],
|
||||
'cessDesc' => $result['descriptif'],
|
||||
'cessDateDesc' => $result['descDateDepot'],
|
||||
'cessDateLim' => $result['dateLimite'],
|
||||
'cessMand' => $result['mandataire'],
|
||||
);
|
||||
}
|
||||
$nb = $stmt->rowCount();
|
||||
} catch(\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if ($nb > 0) {
|
||||
if ($nb > 1) {
|
||||
$mail = new Metier_Common_Mail();
|
||||
$mail->send('debug@scores-decisions.com', 'ylenaour@scores-decisions.com',
|
||||
"classMGreffes.php : Debug getInfosCessions $siren", "Plus de 1 cession pour ce siren");
|
||||
}
|
||||
$result = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
return array(
|
||||
'cessJuge' => $result['etat'],
|
||||
'cessDateJuge' => $result['dateJuge'],
|
||||
'cessDateConv' => $result['dateConv'],
|
||||
'cessDateLJS' => $result['dateLJS'],
|
||||
'cessDateInv' => $result['dateInventaire'],
|
||||
'cessDateBod' => $result['dateBodacc'],
|
||||
'cessCAdec' => $result['caDeclare'],
|
||||
'cessEffectif' => $result['effectif'],
|
||||
'cessDesc' => $result['descriptif'],
|
||||
'cessDateDesc' => $result['descDateDepot'],
|
||||
'cessDateLim' => $result['dateLimite'],
|
||||
'cessMand' => $result['mandataire'],
|
||||
);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -4,6 +4,12 @@ require_once __DIR__ . '/MMapFunctions.php';
|
||||
|
||||
class Metier_Partenaires_MMap
|
||||
{
|
||||
/**
|
||||
* Logger
|
||||
* @var \Monolog\Logger
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
private $referer ='';
|
||||
private $body = '';
|
||||
private $header = '';
|
||||
|
@ -1,17 +1,25 @@
|
||||
<?php
|
||||
class Metier_Partenaires_MMarques
|
||||
{
|
||||
private $iDb;
|
||||
|
||||
/**
|
||||
* PDO Connection with Doctrine
|
||||
* @var \Doctrine\DBAL\Connection
|
||||
*/
|
||||
protected $conn;
|
||||
|
||||
/**
|
||||
* Logger
|
||||
* @var \Monolog\Logger
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->conn = Zend_Registry::get('doctrine');
|
||||
|
||||
if (Zend_Registry::isRegistered('logger')) {
|
||||
$this->logger = Zend_Registry::get('logger');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -28,19 +36,27 @@ class Metier_Partenaires_MMarques
|
||||
dateExpir, idObjetImg, idObjetPdf FROM bopi.marques WHERE";
|
||||
if ($siren > 0) {
|
||||
if (substr($sql, -5) != "WHERE") {
|
||||
$sql.= " AND ";
|
||||
$sql.= " AND";
|
||||
}
|
||||
$sql.= "sirenDeposant=$siren";
|
||||
$sql.= " sirenDeposant=$siren";
|
||||
}
|
||||
if ($idDepot > 0) {
|
||||
if (substr($sql, -5) != "WHERE") {
|
||||
$sql.= " AND ";
|
||||
$sql.= " AND";
|
||||
}
|
||||
$sql.= "numeroMarque=$idDepot";
|
||||
$sql.= " numeroMarque=$idDepot";
|
||||
}
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($stmtNb > 0) {
|
||||
while ($marque = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
if ($marque['nomMarque'] == ' ') {
|
||||
$nomMarque = '(figurative)';
|
||||
@ -51,12 +67,19 @@ class Metier_Partenaires_MMarques
|
||||
if ($idDepot != 0) {
|
||||
if ($marque['numeroMarque'] == $idDepot) {
|
||||
//Produits et Services
|
||||
$psSql = "SELECT remarque FROM bopi.marques_classes WHERE numeroMarque=:id";
|
||||
$psStmt = $this->conn->prepare($psSql);
|
||||
$psStmt->bindValue('id', $idDepot);
|
||||
$psStmt->execute();
|
||||
try {
|
||||
$psSql = "SELECT remarque FROM bopi.marques_classes WHERE numeroMarque=:id";
|
||||
$psStmt = $this->conn->prepare($psSql);
|
||||
$psStmt->bindValue('id', $idDepot);
|
||||
$psStmt->execute();
|
||||
$pNb = $psStmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
$txt = array();
|
||||
if ($psStmt->rowCount() > 0) {
|
||||
if ($pNb > 0) {
|
||||
while ($ps = $psStmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$txt[] = $ps['remarque'];
|
||||
}
|
||||
@ -64,12 +87,19 @@ class Metier_Partenaires_MMarques
|
||||
$marque['PS'] = $txt;
|
||||
|
||||
//Historique
|
||||
$hSql = "SELECT histo2 FROM bopi.marques_histo WHERE numeroMarque=:id ORDER BY dat DESC";
|
||||
$hStmt = $this->conn->prepare($psSql);
|
||||
$hStmt->bindValue('id', $idDepot);
|
||||
$hStmt->execute();
|
||||
try {
|
||||
$hSql = "SELECT histo2 FROM bopi.marques_histo WHERE numeroMarque=:id ORDER BY dat DESC";
|
||||
$hStmt = $this->conn->prepare($psSql);
|
||||
$hStmt->bindValue('id', $idDepot);
|
||||
$hStmt->execute();
|
||||
$hNb = $hStmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
$txt = array();
|
||||
if ($hStmt->rowCount() > 0) {
|
||||
if ($hNb > 0) {
|
||||
while ($h = $hStmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$txt[] = $h['histo2'];
|
||||
}
|
||||
|
@ -66,8 +66,6 @@ class Metier_Partenaires_MPrivileges
|
||||
'28' => "GAGE DES STOCKS",
|
||||
);
|
||||
|
||||
protected $iDb;
|
||||
|
||||
/**
|
||||
* PDO Connection with Doctrine
|
||||
* @var \Doctrine\DBAL\Connection
|
||||
|
@ -1,27 +1,40 @@
|
||||
<?php
|
||||
require_once 'framework/common/curl.php';
|
||||
|
||||
class Metier_Partenaires_MQualibat
|
||||
{
|
||||
private $referer ='';
|
||||
private $body = '';
|
||||
private $header = '';
|
||||
private $cookie = '';
|
||||
private $codeRetour = 0;
|
||||
private $accesDist=true;
|
||||
private $iDb;
|
||||
private $iBodacc;
|
||||
private $iInsee;
|
||||
protected $iBodacc;
|
||||
protected $iInsee;
|
||||
|
||||
public $enCache=false;
|
||||
public $force=false;
|
||||
public $annee=0;
|
||||
/**
|
||||
* PDO Connection with Doctrine
|
||||
* @var \Doctrine\DBAL\Connection
|
||||
*/
|
||||
protected $conn;
|
||||
|
||||
/**
|
||||
* Logger
|
||||
* @var \Monolog\Logger
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
/**
|
||||
* Enable remote
|
||||
* @var string
|
||||
*/
|
||||
protected $remote = false;
|
||||
|
||||
public function __construct($accesDist = true)
|
||||
/**
|
||||
* MQualibat
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->accesDist = $accesDist;
|
||||
$this->iDb = new Metier_Util_Db();
|
||||
$this->conn = Zend_Registry::get('doctrine');
|
||||
|
||||
if (Zend_Registry::isRegistered('logger')) {
|
||||
$this->logger = Zend_Registry::get('logger');
|
||||
}
|
||||
|
||||
$this->iBodacc = new Metier_Bodacc_MBodacc();
|
||||
$this->iInsee = new Metier_Insee_MInsee();
|
||||
}
|
||||
@ -77,23 +90,40 @@ class Metier_Partenaires_MQualibat
|
||||
|
||||
public function getMaxQualibat()
|
||||
{
|
||||
$ret = $this->iDb->select('sdv1.qualibat', 'MAX(id) AS id', '1', false, MYSQL_ASSOC);
|
||||
return $ret[0]['id'];
|
||||
$sql = "SELECT MAX(id) AS id FROM sdv1.qualibat";
|
||||
try {
|
||||
$stmt = $this->conn->executeQuery($sql);
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
$result = $stmt->fetch(\PDO::FETCH_OBJ);
|
||||
|
||||
return $result->id;
|
||||
}
|
||||
|
||||
public function getTabQualibatManquants()
|
||||
{
|
||||
$tabRet = $tabQualibatCalc = $tabQualibatBase = array();
|
||||
|
||||
// Liste des Qualibat Calculés
|
||||
$maxQualibat = $this->getMaxQualibat();
|
||||
for ($i=1; $i<=$maxQualibat; $i++) {
|
||||
$tabQualibatCalc[]=$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'];
|
||||
$sql = "SELECT id FROM sdv1.qualibat ORDER BY id ASC";
|
||||
try {
|
||||
$stmt = $this->conn->executeQuery($sql);
|
||||
while ($result = $stmt->fetch(PDO::FETCH_OBJ)) {
|
||||
$tabQualibatBase[] = $result->id;
|
||||
}
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
return array_diff($tabQualibatCalc, $tabQualibatBase);
|
||||
@ -109,34 +139,56 @@ class Metier_Partenaires_MQualibat
|
||||
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);
|
||||
$sql = "SELECT siren, actif, id, nom, adresse, cp, ville, tel, fax, email, web, eff, teff,
|
||||
ca, tca, libFJ, nace, dateFondation, dateDeb, dateFin, dateInsert
|
||||
FROM sdv1.qualibat WHERE $strWhere";
|
||||
try {
|
||||
$stmt = $this->conn->executeQuery($sql);
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// In database
|
||||
if (!$this->force && count($ret) > 0) {
|
||||
$this->enCache=true;
|
||||
$tabRet = $ret[0];//array();
|
||||
if ($this->remote === false && $stmt->rowCount() > 0) {
|
||||
$tabRet = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
|
||||
// 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;
|
||||
$sql = "SELECT code, periodQualif, niveauQualif, mentions, nomQualif, dateAttrib, dateEch
|
||||
FROM sdv1.qualibatqualif WHERE $strWhere";
|
||||
try {
|
||||
$stmt = $this->conn->executeQuery($sql);
|
||||
if ($stmt->rowCount() > 0) {
|
||||
while ($result = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$tabRet['qualifications'][] = $result;
|
||||
}
|
||||
}
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// 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;
|
||||
$sql = "SELECT civNomPrenom, civilite, nom, prenom, fonction
|
||||
FROM sdv1.qualibatdir WHERE $strWhere";
|
||||
try {
|
||||
$stmt = $this->conn->executeQuery($sql);
|
||||
if ($stmt->rowCount() > 0) {
|
||||
while ($result = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$tabRet['dirigeants'][] = $result;
|
||||
}
|
||||
}
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// WebSite
|
||||
elseif ($this->accesDist == true) {
|
||||
$this->enCache = false;
|
||||
if ($this->remote === true) {
|
||||
$url = 'http://www.qualibat.com/Views/EntreprisesRechercheDetail.aspx?id='.$idQualibat;
|
||||
$page = getUrl($url, '', '', '', false, '', '', 3);
|
||||
if ($page['code'] != 200) {
|
||||
@ -258,10 +310,10 @@ class Metier_Partenaires_MQualibat
|
||||
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;
|
||||
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(
|
||||
@ -282,8 +334,19 @@ class Metier_Partenaires_MQualibat
|
||||
'dateDeb' => @$tabDateAttrib[0],
|
||||
'dateFin' => @$tabDateFin[0]));
|
||||
unset($tabInsert['qualifications']);
|
||||
if (!$this->iDb->insert('sdv1.qualibat', $tabInsert)) {
|
||||
$this->iDb->update('sdv1.qualibat', $tabInsert, "id=$idQualibat");
|
||||
|
||||
$sql = "SELECT id FROM sdv1.qualibat WHERE id=$idQualibat";
|
||||
try {
|
||||
$stmt = $this->conn->executeQuery($sql);
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$this->conn->update('sdv1.qualibat', $tabInsert, array('id' => $idQualibat));
|
||||
} else {
|
||||
$this->conn->insert('sdv1.qualibat', $tabInsert);
|
||||
}
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/** Insertion des qualifications **/
|
||||
@ -292,8 +355,24 @@ class Metier_Partenaires_MQualibat
|
||||
$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']."'");
|
||||
|
||||
$sql = "SELECT id FROM sdv1.qualibatqualif
|
||||
WHERE id=$idQualibat AND code='".$tabInsert['code']."' AND periodQualif='".$tabInsert['periodQualif']."'";
|
||||
try {
|
||||
$stmt = $this->conn->executeQuery($sql);
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$this->conn->update('sdv1.qualibatqualif', $tabInsert, array(
|
||||
'id' => $idQualibat,
|
||||
'code' => $tabInsert['code'],
|
||||
'periodQualif' => $tabInsert['periodQualif'],
|
||||
));
|
||||
} else {
|
||||
$this->conn->insert('sdv1.qualibatqualif', $tabInsert);
|
||||
}
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -304,29 +383,66 @@ class Metier_Partenaires_MQualibat
|
||||
$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'])."'");
|
||||
|
||||
$sql = "SELECT id FROM sdv1.qualibatdir
|
||||
WHERE id=$idQualibat AND civNomPrenom='".addslashes($tabInsert['civNomPrenom'])."' AND fonction='".addslashes($tabInsert['fonction'])."'";
|
||||
try {
|
||||
$stmt = $this->conn->executeQuery($sql);
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$this->conn->update('sdv1.qualibatdir', $tabInsert, array(
|
||||
'id' => $idQualibat,
|
||||
'civNomPrenom' => $tabInsert['civNomPrenom'],
|
||||
'fonction' => $tabInsert['fonction'],
|
||||
));
|
||||
} else {
|
||||
$this->conn->insert('sdv1.qualibatdir', $tabInsert);
|
||||
}
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
unset($tabRet['dirigeants'][$i]['civNomPrenom']);
|
||||
}
|
||||
}
|
||||
|
||||
return $tabRet;
|
||||
} else {
|
||||
$tabInsert = array(
|
||||
'actif' => 0,
|
||||
'id' => $idQualibat,
|
||||
'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);
|
||||
try {
|
||||
$stmt = $this->conn->insert('sdv1.qualibat', $tabInsert);
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Remote Infos
|
||||
* @param unknown $id
|
||||
*/
|
||||
protected function getRemote($id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -58,6 +58,12 @@ class Metier_Partenaires_MRncs
|
||||
*/
|
||||
protected $conn;
|
||||
|
||||
/**
|
||||
* Logger
|
||||
* @var \Monolog\Logger
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
/**
|
||||
* Flag to get remote data
|
||||
* @var string
|
||||
@ -71,6 +77,10 @@ class Metier_Partenaires_MRncs
|
||||
{
|
||||
$this->conn = Zend_Registry::get('doctrine');
|
||||
|
||||
if (Zend_Registry::isRegistered('logger')) {
|
||||
$this->logger = Zend_Registry::get('logger');
|
||||
}
|
||||
|
||||
$this->tabDevises = $this->getTabDevisesInpi();
|
||||
$this->tabPays = $this->getTabPaysInpi();
|
||||
$this->tabTribunaux = $this->getTabTribunaux();
|
||||
@ -109,13 +119,24 @@ class Metier_Partenaires_MRncs
|
||||
return include $cache;
|
||||
} else {
|
||||
$sql = "SELECT devInpi, devIso FROM jo.tabDevises WHERE devInpi>0 ORDER BY devInpi ASC";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
|
||||
$nb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$nb = $stmt->rowCount();
|
||||
} catch(\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if ($nb > 0) {
|
||||
while ($item = $stmt->fetch(\PDO::FETCH_OBJ)) {
|
||||
$tabDevises[intval($item->devInpi)] = $item->devIso;
|
||||
}
|
||||
}
|
||||
|
||||
return $tabDevises;
|
||||
}
|
||||
}
|
||||
@ -146,9 +167,19 @@ class Metier_Partenaires_MRncs
|
||||
} else {
|
||||
$tabJug = array();
|
||||
$sql = "SELECT codJugement, codEven FROM jo.tabJugeRncs";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
|
||||
$nb = 0;
|
||||
try {
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$nb = $stmt->rowCount();
|
||||
} catch(\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if ($nb > 0) {
|
||||
while ($item = $stmt->fetch(\PDO::FETCH_OBJ)) {
|
||||
$tabJug[intval($item->codJugement)] = $item->codEven;
|
||||
}
|
||||
@ -178,9 +209,19 @@ class Metier_Partenaires_MRncs
|
||||
} else {
|
||||
$tabPays = array();
|
||||
$sql = "SELECT codePaysInpi, codPays FROM jo.tabPays WHERE codePaysInpi>0 ORDER BY codePaysInpi ASC";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
|
||||
$nb = 0;
|
||||
try {
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$nb = $stmt->rowCount();
|
||||
} catch(\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if ($nb > 0) {
|
||||
while ($item = $stmt->fetch(PDO::FETCH_OBJ)) {
|
||||
$tabPays[$item->codePaysInpi*1] = $item->codPays;
|
||||
}
|
||||
@ -195,12 +236,24 @@ class Metier_Partenaires_MRncs
|
||||
*/
|
||||
protected function getTabMandataires()
|
||||
{
|
||||
$tabMandSD = array();
|
||||
|
||||
$sql = "SELECT 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
|
||||
FROM jo.tabMandataires WHERE TYPE IN ('A', 'M') GROUP BY NomPre, dep, sirenMand ORDER BY NomPre ASC";
|
||||
$stmt = $this->conn->executeQuery($sql);
|
||||
if ($stmt->rowCount() > 0) {
|
||||
|
||||
$nb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->executeQuery($sql);
|
||||
$nb = $stmt->rowCount();
|
||||
} catch(\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if ($nb > 0) {
|
||||
while ($mand = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$tabMandSD[] = array(
|
||||
'id' => $mand['id'],
|
||||
@ -246,13 +299,22 @@ class Metier_Partenaires_MRncs
|
||||
WHERE 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";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() == 1) {
|
||||
$nb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$nb = $stmt->rowCount();
|
||||
} catch(\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if ($nb == 1) {
|
||||
$result = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
$this->matching = $result['score'];
|
||||
return $result['id'];
|
||||
} elseif ($stmt->rowCount() > 1) {
|
||||
} elseif ($nb > 1) {
|
||||
while ($iRet = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
if ($debug) {
|
||||
echo "je compare '$cp' avec '".$iRet['cp']."' et '$ville' avec '".$iRet["ville"]."' (score=".$iRet['score'].")\n";
|
||||
@ -296,9 +358,19 @@ class Metier_Partenaires_MRncs
|
||||
} else {
|
||||
$tabTribunaux = array();
|
||||
$sql = "SELECT triNumGreffe, triNom, triId, triCode FROM jo.tribunaux WHERE triNumGreffe IS NOT NULL";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
|
||||
$nb = 0;
|
||||
try {
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$nb = $stmt->rowCount();
|
||||
} catch(\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if ($nb > 0) {
|
||||
while ($item = $stmt->fetch(\PDO::FETCH_OBJ)) {
|
||||
$tabTribunaux[$item->triNumGreffe*1] = array(
|
||||
'Id' => $item->triId,
|
||||
@ -321,8 +393,20 @@ class Metier_Partenaires_MRncs
|
||||
$fj = $code_forme_juridique*1;
|
||||
$label = 'En instance de chiffrement';
|
||||
if ($fj > 0 && $fj < 10000) {
|
||||
$stmt = $this->conn->executeQuery("SELECT libelle AS LibFJ FROM jo.tabFJur WHERE code=$fj");
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$sql = "SELECT libelle AS LibFJ FROM jo.tabFJur WHERE code=$fj";
|
||||
|
||||
$nb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$nb = $stmt->rowCount();
|
||||
} catch(\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if ($nb > 0) {
|
||||
$result = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
$label = $result['LibFJ'];
|
||||
}
|
||||
@ -338,10 +422,22 @@ class Metier_Partenaires_MRncs
|
||||
*/
|
||||
private function getLibelleNaf($codeNaf)
|
||||
{
|
||||
$stmt = $this->conn->executeQuery("SELECT libNaf700 AS LibNaf FROM jo.tabNaf4 WHERE codNaf700='$codeNaf'
|
||||
UNION SELECT libNaf5 AS LibNaf FROM jo.tabNaf5 WHERE codNaf5='$codeNaf'");
|
||||
$sql = "SELECT libNaf700 AS LibNaf FROM jo.tabNaf4 WHERE codNaf700='$codeNaf'
|
||||
UNION SELECT libNaf5 AS LibNaf FROM jo.tabNaf5 WHERE codNaf5='$codeNaf'";
|
||||
$label = "Inconnu";
|
||||
if ($stmt->rowCount() > 0) {
|
||||
|
||||
$nb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$nb = $stmt->rowCount();
|
||||
} catch(\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if ($nb > 0) {
|
||||
$result = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
$label = $result['LibNaf'];
|
||||
}
|
||||
@ -412,10 +508,19 @@ class Metier_Partenaires_MRncs
|
||||
adrLibVoie, adrTypeVoie, adrVoie, cp, commune, adrComp, adresse1, adresse2, adresse3,
|
||||
naf, dateFermeture, flux, DATE(dateUpdate) AS jourUpdate
|
||||
FROM jo.rncs_etab WHERE siren=:siren $strSql";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() == 0) {
|
||||
|
||||
$nb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
$nb = $stmt->rowCount();
|
||||
} catch(\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($nb == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -483,10 +588,20 @@ class Metier_Partenaires_MRncs
|
||||
|
||||
$sql = "SELECT siren, sirenValide, actif, numGreffe, triCode, triId, numRC, numRC2, raisonSociale, nom, prenom, nomUsage, sigle, dateNaiss, lieuNaiss, sexe, nationalite, pays, naf, cj, capitalMontant, capitalDevise, capitalDevIso, dateImma, dateRad, capitalType, capitalCent, provisoires, flux, DATE(dateUpdate) AS jourUpdate
|
||||
FROM jo.rncs_entrep WHERE siren=:siren";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
|
||||
$nb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
$nb = $stmt->rowCount();
|
||||
} catch(\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if ($nb > 0) {
|
||||
$entrep = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
if ($entrep['jourUpdate'] != '0000-00-00') {
|
||||
$dateMaj = $entrep['jourUpdate'];
|
||||
@ -539,6 +654,8 @@ class Metier_Partenaires_MRncs
|
||||
*/
|
||||
public function getListeDepots($siren, $dateDepot = null)
|
||||
{
|
||||
$tabDepots = array();
|
||||
|
||||
$sql = "SELECT e.siren, e.codeInterne, e.dateDepot, e.codeEven, l.libEven, e.flux, DATE(e.dateInsert) AS dateInsert
|
||||
FROM jo.rncs_even e LEFT JOIN jo.tabEvenRncs l ON e.codeEven=l.codeEven";
|
||||
$where = " e.siren=$siren ORDER BY e.dateDepot DESC, e.codeInterne ASC";
|
||||
@ -546,10 +663,19 @@ class Metier_Partenaires_MRncs
|
||||
$where = " e.siren=$siren AND e.dateDepot='$dateDepot'";
|
||||
}
|
||||
$sql.= " WHERE ".$where;
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$tabDepots = array();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
|
||||
$nb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$nb = $stmt->rowCount();
|
||||
} catch(\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if ($nb > 0) {
|
||||
while ($result = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$tabDepots[] = array(
|
||||
'codDepot' => $result['codeEven'],
|
||||
@ -579,10 +705,20 @@ class Metier_Partenaires_MRncs
|
||||
adm2id, adm2codeFct, adm2type, adm2nom, adm2adrNum, adm2adrInd, adm2adrType, adm2adrLibVoie, adm2adrVoie, adm2adr1, adm2adr2, adm2adr3, adm2adrCP, adm2adrVille
|
||||
FROM jo.rncs_jugements j, jo.tabJugeRncs l, jo.tabEvenements e
|
||||
WHERE j.siren=:siren AND j.codeJugement=l.codJugement AND l.codEven=e.codEven ORDER BY j.dateEffet DESC";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
|
||||
$nb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
$nb = $stmt->rowCount();
|
||||
} catch(\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if ($nb > 0) {
|
||||
while ($result = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$tabDepots[] = array(
|
||||
'codEven' => $result['codEven'],
|
||||
@ -662,10 +798,20 @@ class Metier_Partenaires_MRncs
|
||||
$sql = "SELECT siren, nic, `table`, champs, valeur, flux, dateInsert FROM jo.rncs_modifs
|
||||
WHERE siren=:siren $strNic $strType $strDateDeb $strDateFin AND `table`='rncs_entrep'
|
||||
ORDER BY flux DESC";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
|
||||
$nb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
$nb = $stmt->rowCount();
|
||||
} catch(\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if ($nb > 0) {
|
||||
while ($result = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$codEve = array();
|
||||
switch ($result['champs']) {
|
||||
@ -807,10 +953,20 @@ class Metier_Partenaires_MRncs
|
||||
FROM jo.annonces WHERE 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";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
|
||||
$nb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
$nb = $stmt->rowCount();
|
||||
} catch(\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if ($nb > 0) {
|
||||
$result = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
$tabRet['dateCessationPaiement'] = $depot['dateCessationPaiement'];
|
||||
for ($i=1; $i<4; $i++) {
|
||||
@ -1079,15 +1235,25 @@ class Metier_Partenaires_MRncs
|
||||
{
|
||||
$siren = $siren*1;
|
||||
$tabRet = array();
|
||||
$numDir = 0;
|
||||
|
||||
$sql = "SELECT siren, raisonSociale, dirRS, civilite, nom, prenom, naissance_nom, naissance_date,
|
||||
naissance_lieu, fonction_code, fonction_lib, cinf, dateFin, flux, dateInsert
|
||||
FROM jo.rncs_dirigeants WHERE siren=:siren AND actif%10=1 ORDER BY fonction_code DESC";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
$numDir = 0;
|
||||
if ($stmt->rowCount() > 0) {
|
||||
|
||||
$nb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
$nb = $stmt->rowCount();
|
||||
} catch(\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if ($nb > 0) {
|
||||
while ($result = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$numDir++;
|
||||
if ($result['naissance_date'] != '0000-00-00') {
|
||||
@ -1126,16 +1292,26 @@ class Metier_Partenaires_MRncs
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
$sql = "SELECT 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
|
||||
FROM jo.rncs_entrep WHERE siren=:siren";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
|
||||
$nb = 0;
|
||||
try {
|
||||
$stmt2 = $this->conn->prepare($sql);
|
||||
$stmt2->bindValue('siren', $siren);
|
||||
$stmt2->execute();
|
||||
$nb = $stmt2->rowCount();
|
||||
} catch(\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($nb > 0) {
|
||||
$numDir = 0;
|
||||
while ($result = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
while ($result = $stmt2->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$numDir++;
|
||||
if ($result['naissance_date'] != '0000-00-00') {
|
||||
$dateNaiss = Metier_Util_Date::dateT('Y-m-d', 'd/m/Y', $result['naissance_date']);
|
||||
|
@ -32,7 +32,7 @@ class Metier_Partenaires_MRnvp
|
||||
public function __construct()
|
||||
{
|
||||
$this->iDb = new Metier_Util_Db();
|
||||
$this->iInsee = new Metier_Insee_MInsee($this->iDb);
|
||||
$this->iInsee = new Metier_Insee_MInsee();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -7,9 +7,22 @@ class Metier_Partenaires_MTel
|
||||
*/
|
||||
protected $conn;
|
||||
|
||||
/**
|
||||
* Logger
|
||||
* @var \Monolog\Logger
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
/**
|
||||
* Tel
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->conn = Zend_Registry::get('doctrine');
|
||||
|
||||
if (Zend_Registry::isRegistered('logger')) {
|
||||
$this->logger = Zend_Registry::get('logger');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -59,22 +72,35 @@ class Metier_Partenaires_MTel
|
||||
partenaireConf, nbConf, idUpdate, dateUpdate, dateUpdate*1 AS dateUpdateYmd
|
||||
FROM jo.telephonie WHERE siren=:siren $strNic $strActif AND dateSuppr=0
|
||||
ORDER BY typeTel ASC, nbConf DESC";
|
||||
$nb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
$nb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
return $tabRet;
|
||||
}
|
||||
if ($stmt->rowCount() > 0) {
|
||||
if ($nb > 0) {
|
||||
$this->enCache = true;
|
||||
while ($tabTel = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
if ($tabTel['typeTel'] == 'an8' && $tabTel['infoTel']*1 > 0) {
|
||||
$an8 = $tabTel['infoTel']*1;
|
||||
$sql = "SELECT libAn8 FROM jo.tabAn8 WHERE codAn8='$an8'";
|
||||
$an8Stmt = $this->conn->executeQuery($sql);
|
||||
$an8Nb = 0;
|
||||
try {
|
||||
$an8Stmt = $this->conn->executeQuery($sql);
|
||||
$an8Nb = $an8Stmt->rowCount();
|
||||
} catch(\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
$infoTel = '';
|
||||
if ($an8Stmt->rowCount() > 0) {
|
||||
if ($an8Nb > 0) {
|
||||
$result = $an8Stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
$label = $result['libAn8'];
|
||||
$infoTel = ucfirst(strtolower($label));
|
||||
|
@ -27,6 +27,12 @@ class Metier_Partenaires_MTva
|
||||
*/
|
||||
protected $conn;
|
||||
|
||||
/**
|
||||
* Logger
|
||||
* @var \Monolog\Logger
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
/**
|
||||
* Remote Flag
|
||||
* @var boolean
|
||||
@ -40,6 +46,10 @@ class Metier_Partenaires_MTva
|
||||
public function __construct()
|
||||
{
|
||||
$this->conn = Zend_Registry::get('doctrine');
|
||||
|
||||
if (Zend_Registry::isRegistered('logger')) {
|
||||
$this->logger = Zend_Registry::get('logger');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -74,10 +84,18 @@ class Metier_Partenaires_MTva
|
||||
|
||||
$sql = "SELECT LPAD(cle,2,0) AS cle, DATE_FORMAT(dateMod,'%Y%m%d') as DateMAJ
|
||||
FROM sdv1.siren_tva WHERE siren=:siren";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $this->siren);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$stmtNb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $this->siren);
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($stmtNb > 0) {
|
||||
$exist = true;
|
||||
$result = $stmt->fetch(\PDO::FETCH_OBJ);
|
||||
$cle = $result->cle;
|
||||
@ -104,7 +122,7 @@ class Metier_Partenaires_MTva
|
||||
return true;
|
||||
}
|
||||
|
||||
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__);
|
||||
$this->logger->error("Erreur impossible (car l'algo ne devrait pas passer par ici) sur le Siren $siren, numéro de TVA = FR $cle $siren. Cas impossible !");
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -160,11 +178,23 @@ class Metier_Partenaires_MTva
|
||||
if (preg_match('/Yes, valid VAT number/i', $body)
|
||||
|| preg_match('/Oui, numéro de TVA valide/i', $body)) {
|
||||
if ($exist) {
|
||||
$this->conn->update('sdv1.siren_tva', array('cle' => intval($this->cle),
|
||||
try {
|
||||
$this->conn->update('sdv1.siren_tva', array('cle' => intval($this->cle),
|
||||
'duree' => $time), array('siren' => $this->siren));
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->conn->insert('sdv1.siren_tva', array('siren' => $this->siren,
|
||||
'cle' => intval($this->cle), 'duree' => $time));
|
||||
try {
|
||||
$this->conn->insert('sdv1.siren_tva', array('siren' => $this->siren,
|
||||
'cle' => intval($this->cle), 'duree' => $time));
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->vatNumber = "FR".$this->cle.$this->siren;
|
||||
$this->vatDefined = true;
|
||||
@ -172,16 +202,28 @@ class Metier_Partenaires_MTva
|
||||
}
|
||||
}
|
||||
} catch (RequestException $e) {
|
||||
Metier_Util_Log::write('I', "TVA ".$e->getMessage(), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
|
||||
// Non disponible
|
||||
if ($exist) {
|
||||
$this->conn->update('sdv1.siren_tva', array('cle' => 'NULL', 'duree' => $time),
|
||||
array('siren' => $this->siren));
|
||||
try {
|
||||
$this->conn->update('sdv1.siren_tva', array('cle' => 'NULL', 'duree' => $time),
|
||||
array('siren' => $this->siren));
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->conn->insert('sdv1.siren_tva', array('siren' => $this->siren,
|
||||
'cle' => 'NULL', 'duree' => $time));
|
||||
try {
|
||||
$this->conn->insert('sdv1.siren_tva', array('siren' => $this->siren,
|
||||
'cle' => 'NULL', 'duree' => $time));
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->vatNumber = "FR".$this->cle.$this->siren;
|
||||
|
@ -703,7 +703,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$iDb = $db;
|
||||
}
|
||||
|
||||
$iInsee = new Metier_Insee_MInsee($iDb);
|
||||
$iInsee = new Metier_Insee_MInsee();
|
||||
|
||||
/**
|
||||
* Récupération des informations identitaire
|
||||
@ -2193,7 +2193,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$tabA = $lienM->getActionnaires(null, true);
|
||||
if (count($tabA)>0) {
|
||||
foreach ($tabA as $i=>$lien) {
|
||||
$lienInsee = new Metier_Insee_MInsee($iDb);
|
||||
$lienInsee = new Metier_Insee_MInsee();
|
||||
if (intval($lien->siren)>100 && ($lien->MajMin=='+' || $lien->PDetention>50)) {
|
||||
$tabIdentiteA=$lienInsee->getIdentiteLight($lien->siren);
|
||||
if ($NICMERE*1==0) {
|
||||
@ -2235,7 +2235,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
if (count($tabP)>0) {
|
||||
foreach ($tabP as $i=>$lien) {
|
||||
if ($lien->siren>100 && ($lien->MajMin=='+' || $lien->PDetention>50)) {
|
||||
$lienInsee = new Metier_Insee_MInsee($iDb);
|
||||
$lienInsee = new Metier_Insee_MInsee();
|
||||
$NBFILLE++; // Nombre de participations à plus de 50%
|
||||
if ($NBFILLE==1) {
|
||||
$tabIdentiteP=$lienInsee->getIdentiteLight($lien->siren);
|
||||
@ -2611,7 +2611,6 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$ANNONCEINTERDIT=0;
|
||||
$dirs = $iInsee->getDirigeants($siren, false);
|
||||
$timer['getDirigeants'] = microtime(true);
|
||||
//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) {
|
||||
@ -3222,8 +3221,6 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$encoursEstime=$plafondEstime;
|
||||
}
|
||||
|
||||
// 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) {
|
||||
$dateCre=$tabIdentite['DateCreaEn']*1;
|
||||
|
@ -760,7 +760,7 @@ class Metier_Scoring_Base extends Metier_Scoring_Vars
|
||||
|
||||
$this->NIVEAU = $cycleClient; // 1, 2, 3 ou 5 Niveau de version des commentaires
|
||||
|
||||
$iInsee = new Metier_Insee_MInsee($this->db);
|
||||
$iInsee = new Metier_Insee_MInsee();
|
||||
if ($this->companyEvenDateStop !== null) {
|
||||
$iInsee->setEvenLimit($this->companyEvenDateStop);
|
||||
}
|
||||
@ -2135,7 +2135,7 @@ class Metier_Scoring_Base extends Metier_Scoring_Vars
|
||||
$tabA = $lienM->getActionnaires(null, true);
|
||||
if (count($tabA)>0) {
|
||||
foreach ($tabA as $i=>$lien) {
|
||||
$lienInsee = new Metier_Insee_MInsee($this->db);
|
||||
$lienInsee = new Metier_Insee_MInsee();
|
||||
if (intval($lien->siren)>100 && ($lien->MajMin=='+' || $lien->PDetention>50)) {
|
||||
$tabIdentiteA=$lienInsee->getIdentiteLight($lien->siren);
|
||||
if ($this->NICMERE*1==0) {
|
||||
@ -2177,7 +2177,7 @@ class Metier_Scoring_Base extends Metier_Scoring_Vars
|
||||
if (count($tabP)>0) {
|
||||
foreach ($tabP as $i=>$lien) {
|
||||
if ($lien->siren>100 && ($lien->MajMin=='+' || $lien->PDetention>50)) {
|
||||
$lienInsee = new Metier_Insee_MInsee($this->db);
|
||||
$lienInsee = new Metier_Insee_MInsee();
|
||||
$this->NBFILLE++; // Nombre de participations à plus de 50%
|
||||
if ($this->NBFILLE==1) {
|
||||
$tabIdentiteP=$lienInsee->getIdentiteLight($lien->siren);
|
||||
@ -2553,7 +2553,6 @@ class Metier_Scoring_Base extends Metier_Scoring_Vars
|
||||
$this->ANNONCEINTERDIT=0;
|
||||
$dirs = $iInsee->getDirigeants($siren, false);
|
||||
$timer['getDirigeants'] = microtime(true);
|
||||
//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) {
|
||||
@ -3168,8 +3167,6 @@ class Metier_Scoring_Base extends Metier_Scoring_Vars
|
||||
$encoursEstime=$plafondEstime;
|
||||
}
|
||||
|
||||
// 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) {
|
||||
$dateCre=$tabIdentite['DateCreaEn']*1;
|
||||
|
@ -6,6 +6,12 @@ class Metier_Util_Db
|
||||
*/
|
||||
protected $db = null;
|
||||
|
||||
/**
|
||||
* Logger
|
||||
* @var \Monolog\Logger
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var unknown
|
||||
@ -21,6 +27,10 @@ class Metier_Util_Db
|
||||
if ($db === null) {
|
||||
$this->db = Zend_Db_Table::getDefaultAdapter();
|
||||
}
|
||||
|
||||
if (Zend_Registry::isRegistered('logger')) {
|
||||
$this->logger = Zend_Registry::get('logger');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -265,11 +275,14 @@ class Metier_Util_Db
|
||||
$duree = 'N/D';
|
||||
}
|
||||
if ($this->errorCode == 0) {
|
||||
$msg = date('Y-m-d H:i:s') ." - DEBUG - ".$this->errorCode.":".$this->errorMsg." - ".$query." - ".$duree;
|
||||
if ($this->logger != null) {
|
||||
$this->logger->debug($this->errorCode.":".$this->errorMsg." - ".$query." - ".$duree);
|
||||
}
|
||||
} else {
|
||||
$msg = date('Y-m-d H:i:s') ." - ERROR - ".$this->errorCode.":".$this->errorMsg." - ".$query." - ".$duree;
|
||||
if ($this->logger != null) {
|
||||
$this->logger->error($this->errorCode.":".$this->errorMsg." - ".$query." - ".$duree);
|
||||
}
|
||||
}
|
||||
file_put_contents(LOG_PATH . '/mysql.log', $msg . "\n", FILE_APPEND);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,74 +0,0 @@
|
||||
<?php
|
||||
class Metier_Util_PdoLib
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @var \PDO
|
||||
*/
|
||||
protected $conn = false;
|
||||
|
||||
/**
|
||||
* Connection PDO
|
||||
* Note : Transition avant de faire les librairies Metier PSR-4
|
||||
* @param array $config
|
||||
* 'host' => 'IP',
|
||||
* 'port' => '3306',
|
||||
* 'dbname' => 'db',
|
||||
* 'charset' => 'utf8',
|
||||
* 'user' => 'user',
|
||||
* 'password' => 'password',
|
||||
* @return boolean|PDO
|
||||
*/
|
||||
public function __construct(array $config = array())
|
||||
{
|
||||
$user = null;
|
||||
$password = null;
|
||||
$options = array();
|
||||
|
||||
// Get Application config from registry
|
||||
if (count($config) == 0) {
|
||||
$c = Zend_Registry::get('config');
|
||||
$params = $c->profil->db->metier->params;
|
||||
$dsn = "mysql:host=".$params->host.
|
||||
";port=".(isset($params->port) ? $params->port : '3306').
|
||||
";dbname=".$params->dbname.
|
||||
";charset=utf8";
|
||||
$user = $params->username;
|
||||
$password = $params->password;
|
||||
}
|
||||
// Get config from params
|
||||
else {
|
||||
$dsn = "mysql:host=".$config['host'].
|
||||
";port=".(isset($config['port']) ? $config['port'] : '3306').
|
||||
";dbname=".$config['dbname'].
|
||||
";charset=".(isset($config['charset']) ? $config['charset'] : 'utf8');
|
||||
if (array_key_exists('username', $config)) {
|
||||
$user = $config['username'];
|
||||
}
|
||||
if (array_key_exists('password', $config)) {
|
||||
$password = $config['password'];
|
||||
}
|
||||
if (array_key_exists('options', $config)) {
|
||||
$options = $config['options'];
|
||||
}
|
||||
}
|
||||
|
||||
// Try to load PDO
|
||||
try {
|
||||
$this->conn = new PDO($dsn, $user, $password, $options);
|
||||
$this->conn->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
|
||||
} catch (PDOException $e) {
|
||||
echo $e->getMessage();
|
||||
$this->conn = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get connection
|
||||
* @return PDO
|
||||
*/
|
||||
public function getConnection()
|
||||
{
|
||||
return $this->conn;
|
||||
}
|
||||
}
|
@ -14,7 +14,19 @@ class Scores_Auth_Adapter_Db implements Zend_Auth_Adapter_Interface
|
||||
protected $clients = array();
|
||||
|
||||
/**
|
||||
*
|
||||
* PDO Connection with Doctrine
|
||||
* @var \Doctrine\DBAL\Connection
|
||||
*/
|
||||
protected $conn;
|
||||
|
||||
/**
|
||||
* Logger
|
||||
* @var \Monolog\Logger
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
/**
|
||||
* Auth DB
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
* @param boolean $checkWs
|
||||
@ -25,6 +37,12 @@ class Scores_Auth_Adapter_Db implements Zend_Auth_Adapter_Interface
|
||||
$this->_password = $password;
|
||||
$this->_hash = md5($username.'|'.$password);
|
||||
$this->checkWs = $checkWs;
|
||||
|
||||
$this->conn = Zend_Registry::get('doctrine');
|
||||
|
||||
if (Zend_Registry::isRegistered('logger')) {
|
||||
$this->logger = Zend_Registry::get('logger');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -33,7 +51,7 @@ class Scores_Auth_Adapter_Db implements Zend_Auth_Adapter_Interface
|
||||
*/
|
||||
public function limitClient($id = null)
|
||||
{
|
||||
if (is_array($id) && count($id)>0) {
|
||||
if (is_array($id) && count($id) > 0) {
|
||||
$this->clients = $id;
|
||||
}
|
||||
}
|
||||
@ -44,7 +62,7 @@ class Scores_Auth_Adapter_Db implements Zend_Auth_Adapter_Interface
|
||||
*/
|
||||
public function setTimeout($seconds = null)
|
||||
{
|
||||
if ($seconds===null) {
|
||||
if ($seconds === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -57,34 +75,39 @@ class Scores_Auth_Adapter_Db implements Zend_Auth_Adapter_Interface
|
||||
*/
|
||||
public function authenticate()
|
||||
{
|
||||
$userM = new Application_Model_Sdv1Utilisateurs();
|
||||
try {
|
||||
$qb = $this->conn->createQueryBuilder();
|
||||
$qb->select(array('u.idClient', 'u.id', 'u.login', 'u.password', 'c.timeout'))
|
||||
->from('sdv1.utilisateurs', 'u')
|
||||
->join('u', 'sdv1.clients', 'c', 'u.idClient = c.id')
|
||||
->where("u.login=:login")->setParameter('login', $this->_username)
|
||||
->andWhere("u.actif=1")
|
||||
->andWhere("u.deleted=0")
|
||||
->andWhere("c.actif='Oui'");
|
||||
if (count($this->clients) > 0) {
|
||||
$qb->andWhere('u.idClient IN('.join(',', $this->clients).')');
|
||||
}
|
||||
|
||||
$sql = $userM->select()
|
||||
->setIntegrityCheck(false)
|
||||
->from(array('u'=>'sdv1.utilisateurs'), array('u.idClient', 'u.id', 'u.login', 'u.password'))
|
||||
->join(array('c'=>'sdv1.clients'), 'u.idClient = c.id', array('c.timeout'))
|
||||
->where('u.login=?', $this->_username)
|
||||
->where('u.actif=?', 1)
|
||||
->where('u.deleted=?', 0)
|
||||
->where('c.actif=?', 'Oui');
|
||||
if ($this->checkWs) {
|
||||
$qb->andWhere('u.accesWS=1');
|
||||
}
|
||||
|
||||
if (count($this->clients) > 0) {
|
||||
$sql->where('u.idClient IN('.join(',', $this->clients).')');
|
||||
$stmt = $qb->execute();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->checkWs) {
|
||||
$sql->where('u.accesWS=?', 1);
|
||||
}
|
||||
|
||||
$result = $userM->fetchRow($sql);
|
||||
|
||||
$identity = new stdClass();
|
||||
$identity->username = $this->_username;
|
||||
$identity->hash = $this->_hash;
|
||||
|
||||
if (null === $result) {
|
||||
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND, $identity, array("Identifiant ou mot de passe invalid"));
|
||||
if ($stmt->rowCount() == 0) {
|
||||
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND, $identity,
|
||||
array("Identifiant ou mot de passe invalid"));
|
||||
} else {
|
||||
$result = $stmt->fetch(PDO::FETC_OBJ);
|
||||
if ($this->_password == $result->password
|
||||
|| $this->_password == md5($result->login.'|'.$result->password)) {
|
||||
|
||||
@ -93,9 +116,11 @@ class Scores_Auth_Adapter_Db implements Zend_Auth_Adapter_Interface
|
||||
*/
|
||||
if (!empty($result->dateDebutCompte) && $result->dateDebutCompte!='0000-00-00') {
|
||||
$today = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
|
||||
$dateDebutCompte = mktime(0, 0, 0, substr($result->dateDebutCompte, 5, 2), substr($result->dateDebutCompte, 8, 2), substr($result->dateDebutCompte, 0, 4));
|
||||
$dateDebutCompte = mktime(0, 0, 0, substr($result->dateDebutCompte, 5, 2),
|
||||
substr($result->dateDebutCompte, 8, 2), substr($result->dateDebutCompte, 0, 4));
|
||||
if ($today < $dateDebutCompte) {
|
||||
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, $identity, array("Date de validité dépassé"));
|
||||
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, $identity,
|
||||
array("Date de validité dépassé"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,9 +129,11 @@ class Scores_Auth_Adapter_Db implements Zend_Auth_Adapter_Interface
|
||||
*/
|
||||
if (!empty($result->dateFinCompte) && $result->dateFinCompte!='0000-00-00') {
|
||||
$today = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
|
||||
$dateFinCompte = mktime(0, 0, 0, substr($result->dateFinCompte, 5, 2), substr($result->dateFinCompte, 8, 2), substr($result->dateFinCompte, 0, 4));
|
||||
$dateFinCompte = mktime(0, 0, 0, substr($result->dateFinCompte, 5, 2),
|
||||
substr($result->dateFinCompte, 8, 2), substr($result->dateFinCompte, 0, 4));
|
||||
if ($today > $dateFinCompte) {
|
||||
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, $identity, array("Date de validité dépassé"));
|
||||
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, $identity,
|
||||
array("Date de validité dépassé"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -117,7 +144,8 @@ class Scores_Auth_Adapter_Db implements Zend_Auth_Adapter_Interface
|
||||
$identity->time = time() + $timeout;
|
||||
return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $identity);
|
||||
} else {
|
||||
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, $identity, array("Identification impossible"));
|
||||
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, $identity,
|
||||
array("Identification impossible"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -240,6 +240,12 @@ class Scores_Ws_Server
|
||||
*/
|
||||
protected $conn;
|
||||
|
||||
/**
|
||||
* Logger
|
||||
* @var \Monolog\Logger
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
/**
|
||||
* Server SOAP
|
||||
* Document/Literal Wrapped - WS-I Compliant
|
||||
@ -247,6 +253,11 @@ class Scores_Ws_Server
|
||||
public function __construct()
|
||||
{
|
||||
$this->conn = Zend_Registry::get('doctrine');
|
||||
|
||||
if (Zend_Registry::isRegistered('logger')) {
|
||||
$this->logger = Zend_Registry::get('logger');
|
||||
}
|
||||
|
||||
$this->listeDroits = include APPLICATION_PATH . '/../library/Scores/Account/Access.php';
|
||||
$this->listeCategory = include APPLICATION_PATH . '/../library/Scores/Account/Category.php';
|
||||
}
|
||||
@ -568,9 +579,9 @@ class Scores_Ws_Server
|
||||
try {
|
||||
$result = $stmt->fetch(\PDO::FETCH_OBJ);
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
$c = Zend_Registry::get('config');
|
||||
file_put_contents($c->profil->path->shared.'/log/application.log',
|
||||
date('Y-m-d H:i:s').'- AUTH : '.$e->getMessage()."\n", FILE_APPEND);
|
||||
if ($this->logger != null) {
|
||||
$this->logger->error("AUTH : ".$e->getMessage());
|
||||
}
|
||||
return '0000';
|
||||
}
|
||||
|
||||
|
@ -5,10 +5,23 @@ class Scores_Ws_Trigger
|
||||
protected $event;
|
||||
protected $events = null;
|
||||
|
||||
/**
|
||||
* PDO Connection with Doctrine
|
||||
* @var \Doctrine\DBAL\Connection
|
||||
*/
|
||||
protected $conn;
|
||||
|
||||
/**
|
||||
* Logger
|
||||
* @var \Monolog\Logger
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
public function __construct($event, $userInfos)
|
||||
{
|
||||
$this->event = $event;
|
||||
$this->userInfos = $userInfos;
|
||||
$this->conn = Zend_Registry::get('doctrine');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -21,21 +34,27 @@ class Scores_Ws_Trigger
|
||||
$service = 'default';
|
||||
}
|
||||
|
||||
$model = new Application_Model_Sdv1ClientsServicesTrigger();
|
||||
$sql = $model->select()
|
||||
->where('event=?', $this->event)
|
||||
->where('idClient=?', $this->userInfos['idClient'])
|
||||
->where('service=?', $service)
|
||||
->where('login=? OR login=""', $login);
|
||||
$result = $model->fetchAll($sql);
|
||||
if (count($result)>0) {
|
||||
foreach ($result as $item) {
|
||||
$sql = "SELECT * FROM sdv1.clients_services_trigger
|
||||
WHERE idClient=:client AND service=:service AND (login=:login OR login='')";
|
||||
$stmtNb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($stmtNb > 0) {
|
||||
while ($item = $stmt->fetch(PDO::FETCH_OBJ)) {
|
||||
$tmp->action = $item->action;
|
||||
$tmp->params = json_decode($item->actionParams, true);
|
||||
$this->events[] = $tmp;
|
||||
}
|
||||
}
|
||||
|
||||
return count($result);
|
||||
return $stmtNb;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -86,24 +105,25 @@ class Scores_Ws_Trigger
|
||||
}
|
||||
|
||||
try {
|
||||
$model = new Application_Model_JoSurveillancesSite();
|
||||
$data = array(
|
||||
'source' => $args['source'],
|
||||
'login' => $this->userInfos['login'],
|
||||
'email' => $this->userInfos['email'],
|
||||
'siren' => $args['siren'],
|
||||
'nic' => $args['nic'],
|
||||
'ref' => $ref,
|
||||
$this->conn->insert('jo.surveillances_site', array(
|
||||
'source' => $args['source'],
|
||||
'login' => $this->userInfos['login'],
|
||||
'email' => $this->userInfos['email'],
|
||||
'siren' => $args['siren'],
|
||||
'nic' => $args['nic'],
|
||||
'ref' => $ref,
|
||||
'encoursClient' => 0,
|
||||
'rs' => $args['Nom'],
|
||||
'cp' => $args['CP'],
|
||||
'ville' => $args['Ville'],
|
||||
'rs' => $args['Nom'],
|
||||
'cp' => $args['CP'],
|
||||
'ville' => $args['Ville'],
|
||||
'dateAjout' => date('Y-m-d'),
|
||||
'dateSuppr' => 0,
|
||||
);
|
||||
$model->insert($data);
|
||||
));
|
||||
return true;
|
||||
} catch (Zend_Db_Exception $e) {
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -21,45 +21,45 @@ class Entreprise extends Scores_Ws_Server
|
||||
*/
|
||||
public function getIdentite($siret, $id, $dept, $waldec)
|
||||
{
|
||||
$forceVerif=false;
|
||||
$forceVerif = false;
|
||||
Metier_Util_Log::write('W',"Recherche par identifiant Siren=$siret, Dept=$dep, Id=$id, Waldec=$waldec",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||
|
||||
$iInsee = new Metier_Insee_MInsee();
|
||||
$result = new EntrepResult();
|
||||
|
||||
|
||||
if ($waldec<>'' && substr($waldec,0,1)=='W' && $siret*1==0) {
|
||||
if ($waldec != '' && substr($waldec,0,1) == 'W' && $siret*1 == 0) {
|
||||
Metier_Util_Log::write('I',"AFNIC Recherche par identifiant Waldec $waldec (Siren=$siret, Dept=$dep, Id=$id)",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||
|
||||
$rep=$iInsee->getEtablissementsParId('AUTRE', $waldec, 0, 20, 20);
|
||||
|
||||
$etabs=$rep['reponses'];
|
||||
if ($rep['nbReponses']>0) {
|
||||
foreach ($etabs as $nb=>$etab) {
|
||||
$siret=$etab['Siret'];
|
||||
$id=$etab['id'];
|
||||
$rep = $iInsee->getEtablissementsParId('AUTRE', $waldec, 0, 20, 20);
|
||||
$etabs = $rep['reponses'];
|
||||
if ($rep['nbReponses'] > 0) {
|
||||
foreach ($etabs as $nb => $etab) {
|
||||
$siret = $etab['Siret'];
|
||||
$id = $etab['id'];
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
Metier_Util_Log::write('W', "Waldec $waldec non présent en base", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
|
||||
$error = new ErrorElement();
|
||||
$error->errnum = 108;
|
||||
$error->errmsg = 'Waldec inconnu';
|
||||
$result->error = $error;
|
||||
return $result;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$tabRet=array();
|
||||
$siret=trim($siret);
|
||||
$len=strlen($siret);
|
||||
$id=trim($id)*1;
|
||||
if ($len==14) $nic=substr(''.$siret,9,5)*1;
|
||||
elseif ($len== 9) $nic='';
|
||||
$tabRet = array();
|
||||
$siret = trim($siret);
|
||||
$len = strlen($siret);
|
||||
$id = trim($id)*1;
|
||||
if ($len == 14) {
|
||||
$nic = substr(''.$siret,9,5)*1;
|
||||
}
|
||||
elseif ($len == 9) {
|
||||
$nic='';
|
||||
}
|
||||
elseif ($len== 0) {
|
||||
$siren=0; $nic='';
|
||||
$siren = 0;
|
||||
$nic = '';
|
||||
}
|
||||
else {
|
||||
Metier_Util_Log::write('W', "Siren/Siret $siren incorrect", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
@ -70,8 +70,8 @@ class Entreprise extends Scores_Ws_Server
|
||||
$result->result = $tabRet;
|
||||
return $result;
|
||||
}
|
||||
$siren=substr(''.$siret,0,9)*1;
|
||||
if ($siren==0 && $id==0) {
|
||||
$siren = substr(''.$siret,0,9)*1;
|
||||
if ($siren == 0 && $id == 0) {
|
||||
Metier_Util_Log::write('W', "Siren $siren inexistant", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
$error = new ErrorElement();
|
||||
$error->errnum = 102;
|
||||
@ -81,7 +81,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
return $result;
|
||||
}
|
||||
|
||||
if ($id==0 && !$iInsee->valideSiren($siren, $nic)) {
|
||||
if ($id == 0 && !$iInsee->valideSiren($siren, $nic)) {
|
||||
Metier_Util_Log::write('W', "Siren $siren/$nic invalide (105)", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
$error = new ErrorElement();
|
||||
$error->errnum = 105;
|
||||
@ -91,15 +91,15 @@ class Entreprise extends Scores_Ws_Server
|
||||
return $result;
|
||||
}
|
||||
|
||||
if ($dep==974) {
|
||||
if ($dep == 974) {
|
||||
Metier_Util_Log::write('I',"AFNIC Recherche par Siren/Dept (Waldec=$waldec, Siren=$siret, Dept=$dep, Id=$id)",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||
$rep=$iInsee->getEtablissements($siren, $nic, 0, 20, 20, $dep);
|
||||
$etabs=$rep['reponses'];
|
||||
$rep = $iInsee->getEtablissements($siren, $nic, 0, 20, 20, $dep);
|
||||
$etabs = $rep['reponses'];
|
||||
if ($rep['nbReponses']>0) {
|
||||
foreach ($etabs as $nb=>$etab) {
|
||||
$siren=$etab['siren'];
|
||||
$nic=$etab['nic'];
|
||||
$id=$etab['id'];
|
||||
$siren = $etab['siren'];
|
||||
$nic = $etab['nic'];
|
||||
$id = $etab['id'];
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
@ -116,7 +116,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
Metier_Util_Log::write('I',"AFNIC Identités demandée pour siret ".strtr(print_r($siret, true),array("\r"=>'',"\n"=>'')). " (id=$id)",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||
|
||||
Metier_Util_Log::write('I', "Avant getIdentiteEntreprise($siren, $nic, $id)", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
$entrep=$iInsee->getIdentiteEntreprise($siren, $nic, $id, $forceVerif);
|
||||
$entrep = $iInsee->getIdentiteEntreprise($siren, $nic, $id, $forceVerif);
|
||||
Metier_Util_Log::write('I', "Après getIdentiteEntreprise($siren, $nic, $id)", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
|
||||
if (empty($entrep)) {
|
||||
@ -132,23 +132,22 @@ class Entreprise extends Scores_Ws_Server
|
||||
$codePaysIso2='FR';
|
||||
if ($entrep['Dept'] > 98) {
|
||||
$codePaysInsee = $entrep['codeCommune'];
|
||||
|
||||
$sql = "SELECT j.codPays, j.numPays, j.codPays3, j.codePaysInpi, j.libPays, i.LIBCOG, i.ACTUAL
|
||||
FROM jo.tabPays j, insee.insee_tabPays i
|
||||
WHERE j.codePaysInsee=:codePays AND j.codePaysInsee=substring(i.COG, 3, 3) AND i.ACTUAL IN (1,4) AND j.numPays is NOT NULL";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('codePays', $codePaysInsee);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() == 1) {
|
||||
$result = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
$codePaysIso2 = $result['codPays'];
|
||||
$paysStmt = $this->conn->prepare($sql);
|
||||
$paysStmt->bindValue('codePays', $codePaysInsee);
|
||||
$paysStmt->execute();
|
||||
if ($paysStmt->rowCount() == 1) {
|
||||
$paysResult = $paysStmt->fetch(\PDO::FETCH_ASSOC);
|
||||
$codePaysIso2 = $paysResult['codPays'];
|
||||
} else {
|
||||
$codePaysIso2 = '';
|
||||
while ($result = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
if (trim(strtoupper(strtr($result['libPays'],
|
||||
while ($paysResult = $paysStmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
if (trim(strtoupper(strtr($paysResult['libPays'],
|
||||
'àáâãäåæçèéêëìíîïðñòóôõöùúûüýÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖÙÚÛÜÝ',
|
||||
"aaaaaaaceeeeiiiionooooouuuuyyAAAAAAACEEEEIIIIONOOOOOUUUUY")))==trim(strtoupper($result['LIBCOG']))) {
|
||||
$codePaysIso2 = $result['codPays'];
|
||||
"aaaaaaaceeeeiiiionooooouuuuyyAAAAAAACEEEEIIIIONOOOOOUUUUY")))==trim(strtoupper($paysResult['LIBCOG']))) {
|
||||
$codePaysIso2 = $paysResult['codPays'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -161,24 +160,38 @@ class Entreprise extends Scores_Ws_Server
|
||||
}
|
||||
|
||||
// Source RNCS prioritaire pour les infos entreprises
|
||||
$nom=$entrep['nomLong'];
|
||||
if ($nom=='') $nom=$entrep['Nom'];
|
||||
$sigle=$entrep['sigleLong'];
|
||||
if ($sigle=='') $sigle=$entrep['Sigle'];
|
||||
$nom = $entrep['nomLong'];
|
||||
if ($nom == '') {
|
||||
$nom = $entrep['Nom'];
|
||||
}
|
||||
$sigle = $entrep['sigleLong'];
|
||||
if ($sigle == '') {
|
||||
$sigle = $entrep['Sigle'];
|
||||
}
|
||||
|
||||
// Actif RNCS
|
||||
if ($entrep['EntActiveRCS']) $actif=1;
|
||||
if ($entrep['EntActiveRCS']) {
|
||||
$actif = 1;
|
||||
}
|
||||
// Inactif RNCS
|
||||
elseif (isset($entrep['EntActiveRCS']) && $entrep['EntActiveRCS']==0) $actif=0;
|
||||
elseif (isset($entrep['EntActiveRCS']) && $entrep['EntActiveRCS']==0) {
|
||||
$actif = 0;
|
||||
}
|
||||
// Actif Insee et périmètre Insee
|
||||
elseif ($entrep['Actif'] || $entrep['NbEtab']) $actif=1;
|
||||
else $actif=0;
|
||||
elseif ($entrep['Actif'] || $entrep['NbEtab']) {
|
||||
$actif = 1;
|
||||
}
|
||||
else {
|
||||
$actif =0;
|
||||
}
|
||||
|
||||
// Source INSEE prioritaire sur l'établissement
|
||||
$enseigne=$entrep['Enseigne'];
|
||||
if ($enseigne=='') $enseigne=$entrep['enseigneLong'];
|
||||
$tabCarInvalides=array('/'=>' ','*'=>' ', '&'=>' ET ', '&'=>' ET ', '&'=>' ET ',
|
||||
'"'=>' ', "'"=>' ');
|
||||
$enseigne = $entrep['Enseigne'];
|
||||
if ($enseigne == '') {
|
||||
$enseigne = $entrep['enseigneLong'];
|
||||
}
|
||||
$tabCarInvalides = array('/'=>' ','*'=>' ', '&'=>' ET ', '&'=>' ET ', '&'=>' ET ',
|
||||
'"'=>' ', "'"=>' ');
|
||||
|
||||
$item = new EntrepElement();
|
||||
$item->id = $entrep['id'];
|
||||
@ -241,12 +254,14 @@ class Entreprise extends Scores_Ws_Server
|
||||
$item->Naf4EtabLib = $entrep2['apet4_lib'];
|
||||
}
|
||||
Metier_Util_Log::write('I', 'Etablissement retourné = '. $entrep['Nom'], __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
$this->wsLog('identite',$siret,$id);
|
||||
$this->wsLog('identite', $siret, $id);
|
||||
|
||||
$error = new ErrorElement();
|
||||
$error->errmsg = '';
|
||||
$error->errnum = 0;
|
||||
|
||||
$result->result = $item;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@ -100,8 +100,11 @@ class Entreprise extends Scores_Ws_Server
|
||||
$inseeLResult->insL6_POST
|
||||
);
|
||||
}
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
catch (\Doctrine\DBAL\DBALException $e) {}
|
||||
|
||||
if (is_array($rnvpResult) && array_key_exists('HexaViaMat', $rnvpResult)) {
|
||||
$Infos->AdresseComplement = $rnvpResult['L3'];
|
||||
@ -120,8 +123,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
}
|
||||
$Infos->PaiementInfo = $PaiementInfo;
|
||||
|
||||
if ($evaluation['NbBilansScore'] > 0)
|
||||
{
|
||||
if ($evaluation['NbBilansScore'] > 0) {
|
||||
$bilan = $evaluation['tabBilan'][0];
|
||||
$Infos->BilanCA = $bilan['FL'];
|
||||
$Infos->BilanDateCloture = $bilan['DATE_CLOTURE'];
|
||||
@ -134,9 +136,6 @@ class Entreprise extends Scores_Ws_Server
|
||||
$Infos->Encours = round($evaluation['encours']/1000) * 1000;
|
||||
|
||||
// --- Ajouter en surveillance
|
||||
|
||||
|
||||
$survM = new Application_Model_JoSurveillancesSite();
|
||||
try {
|
||||
$sql = "SELECT * FROM jo.surveillances_sites WHERE login=:login AND siren=:siren";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
@ -160,8 +159,11 @@ class Entreprise extends Scores_Ws_Server
|
||||
);
|
||||
$this->conn->insert('jo.surveillances_sites', $data);
|
||||
}
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
catch (\Doctrine\DBAL\DBALException $e) {}
|
||||
// --- Fin ajout surveillance
|
||||
|
||||
$this->wsLog('identite', $siren);
|
||||
|
@ -127,8 +127,6 @@ class Entreprise extends Scores_Ws_Server
|
||||
//Initialisation
|
||||
if (empty($histo)) { $histo = false; }
|
||||
|
||||
//Zend_Registry::get('WsLogger')->info('HISTO : '.$histo);
|
||||
|
||||
Metier_Util_Log::write('I',"Dirigeants demandée pour $siren",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||
$tabRet = array();
|
||||
if (strlen($siren)<>9) {
|
||||
@ -141,11 +139,9 @@ class Entreprise extends Scores_Ws_Server
|
||||
|
||||
$iInsee = new Metier_Insee_MInsee();
|
||||
$dirs = $iInsee->getDirigeants($siren, $histo);
|
||||
//Metier_Util_Log::write('W', print_r($dirs, true), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
$liste = array();
|
||||
foreach ($dirs as $nb => $dir)
|
||||
{
|
||||
//Metier_Util_Log::write('I', "Siren/Siret $siren trouvé : ".$etab['Siren'].' '.$etab['Nic'].', '.$etab['Nom'] .', '.$etab['CP'].', '.$etab['Ville'], __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
$dirigeant = new Dirigeant();
|
||||
$dirigeant->Code = $dir['Fonction'];
|
||||
$dirigeant->Titre = $dir['Titre'];
|
||||
|
@ -812,8 +812,6 @@ class Entreprise extends Scores_Ws_Server
|
||||
//Initialisation
|
||||
if (empty($histo)) { $histo = false; }
|
||||
|
||||
//Zend_Registry::get('WsLogger')->info('HISTO : '.$histo);
|
||||
|
||||
Metier_Util_Log::write('I',"Dirigeants demandée pour $siren",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||
$tabRet = array();
|
||||
if (strlen($siren)<>9) {
|
||||
@ -826,11 +824,9 @@ class Entreprise extends Scores_Ws_Server
|
||||
|
||||
$iInsee = new Metier_Insee_MInsee();
|
||||
$dirs = $iInsee->getDirigeants($siren, $histo);
|
||||
//Metier_Util_Log::write('W', print_r($dirs, true), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
$liste = array();
|
||||
foreach ($dirs as $nb => $dir)
|
||||
{
|
||||
//Metier_Util_Log::write('I', "Siren/Siret $siren trouvé : ".$etab['Siren'].' '.$etab['Nic'].', '.$etab['Nom'] .', '.$etab['CP'].', '.$etab['Ville'], __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
$dirigeant = new Dirigeant();
|
||||
$dirigeant->Code = $dir['Fonction'];
|
||||
$dirigeant->Titre = $dir['Titre'];
|
||||
@ -924,7 +920,6 @@ class Entreprise extends Scores_Ws_Server
|
||||
elseif ($filtre==4)
|
||||
$annsM=$iInsee->getAnnoncesBoamp($siren, $idAnn);
|
||||
|
||||
//Metier_Util_Log::write('W', print_r($entrep, true), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
if (empty($anns) && empty($annsB) && empty($annsA) && empty($annsM))
|
||||
{
|
||||
Metier_Util_Log::write('W', "Aucune annonce pour le siren $siren (source=$filtre, id=$idAnn)", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
@ -935,7 +930,6 @@ class Entreprise extends Scores_Ws_Server
|
||||
{
|
||||
foreach ($anns as $nb=>$ann)
|
||||
{
|
||||
//Metier_Util_Log::write('I', "Siren/Siret $siren trouvé : ".$etab['Siren'].' '.$etab['Nic'].', '.$etab['Nom'] .', '.$etab['CP'].', '.$etab['Ville'], __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
$evens = array();
|
||||
foreach ($ann['evenements'] as $tabEven)
|
||||
{
|
||||
@ -980,7 +974,6 @@ class Entreprise extends Scores_Ws_Server
|
||||
{
|
||||
foreach ($annsB as $nb=>$ann)
|
||||
{
|
||||
//Metier_Util_Log::write('I', "Siren/Siret $siren trouvé : ".$etab['Siren'].' '.$etab['Nic'].', '.$etab['Nom'] .', '.$etab['CP'].', '.$etab['Ville'], __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
$evens = array();
|
||||
foreach ($ann['evenements'] as $tabEven)
|
||||
{
|
||||
@ -1021,7 +1014,6 @@ class Entreprise extends Scores_Ws_Server
|
||||
{
|
||||
foreach ($annsA as $nb=>$ann)
|
||||
{
|
||||
//Metier_Util_Log::write('I', "Siren/Siret $siren trouvé : ".$etab['Siren'].' '.$etab['Nic'].', '.$etab['Nom'] .', '.$etab['CP'].', '.$etab['Ville'], __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
$evens = array();
|
||||
foreach ($ann['evenements'] as $tabEven)
|
||||
{
|
||||
@ -4194,10 +4186,8 @@ class Entreprise extends Scores_Ws_Server
|
||||
* base de données, l'accès FTP, l'accès HTTP, l'accès système de fichier
|
||||
*/
|
||||
|
||||
//Enregistrement des accès à la requête getIdentite
|
||||
Zend_Registry::get('WsLogger')->info("status - ip:".
|
||||
$_SERVER['REMOTE_ADDR'].", login:".$_SERVER['PHP_AUTH_USER'].
|
||||
", hash:".$_SERVER['PHP_AUTH_PW']);
|
||||
$this->logger->info($_SERVER['REMOTE_ADDR'].", login:".
|
||||
$_SERVER['PHP_AUTH_USER'].", hash:".$_SERVER['PHP_AUTH_PW']);
|
||||
|
||||
$error = new StatusReturn();
|
||||
//Test connexion à la base de données
|
||||
|
@ -293,7 +293,6 @@ class Entreprise extends Scores_Ws_Server
|
||||
$db = Zend_Db_Table_Abstract::getDefaultAdapter();
|
||||
|
||||
$output = new AvisRncs();
|
||||
$iDb = new Metier_Util_Db();
|
||||
$rncs = new Metier_Partenaires_MRncs();
|
||||
|
||||
//jo.etablissements => insee uniquement, rncs ?
|
||||
@ -359,7 +358,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
$output->ConstitutionTribunalCode = '';
|
||||
$output->ConstitutionTribunalLabel = '';
|
||||
|
||||
$iInsee = new Metier_Insee_MInsee($iDb);
|
||||
$iInsee = new Metier_Insee_MInsee();
|
||||
$dirs = $iInsee->getDirigeants($siren, false);
|
||||
$liste = array();
|
||||
foreach ($dirs as $nb => $dir)
|
||||
@ -1430,8 +1429,6 @@ class Entreprise extends Scores_Ws_Server
|
||||
//Initialisation
|
||||
if (empty($histo)) { $histo = false; }
|
||||
|
||||
//Zend_Registry::get('WsLogger')->info('HISTO : '.$histo);
|
||||
|
||||
Metier_Util_Log::write('I',"Dirigeants demandée pour $siren",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||
$tabRet = array();
|
||||
if (strlen($siren)<>9) {
|
||||
@ -3485,7 +3482,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
elseif (strlen($siret) == 9) $nic = '';
|
||||
|
||||
$iDb = new Metier_Util_Db();
|
||||
$iInsee = new Metier_Insee_MInsee($iDb);
|
||||
$iInsee = new Metier_Insee_MInsee();
|
||||
|
||||
$rep = $iInsee->getEtablissements($siren, $nic, $deb, $nbRep, $maxRep, $dep, $actif, $siege);
|
||||
if ( count($rep['reponses'])==0 && $dep>0 ) {
|
||||
@ -5429,10 +5426,8 @@ class Entreprise extends Scores_Ws_Server
|
||||
* base de données, l'accès FTP, l'accès HTTP, l'accès système de fichier
|
||||
*/
|
||||
|
||||
//Enregistrement des accès à la requête getIdentite
|
||||
/*Zend_Registry::get('WsLogger')->info("status - ip:".
|
||||
$_SERVER['REMOTE_ADDR'].", login:".$_SERVER['PHP_AUTH_USER'].
|
||||
", hash:".$_SERVER['PHP_AUTH_PW']);*/
|
||||
$this->logger->info($_SERVER['REMOTE_ADDR'].", login:".
|
||||
$_SERVER['PHP_AUTH_USER'].", hash:".$_SERVER['PHP_AUTH_PW']);
|
||||
|
||||
$error = new StatusReturn();
|
||||
//Test connexion à la base de données
|
||||
|
@ -33,9 +33,8 @@ class Entreprise extends Scores_Ws_Server
|
||||
$this->sendError('1020');
|
||||
}
|
||||
|
||||
$db = new Metier_Util_Db();
|
||||
|
||||
$iInsee = new Metier_Insee_MInsee($db);
|
||||
$iInsee = new Metier_Insee_MInsee();
|
||||
$iInsee->setLogger();
|
||||
$entrep = $iInsee->getIdentiteEntreprise($siren, $nic, $id, $forceVerif);
|
||||
if (empty($entrep) || empty($entrep['id']) ) {
|
||||
$this->sendError('1020');
|
||||
@ -99,15 +98,22 @@ class Entreprise extends Scores_Ws_Server
|
||||
|
||||
// --- Indicateur Adresse RNVP
|
||||
try {
|
||||
$rnvpM = new Application_Model_VillesRnvpSources();
|
||||
$sql = $rnvpM->select(true)->columns(array('dateRetourRnvp','codeRetour'))
|
||||
->where('source=?', $entrep['Source'])->where('source_id=?', $entrep['SourceId']);
|
||||
$rnvpResult = $rnvpM->fetchRow($sql);
|
||||
if ($rnvpResult !== null) {
|
||||
$identite->AdresseRnvpDate = $rnvpResult->dateRetourRnvp;
|
||||
$identite->AdresseRnvpCode = $rnvpResult->codeRetour;
|
||||
$sql = "SELECT dateRetourRnvp, codeRetour FROM villes.rnvpSources
|
||||
WHERE source=:source AND source_id=:id";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('source', $entrep['Source']);
|
||||
$stmt->bindValue('id', $entrep['SourceId']);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$rnvpResult = $stmt->fetch(\PDO::FETCH_OBJ);
|
||||
$identite->AdresseRnvpDate = $rnvpResult->dateRetourRnvp;
|
||||
$identite->AdresseRnvpCode = $rnvpResult->codeRetour;
|
||||
}
|
||||
} catch(\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
} catch (Zend_Db_Exception $e) {}
|
||||
}
|
||||
|
||||
$identite->Civilite = $entrep['Civilite'];
|
||||
$identite->NbEtab = $entrep['NbEtab'];
|
||||
@ -295,7 +301,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
$identite->GroupeName = $grpHeadFiche->RS;
|
||||
// --- Recherche code Isin
|
||||
$nbIdNum = 3;
|
||||
for ($i=0;$i<$nbIdNum;$i++) {
|
||||
for ($i = 0; $i < $nbIdNum; $i++) {
|
||||
if( !empty($grpHeadFiche->{'idLoc'.$i.'Num'}) && $grpHeadFiche->{'idLoc'.$i.'Type'} == 63 ) {
|
||||
$identite->GroupeIsin = $grpHeadFiche->{'idLoc'.$i.'Num'};
|
||||
break;
|
||||
@ -303,22 +309,25 @@ class Entreprise extends Scores_Ws_Server
|
||||
}
|
||||
$identite->GroupeCountryCode = $grpHeadFiche->adresse_pays;
|
||||
if (!empty($grpHeadFiche->adresse_pays)) {
|
||||
try {
|
||||
$countryM = new Application_Model_JoTabPays();
|
||||
$sql = $countryM->select()->from($countryM, array('codPays3', 'libPays'));
|
||||
$result = $countryM->fetchAll($sql);
|
||||
} catch (Zend_Db_Adapter_Exception $e) {}
|
||||
|
||||
$tabPays = array();
|
||||
if ( $result->count()>0 ) {
|
||||
foreach ( $result as $item ) {
|
||||
$tabPays[$item->codPays3] = $item->libPays;
|
||||
try {
|
||||
$sql = "SELECT codPays3, libPays FROM jo.tabPays";
|
||||
$stmt = $this->conn->executeQuery($sql);
|
||||
if ($stmt->rowCount() > 0) {
|
||||
while($item = $stmt->fetch(\PDO::FETCH_OBJ)) {
|
||||
$tabPays[$item->codPays3] = $item->libPays;
|
||||
}
|
||||
}
|
||||
} catch(\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
$libPays = '';
|
||||
if ($grpHeadFiche->adresse_pays!='') {
|
||||
$libPays = array_key_exists($grpHeadFiche->adresse_pays, $tabPays) ?
|
||||
$tabPays[$grpHeadFiche->adresse_pays] : $grpHeadFiche->adresse_pays;
|
||||
$tabPays[$grpHeadFiche->adresse_pays] : $grpHeadFiche->adresse_pays;
|
||||
} else {
|
||||
$libPays = $tabPays['FRA'];
|
||||
}
|
||||
@ -348,7 +357,6 @@ class Entreprise extends Scores_Ws_Server
|
||||
}
|
||||
|
||||
$output = new AvisRncs();
|
||||
$iDb = new Metier_Util_Db();
|
||||
$rncs = new Metier_Partenaires_MRncs();
|
||||
|
||||
//jo.etablissements => insee uniquement, rncs ?
|
||||
@ -398,29 +406,31 @@ class Entreprise extends Scores_Ws_Server
|
||||
|
||||
//Date du dernier bilan - MOIS/JOUR au pire chercher dans l'annonce
|
||||
try {
|
||||
$bilanM = new Application_Model_JoBilans();
|
||||
$sql = $bilanM->select(true)
|
||||
->columns(array('dateExercice'))
|
||||
->where('siren=?', $siren)
|
||||
->order('dateExercice DESC')->limit(1);
|
||||
$result = $bilanM->fetchRow($sql);
|
||||
if ($result !== null) {
|
||||
$output->CompteArretMois = substr($result->dateExercice,4,2);
|
||||
$output->CompteArretJour = substr($result->dateExercice,6,2);
|
||||
}
|
||||
} catch(Zend_Db_Exception $e) {}
|
||||
$sql = "SELECT dateExercice FROM jo.bilans
|
||||
WHERE siren=:siren ORDER BY dateExercice DESC LIMIT 0,1";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$result = $stmt->fetch(\PDO::FETCH_OBJ);
|
||||
$output->CompteArretMois = substr($result->dateExercice,4,2);
|
||||
$output->CompteArretJour = substr($result->dateExercice,6,2);
|
||||
}
|
||||
} catch(\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
//=> Avec l'adresse du premier siège
|
||||
$output->ConstitutionTribunalCode = '';
|
||||
$output->ConstitutionTribunalLabel = '';
|
||||
|
||||
$iInsee = new Metier_Insee_MInsee($iDb);
|
||||
$iInsee = new Metier_Insee_MInsee();
|
||||
$dirs = $iInsee->getDirigeants($siren, false);
|
||||
$liste = array();
|
||||
foreach ($dirs as $nb => $dir)
|
||||
{
|
||||
foreach ($dirs as $nb => $dir) {
|
||||
$dirigeant = new AvisRncsAdmin();
|
||||
|
||||
$dirigeant->Code = $dir['Fonction'];
|
||||
$dirigeant->Label = $dir['Titre'];
|
||||
$dirigeant->CompanyName = $dir['Societe'];
|
||||
@ -544,17 +554,19 @@ class Entreprise extends Scores_Ws_Server
|
||||
throw new SoapFault('ERR', 'Identifiant incorrect.');
|
||||
}
|
||||
try {
|
||||
$etabM = new Application_Model_JoEtablissements();
|
||||
$sql = $etabM->select(true)->columns(array('LPAD(source,3,0) AS source', 'LPAD(source_id,20,0) AS sourceId'))
|
||||
->where('siren=?', substr($companyId,0,9))
|
||||
->where('nic=?', substr($companyId,9,5));
|
||||
$etabResult = $etabM->fetchRow($sql);
|
||||
if ($etabResult === null) {
|
||||
$sql = "SELECT LPAD(source,3,0) AS source, LPAD(source_id,20,0) AS sourceId
|
||||
FROM jo.etablissements WHERE siren=:siren AND nic=:nic";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', substr($companyId,0,9));
|
||||
$stmt->bindValue('nic', substr($companyId,9,5));
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() == 0) {
|
||||
throw new SoapFault('MSG', 'Etablissement inconnu.');
|
||||
}
|
||||
$source = $etabResult->source;
|
||||
$sourceId = $etabResult->source_id;
|
||||
} catch (Zend_Db_Exception $e) {
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
if ($this->User->idClient == 1) {
|
||||
throw new SoapFault('ERR', $e->getMessage());
|
||||
} else {
|
||||
|
@ -366,14 +366,6 @@ class Gestion extends Scores_Ws_Server
|
||||
$tabUpdate['typeCompte'] = $typeCompte;
|
||||
|
||||
//@todo : See issue #0001209
|
||||
/*
|
||||
if ($this->User->profil=='SuperAdministrateur' && !empty($infos['filtre_ip'])) {
|
||||
$tabUpdate['filtre_ip'] = $infos['filtre_ip'];
|
||||
} else {
|
||||
$rep = $iDbCrm->select('clients', 'filtre_ip', "id='$idClient'",false, MYSQL_ASSOC);
|
||||
$tabUpdate['filtre_ip'] = $rep[0]['filtre_ip'];
|
||||
}
|
||||
*/
|
||||
//$tabUpdate['civilite'] = 'M';
|
||||
$tabUpdate['nom'] = stripslashes($infos['nom']);
|
||||
$tabUpdate['prenom'] = stripslashes($infos['prenom']);
|
||||
|
@ -2273,15 +2273,14 @@ class Interne extends Scores_Ws_Server
|
||||
if (empty($nbRep)) $nbRep = 50;
|
||||
if ($nbRep>200) $nbRep = 200;
|
||||
|
||||
$bilansM = new Application_Model_FedasoBilans();
|
||||
|
||||
$sql = $bilansM->select()->order('dateEntree DESC');
|
||||
$qb = $this->conn->createQueryBuilder();
|
||||
$qb->select('*')->from('sdv1.fedaso_bilans')->orderBy('dateEntree', 'DESC');
|
||||
|
||||
if (is_array($filtre) && count($filtre)>0) {
|
||||
foreach($filtre as $item) {
|
||||
switch($item->key) {
|
||||
case 'siren':
|
||||
$sql->where('siren=?', $item->value);
|
||||
$siren = $item->value;
|
||||
break;
|
||||
case 'etat':
|
||||
|
||||
@ -2302,20 +2301,29 @@ class Interne extends Scores_Ws_Server
|
||||
}
|
||||
}
|
||||
|
||||
//Select user id
|
||||
$sql->where('idUtilisateur=?', $idUtilisateur);
|
||||
// Select user id
|
||||
$qb->where('idUtilisateur=:id')->setParameter('id', $idUtilisateur);
|
||||
|
||||
//Paginate
|
||||
$sql->limit($nbRep, $position);
|
||||
//Get results
|
||||
$results = $bilansM->fetchAll($sql)->toArray();
|
||||
if ($siren) {
|
||||
$qb->andWhere('siren=:siren')->setParameter('siren', $siren);
|
||||
}
|
||||
|
||||
// Paginate
|
||||
$qb->setMaxResults($nbRep)->setFirstResult($position);
|
||||
|
||||
try {
|
||||
$stmt = $qb->execute();
|
||||
} catch(\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
$iInsee = new Metier_Insee_MInsee();
|
||||
|
||||
$output = array();
|
||||
if (count($results)>0) {
|
||||
foreach ($results as $result) {
|
||||
|
||||
if ($stmt->rowCount() > 0) {
|
||||
while ($result = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$entrep = $iInsee->getIdentiteLight($result['siren']);
|
||||
|
||||
$saisie = new BilanSaisieInfos();
|
||||
@ -2359,17 +2367,17 @@ class Interne extends Scores_Ws_Server
|
||||
{
|
||||
$this->authenticate();
|
||||
|
||||
if ( strlen($siret)!=9 && strlen($siret)!=14 ) {
|
||||
if ( strlen($siret) != 9 && strlen($siret) != 14 ) {
|
||||
$this->sendError('1010');
|
||||
}
|
||||
|
||||
$siren = substr($siret,0,9);
|
||||
if (intval($siren)==0 ) {
|
||||
if (intval($siren) == 0) {
|
||||
$this->sendError('1010');
|
||||
}
|
||||
|
||||
$nic = substr($siret,9,5);
|
||||
if (intval($nic)==0) {
|
||||
if (intval($nic) == 0) {
|
||||
$nic = '00000';
|
||||
}
|
||||
|
||||
@ -2378,65 +2386,70 @@ class Interne extends Scores_Ws_Server
|
||||
if ($filtre !== null && !in_array($filtre, $typeToSelect)) {
|
||||
throw new SoapFault('ERR', "Unknown filtre");
|
||||
}
|
||||
|
||||
$telephonieM = new Application_Model_JoTelephonie();
|
||||
$sql = $telephonieM->select()
|
||||
->from($telephonieM, array(
|
||||
'id',
|
||||
'LPAD(siren,9,0) AS siren',
|
||||
'LPAD(nic,5,0) AS nic',
|
||||
'typeTel',
|
||||
'infoTel',
|
||||
'LPAD(telephone, 10, 0) AS telephone',
|
||||
'partenaire',
|
||||
"dateProvPartenaire",
|
||||
'IF(dateSuppr!=0,1,0) AS deleted',
|
||||
))
|
||||
->where('actif=1')
|
||||
->where('typeTel IN ("'.join('","', $typeToSelect).'")')
|
||||
->where('siren=?',$siren);
|
||||
|
||||
// Comptage
|
||||
$qb = $this->conn->createQueryBuilder();
|
||||
$qb->select(array('COUNT(*) AS nb'))
|
||||
->from('jo.telephonie')
|
||||
->where('actif=1')
|
||||
->andWhere('typeTel IN ("'.join('","', $typeToSelect).'")')
|
||||
->andWhere('siren=:siren')->setParameter('siren', $siren);
|
||||
|
||||
if ( intval($nic) > 0 ) {
|
||||
$sql->where('nic=?',$nic);
|
||||
$qb->where('nic=:nic')->setParameter('nic', $nic);
|
||||
}
|
||||
$stmt = $qb->execute();
|
||||
$nbContacts = 0;
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$result = $stmt->fetch(\PDO::FETCH_OBJ);
|
||||
$nbContacts = $result->nb;
|
||||
}
|
||||
|
||||
if ( $filtre != null ) {
|
||||
$sql->where('typeTel=?', $filtre);
|
||||
}
|
||||
|
||||
$sql->order('typeTel ASC');
|
||||
$sql->order('dateInsert DESC')->limit($nbRep, $position);
|
||||
|
||||
try {
|
||||
$contacts = $telephonieM->fetchAll($sql);
|
||||
} catch (Zend_Db_Exception $e) {
|
||||
if ($this->User->idClient!=1) {
|
||||
throw new SoapFault('ERR', "Application error");
|
||||
} else {
|
||||
throw new SoapFault('ERR', $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
//Comptage
|
||||
$sql = $telephonieM->select()
|
||||
->from($telephonieM, 'COUNT(*) as nb')
|
||||
->where('actif=1')
|
||||
->where('typeTel IN ("'.join('","', $typeToSelect).'")')
|
||||
->where('siren=?',$siren);
|
||||
// List
|
||||
$qb = $this->conn->createQueryBuilder();
|
||||
$qb->select(array(
|
||||
'id',
|
||||
'LPAD(siren,9,0) AS siren',
|
||||
'LPAD(nic,5,0) AS nic',
|
||||
'typeTel',
|
||||
'infoTel',
|
||||
'LPAD(telephone, 10, 0) AS telephone',
|
||||
'partenaire',
|
||||
"dateProvPartenaire",
|
||||
'IF(dateSuppr!=0,1,0) AS deleted'))
|
||||
->from('jo.telephonie')
|
||||
->where('actif=1')
|
||||
->andWhere('typeTel IN ("'.join('","', $typeToSelect).'")')
|
||||
->andWhere('siren=:siren')->setParameter('siren', $siren);
|
||||
|
||||
if ( intval($nic) > 0 ) {
|
||||
$sql->where('nic=?',$nic);
|
||||
}
|
||||
|
||||
$result = $telephonieM->fetchRow($sql);
|
||||
$nbContacts = 0;
|
||||
if ( $result !== null ) {
|
||||
$nbContacts = $result->nb;
|
||||
$qb->andWhere('nic=:nic')->setParameter('nic', $nic);
|
||||
}
|
||||
|
||||
if ($filtre != null) {
|
||||
$qb->andWhere('typeTel=:filtre')->setParameter('filtre', $filtre);
|
||||
}
|
||||
|
||||
$qb->orderBy('typeTel', 'ASC')
|
||||
->orderBy('dateInsert', 'DESC')
|
||||
->setFirstResult($position)->setMaxResults($nbRep);
|
||||
|
||||
try {
|
||||
$listStmt = $qb->execute();
|
||||
} catch(\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
if ($this->User->idClient == 1) {
|
||||
throw new SoapFault('ERR', $e->getMessage());
|
||||
} else {
|
||||
throw new SoapFault('ERR', "Application error");
|
||||
}
|
||||
}
|
||||
|
||||
$list = array();
|
||||
if ( $contacts->count() > 0) {
|
||||
foreach ( $contacts as $item ) {
|
||||
if ($listStmt->rowCount() > 0) {
|
||||
while ($item = $listStmt->fetch(\PDO::FETCH_OBJ)) {
|
||||
$contact = new ContactEt();
|
||||
$contact->id = $item->id;
|
||||
$contact->siren = $item->siren;
|
||||
@ -2456,7 +2469,7 @@ class Interne extends Scores_Ws_Server
|
||||
$contact->date = $date->format('Y-m-d');
|
||||
|
||||
$contact->deleted = false;
|
||||
if ($item->deleted==1) {
|
||||
if ($item->deleted == 1) {
|
||||
$contact->deleted = true;
|
||||
}
|
||||
|
||||
@ -2464,7 +2477,7 @@ class Interne extends Scores_Ws_Server
|
||||
}
|
||||
}
|
||||
|
||||
//Return
|
||||
// Return
|
||||
$output = new ContactEtReturn();
|
||||
$output->nbReponses = $nbContacts;
|
||||
$output->result = $list;
|
||||
@ -2489,13 +2502,15 @@ class Interne extends Scores_Ws_Server
|
||||
|
||||
//Retrieve data
|
||||
try {
|
||||
$idlocalM = new Application_Model_Sdv1TabIdLocal();
|
||||
$sql = $idlocalM->select()
|
||||
->where('codPays=?', $codeCountry)
|
||||
->orWhere('codPays IS NULL')
|
||||
->where('dateSuppr=?', '0000-00-00 00:00:00');
|
||||
$row = $idlocalM->fetchAll($sql);
|
||||
} catch (Zend_Db_Exception $e) {
|
||||
$sql = "SELECT id, idLocal, idLocalLong, idPrincipal, infoIden FROM sdv1.tabIdLocal
|
||||
WHERE (codPays=:pays OR codPays IS NULL) AND dateSuppr='0000-00-00 00:00:00'";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('pays', $codeCountry);
|
||||
$stmt->execute();
|
||||
} catch(\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
if ($this->User->idClient!=1) {
|
||||
throw new SoapFault('ERR', "Application error");
|
||||
} else {
|
||||
@ -2504,8 +2519,8 @@ class Interne extends Scores_Ws_Server
|
||||
}
|
||||
|
||||
$output = array();
|
||||
if ($row->count()>0) {
|
||||
foreach ( $row as $item ) {
|
||||
if ($stmt->rowCount() > 0) {
|
||||
while ($item = $stmt->fetch(\PDO::FETCH_OBJ)) {
|
||||
$struct = new CountryId();
|
||||
$struct->internalId = $item->id;
|
||||
$struct->name = $item->idLocal;
|
||||
@ -2539,77 +2554,69 @@ class Interne extends Scores_Ws_Server
|
||||
{
|
||||
$this->authenticate();
|
||||
|
||||
if ( strlen($siret)!=9 && strlen($siret)!=14 ) {
|
||||
if (strlen($siret) != 9 && strlen($siret) != 14) {
|
||||
$this->sendError('1010');
|
||||
}
|
||||
|
||||
$siren = substr($siret,0,9);
|
||||
if ( intval($siren)==0 ) {
|
||||
if (intval($siren) == 0) {
|
||||
$this->sendError('1010');
|
||||
}
|
||||
|
||||
if( strtolower($type)=='indiscore' ) {
|
||||
$type = ( $this->User->typeScore==20 ) ? 'indiScore20' : 'indiScore';
|
||||
if(strtolower($type) == 'indiscore') {
|
||||
$type = ($this->User->typeScore == 20) ? 'indiScore20' : 'indiScore';
|
||||
}
|
||||
|
||||
$scoresDb = new Application_Model_JoScoresSurveillance();
|
||||
$motifLib = array(
|
||||
'ajout' => "Initialisation",
|
||||
'ancien' => "Score trop ancien",
|
||||
'bilans1' => "Publication bilan",
|
||||
'bilans2' => "Publication bilan",
|
||||
'bilansasso'=> "Publication bilan Association",
|
||||
'bodacc' => "Publication Bodacc",
|
||||
'collecte' => "Publication JAL ou Greffe",
|
||||
'dirigeants'=> "Modification de l'administration",
|
||||
'impayes' => "Informations de paiements",
|
||||
'insee' => "Modification identitaires INSEE",
|
||||
'jour' => "Modifications identitaires",
|
||||
'liens' => "Mise à jour de la structure du groupe",
|
||||
'modifenc' => "Autre modification identitaire",
|
||||
'privileges'=> "Mise à jour des privilèges",
|
||||
'regulier' => "Informations de paiements",
|
||||
'rncs' => "Modifications identitaires RNCS",
|
||||
'default' => "Modification identitaire",
|
||||
);
|
||||
|
||||
$sql1 = $scoresDb->select()
|
||||
->from(array('j'=>'scores_surveillance'), array("j.$type", 'j.encours', 'j.indiScoreDate', 'j.sourceModif'), 'jo')
|
||||
->where('siren=?',$siren)
|
||||
->where('indiScoreDate >= (CURDATE() - INTERVAL 5 YEAR)')
|
||||
->group('indiScoreDate');
|
||||
|
||||
$sql2 = $scoresDb->select()
|
||||
->from(array('h'=>'scores_surveillance'), array("h.$type", 'h.encours', 'h.indiScoreDate', 'h.sourceModif'), 'historiques')
|
||||
->where('siren=?',$siren)
|
||||
->where('indiScoreDate >= (CURDATE() - INTERVAL 5 YEAR)')
|
||||
->group('indiScoreDate');
|
||||
|
||||
$query = $scoresDb->select()
|
||||
->union(array($sql1, $sql2))
|
||||
->group('indiScoreDate')
|
||||
->order('indiScoreDate DESC');
|
||||
|
||||
try {
|
||||
$rows = $scoresDb->fetchAll($query);
|
||||
} catch(Exception $e) {
|
||||
if ($this->User->idClient==1) {
|
||||
throw new SoapFault('ERR', $e->getMessage());
|
||||
} else {
|
||||
throw new SoapFault('ERR', "Application error");
|
||||
}
|
||||
}
|
||||
|
||||
$motifLib = array(
|
||||
'ajout' => "Initialisation",
|
||||
'ancien' => "Score trop ancien",
|
||||
'bilans1' => "Publication bilan",
|
||||
'bilans2' => "Publication bilan",
|
||||
'bilansasso'=> "Publication bilan Association",
|
||||
'bodacc' => "Publication Bodacc",
|
||||
'collecte' => "Publication JAL ou Greffe",
|
||||
'dirigeants'=> "Modification de l'administration",
|
||||
'impayes' => "Informations de paiements",
|
||||
'insee' => "Modification identitaires INSEE",
|
||||
'jour' => "Modifications identitaires",
|
||||
'liens' => "Mise à jour de la structure du groupe",
|
||||
'modifenc' => "Autre modification identitaire",
|
||||
'privileges'=> "Mise à jour des privilèges",
|
||||
'regulier' => "Informations de paiements",
|
||||
'rncs' => "Modifications identitaires RNCS",
|
||||
'default' => "Modification identitaire",
|
||||
);
|
||||
try {
|
||||
$sql = "(SELECT j.$type, j.encours, j.indiScoreDate, j.sourceModif FROM jo.scores_surveillance j
|
||||
WHERE siren=:siren AND indiScoreDate >= (CURDATE() - INTERVAL 5 YEAR) GROUP BY indiScoreDate)
|
||||
UNION (SELECT h.$type, h.encours, h.indiScoreDate, h.sourceModif FROM historiques.scores_surveillance h
|
||||
WHERE siren=:siren AND indiScoreDate >= (CURDATE() - INTERVAL 5 YEAR) GROUP BY indiScoreDate)
|
||||
ORDER BY indiScoreDate DESC";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
} catch(\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
if ($this->User->idClient == 1) {
|
||||
throw new SoapFault('ERR', $e->getMessage());
|
||||
} else {
|
||||
throw new SoapFault('ERR', "Application error");
|
||||
}
|
||||
}
|
||||
|
||||
$list = array();
|
||||
|
||||
foreach($rows as $row) {
|
||||
$item = new ScoresHisto();
|
||||
$item->date = $row->indiScoreDate;
|
||||
$item->value = $row->{$type};
|
||||
$item->label = $motifLib[$row->sourceModif];
|
||||
$item->encours = round($row->encours/1000,1);
|
||||
$list[] = $item;
|
||||
if ($stmt->rowCount() > 0) {
|
||||
while ($row = $stmt->fetch(\PDO::FETCH_OBJ)) {
|
||||
$item = new ScoresHisto();
|
||||
$item->date = $row->indiScoreDate;
|
||||
$item->value = $row->{$type};
|
||||
$item->label = $motifLib[$row->sourceModif];
|
||||
$item->encours = round($row->encours/1000,1);
|
||||
$list[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
$output = new ScoresHistoReturn();
|
||||
@ -2649,7 +2656,7 @@ class Interne extends Scores_Ws_Server
|
||||
|
||||
$iDb = new Metier_Util_Db();
|
||||
|
||||
$iInsee = new Metier_Insee_MInsee($iDb);
|
||||
$iInsee = new Metier_Insee_MInsee();
|
||||
$rep = $iInsee->getEtablissements($siren, '', $position, $nbRep, 200, $departement, $actif);
|
||||
$etabs = $rep['reponses'];
|
||||
$nbReponses = $rep['nbReponsesTotal'];
|
||||
|
@ -109,13 +109,17 @@ class Saisie extends Scores_Ws_Server
|
||||
try {
|
||||
$isInserted = $db->insert('jo.infos_entrep', array_merge(array('siren'=>$siren), $tabUpdate));
|
||||
} catch(Zend_Db_Exception $e) {
|
||||
file_put_contents('insert.log', "INSERT = ".$e->getMessage());
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
$isUpdated = $db->update('jo.infos_entrep', $tabUpdate, "siren=$siren");
|
||||
} catch(Zend_Db_Exception $e) {
|
||||
file_put_contents('update.log', "INSERT = ".$e->getMessage());
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
// Fin mise à jour identité
|
||||
|
Loading…
Reference in New Issue
Block a user