Compare commits
No commits in common. "master" and "3.0" have entirely different histories.
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,5 +0,0 @@
|
||||
/.settings/
|
||||
/.buildpath
|
||||
/.project
|
||||
/vendor/
|
||||
/composer-develop.lock
|
22
README.md
22
README.md
@ -1,22 +0,0 @@
|
||||
# WebService
|
||||
## Installation du projet
|
||||
|
||||
1. Création de la configuration du VHOST apache
|
||||
2. Référencer le domaine virtuel dans le fichier host de la machine
|
||||
* ex : 192.168.33.10 webservice.sd.dev
|
||||
3. Executer composer install pour charger les librairies externes dans vendor
|
||||
4. Configurer l'application (application.ini)
|
||||
* exemple fourni - `docs/config` ou projet `ansible`
|
||||
|
||||
Voir le fichier `docs/README` pour plus d'éléments
|
||||
|
||||
|
||||
## Mode développement pour les librairies externes
|
||||
|
||||
Utiliser la branche `develop` de `scores/library`
|
||||
|
||||
`$ COMPOSER=composer-develop.json composer install`
|
||||
|
||||
|
||||
|
||||
|
@ -1,218 +0,0 @@
|
||||
<?php
|
||||
use Monolog\Logger;
|
||||
use Monolog\Handler\StreamHandler;
|
||||
use Monolog\Processor\IntrospectionProcessor;
|
||||
|
||||
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||
{
|
||||
protected function _initConfig()
|
||||
{
|
||||
$config = new Zend_Config($this->getOptions());
|
||||
Zend_Registry::set('config', $config);
|
||||
|
||||
define('MYSQL_HOST', $config->profil->db->metier->params->host);
|
||||
define('MYSQL_USER', $config->profil->db->metier->params->username);
|
||||
define('MYSQL_PASS', $config->profil->db->metier->params->password);
|
||||
define('LOG_PATH', $config->profil->path->shared.'/log');
|
||||
|
||||
// Entreprise
|
||||
define('SPHINX_ENT_HOST', $config->profil->sphinx->ent->host);
|
||||
define('SPHINX_ENT_PORT', intval($config->profil->sphinx->ent->port));
|
||||
define('SPHINX_ENT_VERSION', $config->profil->sphinx->ent->version);
|
||||
|
||||
// Dirigeants
|
||||
define('SPHINX_DIR_HOST', $config->profil->sphinx->dir->host);
|
||||
define('SPHINX_DIR_PORT', intval($config->profil->sphinx->dir->port));
|
||||
define('SPHINX_DIR_VERSION', $config->profil->sphinx->dir->version);
|
||||
|
||||
// Historique
|
||||
define('SPHINX_HISTO_HOST', $config->profil->sphinx->histo->host);
|
||||
define('SPHINX_HISTO_PORT', intval($config->profil->sphinx->histo->port));
|
||||
define('SPHINX_HISTO_VERSION', $config->profil->sphinx->histo->version);
|
||||
|
||||
// Actionnaire
|
||||
define('SPHINX_ACT_HOST', $config->profil->sphinx->act->host);
|
||||
define('SPHINX_ACT_PORT', intval($config->profil->sphinx->act->port));
|
||||
define('SPHINX_ACT_VERSION', $config->profil->sphinx->act->version);
|
||||
|
||||
//Old
|
||||
define('SPHINX_HOST', $config->profil->sphinx->ent->host);
|
||||
define('SPHINX_PORT', intval($config->profil->sphinx->ent->port));
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
//Initialisation global des paramètres de vue
|
||||
protected function _initViewSettings()
|
||||
{
|
||||
$this->bootstrap('view');
|
||||
|
||||
$view = $this->getResource('view');
|
||||
$view->setEncoding('UTF-8');
|
||||
$view->doctype('HTML5');
|
||||
|
||||
$view->headMeta()
|
||||
->appendName('viewport', 'width=device-width, initial-scale=1.0')
|
||||
->appendHttpEquiv('X-UA-Compatible', 'IE=edge')
|
||||
->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8')
|
||||
->appendHttpEquiv('Content-Language', 'fr-FR');
|
||||
|
||||
//Favicon - Touch icon for iOS 2.0+ and Android 2.1+
|
||||
$view->headLink()->headLink(array(
|
||||
'rel' => 'apple-touch-icon-precomposed',
|
||||
'href' => '/favicon-152.png'
|
||||
));
|
||||
//Favicon - targeted to any additional png size
|
||||
$view->headLink()->headLink(array(
|
||||
'rel' => 'icon',
|
||||
'type' => 'image/png',
|
||||
'href' => '/favicon-32.png'
|
||||
));
|
||||
$view->headLink()->headLink(array(
|
||||
'rel' => 'shortcut icon',
|
||||
'type' => 'image/x-icon',
|
||||
'href' => '/favicon.ico')
|
||||
);
|
||||
|
||||
$view->headLink()
|
||||
->appendStylesheet('/assets/libs/bootstrap-3.3.7/css/bootstrap.min.css', 'all')
|
||||
->appendStylesheet('/assets/themes/default/css/docs.css', 'all')
|
||||
->appendStylesheet('/assets/themes/default/css/main.css', 'all');
|
||||
|
||||
$view->headScript()
|
||||
->appendFile('/assets/libs/html5shiv.min.js', 'text/javascript', array('conditional' => 'lt IE 9'))
|
||||
->appendFile('/assets/libs/respond.min.js', 'text/javascript', array('conditional' => 'lt IE 9'))
|
||||
->appendFile('/assets/libs/jquery-1.12.4.min.js', 'text/javascript')
|
||||
->appendFile('/assets/libs/bootstrap-3.3.7/js/bootstrap.min.js', 'text/javascript');
|
||||
|
||||
$view->headTitle()->setSeparator(' - ');
|
||||
$view->headTitle('Web Service API - Scores & Decisions');
|
||||
}
|
||||
|
||||
protected function _initRouter()
|
||||
{
|
||||
$this->bootstrap('frontController');
|
||||
$front = $this->getResource('frontController');
|
||||
$router = $front->getRouter();
|
||||
|
||||
// Lire les services disponibles et créer les routes
|
||||
$services = require_once APPLICATION_PATH . '/../library/WsScore/ServicesConfig.php';
|
||||
foreach ($services as $section => $params) {
|
||||
if ($params['actif']) {
|
||||
$route = new Zend_Controller_Router_Route($section.'/:version', array(
|
||||
'controller' => 'service',
|
||||
'action' => 'index',
|
||||
'service' => $section,
|
||||
'version' => '',
|
||||
));
|
||||
$router->addRoute($section, $route);
|
||||
}
|
||||
}
|
||||
|
||||
// Route pour WS Clients
|
||||
$route = new Zend_Controller_Router_Route('clients/:client/:version', array(
|
||||
'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' => '',
|
||||
));
|
||||
$router->addRoute('fichier', $fichierRoute);
|
||||
return $router;
|
||||
}
|
||||
|
||||
protected function _initDb()
|
||||
{
|
||||
$c = new Zend_Config($this->getOptions());
|
||||
try {
|
||||
$db = Zend_Db::factory($c->profil->db->metier);
|
||||
} catch (Exception $e) {
|
||||
if (APPLICATION_ENV == 'development') {
|
||||
echo '<pre>';
|
||||
print_r($e);
|
||||
echo '</pre>';
|
||||
} else {
|
||||
echo "Le service rencontre actuellement un problème technique.";
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default adapter to use with all model
|
||||
*/
|
||||
Zend_Db_Table::setDefaultAdapter($db);
|
||||
}
|
||||
|
||||
protected function _initDoctrine()
|
||||
{
|
||||
$c = new Zend_Config($this->getOptions());
|
||||
|
||||
$config = new \Doctrine\DBAL\Configuration();
|
||||
|
||||
if (APPLICATION_ENV == 'development') {
|
||||
$logger = new Scores_Logger_Sql();
|
||||
$config->setSQLLogger($logger);
|
||||
}
|
||||
|
||||
$connectionParams = array(
|
||||
'dbname' => $c->profil->db->metier->params->dbname,
|
||||
'user' => $c->profil->db->metier->params->username,
|
||||
'password' => $c->profil->db->metier->params->password,
|
||||
'host' => $c->profil->db->metier->params->host,
|
||||
'charset' => 'utf8',
|
||||
'driver' => 'pdo_mysql',
|
||||
);
|
||||
|
||||
try {
|
||||
$conn = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config);
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if (APPLICATION_ENV == 'development') {
|
||||
echo '<pre>';
|
||||
print_r($e);
|
||||
echo '</pre>';
|
||||
} else {
|
||||
echo "Le service rencontre actuellement un problème technique.";
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
Zend_Registry::set('doctrine', $conn);
|
||||
}
|
||||
|
||||
protected function _initCache()
|
||||
{
|
||||
if (APPLICATION_ENV!='development') {
|
||||
//MetadataCache pour la base de données
|
||||
$frontendOptions = array(
|
||||
'lifetime' => 14400,
|
||||
'automatic_serialization' => true
|
||||
);
|
||||
$backendOptions = array();
|
||||
$cache = Zend_Cache::factory('Core', 'Apc', $frontendOptions, $backendOptions);
|
||||
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::NOTICE;
|
||||
}
|
||||
$log->pushHandler(new StreamHandler($logFile, $level));
|
||||
$log->pushProcessor(new IntrospectionProcessor());
|
||||
|
||||
Zend_Registry::set('logger', $log);
|
||||
}
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
<?php
|
||||
// --- Define path to application directory
|
||||
defined('APPLICATION_PATH')
|
||||
|| define('APPLICATION_PATH', realpath(__DIR__ . '/../application'));
|
||||
|
||||
// --- Define application environment
|
||||
defined('APPLICATION_ENV')
|
||||
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
|
||||
|
||||
// --- Composer autoload
|
||||
require_once realpath(__DIR__ . '/../vendor/autoload.php');
|
||||
|
||||
// --- Create application, bootstrap, and run
|
||||
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
|
||||
|
||||
$c = new Zend_Config($application->getOptions());
|
||||
Zend_Registry::set('config', $c);
|
||||
|
||||
// Database - Zend Style
|
||||
$db = Zend_Db::factory($c->profil->db->metier);
|
||||
Zend_Db_Table_Abstract::setDefaultAdapter($db);
|
||||
|
||||
// Database - Doctrine Style
|
||||
$config = new \Doctrine\DBAL\Configuration();
|
||||
$connectionParams = array(
|
||||
'dbname' => $c->profil->db->metier->params->dbname,
|
||||
'user' => $c->profil->db->metier->params->username,
|
||||
'password' => $c->profil->db->metier->params->password,
|
||||
'host' => $c->profil->db->metier->params->host,
|
||||
'charset' => 'utf8',
|
||||
'driver' => 'pdo_mysql',
|
||||
);
|
||||
|
||||
try {
|
||||
$conn = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config);
|
||||
Zend_Registry::set('doctrine', $conn);
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
echo "Connection Database impossible.\n";
|
||||
exit;
|
||||
}
|
1
application/configs/.gitignore
vendored
1
application/configs/.gitignore
vendored
@ -1 +0,0 @@
|
||||
/application.ini
|
@ -1,55 +0,0 @@
|
||||
<?php
|
||||
return array(
|
||||
array(
|
||||
'label'=> "Accueil",
|
||||
'controller' => 'index',
|
||||
'action' => 'index',
|
||||
'pages' => array(),
|
||||
),
|
||||
array(
|
||||
'label'=> "Documentation",
|
||||
'controller' => 'documentation',
|
||||
'action' => 'index',
|
||||
'pages' => array(
|
||||
array(
|
||||
'label'=> "Information générale",
|
||||
'controller' => 'documentation',
|
||||
'action' => 'index',
|
||||
'pages' => array(),
|
||||
),
|
||||
array(
|
||||
'uri' => '#',
|
||||
),
|
||||
array(
|
||||
'label'=> "Liste des services",
|
||||
'controller' => 'documentation',
|
||||
'action' => 'services',
|
||||
'pages' => array(),
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'label'=> "Démonstration",
|
||||
'controller' => 'demo',
|
||||
'action' => 'index',
|
||||
'pages' => array(),
|
||||
),
|
||||
array(
|
||||
'label'=> "Contact",
|
||||
'controller' => 'index',
|
||||
'action' => 'contact',
|
||||
'pages' => array(),
|
||||
),
|
||||
array(
|
||||
'label'=> "Paramètres",
|
||||
'controller' => 'user',
|
||||
'action' => 'params',
|
||||
'pages' => array(),
|
||||
),
|
||||
array(
|
||||
'label'=> "A propos",
|
||||
'controller' => 'index',
|
||||
'action' => 'about',
|
||||
'pages' => array(),
|
||||
),
|
||||
);
|
@ -1,20 +0,0 @@
|
||||
[production]
|
||||
webservice.scores.wsdl = ""
|
||||
webservice.scores.options.location = "http://192.168.3.2/ws2/"
|
||||
webservice.scores.options.uri = "http://192.168.3.2/"
|
||||
webservice.scores.options.trace = 1
|
||||
webservice.scores.options.soap_version = SOAP_1_1
|
||||
|
||||
[staging]
|
||||
webservice.scores.wsdl = ""
|
||||
webservice.scores.options.location = "http://78.31.45.206/ws2/"
|
||||
webservice.scores.options.uri = "http://78.31.45.206/"
|
||||
webservice.scores.options.trace = 1
|
||||
webservice.scores.options.soap_version = SOAP_1_1
|
||||
|
||||
[development]
|
||||
webservice.scores.wsdl = ""
|
||||
webservice.scores.options.location = "http://78.31.45.206/ws2/"
|
||||
webservice.scores.options.uri = "http://78.31.45.206/"
|
||||
webservice.scores.options.trace = 1
|
||||
webservice.scores.options.soap_version = SOAP_1_1
|
@ -1,107 +0,0 @@
|
||||
<?php
|
||||
class DemoController extends Zend_Controller_Action
|
||||
{
|
||||
protected $_username;
|
||||
protected $_hash;
|
||||
|
||||
protected $methods = array(
|
||||
'getIdentite' => array(
|
||||
'ws' => 'entreprise/v0.8?wsdl',
|
||||
'form' => 'getIdentite',
|
||||
),
|
||||
);
|
||||
|
||||
public function init()
|
||||
{
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$this->_username = $auth->getIdentity()->username;
|
||||
$this->_hash = $auth->getIdentity()->hash;
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
//Liste
|
||||
|
||||
|
||||
$tabMethods = array();
|
||||
foreach ($this->methods as $method => $element) {
|
||||
$url = $this->view->url(array(
|
||||
'controller' => 'demo',
|
||||
'action' => 'method',
|
||||
'name' => $method,
|
||||
));
|
||||
$tabMethods[] = array(
|
||||
'nom' => $method,
|
||||
'url' => $url,
|
||||
);
|
||||
}
|
||||
|
||||
$this->view->assign('methods', $tabMethods);
|
||||
}
|
||||
|
||||
public function methodAction()
|
||||
{
|
||||
$method = $this->_getParam('name', '');
|
||||
$this->view->assign('method', $method);
|
||||
//Affichage du formulaire
|
||||
if (array_key_exists($method, $this->methods)) {
|
||||
$class = 'Scores_Ws_Form_'.ucfirst($method);
|
||||
if (class_exists($class)) {
|
||||
$form = new $class;
|
||||
$form->addElement('hidden', 'method', array(
|
||||
'value' => $method,
|
||||
));
|
||||
if ($this->_request->isPost()) {
|
||||
$formData = $this->_request->getPost();
|
||||
$form->populate($formData);
|
||||
}
|
||||
$this->view->assign('form', $form);
|
||||
} else {
|
||||
$this->view->assign('message', "Impossible d'afficher le formulaire !");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function requeteAction()
|
||||
{
|
||||
if ($this->_request->isPost()) {
|
||||
$formData = $this->_request->getPost();
|
||||
$method = $formData['method'];
|
||||
$class = 'Scores_Ws_Form_'.ucfirst($method);
|
||||
if (class_exists($class)) {
|
||||
$form = new $class;
|
||||
if ($form->isValid($formData)) {
|
||||
$method = $formData['method'];
|
||||
$siret = $formData['siret'];
|
||||
$accesWs = $this->methods[$method]['ws'];
|
||||
$hostName = $this->getRequest()->getHttpHost();
|
||||
$options = array(
|
||||
'login' => $this->_username,
|
||||
'password' => $this->_hash,
|
||||
'features' => SOAP_USE_XSI_ARRAY_TYPE + SOAP_SINGLE_ELEMENT_ARRAYS
|
||||
);
|
||||
$client = new Zend_Soap_Client('http://'.$hostName.'/'.$accesWs, $options);
|
||||
$params = new StdClass();
|
||||
$params->siret = $siret;
|
||||
try {
|
||||
$reponse = $client->getIdentite($params);
|
||||
} catch (Zend_Soap_Client_Exception $e) {
|
||||
$reponse = $e->getMessage();
|
||||
}
|
||||
$soap = array(
|
||||
'requete' => $params,
|
||||
'reponse' => $reponse,
|
||||
);
|
||||
$this->view->assign('soap', $soap);
|
||||
$xml = array(
|
||||
'requete' => $client->getLastRequest(),
|
||||
'reponse' => $client->getLastResponse()
|
||||
);
|
||||
$this->view->assign('xml', $xml);
|
||||
} else {
|
||||
$this->_forward('method', 'demo', null, array('name'=> 'getIdentite'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,223 +0,0 @@
|
||||
<?php
|
||||
class DocumentationController extends Zend_Controller_Action
|
||||
{
|
||||
|
||||
/**
|
||||
* Affichage de la documentation des webservices
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
//Do nothing
|
||||
}
|
||||
|
||||
/**
|
||||
* Liste des services
|
||||
*/
|
||||
public function servicesAction()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Liste des version par service
|
||||
*/
|
||||
public function servicevAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$name = $request->getParam('name');
|
||||
|
||||
$this->view->key = $name;
|
||||
}
|
||||
|
||||
public function serviceAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$type = $request->getParam('type', 'sd');
|
||||
$ws = strtolower($request->getParam('name', 'entreprise'));
|
||||
|
||||
$myService = $this->view->WsServices[$ws];
|
||||
|
||||
// Gestion des versions
|
||||
$serviceVersions = array();
|
||||
$configServiceVersions = $myService['versions'];
|
||||
foreach ($configServiceVersions as $section => $params) {
|
||||
$serviceVersions[$section] = $params;
|
||||
if ($params['defaut']) {
|
||||
$defautVersion = $section;
|
||||
}
|
||||
}
|
||||
$version = $request->getParam('version', $defautVersion);
|
||||
|
||||
$this->view->assign('serviceName', $myService['name']);
|
||||
$this->view->assign('serviceVersion', $version);
|
||||
|
||||
$isDeprecated = false;
|
||||
if ($myService['versions'][$version]['defaut'] == '') {
|
||||
$isDeprecated = true;
|
||||
}
|
||||
$this->view->assign('isDeprecated', $isDeprecated);
|
||||
|
||||
if ($type == 'client') {
|
||||
$client = $ws;
|
||||
$ws = 'entreprise';
|
||||
}
|
||||
|
||||
// Charger les classes et les types pour le service suivant la version
|
||||
if ($type == 'client') {
|
||||
$pathClassService = 'WsScore/Clients/'.ucfirst($client).'/v'.$version.'/';
|
||||
} else {
|
||||
$pathClassService = 'WsScore/'.ucfirst($ws).'/v'.$version.'/';
|
||||
}
|
||||
|
||||
//Génération du tableau de mapping
|
||||
$classmap = include $pathClassService.'Config.php';
|
||||
|
||||
//Définir l'url d'accès au WSDL
|
||||
$wsdl_url = $this->view->baseUrl();
|
||||
if ($type == 'client') {
|
||||
$wsdl_url.= '/clients/'.$client.'/v'.$version;
|
||||
} else {
|
||||
$wsdl_url.= '/'.$ws.'/v'.$version;
|
||||
}
|
||||
if (APPLICATION_ENV == 'production') {
|
||||
$wsdl_url.= '?wsdl';
|
||||
} else {
|
||||
$wsdl_url.= '?wsdl-auto';
|
||||
}
|
||||
|
||||
// Affichage de la documentation
|
||||
$doc = new Scores_Ws_Doc(ucfirst($ws), $classmap, $pathClassService);
|
||||
$tabServiceMethods = $doc->getServiceMethods();
|
||||
// Tri des méthodes par ordre alphabétique
|
||||
$tabServiceMethodsK = array();
|
||||
foreach ($tabServiceMethods as $method) {
|
||||
$tabServiceMethodsK[$method['name']] = $method;
|
||||
}
|
||||
ksort($tabServiceMethodsK);
|
||||
$tabServiceTypes = $doc->getServiceTypes();
|
||||
|
||||
$this->view->assign('wsdl', $wsdl_url);
|
||||
$this->view->assign('serviceMethods', $tabServiceMethodsK);
|
||||
$this->view->assign('serviceTypes', $tabServiceTypes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Liste les exemples de code disponible pour chaque méthode
|
||||
*/
|
||||
public function exemplesAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$ws = strtolower($request->getParam('ws', 'Entreprise'));
|
||||
$auth = Zend_Auth::getInstance();
|
||||
|
||||
//Si client possède un webservice particulier alors on redirige vers la doc clients
|
||||
$clients = include APPLICATION_PATH . '/../library/WsScore/Clients/ClientsConfig.php';
|
||||
foreach ($clients as $section => $params) {
|
||||
if ($params['actif']) {
|
||||
$wsClients[$params['idClient']] = $section;
|
||||
}
|
||||
}
|
||||
|
||||
if (array_key_exists($auth->getIdentity()->idClient, $wsClients)) {
|
||||
$this->_forward('clients', 'documentation', null, array(
|
||||
'nom' => $wsClients[$auth->getIdentity()->idClient]
|
||||
));
|
||||
} else {
|
||||
|
||||
// Liste des webservices
|
||||
$services = include APPLICATION_PATH . '/../library/WsScore/ServicesConfig.php';
|
||||
foreach ($services as $section => $params) {
|
||||
if ($params['actif']) {
|
||||
$wsServices[$section] = $params;
|
||||
}
|
||||
}
|
||||
|
||||
// On vérifie que l'utilisateur peut accèder à la documentation
|
||||
$username = $auth->getIdentity()->username;
|
||||
$idClient = $auth->getIdentity()->idClient;
|
||||
if (array_key_exists($ws, $wsServices)) {
|
||||
if (isset($wsServices['idClient']) && $idClient!=$wsServices['idClient']) {
|
||||
$this->renderScript('documentation/nodoc.phtml');
|
||||
exit;
|
||||
}
|
||||
if (isset($wsServices['user']) && !in_array($username, $wsServices['user'])) {
|
||||
$this->renderScript('documentation/nodoc.phtml');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Gestion des versions
|
||||
$serviceVersions = array();
|
||||
$configServiceVersions = $wsServices[$ws]['versions'];
|
||||
foreach ($configServiceVersions as $section => $params) {
|
||||
$serviceVersions[$section] = $params;
|
||||
if ($params['defaut']) {
|
||||
$defautVersion = $section;
|
||||
}
|
||||
}
|
||||
$version = $request->getParam('version', $defautVersion);
|
||||
|
||||
// Charger les classes et les types pour le service suivant la version
|
||||
$pathClassService = 'WsScore/'.ucfirst($ws).'/v'.$version.'/';
|
||||
|
||||
//Génération du tableau de mapping
|
||||
$classmap = include $pathClassService.'Config.php';
|
||||
|
||||
//Définir l'url d'accès au WSDL
|
||||
$wsdl_url = $this->view->baseUrl();
|
||||
if (APPLICATION_ENV == 'production') {
|
||||
$wsdl_url.= '/'.$ws.'/v'.$version.'?wsdl';
|
||||
} else {
|
||||
$wsdl_url.= '/'.$ws.'/v'.$version.'?wsdl-auto';
|
||||
}
|
||||
// Affichage de la documentation
|
||||
$doc = new Scores_Ws_Doc(ucfirst($ws), $classmap, $pathClassService);
|
||||
$tabServiceMethods = $doc->getServiceMethods();
|
||||
// Tri des méthodes par ordre alphabétique
|
||||
$tabServiceMethodsK = array();
|
||||
foreach ($tabServiceMethods as $method) {
|
||||
$tabServiceMethodsK[$method['name']] = $method;
|
||||
}
|
||||
ksort($tabServiceMethodsK);
|
||||
$tabServiceTypes = $doc->getServiceTypes();
|
||||
$this->view->assign('wsdl', $wsdl_url);
|
||||
$this->view->assign('serviceMethods', $tabServiceMethodsK);
|
||||
$this->view->assign('serviceTypes', $tabServiceTypes);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Affichage exemple de code avec coloration syntaxique
|
||||
* Le code doit être placé dans public/code et doit être nommé
|
||||
* [nom de la méthode]-langage.txt
|
||||
*/
|
||||
public function codeAction()
|
||||
{
|
||||
$langage = strtolower($this->_getParam('langage', ''));
|
||||
$element = $this->_getParam('element', '');
|
||||
|
||||
$fichier = APPLICATION_PATH . '/../public/assets/code/' . $element . '-' . $langage . '.txt';
|
||||
if (file_exists($fichier)) {
|
||||
$sourceCode = file_get_contents($fichier);
|
||||
|
||||
$geshi = new GeSHi($sourceCode, $langage);
|
||||
$geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
|
||||
$sourceHighlight = $geshi->parse_code();
|
||||
|
||||
$this->view->assign('langage', strtoupper($langage));
|
||||
$this->view->assign('code', $sourceHighlight);
|
||||
} else {
|
||||
$this->view->assign('langage',
|
||||
'Element non traités, Vous pouvez aussi nous fournir des exemples.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Affichage de la liste des erreurs avec leur code
|
||||
*/
|
||||
public function erreurAction()
|
||||
{
|
||||
$ws = new Scores_Ws_Server();
|
||||
$erreurs = $ws->listError;
|
||||
$this->view->assign('erreurs', $erreurs);
|
||||
}
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
<?php
|
||||
class ErrorController extends Zend_Controller_Action
|
||||
{
|
||||
public function errorAction()
|
||||
{
|
||||
$errors = $this->_getParam('error_handler');
|
||||
|
||||
switch ($errors->type) {
|
||||
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE:
|
||||
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
|
||||
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
|
||||
|
||||
// 404 error -- controller or action not found
|
||||
$this->getResponse()->setHttpResponseCode(404);
|
||||
$this->view->message = 'Page not found';
|
||||
break;
|
||||
default:
|
||||
// application error
|
||||
$this->getResponse()->setHttpResponseCode(500);
|
||||
$this->view->message = 'Application error';
|
||||
break;
|
||||
}
|
||||
|
||||
// Log exception, if logger available
|
||||
if ($log = $this->getLog()) {
|
||||
$log->crit($this->view->message, $errors->exception);
|
||||
}
|
||||
|
||||
// conditionally display exceptions
|
||||
if ($this->getInvokeArg('displayExceptions') == true) {
|
||||
$this->view->exception = $errors->exception;
|
||||
}
|
||||
|
||||
$this->view->request = $errors->request;
|
||||
}
|
||||
|
||||
public function getLog()
|
||||
{
|
||||
$bootstrap = $this->getInvokeArg('bootstrap');
|
||||
if (!$bootstrap->hasPluginResource('Log')) {
|
||||
return false;
|
||||
}
|
||||
$log = $bootstrap->getResource('Log');
|
||||
return $log;
|
||||
}
|
||||
}
|
@ -1,261 +0,0 @@
|
||||
<?php
|
||||
class FichierController extends Zend_Controller_Action
|
||||
{
|
||||
/**
|
||||
* PDO Connection with Doctrine
|
||||
* @var \Doctrine\DBAL\Connection
|
||||
*/
|
||||
protected $conn;
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
$this->conn = Zend_Registry::get('doctrine');
|
||||
}
|
||||
|
||||
public function bodaccAction()
|
||||
{
|
||||
$auth = Zend_Auth::getInstance();
|
||||
if ($auth->hasIdentity()) {
|
||||
$c = Zend_Registry::get('config');
|
||||
$directory = $c->profil->path->shared.'/datafile/bodacc/histo';
|
||||
|
||||
$q = $this->getRequest()->getParam('q');
|
||||
$filename = base64_decode($q);
|
||||
|
||||
$file = $directory.'/'.$filename;
|
||||
|
||||
if (file_exists($file) && filesize($file) > 0) {
|
||||
|
||||
//Log de la requete
|
||||
$data = array(
|
||||
'login' => $auth->getIdentity()->username,
|
||||
'idClient' => $auth->getIdentity()->idClient,
|
||||
'page' => 'histobodacc',
|
||||
'siren' => '',
|
||||
'nic' => '',
|
||||
'params' => $file,
|
||||
'test' => 0,
|
||||
'raisonSociale' => '',
|
||||
'cp' => '',
|
||||
'ville' => '',
|
||||
'ipClient' => $_SERVER['REMOTE_ADDR'],
|
||||
);
|
||||
$this->conn->insert('sdv1.logs', $data);
|
||||
|
||||
$content_type = 'application/pdf';
|
||||
// --- Envoi du fichier sur la sortie standard
|
||||
$modules = array(); //apache_get_modules();
|
||||
if (in_array('mod_xsendfile', $modules)) {
|
||||
header('X-Sendfile: ' . $file);
|
||||
header('Content-Type: ' . $content_type);
|
||||
header('Content-Disposition: inline; filename="' . $content_type . '"');
|
||||
exit;
|
||||
} else {
|
||||
ini_set('zlib.output_compression', '0');
|
||||
header('Content-Transfer-Encoding: none');
|
||||
header('Content-Type: ' . $content_type.'');
|
||||
header('Content-Length: ' . filesize($file));
|
||||
header('Content-MD5: ' . base64_encode(md5_file($file)));
|
||||
header('Content-Disposition: inline; filename="' . basename($file) . '"');
|
||||
header('Cache-Control: private, max-age=0, must-revalidate');
|
||||
header('Pragma: public');
|
||||
readfile($file);
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
echo "Erreur lors de l'affichage du fichier.";
|
||||
}
|
||||
} else {
|
||||
echo "Authentification échoué.";
|
||||
}
|
||||
}
|
||||
|
||||
public function logsAction()
|
||||
{
|
||||
$content_type = 'application/csv-tab-delimited-table';
|
||||
$filename = $this->getRequest()->getParam('fichier');
|
||||
$c = Zend_Registry::get('config');
|
||||
$file = $c->profil->path->shared . '/files/'.$filename;
|
||||
// --- Envoi du fichier sur la sortie standard
|
||||
if (file_exists($file)) {
|
||||
$modules = array(); //apache_get_modules();
|
||||
if (in_array('mod_xsendfile', $modules)) {
|
||||
header('X-Sendfile: ' . $file);
|
||||
header('Content-Type: ' . $content_type);
|
||||
header('Content-Disposition: inline; filename="' . $content_type . '"');
|
||||
exit;
|
||||
} else {
|
||||
ini_set('zlib.output_compression', '0');
|
||||
header('Content-Transfer-Encoding: none');
|
||||
header('Content-Type: ' . $content_type.'');
|
||||
header('Content-Length: ' . filesize($file));
|
||||
header('Content-MD5: ' . base64_encode(md5_file($file)));
|
||||
header('Content-Disposition: inline; filename="' . basename($file) . '"');
|
||||
header('Cache-Control: private, max-age=0, must-revalidate');
|
||||
header('Pragma: public');
|
||||
readfile($file);
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
$this->getResponse()->setHttpResponseCode(404);
|
||||
}
|
||||
}
|
||||
|
||||
public function csvAction()
|
||||
{
|
||||
$content_type = 'application/csv-tab-delimited-table';
|
||||
$filename = $this->getRequest()->getParam('fichier');
|
||||
$c = Zend_Registry::get('config');
|
||||
$file = $c->profil->path->shared . '/files/'. $filename;
|
||||
// --- Envoi du fichier sur la sortie standard
|
||||
if (file_exists($file)) {
|
||||
$modules = array(); //apache_get_modules();
|
||||
if (in_array('mod_xsendfile', $modules)) {
|
||||
header('X-Sendfile: ' . $file);
|
||||
header('Content-Type: ' . $content_type);
|
||||
header('Content-Disposition: inline; filename="' . $content_type . '"');
|
||||
exit;
|
||||
} else {
|
||||
ini_set('zlib.output_compression', '0');
|
||||
header('Content-Transfer-Encoding: none');
|
||||
header('Content-Type: ' . $content_type.'');
|
||||
header('Content-Length: ' . filesize($file));
|
||||
header('Content-MD5: ' . base64_encode(md5_file($file)));
|
||||
header('Content-Disposition: inline; filename="' . basename($file) . '"');
|
||||
header('Cache-Control: private, max-age=0, must-revalidate');
|
||||
header('Pragma: public');
|
||||
readfile($file);
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
$this->getResponse()->setHttpResponseCode(404);
|
||||
}
|
||||
}
|
||||
|
||||
public function kbisAction()
|
||||
{
|
||||
$content_type = 'application/pdf';
|
||||
$filename = $this->getRequest()->getParam('fichier');
|
||||
$c = Zend_Registry::get('config');
|
||||
$file = realpath($c->profil->path->shared).'/datafile/kbis/'.$filename;
|
||||
// --- Envoi du fichier sur la sortie standard
|
||||
if (file_exists($file)) {
|
||||
$modules = array(); //apache_get_modules();
|
||||
if (in_array('mod_xsendfile', $modules)) {
|
||||
header('X-Sendfile: ' . $file);
|
||||
header('Content-Type: ' . $content_type);
|
||||
header('Content-Disposition: inline; filename="' . $content_type . '"');
|
||||
exit;
|
||||
} else {
|
||||
ini_set('zlib.output_compression', '0');
|
||||
header('Content-Transfer-Encoding: none');
|
||||
header('Content-Type: ' . $content_type.'');
|
||||
header('Content-Length: ' . filesize($file));
|
||||
header('Content-MD5: ' . base64_encode(md5_file($file)));
|
||||
header('Content-Disposition: inline; filename="' . basename($file) . '"');
|
||||
header('Cache-Control: private, max-age=0, must-revalidate');
|
||||
header('Pragma: public');
|
||||
readfile($file);
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
$this->getResponse()->setHttpResponseCode(404);
|
||||
}
|
||||
}
|
||||
|
||||
public function associationsAction()
|
||||
{
|
||||
$content_type = 'application/pdf';
|
||||
$filename = $this->getRequest()->getParam('fichier');
|
||||
$c = Zend_Registry::get('config');
|
||||
$file = $c->profil->path->shared . '/files/' . $filename;
|
||||
// --- Envoi du fichier sur la sortie standard
|
||||
if (file_exists($file)) {
|
||||
$modules = array(); //apache_get_modules();
|
||||
if (in_array('mod_xsendfile', $modules)) {
|
||||
header('X-Sendfile: ' . $file);
|
||||
header('Content-Type: ' . $content_type);
|
||||
header('Content-Disposition: inline; filename="' . $content_type . '"');
|
||||
exit;
|
||||
} else {
|
||||
ini_set('zlib.output_compression', '0');
|
||||
header('Content-Transfer-Encoding: none');
|
||||
header('Content-Type: ' . $content_type.'');
|
||||
header('Content-Length: ' . filesize($file));
|
||||
header('Content-MD5: ' . base64_encode(md5_file($file)));
|
||||
header('Content-Disposition: inline; filename="' . basename($file) . '"');
|
||||
header('Cache-Control: private, max-age=0, must-revalidate');
|
||||
header('Pragma: public');
|
||||
readfile($file);
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
$this->getResponse()->setHttpResponseCode(404);
|
||||
}
|
||||
}
|
||||
|
||||
public function greffesAction()
|
||||
{
|
||||
$content_type = 'application/pdf';
|
||||
$filename = $this->getRequest()->getParam('fichier');
|
||||
$c = Zend_Registry::get('config');
|
||||
$file = $c->profil->path->shared . '/files/' .$filename;
|
||||
// --- Envoi du fichier sur la sortie standard
|
||||
if (file_exists($file)) {
|
||||
$modules = array(); //apache_get_modules();
|
||||
if (in_array('mod_xsendfile', $modules)) {
|
||||
header('X-Sendfile: ' . $file);
|
||||
header('Content-Type: ' . $content_type);
|
||||
header('Content-Disposition: inline; filename="' . $content_type . '"');
|
||||
exit;
|
||||
} else {
|
||||
ini_set('zlib.output_compression', '0');
|
||||
header('Content-Transfer-Encoding: none');
|
||||
header('Content-Type: ' . $content_type.'');
|
||||
header('Content-Length: ' . filesize($file));
|
||||
header('Content-MD5: ' . base64_encode(md5_file($file)));
|
||||
header('Content-Disposition: inline; filename="' . basename($file) . '"');
|
||||
header('Cache-Control: private, max-age=0, must-revalidate');
|
||||
header('Pragma: public');
|
||||
readfile($file);
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
$this->getResponse()->setHttpResponseCode(404);
|
||||
}
|
||||
}
|
||||
|
||||
public function crmAction()
|
||||
{
|
||||
$content_type = 'application/x-bzip';
|
||||
$filename = $this->getRequest()->getParam('fichier');
|
||||
$c = Zend_Registry::get('config');
|
||||
$file = $c->profil->path->shared . '/files/' .$filename;
|
||||
|
||||
// --- Envoi du fichier sur la sortie standard
|
||||
if (file_exists($file)) {
|
||||
$modules = array(); //apache_get_modules();
|
||||
if (in_array('mod_xsendfile', $modules)) {
|
||||
header('X-Sendfile: ' . $file);
|
||||
header('Content-Type: ' . $content_type);
|
||||
header('Content-Disposition: inline; filename="' . $content_type . '"');
|
||||
exit;
|
||||
} else {
|
||||
ini_set('zlib.output_compression', '0');
|
||||
header('Content-Transfer-Encoding: none');
|
||||
header('Content-Type: ' . $content_type.'');
|
||||
header('Content-Length: ' . filesize($file));
|
||||
header('Content-MD5: ' . base64_encode(md5_file($file)));
|
||||
header('Content-Disposition: inline; filename="' . basename($file) . '"');
|
||||
header('Cache-Control: private, max-age=0, must-revalidate');
|
||||
header('Pragma: public');
|
||||
readfile($file);
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
$this->getResponse()->setHttpResponseCode(404);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
class IndexController extends Zend_Controller_Action
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
}
|
||||
|
||||
public function contactAction()
|
||||
{
|
||||
}
|
||||
|
||||
public function aboutAction()
|
||||
{
|
||||
}
|
||||
}
|
@ -1,106 +0,0 @@
|
||||
<?php
|
||||
class JsonrpcController extends Zend_Controller_Action
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
$this->_helper->layout->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
|
||||
$request = $this->getRequest();
|
||||
|
||||
//Nom du service
|
||||
$serviceName = strtolower($request->getParam('service', 'Entreprise'));
|
||||
|
||||
//Service spécifique client
|
||||
if ($serviceName == 'clients') {
|
||||
$client = $request->getParam('client', '');
|
||||
//Liste des clients
|
||||
$clients = array();
|
||||
$listeClients = include APPLICATION_PATH . '/../library/WsScore/Clients/ClientsConfig.php';
|
||||
foreach ($listeClients as $section => $params) {
|
||||
if ($params['actif']) {
|
||||
$clients[] = $section;
|
||||
}
|
||||
}
|
||||
if (!in_array($client, $clients)) {
|
||||
echo 'Service clients introuvable !';
|
||||
exit;
|
||||
}
|
||||
$configServiceVersions = $clients[$client]['versions'];
|
||||
} else {
|
||||
//Service versions
|
||||
$services = include APPLICATION_PATH . '/../library/WsScore/ServicesConfig.php';
|
||||
$configServiceVersions = $services[$serviceName]['versions'];
|
||||
}
|
||||
|
||||
//Liste des versions
|
||||
foreach ($configServiceVersions as $section => $params) {
|
||||
$serviceVersions[$section] = $params;
|
||||
if ($params['defaut']) {
|
||||
$defautVersion = $section;
|
||||
}
|
||||
}
|
||||
$version = $request->getParam('version', 'v'.$defautVersion);
|
||||
$version = substr($version, 1);
|
||||
|
||||
// Version inexistante
|
||||
if (!array_key_exists($version, $serviceVersions)) {
|
||||
echo "Version inexistante.";
|
||||
exit;
|
||||
}
|
||||
// Version désactivé
|
||||
if (!$serviceVersions[$version]['actif']) {
|
||||
echo "Version désactivée.";
|
||||
exit;
|
||||
}
|
||||
|
||||
// Charger les classes et les types pour le service suivant la version
|
||||
if ($serviceName == 'clients') {
|
||||
$pathServiceClassIni = 'WsScore/Clients/'.ucfirst($client).'/v'.$version.'/Entreprise.ini';
|
||||
$pathServiceClassPhp = 'WsScore/Clients/'.ucfirst($client).'/v'.$version.'/Entreprise.php';
|
||||
$pathServiceUrl = 'clients/'.$client.'/v'.$version.'?wsdl-auto';
|
||||
//On redéfini le nom du service
|
||||
$serviceName = 'Entreprise';
|
||||
$fichierWsdl = ucfirst($client).'-'.$serviceName.'-'.$version.'.wsdl';
|
||||
} else {
|
||||
$pathServiceClassIni = 'WsScore/'.ucfirst($serviceName).'/v'.$version.'/'.ucfirst($serviceName).'.ini';
|
||||
$pathServiceClassPhp = 'WsScore/'.ucfirst($serviceName).'/v'.$version.'/'.ucfirst($serviceName).'.php';
|
||||
$pathServiceUrl = $serviceName.'/v'.$version.'?wsdl-auto';
|
||||
$fichierWsdl = ucfirst($serviceName).'-'.$version.'.wsdl';
|
||||
}
|
||||
|
||||
//Génération du tableau de mapping
|
||||
$wsConfig = new Zend_Config_Ini($pathServiceClassIni);
|
||||
foreach ($wsConfig->Type->toArray() as $Type) {
|
||||
$classmap[$Type] = $Type;
|
||||
}
|
||||
|
||||
//Inclusion des classes de données
|
||||
require_once $pathServiceClassPhp;
|
||||
|
||||
// Instance du server
|
||||
$server = new Zend_Json_Server();
|
||||
// Define class name
|
||||
$server->setClass(ucfirst($serviceName));
|
||||
|
||||
// Gestion du SMD
|
||||
if ($this->getRequest()->isGet()) {
|
||||
// Indiquer URL endpoint
|
||||
//$this->getHelper('url')->url(array('controller'=>'', 'action'=>'' ));
|
||||
$server->setTarget('/jsonrpc/'.$serviceName.'/'.$version.'/')
|
||||
->setEnvelope(Zend_Json_Server_Smd::ENV_JSONRPC_2);
|
||||
// Grab the SMD
|
||||
$smd = $server->getServiceMap();
|
||||
|
||||
//Return the SMD to the client
|
||||
if (!headers_sent()) {
|
||||
header('Content-Type: application/json');
|
||||
}
|
||||
echo $smd;
|
||||
return;
|
||||
} else {
|
||||
$server->setAutoEmitResponse(true);
|
||||
$server->handle();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,128 +0,0 @@
|
||||
<?php
|
||||
use League\Csv\Writer;
|
||||
|
||||
class RefController extends Zend_Controller_Action
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
//Ne fait rien...
|
||||
}
|
||||
|
||||
/**
|
||||
* Donne accès au fichier
|
||||
*/
|
||||
public function fichierAction()
|
||||
{
|
||||
//Lecture du nom du fichier
|
||||
$fichier = $this->_getParam('q', '');
|
||||
$fichier = $fichier . '.csv';
|
||||
if (!empty($fichier) && file_exists('fichiers/'.$fichier)) {
|
||||
$this->_helper->layout->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
|
||||
list($nomFichier, $extFichier) = explode('.', $fichier);
|
||||
//Distribution du fichier sur la sortie standard
|
||||
switch ($extFichier) {
|
||||
case 'png': $content_type = 'image/png'; break;
|
||||
case 'gif': $content_type = 'image/gif'; break;
|
||||
case 'jpeg':
|
||||
case 'jpg': $content_type = 'image/jpeg'; break;
|
||||
case 'pdf': $content_type = 'application/pdf'; break;
|
||||
case 'csv': $content_type = 'application/csv-tab-delimited-table'; break;
|
||||
}
|
||||
$this->getResponse()->setHeader('Content-Type', $content_type);
|
||||
$contentDisposition = 'attachment';
|
||||
switch ($contentDisposition) {
|
||||
case 'inline':
|
||||
$this->getResponse()->setHeader('Content-Disposition', 'inline');
|
||||
break;
|
||||
case 'attachment':
|
||||
$this->getResponse()->setHeader('Content-Disposition', "attachment; filename=\"$fichier\"");
|
||||
break;
|
||||
}
|
||||
|
||||
$data = file_get_contents('assets/fichiers/'.$fichier);
|
||||
|
||||
$this->getResponse()->setHeader('Content-Length', strlen($data))
|
||||
->setHeader('Cache-Control', 'private, max-age=0, must-revalidate')
|
||||
->setHeader('Pragma', 'public')
|
||||
->setBody($data);
|
||||
} else {
|
||||
$this->view->assign('message', 'Fichier introuvable !');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Donne accès aux données contenues dans une table de base de données
|
||||
*/
|
||||
public function tableAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$requetesql = $request->getParam('q', '');
|
||||
$fichierCsv = $requetesql.'.csv';
|
||||
$fichierSql = $requetesql.'.sql';
|
||||
|
||||
//Emplacement des fichiers générés - lien symbolique en PRODUCTION
|
||||
$c = Zend_Registry::get('config');
|
||||
$path = $c->profil->path->shared . '/files/fichiers/';
|
||||
if (!is_dir($path)) {
|
||||
mkdir($path);
|
||||
}
|
||||
if (!empty($requetesql)) {
|
||||
if (!file_exists($path . $fichierCsv)) {
|
||||
if (file_exists('assets/sql/'.$fichierSql)) {
|
||||
/**
|
||||
* @var \Doctrine\DBAL\Connection $conn
|
||||
*/
|
||||
$conn = Zend_Registry::get('doctrine');
|
||||
$sql = file_get_contents('assets/sql/'.$fichierSql);
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->setFetchMode(\PDO::FETCH_ASSOC);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$csv = Writer::createFromPath($path . $fichierCsv.'.tmp', 'w');
|
||||
$csv->setNewline("\r\n");
|
||||
$headers = array_keys($stmt->fetch());
|
||||
$csv->insertOne($headers);
|
||||
$csv->insertAll($stmt);
|
||||
}
|
||||
rename($path . $fichierCsv.'.tmp', $path . $fichierCsv);
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists($path . $fichierCsv)) {
|
||||
$this->_helper->layout->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
//Distribution du fichier sur la sortie standard
|
||||
list($nomFichier, $extFichier) = explode('.', $fichierCsv);
|
||||
switch ($extFichier) {
|
||||
case 'png': $content_type = 'image/png'; break;
|
||||
case 'gif': $content_type = 'image/gif'; break;
|
||||
case 'jpeg':
|
||||
case 'jpg': $content_type = 'image/jpeg'; break;
|
||||
case 'pdf': $content_type = 'application/pdf'; break;
|
||||
case 'csv': $content_type = 'application/csv-tab-delimited-table'; break;
|
||||
}
|
||||
$this->getResponse()->setHeader('Content-Type', $content_type);
|
||||
$contentDisposition = 'attachment';
|
||||
switch ($contentDisposition) {
|
||||
case 'inline':
|
||||
$this->getResponse()->setHeader('Content-Disposition', 'inline');
|
||||
break;
|
||||
case 'attachment':
|
||||
$this->getResponse()->setHeader('Content-Disposition', "attachment; filename=\"$fichierCsv\"");
|
||||
break;
|
||||
}
|
||||
|
||||
$data = file_get_contents($path . $fichierCsv);
|
||||
|
||||
$this->getResponse()->setHeader('Content-Length', strlen($data))
|
||||
->setHeader('Cache-Control', 'private, max-age=0, must-revalidate')
|
||||
->setHeader('Pragma', 'public')
|
||||
->setBody($data);
|
||||
}
|
||||
} else {
|
||||
$this->view->assign('message', 'Paramètres incorrects !');
|
||||
}
|
||||
}
|
||||
}
|
@ -1,202 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Distribute all SOAP based Web Services
|
||||
*
|
||||
*/
|
||||
class ServiceController extends Zend_Controller_Action
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
/**
|
||||
* Be sure we don't make any render
|
||||
*/
|
||||
$this->_helper->layout->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
|
||||
$request = $this->getRequest();
|
||||
|
||||
// --- Get the service name, make sure the string is in lower case
|
||||
$serviceName = strtolower($request->getParam('service', 'Entreprise'));
|
||||
|
||||
// --- ClassName and Directory with first letter capitalized
|
||||
$serviceClassName = ucfirst($serviceName);
|
||||
|
||||
// --- Customize service for customers
|
||||
if ('clients' == $serviceName) {
|
||||
$client = strtolower($request->getParam('client', ''));
|
||||
$clientClassName = ucfirst($client);
|
||||
// --- Get list of customers
|
||||
$clients = array();
|
||||
$listeClients = include APPLICATION_PATH . '/../library/WsScore/Clients/ClientsConfig.php';
|
||||
foreach ($listeClients as $section => $params) {
|
||||
if ($params['actif']) {
|
||||
$clients[$section] = $params;
|
||||
}
|
||||
}
|
||||
if (!array_key_exists($client, $clients)) {
|
||||
echo 'Service clients introuvable !';
|
||||
exit;
|
||||
}
|
||||
$configServiceVersions = $clients[$client]['versions'];
|
||||
}
|
||||
// --- Service versions
|
||||
else {
|
||||
$services = include APPLICATION_PATH . '/../library/WsScore/ServicesConfig.php';
|
||||
$configServiceVersions = $services[$serviceName]['versions'];
|
||||
}
|
||||
|
||||
// --- Check versions
|
||||
foreach ($configServiceVersions as $section => $params) {
|
||||
$serviceVersions[$section] = $params;
|
||||
if ($params['defaut']) {
|
||||
$defautVersion = $section;
|
||||
}
|
||||
}
|
||||
$version = $request->getParam('version', 'v'.$defautVersion);
|
||||
$version = substr($version, 1);
|
||||
|
||||
// --- Version inexistante
|
||||
if (!array_key_exists($version, $serviceVersions)) {
|
||||
echo "Version inexistante.";
|
||||
exit;
|
||||
}
|
||||
// --- Version désactivé
|
||||
if (!$serviceVersions[$version]['actif']) {
|
||||
echo "Version désactivée.";
|
||||
exit;
|
||||
}
|
||||
|
||||
// --- Charger les classes et les types pour le service suivant la version
|
||||
if ('clients' == $serviceName) {
|
||||
$pathServiceClassIni = 'WsScore/Clients/'.$clientClassName.'/v'.$version.'/Config.php';
|
||||
$pathServiceClassPhp = 'WsScore/Clients/'.$clientClassName.'/v'.$version.'/Service.php';
|
||||
// --- Gestion du mode de génération du wsdl
|
||||
if (APPLICATION_ENV == 'development'
|
||||
|| array_key_exists('mode', $serviceVersions[$version])
|
||||
&& $serviceVersions[$version]['mode']=='auto') {
|
||||
$pathServiceUrl = 'clients/'.$client.'/v'.$version.'?wsdl-auto';
|
||||
} else {
|
||||
$pathServiceUrl = 'clients/'.$client.'/v'.$version.'?wsdl';
|
||||
}
|
||||
$pathServiceUri = 'clients/'.$client.'/v'.$version;
|
||||
// --- On redéfini le nom du service
|
||||
$serviceClassName = 'Entreprise';
|
||||
$fichierWsdl = $clientClassName.'-'.$serviceClassName.'-'.$version.'.wsdl';
|
||||
} else {
|
||||
$pathServiceClassIni = 'WsScore/'.$serviceClassName.'/v'.$version.'/Config.php';
|
||||
$pathServiceClassPhp = 'WsScore/'.$serviceClassName.'/v'.$version.'/Service.php';
|
||||
// --- Gestion du mode de génération du wsdl
|
||||
if (APPLICATION_ENV == 'development'
|
||||
|| array_key_exists('mode', $serviceVersions[$version])
|
||||
&& $serviceVersions[$version]['mode']=='auto') {
|
||||
$pathServiceUrl = $serviceName.'/v'.$version.'?wsdl-auto';
|
||||
} else {
|
||||
$pathServiceUrl = $serviceName.'/v'.$version.'?wsdl';
|
||||
}
|
||||
$pathServiceUri = $serviceName.'/v'.$version;
|
||||
$fichierWsdl = $serviceClassName.'-'.$version.'.wsdl';
|
||||
}
|
||||
|
||||
// --- Get map of WSDL type to PHP Classes
|
||||
$classmap = include $pathServiceClassIni;
|
||||
|
||||
// --- Inclusion des classes de données
|
||||
require_once $pathServiceClassPhp;
|
||||
|
||||
// --- Get hostname - add compatibility with Reverse Proxy
|
||||
$hostName = $request->getHttpHost();
|
||||
$hostScheme = $request->getScheme();
|
||||
$http = new Zend_Controller_Request_Http();
|
||||
$proxyScheme = $http->getHeader('X-Forwarded-Proto');
|
||||
if ($proxyScheme == 'https') {
|
||||
$hostScheme = 'https';
|
||||
}
|
||||
$fichierWsdl = $hostName . '-' . $hostScheme . '-' . $fichierWsdl;
|
||||
$c = Zend_registry::get('config');
|
||||
$wsdlPath = $c->profil->path->shared . '/wsdl';
|
||||
|
||||
// --- Fourniture du wsdl
|
||||
if (isset($_GET['wsdl']) && file_exists($wsdlPath . '/' . $fichierWsdl)) {
|
||||
if (!headers_sent()) {
|
||||
header('Content-Type: text/xml');
|
||||
}
|
||||
readfile($wsdlPath . '/' . $fichierWsdl);
|
||||
} elseif (isset($_GET['wsdl']) && !file_exists($wsdlPath . '/' . $fichierWsdl)
|
||||
|| isset($_GET['wsdl-generate'])
|
||||
|| isset($_GET['wsdl-auto'])) {
|
||||
// --- Définition du webservice
|
||||
$wsdl = new Zend_Soap_AutoDiscover();
|
||||
$wsdl->setComplexTypeStrategy('Zend_Soap_Wsdl_Strategy_ArrayOfTypeSequence');
|
||||
$wsdl->setOperationBodyStyle(array('use' => 'literal'));
|
||||
$wsdl->setBindingStyle(array('style' => 'document'));
|
||||
$wsdl->setClass($serviceClassName);
|
||||
|
||||
if ($hostScheme == 'https') {
|
||||
$wsdl->setUri($hostScheme.'://'.$hostName.'/'.$pathServiceUri);
|
||||
}
|
||||
|
||||
// --- Enregistrement du WSDL dans un fichier
|
||||
if (isset($_GET['wsdl-generate'])) {
|
||||
if (file_exists($wsdlPath . '/' . $fichierWsdl)) {
|
||||
unlink($wsdlPath . '/' . $fichierWsdl);
|
||||
}
|
||||
$wsdl->dump($wsdlPath . '/' . $fichierWsdl);
|
||||
echo "Le fichier $fichierWsdl a été généré";
|
||||
// --- Génération/Fourniture du wsdl
|
||||
} elseif (isset($_GET['wsdl']) && !file_exists($wsdlPath . '/' . $fichierWsdl)) {
|
||||
$wsdl->dump($wsdlPath . '/' . $fichierWsdl);
|
||||
if (!headers_sent()) {
|
||||
header('Content-Type: text/xml');
|
||||
}
|
||||
readfile($wsdlPath . '/' . $fichierWsdl);
|
||||
}
|
||||
// --- Envoi sur la sortie standard le wsdl sans enregistrement dans un fichier
|
||||
elseif (isset($_GET['wsdl-auto'])) {
|
||||
$wsdl->handle();
|
||||
}
|
||||
}
|
||||
// --- Fourniture du service
|
||||
else {
|
||||
// --- Traitement
|
||||
if (in_array(APPLICATION_ENV, array('production', 'staging'))
|
||||
&& file_exists($wsdlPath . '/' . $fichierWsdl)) {
|
||||
$server = new Zend_Soap_Server($wsdlPath . '/' . $fichierWsdl);
|
||||
} else {
|
||||
$server = new Zend_Soap_Server($hostScheme.'://'.$hostName.'/'.$pathServiceUrl);
|
||||
}
|
||||
|
||||
// --- Sonde paramètres server
|
||||
$debug = false;
|
||||
$debugUser = '';
|
||||
if ($debug && $_SERVER['PHP_AUTH_USER'] == $debugUser) {
|
||||
file_put_contents(APPLICATION_PATH . '/../debugserver.log',
|
||||
"FichierWSDL : ".$fichierWsdl."\n".
|
||||
"Hostname : ".$hostName."\n"
|
||||
);
|
||||
}
|
||||
|
||||
// --- Options et traitement de la requete
|
||||
$server->setSoapFeatures(SOAP_USE_XSI_ARRAY_TYPE + SOAP_SINGLE_ELEMENT_ARRAYS);
|
||||
$server->setClassmap($classmap);
|
||||
$server->setEncoding('UTF-8');
|
||||
$server->registerFaultException(array('Scores_Ws_Exception'));
|
||||
$server->setWsiCompliant(true);
|
||||
|
||||
// --- Création du service
|
||||
$server->setObject(new $serviceClassName());
|
||||
$server->handle();
|
||||
|
||||
// --- Pour débuggage ultime
|
||||
$debug = false;
|
||||
$debugUser = '';
|
||||
if ($debug && $_SERVER['PHP_AUTH_USER'] == $debugUser) {
|
||||
file_put_contents(APPLICATION_PATH . '/../debugcall.log',
|
||||
"FichierWSDL : ".$fichierWsdl."\n"."Hostname : ".$hostName."\n");
|
||||
$request = $server->getLastRequest();
|
||||
file_put_contents(APPLICATION_PATH . '/../debugcall.log', $request . "\n", FILE_APPEND);
|
||||
$response = $server->getLastResponse();
|
||||
file_put_contents(APPLICATION_PATH . '/../debugcall.log', $response. "\n", FILE_APPEND);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,133 +0,0 @@
|
||||
<?php
|
||||
class UserController extends Zend_Controller_Action
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
}
|
||||
|
||||
public function loginAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
|
||||
$this->view->headLink()->appendStylesheet('/assets/themes/default/css/signin.css', 'all');
|
||||
|
||||
$this->view->headTitle()->append('Connexion');
|
||||
$form = new Application_Form_Login();
|
||||
$this->view->form = $form;
|
||||
$request = $this->getRequest();
|
||||
if ($request->isPost()) {
|
||||
$formData = $request->getPost();
|
||||
if ($form->isValid($formData)) {
|
||||
$login = $form->getValue('login');
|
||||
$pass = $form->getValue('pass');
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$authAdapter = new Scores_Auth_Adapter_Db($login, $pass, true);
|
||||
$result = $auth->authenticate($authAdapter);
|
||||
if ($result->isValid()) {
|
||||
$timeout = $auth->getIdentity()->timeout;
|
||||
|
||||
//Ecrit un cookie persistant valide pendant le temps definit
|
||||
Zend_Session::rememberMe($timeout);
|
||||
|
||||
$storage = new Zend_Auth_Storage_Session();
|
||||
$sessionNamespace = new Zend_Session_Namespace($storage->getNamespace());
|
||||
$sessionNamespace->setExpirationSeconds($timeout);
|
||||
$auth->setStorage($storage);
|
||||
|
||||
$this->redirect('/');
|
||||
} else {
|
||||
$this->view->message = '';
|
||||
foreach ($result->getMessages() as $message) {
|
||||
$this->view->message.= $message."<br/>";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function logoutAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
Zend_Auth::getInstance()->clearIdentity();
|
||||
}
|
||||
|
||||
public function paramsAction()
|
||||
{
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$identity = $auth->getIdentity();
|
||||
$login = $identity->username;
|
||||
$pass = $identity->hash;
|
||||
|
||||
$this->view->login = $login;
|
||||
$this->view->authorizationHeader = base64_encode($login.':'.$pass);
|
||||
|
||||
/**
|
||||
* @var \Doctrine\DBAL\Connection $conn
|
||||
*/
|
||||
$conn = Zend_Registry::get('doctrine');
|
||||
$userSql = "SELECT * FROM sdv1.utilisateurs WHERE id=:id";
|
||||
$stmt = $conn->prepare($userSql);
|
||||
$stmt->bindValue('id', $identity->id);
|
||||
$stmt->execute();
|
||||
$user = $stmt->fetch(\PDO::FETCH_OBJ);
|
||||
|
||||
$this->view->IdFullName = $user->civilite . ' ' . $user->nom . ' ' . $user->prenom;
|
||||
$this->view->IdEmail = $user->email;
|
||||
|
||||
//Liste des droits
|
||||
$listdroit = explode(' ', $user->droits);
|
||||
|
||||
//Association méthodes - droits
|
||||
$assoc = array(
|
||||
'getAnnoncesAsso' => array('ANNONCES'),
|
||||
'getAnnoncesBalo' => array('ANNONCES'),
|
||||
'getAnnoncesBoamp' => array('ANNONCES'),
|
||||
'getAnnoncesLegales' => array('ANNONCES'),
|
||||
'getAnnoncesNum' => array('ANNONCES'),
|
||||
'getAvisRncs' => array('AVISRNCS'),
|
||||
'getBanques' => array('BANQUES'),
|
||||
'getBilan' => array('LIASSE'),
|
||||
'getDirigeants' => array('DIRIGEANTS'),
|
||||
'getIdentite' => array('IDENTITE'),
|
||||
'getIdentiteProcol' => array('IDPROCOL'),
|
||||
'getIndiScore' => array('INDISCORE1', 'INDISCORE2', 'INDISCORE3'),
|
||||
'getInfosBourse' => array('BOURSE'),
|
||||
'getInfosReg' => array('INFOSREG'),
|
||||
'getLiasseInfos' => array(),
|
||||
'getLienRef' => array('LIENS'),
|
||||
'getLiens' => array('LIENS'),
|
||||
'getLiensById' => array('LIENS'),
|
||||
'getListeBilans' => array('LIASSE'),
|
||||
'getListeCompetences' => array('COMPETENCES'),
|
||||
'getListeEtablissements' => array('ETABLISSEMENTS'),
|
||||
'getListeEvenements' => array('EVENINSEE'),
|
||||
'getRapport' => array('INDISCORE3'),
|
||||
'getRatios' => array('RATIOS'),
|
||||
'getSubventionDetail' => array(''),
|
||||
'getSubventionList' => array(''),
|
||||
'getTVA' => array(''),
|
||||
'getValo' => array('VALORISATION'),
|
||||
'isSirenExistant' => array(''),
|
||||
'searchAutreId' => array('SEARCHENT'),
|
||||
'searchDir' => array('SEARCHDIR'),
|
||||
'searchEntreprise' => array('SEARCHENT'),
|
||||
'searchNomAdr' => array('SEARCHENT'),
|
||||
'searchRefClient' => array(),
|
||||
'searchSiren' => array('SEARCHENT'),
|
||||
'searchTelFax' => array('SEARCHENT'),
|
||||
);
|
||||
|
||||
$display = array();
|
||||
foreach ($listdroit as $droit) {
|
||||
foreach ($assoc as $l => $d) {
|
||||
if (in_array(strtoupper($droit), $d)) {
|
||||
$display[] = array(
|
||||
'label' => $l,
|
||||
'droit' => $droit,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->view->display = $display;
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
<?php
|
||||
class Zend_View_Helper_DocComplement extends Zend_View_Helper_Abstract
|
||||
{
|
||||
public function docComplement($method)
|
||||
{
|
||||
}
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
class Zend_View_Helper_DocDescription extends Zend_View_Helper_Abstract
|
||||
{
|
||||
public function docDescription($method)
|
||||
{
|
||||
return $method['desc'];
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
<?php
|
||||
class Zend_View_Helper_DocExemple extends Zend_View_Helper_Abstract
|
||||
{
|
||||
public function docExemple($method)
|
||||
{
|
||||
$exemple = '';
|
||||
$langages = array(
|
||||
'php' => 'PHP',
|
||||
'java' => 'Java',
|
||||
'perl' => 'Perl',
|
||||
'python' => 'Python',
|
||||
'csharp' => 'C#'
|
||||
);
|
||||
|
||||
foreach ($langages as $langage => $lib) {
|
||||
$fichier = 'assets/code/'.$method.'-'.$langage.'.txt';
|
||||
if (file_exists($fichier)) {
|
||||
$url = $this->view->url(
|
||||
array(
|
||||
'controller' => 'documentation',
|
||||
'action' => 'code',
|
||||
'langage' => $langage,
|
||||
'element' => $method,
|
||||
), null, true);
|
||||
$exemple.= '<a href="'.$url.'">' . $lib . '</a>';
|
||||
$exemple.= ' ';
|
||||
}
|
||||
}
|
||||
return $exemple;
|
||||
}
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
<?php
|
||||
class Zend_View_Helper_DocMethod extends Zend_View_Helper_Abstract
|
||||
{
|
||||
protected $_transcodeType = array(
|
||||
'str' => 'string',
|
||||
'bool' => 'boolean',
|
||||
'integer' => 'int',
|
||||
);
|
||||
|
||||
public function docMethod($method)
|
||||
{
|
||||
$output = '';
|
||||
|
||||
$returnType = $method['return'];
|
||||
$methodName = $method['name'];
|
||||
|
||||
$cptParameters = 0;
|
||||
$parameters = '';
|
||||
foreach ($method['params'] as $param) {
|
||||
if (isset($param['optional'])) {
|
||||
$parameters.= '[';
|
||||
}
|
||||
$parameters.= '<i>' . $this->transcodeType($param['type']) . '</i>';
|
||||
$parameters.= ' ';
|
||||
$parameters.= '<b>' . $param['name'] . '</b>';
|
||||
|
||||
if (isset($param['optional'])) {
|
||||
if (isset($param['defaultValue'])) {
|
||||
$parameters.= ' = ';
|
||||
if (is_bool($param['defaultValue'])) {
|
||||
$parameters.= ($param['defaultValue'] === false) ? 'false' : 'true' ;
|
||||
} elseif (is_string($param['defaultValue']) && $param['defaultValue']=='') {
|
||||
$parameters.= "''";
|
||||
} else {
|
||||
$parameters.= $param['defaultValue'];
|
||||
}
|
||||
}
|
||||
$parameters.= ']';
|
||||
}
|
||||
$cptParameters++;
|
||||
if ($cptParameters < count($method['params'])) {
|
||||
$parameters.= ', ';
|
||||
}
|
||||
}
|
||||
$output = '<i>' . $this->transcodeType($returnType) . '</i>';
|
||||
$output.= ' ';
|
||||
$output.= '<b>' . $methodName . '</b>' . ' <b>(</b> ' . $parameters . ' <b>)</b>';
|
||||
return $output;
|
||||
}
|
||||
|
||||
private function transcodeType($type)
|
||||
{
|
||||
if (array_key_exists($type, $this->_transcodeType)) {
|
||||
return $this->_transcodeType[$type];
|
||||
} else {
|
||||
return $type;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,80 +0,0 @@
|
||||
<?php
|
||||
class Zend_View_Helper_DocParameter extends Zend_View_Helper_Abstract
|
||||
{
|
||||
protected $serviceTypes;
|
||||
|
||||
protected $types = array(
|
||||
'string', 'str',
|
||||
'boolean', 'bool',
|
||||
'int', 'integer', 'long',
|
||||
'float', 'double',
|
||||
'array', 'object', 'mixed'
|
||||
);
|
||||
|
||||
protected $_transcodeType = array(
|
||||
'str' => 'string',
|
||||
'bool' => 'boolean',
|
||||
'integer' => 'int',
|
||||
);
|
||||
|
||||
public function docParameter($params, $serviceTypes)
|
||||
{
|
||||
$this->serviceTypes = $serviceTypes;
|
||||
$output = '';
|
||||
if (count($params)>0) {
|
||||
$output.= '<ul>';
|
||||
foreach ($params as $param) {
|
||||
$output.= $this->formatParam($param);
|
||||
}
|
||||
$output.= '</ul>';
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
private function parseType($type)
|
||||
{
|
||||
$output = '';
|
||||
$type = str_replace('[]', '', $type);
|
||||
if (array_key_exists($type, $this->serviceTypes)) {
|
||||
$types = $this->serviceTypes[$type];
|
||||
$output.= '<ul>';
|
||||
foreach ($types as $param) {
|
||||
$output.= $this->formatParam($param);
|
||||
}
|
||||
$output.= '</ul>';
|
||||
} elseif (in_array($type, $this->types)) {
|
||||
$output.= '';
|
||||
} elseif ($type == 'void') {
|
||||
$output.= 'Void';
|
||||
} else {
|
||||
$output.= ' => <b>Type '.$type.' inconnu</b>';
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
private function formatParam($param)
|
||||
{
|
||||
$output = '';
|
||||
$output.= '<li>';
|
||||
$output.= '<i>' . $this->transcodeType($param['type']) . '</i>';
|
||||
$output.= ' ';
|
||||
$output.= '<b>' . $param['name'] . '</b>';
|
||||
if (isset($param['description']) && !empty($param['description'])) {
|
||||
$output.= ' - '.$param['description'];
|
||||
}
|
||||
if (!in_array($param['type'], $this->types)) {
|
||||
$output.= $this->parseType($param['type']);
|
||||
}
|
||||
$output.= '</li>';
|
||||
return $output;
|
||||
}
|
||||
|
||||
private function transcodeType($type)
|
||||
{
|
||||
if (array_key_exists($type, $this->_transcodeType)) {
|
||||
return $this->_transcodeType[$type];
|
||||
} else {
|
||||
return $type;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,73 +0,0 @@
|
||||
<?php
|
||||
class Zend_View_Helper_DocReturn extends Zend_View_Helper_Abstract
|
||||
{
|
||||
protected $serviceTypes;
|
||||
|
||||
protected $types = array(
|
||||
'string', 'str',
|
||||
'boolean', 'bool',
|
||||
'integer', 'int', 'long',
|
||||
'float', 'double',
|
||||
'array', 'object', 'mixed'
|
||||
);
|
||||
|
||||
protected $_transcodeType = array(
|
||||
'str' => 'string',
|
||||
'bool' => 'boolean',
|
||||
'integer' => 'int',
|
||||
);
|
||||
|
||||
public function docReturn($type, $serviceTypes)
|
||||
{
|
||||
$this->serviceTypes = $serviceTypes;
|
||||
return $this->parseType($type);
|
||||
}
|
||||
|
||||
private function parseType($type)
|
||||
{
|
||||
$output = '';
|
||||
$type = str_replace('[]', '', $type);
|
||||
if (array_key_exists($type, $this->serviceTypes)) {
|
||||
$types = $this->serviceTypes[$type];
|
||||
$output.= '<ul>';
|
||||
foreach ($types as $param) {
|
||||
$output.= $this->formatParam($param);
|
||||
}
|
||||
$output.= '</ul>';
|
||||
} elseif (in_array($type, $this->types)) {
|
||||
$output.= '<i>' . $type . '</i> ';
|
||||
} elseif ($type == 'void') {
|
||||
$output.= 'Void';
|
||||
} else {
|
||||
$output.= ' => <b>Type '.$type.' inconnu</b>';
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
private function formatParam($param)
|
||||
{
|
||||
$output = '';
|
||||
$output.= '<li>';
|
||||
$output.= '<i>' . $this->transcodeType($param['type']) . '</i>';
|
||||
$output.= ' ';
|
||||
$output.= '<b>'. $param['name'] . '</b>';
|
||||
if (isset($param['description']) && !empty($param['description'])) {
|
||||
$output.= ' - '.$param['description'];
|
||||
}
|
||||
$type = str_replace('[]', '', $param['type']);
|
||||
if (!in_array($type, $this->types)) {
|
||||
$output.= $this->parseType($param['type']);
|
||||
}
|
||||
$output.= '</li>';
|
||||
return $output;
|
||||
}
|
||||
|
||||
private function transcodeType($type)
|
||||
{
|
||||
if (array_key_exists($type, $this->_transcodeType)) {
|
||||
return $this->_transcodeType[$type];
|
||||
} else {
|
||||
return $type;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
<?php
|
||||
|
||||
class Zend_View_Helper_ProfileLink extends Zend_View_Helper_Abstract
|
||||
{
|
||||
public function profileLink()
|
||||
{
|
||||
$auth = Zend_Auth::getInstance();
|
||||
if ($auth->hasIdentity()) {
|
||||
$username = $auth->getIdentity()->username;
|
||||
$logoutUrl = $this->view->url(array(
|
||||
'controller' => 'user',
|
||||
'action' => 'logout'
|
||||
), null, true);
|
||||
return '<a href="'.$logoutUrl.'" title="Se déconnecter" class="navbar-link">Déconnexion : ' . $username . '</a>';
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
<h1>Démonstration - Liste des méthodes</h1>
|
||||
|
||||
<p class="bg-info">Uniquement disponible à titre d'information. Se référer à la documentation pour réaliser des tests.</p>
|
||||
|
||||
<ul>
|
||||
<?php foreach($this->methods as $method){ ?>
|
||||
<li>
|
||||
<a href="<?php echo $method['url'];?>">
|
||||
<?php echo $method['nom'];?></a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
@ -1,5 +0,0 @@
|
||||
<h2><?php echo $this->method;?></h2>
|
||||
<p><?php echo $this->message;?></p>
|
||||
<div>
|
||||
<?php echo $this->form;?>
|
||||
</div>
|
@ -1,20 +0,0 @@
|
||||
<h2>SOAP</h2>
|
||||
|
||||
<p>Requete</p>
|
||||
<textarea rows="10" cols="100" name="soap-requete">
|
||||
<?php print_r($this->soap['requete']);?>
|
||||
</textarea>
|
||||
<p>Réponse</p>
|
||||
<textarea rows="10" cols="100" name="soap-reponse">
|
||||
<?php print_r($this->soap['reponse']);?>
|
||||
</textarea>
|
||||
|
||||
<h2>XML</h2>
|
||||
<p>Requete</p>
|
||||
<textarea rows="10" cols="100" name="xml-requete">
|
||||
<?php echo $this->xml['requete'];?>
|
||||
</textarea>
|
||||
<p>Réponse</p>
|
||||
<textarea rows="10" cols="100" name="xml-reponse">
|
||||
<?php echo $this->xml['reponse'];?>
|
||||
</textarea>
|
@ -1,42 +0,0 @@
|
||||
<div id="wsdl">
|
||||
<h1>WSDL</h1>
|
||||
<p><a href="<?=$this->wsdl?>">Télécharger le WSDL</a></p>
|
||||
<i>Le fichier est accessible sans authentification.</i>
|
||||
</div>
|
||||
|
||||
<div class="op-list">
|
||||
<h1>Liste des opérations :</h1>
|
||||
<ol>
|
||||
<?php foreach ($this->serviceMethods as $method) {?>
|
||||
<li>
|
||||
<b><?php echo $method['name'];?></b>
|
||||
<a href="#<?php echo $method['name'];?>"><i>Détail</i></a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
<div class="op-detail">
|
||||
<h1>Détails :</h1>
|
||||
<?php foreach ($this->serviceMethods as $method) {?>
|
||||
<div class="function">
|
||||
<a name="<?php echo $method['name'];?>"> </a>
|
||||
<h2><?php echo $method['name'];?></h2>
|
||||
<div><u>Description : </u></div>
|
||||
<div class="description"><?=$this->docDescription($method)?></div>
|
||||
<div class="complement"><?=$this->docComplement($method)?></div>
|
||||
<div class="function-detail" id="<?=$method['name']?>">
|
||||
<p><?php echo $this->docMethod($method);?></p>
|
||||
<div><u>Paramètres : </u></div>
|
||||
<div class="parameters">
|
||||
<?php echo $this->docParameter($method['params'], $this->serviceTypes);?>
|
||||
</div>
|
||||
<div><u>Retour : </u></div>
|
||||
<div class="return">
|
||||
<?php echo $this->docReturn($method['return'], $this->serviceTypes);?>
|
||||
</div>
|
||||
</div>
|
||||
<p>Exemple : <?php echo $this->docExemple($method['name']);?></p>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
@ -1,2 +0,0 @@
|
||||
<h2><?=$this->langage?></h2>
|
||||
<?=$this->code?>
|
@ -1,10 +0,0 @@
|
||||
<div>
|
||||
<h1>Liste des code erreurs/messages :</h1>
|
||||
<ul>
|
||||
<?php foreach ($this->erreurs as $code => $message) {?>
|
||||
<li>
|
||||
<b><?php echo $code?></b> : <?php echo $message?>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</div>
|
@ -1,2 +0,0 @@
|
||||
<h2>Liste des exemples</h2>
|
||||
|
@ -1,48 +0,0 @@
|
||||
<div class="page-header"><h1>Authentification</h1></div>
|
||||
<p>
|
||||
Le WebService utilise une authentification http basic.
|
||||
Il s'agit donc de transmettre comme paramètres d'authentification
|
||||
</p>
|
||||
<p><code>http://{login}:{password}@url</code></p>
|
||||
<p>
|
||||
- <code>{password}</code> est une chaine construite de cette façon md5({login}|{pass}) <br/>
|
||||
- <code>{login}</code> est l'identifiant fournit <br/>
|
||||
- <code>{pass}</code> le mot de passe fournit.
|
||||
</p>
|
||||
|
||||
<div class="bs-callout bs-callout-warning">
|
||||
Authentification basic<br/>
|
||||
<br/>
|
||||
Le client HTTP envoi une requête avec l'en-tête HTTP "Authorization". Celui-ci doit contenir la méthode utilisée
|
||||
(Basic) suivi de la représentation en Base64 du nom de l'utilisateur et du mot de passe séparés par
|
||||
le caractère ":" (deux-points).<br/>
|
||||
<br/>
|
||||
Par exemple :<br/>
|
||||
<br/>
|
||||
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
|
||||
</div>
|
||||
|
||||
<p>
|
||||
Vous trouverez dans ces exemples les prérequis pour s'authentifier et suivant
|
||||
les outils et langage la possibilité de générer le code à partir du WSDL.<br/>
|
||||
Exemple : <?=$this->docExemple('authentication')?>
|
||||
</p>
|
||||
|
||||
|
||||
<div class="page-header"><h1>Compatibilité</h1></div>
|
||||
<p>Notre service web a été testé avec ces langages/librairies</p>
|
||||
<ul>
|
||||
<li>C# : .Net Framework</li>
|
||||
<li>PHP : PHP5 SOAP Extension</li>
|
||||
<li>Perl : SOAP::Lite</li>
|
||||
<li>Java : JAX-WS</li>
|
||||
<li>Python : SOAPpy</li>
|
||||
<li>VB.Net : .Net Framework</li>
|
||||
<li>C++ : gSOAP</li>
|
||||
</ul>
|
||||
|
||||
<br/>
|
||||
<p>
|
||||
Pour toutes remarques ou question merci d'adresser un email à
|
||||
<a href="mailto:support@scores-decisions.com">support@scores-decisions.com</a>
|
||||
</p>
|
@ -1 +0,0 @@
|
||||
Erreur
|
@ -1,78 +0,0 @@
|
||||
<div class="page-header"><h1>Service <?=$this->serviceName?> v<?=$this->serviceVersion?></h1></div>
|
||||
|
||||
<?php if ( $this->isDeprecated === true) {?>
|
||||
<p class="bg-danger">Cette version est déprécié. Elle est désactivé.</p>
|
||||
<?php }?>
|
||||
|
||||
<?php if ( $this->Info ) {?>
|
||||
<p class="bg-info"><?=$this->Info?></p>
|
||||
<?php }?>
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">WSDL</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<p><a href="<?=$this->wsdl?>">Télécharger le WSDL</a></p>
|
||||
<i>Le fichier est accessible sans authentification.</i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Liste des opérations</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<ol>
|
||||
<?php foreach ($this->serviceMethods as $method) {?>
|
||||
<li>
|
||||
<b><?php echo $method['name'];?></b>
|
||||
<a href="#<?php echo $method['name'];?>"><i>Détail</i></a>
|
||||
</li>
|
||||
<?php }?>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-header">
|
||||
<h2>Détails</h2>
|
||||
</div>
|
||||
|
||||
<?php foreach ($this->serviceMethods as $method) {?>
|
||||
<div class="panel panel-default" id="<?=$method['name']?>">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title"><h4><?=$method['name']?></h4></h3>
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
|
||||
<h5>Description</h5>
|
||||
<div class="bs-callout bs-callout-php">
|
||||
<h4><code><?=$this->docMethod($method)?></code></h4>
|
||||
<p><?=$this->docComplement($method)?></p>
|
||||
<p><?=$this->docDescription($method)?></p>
|
||||
</div>
|
||||
|
||||
<h5>Paramètres</h5>
|
||||
<div class="bs-callout bs-callout-php">
|
||||
<?=$this->docParameter($method['params'], $this->serviceTypes);?>
|
||||
</div>
|
||||
|
||||
<h5>Retour</h5>
|
||||
<div class="bs-callout bs-callout-php">
|
||||
<?php if ($method['returnDesc'] != '') {?><?=$method['returnDesc']?><br/><br/><?php }?>
|
||||
<?=$this->docReturn($method['return'], $this->serviceTypes);?>
|
||||
</div>
|
||||
|
||||
<?php $exemple = $this->docExemple($method['name'])?>
|
||||
<?php if ( !empty($exemple) ) {?>
|
||||
<h5>Exemple</h5>
|
||||
<div class="bs-callout bs-callout-php">
|
||||
<?=$exemple?>
|
||||
</div>
|
||||
<?php }?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<?php } ?>
|
@ -1,51 +0,0 @@
|
||||
<div class="page-header"><h1>Liste des services disponibles</h1></div>
|
||||
<p class="lead">Ci-dessous la liste des services disponibles, personnalisés ou standards.</code>.</p>
|
||||
|
||||
<?php foreach ($this->WsServices as $service => $params) {?>
|
||||
<div class="panel panel-default">
|
||||
<!-- Default panel contents -->
|
||||
<div class="panel-heading">
|
||||
<a href="<?=$this->url(array(
|
||||
'controller'=>'documentation',
|
||||
'action'=>'servicev',
|
||||
'name'=>$service,
|
||||
'type'=>$params['type']),null,true)?>">
|
||||
<?=$params['name']?>
|
||||
</a>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<p>Informations</p>
|
||||
</div>
|
||||
<?php if (isset($params['versions'])) { ?>
|
||||
<ul class="list-group">
|
||||
<?php foreach ($params['versions'] as $version => $versionElement) { ?>
|
||||
<li class="list-group-item">
|
||||
<a href="<?=$this->url(array(
|
||||
'controller'=>'documentation',
|
||||
'action'=>'service',
|
||||
'name'=>$service,
|
||||
'type'=>$params['type'],
|
||||
'version'=>$version),null,true)?>">
|
||||
Version <?=$version?></a>
|
||||
|
||||
<div class="pull-right">
|
||||
<?php if ( $versionElement['defaut'] === true ) { ?>
|
||||
<span class="label label-success">Actuel</span>
|
||||
<?php } elseif ( $versionElement['defaut'] === false ) {?>
|
||||
<span class="label label-danger">Déprécié</span>
|
||||
<?php } elseif ( $versionElement['defaut'] == 'beta') {?>
|
||||
<span class="label label-warning">Beta</span>
|
||||
<?php }?>
|
||||
<?php if ( $versionElement['actif'] === true ) { ?>
|
||||
<span class="label label-info">Actif</span>
|
||||
<?php } else {?>
|
||||
<span class="label label-info">Inactif</span>
|
||||
<?php }?>
|
||||
</div>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
<?php } ?>
|
@ -1,40 +0,0 @@
|
||||
<?php
|
||||
$service = null;
|
||||
if ( array_key_exists($this->key, $this->WsServices) ) {
|
||||
$service = $this->WsServices[$this->key];
|
||||
}
|
||||
?>
|
||||
<?php if ( $service === null ) {?>
|
||||
|
||||
<?php } else {?>
|
||||
|
||||
<div class="page-header"><h1>Versions du service <?=$service['name']?></h1></div>
|
||||
<p class="lead">...</p>
|
||||
|
||||
<?php if (isset($service['versions'])) { ?>
|
||||
<?php foreach ($service['versions'] as $version => $versionElement) { ?>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<a href="<?=$this->url(array(
|
||||
'controller'=>'documentation',
|
||||
'action'=>'service',
|
||||
'name'=>$this->key,
|
||||
'type'=>$service['type'],
|
||||
'version'=>$version))?>">
|
||||
Version <?=$version?></a>
|
||||
<?php if ( $versionElement['defaut'] === true ) { ?>
|
||||
<span style="float:right;" class="label label-success">Défaut</span>
|
||||
<?php } elseif ( $versionElement['defaut'] === false ) {?>
|
||||
<span style="float:right;" class="label label-danger">Déprécié</span>
|
||||
<?php } elseif ( $versionElement['defaut'] == 'beta') {?>
|
||||
<span style="float:right;" class="label label-warning">Beta</span>
|
||||
<?php }?>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<p>Information</p>
|
||||
</div>
|
||||
</div>
|
||||
<?php }?>
|
||||
<?php }?>
|
||||
|
||||
<?php } ?>
|
@ -1,18 +0,0 @@
|
||||
<h1>An error occurred</h1>
|
||||
<h2><?php echo $this->message ?></h2>
|
||||
|
||||
<?php if (isset($this->exception)): ?>
|
||||
|
||||
<h3>Exception information:</h3>
|
||||
<p>
|
||||
<b>Message:</b> <?php echo $this->exception->getMessage() ?>
|
||||
</p>
|
||||
|
||||
<h3>Stack trace:</h3>
|
||||
<pre><?php echo $this->exception->getTraceAsString() ?>
|
||||
</pre>
|
||||
|
||||
<h3>Request Parameters:</h3>
|
||||
<pre><?php echo var_export($this->request->getParams(), true) ?>
|
||||
</pre>
|
||||
<?php endif ?>
|
@ -1,3 +0,0 @@
|
||||
<div class="container">
|
||||
<p class="text-muted credit"> © <?=date('Y')?> <a href="http://www.scores-decisions.com">Scores & Décisions SAS</a>.</p>
|
||||
</div>
|
@ -1,38 +0,0 @@
|
||||
<!-- Fixed navbar -->
|
||||
<div class="navbar navbar-default navbar-fixed-top">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="#">Web Service API</a>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<?php foreach ($this->navigation()->getContainer() as $page) {?>
|
||||
<?php if ( $page->hasPages() ) {?>
|
||||
<li class="dropdown<?php if ( $page->isActive(true) ) { echo ' active'; } ?>">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?=$page->label?> <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="<?=$page->getHref()?>">Accueil</a></li>
|
||||
<li class="divider"></li>
|
||||
<?php foreach ( $page->getPages() as $child ) {?>
|
||||
<?php if ( $child->getHref() == '#') {?>
|
||||
<li class="divider"></li>
|
||||
<?php } else {?>
|
||||
<li<?php if ( $child->isActive(true) ) { echo ' class="active"'; } ?>><a href="<?=$child->getHref()?>"><?=$child->label?></a></li>
|
||||
<?php }?>
|
||||
<?php }?>
|
||||
</ul>
|
||||
</li>
|
||||
<?php } else {?>
|
||||
<li<?php if ( $page->isActive(true) ) { echo ' class="active"'; } ?>><a href="<?=$page->getHref()?>"><?=$page->label?></a></li>
|
||||
<?php }?>
|
||||
<?php }?>
|
||||
</ul>
|
||||
<p class="navbar-text pull-right"><?=$this->profileLink()?></p>
|
||||
</div><!--/.nav-collapse -->
|
||||
</div>
|
||||
</div>
|
@ -1,53 +0,0 @@
|
||||
<div>
|
||||
|
||||
<h2>Intégration d'un fichier</h2>
|
||||
|
||||
<p>Taille maximale d'un fichier : <?=$this->filesize?></p>
|
||||
|
||||
<form enctype="multipart/form-data" name="sendfile" action="<?=$this->url(array('controller'=>'import','action'=>'fileupload'))?>" method="post">
|
||||
<input type="hidden" name="APC_UPLOAD_PROGRESS" id="key" value="<?=uniqid()?>"/>
|
||||
<input type="hidden" name="idClient" value="<?=$this->idClient?>" />
|
||||
<input type="hidden" name="login" value="<?=$this->login?>" />
|
||||
|
||||
<div class="fieldgrp">
|
||||
<label>Fichier</label>
|
||||
<div class="field">
|
||||
<input type="file" id="fichier" name="fichier"/>
|
||||
<input type="submit" value="Envoi"/>
|
||||
|
||||
<div id="progressbar"></div>
|
||||
<div id="output"></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
<?=$this->inlineScript()?>
|
||||
|
||||
<script>
|
||||
var timer;
|
||||
|
||||
$('form[name=sendfile]').ajaxForm({
|
||||
beforeSubmit: function() {
|
||||
timer = setInterval(checkProgress,200);
|
||||
$('#progressbar').reportprogress(0);
|
||||
$('#output').html('Envoi en cours...');
|
||||
},
|
||||
success: function(data) {
|
||||
clearInterval(timer);
|
||||
$('#progressbar').remove();
|
||||
$('#output').html('<strong>' + data + '</strong>');
|
||||
}
|
||||
});
|
||||
|
||||
function checkProgress() {
|
||||
$.get('<?=$this->url(array('controller'=>'import', 'action'=>'fileprogress'))?>',
|
||||
{key: $('#key').val()}, function(data) {
|
||||
var percent = data.current/data.total*100;
|
||||
$('#progressbar').reportprogress(percent);
|
||||
}, 'json');
|
||||
}
|
||||
</script>
|
@ -1,6 +0,0 @@
|
||||
<div class="page-header"><h1>Contact</h1></div>
|
||||
<p class="lead"></p>
|
||||
<p>Pour toutes questions concernant les paramètres techniques ou une explication des données, vous pouvez contactez
|
||||
votre commercial ou le service support (<a href="mailto:support@scores-decisions.com">support@scores-decisions.com</a>).</p>
|
||||
|
||||
<p>Merci de rappeler pour référence le login utilisé pour l'accès au WebService.</p>
|
@ -1,6 +0,0 @@
|
||||
<div class="page-header"><h1>Contact</h1></div>
|
||||
<p class="lead"></p>
|
||||
<p>Pour toutes questions concernant les paramètres techniques ou une explication des données, vous pouvez contactez
|
||||
votre commercial ou le service support (<a href="mailto:support@scores-decisions.com">support@scores-decisions.com</a>).</p>
|
||||
|
||||
<p>Merci de rappeler pour référence le login utilisé pour l'accès au WebService.</p>
|
@ -1,7 +0,0 @@
|
||||
<div class="page-header"><h1>Web Service API</h1></div>
|
||||
<p class="lead">Scores & Décisions fournit un ensemble d'information sous la forme d'une API
|
||||
compatible avec le protocole SOAP permettant la communication et l'échange de données avec vos
|
||||
applications métier.
|
||||
</p>
|
||||
<p>La documentation vous fournira les éléments techniques relatifs aux <em>paramètres de connexion</em>,
|
||||
<em>structure des données</em>, ...</p>
|
@ -1,26 +0,0 @@
|
||||
<?php echo $this->doctype(); ?>
|
||||
<html>
|
||||
<head>
|
||||
<?php echo $this->headMeta(); ?>
|
||||
<?php echo $this->headTitle(); ?>
|
||||
<?php echo $this->headStyle(); ?>
|
||||
<?php echo $this->headLink(); ?>
|
||||
<?php echo $this->headScript(); ?>
|
||||
</head>
|
||||
<body>
|
||||
<div id="wrap">
|
||||
<?php echo $this->render('header.phtml') ?>
|
||||
|
||||
<div class="container">
|
||||
<?php echo $this->layout()->content; ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="footer">
|
||||
<?php echo $this->render('footer.phtml'); ?>
|
||||
</div>
|
||||
|
||||
<?php echo $this->inlineScript(); ?>
|
||||
</body>
|
||||
</html>
|
@ -1 +0,0 @@
|
||||
<?= $this->message ?>
|
@ -1 +0,0 @@
|
||||
<?php
|
@ -1 +0,0 @@
|
||||
<?= $this->message ?>
|
@ -1 +0,0 @@
|
||||
|
@ -1,33 +0,0 @@
|
||||
<?php echo $this->doctype(); ?>
|
||||
<html>
|
||||
<head>
|
||||
<?php echo $this->headMeta(); ?>
|
||||
<?php echo $this->headTitle(); ?>
|
||||
<?php echo $this->headStyle(); ?>
|
||||
<?php echo $this->headLink(); ?>
|
||||
<?php echo $this->headScript(); ?>
|
||||
</head>
|
||||
<body>
|
||||
<div id="wrap">
|
||||
|
||||
<div class="container">
|
||||
|
||||
<form class="form-signin" method="<?=$this->form->getMethod()?>" action="<?=$this->form->getAction()?>">
|
||||
<h2 class="form-signin-heading">Web Service API</h2>
|
||||
<div style="text-align:center;"><p class="text-danger"><span><?=$this->message?></span></p></div>
|
||||
<input name="login" value="<?=$this->form->getValue('login')?>" type="text" class="form-control" placeholder="Identifiant" autofocus>
|
||||
<input name="pass" value="<?=$this->form->getValue('pass')?>" type="password" class="form-control" placeholder="Mot de passe">
|
||||
<button class="btn btn-lg btn-primary btn-block" type="submit">Connexion</button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="footer">
|
||||
<?php echo $this->render('footer.phtml'); ?>
|
||||
</div>
|
||||
|
||||
<?php echo $this->inlineScript(); ?>
|
||||
</body>
|
||||
</html>
|
@ -1,24 +0,0 @@
|
||||
<?php echo $this->doctype(); ?>
|
||||
<html>
|
||||
<head>
|
||||
<?php echo $this->headMeta(); ?>
|
||||
<?php echo $this->headTitle(); ?>
|
||||
<?php echo $this->headStyle(); ?>
|
||||
<?php echo $this->headLink(); ?>
|
||||
</head>
|
||||
<body>
|
||||
<div id="wrap">
|
||||
|
||||
<div class="container">
|
||||
<p>Vous avez été déconnecté.</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="footer">
|
||||
<?php echo $this->render('footer.phtml'); ?>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,36 +0,0 @@
|
||||
<div class="page-header"><h1>Identifiant</h1></div>
|
||||
|
||||
<h2>Identité</h2>
|
||||
<address>
|
||||
<p>Login : <?=$this->login?></p>
|
||||
<strong><?=$this->IdFullName?></strong><br>
|
||||
<a href="mailto:#"><?=$this->IdEmail?></a>
|
||||
</address>
|
||||
|
||||
<h2>Authorization Header</h2>
|
||||
<div class="bs-callout bs-callout-warning">
|
||||
Authorization: Basic <?=$this->authorizationHeader;?>
|
||||
</div>
|
||||
<div>
|
||||
Base64("<?=$this->login?>:*****") = "<?=$this->authorizationHeader;?>"
|
||||
</div>
|
||||
|
||||
<div class="page-header"><h1>Paramètres</h1></div>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Méthode</th>
|
||||
<th>Droit</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if ( count($this->display)>0 ) {?>
|
||||
<?php foreach ( $this->display as $d ) {?>
|
||||
<tr>
|
||||
<td><?=$d['label']?></td>
|
||||
<td><?=$d['droit']?></td>
|
||||
</tr>
|
||||
<?php }?>
|
||||
<?php }?>
|
||||
</tbody>
|
||||
</table>
|
@ -1,50 +0,0 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../application/bin.bootstrap.php';
|
||||
|
||||
// --- Options
|
||||
$displayUsage = false;
|
||||
try {
|
||||
$opts = new Zend_Console_Getopt(array(
|
||||
'help|?' => "Aide.",
|
||||
'path=s' => "{Service Name}/{version}",
|
||||
));
|
||||
$opts->parse();
|
||||
$optionsNb = count($opts->getOptions());
|
||||
} catch (Zend_Console_Getopt_Exception $e) {
|
||||
$displayUsage = true;
|
||||
}
|
||||
|
||||
// --- Aide / Options
|
||||
if ($optionsNb == 0 || isset($opts->help)) {
|
||||
$displayUsage = true;
|
||||
}
|
||||
|
||||
// --- Usage
|
||||
if ($displayUsage) {
|
||||
echo "\nType Service\n\n";
|
||||
echo $opts->getUsageMessage();
|
||||
exit;
|
||||
}
|
||||
|
||||
$wsPath = APPLICATION_PATH . '/../library/WsScore/';
|
||||
|
||||
require_once $wsPath . $opts->path . '/Types.php';
|
||||
$detect = new Zend_Reflection_File($wsPath . $opts->path . '/Types.php');
|
||||
$result = $detect->getClasses();
|
||||
|
||||
$outPath = dirname($wsPath . $opts->path . '/Types.php');
|
||||
$outFile = $outPath . '/Config.php';
|
||||
|
||||
if (count($result) > 0) {
|
||||
file_put_contents($outFile, "<?php\n");
|
||||
file_put_contents($outFile, "return array(\n", FILE_APPEND);
|
||||
foreach ($result as $c) {
|
||||
file_put_contents($outFile, "\t'". $c->name . "' => '" . $c->name ."',\n", FILE_APPEND);
|
||||
}
|
||||
file_put_contents($outFile, ");\n", FILE_APPEND);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,60 +0,0 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../application/bin.bootstrap.php';
|
||||
|
||||
error_reporting(E_ALL & ~E_NOTICE);
|
||||
|
||||
$typesFichier = array('csv', 'fichiers', 'clients', 'kbis');
|
||||
|
||||
// --- Options
|
||||
$displayUsage = false;
|
||||
try {
|
||||
$opts = new Zend_Console_Getopt(array(
|
||||
'help|?' => 'Displays usage information.',
|
||||
'all' => 'Execute toutes les actions (cron).',
|
||||
'type=w' => 'Supprime uniquement les fichiers indiqués.',
|
||||
));
|
||||
$opts->parse();
|
||||
$optionsNb = count($opts->getOptions());
|
||||
} catch (Zend_Console_Getopt_Exception $e) {
|
||||
$displayUsage = true;
|
||||
}
|
||||
|
||||
// --- Aide / Options
|
||||
if ($optionsNb == 0 || isset($opts->help)) {
|
||||
$displayUsage = true;
|
||||
}
|
||||
|
||||
// --- Usage
|
||||
if ($displayUsage) {
|
||||
echo $opts->getUsageMessage();
|
||||
?>
|
||||
|
||||
Types de fichier disponibles : <?php echo join(', ', $typesFichier)?>
|
||||
|
||||
<?php
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($opts->all || $opts->type)
|
||||
{
|
||||
foreach ($typesFichier as $dir)
|
||||
{
|
||||
if ($opts->all || $opts->type==$dir ){
|
||||
removeFileInDir(LOG_PATH.'/'.$dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function removeFileInDir($dir)
|
||||
{
|
||||
if (is_dir($dir)) {
|
||||
if ($dh = opendir($dir)) {
|
||||
while (($file = readdir($dh)) !== false) {
|
||||
unlink($dir . $file);
|
||||
}
|
||||
closedir($dh);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
443
bin/greffe.php
443
bin/greffe.php
@ -1,443 +0,0 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../application/bin.bootstrap.php';
|
||||
|
||||
// --- Options
|
||||
$displayUsage = false;
|
||||
try {
|
||||
$opts = new Zend_Console_Getopt(array(
|
||||
'help|?' => "Affiche l'aide.",
|
||||
'list' => "Liste les actes en attente disponible sur le FTP et affiche les informations",
|
||||
'get-s' => "Recupère seulement les actes du FTP (un seul document si la référence est spécifier G<NNN> )",
|
||||
'send-s' => "Récupère les actes et envoi un mail à chaque client (un seul acte si la référence est spécifier G<NNN>)",
|
||||
'type-s' => "Type de document : bilan, acte",
|
||||
));
|
||||
$opts->parse();
|
||||
$optionsNb = count($opts->getOptions());
|
||||
} catch (Zend_Console_Getopt_Exception $e) {
|
||||
$displayUsage = true;
|
||||
}
|
||||
|
||||
// --- Aide / Options
|
||||
if ($optionsNb == 0 || isset($opts->help)) {
|
||||
$displayUsage = true;
|
||||
}
|
||||
|
||||
// --- Usage
|
||||
if ($displayUsage) {
|
||||
echo "Vérifie les actes numérisés reçus en provenance des Greffes.";
|
||||
echo "\n\n";
|
||||
echo $opts->getUsageMessage();
|
||||
echo "\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
$testMail = false;
|
||||
|
||||
$test = false;
|
||||
if (isset($opts->list)){
|
||||
$test = true;
|
||||
}
|
||||
|
||||
$types = array('bi', 'ac');
|
||||
|
||||
// Configuration FTP
|
||||
define ('ACTES_IGNUM_FTP_URL', 'ftp.scores-decisions.com');
|
||||
define ('ACTES_IGNUM_FTP_USER', 'mpc2500');
|
||||
define ('ACTES_IGNUM_FTP_PASS', 'passmpc78');
|
||||
|
||||
$pathIn = $c->profil->path->shared.'/files';
|
||||
|
||||
$report_email = $c->profil->mail->email->support;
|
||||
$report_subject = 'Traitement des actes '.date('Y-m-d H:i:s');
|
||||
$report_txt = '';
|
||||
|
||||
function sendMail($commande, $type){
|
||||
$subject = "Actes ou Statuts disponible pour ".$commande->raisonSociale.' ('.$commande->siren.')';
|
||||
$message = "Bonjour,\n\n";
|
||||
$message.= "Le document commandé pour ".$commande->raisonSociale." (siren ".$commande->siren.") est disponible en téléchargement sur le site de Scores & Décisions.\r\n\r\n";
|
||||
if ($commande->refClient!='') {
|
||||
$message = "Votre référence : ".$commande->refClient."\r\n\r\n";
|
||||
}
|
||||
switch ( $type ) {
|
||||
case 'BI':
|
||||
$dateBilan = substr($commande->bilanCloture,8,2).'/'.substr($commande->bilanCloture,5,2).'/'.substr($commande->bilanCloture,0,4);
|
||||
$message.= "Bilan cloturé le ".$dateBilan;
|
||||
break;
|
||||
case 'AC':
|
||||
$dateActe = substr($commande->acteDate,8,2).'/'.substr($commande->acteDate,5,2).'/'.substr($commande->acteDate,0,4);
|
||||
$dateDepot = substr($commande->depotDate,8,2).'/'.substr($commande->depotDate,5,2).'/'.substr($commande->depotDate,0,4);
|
||||
$message.= "Acte n°".$commande->acteNum." du ".$dateActe." (Dépot n°".$commande->depotNum." du ".$dateDepot.") ";
|
||||
break;
|
||||
}
|
||||
$message.= "\n\n";
|
||||
|
||||
$message.= "Consulter la fiche identité http://extranet.scores-decisions.com/identite/fiche/siret/".$commande->siren.", puis rubrique \"Pieces Officielles\"\n";
|
||||
|
||||
$message.= "ou directement depuis la page suivante http://extranet.scores-decisions.com/pieces";
|
||||
switch ( $type ) {
|
||||
case 'BI':
|
||||
$message.= "/bilans/siret/".$commande->siren;
|
||||
break;
|
||||
case 'AC':
|
||||
$message.= "/actes/siret/".$commande->siren;
|
||||
break;
|
||||
}
|
||||
$message.= "\n\n";
|
||||
|
||||
$message.= "Bien cordialement, \n";
|
||||
$message.= "Le service support.\n";
|
||||
$message.= "\n";
|
||||
|
||||
$message.= "--";
|
||||
|
||||
$message.= "\n\n";
|
||||
|
||||
$message.= "SCORES & DECISIONS";
|
||||
$message.= "\n";
|
||||
$message.= "Service support";
|
||||
$message.= "\n";
|
||||
$message.= "1, rue de Clairefontaine - 78120 RAMBOUILLET";
|
||||
$message.= "\n";
|
||||
$message.= "tél : 0 811 261 216";
|
||||
$message.= "\n";
|
||||
$message.= "fax : 33 (0)1 75 43 85 74";
|
||||
$message.= "\n";
|
||||
$message.= "support@scores-decisions.com";
|
||||
$message.= "\n";
|
||||
$message.= "http://www.scores-decisions.com/";
|
||||
$message.= "\n";
|
||||
$message.= "Scores & Décisions est l'acteur nouvelle génération de l'information et de l'évaluation des entreprises";
|
||||
|
||||
$message.= "\n\n";
|
||||
|
||||
$message.= "Pensez à l'environnement avant d'imprimer ce message !";
|
||||
$message.= "\n";
|
||||
$message.= "Save paper - think before you print";
|
||||
$message.= "\n";
|
||||
|
||||
$headers = 'From: support@scores-decisions.com' . "\r\n" .
|
||||
'Reply-To: support@scores-decisions.com';
|
||||
|
||||
if ( mail(strtolower($commande->email), $subject, utf8_decode($message), $headers) ){
|
||||
echo date ('Y/m/d - H:i:s').' - Un email a été envoyé à '.$commande->email." pour la commande ".$commande->id.".\n";
|
||||
return true;
|
||||
} else {
|
||||
echo date ('Y/m/d - H:i:s').' - ERREUR : Impossible d\'envoyer l\'email à '.$commande->email." pour la commande ".$commande->id.".\n";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Liste des commandes non traités depuis la base de données
|
||||
*/
|
||||
$tabCommandes = array();
|
||||
if (in_array('ac', $types)) {
|
||||
$sql = "SELECT * FROM sdv1.greffe_commandes_ac WHERE mode=:mode AND dateCommande!=:commande AND dateEnvoi=:envoi";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->bindValue('mode', 'C');
|
||||
$stmt->bindValue('commande', '0000-00-00 00:00:00');
|
||||
$stmt->bindValue('envoi', '0000-00-00 00:00:00');
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
while ($row = $stmt->fetch(\PDO::FETCH_OBJ)) {
|
||||
$tabCommandes['G-AC-'.$row->id] = $row;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (in_array('bi', $types)) {
|
||||
$sql = "SELECT * FROM sdv1.greffe_commandes_bi WHERE mode=:mode AND dateCommande!=:commande AND dateEnvoi=:envoi";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->bindValue('mode', 'C');
|
||||
$stmt->bindValue('commande', '0000-00-00 00:00:00');
|
||||
$stmt->bindValue('envoi', '0000-00-00 00:00:00');
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
while ($row = $stmt->fetch(\PDO::FETCH_OBJ)) {
|
||||
$tabCommandes['G-BI-'.$row->id] = $row;
|
||||
}
|
||||
}
|
||||
}
|
||||
$nbCommandes = count($tabCommandes);
|
||||
echo date('Y/m/d - H:i:s') ." - Il y a $nbCommandes commandes en attente de réception courrier ou numérisation !\n";
|
||||
|
||||
/**
|
||||
* Connexion au site FTP pour la récupération de la liste des fichiers au format pdf
|
||||
*/
|
||||
$conn_id = ftp_connect(ACTES_IGNUM_FTP_URL);
|
||||
if (!$conn_id) {
|
||||
echo date ('Y/m/d - H:i:s')." - ERREUR : Impossible de se connecter au serveur FTP (".ACTES_IGNUM_FTP_URL.") !\n";
|
||||
exit;
|
||||
}
|
||||
$login_result = ftp_login($conn_id, ACTES_IGNUM_FTP_USER, ACTES_IGNUM_FTP_PASS);
|
||||
if (!$login_result) {
|
||||
echo date ('Y/m/d - H:i:s')." - ERREUR : Impossible de s'authentifier sur le serveur FTP (".ACTES_IGNUM_FTP_URL.")!\n";
|
||||
exit;
|
||||
}
|
||||
ftp_pasv($conn_id, true);
|
||||
$contents = ftp_nlist($conn_id, "*.pdf");
|
||||
if ($contents === false) {
|
||||
echo date ('Y/m/d - H:i:s')." - ERREUR : Impossible de se connecter au serveur FTP (".ACTES_IGNUM_FTP_URL.") !\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Liste de tout les fichiers disponible dans le repertoire
|
||||
* et associe une clé pour faciliter le tri
|
||||
*/
|
||||
$tabFichiersFtp = array();
|
||||
foreach ($contents as $filename){
|
||||
$indice = 0;
|
||||
$f = strtolower($filename);
|
||||
if (preg_match('/g-(ac|bi)-[0-9]+\.pdf/', $f)
|
||||
|| preg_match('/g-(ac|bi)-[0-9]+-[0-9]{1,2}\.pdf/', $f)) {
|
||||
$part = substr(str_replace('.pdf', '', $f), 5);
|
||||
$p = strpos($part, '-');
|
||||
if ( $p === false ) {
|
||||
$ref = substr($f, 0, 5) . $part;
|
||||
$indice = 0;
|
||||
} else {
|
||||
$ref = substr($f, 0, 5) . substr($part, 0, $p);
|
||||
$indice = substr($part, $p+1);
|
||||
}
|
||||
$tabFichiersFtp[strtoupper($ref).'-'.$indice] = $filename;
|
||||
}
|
||||
// Fichiers en anomalies
|
||||
else {
|
||||
if ($test) {
|
||||
echo "Erreur : Anomalie fichier numérisé $filename\n";
|
||||
} else {
|
||||
$subject = "Erreur : Anomalie fichier numérisé";
|
||||
$message = "Le fichier $filename a été trouvé et ne correspond pas au format attendu";
|
||||
$headers = 'From: supportdev@scores-decisions.com' . "\r\n" .
|
||||
'Reply-To: supportdev@scores-decisions.com';
|
||||
mail('supportdev@scores-decisions.com', $subject, $message, $headers);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tri des fichiers par ordre décroissant
|
||||
* Les noms des fichiers sont incrémenté par 1
|
||||
*/
|
||||
krsort($tabFichiersFtp);
|
||||
|
||||
/**
|
||||
* Dans le cas ou il y a eu une erreur de scan, la production passe a nouveau le
|
||||
* document dans le scanner et le fichier est envoyé sur le ftp
|
||||
* Le document est nommé G[ref],G[ref]-1,G[ref]-2,.....pdf.
|
||||
* On garde donc le dernier document scanné.
|
||||
*/
|
||||
$lastRef = '';
|
||||
$tabFichiersTemp = array();
|
||||
foreach($tabFichiersFtp as $k => $val) {
|
||||
$part = substr($k, 5);
|
||||
$p = strpos($part, '-');
|
||||
if ($p === false) {
|
||||
$ref = substr($k, 0, 5) . $part;
|
||||
} else {
|
||||
$ref = substr($k, 0, 5) . substr($part, 0, $p);
|
||||
}
|
||||
|
||||
if( $lastRef != $ref ) {
|
||||
$tabFichiersTemp[$ref] = $val;
|
||||
}
|
||||
$lastRef = $ref;
|
||||
|
||||
}
|
||||
$tabFichiers = $tabFichiersTemp;
|
||||
unset($tabFichiersTemp);
|
||||
|
||||
/**
|
||||
* Pour chaque commande, test de la présence d'un fichier associé
|
||||
* Si le fichier correspond téléchargement du fichier
|
||||
*/
|
||||
foreach ($tabCommandes as $ref => $commande) {
|
||||
foreach ($tabFichiers as $refAssocie => $fichier) {
|
||||
|
||||
if ($ref == $refAssocie) {
|
||||
echo date ('Y/m/d - H:i:s')." - Traitement de la commande $ref\n";
|
||||
if ($test) {
|
||||
echo date ('Y/m/d - H:i:s')." - Fichier $fichier \n";
|
||||
} else {
|
||||
// Récupération du fichier depuis le FTP (s'il n'existe pas déjà)
|
||||
if (!file_exists($pathIn.'/'.$fichier)) {
|
||||
if (ftp_get($conn_id, $pathIn.'/'.$fichier, $fichier, FTP_BINARY, 0)) {
|
||||
echo date ('Y/m/d - H:i:s')." - Fichier $fichier téléchargé depuis le serveur FTP.\n";
|
||||
} else {
|
||||
echo date ('Y/m/d - H:i:s')." - ERREUR : Impossible de télécharger le fichier $fichier !\n";
|
||||
}
|
||||
}
|
||||
|
||||
switch (substr($ref,2,2)) {
|
||||
case 'BI':
|
||||
$infogreffe = new Metier_Infogreffe_DocBI();
|
||||
$infogreffe->setSiren($commande->siren);
|
||||
//Format date cloture
|
||||
$dateCloture = substr($commande->bilanCloture,0,4) . '-' .
|
||||
substr($commande->bilanCloture,5,2) . '-' .
|
||||
substr($commande->bilanCloture,8,2);
|
||||
$path = $infogreffe->getFilePath($commande->bilanType, $dateCloture);
|
||||
$nomCible = $infogreffe->getFileName($commande->bilanType, $dateCloture);
|
||||
$fileOut = $c->profil->infogreffe->storage->path.'/'.$path.'/'.$nomCible;
|
||||
|
||||
$isFileOnStorage = false;
|
||||
if (file_exists($fileOut)) {
|
||||
$isFileOnStorage = true;
|
||||
echo date ('Y/m/d - H:i:s')." - Fichier ".$pathIn.'/'.$fichier." déjà présent en ".$fileOut.".\n";
|
||||
} else {
|
||||
if (copy($pathIn.'/'.$fichier, $fileOut)) {
|
||||
$isFileOnStorage = true;
|
||||
echo date ('Y/m/d - H:i:s')." - Fichier ".$pathIn.'/'.$fichier." déplacé en ".$fileOut.".\n";
|
||||
} else {
|
||||
echo date ('Y/m/d - H:i:s')." ERREUR - Impossible de déplacer ".$pathIn.'/'.$fichier." en ".$fileOut." !\n";
|
||||
}
|
||||
}
|
||||
|
||||
// --- Lecture présence référence bilan
|
||||
if ($commande->bilanType=='sociaux') {
|
||||
$sql = "SELECT * FROM jo.greffes_bilans WHERE siren=:siren AND date_cloture=:cloture AND type_comptes='' OR type_comptes='sociaux'";
|
||||
} else {
|
||||
$sql = "SELECT * FROM jo.greffes_bilans WHERE siren=:siren AND date_cloture=:cloture AND type_comptes='consolides'";
|
||||
}
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $commande->siren);
|
||||
$stmt->bindValue('cloture', $dateCloture);
|
||||
$stmt->execute();
|
||||
$item = $stmt->fetch(\PDO::FETCH_OBJ);
|
||||
|
||||
// --- Enregistrement
|
||||
if ($isFileOnStorage && $item->pdfDate == '0000-00-00') {
|
||||
$infos = $infogreffe->pdfInfos($fileOut);
|
||||
if (false !== $infos) {
|
||||
$data = array(
|
||||
'pdfLink' => $nomCible,
|
||||
'pdfSize' => $infos['size'],
|
||||
'pdfPage' => $infos['pages'],
|
||||
'pdfVer' => $infos['version'],
|
||||
'pdfDate' => date('Ymd'),
|
||||
);
|
||||
try {
|
||||
$conn->update('jo.greffes_bilans', $data, array('id' => $item->id));
|
||||
} catch(\Doctrine\DBAL\DBALException $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'AC':
|
||||
$sql = "SELECT id, siren, numRC, LPAD(numGreffe,4,0) AS numGreffe, pdfLink,
|
||||
pdfSize, pdfPage, pdfDate, num_depot, date_depot, date_acte,
|
||||
LPAD(num_acte,2,0) AS num_acte, type_acte, type_acte_libelle,
|
||||
nbpages_acte, decision_nature, decision_libelle FROM jo.greffes_actes
|
||||
WHERE siren=:siren AND num_depot=:depot AND num_acte=:acte AND type_acte=:type";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $commande->siren);
|
||||
$stmt->bindValue('depot', $commande->depotNum);
|
||||
$stmt->bindValue('acte', $commande->acteNum);
|
||||
$stmt->bindValue('type', $commande->acteType);
|
||||
$stmt->execute();
|
||||
$item = $stmt->fetch(\PDO::FETCH_OBJ);
|
||||
|
||||
$infogreffe = new Metier_Infogreffe_DocAC();
|
||||
$infogreffe->setSiren($commande->siren);
|
||||
$date = $commande->acteDate;
|
||||
if ($date == '0000-00-00') {
|
||||
$date = $commande->depotDate;
|
||||
}
|
||||
|
||||
$path = $infogreffe->getFilePath($date);
|
||||
//(Numéro du Greffe)-(dossier_millesime)-(dossier_statut)-(dossier_chrono)-(num_depot)
|
||||
$options = $item->numGreffe . '-' . substr($item->numRC,0,2) . '-' . substr($item->numRC,2,1) . '-' . substr($item->numRC,3) . '-' . $item->num_depot;
|
||||
$nomCible = $infogreffe->getFileName($date, $commande->acteNum, $commande->acteType, $options);
|
||||
|
||||
$fileOut = $c->profil->infogreffe->storage->path.'/'.$path.'/'.$nomCible;
|
||||
|
||||
$isFileOnStorage = false;
|
||||
|
||||
if (file_exists($fileOut)) {
|
||||
$isFileOnStorage = true;
|
||||
echo date ('Y/m/d - H:i:s')." - Fichier ".$pathIn.'/'.$fichier." déjà présent en ".$fileOut.".\n";
|
||||
} else {
|
||||
if (copy($pathIn.'/'.$fichier, $fileOut)) {
|
||||
$isFileOnStorage = true;
|
||||
echo date ('Y/m/d - H:i:s')." - Fichier ".$pathIn.'/'.$fichier." déplacé en ".$fileOut.".\n";
|
||||
} else {
|
||||
echo date ('Y/m/d - H:i:s')." ERREUR - Impossible de déplacer ".$pathIn.'/'.$fichier." en ".$fileOut." !\n";
|
||||
}
|
||||
}
|
||||
|
||||
if ($isFileOnStorage && $item->pdfDate == '0000-00-00') {
|
||||
$infos = $infogreffe->pdfInfos($fileOut);
|
||||
if ( false !== $infos ) {
|
||||
$data = array(
|
||||
'pdfLink' => $nomCible,
|
||||
'pdfSize' => $infos['size'],
|
||||
'pdfPage' => $infos['pages'],
|
||||
'pdfVer' => $infos['version'],
|
||||
'pdfDate' => date('Ymd'),
|
||||
);
|
||||
try {
|
||||
$conn->update('jo.greffes_actes', $data, array('id' => $item->id));
|
||||
echo " = enregistrement.\n";
|
||||
} catch(\Doctrine\DBAL\DBALException $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// Envoi du mail et Mise à jour de la commande
|
||||
if (file_exists($fileOut)) {
|
||||
if ( $testMail ) {
|
||||
echo "Envoi fichier $nomCible ($ref) à ".$commande->email;
|
||||
} else {
|
||||
$report_txt.= "$ref intégré à l'extranet";
|
||||
$isMailSent = false;
|
||||
if (trim($commande->email)!=''){
|
||||
$isMailSent = sendMail($commande, substr($ref,2,2));
|
||||
} else {
|
||||
$isMailSent = true;
|
||||
}
|
||||
if ( $isMailSent ) {
|
||||
$data = array( 'dateEnvoi' => date('YmdHis'));
|
||||
switch ( substr($ref,2,2) ) {
|
||||
case 'BI':
|
||||
$conn->update('sdv1.greffe_commandes_bi', $data, array('id' => $commande->id));
|
||||
break;
|
||||
case 'AC':
|
||||
$conn->update('sdv1.greffe_commandes_ac', $data, array('id' => $commande->id));
|
||||
break;
|
||||
}
|
||||
echo date ('Y/m/d - H:i:s')." - Commande $ref mise à jour\n";
|
||||
$report_txt.= ' - Email envoyé à '.$commande->email;
|
||||
} else {
|
||||
$report_txt.= ' - Email non envoyé !';
|
||||
echo date ('Y/m/d - H:i:s')." ERREUR - Email non envoyé et commande $ref non mise à jour\n";
|
||||
}
|
||||
$report_txt.= "\n";
|
||||
}
|
||||
} // Fin envoi mail
|
||||
}
|
||||
} // Fin condition ref
|
||||
}
|
||||
}
|
||||
ftp_close($conn_id);
|
||||
|
||||
if (empty($report_txt)) {
|
||||
$report_txt = "Aucun envoi.";
|
||||
}
|
||||
|
||||
//Envoi du mail de rapport
|
||||
if (!$test && !$testMail){
|
||||
$headers = 'From: supportdev@scores-decisions.com';
|
||||
if (mail($report_email, $report_subject, utf8_decode($report_txt))){
|
||||
echo date ('Y/m/d - H:i:s')." - Rapport envoyé.\n";
|
||||
} else {
|
||||
echo date ('Y/m/d - H:i:s')." - Erreur lors de l'envoir du rapport !\n";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
599
bin/kbis.php
599
bin/kbis.php
@ -1,599 +0,0 @@
|
||||
#!/usr/bin/php
|
||||
<?php
|
||||
require_once __DIR__ . '/../application/bin.bootstrap.php';
|
||||
|
||||
// --- Options
|
||||
$displayUsage = false;
|
||||
try {
|
||||
$opts = new Zend_Console_Getopt(
|
||||
//Options
|
||||
array(
|
||||
'help|?' => "Affiche l'aide.",
|
||||
'siren=s' => "Commander un kbis",
|
||||
'commandes' => "Liste les commandes passees (Reference), si reference alors recupere le kbis",
|
||||
'visu=s' => "Telechargement du kbis avec une reference (--commandes obligatoire)",
|
||||
'debug' => "Mode debug",
|
||||
)
|
||||
);
|
||||
$opts->parse();
|
||||
$optionsNb = count($opts->getOptions());
|
||||
} catch (Zend_Console_Getopt_Exception $e) {
|
||||
$displayUsage = true;
|
||||
}
|
||||
|
||||
// --- Aide / Options
|
||||
if ($optionsNb == 0 || isset($opts->help)) {
|
||||
$displayUsage = true;
|
||||
}
|
||||
|
||||
// --- Usage
|
||||
if ($displayUsage) {
|
||||
echo "Telecharge le kbis chez infogreffe.";
|
||||
echo "\n\n";
|
||||
echo $opts->getUsageMessage();
|
||||
echo "\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( isset($opts->debug) ) {
|
||||
define('DEBUG', true);
|
||||
} else {
|
||||
define('DEBUG', false);
|
||||
}
|
||||
|
||||
function getPageHeader($start,$end,$header)
|
||||
{
|
||||
$pattern = '/'. $start .'(.*)'. $end .'/';
|
||||
if (preg_match($pattern, $header, $result)) {
|
||||
return $result[1];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function getPage($url, $curl_data = '', $override = null)
|
||||
{
|
||||
global $ckfile;
|
||||
|
||||
//$user_agent = 'Mozilla/5.0 (Windows NT 5.1; rv:9.0.1) Gecko/20100101 Firefox/9.0.1';
|
||||
//$user_agent = 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)';
|
||||
$user_agent = 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)';
|
||||
|
||||
$verbose = false;
|
||||
$post = false;
|
||||
$fields = '';
|
||||
if (is_array($curl_data) && count($curl_data)>0) {
|
||||
foreach($curl_data as $key=>$value) {
|
||||
$fields .= $key.'='.$value.'&';
|
||||
}
|
||||
rtrim($fields,'&');
|
||||
$post = true;
|
||||
}
|
||||
|
||||
$options = array(
|
||||
CURLOPT_RETURNTRANSFER => true, // return web page
|
||||
CURLOPT_HEADER => false, // don't return headers
|
||||
CURLOPT_FOLLOWLOCATION => false, // follow redirects
|
||||
CURLOPT_ENCODING => "", // handle all encodings
|
||||
CURLOPT_USERAGENT => $user_agent, // who am i
|
||||
CURLOPT_AUTOREFERER => true, // set referer on redirect
|
||||
CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect
|
||||
CURLOPT_TIMEOUT => 120, // timeout on response
|
||||
CURLOPT_MAXREDIRS => 10, // stop after 10 redirects
|
||||
CURLOPT_POST => $post, // i am sending post data
|
||||
CURLOPT_POSTFIELDS => $fields, // this are my post vars
|
||||
CURLOPT_SSL_VERIFYHOST => 0, // don't verify ssl
|
||||
CURLOPT_SSL_VERIFYPEER => false, //
|
||||
CURLOPT_VERBOSE => $verbose , //
|
||||
//CURLOPT_COOKIESESSION => true,
|
||||
CURLOPT_COOKIEFILE => $ckfile,
|
||||
CURLOPT_COOKIEJAR => $ckfile, // Stockage du cookie de session
|
||||
);
|
||||
|
||||
//Override define CURL option
|
||||
if (is_array($override) && count($override)>0 ) {
|
||||
$options = $override + $options;
|
||||
}
|
||||
|
||||
$ch = curl_init($url);
|
||||
curl_setopt_array($ch,$options);
|
||||
$content = curl_exec($ch);
|
||||
$err = curl_errno($ch);
|
||||
$errmsg = curl_error($ch) ;
|
||||
$header = curl_getinfo($ch);
|
||||
curl_close($ch);
|
||||
|
||||
//Rewrite encoding to UTF-8
|
||||
//text/html; charset=ISO-8859-1
|
||||
//$encoding = getPageHeader('text\/html; charset=', '', $header['content_type']);
|
||||
//$encoding = 'ISO-8859-1';
|
||||
//$content = iconv($encoding, 'UTF-8//TRANSLIT', $content);
|
||||
|
||||
// $header['errno'] = $err;
|
||||
// $header['errmsg'] = $errmsg;
|
||||
// $header['content'] = $content;
|
||||
return array('header'=>$header, 'content'=>$content);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retourne l'url après une page 302
|
||||
* @param string $content
|
||||
* @return string|boolean
|
||||
*/
|
||||
function getUrl302($content)
|
||||
{
|
||||
$url = false;
|
||||
preg_match('/\<title\>(.*)\<\/title\>/', $content, $matches);
|
||||
if ($matches[1]=='302 Moved Temporarily') {
|
||||
preg_match('/\<a href="(.*)"\>/', $content, $matches);
|
||||
$url = $matches[1];
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
||||
//Define Main URL
|
||||
$siteUrl = "https://www2.infogreffe.fr";
|
||||
|
||||
function infogreffeConnexion()
|
||||
{
|
||||
global $siteUrl;
|
||||
|
||||
$url = $siteUrl . "/infogreffe/index.jsp";
|
||||
$result = getPage($url);
|
||||
if (DEBUG) file_put_contents('kbis-connexion1.html', $result['content']);
|
||||
|
||||
$url = $siteUrl . "/infogreffe/popupLog.jsp?type=0&url=index.jsp";
|
||||
$result = getPage($url);
|
||||
if (DEBUG) file_put_contents('kbis-connexion2.html', $result['content']);
|
||||
|
||||
$url = $siteUrl . "/infogreffe/login.do?redirect=index.jsp";
|
||||
// 302 Moved Temporarily
|
||||
// => http://www.infogreffe.fr/infogreffe/index.jsp
|
||||
$data = array(
|
||||
'codeAbo'=>'2559',
|
||||
'codeClt'=>'0041',
|
||||
'log'=>'',
|
||||
'pwd'=>'69873',
|
||||
);
|
||||
$result = getPage($url, $data);
|
||||
if (DEBUG) file_put_contents('kbis-connexion3.html', $result['content']);
|
||||
|
||||
/*
|
||||
We need to have
|
||||
<div style="margin-top:2px; *margin-top:0px;" class="identBar">
|
||||
|
||||
<span class="name">Abonné</span> |
|
||||
<a href="/infogreffe/jsp/information/monCompte.jsp">Mon compte</a> |
|
||||
<a href="/infogreffe/afficherMesAchats.do?refCde=N">Documents Commandés</a>
|
||||
| <a href="/infogreffe/deconnexion.do">Se déconnecter</a>
|
||||
</div>
|
||||
*/
|
||||
}
|
||||
|
||||
function infogreffeKbis($ref)
|
||||
{
|
||||
global $siteUrl;
|
||||
/**************************************************
|
||||
afficheProduit
|
||||
**************************************************/
|
||||
$url = $siteUrl . "/infogreffe/chargement.jsp?oups=".$ref."_0_V_0_";
|
||||
$result = getPage($url);
|
||||
if (DEBUG) file_put_contents('kbis-afficheproduit.html', $result['content']);
|
||||
|
||||
//Redirection javascript qui fait patienter
|
||||
sleep(1);
|
||||
/**************************************************
|
||||
serviceProduit
|
||||
**************************************************/
|
||||
$url = $siteUrl . "/infogreffe/serviceProduit.do?cdePro=".$ref."_0_V_0_";
|
||||
$result = getPage($url);
|
||||
if (DEBUG) file_put_contents('kbis-serviceproduit.html', $result['content']);
|
||||
|
||||
$output = $result['content'];
|
||||
|
||||
//Modification du code HTML pour impression
|
||||
$output = removeTag('script', $output, true, true);
|
||||
|
||||
$output = str_replace('/infogreffe/styles/infogreffe_base.css', '../styles/infogreffe_base.css', $output);
|
||||
$output = str_replace('/infogreffe/styles/infogreffe.css', '../styles/infogreffe.css', $output);
|
||||
|
||||
$output = preg_replace(
|
||||
'/\<body onload="adapterDimensions(\'conteneur\');" class="simple preventSelection" style="background-color: rgb(241, 241, 241);">/',
|
||||
'<body class="simple preventSelection" style="background-color: rgb(241, 241, 241);">',
|
||||
$output
|
||||
);
|
||||
|
||||
//Récupération des informations dans le kbis
|
||||
//<td align="left" valign="top" class="label">Numéro d'identification :</td><td>509 536 371 R.C.S. PONTOISE</td>
|
||||
|
||||
preg_match('/([0-9]{3}\s[0-9]{3}\s[0-9]{3})\sR\.C\.S\./', $output, $matches);
|
||||
|
||||
if (count($matches)>1){
|
||||
$identifiant = str_replace(' ', '',$matches[1]);
|
||||
} else {
|
||||
$identifiant = 'unknown';
|
||||
}
|
||||
$fichier = $identifiant . '-' . $ref . '.html';
|
||||
|
||||
global $c;
|
||||
$dir = realpath($c->profil->path->shared).'/datafile/kbis/'.date('Ymd');
|
||||
if (!file_exists($dir)) mkdir($dir);
|
||||
file_put_contents($dir . '/' . $fichier, $output);
|
||||
return ($identifiant!='unknown') ? $identifiant : false;
|
||||
}
|
||||
|
||||
function removeTag($balise, $content, $endOfTag = true, $removeContent = true)
|
||||
{
|
||||
if( $endOfTag )
|
||||
{
|
||||
if( $removeContent)
|
||||
$output = preg_replace(
|
||||
'@<'.$balise.'[^>]*?>.*?</'.$balise.'>@si',
|
||||
'',
|
||||
$content
|
||||
);
|
||||
else
|
||||
$output = preg_replace(
|
||||
array('@<'.$balise.'[^>]*?>@', '@</'.$balise.'>@'),
|
||||
'',
|
||||
$content
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$output = preg_replace(
|
||||
'@<'.$balise.'[^>]*?>@',
|
||||
'',
|
||||
$content
|
||||
);
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
function parseRef($document)
|
||||
{
|
||||
$doc = new DOMDocument();
|
||||
$doc->strictErrorChecking = false;
|
||||
$doc->preserveWhiteSpace = false;
|
||||
@$doc->loadHTML($document);
|
||||
$xpath = new DOMXpath($doc);
|
||||
|
||||
//Recherche des infos de la première commande
|
||||
$nodelist = $xpath->query("//a/img[@alt='visualiser']");
|
||||
foreach ($nodelist as $n){
|
||||
$href = $n->parentNode->getAttribute('href');
|
||||
preg_match("/javascript:afficheProduit\(\'(.*)_0_V_0_\'/", $href, $matches);
|
||||
$ref = $matches[1];
|
||||
}
|
||||
//Recherche Raison Sociale
|
||||
$nodelist = $xpath->query("//span[@class='text-company']/a");
|
||||
foreach ($nodelist as $n){
|
||||
$rs = $n->nodeValue;
|
||||
break;
|
||||
}
|
||||
//Recherche RCS
|
||||
$nodelist = $xpath->query("//span[@class='text-rcs']");
|
||||
foreach ($nodelist as $n){
|
||||
$rcs = $n->nodeValue;
|
||||
break;
|
||||
}
|
||||
return array(
|
||||
'ref' => $ref,
|
||||
'rs' => $rs,
|
||||
'rcs' => $rcs,
|
||||
);
|
||||
}
|
||||
|
||||
//Define cookie file for storage
|
||||
//@todo : Faire en sorte d'utiliser le cookie pendant un temps déterminé, ou nouvelle session à chaque fois
|
||||
$ckfile = __DIR__.'/'.uniqid('cookie-');
|
||||
if (file_exists($ckfile)) unlink($ckfile);
|
||||
|
||||
// Récupération de la liste des commandes et
|
||||
if ( $opts->commandes )
|
||||
{
|
||||
$referer = '';
|
||||
|
||||
/**************************************************
|
||||
Connexion
|
||||
**************************************************/
|
||||
infogreffeConnexion();
|
||||
|
||||
$url = $siteUrl . "/infogreffe/jsp/information/monCompte.jsp";
|
||||
$result = getPage($url);
|
||||
if (DEBUG) file_put_contents('kbis-moncompte.html', $result['content']);
|
||||
|
||||
/**************************************************
|
||||
Documents commandés
|
||||
**************************************************/
|
||||
$url = $siteUrl . "/infogreffe/afficherMesAchats.do?refCde=N";
|
||||
$result = getPage($url);
|
||||
if (DEBUG) file_put_contents('documents.html', $result['content']);
|
||||
|
||||
//On parse le document pour trouver les références de commandes
|
||||
$refs = array();
|
||||
|
||||
$tmp = parseRef($result['content']);
|
||||
$refs[] = $tmp;
|
||||
|
||||
//Liste des commandes
|
||||
$nodelist = $xpath->query("//a[@class='folded-fond-gris']");
|
||||
foreach ($nodelist as $n){
|
||||
$href = $n->getAttribute('href');
|
||||
preg_match("/javascript:reveal\(\'(.*)\'\)/", $href, $matches);
|
||||
$refs[] = array( 'ref' => $matches[1] );
|
||||
}
|
||||
|
||||
$listeRef = array();
|
||||
foreach($refs as $item){
|
||||
$listeRef[] = $item['ref'];
|
||||
}
|
||||
|
||||
if ( $opts->visu && in_array($opts->visu, $listeRef) )
|
||||
{
|
||||
//Pour toutes les commandes en dehors de la toute dernière
|
||||
if ( array_search($opts->visu, $listeRef)!=0 ){
|
||||
$url = $siteUrl . "/infogreffe/chargerContenuCommande.do?refCde=".$opts->visu."&_=";
|
||||
$result = getPage($url);
|
||||
if (DEBUG) file_put_contents('documents-'.$ref['ref'].'.html', $result['content']);
|
||||
}
|
||||
|
||||
echo "Téléchargement du kbis...\n";
|
||||
infogreffeKbis($opts->visu);
|
||||
|
||||
} elseif ( !$opts->visu ) {
|
||||
|
||||
/**************************************************
|
||||
Reveal : Ajax pour mettre à jour le div
|
||||
**************************************************/
|
||||
// Parcourir le fichier précédent et relevé toute les références de commandes
|
||||
// http://www.infogreffe.fr/infogreffe/chargerContenuCommande.do?refCde=XNDAE&_=
|
||||
// Dans javascript la requete est réalisé en GET
|
||||
$i = 0;
|
||||
foreach ( $refs as $ref )
|
||||
{
|
||||
if ($i!=0){
|
||||
$url = $siteUrl . "/infogreffe/chargerContenuCommande.do?refCde=".$ref['ref']."&_=";
|
||||
$result = getPage($url);
|
||||
if (DEBUG) file_put_contents('documents-'.$ref['ref'].'.html', $result['content']);
|
||||
//@todo : Recup des informations
|
||||
$info = array();
|
||||
$info = parseRef($document);
|
||||
}
|
||||
echo $ref['ref'];
|
||||
if ( $info['ref']==$ref['ref'] ) {
|
||||
if ( !empty($info['rs']) ) echo " ".$info['rs'];
|
||||
if ( !empty($info['rcs']) ) echo " ".$info['rcs'];
|
||||
}
|
||||
echo "\n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Commande d'un kbis
|
||||
if ( $opts->siren )
|
||||
{
|
||||
//Vérification du siren
|
||||
if (strlen($opts->siren)!=9 && strlen($opts->siren)!=14) {
|
||||
echo "Erreur SIREN invalide\n"; exit;
|
||||
}
|
||||
$referer = '';
|
||||
|
||||
/**************************************************
|
||||
Connexion
|
||||
**************************************************/
|
||||
infogreffeConnexion();
|
||||
|
||||
/**************************************************
|
||||
Affichage formulaire
|
||||
**************************************************/
|
||||
$url = $siteUrl . "/infogreffe/index.jsp";
|
||||
$result = getPage($url);
|
||||
if (DEBUG) file_put_contents('kbis1.html', $result['content']);
|
||||
|
||||
/**************************************************
|
||||
Soumission formulaire
|
||||
**************************************************/
|
||||
$fields = array(
|
||||
'commune' => '',
|
||||
'denomination' => '',
|
||||
'departement' => '',
|
||||
//'elargirSecondaire' => 'on',
|
||||
'elargirRadie' => 'on',
|
||||
'siren' => $opts->siren,
|
||||
);
|
||||
$url = $siteUrl . "/infogreffe/newRechercheEntreprise.xml";
|
||||
$result = getPage($url, $fields);
|
||||
if (DEBUG) file_put_contents('kbis2.html', $result['content']);
|
||||
|
||||
// 302 Moved Temporarily - But we always use this URL
|
||||
$url = $siteUrl . '/infogreffe/entrepRech.do';
|
||||
|
||||
/**************************************************
|
||||
Affichage identite entreprise
|
||||
**************************************************/
|
||||
//url defini plus haut
|
||||
$result = getPage($url, '', array(CURLOPT_FOLLOWLOCATION => true));
|
||||
if (DEBUG) file_put_contents('kbis3.html', $result['content']);
|
||||
|
||||
/*
|
||||
* !! Attention !! Elargir aux radiés peut retourner plusieurs résultats
|
||||
*/
|
||||
$doc = new DOMDocument();
|
||||
$doc->strictErrorChecking = false;
|
||||
$doc->preserveWhiteSpace = false;
|
||||
@$doc->loadHTML($result['content']);
|
||||
$xpath = new DOMXpath($doc);
|
||||
$nodelist = $xpath->query("//div[@id='includeEntrepListe']");
|
||||
if ($nodelist->length>0) {
|
||||
$entries = $xpath->query("//a[@class='company']");
|
||||
foreach ($entries as $n) {
|
||||
$url = $siteUrl . $n->getAttribute('href');
|
||||
break;
|
||||
}
|
||||
$result = getPage($url);
|
||||
}
|
||||
|
||||
/*
|
||||
* Try to detect we can pass an order, else send message and exit
|
||||
*
|
||||
* Si la recherche a fonctionné
|
||||
* div[@id="libelleRcsGreffe"], nodeValue = "552 144 503 R.C.S. PARIS"
|
||||
*
|
||||
* Si pas de résultats lors de la recherche alors
|
||||
* table[@class='liste-res-rech']/tbody/tr[1]/td[1]/div/span[1]
|
||||
*/
|
||||
$doc = new DOMDocument();
|
||||
$doc->strictErrorChecking = false;
|
||||
$doc->preserveWhiteSpace = false;
|
||||
@$doc->loadHTML($result['content']);
|
||||
$xpath = new DOMXpath($doc);
|
||||
$nodelist = $xpath->query("//div[@id='libelleRcsGreffe']");
|
||||
if ($nodelist->length==0) {
|
||||
$entries = $xpath->query("//table[@class='liste-res-rech']/tbody/tr[1]/td[1]/div/span");
|
||||
if ($entries->length>0) {
|
||||
echo trim($entries->item(0)->nodeValue);
|
||||
} else {
|
||||
echo "ERREUR";
|
||||
}
|
||||
if (file_exists($ckfile)) unlink($ckfile);
|
||||
exit;
|
||||
}
|
||||
|
||||
/*
|
||||
* Si les documents sont disponibles
|
||||
* <a onclick="reveal('kbis');return false" href="#" id="a_kbis" class="folded">Extrait RCS (Kbis)</a>
|
||||
*
|
||||
* Sinon rechercher la valeur du message
|
||||
* "//div[@id='conteneur']/table/tbody/tr/td/table/tbody/tr[2]/td/table[2]/tbody/tr[last()-2]/td";
|
||||
*/
|
||||
$nodelist = $xpath->query("//a[@id='a_kbis']");
|
||||
if ($nodelist->length==0) {
|
||||
$div = $xpath->query("//div[@id='conteneur']");
|
||||
$context = $div->item(0);
|
||||
$entries = $xpath->query("table/tbody/tr/td/table/tbody/tr[2]/td/table[2]/tbody/tr[9]/td", $context);
|
||||
|
||||
if ($entries->length!=0) {
|
||||
$message = $entries->item(0)->nodeValue;
|
||||
echo trim($message);
|
||||
} else {
|
||||
$entries = $xpath->query("//span[@class='texte-standard']", $context);
|
||||
if ($entries->length!=0) {
|
||||
$message = $entries->item(0)->nodeValue;
|
||||
echo trim($message);
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists($ckfile)) unlink($ckfile);
|
||||
exit;
|
||||
}
|
||||
|
||||
// 302 Moved Temporarily
|
||||
//http://www.infogreffe.fr/infogreffe/entrepListe.do?index=rcs
|
||||
if ( $result['header']['http_code']=='302' && array_key_exists('redirect_url', $result['header']) ) {
|
||||
$url = $result['header']['redirect_url'];
|
||||
$result = getPage($url);
|
||||
if (DEBUG) file_put_contents('kbis3-1.html', $result['content']);
|
||||
|
||||
// => /infogreffe/getEntrepDetail.do?docId=780308B042410000
|
||||
$doc = new DOMDocument();
|
||||
$doc->strictErrorChecking = false;
|
||||
$doc->preserveWhiteSpace = false;
|
||||
@$doc->loadHTML($result['content']);
|
||||
$xpath = new DOMXpath($doc);
|
||||
$nodelist = $xpath->query("//a[@class='company']");
|
||||
foreach ($nodelist as $n) {
|
||||
$url = $siteUrl . $n->getAttribute('href');
|
||||
break;
|
||||
}
|
||||
$result = getPage($url);
|
||||
if (DEBUG) file_put_contents('kbis3-2.html', $result['content']);
|
||||
} elseif ( $result['header']['http_code']=='302' ) {
|
||||
$url = $siteUrl . '/weblogic/infogreffe/entrepListe.do?index=rcs';
|
||||
$result = getPage($url);
|
||||
if (DEBUG) file_put_contents('kbis3-1.html', print_r($result,1));
|
||||
|
||||
$doc = new DOMDocument();
|
||||
$doc->strictErrorChecking = false;
|
||||
$doc->preserveWhiteSpace = false;
|
||||
@$doc->loadHTML($result['content']);
|
||||
$xpath = new DOMXpath($doc);
|
||||
$nodelist = $xpath->query("//a[@class='company']");
|
||||
foreach ($nodelist as $n) {
|
||||
$url = $siteUrl . $n->getAttribute('href');
|
||||
break;
|
||||
}
|
||||
$result = getPage($url);
|
||||
if (DEBUG) file_put_contents('kbis3-2.html', $result['content']);
|
||||
}
|
||||
|
||||
$fields = array();
|
||||
//Recherche des infos pour la validation du formulaire
|
||||
$doc = new DOMDocument();
|
||||
$doc->strictErrorChecking = false;
|
||||
$doc->preserveWhiteSpace = false;
|
||||
@$doc->loadHTML($result['content']);
|
||||
$xpath = new DOMXpath($doc);
|
||||
$nodelist = $xpath->query("//form[@name='FicheEntrepriseForm']/div[@id='conteneur']/input[@type='hidden']");
|
||||
foreach ($nodelist as $n) {
|
||||
$key = $n->getAttribute('name');
|
||||
$value = $n->getAttribute('value');
|
||||
$fields[$key] = $value;
|
||||
}
|
||||
$fields['montantTotalSelection'] = '5.44'; // 3.11 + 2.33
|
||||
$fields['extraitForm.visualisation'] = 'on'; // => Définit par javascript
|
||||
|
||||
$fields['extraitForm.formVisible'] = 'true';
|
||||
$fields['extraitForm.envoiPeriodiqueForm.periodicite'] = '1';
|
||||
$fields['extraitForm.envoiPeriodiqueForm.duree'] = '12';
|
||||
$fields['etatEndettementForm.formVisible'] = 'true';
|
||||
$fields['etatEndettementForm.etatComplet'] = 'false';
|
||||
$fields['listeActesForm.formVisible'] = 'true';
|
||||
$fields['historiqueModificationsForm.formVisible'] = 'true';
|
||||
$fields['historiqueModificationsForm.tri'] = '0';
|
||||
$fields['procedureCollectiveForm.formVisible'] = 'true';
|
||||
$fields['dossierCompletForm.formVisible'] = 'true';
|
||||
|
||||
if (DEBUG) print_r($fields);
|
||||
/**************************************************
|
||||
Validation de la selection
|
||||
**************************************************/
|
||||
$url = $siteUrl . "/infogreffe/validerSelectionFicheEntreprise.xml";
|
||||
$result = getPage($url, $fields);
|
||||
if (DEBUG) file_put_contents('kbis4.html', print_r($result,1));
|
||||
|
||||
/**************************************************
|
||||
Valider la commande
|
||||
**************************************************/
|
||||
$url = $siteUrl . "/infogreffe/validerPanierAbonne.do?forcerSaisieCoordonnees=false";
|
||||
$fields = array();
|
||||
$result = getPage($url, $fields);
|
||||
if (DEBUG) file_put_contents('kbis5.html', $result['content']);
|
||||
|
||||
/**************************************************
|
||||
Afficher mes achats et prendre la première commande
|
||||
**************************************************/
|
||||
$url = $siteUrl . "/infogreffe/afficherMesAchats.do?refCde=N&pageAppel=validerPanier";
|
||||
$fields = array();
|
||||
$result = getPage($url, $fields);
|
||||
if (DEBUG) file_put_contents('kbis6.html', $result['content']);
|
||||
|
||||
$info = parseRef($result['content']);
|
||||
$ref = $info['ref'];
|
||||
|
||||
/**************************************************
|
||||
Visualiser
|
||||
**************************************************/
|
||||
$identifiant = infogreffeKbis($ref);
|
||||
|
||||
//Suppression fichier
|
||||
if (file_exists($ckfile)) unlink($ckfile);
|
||||
|
||||
if ($identifiant===false || $identifiant!=substr($opts->siren,0,9)) {
|
||||
echo "ERREUR";
|
||||
exit;
|
||||
}
|
||||
echo $identifiant.'-'.$ref.'.html';
|
||||
}
|
378
bin/kbis2.php
378
bin/kbis2.php
@ -1,378 +0,0 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../application/bin.bootstrap.php';
|
||||
|
||||
/**
|
||||
* User-Agent
|
||||
* IE 11.0 : Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
try {
|
||||
$opts = new Zend_Console_Getopt(
|
||||
//Options
|
||||
array(
|
||||
'help|?' => "Affiche l'aide.",
|
||||
'siren=s' => "Commander un kbis",
|
||||
'commandes' => "Liste les commandes passees (Reference), si reference alors recupere le kbis",
|
||||
'visu=s' => "Telechargement du kbis avec une reference (--commandes obligatoire)",
|
||||
'debug' => "Mode debug",
|
||||
)
|
||||
);
|
||||
$opts->parse();
|
||||
$optionsNb = count($opts->getOptions());
|
||||
} catch (Zend_Console_Getopt_Exception $e) {
|
||||
echo $e->getUsageMessage();
|
||||
exit;
|
||||
}
|
||||
|
||||
// --- Aide / Options
|
||||
if ($optionsNb == 0 || isset($opts->help)) {
|
||||
$displayUsage = true;
|
||||
}
|
||||
|
||||
// --- Usage
|
||||
if ($displayUsage) {
|
||||
echo "Telecharge le kbis chez infogreffe.";
|
||||
echo "\n\n";
|
||||
echo $opts->getUsageMessage();
|
||||
echo "\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( isset($opts->debug) ) {
|
||||
define('DEBUG', true);
|
||||
} else {
|
||||
define('DEBUG', false);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
338 437 189
|
||||
552 144 503
|
||||
|
||||
https://www.infogreffe.fr/societes/
|
||||
|
||||
Se connecter
|
||||
Form
|
||||
Var client : 0041
|
||||
Var utilisateur : 2559
|
||||
Var password : 69873
|
||||
|
||||
|
||||
1 - GET https://www.infogreffe.fr/societes/
|
||||
|
||||
2 - POST https://www.infogreffe.fr/sso/identity/authenticate
|
||||
password 69873
|
||||
uri realm=abonnes
|
||||
username 00412559
|
||||
token.id=AQIC5wM2LY4Sfcy_Nc7YNNc2BtJVjZr-CrTMfnMxDw1iSvw.*AAJTSQACMDIAAlMxAAIwNA..*
|
||||
|
||||
3 - GET https://www.infogreffe.fr/societes/
|
||||
|
||||
|
||||
|
||||
4 - GET https://www.infogreffe.fr/services/entreprise/rest/recherche/parPhrase?nbIdRetournes=100&surveillanceVisible=true&miseAuPanierVisible=true&typeProduitMisEnAvant=EXTRAIT&phrase=338437189
|
||||
miseAuPanierVisible true
|
||||
nbIdRetournes 100
|
||||
phrase 338437189
|
||||
surveillanceVisible true
|
||||
typeProduitMisEnAvant EXTRAIT
|
||||
|
||||
{"critereRecherchePrincipal":"338437189","critereRecherche":null,"entrepRechInfosComplementaires":null
|
||||
,"entrepRCSStoreResponse":{"success":true,"identifier":"id","label":"deno","loadedAttr":"numeroDossier"
|
||||
,"idRecherche":"ENTREP_RCS_ACTIF","nbTotalResultats":1,"items":[{"id":8143039,"numeroDossier":"130586B20094"
|
||||
,"etablissementChrono":"0000","libelleEntreprise":{"denomination":"PROVENCE PLOMBERIE","denominationEirl"
|
||||
:null,"enseigne":"PROVENCE PLOMBERIE","nomCommercial":null,"sigle":null},"siren":338437189,"nic":"00016"
|
||||
,"adresse":{"lignes":["QUARTIER LA MARIANNE "],"codePostal":"13560","bureauDistributeur":"SÉNAS"},"codePaysRegistreEtranger"
|
||||
:null,"greffe":{"numero":"1305","nom":"TARASCON","codeGroupement":"05","codeEDI":"G1305","nomGreffeMin"
|
||||
:null},"typeEtab":"SIE","produitAuPanier":"AJOUTABLE","typeInscription":1,"sourceDonnees":"GTC","radie"
|
||||
:false,"dateRadiation":null,"nbEtablissements":1,"activite":{"codeNAF":"4322A","libelleNAF":"Travaux
|
||||
d'installation d'eau et de gaz en tous locaux"},"etatSurveillance":"SURVEILLABLE"}],"typeProduitMisEnAvant"
|
||||
:"EXTRAIT","critereRecherchePrincipal":null,"entrepRechInfosComplementaires":null},"entrepMultiStoreResponse"
|
||||
:{"success":true,"identifier":"id","label":"deno","loadedAttr":"numeroDossier","idRecherche":null,"nbTotalResultats"
|
||||
:0,"items":null,"typeProduitMisEnAvant":"EXTRAIT","critereRecherchePrincipal":null,"entrepRechInfosComplementaires"
|
||||
:null},"entrepRadieeStoreResponse":null,"entrepHorsRCSStoreResponse":{"success":true,"identifier":"id"
|
||||
,"label":"deno","loadedAttr":"numeroDossier","idRecherche":"ENTREP_HORS_RCS_ACTIFS","nbTotalResultats"
|
||||
:0,"items":[],"typeProduitMisEnAvant":"EXTRAIT","critereRecherchePrincipal":null,"entrepRechInfosComplementaires"
|
||||
:null},"reprStoreResponse":{"success":true,"identifier":"id","label":"deno","loadedAttr":"numeroDossier"
|
||||
,"idRecherche":"REPRESENTANT","nbTotalResultats":0,"items":[],"typeProduitMisEnAvant":"EXTRAIT","critereRecherchePrincipal"
|
||||
:"338437189","critereRecherche":null,"entrepRechInfosComplementaires":null},"typeProduitMisEnAvant":"EXTRAIT"
|
||||
}
|
||||
|
||||
5 - GET https://www.infogreffe.fr/societes/entreprise-societe/338437189-provence-plomberie-130586B200940000.html?typeProduitOnglet=EXTRAIT&afficherretour=false
|
||||
afficherretour false
|
||||
typeProduitOnglet EXTRAIT
|
||||
|
||||
<title>PROVENCE PLOMBERIE à SÉNAS (338437189) - Infogreffe</title>
|
||||
|
||||
5 - GET https://www.infogreffe.fr/services/produits/rest/catalogue/dossier/130586B20094/0000
|
||||
|
||||
{"ordrePresentationParProduit":{"BILAN_SAISI":6,"EXTRAIT":1,"ETAT_ENDETEMENT":2,"DOSSIER_COMPLET":9,"HISTO_MODIFS_RCS"
|
||||
:7,"CERTIF_PROC_COLLECTIVE":8,"ACTE":5},"cataloguePrix":{"ETAT_ENDETEMENT":{"typeProduit":"ETAT_ENDETEMENT"
|
||||
,"prixBaseTTC":46.8,"prixFraisEnvoiPostalTTC":1.42,"prixFraisEnvoiElectroniqueTTC":2.34,"prixBaseTTCParTypeInscription"
|
||||
:3.12,"prixFraisEnvoiPostalTTCParTypeInscription":0.89},"BILAN_SAISI":{"typeProduit":"BILAN_SAISI","prixBaseTTC"
|
||||
:3.6,"prixFraisEnvoiPostalTTC":0.0,"prixFraisEnvoiElectroniqueTTC":2.34},"STATUT_A_JOUR":{"typeProduit"
|
||||
:"STATUT_A_JOUR","prixBaseTTC":9.36,"prixFraisEnvoiPostalTTC":2.15,"prixFraisEnvoiElectroniqueTTC":2
|
||||
.34},"HISTO_MODIFS_RCS":{"typeProduit":"HISTO_MODIFS_RCS","prixBaseTTC":7.8,"prixFraisEnvoiPostalTTC"
|
||||
:0.0,"prixFraisEnvoiElectroniqueTTC":2.34},"BILAN_COMPLET":{"typeProduit":"BILAN_COMPLET","prixBaseTTC"
|
||||
:9.36,"prixFraisEnvoiPostalTTC":2.15,"prixFraisEnvoiElectroniqueTTC":2.34},"EXTRAIT":{"typeProduit":"EXTRAIT"
|
||||
,"prixBaseTTC":3.12,"prixFraisEnvoiPostalTTC":0.89,"prixFraisEnvoiElectroniqueTTC":0.78},"DOSSIER_COMPLET"
|
||||
:{"typeProduit":"DOSSIER_COMPLET","prixBaseTTC":70.19999999999999,"prixFraisEnvoiPostalTTC":7.499999999999999
|
||||
,"prixFraisEnvoiElectroniqueTTC":2.34},"ACTE":{"typeProduit":"ACTE","prixBaseTTC":9.36,"prixFraisEnvoiPostalTTC"
|
||||
:2.15,"prixFraisEnvoiElectroniqueTTC":2.34},"CERTIF_PROC_COLLECTIVE":{"typeProduit":"CERTIF_PROC_COLLECTIVE"
|
||||
,"prixBaseTTC":1.56,"prixFraisEnvoiPostalTTC":0.89,"prixFraisEnvoiElectroniqueTTC":2.34}},"produits"
|
||||
:[{"modesDeDiffusionDispos":["V","C","M","T"],"produit":{"typeProduit":"EXTRAIT","modifiable":true,"identifiant"
|
||||
:{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094"},"kbisPeriodique"
|
||||
:true},"miseAuPanier":null},{"modesDeDiffusionDispos":["V","C"],"produit":{"typeProduit":"ETAT_ENDETEMENT"
|
||||
,"modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono"
|
||||
:"20094"},"categoriesInscription":[{"code":"C1","libelle":"Catégorie 1","typesInscription":[{"code":"PRIV_SECU"
|
||||
,"libelle":"Privilège de la sécurité sociale et des régimes complémentaires"},{"code":"PRIV_TRESOR","libelle"
|
||||
:"Privilège du Trésor Public"},{"code":"PROTET","libelle":"Protêts"},{"code":"PRIV_ANAEM","libelle":"Agence
|
||||
Nationale de l'Accueil des Etrangers et des Migrations"}]},{"code":"C2","libelle":"Catégorie 2","typesInscription"
|
||||
:[{"code":"NAN_FOND_COMM","libelle":"Nantissements du fonds de commerce"},{"code":"PRIV_VENDEUR","libelle"
|
||||
:"Privilèges du vendeur de fonds de commerce et d'action résolutoire"},{"code":"NAN_OUTIL","libelle"
|
||||
:"Nantissements de l'outillage, matériel et équipement"},{"code":"DECL_CREANCES","libelle":"Déclaration
|
||||
de créance"}]},{"code":"C3","libelle":"Catégorie 3","typesInscription":[{"code":"OP_CREDIT_BAIL","libelle"
|
||||
:"Opérations de crédit-bail en matière mobilière"},{"code":"PUB_CONTRAT_LOC","libelle":"Publicité de
|
||||
contrats de location"},{"code":"PUB_RESEV_PROPR","libelle":"Publicité de clauses de réserve de propri
|
||||
été"}]},{"code":"C4","libelle":"Catégorie 4","typesInscription":[{"code":"GAGE_STOCKS","libelle":"Gage
|
||||
des stocks"},{"code":"WARRANTS_CAT","libelle":"Warrants"}]},{"code":"C5","libelle":"Catégorie 5","typesInscription"
|
||||
:[{"code":"PRETS_DELAIS","libelle":"Prêts et délais"},{"code":"BIENS_INALIENABLES","libelle":"Biens inali
|
||||
énables"}]}]},"miseAuPanier":null},{"modesDeDiffusionDispos":["V","C","T"],"produit":{"typeProduit":"STATUT_A_JOUR"
|
||||
,"modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono"
|
||||
:"20094","depotActeNumero":4,"acteChrono":2},"dateActe":1418770800000,"typeActe":{"code":"STAJh","libelle"
|
||||
:"Statuts mis à jour"},"nbPages":16,"decisions":[],"depot":{"numeroDepot":"4","numeroDepotManu":3459
|
||||
,"dateDepot":1419980400000}},"miseAuPanier":null},{"modesDeDiffusionDispos":["C"],"produit":{"typeProduit"
|
||||
:"ACTE","modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut"
|
||||
:"B","dossierChrono":"20094","depotActeNumero":1,"acteChrono":1},"dateActe":652485600000,"typeActe":
|
||||
{"code":"ORDPREh","libelle":"Ordonnance du président"},"nbPages":0,"decisions":[{"natureDecision":{"code"
|
||||
:"AGPRh","libelle":"Prorogation du délai de réunion de l'A.G. chargée d'approuver les comptes"},"libelle"
|
||||
:null}],"depot":{"numeroDepot":"1","numeroDepotManu":16,"dateDepot":655686000000}},"miseAuPanier":null
|
||||
},{"modesDeDiffusionDispos":["V","C","T"],"produit":{"typeProduit":"ACTE","modifiable":true,"identifiant"
|
||||
:{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094","depotActeNumero"
|
||||
:2,"acteChrono":1},"dateActe":807832800000,"typeActe":{"code":"PVAh","libelle":"Procès-verbal d'assembl
|
||||
ée"},"nbPages":19,"decisions":[],"depot":{"numeroDepot":"2","numeroDepotManu":814,"dateDepot":812156400000
|
||||
}},"miseAuPanier":null},{"modesDeDiffusionDispos":["V","C","T"],"produit":{"typeProduit":"ACTE","modifiable"
|
||||
:true,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono"
|
||||
:"20094","depotActeNumero":2,"acteChrono":2},"dateActe":807832800000,"typeActe":{"code":"STAJh","libelle"
|
||||
:"Statuts mis à jour"},"nbPages":19,"decisions":[],"depot":{"numeroDepot":"2","numeroDepotManu":814,"dateDepot"
|
||||
:812156400000}},"miseAuPanier":null},{"modesDeDiffusionDispos":["V","C","T"],"produit":{"typeProduit"
|
||||
:"ACTE","modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut"
|
||||
:"B","dossierChrono":"20094","depotActeNumero":2,"acteChrono":3},"dateActe":807832800000,"typeActe":
|
||||
{"code":"DIVERSh","libelle":"Divers"},"nbPages":19,"decisions":[{"natureDecision":{"code":"ZDIVh","libelle"
|
||||
:"Divers"},"libelle":"EXTENSION OBJET SOCIAL & ACTIVITE"}],"depot":{"numeroDepot":"2","numeroDepotManu"
|
||||
:814,"dateDepot":812156400000}},"miseAuPanier":null},{"modesDeDiffusionDispos":["V","C","T"],"produit"
|
||||
:{"typeProduit":"ACTE","modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut"
|
||||
:"B","dossierChrono":"20094","depotActeNumero":3,"acteChrono":1},"dateActe":1216072800000,"typeActe"
|
||||
:{"code":"PVAh","libelle":"Procès-verbal d'assemblée"},"nbPages":4,"decisions":[{"natureDecision":{"code"
|
||||
:"ZDIVh","libelle":"Divers"},"libelle":"MODIFICATION DE L'AFFECTATION DU RESULTAT - EXERCICE CLOS LE
|
||||
31.12.2007"}],"depot":{"numeroDepot":"3","numeroDepotManu":1373,"dateDepot":1219960800000}},"miseAuPanier"
|
||||
:null},{"modesDeDiffusionDispos":["V","C","T"],"produit":{"typeProduit":"ACTE","modifiable":true,"identifiant"
|
||||
:{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094","depotActeNumero"
|
||||
:4,"acteChrono":1},"dateActe":1418770800000,"typeActe":{"code":"PVAGEXh","libelle":"Procès-verbal d'assembl
|
||||
ée générale extraordinaire"},"nbPages":3,"decisions":[{"natureDecision":{"code":"EXCLOTh","libelle":"Changement
|
||||
relatif à la date de clôture de l'exercice social"},"libelle":null}],"depot":{"numeroDepot":"4","numeroDepotManu"
|
||||
:3459,"dateDepot":1419980400000}},"miseAuPanier":null},{"modesDeDiffusionDispos":["V","M","T"],"produit"
|
||||
:{"typeProduit":"BILAN_SAISI","modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime"
|
||||
:"86","dossierStatut":"B","dossierChrono":"20094","bilanMillesime":2013,"bilanNumero":1427},"type":"BS"
|
||||
,"sousCode":"SP","dateClotureExercice":1388444400000,"denominationEIRL":null,"disponibleXbrl":false}
|
||||
,"miseAuPanier":null},{"modesDeDiffusionDispos":["V","C","T"],"produit":{"typeProduit":"BILAN_COMPLET"
|
||||
,"modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono"
|
||||
:"20094","bilanMillesime":2013,"bilanNumero":1427},"type":"BS","sousCode":"BL","dateClotureExercice"
|
||||
:1388444400000,"denominationEIRL":null,"disponibleXbrl":false},"miseAuPanier":null},{"modesDeDiffusionDispos"
|
||||
:["V","M","T"],"produit":{"typeProduit":"BILAN_SAISI","modifiable":true,"identifiant":{"codeGreffe":"1305"
|
||||
,"dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094","bilanMillesime":2012,"bilanNumero"
|
||||
:2537},"type":"BS","sousCode":"SP","dateClotureExercice":1356908400000,"denominationEIRL":null,"disponibleXbrl"
|
||||
:false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V","C","T"],"produit":{"typeProduit":"BILAN_COMPLET"
|
||||
,"modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono"
|
||||
:"20094","bilanMillesime":2012,"bilanNumero":2537},"type":"BS","sousCode":"BL","dateClotureExercice"
|
||||
:1356908400000,"denominationEIRL":null,"disponibleXbrl":false},"miseAuPanier":null},{"modesDeDiffusionDispos"
|
||||
:["V","M","T"],"produit":{"typeProduit":"BILAN_SAISI","modifiable":true,"identifiant":{"codeGreffe":"1305"
|
||||
,"dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094","bilanMillesime":2011,"bilanNumero"
|
||||
:1672},"type":"BS","sousCode":"SP","dateClotureExercice":1325286000000,"denominationEIRL":null,"disponibleXbrl"
|
||||
:false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V","C","T"],"produit":{"typeProduit":"BILAN_COMPLET"
|
||||
,"modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono"
|
||||
:"20094","bilanMillesime":2011,"bilanNumero":1672},"type":"BS","sousCode":"BL","dateClotureExercice"
|
||||
:1325286000000,"denominationEIRL":null,"disponibleXbrl":false},"miseAuPanier":null},{"modesDeDiffusionDispos"
|
||||
:["V","M","T"],"produit":{"typeProduit":"BILAN_SAISI","modifiable":true,"identifiant":{"codeGreffe":"1305"
|
||||
,"dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094","bilanMillesime":2010,"bilanNumero"
|
||||
:2196},"type":"BS","sousCode":"SP","dateClotureExercice":1293750000000,"denominationEIRL":null,"disponibleXbrl"
|
||||
:false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V","C","T"],"produit":{"typeProduit":"BILAN_COMPLET"
|
||||
,"modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono"
|
||||
:"20094","bilanMillesime":2010,"bilanNumero":2196},"type":"BS","sousCode":"BL","dateClotureExercice"
|
||||
:1293750000000,"denominationEIRL":null,"disponibleXbrl":false},"miseAuPanier":null},{"modesDeDiffusionDispos"
|
||||
:["V","M","T"],"produit":{"typeProduit":"BILAN_SAISI","modifiable":true,"identifiant":{"codeGreffe":"1305"
|
||||
,"dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094","bilanMillesime":2009,"bilanNumero"
|
||||
:969},"type":"BS","sousCode":"SP","dateClotureExercice":1262214000000,"denominationEIRL":null,"disponibleXbrl"
|
||||
:false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V","C","T"],"produit":{"typeProduit":"BILAN_COMPLET"
|
||||
,"modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono"
|
||||
:"20094","bilanMillesime":2009,"bilanNumero":969},"type":"BS","sousCode":"BL","dateClotureExercice":1262214000000
|
||||
,"denominationEIRL":null,"disponibleXbrl":false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V"
|
||||
,"M","T"],"produit":{"typeProduit":"BILAN_SAISI","modifiable":true,"identifiant":{"codeGreffe":"1305"
|
||||
,"dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094","bilanMillesime":2008,"bilanNumero"
|
||||
:1427},"type":"BS","sousCode":"SP","dateClotureExercice":1230678000000,"denominationEIRL":null,"disponibleXbrl"
|
||||
:false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V","C","T"],"produit":{"typeProduit":"BILAN_COMPLET"
|
||||
,"modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono"
|
||||
:"20094","bilanMillesime":2008,"bilanNumero":1427},"type":"BS","sousCode":"BL","dateClotureExercice"
|
||||
:1230678000000,"denominationEIRL":null,"disponibleXbrl":false},"miseAuPanier":null},{"modesDeDiffusionDispos"
|
||||
:["V","M","T"],"produit":{"typeProduit":"BILAN_SAISI","modifiable":true,"identifiant":{"codeGreffe":"1305"
|
||||
,"dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094","bilanMillesime":2007,"bilanNumero"
|
||||
:902},"type":"BS","sousCode":"SP","dateClotureExercice":1199055600000,"denominationEIRL":null,"disponibleXbrl"
|
||||
:false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V","C","T"],"produit":{"typeProduit":"BILAN_COMPLET"
|
||||
,"modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono"
|
||||
:"20094","bilanMillesime":2007,"bilanNumero":902},"type":"BS","sousCode":"BL","dateClotureExercice":1199055600000
|
||||
,"denominationEIRL":null,"disponibleXbrl":false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V"
|
||||
,"M","T"],"produit":{"typeProduit":"BILAN_SAISI","modifiable":true,"identifiant":{"codeGreffe":"1305"
|
||||
,"dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094","bilanMillesime":2006,"bilanNumero"
|
||||
:891},"type":"BS","sousCode":"SP","dateClotureExercice":1167519600000,"denominationEIRL":null,"disponibleXbrl"
|
||||
:false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V","C","T"],"produit":{"typeProduit":"BILAN_COMPLET"
|
||||
,"modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono"
|
||||
:"20094","bilanMillesime":2006,"bilanNumero":891},"type":"BS","sousCode":"BL","dateClotureExercice":1167519600000
|
||||
,"denominationEIRL":null,"disponibleXbrl":false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V"
|
||||
,"M","T"],"produit":{"typeProduit":"BILAN_SAISI","modifiable":true,"identifiant":{"codeGreffe":"1305"
|
||||
,"dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094","bilanMillesime":2005,"bilanNumero"
|
||||
:769},"type":"BS","sousCode":"SP","dateClotureExercice":1135983600000,"denominationEIRL":null,"disponibleXbrl"
|
||||
:false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V","C","T"],"produit":{"typeProduit":"BILAN_COMPLET"
|
||||
,"modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono"
|
||||
:"20094","bilanMillesime":2005,"bilanNumero":769},"type":"BS","sousCode":"BL","dateClotureExercice":1135983600000
|
||||
,"denominationEIRL":null,"disponibleXbrl":false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V"
|
||||
,"M","T"],"produit":{"typeProduit":"BILAN_SAISI","modifiable":true,"identifiant":{"codeGreffe":"1305"
|
||||
,"dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094","bilanMillesime":2004,"bilanNumero"
|
||||
:704},"type":"BS","sousCode":"SP","dateClotureExercice":1104447600000,"denominationEIRL":null,"disponibleXbrl"
|
||||
:false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V","T"],"produit":{"typeProduit":"BILAN_COMPLET"
|
||||
,"modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono"
|
||||
:"20094","bilanMillesime":2004,"bilanNumero":704},"type":"BS","sousCode":"BL","dateClotureExercice":1104447600000
|
||||
,"denominationEIRL":null,"disponibleXbrl":false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V"
|
||||
,"M","T"],"produit":{"typeProduit":"BILAN_SAISI","modifiable":true,"identifiant":{"codeGreffe":"1305"
|
||||
,"dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094","bilanMillesime":2003,"bilanNumero"
|
||||
:850},"type":"BS","sousCode":"SP","dateClotureExercice":1072825200000,"denominationEIRL":null,"disponibleXbrl"
|
||||
:false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V","T"],"produit":{"typeProduit":"BILAN_COMPLET"
|
||||
,"modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono"
|
||||
:"20094","bilanMillesime":2003,"bilanNumero":850},"type":"BS","sousCode":"BL","dateClotureExercice":1072825200000
|
||||
,"denominationEIRL":null,"disponibleXbrl":false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V"
|
||||
,"M","T"],"produit":{"typeProduit":"BILAN_SAISI","modifiable":true,"identifiant":{"codeGreffe":"1305"
|
||||
,"dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094","bilanMillesime":2002,"bilanNumero"
|
||||
:959},"type":"BS","sousCode":"SP","dateClotureExercice":1041289200000,"denominationEIRL":null,"disponibleXbrl"
|
||||
:false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V","T"],"produit":{"typeProduit":"BILAN_COMPLET"
|
||||
,"modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono"
|
||||
:"20094","bilanMillesime":2002,"bilanNumero":959},"type":"BS","sousCode":"BL","dateClotureExercice":1041289200000
|
||||
,"denominationEIRL":null,"disponibleXbrl":false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V"
|
||||
,"M","T"],"produit":{"typeProduit":"BILAN_SAISI","modifiable":true,"identifiant":{"codeGreffe":"1305"
|
||||
,"dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094","bilanMillesime":2001,"bilanNumero"
|
||||
:561},"type":"BS","sousCode":"SP","dateClotureExercice":1009753200000,"denominationEIRL":null,"disponibleXbrl"
|
||||
:false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V","T"],"produit":{"typeProduit":"BILAN_COMPLET"
|
||||
,"modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono"
|
||||
:"20094","bilanMillesime":2001,"bilanNumero":561},"type":"BS","sousCode":"BL","dateClotureExercice":1009753200000
|
||||
,"denominationEIRL":null,"disponibleXbrl":false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V"
|
||||
,"M","T"],"produit":{"typeProduit":"BILAN_SAISI","modifiable":true,"identifiant":{"codeGreffe":"1305"
|
||||
,"dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094","bilanMillesime":2000,"bilanNumero"
|
||||
:644},"type":"BS","sousCode":"SP","dateClotureExercice":978217200000,"denominationEIRL":null,"disponibleXbrl"
|
||||
:false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V","T"],"produit":{"typeProduit":"BILAN_COMPLET"
|
||||
,"modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono"
|
||||
:"20094","bilanMillesime":2000,"bilanNumero":644},"type":"BS","sousCode":"BL","dateClotureExercice":978217200000
|
||||
,"denominationEIRL":null,"disponibleXbrl":false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V"
|
||||
,"T"],"produit":{"typeProduit":"BILAN_COMPLET","modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime"
|
||||
:"86","dossierStatut":"B","dossierChrono":"20094","bilanMillesime":1999,"bilanNumero":986},"type":"BS"
|
||||
,"sousCode":"BL","dateClotureExercice":946594800000,"denominationEIRL":null,"disponibleXbrl":false},"miseAuPanier"
|
||||
:null},{"modesDeDiffusionDispos":["V","T"],"produit":{"typeProduit":"BILAN_COMPLET","modifiable":true
|
||||
,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094"
|
||||
,"bilanMillesime":1998,"bilanNumero":614},"type":"BS","sousCode":"BL","dateClotureExercice":915058800000
|
||||
,"denominationEIRL":null,"disponibleXbrl":false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V"
|
||||
,"T"],"produit":{"typeProduit":"HISTO_MODIFS_RCS","modifiable":true,"identifiant":{"codeGreffe":"1305"
|
||||
,"dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094"}},"miseAuPanier":null},{"modesDeDiffusionDispos"
|
||||
:["V","C"],"produit":{"typeProduit":"CERTIF_PROC_COLLECTIVE","modifiable":true,"identifiant":{"codeGreffe"
|
||||
:"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094"}},"miseAuPanier":null},{"modesDeDiffusionDispos"
|
||||
:["V","C"],"produit":{"typeProduit":"DOSSIER_COMPLET","modifiable":true,"identifiant":{"codeGreffe":"1305"
|
||||
,"dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094"},"detailProduits":[{"typeProduit"
|
||||
:"EXTRAIT","modesDeDiffusionDispos":["V","C","M","T"]},{"typeProduit":"ETAT_ENDETEMENT","modesDeDiffusionDispos"
|
||||
:["V","C"]},{"typeProduit":"BILAN_COMPLET","modesDeDiffusionDispos":["V","C","T"],"dateClotureExercice"
|
||||
:1388444400000},{"typeProduit":"STATUT_A_JOUR","modesDeDiffusionDispos":["V","C","T"]},{"typeProduit"
|
||||
:"CERTIF_PROC_COLLECTIVE","modesDeDiffusionDispos":["V","C"]}]},"miseAuPanier":null}]}
|
||||
|
||||
ordrePresentationParProduit.EXTRAIT = 1 (+ cataloguePrix)
|
||||
|
||||
|
||||
6 - POST AJAX https://www.infogreffe.fr/services/produits/rest/panier/extrait
|
||||
idDossier 130586B20094
|
||||
modesDeDiffusion V
|
||||
modesDeDiffusion T
|
||||
nbExemplaires 0
|
||||
|
||||
{"nbDocuments":1,"nbDocumentsParTypeProduit":1,"total":3.9,"totalReduit":3.9,"hasCourrier":false,"cartoucheTotal"
|
||||
:3.9,"cartoucheReduitTotal":3.9,"produitTotal":3.9,"produitReduitTotal":3.9}
|
||||
|
||||
7 - https://www.infogreffe.fr/services/produits/rest/panier
|
||||
|
||||
{"panier":{"panierCartouches":[{"prixCartouche":{"totalTtc":3.9},"identite":{"dossier":{"idDossier":
|
||||
{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094"},"nomGreffeImmat"
|
||||
:"TARASCON","siren":338437189,"denomination":"PROVENCE PLOMBERIE","etatposeSurveillance":null},"debiteur"
|
||||
:null,"listeEntreprises":null,"affaire":null,"nomGreffeImmat":"TARASCON"},"ordrePresentationParProduit"
|
||||
:{"EXTRAIT":1},"produits":[{"produit":{"typeProduit":"EXTRAIT","modifiable":true,"identifiant":{"codeGreffe"
|
||||
:"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094"},"kbisPeriodique":true},"miseAuPanier"
|
||||
:{"prixProduit":{"totalTtc":3.9},"modesDeDiffusionSelectionnes":["V","T"],"nbExemplaires":null,"envoiPeriodique"
|
||||
:{"periodicite":0,"duree":0},"modifiable":true},"libelleProduit":"Extrait RCS (K bis)"}],"prixTotalActes"
|
||||
:0.0,"prixTotalDap":0.0}],"prixTotal":{"totalTtc":3.9},"hasCourrier":false}}
|
||||
|
||||
8 - https://www.infogreffe.fr/services/produits/rest/panier/resume
|
||||
|
||||
{"nbDocuments":1,"nbDocumentsParTypeProduit":0,"total":3.9,"totalReduit":3.9,"hasCourrier":false}
|
||||
|
||||
9 - GET https://www.infogreffe.fr/services/achatclient/rest/achat/createCmdAbonne
|
||||
|
||||
{"numCommande":"173829445","modeDiffusionCourrier":false}
|
||||
|
||||
10 - GET https://www.infogreffe.fr/services/commandeclient/rest/client/recapCommande?numeroCommande=173829445
|
||||
numeroCommande 173829445
|
||||
|
||||
{"commande":{"idCommande":"173829445","date":1433493693000,"totalTTC":3.9,"totalTVA":0.65,"totalHT":null
|
||||
,"refCommande":"YGWJN","moyenPaiement":"COMPTE_ABONNE","numeroCartePrepayee":null,"cartouches":[{"intitule"
|
||||
:{"dossier":{"idDossier":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono"
|
||||
:"20094"},"nomGreffeImmat":"TARASCON","siren":338437189,"denomination":"PROVENCE PLOMBERIE","etatposeSurveillance"
|
||||
:"SURVEILLABLE"},"debiteur":null,"listeEntreprises":null,"affaire":null,"nomGreffeImmat":"TARASCON"}
|
||||
,"produitsEntreprise":[{"ligneCommande":1,"document":"EXCP","produitTTC":3.9000000000000004,"produitHT"
|
||||
:0.0,"fraisDePortHT":0.0,"documentsProduit":[{"modeDiffusion":"V","nbExemplaires":1,"urlTelechargement"
|
||||
:null,"codeSuiviLivraison":null},{"modeDiffusion":"T","nbExemplaires":1,"urlTelechargement":null,"codeSuiviLivraison"
|
||||
:null}],"inDossierComplet":null,"envoiPeriodique":{"periodicite":0,"duree":0},"refEnvoiPeriodique":null
|
||||
}]}],"refCommandeClient":null,"refEnvoiPeriodique":null,"denominationSociete":null,"nomClient":"SCORES
|
||||
ET DECISIONS SAS","abNume":"0041","abAbonne":"2559","email":"CONTACT@SCORES-DECISIONS.COM","solde":null
|
||||
,"nbDocuments":null,"fraisDePortHT":0.0}}
|
||||
|
||||
11 - GET https://www.infogreffe.fr/services/commandeclient/rest/client/recapCommande?numeroCommande=173829445
|
||||
numeroCommande 173829445
|
||||
|
||||
{"commande":{"idCommande":"173829445","date":1433493693000,"totalTTC":3.9,"totalTVA":0.65,"totalHT":null
|
||||
,"refCommande":"YGWJN","moyenPaiement":"COMPTE_ABONNE","numeroCartePrepayee":null,"cartouches":[{"intitule"
|
||||
:{"dossier":{"idDossier":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono"
|
||||
:"20094"},"nomGreffeImmat":"TARASCON","siren":338437189,"denomination":"PROVENCE PLOMBERIE","etatposeSurveillance"
|
||||
:"SURVEILLABLE"},"debiteur":null,"listeEntreprises":null,"affaire":null,"nomGreffeImmat":"TARASCON"}
|
||||
,"produitsEntreprise":[{"ligneCommande":1,"document":"EXCP","produitTTC":3.9000000000000004,"produitHT"
|
||||
:0.0,"fraisDePortHT":0.0,"documentsProduit":[{"modeDiffusion":"V","nbExemplaires":1,"urlTelechargement"
|
||||
:null,"codeSuiviLivraison":null},{"modeDiffusion":"T","nbExemplaires":1,"urlTelechargement":null,"codeSuiviLivraison"
|
||||
:null}],"inDossierComplet":null,"envoiPeriodique":{"periodicite":0,"duree":0},"refEnvoiPeriodique":null
|
||||
}]}],"refCommandeClient":null,"refEnvoiPeriodique":null,"denominationSociete":null,"nomClient":"SCORES
|
||||
ET DECISIONS SAS","abNume":"0041","abAbonne":"2559","email":"CONTACT@SCORES-DECISIONS.COM","solde":null
|
||||
,"nbDocuments":null,"fraisDePortHT":0.0}}
|
||||
|
||||
12 - GET https://www.infogreffe.fr/societes/panier/confirmation?numCommande=173829445&typeClient=AB&etapeCoord=false
|
||||
etapeCoord false
|
||||
numCommande 173829445
|
||||
typeClient AB
|
||||
=> HTML
|
||||
Téléchargement du KBIS
|
||||
|
||||
<tbody class="commandeDocs">
|
||||
<a href="javascript:void(0);" class="voirRouge" style="color: red;">Télécharger</a>
|
||||
|
||||
https://www.infogreffe.fr/services/commandeclient/rest/client/visupdf?numeroCommande=173829445&ligneCommande=1&visualisation=undefined
|
||||
|
||||
|
||||
|
||||
13 - GET https://www.infogreffe.fr/services/commandeclient/rest/client/recapCommande?numeroCommande=173829445
|
||||
=> Voir 10
|
||||
|
||||
14 -
|
||||
|
||||
|
||||
*/
|
@ -1,56 +0,0 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../application/bin.bootstrap.php';
|
||||
|
||||
// --- Options
|
||||
$displayUsage = false;
|
||||
try {
|
||||
$opts = new Zend_Console_Getopt(array(
|
||||
'help|?' => "Displays usage information.",
|
||||
'sqlfile=s' => "",
|
||||
'csvfile=s' => "",
|
||||
));
|
||||
$opts->parse();
|
||||
$optionsNb = count($opts->getOptions());
|
||||
} catch (Zend_Console_Getopt_Exception $e) {
|
||||
$displayUsage = true;
|
||||
}
|
||||
|
||||
// --- Aide / Options
|
||||
if (count($opts->getOptions())==0 || isset($opts->help)) {
|
||||
$displayUsage = true;
|
||||
}
|
||||
|
||||
// --- Usage
|
||||
if ($displayUsage) {
|
||||
echo "Génération d'un fichier CSV à partir d'un fichier SQL.\n";
|
||||
echo $opts->getUsageMessage();
|
||||
exit;
|
||||
}
|
||||
|
||||
use League\Csv\Writer;
|
||||
|
||||
$sql = file_get_contents($opts->sqlfile);
|
||||
|
||||
//we fetch the info from a DB using a PDO object
|
||||
$stmt = $conn->executeQuery($sql);
|
||||
|
||||
if ($stmt->rowCount() == 0) {
|
||||
file_put_contents($opts->csvfile, "");
|
||||
}
|
||||
else {
|
||||
$rows = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
|
||||
// Create the CSV
|
||||
$csv = Writer::createFromPath($opts->csvfile.'.tmp', 'w');
|
||||
$csv->setNewline("\r\n");
|
||||
$csv->setOutputBOM(Writer::BOM_UTF8);
|
||||
|
||||
// Insert the CSV header
|
||||
$csv->insertOne(array_keys($rows[0]));
|
||||
|
||||
// Insert all data
|
||||
$csv->insertAll($rows);
|
||||
|
||||
// Set the real name of file
|
||||
rename($opts->csvfile.'.tmp', $opts->csvfile);
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
{
|
||||
"name": "scores/webservice",
|
||||
"description": "Webservice API",
|
||||
"require": {
|
||||
"zendframework/zendframework1": "^1.12",
|
||||
"geshi/geshi": "dev-master",
|
||||
"league/csv": "^8.1",
|
||||
"doctrine/dbal": "^2.5",
|
||||
"mikehaertl/phpwkhtmltopdf": "^2.2",
|
||||
"guzzlehttp/guzzle": "^6.2",
|
||||
"monolog/monolog": "^1.22",
|
||||
"scores/library": "dev-develop"
|
||||
},
|
||||
"repositories": [
|
||||
{
|
||||
"type": "git",
|
||||
"url": "git@gitlab.factory.insight.doubletrade.com:scores/library.git"
|
||||
}
|
||||
],
|
||||
"include-path": ["library/"],
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"application/",
|
||||
"library/Application/"
|
||||
]
|
||||
},
|
||||
"authors": [
|
||||
{
|
||||
"name": "Scores et Decisions",
|
||||
"email": "supportdev@scores-decisions.com"
|
||||
}
|
||||
]
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
{
|
||||
"name": "scores/webservice",
|
||||
"description": "Webservice API",
|
||||
"require": {
|
||||
"zendframework/zendframework1": "^1.12",
|
||||
"geshi/geshi": "dev-master",
|
||||
"league/csv": "^8.1",
|
||||
"doctrine/dbal": "^2.5",
|
||||
"mikehaertl/phpwkhtmltopdf": "^2.2",
|
||||
"guzzlehttp/guzzle": "^6.2",
|
||||
"monolog/monolog": "^1.22",
|
||||
"scores/library": "dev-master"
|
||||
},
|
||||
"repositories": [
|
||||
{
|
||||
"type": "git",
|
||||
"url": "git@gitlab.factory.insight.doubletrade.com:scores/library.git"
|
||||
}
|
||||
],
|
||||
"include-path": ["library/"],
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"application/",
|
||||
"library/Application/"
|
||||
]
|
||||
},
|
||||
"authors": [
|
||||
{
|
||||
"name": "Scores et Decisions",
|
||||
"email": "supportdev@scores-decisions.com"
|
||||
}
|
||||
]
|
||||
}
|
1151
composer.lock
generated
1151
composer.lock
generated
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,55 +0,0 @@
|
||||
Le fichier Zend/Soap/Wsdl/Strategy/DefaultComplexType.php a été modifié pour
|
||||
générer la documentation automatiquement.
|
||||
|
||||
/**
|
||||
* Traitement éléments de documentation à placer dans le WSDL
|
||||
* Supprime les retours chariots.
|
||||
* Récupére les éléments de documentation
|
||||
*/
|
||||
$comment = '';
|
||||
$docBlock = preg_replace('/\n/', '', $property->getDocComment() );
|
||||
if (preg_match('/\/\*\*(.+) \* @var\s+[^\s]+\s+(?:\*|@)/m', $docBlock, $docBlockMatches)) {
|
||||
$comment.= preg_replace(
|
||||
array('/\r/', '/\t\s\*/'),
|
||||
array('', ''), $docBlockMatches[1]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajout des éléments de documentation au WSDL
|
||||
*/
|
||||
if (!empty($comment)){
|
||||
$annotation = $dom->createElement('xsd:annotation');
|
||||
$documentation = $dom->createElement('xsd:documentation', trim($comment));
|
||||
$annotation->appendChild($documentation);
|
||||
$element->appendChild($annotation);
|
||||
}
|
||||
|
||||
===============================================================================>
|
||||
|
||||
Le fichier Zend/Soap/AutoDiscover.php a été modifié
|
||||
function _addFunctionToWsdl
|
||||
|
||||
$sequenceElement = array(
|
||||
'name' => $param->getName(),
|
||||
'type' => $wsdl->getType($param->getType()),
|
||||
'desc' => $param->getDescription()
|
||||
);
|
||||
|
||||
===============================================================================>
|
||||
|
||||
Le fichier Zend/Soap/Wsdl.php a été modifié
|
||||
function _parseElement
|
||||
|
||||
} elseif ($key == 'desc') {
|
||||
if (!empty($value)) {
|
||||
$annotation = $this->_dom->createElement('xsd:annotation');
|
||||
$documentation = $this->_dom->createElement('xsd:documentation', trim($value));
|
||||
$annotation->appendChild($documentation);
|
||||
$elementXml->appendChild($annotation);
|
||||
}
|
||||
} else {
|
||||
|
||||
|
||||
|
||||
|
163
docs/README
163
docs/README
@ -1,163 +0,0 @@
|
||||
WebService
|
||||
==========
|
||||
|
||||
- Créer le vhost, voir le fichier VHOST pour les exemples
|
||||
|
||||
<VirtualHost *:80>
|
||||
ServerName webservice.sd.dev
|
||||
AddDefaultCharset utf-8
|
||||
|
||||
<IfModule mod_xsendfile.c>
|
||||
XSendFile On
|
||||
XSendFilePath /home/vhosts/webservice/shared
|
||||
</IfModule>
|
||||
|
||||
DocumentRoot /home/vhosts/webservice/public
|
||||
<Directory /home/vhosts/webservice/public/>
|
||||
EnableSendfile Off
|
||||
AllowOverride none
|
||||
Require all granted
|
||||
<Files ~ "^\.user.ini">
|
||||
Order allow,deny
|
||||
Deny from all
|
||||
</Files>
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
RewriteCond %{REQUEST_URI} ^/favicon.ico$ [OR]
|
||||
RewriteCond %{REQUEST_FILENAME} -s [OR]
|
||||
RewriteCond %{REQUEST_FILENAME} -l [OR]
|
||||
RewriteCond %{REQUEST_FILENAME} -d
|
||||
RewriteRule ^.*$ - [NC,L]
|
||||
RewriteRule ^.*$ index.php [NC,L]
|
||||
</IfModule>
|
||||
</Directory>
|
||||
|
||||
<Directory /home/vhosts/webservice/public/assets/>
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine Off
|
||||
</IfModule>
|
||||
</Directory>
|
||||
|
||||
# Possible values include: debug, info, notice, warn, error, crit, alert, emerg.
|
||||
LogLevel error
|
||||
ErrorLog ${APACHE_LOG_DIR}/webservice-error.log
|
||||
CustomLog ${APACHE_LOG_DIR}/webservice-access.log combined
|
||||
</VirtualHost>
|
||||
|
||||
- Installer les librairies avec composer
|
||||
|
||||
$ composer install
|
||||
|
||||
|
||||
- Configurer l'application
|
||||
|
||||
La config (fichier application.ini) est à placer dans "application/configs/"
|
||||
|
||||
Exemple de la config dans "docs/config/application.ini" (Modifier selon les besoins)
|
||||
|
||||
|
||||
- APPLICATION_ENV
|
||||
|
||||
Différent niveau peuvent être utilisé dans l'application pour gérer les erreurs et le comportement.
|
||||
|
||||
production
|
||||
staging
|
||||
development
|
||||
testing
|
||||
|
||||
Cette variable est accessible dans PHP.
|
||||
|
||||
. mod_php
|
||||
|
||||
Add in <VirtualHost/>
|
||||
SetEnv APPLICATION_ENV "development"
|
||||
|
||||
. php-fpm
|
||||
|
||||
Add a file in document root path (public/) a file .user.ini
|
||||
env[APPLICATION_ENV] = "development"
|
||||
|
||||
See the .user.ini file
|
||||
|
||||
|
||||
- Créer les repertoires de données nécessaires
|
||||
|
||||
[WORKSPACE]/data/webservice/
|
||||
- cache
|
||||
- logs
|
||||
- sessions
|
||||
- wsdl
|
||||
- files
|
||||
- greffes
|
||||
|
||||
|
||||
Fonctionnement
|
||||
==============
|
||||
Obtenir les WSDL
|
||||
Pour le service Entreprise
|
||||
|
||||
- En mode développement : http://hostname/entreprise/version?wsdl-auto
|
||||
- Générer le WSDL : http://hostname/entreprise/version?wsdl-generate
|
||||
- Utiliser le WSDL généré : http://hostname/entreprise/version?wsdl
|
||||
|
||||
Pour le service Interne
|
||||
|
||||
http://hostname/interne/version?wsdl
|
||||
|
||||
Pour les clients
|
||||
|
||||
http://hostname/clients/nom_du_client/version?wsdl
|
||||
|
||||
N.B : Le fichier WSDL est généré automatiquement en appelant
|
||||
http://hostname/service?wsdl afin de ne pas provoquer d'erreur
|
||||
après une mise en production
|
||||
|
||||
Pour définir le mode (vhost d'apache)
|
||||
SetEnv APPLICATION_ENV "development"
|
||||
SetEnv APPLICATION_ENV "production"
|
||||
SetEnv APPLICATION_ENV "staging"
|
||||
|
||||
En appelant l'url http://hostname/service, le contoller de l'application,
|
||||
"service" est automatiquement utiliser.
|
||||
Tout ce qui est visible dans la class est utilisé par le controller et se
|
||||
retrouve visible dans le service (wsdl, requête)
|
||||
|
||||
Si des fonctions ne doivent pas être rendu visible il faut donc les séparer
|
||||
dans un autre controller utilisant une autre class.
|
||||
|
||||
|
||||
Documentation des méthodes et ajout spécial
|
||||
===========================================
|
||||
|
||||
La documentation est géneré en automatique.
|
||||
|
||||
Voici comment définir simplement la documentation d'une méthode
|
||||
|
||||
/**
|
||||
* Retourne les informations identitaires de l'entreprise ou de l'établissement demandé
|
||||
* @param string $key Siren de l'entreprise ou siret de l'établissement
|
||||
* @return Identite
|
||||
*/
|
||||
public function test($key)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Attention ces informations servent aussi pour la structure du WSDL
|
||||
|
||||
Pour spécifier un lien vers un fichier ou pour générer un fichier depuis une
|
||||
requête SQL à partir de la documentation du service.
|
||||
Ajouter dans le docblock :
|
||||
- Pour un fichier
|
||||
@ref fichier:libellé:{nom_du_fichier.ext}
|
||||
- Pour une requête SQL
|
||||
@ref mysql:libellé:{nom_du_fichier.sql}
|
||||
|
||||
Les fichiers a télécharger sont à placer dans le répértoire public/fichier et
|
||||
les fichiers sql dans public/sql
|
||||
|
||||
Pour spécifier des éléments de taille (non pris en compte sur le WSDL)
|
||||
@xsd minLength=9
|
||||
@xsd maxLength=15
|
||||
|
||||
|
@ -1,9 +0,0 @@
|
||||
upload_max_filesize=513M
|
||||
post_max_size=513M
|
||||
memory_limit=512M
|
||||
mbstring.func_overload=0
|
||||
always_populate_raw_post_data=-1
|
||||
default_charset='UTF-8'
|
||||
date.timezone='Europe/Paris'
|
||||
soap.wsdl_cache_enabled=0
|
||||
env[APPLICATION_ENV] = "development"
|
@ -1,74 +0,0 @@
|
||||
[production]
|
||||
phpSettings.soap.wsdl_cache_dir = "PROJECT_DIR/shared/sessions/wsdl"
|
||||
phpSettings.date.timezone = "Europe/Paris"
|
||||
phpSettings.display_startup_errors = 0
|
||||
phpSettings.display_errors = 0
|
||||
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
|
||||
bootstrap.class = "Bootstrap"
|
||||
appnamespace = "Application"
|
||||
resources.session.save_path = "PROJECT_DIR/shared/sessions"
|
||||
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
|
||||
resources.frontController.plugins.Auth = "Application_Controller_Plugin_Auth"
|
||||
resources.frontController.plugins.Services = "Application_Controller_Plugin_Services"
|
||||
resources.frontController.plugins.Menu = "Application_Controller_Plugin_Menu"
|
||||
resources.frontController.params.displayExceptions = 0
|
||||
resources.layout.layout = "layout"
|
||||
resources.layout.layoutPath = APPLICATION_PATH "/views"
|
||||
resources.view.basePath = APPLICATION_PATH "/views"
|
||||
|
||||
; Scores configuration
|
||||
profil.server.name = development
|
||||
profil.mail.method = smtp
|
||||
profil.mail.host = smtp.free.fr
|
||||
profil.mail.email.support = supportdev@scores-decisions.com
|
||||
profil.mail.email.supportdev = supportdev@scores-decisions.com
|
||||
profil.mail.email.contact = supportdev@scores-decisions.com
|
||||
profil.mail.email.production = supportdev@scores-decisions.com
|
||||
profil.wkhtmltopdf.path = "/usr/local/bin/wkhtmltopdf"
|
||||
profil.path.shared = "PROJECT_DIR/shared"
|
||||
|
||||
; Metier - Infogreffe
|
||||
profil.infogreffe.wsdl = "infogreffe.wsdl"
|
||||
profil.infogreffe.url = "https://webservices.infogreffe.fr/WSContextInfogreffe/INFOGREFFE"
|
||||
profil.infogreffe.uri = "https://webservices.infogreffe.fr/"
|
||||
profil.infogreffe.user = 85000109
|
||||
profil.infogreffe.password = 166
|
||||
profil.infogreffe.cache.path = "PROJECT_DIR/shared/cache"
|
||||
profil.infogreffe.cache.time = 8
|
||||
profil.infogreffe.storage.path = "PROJECT_DIR/shared/datafile/greffes"
|
||||
|
||||
; Sphinx configuration
|
||||
profil.sphinx.ent.host = "172.18.8.5"
|
||||
profil.sphinx.ent.port = 9312
|
||||
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.2.10"
|
||||
profil.sphinx.act.host = "172.18.8.5"
|
||||
profil.sphinx.act.port = 9312
|
||||
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.2.10"
|
||||
|
||||
; For old configuration - see Configure.php
|
||||
profil.db.metier.adapter=mysqli
|
||||
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
|
||||
profil.db.metier.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8mb4"
|
||||
|
||||
[staging : production]
|
||||
phpSettings.soap.wsdl_cache_enabled = 0
|
||||
resources.frontController.params.displayExceptions = 1
|
||||
|
||||
[development : production]
|
||||
phpSettings.soap.wsdl_cache_enabled = 0
|
||||
phpSettings.display_startup_errors = 1
|
||||
phpSettings.display_errors = 0
|
||||
resources.frontController.params.displayExceptions = 1
|
||||
|
||||
[testing : production]
|
||||
phpSettings.display_startup_errors = 1
|
||||
phpSettings.display_errors = 1
|
@ -1,8 +0,0 @@
|
||||
Créer un fichier "webservice" dans /etc/logrotate.d
|
||||
|
||||
/var/log/webservice/*.log {
|
||||
weekly
|
||||
missingok
|
||||
compress
|
||||
notifempty
|
||||
}
|
@ -1,89 +0,0 @@
|
||||
<?php
|
||||
class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
|
||||
{
|
||||
/**
|
||||
* Vérifie les autorisations
|
||||
* Utilise _request et _response hérités et injectés par le FC
|
||||
*
|
||||
* @param Zend_Controller_Request_Abstract $request : non utilisé, mais demandé par l'héritage
|
||||
*/
|
||||
public function preDispatch(Zend_Controller_Request_Abstract $request)
|
||||
{
|
||||
$controller = $request->getControllerName();
|
||||
$action = $request->getActionName();
|
||||
|
||||
$checkAuth = true;
|
||||
// --- Pas d'authentification sur la demande d'authentification
|
||||
if ( $controller == 'user' && $action == 'login' ) {
|
||||
$checkAuth = false;
|
||||
}
|
||||
|
||||
// --- Pas d'authentification sur ces services
|
||||
if ( in_array($controller, array('service', 'import'))
|
||||
|| ( $controller == 'fichier' && $action == 'logs' )
|
||||
|| ( $controller == 'fichier' && $action == 'kbis' )
|
||||
|| ( $controller == 'fichier' && $action == 'csv' )
|
||||
|| ( $controller == 'fichier' && $action == 'associations' )
|
||||
|| ( $controller == 'fichier' && $action == 'greffes' )
|
||||
|| ( $controller == 'fichier' && $action == 'crm' )) {
|
||||
$checkAuth = false;
|
||||
}
|
||||
|
||||
$checkWs = true;
|
||||
if ( $controller == 'fichier' ) {
|
||||
$checkWs = false;
|
||||
}
|
||||
|
||||
if ($checkAuth) {
|
||||
$login = $request->getParam('login');
|
||||
$pass = $request->getParam('pass', '');
|
||||
|
||||
$hach = $request->getParam('hach');
|
||||
if (!empty($hach)) {
|
||||
$pass = $hach;
|
||||
}
|
||||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
|
||||
// --- On vérifie le tout lors d'une connexion par url
|
||||
if ( !empty($login) && !empty($pass) ) {
|
||||
$authAdapter = new Scores_Auth_Adapter_Db($login, $pass, $checkWs);
|
||||
$result = $auth->authenticate($authAdapter);
|
||||
if ($result->isValid()) {
|
||||
$storage = new Zend_Auth_Storage_Session();
|
||||
$session = new Zend_Session_Namespace($storage->getNamespace());
|
||||
//$session->setExpirationSeconds(86400);
|
||||
$auth->setStorage($storage);
|
||||
}
|
||||
else {
|
||||
$layout = Zend_Layout::getMVCInstance();
|
||||
if ( !$layout->isEnabled() ){
|
||||
echo "Identification incorrect ou périmé.";
|
||||
} else {
|
||||
$request->setModuleName('default')
|
||||
->setControllerName('user')
|
||||
->setActionName('logout');
|
||||
}
|
||||
}
|
||||
}
|
||||
// Sinon on reste sur le standard
|
||||
else {
|
||||
// Pas authentifié
|
||||
if ( !$auth->hasIdentity() || time() > $auth->getIdentity()->time ) {
|
||||
$layout = Zend_Layout::getMVCInstance();
|
||||
if (!$layout->isEnabled()){
|
||||
echo "Identification incorrect ou périmé.";
|
||||
} else {
|
||||
$this->_response->setRedirect('/user/login')->sendResponse();
|
||||
}
|
||||
}
|
||||
// Authentifié => on met à jour la session
|
||||
else {
|
||||
$identity = $auth->getIdentity();
|
||||
$identity->time = time() + $identity->timeout;
|
||||
$auth->getStorage()->write($identity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
<?php
|
||||
class Application_Controller_Plugin_Menu extends Zend_Controller_Plugin_Abstract
|
||||
{
|
||||
/**
|
||||
* Créer le menu en fonction des besoins et des paramètres en entrée
|
||||
* @param Zend_Controller_Request_Abstract $request
|
||||
*/
|
||||
public function preDispatch(Zend_Controller_Request_Abstract $request)
|
||||
{
|
||||
$layout = Zend_Layout::getMVCInstance();
|
||||
|
||||
$controller = $request->getControllerName();
|
||||
$action = $request->getActionName();
|
||||
|
||||
$activateLayout = true;
|
||||
if ( $controller == 'user' && in_array($action, array('login', 'logout')) ) {
|
||||
$activateLayout = false;
|
||||
}
|
||||
|
||||
if ( $layout->isEnabled() && $activateLayout ) {
|
||||
|
||||
$view = $layout->getView();
|
||||
$config = include APPLICATION_PATH . '/configs/menu.config.php';
|
||||
$container = new Zend_Navigation($config);
|
||||
|
||||
// --- Secure demo mode
|
||||
$auth = Zend_Auth::getInstance();
|
||||
if ($auth->hasIdentity()) {
|
||||
$user = $auth->getIdentity();
|
||||
if ($user->idClient != 1) {
|
||||
$toSecure = $container->findOneBy('Label', "Démonstration");
|
||||
$container->removePage($toSecure);
|
||||
}
|
||||
}
|
||||
|
||||
$view->navigation($container);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,76 +0,0 @@
|
||||
<?php
|
||||
class Application_Controller_Plugin_Services extends Zend_Controller_Plugin_Abstract
|
||||
{
|
||||
/**
|
||||
* Vérifie les autorisations
|
||||
* Utilise _request et _response hérités et injectés par le FC
|
||||
*
|
||||
* @param Zend_Controller_Request_Abstract $request : non utilisé, mais demandé par l'héritage
|
||||
*/
|
||||
public function preDispatch(Zend_Controller_Request_Abstract $request)
|
||||
{
|
||||
$controller = $request->getControllerName();
|
||||
$action = $request->getActionName();
|
||||
|
||||
if ( in_array($controller, array('service'))
|
||||
|| ( $controller == 'user' && in_array($action, array('login', 'logout')) ) ) {
|
||||
//Do nothing
|
||||
} else {
|
||||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
if ( $auth->hasIdentity() ) {
|
||||
|
||||
$username = $auth->getIdentity()->username;
|
||||
$idClient = $auth->getIdentity()->idClient;
|
||||
|
||||
$wsServices = array();
|
||||
|
||||
//Get all webservice client
|
||||
$clients = include APPLICATION_PATH . '/../library/WsScore/Clients/ClientsConfig.php';
|
||||
foreach( $clients as $section => $params ) {
|
||||
if ( $params['actif']
|
||||
&& (isset($params['idClient']) && in_array($idClient,$params['idClient'])) ) {
|
||||
|
||||
$params['name'] = $section;
|
||||
$params['type'] = 'client';
|
||||
if ( $idClient == 1 ) {
|
||||
$params['name'] = 'Client - '.ucfirst($section);
|
||||
}
|
||||
$wsServices[$section] = $params;
|
||||
}
|
||||
}
|
||||
|
||||
//Standard service
|
||||
if ( count($wsServices)==0 || $idClient==1 ) {
|
||||
$services = include APPLICATION_PATH . '/../library/WsScore/ServicesConfig.php';
|
||||
foreach( $services as $section => $params )
|
||||
{
|
||||
if ( $params['actif'] ) {
|
||||
$params['name'] = ucfirst($section);
|
||||
$params['type'] = 'sd';
|
||||
if ( isset($params['idClient']) && in_array($idClient,$params['idClient']) ) {
|
||||
if ( $idClient == 1 ) {
|
||||
$params['name'] = 'SD - '.ucfirst($section);
|
||||
}
|
||||
$wsServices[$section] = $params;
|
||||
}
|
||||
elseif ( !isset($params['idClient']) ) {
|
||||
if ( $idClient == 1 ) {
|
||||
$params['name'] = 'SD - '.ucfirst($section);
|
||||
}
|
||||
$wsServices[$section] = $params;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$layout = Zend_Layout::getMVCInstance();
|
||||
$view = $layout->getView();
|
||||
$view->WsServices = $wsServices;
|
||||
|
||||
}
|
||||
|
||||
} // Zend_Auth::hasIdentity
|
||||
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
<?php
|
||||
class Application_Form_Login extends Zend_Form {
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->setName('login');
|
||||
$this->setAction('login');
|
||||
$this->setMethod('post');
|
||||
$this->addElement('text', 'login', array(
|
||||
'filters' => array('StringTrim'),
|
||||
'label' => 'Identifiant : ',
|
||||
'required' => 'true',
|
||||
)
|
||||
);
|
||||
$this->addElement('password', 'pass',
|
||||
array(
|
||||
'label' => 'Mot de passe : ',
|
||||
'required' => 'true',
|
||||
)
|
||||
);
|
||||
$this->addElement('submit', 'submit',
|
||||
array(
|
||||
'label' => 'Identification',
|
||||
'ignore' => true,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_AssoActes extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'asso_actes';
|
||||
protected $_schema = 'jo';
|
||||
|
||||
public function insert(array $data)
|
||||
{
|
||||
// Ajout d'un timestamp
|
||||
if (empty($data['dateInsert'])) {
|
||||
$data['dateInsert'] = date('Y-m-d H:i:s');
|
||||
}
|
||||
return parent::insert($data);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_BopiMarques extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'marques';
|
||||
protected $_schema = 'bopi';
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_Commandes extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'commandes';
|
||||
|
||||
protected $_dependentTables = array(
|
||||
'Application_Model_CommandesEven',
|
||||
'Application_Model_CommandesPieces',
|
||||
);
|
||||
|
||||
public function insert(array $data)
|
||||
{
|
||||
// Ajout d'un timestamp
|
||||
if (empty($data['date_added'])) {
|
||||
$data['date_added'] = date('Y-m-d H:i:s');
|
||||
}
|
||||
return parent::insert($data);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_CommandesActe extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'commandes_acte';
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_CommandesAsso extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'commandes_asso';
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_CommandesBilan extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'commandes_bilan';
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_CommandesEven extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'commandes_even';
|
||||
|
||||
protected $_referenceMap = array(
|
||||
'CommandesEven' => array(
|
||||
'columns' => array('commande_id'),
|
||||
'refTableClass' => 'Application_Model_Commandes',
|
||||
'refColumns' => array('id'),
|
||||
),
|
||||
);
|
||||
|
||||
public function insert(array $data)
|
||||
{
|
||||
if (empty($data['date_added'])) {
|
||||
$data['date_added'] = date('Y-m-d H:i:s');
|
||||
}
|
||||
return parent::insert($data);
|
||||
}
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_CommandesKbis extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'commandes_kbis';
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_CommandesPieces extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'commandes_pieces';
|
||||
|
||||
protected $_referenceMap = array(
|
||||
'CommandesPieces' => array(
|
||||
'columns' => array('commande_id'),
|
||||
'refTableClass' => 'Application_Model_Commandes',
|
||||
'refColumns' => array('id'),
|
||||
),
|
||||
);
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_CommandesStatut extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'commandes_statut';
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_ExtractionCommandes extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'commandes';
|
||||
|
||||
public function insert(array $data)
|
||||
{
|
||||
// Ajout d'un timestamp
|
||||
if (empty($data['dateAdded'])) {
|
||||
$data['dateAdded'] = date('Y-m-d H:i:s');
|
||||
}
|
||||
return parent::insert($data);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_FedasoBilans extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'fedaso_bilans';
|
||||
protected $_schema = 'sdv1';
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_HistoriquesBilans extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'bilans';
|
||||
protected $_schema = 'historiques';
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_InseeDepartements extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'departements';
|
||||
protected $_schema = 'insee';
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_InseeIdentite extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'identite';
|
||||
protected $_schema = 'insee';
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_InseeTabVilles extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'insee_tabVilles';
|
||||
protected $_schema = 'insee';
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_JoAssoBilans extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'asso_bilans';
|
||||
protected $_schema = 'jo';
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_JoAssoStatut extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'asso_statut';
|
||||
protected $_schema = 'jo';
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_JoAssoSubventions extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'asso_subventions';
|
||||
protected $_schema = 'jo';
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_JoBilans extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'bilans';
|
||||
protected $_schema = 'jo';
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_JoBilansUser extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'bilans_user';
|
||||
protected $_schema = 'jo';
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_JoBoampLots extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'boamp_lots';
|
||||
protected $_schema = 'jo';
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_JoBodaccDetail extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'bodacc_detail';
|
||||
protected $_schema = 'jo';
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_JoBodaccFonctions extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'bodacc_fonctions';
|
||||
protected $_schema = 'jo';
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_JoEtablissements extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'etablissements';
|
||||
protected $_schema = 'jo';
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_JoGreffesActes extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'greffes_actes';
|
||||
protected $_schema = 'jo';
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_JoGreffesBilans extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'greffes_bilans';
|
||||
protected $_schema = 'jo';
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_JoLiens extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'liens2';
|
||||
protected $_schema = 'jo';
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_JoLiensDoc extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'liensDoc';
|
||||
protected $_schema = 'jo';
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_JoLiensRef extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'liensRef';
|
||||
protected $_schema = 'jo';
|
||||
|
||||
public function insert(array $data)
|
||||
{
|
||||
// Ajout d'un timestamp
|
||||
if (empty($data['dateInsert'])) {
|
||||
$data['dateInsert'] = date('YmdHis');
|
||||
}
|
||||
return parent::insert($data);
|
||||
}
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user