From 6f003be55b349a51d9256cff370b39c8db42ddea Mon Sep 17 00:00:00 2001 From: Michael RICOIS Date: Fri, 30 Nov 2012 13:51:48 +0000 Subject: [PATCH] Use new configuration file --- application/Bootstrap.php | 38 +- application/configs/application.ini | 69 +- application/controllers/FichierController.php | 44 +- .../Application/Controller/Plugin/Auth.php | 6 +- library/Infogreffe/Config.php | 2 +- library/Infogreffe/Infogreffe.php | 308 ++++- library/Metier/partenaires/classMFedaso.php | 2 +- library/Metier/partenaires/classMLiensPre.php | 473 ------- library/Metier/scores/classMScores.php | 2 +- library/WsScore/Configure.php | 101 ++ library/WsScore/Gestion/v0.1/Gestion.php | 57 +- library/WsScore/Gestion/v0.2/Gestion.php | 9 +- library/WsScore/Gestion/v0.3/Gestion.php | 15 +- library/WsScore/Pieces/v0.1/Pieces.php | 199 ++- library/WsScore/Saisie/v0.2/Saisie.php | 6 +- library/WsScore/WsScore.php | 6 +- public/index.php | 2 - .../build/config/WebRecette/application.ini | 93 ++ .../build/config/WebService/application.ini | 93 ++ .../config/_files/kbis/styles/infogreffe.css | 1110 +++++++++++++++ .../_files/kbis/styles/infogreffe_base.css | 1212 +++++++++++++++++ scripts/build/config/_files/tables/voies.csv | 208 +++ .../build/config/_sql/historiques.bilans.sql | 19 + scripts/build/config/_sql/jo.asso_actes.sql | 14 + scripts/build/config/_sql/jo.bilans_user.sql | 10 + scripts/build/config/_sql/logsCount.sql | 14 + .../config/_sql/sdv1.clients_services.sql | 6 + .../build/config/_sql/sdv1.clients_tarifs.sql | 13 + .../build/config/_sql/sdv1.prestations.sql | 31 + .../config/_sql/sdv1.utilisateurs_service.sql | 5 + scripts/build/config/local/application.ini | 92 ++ .../build/config/sdsrvdev01/application.ini | 93 ++ scripts/build/configure.php | 93 ++ scripts/jobs/calculRatios.php | 284 ++++ scripts/jobs/genCodeRatios.php | 585 ++++++++ scripts/jobs/genwsdl.php | 80 ++ scripts/jobs/getActesAsso.php | 142 ++ scripts/jobs/getKbis.php | 603 ++++++++ scripts/jobs/removeTempFile.php | 84 ++ scripts/jobs/setLogsCount.php | 48 + scripts/jobs/sql2csv.php | 94 ++ 41 files changed, 5695 insertions(+), 670 deletions(-) delete mode 100644 library/Metier/partenaires/classMLiensPre.php create mode 100644 library/WsScore/Configure.php create mode 100644 scripts/build/config/WebRecette/application.ini create mode 100644 scripts/build/config/WebService/application.ini create mode 100644 scripts/build/config/_files/kbis/styles/infogreffe.css create mode 100644 scripts/build/config/_files/kbis/styles/infogreffe_base.css create mode 100644 scripts/build/config/_files/tables/voies.csv create mode 100644 scripts/build/config/_sql/historiques.bilans.sql create mode 100644 scripts/build/config/_sql/jo.asso_actes.sql create mode 100644 scripts/build/config/_sql/jo.bilans_user.sql create mode 100644 scripts/build/config/_sql/logsCount.sql create mode 100644 scripts/build/config/_sql/sdv1.clients_services.sql create mode 100644 scripts/build/config/_sql/sdv1.clients_tarifs.sql create mode 100644 scripts/build/config/_sql/sdv1.prestations.sql create mode 100644 scripts/build/config/_sql/sdv1.utilisateurs_service.sql create mode 100644 scripts/build/config/local/application.ini create mode 100644 scripts/build/config/sdsrvdev01/application.ini create mode 100644 scripts/build/configure.php create mode 100644 scripts/jobs/calculRatios.php create mode 100644 scripts/jobs/genCodeRatios.php create mode 100644 scripts/jobs/genwsdl.php create mode 100644 scripts/jobs/getActesAsso.php create mode 100644 scripts/jobs/getKbis.php create mode 100644 scripts/jobs/removeTempFile.php create mode 100644 scripts/jobs/setLogsCount.php create mode 100644 scripts/jobs/sql2csv.php diff --git a/application/Bootstrap.php b/application/Bootstrap.php index 928a0061..e03e58be 100644 --- a/application/Bootstrap.php +++ b/application/Bootstrap.php @@ -1,13 +1,30 @@ getOptions()); + Zend_Registry::set('config', $config); + + //Load old config + require_once 'WsScore/Configure.php'; + $oldconfig = new Configure(); + + /*echo "
";
+        print_r(get_defined_constants(true));
+        echo "
"; + exit;*/ + + 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('XHTML1_STRICT'); + $view->doctype('HTML5'); $view->headMeta() ->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8') ->appendHttpEquiv('Content-Language', 'fr-FR'); @@ -24,19 +41,9 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap protected function _initLogging() { $WsLogger = new Zend_Log(); - $WsFileWriter = new Zend_Log_Writer_Stream(LOG_PATH.'/wsentreprise.log'); + $WsFileWriter = new Zend_Log_Writer_Stream($config->profil->path->log.'/wsentreprise.log'); $WsFileWriter->addFilter(Zend_Log::INFO); $WsLogger->addWriter($WsFileWriter); - if (APPLICATION_ENV == 'production') - { - $WsMail = new Zend_Mail(); - $WsMail->setFrom('production@scores-decisions.com') - ->addTo('mricois@scores-decisions.com'); - $WsMailWriter = new Zend_Log_Writer_Mail($WsMail); - $WsMailWriter->setSubjectPrependText('ERREUR'); - $WsMailWriter->addFilter(Zend_Log::ERR); - $WsLogger->addWriter($WsMailWriter); - } Zend_Registry::set('WsLogger', $WsLogger); } @@ -123,6 +130,11 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap )); $router->addRoute('client', $route); + $fichierRoute = new Zend_Controller_Router_Route('fichier/:action/:fichier', array( + 'controller' => 'fichier', + 'fichier' => '', + )); + $router->addRoute('fichier', $fichierRoute); return $router; } diff --git a/application/configs/application.ini b/application/configs/application.ini index ff82e97f..6d04f533 100644 --- a/application/configs/application.ini +++ b/application/configs/application.ini @@ -5,10 +5,7 @@ phpSettings.display_errors = 0 bootstrap.path = APPLICATION_PATH "/Bootstrap.php" bootstrap.class = "Bootstrap" appnamespace = "Application" -;resources.session.save_path = APPLICATION_PATH "/../cache/sessions" -;resources.session.gc_maxlifetime = 86400 -;resources.session.cookie_lifetime = 86400 -;resources.session.remember_me_seconds = 86400 +resources.session.save_path = APPLICATION_PATH "/../data/sessions" resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers" resources.frontController.plugins.Auth = "Application_Controller_Plugin_Auth" resources.frontController.params.displayExceptions = 0 @@ -19,10 +16,72 @@ autoloaderNamespaces[] = "Application_" autoloaderNamespaces[] = "Scores_" autoloaderNamespaces[] = "Form_" +; Scores configuration +profil.server.name = development +profil.mail.method = smtp +profil.mail.smtp_host = smtp.free.fr +profil.mail.email.support = supportdev@scores-decisions.com +profil.mail.email.supportdev = supportdev@scores-decisions.com +profil.mail.email.contact = supportdev@scores-decisions.com +profil.mail.email.production = supportdev@scores-decisions.com +profil.wkhtmltopdf.path = "c:\Users\mricois\www\data\wkhtml" +profil.wkhtmltopdf.arch = "amd64" +profil.path.batch = APPLICATION_PATH "/../scripts/jobs" +profil.path.cache = APPLICATION_PATH "/../data/cache" +profil.path.files = APPLICATION_PATH "/../data/files" +profil.path.log = APPLICATION_PATH "/../data/log" +profil.path.data = "c:\Users\mricois\www\dataws" +profil.path.secure = "c:\Users\mricois\www\dataws" + +profil.sphinx.ent.host = "192.168.78.252" +profil.sphinx.ent.port = 3312 +profil.sphinx.ent.version = 2 +profil.sphinx.dir.host = "192.168.78.252" +profil.sphinx.dir.port = 3312 +profil.sphinx.dir.version = 2 +profil.sphinx.act.host = "192.168.78.252" +profil.sphinx.act.port = 3312 +profil.sphinx.act.version = 2 +profil.sphinx.histo.host = "192.168.78.252" +profil.sphinx.histo.port = 3312 +profil.sphinx.histo.version = 2 + +; For old configuration - see WsScores/Configure.php +profil.db.default.adapter=mysqli +profil.db.default.params.host=192.168.78.230 +profil.db.default.params.username=root +profil.db.default.params.password=scores +profil.db.default.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8" + +; Complete database configuration +profil.db.sdv1.adapter=mysqli +profil.db.sdv1.params.host=192.168.78.230 +profil.db.sdv1.params.username=wsuser +profil.db.sdv1.params.password=scores +profil.db.sdv1.params.dbname=sdv1 +profil.db.sdv1.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8" +profil.db.sdv1.params.persistent = true + +profil.db.jo.adapter=mysqli +profil.db.jo.params.host=192.168.78.230 +profil.db.jo.params.username=wsuser +profil.db.jo.params.password=scores +profil.db.jo.params.dbname=jo +profil.db.jo.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8" +profil.db.jo.params.persistent = true + +profil.db.historiques.adapter=mysqli +profil.db.historiques.params.host=192.168.78.230 +profil.db.historiques.params.username=wsuser +profil.db.historiques.params.password=scores +profil.db.historiques.params.dbname=historiques +profil.db.historiques.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8" +profil.db.historiques.params.persistent = true + + [staging : production] resources.frontController.params.displayExceptions = 1 - [development : production] phpSettings.display_startup_errors = 1 phpSettings.display_errors = 1 diff --git a/application/controllers/FichierController.php b/application/controllers/FichierController.php index 01ca153e..230370ec 100644 --- a/application/controllers/FichierController.php +++ b/application/controllers/FichierController.php @@ -11,8 +11,8 @@ class FichierController extends Zend_Controller_Action { $auth = Zend_Auth::getInstance(); if ( $auth->hasIdentity() ) { - - $directory = realpath(DOC_WEB_LOCAL).'/bodacc'; + + $directory = '/mnt/bodacc'; $q = $this->getRequest()->getParam('q'); $file = base64_decode($q); @@ -55,5 +55,45 @@ class FichierController extends Zend_Controller_Action } } + + 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 kbisAction() + { + $file = $this->getRequest()->getParam('fichier'); + $content_type = 'application/csv-tab-delimited-table'; + $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); + } + } } \ No newline at end of file diff --git a/library/Application/Controller/Plugin/Auth.php b/library/Application/Controller/Plugin/Auth.php index 0462cdac..c1617f10 100644 --- a/library/Application/Controller/Plugin/Auth.php +++ b/library/Application/Controller/Plugin/Auth.php @@ -11,12 +11,12 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract { $checkAuth = true; //Pas d'authentification sur la demande d'authentification - if ($request->getControllerName()=='user' && $request->getActionName()=='login'){ + if ($request->getControllerName()=='user' && $request->getActionName()=='login') { $checkAuth = false; } // Pas d'authentification sur ces services - if (in_array($request->getControllerName(), array('service', 'import')) ) { + if (in_array($request->getControllerName(), array('service', 'import', 'fichier')) ) { $checkAuth = false; } @@ -74,7 +74,7 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract //Authentifié => on met à jour la session } else { - $identity = $auth->getIdentity(); + $identity = $auth->getIdentity(); $identity->time = time() + $identity->timeout; $auth->getStorage()->write($identity); diff --git a/library/Infogreffe/Config.php b/library/Infogreffe/Config.php index d415009e..b650eb5e 100644 --- a/library/Infogreffe/Config.php +++ b/library/Infogreffe/Config.php @@ -36,5 +36,5 @@ class Infogreffe_Config * Directory where cache file are store * @var string */ - protected $cachePath = ''; + protected $cachePath = '/cache/'; } \ No newline at end of file diff --git a/library/Infogreffe/Infogreffe.php b/library/Infogreffe/Infogreffe.php index eb7d4bc5..8f53a507 100644 --- a/library/Infogreffe/Infogreffe.php +++ b/library/Infogreffe/Infogreffe.php @@ -48,10 +48,10 @@ class Infogreffe extends Infogreffe_Config protected $vecteur; /** - * String which contain reference - * @var string + * Elements de référence + * @var array */ - protected $option; + protected $option = array(); /** * Error number @@ -71,7 +71,7 @@ class Infogreffe extends Infogreffe_Config /** * Define path where PDF file are store */ - $this->dataPath = ''; + $this->dataPath = SECURE_STORAGE; /** * Define path where XML cache file are store @@ -124,65 +124,31 @@ class Infogreffe extends Infogreffe_Config $commande->addChild('num_siren', $this->siren); // Commande de documents : bilan saisie ou bilan complet - if ( ($this->typeCommande=='BS' || $this->typeCommande=='BI') && $this->option!='' ) + if ( ($this->typeCommande=='BS' || $this->typeCommande=='BI') && count($this->option)>0 ) { - - /* Format de la variable option pour la commande de type BI ou BS - * 0 => millesime - * 1 => date_cloture - * 2 => greffe - * 3 => dossier_millesime - * 4 => dossier_statut - * 5 => dossier_chrono - * 6 => num_depot - */ - $ref = explode('-', $this->option); - $commande->addChild('greffe',$ref[2]); - $commande->addChild('dossier_millesime',$ref[3]); - $commande->addChild('dossier_statut',$ref[4]); - $commande->addChild('dossier_chrono',$ref[5]); - $commande->addChild('num_depot',$ref[6]); - $commande->addChild('date_cloture', WDate::dateT('Ymd','d/m/Y', $ref[1])); + $commande->addChild('greffe',$this->option['greffe']); + $commande->addChild('dossier_millesime',$this->option['dossier_millesime']); + $commande->addChild('dossier_statut',$this->option['dossier_statut']); + $commande->addChild('dossier_chrono',$this->option['dossier_chrono']); + $commande->addChild('num_depot',$this->option['num_depot']); + $commande->addChild('date_cloture', $this->option['date_cloture']); } // Commande de documents : actes - elseif ( $this->typeCommande=='AC' && !empty($this->option) ) + elseif ( $this->typeCommande=='AC' && count($this->option)>0 ) { - /* Format de la variable option pour commande type AC - * 0 => type_acte - * 1 => date de référence - * 2 => greffe - * 3 => dossier_millesime - * 4 => dossier_statut - * 5 => dossier_chrono - * 6 => num_depot - * 7 => num_acte - */ - $ref = explode('-', $this->option); - $num_actes = explode('|', $ref[7]); - $commande->addChild('greffe',$ref[2]); - $commande->addChild('dossier_millesime', $ref[3]); - $commande->addChild('dossier_statut', $ref[4]); - $commande->addChild('dossier_chrono', $ref[5]); - $commande->addChild('num_depot', $ref[6]); + $commande->addChild('greffe',$this->option['greffe']); + $commande->addChild('dossier_millesime',$this->option['dossier_millesime']); + $commande->addChild('dossier_statut',$this->option['dossier_statut']); + $commande->addChild('dossier_chrono',$this->option['dossier_chrono']); + $commande->addChild('num_depot',$this->option['num_depot']); $liste_actes = $commande->addChild('liste_actes'); - if(is_array($num_actes) && count($num_actes)>1) - { - foreach($num_actes as $num_acte) - { - $liste_actes->addChild('acte')->addAttribute('num', $num_acte); - } - } - else - { - $liste_actes->addChild('acte')->addAttribute('num', $ref[7]); - $fichierOption = $this->option; - } + $liste_actes->addChild('acte')->addAttribute('num', $this->option['num_acte']); } $xmlStr = str_replace('', '', $xml->asXML()); //Be sure it's in UTF-8 - $req = utf8_encode($xml); + $req = utf8_encode($xmlStr); //Create XML request $post = ''. @@ -200,7 +166,7 @@ class Infogreffe extends Infogreffe_Config ''; $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $this->url); + curl_setopt($ch, CURLOPT_URL, $this->config[$env]['URL']); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_COOKIEFILE,TRUE); curl_setopt($ch, CURLOPT_POST, TRUE); @@ -210,7 +176,7 @@ class Infogreffe extends Infogreffe_Config //Remove SOAP part of XML $response = str_replace("", '', $response); - $response = str_replace('','', $response); + $response = str_replace('','', $response); return $response; } @@ -235,12 +201,12 @@ class Infogreffe extends Infogreffe_Config if( $errNum == '5' ){ $errMsg = 'Service partenaire indisponible.'; } - throw new Exception($errNum . '-' . $errMsg, 'ERR'); + throw new Exception($errNum . '-' . $errMsg); } } else { - throw new Exception('Fichier vide', 'ERR'); + throw new Exception('Fichier vide'); } } @@ -248,6 +214,7 @@ class Infogreffe extends Infogreffe_Config * Return true if the file modification time is in the period of caching * @param string $file * Path of file + * @return boolean */ protected function cachetimeover($file) { @@ -259,7 +226,36 @@ class Infogreffe extends Infogreffe_Config return $timeover; } - public function download(){} + protected function bilanFileName() + { + return 'bilan-'.$this->siren.'-'; + + } + + /** + * + * @param unknown $url + * @return boolean + */ + public function download($url) + { + $result = true; + + + + $fp = fopen(SECURE_STORAGE . ''. $file, 'w'); + $ch = curl_init($url); + curl_setopt($ch, CURLOPT_FILE, $fp); + $data = curl_exec($ch); + // Check if any error occured + if(curl_errno($ch)) + { + $result = false; + } + curl_close($ch); + fclose($fp); + return $result; + } public function getStatut($siren, $typeCommande = '', $ref = '', $idCommande = 0) { @@ -290,8 +286,8 @@ class Infogreffe extends Infogreffe_Config $this->vecteur = 'XL'; $this->typeCommande = 'BI'; - $cacheFile = $this->cachePath.'/'.$this->typeCommande.'-'.$siren.'.xml'; - + $cacheFile = APPLICATION_PATH . $this->cachePath.'/'.$this->typeCommande.'-'.$siren.'.xml'; + //Get cache information if (file_exists($cacheFile) && $this->cachetimeover($cacheFile) ) { @@ -351,17 +347,199 @@ class Infogreffe extends Infogreffe_Config return $bilans; } - public function getBilan() + /** + * Commande d'un bilan image + * @param string $siren + * Siren + * @param string $diffusion + * Mode de diffusion (C|T) + * @param array $option + * Référence + * @return string + */ + public function getBilan($siren, $diffusion, $option) { - //Retourner la référence de commande interne, chez infogreffe + $this->siren = $siren; + $this->typeCommande = 'BI'; + $this->vecteur = $diffusion; + $this->option = $option; + $xml = $this->getProduitsXML(); + + $doc = new DOMDocument(); + $doc->loadXML($xml); + $bilan_complet = $doc->getElementsByTagName('bilan_complet')->item(0); + $bilan = array(); + $bilan['num_gest'] = array(); + $num_gest = $bilan_complet->getElementsByTagName('num_gest')->item(0); + $bilan['num_gest']['greffe'] = $num_gest->getElementsByTagName('greffe')->item(0)->nodeValue; + $bilan['num_gest']['dossier_millesime'] = $num_gest->getElementsByTagName('dossier_millesime')->item(0)->nodeValue; + $bilan['num_gest']['dossier_statut'] = $num_gest->getElementsByTagName('dossier_statut')->item(0)->nodeValue; + $bilan['num_gest']['dossier_chrono'] = $num_gest->getElementsByTagName('dossier_chrono')->item(0)->nodeValue; + $bilan['num_siren'] = $bilan_complet->getElementsByTagName('num_siren')->item(0)->nodeValue; + $bilan['date_cloture'] = $bilan_complet->getElementsByTagName('date_cloture')->item(0)->nodeValue; + $bilan['date_cloture_iso'] = $bilan_complet->getElementsByTagName('date_cloture_iso')->item(0)->nodeValue; + $bilan['millesime'] = $bilan_complet->getElementsByTagName('millesime')->item(0)->nodeValue; + $bilan['num_depot'] = $bilan_complet->getElementsByTagName('num_depot')->item(0)->nodeValue; + $bilan['type_comptes'] = $bilan_complet->getElementsByTagName('type_comptes')->item(0)->nodeValue; + $bilan['url_acces'] = $bilan_complet->getElementsByTagName('url_acces')->item(0)->nodeValue; + + return $bilan['url_acces']; } + /** + * Retourne la liste des actes + * @param string $siren + * @return array + */ + public function getActes($siren) + { + $this->siren = $siren; + $this->vecteur = 'XL'; + $this->typeCommande = 'AC'; + + $cacheFile = APPLICATION_PATH . $this->cachePath.'/'.$this->typeCommande.'-'.$siren.'.xml'; + + //Get cache information + if (file_exists($cacheFile) && $this->cachetimeover($cacheFile) ) + { + $xml = file_get_contents($cacheFile); + } + //Make the request + else + { + $xml = $this->getProduitsXML(); + $this->error($xml); + + //Create file for the cache + file_put_contents($cacheFile, $xml); + } + + //Parse XML to make tab + $doc = new DOMDocument(); + $doc->loadXML($xml); + $liste_depot_acte = $doc->getElementsByTagName('liste_depot_acte')->item(0); + $depot_actes = $liste_depot_acte->getElementsByTagName('depot_acte'); + $actes = array(); + foreach($depot_actes as $depot_acte) + { + $acte = array(); + + $acte['num_gest'] = array(); + $num_gest = $depot_acte->getElementsByTagName('num_gest')->item(0); + $acte['num_gest']['greffe'] = $num_gest->getElementsByTagName('greffe')->item(0)->nodeValue; + $acte['num_gest']['dossier_millesime'] = $num_gest->getElementsByTagName('dossier_millesime')->item(0)->nodeValue; + $acte['num_gest']['dossier_statut'] = $num_gest->getElementsByTagName('dossier_statut')->item(0)->nodeValue; + $acte['num_gest']['dossier_chrono'] = $num_gest->getElementsByTagName('dossier_chrono')->item(0)->nodeValue; + + $acte['num_siren'] = $depot_acte->getElementsByTagName('num_siren')->item(0)->nodeValue; + $acte['num_depot'] = $depot_acte->getElementsByTagName('num_depot')->item(0)->nodeValue; + $acte['date_depot'] = $depot_acte->getElementsByTagName('date_depot')->item(0)->nodeValue; + + $infoActes = $depot_acte->getElementsByTagName('acte'); + $acte['depot'] = array(); + foreach($infoActes as $infoActe) + { + $actenum = array(); + $actenum['date_acte'] = $infoActe->getElementsByTagName('date_acte')->item(0)->nodeValue; + $actenum['num_acte'] = $infoActe->getElementsByTagName('num_acte')->item(0)->nodeValue; + $actenum['type_acte'] = $infoActe->getElementsByTagName('type_acte')->item(0)->nodeValue; + $actenum['type_acte_libelle'] = $infoActe->getElementsByTagName('type_acte_libelle')->item(0)->nodeValue; + $actenum['nbpages_acte'] = $infoActe->getElementsByTagName('nbpages_acte')->item(0)->nodeValue; + $decision = $infoActe->getElementsByTagName('decision')->item(0); + if($decision) + { + $actenum['decision'] = array(); + $actenum['decision']['nature'] = $decision->getElementsByTagName('nature')->item(0)->nodeValue; + $actenum['decision']['libelle'] = $decision->getElementsByTagName('libelle')->item(0)->nodeValue; + } + + $actenum['mode_diffusion'] = array(); + $mode_diffusion = $infoActe->getElementsByTagName('mode_diffusion')->item(0)->getElementsByTagName('mode'); + foreach($mode_diffusion as $mode) + { + $actenum['mode_diffusion'][] = $mode->getAttribute('type'); + } + $acte['depot'][] = $actenum; + }//Fin listes des infos acte + + //Génération de l'index pour le tri + if(!empty($acte['date_depot'])){ + $date = $acte['date_depot']; + } else { + $date = ''; + } + + if(!empty($date)) + { + $datef = substr($date,0,4).substr($date,5,2).substr($date,8,2); + $key = $datef.'-'.$acte['num_depot']; + //Affectation liste générale avec un index permettant le tri + $actes[$key] = $acte; + } + //Prise en compte de l'acte -1 + if($acte['num_depot']==-1) + { + $actes[0] = $acte; + } + + } + + //Tri suivant la date d'acte ou de depot + krsort($actes); + return $actes; + + } - public function getActes(){} - - public function getActe() + public function getActe($siren, $diffusion, $option) { //Retourner la référence de commande interne, chez infogreffe + + + + + + $doc = new DOMDocument(); + $doc->loadXML($xml); + + $depot_acte = $doc->getElementsByTagName('depot_acte')->item(0); + + $info = array(); + $info['num_gest'] = array(); + + $num_gest = $depot_acte->getElementsByTagName('num_gest')->item(0); + + $info['num_gest']['greffe'] = $num_gest->getElementsByTagName('greffe')->item(0)->nodeValue; + $info['num_gest']['dossier_millesime'] = $num_gest->getElementsByTagName('dossier_millesime')->item(0)->nodeValue; + $info['num_gest']['dossier_statut'] = $num_gest->getElementsByTagName('dossier_statut')->item(0)->nodeValue; + $info['num_gest']['dossier_chrono'] = $num_gest->getElementsByTagName('dossier_chrono')->item(0)->nodeValue; + + $info['num_siren'] = $depot_acte->getElementsByTagName('num_siren')->item(0)->nodeValue; + $info['num_depot'] = $depot_acte->getElementsByTagName('num_depot')->item(0)->nodeValue; + $info['date_depot'] = $depot_acte->getElementsByTagName('date_depot')->item(0)->nodeValue; + + $infoActes = $depot_acte->getElementsByTagName('acte'); + $info['actes'] = array(); + foreach($infoActes as $infoActe) + { + $actenum = array(); + $actenum['date_acte'] = $infoActe->getElementsByTagName('date_acte')->item(0)->nodeValue; + $actenum['num_acte'] = $infoActe->getElementsByTagName('num_acte')->item(0)->nodeValue; + $actenum['type_acte'] = $infoActe->getElementsByTagName('type_acte')->item(0)->nodeValue; + $actenum['type_acte_libelle'] = $infoActe->getElementsByTagName('type_acte_libelle')->item(0)->nodeValue; + $actenum['nbpages_acte'] = $infoActe->getElementsByTagName('nbpages_acte')->item(0)->nodeValue; + + $decision = $infoActe->getElementsByTagName('decision')->item(0); + if($decision) + { + $actenum['decision'] = array(); + $actenum['decision']['nature'] = $decision->getElementsByTagName('nature')->item(0)->nodeValue; + $actenum['decision']['libelle'] = $decision->getElementsByTagName('libelle')->item(0)->nodeValue; + } + $actenum['url_acces'] = htmlspecialchars_decode($infoActe->getElementsByTagName('url_acces')->item(0)->nodeValue); + $info['actes'][] = $actenum; + } + + } } \ No newline at end of file diff --git a/library/Metier/partenaires/classMFedaso.php b/library/Metier/partenaires/classMFedaso.php index 5ed349af..a4ef68bd 100644 --- a/library/Metier/partenaires/classMFedaso.php +++ b/library/Metier/partenaires/classMFedaso.php @@ -33,7 +33,7 @@ public function getRefCodeVoie($sep=',', $eol=EOL) { $row = 1; - $handle = fopen(DOC_WEB_LOCAL.'voies.csv', 'r'); + $handle = fopen(DOC_WEB_LOCAL.'tables/voies.csv', 'r'); if (!$handle) die('Impossible d\'ouvrir le fichier de configuration des voies INSEE'); $tabTmp=array(); while (($data = fgetcsv($handle, 1000, ';')) !== FALSE) { diff --git a/library/Metier/partenaires/classMLiensPre.php b/library/Metier/partenaires/classMLiensPre.php deleted file mode 100644 index 231359f6..00000000 --- a/library/Metier/partenaires/classMLiensPre.php +++ /dev/null @@ -1,473 +0,0 @@ -'é', 'ç'=>'ç','è'=>'è','à '=>'à'); - - private static $tabFct=array( 'ADM'=>'Administrateur', - 'ASS'=>'Associé', - 'COG'=>'Co-gérant', - 'CON'=>'Contrôleur de gestion', - 'DID'=>'Directeur Général Délégué', - 'DIR'=>'Directeur', - 'GER'=>'Gérant', - 'PCS'=>'Président du Conseil de Surveillance', - 'PDG'=>'Président Directeur Général', - 'PP'=>'Personne Physique', - 'PRD'=>'Président du directoire', - 'PRE'=>'Président du Conseil d\'Administration', - 'VIC'=>'Vice président du CA ou Surv.', - ); - - public function __construct($siren) { - $this->siren=$siren; - } - - /** Retourne les actionnaires du siren - ** @param int Siren de l'entreprise - ** @return array Tableau d'actionnaires - **/ - public function getActionnaires($siren=false, $actifsUniquement=true) { - if (!$siren) $siren=$this->siren; - $iDb=new WDB(); - $tab=$iDb->select('liens', 'Siren1, ActionPart, Pmin, Pmax, MajMin, PpPm, Siren2, RaisonSociale, Pays, actif, source', "Siren1='$siren' AND ActionPart=1 ORDER BY source DESC, actif DESC, Pmin DESC", true, MYSQL_ASSOC); - //$tabActiDB=mysql_select('dbo_liens_fi', 'SirenEntite, NomAdresse, PourcentageDetenu, Ville, Lien, MAJLien, MAJImport', "Siren='$siren' AND CodeLien='AC' ORDER BY PourcentageDetenu DESC"); - //@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "Debug $siren ($actifsUniquement)", print_r($tab,true)) ; - $sourcePre=false; - $tabRet=array(); - foreach ($tab as $i=>$lien) { - if ($lien['source']>=1700 && $lien['source']<=1720) $source=1700; - else $source=$lien['source']; - if ($i>0 && $sourcePre<>$source) break; - /*if ($actifsUniquement && $lien['actif']==0) continue; - else - $tabRet[]=array('Pmin' => number_format($lien['Pmin']*1,2,',',''), - 'MajMin' => $lien['MajMin'], - 'RaisonSociale' => strtr($lien['RaisonSociale'],$this->tabChars), - 'Pays' => $lien['libPays'], - 'Siren' => $lien['Siren2'], - 'Actif' => $lien['actif']);*/ - if ($actifsUniquement && $lien['actif']==0) continue; - else { - $codPays=strtoupper($lien['Pays']); - $libPays=''; - if ($codPays<>'' && $codPays<>'FRA') { - $tmp=$iDb->select('tabPays', 'libPays', "codPays3='$codPays'", true, MYSQL_ASSOC); - $libPays=$tmp[0]['libPays']; - } - if ($lien['MajMin']=='F') $majMin='A'; - else $majMin=$lien['MajMin']; - $tabRet[]=array( 'Pmin' => number_format($lien['Pmin']*1,2,',',''), - 'MajMin' => $majMin, - 'RaisonSociale' => strtr($lien['RaisonSociale'],$this->tabChars), - 'Pays' => $libPays, - 'Siren' => $lien['Siren2'], - 'Actif' => $lien['actif']); - } - $sourcePre=$source; - } - - if (count($tabRet)==0) { - $iInsee=new MInsee(); - $tabTmp=$iInsee->getIdentiteLight($siren); - switch ($tabTmp['FJ']*1) { - case 7111: - case 7113: - case 7120: - case 7150: - case 7160: - case 7171: - case 7172: - case 7179: - case 7190: - case 7229: - case 7331: - case 7349: - case 7351: - case 7352: - case 7364: - case 7365: - case 7366: - case 7371: - case 7372: - case 7373: - case 7379: - case 7381: - case 7382: - case 7383: - case 7384: - case 7385: - case 7389: - case 7410: - case 7430: - case 7450: - case 7490: - $tabRet[]=array('Pmin' => 0, - 'MajMin' => '+', - 'RaisonSociale' => 'ETAT FRANCAIS', - 'Pays' => '', - 'Siren' => 0, - 'Actif' => 1); - break; - case 7210: // Communes - // Siren Commune du Lamentin : 219 722 139 - // ~~~ ~~~~ - $dept=substr($siren,2,2); - $comm=substr($siren,5,3); - $codeInsee=$dept.$comm; - if ($dept<>'20') // Corse - $strCodeInsee="codeInsee='$codeInsee'"; - else - $strCodeInsee="codeInsee IN ('2A$comm','2B$comm','20$comm') "; - - $tmp=$iDb->select('insee.insee_tabVillesEpci', 'typEPCI, codEPCI, libEPCI, libCommune', $strCodeInsee, true, MYSQL_ASSOC); - $tabCC=$tmp[0]; - switch($tabCC['typEPCI']) { - case 'CA': $typeCC="Communauté d'agglomérations"; break; // CJ=7348 - case 'CC': $typeCC="Communauté de communes"; break; // CJ=7346 - case 'CU': $typeCC="Communauté urbaine"; break; // CJ=73 - case 'SAN': $typeCC="Syndicat d'agglomérations nouvelles"; break; // CJ=73 - default: $typeCC=''; - } - $tabRet[]=array('Pmin' => 0, - 'MajMin' => '+', - 'RaisonSociale' => strtoupper($typeCC.' '.preg_replace('/^(CA|CC|CU|SAN) /Uis', '',$tabCC['libEPCI'])), - 'Pays' => '', - 'Siren' => $tabCC['codEPCI'], - 'Actif' => 1); - break; - - } - } - - if (count($tabRet)==0) { - $iInsee=new MInsee(); - $tabTmp=$iInsee->getIdentiteLight($siren); - $fj=$tabTmp['FJ']*1; - if ($fj==5498) $strFonctions=",'Gérant'"; - else $strFonctions=''; - $adresse=end(explode(' ', $tabTmp['AdresseVoie'])); - $codePostal=$tabTmp['CP']; - $tab=$iDb->select('rncs_dirigeants', 'typeDir, raisonSociale, dirSiren, dirRS, civilite, nom, prenom, actif, naissance_nom, naissance_date, naissance_lieu, nat, adresse, fonction_code, fonction_lib, source, cinf', - "siren='$siren' AND fonction_lib IN ('Associé-gérant' $strFonctions)", true, MYSQL_ASSOC); - $majMin='+'; - if (count($tab)>1) $majMin='-'; - foreach ($tab as $i=>$lien) { - if ($actifsUniquement && $lien['actif']==0) continue; - else { - $ville=$siege=$actif=''; - $deb=$siren2=0; - $nbRep=$maxRep=200; - $pertinence=$avecSiren=true; - - $etabs=$iInsee->rechercheEtab($lien['nom'].' '.$lien['prenom'], $adresse, $codePostal, $ville, $siege, $actif, $deb, $nbRep, $maxRep, $pertinence, $avecSiren); - $tabSiren=array(); - foreach ($etabs['reponses'] as $etab) { - $tabTmp=preg_split('/( +|\/|\*)/', $etab['Nom']); - $rsEtab=$tabTmp[0]; - $tabTmp=preg_split('/( +|\/|\*)/', $lien['nom']); - $rsLien=$tabTmp[0]; - if ($etab['FJ']==1800 && $rsEtab==$rsLien) - $tabSiren[]=$etab['Siren']; - } - /* - 'Nom'=>prepareString(strtr($etab['Nom'],'/*',' ')), - 'Nom2'=>prepareString($etab['Nom2']), - 'Sigle'=>prepareString($etab['Sigle']), - 'Enseigne'=>prepareString($etab['Enseigne']), - 'Adresse'=>prepareString($etab['Adresse']), - 'CP'=>$etab['CP'], - 'Ville'=>prepareString($etab['Ville']), - 'Tel'=>$etab['Tel'], - 'Fax'=>$etab['Fax'], - 'Nic'=>$etab['Nic'], - 'Actif'=>$etab['Actif'], - 'NafEtab'=>$etab['NafEtab'], // Etablissement - 'NafEtabLib'=>prepareString($etab['NafEtabLib']), - 'NafEnt'=>$etab['NafEnt'], // Entreprise - 'NafEntLib'=>prepareString($etab['NafEntLib']),*/ - $tabSiren2=array_unique($tabSiren); - if (count($tabSiren2==1)) $siren2=end($tabSiren2); - else $siren2=$lien['dirSiren']; - if ($lien['civilite']=='MME') $genre='Madame'; - elseif ($lien['civilite']=='M') $genre='Monsieur'; - else $genre=''; - $tabRet[]=array( 'Pmin' => 0, - 'MajMin' => $majMin, - 'RaisonSociale' => trim(preg_replace('/ +/', ' ', $lien['dirRS'].' '.$genre.' '.$lien['nom'].' '.$lien['prenom'])), - 'Pays' => '', - 'Siren' => $siren2, - 'Actif' => $lien['actif']); - if ($siren2*1>0) { - /** Insertion du lien en base **/ - $nom=$pays=$dateMAJ=''; - $ppPm='P'; - $pct=0; - $entrep2=$iInsee->getIdentiteLight($siren); - $nom2=$entrep2['Nom']; - $pays2='FRA'; - if (substr($entrep2['FJ'],0,1)*1<>1) $ppPm='M'; - $entrep=$iInsee->getIdentiteLight($siren2); - $nom=strtr($entrep['Nom'],'/*',' '); - $pays='FRA'; - $tabUpdate=array( 'Pmin'=> $pct, - 'Pmax'=> $pct, - 'MajMin'=> $majMin, - 'PpPm'=> $ppPm, - 'dateLien'=> $dateMAJ, - ); - /* Insertion de l'actionnaire */ - $tabInsert1=array_merge($tabUpdate, array( 'ActionPart'=>1), - array( 'Siren1'=> $siren, - 'Siren2'=> $siren2, - 'RaisonSociale'=> $nom, - 'Pays'=> $pays, - 'actif'=> 1, - 'source'=> 1600, - 'dateInsert'=> date('YmdHis'))); - $res=$iDb->select('liens', 'count(*)', "Siren1=$siren AND (Siren2=$siren2 OR (RaisonSociale='".addslashes($nom)."' AND Pays='$pays'))"); - if ($res[0][0]>0) { - if (!$iDb->update('liens', array_merge($tabUpdate,array('ActionPart'=>1)), "siren=$siren AND (Siren2=$siren2 OR (RaisonSociale='".addslashes($nom)."' AND Pays='$pays'))", true)) - $errMaj=1016166; - } else { - if (!$iDb->insert('liens', $tabInsert1, true)) - $errMaj=1016167; - } - - /* Insertion de la participation pour l'actionnaire précédent */ - $tabInsert2=array_merge($tabUpdate, array( 'ActionPart'=>2), - array( 'Siren1'=> $siren2, - 'Siren2'=> $siren, - 'RaisonSociale'=> $nom2, - 'Pays'=> $pays2, - 'actif'=> 1, - 'source'=> 1600, - 'dateInsert'=> date('YmdHis'))); - $res=$iDb->select('liens', 'count(*)', "Siren1=$siren2 AND (Siren2=$siren OR (RaisonSociale='$nom2' AND Pays='$pays2'))"); - if ($res[0][0]>0) { - if (!$iDb->update('liens', array_merge($tabUpdate,array('ActionPart'=>2)), "siren=$siren2 AND (Siren2=$siren OR (RaisonSociale='".addslashes($nom2)."' AND Pays='$pays2'))", true)) - $errMaj=1016168; - } else { - if (!$iDb->insert('liens', $tabInsert2, true)) - $errMaj=1016169; - } - - /** Insertion du dirigeant pour l'actionnaire en base **/ - $dirs=$iDb->select('rncs_dirigeants','siren', "siren=$siren2", true, MYSQL_ASSOC); - if (count($dirs)==0) { - $iDb->insert('rncs_dirigeants', array( 'siren' => $siren2, - 'raisonSociale' => $nom, - 'civilite' => $lien['civilite'], - 'typeDir' => $lien['typeDir'], - 'dirRS' => $siren2, - 'nom' => $lien['nom'], - 'prenom' => $lien['prenom'], - 'naissance_nom' => $lien['naissance_nom'], - 'naissance_date'=> $lien['naissance_date'], - 'naissance_lieu'=> $lien['naissance_lieu'], - 'nat' => $lien['nat'], - 'fonction_code' => 0, - 'fonction_lib' => 'Personne Physique', - 'actif' => 1, - 'dateInsert' => date('YmdHis'), - 'source' => 'lag', // Lien Associé Gérant - 'cinf' => $lien['cinf'], - ), true); - } - } - } - - } - } - //@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "Debug Fin $siren ($actifsUniquement)", print_r($tabRet,true)) ; - return $tabRet; - } - - /** Retourne les participations du siren - ** @param int Siren de l'entreprise - ** @return array Tableau de participations - **/ - public function getParticipations($siren=false, $actifsUniquement=true) { - if (!$siren) $siren=$this->siren; - $iDb=new WDB(); - $tab=$iDb->select('liens LEFT JOIN tabPays ON codPays3=Pays', 'Siren1, ActionPart, Pmin, Pmax, MajMin, PpPm, Siren2, RaisonSociale, Pays, libPays, actif, source', "Siren1='$siren' AND ActionPart=2 ORDER BY source DESC, actif DESC, Pmin DESC", true, MYSQL_ASSOC); // OR Siren2='$siren -// $tabPartDB=mysql_select('dbo_liens_fi', 'SirenEntite, NomAdresse, PourcentageDetenu, Ville, Lien, MAJLien, MAJImport', "Siren='$siren' AND CodeLien='PA' ORDER BY PourcentageDetenu DESC"); - $tabRet=array(); - $sourcePre=false; - foreach ($tab as $i=>$lien) { - if ($lien['source']>=500 && $lien['source']<=520) $source=500; - else $source=$lien['source']; - if ($i>0 && $sourcePre<>$source) break; - if ($actifsUniquement && $lien['actif']==0) continue; - else - $tabRet[]=array('Pmin' => number_format($lien['Pmin']*1,2,',',''), - 'MajMin' => $lien['MajMin'], - 'RaisonSociale' => strtr($lien['RaisonSociale'],$this->tabChars), - 'Pays' => $lien['libPays'], - 'Siren' => $lien['Siren2'], - 'Actif' => $lien['actif']); - $sourcePre=$source; - } - - if (count($tabRet)==0) { - $iInsee=new MInsee(); - $tabTmp=$iInsee->getIdentiteLight($siren); - switch ($tabTmp['FJ']*1) { - case 7346: // Communaute de communes - case 7348: // Communaute d'agglomeration - //case 'CC': $typeCC="Communauté de communes"; break; // CJ=73 - //case 'CU': $typeCC="Communauté urbaine"; break; // CJ=73 - //case 'SAN': $typeCC="Syndicat d'agglomérations nouvelles"; break; // CJ=73 - $tmp=$iDb->select('insee.insee_tabVillesEpci', 'typEPCI, libEPCI, codeInsee, libCommune', "codEPCI='$siren'", true, MYSQL_ASSOC); - - @sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "Debug Fin $siren ($actifsUniquement)", print_r($tmp, true)) ; - - foreach ($tmp as $tabCom) { - $dept=substr($tabCom['codeInsee'],0,2); - if ($dept=='2A' || $dept=='2B' || $dept=='20') - $dept='200'; - elseif ($dept*1>95) - $dept=substr($tabCom['codeInsee'],0,3); - else - $dept=$dept.'0'; - $comm=substr($tabCom['codeInsee'],2,3); - for ($iSir=0; $iSir<10; $iSir++) { - $sirenCom='21'.$dept.$comm.$iSir; - if ($iInsee->valideSiren($sirenCom)) break; - } - $tabRet[]=array('Pmin' => 0, - 'MajMin' => '+', - 'RaisonSociale' => 'COMMUNE DE '.strtoupper($tabCom['libCommune']), - 'Pays' => '', - 'Siren' => $sirenCom, - 'Actif' => 1); - } - break; - } - } - - return $tabRet; - } - - public function getLiens($siren=false) { - $tabA=$this->getActionnaires($siren); - $tabP=$this->getParticipations($siren); - return array( 'actionnaires'=>$tabA, - 'participations'=>$tabP); - } - - - private function getLiensPartenaires($siren=false) { - if (!$siren) $siren=$this->siren; - /** Le partenaire pour les liens Actionnaires/Participations est infobilan.decideur.com - **/ - $urlRacine='http://infobilan.decideur.com/'; - $tabPost=array( 'choix'=>'1', - 'pagePrecedente'=>'recherche_entreprise.html', - 'nomsocRech'=>'', - 'cpRech'=>'', - 'villeRech'=>'', - 'nomdirRech'=>'', - 'predirRech'=>'', - 'sirenRech'=>$this->siren, - 'telRech'=>'', - 'Rechercher.x'=>round(79), - 'Rechercher.y'=>round(19),); - $url=$urlRacine.'liste_result.html'; - $referer=$urlRacine.'recherche_entreprise.html'; - $page=getUrl($url,'', $tabPost, $referer, false, 'infobilan.decideur.com'); - $this->body=$page['body']; - $strCookie=$page['header']['Set-Cookie']; - $refererInfoD=$url; - - if(preg_match_all('/(.*)<\/a><\/span>
/i', $page['body'], $matches)) - { - $urlInfoD=$urlRacine.'choix_pdt.html?'.$matches[1][0]; - $page=getUrl($urlInfoD,$strCookie,'', $refererInfoD, false, 'infobilan.decideur.com'); - $referer=$urlInfoD; - if ($this->nscrl==0) $this->nscrl=@getTextInHtml($url, 'nscrlP=', '=','&'); - - $url=$urlRacine.'fiche_ident.html'; - $page=getUrl($url,$strCookie,'', $referer, false, 'infobilan.decideur.com'); - $this->body=$page['body']; - - if ($this->raisonSociale=='') - $this->raisonSociale=trim(@getTextInHtml($this->body, 'Société', ' :', '')); - - if ($this->adresse=='') - $this->adresse=trim(@getTextInHtml($this->body, 'Adresse :', '', '')); - - if ($this->tel=='') - $this->tel=trim(@getTextInHtml($this->body, 'Tél', '', '
')); - if ($this->fax=='') - $this->fax=trim(@getTextInHtml($this->body, 'Fax', ' :', '
')); - if ($this->web=='') - $this->web=trim(@getTextInHtml($this->body, 'Site Web', '
')); - if ($this->mail=='') - $this->mail=trim(@getTextInHtml($this->body, 'E-mail', '')); - if ($this->naf=='') - $this->naf=trim(@getTextInHtml($this->body, 'Code NAF', ' :', '')); - - if(preg_match('/Capital social<\/span> : (\d*)(.*)
/isU', $this->body, $matches) - && ($this->capitalMontant=='' || $this->capitalDevise=='')) { - $this->capitalMontant=trim($matches[1]); - $this->capitalDevise=trim($matches[2]); - } - - if ($this->fj=='') - $this->fj=trim(@getTextInHtml($this->body, 'Forme juridique', ' :', '
')); - if ($this->nationalite=='') - $this->nationalite=trim(@getTextInHtml($this->body, 'Nationalité', ' :', '')); - if ($this->effectif=='') - $this->effectif=trim(@getTextInHtml($this->body, 'Effectif', ' :', '
')); - if ($this->activite=='') - $this->activite=trim(@getTextInHtml($this->body, 'Activité', ' :', '
')); - - /** Actionnaires **/ - $strTmp=trim(@getTextInHtml($this->body, 'ACTIONNAIRES
', '', '

')); - if(preg_match_all('/

(.*)<\/span> - Participation<\/span> : (.*) %
(.*)<\/p>/isU', $strTmp, $matches)) { - foreach ($matches[1] as $i=>$nom) { - $this->tabAct[$i]['nom']=trim($nom); - $this->tabAct[$i]['pct']=trim($matches[2][$i]); - $this->tabAct[$i]['rcs']=trim(str_replace('RCS : ','',strip_tags($matches[3][$i]))); - } - } - - /** Filiales **/ - $strTmp=trim(@getTextInHtml($this->body, 'FILIALES
', '

', '

')); - if(preg_match_all('/

(.*)<\/span> - Participation<\/span> :(.*)%
(.*)<\/p>/isU', $strTmp, $matches)) { - foreach ($matches[1] as $i=>$nom) { - $this->tabFil[$i]['nom']=trim($nom); - $this->tabFil[$i]['pct']=trim($matches[2][$i]); - $this->tabFil[$i]['rcs']=trim(str_replace('RCS :','',strip_tags($matches[3][$i]))); - } - } - - /** CA et Résultat **/ - $strTmp=trim(@getTextInHtml($this->body, '

PRINCIPAUX ELEMENTS FINANCIERS
', '

', '

')); - if(preg_match('/

CA (.*)<\/span>(.*)
/isU', $strTmp, $matches)) { - $this->derExerciceAnnee=trim($matches[1]); - $this->derExerciceCA=trim(str_replace(':',' ', $matches[2])); - } - if(preg_match('/Résultat(.*)<\/span>(.*)$/isU', $strTmp, $matches)) { - $this->derExerciceResultat=trim(str_replace(':',' ', $matches[2])); - } - - /* - $infoBilan=print_r($page, true); - $fp=fopen('./infobilan.html', 'w'); - fwrite($fp, $infoBilan); - fclose($fp); - */ - } - - $tabA=$this->getActionnaires($siren); - $tabP=$this->getParticipations($siren); - return array( 'actionnaires'=>$tabA, - 'participations'=>$tabP); - } - -} - ?> diff --git a/library/Metier/scores/classMScores.php b/library/Metier/scores/classMScores.php index fafb84a2..a4c15cae 100644 --- a/library/Metier/scores/classMScores.php +++ b/library/Metier/scores/classMScores.php @@ -67,7 +67,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail switch( $type ) { case 'scores': - $version = '_405'; + $version = '_405'; //@todo : Version en RECETTE et en PROD $tableComments = 'scores_commentaires'; break; case 'valo': diff --git a/library/WsScore/Configure.php b/library/WsScore/Configure.php new file mode 100644 index 00000000..d452b4d4 --- /dev/null +++ b/library/WsScore/Configure.php @@ -0,0 +1,101 @@ +readConfig(); + $this->_defineDb(); + $this->_definePath(); + $this->_defineSphinx(); + $this->_defineMail(); + } + + /** + * Read config application.ini + */ + protected function readConfig() + { + if ( Zend_Registry::isRegistered('config') ) { + $c = Zend_Registry::get('config'); + $this->profil = $c->profil; + } else { + $c = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', 'production'); + $this->profil = $c->profil; + } + } + + protected function _defineDb() + { + if ( $this->profil->db->default ) { + define('MYSQL_HOST', $this->profil->db->default->params->host); + define('MYSQL_USER', $this->profil->db->default->params->username); + define('MYSQL_PASS', $this->profil->db->default->params->password); + define('MYSQL_DEFAULT_DB', 'jo'); + define('MYSQL_SQL_LOG', 'NONE'); + } + } + + + protected function _definePath() + { + //Use of realpath + + define('BODACC_LOCAL_DIR' , '/home/data/bodacc/'); + define('JAL_LOCAL_DIR' , '/home/data/jal/'); + define('HUGIN_LOCAL_DIR' , '/home/data/infosreg/hugin/'); + define('ACTUSNEWS_LOCAL_DIR' , '/home/data/infosreg/actusnews/'); + define('DIRELEASE_LOCAL_DIR' , '/home/data/infosreg/direlease/'); + define('LESECHOS_LOCAL_DIR' , '/home/data/infosreg/lesechos/'); + define('BUSINESSWIRE_LOCAL_DIR_INCOMING' , '/home/data/ftp/businesswire/'); + define('BUSINESSWIRE_LOCAL_DIR' , '/home/data/infosreg/businesswire/'); + + define('SECURE_STORAGE' , $this->profil->path->secure.'/'); + define('DOC_WEB_LOCAL' , $this->profil->path->files.'/'); + define('DOC_WEB_URL' , '/fichier/'); + define('LOG_PATH' , $this->profil->path->data.'/log'); + } + + protected function _defineSphinx() + { + // Entreprise + define('SPHINX_ENT_HOST', $this->profil->sphinx->ent->host); + define('SPHINX_ENT_PORT', intval($this->profil->sphinx->ent->port)); + define('SPHINX_ENT_VERSION', $this->profil->sphinx->ent->version); + + // Dirigeants + define('SPHINX_DIR_HOST', $this->profil->sphinx->dir->host); + define('SPHINX_DIR_PORT', intval($this->profil->sphinx->dir->port)); + define('SPHINX_DIR_VERSION', $this->profil->sphinx->dir->version); + + // Historique + define('SPHINX_HISTO_HOST', $this->profil->sphinx->histo->host); + define('SPHINX_HISTO_PORT', intval($this->profil->sphinx->histo->port)); + define('SPHINX_HISTO_VERSION', $this->profil->sphinx->histo->version); + + // Actionnaire + define('SPHINX_ACT_HOST', $this->profil->sphinx->act->host); + define('SPHINX_ACT_PORT', intval($this->profil->sphinx->act->port)); + define('SPHINX_ACT_VERSION', $this->profil->sphinx->act->version); + + //Old + define('SPHINX_HOST', $this->profil->sphinx->ent->host); + define('SPHINX_PORT', intval($this->profil->sphinx->ent->port)); + } + + protected function _defineMail() + { + //Messagerie + define('SMTP_HOST', $this->profil->mail->smtp_host); + define('SMTP_PORT', ''); + define('SMTP_USER', ''); + define('SMTP_PASS', ''); + } + +} \ No newline at end of file diff --git a/library/WsScore/Gestion/v0.1/Gestion.php b/library/WsScore/Gestion/v0.1/Gestion.php index 25e83368..27ea7a66 100644 --- a/library/WsScore/Gestion/v0.1/Gestion.php +++ b/library/WsScore/Gestion/v0.1/Gestion.php @@ -29,7 +29,7 @@ class Gestion extends WsScore debugLog('I',"getInfosLogin pour $login (IP=$ipUtilisateur)",__LINE__,__FILE__, __FUNCTION__, __CLASS__); //L'utilisateur qui demande les informations est différent - if ( $this->tabInfoUser['login']<>$login + if ( $this->tabInfoUser['login']<>$login && in_array($this->tabInfoUser['profil'], array('Administrateur', 'SuperAdministrateur') ) ) { /** Un administrateur veut il des infos sur un login ? **/ @@ -44,7 +44,7 @@ class Gestion extends WsScore if (count($rep)>0) { $timeOutSec = $tabRep['timeout']; - if ($timeOutSec==0) $timeOutSec = 1800; + if ($timeOutSec==0) $timeOutSec = 1800; $result->login = $login; $result->id = $tabRep['id']; $result->email = $tabRep['email']; @@ -161,10 +161,10 @@ class Gestion extends WsScore $iDbCrm->insert('logs', $tabInsert); //Date de dernière connexion - $iDbCrm->update('utilisateurs', - array('dateDerniereConnexion'=> date('Y-m-d H:i:s')), + $iDbCrm->update('utilisateurs', + array('dateDerniereConnexion'=> date('Y-m-d H:i:s')), "idClient=".$this->tabInfoUser['idClient']." AND login='".$this->tabInfoUser['login']."'" - ); + ); } //Retour @@ -194,7 +194,7 @@ class Gestion extends WsScore { case 'delete': - if ($this->tabInfoUser['profil']=='Administrateur' + if ($this->tabInfoUser['profil']=='Administrateur' || $this->tabInfoUser['profil']=='SuperAdministrateur') { $tabUpdate = array( 'deleted' => 1, 'dateUpdate' => date('Y-m-d H:i:s') ); $iDbCrm = new WDB('sdv1'); @@ -209,7 +209,7 @@ class Gestion extends WsScore case 'actif': case 'desactif': - if ($this->tabInfoUser['profil']=='Administrateur' + if ($this->tabInfoUser['profil']=='Administrateur' || $this->tabInfoUser['profil']=='SuperAdministrateur'){ if ($action=='actif') $actif = 1; if ($action=='desactif') $actif = 0; @@ -243,7 +243,7 @@ class Gestion extends WsScore case 'new': - if ($this->tabInfoUser['profil']=='Administrateur' + if ($this->tabInfoUser['profil']=='Administrateur' || $this->tabInfoUser['profil']=='SuperAdministrateur') { $idClient = $this->tabInfoUser['idClient']; @@ -252,7 +252,7 @@ class Gestion extends WsScore } $typeCompte = 'PROD'; - if ( $this->tabInfoUser['profil']=='SuperAdministrateur' && $infos->typeCompte=='TEST'){ + if ( $this->tabInfoUser['profil']=='SuperAdministrateur' && $infos->typeCompte=='TEST'){ $typeCompte = 'TEST'; } @@ -340,29 +340,29 @@ class Gestion extends WsScore $this->authenticate(); if ($this->tabInfoUser['profil']!='SuperAdministrateur') { - $this->sendError('0901'); + $this->sendError('0901'); } if (empty($element)){ - throw new SoapFault('Error', 'Erreur dans les paramètres'); + throw new SoapFault('Error', 'Erreur dans les paramètres'); } - switch(strtolower($element)){ + switch(strtolower($element)){ //Mettre à jour les ips des utilisateurs en fonction de celles du client case 'ip': $iDbCrm = new WDB('sdv1'); $rep = $iDbCrm->select('clients', 'filtre_ip', "id='$idClient'", false, MYSQL_ASSOC); if (count($rep)==0){ throw new SoapFault('Error', 'Client inexistant'); - } + } $data = array( 'filtre_ip' => $rep[0]['filtre_ip'], 'dateUpdate' => date('Y-m-d H:i:s'), - ); - $where = ' WHERE idClient='.$idClient; + ); + $where = ' WHERE idClient='.$idClient; if (!empty($utilisateurs) && is_array($utilisateurs->item)){ $where.= ' AND login IN ('.join(',',$utilisateurs->item).')'; } if($iDbCrm->update('utilisateurs', $data, $where)){ - return true; + return true; } return false; break; @@ -449,8 +449,8 @@ class Gestion extends WsScore $iDbCrm = new WDB('sdv1'); $rep = $iDbCrm->select('clients', - 'id, nom, actif, test, racineLogin, siren, nic, tva, editerFacture, fact_detail, fac_dest, fac_adr1, fac_adr2, fac_adr3, fac_email, fac_tel, fact_rib, liv_dest, liv_adr1, liv_adr2, liv_adr3, liv_email, liv_tel, droits, filtres_ip, dateInsert, dateUpdate, respComSD, typeContrat, dateSignature, typeAcces, typeScore, timeout, accesPieces, accesKbis, accesInvestigations, accesInternationnal, accesEnquetes, miseSousSurveillance, forfaitExtranetPeriode, forfaitExtranetMontant, reconductionAuto, remarque, forfaitPiecesNb, forfaitPiecesMt, forfaitPiecesDep, forfaitInvestigNb, forfaitInvestigMt, forfaitInvestigDep, tarifIndiscore', - "1 $strClient", + 'id, nom, actif, test, racineLogin, siren, nic, tva, editerFacture, fact_detail, fac_dest, fac_adr1, fac_adr2, fac_adr3, fac_email, fac_tel, fact_rib, liv_dest, liv_adr1, liv_adr2, liv_adr3, liv_email, liv_tel, droits, filtres_ip, dateInsert, dateUpdate, respComSD, typeContrat, dateSignature, typeAcces, typeScore, timeout, accesPieces, accesKbis, accesInvestigations, accesInternationnal, accesEnquetes, miseSousSurveillance, forfaitExtranetPeriode, forfaitExtranetMontant, reconductionAuto, remarque, forfaitPiecesNb, forfaitPiecesMt, forfaitPiecesDep, forfaitInvestigNb, forfaitInvestigMt, forfaitInvestigDep, tarifIndiscore', + "1 $strClient", false, MYSQL_ASSOC); $tabRet = array(); @@ -623,8 +623,8 @@ class Gestion extends WsScore // Vue détaillée ou uniquement les infos payantes if ($detail==0) { - $detail='Non'; - //$strDetail=" AND (page LIKE 'greffe_%' OR page LIKE 'inpi_%' OR page='kbis' OR page LIKE 'indiscore%' OR page='privileges' OR page='commandeAsso') AND (params<>'' OR page LIKE 'indiscore%' AND tarifIndiscore<>0) AND (params NOT LIKE '%erreur%' OR params LIKE '%erreur 17%') "; + $detail='Non'; + //$strDetail=" AND (page LIKE 'greffe_%' OR page LIKE 'inpi_%' OR page='kbis' OR page LIKE 'indiscore%' OR page='privileges' OR page='commandeAsso') AND (params<>'' OR page LIKE 'indiscore%' AND tarifIndiscore<>0) AND (params NOT LIKE '%erreur%' OR params LIKE '%erreur 17%') "; $strDetail = ' AND ( '; $pages = array('greffe_actes', 'greffe_bilans', 'kbis', 'indiscore', 'indiscore2', 'indiscore3', 'rapport2', 'rapport3', 'privileges', 'privcumul'); $totalPages = count($pages); @@ -646,9 +646,9 @@ class Gestion extends WsScore $i++; if ( $i<$totalPages) { $strDetail.= ' OR '; - } + } } - $strDetail.= ' ) '; + $strDetail.= ' ) '; } elseif($detail==1) { $detail='Oui'; } @@ -679,7 +679,8 @@ class Gestion extends WsScore $dateDeb=date('Y-m-d', mktime(0,0,0,$mois,1,$annee)); $dateFin=date('Y-m-t', mktime(0,0,0,$mois,15,$annee)); - $fichierCsv=DOC_WEB_LOCAL."csv/logs-$annee-$mois-$detail-$idClient-$login-$all.csv"; + $c = Zend_Registry::get('config'); + $fichierCsv=$c->profil->path->files."/logs-$annee-$mois-$detail-$idClient-$login-$all.csv"; if (file_exists($fichierCsv) && date('Ymd', filemtime($fichierCsv))==date('Ymd') && @@ -695,19 +696,19 @@ class Gestion extends WsScore WHERE 1 $strDetail $strClient $strLogin AND dateHeure BETWEEN '$dateDeb 00:00:00' AND '$dateFin 23:59:59' AND l.login=u.login AND u.idClient=c.id GROUP BY l.login, l.siren, l.page, date(dateHeure), l.params ORDER BY l.login ASC, l.dateHeure ASC"; - $fp = fopen(DOC_WEB_LOCAL."/csv/logs-$annee-$mois-$detail-$idClient-$login-$all.sql", 'w'); + $fp = fopen($c->profil->path->cache."/logs-$annee-$mois-$detail-$idClient-$login-$all.sql", 'w'); fwrite($fp, $sql.EOL); fclose($fp); - exec("php ".APPLICATION_PATH."/../batch/sql2csv.php sdv1 ".DOC_WEB_LOCAL."csv/logs-$annee-$mois-$detail-$idClient-$login-$all.sql $fichierCsv > /dev/null &"); + exec("php ".$c->profil->path->batch."/sql2csv.php sdv1 ".$c->profil->path->cache."/logs-$annee-$mois-$detail-$idClient-$login-$all.sql $fichierCsv > /dev/null &"); $size = $cache = 0; } - + $hostname = 'http://'.$_SERVER['SERVER_NAME']; if ($_SERVER['SERVER_PORT']!='80'){ $hostname.= ':'.$_SERVER['SERVER_PORT']; } $result = new LogsClients(); - $result->Url = $hostname.DOC_WEB_URL."csv/logs-$annee-$mois-$detail-$idClient-$login-$all.csv"; + $result->Url = $hostname."/fichier/logs/logs-$annee-$mois-$detail-$idClient-$login-$all.csv"; $result->Taille = $size; $result->Cache = $cache; @@ -947,7 +948,7 @@ class Gestion extends WsScore $output->error = $error; $output->result = $result; return $output; - } + } /** * Création d'un modele pour le préremplisage des données utilisateurs diff --git a/library/WsScore/Gestion/v0.2/Gestion.php b/library/WsScore/Gestion/v0.2/Gestion.php index 625f1f04..a9b1ab8e 100644 --- a/library/WsScore/Gestion/v0.2/Gestion.php +++ b/library/WsScore/Gestion/v0.2/Gestion.php @@ -713,7 +713,8 @@ class Gestion extends WsScore $dateDeb=date('Y-m-d', mktime(0,0,0,$mois,1,$annee)); $dateFin=date('Y-m-t', mktime(0,0,0,$mois,15,$annee)); - $fichierCsv=DOC_WEB_LOCAL."csv/logs-$annee-$mois-$detail-$idClient-$login-$all.csv"; + $c = Zend_Registry::get('config'); + $fichierCsv=$c->profil->path->files."/logs-$annee-$mois-$detail-$idClient-$login-$all.csv"; if (file_exists($fichierCsv) && date('Ymd', filemtime($fichierCsv))==date('Ymd') && @@ -729,10 +730,10 @@ class Gestion extends WsScore WHERE 1 $strDetail $strClient $strLogin AND dateHeure BETWEEN '$dateDeb 00:00:00' AND '$dateFin 23:59:59' AND l.login=u.login AND u.idClient=c.id GROUP BY l.login, l.siren, l.page, date(dateHeure), l.params ORDER BY l.login ASC, l.dateHeure ASC"; - $fp = fopen(DOC_WEB_LOCAL."/csv/logs-$annee-$mois-$detail-$idClient-$login-$all.sql", 'w'); + $fp = fopen($c->profil->path->cache."/logs-$annee-$mois-$detail-$idClient-$login-$all.sql", 'w'); fwrite($fp, $sql.EOL); fclose($fp); - exec("php ".APPLICATION_PATH."/../batch/sql2csv.php sdv1 ".DOC_WEB_LOCAL."csv/logs-$annee-$mois-$detail-$idClient-$login-$all.sql $fichierCsv > /dev/null &"); + exec("php ".$c->profil->path->batch."/sql2csv.php sdv1 ".$c->profil->path->cache."/logs-$annee-$mois-$detail-$idClient-$login-$all.sql $fichierCsv > /dev/null &"); $size = $cache = 0; } @@ -741,7 +742,7 @@ class Gestion extends WsScore $hostname.= ':'.$_SERVER['SERVER_PORT']; } $result = new LogsClients(); - $result->Url = $hostname.DOC_WEB_URL."csv/logs-$annee-$mois-$detail-$idClient-$login-$all.csv"; + $result->Url = $hostname."/fichier/logs/logs-$annee-$mois-$detail-$idClient-$login-$all.csv"; $result->Taille = $size; $result->Cache = $cache; diff --git a/library/WsScore/Gestion/v0.3/Gestion.php b/library/WsScore/Gestion/v0.3/Gestion.php index f9b71701..4f5202fe 100644 --- a/library/WsScore/Gestion/v0.3/Gestion.php +++ b/library/WsScore/Gestion/v0.3/Gestion.php @@ -751,11 +751,12 @@ class Gestion extends WsScore $dateDeb=date('Y-m-d', mktime(0,0,0,$mois,1,$annee)); $dateFin=date('Y-m-t', mktime(0,0,0,$mois,15,$annee)); - $fichierCsv=DOC_WEB_LOCAL."csv/logs-$annee-$mois-$detail-$idClient-$login-$all.csv"; + $c = Zend_Registry::get('config'); + $fichierCsv=$c->profil->path->files."/logs-$annee-$mois-$detail-$idClient-$login-$all.csv"; - if (file_exists($fichierCsv) && - date('Ymd', filemtime($fichierCsv))==date('Ymd') && - filesize($fichierCsv)>60 ) { + if (file_exists($fichierCsv) + && date('Ymd', filemtime($fichierCsv))==date('Ymd') + && filesize($fichierCsv)>60 ) { $size=filesize($fichierCsv); $erreur=false; $tabNom=array(); @@ -767,10 +768,10 @@ class Gestion extends WsScore WHERE 1 $strDetail $strClient $strLogin AND dateHeure BETWEEN '$dateDeb 00:00:00' AND '$dateFin 23:59:59' AND l.login=u.login AND u.idClient=c.id GROUP BY l.login, l.siren, l.page, date(dateHeure), l.params ORDER BY l.login ASC, l.dateHeure ASC"; - $fp = fopen(DOC_WEB_LOCAL."/csv/logs-$annee-$mois-$detail-$idClient-$login-$all.sql", 'w'); + $fp = fopen($c->profil->path->cache."/logs-$annee-$mois-$detail-$idClient-$login-$all.sql", 'w'); fwrite($fp, $sql.EOL); fclose($fp); - exec("php ".APPLICATION_PATH."/../batch/sql2csv.php sdv1 ".DOC_WEB_LOCAL."csv/logs-$annee-$mois-$detail-$idClient-$login-$all.sql $fichierCsv > /dev/null &"); + exec("php ".$c->profil->path->batch."/sql2csv.php sdv1 ".$c->profil->path->cache."/logs-$annee-$mois-$detail-$idClient-$login-$all.sql $fichierCsv > /dev/null &"); $size = $cache = 0; } @@ -779,7 +780,7 @@ class Gestion extends WsScore $hostname.= ':'.$_SERVER['SERVER_PORT']; } $result = new LogsClients(); - $result->Url = $hostname.DOC_WEB_URL."csv/logs-$annee-$mois-$detail-$idClient-$login-$all.csv"; + $result->Url = $hostname."/fichier/logs/logs-$annee-$mois-$detail-$idClient-$login-$all.csv"; $result->Taille = $size; $result->Cache = $cache; diff --git a/library/WsScore/Pieces/v0.1/Pieces.php b/library/WsScore/Pieces/v0.1/Pieces.php index 36ce7262..e1af4af6 100644 --- a/library/WsScore/Pieces/v0.1/Pieces.php +++ b/library/WsScore/Pieces/v0.1/Pieces.php @@ -26,35 +26,37 @@ class Pieces extends WsScore if ($_SERVER['SERVER_PORT']!='80'){ $hostname.= ':'.$_SERVER['SERVER_PORT']; } + + $c = Zend_Registry::get('config'); + $path = realpath($c->profil->path->secure).'/kbis/'; //Le fichier existe avec une date de validité inférieure à 1 jour - $filepdf = DOC_WEB_LOCAL.'kbis/'.$siren.'.pdf'; + $filepdf = $path.$siren.'.pdf'; if ( file_exists($filepdf) && date('Ymd', filemtime($filepdf))==date('Ymd') ) { $this->wsLog('kbis', $siren, basename($filepdf)); - - return $hostname.'/data/kbis/'.basename($filepdf); + return $hostname.DOC_WEB_URL.'/kbis/'.basename($filepdf); } else { $file = null; //On vérifie quand même si il n'existe pas une commande en html - $dir = DOC_WEB_LOCAL.'kbis/'.date('Ymd'); - if (file_exists($dir)) { + $dir = $path.date('Ymd'); + if ( file_exists($dir) ) { foreach ( glob($dir.'/'.$siren.'-*.html') as $file ) { break; } } - if (empty($file)) { + if ( empty($file) ) { //Téléchargement du KBIS $result = array(); - exec('php '.APPLICATION_PATH.'/../batch/getKbis.php --siren '.$siren, $result); + exec('php '.$c->profil->path.batch.'/getKbis.php --siren '.$siren, $result); $result = end($result); if (substr($result,-5)=='.html') { - $file = DOC_WEB_LOCAL.'kbis/'.date('Ymd').'/'.$result; + $file = $path.'/kbis/'.date('Ymd').'/'.$result; $this->wsLog('kbis', $siren, $result); } elseif ( $result!='ERREUR') @@ -83,7 +85,7 @@ class Pieces extends WsScore if ( !file_exists($filepdf) ) { throw new SoapFault('0000',"Fichier PDF introuvable"); } - return $hostname.'/data/kbis/'.basename($filepdf); + return $hostname.DOC_WEB_URL.'/kbis/'.basename($filepdf); } } @@ -132,6 +134,8 @@ class Pieces extends WsScore '9300', ); + $list = array(); + //Liste des bilans association if ( in_array($fj, $assoFormeJuridique) ) { @@ -167,48 +171,43 @@ class Pieces extends WsScore ->from($bilansM, array('dateCloture', 'Assoc_Date_Declaration', 'pdfLink', 'typeCompte', 'pdfSize', 'pdfPage')) ->where('siren = ?', $siren) ->order('dateCloture DESC') - ->limit($$nbRep, $position); + ->limit($nbRep, $position); $bilans = $bilansM->fetchAll($sql); - } - $list = array(); - if( $bilans->count() > 0) { - foreach ($bilans as $item) { - - $filename = basename($item->pdfLink); - $file = DOC_WEB_LOCAL . 'associations/bilans/' . $filename; - - $bilansList = new Bilans(); - $bilansList->DateCloture = substr($item->dateCloture,0,4).substr($item->dateCloture,5,2).substr($item->dateCloture,8,2); - $bilansList->DateDepot = substr($item->Assoc_Date_Declaration,0,4).substr($item->Assoc_Date_Declaration,5,2).substr($item->Assoc_Date_Declaration,8,2); - $bilansList->DureeExercice = ''; - $bilansList->Type = $item->typeCompte; - - //Chech file exist - if ( file_exists($file) ) - { - $bilansList->File = 'ASS_'.$filename; - $bilansList->FileSize = $item->pdfSize; - $bilansList->NumberOfPages = $item->pdfPage; - $bilansList->ModeDiffusion = 'T'; - } - - $list[] = $bilansList; + if( $bilans->count() > 0) { + foreach ($bilans as $item) { + + $filename = basename($item->pdfLink); + $file = SECURE_STORAGE . 'associations/bilans/' . $filename; + + $bilansList = new Bilans(); + $bilansList->DateCloture = substr($item->dateCloture,0,4).substr($item->dateCloture,5,2).substr($item->dateCloture,8,2); + $bilansList->DateDepot = substr($item->Assoc_Date_Declaration,0,4).substr($item->Assoc_Date_Declaration,5,2).substr($item->Assoc_Date_Declaration,8,2); + $bilansList->DureeExercice = ''; + $bilansList->Type = $item->typeCompte; + + //Chech file exist + if ( file_exists($file) ) + { + $bilansList->File = 'ASS_'.$filename; + $bilansList->FileSize = $item->pdfSize; + $bilansList->NumberOfPages = $item->pdfPage; + $bilansList->ModeDiffusion = 'T'; + } + $list[] = $bilansList; + } } } - } //Liste des bilans Infogreffe else { //@todo : définition du chemin de stockage des fichiers infogreffe - - /* + require_once 'Infogreffe/Infogreffe.php'; $infogreffe = new Infogreffe(); $infogreffeListBilans = $infogreffe->getBilans($siren); - $infogreffeListBilans = array_slice($infogreffeListBilans, $position, $nbRep, true); if ( $infogreffeListBilans > 0 ) @@ -216,32 +215,32 @@ class Pieces extends WsScore foreach ( $infogreffeListBilans as $item ) { $bilansList = new Bilans(); - $bilansList->DateCloture = ''; + $bilansList->DateCloture = substr($item['date_cloture_iso'],0,4).substr($item['date_cloture_iso'],5,2).substr($item['date_cloture_iso'],8,2); $bilansList->DateDepot = ''; $bilansList->DureeExercice = ''; - $bilansList->Type = ''; + $bilansList->Type = $item['type_comptes']; $filename = basename($item->pdfLink); if ( file_exists($filename) ) { - + // @todo : Vérifier que le fichier existe + /* + $bilansList->File = basename($item->pdfLink); + $bilansList->FileSize = $item->pdfSize; + $bilansList->NumberOfPages = $item->pdfPage; + $bilansList->ModeDiffusion = 'T'; + */ } - - - // @todo : Vérifier que le fichier existe - $bilansList->File = basename($item->pdfLink); - $bilansList->FileSize = $item->pdfSize; - $bilansList->NumberOfPages = $item->pdfPage; - - $bilansList->ModeDiffusion = 'T'; - $list[] = $bilansList; } } - */ - //@todo : Regarder la table jo.greffes_bilans + //@todo : Lire la table jo.greffes_bilans + //Comparer avec la liste infogreffe + //Si différence enregistrer dans la base + //Renvoyer le résultat + //Infos : } @@ -255,8 +254,8 @@ class Pieces extends WsScore /** * Commande du fichier (URL ou Référence de commande) - * @param string $siren - * SIREN + * @param string $identifiant + * SIREN ou autre identifiant * @param string $diffusion * Mode de diffusion T, C * @param string $dateCloture @@ -266,18 +265,18 @@ class Pieces extends WsScore * @return string * URL ou identifiant de commande */ - public function getBilan($siren, $diffusion, $dateCloture, $reference) + public function getBilan($identifiant, $diffusion, $dateCloture, $reference = '') { $this->authenticate(); $this->permission('actes'); - if ( strlen($siren)!=9 ) { + if ( strlen($identifiant)!=9 ) { $this->sendError('1010'); } /* * Un bilan doit principalement s'identifier par - * siren, date de cloture, type, mode de diffusion + * siren, date de cloture, mode de diffusion * * Chemin fichier association * Monter dans /mnt/datafile/associations @@ -299,19 +298,94 @@ class Pieces extends WsScore $controlSiren = $parseRef[1]; $controlDate = substr($parseRef[2],4,4).substr($parseRef[2],2,2).substr($parseRef[2],0,2); if ( $controlSiren == $siren && $controlDate == $dateCloture) { - $filename = substr($reference,4); - $file = '/mnt/datafile/associations/bilans/' . $filename; + $filename = substr($reference,4); + //@todo : Emplacement des fichiers + $file = SECURE_STORAGE . 'associations/bilans/' . $filename; $dest = DOC_WEB_LOCAL . 'associations/' . $reference; if ( file_exists($file) && copy($file, $dest)) { $hostname = 'http://'.$_SERVER['SERVER_NAME']; - if ($_SERVER['SERVER_PORT']!='80'){ + if ($_SERVER['SERVER_PORT']!='80') { $hostname.= ':'.$_SERVER['SERVER_PORT']; } $output = $hostname . '/data/associations/' . basename($dest); - $this->wsLog('greffe_bilans', $siren, 'Bilan association'); + $dateClotureD = substr($dateCloture,0,2).'/'.substr($dateCloture,2,2).'/'.substr($dateCloture,4,4); + $this->wsLog('greffe_bilans', $siren, 'Bilan association au '.$dateClotureD); } } } + break; + } + } else { + switch ( $diffusion ) + { + case 'T': + //Read the database to see if file exist + try { + $db = Zend_Db::factory($this->dbConfig->db->jo); + $db->getConnection(); + } catch (Zend_Db_Adapter_Exception $e) { + if ($this->tabInfoUser['idClient']!=1) { + throw new SoapFault('ERR', "Application error"); + } else { + throw new SoapFault('ERR', $e->getMessage()); + } + } catch (Zend_Exception $e) { + if ($this->tabInfoUser['idClient']!=1) { + throw new SoapFault('ERR', "Application error"); + } else { + throw new SoapFault('ERR', $e->getMessage()); + } + } + $bilansM = new Application_Model_JoGreffesBilans($db); + $sql = $bilansM->select() + ->where('siren=?', $identifiant) + ->where('date_cloture=?', substr($dateCloture,0,4).'-'.substr($dateCloture,4,2).'-'.substr($dateCloture,6,2)); + $infos = $bilansM->fetchRow($sql); + + if ( $infos===null ) { + throw new SoapFault('ERR', 'Bilan indisponible'); + } + + //Go to Infogreffe service + if ( $infos->pdfLink=='' ) { + require_once 'Infogreffe/Infogreffe.php'; + $infogreffe = new Infogreffe(); + $url = $infogreffe->getBilan($siren, $diffusion, array( + 'greffe' => $infos->numGreffe, + 'dossier_millesime' => substr($infos->numRC,0,2), + 'dossier_statut' => substr($infos->numRC,2,1), + 'dossier_chrono' => substr($infos->numRC,3), + 'num_depot' => $infos->num_depot, + 'date_cloture' => WDate::dateT('Ymd','d/m/Y',$infos->date_cloture) + )); + $pdf = $infogreffe->download($url); + + + } else { + $pdf = $infos->pdfLink; + } + + if ( !empty($pdf) ) { + $file = SECURE_STORAGE . 'greffes/bilans/' . $pdf; + $dest = DOC_WEB_LOCAL . 'greffes/' . $pdf; + if ( file_exists($file) && copy($file, $dest)) { + $hostname = 'http://'.$_SERVER['SERVER_NAME']; + if ($_SERVER['SERVER_PORT']!='80') { + $hostname.= ':'.$_SERVER['SERVER_PORT']; + } + $output = $hostname . '/data/greffes/' . basename($dest); + $this->wsLog('greffe_bilans', $siren, $dateCloture); + } else { + throw new SoapFault('ERR', 'Fichier introuvable'); + } + } + + break; + + case 'C': + + // Renvoyer l'id de commande + break; } } @@ -321,7 +395,8 @@ class Pieces extends WsScore protected function getActes($identifiant) { - + + } protected function getActe(){} diff --git a/library/WsScore/Saisie/v0.2/Saisie.php b/library/WsScore/Saisie/v0.2/Saisie.php index 0f682050..af864b39 100644 --- a/library/WsScore/Saisie/v0.2/Saisie.php +++ b/library/WsScore/Saisie/v0.2/Saisie.php @@ -1858,7 +1858,11 @@ class Saisie extends WsScore throw new SoapFault('ERR', $e->getMessage()); } } catch (Zend_Exception $e) { - throw new SoapFault('ERR', "Application error"); + if ($this->tabInfoUser['idClient']!=1) { + throw new SoapFault('ERR', "Application error"); + } else { + throw new SoapFault('ERR', $e->getMessage()); + } } //Type = Entreprise => Search id by Siren diff --git a/library/WsScore/WsScore.php b/library/WsScore/WsScore.php index c4519ffd..5a0dc341 100644 --- a/library/WsScore/WsScore.php +++ b/library/WsScore/WsScore.php @@ -294,8 +294,10 @@ class WsScore define ('TIME', substr(DATETIME,8,6)); define ('DATE_LISIBLE', substr(DATETIME,6,2).'/'.substr(DATETIME,4,2).'/'.substr(DATETIME,0,4)); define ('TIME_LISIBLE', substr(DATETIME,8,2).':'.substr(DATETIME,10,2).':'.substr(DATETIME,12,2)); - - $this->dbConfig = new Zend_Config_Ini(APPLICATION_PATH . '/configs/databases.ini'); + + //Load database configuration + $c = Zend_Registry::get('config'); + $this->dbConfig = $c->profil; } /** diff --git a/public/index.php b/public/index.php index 7ab4731f..f787e95d 100644 --- a/public/index.php +++ b/public/index.php @@ -26,6 +26,4 @@ $application = new Zend_Application( APPLICATION_PATH . '/configs/application.ini' ); -require_once '../config/config.php'; - $application->bootstrap()->run(); \ No newline at end of file diff --git a/scripts/build/config/WebRecette/application.ini b/scripts/build/config/WebRecette/application.ini new file mode 100644 index 00000000..91f45096 --- /dev/null +++ b/scripts/build/config/WebRecette/application.ini @@ -0,0 +1,93 @@ +[production] +phpSettings.date.timezone = "Europe/Paris" +phpSettings.display_startup_errors = 0 +phpSettings.display_errors = 0 +bootstrap.path = APPLICATION_PATH "/Bootstrap.php" +bootstrap.class = "Bootstrap" +appnamespace = "Application" +resources.session.save_path = APPLICATION_PATH "/../data/sessions" +resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers" +resources.frontController.plugins.Auth = "Application_Controller_Plugin_Auth" +resources.frontController.params.displayExceptions = 0 +resources.layout.layout = "main" +resources.layout.layoutPath = APPLICATION_PATH "/views" +resources.view.basePath = APPLICATION_PATH "/views" +autoloaderNamespaces[] = "Application_" +autoloaderNamespaces[] = "Scores_" +autoloaderNamespaces[] = "Form_" + +; Scores configuration +profil.server.name = WebRecette +profil.mail.method = smtp +profil.mail.smtp_host = smtp.free.fr +profil.mail.email.support = supportdev@scores-decisions.com +profil.mail.email.supportdev = supportdev@scores-decisions.com +profil.mail.email.contact = supportdev@scores-decisions.com +profil.mail.email.production = supportdev@scores-decisions.com +profil.wkhtmltopdf.path = "/home/vhosts/dataws/wkhtml" +profil.wkhtmltopdf.arch = "amd64" +profil.path.batch = APPLICATION_PATH "/../scripts/jobs" +profil.path.cache = APPLICATION_PATH "/../data/cache" +profil.path.files = APPLICATION_PATH "/../data/files" ; DOC_WEB_LOCAL +profil.path.data = "/home/vhosts/dataws" +profil.path.secure = "/mnt/datafile" ; SECURE_STORAGE + +; For old configuration - see Configure.php +profil.db.default.adapter=mysqli +profil.db.default.params.host=127.0.0.1 +profil.db.default.params.username=wsuser +profil.db.default.params.password=wspass2012 +profil.db.default.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8" + +; Complete database configuration +profil.db.sdv1.adapter=mysqli +profil.db.sdv1.params.host=192.168.78.230 +profil.db.sdv1.params.username=wsuser +profil.db.sdv1.params.password=wspass2012 +profil.db.sdv1.params.dbname=sdv1 +profil.db.sdv1.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8" +profil.db.sdv1.params.persistent = true + +profil.db.jo.adapter=mysqli +profil.db.jo.params.host=192.168.78.230 +profil.db.jo.params.username=wsuser +profil.db.jo.params.password=wspass2012 +profil.db.jo.params.dbname=jo +profil.db.jo.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8" +profil.db.jo.params.persistent = true + +profil.db.historiques.adapter=mysqli +profil.db.historiques.params.host=192.168.78.230 +profil.db.historiques.params.username=wsuser +profil.db.historiques.params.password=wspass2012 +profil.db.historiques.params.dbname=historiques +profil.db.historiques.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8" +profil.db.historiques.params.persistent = true + +profil.db.Commandes.adapter=mysqli +profil.db.Commandes.params.host=127.0.0.1 +profil.db.Commandes.params.username=wsuser +profil.db.Commandes.params.password=wspass2012 +profil.db.Commandes.params.dbname=commandes +profil.db.Commandes.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8" +profil.db.Commandes.params.persistent = true + +profil.db.Webservice.adapter=mysqli +profil.db.Webservice.params.host=127.0.0.1 +profil.db.Webservice.params.username=wsuser +profil.db.Webservice.params.password=wspass2012 +profil.db.Webservice.params.dbname=webservice +profil.db.Webservice.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8" +profil.db.WebServices.params.persistent = true + +[staging : production] +resources.frontController.params.displayExceptions = 1 + +[development : production] +phpSettings.display_startup_errors = 1 +phpSettings.display_errors = 1 +resources.frontController.params.displayExceptions = 1 + +[testing : production] +phpSettings.display_startup_errors = 1 +phpSettings.display_errors = 1 \ No newline at end of file diff --git a/scripts/build/config/WebService/application.ini b/scripts/build/config/WebService/application.ini new file mode 100644 index 00000000..e44a7d80 --- /dev/null +++ b/scripts/build/config/WebService/application.ini @@ -0,0 +1,93 @@ +[production] +phpSettings.date.timezone = "Europe/Paris" +phpSettings.display_startup_errors = 0 +phpSettings.display_errors = 0 +bootstrap.path = APPLICATION_PATH "/Bootstrap.php" +bootstrap.class = "Bootstrap" +appnamespace = "Application" +resources.session.save_path = APPLICATION_PATH "/../data/sessions" +resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers" +resources.frontController.plugins.Auth = "Application_Controller_Plugin_Auth" +resources.frontController.params.displayExceptions = 0 +resources.layout.layout = "main" +resources.layout.layoutPath = APPLICATION_PATH "/views" +resources.view.basePath = APPLICATION_PATH "/views" +autoloaderNamespaces[] = "Application_" +autoloaderNamespaces[] = "Scores_" +autoloaderNamespaces[] = "Form_" + +; Scores configuration +profil.server.name = WebService +profil.mail.method = smtp +profil.mail.smtp_host = smtp.free.fr +profil.mail.email.support = supportdev@scores-decisions.com +profil.mail.email.supportdev = supportdev@scores-decisions.com +profil.mail.email.contact = supportdev@scores-decisions.com +profil.mail.email.production = supportdev@scores-decisions.com +profil.wkhtmltopdf.path = "/home/vhosts/dataws/wkhtml" +profil.wkhtmltopdf.arch = "amd64" +profil.path.batch = APPLICATION_PATH "/../scripts/jobs" +profil.path.cache = APPLICATION_PATH "/../data/cache" +profil.path.files = APPLICATION_PATH "/../data/files" ; DOC_WEB_LOCAL +profil.path.data = "/home/vhosts/data" +profil.path.secure = "/mnt/datafile" ; SECURE_STORAGE + +; For old configuration - see Configure.php +profil.db.default.adapter=mysqli +profil.db.default.params.host=127.0.0.1 +profil.db.default.params.username=wsuser +profil.db.default.params.password=wspass2012 +profil.db.default.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8" + +; Complete database configuration +profil.db.sdv1.adapter=mysqli +profil.db.sdv1.params.host=192.168.78.230 +profil.db.sdv1.params.username=wsuser +profil.db.sdv1.params.password=wspass2012 +profil.db.sdv1.params.dbname=sdv1 +profil.db.sdv1.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8" +profil.db.sdv1.params.persistent = true + +profil.db.jo.adapter=mysqli +profil.db.jo.params.host=192.168.78.230 +profil.db.jo.params.username=wsuser +profil.db.jo.params.password=wspass2012 +profil.db.jo.params.dbname=jo +profil.db.jo.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8" +profil.db.jo.params.persistent = true + +profil.db.historiques.adapter=mysqli +profil.db.historiques.params.host=192.168.78.230 +profil.db.historiques.params.username=wsuser +profil.db.historiques.params.password=wspass2012 +profil.db.historiques.params.dbname=historiques +profil.db.historiques.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8" +profil.db.historiques.params.persistent = true + +profil.db.Commandes.adapter=mysqli +profil.db.Commandes.params.host=127.0.0.1 +profil.db.Commandes.params.username=wsuser +profil.db.Commandes.params.password=wspass2012 +profil.db.Commandes.params.dbname=commandes +profil.db.Commandes.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8" +profil.db.Commandes.params.persistent = true + +profil.db.Webservice.adapter=mysqli +profil.db.Webservice.params.host=127.0.0.1 +profil.db.Webservice.params.username=wsuser +profil.db.Webservice.params.password=wspass2012 +profil.db.Webservice.params.dbname=webservice +profil.db.Webservice.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8" +profil.db.WebServices.params.persistent = true + +[staging : production] +resources.frontController.params.displayExceptions = 1 + +[development : production] +phpSettings.display_startup_errors = 1 +phpSettings.display_errors = 1 +resources.frontController.params.displayExceptions = 1 + +[testing : production] +phpSettings.display_startup_errors = 1 +phpSettings.display_errors = 1 \ No newline at end of file diff --git a/scripts/build/config/_files/kbis/styles/infogreffe.css b/scripts/build/config/_files/kbis/styles/infogreffe.css new file mode 100644 index 00000000..a6a24335 --- /dev/null +++ b/scripts/build/config/_files/kbis/styles/infogreffe.css @@ -0,0 +1,1110 @@ + +/* -------------------------------------------------------------------------- + ELEMENTS DE STYLE REUTILISABLES DU SITE INFOGREFFE + $Revision: 1.1.2.78.38.19 $ +*/ + +@media print { + td#struct-left, tr#struct-bandeau-plume, tr#struct-bandeau-utilisateur, tr#struct-bandeau-panier, tr#struct-footer, div.struct-onglets { + display: none; + } + .header { + display: none; + } + .menu { + display: none; + } + .bottomNavigation { + display: none; + } + .footer { + display: none; + } + div.no-print { + display: none; + } + body.simple { + color:black; + } + td { + color:black; + } +} +div.espacement-default { + font-size: 0px; + margin-bottom: 15px; +} + +div.pointilles { + font-size: 5px; + border-bottom-style: dashed; + border-bottom-width: 1px; + border-bottom-color: #939393; +} + +div.lien-noeud { + text-align: right; + font-weight: bold; + color: #7f7f7f; + margin-right: 71px; +} + +div.bouton-bas { + text-align: right; + padding: 0px; + margin: 0px; + border-collapse:collapse; + border-width: 0px; + border-color: green; + border-style: solid; +} + +a:link.lien-noeud { + text-align: right; + font-weight: bold; + font-size: 10px; + color: #7f7f7f; +} + +td.bandeau-resultat { + background-color:white; + border-bottom:1px dashed #7f7f7f; + width:410px; + padding:6px; + font-size:11px; +} + +/* -------------------------------------------------------------------------- + ELEMENTS DE STYLE DE CELLULES +*/ + +td.standard { + border-color: #999999; + border-bottom-style: dashed; + border-bottom-width: 1px; + border-right-style: solid; + border-right-width: 1px; +} + +td.colonne-titre { + border-color: #999999; + border-bottom-style: dashed; + border-bottom-width: 0px; + border-right-style: solid; + border-right-width: 1px; + background-color: red; + width: 150px; + height: 60px; +} + +/* -------------------------------------------------------------------------- + ELEMENTS DE STYLE DE TEXTE +*/ + +.annotation { + font-size: 10px; + font-style: italic; + color:#777B94; +} + +p.ident { + font-size: 9px; + color:#535353; +} + +.ident-cartouche { + white-space: nowrap; + font-size: 9px; + font-weight:normal; + color:#535353; +} + +.legende-grand { + font-size: 11px; + font-style: italic; + color:#FF9C00; +} + +.legende-moyen { + font-size: 10px; + font-style: italic; + color:#FF9C00; +} + +.legende-petit { + font-size: 10px; + font-style: italic; + color:#FF9C00; +} + +.surbrillance { + color:#FF9C00; +} + +.libelle-facultatif { + font-size: 10px; + color:#999999; +} + +.libelle-normal { + font-size: 11px; + color:#999999; +} + +.menu-titre { + font-size: 9px; + color:#BFD8E9; +} + +.montant { + font-size: 11px; + color:black; +} +.nom-produit { + font-size: 11px; + font-weight: bold; + color:#545377; + text-indent: -7px; +} + +.nom-sousproduit { + font-size: 11px; + font-weight: normal; + color:#545377; + padding-left: 19px; +} + +.pagination-page { + font-size: 11px; + color:#545377; + vertical-align: middle; +} + +.pagination-page img { + vertical-align: middle; +} + +.pagination-page span { + vertical-align: middle; +} + +.pagination-page a { + text-decoration: none; + font-weight: bold; +} + +a.pagination-page { + font-size: 11px; + color:#545377; + vertical-align: middle; + text-decoration: none; + font-weight: bold; +} + +.texte-standard { + font-size: 11px; + color:#535353; +} + +.text-bleu { + font-size: 11px; + color:#545377; +} + +.text-titre { + font-size: 11px; + color:#545377; + font-style:italic; + font-weight:bold; +} + +.text-montant-total { + font-size: 11px; + color:#545377; + font-weight:bold; +} + +.text-bleu-small { + font-size: 10px; + color:#545377; +} + +.text-std { + font-size: 11px; + color:#535353; +} + +.text-std-big { + font-size: 13px; + color:#535353; +} +.text-std-small { + font-size: 10px; + color:#535353; +} + +.text-std-xsmall { + font-size: 9px; + color:#535353; +} + +.text-gris { + font-size: 11px; + color:#999999; +} + +.text-noir { + color:black; +} + +.text-orange { + font-size: 11px; + color:#FF9C00; +} + +.text-orange-small { + font-size: 10px; + color:#FF9C00; +} + +.text-orange-xsmall { + font-size: 9px; + color:#FF9C00; +} + +.text-gris-small { + font-size: 10px; + color:#999999; +} + +.text-rcs { + font-size: 10px; + color:#535353; +} + +.text-company { + font-size:13px; + color:#545377; + font-weight: bold; +} + +/* spécifique panier */ +/* (on retrouve les éléments de text-company) */ +.text-company-panier { + font-size:13px; + color:#545377; + font-weight: bold; + background-color: #D9EEF1; + padding:5px; + border-bottom:dashed 1px #939393; +} + +/* -------------------------------------------------------------------------- + ELEMENTS DE STYLE DE LIEN +*/ +.action, a:visited.action { + font-size: 9px; + color: #545377; +} +a:hover.action { + font-size: 9px; + text-decoration: none; + color: #FF9C00; +} + +a.lien { + font-size: 11px; + color: #FF9C00; +} + +a.lien-orange, a:visited.lien-orange{ + font-size: 11px; + font-style: italic; + color: #FF9C00; +} + +a.lien-orange-gras, a:visited.lien-orange-gras{ + font-size: 11px; + font-weight: bold; + color: #FF9C00; +} + +a.menu { + font-size: 9px; + text-decoration: none; + color: #767676; +} +a:hover.menu { + font-size: 9px; + text-decoration: none; + color: #FF9C00; +} + +a.navigation { + font-size: 9px; + color: #5B8CB0; +} + +a.company { + font-size:11px; + color:#545377; + font-weight: bold; +} + +.company-cartouche, a:visited.company-cartouche { + font-size:11px; + color:#5B8CB0; + font-weight: bold; +} + +a.company-popup { + font-size:11px; + color:#545377; +} + +/* Lien exercice antérieur sur la section produit des bilans */ +div#divLienExAnte a { + font-weight:bold; +} + +/* -------------------------------------------------------------------------- + ELEMENTS DE STYLE D'INPUTS +*/ + +/*Zone e mail/dénomination entreprise/numéro de téléphone : 196 pixel*/ +.email { + margin: 0px; + padding: 1px; + width: 196px; + vertical-align: middle; +} + +/*Zone adresse : 250 pixel*/ +.adresse { + margin: 0px; + padding: 1px; + width: 250px; + vertical-align: middle; +} + +/*Zone commune/département/numéro d’identification RCS/référence : 120 pixel*/ +.identification { + margin: 0px; + padding: 1px; + width: 120px; + vertical-align: middle; +} + +select.identification { + margin: 0px; + padding: 1px; + width: 130px; + vertical-align: middle; + font-size: 10px; +} + +/* mesAchats.listeCommandes */ +select.listeCommandes { + margin: 0px; + padding: 1px; + width: 225px; + vertical-align: middle; + font-size: 10px; +} + +/*Zone numéro de voie/civilité: 60 pixel*/ +.civilite { + margin: 0px; + padding: 1px; + width: 60px; + vertical-align: middle; +} + +.zone5 { + margin: 0px; + padding: 1px; + width: 250px; + vertical-align: middle; +} + +/* -------------------------------------------------------------------------- + ELEMENTS DE STYLE DE TABLEAU +*/ + +table.pagination-table { + border-collapse: collapse; +} + +table.pagination-table td.pagination-col { + vertical-align: middle; + text-align: center; + border-style: solid; + border-width: 0px; + border-color: black; + padding-right: 3px; + padding-left: 3px; + padding-top: 0px; + padding-bottom: 0px; + margin: 0px; +} + +/* -------------------------------------------------------------------------- + ELEMENTS UTILISES PAR LES COMPOSANTS DES TAGLIBS +*/ + +.tag-bandeau-gauche { + border-left: 7px solid #777d97; + text-align: justify; + padding-left: 5px; + padding-bottom: 0px; + margin-left: 86px; + margin-top: 0px; + margin-bottom: 0px; + margin-right: 71px; +} + +table.noeud-list { + padding-bottom: 0px; + margin-left: 86px; + margin-top: 0px; + margin-bottom: 0px; + margin-right: 71px; +} + +table.noeud-list td { + text-align: justify; +} + +table.noeud-list td.bullet { + background-image:url(/infogreffe/img/puce/puce6.gif); + background-repeat:no-repeat; + background-position:2px 4px; + vertical-align:top; + padding-left:10px; + padding-right:2px; +} + +/* -------------------------------------------------------------------------- + ELEMENTS SPECIFIQUES PAR PAGE +*/ + +/* page de resultat des recherches par nom ou RCS (rechRegCom.jsp) */ +table.rechRegCom-table { + border-collapse:collapse; + padding:0px; + margin:0px; + border:0px; + width: 100%; +} + +table.rechRegCom-table td.rechRegCom-col1 { + border-color: black; + border-style: solid; + border-width:0px; + padding:0px; + /*padding-right: 7px;*/ + margin:0px; + vertical-align: top; +} + +table.rechRegCom-table td.rechRegCom-col2 { + border-color: black; + border-style: solid; + border-width: 0px; + padding:0px; + padding-left: 7px; + margin:0px; + vertical-align: top; +} + +table.rechRegCom-table td.rechRegCom-bouton { + border-color: black; + border-style: solid; + border-width: 0px; + padding:0px; + margin:0px; + text-align: right; + vertical-align: bottom; +} + +table.rechRegCom-precision { + border-collapse:collapse; + padding:0px; + margin:0px; + border:0px; +} + +table.rechRegCom-precision td.rechRegCom-precision-col1 { + padding:0px; + padding-right: 6px; + margin:0px; + text-align: left; + vertical-align: top; +} + +table.rechRegCom-precision td.rechRegCom-precision-col2 { + padding:0px; + padding-left: 0px; + margin:0px; + text-align: left; + vertical-align: top; +} + +/* page de resultat des recherches entreprise */ +table.liste-res-rech { + border-collapse:collapse; + padding:0px; + margin:0px; + border:0px; +} + +table.liste-res-rech td.result { + border-bottom: 1px dashed #939393; + background-color:white; + width:410px; + padding:6px; + font-size:11px +} + +table.liste-res-rech td.picto { + width:22px; + vertical-align:top; + padding-top:2px; + padding-left:2px +} + +table.liste-res-rech td.entreprise { + width:400px; + vertical-align:top; + padding:6px; + font-size:9px; + color:#535353; +} + +table.liste-res-rech td.entreprise a.company { + font-size:11px; + color:#545377; + font-weight: bold; +} + +table.liste-res-rech td.boutons { + width:115px; + padding:6px 0px 6px 0px; + text-align:right; +} +/* page MA SELECTION (panier.jsp) */ + +td.panier-premcol { + border-width: 1px; + border-color: red; + border-style: solid; + width: 160px; + vertical-align: bottom; +} + +td.panier-col-visu { + text-align: center; + padding: 0px; + margin: 0px; + vertical-align: bottom; + border-width: 1px; + border-color: red; + border-style: solid; +} + +td.panier-col-mail { + text-align: center; + padding: 0px; + padding-left: 10px; + margin: 0px; + vertical-align: bottom; + border-width: 1px; + border-color: red; + border-style: solid; +} + +td.panier-col-telecharger { + text-align: center; + padding: 0px; + margin: 0px; + vertical-align: bottom; + border-width: 1px; + border-color: red; + border-style: solid; +} + +td.panier-col-courrier { + text-align: center; + padding: 0px; + margin: 0px; + vertical-align: bottom; + border-width: 1px; + border-color: red; + border-style: solid; +} + +td.panier-derncol { + vertical-align: bottom; + text-align: right; + border-width: 1px; + border-color: red; + border-style: solid; +} + +table.panier-lien { + width: 70px; + border-collapse:collapse; + margin: 0px; + margin: 0px; +} + +table.panier-lien td.panier-haut-gauche { + border-bottom-width: 1px; + border-bottom-style: solid; + border-bottom-color: white; + border-width: 1px; + border-color: green; + border-style: solid; +} +table.panier-lien td.panier-haut-droite { + text-align: center; + border-width: 1px; + border-color: green; + border-style: solid; +} +table.panier-lien td.panier-bas-gauche { + border-width: 1px; + border-color: green; + border-style: solid; +} +table.panier-lien td.panier-bas-droite { + text-align: center; + border-width: 1px; + border-color: green; + border-style: solid; +} + +/* page LOGIN (login.jsp) */ + +/*-------------------------------------*/ +/*------popupLog.jsp-------- "olivier"-*/ +/*-------------------------------------*/ + +.popupLog-bouton { + margin-right:5px; + margin-top:10px; + text-align:right; +} +.login-bouton { + + text-align: right; + margin-right: 5px; + margin-top:5px; +} +.popupLog-champ-type5 { + margin: 1px; + padding: 1px; + width: 250px; + vertical-align: middle; +} +div.popupLog-fond-bleu { + width:305px; + background-color:#d9eef1; + padding:10px; + margin:0px 0px 0px; +} +.popupLog-lien { + font-size: 18px; + color: #545377; + margin-top:10px; +} +.popupLog-libelle-normal-email { + margin-top:20px; + font-size: 11px; + color:#999999; +} +.popupLog-libelle-normal-MotDePasse { + margin-top:10px; + font-size: 11px; + color:#999999; +} +/*---------------------------------*/ +/*--Fin--popupLog.jsp-----"olivier"*/ +/*---------------------------------*/ + +/*---- resultatRechSimple----olivier--Table haut droite--*/ + +table.tableRecherche { + width: 90px; + border-collapse:collapse; + margin-left: 10px; + margin-top:10px; +} + +table.tableRecherche td.Recherche-haut-gauche { + border-bottom-width: 1px; + border-bottom-style: solid; + border-top-color: #f1f1f1; + border-width: 1px; + border-bottom-color: white; + border-style: solid; + border-left-color: #f1f1f1; + font-size: 10px; + color: #FF9C00; + padding:3px; + +} +table.tableRecherche td.Recherche-haut-droite { + text-align: center; + border-width: 1px; + border-color: #f1f1f1; + border-style: solid; + border-bottom-color: white; + +} +table.tableRecherche td.Recherche-bas-gauche { + border-width: 1px; + border-color: #f1f1f1; + border-style: solid; + border-right-color: white; + padding:3px; + font-size: 10px; + +} +table.tableRecherche td.Recherche-bas-droite { + text-align: center; + border-width: 1px; + border-style: solid; + + border-color: #f1f1f1; +} + +/*-------------------------------------*/ +/*------ficheEntreprise.jsp -----*/ +/*-------------------------------------*/ + +div.divDocumentsDisponibles { + margin-left:10px; + margin-top:5px; +} + +div.divDocumentsDisponibles a { + font-weight:bold; +} + +div.ficheidentite-ident{ + margin-left:0px; + margin-top:5px; +} + +span.ficheidentite-ident{ + margin-left:10px; +} +.ficheidentite-texte-standard-italic-gras { + font-size: 11px; + color:#535353; + font-style: italic; + font-weight: bold; +} + +div.bandeauGlissant { + width: 103px; + margin: 20px 0 0 12px; + background-color: #FFFFBD; + visibility: hidden; +} + +/*--------- PAGE D'ACCUEIL -------------------------------------------------- */ + +table.index-form { + border-collapse:collapse; + margin:0px; + padding:0px; + border:none; +} + +table.index-form td { + color:#535353; + padding-bottom:8px; + padding-right:8px; + vertical-align:middle; +} + +table.index-form td img { + vertical-align:middle; + border-right:8px; +} + +table.index-form td input { + width:122px; +} + +/*--------- PAGES DE PAIEMENT DES COMMANDES --------------------------------- */ + + +table.table-form { + border-collapse:collapse; + table-layout:fixed; + padding:0px; + margin:0px; + border:none; +} + +table.table-form td { + vertical-align:middle; + padding-top:2px; + padding-left:8px; + padding-right:4px; + padding-bottom:1px; +} + +table.table-form td.left { + padding-left:0px; +} + +table.table-form td.mandatory { + background-image:url(/infogreffe/img/pictos/puce-orange.png); + background-repeat:no-repeat; + background-position:center left; +} + +table.table-form tr.input td { + padding-bottom: 8px; +} + +table.payer-commande-struct-moyen { + border-collapse:collapse; + padding:0px; + margin:0px; + border:none; +} + +table.payer-commande-struct-moyen td { + vertical-align:middle; + padding:4px 6px 4px 6px; +} + +table.payer-commande-struct-moyen td.img { + text-align:center; +} + +/* Nouveaux styles pour la refonte cinématique */ + + .folded { + background:url(/infogreffe/img/folded.gif) no-repeat left; + font-weight:bold; + padding-left:15px; + } + .unfolded { + background:url(/infogreffe/img/unfolded.gif) no-repeat left; + } + + .folded-fond-gris { + background:url(/infogreffe/img/folded-fond-gris.gif) no-repeat left; + font-weight:bold; + padding-left:15px; + } + .unfolded-fond-gris { + background:url(/infogreffe/img/unfolded-fond-gris.gif) no-repeat left; + } + + .folded-loading { + background:url(/infogreffe/img/indicator.gif) no-repeat left; + font-weight:bold; + padding-left:15px; + } + + .fold { + margin:5px 0px 5px 15px; + border-bottom:dashed 1px #939393; + padding-bottom:10px; + } + + .infobulle { + border-bottom:#535353 dashed 1px; + cursor:help; + line-height:16px; + } + + .entreprise { + } + + .text-company-refonte { + font-size:13px; + color:#545377; + font-weight: bold; + background-color: #D9EEF1; + padding-top:7px; + padding-left:7px; + padding-right:7px; + } + + .text-rcs-refonte { + white-space: nowrap; + } + + .commande { + margin-left:0 !important; + } + +/* style pour le lien d'accès a via michelien*/ + .span-planAcces { + text-align: right; + font-weight:bold; + } + + .img-lien-non-souligne{ + text-decoration: none; + text-indent: 0px; + padding:0px; + margin:0px; + border:none; + } + +/* + * Debut de la définition des styles pour + * le pour le calendrier de audience + */ + +/* div qui contient les informations du calendrier */ +div.calendrierDiv { + text-align: right; + padding-bottom: 10px; + margin: 0px; + border-collapse:collapse; + border-width: 0px; + background-color:white; +} + +/* div qui contient les 2 options select du calendrier */ +div.calendrier-contain-select { + padding-top:10px; + padding-bottom:10px; + padding-left: 10px; +} + +/* div pour chaque select */ +div.calendrier-select { + padding-bottom: 5px; + text-align: left; +} + +/* Div utilisé pour la parrue de detail du calendrier */ +div.calendrier-detail { + margin: 0px; + border-collapse:collapse; + border-width: 0px; + background-color:white; + text-align: left; + padding-bottom: 10px; + padding-top: 10px; + padding-left: 5px; +} + +/* pour le Titre de la page d'affichage du calendrier*/ +.titre-calendrier +{ + font-size: 15px; + text-transform:uppercase; + font-weight: bold; + color: #545377; + background-color: #D9EEF1; + padding-top:10px; + padding-bottom:10px; + text-align: center; +} + +/* Definition de la table qui conteint le calendrier*/ +table.calendrier +{ + text-align: left; +} + +/* pour les ligne du calendrier */ +table.calendrier tr.ligne +{ + border: 1px; + border-style: solid; + border-color : black; + height: 50px; +} + +/* pour la première colonne */ +table.calendrier td.intitule-jour +{ + border: 1px; + border-style: solid; + border-color : black; + padding-left: 2px; + width: 60px; + text-align: center; +} + +/* Pour toutes les colonnes de la table du calendrier sauf la première */ +table.calendrier td.jour +{ + border: 1px; + border-style: solid; + border-color : black; + padding-left: 4px; + width: 80px; + vertical-align: text-top; +} + +/* Couleur de fond utilisé par des span pour afficher les groupement + * d'audiences. + * FON:fond; REF:refere; PCL:procedure collective; PREV:prevention; + * IP:Injonction de payer; DIV:divers; + */ +.couleur-audience-FON { + background-color: #ffff00; + cursor:auto; + +} + +.couleur-audience-REF { + background-color: #ffcc33; + cursor:auto; + +} + +.couleur-audience-PCL { + background-color: #ff9900; + cursor:auto; + +} + +.couleur-audience-PREV { + background-color: #cc9933; + cursor:auto; + +} + +.couleur-audience-IP { + background-color: #ff6600; + cursor:auto; + +} + +.couleur-audience-DIV { + background-color: #ff0033; + cursor:auto; + +} + +.couleur-audience-JC { + background-color: #ff00ff; + cursor:auto; +} + +/* Fin de la définition des styles pour + * le pour le calendrier de audience + */ + +.actesBodacc-entete-popup { + font-size:12px; + padding-left: 10px; + padding-top: 4px; + padding-bottom: 8px; + background-color:#F1F1F1 +} \ No newline at end of file diff --git a/scripts/build/config/_files/kbis/styles/infogreffe_base.css b/scripts/build/config/_files/kbis/styles/infogreffe_base.css new file mode 100644 index 00000000..e6746d66 --- /dev/null +++ b/scripts/build/config/_files/kbis/styles/infogreffe_base.css @@ -0,0 +1,1212 @@ + +/* -------------------------------------------------------------------------- + * ELEMENTS DE STYLE ET DE STRUCTURATION GENERAUX + * $Revision: 1.1.2.73.44.15 $ + */ + +body.full { + background-image:url(/infogreffe/img/fond.png); + background-repeat:no-repeat; + background-position:top center; + background-color:white; + padding:0px; + border:0px; + margin:0px; + font-family: arial, sans-serif; + font-size: 11px; + text-align:center; + color:#535353; +} + +body.simple { + background-color:white; + padding:0px; + border:0px; + margin:0px; + font-family: arial, sans-serif; + font-size: 11px; + color:#535353; +} + +td { + font-family: arial, sans-serif; + font-size: 11px; + color:#535353; +} + +form { + margin:0px; + padding:0px; + border:none; +} + +form select { + font-family: arial, sans-serif; + font-size: 10px; + vertical-align:middle; + border:1px solid #999999; +} + +form input { + font-family: arial, sans-serif; + font-size: 11px; + border:1px solid #999999; + padding-left: 1px; +} + +form input.checkbox { + border:none; + background-color:transparent; + vertical-align:middle; + padding-left: 0px; + margin-left: 0px; +} + +form input.checkboxform { + border:none; + background-color:transparent; + vertical-align:middle; + padding-left: 0px; + margin-left: 3px; +} + +/*since eirl*/ +div.choixBloc { + float: left; + width: 275px; +} + +/*since eirl*/ +input.choicRadio { + float: left; +} + +/*since eirl*/ +span.choixLibelle { + display: block; + margin-left: 1.75em; +} + + +/* les images dans les liens n'ont jamais de bordure */ +a img { + border:0px; +} + +/* -------------------------------------------------------------------------- + ELEMENTS DE STRUCTURATION GENERALE DE LA PAGE +*/ + +#struct-main { + width:774px; + margin:0px auto; + padding:0px; + border:0px; + text-align:left; +} + +.struct-main-table { + border-collapse:collapse; + width:100%; + margin:0px; + border:0px; + padding:0px; +} + +.struct-main-table td { + padding:0px; + margin:0px; + border:0px; +} + +#struct-left { + font-size: 10px; + background-color:#fffaf2; + width:139px; + vertical-align:top; +} + +.struct-left { + background-color:#fffaf2; + width:139px; +} + +.struct-right { + background-image:url(/infogreffe/img/ombre.png); + background-repeat:repeat-y; + background-position:top left; + width:635px; +} + +#struct-bottom { + background-image:url(/infogreffe/img/ombre.png); + background-repeat:repeat-y; + background-position:top left; + width:635px; + padding-top:2em; +} + +/* structuration de la partie droite de la page (qui est un tableau) */ +#struct-right-table { + border-collapse:collapse; + width:100%; + margin:0px; + border:none; + padding:0px; +} + +table.struct { + border-collapse:collapse; + margin:0px; + border:0px; + padding:0px; +} + +td.struct { + margin:0px; + border:0px; + padding:0px; +} + +div.struct { + margin:0px; + border:0px; + padding:0px; +} + +/* div pour �viter l'impression d'une partie de la page*/ +div.no-print { + margin:0px; + border:0px; + padding:0px; + display:none; +} + +table.struct td { + vertical-align:top; + margin:0px; + border:0px; + padding:0px; +} + +table.debug { + border-collapse:collapse; + margin:0px; + border:1px solid green; + padding:0px; +} + +table.debug td { + vertical-align:top; + margin:0px; + border:1px solid green; + padding:0px; +} + +td.debug { + border:1px solid green; +} + +div.debug { + border:1px solid green; +} + +span.debug { + color: green; +} + +/* -------------------------------------------------------------------------- + ELEMENTS DE STYLE DU BANDEAU GAUCHE +*/ + +#struct-left p { + background-repeat:no-repeat; + background-position:top left; + margin:0px; + padding-left:11px; + padding-top:0px; + padding-bottom:0px; + color: #747474; +} + +#struct-left p.link1 {background-image:url(/infogreffe/img/puceGauche1.png);} +#struct-left p.link2 {background-image:url(/infogreffe/img/puceGauche2.png);} +#struct-left p.link3 {background-image:url(/infogreffe/img/puceGauche3.png);} +#struct-left p.link4 {background-image:url(/infogreffe/img/puceGauche4.png);} +#struct-left p.link5 {background-image:url(/infogreffe/img/puceGauche5.png);} +#struct-left p.link6 {background-image:url(/infogreffe/img/puce/puce6.gif);} + +#struct-left p.plus { + margin:0px; + text-align:right; + padding-top:2px; + padding-right:4px; +} + +#struct-left div.hr { + width:100%; + margin:0px; + border:none; + border-top:1px solid #c2c3c5; + margin-top:4px; +} + +#struct-left div.section { + background-color:#777b94; + margin-top:6px; + margin-bottom:6px; + padding:4px; + text-align:center; + color:#bfd8e9; + font-size:9px; +} + +#struct-left a { + text-decoration:none; + color: #747474; +} + +#struct-left a:hover { + text-decoration: underline; +} + +#struct-left p.plus a { + text-decoration:none; + color: #FF9C00; +} + +#struct-left p.plus a:hover { + text-decoration:underline; +} + + +/* -------------------------------------------------------------------------- + ELEMENTS DE STYLE DU BANDEAU BAS +*/ + +#struct-bottom p { + text-align:center; + margin-right:40px; + margin-left:43px; + margin-bottom:5px; + padding-top:5px; + color: #767676; + border-top:1px dashed #939393; +} + +#struct-bottom a { + text-decoration:none; + color: #767676; +} + +#struct-bottom a:hover { + text-decoration: underline; +} + +/* -------------------------------------------------------------------------- + ELEMENTS DE STYLE DE LA CELLULE DU CENTRE +*/ + +.struct-center-table { + background-image:url(/infogreffe/img/fond-interieur.png); + background-repeat:no-repeat; + background-position:top left; + border-collapse:collapse; + width:100%; + margin:0px; + border:0px; + padding:0px; +} + +.struct-center-table a:hover { + text-decoration:none; +} + +#struct-content a:hover { + text-decoration:none; +} + +.struct-center-table td.margin-left { + width:45px; +} + +.struct-center-table td.margin-right { + width:40px; +} + +.struct-panier { + padding:4px; + font-weight: bold; + text-align:right; + padding-right:0.5em; + color:#545377; + font-size:9px; +} + +.struct-panier a:link { + color:#545377; +} +.struct-panier a:visited { + color:#545377; +} +.struct-panier a:active { + color:#545377; +} + +.struct-panier a:hover { + color:#ff9c00; +} + +.struct-welcome { + font-size:9px; + color:#5b8cb8; +} + +.struct-onglets { + font-size:9px; + color:#767676; +} + +.struct-erreur { + color:#FF9C00; +} + +.struct-onglets a, .struct-onglets a:hover, .struct-onglets a:visited { + color:#5b8cb0; +} + +.struct-onglets span.courant { + color:#999999; +} + +a { + color: #545377; +} + +a:hover { + color: #545377; +} + +a:visited { + color: #545377; +} + +/* -------------------------------------------------------------------------- + ELEMENTS DE STYLE REUTILISABLES +*/ + +div.fond-bleu { + width:100%; + background-color:#d9eef1; + padding:10px; +} + +div.fond-resultat { + background-color:#f1f1f1; + border-top:8px solid #767a96; + padding:10px 0px 20px 21px; +} + + +/* les commentaires de bas de page (voir formulaires de recherche) */ +div.commentaires { + padding:5px 14px 5px 14px; + margin-right:33px; + margin-left:33px; + border:1px solid #7f7f7f; + text-align:center; + line-height:1.66em; +} + +div.commentaires p { + margin-top:0; + margin-bottom:1em; +} + +div.confirPaiement { + width: 529px; + padding:0px 0px 0px 0px; + color: #ff9933 +} + +div.commentaires a { + font-weight:bold; +} + +.input-text { + border:1px solid #7f7f7f; +} + +.input-text-area { + border:1px solid #7f7f7f; + font-family: arial, sans-serif; + font-size: 11px; +} + +.input-select { + border:1px solid #7f7f7f; +} + +.tag-titre { + margin-top:8px; + font-size: 15px; + text-transform:uppercase; + padding-bottom:4px; + margin-bottom:10px; + font-weight: bold; + color:#767676; + border-bottom:1px dashed #939393; +} + +.tag-titre-loginDirect{ + margin-top:8px; + font-size: 15px; + text-transform:uppercase; + padding-bottom:4px; + font-weight: bold; + color:#767676; +} + +/* -------------------------------------------------------------------------- + ELEMENTS DE STYLE DE LA BARRE DE MENUS PAR ROLLOVER +*/ + +table.top-boutons { + padding:0px; + margin:0px; + border:none; + border-collapse:collapse; + margin-top:1px; +} + +table.top-boutons td { + line-height:14px; + padding:0px; + margin:0px; + border:none; + font-size:9px; + text-transform:uppercase; + vertical-align:middle; +} + +table.top-boutons td.titre { + color:#e2e2e2; + background-color:#939393; + text-align:right; + padding-right:2px; + letter-spacing: 1px; + width:134px; +} + +table.top-boutons td.link { + background-image:url(/infogreffe/img/top-separator.png); + background-repeat:no-repeat; + background-position:center right; + padding-right:2px; + background-color:#d2d2d2; + width:1em; +} + +table.top-boutons td.link a { + color:#737373; + background-color:#d2d2d2; + display:block; + text-decoration:none; + padding-left:1em; + padding-right:1em; + white-space: nowrap; +} + +table.top-boutons td.link a:hover { + color:#939393; + background-color:white; +} + +table.struct td.top-filler { + background-image:url(/infogreffe/img/top-filler2.png); + background-repeat:repeat-x; + height:16px; + width:635px; +} + +/* -------------------------------------------------------------------------- + ELEMENTS DE STYLE DE LA ZONE D'ABONNEMENT +*/ + +td#inscr-light { + background-image:url("/infogreffe/img/inscr-bg-light.png"); + background-repeat:repeat-x; + background-position:top left; + vertical-align:middle; + padding:0 0.5em 0 1em; + color:#545377; + font-size: 9px; + font-weight:bold; +} + +td#inscr-light a { + font-family: verdana, arial, sans-serif; +} + +td#inscr-light a:hover { + text-decoration:none; +} + +td#inscr-dark { + background-image:url("/infogreffe/img/inscr-bg-dark.png"); + background-repeat:repeat-x; + background-position:top left; + font-family: verdana, arial, sans-serif; + vertical-align:middle; + padding:0 1em 0 1em; + color:white; + font-size: 9px; + font-weight:bold; +} + +td.inscr { + background-image:url("/infogreffe/img/inscr-bg-left.png"); + background-repeat:repeat-x; + background-position:top left; +} + +/* -------------------------------------------------------------------------- + ELEMENTS DE STYLE DES TAGLIBS ET AUTRES ELEMENTS STANDARDS +*/ + +table.cartouche-liens { + width: 100px; + border-collapse:collapse; +} + +table.cartouche-liens td.gauche { + border-bottom-width: 1px; + border-bottom-style: solid; + border-bottom-color: white; + border-right-width: 1px; + border-right-style: solid; + border-right-color: white; + font-size: 10px; + color: #FF9C00; + padding:3px; + width:65px; + text-align:left; +} +table.cartouche-liens td.droite { + text-align: center; + vertical-align: middle; + border-bottom-width: 1px; + border-bottom-style: solid; + border-bottom-color: white; + width:35px; +} + +/* -------------------------------------------------------------------------- + ELEMENTS DE STYLE DES TABLES STANDARD +*/ + +tr.mediabar td { + padding:0px; + margin:0px; + border:none; +} + +/* table de prix */ + +table.table-prix, table.table-classic, table.table-produit { + border-collapse:collapse; + border: 0px; + border-color: #939393; +} + +table.table-prix tr.titre td.titre { + padding:8px 4px 8px 20px; + background-color: #D9EEF1; + border-right:1px solid #939393; + color:#545377; + font-weight:bold; +} + +table.table-prix td.mediabar { + width:240px; + padding-bottom:4px; +} + +table.table-prix td.prix-popup-produit, table.table-prix td.prix-popup-transmission, table.table-prix td.prix-popup-total { + background-color: #FFFAF2; + border-bottom:1px dashed #939393; + text-align:right; + padding-right:10px; + white-space:nowrap; + color:black; + font-weight:bold; +} + +table.table-prix td.prix { + background-color: #FFFAF2; + border-bottom:1px dashed #939393; + text-align:right; + padding-right:10px; + white-space:nowrap; + color:black; +} + +table.table-prix td.prix-popup-produit { + color:#535353; +} + +table.table-prix td.prix-popup-transmission { + color:#535353; + /*font-style:italic;*/ +} + +table.table-prix td.titre span.adresse { + font-size: 9px; + color:#535353; + font-weight:normal; + width:auto; /* because of an IE6 bug */ +} + +table.table-prix tr.ligne td.titre, table.table-prix tr.last td.titre { + padding:4px 4px 4px 20px; + background-color: #ECF7F8; + border-right:1px solid #939393; + color:#545377; + font-weight:bold; + vertical-align:top; +} + +table.table-prix tr.ligne td.std, table.table-prix tr.last td.std { + padding:4px 4px 4px 4px; + background-color: #FFF; + border-right:1px solid #939393; + text-align:center; +} + +table.table-prix tr.ligne td.media, table.table-prix tr.last td.media { + width:59px; /* 59 + 1(margin) = 60 for IE6 */ + padding:0px; + margin:0px; + background-color: #FFF; + border-right:1px solid #939393; + text-align:center; + font-weight:bold; + color:#545377; +} + +table.table-prix td.last { + padding:4px 4px 4px 4px; + background-color: #FFF; + text-align:center; +} + +table.table-prix tr.ligne td.titre, table.table-prix tr.ligne td.std, table.table-prix tr.ligne td.media { + border-bottom:1px dashed #939393; +} + +table.table-prix tr.total td, table.table-prix tr.grand-total td { + font-style: italic; + padding:4px 10px 4px 10px; + font-weight:bold; + text-align:right; + background-color: #FFFAF2; +} + +table.table-prix tr.total td.titre { + color:#545377; +} + +table.table-prix tr.total td.prix { + color:black; +} + +table.table-prix tr.grand-total td.titre { + color:#545377; + padding-top:10px; + padding-bottom:10px; + background-color:white; + border-right:1px solid #939393; +} + +table.table-prix tr.grand-total td.prix { + font-style: normal; + border-bottom:0px; +} + +table.table-prix a.action, table.table-prix a:hover.action, table.table-prix a:visited.action { + font-size:9px; + color:#545377; + text-decoration:underline; +} + +/* table de produits */ + +table.table-produit td.mediabar { + width:320px; + padding-bottom:4px; +} + +table.table-produit tr.titre td.titre { + padding:8px 4px 8px 20px; + background-color: #D9EEF1; + color:#545377; + font-weight:bold; +} + +table.table-produit td.titre span.adresse { + font-size: 9px; + color:#535353; + font-weight:normal; + width:auto; /* because of an IE6 bug */ +} + +table.table-produit tr.ligne td.titre, table.table-produit tr.last td.titre { + padding:4px 4px 4px 20px; + background-color: #ECF7F8; + border-right:1px solid #939393; + color:#545377; + font-weight:bold; + vertical-align:top; +} + +table.table-produit td.media, table.table-produit td.media-last { + width:79px; /* 79 + 1(margin) = 80 for IE6 */ + background-color: #FFF; + border-right:1px solid #939393; + text-align:center; +} + +table.table-produit td.media-last { + border-right:none; +} + +table.table-produit tr.ligne td { + border-bottom:1px dashed #939393; +} + +table.table-produit a.action, table.table-produit a:hover.action, table.table-produit a:visited.action { + font-size:9px; + color:#545377; + text-decoration:underline; +} + +/* table classique */ + +table.table-classic tr.titre td { + padding:8px 4px 8px 8px; + background-color: #D9EEF1; + font-weight:bold; + color:#545377; +} + +table.table-classic tr.ligne td.titre, table.table-classic tr.last td.titre, +table.table-classic tr.ligne td.std, table.table-classic tr.last td.std, +table.table-classic tr.ligne td.last, table.table-classic tr.last td.last { + padding:8px 4px 8px 8px; + background-color: #FFF; + border-right: 1px solid #939393; + color:#545377; +} + +table.table-classic tr.ligne td.titre, table.table-classic tr.last td.titre { + background-color: #ECF7F8; + font-weight:bold; +} + +table.table-classic a, table.table-classic a:visited, table.table-classic a:hover { + color:#545377; +} + +table.table-classic tr.ligne td.titre, table.table-classic tr.ligne td.std, table.table-classic tr.ligne td.last { + border-bottom : 1px dashed #939393; +} + +table.table-classic tr.ligne td.last, table.table-classic tr.last td.last { + border-right: none; +} + +/* table structurante */ +table.struct td.content { + padding:0px 8px 0px 0px; +} + +table.struct td.content-ident { + padding:0px 10px 0px 10px; +} + +/** marge top 8, idem gauche/droite 10*/ +table.struct td.content-ident-top { + padding:8px 10px 0px 10px; +} + +table.struct td.content-ligne-bleu { + padding:8px 4px 8px 8px; + background-color: #ECF7F8; + border-bottom : 1px dashed #939393; + color:#545377; +} + +table.struct td.content-ligne-titre { + padding:8px 4px 8px 8px; + background-color: #D9EEF1; + border-bottom : 1px dashed #939393; + color:#545377; +} + +table.struct td.content-ligne-transparent { + padding:8px 4px 8px 8px; + background-color: transparent; + border-bottom : 1px dashed #939393; + color:#545377; +} + +table.struct td.content-ligne { + padding:8px 4px 8px 8px; + background-color: #FFF; + border-bottom : 1px dashed #939393; + color:#545377; +} + +table.struct td.content-last-bleu { + padding:8px 4px 8px 8px; + background-color: #ECF7F8; + color:#545377; +} + +table.struct td.content-last-titre { + padding:8px 4px 8px 8px; + background-color: #D9EEF1; + color:#545377; +} + +table.struct td.content-last-transparent { + padding:8px 4px 8px 8px; + background-color: transparent; + color:#545377; +} + +table.struct td.content-last-jaune { + padding:8px 4px 8px 8px; + background-color: #FFFAF2; + color:#545377; +} + +table.struct td.content-last { + padding:8px 4px 8px 8px; + background-color: #FFF; + color:#545377; +} + +table.struct td.struct-ligne-bleu { + padding:8px 0px 8px 0px; + background-color: #ECF7F8; + border-bottom : 1px dashed #939393; + color:#545377; +} + +table.struct td.struct-ligne-titre { + padding:8px 0px 8px 0px; + background-color: #D9EEF1; + border-bottom : 1px dashed #939393; + color:#545377; +} + +table.struct td.struct-ligne { + padding:8px 0px 8px 0px; + background-color: #FFF; + border-bottom : 1px dashed #939393; + color:#545377; +} + +table.struct td.struct-ligne-ident { + padding:8px 10px 8px 10px; + background-color: #FFF; + border-bottom : 1px dashed #939393; + color:#545377; +} + +table.struct td.struct-ligne-top { + padding:8px 0px 8px 0px; + background-color: #FFF; + border-top : 1px dashed #939393; + color:#545377; +} + +table.struct td.struct-last-bleu { + padding:8px 0px 8px 0px; + background-color: #ECF7F8; + color:#545377; +} + +table.struct td.struct-last-titre { + padding:8px 0px 8px 0px; + background-color: #D9EEF1; + color:#545377; +} + +table.struct td.struct-last-transparent { + padding:8px 0px 8px 0px; + background-color: transparent; + color:#545377; +} + +table.struct td.struct-last { + padding:8px 0px 8px 0px; + background-color: #FFF; + color:#545377; +} + +table.struct td.content-last-prix { + padding:8px 10px 8px 0px; + background-color: #FFFAF2; + text-align:right; + white-space:nowrap; +} + +table.struct td.content-ligne-prix { + padding:8px 10px 8px 0px; + background-color: #FFFAF2; + text-align:right; + border-bottom : 1px dashed #939393; + white-space:nowrap; +} + +/* ------------ CADRES A PUCES ET AUTRES TAGLIBS -----------------*/ + + +table.cadre-puce { + table-layout:fixed; + border-collapse:collapse; + padding:0px; + margin:0px; + border:none; +} + +table.cadre-puce td { + padding:0px; +} + +table.cadre-puce tr.head td.c1 { + background-image:url(/infogreffe/img/cadrePuce-gauche-orange.png); + background-repeat:no-repeat; + background-position:bottom left; + width:14px; +} + +table.cadre-puce tr.head td.c2 { + background-image:url(/infogreffe/img/cadrePuce-haut.png); + background-repeat:repeat-x; + background-position:bottom left; +} + +table.cadre-puce tr.head td.c2 span { + background-color:#777b94; + color:white; + padding:1px 4px 1px 4px; + font-size:11px; +} + +table.cadre-puce tr.head td.c3 { + background-image:url(/infogreffe/img/cadrePuce-droite.png); + background-repeat:no-repeat; + background-position:bottom left; + width:1px; +} + +table.cadre-puce tr.head td img { + vertical-align:top +} + +table.cadre-puce tr.content td.c1 { + background-image:url(/infogreffe/img/cadrePuce-vertical.png); + background-repeat:repeat-y; + background-position:top left; + background-color:white; +} + +table.cadre-puce tr.content td.c2 { + padding:2px 10px 10px 0px; + background-color:white; +} + +table.cadre-puce tr.content td.c3 { + background-image:url(/infogreffe/img/cadrePuce-vertical.png); + background-repeat:repeat-y; + background-position:top left; + background-color:white; +} + +table.cadre-puce tr.foot td.c1 { + border-top:1px solid #777b94; +} + +table.tag-titre-liste { + border-collapse:collapse; + border:none; + padding:0px; + margin:0px; +} + +table.tag-titre-liste tr.tag-titre-liste td.puce { + vertical-align:middle; +} + +table.tag-titre-liste tr.tag-titre-liste td.content { + background-color:#777b94; + color:white; + padding:1px 8px 1px 8px; + font-size:11px; + font-weight:bold; +} + +/* ------------ FAQS ET AUTRES FENETRES ET POPUP D'INFOS -----------------*/ + +div.faq p { + padding-left:18px; + padding-right:18px; + text-align: justify; +} + +div.faq h2 { + font-size:12px; + font-style:italic; + color:#545377; + padding-left:18px; + padding-top:8px; + padding-right:18px; + /*border-top:1px dashed #939393;*/ +} + +div.faq h3 { + font-size:13px; + font-style:italic; + color:#545377; + padding-left:50px; + padding-top:8px; + padding-right:18px; + /*border-top:1px dashed #939393;*/ +} + +div.faq ul { + margin-left:18px; + margin-right:18px; + padding-left:4em; +} + +div.faq ol { + margin-left:18px; + margin-right:18px; + padding-left:4em; +} + +div.faq ol li { + text-align: justify; + list-style-type:decimal; + padding-bottom:4px; +} + +div.faq ul li { + text-align: justify; + list-style-image: url(/infogreffe/img/puce/puce6.gif); + padding-bottom:4px; +} + +div.faq ul.level2 li { + list-style-type:disc; + text-align: left; + list-style-image: none; +} + +div.faq div.faqChapter { + padding-left: 5px; + padding-top: 1em; + border-top:1px dashed #939393; +} + +/* ------------ MINIBLOCS -----------------*/ + +table.minibloc { + border-collapse:collapse; + padding:0px; + margin:0px; + border:none; +} + +table.minibloc td.head { + background-image:url(/infogreffe/img/puceBlanche.png); + background-position:top left; + background-repeat:no-repeat; + font-size:10px; + color:white; + padding:1px 0px 2px 20px; + font-weight:bold; + border-left:1px solid; + border-right:1px solid; +} + +table.minibloc td.content { + font-size:10px; + color:#535353; + border:1px solid #848484; + border-top:none; + padding:4px 4px 4px 4px; + line-height:130%; + text-align:justify; +} + +table.minibloc td.content a { + color:#535353; +} + +/* Effet popup dynamique */ +.folded { + background:url(/infogreffe/img/puce/folded.gif) no-repeat left; + font-weight:bold; + padding-left:15px; +} + +.unfolded { + background:url(/infogreffe/img/puce/unfolded.gif) no-repeat left; +} + +.fold { + margin:5px 0px 5px 15px; + border-bottom:dashed 1px #939393; + padding-bottom:10px; +} + +/* utilis� pour les produit en document direct (pas de ligne s�paratrice) */ +.folddirect { + margin:5px 0px 0px 15px; +} + +.infobulle { + border-bottom:#535353 dashed 1px; + cursor:help; + line-height:16px; +} + +/* Utiliser pour desactiver la selection du texte*/ +.preventSelection{ + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -o-user-select: none; + user-select: none; +} + +/******************* +* Ajouts redesign * +********************/ +/* Tous les �l�ments du contenu central sont dans la div ayant pour className .struct-main-table */ + +/* Forcer la taille de police */ +.struct-main-table { font-size:11px; color:#535353;} + +/* Forcer les couleurs de liens */ +.struct-main-table a { color: #545377!important; } +.struct-main-table a:hover { color: #545377!important; text-decoration:none!important; } +.struct-main-table a:visited { color: #545377!important; } + +/* retours 2*/ +.struct-main-table input, .struct-main-table select { margin:0; } diff --git a/scripts/build/config/_files/tables/voies.csv b/scripts/build/config/_files/tables/voies.csv new file mode 100644 index 00000000..12da5542 --- /dev/null +++ b/scripts/build/config/_files/tables/voies.csv @@ -0,0 +1,208 @@ +#CodeVoie;Libellé Voie;Export +ABE;Abbaye;1 +AGL;Agglomération;1 +AIRE;Aire;1 +ALL;Allée;1 +ALL;Allee;0 +ACH;Ancien chemin;1 +ART;Ancienne route;1 +ANSE;Anse;1 +ARC;Arcade;1 +AUT;Autoroute;1 +AV;Avenue;1 +BRE;Barrière;1 +BCH;Bas chemin;1 +BSTD;Bastide;1 +BAST;Baston;1 +BEGI;Beguinage;1 +BER;Berge;1 +BOIS;Bois;1 +BCLE;Boucle;1 +BD;Boulevard;1 +BRG;Bourg;1 +BUT;Butte;1 +CALE;Cale;1 +CAMP;Camp;1 +CGNE;Campagne;1 +CPG;Camping;1 +CARR;Carré;1 +CAU;Carreau;1 +CAR;Carrefour;1 +CARE;Carrière;1 +CST;Castel;1 +CAV;Cavée;1 +CTRE;Central;1 +CTRE;Centre;1 +CHL;Chalet;1 +CHP;Chapelle;1 +CHI;Charmille;1 +CHT;Château;1 +CHS;Chaussée;1 +CHE;Chemin;1 +CHV;Chemin vicinaux;0 +CHV;Chemin vicinal;1 +CHEM;Cheminement;1 +#CHEZ;Chez;0 +CITE;Cîte;1 +CLOI;Cloître;1 +CLOS;Clos;1 +COL;Col;1 +COLI;Colline;1 +CTR;Contour;1 +COR;Corniche;1 +COTE;Côte;1 +COTT;Cottage;1 +COUR;Cour;1 +CRS;Cours;1 +DARS;Darse;1 +DEG;Degré;1 +DSG;Descente;1 +DSC;Descente;0 +DIG;Digue;1 +DOM;Domaine;1 +ECA;Ecart;1 +ECL;Ecluse;1 +EGL;Eglise;1 +EN;Enceinte;1 +ENV;Enclave;1 +ENC;Enclos;1 +ESC;Escalier;1 +ESPA;Espace;1 +ESP;Esplanade;1 +ETING;Etang;1 +FG;Faubourg;1 +FRM;Ferme;1 +FON;Fontaine;1 +FORT;Fort;1 +FORM;Forum;1 +FOS;Fosse;1 +FOYR;Foyer;1 +GAL;Galerie;1 +GARE;Gare;1 +GARN;Garenne;1 +GBD;Grand boulevard;1 +GDEN;Grande ensemble;1 +GR;Grande rue;1 +GRI;Grille;1 +GRIM;Grimpette;1 +GPE;Groupe;1 +GPT;Groupement;1 +HLE;Halle;1 +HAM;Hameau;1 +HCH;Haut chemin;1 +HIP;Hippodrome;1 +HLM;HLM;1 +ILE;Ile;1 +IMM;Immeuble;1 +IMP;Impasse;1 +JARD;Jardin;1 +JTE;Jetée;1 +LEVE;Levée;1 +LD;Lieu dit;1 +LD;Lieudit;0 +LOT;Lotissement;1 +MAIL;Mail;1 +MF;Maison forestière;1 +MAN;Manoir;1 +MAR;Marche;1 +MAS;Mas;1 +MET;Métro;1 +MET;Metro;0 +MTE;Montée;1 +MTE;Montee;1 +MLN;Moulin;1 +MUS;Musée;1 +MUS;Musee;0 +NTE;Nouvelle route;1 +PAL;Palais;1 +PARC;Parc;1 +PKG;Parking;1 +PRV;Parvis;1 +PAS;Passage;1 +PN;Passage à niveau;1 +PASS;Passe;1 +PLE;Passerelle;1 +PAT;Patio;1 +PAV;Pavillon;1 +PERI;Périphérique;1 +PERI;Peripherique;0 +PSTY;Péristyle;1 +PSTY;Peristyle;0 +PTA;Petites allée;1 +PTA;Petites allee;0 +PCH;Petit chemin;1 +PAE;Petite avenue;1 +PIM;Petite impasse;1 +PRT;Petite route;1 +PTR;Petite rue;1 +PL;Place;1 +PLCI;Placis;1 +PLAG;Plage;1 +PLN;Plaine;1 +PLAN;Plan;1 +PLT;Plateau;1 +PNT;Pointe;1 +PONT;Pont;1 +PCH;Porche;1 +PORT;Port;1 +PTE;Porte;1 +PORQ;Portique;1 +POT;Poterne;1 +POUR;Pourtour;1 +PRE;Pré;1 +PRE;Pre;0 +PRQ;Presqu'île;1 +PRQ;Presqu'ile;0 +PROM;Promenade;1 +QU;Quai;1 +QUAI;Quai;0 +QUA;Quartier;1 +RAC;Raccourci;1 +RAID;Raidillon;1 +RPE;Rampe;1 +REM;Rempart;1 +RES;Résidence;1 +RES;Residence;0 +ROC;Roc;1 +ROC;Rocade;1 +RPT;Rond point;1 +ROQT;Roquet;1 +RTD;Rotonde;1 +RTE;Route;1 +R;Rue;1 +RUE;Rue;0 +RLE;Ruelle;1 +SEN;Sente;1 +SEN;Sentier;1 +SQ;Square;1 +STDE;Stade;1 +STA;Station;1 +TPL;Terre plein;1 +TRN;Terrain;1 +TSSE;Terrasse;1 +TRT;Tertre;1 +TOUR;Tour;1 +TRA;Traverse;1 +VAL;Vallon;1 +VAL;Vallée;1 +VAL;Vallee;0 +VEN;Venelle;1 +VIA;Via;1 +VTE;Vieille route;1 +VCHE;Vieux chemin;1 +VLA;Villa;1 +VGE;Village;1 +VLGE;Village;0 +VOI;Voie;1 +VOIE;Voie;0 +ZONE;Zone;1 +ZAC;Zone d'aménagement concerté;1 +Z A C;Zone d'aménagement concerté;0 +ZAD;Zone d'aménagement différé;1 +Z A D;Zone d'aménagement différé;0 +ZA;Zone artisanale;1 +Z A;Zone artisanale;0 +ZI;Zone industrielle;1 +Z I;Zone industrielle;0 +ZUP;Zone à urbaniser en priorité;1 +Z U P;Zone à urbaniser en priorité;0 \ No newline at end of file diff --git a/scripts/build/config/_sql/historiques.bilans.sql b/scripts/build/config/_sql/historiques.bilans.sql new file mode 100644 index 00000000..9da497dd --- /dev/null +++ b/scripts/build/config/_sql/historiques.bilans.sql @@ -0,0 +1,19 @@ +CREATE TABLE IF NOT EXISTS `bilans` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `siren` int(9) unsigned zerofill NOT NULL, + `dateProvPartenaire` int(8) unsigned NOT NULL, + `dateExercice` int(8) unsigned NOT NULL, + `dateExercicePre` int(8) unsigned NOT NULL, + `dureeExercice` tinyint(2) unsigned NOT NULL DEFAULT '0', + `dureeExercicePre` tinyint(2) unsigned NOT NULL DEFAULT '0', + `monnaie` char(3) NOT NULL COMMENT 'Code devise du bilan stocké en base selon la ISO 4217 (3 lettres)', + `typeBilan` char(1) NOT NULL DEFAULT '', + `monnaieOrigine` char(3) NOT NULL COMMENT 'Code devise d''origine selon la ISO 4217 (3 lettres)', + `unite` char(1) NOT NULL DEFAULT '', + `postes` text NOT NULL, + `partenaire` tinyint(1) unsigned NOT NULL DEFAULT '0', + `confidentiel` tinyint(1) unsigned NOT NULL DEFAULT '0', + `dateInsert` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + KEY `dateInsert` (`dateInsert`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Bilans'; \ No newline at end of file diff --git a/scripts/build/config/_sql/jo.asso_actes.sql b/scripts/build/config/_sql/jo.asso_actes.sql new file mode 100644 index 00000000..dbc4078e --- /dev/null +++ b/scripts/build/config/_sql/jo.asso_actes.sql @@ -0,0 +1,14 @@ +CREATE TABLE IF NOT EXISTS `asso_actes` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `siren` varchar(9) DEFAULT NULL COMMENT 'Siren', + `waldec` varchar(15) DEFAULT NULL COMMENT 'Numéro R.N.A', + `pdfLink` varchar(50) NOT NULL COMMENT 'Nom du PDF', + `pdfSize` int(11) NOT NULL COMMENT 'Taille du PDF en octets', + `pdfVer` varchar(4) NOT NULL COMMENT 'Version du fichier PDF', + `pdfPage` int(2) NOT NULL COMMENT 'Nombre de pages', + `date_acte` date NOT NULL COMMENT 'Date de l''acte', + `type_acte` varchar(5) NOT NULL COMMENT 'Type de l''acte (info)', + `type_acte_libelle` varchar(100) NOT NULL COMMENT 'Libellé du type de l''acte', + `dateInsert` datetime NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Statuts des associations' ; \ No newline at end of file diff --git a/scripts/build/config/_sql/jo.bilans_user.sql b/scripts/build/config/_sql/jo.bilans_user.sql new file mode 100644 index 00000000..2d7b113a --- /dev/null +++ b/scripts/build/config/_sql/jo.bilans_user.sql @@ -0,0 +1,10 @@ +CREATE TABLE IF NOT EXISTS `bilans_user` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `idUtilisateur` int(11) NOT NULL COMMENT 'Identifiant de l''opérateur ayant modifié le bilan', + `login` varchar(20) NOT NULL COMMENT 'Login de l''opérateur ayant modifié le bilan', + `siren` int(9) unsigned zerofill NOT NULL COMMENT 'Siren du bilan modifié', + `dateExercice` int(8) NOT NULL COMMENT 'Date de clôture du bilan modifié', + `typeBilan` char(1) NOT NULL COMMENT 'Type de bilan modifié', + `dateAction` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Modifications de bilans faites par des opérateurs S&D'; diff --git a/scripts/build/config/_sql/logsCount.sql b/scripts/build/config/_sql/logsCount.sql new file mode 100644 index 00000000..b2b2b0c7 --- /dev/null +++ b/scripts/build/config/_sql/logsCount.sql @@ -0,0 +1,14 @@ +-- +-- Structure de la table `logsCount` +-- + +CREATE TABLE IF NOT EXISTS `logsCount` ( + `jour` date NOT NULL COMMENT 'Jour de la consommation', + `idClient` int(11) NOT NULL, + `service` char(20) NOT NULL, + `login` char(20) NOT NULL, + `log` char(20) NOT NULL COMMENT 'Nom de l''élément consommé', + `conso` int(11) NOT NULL COMMENT 'Nombre de consommation', + `batchUpdate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT 'Date de mise à jour par Batch', + UNIQUE KEY `jour` (`jour`,`idClient`,`service`,`login`,`log`) +) ENGINE=MyISAM COMMENT='Calcul des consommations'; \ No newline at end of file diff --git a/scripts/build/config/_sql/sdv1.clients_services.sql b/scripts/build/config/_sql/sdv1.clients_services.sql new file mode 100644 index 00000000..cc36337f --- /dev/null +++ b/scripts/build/config/_sql/sdv1.clients_services.sql @@ -0,0 +1,6 @@ +CREATE TABLE IF NOT EXISTS `clients_services` ( + `code` varchar(20) NOT NULL COMMENT 'Code du service (elements texte sans espace ni caractères spéciaux)', + `label` varchar(100) NOT NULL COMMENT 'Libellé du service', + `idClient` int(11) NOT NULL, + KEY `code` (`code`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; \ No newline at end of file diff --git a/scripts/build/config/_sql/sdv1.clients_tarifs.sql b/scripts/build/config/_sql/sdv1.clients_tarifs.sql new file mode 100644 index 00000000..495f7b63 --- /dev/null +++ b/scripts/build/config/_sql/sdv1.clients_tarifs.sql @@ -0,0 +1,13 @@ +CREATE TABLE IF NOT EXISTS `clients_tarifs` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `idClient` int(11) NOT NULL, + `service` char(20) NOT NULL, + `log` char(20) NOT NULL COMMENT 'Element à facturer', + `type` enum('Unitaire','ForfaitLimit','ForfaitNolimit') NOT NULL, + `priceUnit` float NOT NULL DEFAULT '0' COMMENT 'Prix unitaire d''un élément', + `limit` int(11) NOT NULL DEFAULT '0' COMMENT 'Nombre limite de consommation', + `dateDebut` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT 'Date de debut du contrat', + `duree` int(11) NOT NULL COMMENT 'Durée du contrat', + `doublon` enum('jour','mois','period','') NOT NULL COMMENT 'Période de dédoublonnage', + PRIMARY KEY (`id`) +) ENGINE=MyISAM COMMENT='Définition des tarifs pour les clients et services'; \ No newline at end of file diff --git a/scripts/build/config/_sql/sdv1.prestations.sql b/scripts/build/config/_sql/sdv1.prestations.sql new file mode 100644 index 00000000..349ac5d5 --- /dev/null +++ b/scripts/build/config/_sql/sdv1.prestations.sql @@ -0,0 +1,31 @@ +-- +-- Structure de la table `prestations` +-- + +CREATE TABLE IF NOT EXISTS `prestations` ( + `id` int(11) NOT NULL, + `typeprestation` varchar(50) NOT NULL, + `source` varchar(50) NOT NULL, + `datemiseenplace` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `datepremierefactu` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `freqfacturation` enum('Unitaire','Quotidien','Hebdo','Mensuel','Trimestriel','Annuel','Semestriel') NOT NULL, + `datefinprestation` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `prestatest` tinyint(1) NOT NULL, + `identifiantPrestation` varchar(100) NOT NULL, + `passwordprestation` varchar(100) NOT NULL, + `supportprestation` enum('FTP','Email','CD/DVD','CFT') NOT NULL, + `identifiantCFT` varchar(100) NOT NULL, + `dureecontrat` int(2) NOT NULL, + `montantannuelfactu` varchar(10) NOT NULL, + `freqenvois` enum('Unitaire','Quotidien','Hebdo','Mensuel','Trimestriel','Annuel','Semestriel') NOT NULL, + `formatdesenvois` varchar(100) NOT NULL, + `trtnumerotour` int(11) NOT NULL, + `trtdatedeniereexec` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `optionsprestation` text NOT NULL, + `prestationactive` enum('oui','non') NOT NULL, + `optionsupport` text NOT NULL, + `mailIN` varchar(100) NOT NULL, + `mailOUT` varchar(100) NOT NULL, + `osClient` int(11) NOT NULL, + `compression` enum('none','zip','gzip','bzip2') NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Prestations Surveillance / Diffusion'; \ No newline at end of file diff --git a/scripts/build/config/_sql/sdv1.utilisateurs_service.sql b/scripts/build/config/_sql/sdv1.utilisateurs_service.sql new file mode 100644 index 00000000..b18b2dc4 --- /dev/null +++ b/scripts/build/config/_sql/sdv1.utilisateurs_service.sql @@ -0,0 +1,5 @@ +CREATE TABLE IF NOT EXISTS `utilisateurs_service` ( + `login` varchar(20) NOT NULL, + `serviceCode` varchar(20) NOT NULL COMMENT 'Code du service', + KEY `login` (`login`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; diff --git a/scripts/build/config/local/application.ini b/scripts/build/config/local/application.ini new file mode 100644 index 00000000..494dea56 --- /dev/null +++ b/scripts/build/config/local/application.ini @@ -0,0 +1,92 @@ +[production] +phpSettings.date.timezone = "Europe/Paris" +phpSettings.display_startup_errors = 0 +phpSettings.display_errors = 0 +bootstrap.path = APPLICATION_PATH "/Bootstrap.php" +bootstrap.class = "Bootstrap" +appnamespace = "Application" +resources.session.save_path = APPLICATION_PATH "/../data/sessions" +resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers" +resources.frontController.plugins.Auth = "Application_Controller_Plugin_Auth" +resources.frontController.params.displayExceptions = 0 +resources.layout.layout = "main" +resources.layout.layoutPath = APPLICATION_PATH "/views" +resources.view.basePath = APPLICATION_PATH "/views" +autoloaderNamespaces[] = "Application_" +autoloaderNamespaces[] = "Scores_" +autoloaderNamespaces[] = "Form_" + +; Scores configuration +profil.server.name = development +profil.mail.method = smtp +profil.mail.smtp_host = smtp.free.fr +profil.mail.email.support = supportdev@scores-decisions.com +profil.mail.email.supportdev = supportdev@scores-decisions.com +profil.mail.email.contact = supportdev@scores-decisions.com +profil.mail.email.production = supportdev@scores-decisions.com +profil.wkhtmltopdf.path = "c:\Users\mricois\www\data\wkhtml" +profil.wkhtmltopdf.arch = "amd64" +profil.path.batch = APPLICATION_PATH "/../scripts/jobs" +profil.path.cache = APPLICATION_PATH "/../data/cache" +profil.path.files = APPLICATION_PATH "/../data/files" +profil.path.log = APPLICATION_PATH "/../data/log" +profil.path.data = "c:\Users\mricois\www\dataws" +profil.path.secure = "c:\Users\mricois\www\dataws" + +profil.sphinx.ent.host = "192.168.78.252" +profil.sphinx.ent.port = 3312 +profil.sphinx.ent.version = 2 +profil.sphinx.dir.host = "192.168.78.252" +profil.sphinx.dir.port = 3312 +profil.sphinx.dir.version = 2 +profil.sphinx.act.host = "192.168.78.252" +profil.sphinx.act.port = 3312 +profil.sphinx.act.version = 2 +profil.sphinx.histo.host = "192.168.78.252" +profil.sphinx.histo.port = 3312 +profil.sphinx.histo.version = 2 + +; For old configuration - see WsScores/Configure.php +profil.db.default.adapter=mysqli +profil.db.default.params.host=192.168.78.230 +profil.db.default.params.username=user +profil.db.default.params.password=password +profil.db.default.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8" + +; Complete database configuration +profil.db.sdv1.adapter=mysqli +profil.db.sdv1.params.host=192.168.78.230 +profil.db.sdv1.params.username=user +profil.db.sdv1.params.password=password +profil.db.sdv1.params.dbname=sdv1 +profil.db.sdv1.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8" +profil.db.sdv1.params.persistent = true + +profil.db.jo.adapter=mysqli +profil.db.jo.params.host=192.168.78.230 +profil.db.jo.params.username=user +profil.db.jo.params.password=password +profil.db.jo.params.dbname=jo +profil.db.jo.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8" +profil.db.jo.params.persistent = true + +profil.db.historiques.adapter=mysqli +profil.db.historiques.params.host=192.168.78.230 +profil.db.historiques.params.username=user +profil.db.historiques.params.password=password +profil.db.historiques.params.dbname=historiques +profil.db.historiques.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8" +profil.db.historiques.params.persistent = true + + +[staging : production] +resources.frontController.params.displayExceptions = 1 + +[development : production] +phpSettings.display_startup_errors = 1 +phpSettings.display_errors = 1 +resources.frontController.params.displayExceptions = 1 + +[testing : production] +phpSettings.display_startup_errors = 1 +phpSettings.display_errors = 1 \ No newline at end of file diff --git a/scripts/build/config/sdsrvdev01/application.ini b/scripts/build/config/sdsrvdev01/application.ini new file mode 100644 index 00000000..cbffb5b1 --- /dev/null +++ b/scripts/build/config/sdsrvdev01/application.ini @@ -0,0 +1,93 @@ +[production] +phpSettings.date.timezone = "Europe/Paris" +phpSettings.display_startup_errors = 0 +phpSettings.display_errors = 0 +bootstrap.path = APPLICATION_PATH "/Bootstrap.php" +bootstrap.class = "Bootstrap" +appnamespace = "Application" +resources.session.save_path = APPLICATION_PATH "/../data/sessions" +resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers" +resources.frontController.plugins.Auth = "Application_Controller_Plugin_Auth" +resources.frontController.params.displayExceptions = 0 +resources.layout.layout = "main" +resources.layout.layoutPath = APPLICATION_PATH "/views" +resources.view.basePath = APPLICATION_PATH "/views" +autoloaderNamespaces[] = "Application_" +autoloaderNamespaces[] = "Scores_" +autoloaderNamespaces[] = "Form_" + +; Scores configuration +profil.server.name = development +profil.mail.method = smtp +profil.mail.smtp_host = smtp.free.fr +profil.mail.email.support = supportdev@scores-decisions.com +profil.mail.email.supportdev = supportdev@scores-decisions.com +profil.mail.email.contact = supportdev@scores-decisions.com +profil.mail.email.production = supportdev@scores-decisions.com +profil.wkhtmltopdf.path = "c:\Users\mricois\www\data\wkhtml" +profil.wkhtmltopdf.arch = "amd64" +profil.path.batch = APPLICATION_PATH "/../scripts/jobs" +profil.path.cache = APPLICATION_PATH "/../data/cache" +profil.path.files = APPLICATION_PATH "/../data/files" ; DOC_WEB_LOCAL +profil.path.data = "/home/vhosts/dataws/" +profil.path.secure = "/mnt/datafile/" ; SECURE_STORAGE + +; For old configuration - see Configure.php +profil.db.default.adapter=mysqli +profil.db.default.params.host=127.0.0.1 +profil.db.default.params.username=root +profil.db.default.params.password=bj10sx +profil.db.default.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8" + +; Complete database configuration +profil.db.sdv1.adapter=mysqli +profil.db.sdv1.params.host=192.168.78.230 +profil.db.sdv1.params.username=wsuser +profil.db.sdv1.params.password=scores +profil.db.sdv1.params.dbname=sdv1 +profil.db.sdv1.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8" +profil.db.sdv1.params.persistent = true + +profil.db.jo.adapter=mysqli +profil.db.jo.params.host=192.168.78.230 +profil.db.jo.params.username=wsuser +profil.db.jo.params.password=scores +profil.db.jo.params.dbname=jo +profil.db.jo.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8" +profil.db.jo.params.persistent = true + +profil.db.historiques.adapter=mysqli +profil.db.historiques.params.host=192.168.78.230 +profil.db.historiques.params.username=wsuser +profil.db.historiques.params.password=scores +profil.db.historiques.params.dbname=historiques +profil.db.historiques.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8" +profil.db.historiques.params.persistent = true + +profil.db.Commandes.adapter=mysqli +profil.db.Commandes.params.host=127.0.0.1 +profil.db.Commandes.params.username=wsuser +profil.db.Commandes.params.password=wspass2012 +profil.db.Commandes.params.dbname=commandes +profil.db.Commandes.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8" +profil.db.Commandes.params.persistent = true + +profil.db.Webservice.adapter=mysqli +profil.db.Webservice.params.host=127.0.0.1 +profil.db.Webservice.params.username=wsuser +profil.db.Webservice.params.password=wspass2012 +profil.db.Webservice.params.dbname=webservice +profil.db.Webservice.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8" +profil.db.WebServices.params.persistent = true + +[staging : production] +resources.frontController.params.displayExceptions = 1 + +[development : production] +phpSettings.display_startup_errors = 1 +phpSettings.display_errors = 1 +resources.frontController.params.displayExceptions = 1 + +[testing : production] +phpSettings.display_startup_errors = 1 +phpSettings.display_errors = 1 \ No newline at end of file diff --git a/scripts/build/configure.php b/scripts/build/configure.php new file mode 100644 index 00000000..b1d007fb --- /dev/null +++ b/scripts/build/configure.php @@ -0,0 +1,93 @@ + "Affiche les informations d'utilisation", + 'check' => "Vérifie la configuration suivant le fichier de config installé", + 'install' => "Installe et configure", + ) + ); + $opts->parse(); +} catch (Zend_Console_Getopt_Exception $e) { + echo $e->getUsageMessage(); + exit; +} + +//Usage +if(isset($opts->help)) +{ + echo $opts->getUsageMessage(); + exit; +} + +$c = new Zend_Config($application->getOptions()); + +if(isset($opts->check)) +{ + +} +elseif(isset($opts->install)) +{ + //Create data directory and all his children + mkdir(APPLICATION_PATH.'/../data'); + mkdir(APPLICATION_PATH.'/../data/cache'); + mkdir(APPLICATION_PATH.'/../data/files'); + mkdir(APPLICATION_PATH.'/../data/log'); + mkdir(APPLICATION_PATH.'/../data/sessions'); + + //Copy files + passthru('cp -v '.realpath(dirname(__FILE__)).'/_files/* '.$c->profil->path->files.'/'); + + //Modification des permissions + passthru('chown -R www-data: '.APPLICATION_PATH.'/../'); + + //Création des liens symboliques pour l'impression + if (!file_exists($c->profil->path->pages.'/themes/default/images')) + passthru('ln -vs '.APPLICATION_PATH.'/../public/themes/default/images '. + $c->profil->path->pages.'/themes/default/images'); + + if (!file_exists($c->profil->path->pages.'/themes/default/scripts')) + passthru('ln -vs '.APPLICATION_PATH.'/../public/themes/default/scripts '. + $c->profil->path->pages.'/themes/default/scripts'); + + if (!file_exists($c->profil->path->pages.'/fichier/imgcache')) + passthru('ln -vs '.APPLICATION_PATH.'/../data/pages/imgcache'.' '. + $c->profil->path->pages.'/fichier/imgcache'); + + if (!file_exists($c->profil->path->pages.'/fichier/logo')) + passthru('ln -vs '.$c->profil->path.'/logos '.$c->profil->path->pages.'/fichier/logo'); + +} diff --git a/scripts/jobs/calculRatios.php b/scripts/jobs/calculRatios.php new file mode 100644 index 00000000..9a8c362c --- /dev/null +++ b/scripts/jobs/calculRatios.php @@ -0,0 +1,284 @@ +getOptions()); +Zend_Registry::set('config', $c); + +require_once 'WsScore/Configure.php'; +$oldconfig = new Configure(); + +require_once 'framework/fwk.php'; +require_once 'framework/common/chiffres.php'; +require_once 'framework/common/dates.php'; +require_once 'framework/mail/sendMail.php'; +require_once 'Metier/insee/classMInsee.php'; +require_once 'Metier/partenaires/classMGreffes.php'; +require_once 'Metier/partenaires/classMBilans.php'; + +$strInfoScript='Usage : '.basename($argv[0]). " [OPTION] +Mise à jour des ratios en fonction de l'arrivée de nouveaux Bilans dans la base entreprise S&D. + +Options : + -t Calculer tous les ratios (*) + -i:XXX Reprendre à la ligne XXX + -c Mettre à jour le cache + -d:SSAAMMJJhhiiss Forcer la date de dernière MAJ à ... + +(*) Option par défaut si aucun argument n'est passé. +"; + +$iDeb=0; +$updateCache=false; + +for ($i=1; isset($argv[$i]); $i++) { + if (substr($argv[$i],0,1)=='-') { + switch (strtolower(substr($argv[$i],1,1))) { + case 't': + break; + case 'i': + $iDeb=substr($argv[$i],3)*1; + break; + case 'd': + $dateDeb=substr($argv[$i],3)*1; + break; + case 'c': + $updateCache=true; + break; + case '-': + case '?': + die($strInfoScript); + break; + default: + die('Option '. $argv[$i] . ' inconnue !'.EOL); + break; + } + } +} + + //$iDbI=new WDB('insee'); + $iDb=new WDB('jo'); + $iDb2=new WDB('jo'); + $iInsee=new MInsee(); + + if ($updateCache) { + include_once 'Metier/scores/classMRatios.php'; + if (genereCacheRatios()) + echo date('Y/m/d - H:i:s') ." - Le cache des ratios a été généré avec succès !".EOL; + else + echo date('Y/m/d - H:i:s') ." - Erreur lors de la génération du cache des ratios !".EOL; + die(); + } + + echo date('Y/m/d - H:i:s') ." - DEBUT du programme de calcul des ratios...".EOL; + + $tabLast=$iDb->select( 'ratios_formules', + 'max(dateUpdate) AS lastUpdate, max(dateInsert) AS lastInsert', + '1'); + $lastUpdate=$tabLast[0]['lastInsert']; + if ($tabLast[0]['lastUpdate']>$lastUpdate) $lastUpdate=$tabLast[0]['lastUpdate']; + + /** On vérifie la présence du cache de calcul des ratios **/ + $pathMetier = realpath(APPLICATION_PATH . '/../library/Metier'); + if (!file_exists($pathMetier.'/tmp/configMRatios.php')) + die(date('Y/m/d - H:i:s') ." - ERREUR FATALE : Le cache des calculs de ratio n'existe pas !".EOL); + /** On vérifie qu'il n'y a pas de nouvelles formules à mettre dans le cache de calcul des ratios **/ + elseif (strtr($lastUpdate, array(':'=>'','-'=>'', ' '=>''))>date('YmdHis',filectime($pathMetier.'/tmp/configMRatios.php'))) { + sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "ERREUR FATALE, le cache ratio n'est pas à jour !", date('Y/m/d - H:i:s') ." - ERREUR FATALE : Le cache des calculs de ratio n'est pas à jour (nouvelles formules ?). Relancer à l'option -c !"); + die(date('Y/m/d - H:i:s') ." - ERREUR FATALE : Le cache des calculs de ratio n'est pas à jour (nouvelles formules ?). Relancer à l'option -c !".EOL); + } + /** On vérifie que le programme de MAJ du cache n'a pas été modifié **/ + elseif (date('YmdHis',filectime($pathMetier.'/scores/classMRatios.php'))>date('YmdHis',filectime($pathMetier.'/tmp/configMRatios.php'))) // Le fichier de cache est déprécié + die(date('Y/m/d - H:i:s') ." - ERREUR FATALE : Le cache des calculs de ratio n'est pas à jour (programme modifié). Relancer à l'option -c !".EOL); + + include_once 'Metier/tmp/configMRatios.php'; + + echo date('Y/m/d - H:i:s') ." - Formules de calcul des ratios déjà en cache.".EOL; + + /** Recherche de la dernière mise à jour des ratios secteurs **/ + $tabLast=$iDb->select( 'ratios_secteurs', + 'max(dateUpdate) AS lastUpdate, max(dateInsert) AS lastInsert', + '1'); + $lastUpdate=$tabLast[0]['lastInsert']; + if ($tabLast[0]['lastUpdate']>$lastUpdate) $lastUpdate=$tabLast[0]['lastUpdate']; + if ($dateDeb>20000101123000) $lastUpdate=$dateDeb; + + echo(date('Y/m/d - H:i:s') ." - La dernière mise à jour des ratios secteurs date du $lastUpdate...".EOL); + + $nbRows=$iDb->select( 'ratios_tmp', 'siren, lastUpdate', "1", false, MYSQL_ASSOC, true); + if ($nbRows>0) { + $modeSuite=true; + echo date('Y/m/d - H:i:s') ." - Il reste $nbRows entreprises pour lesquels il faut mettre à jour les ratios secteurs...".EOL; + } else { + /** On met en table temporaire les siren en cas de plantage du script **/ + $modeSuite=false; + + // Date du dernier bilan inseré + $tabLast=$iDb->select( 'bilans', + 'MAX(dateInsert) AS lastDateInsert', + "siren>100 AND dateInsert>='$lastUpdate' AND typeBilan IN ('N','',' ','A','B') ORDER BY dateInsert DESC"); + $lastDateBilan=strtr($tabLast[0]['lastDateInsert'],array(' '=>'',':'=>'','-'=>'')); + echo(date('Y/m/d - H:i:s') ." - Le dernier bilan inséré en base date du $lastDateBilan...".EOL); + + // Liste des derniers Bilans insérés depuis le dernier calcul des ratios + $nbRows=$iDb->select( 'bilans', 'DISTINCT siren', "siren>100 AND dateInsert>='$lastUpdate' AND typeBilan IN ('N','',' ','A','B') ORDER BY dateInsert DESC", false, MYSQL_ASSOC, true); + $lastDate=strtr($lastUpdate,array(' '=>'',':'=>'','-'=>'')); + echo date('Y/m/d - H:i:s') ." - Il y a $nbRows entreprises avec nouveaux bilans pour calcul des ratios secteurs...".EOL; + $iDb2->query('DROP TABLE IF EXISTS ratios_tmp;'); + if (mysql_errno()>0) echo date('Y/m/d - H:i:s') .' - ERREUR SQL lors de la création de la table temporaires, n°'.mysql_errno().' : '.mysql_error().EOL; + $strSQL="CREATE TABLE IF NOT EXISTS ratios_tmp ( siren int(9) unsigned zerofill NOT NULL, lastUpdate bigint(14) unsigned zerofill NOT NULL, lastBilan bigint(14) unsigned zerofill NOT NULL, PRIMARY KEY(siren) ) ENGINE=MyISAM DEFAULT CHARSET=latin1;"; + $iDb2->query($strSQL); + if (mysql_errno()>0) echo date('Y/m/d - H:i:s') .' - ERREUR SQL lors de la création de la table temporaires, n°'.mysql_errno().' : '.mysql_error().EOL; + while($entrep=$iDb->fetch(MYSQL_ASSOC)) { + $iDb2->insert('ratios_tmp', array('siren'=>$entrep['siren'], 'lastUpdate'=>$lastDate, 'lastBilan'=>$lastDateBilan)); + } + echo date('Y/m/d - H:i:s') ." - Les éléments ont été mis en table temporaire en cas de reprise sur erreur !".EOL; + $nbRows=$iDb->select( 'ratios_tmp', 'siren, lastUpdate, lastBilan', "1", false, MYSQL_ASSOC, true); + } + + $k=0; // Compteur d'entreprises + $b=0; // Compteur total de bilans + while($entrep=$iDb->fetch(MYSQL_ASSOC)) { + if ($modeSuite && $k==0) $lastDate=$entrep['lastUpdate']; + + $k++; + if ($k<$iDeb) continue; + + $siren=$entrep['siren']; + if ($siren<100) continue; + // else echo "$siren\n"; + $naf4=$naf5=''; + unset($mBil); + + $mBil=new MBilans($siren); + + /** Récupération des informations Identitaires **/ + $tabIdentite=@$iInsee->getIdentiteLight($siren); + $naf=$tabIdentite['NafEnt']; + $nafLib=$tabIdentite['NafEntLib']; + $efftr=$tabIdentite['Effectif']; + $fj=$tabIdentite['FJ']; + + /** On Recherche le dernier Bilan mis à jour **/ + $tabBilans=$mBil->listeBilans(); + $nbBilansTot=count($tabBilans); + $tabBilans2=array(); + foreach ($tabBilans as $mil=>$infosBilan) { + /** On vérifie s'il n'y a pas de Bilans vides **/ + if ($infosBilan['dureeExercice']==0) { + print_r($infosBilan); + echo date('Y/m/d - H:i:s') ." - Erreur : Bilans vide en base pour le siren $siren !".EOL; + continue(2); + } + /** On ne garde que les Bilans dont la date de provenance est > à la date de dernière Mise à jour + ** car les ratios secteurs des autres bilans on déjà été calculés ! **/ + if ($infosBilan['dateInsert']>=$lastDate) + $tabBilans2[$mil]=$infosBilan; + } + + $nbBilans=count($tabBilans2); + $tabBilan=$tabBil=array(); + if ($nbBilans==0) { + print_r($tabBilans2); + echo date('Y/m/d - H:i:s') ." - Erreur : Aucun nouveau bilan en base pour le siren $siren sur les $nbBilansTot bilans !".EOL; + print_r($tabBilans); + //die(); + continue; + } + + $tabRatios=@calculRatios($tabBilans2, $tabIdentite, false); + if (strlen($naf)>4) $naf5=$naf; else $naf4=$naf; + + if ($tabBilan[0]['CONSOLIDE']=='A') $naf4='ASSU'; + elseif ($tabBilan[0]['CONSOLIDE']=='B') $naf4='BANQ'; + + if ($naf4=='ASSU' || $naf4=='BANQ') { + sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "Calcul des ratios : Attention bilan de Banque ou Assurance", "Siren $siren, bilan $naf4".EOL.print_r($tabBilans)); + } + + foreach ($tabFormules as $f=>$formule) { + foreach ($tabRatios as $i=>$R) { + if ($f==0) $b++; + $id=$formule['id']; + // Si on n'est pas une banque/assurance, on ne calcul pas les ratios 700 à 799 + if ($naf4<>'ASSU' && $naf4<>'BANQ' && $id>=700 && $id<800) + continue; + + $annee=substr($tabBilan[$i]['DATE_CLOTURE'],0,4); + + if ($R[$id]==='NS' || $R[$id]===false ) + //echo "Le ratio n°$id est non significatif (".$R[$id].") pour le siren $siren et l'année $annee !".EOL; + continue; + + + /** Si c'est un ratio EUR, on le passe en K€ **/ + if ($formule['unite']=='EUR') $mt=$R[$id]/1000; + else $mt=$R[$id]; + + /** On vérifie les bornes MIN et MAX **/ + if ($formule['min']<>'' && $mt<$formule['min']) { + echo "Ratio n°$id, borne Mini non nulle (".$formule['min'].") et le montant est inférieur : $mt<".$formule['min']." pour le siren $siren et l'année $annee".EOL; + continue; + } elseif ($formule['max']<>'' && $mt>$formule['max']) { + echo "Ratio n°$id, borne Maxi non nulle (".$formule['max'].") et le montant est supérieur : $mt>".$formule['max']." pour le siren $siren et l'année $annee".EOL; + continue; + } //else + //echo "Ratio n°$id compris entre bornes ".$formule['min']." < $mt < ".$formule['max']." pour le siren $siren et l'année $annee".EOL; + + /** Lecture des chiffres existants dans la table ratios_secteurs **/ + $tabTmp=$iDb2->select( 'ratios_secteurs', + 'montant, nombre, id, naf4, naf5, annee', + "id=$id AND naf4='$naf4' AND naf5='$naf5' AND annee=$annee", + false, MYSQL_ASSOC); + if (count($tabTmp)>0) { + $mt2=$mt+$tabTmp[0]['montant']; + $nb2=$tabTmp[0]['nombre'] + 1; + } else { + $mt2=$mt; + $nb2=1; + } + + $tabUpdate=array( 'montant' => $mt2, + 'nombre' => $nb2, + ); + if (!$iDb2->update('ratios_secteurs', $tabUpdate, "id=$id AND naf4='$naf4' AND naf5='$naf5' AND annee=$annee") || $iDb2->getAffectedRows()==0 ) { // getAffectedRows ajouté le 14 mai 2009 + $tabInsert=array_merge($tabUpdate, array( 'id'=>$id, + 'naf4'=>$naf4, + 'naf5'=>$naf5, + 'annee'=>$annee, + 'dateInsert'=>$lastDateBilan, + )); + if (!$iDb2->insert('ratios_secteurs', $tabInsert) && mysql_errno()<>1062) { + $pct=round(($k/$nbRows)*100,2); + echo date('Y/m/d - H:i:s') ." - $k entreprises ($pct %) dont les ratios ont été calculés pour un total de $b bilans ($siren)...".EOL; + echo date('Y/m/d - H:i:s') .' - ERREUR SQL n°'.mysql_errno().' : '.mysql_error().EOL; + die(); + } + } + + if ($k%1000==0 && $f==0 && $i==0) { + $pct=round(($k/$nbRows)*100,2); + echo date('Y/m/d - H:i:s') ." - $k entreprises ($pct %) dont les ratios ont été calculés pour un total de $b bilans ($siren)...".EOL; + } + } + } + $iDb2->delete('ratios_tmp', "siren=$siren"); + if (mysql_errno()>0) echo date('Y/m/d - H:i:s') .' - ERREUR SQL lors de la suppression des informations temporaires, n°'.mysql_errno().' : '.mysql_error().EOL; + } +echo date('Y/m/d - H:i:s') ." - Les ratios ont été mis à jour ; suppression des informations temporaires.".EOL; + +$iDb2->query('DROP TABLE IF EXISTS jo.ratios_tmp;'); + +die(date('Y/m/d - H:i:s') ." - Fin du programme.".EOL); + + ?> \ No newline at end of file diff --git a/scripts/jobs/genCodeRatios.php b/scripts/jobs/genCodeRatios.php new file mode 100644 index 00000000..6c708eba --- /dev/null +++ b/scripts/jobs/genCodeRatios.php @@ -0,0 +1,585 @@ + "Aide.", + 'indiscore-s' => "Génére le code tmp/indiscore_\$versions.php", + 'type-s' => "Choix du type d'indiScore : scores ou valo", + 'ratios' => "Génére le cache des ratios (tmp/configMRatios.php)" + ) + ); + $opts->parse(); +} catch (Zend_Console_Getopt_Exception $e) { + echo $e->getUsageMessage(); + exit; +} + +//Usage +if( count($opts->getOptions())==0 || isset($opts->help)) +{ + echo $opts->getUsageMessage(); + exit; +} + +$c = new Zend_Config($application->getOptions()); +Zend_Registry::set('config', $c); + +require_once 'WsScore/Configure.php'; +$oldconfig = new Configure(); + +require_once 'framework/fwk.php'; +require_once 'framework/common/chiffres.php'; +require_once 'framework/common/dates.php'; +require_once 'framework/mail/sendMail.php'; +require_once 'Metier/insee/classMInsee.php'; +require_once 'Metier/partenaires/classMGreffes.php'; +require_once 'Metier/partenaires/classMBilans.php'; + +if (isset($opts->ratios)){ + genereCacheRatios(); +} + +if ( isset($opts->indiscore) ) { + + if ( isset($opts->type) && in_array($opts->type, array('scores', 'valo')) ) { + $type = $opts->type; + } else { + $type = 'scores'; + } + + if (genereCacheIndiscore($opts->indiscore, $type) === true){ + echo "Code généré. \n"; + } +} + +/** + * Make the static data file cache configMRatios.tmp.php + * Must be rename as configRatios.php + */ +function genereCacheRatios() +{ + $tabMoy=array(); + $iDb=new WDB("jo"); + $tabTmp=$iDb->select("sdv1.inflation", "annee, infla", "annee>1990 ORDER BY annee", false, MYSQL_ASSOC); + $strFonctions= "\$tabInfla=array();\n"; + foreach ($tabTmp as $tabTmp2) { + $strFonctions.='$tabInfla['.$tabTmp2['annee'].']='.$tabTmp2['infla'].";\n"; + } + + $strFonctions.=' +/** Donne le taux d\'inflation pour une année donnée **/ +function getInflation($annee) { + global $tabInfla; + if (!isset($tabInfla[$annee])) + sendMail("production@scores-decisions.com", "ylenaour@scores-decisions.com", "ERREUR, il manque le taux d\'inflation pour l\'année $annee", "il manque le taux d\'inflation pour l\'année $annee dans la table sdv1.inflation"); + return $tabInfla[$annee]; +}'; + + $configFileTmp = APPLICATION_PATH.'/../library/Metier/tmp/configMRatios.tmp.php'; + $configFile = APPLICATION_PATH.'/../library/Metier/tmp/configMRatios.php'; + + $fp=fopen($configFileTmp, 'w'); + fwrite($fp, 'select( + 'ratios_formules', + 'id, libelle, formule, unite, commentaires, borneMin, borneMax, deleted', + 'deleted=0'); + + foreach ($tabFormules as $i=>$formule) { + $id=$formule['id']*1; + fwrite($fp, '$tabFormules['.$i.'][\'id\']='.$id.';' ."\n"); + fwrite($fp, '$tabFormules['.$i.'][\'libelle\']="'.trim(str_replace('"','\"',$formule['libelle'])).'";' ."\n"); + fwrite($fp, '$tabFormules['.$i.'][\'commentaires\']="'.trim(str_replace('"','\"',$formule['commentaires'])).'";' ."\n"); + fwrite($fp, '$tabFormules['.$i.'][\'unite\']=\''.$formule['unite'].'\';' ."\n"); + fwrite($fp, '$tabFormules['.$i.'][\'borneMin\']=\''.$formule['borneMin'].'\';' ."\n"); + fwrite($fp, '$tabFormules['.$i.'][\'borneMax\']=\''.$formule['borneMax'].'\';' ."\n"); + fwrite($fp, '$tabFormules['.$i.'][\'formule\']=\''.$formule['formule'].'\';' ."\n"); + } + fwrite($fp, "\n".'function calculRatios($tabBilans, $tabIdentite, $accesPartenaire) {' ."\n"); + fwrite($fp, ' global $tva, $tabFormules, $mBil, $tabBilan, $efftr;' ."\n"); + fwrite($fp, ' $numBil=0;' ."\n"); + fwrite($fp, ' $numBilType=array();' ."\n"); + fwrite($fp, ' foreach ($tabBilans as $millesime=>$bil) {' ."\n"); + fwrite($fp, ' $tabTmp=@$mBil->getBilan(substr($millesime,-10), substr($millesime,0,1), @$bil[\'ref\'], $accesPartenaire);' ."\n"); + + fwrite($fp, ' $numBilType[substr($millesime,0,1)]++;' ."\n"); + fwrite($fp, ' if (substr($millesime,0,1)==\'S\') {' ."\n"); + fwrite($fp, ' if ($numBilType[\'S\']>5) continue;' ."\n"); + fwrite($fp, ' $tabTmp2=$mBil->bilanSimplifie2Normal($tabTmp);' ."\n"); + fwrite($fp, ' $tabBilan[$numBil]=array_merge($tabTmp2, $tabTmp);' ."\n"); + fwrite($fp, ' } elseif (substr($millesime,0,1)==\'N\') {' ."\n"); + fwrite($fp, ' if ($numBilType[\'N\']>5) continue;' ."\n"); + fwrite($fp, ' $tabBilan[$numBil]=$tabTmp;' ."\n"); + fwrite($fp, ' } elseif (substr($millesime,0,1)==\'C\') {' ."\n"); + fwrite($fp, ' if ($numBilType[\'C\']>5) continue;' ."\n"); + fwrite($fp, ' $tabBilan[$numBil]=$tabTmp;' ."\n"); + fwrite($fp, ' } elseif (substr($millesime,0,1)==\'A\') {' ."\n"); + fwrite($fp, ' if ($numBilType[\'A\']>5) continue;' ."\n"); + fwrite($fp, ' $tabBilan[$numBil]=$tabTmp;' ."\n"); + fwrite($fp, ' //return(array());' ."\n"); + fwrite($fp, ' } elseif (substr($millesime,0,1)==\'B\') {' ."\n"); + fwrite($fp, ' if ($numBilType[\'B\']>5) continue;' ."\n"); + fwrite($fp, ' $tabBilan[$numBil]=$tabTmp;' ."\n"); + fwrite($fp, ' //return(array());' ."\n"); + fwrite($fp, ' }' ."\n"); + fwrite($fp, ' unset($tabTmp); unset($tabTmp2);' ."\n"); + fwrite($fp, ' if ($numBil>10) break;' ."\n"); + fwrite($fp, ' $p=$tabBilan[$numBil];' ."\n"); + fwrite($fp, ' $nm=$p[\'DUREE_MOIS\'];' ."\n"); + fwrite($fp, ' $nmp=$p[\'DUREE_MOIS_PRE\'];' ."\n"); + fwrite($fp, ' $R=array();' ."\n"."\n"); + + foreach ($tabFormules as $i=>$formule) { + $id=$formule['id']*1; + $libelle=$formule['libelle']; + $unite=$formule['unite']; + $formule=$formule['formule']; + + if (preg_match("/^MOY\(R\[(.*)\],(.*)\)/Ui", $formule, $matches)) { + $tabMoy[$id]=array( + 'ratio'=>$matches[1]*1, + 'nbExo'=>$matches[2]*1, + ); + continue; + } + + // Gestion des variables minuscules de 1 à 8 caractères alphanumériques + $formule1=preg_replace('/([a-z]{1,8})/','\$$1', $formule); + // Gestion des postes du BILAN AX, BX, YP, FL1, etc... + $formule1=preg_replace('/\b([A-Z]{2,2}[1-9]{0,1})\b/','\$p[\'$1\']', $formule1); + // Gestion des ratios précédent + $formule1=preg_replace('/\bR\[(.*)\]/U', '\$R['."'\\1'*1".']', $formule1); + // Gestion des valeurs Absolues + $formule1=preg_replace('/\|(.*)\|/U', 'abs($1)', $formule1); + // Gestion de l'inflation pour l'année du bilan + $formule1=preg_replace('/\INFLATION/U', 'getInflation(substr($millesime,-4))', $formule1); + + // Ecriture de la formule + $formule1="\$R[$id]=".$formule1.';'; + + /** fonction ou **/ + if (preg_match('/ \$ou (.*)/', $formule1, $matches)) { + $formule1=preg_replace('/ \$ou (.*)/',';', $formule1); + $alternative=$matches[1]; + $formule1.="if (\$R[$id]==0) \$R[$id]=$alternative"; + } + + /** Bornage des résultats en cas de dépassement **/ + if (preg_match('/;BORN\((.*)\)/U', $formule1, $matches)) { + $formule1=preg_replace('/(;BORN\(.*\))/U','', $formule1); + $tabBornes=explode(':', $matches[1]); + if (trim($tabBornes[0])<>'') { + $bMin=trim($tabBornes[0])*1; + $formule1.="if (\$R[$id]<$bMin) \$R[$id]=$bMin;"; + } + if (isset($tabBornes[1]) && trim(@$tabBornes[1])<>'') { + $bMax=trim($tabBornes[1])*1; + $formule1.="if (\$R[$id]>$bMax) \$R[$id]=$bMax;"; + } + } + + /** Bornage des résultats en cas de dépassement **/ + if (preg_match('/;LIM\((.*)\)/U', $formule1, $matches)) { + $formule1=preg_replace('/(;LIM\(.*\))/U','', $formule1); + $bMax=trim($matches[1])*1; + $formule1.="if (\$R[$id]>$bMax) \$R[$id]=$bMax;"; + } + $formule2=$formule1; + + fwrite($fp, "\t\t".$formule2."\n"); + //@eval($formule2); + fwrite($fp, "\t\t".'if (!isset($R['.$id.'])) $R['.$id.']=\'NS\';'."\n"); + if (!isset($R[$id])) $R[$id]='NS'; + } + + fwrite($fp, "\n\t\t".'$tabRatios[$numBil]=$R;'."\n"); + fwrite($fp, "\t\t".'$numBil++;'."\n"); + fwrite($fp, "\t\t".'}'."\n\n"); + + foreach($tabMoy as $iRatio=>$tMoy) { + $irMoy=$tMoy['ratio']; + $nbExo=$tMoy['nbExo']; + fwrite($fp, ' for($i=0; $i<$numBil; $i++) {'."\n"); + fwrite($fp, ' $tabRatios[$i]['.$iRatio.']=($tabRatios[$i]['.$irMoy.']'); + for($i=1; $i<$nbExo; $i++) + fwrite($fp, '+$tabRatios[$i+'.$i.']['.$irMoy.']'); + fwrite($fp, ')/'.$nbExo.';'); + fwrite($fp, ' }'."\n"."\n"); + } + + fwrite($fp, "\t".'return $tabRatios;'."\n"); + fwrite($fp, '}'."\n"); + fclose ($fp); + + $strOutput=exec('php -l '.$configFileTmp, $output); + if (preg_match('/^No syntax errors detected in /', $strOutput)) { + //move($configFileTmp, $configFile); + } else { + //@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "classMRatios sur $siren : Erreur de compilation '$strOutput'", print_r($output, true)."\n"); + print_r($output); + return false; + } + return true; +} + +/** + * Make the static file cache for indIscore + * (indiscore.tmp.php, must be rename as indiscore$version.php) + * @param string $version ex : "_XXX" where XXX is the number version to select the right table in + * database + * @param string $type + * scores : Comments for the score version, valo : Comments for the "valorisation" version + * @return string + */ +function genereCacheIndiscore($version, $type = 'scores') +{ + $cycleClient = 2; + + // Chargement des formules de commentaires + $tabFormulesScore=array(); + + $iDb = new WDB("jo"); + + // Select the right table in database in function of type + switch ($type) { + case 'scores': + $fileIndiscore = APPLICATION_PATH.'/../library/Metier/tmp/indiscore'.$version.'.php'; + $fileIndiscoreTmp = APPLICATION_PATH.'/../library/Metier/tmp/indiscore.tmp.php'; + $tableComments = 'scores_commentaires'.$version; + $tableFormu = 'scores_formules'.$version; + break; + + case 'valo': + $fileIndiscore = APPLICATION_PATH.'/../library/Metier/tmp/indiscorevalo'.$version.'.php'; + $fileIndiscoreTmp = APPLICATION_PATH.'/../library/Metier/tmp/indiscorevalo.tmp.php'; + $tableComments = 'valo_commentaires'.$version; + $tableFormu = 'valo_formules'.$version; + break; + } + + // Read comments text + $tabTmp = $iDb->select( + $tableComments, + 'code, langue, cycle, ligne, commentaire, tri, deleted', + "deleted=0 AND cycle=$cycleClient AND ligne NOT LIKE '%*%' AND commentaire NOT LIKE '.*%' ORDER BY langue ASC, cycle ASC, code ASC, ligne ASC", + false, MYSQL_ASSOC + ); + + foreach ($tabTmp as $i => $commentaire) { + $id = $commentaire['code']*1; + $cycle = $commentaire['cycle']*1; + $ligne = $commentaire['ligne']*1; + $tabCommentaires[$id][$cycle][$ligne] = $commentaire['commentaire']; + if ($commentaire['tri']) { + $tabTri[$id] = $commentaire['tri']; + $tabTriAff[$id] = ($commentaire['tri'].'.'.(10000000+(1*$commentaire['code'])))*1; + } + } + + // Read formulas + $tabTmp = $iDb->select( + $tableFormu, + 'code, ligne, remarque, operande, ope1, operation, valeur', + "deleted=0 AND ligne NOT LIKE '%*%' ORDER BY code ASC, ligne ASC", + false, MYSQL_ASSOC + ); + + + $idPre=$strFormule=false; + //echo ''; + $debugFormule=''; + $fp2=fopen($fileIndiscoreTmp,'w'); + fwrite($fp2,'$formule) { + + $id=$formule['code']*1; + if ($idPre!=$id && $idPre!=false) { + $debugFormule.=$strFormule.') { $C['.$idPre."]=true; $strAction } \t"; + //$strFormule=preg_replace('/\|(.+)\|/U', 'abs($1)', $strFormule); + $strFormule=preg_replace('/\|([A-Z0-9\. \$\[\]]{1,12})\|/Ui', 'abs($1)', $strFormule); + $strFormule=preg_replace('/\$R\[0+/', '$R[', $strFormule); + $strFormule=preg_replace('/\$Ra\[0+/', '$Ra[', $strFormule); + $strFormule=preg_replace('/\$Rap\[0+/', '$Rap[', $strFormule); + $strFormule=preg_replace('/\$Rp\[0+/', '$Rp[', $strFormule); + $strFormule=preg_replace('/\$Rs\[0+/', '$Rs[', $strFormule); + $strFormule=preg_replace('/\$Rsp\[0+/', '$Rsp[', $strFormule); + $strFormule=preg_replace('/\$Revol\[0+/', '$Revol[', $strFormule); + $strFormule=preg_replace('/\$Revolp\[0+/', '$Revolp[', $strFormule); + $strFormule=preg_replace('/\$Rdiff\[0+/', '$Rdiff[', $strFormule); + for ($j=2;$j<5;$j++) { + $strFormule=preg_replace('/\$Rp'.$j.'\[0+/', '$Rp'.$j.'[', $strFormule); + $strFormule=preg_replace('/\$Rs'.$j.'\[0+/', '$Rs'.$j.'[', $strFormule); + $strFormule=preg_replace('/\$Rsp'.$j.'\[0+/', '$Rsp'.$j.'[', $strFormule); + $strFormule=preg_replace('/\$Revol'.$j.'\[0+/', '$Revol'.$j.'[', $strFormule); + $strFormule=preg_replace('/\$Revolp'.$j.'\[0+/', '$Revolp'.$j.'[', $strFormule); + } + debugLog('W', 'Indiscore '.$strFormule.') $C['.$idPre.']='.$C[$idPre], __LINE__, __FILE__, __FUNCTION__, __CLASS__); + //$fp2=fopen('/var/www/html/ws2/indiscore.tmp.php','a'); + // Cas particulier de la première lignde de commentaire + //if ($i<=1) $remarque="// $id-".$formule['ligne'].' : '.trim($formule['remarque'].' '.$remarque); + fwrite($fp2, $remarque."\n"); + fwrite($fp2, $strFormule.') { $C['.$idPre."]=true; $strAction } "."\n"); + //fclose($fp2); + eval ($strFormule.') { $C['.$idPre."]=true; $strAction } "); + $debugFormule.='$C['.$idPre.']='.$C[$idPre]."\r\n"; + $remarque="// $id-".$formule['ligne'].' : '.$formule['remarque']; + $strAction=''; + } elseif (!$idPre) + $remarque="// $id-".$formule['ligne']; + else + $remarque.=' '.$formule['remarque']; + + $ligne=$formule['ligne']*1; + + $operande=trim(strtr(strtoupper($formule['operande']),array(':'=>''))); + $ope1=trim($formule['ope1']); + /*P[xxx,+n] valeur Projection linéaire du ratio xxx sur n années Valeur du ratio au terme de l'année N +n années + Pc[xxx,+n] ou Pc[xxx] Valeur du coefficient de corrélation de la régression linéaire Coef de 0 à 1 à transformer en % Pertinence de la corélation pour qu'elle soit bonne le coef doit > 0,75 + Pevol[xxx,n] Valeur du taux de progression au terme des N années Projection linéaire du ratio xxx sur N années Taux de progression entre la valeur du ratio en année N et sa valeur à +n années (même principe que Revol[xxx] pour les ratios) + */ + if (preg_match("/(PROJECTAUX|PROJECCOEF|PROJEC)\((.*)\)/Ui", $ope1, $matches)) + { + $ope1=$matches[1].'($'.preg_replace('/R\[0+/', 'regR[', $matches[2]).')'; + } + elseif (preg_match('/^LONG\(([A-Z0-9\_]{1,30})\)$/i', $ope1, $matches)) + { + // Gestion du mot clef LONG + $ope1=preg_replace('/^LONG\(([A-Z0-9\_]{1,30})\)$/i','strlen(\$$1)', $ope1); + } + else + { + // Gestion du substr + $ope1=preg_replace('/([A-Z0-9\_]{1,30})\((.*)\)$/i','substr(\$$1,$2)', $ope1); + } + + $operation=trim($formule['operation']); + if ($operation=='=') $operation='=='; + + $valeur=trim(strtr($formule['valeur'], array('"'=>"'"))); + $tabFormulesScore[$id][$ligne]['operande']=$operande; + $tabFormulesScore[$id][$ligne]['ope1']=$ope1; + $tabFormulesScore[$id][$ligne]['operation']=$operation; + $tabFormulesScore[$id][$ligne]['valeur']=$valeur; + + if (preg_match("/^MOY\(R(.*),(.*)\)/Ui", $valeur, $matches)) { + $valeur='( (R'.$matches[1]; + for($iMoy=0; $iMoy<$matches[2]; $iMoy++) { + if ($iMoy==1) + $valeur.='+Rp'.$matches[1]; + else + $valeur.='+Rp'.$iMoy.$matches[1]; + } + $valeur.=')/'.$matches[2].')'; + } + else + { + $valeur=preg_replace('/([A-Z\_]{1,30})\((.*)\)$/i','substr(\$$1,$2)', $valeur); + } + + + if ( !empty($valeur) + || substr($valeur,0,6)!='substr' && substr($valeur,0,1)!="'" + || !in_array($valeur, array('vrai', 'faux')) + ) { + //file_put_contents('test.log', $valeur, FILE_APPEND); + $valeur = preg_replace('/([A-Z][A-Z0-9\_]{1,29}|[A-Za-z0-9]{1,30}\[[0-9]+\])/' , '\$$1' , $valeur); + //file_put_contents('test.log', " = ".$valeur."\n", FILE_APPEND); + } + + if (preg_match("/^substr|^projec|^strlen|^\||^'/i", $ope1)) { + $ope1deb=''; + $ope1=strtr($ope1, array( '|R['=>'|$R[', + '|Rp['=>'|$Rp[', + '|Rp2['=>'|$Rp2[', + '|Rp3['=>'|$Rp3[', + '|Rs['=>'|$Rs[', + '|Rsp['=>'|$Rsp[', + '|Revol['=>'|$Revol[', + '|Revolp['=>'|$Revolp[', + '|Revols['=>'|$Revols[', + '|Rdiff['=>'|$Rdiff[', + )); + } + else { + $ope1deb='$'; + $ope1=strtr($ope1, array( '/R['=>'/$R[', + '/Rp['=>'/$Rp[', + '/Rp2['=>'/$Rp2[', + '/Rp3['=>'/$Rp3[', + '/Rs['=>'/$Rs[', + '/Rsp['=>'/$Rsp[', + '/Revol['=>'/$Revol[', + '/Revolp['=>'/$Revolp[', + '/Revols['=>'/$Revols[', + '/Rdiff['=>'/$Rdiff[', + )); + } + //(C[5000100]àC[5000998]) + if (preg_match('/^C\[(.*)\]àC\[(.*)\]$/', $ope1, $matches)) { + /** On veut savoir si des commentaires Cxx à Cyy sont chargés **/ + $tabTmp4=array(); + foreach ($tabTri as $idxC=>$t) { + if ($idxC>=$matches[1] && $idxC<=$matches[2]) + $tabTmp4[]=' isset($C['.$idxC.']) '; + } + //@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "Indiscore sur $siren : Debug Code=$id, ligne=$ligne", print_r($matches, true).print_r($tabTmp4, true)."\n"); + $tmpFormule='true'; + // if (count($tabTmp4)>0 && preg_match('/NON/i',$operande)) + // $tmpFormule=' ('.implode(' && ', $tabTmp4).') '; + //else + if (count($tabTmp4)>0) + $tmpFormule=' ('.implode(' || ', $tabTmp4).') '; + } elseif (preg_match_all('/^\((C\[(.*)\];?)+\)$/', $ope1, $matches)) { + //@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "Indiscore sur $siren : Debug", print_r($matches, true)."\n"); + $tabTmp5=explode(';', $matches[1][0]);// C[3255000];C[3260000];C[3265000] + $tabTmp4=array(); + foreach ($tabTmp5 as $t) + $tabTmp4[]=' isset($'.$t.') '; + $tmpFormule='true'; + if (count($tabTmp4)>0 && preg_match('/NON/i',$operande)) + $tmpFormule=' ('.implode(' && ', $tabTmp4).') '; + elseif (count($tabTmp4)>0) + $tmpFormule=' ('.implode(' || ', $tabTmp4).') '; + } elseif (($operation=='==' || $operation=='<>') && preg_match('/\(.*;.*\)/', $valeur)) { + /** Gestion du point-virgule (correspond à un IN dans WHERE sql **/ + $tabTmp3=explode(';', $valeur); + $tabTmp4=array(); + foreach ($tabTmp3 as $i3=>$svaleur) + $tabTmp4[]=$ope1deb.$ope1.$operation.strtr($svaleur,array('('=>'', ')'=>'', ','=>'.')); + if ($operation=='==') $tmpFormule=' ('.implode(' || ', $tabTmp4).') '; + else $tmpFormule=implode(' && ', $tabTmp4); + } elseif ($operande=='ET' && preg_match('/\(.*;.*\)/', $ope1)) { + /** Gestion du point-virgule (correspond à un IN dans WHERE sql **/ + $tabTmp3=explode(';', $ope1); + $tabTmp4=array(); + foreach ($tabTmp3 as $i3=>$ope1val) + $tabTmp4[]=$ope1deb.strtr($ope1val,array('('=>'', ')'=>'', ','=>'.')); + $tmpFormule=' ('.implode(' && ', $tabTmp4).') '; + } elseif (preg_match('/(.*)à(.*)/', $valeur, $matches)) { + /** Gestion du 'à' (correspond à min < xxx < max **/ + $tmpFormule=' ('.$ope1deb.$ope1.' >= '.$matches[1].' && '.$ope1deb.$ope1.' <= '.$matches[2].') '; + } else { + if (!preg_match("/^substr/", $valeur)) + $valeur=strtr($valeur,array(','=>'.')); + + if ($operation=='' && $valeur=='') + $tmpFormule=$ope1deb.$ope1; + elseif ($operation<>'' && $valeur=='') + $tmpFormule=$ope1deb.$ope1.$operation."''"; + elseif (strtoupper($valeur)==strtolower($valeur) && $valeur<>'') + $tmpFormule=$ope1deb.$ope1.$operation.$valeur; + elseif (strtolower($valeur)=='vrai') + $tmpFormule=$ope1deb.$ope1.$operation.'true'; + elseif (strtolower($valeur)=='faux') + $tmpFormule=$ope1deb.$ope1.$operation.'false'; + elseif (strtolower($valeur)=='nmp') + $tmpFormule=$ope1deb.$ope1.$operation.'$nmp'; + else + $tmpFormule=$ope1deb.$ope1.$operation.$valeur; + + } + + $strParentDeb=$strParentFin=''; + if (preg_match_all('/(\()/',$operande,$matches)) { + $strParentDeb=implode(' ', $matches[1]); + $operande=trim(strtr($operande,array('('=>''))); + } elseif (preg_match_all('/(\))/',$operande,$matches)) { + $strParentFin=implode(' ', $matches[1]); + $operande=trim(strtr($operande,array(')'=>''))); + } + + switch ($operande) { + case 'SI': $strFormule="if ( $strParentDeb $tmpFormule $strParentFin"; break; + case 'SI NON': $strFormule="if ( $strParentDeb !($tmpFormule) $strParentFin"; break; + case 'ET': $strFormule.=" && $strParentDeb $tmpFormule $strParentFin"; break; + case 'ET NON': $strFormule.=" && $strParentDeb !($tmpFormule) $strParentFin"; break; + case 'OU': $strFormule.=" || $strParentDeb $tmpFormule $strParentFin"; break; + case 'OU NON': $strFormule.=" || $strParentDeb !($tmpFormule) $strParentFin"; break; + case 'ACTION': $strAction.=str_replace('==','=', " $tmpFormule; "); break; + case 'ECHANGE': $ECHANGE[]=$tmpFormule; break; + default: + debugLog('W', 'Indiscore '.$id.' OPERANDE INCONNUE '.$operande, __LINE__, __FILE__, __FUNCTION__, __CLASS__); + break; + } + $idPre=$id; + + debugLog('W', 'Indiscore '.$id.' '.$strFormule, __LINE__, __FILE__, __FUNCTION__, __CLASS__); + } + + /** Gestion de la dernière ligne de commentaire **/ + $debugFormule.=$strFormule.') ) $C['.$idPre.']=true;'."\t"; + $strFormule=preg_replace('/\|(.{1,12})\|/U', 'abs($1)', $strFormule); + $strFormule=preg_replace('/\$R\[0+/', '$R[', $strFormule); + $strFormule=preg_replace('/\$Ra\[0+/', '$Ra[', $strFormule); + $strFormule=preg_replace('/\$Rap\[0+/', '$Rap[', $strFormule); + $strFormule=preg_replace('/\$Rp\[0+/', '$Rp[', $strFormule); + $strFormule=preg_replace('/\$Rs\[0+/', '$Rs[', $strFormule); + $strFormule=preg_replace('/\$Rsp\[0+/', '$Rsp[', $strFormule); + $strFormule=preg_replace('/\$Revol\[0+/', '$Revol[', $strFormule); + $strFormule=preg_replace('/\$Revolp\[0+/', '$Revolp[', $strFormule); + $strFormule=preg_replace('/\$Revols\[0+/', '$Revols[', $strFormule); + $strFormule=preg_replace('/\$Rdiff\[0+/', '$Rdiff[', $strFormule); + for ($j=2;$j<5;$j++) { + $strFormule=preg_replace('/\$Rp'.$j.'\[0+/', '$Rp'.$j.'[', $strFormule); + $strFormule=preg_replace('/\$Rs'.$j.'\[0+/', '$Rs'.$j.'[', $strFormule); + $strFormule=preg_replace('/\$Rsp'.$j.'\[0+/', '$Rsp'.$j.'[', $strFormule); + $strFormule=preg_replace('/\$Revol'.$j.'\[0+/', '$Revol'.$j.'[', $strFormule); + $strFormule=preg_replace('/\$Revolp'.$j.'\[0+/', '$Revolp'.$j.'[', $strFormule); + } + debugLog('W', 'Indiscore '.$strFormule.') $C['.$idPre.']='.$C[$idPre], __LINE__, __FILE__, __FUNCTION__, __CLASS__); + eval ($strFormule.') $C['.$idPre.']=true;'); + //$fp2=fopen('/var/www/html/ws2/indiscore.tmp.php','a'); + fwrite($fp2, $strFormule.') $C['.$idPre.']=true;'."\n"); + + fwrite($fp2, "\n".'$ECHANGE=\''.serialize($ECHANGE)."';"."\n"); + + fwrite($fp2, "\n".'?>'."\n"); + fclose($fp2); + $debugFormule.='$C['.$idPre.']='.$C[$idPre]."\r\n"; + //echo '
'; + + $strOutput=exec('php -l '.$fileIndiscoreTmp, $output); + if (preg_match('/^No syntax errors detected in /', $strOutput)) { + echo "Aucune erreur\n"; + //move($fileIndiscoreTmp, $fileIndiscore); + //@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "Indiscore sur $siren : Compilation OK '$strOutput'", print_r($output, true)."\n"); + } else { + echo "Erreur : $strOutput\n"; + print_r($output); + //@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "Indiscore sur $siren : Erreur de compilation '$strOutput'", print_r($output, true)."\n"); + } + +} + diff --git a/scripts/jobs/genwsdl.php b/scripts/jobs/genwsdl.php new file mode 100644 index 00000000..d5edc652 --- /dev/null +++ b/scripts/jobs/genwsdl.php @@ -0,0 +1,80 @@ + "Displays usage information.", + 'all' => "Créer les WSDL à l'installation.", + 'version=s' => "Re-Créer le WSDL associé à la version X.X.X", + 'host=s' => "Le nom de domaine à requéter pour générer les WSDL correctement (sans http://)." + ) + ); + $opts->parse(); +} catch (Zend_Console_Getopt_Exception $e) { + echo $e->getUsageMessage(); + exit; +} + +//Usage +if(isset($opts->help)) +{ + echo $opts->getUsageMessage(); + exit; +} + +//Génération des WSDL +if (isset($opts->all) && isset($opts->host)) +{ + $configServiceVersions = new Zend_Config_Ini('WsScore/Entreprise/Versions.ini'); + foreach( $configServiceVersions->toArray() as $section => $params ){ + $version = $section; + echo "Version $version"; + if ($params['actif']==1){ + echo " Traitement...\n"; + echo genereWSDL($opts->host, $version); + } + echo "\n"; + } +} + +if (isset($opts->version) && isset($opts->host)){ + echo genereWSDL($opts->host, $opts->version); + echo "\n"; +} + +function genereWSDL($host, $version){ + $uri = 'http://'.$host.'/entreprise/v'.$version.'?wsdl-generate'; + $client = new Zend_Http_Client($uri, array( + 'adapter' => 'Zend_Http_Client_Adapter_Curl', + )); + $response = $client->request('GET'); + return $response->getBody(); +} + + + diff --git a/scripts/jobs/getActesAsso.php b/scripts/jobs/getActesAsso.php new file mode 100644 index 00000000..3a7b7270 --- /dev/null +++ b/scripts/jobs/getActesAsso.php @@ -0,0 +1,142 @@ +getOptions()); +Zend_Registry::set('config', $c); + +require_once 'WsScore/Configure.php'; +$oldconfig = new Configure(); + +/** Zend_Application */ +require_once 'Zend/Application.php'; + +// Create application, bootstrap, and run +$application = new Zend_Application( + APPLICATION_ENV, + APPLICATION_PATH . '/configs/application.ini' +); + +try { + $opts = new Zend_Console_Getopt( + //Options + array( + 'help|?' => "Aide.", + ) + ); + $opts->parse(); +} catch (Zend_Console_Getopt_Exception $e) { + echo $e->getUsageMessage(); + exit; +} + +//Usage +if(isset($opts->help)) +{ + echo $opts->getUsageMessage(); + exit; +} + +function getFilePdf($url, $file) +{ + $result = true; + $fp = fopen($file, 'w'); + $ch = curl_init($url); + curl_setopt($ch, CURLOPT_FILE, $fp); + $data = curl_exec($ch); + // Check if any error occured + if(curl_errno($ch)) + { + $result = false; + } + curl_close($ch); + fclose($fp); + return $result; +} + +$reportSubject = ''; +$reportMsg = ''; + +//Lire la base de données - Récupérer les éléments sans fichier +//Connect to the database +try { + $db = Zend_Db::factory($this->dbConfig->db->jo); + $db->getConnection(); +} catch (Zend_Db_Adapter_Exception $e) { + +} catch (Zend_Exception $e) { + +} + +$baseUrl = 'http://extranetrec.scores-decisions.com/fichier/pdfassociation/actes/'; +$path = SECURE_STORAGE . 'associations/actes/'; + +//Lecture des données +$acteM = new Application_Model_AssoActes($db); +$sql = $acteM->select()->where('pdfLink=?', ''); +$acteList = $acteM->fetchAll($sql); +if ($acteList->count()>0) { + foreach ($acteList->toArray() as $item) { + $date = substr($item['date_acte'],0,4).substr($item['date_acte'],5,2).substr($item['date_acte'],8,2); + if (intval($item['siren'])==0) { + $file = 'ST-'.$item['waldec'].'-'.$date; + } else { + $file = 'ST-'.$item['siren'].'-'.$date; + } + //Télécharger le fichier + $isDownload = getFilePdf($baseUrl.$file, $path.$file); + + if ($isDownload && file_exists($path.$file)) { + //Récupérer les informations du PDF + $pdfInfos = array(); + $pdfInfos['pdfLink'] = $file; + $pdfInfos['pdfSize'] = filesize($path.$file); + + //Get PDF version + $handle = fopen($path.$file, 'r'); + if ($handle) { + while (!feof($handle)) { + $buffer = fgets($handle, 4096); + if (preg_match("/^\%PDF\-(.*)\s/U", $buffer, $matches)) { + $version = $matches[1]; + } + break; + } + fclose($handle); + } + + $pdfInfos['pdfVer'] = $version; + + //Get PDF number of pages + $pdf = new Zend_Pdf($path.$file, null, true); + $pdfInfos['pdfPage'] = count($pdf->pages); + + //Modifier la ligne dans la base de données + $acteM->update($pdfInfos, 'id='.$item['id']); + + } + } +} + +$reportMsg = "\nGénéré par getActesAsso."; + +//Envoyer un mail de rapport +$mail = new Zend_Mail(); +$tr = new Zend_Mail_Transport_Smtp('smtp.celeste.fr'); +$mail->setDefaultTransport($tr); +$mail->setFrom('production@scores-decisions.com', 'Production'); +$mail->addTo('support@scores-decisions.com', 'Support'); +$mail->setSubject($reportSubject); +$mail->setBodyText(mb_convert_encoding($reportMsg, 'ISO-8859-1', 'UTF-8')); +$mail->send(); diff --git a/scripts/jobs/getKbis.php b/scripts/jobs/getKbis.php new file mode 100644 index 00000000..43386e31 --- /dev/null +++ b/scripts/jobs/getKbis.php @@ -0,0 +1,603 @@ +#!/usr/bin/php + "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(); +} catch (Zend_Console_Getopt_Exception $e) { + echo $e->getUsageMessage(); + exit; +} + +$c = new Zend_Config($application->getOptions()); +Zend_Registry::set('config', $c); + +if ( isset($opts->debug) ) { + define('DEBUG', true); +} else { + define('DEBUG', false); +} + +//Usage +if(count($opts->getOptions())==0 || isset($opts->help)) +{ + echo "Telecharge le kbis chez infogreffe."; + echo "\n\n"; + echo $opts->getUsageMessage(); + echo "\n"; + exit; +} + +function getPageHeader($start,$end,$header) +{ + $pattern = '/'. $start .'(.*)'. $end .'/'; + if (preg_match($pattern, $header, $result)) { + return $result[1]; + } else { + return false; + } +} + +function getPage($url, $curl_data = '', $override = null) +{ + global $ckfile; + + //$user_agent = 'Mozilla/5.0 (Windows NT 5.1; rv:9.0.1) Gecko/20100101 Firefox/9.0.1'; + //$user_agent = 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)'; + $user_agent = 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)'; + + $verbose = false; + $post = false; + $fields = ''; + if (is_array($curl_data) && count($curl_data)>0) { + foreach($curl_data as $key=>$value) { + $fields .= $key.'='.$value.'&'; + } + rtrim($fields,'&'); + $post = true; + } + + $options = array( + CURLOPT_RETURNTRANSFER => true, // return web page + CURLOPT_HEADER => false, // don't return headers + CURLOPT_FOLLOWLOCATION => false, // follow redirects + CURLOPT_ENCODING => "", // handle all encodings + CURLOPT_USERAGENT => $user_agent, // who am i + CURLOPT_AUTOREFERER => true, // set referer on redirect + CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect + CURLOPT_TIMEOUT => 120, // timeout on response + CURLOPT_MAXREDIRS => 10, // stop after 10 redirects + CURLOPT_POST => $post, // i am sending post data + CURLOPT_POSTFIELDS => $fields, // this are my post vars + CURLOPT_SSL_VERIFYHOST => 0, // don't verify ssl + CURLOPT_SSL_VERIFYPEER => false, // + CURLOPT_VERBOSE => $verbose , // + //CURLOPT_COOKIESESSION => true, + CURLOPT_COOKIEFILE => $ckfile, + CURLOPT_COOKIEJAR => $ckfile, // Stockage du cookie de session + ); + + //Override define CURL option + if (is_array($override) && count($override)>0 ) { + $options = $override + $options; + } + + $ch = curl_init($url); + curl_setopt_array($ch,$options); + $content = curl_exec($ch); + $err = curl_errno($ch); + $errmsg = curl_error($ch) ; + $header = curl_getinfo($ch); + curl_close($ch); + + //Rewrite encoding to UTF-8 + //text/html; charset=ISO-8859-1 + $encoding = getPageHeader('text\/html; charset=', '', $header['content_type']); + //$encoding = 'ISO-8859-1'; + $content = iconv($encoding, 'UTF-8//IGNORE', $content); + + // $header['errno'] = $err; + // $header['errmsg'] = $errmsg; + // $header['content'] = $content; + return array('header'=>$header, 'content'=>$content); +} + + +/** + * Retourne l'url après une page 302 + * @param string $content + * @return string|boolean + */ +function getUrl302($content) +{ + $url = false; + preg_match('/\(.*)\<\/title\>/', $content, $matches); + if ($matches[1]=='302 Moved Temporarily') { + preg_match('/\
/', $content, $matches); + $url = $matches[1]; + } + return $url; +} + +function infogreffeConnexion() +{ + $url = "http://www.infogreffe.fr/infogreffe/index.jsp"; + $result = getPage($url); + if (DEBUG) file_put_contents('kbis-connexion1.html', $result['content']); + + $url = "http://www.infogreffe.fr/infogreffe/popupLog.jsp?type=0&url=index.jsp"; + $result = getPage($url); + if (DEBUG) file_put_contents('kbis-connexion2.html', $result['content']); + + $url = "https://www.infogreffe.fr/infogreffe/login.do?redirect=index.jsp"; + // 302 Moved Temporarily + // => http://www.infogreffe.fr/infogreffe/index.jsp + $data = array( + 'codeAbo'=>'2559', + 'codeClt'=>'0041', + 'log'=>'', + 'pwd'=>'69873', + ); + $result = getPage($url, $data); + if (DEBUG) file_put_contents('kbis-connexion3.html', $result['content']); + + /* + We need to have +

+ + Abonné | + Mon compte | + Documents Commandés + | Se déconnecter +
+ */ +} + +function infogreffeKbis($ref) +{ + /************************************************** + afficheProduit + **************************************************/ + $url = "http://www.infogreffe.fr/infogreffe/chargement.jsp?oups=".$ref."_0_V_0_"; + $result = getPage($url); + if (DEBUG) file_put_contents('kbis-afficheproduit.html', $result['content']); + + //Redirection javascript qui fait patienter + sleep(1); + /************************************************** + serviceProduit + **************************************************/ + $url = "http://www.infogreffe.fr/infogreffe/serviceProduit.do?cdePro=".$ref."_0_V_0_"; + $result = getPage($url); + if (DEBUG) file_put_contents('kbis-serviceproduit.html', $result['content']); + + $output = $result['content']; + + //Modification du code HTML pour impression + $output = removeTag('script', $output, true, true); + + $output = str_replace('/infogreffe/styles/infogreffe_base.css', '../styles/infogreffe_base.css', $output); + $output = str_replace('/infogreffe/styles/infogreffe.css', '../styles/infogreffe.css', $output); + + $output = preg_replace( + '/\/', + '', + $output + ); + + //Récupération des informations dans le kbis + //Numéro d'identification :509 536 371 R.C.S. PONTOISE + + preg_match('/([0-9]{3}\s[0-9]{3}\s[0-9]{3})\sR\.C\.S\./', $output, $matches); + + if (count($matches)>1){ + $identifiant = str_replace(' ', '',$matches[1]); + } else { + $identifiant = 'unknown'; + } + $fichier = $identifiant . '-' . $ref . '.html'; + + $dir = $c->profil->path->secure.'/kbis/'.date('Ymd'); + if (!file_exists($dir)) mkdir($dir); + file_put_contents($dir . '/' . $fichier, $output); + return ($identifiant!='unknown') ? $identifiant : false; +} + +function removeTag($balise, $content, $endOfTag = true, $removeContent = true) +{ + if( $endOfTag ) + { + if( $removeContent) + $output = preg_replace( + '@<'.$balise.'[^>]*?>.*?@si', + '', + $content + ); + else + $output = preg_replace( + array('@<'.$balise.'[^>]*?>@', '@@'), + '', + $content + ); + } + else + { + $output = preg_replace( + '@<'.$balise.'[^>]*?>@', + '', + $content + ); + } + return $output; +} + +function parseRef($document) +{ + $doc = new DOMDocument(); + $doc->strictErrorChecking = false; + $doc->preserveWhiteSpace = false; + @$doc->loadHTML($document); + $xpath = new DOMXpath($doc); + + //Recherche des infos de la première commande + $nodelist = $xpath->query("//a/img[@alt='visualiser']"); + foreach ($nodelist as $n){ + $href = $n->parentNode->getAttribute('href'); + preg_match("/javascript:afficheProduit\(\'(.*)_0_V_0_\'/", $href, $matches); + $ref = $matches[1]; + } + //Recherche Raison Sociale + $nodelist = $xpath->query("//span[@class='text-company']/a"); + foreach ($nodelist as $n){ + $rs = $n->nodeValue; + break; + } + //Recherche RCS + $nodelist = $xpath->query("//span[@class='text-rcs']"); + foreach ($nodelist as $n){ + $rcs = $n->nodeValue; + break; + } + return array( + 'ref' => $ref, + 'rs' => $rs, + 'rcs' => $rcs, + ); +} + +//Define cookie file for storage +//@todo : Faire en sorte d'utiliser le cookie pendant un temps déterminé, ou nouvelle session à chaque fois +$ckfile = __DIR__.'/'.uniqid('cookie-'); +if (file_exists($ckfile)) unlink($ckfile); + +// Récupération de la liste des commandes et +if ( $opts->commandes ) +{ + $referer = ''; + + /************************************************** + Connexion + **************************************************/ + infogreffeConnexion(); + + $url = "http://www.infogreffe.fr/infogreffe/jsp/information/monCompte.jsp"; + $result = getPage($url); + if (DEBUG) file_put_contents('kbis-moncompte.html', $result['content']); + + /************************************************** + Documents commandés + **************************************************/ + $url = "http://www.infogreffe.fr/infogreffe/afficherMesAchats.do?refCde=N"; + $result = getPage($url); + if (DEBUG) file_put_contents('documents.html', $result['content']); + + //On parse le document pour trouver les références de commandes + $refs = array(); + + $tmp = parseRef($result['content']); + $refs[] = $tmp; + + //Liste des commandes + $nodelist = $xpath->query("//a[@class='folded-fond-gris']"); + foreach ($nodelist as $n){ + $href = $n->getAttribute('href'); + preg_match("/javascript:reveal\(\'(.*)\'\)/", $href, $matches); + $refs[] = array( 'ref' => $matches[1] ); + } + + $listeRef = array(); + foreach($refs as $item){ + $listeRef[] = $item['ref']; + } + + if ( $opts->visu && in_array($opts->visu, $listeRef) ) + { + //Pour toutes les commandes en dehors de la toute dernière + if ( array_search($opts->visu, $listeRef)!=0 ){ + $url = "http://www.infogreffe.fr/infogreffe/chargerContenuCommande.do?refCde=".$opts->visu."&_="; + $result = getPage($url); + if (DEBUG) file_put_contents('documents-'.$ref['ref'].'.html', $result['content']); + } + + echo "Téléchargement du kbis...\n"; + infogreffeKbis($opts->visu); + + //Lancer WKHTMLTOPDF pour le PDF + + } elseif ( !$opts->visu ) { + + /************************************************** + Reveal : Ajax pour mettre à jour le div + **************************************************/ + // Parcourir le fichier précédent et relevé toute les références de commandes + // http://www.infogreffe.fr/infogreffe/chargerContenuCommande.do?refCde=XNDAE&_= + // Dans javascript la requete est réalisé en GET + $i = 0; + foreach ( $refs as $ref ) + { + if ($i!=0){ + $url = "http://www.infogreffe.fr/infogreffe/chargerContenuCommande.do?refCde=".$ref['ref']."&_="; + $result = getPage($url); + if (DEBUG) file_put_contents('documents-'.$ref['ref'].'.html', $result['content']); + //@todo : Recup des informations + $info = array(); + $info = parseRef($document); + } + echo $ref['ref']; + if ( $info['ref']==$ref['ref'] ) { + if ( !empty($info['rs']) ) echo " ".$info['rs']; + if ( !empty($info['rcs']) ) echo " ".$info['rcs']; + } + echo "\n"; + $i++; + } + } +} + +// Commande d'un kbis +if ( $opts->siren ) +{ + //Vérification du siren + if (strlen($opts->siren)!=9) { + echo "Erreur SIREN invalide\n"; exit; + } + $referer = ''; + + /************************************************** + Connexion + **************************************************/ + infogreffeConnexion(); + + /************************************************** + Affichage formulaire + **************************************************/ + $url = "http://www.infogreffe.fr/infogreffe/index.jsp"; + $result = getPage($url); + if (DEBUG) file_put_contents('kbis1.html', $result['content']); + + /************************************************** + Soumission formulaire + **************************************************/ + $fields = array( + 'commune' => '', + 'denomination' => '', + 'departement' => '', + //'elargirSecondaire' => 'on', + 'elargirRadie' => 'on', + 'siren' => $opts->siren, + ); + $url = "http://www.infogreffe.fr/infogreffe/newRechercheEntreprise.xml"; + $result = getPage($url, $fields); + if (DEBUG) file_put_contents('kbis2.html', $result['content']); + + // 302 Moved Temporarily - But we always use this URL + $url = 'http://www.infogreffe.fr/infogreffe/entrepRech.do'; + + /************************************************** + Affichage identite entreprise + **************************************************/ + //url defini plus haut + $result = getPage($url, '', array(CURLOPT_FOLLOWLOCATION => true)); + if (DEBUG) file_put_contents('kbis3.html', $result['content']); + + /* + * !! Attention !! Elargir aux radiés peut retourner plusieurs résultats + */ + $doc = new DOMDocument(); + $doc->strictErrorChecking = false; + $doc->preserveWhiteSpace = false; + @$doc->loadHTML($result['content']); + $xpath = new DOMXpath($doc); + $nodelist = $xpath->query("//div[@id='includeEntrepListe']"); + if ($nodelist->length>0) { + $entries = $xpath->query("//a[@class='company']"); + foreach ($entries as $n) { + $url = 'http://www.infogreffe.fr'. $n->getAttribute('href'); + break; + } + $result = getPage($url); + } + + /* + * Try to detect we can pass an order, else send message and exit + * + * Si la recherche a fonctionné + * div[@id="libelleRcsGreffe"], nodeValue = "552 144 503 R.C.S. PARIS" + * + * Si pas de résultats lors de la recherche alors + * table[@class='liste-res-rech']/tbody/tr[1]/td[1]/div/span[1] + */ + $doc = new DOMDocument(); + $doc->strictErrorChecking = false; + $doc->preserveWhiteSpace = false; + @$doc->loadHTML($result['content']); + $xpath = new DOMXpath($doc); + $nodelist = $xpath->query("//div[@id='libelleRcsGreffe']"); + if ($nodelist->length==0) { + $entries = $xpath->query("//table[@class='liste-res-rech']/tbody/tr[1]/td[1]/div/span"); + if ($entries->length>0) { + echo trim($entries->item(0)->nodeValue); + } else { + echo "ERREUR"; + } + if (file_exists($ckfile)) unlink($ckfile); + exit; + } + + /* + * Si les documents sont disponibles + * Extrait RCS (Kbis) + * + * Sinon rechercher la valeur du message + * "//div[@id='conteneur']/table/tbody/tr/td/table/tbody/tr[2]/td/table[2]/tbody/tr[last()-2]/td"; + */ + $nodelist = $xpath->query("//a[@id='a_kbis']"); + if ($nodelist->length==0) { + $div = $xpath->query("//div[@id='conteneur']"); + $context = $div->item(0); + $entries = $xpath->query("table/tbody/tr/td/table/tbody/tr[2]/td/table[2]/tbody/tr[9]/td", $context); + $message = $entries->item(0)->nodeValue; + echo trim($message); + if (file_exists($ckfile)) unlink($ckfile); + exit; + } + + // 302 Moved Temporarily + //http://www.infogreffe.fr/infogreffe/entrepListe.do?index=rcs + if ( $result['header']['http_code']=='302' && array_key_exists('redirect_url', $result['header']) ) { + $url = $result['header']['redirect_url']; + $result = getPage($url); + if (DEBUG) file_put_contents('kbis3-1.html', $result['content']); + + // => /infogreffe/getEntrepDetail.do?docId=780308B042410000 + $doc = new DOMDocument(); + $doc->strictErrorChecking = false; + $doc->preserveWhiteSpace = false; + @$doc->loadHTML($result['content']); + $xpath = new DOMXpath($doc); + $nodelist = $xpath->query("//a[@class='company']"); + foreach ($nodelist as $n) { + $url = 'http://www.infogreffe.fr'. $n->getAttribute('href'); + break; + } + $result = getPage($url); + if (DEBUG) file_put_contents('kbis3-2.html', $result['content']); + } elseif ( $result['header']['http_code']=='302' ) { + $url = 'http://www.infogreffe.fr/weblogic/infogreffe/entrepListe.do?index=rcs'; + $result = getPage($url); + if (DEBUG) file_put_contents('kbis3-1.html', print_r($result,1)); + + $doc = new DOMDocument(); + $doc->strictErrorChecking = false; + $doc->preserveWhiteSpace = false; + @$doc->loadHTML($result['content']); + $xpath = new DOMXpath($doc); + $nodelist = $xpath->query("//a[@class='company']"); + foreach ($nodelist as $n) { + $url = 'http://www.infogreffe.fr'. $n->getAttribute('href'); + break; + } + $result = getPage($url); + if (DEBUG) file_put_contents('kbis3-2.html', $result['content']); + } + + $fields = array(); + //Recherche des infos pour la validation du formulaire + $doc = new DOMDocument(); + $doc->strictErrorChecking = false; + $doc->preserveWhiteSpace = false; + @$doc->loadHTML($result['content']); + $xpath = new DOMXpath($doc); + $nodelist = $xpath->query("//form[@name='FicheEntrepriseForm']/div[@id='conteneur']/input[@type='hidden']"); + foreach ($nodelist as $n) { + $key = $n->getAttribute('name'); + $value = $n->getAttribute('value'); + $fields[$key] = $value; + } + $fields['montantTotalSelection'] = '5.44'; // 3.11 + 2.33 + $fields['extraitForm.visualisation'] = 'on'; // => Définit par javascript + + $fields['extraitForm.formVisible'] = 'true'; + $fields['extraitForm.envoiPeriodiqueForm.periodicite'] = '1'; + $fields['extraitForm.envoiPeriodiqueForm.duree'] = '12'; + $fields['etatEndettementForm.formVisible'] = 'true'; + $fields['etatEndettementForm.etatComplet'] = 'false'; + $fields['listeActesForm.formVisible'] = 'true'; + $fields['historiqueModificationsForm.formVisible'] = 'true'; + $fields['historiqueModificationsForm.tri'] = '0'; + $fields['procedureCollectiveForm.formVisible'] = 'true'; + $fields['dossierCompletForm.formVisible'] = 'true'; + + if (DEBUG) print_r($fields); + /************************************************** + Validation de la selection + **************************************************/ + $url = "http://www.infogreffe.fr/infogreffe/validerSelectionFicheEntreprise.xml"; + $result = getPage($url, $fields); + if (DEBUG) file_put_contents('kbis4.html', print_r($result,1)); + + /************************************************** + Valider la commande + **************************************************/ + $url = "http://www.infogreffe.fr/infogreffe/validerPanierAbonne.do?forcerSaisieCoordonnees=false"; + $fields = array(); + $result = getPage($url, $fields); + if (DEBUG) file_put_contents('kbis5.html', $result['content']); + + /************************************************** + Afficher mes achats et prendre la première commande + **************************************************/ + $url = "http://www.infogreffe.fr/infogreffe/afficherMesAchats.do?refCde=N&pageAppel=validerPanier"; + $fields = array(); + $result = getPage($url, $fields); + if (DEBUG) file_put_contents('kbis6.html', $result['content']); + + $info = parseRef($result['content']); + $ref = $info['ref']; + + /************************************************** + Visualiser + **************************************************/ + $identifiant = infogreffeKbis($ref); + + //Suppression fichier + if (file_exists($ckfile)) unlink($ckfile); + + if ($identifiant===false || $identifiant!=$opts->siren) { + echo "ERREUR"; + exit; + } + echo $identifiant.'-'.$ref.'.html'; +} \ No newline at end of file diff --git a/scripts/jobs/removeTempFile.php b/scripts/jobs/removeTempFile.php new file mode 100644 index 00000000..4941c2bf --- /dev/null +++ b/scripts/jobs/removeTempFile.php @@ -0,0 +1,84 @@ +getOptions()); +Zend_Registry::set('config', $c); + +require_once 'WsScore/Configure.php'; +$oldconfig = new Configure(); + +$typesFichier = array('csv', 'fichiers', 'clients', 'kbis'); + +try { + $opts = new Zend_Console_Getopt( + //Options + array( + 'help|?' => 'Displays usage information.', + 'all' => 'Execute toutes les actions (cron).', + 'type=w' => 'Supprime uniquement les fichiers indiqués.', + ) + ); + $opts->parse(); +} catch (Zend_Console_Getopt_Exception $e) { + echo $e->getUsageMessage(); + exit; +} + +//Usage +if(isset($opts->help)) +{ + echo $opts->getUsageMessage(); +?> + +Types de fichier disponibles : + +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); + } + } +} + + diff --git a/scripts/jobs/setLogsCount.php b/scripts/jobs/setLogsCount.php new file mode 100644 index 00000000..5d2f26c1 --- /dev/null +++ b/scripts/jobs/setLogsCount.php @@ -0,0 +1,48 @@ + "Aide.", + 'yesterday|y' => "Traitement logs du jour précédent", + 'jour' => "Date au format AAAA-MM-JJ", + ) + ); + $opts->parse(); +} catch (Zend_Console_Getopt_Exception $e) { + echo $e->getUsageMessage(); + exit; +} + +//Usage +if(isset($opts->help) || !isset($opts->file)) +{ + echo $opts->getUsageMessage(); + exit; +} + + + diff --git a/scripts/jobs/sql2csv.php b/scripts/jobs/sql2csv.php new file mode 100644 index 00000000..04b71a54 --- /dev/null +++ b/scripts/jobs/sql2csv.php @@ -0,0 +1,94 @@ + 'Displays usage information.', + ) + ); + $opts->parse(); +} catch (Zend_Console_Getopt_Exception $e) { + echo $e->getUsageMessage(); + exit; +} + +$c = new Zend_Config($application->getOptions()); +Zend_Registry::set('config', $c); + +require_once 'WsScore/Configure.php'; +$oldconfig = new Configure(); + +//Usage +if(isset($opts->help)) +{ + echo "\n"; + echo $opts->getUsageMessage(); + echo basename($argv[0]). " BASE FICHIER.SQL FICHIER.CSV\n"; + echo "Génération d'un fichier CSV à partir d'un fichier SQL sur la BASE en paramètre."; + echo "\n"; + exit; +} +elseif (count($opts)==1 && $argc==4) +{ + require_once 'framework/fwk.php'; + require_once 'framework/common/chiffres.php'; + require_once 'framework/common/dates.php'; + require_once 'framework/mail/sendMail.php'; + require_once 'Metier/insee/classMInsee.php'; + require_once 'Metier/partenaires/classMGreffes.php'; + require_once 'Metier/partenaires/classMBilans.php'; + + $base = $argv[1]; + $sql = $argv[2]; + $csv = $argv[3]; + + $heureDemande = date('Hi'); + + $iDb = new WDB($base); + $nbLignes = $iDb->exportCSV(file_get_contents($sql), $csv.'.tmp'); + $fp = fopen(LOG_PATH.'/csv2sql.log', 'a'); + fwrite($fp, date('Y-m-d H:i:s')." - $base $sql $csv : $nbLignes lignes extraites".EOL); + fclose($fp); + move($csv.'.tmp', $csv); + exit; +} else { + echo "Erreur !\n"; +} + + + + +