Compare commits

...

No commits in common. "master" and "2.4" have entirely different histories.
master ... 2.4

3708 changed files with 990609 additions and 35826 deletions

5
.gitignore vendored
View File

@ -1,5 +0,0 @@
/.settings/
/.buildpath
/.project
/vendor/
/composer-develop.lock

View File

@ -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`

View File

@ -1,8 +1,4 @@
<?php
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
use Monolog\Processor\IntrospectionProcessor;
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
protected function _initConfig()
@ -10,209 +6,182 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
$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));
//Load old config
require_once 'WsScore/Configure.php';
$oldconfig = new Configure();
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')
protected function _initViewSettings()
{
$this->bootstrap('view');
$view = $this->getResource('view');
$view->setEncoding('UTF-8');
$view->doctype('HTML5');
$view->headMeta()
->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8')
->appendHttpEquiv('Content-Language', 'fr-FR');
$view->headLink()
->appendStylesheet('/styles/reset.css', 'all')
->appendStylesheet('/styles/main.css', 'all');
$view->headScript()->appendFile('/scripts/jquery.js', 'text/javascript');
$view->headScript()->appendFile('/scripts/scripts.js', 'text/javascript');
$view->headTitle()->setSeparator(' - ');
$view->headTitle('WebService Scores & Decisions');
}
//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')
);
//Initialisation global des paramètres de log
protected function _initLogging()
{
$c = Zend_Registry::get('config');
$WsLogger = new Zend_Log();
$WsFileWriter = new Zend_Log_Writer_Stream($c->profil->path->log.'/wsentreprise.log');
$WsFileWriter->addFilter(Zend_Log::INFO);
$WsLogger->addWriter($WsFileWriter);
Zend_Registry::set('WsLogger', $WsLogger);
}
$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');
protected function _initNavigation()
{
$view = $this->bootstrap('layout')->getResource('layout')->getView();
$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');
//@todo : gérer les versions et les clients
$view->headTitle()->setSeparator(' - ');
$view->headTitle('Web Service API - Scores & Decisions');
}
$menu = array(
array(
'label' => 'Accueil',
'controller' => 'index',
'action' => 'index',
),
array(
'label' => 'Documentation',
'controller' => 'documentation',
'action' => 'index',
'pages' => array(
array(
'label' => 'Entreprise',
'controller' => 'documentation',
'action' => 'index',
),
array(
'label' => 'Code erreurs/messages',
'controller' => 'documentation',
'action' => 'erreur',
),
array(
'label' => 'Exemples',
'controller' => 'documentation',
'action' => 'exemples',
),
),
),
array(
'label' => 'Démonstration',
'controller' => 'demo',
'action' => 'index',
),
);
$view->navigation(new Zend_Navigation($menu));
}
protected function _initRouter()
{
$this->bootstrap('frontController');
$front = $this->getResource('frontController');
$router = $front->getRouter();
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);
}
}
//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);
$route = new Zend_Controller_Router_Route('jsonrpc/'.$section.'/:version', array(
'controller' => 'jsonrpc',
'action' => 'index',
'service' => $section,
'version' => '',
));
$router->addRoute('jsonrpc-'.$section, $route);
}
}
$fichierRoute = new Zend_Controller_Router_Route('fichier/:action/:fichier', array(
'controller' => 'fichier',
'fichier' => '',
));
$router->addRoute('fichier', $fichierRoute);
return $router;
}
//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);
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;
}
$fichierRoute = new Zend_Controller_Router_Route('fichier/:action/:fichier', array(
'controller' => 'fichier',
'fichier' => '',
));
$router->addRoute('fichier', $fichierRoute);
return $router;
}
/**
* Set the default adapter to use with all model
*/
Zend_Db_Table::setDefaultAdapter($db);
}
protected function _initDb()
{
$c = Zend_Registry::get('config');
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;
}
protected function _initDoctrine()
{
$c = new Zend_Config($this->getOptions());
/**
* Set the default adapter to use with all model
*/
Zend_Db_Table::setDefaultAdapter($db);
}
$config = new \Doctrine\DBAL\Configuration();
protected function _initWsDebug()
{
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->registerNamespace('WsDebug');
if (APPLICATION_ENV == 'development') {
$logger = new Scores_Logger_Sql();
$config->setSQLLogger($logger);
}
$options = array(
'plugins' => array(
'Exception',
),
);
$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',
);
$debug = new WsDebug_Controller_Plugin_Debug($options);
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;
}
$this->bootstrap('frontController');
$frontController = $this->getResource('frontController');
$frontController->registerPlugin($debug);
}
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);
}
}
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);
}
}
}

View File

@ -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;
}

View File

@ -1 +0,0 @@
/application.ini

View File

@ -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(),
),
);

View File

@ -1,107 +1,105 @@
<?php
class DemoController extends Zend_Controller_Action
{
protected $_username;
protected $_hash;
protected $_username;
protected $_hash;
protected $methods = array(
'getIdentite' => array(
'ws' => 'entreprise/v0.8?wsdl',
'form' => 'getIdentite',
),
);
protected $methods = array(
'getIdentite' => array(
'ws' => 'entreprise/v0.7?wsdl',
'form' => 'getIdentite',
),
);
public function init()
public function init()
{
require_once 'Web/demo/getIdentite.php';
$auth = Zend_Auth::getInstance();
$this->_username = $auth->getIdentity()->username;
$this->_hash = $auth->getIdentity()->hash;
}
public function indexAction()
{
$auth = Zend_Auth::getInstance();
$this->_username = $auth->getIdentity()->username;
$this->_hash = $auth->getIdentity()->hash;
}
public function indexAction()
{
//Liste
//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,
);
}
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);
$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 methodAction()
{
$method = $this->_getParam('name','');
$this->view->assign('method', $method);
//Affichage du formulaire
if (array_key_exists($method, $this->methods)){
$class = 'Form_'.$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()
{
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'));
}
}
$method = $formData['method'];
$class = 'Form_'.$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;
$soap = array(
'requete' => $params,
'reponse' => $client->getIdentite($params)
);
$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'));
}
}
}
}
}
}

View File

@ -2,188 +2,158 @@
class DocumentationController extends Zend_Controller_Action
{
/**
/**
* Affichage de la documentation des webservices
*/
public function indexAction()
{
//Do nothing
}
$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)){
/**
* Liste des services
*/
public function servicesAction()
$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
require_once 'Web/WebClassDoc.php';
$doc = new WebClassDoc(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);
}
}
public function clientsAction()
{
$request = $this->getRequest();
$client = strtolower($request->getParam('nom'));
$ws = 'entreprise';
// Gestion des versions
$clients = include APPLICATION_PATH . '/../library/WsScore/Clients/ClientsConfig.php';
$configServiceVersions = $clients[$client]['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/Clients/'.ucfirst($client).'/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.= '/clients/'.$client.'/v'.$version.'?wsdl';
} else {
$wsdl_url.= '/clients/'.$client.'/v'.$version.'?wsdl-auto';
}
// Affichage de la documentation
require_once 'Web/WebClassDoc.php';
$doc = new WebClassDoc(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 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();
public function exemplesAction()
{
//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
@ -192,32 +162,36 @@ class DocumentationController extends Zend_Controller_Action
*/
public function codeAction()
{
$langage = strtolower($this->_getParam('langage', ''));
$element = $this->_getParam('element', '');
$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);
$fichier = APPLICATION_PATH .
'/../public/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();
require_once 'geshi/geshi.php';
$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.');
}
$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);
require_once 'WsScore/WsScore.php';
$ws = new WsScore();
$erreurs = $ws->listError;
$this->view->assign('erreurs', $erreurs);
}
}

View File

@ -1,7 +1,7 @@
<?php
class ErrorController extends Zend_Controller_Action
{
public function errorAction()
public function errorAction()
{
$errors = $this->_getParam('error_handler');
@ -44,3 +44,4 @@ class ErrorController extends Zend_Controller_Action
return $log;
}
}

View File

@ -0,0 +1,20 @@
<?php
class ExportController extends Zend_Controller_Action
{
public function init()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
}
public function indexAction()
{
echo "Export";
}
protected function checkFile($path)
{
}
}

View File

@ -1,261 +1,139 @@
<?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);
}
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() ) {
public function bodaccAction()
{
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
$c = Zend_Registry::get('config');
$directory = $c->profil->path->shared.'/datafile/bodacc/histo';
$directory = '/mnt/bodacc';
$q = $this->getRequest()->getParam('q');
$filename = base64_decode($q);
$q = $this->getRequest()->getParam('q');
$file = base64_decode($q);
$file = $directory.'/'.$filename;
$output_file = $directory.'/'.$file;
if (file_exists($file) && filesize($file) > 0) {
if (file_exists($output_file) && filesize($output_file)>0) {
$content_type = 'application/pdf';
header('Content-type: '.$content_type.'');
header('Content-Length: '.filesize($output_file));
header('Content-MD5: '.base64_encode(md5_file($output_file)));
header('Content-Disposition: inline; filename="'.basename($output_file).'"');
header('Cache-Control: private, max-age=0, must-revalidate');
header('Pragma: public');
ini_set('zlib.output_compression','0');
echo file_get_contents($output_file);
//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);
//Log de la requete
$tabInsert = array(
'login' => $auth->getIdentity()->username,
'idClient' => $auth->getIdentity()->idClient,
'page' => 'histobodacc',
'siren' => '',
'nic' => '',
'params' => $file,
'test' => 0,
'raisonSociale' => '',
'cp' => '',
'ville' => '',
'ipClient' => $_SERVER['REMOTE_ADDR'],
);
require_once 'framework/common/mysql.php';
$iDbCrm = new WDB('sdv1');
$rep = $iDbCrm->insert('logs', array_merge($tabInsert,$tabRdvInsee), false, true);
$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é.";
}
}
} 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 logsAction()
{
$file = $this->getRequest()->getParam('fichier');
$content_type = 'application/csv-tab-delimited-table';
$c = Zend_Registry::get('config');
$path = realpath($c->profil->path->files).'/';
//Envoi du fichier sur la sortie standard
if ( file_exists($path.$file) ) {
header('Content-Transfer-Encoding: none');
header('Content-type: ' . $content_type.'');
header('Content-Length: ' . filesize($path.$file));
header('Content-MD5: ' . base64_encode(md5_file($path.$file)));
header('Content-Disposition: filename="' . basename($path.$file) . '"');
header('Cache-Control: private, max-age=0, must-revalidate');
header('Pragma: public');
ini_set('zlib.output_compression', '0');
echo file_get_contents($path.$file);
}
}
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 csvAction()
{
$file = $this->getRequest()->getParam('fichier');
$content_type = 'application/csv-tab-delimited-table';
$c = Zend_Registry::get('config');
$path = realpath($c->profil->path->files).'/';
//Envoi du fichier sur la sortie standard
if ( file_exists($path.$file) ) {
header('Content-Transfer-Encoding: none');
header('Content-type: ' . $content_type.'');
header('Content-Length: ' . filesize($path.$file));
header('Content-MD5: ' . base64_encode(md5_file($path.$file)));
header('Content-Disposition: filename="' . basename($path.$file) . '"');
header('Cache-Control: private, max-age=0, must-revalidate');
header('Pragma: public');
ini_set('zlib.output_compression', '0');
echo file_get_contents($path.$file);
}
}
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 kbisAction()
{
$file = $this->getRequest()->getParam('fichier');
$content_type = 'application/pdf';
$c = Zend_Registry::get('config');
$path = realpath($c->profil->path->secure).'/kbis/';
//Envoi du fichier sur la sortie standard
if ( file_exists($path.$file) ) {
header('Content-Transfer-Encoding: none');
header('Content-type: ' . $content_type.'');
header('Content-Length: ' . filesize($path.$file));
header('Content-MD5: ' . base64_encode(md5_file($path.$file)));
header('Content-Disposition: filename="' . basename($path.$file) . '"');
header('Cache-Control: private, max-age=0, must-revalidate');
header('Pragma: public');
ini_set('zlib.output_compression', '0');
echo file_get_contents($path.$file);
}
}
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 associationsAction()
{
$file = $this->getRequest()->getParam('fichier');
$content_type = 'application/pdf';
$c = Zend_Registry::get('config');
$path = realpath($c->profil->path->files).'/associations/';
//Envoi du fichier sur la sortie standard
if ( file_exists($path.$file) ) {
header('Content-Transfer-Encoding: none');
header('Content-type: ' . $content_type.'');
header('Content-Length: ' . filesize($path.$file));
header('Content-MD5: ' . base64_encode(md5_file($path.$file)));
header('Content-Disposition: filename="' . basename($path.$file) . '"');
header('Cache-Control: private, max-age=0, must-revalidate');
header('Pragma: public');
ini_set('zlib.output_compression', '0');
echo file_get_contents($path.$file);
}
}
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);
}
}
}
}

View File

@ -0,0 +1,78 @@
<?php
class ImportController extends Zend_Controller_Action
{
public function fileformAction()
{
$this->_helper->layout()->disableLayout();
$this->view->inlineScript()->appendFile('/scripts/jquery.form.js');
$this->view->inlineScript()->appendFile('/scripts/jqueryprogressbar.js');
$this->view->assign('filesize', ini_get('upload_max_filesize'));
$request = $this->getRequest();
$idClient = $request->getParam('idClient', null);
$login = $request->getParam('login', null);
$this->view->assign('idClient', $idClient);
$this->view->assign('login', $login);
}
public function fileuploadAction()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$request = $this->getRequest();
$idClient = $request->getParam('idClient');
$login = $request->getParam('login');
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'path');
$path = realpath($config->data).'/validation';
if(!file_exists($path)) mkdir($path);
if ( isset($_FILES) && count($_FILES)==1 ){
$n = $_FILES['fichier']['name'];
$s = $_FILES['fichier']['size'];
$tmp_name = $_FILES['fichier']['tmp_name'];
$extValide = array('csv');
$extension = strrchr($n,'.');
$extension = substr($extension,1);
//Vérifier l'extension du fichier
if(!in_array($extension, $extValide)){
echo "Extension de fichier incorrect !";
} elseif (move_uploaded_file($tmp_name, $path.'/'.$idClient.'-'.$name.'.'.$extension)){
echo "Fichier envoyé, <a href=\"".
$this->view->url(array(
'controller' => 'import',
'action' => 'checkfile',
'file' => $idClient.'-'.$name.'.'.$extension,
))."\">Vérifier le format</a>";
} else {
echo "Erreur : ".$_FILES['fichier']['error'];
}
}
}
/**
* Etat de progression de l'upload du fichier
*/
public function fileprogressAction()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$request = $this->getRequest();
$key = $request->getParam('key', '');
if (!empty($key)) {
//$rep sera égal à false si la clef n'existe pas dans le cache apc
$rep = apc_fetch('upload_'.$key);
echo json_encode($rep);
}
}
}

View File

@ -1,15 +1,90 @@
<?php
class IndexController extends Zend_Controller_Action
{
protected $serviceList = array();
protected $serviceClientList = array();
public function init()
{
$auth = Zend_Auth::getInstance();
if ( $auth->hasIdentity() ) {
//Lecture des webservices normaux
$services = include APPLICATION_PATH . '/../library/WsScore/ServicesConfig.php';
foreach( $services as $section => $params )
{
if ($params['actif']) {
$wsServices[$section] = $params;
}
}
//Parcourir les webservices
foreach($wsServices as $serviceName => $serviceInfo)
{
if ( !isset($wsServices[$serviceName]['idClient'])
|| $wsServices[$serviceName]['idClient'] == $auth->getIdentity()->idClient)
{
$serviceVersions = array();
$configServiceVersions = $wsServices[$serviceName]['versions'];
foreach( $configServiceVersions as $section => $params )
{
$serviceVersions[$section] = $params;
$this->serviceList[$serviceName]['version'] = $serviceVersions;
}
}
}
//Lecture des webservices Clients
$clients = include APPLICATION_PATH . '/../library/WsScore/Clients/ClientsConfig.php';
foreach( $clients as $section => $params ){
if ($params['actif']) {
$wsClients[$section] = $params;
}
}
//Parcourir les webservices clients
foreach($wsClients as $serviceName => $serviceInfo)
{
if ( $wsClients[$serviceName]['idClient'] == $auth->getIdentity()->idClient ) {
$this->serviceList = array();
}
if ( $wsClients[$serviceName]['idClient'] == $auth->getIdentity()->idClient
|| in_array($auth->getIdentity()->username, $wsClients[$serviceName]['user']) )
{
$serviceVersions = array();
$configServiceVersions = $wsClients[$serviceName]['versions'];
foreach( $configServiceVersions as $section => $params )
{
$serviceVersions[$section] = $params;
$this->serviceList[$serviceName]['version'] = $serviceVersions;
$this->serviceList[$serviceName]['type'] = 'client';
}
}
}
}
}
public function indexAction()
{
$displayWs = array();
if (count($this->serviceList)>0)
{
foreach($this->serviceList as $key => $ws)
{
$displayWs[$key] = $ws;
}
}
$this->view->assign('ws', $displayWs);
}
public function contactAction()
{
}
public function aboutAction()
public function testAction()
{
//Connexion au service - Faire comme ci on charger le WSDL de l'extérieur
//getFunctions / getTypes
//Pour chaque Function, identifier les Types puis proposer les champs associés
//Valider les formulaires pour executer la requête du service
//Utiliser le jeux de tests disponible
}
}

View File

@ -1,106 +1,108 @@
<?php
class JsonrpcController extends Zend_Controller_Action
{
public function indexAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
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();
}
}
}
$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();
}
}
}

View File

@ -1,128 +1,119 @@
<?php
use League\Csv\Writer;
class RefController extends Zend_Controller_Action
{
public function indexAction()
{
//Ne fait rien...
}
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();
/**
* 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;
}
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);
$data = file_get_contents('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 !');
}
}
$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';
/**
* Donne accès aux données contenues dans une table de base de données
*/
public function tableAction ()
{
$requetesql = $this->_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);
}
}
//Emplacement des fichiers générés - lien symbolique en PRODUCTION
$path = DOC_WEB_LOCAL . 'fichiers/';
if (!is_dir($path)) { mkdir($path); }
if (!empty($requetesql))
{
if (!file_exists($path . $fichierCsv))
{
if (file_exists('sql/'.$fichierSql))
{
//Connexion mysql
$sql = file_get_contents('sql/'.$fichierSql);
require_once 'framework/common/mysql.php';
$db = new WDB();
$db->exportCSV($sql, $path . $fichierCsv, ',', "\n");
}
}
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;
}
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);
$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 !');
}
}
}
$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 !');
}
}
}

View File

@ -1,202 +1,173 @@
<?php
/**
* Distribute all SOAP based Web Services
*
*/
require_once 'framework/fwk.php';
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();
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$request = $this->getRequest();
$request = $this->getRequest();
// --- Get the service name, make sure the string is in lower case
$serviceName = strtolower($request->getParam('service', 'Entreprise'));
//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);
//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'];
}
//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'];
}
else
{
//Service versions
$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);
// 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;
}
// 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';
}
// 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.'/Entreprise.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';
}
//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.'/'.$serviceClassName.'.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';
}
$fichierWsdl = $serviceClassName.'-'.$version.'.wsdl';
}
// --- Get map of WSDL type to PHP Classes
$classmap = include $pathServiceClassIni;
//Get map of WSDL type to PHP Classes
$classmap = include $pathServiceClassIni;
//Inclusion des classes de données
require_once $pathServiceClassPhp;
// --- Inclusion des classes de données
require_once $pathServiceClassPhp;
// Fourniture du wsdl
if ( isset($_GET['wsdl']) && file_exists($fichierWsdl) ) {
// --- 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';
if (!headers_sent()) {
header('Content-Type: text/xml');
}
echo file_get_contents($fichierWsdl);
// --- 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);
} elseif ( isset($_GET['wsdl']) && !file_exists($fichierWsdl)
|| isset($_GET['wsdl-generate'])
|| isset($_GET['wsdl-auto']) ) {
if ($hostScheme == 'https') {
$wsdl->setUri($hostScheme.'://'.$hostName.'/'.$pathServiceUri);
}
// 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);
// --- 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);
}
// Enregistrement du WSDL dans un fichier
if ( isset($_GET['wsdl-generate']) ) {
if (file_exists($fichierWsdl)) {
unlink($fichierWsdl);
}
$wsdl->dump($fichierWsdl);
echo "Le fichier $fichierWsdl a été généré";
// --- 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"
);
}
//Génération/Fourniture du wsdl
} elseif (isset($_GET['wsdl']) && !file_exists($fichierWsdl)) {
$wsdl->dump($fichierWsdl);
if (!headers_sent()) {
header('Content-Type: text/xml');
}
echo file_get_contents($fichierWsdl);
// --- 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);
// Envoi sur la sortie standard le wsdl sans enregistrement dans un fichier
} elseif ( isset($_GET['wsdl-auto']) ){
$wsdl->handle();
}
// --- Création du service
$server->setObject(new $serviceClassName());
$server->handle();
// Fourniture du service
} else {
// --- 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);
}
}
// Traitement
if (APPLICATION_ENV == 'production' && file_exists($fichierWsdl)) {
$server = new Zend_Soap_Server($fichierWsdl);
} else {
$hostName = $this->getRequest()->getHttpHost();
$server = new Zend_Soap_Server('http://'.$hostName.'/'.$pathServiceUrl);
}
$server->setSoapFeatures(SOAP_USE_XSI_ARRAY_TYPE + SOAP_SINGLE_ELEMENT_ARRAYS);
$server->setClassmap($classmap);
$server->setEncoding('UTF-8');
$server->registerFaultException(array('WsScores_Exception'));
$server->setWsiCompliant(true);
$server->setObject(new $serviceClassName());
$server->handle();
//Pour débuggage ultime
$debug = false;
if ($debug){
$request = $server->getLastRequest();
file_put_contents(APPLICATION_PATH . '/../request.log', $request);
$response = $server->getLastResponse();
file_put_contents(APPLICATION_PATH . '/../response.log', $response);
}
}
}
}
}

View File

@ -1,133 +1,67 @@
<?php
class UserController extends Zend_Controller_Action
{
public function indexAction()
class UserController extends Zend_Controller_Action {
public function init()
{
$activeNav = $this->view->navigation();
$activeNav->removePages();
}
public function indexAction()
{
}
public function loginAction()
{
}
$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_AuthAdapter($login, $pass);
$result = $auth->authenticate($authAdapter);
if (!$result->isValid()){
$this->view->message = '';
foreach ($result->getMessages() as $message) {
$this->view->message.= $message."<br/>";
}
} else {
$timeout = $auth->getIdentity()->timeout;
public function loginAction()
{
$this->_helper->layout()->disableLayout();
//Ecrit un cookie persistant valide pendant le temps definit
Zend_Session::rememberMe($timeout);
$this->view->headLink()->appendStylesheet('/assets/themes/default/css/signin.css', 'all');
$storage = new Zend_Auth_Storage_Session();
$sessionNamespace = new Zend_Session_Namespace($storage->getNamespace());
$sessionNamespace->setExpirationSeconds($timeout);
$auth->setStorage($storage);
$url = '';
if (Zend_Session::namespaceIsset('login')){
$session = new Zend_Session_Namespace('login');
if (isset($session->url)) {
$url = $session->url;
}
}
if (!empty($url)){
$this->_redirect($url);
}
$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;
$this->_redirect('/');
}
//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();
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;
}
}
}

View File

@ -3,4 +3,5 @@ class Application_Model_JoScoresSurveillance extends Zend_Db_Table_Abstract
{
protected $_name = 'scores_surveillance';
protected $_schema = 'jo';
protected $_primary = 'siren';
}

View File

@ -0,0 +1,14 @@
<?php
class Application_Model_Sdv1ClientsServices extends Zend_Db_Table_Abstract
{
protected $_name = 'clients_services';
protected $_schema = 'sdv1';
protected $_referenceMap = array(
'Login' => array(
'columns' => array('code'),
'refTableClass' => 'Application_Model_Sdv1UtilistateursService',
'refColumns' => array('serviceCode')
)
);
}

View File

@ -0,0 +1,6 @@
<?php
class Application_Model_Sdv1GreffeCommandes extends Zend_Db_Table_Abstract
{
protected $_name = 'greffe_commandes';
protected $_schema = 'sdv1';
}

View File

@ -0,0 +1,6 @@
<?php
class Application_Model_Sdv1TabCities extends Zend_Db_Table_Abstract
{
protected $_name = 'zonesVilles';
protected $_schema = 'sdv1';
}

View File

@ -9,9 +9,9 @@ class Application_Model_Sdv1Utilisateurs extends Zend_Db_Table_Abstract
'refTableClass' => 'Sdv1Clients',
'refColumns' => 'id'
),
'ServiceCode' => array(
'Service' => array(
'columns' => 'login',
'refTableClass' => 'Sdv1ClientsServicesUsers',
'refTableClass' => 'Sdv1UtilisateursService',
'refColumns' => 'login'
),
);

View File

@ -1,7 +1,8 @@
<?php
class Zend_View_Helper_DocComplement extends Zend_View_Helper_Abstract
{
public function docComplement($method)
{
}
}
public function docComplement($method)
{
}
}

View File

@ -1,8 +1,8 @@
<?php
class Zend_View_Helper_DocDescription extends Zend_View_Helper_Abstract
{
public function docDescription($method)
{
return $method['desc'];
}
}
public function docDescription($method)
{
return $method['desc'];
}
}

View File

@ -1,31 +1,32 @@
<?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#'
);
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.= '&nbsp;';
}
}
return $exemple;
}
}
foreach ($langages as $langage => $lib){
$fichier = 'code/'.$method.'-'.$langage.'.txt';
if (file_exists($fichier)){
$url = $this->view->url(
array(
'controller' => 'documentation',
'action' => 'code',
'langage' => $langage,
'element' => $method,
)
);
$exemple.= '<a href="'.$url.'">' . $lib . '</a>';
$exemple.= '&nbsp;';
}
}
return $exemple;
}
}

View File

@ -1,59 +1,61 @@
<?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 = '';
protected $_transcodeType = array(
'str' => 'string',
'bool' => 'boolean',
'integer' => 'int',
);
$returnType = $method['return'];
$methodName = $method['name'];
public function docMethod($method)
{
$output = '';
$cptParameters = 0;
$parameters = '';
foreach ($method['params'] as $param) {
if (isset($param['optional'])) {
$parameters.= '[';
}
$parameters.= '<i>' . $this->transcodeType($param['type']) . '</i>';
$parameters.= '&nbsp;';
$parameters.= '<b>' . $param['name'] . '</b>';
$returnType = $method['return'];
$methodName = $method['name'];
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;
}
$cptParameters = 0;
$parameters = '';
foreach ($method['params'] as $param) {
if (isset($param['optional'])) {
$parameters.= '[';
}
$parameters.= '<i>' . $this->transcodeType($param['type']) . '</i>';
$parameters.= '&nbsp;';
$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;
}
}
private function transcodeType($type)
{
if (array_key_exists($type, $this->_transcodeType)) {
return $this->_transcodeType[$type];
} else {
return $type;
}
}
}

View File

@ -1,80 +1,81 @@
<?php
class Zend_View_Helper_DocParameter extends Zend_View_Helper_Abstract
{
protected $serviceTypes;
protected $serviceTypes;
protected $types = array(
'string', 'str',
'boolean', 'bool',
'int', 'integer', 'long',
'float', 'double',
'array', 'object', 'mixed'
);
protected $types = array(
'string', 'str',
'boolean', 'bool',
'int', 'integer', 'long',
'float', 'double',
'array', 'object', 'mixed'
);
protected $_transcodeType = array(
'str' => 'string',
'bool' => 'boolean',
'integer' => 'int',
);
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;
}
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 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 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;
}
}
}
private function transcodeType($type)
{
if(array_key_exists($type, $this->_transcodeType)){
return $this->_transcodeType[$type];
} else {
return $type;
}
}
}

View File

@ -1,73 +1,74 @@
<?php
class Zend_View_Helper_DocReturn extends Zend_View_Helper_Abstract
{
protected $serviceTypes;
protected $serviceTypes;
protected $types = array(
'string', 'str',
'boolean', 'bool',
'integer', 'int', 'long',
'float', 'double',
'array', 'object', 'mixed'
);
protected $types = array(
'string', 'str',
'boolean', 'bool',
'integer', 'int', 'long',
'float', 'double',
'array', 'object', 'mixed'
);
protected $_transcodeType = array(
'str' => 'string',
'bool' => 'boolean',
'integer' => 'int',
);
protected $_transcodeType = array(
'str' => 'string',
'bool' => 'boolean',
'integer' => 'int',
);
public function docReturn($type, $serviceTypes)
{
$this->serviceTypes = $serviceTypes;
return $this->parseType($type);
}
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 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 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;
}
}
private function transcodeType($type)
{
if (array_key_exists($type, $this->_transcodeType)) {
return $this->_transcodeType[$type];
} else {
return $type;
}
}
}

View File

@ -2,16 +2,16 @@
class Zend_View_Helper_ProfileLink extends Zend_View_Helper_Abstract
{
public function profileLink()
{
$auth = Zend_Auth::getInstance();
public function profileLink()
{
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
$username = $auth->getIdentity()->username;
$logoutUrl = $this->view->url(array(
'controller' => 'user',
'action' => 'logout'
'controller' => 'user',
'action' => 'logout'
), null, true);
return '<a href="'.$logoutUrl.'" title="Se déconnecter" class="navbar-link">Déconnexion : ' . $username . '</a>';
return '<a href="'.$logoutUrl.'" alt="Se déconnecter">Déconnexion : ' . $username . '</a>';
}
}
}
}
}

View File

@ -1,12 +1,13 @@
<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){ ?>
<?php
foreach($this->methods as $method){
?>
<li>
<a href="<?php echo $method['url'];?>">
<?php echo $method['nom'];?></a>
</li>
<?php } ?>
<?php
}
?>
</ul>

View File

@ -1,2 +1,2 @@
<h2><?=$this->langage?></h2>
<?=$this->code?>
<pre><?=$this->code?></pre>

View File

@ -1,48 +1,46 @@
<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 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>
<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="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="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>
<div class="op-detail">
<h1>Détails :</h1>
<?php foreach ($this->serviceMethods as $method) {?>
<div class="function">
<a name="<?=$method['name']?>">&nbsp;</a>
<h2><?=$method['name']?></h2>
<div class="titre">Description :</div>
<div class="description"><?=$this->docDescription($method)?></div>
<div class="titre">Empreinte :</div>
<div class="complement"><?=$this->docComplement($method)?></div>
<div class="function-detail" id="<?=$method['name']?>">
<p><?=$this->docMethod($method)?></p>
<div class="titre">Paramètres :</div>
<div class="parameters">
<?=$this->docParameter($method['params'], $this->serviceTypes);?>
</div>
<div class="titre">Retour :</div>
<div class="return">
<?=$this->docReturn($method['return'], $this->serviceTypes);?>
</div>
</div>
<?php $exemple = $this->docExemple($method['name'])?>
<?php if (!empty($exemple)) {?>
<p>Exemple : <?=$exemple?></p>
<?php }?>
</div>
<?php } ?>
</div>

View File

@ -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 } ?>

View File

@ -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 } ?>

View File

@ -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 } ?>

View File

@ -1,18 +1,28 @@
<h1>An error occurred</h1>
<h2><?php echo $this->message ?></h2>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Zend Framework Default Application</title>
</head>
<body>
<h1>An error occurred</h1>
<h2><?php echo $this->message ?></h2>
<?php if (isset($this->exception)): ?>
<?php if (isset($this->exception)): ?>
<h3>Exception information:</h3>
<p>
<b>Message:</b> <?php echo $this->exception->getMessage() ?>
</p>
<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>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 ?>
<h3>Request Parameters:</h3>
<pre><?php echo var_export($this->request->getParams(), true) ?>
</pre>
<?php endif ?>
</body>
</html>

View File

@ -1,3 +1 @@
<div class="container">
<p class="text-muted credit"> &copy; <?=date('Y')?> <a href="http://www.scores-decisions.com">Scores & Décisions SAS</a>.</p>
</div>
<?php

View File

@ -1,38 +1,12 @@
<!-- 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>
<h1>WebService Scores & Décisions</h1>
<div>
<div id="menu">
<?php echo $this->navigation()->menu(); ?>
</div>
<div style="float:right;">
<?php echo $this->profileLink(); ?>
</div>
<div id="breadcrumbs" style="clear:both;">
<?php /*echo $this->navigation()->breadcrumbs()->setMinDepth(0)->setLinkLast(true)->setSeparator(" >> ");*/ ?>
</div>
</div>

View File

@ -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>

View File

@ -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>

View File

@ -1,7 +1,82 @@
<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.
<h1>Liste des services disponibles</h1>
<ul>
<?php foreach ($this->ws as $key => $ws) {?>
<li>
<?php if (array_key_exists('type', $ws) && $ws['type'] == 'client') {?>
<a href="<?=$this->url(array('controller' => 'documentation', 'action' => 'clients', 'nom' => strtolower($key)))?>">
<?=ucfirst($key)?>
</a>
<?php } else {?>
<a href="<?=$this->url(array('controller' => 'documentation', 'ws' => $key))?>">
<?=ucfirst($key)?>
</a>
<?php }?>
</li>
<?php if (isset($ws['version'])) { ?>
<ul>
<?php foreach ($ws['version'] as $version => $versionElement) { ?>
<?php if ($versionElement['actif']) { ?>
<li>
<?php if (array_key_exists('type', $ws) && $ws['type'] == 'client') {?>
<a href="<?=$this->url(array(
'controller' => 'documentation',
'action' => 'clients',
'nom' => strtolower($key),
'version' => $version,
))?>">Version <?=$version?></a>
<?php } else {?>
<a href="<?=$this->url(array(
'controller' => 'documentation',
'ws' => $key,
'version' => $version,
))?>">Version <?=$version?></a>
<?php }?>
<?php echo ( $versionElement['defaut']) ? '(défaut)' : '';?>
</li>
<?php } ?>
<?php } ?>
</ul>
<?php } ?>
<?php } ?>
</ul>
<br/>
<h1>Authentification</h1>
<p>
Le WebService utilise une authentification http basique.
Il s'agit donc de transmettre comme paramètres d'authentification
</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>
<p>http://{login}:{password}@url</p>
<p>
{password} est une chaine construite de cette façon md5({login}|{pass}) <br/>
ou {login} est l'identifiant fournit <br/>
et {pass} le mot de passe fournit.
</p>
<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>
<br/>
<h1>Compatibilité</h1>
<p>Notre service web a été testé avec ces langages/librairies</p>
<ul>
<li>PHP : PHP5 SOAP Extension</li>
<li>Perl : SOAP::Lite</li>
<li>Java : JAX-WS</li>
<li>(En cours de test) - Python : SOAPpy</li>
<li>(En cours de test) - C# : .Net Framework</li>
<li>(En cours de test) - VB.Net : .Net Framework</li>
<li>(En cours de test) - 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>

View File

@ -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>

View File

@ -0,0 +1,23 @@
<?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="global">
<div id="header">
<?php echo $this->render('header.phtml') ?>
</div>
<div id="content" style="clear:both;">
<?php echo $this->layout()->content; ?>
</div>
<div id="footer">
<?php echo $this->render('footer.phtml'); ?>
</div>
</div>
</body>
</html>

View File

@ -1,33 +1,2 @@
<?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>
<p>Identifiez-vous pour accèder aux ressources</p>
<?=$this->form?>

View File

@ -1,24 +1 @@
<?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>
Vous avez été déconnecté.

View File

@ -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>

View File

@ -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);
}

View File

@ -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);
}
}
}

View File

@ -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";
}
}
?>

View File

@ -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 -
*/

View File

@ -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);
}

View File

@ -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"
}
]
}

View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -1,95 +1,18 @@
WebService
==========
README
======
Le webservice est basé sur le ZendFramework pour générer les WSDLs.
- 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
Fichier de configuration
========================
La configuration est décomposé en plusieurs fichiers,
avec adaptation suivant la machine
- mysql.php
- smtp.php
- sphinx.php
- stockage.php
sans adaptation suivant la machine
- partenaires.php
Fonctionnement
==============
@ -160,4 +83,97 @@ Pour spécifier des éléments de taille (non pris en compte sur le WSDL)
@xsd minLength=9
@xsd maxLength=15
Configuration PHP
=================
apt-get install php5-mysql
apt-get install php-apc
apt-get install php5-curl
apt-get install php5-xmlrpc
Paquet PEAR
- Mail
- Mail_Mime
WKHTMLTOPDF
===========
apt-get install libXrender1
apt-get install libfontconfig
Configuration VHOST
===================
a2enmod rewrite
Exemple de vhost en mode développement
<VirtualHost *:80>
ServerName scoresws.sd.dev
AddDefaultCharset utf-8
# Pour la gestion des ports : $_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT']
UseCanonicalName On
UseCanonicalPhysicalPort On
DocumentRoot "D:/www/webservice/public"
SetEnv APPLICATION_ENV "development"
<Directory "D:/www/webservice/public/">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
<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>
# Possible values include: debug, info, notice, warn, error, crit, alert, emerg.
LogLevel debug
ErrorLog "logs/scoresws.sd.dev-error.log"
CustomLog "logs/scoresws.sd.dev-access.log" common
</VirtualHost>
Vhost réel
<VirtualHost *:8081>
ServerName wse.scores-decisions.com
ServerAlias wse1.scores-decisions.com
# Pour la gestion des ports : $_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT']
UseCanonicalName On
UseCanonicalPhysicalPort On
ServerSignature Off
AddDefaultCharset utf-8
DocumentRoot /home/vhosts/webservice/public
SetEnv APPLICATION_ENV "production"
<Directory /home/vhosts/webservice/public/>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
<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>
# Possible values include: debug, info, notice, warn, error, crit, alert, emerg.
LogLevel error
ErrorLog /var/log/apache2/webservice-error.log
CustomLog /var/log/apache2/webservice-access.log common
</VirtualHost>

View File

@ -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"

View File

@ -13,19 +13,17 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
$action = $request->getActionName();
$checkAuth = true;
// --- Pas d'authentification sur la demande d'authentification
//Pas d'authentification sur la demande d'authentification
if ( $controller == 'user' && $action == 'login' ) {
$checkAuth = false;
}
// --- Pas d'authentification sur ces services
// Pas d'authentification sur ces services
if ( in_array($controller, array('service', 'import'))
|| ( $controller == 'fichier' && $action == 'logs' )
|| ( $controller == 'fichier' && $action == 'logs' )
|| ( $controller == 'fichier' && $action == 'kbis' )
|| ( $controller == 'fichier' && $action == 'csv' )
|| ( $controller == 'fichier' && $action == 'associations' )
|| ( $controller == 'fichier' && $action == 'greffes' )
|| ( $controller == 'fichier' && $action == 'crm' )) {
|| ( $controller == 'fichier' && $action == 'associations' )) {
$checkAuth = false;
}
@ -42,46 +40,59 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
if (!empty($hach)) {
$pass = $hach;
}
$auth = Zend_Auth::getInstance();
// --- On vérifie le tout lors d'une connexion par url
//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);
$authAdapter = new Scores_AuthAdapter($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);
if (!$result->isValid()) {
$layout = Zend_Layout::getMVCInstance();
if ( !$layout->isEnabled() ){
echo "Identification incorrect ou périmé.";
} else {
$request->setModuleName('default')
->setControllerName('user')
->setActionName('logout');
}
} else {
$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é
//Sinon on reste sur le standard
} else {
//Pas authentifié
if ( !$auth->hasIdentity() || time() > $auth->getIdentity()->time ) {
$layout = Zend_Layout::getMVCInstance();
$auth->clearIdentity();
$session = new Zend_Session_Namespace('login');
$session->url = $_SERVER['REQUEST_URI'];
$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();
//Authentifié => on met à jour la session
} else {
$identity = $auth->getIdentity();
$identity->time = time() + $identity->timeout;
$auth->getStorage()->write($identity);
if (Zend_Session::namespaceIsset('login')){
Zend_Session::namespaceUnset('login');
}
}
}
}

View File

@ -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);
}
}
}

View File

@ -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
}
}

View File

@ -1,6 +0,0 @@
<?php
class Application_Model_InseeDepartements extends Zend_Db_Table_Abstract
{
protected $_name = 'departements';
protected $_schema = 'insee';
}

Some files were not shown because too many files have changed in this diff Show More