Regroupement et organisation des scripts
This commit is contained in:
parent
a91a299aea
commit
8c42bb9ed5
@ -637,5 +637,4 @@ else {
|
||||
echo date('Y/m/d H:i:s') . "Aucun fichier à traiter !\n";
|
||||
}
|
||||
|
||||
echo date('Y/m/d H:i:s')." - Fin du traitement !\n"
|
||||
?>
|
||||
echo date('Y/m/d H:i:s')." - Fin du traitement !\n";
|
@ -4,14 +4,14 @@ error_reporting(E_ALL & ~E_STRICT & ~E_NOTICE & ~E_WARNING & ~E_DEPRECATED);
|
||||
|
||||
// --- Define path to application directory
|
||||
defined('APPLICATION_PATH')
|
||||
|| define('APPLICATION_PATH', realpath(__DIR__ . '/../../application'));
|
||||
|| define('APPLICATION_PATH', realpath(__DIR__ . '/../application'));
|
||||
|
||||
// --- Define application environment
|
||||
defined('APPLICATION_ENV')
|
||||
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
|
||||
|
||||
// --- Composer autoload
|
||||
require_once realpath(__DIR__ . '/../../vendor/autoload.php');
|
||||
require_once realpath(__DIR__ . '/../vendor/autoload.php');
|
||||
|
||||
// Create application, bootstrap, and run
|
||||
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
|
@ -8,14 +8,14 @@ error_reporting(E_ALL & ~E_STRICT & ~E_NOTICE & ~E_WARNING & ~E_DEPRECATED);
|
||||
|
||||
// --- Define path to application directory
|
||||
defined('APPLICATION_PATH')
|
||||
|| define('APPLICATION_PATH', realpath(__DIR__ . '/../../application'));
|
||||
|| define('APPLICATION_PATH', realpath(__DIR__ . '/../application'));
|
||||
|
||||
// --- Define application environment
|
||||
defined('APPLICATION_ENV')
|
||||
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
|
||||
|
||||
// --- Composer autoload
|
||||
require_once realpath(__DIR__ . '/../../vendor/autoload.php');
|
||||
require_once realpath(__DIR__ . '/../vendor/autoload.php');
|
||||
|
||||
// Create application, bootstrap, and run
|
||||
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
|
||||
@ -1002,4 +1002,3 @@ function execDbInternal($values, $debug = false)
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
@ -7,14 +7,14 @@ error_reporting(E_ALL & ~E_STRICT & ~E_NOTICE & ~E_WARNING);
|
||||
|
||||
// --- Define path to application directory
|
||||
defined('APPLICATION_PATH')
|
||||
|| define('APPLICATION_PATH', realpath(__DIR__ . '/../../application'));
|
||||
|| define('APPLICATION_PATH', realpath(__DIR__ . '/../application'));
|
||||
|
||||
// --- Define application environment
|
||||
defined('APPLICATION_ENV')
|
||||
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
|
||||
|
||||
// --- Composer autoload
|
||||
require_once realpath(__DIR__ . '/../../vendor/autoload.php');
|
||||
require_once realpath(__DIR__ . '/../vendor/autoload.php');
|
||||
|
||||
// Create application, bootstrap, and run
|
||||
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
|
||||
@ -134,5 +134,3 @@ if ( $opts->in ) {
|
||||
echo date('Y-m-d H:i:s')." - Erreur confirmation des SIREN." . PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -314,4 +314,4 @@ $mail->addTo('suivi@scores-decisions.com', 'Suivi');
|
||||
$mail->setSubjectC($subject);
|
||||
$mail->execute();
|
||||
|
||||
echo date('Y/m/d H:i:s') ." - Fin du traitement.".PHP_EOL;
|
||||
echo date('Y/m/d H:i:s') ." - Fin du traitement.\n";
|
@ -164,4 +164,3 @@ foreach($sourcesList as $declencheur => $sql)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1204,4 +1204,3 @@ function exporteRatio($valeur) {
|
||||
if($valeur<0) $signe='-';
|
||||
return ''.$signe.initstr(abs($valeur), 20, '0', ALIGN_RIGHT);
|
||||
}
|
||||
|
@ -7,14 +7,14 @@ error_reporting(E_ALL & ~E_STRICT & ~E_NOTICE & ~E_WARNING & ~E_DEPRECATED);
|
||||
|
||||
// --- Define path to application directory
|
||||
defined('APPLICATION_PATH')
|
||||
|| define('APPLICATION_PATH', realpath(__DIR__ . '/../../application'));
|
||||
|| define('APPLICATION_PATH', realpath(__DIR__ . '/../application'));
|
||||
|
||||
// --- Define application environment
|
||||
defined('APPLICATION_ENV')
|
||||
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
|
||||
|
||||
// --- Composer autoload
|
||||
require_once realpath(__DIR__ . '/../../vendor/autoload.php');
|
||||
require_once realpath(__DIR__ . '/../vendor/autoload.php');
|
||||
|
||||
// --- Create application, bootstrap, and run
|
||||
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
|
@ -5,14 +5,14 @@
|
||||
*/
|
||||
// --- Define path to application directory
|
||||
defined('APPLICATION_PATH')
|
||||
|| define('APPLICATION_PATH', realpath(__DIR__ . '/../../application'));
|
||||
|| define('APPLICATION_PATH', realpath(__DIR__ . '/../application'));
|
||||
|
||||
// --- Define application environment
|
||||
defined('APPLICATION_ENV')
|
||||
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
|
||||
|
||||
// --- Composer autoload
|
||||
require_once realpath(__DIR__ . '/../../vendor/autoload.php');
|
||||
require_once realpath(__DIR__ . '/../vendor/autoload.php');
|
||||
|
||||
// --- Create application, bootstrap, and run
|
||||
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
|
@ -15,14 +15,14 @@ error_reporting(E_ALL & ~E_STRICT & ~E_NOTICE & ~E_WARNING & ~E_DEPRECATED);
|
||||
|
||||
// --- Define path to application directory
|
||||
defined('APPLICATION_PATH')
|
||||
|| define('APPLICATION_PATH', realpath(__DIR__ . '/../../application'));
|
||||
|| define('APPLICATION_PATH', realpath(__DIR__ . '/../application'));
|
||||
|
||||
// --- Define application environment
|
||||
defined('APPLICATION_ENV')
|
||||
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
|
||||
|
||||
// --- Composer autoload
|
||||
require_once realpath(__DIR__ . '/../../vendor/autoload.php');
|
||||
require_once realpath(__DIR__ . '/../vendor/autoload.php');
|
||||
|
||||
// Create application, bootstrap, and run
|
||||
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
|
||||
@ -237,4 +237,3 @@ if ($opts->parsefile) {
|
||||
// --- Lire les fichiers dans clients/jalpdfsed/send
|
||||
// --- Vérifier la présence en base
|
||||
}
|
||||
|
@ -3,14 +3,14 @@ error_reporting(E_ALL & ~E_STRICT & ~E_NOTICE & ~E_WARNING & ~E_DEPRECATED);
|
||||
|
||||
// --- Define path to application directory
|
||||
defined('APPLICATION_PATH')
|
||||
|| define('APPLICATION_PATH', realpath(__DIR__ . '/../../application'));
|
||||
|| define('APPLICATION_PATH', realpath(__DIR__ . '/../application'));
|
||||
|
||||
// --- Define application environment
|
||||
defined('APPLICATION_ENV')
|
||||
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
|
||||
|
||||
// --- Composer autoload
|
||||
require_once realpath(__DIR__ . '/../../vendor/autoload.php');
|
||||
require_once realpath(__DIR__ . '/../vendor/autoload.php');
|
||||
|
||||
// --- Create application, bootstrap, and run
|
||||
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
|
||||
@ -181,5 +181,3 @@ foreach($requests as $n => $r) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
<?php
|
||||
// --- Define path to application directory
|
||||
defined('APPLICATION_PATH')
|
||||
|| define('APPLICATION_PATH', realpath(__DIR__ . '/../../application'));
|
||||
|| define('APPLICATION_PATH', realpath(__DIR__ . '/../application'));
|
||||
|
||||
// --- Define application environment
|
||||
defined('APPLICATION_ENV')
|
||||
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
|
||||
|
||||
// --- Composer autoload
|
||||
require_once realpath(__DIR__ . '/../../vendor/autoload.php');
|
||||
require_once realpath(__DIR__ . '/../vendor/autoload.php');
|
||||
|
||||
// Create application, bootstrap, and run
|
||||
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
|
@ -1,14 +1,14 @@
|
||||
<?php
|
||||
// --- Define path to application directory
|
||||
defined('APPLICATION_PATH')
|
||||
|| define('APPLICATION_PATH', realpath(__DIR__ . '/../../application'));
|
||||
|| define('APPLICATION_PATH', realpath(__DIR__ . '/../application'));
|
||||
|
||||
// --- Define application environment
|
||||
defined('APPLICATION_ENV')
|
||||
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
|
||||
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
|
||||
|
||||
// --- Composer autoload
|
||||
require_once realpath(__DIR__ . '/../../vendor/autoload.php');
|
||||
require_once realpath(__DIR__ . '/../vendor/autoload.php');
|
||||
|
||||
// Create application, bootstrap, and run
|
||||
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
|
@ -15,12 +15,6 @@ $application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/config
|
||||
|
||||
$c = new Zend_Config($application->getOptions());
|
||||
|
||||
// Stockage Client => SD
|
||||
$pathClientSend = '/home/scores/batch/shared/clients/fransbonhomme/send';
|
||||
|
||||
// Stockage SD => Client
|
||||
$pathClientRecv = '/home/scores/batch/shared/clients/fransbonhomme/recv';
|
||||
|
||||
//Options
|
||||
try {
|
||||
$opts = new Zend_Console_Getopt(array(
|
48
build/exportCSV.php
Normal file
48
build/exportCSV.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
//mb_internal_encoding('ISO-8859-15');
|
||||
mb_internal_encoding('UTF-8');
|
||||
|
||||
$header = array(
|
||||
"siren", "infoTel"
|
||||
);
|
||||
|
||||
$sql = "";
|
||||
|
||||
$filename = '20160310-2.csv';
|
||||
$delimiter = ',';
|
||||
$enclosure = '"';
|
||||
|
||||
$host = '192.168.78.249';
|
||||
$user = 'admin';
|
||||
$pass = 'scores';
|
||||
|
||||
$mysqli = new mysqli($host, $user, $pass);
|
||||
if ($mysqli->connect_errno) {
|
||||
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
|
||||
exit;
|
||||
}
|
||||
|
||||
$fp = fopen($filename, 'w');
|
||||
fputcsv($fp, $header, $delimiter, $enclosure);
|
||||
|
||||
if (!$result = $mysqli->query($sql)) {
|
||||
echo $mysqli->error;
|
||||
exit;
|
||||
}
|
||||
if ($result->num_rows > 0) {
|
||||
$rTotal = $result->num_rows;
|
||||
$r = 0;
|
||||
while ($row = $result->fetch_object()) {
|
||||
$r++;
|
||||
$fline = array();
|
||||
foreach($header as $h) {
|
||||
$fline[] = $row->$h;
|
||||
}
|
||||
fputcsv($fp, $fline, $delimiter, $enclosure);
|
||||
echo str_pad($r, strlen($rTotal), ' ', STR_PAD_LEFT)." / ".$rTotal."\n";
|
||||
}
|
||||
$result->close();
|
||||
}
|
||||
|
||||
fclose($fp);
|
20
docs/README
20
docs/README
@ -2,18 +2,16 @@
|
||||
Scripts PHP
|
||||
===========
|
||||
|
||||
composer install
|
||||
. Installer les dépendances
|
||||
|
||||
composer install
|
||||
|
||||
Nommage des scripts
|
||||
. Nommage des scripts
|
||||
|
||||
Avoir un nom concis et ajouter le préfix suivant le type de scripts
|
||||
Avoir un nom concis et ajouter le préfix suivant le type de scripts
|
||||
|
||||
Prefix des catégories
|
||||
|
||||
- client
|
||||
- source
|
||||
- data
|
||||
- cache
|
||||
|
||||
- presta
|
||||
Prefix des catégories
|
||||
- client
|
||||
- source
|
||||
- data
|
||||
- presta
|
||||
|
@ -1,70 +0,0 @@
|
||||
[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.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
|
||||
resources.frontController.params.displayExceptions = 0
|
||||
resources.layout.layout = "main"
|
||||
resources.layout.layoutPath = APPLICATION_PATH "/views"
|
||||
resources.view.basePath = APPLICATION_PATH "/views"
|
||||
|
||||
; Scores configuration
|
||||
profil.server.name = development
|
||||
profil.mail.method = smtp
|
||||
profil.mail.host = 192.168.3.200
|
||||
profil.mail.port = 587
|
||||
profil.mail.auth = login
|
||||
profil.mail.username = batch1@srvbak01
|
||||
profil.mail.password = test
|
||||
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.path.shared = "/home/scores/batch/shared"
|
||||
|
||||
; Metier - Infogreffe
|
||||
profil.infogreffe.wsdl = "infogreffe.wsdl"
|
||||
profil.infogreffe.url = "https://webservices.infogreffe.fr/WSContextInfogreffe/INFOGREFFE"
|
||||
profil.infogreffe.uri = "https://webservices.infogreffe.fr/"
|
||||
profil.infogreffe.user = 85000109
|
||||
profil.infogreffe.password = 166
|
||||
profil.infogreffe.cache.path = APPLICATION_PATH "/../data/cache"
|
||||
profil.infogreffe.cache.time = 8
|
||||
profil.infogreffe.storage.path = ""
|
||||
|
||||
; Sphinx configuration
|
||||
profil.sphinx.ent.host = "192.168.3.25"
|
||||
profil.sphinx.ent.port = 3312
|
||||
profil.sphinx.ent.version = 1
|
||||
profil.sphinx.dir.host = "192.168.3.25"
|
||||
profil.sphinx.dir.port = 3312
|
||||
profil.sphinx.dir.version = 1
|
||||
profil.sphinx.act.host = "192.168.3.25"
|
||||
profil.sphinx.act.port = 3312
|
||||
profil.sphinx.act.version = 1
|
||||
profil.sphinx.histo.host = "192.168.3.25"
|
||||
profil.sphinx.histo.port = 3312
|
||||
profil.sphinx.histo.version = 1
|
||||
|
||||
; Database configuration - For old configuration - see Configure.php
|
||||
profil.db.metier.adapter=mysqli
|
||||
profil.db.metier.params.host=192.168.3.28
|
||||
profil.db.metier.params.username=batchuser
|
||||
profil.db.metier.params.password=2XQTpKatBVRezXE9
|
||||
profil.db.metier.params.dbname=sdv1
|
||||
profil.db.metier.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
|
||||
|
||||
[staging : production]
|
||||
resources.frontController.params.displayExceptions = 1
|
||||
|
||||
[development : production]
|
||||
phpSettings.display_startup_errors = 1
|
||||
phpSettings.display_errors = 0
|
||||
resources.frontController.params.displayExceptions = 1
|
||||
|
||||
[testing : production]
|
||||
phpSettings.display_startup_errors = 1
|
||||
phpSettings.display_errors = 1
|
@ -1,95 +0,0 @@
|
||||
<?php
|
||||
/** BATCH **/
|
||||
define('FILLER',' ');
|
||||
define('VERSION_FICHIER_BODACC','0106');
|
||||
define('LONGUEUR_LIGNE_SORTIE', 2000);
|
||||
|
||||
/** Paramétres du FTP des JO **/
|
||||
define('BODACC_FTP_URL', 'ftp.journal-officiel.gouv.fr');
|
||||
define('BODACC_FTP_USER', 'SCORE');
|
||||
define('BODACC_FTP_PASS', 'SD075');
|
||||
define('BODACC_LOCAL_DIR', '/home/scores/batch/shared/sources/bodacc/');
|
||||
define('JAL_LOCAL_DIR', '/home/scores/batch/shared/sources/jal/');
|
||||
|
||||
/** Paramétres du FTP de Hugin : Communiqués de presse **/
|
||||
define('HUGIN_FTP_URL', 'ftp.companynews.fr');
|
||||
define('HUGIN_FTP_USER', 'scores');
|
||||
define('HUGIN_FTP_PASS', 'scores_632');
|
||||
define('HUGIN_LOCAL_DIR', '/home/scores/batch/shared/sources/infosreg/hugin/');
|
||||
|
||||
/** Paramétres du FTP de ActusNews : Communiqués de presse **/
|
||||
define('ACTUSNEWS_FTP_URL', 'ftp.actusnews.com');
|
||||
define('ACTUSNEWS_FTP_USER', 'scores_act');
|
||||
define('ACTUSNEWS_FTP_PASS', '6_etIwL');
|
||||
define('ACTUSNEWS_LOCAL_DIR', '/home/scores/batch/shared/sources/infosreg/actusnews/');
|
||||
|
||||
/** Paramétres du FTP de Di Release : Communiqués de presse **/
|
||||
define('DIRELEASE_FTP_URL', 'ftp.actusnews.com');
|
||||
define('DIRELEASE_FTP_USER', 'scores_dir');
|
||||
define('DIRELEASE_FTP_PASS', '-gT52sQ');
|
||||
define('DIRELEASE_LOCAL_DIR', '/home/scores/batch/shared/sources/infosreg/direlease/');
|
||||
|
||||
/** Paramétres du FTP des Echos: Communiqués de presse **/
|
||||
define('LESECHOS_FTP_URL', 'ftp.webdisclosure.com');
|
||||
define('LESECHOS_FTP_USER', 'Scores');
|
||||
define('LESECHOS_FTP_PASS', 'scores2001');
|
||||
define('LESECHOS_LOCAL_DIR', '/home/scores/batch/shared/sources/infosreg/lesechos/');
|
||||
|
||||
/** Paramétres du FTP de BusinessWire : Communiqués de presse **/
|
||||
define('BUSINESSWIRE_LOCAL_DIR_INCOMING', '/home/scores/batch/shared/ftp/businesswire/');
|
||||
define('BUSINESSWIRE_LOCAL_DIR', '/home/scores/batch/shared/infosreg/businesswire/');
|
||||
|
||||
/** Base de données de S&D **/
|
||||
define ('MYSQL_HOST', '192.168.3.28');
|
||||
define ('MYSQL_USER', 'batchuser');
|
||||
define ('MYSQL_PASS', '2XQTpKatBVRezXE9');
|
||||
define ('MYSQL_DEFAULT_DB', 'jo');
|
||||
define ('MYSQL_SQL_LOG', 'NONE');
|
||||
|
||||
define ('SPHINX_HOST', '192.168.3.25');
|
||||
define ('SPHINX_PORT', 3312);
|
||||
|
||||
define ('SPHINX_ENT_HOST', '192.168.3.25');
|
||||
define ('SPHINX_ENT_PORT', 3312);
|
||||
|
||||
define ('SPHINX_DIR_HOST', '192.168.3.25');
|
||||
define ('SPHINX_DIR_PORT', 3312);
|
||||
|
||||
define ('SPHINX_ACT_HOST', '192.168.3.25');
|
||||
define ('SPHINX_ACT_PORT', 3312);
|
||||
|
||||
define ('SPHINX_HISTO_HOST', '192.168.3.25');
|
||||
define ('SPHINX_HISTO_PORT', 3312);
|
||||
|
||||
|
||||
/** SERVEUR DE MESSAGERIE **/
|
||||
define ('SMTP_HOST', 'smtp.celeste.fr');
|
||||
define ('SMTP_PORT', 25);
|
||||
define ('SMTP_USER', '');
|
||||
define ('SMTP_PASS', '');
|
||||
|
||||
/** INFOGREFFE **/
|
||||
define('INFOGREFFE_DISPO', true);
|
||||
define('INFOGREFFE_DISPO_WS', true);
|
||||
define('INFOGREFFE_DISPO_WEB', true);
|
||||
define('INFOGREFFE_WS_URL', 'https://webservices.infogreffe.fr/WSContextInfogreffe/INFOGREFFE');
|
||||
define('INFOGREFFE_WS_URI', 'https://webservices.infogreffe.fr/');
|
||||
define('INFOGREFFE_WS_USER', '85000109');
|
||||
define('INFOGREFFE_WS_PASS', '166');
|
||||
|
||||
/** AMABIS **/
|
||||
define('AMABIS_WS_URL', 'http://sw4.amabis.com:5101');
|
||||
define('AMABIS_WS_URI', 'http://sw4.amabis.com:5101');
|
||||
|
||||
/** Dossiers locaux pour les documents a telecharger (PDF kbis, marques, etc...) **/
|
||||
define ('DOC_WEB_LOCAL', '/home/scores/batch/shared/datafile/');
|
||||
define ('DOC_WEB_URL', '/data/');
|
||||
|
||||
/** LOGGING **/
|
||||
define('LOG_PATH', '/home/scores/batch/shared/log');
|
||||
|
||||
define ('DATETIME', date('YmdHis'));
|
||||
define ('DATE', substr(DATETIME,0,8));
|
||||
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));
|
@ -1,66 +0,0 @@
|
||||
[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.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
|
||||
resources.frontController.params.displayExceptions = 0
|
||||
resources.layout.layout = "main"
|
||||
resources.layout.layoutPath = APPLICATION_PATH "/views"
|
||||
resources.view.basePath = APPLICATION_PATH "/views"
|
||||
|
||||
; 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.path.shared = "/home/scores/batch/shared"
|
||||
|
||||
; Metier - Infogreffe
|
||||
profil.infogreffe.wsdl = "infogreffe.wsdl"
|
||||
profil.infogreffe.url = "https://webservices.infogreffe.fr/WSContextInfogreffe/INFOGREFFE"
|
||||
profil.infogreffe.uri = "https://webservices.infogreffe.fr/"
|
||||
profil.infogreffe.user = 85000109
|
||||
profil.infogreffe.password = 166
|
||||
profil.infogreffe.cache.path = APPLICATION_PATH "/../data/cache"
|
||||
profil.infogreffe.cache.time = 8
|
||||
profil.infogreffe.storage.path = "c:\Users\mricois\www\dataws\greffes"
|
||||
|
||||
; Sphinx configuration
|
||||
profil.sphinx.ent.host = "192.168.78.242"
|
||||
profil.sphinx.ent.port = 3312
|
||||
profil.sphinx.ent.version = 2
|
||||
profil.sphinx.dir.host = "192.168.78.242"
|
||||
profil.sphinx.dir.port = 3312
|
||||
profil.sphinx.dir.version = 2
|
||||
profil.sphinx.act.host = "192.168.78.242"
|
||||
profil.sphinx.act.port = 3312
|
||||
profil.sphinx.act.version = 2
|
||||
profil.sphinx.histo.host = "192.168.78.242"
|
||||
profil.sphinx.histo.port = 3312
|
||||
profil.sphinx.histo.version = 2
|
||||
|
||||
; Database configuration - For old configuration - see Configure.php
|
||||
profil.db.metier.adapter=mysqli
|
||||
profil.db.metier.params.host=192.168.78.230
|
||||
profil.db.metier.params.username=root
|
||||
profil.db.metier.params.password=scores
|
||||
profil.db.metier.params.dbname=sdv1
|
||||
profil.db.metier.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
|
||||
|
||||
[staging : production]
|
||||
resources.frontController.params.displayExceptions = 0
|
||||
|
||||
[development : production]
|
||||
phpSettings.display_startup_errors = 1
|
||||
phpSettings.display_errors = 0
|
||||
resources.frontController.params.displayExceptions = 1
|
||||
|
||||
[testing : production]
|
||||
phpSettings.display_startup_errors = 1
|
||||
phpSettings.display_errors = 1
|
@ -1,95 +0,0 @@
|
||||
<?php
|
||||
/** BATCH **/
|
||||
define('FILLER',' ');
|
||||
define('VERSION_FICHIER_BODACC','0106');
|
||||
define('LONGUEUR_LIGNE_SORTIE', 2000);
|
||||
|
||||
/** Paramétres du FTP des JO **/
|
||||
define('BODACC_FTP_URL', 'ftp.journal-officiel.gouv.fr');
|
||||
define('BODACC_FTP_USER', 'SCORE');
|
||||
define('BODACC_FTP_PASS', 'SD075');
|
||||
define('BODACC_LOCAL_DIR', '/home/scores/batch/shared/sources/bodacc/');
|
||||
define('JAL_LOCAL_DIR', '/home/scores/batch/shared/sources/jal/');
|
||||
|
||||
/** Paramétres du FTP de Hugin : Communiqués de presse **/
|
||||
define('HUGIN_FTP_URL', 'ftp.companynews.fr');
|
||||
define('HUGIN_FTP_USER', 'scores');
|
||||
define('HUGIN_FTP_PASS', 'scores_632');
|
||||
define('HUGIN_LOCAL_DIR', '/home/scores/batch/shared/sources/infosreg/hugin/');
|
||||
|
||||
/** Paramétres du FTP de ActusNews : Communiqués de presse **/
|
||||
define('ACTUSNEWS_FTP_URL', 'ftp.actusnews.com');
|
||||
define('ACTUSNEWS_FTP_USER', 'scores_act');
|
||||
define('ACTUSNEWS_FTP_PASS', '6_etIwL');
|
||||
define('ACTUSNEWS_LOCAL_DIR', '/home/scores/batch/shared/sources/infosreg/actusnews/');
|
||||
|
||||
/** Paramétres du FTP de Di Release : Communiqués de presse **/
|
||||
define('DIRELEASE_FTP_URL', 'ftp.actusnews.com');
|
||||
define('DIRELEASE_FTP_USER', 'scores_dir');
|
||||
define('DIRELEASE_FTP_PASS', '-gT52sQ');
|
||||
define('DIRELEASE_LOCAL_DIR', '/home/scores/batch/shared/sources/infosreg/direlease/');
|
||||
|
||||
/** Paramétres du FTP des Echos: Communiqués de presse **/
|
||||
define('LESECHOS_FTP_URL', 'ftp.webdisclosure.com');
|
||||
define('LESECHOS_FTP_USER', 'Scores');
|
||||
define('LESECHOS_FTP_PASS', 'scores2001');
|
||||
define('LESECHOS_LOCAL_DIR', '/home/scores/batch/shared/sources/infosreg/lesechos/');
|
||||
|
||||
/** Paramétres du FTP de BusinessWire : Communiqués de presse **/
|
||||
define('BUSINESSWIRE_LOCAL_DIR_INCOMING', '/home/scores/batch/shared/ftp/businesswire/');
|
||||
define('BUSINESSWIRE_LOCAL_DIR', '/home/scores/batch/shared/infosreg/businesswire/');
|
||||
|
||||
/** Base de données de S&D **/
|
||||
define ('MYSQL_HOST', '192.168.78.230');
|
||||
define ('MYSQL_USER', 'root');
|
||||
define ('MYSQL_PASS', 'scores');
|
||||
define ('MYSQL_DEFAULT_DB', 'jo');
|
||||
define ('MYSQL_SQL_LOG', 'NONE');
|
||||
|
||||
define ('SPHINX_HOST', '192.168.78.242');
|
||||
define ('SPHINX_PORT', 3312);
|
||||
|
||||
define ('SPHINX_ENT_HOST', '192.168.78.242');
|
||||
define ('SPHINX_ENT_PORT', 3312);
|
||||
|
||||
define ('SPHINX_DIR_HOST', '192.168.78.242');
|
||||
define ('SPHINX_DIR_PORT', 3312);
|
||||
|
||||
define ('SPHINX_ACT_HOST', '192.168.78.242');
|
||||
define ('SPHINX_ACT_PORT', 3312);
|
||||
|
||||
define ('SPHINX_HISTO_HOST', '192.168.78.242');
|
||||
define ('SPHINX_HISTO_PORT', 3312);
|
||||
|
||||
|
||||
/** SERVEUR DE MESSAGERIE **/
|
||||
define ('SMTP_HOST', 'smtp.free.fr');
|
||||
define ('SMTP_PORT', 25);
|
||||
define ('SMTP_USER', '');
|
||||
define ('SMTP_PASS', '');
|
||||
|
||||
/** INFOGREFFE **/
|
||||
define('INFOGREFFE_DISPO', true);
|
||||
define('INFOGREFFE_DISPO_WS', true);
|
||||
define('INFOGREFFE_DISPO_WEB', true);
|
||||
define('INFOGREFFE_WS_URL', 'https://webservices.infogreffe.fr/WSContextInfogreffe/INFOGREFFE');
|
||||
define('INFOGREFFE_WS_URI', 'https://webservices.infogreffe.fr/');
|
||||
define('INFOGREFFE_WS_USER', '85000109');
|
||||
define('INFOGREFFE_WS_PASS', '166');
|
||||
|
||||
/** AMABIS **/
|
||||
define('AMABIS_WS_URL', 'http://sw4.amabis.com:5101');
|
||||
define('AMABIS_WS_URI', 'http://sw4.amabis.com:5101');
|
||||
|
||||
/** Dossiers locaux pour les documents a telecharger (PDF kbis, marques, etc...) **/
|
||||
define ('DOC_WEB_LOCAL', '/home/scores/batch/shared/datafile/');
|
||||
define ('DOC_WEB_URL', '/data/');
|
||||
|
||||
/** LOGGING **/
|
||||
define('LOG_PATH', 'c:/Users/michael/www/batch-1.2/data/sources/log');
|
||||
|
||||
define ('DATETIME', date('YmdHis'));
|
||||
define ('DATE', substr(DATETIME,0,8));
|
||||
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));
|
@ -1,64 +0,0 @@
|
||||
<?php
|
||||
// --- Define path to application directory
|
||||
defined('APPLICATION_PATH')
|
||||
|| define('APPLICATION_PATH', realpath(__DIR__ . '/../../application'));
|
||||
|
||||
// --- Define application environment
|
||||
defined('APPLICATION_ENV')
|
||||
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
|
||||
|
||||
// --- Composer autoload
|
||||
require_once realpath(__DIR__ . '/../../vendor/autoload.php');
|
||||
|
||||
//Copy configuration
|
||||
$configDir = realpath(dirname(__FILE__)).'/config';
|
||||
$appconfigDir = APPLICATION_PATH.'/configs';
|
||||
|
||||
if (stristr(PHP_OS, 'WIN')) {
|
||||
$hostname = 'development';
|
||||
} else {
|
||||
$hostname = exec('echo $(hostname)');
|
||||
}
|
||||
|
||||
if ( !copy($configDir.'/'.$hostname.'/application.ini', $appconfigDir.'/application.ini') ) {
|
||||
echo "application.ini could not be copied !\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( !copy($configDir.'/'.$hostname.'/config.php', $appconfigDir.'/config.php') ) {
|
||||
echo "config.php could not be copied !\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
// 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|?' => "Display usage information.",
|
||||
'install' => "Make install operation.",
|
||||
)
|
||||
);
|
||||
$opts->parse();
|
||||
} catch (Zend_Console_Getopt_Exception $e) {
|
||||
echo $e->getUsageMessage();
|
||||
exit;
|
||||
}
|
||||
|
||||
//Usage
|
||||
if(isset($opts->help))
|
||||
{
|
||||
echo $opts->getUsageMessage();
|
||||
exit;
|
||||
}
|
||||
|
||||
if(isset($opts->install))
|
||||
{
|
||||
if (stristr(PHP_OS, 'WIN')) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
/home/scores/batch/shared/log/*.log {
|
||||
missingok
|
||||
notifempty
|
||||
weekly
|
||||
rotate 10
|
||||
compress
|
||||
delaycompress
|
||||
nocreate
|
||||
}
|
File diff suppressed because one or more lines are too long
@ -1,691 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Crontab
|
||||
* 0 9 * * 1-5 /var/www/batch/getAsso.php -c >> /var/www/log/getAsso.log
|
||||
*
|
||||
* Recherche
|
||||
*
|
||||
* Compte initial
|
||||
* http://www.journal-officiel.gouv.fr/association/index.php?ACTION=Rechercher&HI_PAGE=1&HI_COMPTEUR=0&original_method=get&WHAT=&JTH_ID=&JAN_BD_CP=&JRE_ID=&JAN_LIEU_DECL=&JTY_ID=&JTY_WALDEC=&JTY_SIREN=776467102&JPA_D_D=&JPA_D_F=&rechercher.x=0&rechercher.y=0
|
||||
*
|
||||
*/
|
||||
|
||||
// --- Define path to application directory
|
||||
defined('APPLICATION_PATH')
|
||||
|| define('APPLICATION_PATH', realpath(__DIR__ . '/../application'));
|
||||
|
||||
// --- Define application environment
|
||||
defined('APPLICATION_ENV')
|
||||
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
|
||||
|
||||
// --- Composer autoload
|
||||
require_once realpath(__DIR__ . '/../vendor/autoload.php');
|
||||
|
||||
// --- Create application, bootstrap, and run
|
||||
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
|
||||
|
||||
require_once APPLICATION_PATH.'/configs/config.php';
|
||||
|
||||
require_once 'framework/fwk.php';
|
||||
require_once 'framework/common/chiffres.php';
|
||||
require_once 'framework/common/dates.php';
|
||||
require_once 'framework/mail/sendMail.php';
|
||||
|
||||
$tabInfosGlobal=array();
|
||||
$repPdfAssoCpt='/home/scores/batch/shared/datafile/association/bilans/';
|
||||
|
||||
function getNextDate($dateCour, $nbJours=7) {
|
||||
$nextDate=date('Ymd', mktime(0, 0, 0, WDate::dateT('Ymd','m', $dateCour), WDate::dateT('Ymd','d', $dateCour)+$nbJours, WDate::dateT('Ymd','Y', $dateCour)));
|
||||
return $nextDate;
|
||||
}
|
||||
|
||||
global $tabDep;
|
||||
$tabDep = array(
|
||||
'Dordogne'=>'24',
|
||||
'Gironde'=>'33',
|
||||
'Landes'=>'40',
|
||||
'Lot-et-Garonne'=>'47',
|
||||
'Pyrénées-Atlantiques'=>'64',
|
||||
'Bas-Rhin'=>'67',
|
||||
'Haut-Rhin'=>'68',
|
||||
'Allier'=>'03',
|
||||
'Cantal'=>'15',
|
||||
'Haute-Loire'=>'43',
|
||||
'Puy-de-Dôme'=>'63',
|
||||
'Calvados'=>'14',
|
||||
'Manche'=>'50',
|
||||
'Orne'=>'61',
|
||||
'Côte-d\'Or'=>'21',
|
||||
'Nièvre'=>'58',
|
||||
'Saône-et-Loire'=>'71',
|
||||
'Yonne'=>'89',
|
||||
'Côtes-d\'Armor'=>'22',
|
||||
'Finistère'=>'29',
|
||||
'Ille-et-Vilaine'=>'35',
|
||||
'Morbihan'=>'56',
|
||||
'Cher'=>'18',
|
||||
'Eure-et-Loir'=>'28',
|
||||
'Indre'=>'36',
|
||||
'Indre-et-Loire'=>'37',
|
||||
'Loir-et-Cher'=>'41',
|
||||
'Loiret'=>'45',
|
||||
'Ardennes'=>'08',
|
||||
'Aube'=>'10',
|
||||
'Haute-Marne'=>'52',
|
||||
'Marne'=>'51',
|
||||
'Corse-du-sud'=>'2A',
|
||||
'Haute-Corse'=>'2B',
|
||||
'Doubs'=>'25',
|
||||
'Haute-Saône'=>'70',
|
||||
'Jura'=>'39',
|
||||
'Territoire-de-Belfort'=>'90',
|
||||
'Eure'=>'27',
|
||||
'Seine-Maritime'=>'76',
|
||||
'Essonne'=>'91',
|
||||
'Hauts-de-Seine'=>'92',
|
||||
'Paris'=>'75',
|
||||
'Seine-et-Marne'=>'77',
|
||||
'Seine-Saint-Denis'=>'93',
|
||||
'Val-d\'Oise'=>'95',
|
||||
'Val-de-Marne'=>'94',
|
||||
'Yvelines'=>'78',
|
||||
'Aude'=>'11',
|
||||
'Gard'=>'30',
|
||||
'Hérault'=>'34',
|
||||
'Lozère'=>'48',
|
||||
'Pyrénées-Orientales'=>'66',
|
||||
'Corrèze'=>'19',
|
||||
'Creuse'=>'23',
|
||||
'Haute-Vienne'=>'87',
|
||||
'Moselle'=>'57',
|
||||
'Meurthe-et-Moselle'=>'54',
|
||||
'Meuse'=>'55',
|
||||
'Vosges'=>'88',
|
||||
'Ariège'=>'09',
|
||||
'Aveyron'=>'12',
|
||||
'Gers'=>'32',
|
||||
'Haute-Garonne'=>'31',
|
||||
'Hautes-Pyrénées'=>'65',
|
||||
'Lot'=>'46',
|
||||
'Tarn'=>'81',
|
||||
'Tarn-et-Garonne'=>'82',
|
||||
'Nord'=>'59',
|
||||
'Pas-de-calais'=>'62',
|
||||
'Guadeloupe'=>'971',
|
||||
'Guyane'=>'973',
|
||||
'Martinique'=>'972',
|
||||
'Réunion'=>'974',
|
||||
'Saint-Pierre-et-Miquelon'=>'975',
|
||||
'Mayotte'=>'976',
|
||||
'Loire-Atlantique'=>'44',
|
||||
'Maine-et-Loire'=>'49',
|
||||
'Mayenne'=>'53',
|
||||
'Sarthe'=>'72',
|
||||
'Vendée'=>'85',
|
||||
'Aisne'=>'02',
|
||||
'Oise'=>'60',
|
||||
'Somme'=>'80',
|
||||
'Charente'=>'16',
|
||||
'Charente-Maritime'=>'17',
|
||||
'Deux-Sèvres'=>'79',
|
||||
'Vienne'=>'86',
|
||||
'Alpes-de-Haute-Provence'=>'04',
|
||||
'Alpes-Maritimes'=>'06',
|
||||
'Bouches-du-Rhone'=>'13',
|
||||
'Hautes-Alpes'=>'05',
|
||||
'Var'=>'83',
|
||||
'Vaucluse'=>'84',
|
||||
'Ain'=>'01',
|
||||
'Ardèche'=>'07',
|
||||
'Drôme'=>'26',
|
||||
'Haute-Savoie'=>'74',
|
||||
'Isère'=>'38',
|
||||
'Loire'=>'42',
|
||||
'Rhône'=>'69',
|
||||
'Savoie'=>'73',
|
||||
);
|
||||
|
||||
function getInfosAnnonceAsso($annonceHtml, $depotComptes=false)
|
||||
{
|
||||
$tabAnn=array();
|
||||
global $tabDep;
|
||||
global $iInsee;
|
||||
|
||||
$tabAnn['Assoc_Nom']=htm2txt(@getTextInHtml($annonceHtml, '<p>Association : <b>', '<b>', '</b>'));
|
||||
if (substr($tabAnn['Assoc_Nom'],-1)=='.') $tabAnn['Assoc_Nom']=substr($tabAnn['Assoc_Nom'],0,-1);
|
||||
|
||||
$tabAnn['Siren']=str_replace(' ','', strtr(htm2txt(@getTextInHtml($annonceHtml, '<p>Siren : <b>', '<b>', '</b>')),' .-/;,',' '))*1;
|
||||
$tabAnn['sirenValide']=$iInsee->valideSiren($tabAnn['Siren']);
|
||||
$tabAnn['Waldec']=strtoupper(@getTextInHtml($annonceHtml, '<p>Identification R.N.A. : <b>', '<b>', '</b>'));
|
||||
$tabAnn['Annonce_Html']=str_replace('</p>','',str_replace(chr(160), ' ', html_entity_decode(@getTextInHtml($annonceHtml, '<p align="LEFT"><br>', '<br>', '</p>'))));
|
||||
if ($tabAnn['Annonce_Html']=='') // Les fondations n'ont pas le même corps HTML
|
||||
$tabAnn['Annonce_Html']=str_replace('</p>','',str_replace(chr(160), ' ', html_entity_decode(@getTextInHtml($annonceHtml, '<p align="left"></p> <p align="left">', '</p> <p align="left">', '</p>'))));
|
||||
if ($tabAnn['Annonce_Html']=='') // Les fondations n'ont pas le même corps HTML
|
||||
$tabAnn['Annonce_Html']='#####'.str_replace(chr(160), ' ', html_entity_decode($annonceHtml));
|
||||
|
||||
if ($depotComptes) {
|
||||
|
||||
$tabAnn['pdfLink']=@getTextInHtml($annonceHtml, '<a href="/', '/', '">');
|
||||
|
||||
$tmp=@getTextInHtml($annonceHtml, 'Date de clôture de l\'exercice : <b>', '<b>', '</b>');
|
||||
$tabAnn['dateCloture']=WDate::dateT('d/m/Y', 'Y-m-d', $tmp);
|
||||
if ( $tabAnn['dateCloture']=='' ) {
|
||||
preg_match('/_([0-9]{8})/', $tabAnn['pdfLink'], $matches);
|
||||
/*sendMail(
|
||||
'mricois@scores-decisions.com',
|
||||
'mricois@scores-decisions.com',
|
||||
'Associations',
|
||||
$annonceHtml."\n\n\n".print_r($matches,1));*/
|
||||
}
|
||||
|
||||
$tabAnn['typeCompte']=@getTextInHtml($annonceHtml, '<a href="/', '">>', '</a>');
|
||||
$tabAnn['dateInsert']=date('YmdHis');
|
||||
} else {
|
||||
$tabAnn['nic']=0;
|
||||
$tabAnn['nicValide']=0;
|
||||
$tabAnn['Activite']=htm2txt(@getTextInHtml($annonceHtml, 'Activité(s) : <b>', '<b>', '</b>'));
|
||||
$tabAnn['Num_Annonce']=@getTextInHtml($annonceHtml, 'No d\'annonce : <b>', '<b>', '</b>');
|
||||
$tmp=@getTextInHtml($annonceHtml, 'Paru le : <b>', '<b>', '</b>');
|
||||
$tabAnn['Date_Parution']=substr($tmp,6,4).'-'.substr($tmp,3,2).'-'.substr($tmp,0,2);
|
||||
$tabAnn['Num_Parution']=@getTextInHtml($annonceHtml, 'No de parution : <b>', '<b>', '</b>');
|
||||
$depReg=trim(htm2txt(@getTextInHtml($annonceHtml, 'Département (Région) : <b>','<b>','</b></p>')));
|
||||
$tabDepReg=explode('(', $depReg);
|
||||
$dep=trim($tabDepReg[0]);
|
||||
$numDep=$tabDep[$dep];
|
||||
if ($numDep=='') echo date ('Y/m/d - H:i:s') ." - Attention, département '$dep' non trouvé !". EOL;
|
||||
$region=trim(substr($tabDepReg[1],0,strlen($tabDepReg[1])-1));
|
||||
$tabAnn['Departement']=$numDep;
|
||||
$tabAnn['Sous_Prefecture']=htm2txt(@getTextInHtml($annonceHtml, '<p>Lieu parution : <b>Déclaration à la ', ' à la ', '</b>'));
|
||||
$tabAnn['Type_Annonce']=htm2txt(@getTextInHtml($annonceHtml, 'Type d\'annonce : <b>', '<b>', '</b>'));
|
||||
|
||||
/** Recherche du type d'association
|
||||
**/
|
||||
if (preg_match('/ASL/i', $tabAnn['Type_Annonce']) || preg_match('/syndicale/i', $tabAnn['Type_Annonce']))
|
||||
$tabAnn['typeAsso']='ASL';
|
||||
elseif (preg_match('/Fondation/i', $tabAnn['Type_Annonce']))
|
||||
$tabAnn['typeAsso']='FON';
|
||||
elseif (preg_match('/dotation/i', $tabAnn['Type_Annonce']))
|
||||
$tabAnn['typeAsso']='FOD';
|
||||
else
|
||||
$tabAnn['typeAsso']='ASS';
|
||||
|
||||
/** Recherche du type d'insertion
|
||||
**/
|
||||
if (preg_match('/ANNULATION/i', $tabAnn['Type_Annonce']))
|
||||
$tabAnn['typeAnnonce']='Suppression';
|
||||
elseif (preg_match('/RECTIFICATIF/i', $tabAnn['Type_Annonce']))
|
||||
$tabAnn['typeAnnonce']='Rectificatif';
|
||||
else
|
||||
$tabAnn['typeAnnonce']='Insertion';
|
||||
|
||||
$tabAnn['Assoc_Duree']=trim(htm2txt(@getTextInHtml($tabAnn['Annonce_Html'], 'Durée :', 'Durée :', '.<br>')));
|
||||
$tabAnn['Assoc_Dotation']=trim(htm2txt(@getTextInHtml($tabAnn['Annonce_Html'], 'Montant de la dotation initiale :', 'initiale :', '.<br>')));
|
||||
$tabAnn['Assoc_ProgAction']=trim(htm2txt(@getTextInHtml($tabAnn['Annonce_Html'], 'action pluriannuel :', 'pluriannuel :', '.<br>')));
|
||||
$tabAnn['Assoc_Fondateurs']=trim(htm2txt(@getTextInHtml($tabAnn['Annonce_Html'], ' de chacun des fondateurs :', 'fondateurs :', '.</p>')));
|
||||
|
||||
|
||||
//<p align="LEFT">Autorisation administrative.</p> <p align="LEFT">
|
||||
//Date de signature de statuts : 21 décembre 1992.<br>
|
||||
//Date de la modification des statuts : 7 février 1996, autorisation délivrée par le préfet 16 mars 1996.</p> <p align="LEFT">Autorisation tacite.</p> <p align="LEFT">
|
||||
//Date de la demande de modification des statuts : 7 février 1996, sollicitée auprès du préfet de Paris.</p>
|
||||
|
||||
|
||||
$tabAnn['Assoc_Web']=@getTextInHtml($tabAnn['Annonce_Html'], 'ite Internet : </i>', '</i>', '<i>');
|
||||
if (substr($tabAnn['Assoc_Web'],-1)=='.')
|
||||
$tabAnn['Assoc_Web']=substr($tabAnn['Assoc_Web'],0,-1);
|
||||
$tabAnn['Assoc_Mail']= @getTextInHtml($tabAnn['Annonce_Html'], '<i>Courriel : </i>', '</i>', '<i>');
|
||||
if ($tabAnn['Assoc_Mail']=='')
|
||||
$tabAnn['Assoc_Mail']= @getTextInHtml($tabAnn['Annonce_Html'], '<i>Mél. : </i>', '</i>', '<i>');
|
||||
if (substr($tabAnn['Assoc_Mail'],-1)=='.')
|
||||
$tabAnn['Assoc_Mail']=substr($tabAnn['Assoc_Mail'],0,-1);
|
||||
$tabAnn['Assoc_Objet']=htm2txt(@getTextInHtml($tabAnn['Annonce_Html'], '>Objet : </i>', '</i>', '<i>'));
|
||||
if(trim($tabAnn['Assoc_Objet'])=='')
|
||||
$tabAnn['Assoc_Objet']=htm2txt(@getTextInHtml($tabAnn['Annonce_Html'], 'Objet : </i>', '</i>', '<br>'));
|
||||
|
||||
$tabAnn['Assoc_NObjet']=htm2txt(@getTextInHtml($tabAnn['Annonce_Html'], '<i>Nouvel objet : </i>', '</i>', '<i>'));
|
||||
$tabAnn['Assoc_AObjet']=htm2txt(@getTextInHtml($tabAnn['Annonce_Html'], '<i>Additif à l’objet : </i>', '</i>', '<i>'));
|
||||
$tabAnn['Assoc_NAdresse']=htm2txt(@getTextInHtml($tabAnn['Annonce_Html'], '<i>Transféré ; nouvelle adresse : </i>', '</i>', '. <i>'));
|
||||
$tabAnn['Assoc_Fusion']=htm2txt(@getTextInHtml($tabAnn['Annonce_Html'], '<i>Fusion des associations : </i>', '</i>', '<i>'));
|
||||
$tabAnn['Assoc_Adresse']=htm2txt(@getTextInHtml($tabAnn['Annonce_Html'], '<i>Siège social : </i>', '</i>', '. <i>'));
|
||||
// Fondations
|
||||
if (trim($tabAnn['Assoc_Adresse'])=='')
|
||||
$tabAnn['Assoc_Adresse']=htm2txt(@getTextInHtml($tabAnn['Annonce_Html'], 'Siège : </i>', '</i>', '.<br>'));
|
||||
if (trim($tabAnn['Assoc_Adresse'])=='')
|
||||
$tabAnn['Assoc_Adresse']=htm2txt(@getTextInHtml($tabAnn['Annonce_Html'], 'Siège : </i>', '</i>', '.</p>'));
|
||||
|
||||
$tabAnn['Assoc_Date_Declaration']=htm2txt(@getTextInHtml($tabAnn['Annonce_Html'], '>Date de la déclaration : </i>', '</i>', '.'));
|
||||
if ($tabAnn['Assoc_Date_Declaration']=='')
|
||||
$tabAnn['Assoc_Date_Declaration']=htm2txt(@getTextInHtml($tabAnn['Annonce_Html'], '>Date de délivrance du récépissé : </i>', '</i>', '.'));
|
||||
// Fondations
|
||||
if(trim($tabAnn['Assoc_Date_Declaration'])=='') {
|
||||
$tabAnn['Assoc_Date_Declaration']=trim(htm2txt(@getTextInHtml($tabAnn['Annonce_Html'], 'autorisation administrative :', 'administrative :', ',')));
|
||||
if (trim($tabAnn['Assoc_Date_Declaration'])=='')
|
||||
$tabAnn['Assoc_Date_Declaration']=trim(htm2txt(@getTextInHtml($tabAnn['Annonce_Html'], 'Date de la modification des statuts :', 'statuts :', ',')));
|
||||
if(trim($tabAnn['Sous_Prefecture'])=='')
|
||||
$tabAnn['Sous_Prefecture']=htm2txt(@getTextInHtml($annonceHtml, 'sollicitée auprès du', 'du', '<br>'));
|
||||
if(trim($tabAnn['Sous_Prefecture'])=='')
|
||||
$tabAnn['Sous_Prefecture']=htm2txt(@getTextInHtml($annonceHtml, 'sollicitée auprès du', 'du', '</p>'));
|
||||
}
|
||||
$tabAnn['Assoc_Date_Declaration2']=WDate::dateT('d M Y', 'Y-m-d', $tabAnn['Assoc_Date_Declaration']);
|
||||
$tabAnn['Assoc_ANom']=htm2txt(@getTextInHtml($tabAnn['Annonce_Html'], '<i>Ancien titre : </i>', '</i>', '<i>'));
|
||||
$tabAnn['Assoc_Annulation']='Annulation '.htm2txt(@getTextInHtml($tabAnn['Annonce_Html'], '>Annulation', '</i>', '.'));
|
||||
/*<i>Annulation </i>de l’insertion n<sup>o</sup> 1014, parue au <i>Journal officiel </i>n<sup>o</sup> 25, du 24 juin 2006, page 3106.*/
|
||||
if ($tabAnn['Assoc_Annulation']=='Annulation ') $tabAnn['Assoc_Annulation']='';
|
||||
|
||||
if ($tabAnn['Assoc_ANom']=='')
|
||||
$tabAnn['Assoc_ANom']=htm2txt(@getTextInHtml($tabAnn['Annonce_Html'], 'Au lieu de : </i>', '</i>', '<i>'));
|
||||
if (substr($tabAnn['Assoc_ANom'],-1)=='.')
|
||||
$tabAnn['Assoc_ANom']=substr($tabAnn['Assoc_ANom'],0,-1);
|
||||
$tabAnn['Assoc_NNom']=htm2txt(@getTextInHtml($tabAnn['Annonce_Html'], '<i>Nouveau titre :', '</i>', '<i>'));
|
||||
if (substr($tabAnn['Assoc_NNom'],-1)=='.')
|
||||
$tabAnn['Assoc_NNom']=substr($tabAnn['Assoc_NNom'],0,-1);
|
||||
}
|
||||
return $tabAnn;
|
||||
}
|
||||
|
||||
$tempsMinEntreRequetes=5;
|
||||
$tempsMaxEntreRequetes=30;
|
||||
set_time_limit(0);
|
||||
$lastJO=$dateDebut=$dateFin=$dateF=$dateCour=$verif=false;
|
||||
$strInfoProg='Usage : '.basename($argv[0]). " [OPTION]
|
||||
Recupère les annonces Association sur le site du JO Association.
|
||||
|
||||
Sans aucun paramètre, récupération du dernier JO Association.
|
||||
Sinon:
|
||||
-d:JJ/MM/AAAA Date de début de publication
|
||||
-f:JJ/MM/AAAA Date de fin de publication
|
||||
-l Dernier JO Association uniquement (*)
|
||||
-c Dépôts des comptes uniquement
|
||||
-s:123456789 Recherche par siren
|
||||
-n:X Intervalle MIN en secondes entre les requêtes sur le site des JO (défaut=$tempsMinEntreRequetes)
|
||||
-i:X \" MAX \" \" \" \" \" \" \" \" \" \" (défaut=$tempsMaxEntreRequetes)
|
||||
-v Vérifier que toutes les annonces du JO sont en base !
|
||||
";
|
||||
|
||||
$depotComptes=false;
|
||||
$siren = null;
|
||||
|
||||
$argv=$_SERVER['argv'];
|
||||
if ($_SERVER['argc']==1) $lastJO=true;
|
||||
else {
|
||||
for ($i=1; isset($argv[$i]); $i++) {
|
||||
if (substr($argv[$i],0,1)=='-') {
|
||||
switch (substr($argv[$i],1,1)) {
|
||||
case 'd':
|
||||
$dateDebut=substr($argv[$i],3,10);
|
||||
$dateDeb=WDate::dateT('d/m/Y', 'Ymd', $dateDebut);
|
||||
break;
|
||||
case 'f':
|
||||
$dateFin=substr($argv[$i],3,10);
|
||||
$dateF=WDate::dateT('d/m/Y', 'Ymd', $dateFin);
|
||||
break;
|
||||
case 'n':
|
||||
$tempsMinEntreRequetes=trim(substr($argv[$i],3))*1;
|
||||
if ($tempsMinEntreRequetes<0) $tempsMinEntreRequetes=0;
|
||||
break;
|
||||
case 'i':
|
||||
$tempsMaxEntreRequetes=trim(substr($argv[$i],3))*1;
|
||||
if ($tempsMaxEntreRequetes<5) $tempsMaxEntreRequetes=2;
|
||||
break;
|
||||
case 'l':
|
||||
$lastJO=true;
|
||||
break;
|
||||
case 'v':
|
||||
$verif=true;
|
||||
break;
|
||||
case 'c':
|
||||
$depotComptes=true;
|
||||
break;
|
||||
case 's':
|
||||
$siren = substr($argv[$i],3,9);
|
||||
break;
|
||||
case '-':
|
||||
die($strInfoProg);
|
||||
break;
|
||||
default: die('Option '. $argv[$i] . " inconnue !\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($depotComptes) {
|
||||
$tabReg = array(
|
||||
'ASSOCIATION%2FCOMPTE',
|
||||
'FONDATION%2FCOMPTE',
|
||||
'FONDS+DE+DOTATION%2FCOMPTE',
|
||||
'AUTRE%2FCOMPTE',
|
||||
);
|
||||
} else {
|
||||
$tabReg = array(
|
||||
'ASSOCIATION%2FCREATION',
|
||||
'ASSOCIATION%2FMODIFICATION',
|
||||
'ASSOCIATION%2FDISSOLUTION',
|
||||
'ASL',
|
||||
'FONDATION',
|
||||
'DECISION+JUSTICE',
|
||||
'AUTRE',
|
||||
'FONDS+DE+DOTATION',
|
||||
);
|
||||
}
|
||||
|
||||
$iDb=new WDB();
|
||||
$iInsee=new Metier_Insee_MInsee();
|
||||
|
||||
$referer='http://www.journal-officiel.gouv.fr/association/';
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
if ($verif) {
|
||||
echo date('Y/m/d - H:i:s') ." - Comptage du nombre d'annonce présentes en base par date de parution...". EOL;
|
||||
$AnnDb=$iDb->select('asso', 'Date_Parution, count(*) as nb', '1 GROUP BY Date_Parution');
|
||||
foreach ($AnnDb as $i=>$tabDates) {
|
||||
if ($tabDates[0]<>'0000-00-00') {
|
||||
$parDate=$tabDates[0];
|
||||
$parNb =$tabDates[1];
|
||||
$dateFmt=str_replace('/', '%2F', WDate::dateT('Y-m-d', 'd/m/Y',$parDate));
|
||||
$url="http://www.journal-officiel.gouv.fr/association/index.php?ACTION=Rechercher&HI_PAGE=1&HI_COMPTEUR=0&original_method=get&WHAT=&JTH_ID=&JAN_BD_CP=&JRE_ID=&JAN_LIEU_DECL=&JTY_ID=&JTY_WALDEC=&JPA_D_D=$dateFmt&JPA_D_F=".$dateFmt.'&rechercher.x='.rand(1,68).'&rechercher.y='.rand(1,16).'&rechercher=Rechercher';
|
||||
|
||||
$page=getUrl($url, '', '', $referer, false, 'www.journal-officiel.gouv.fr');
|
||||
$body=$page['body'];
|
||||
$ctx=@getTextInHtml($body, '<A href="index.php?ctx=', 'ctx=', '&'); // Clé de contexte entre chaque page
|
||||
$nbAnnonces=@getTextInHtml($body, '<p>Résultat de la recherche : <strong>', '<strong>', 'annonce(s)</strong>');
|
||||
if ($nbAnnonces<>$parNb && $nbAnnonces<>0)
|
||||
echo date('Y/m/d - H:i:s') ." - Parution du $parDate : $parNb annonces en base / $nbAnnonces annonces parues !". EOL;
|
||||
elseif ($nbAnnonces==0)
|
||||
echo date('Y/m/d - H:i:s') ." - Parution du $parDate : $parNb annonces en base / Plus d'annonces sur le site JO.". EOL;
|
||||
randsleep($tempsMinEntreRequetes, $tempsMaxEntreRequetes);
|
||||
}
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
if ($lastJO==true) {
|
||||
$strLast=' dernier';
|
||||
$strDates='';
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
else {
|
||||
$strLast='';
|
||||
if ($depotComptes) {
|
||||
if ($dateDebut==false) {
|
||||
$dateDeb= getNextDate(date('Ymd'),-5);
|
||||
$dateDebut= WDate::dateT('Ymd', 'd/m/Y',$dateDeb);
|
||||
}
|
||||
if ($dateFin==false) {
|
||||
$dateF= getNextDate(date('Ymd'),0);
|
||||
$dateFin= WDate::dateT('Ymd', 'd/m/Y',$dateF);
|
||||
}
|
||||
$dateCour= $dateDeb;
|
||||
}
|
||||
if ($dateFin==false) {
|
||||
$dateFin=date('d/m/Y');
|
||||
$dateF=WDate::dateT('d/m/Y', 'Ymd', $dateFin);
|
||||
}
|
||||
if ($dateDebut==false)
|
||||
die($strInfoProg);
|
||||
else
|
||||
$strDates=" du $dateDebut au $dateFin";
|
||||
$dateCour=$dateDeb;
|
||||
}
|
||||
|
||||
|
||||
echo date('Y/m/d - H:i:s') ." - DEBUT du la récupération du$strLast JO Association$strDates".EOL;
|
||||
echo date('Y/m/d - H:i:s') .' - La durée maximum entre chaque requête est de '. $tempsMaxEntreRequetes .' secondes.'. EOL;
|
||||
|
||||
$message = '';
|
||||
|
||||
// Boucle sur les dates
|
||||
while ($dateCour<=$dateF || $lastJO)
|
||||
{
|
||||
// Boucle sur les régions
|
||||
for ($i_reg=0; isset($tabReg[$i_reg]) || $lastJO; $i_reg++)
|
||||
{
|
||||
// Recherche par siren
|
||||
if ($siren !== null) {
|
||||
$url = 'http://www.journal-officiel.gouv.fr/association/index.php?ACTION=Rechercher&HI_PAGE=1&HI_COMPTEUR=0&original_method=get&WHAT=&JTH_ID=&JAN_BD_CP=&JRE_ID=&JAN_LIEU_DECL=&JTY_ID='.$region.'&JTY_WALDEC=&JTY_SIREN='.$siren.'&JPA_D_D=&JPA_D_F=&rechercher.x='.rand(1,68).'&rechercher.y='.rand(1,16).'&rechercher=Rechercher';
|
||||
// Cas récup dernier JO
|
||||
} elseif ($lastJO==true) {
|
||||
$region='';
|
||||
$reg5=substr($region,0,5);
|
||||
$url='http://www.journal-officiel.gouv.fr/association/index.php?ACTION=showLast';
|
||||
}
|
||||
// On est pas dans la récupération du JO Assoc Jiur
|
||||
else {
|
||||
$region=$tabReg[$i_reg];
|
||||
$reg5=substr($region,0,5);
|
||||
$dateFmt=str_replace('/', '%2F', WDate::dateT('Ymd', 'd/m/Y',$dateCour));
|
||||
if ($depotComptes)
|
||||
$dateFmt2=str_replace('/', '%2F', WDate::dateT('Ymd', 'd/m/Y',getNextDate($dateCour,0)));
|
||||
else
|
||||
$dateFmt2=str_replace('/', '%2F', WDate::dateT('Ymd', 'd/m/Y',getNextDate($dateCour)));
|
||||
|
||||
$url='http://www.journal-officiel.gouv.fr/association/index.php?ACTION=Rechercher&HI_PAGE=1&HI_COMPTEUR=0&original_method=get&WHAT=&JTH_ID=&JAN_BD_CP=&JRE_ID=&JAN_LIEU_DECL=&JTY_ID='.$region.'&JTY_WALDEC=&JTY_SIREN=&JPA_D_D='. $dateFmt .'&JPA_D_F='. $dateFmt2.'&rechercher.x='.rand(1,68).'&rechercher.y='.rand(1,16).'&rechercher=Rechercher';
|
||||
$strLast='';
|
||||
}
|
||||
|
||||
$page=getUrl($url, '', '', $referer, false, 'www.journal-officiel.gouv.fr');
|
||||
$body=$page['body'];
|
||||
//die(print_r($body));
|
||||
$ctx=@getTextInHtml($body, '<A href="index.php?ctx=', 'ctx=', '&'); // Clé de contexte entre chaque page
|
||||
$nbAnnonces=@getTextInHtml($body, 'Résultat de la recherche :', ' :', 'annonce(s)');
|
||||
$dateDerParution=@getTextInHtml($body, 'Annonce parue entre le :', ' et le ', '<br>'); // Date au format JJ/MM/AAAA
|
||||
// 01/08/2010 et le 01/08/2010<br>
|
||||
$nbPages=ceil($nbAnnonces/25);
|
||||
if ($nbPages>100) {
|
||||
echo date('Y/m/d - H:i:s') .' - ERREUR : Il y a plus de 100 pages d\'annonces !'. EOL;
|
||||
die();
|
||||
}
|
||||
echo date('Y/m/d - H:i:s') ." - Clé de contexte = $ctx".EOL;
|
||||
unset($AnnDb);
|
||||
$nbAnnDb=0;
|
||||
if ($lastJO==true) {
|
||||
echo date('Y/m/d - H:i:s') .' - Derniere parution ASSO le '. $dateDerParution .' de '. $nbAnnonces .' annonces ('. $nbPages .' pages)'. EOL;
|
||||
// On recherche si nous n'avons pas déjà toutes ces annonces en base !
|
||||
$dateDb=substr($dateDerParution,6,4).'-'.substr($dateDerParution,3,2).'-'.substr($dateDerParution,0,2);
|
||||
$AnnDb=$iDb->select('asso', 'count(*) AS nb', "Date_Parution='$dateDb'", false, MYSQL_ASSOC);
|
||||
$nbAnnDb=$AnnDb[0]['nb'];
|
||||
if ($nbAnnDb==$nbAnnonces) {
|
||||
echo date('Y/m/d - H:i:s') .' - Toutes les annonces du '. $dateDerParution .' sont en base !'. EOL;
|
||||
echo date('Y/m/d - H:i:s') .' - FIN du script'. EOL;
|
||||
die();
|
||||
}
|
||||
elseif ($nbAnnDb>0 && $nbAnnDb<$nbAnnonces) {
|
||||
$message=date('Y/m/d - H:i:s') .' - ATTENTION : Il n\'y a que '. $nbAnnDb .' annonces en base sur les '. $nbAnnonces .' annonces présentes au JO Association du '. $dateDerParution .' !'. EOL;
|
||||
echo $message;
|
||||
sendMail('supportdev@scores-decisions.com', 'suivi@scores-decisions.com', 'JO Association', $message);
|
||||
echo date('Y/m/d - H:i:s') .' - Tentative de récupération des annonces...'. EOL;
|
||||
}
|
||||
} else {
|
||||
// On recherche si nous n'avons pas déjà toutes ces annonces en base !
|
||||
$dateDb=substr($dateCour,0,4).'-'.substr($dateCour,4,2).'-'.substr($dateCour,6,2);
|
||||
$dateDerParution=WDate::dateT('Y-m-d', 'd/m/Y',$dateDb);
|
||||
if ($depotComptes) {
|
||||
switch ($region) {
|
||||
case 'ASSOCIATION%2FCOMPTE': $strRegSql=" AND typeAsso='ASS' "; break;
|
||||
case 'FONDATION%2FCOMPTE': $strRegSql=" AND typeAsso='FON' "; break;
|
||||
case 'FONDS+DE+DOTATION%2FCOMPTE': $strRegSql=" AND typeAsso='FOD' "; break;
|
||||
case 'AUTRE%2FCOMPTE': $strRegSql=" AND typeAsso='DIV' "; break;
|
||||
}
|
||||
$AnnDb=$iDb->select('asso_bilans', 'count(*) AS nb', "Assoc_Date_Declaration='$dateDb' $strRegSql", false, MYSQL_ASSOC);
|
||||
$strJO='depôts des comptes associations';
|
||||
} else {
|
||||
$AnnDb=$iDb->select('asso', 'count(*) AS nb', "Date_Parution='$dateDb'", false, MYSQL_ASSOC);
|
||||
$strJO='associations';
|
||||
}
|
||||
$nbAnnDb=$AnnDb[0]['nb'];
|
||||
if ($nbAnnDb>=$nbAnnonces) {
|
||||
echo mysql_error().EOL;
|
||||
echo date('Y/m/d - H:i:s') ." - Les $nbAnnonces annonces $strJO $reg5 du $dateDerParution ($dateDb) sont en base ($nbAnnDb) !". EOL;
|
||||
randsleep($tempsMinEntreRequetes, $tempsMaxEntreRequetes);
|
||||
continue;
|
||||
}
|
||||
elseif ($nbAnnDb>0 && $nbAnnDb<$nbAnnonces) {
|
||||
$message.=date('Y/m/d - H:i:s') ." - ATTENTION : Il n'y a que $nbAnnDb annonce(s) $strJO en base sur les $nbAnnonces annonces présentes au JO du $dateDerParution !". EOL;
|
||||
echo date('Y/m/d - H:i:s') ." - ATTENTION : Il n'y a que $nbAnnDb annonce(s) $strJO en base sur les $nbAnnonces annonces présentes au JO du $dateDerParution !". EOL;
|
||||
echo date('Y/m/d - H:i:s') .' - Tentative de récupération des annonces...'. EOL;
|
||||
}
|
||||
else {
|
||||
$message.=date('Y/m/d - H:i:s') ." - Il y a $nbAnnDb annonce(s) $strJO $reg5 en base sur les $nbAnnonces annonces présentes au JO du $dateDerParution !". EOL;
|
||||
echo date('Y/m/d - H:i:s') ." - Il y a $nbAnnDb annonce(s) $strJO $reg5 en base sur les $nbAnnonces annonces présentes au JO du $dateDerParution !". EOL;
|
||||
}
|
||||
}
|
||||
|
||||
$tabAnnonces=explode('<div class="hr"><hr/></div>', utf8_encode($page['body']));
|
||||
|
||||
for ($j=1; $j<26 && isset($tabAnnonces[$j]); $j++)
|
||||
$tabAnn[$j-1]=$tabAnnonces[$j];
|
||||
randsleep($tempsMinEntreRequetes, $tempsMaxEntreRequetes);
|
||||
$referer=$url;
|
||||
for ($i=2; $i<=$nbPages; $i++)
|
||||
{
|
||||
if (!$lastJO) {
|
||||
$data='';
|
||||
$date1=str_replace('/', '%2F', WDate::dateT('Ymd', 'd/m/Y',$dateCour));
|
||||
if ($depotComptes)
|
||||
$date2=str_replace('/', '%2F', WDate::dateT('Ymd', 'd/m/Y',getNextDate($dateCour,0)));
|
||||
else
|
||||
$date2=str_replace('/', '%2F', WDate::dateT('Ymd', 'd/m/Y',getNextDate($dateCour)));
|
||||
$url='http://www.journal-officiel.gouv.fr/association/index.php?ctx='.$ctx.'&page='.$i.'&JRE_ID='.urlencode($region).'&JPA_D_D='.$date1.'&JPA_D_F='.$date2;
|
||||
|
||||
} else {
|
||||
$date1='';$date2='';$data='1';
|
||||
$url='http://www.journal-officiel.gouv.fr/association/index.php?ctx='.$ctx.'&page='.$i;
|
||||
}
|
||||
|
||||
$page=getUrl($url, '', '', $referer, false, 'www.journal-officiel.gouv.fr');
|
||||
$tabAnnonces=explode('<div class="hr"><hr/></div>', utf8_encode($page['body']));
|
||||
|
||||
|
||||
for ($j=1; $j<26; $j++) {
|
||||
$k=$j+(25*($i-1))-1;
|
||||
if ($k<$nbAnnonces)
|
||||
$tabAnn[$k]=$tabAnnonces[$j];
|
||||
}
|
||||
flush();
|
||||
if ($i==2)
|
||||
echo date('Y/m/d - H:i:s') ." - Page $i/$nbPages";
|
||||
else
|
||||
echo ", $i/$nbPages";
|
||||
if ($i==$nbPages)
|
||||
echo '.'.EOL;
|
||||
else
|
||||
randsleep($tempsMinEntreRequetes, $tempsMaxEntreRequetes);
|
||||
}
|
||||
|
||||
$tabActivites=array();
|
||||
for ($i=0; $i<$nbAnnonces; $i++) {
|
||||
$infoAnnBalo=getInfosAnnonceAsso($tabAnn[$i], $depotComptes);
|
||||
$tabInfos=array();
|
||||
preg_match_all("|<i>(.*)</i>|U", $infoAnnBalo['Annonce_Html'], $tabInfos);
|
||||
$tabInfosGlobal=array_unique(array_merge($tabInfosGlobal, $tabInfos[1]));
|
||||
// On recherche si nous n'avons pas déjà cette annonce en base !
|
||||
if ($depotComptes) {
|
||||
$AnnDb=$iDb->select('asso_bilans', 'count(*) AS nb', "Siren=".$infoAnnBalo['Siren']." AND Waldec='".$infoAnnBalo['Waldec']."' AND dateCloture='".$infoAnnBalo['dateCloture']."'", false, MYSQL_ASSOC);
|
||||
// $AnnDb[0][0]=0;
|
||||
} else {
|
||||
$AnnDb=$iDb->select('asso', 'count(*) AS nb', "Num_Annonce='".$infoAnnBalo['Num_Annonce']."' AND Date_Parution='".$infoAnnBalo['Date_Parution']."' AND Num_Parution='".$infoAnnBalo['Num_Parution']."'", false, MYSQL_ASSOC);
|
||||
$dateAff=$infoAnnBalo['Date_Parution'];
|
||||
}
|
||||
$nbAnnDb=$AnnDb[0]['nb'];
|
||||
$i2=$i+1;
|
||||
$strRegion=', '. $region;
|
||||
|
||||
if ($depotComptes) {
|
||||
$table='asso_bilans';
|
||||
// Si le bilan PDF n'est pas déjà sur le disk, on va le chercher !
|
||||
switch ($region) {
|
||||
case 'ASSOCIATION%2FCOMPTE': $infoAnnBalo['typeAsso']='ASS'; break;
|
||||
case 'FONDATION%2FCOMPTE': $infoAnnBalo['typeAsso']='FON'; break;
|
||||
case 'FONDS+DE+DOTATION%2FCOMPTE': $infoAnnBalo['typeAsso']='FOD'; break;
|
||||
case 'AUTRE%2FCOMPTE':
|
||||
default: $infoAnnBalo['typeAsso']='DIV'; break;
|
||||
}
|
||||
$dateAff=$dateCour.' ('.$infoAnnBalo['dateCloture'].')';
|
||||
$infoAnnBalo['Assoc_Date_Declaration']=$dateCour;
|
||||
$tabPdf=getPdfInfo($repPdfAssoCpt.'/'.basename($infoAnnBalo['pdfLink']));
|
||||
if (!$tabPdf) {
|
||||
$page=getUrl('http://www.journal-officiel.gouv.fr/'.$infoAnnBalo['pdfLink'], '', '', '', false);
|
||||
$fp = fopen($repPdfAssoCpt.'/'.basename($infoAnnBalo['pdfLink']), 'w');
|
||||
if ($fp === false ) {
|
||||
$message.=date('Y/m/d - H:i:s') .' - ERREUR : Problème de création du PDF '. basename($infoAnnBalo['pdfLink']) ." pour la parution du $dateAff $strRegion, Annonce $i2/$nbAnnonces, Association \"". $infoAnnBalo['Assoc_Nom'] .'" !'.EOL;
|
||||
echo date('Y/m/d - H:i:s') .' - ERREUR : Problème de création du PDF '. basename($infoAnnBalo['pdfLink']) ." pour la parution du $dateAff $strRegion, Annonce $i2/$nbAnnonces, Association \"". $infoAnnBalo['Assoc_Nom'] .'" !'.EOL;
|
||||
} else {
|
||||
fwrite($fp, $page['body']);
|
||||
fclose($fp);
|
||||
}
|
||||
$tabPdf=getPdfInfo($repPdfAssoCpt.'/'.basename($infoAnnBalo['pdfLink']));
|
||||
randsleep($tempsMinEntreRequetes, $tempsMaxEntreRequetes);
|
||||
}
|
||||
$infoAnnBalo['pdfSize'] = $tabPdf['pdfSize'];
|
||||
$infoAnnBalo['pdfVer'] = $tabPdf['version'];
|
||||
$infoAnnBalo['pdfPage'] = $tabPdf['nbPages'];
|
||||
} else {
|
||||
$table='asso';
|
||||
$tabTmp=explode('/',$infoAnnBalo['Activite']);
|
||||
$tabActivites=array_merge($tabActivites, $tabTmp);
|
||||
}
|
||||
if ($nbAnnDb==1) {
|
||||
echo date('Y/m/d - H:i:s') ." - Parution du $dateAff $strRegion, Annonce $i2/$nbAnnonces, Association \"". $infoAnnBalo['Assoc_Nom'] .'" déjà en base !'.EOL;
|
||||
// L'annonce est déjà en base !
|
||||
continue;
|
||||
} else {
|
||||
$message.=date('Y/m/d - H:i:s') ." - Parution du $dateAff $strRegion, Annonce $i2/$nbAnnonces, Association \"". $infoAnnBalo['Assoc_Nom'] .'"... enregistrement'.EOL;
|
||||
echo date('Y/m/d - H:i:s') ." - Parution du $dateAff $strRegion, Annonce $i2/$nbAnnonces, Association \"". $infoAnnBalo['Assoc_Nom'] .'"... enregistrement'.EOL;
|
||||
}
|
||||
|
||||
if (!$iDb->insert($table, $infoAnnBalo))
|
||||
echo date ('Y/m/d - H:i:s') .' - ERREUR : MySql n°'. mysql_errno() .') : '. mysql_error() . EOL;
|
||||
}
|
||||
|
||||
if ($lastJO) {
|
||||
print_r($tabInfosGlobal);
|
||||
echo date('Y/m/d - H:i:s') .' - FIN du script'. EOL;
|
||||
die();
|
||||
}
|
||||
unset($tabAnn);
|
||||
} // Fin boucle région
|
||||
if ($depotComptes)
|
||||
$dateCour=getNextDate($dateCour,1);
|
||||
else
|
||||
$dateCour=getNextDate($dateCour);
|
||||
|
||||
} // Fin boucle Data
|
||||
|
||||
if ($depotComptes) {
|
||||
//
|
||||
$AnnDb=$iDb->select('annonces', 'MAX(dateSource) AS dateMAJ', "typeEven=3200", false, MYSQL_ASSOC);
|
||||
$dateMaj=$AnnDb[0]['dateMAJ'];
|
||||
// echo date('Y/m/d - H:i:s') ." - Dernière mise à jour des annonces dépots en collecte en date du $dateMaj.".EOL;
|
||||
|
||||
$AnnDb=$iDb->select('asso_bilans',
|
||||
"Assoc_Nom AS raisonSociale, siren, sirenValide, dateCloture AS dateEffetFinP, Assoc_Date_Declaration AS dateJugement, dateInsert AS dateSource,
|
||||
'3200' AS typeEven, 'DJOFFJ' AS tribunal, 'JS' AS source, Waldec",
|
||||
"dateInsert>'$dateMaj' ORDER BY dateEffetFinP DESC", false, MYSQL_ASSOC);
|
||||
$nbAnnonces=count($AnnDb);
|
||||
$message.=date('Y/m/d - H:i:s') ." - Il y a $nbAnnonces annonces dépots à mettre en collecte en date du $dateMaj.".EOL;
|
||||
echo date('Y/m/d - H:i:s') ." - Il y a $nbAnnonces annonces dépots à mettre en collecte en date du $dateMaj.".EOL;
|
||||
|
||||
foreach ($AnnDb as $i=>$tabInsert) {
|
||||
$tabTmp=$iInsee->getIdentiteLight($tabInsert['siren']);
|
||||
$tabInsert['adresse'] = $tabTmp['Adresse'];
|
||||
$tabInsert['codePostal']= $tabTmp['CP'];
|
||||
$tabInsert['ville'] = $tabTmp['Ville'];
|
||||
$tabInsert['dateInsert']= date('YmdHis');
|
||||
if (trim($tabInsert['Waldec'])<>'')
|
||||
$tabInsert['complement']= 'Identifiant Waldec : '.$tabInsert['Waldec'];
|
||||
unset($tabInsert['Waldec']);
|
||||
//print_r($tabInsert);
|
||||
//die();
|
||||
if (!$iDb->insert('annonces', $tabInsert))
|
||||
echo '';//date ('Y/m/d - H:i:s') .' - ERREUR : MySql n°'. mysql_errno() .') : '. mysql_error() . EOL;
|
||||
}
|
||||
sendMail('supportdev@scores-decisions.com', 'suivi@scores-decisions.com', '[CHARGEMENT] JO Association Comptes', $message);
|
||||
}
|
||||
|
||||
echo date('Y/m/d - H:i:s') .' - FIN du script.'. EOL;
|
@ -1,119 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Récupère les bilans au format PDF
|
||||
* 15 19 * * 1-5 /var/www/batch/fedasoBilans.php -d >> /var/www/log/fedasoBilans.log
|
||||
*/
|
||||
|
||||
// --- Define path to application directory
|
||||
defined('APPLICATION_PATH')
|
||||
|| define('APPLICATION_PATH', realpath(__DIR__ . '/../application'));
|
||||
|
||||
// --- Define application environment
|
||||
defined('APPLICATION_ENV')
|
||||
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
|
||||
|
||||
// --- Composer autoload
|
||||
require_once realpath(__DIR__ . '/../vendor/autoload.php');
|
||||
|
||||
// --- Create application, bootstrap, and run
|
||||
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
|
||||
|
||||
//Options
|
||||
try {
|
||||
$opts = new Zend_Console_Getopt(array(
|
||||
'help|?' => "Displays usage information.",
|
||||
'source' => "source (extranet)",
|
||||
'debug' => "Mode debug",
|
||||
));
|
||||
$opts->parse();
|
||||
} catch (Zend_Console_Getopt_Exception $e) {
|
||||
echo $e->getUsageMessage();
|
||||
exit;
|
||||
}
|
||||
|
||||
//Usage
|
||||
if( isset($opts->help) || count($opts->getOptions())==0 )
|
||||
{
|
||||
echo "Gestion des échanges de bilan saisie.\n";
|
||||
echo $opts->getUsageMessage();
|
||||
exit;
|
||||
}
|
||||
|
||||
$c = new Zend_Config($application->getOptions());
|
||||
$db = Zend_Db::factory($c->profil->db->metier);
|
||||
Zend_Db_Table_Abstract::setDefaultAdapter($db);
|
||||
|
||||
$pathSend = $c->profil->path->shared . '/clients/bilansext/send';
|
||||
$pathBackup = $c->profil->path->shared . '/clients/bilansext/send/done';
|
||||
|
||||
// Lecture du dossier des dépots de bilans à demander en saisie
|
||||
if ($opts->source == 'extranet')
|
||||
{
|
||||
echo date('Y-m-d H:i:s') ." - Chargement bilan source extranet.\n";
|
||||
|
||||
$dh = opendir($pathSend);
|
||||
while (false !== ($filename = readdir($dh)))
|
||||
{
|
||||
if ($filename != '.' && $filename != '..' && substr($filename, -4) == '.pdf')
|
||||
{
|
||||
if (preg_match('/([0-9]{9})_([CNS])([0-9]{8})_([0-9]{2})_([0-9]{1})_([0-9]{1,})_([0-9]{1,}).pdf/', $filename, $t))
|
||||
{
|
||||
$filetime = date('YmdHis', filectime($pathSend.'/'.$filename));
|
||||
|
||||
$siren = $t[1];
|
||||
$format = $t[2];
|
||||
$cloture = $t[3];
|
||||
$duree = $t[4];
|
||||
$confidentiel = $t[5];
|
||||
$userId = $t[6];
|
||||
$extranetId = $t[7];
|
||||
|
||||
if ( false !== ( $file = file_get_contents($pathSend.'/'.$filename) ) )
|
||||
{
|
||||
//Number of page
|
||||
$pages = preg_match_all( "/\/Page\W/", $file, $matches );
|
||||
|
||||
//Pdf size
|
||||
$size = filesize($pathSend.'/'.$filename);
|
||||
}
|
||||
|
||||
$dataInsert = array(
|
||||
'siren' => $siren,
|
||||
'dateCloture' => $cloture,
|
||||
'format' => $format,
|
||||
'duree' => $duree,
|
||||
'confidentiel' => $confidentiel,
|
||||
'idUtilisateur' => $userId,
|
||||
'idExtranet' => $extranetId,
|
||||
'environnement' => '',
|
||||
'refDoc' => $filename,
|
||||
'dateEntree' => $filetime,
|
||||
'dateEnvoi' => date('YmdHis'),
|
||||
'pdfNum' => 0,
|
||||
'pdfSize' => $size,
|
||||
'pdfPage' => $pages,
|
||||
);
|
||||
|
||||
$insertOk = false;
|
||||
try {
|
||||
$db->insert('sdv1.fedaso_bilans', $dataInsert);
|
||||
$insertOk = true;
|
||||
} catch (Zend_Db_Exception $e) {
|
||||
//Doublon
|
||||
if ($e->getCode() == '1062') {
|
||||
$insertOk = false;
|
||||
}
|
||||
}
|
||||
|
||||
//Copier le fichier
|
||||
if ($insertOk === true) {
|
||||
if (!rename($pathSend.'/'.$filename, $pathBackup.'/'.$filename)) {
|
||||
echo date('Y-m-d H:i:s') ." - Impossible de déplacer le fichier $filename.\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo date('Y-m-d H:i:s') ." - FIN du script.\n";
|
@ -1,266 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Chargement des fichiers en provenance de GE FactoFrance
|
||||
* Les fichiers sont disponible dans le répertoire de stockage avec une date pour historisation
|
||||
* Liste des fichiers :
|
||||
* - GESCDACH
|
||||
* - GESCDCLT
|
||||
* - GESCDMVT
|
||||
* Execution entre le 5 et le 8 du mois toutes les 4 heures ?
|
||||
*/
|
||||
ini_set('auto_detect_line_endings', true);
|
||||
|
||||
// --- Define path to application directory
|
||||
defined('APPLICATION_PATH')
|
||||
|| define('APPLICATION_PATH', realpath(__DIR__ . '/../application'));
|
||||
|
||||
// --- Define application environment
|
||||
defined('APPLICATION_ENV')
|
||||
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
|
||||
|
||||
// --- Composer autoload
|
||||
require_once realpath(__DIR__ . '/../vendor/autoload.php');
|
||||
|
||||
// --- Create application, bootstrap, and run
|
||||
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
|
||||
|
||||
//Options
|
||||
try {
|
||||
$opts = new Zend_Console_Getopt(array(
|
||||
'help|?' => "Displays usage information.",
|
||||
'cron' => "Launch in cron",
|
||||
'file=s' => "Specify file name to execute manually",
|
||||
'debug' => "Mode debug",
|
||||
));
|
||||
$opts->parse();
|
||||
} catch (Zend_Console_Getopt_Exception $e) {
|
||||
echo $e->getUsageMessage();
|
||||
exit;
|
||||
}
|
||||
|
||||
//Usage
|
||||
if( isset($opts->help) || count($opts->getOptions())==0 )
|
||||
{
|
||||
echo "Chargement des fichiers en provenance de GE FactoFrance.".PHP_EOL;
|
||||
echo $opts->getUsageMessage();
|
||||
exit;
|
||||
}
|
||||
|
||||
$c = new Zend_Config($application->getOptions());
|
||||
$db = Zend_Db::factory($c->profil->db->metier);
|
||||
Zend_Db_Table_Abstract::setDefaultAdapter($db);
|
||||
|
||||
$tabFile = array();
|
||||
|
||||
//Lire le nom du fichier depuis la ligne de commande
|
||||
if ( $opts->file ) {
|
||||
if ( empty($opts->file) ) {
|
||||
echo date('Y-m-d H:i:s') . " - Aucun fichier définit !".PHP_EOL;
|
||||
exit;
|
||||
}
|
||||
|
||||
$tabFile[] = $opts->file;
|
||||
}
|
||||
|
||||
//Lire la table flux_filein (Nom du fichier, nombre de ligne)
|
||||
if ( $opts->cron ) {
|
||||
$fluxinM = new Application_Model_Sdv1FluxFileIn();
|
||||
$sql = $fluxinM->select()
|
||||
->where('client=?', 'gefacto')
|
||||
->where('name=?', 'GEFACTO')
|
||||
->where('depotType=?', 'SFTP')
|
||||
->where('dateExecute=?','0000-00-00 00:00:00')
|
||||
->order('dateInsert DESC');
|
||||
|
||||
$pitems = $fluxinM->fetchAll($sql);
|
||||
foreach ( $pitems as $p ) {
|
||||
$tabFile[] = $p->depotFile;
|
||||
}
|
||||
}
|
||||
|
||||
if ( count($tabFile)==0 ) {
|
||||
echo date('Y-m-d H:i:s') . " - Aucun fichier à traiter !".PHP_EOL;
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once APPLICATION_PATH . '/configs/config.php';
|
||||
require_once 'framework/fwk.php';
|
||||
require_once 'framework/mail/sendMail.php';
|
||||
|
||||
foreach ($tabFile as $filename)
|
||||
{
|
||||
$path = $c->profil->path->shared . '/clients/gefacto/send';
|
||||
$file = $path . '/' . $filename;
|
||||
|
||||
//Check fichier
|
||||
if ( file_exists($file) ) {
|
||||
|
||||
$dateFichier = date('YmdHis', filemtime($file));
|
||||
|
||||
echo date('Y-m-d H:i:s') . " - Chargement des Informations de Paiement ".basename($file).PHP_EOL;
|
||||
|
||||
//Ouvrir le fichier
|
||||
$fp = fopen($file, 'r');
|
||||
|
||||
if (!$fp) {
|
||||
echo date('Y-m-d H:i:s') . " - Impossible de lire le fichier !".PHP_EOL;
|
||||
exit;
|
||||
}
|
||||
|
||||
//Calcul du nombre de ligne du fichier
|
||||
$nbLines = 0;
|
||||
while (($buffer = fgets($fp)) !== false)
|
||||
{
|
||||
$nbLines++;
|
||||
|
||||
//Détection de la longueur de la première ligne
|
||||
$lineLength = strlen($buffer);
|
||||
if ( $lineLength<=30 ) {
|
||||
$fileType = 1; $dbTableUpdate = 'ge_cs2';
|
||||
} elseif ( $lineLength==122 ) {
|
||||
$fileType = 0; $dbTableUpdate = 'ge_acheteurs';
|
||||
} elseif ( $lineLength==75 ) {
|
||||
$fileType = 2; $dbTableUpdate = 'ge_paiements';
|
||||
}
|
||||
//Erreur
|
||||
else {
|
||||
echo date('Y-m-d H:i:s') . " - Erreur : Première ligne de taille $lineLength non gérée !".PHP_EOL;
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($opts->debug) echo date('Y-m-d H:i:s') . " - Ligne $nbLines".PHP_EOL;
|
||||
|
||||
}
|
||||
|
||||
//Retour au début du fichier
|
||||
rewind($fp);
|
||||
|
||||
//Executer les chargements
|
||||
|
||||
$iDb = new WDB();
|
||||
$iInsee = new Metier_Insee_MInsee($iDb);
|
||||
|
||||
$iFacto = new Metier_Partenaires_MFacto();
|
||||
$iFacto->setTypeFic($fileType);
|
||||
if ( $fileType==1 ) {
|
||||
$iDb->update('sdv1.'.$dbTableUpdate, array('indTrt'=>0),'1');
|
||||
}
|
||||
|
||||
$nbSiretInvalides = 0;
|
||||
$nbSiretValides = 0;
|
||||
$cptLine = $nbInsert = $nbUpdate = 0;
|
||||
while (($buffer = fgets($fp)) !== false) {
|
||||
$cptLine++;
|
||||
|
||||
if ($opts->debug) echo date('Y-m-d H:i:s') . " - Ligne $cptLine / $nbLines".PHP_EOL;
|
||||
|
||||
$dateInsert = date('YmdHis');
|
||||
|
||||
$a = $iFacto->readFic($buffer);
|
||||
|
||||
//Vérification du Siren/Siret
|
||||
if ( $dbTableUpdate=='sdv1.ge_acheteurs' )
|
||||
{
|
||||
if (!$iInsee->valideSiren($a['SIRENE']))
|
||||
{
|
||||
$a['sirenValide'] = 0;
|
||||
$nbSiretInvalides++;
|
||||
}
|
||||
else
|
||||
{
|
||||
$a['sirenValide'] = 1;
|
||||
$nbSiretValides++;
|
||||
}
|
||||
}
|
||||
|
||||
//Siren pour la table ge_paiements
|
||||
if ( $dbTableUpdate == 'ge_paiements' )
|
||||
{
|
||||
$result = $iDb->select('sdv1.ge_acheteurs', 'SIRENE', 'NUMACH='.$a['NUMACH']);
|
||||
if (count($result) > 0)
|
||||
{
|
||||
$a['siren'] = $result[0]['SIRENE'];
|
||||
}
|
||||
}
|
||||
|
||||
//Insertion dans l'historique
|
||||
if ( $dbTableUpdate == 'ge_cs2' )
|
||||
{
|
||||
$iDb->insert('historiques.'.$dbTableUpdate, array_merge($a, array('dateInsert'=>$dateInsert, 'dateConf'=>$dateFichier)));
|
||||
if (mysql_errno()>0 && mysql_errno()<>1062) die("Table = $dbTableUpdate".PHP_EOL.mysql_error().PHP_EOL);
|
||||
}
|
||||
|
||||
//Insertion dans la table
|
||||
if ( $iDb->insert('sdv1.'.$dbTableUpdate, array_merge($a, array('dateInsert'=>$dateInsert))) )
|
||||
{
|
||||
$nbInsert++;
|
||||
}
|
||||
elseif ( $dbTableUpdate=='ge_cs2' )
|
||||
{
|
||||
$ret = $iDb->select('sdv1.'.$dbTableUpdate, 'cs, dateFin*1 AS dateFin', 'siren='.$a['siren'], false, MYSQL_ASSOC);
|
||||
if ( count($ret)>0 )
|
||||
{
|
||||
$csPre = $ret[0]['cs'];
|
||||
$datePre = $ret[0]['dateFin'];
|
||||
if ($a['cs']<>$csPre || $a['dateFin']<>$datePre) {
|
||||
$iDb->update('sdv1.'.$dbTableUpdate, array_merge($a, array(
|
||||
'dateConf' => $dateFichier,
|
||||
'csPre' => $csPre,
|
||||
'dateCsPre' => $datePre,
|
||||
'dateModifCS' => $dateFichier,
|
||||
'dateUpdate' => $dateInsert,
|
||||
'indTrt'=> 1)
|
||||
),'siren='.$a['siren']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$iDb->update('sdv1.'.$dbTableUpdate, array_merge($a, array(
|
||||
'dateConf'=>$dateFichier,
|
||||
'indTrt'=>1)
|
||||
), 'siren='.$a['siren']);
|
||||
}
|
||||
if (mysql_errno()>0) {
|
||||
if ($opts->debug) echo date('Y-m-d H:i:s') . " - Erreur SQL ".mysql_errno().' : '.mysql_error()." sur $dbTableUpdate pour ".print_r($a);
|
||||
}
|
||||
$nbUpdate++;
|
||||
}
|
||||
}
|
||||
elseif ( $dbTableUpdate=='ge_acheteurs' )
|
||||
{
|
||||
$iDb->update('sdv1.'.$dbTableUpdate, array_merge($a, array('dateUpdate'=>$dateInsert)), 'NUMACH='.$a['NUMACH']);
|
||||
if (mysql_errno()>0) {
|
||||
if ($opts->debug) echo date('Y-m-d H:i:s') . " - Erreur SQL ".mysql_errno().' : '.mysql_error()." sur $dbTableUpdate pour ".print_r($a);
|
||||
}
|
||||
$nbUpdate++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($opts->debug) echo date('Y-m-d H:i:s') . " - Erreur SQL ".mysql_errno().' : '.mysql_error()." sur $dbTableUpdate pour ".print_r($a);
|
||||
}
|
||||
}
|
||||
|
||||
//Fermeture du fichier
|
||||
fclose($fp);
|
||||
|
||||
echo date('Y-m-d H:i:s') . " - $nbLines lignes traitées dont $nbSiretInvalides siren/siret invalides !".PHP_EOL;
|
||||
echo date('Y-m-d H:i:s') . " - Le fichier ".basename($file)." vient d'être chargé : $nbInsert ajouts et $nbUpdate MAJ !".PHP_EOL;
|
||||
if ($dbTableUpdate=='ge_cs2') {
|
||||
$iDb->update('sdv1.'.$dbTableUpdate, array('dateSuppr'=>$dateInsert), 'indTrt=0');
|
||||
}
|
||||
|
||||
$iDb->update('sdv1.flux_filein', array('dateExecute'=>date('YmdHis')), "name='GEFACTO' AND depotFile='".basename($file)."'", false);
|
||||
echo date('Y-m-d H:i:s') . " - Le fichier ".basename($file)." vient d'être marqué traité.".PHP_EOL;
|
||||
|
||||
$message = "Le fichier ".basename($file)." vient d'être chargé :\r\n";
|
||||
$message.= "$nbInsert ajouts et $nbUpdate mises à jours sur $nbLines lignes ($nbSiretInvalides siren/siret invalides).".PHP_EOL;
|
||||
|
||||
sendMail('production@scores-decisions.com', 'support@scores-decisions.com,ylenaour@scores-decisions.com', '[CHARGEMENT] Informations de Paiement', $message);
|
||||
|
||||
echo date('Y-m-d H:i:s') . " - Fin du chargement des Informations de Paiement ".basename($file).PHP_EOL;
|
||||
|
||||
} else {
|
||||
|
||||
echo date('Y-m-d H:i:s') . " - Fichier $file inexistant !".PHP_EOL;
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user