Compare commits
12 Commits
defaillanc
...
develop
Author | SHA1 | Date | |
---|---|---|---|
|
3f003800fd | ||
|
0727603bac | ||
|
97b7b45248 | ||
|
3f7a1deba5 | ||
|
ba51eed034 | ||
|
8af826eb9b | ||
|
92a523e7a7 | ||
|
d5e9d3a753 | ||
|
7aa9f88661 | ||
|
501501693d | ||
|
ed7f18505b | ||
|
1477aae85b |
391
bin/library-cache.php
Executable file
391
bin/library-cache.php
Executable file
@ -0,0 +1,391 @@
|
||||
<?php
|
||||
require_once realpath(__DIR__ . '/../../../../application/bin.bootstrap.php');
|
||||
|
||||
// --- Options
|
||||
$displayUsage = false;
|
||||
try {
|
||||
$opts = new Zend_Console_Getopt(array(
|
||||
'help|?' => "Aide.",
|
||||
'list' => "List item.",
|
||||
'generate|g=s' => "Generate the specify cache.",
|
||||
));
|
||||
$opts->parse();
|
||||
$optionsNb = count($opts->getOptions());
|
||||
} catch (Zend_Console_Getopt_Exception $e) {
|
||||
$displayUsage = true;
|
||||
}
|
||||
|
||||
// --- Aide / Options
|
||||
if ($optionsNb == 0 || isset($opts->help)) {
|
||||
$displayUsage = true;
|
||||
}
|
||||
|
||||
// --- Usage
|
||||
if ($displayUsage) {
|
||||
echo "\nGénération Table Static Metier\n\n";
|
||||
echo $opts->getUsageMessage();
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( $opts->list ) {
|
||||
$tabItems = array(
|
||||
'Tribunaux' => "Tribunaux",
|
||||
'FctDir' => "Fonctions de direction",
|
||||
'Evenements' => "Table des evenements bodacc",
|
||||
'Devises' => "Table des devises bodacc",
|
||||
'RncsTribunaux' => "Table des tribunaux",
|
||||
'DevisesInpi' => "Devises Inpi",
|
||||
'Jugements' => "Jugements",
|
||||
'PaysInpi' => "PaysInpi",
|
||||
'CodesNaf' => "Codes Naf",
|
||||
'CodesNace' => "Codes Nace",
|
||||
'CodesNafa' => "Codes Nafa",
|
||||
'CodesFJ' => "Codes Formes Juridiques",
|
||||
'AffairesTypes' => "Codes natures des contentieux",
|
||||
'ProcolDelete' => "Codes effacement de procol",
|
||||
);
|
||||
echo "\n";
|
||||
foreach ( $tabItems as $code => $label ) {
|
||||
echo "\t" . $code . " => ". $label . PHP_EOL;
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cache des Tribunaux Bodacc
|
||||
*/
|
||||
if( $opts->generate == 'Tribunaux' ) {
|
||||
|
||||
$sql = "SELECT triCode, triNom, LPAD(triCP,5,0) AS triCP, triSiret FROM jo.tribunaux WHERE triCode IS NOT NULL";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
||||
|
||||
$fp = fopen(APPLICATION_PATH . '/../vendor/scores/library/src/Metier/Table/BodaccTribunaux.php','w');
|
||||
fwrite($fp, "<?php\n");
|
||||
fwrite($fp, "return array(\n");
|
||||
|
||||
if ($stmt->rowCount() > 0) {
|
||||
foreach($result as $item) {
|
||||
$dep = substr($item->triCP, 0, 2);
|
||||
if ($dep == 97 || $dep == 98) {
|
||||
$dep = substr($item->triCP, 0, 3);
|
||||
}
|
||||
fwrite($fp, "\t'" . $item->triCode . "' => array(");
|
||||
fwrite($fp, "'nom'=>\"" . $item->triNom . "\", 'siret'=>\"".$item->triSiret."\", 'dep'=>\"".$dep."\"");
|
||||
fwrite($fp, "),\n");
|
||||
}
|
||||
}
|
||||
fwrite($fp, ");\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* Cache Fonctions de Direction
|
||||
*/
|
||||
if ( $opts->generate == 'FctDir' ) {
|
||||
|
||||
$sql = "SELECT codeFct, libelle FROM jo.bodacc_fonctions";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
||||
|
||||
$fp=fopen(APPLICATION_PATH . '/../vendor/scores/library/src/Metier/Table/FctDir.php','w');
|
||||
fwrite($fp, "<?php\n");
|
||||
fwrite($fp, "return array(\n");
|
||||
|
||||
if ($stmt->rowCount() > 0) {
|
||||
foreach($result as $item) {
|
||||
fwrite($fp, "\t'" . intval($item->codeFct) . "' => \"". $item->libelle . "\",\n");
|
||||
}
|
||||
}
|
||||
fwrite($fp, ");\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* Cache Evenements
|
||||
*/
|
||||
if ( $opts->generate == 'Evenements' ) {
|
||||
|
||||
$sql = "SELECT codEven, libEven, Bodacc_Code, Rubrique, version, lienEtab FROM jo.tabEvenements";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
||||
|
||||
$fp = fopen(APPLICATION_PATH . '/../vendor/scores/library/src/Metier/Table/Evenements.php','w');
|
||||
fwrite($fp, "<?php\n");
|
||||
fwrite($fp, "return array(\n");
|
||||
|
||||
if ($stmt->rowCount() > 0) {
|
||||
foreach($result as $item) {
|
||||
fwrite($fp, "\t'" . intval($item->codEven) . "' => array(\n");
|
||||
|
||||
fwrite($fp, "\t\t'libEven' => \"" . $item->libEven . "\",\n");
|
||||
fwrite($fp, "\t\t'Bodacc_Code' => \"" . $item->Bodacc_Code . "\",\n");
|
||||
fwrite($fp, "\t\t'Rubrique' => \"" . $item->Rubrique . "\",\n");
|
||||
fwrite($fp, "\t\t'Version' => " . $item->version . ",\n");
|
||||
fwrite($fp, "\t\t'LienEtab' => " . $item->lienEtab . ",\n");
|
||||
|
||||
fwrite($fp, "\t),\n");
|
||||
}
|
||||
}
|
||||
fwrite($fp, ");\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* Cache des devises Bodacc
|
||||
*/
|
||||
if ( $opts->generate == 'Devises' ) {
|
||||
|
||||
$sql = "SELECT libDeviseBodacc, devIso FROM jo.bodacc_devises";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
||||
|
||||
$fp = fopen(APPLICATION_PATH . '/../vendor/scores/library/src/Metier/Table/Devises.php','w');
|
||||
fwrite($fp, "<?php\n");
|
||||
fwrite($fp, "return array(\n");
|
||||
|
||||
if ($stmt->rowCount() > 0) {
|
||||
foreach($result as $item) {
|
||||
fwrite($fp, "\t\"" . $item->libDeviseBodacc . "\" => \"" . $item->devIso ."\",\n");
|
||||
}
|
||||
}
|
||||
fwrite($fp, ");\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* Cache Tribunaux RNCS
|
||||
*/
|
||||
if ( $opts->generate == 'RncsTribunaux' ) {
|
||||
|
||||
$sql = "SELECT triNumGreffe, triNom, triId, triCode FROM jo.tribunaux WHERE triNumGreffe IS NOT NULL";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
||||
|
||||
$fp = fopen(APPLICATION_PATH . '/../vendor/scores/library/src/Metier/Table/RncsTribunaux.php','w');
|
||||
fwrite($fp, "<?php\n");
|
||||
fwrite($fp, "return array(\n");
|
||||
|
||||
if ($stmt->rowCount() > 0) {
|
||||
foreach($result as $item) {
|
||||
fwrite($fp, "\t" . intval($item->triNumGreffe) . " => array(");
|
||||
fwrite($fp, "'Id'=>\"" . intval($item->triId) . "\", 'Nom'=>\"".$item->triNom."\", 'Code'=>\"".$item->triCode."\"");
|
||||
fwrite($fp, "),\n");
|
||||
}
|
||||
}
|
||||
fwrite($fp, ");\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* Cache Devises Inpi
|
||||
*/
|
||||
if ( $opts->generate == 'DevisesInpi' ) {
|
||||
|
||||
$sql = "SELECT devInpi, devIso FROM jo.tabDevises WHERE devInpi>0 ORDER BY devInpi ASC";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
||||
|
||||
$fp = fopen(APPLICATION_PATH . '/../vendor/scores/library/src/Metier/Table/DevisesInpi.php','w');
|
||||
fwrite($fp, "<?php\n");
|
||||
fwrite($fp, "return array(\n");
|
||||
|
||||
if ($stmt->rowCount() > 0) {
|
||||
foreach($result as $item) {
|
||||
fwrite($fp, "\t" . intval($item->devInpi) . " => \"" . $item->devIso . "\",\n");
|
||||
}
|
||||
}
|
||||
fwrite($fp, ");\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* Cache Jugements
|
||||
*/
|
||||
if ( $opts->generate == 'Jugements' ) {
|
||||
|
||||
$sql = "SELECT codJugement, codEven FROM jo.tabJugeRncs";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
||||
|
||||
$fp = fopen(APPLICATION_PATH . '/../vendor/scores/library/src/Metier/Table/Jugements.php','w');
|
||||
fwrite($fp, "<?php\n");
|
||||
fwrite($fp, "return array(\n");
|
||||
|
||||
if ($stmt->rowCount() > 0) {
|
||||
foreach($result as $item) {
|
||||
fwrite($fp, "\t" . intval($item->codJugement) . " => " . $item->codEven . ",\n");
|
||||
}
|
||||
}
|
||||
fwrite($fp, ");\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* Cache PaysInpi
|
||||
*/
|
||||
if ( $opts->generate == 'PaysInpi' ) {
|
||||
|
||||
$sql = "SELECT codePaysInpi, codPays FROM jo.tabPays WHERE codePaysInpi>0 ORDER BY codePaysInpi ASC";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
||||
|
||||
$fp = fopen(APPLICATION_PATH . '/../vendor/scores/library/src/Metier/Table/PaysInpi.php','w');
|
||||
fwrite($fp, "<?php\n");
|
||||
fwrite($fp, "return array(\n");
|
||||
|
||||
if ($stmt->rowCount() > 0) {
|
||||
foreach($result as $item) {
|
||||
fwrite($fp, "\t" . intval($item->codePaysInpi) . " => \"" . $item->codPays . "\",\n");
|
||||
}
|
||||
}
|
||||
fwrite($fp, ");\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* Cache CodesNaf
|
||||
*/
|
||||
if ( $opts->generate == 'CodesNaf' ) {
|
||||
|
||||
$sql = "SELECT codNaf700 AS naf, libNaf700 AS LibNaf FROM jo.tabNaf4";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
||||
|
||||
$fp = fopen(APPLICATION_PATH . '/../vendor/scores/library/src/Metier/Table/CodesNaf.php','w');
|
||||
fwrite($fp, "<?php\n");
|
||||
fwrite($fp, "return array(\n");
|
||||
|
||||
if ($stmt->rowCount() > 0) {
|
||||
foreach($result as $item) {
|
||||
fwrite($fp, "\t'" . $item->naf . "' => \"" . $item->LibNaf . "\",\n");
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "SELECT codNaf5 AS naf, libNaf5 AS LibNaf FROM jo.tabNaf5";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
||||
|
||||
if ($stmt->rowCount() > 0) {
|
||||
foreach($result as $item) {
|
||||
fwrite($fp, "\t'" . $item->naf . "' => \"" . $item->LibNaf. "\",\n");
|
||||
}
|
||||
}
|
||||
|
||||
fwrite($fp, ");\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* Cache CodesNace
|
||||
*/
|
||||
if ( $opts->generate == 'CodesNace' ) {
|
||||
|
||||
$sql = "SELECT codNaf5 AS naf, libNaf5 AS LibNaf, codNaf1 FROM jo.tabNaf5";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
||||
|
||||
$fp = fopen(APPLICATION_PATH . '/../vendor/scores/library/src/Metier/Table/CodesNace.php','w');
|
||||
fwrite($fp, "<?php\n");
|
||||
fwrite($fp, "return array(\n");
|
||||
|
||||
if ($stmt->rowCount() > 0) {
|
||||
foreach($result as $item) {
|
||||
fwrite($fp, "\t'" . $item->naf . "' => \"" . $item->codNaf1 . preg_replace('/^0/','',substr($item->naf,0,4)) . "\",\n");
|
||||
}
|
||||
}
|
||||
fwrite($fp, ");\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* Cache CodesNafa
|
||||
*/
|
||||
if ( $opts->generate == 'CodesNafa' ) {
|
||||
|
||||
$sql = "SELECT codNafa AS nafa, libNafa FROM jo.tabNafa";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
||||
|
||||
$fp = fopen(APPLICATION_PATH . '/../vendor/scores/library/src/Metier/Table/CodesNafa.php','w');
|
||||
fwrite($fp, "<?php\n");
|
||||
fwrite($fp, "return array(\n");
|
||||
|
||||
if ($stmt->rowCount() > 0) {
|
||||
foreach($result as $item) {
|
||||
fwrite($fp, "\t'" . $item->nafa . "' => \"" . $item->libNafa ."\",\n");
|
||||
}
|
||||
}
|
||||
fwrite($fp, ");\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* Cache CodesFJ
|
||||
*/
|
||||
if ( $opts->generate == 'CodesFJ' ) {
|
||||
|
||||
$sql = "SELECT code AS FJ, libelle AS libFJ FROM jo.tabFJur WHERE code>=1000";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
||||
|
||||
$fp = fopen(APPLICATION_PATH . '/../vendor/scores/library/src/Metier/Table/CodesFJ.php','w');
|
||||
fwrite($fp, "<?php\n");
|
||||
fwrite($fp, "return array(\n");
|
||||
|
||||
if ($stmt->rowCount() > 0) {
|
||||
foreach($result as $item) {
|
||||
fwrite($fp, "\t" . $item->FJ . " => \"" . str_replace('"','\"',$item->libFJ) ."\",\n");
|
||||
}
|
||||
}
|
||||
fwrite($fp, ");\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* Cache AffairesTypes
|
||||
* Code Nature des contentieux
|
||||
*/
|
||||
if ( $opts->generate == 'AffairesTypes' ) {
|
||||
|
||||
$sql = "SELECT code, label FROM jo.greffes_affaires_nature";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
||||
|
||||
$fp = fopen(APPLICATION_PATH . '/../vendor/scores/library/src/Metier/Table/AffairesTypes.php','w');
|
||||
fwrite($fp, "<?php\n");
|
||||
fwrite($fp, "return array(\n");
|
||||
|
||||
if ($stmt->rowCount() > 0) {
|
||||
foreach($result as $item) {
|
||||
fwrite($fp, "\t'" . $item->code . "' => \"" . $item->label ."\",\n");
|
||||
}
|
||||
}
|
||||
fwrite($fp, ");\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* Procol Delete
|
||||
*/
|
||||
if ( $opts->generate == 'ProcolDelete' ) {
|
||||
|
||||
$sql = "SELECT codEven, affProcol, libEven FROM jo.tabEvenements WHERE affProcol>0";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
||||
|
||||
$fp = fopen(APPLICATION_PATH . '/../vendor/scores/library/src/Metier/Defaillance/ProcolDelete.php', 'w');
|
||||
fwrite($fp, "<?php\n");
|
||||
fwrite($fp, "return array(\n");
|
||||
|
||||
if ($stmt->rowCount() > 0) {
|
||||
foreach($result as $item) {
|
||||
fwrite($fp, "\t" . $item->codEven . " => " . $item->affProcol .", //".$item->libEven." \n");
|
||||
}
|
||||
}
|
||||
fwrite($fp, ");\n");
|
||||
}
|
||||
|
||||
|
57
bin/library-log.php
Executable file
57
bin/library-log.php
Executable file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
require_once realpath(__DIR__ . '/../../../../application/bin.bootstrap.php');
|
||||
|
||||
// --- Options
|
||||
$displayUsage = false;
|
||||
try {
|
||||
$opts = new Zend_Console_Getopt(array(
|
||||
'help|?' => "Aide.",
|
||||
'log' => "",
|
||||
));
|
||||
$opts->parse();
|
||||
$optionsNb = count($opts->getOptions());
|
||||
} catch (Zend_Console_Getopt_Exception $e) {
|
||||
$displayUsage = true;
|
||||
}
|
||||
|
||||
// --- Aide / Options
|
||||
if ($optionsNb == 0 || isset($opts->help)) {
|
||||
$displayUsage = true;
|
||||
}
|
||||
|
||||
// --- Usage
|
||||
if ($displayUsage) {
|
||||
echo "\nLog\n\n";
|
||||
echo $opts->getUsageMessage();
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($opts->log) {
|
||||
$sql = "SELECT * FROM sdv1.logs_item";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
|
||||
$outPath = APPLICATION_PATH . '/../vendor/scores/library/src/Scores/Account/Log/List.php';
|
||||
$outFile = $outPath . '/Config.php';
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
||||
file_put_contents($outFile, "<?php\n");
|
||||
file_put_contents($outFile, "/* Auto generated ".date('Y-m-d H:i:s')." */\n");
|
||||
file_put_contents($outFile, "return array(\n", FILE_APPEND);
|
||||
foreach ($result as $c) {
|
||||
file_put_contents($outFile, "\t'". $c->Code . "' => array(,\n", FILE_APPEND);
|
||||
file_put_contents($outFile, "\t\t'Label' => ". $c->Label . ",\n", FILE_APPEND);
|
||||
file_put_contents($outFile, "\t\'Description' => ". $c->Description . ",\n", FILE_APPEND);
|
||||
file_put_contents($outFile, "\t\t'Category' => ". $c->Category . ",\n", FILE_APPEND);
|
||||
file_put_contents($outFile, "\t),\n", FILE_APPEND);
|
||||
}
|
||||
file_put_contents($outFile, ");\n", FILE_APPEND);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
1070
bin/library-ratios.php
Executable file
1070
bin/library-ratios.php
Executable file
File diff suppressed because it is too large
Load Diff
632
bin/library-ratiosload.php
Executable file
632
bin/library-ratiosload.php
Executable file
@ -0,0 +1,632 @@
|
||||
<?php
|
||||
require_once realpath(__DIR__ . '/../../../../application/bin.bootstrap.php');
|
||||
|
||||
try {
|
||||
$opts = new Zend_Console_Getopt(
|
||||
//Options
|
||||
array(
|
||||
'help|?' => "Aide.",
|
||||
'fichier=s' => "Nom du fichier complet : version ",
|
||||
'affiche=s' => "Affiche resultat traitement "
|
||||
));
|
||||
$opts->parse();
|
||||
$optionsNb = count($opts->getOptions());
|
||||
}
|
||||
catch (Zend_Console_Getopt_Exception $e)
|
||||
{
|
||||
$displayUsage = true;
|
||||
}
|
||||
|
||||
// --- Aide / Options
|
||||
if ($optionsNb == 0 || isset($opts->help)) {
|
||||
$displayUsage = true;
|
||||
}
|
||||
|
||||
// --- Usage
|
||||
if ($displayUsage) {
|
||||
echo "Charge les commentaires ratios à partir de CSV.";
|
||||
echo "\n\n";
|
||||
echo $opts->getUsageMessage();
|
||||
echo "\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
#########################################################
|
||||
##### Presence te taille du fichier #####
|
||||
#########################################################
|
||||
|
||||
$fichier = $opts->fichier; // $fichier contient chemin/qqchose.csv
|
||||
$nomfichier = basename($fichier); // $nomfichier contient qqchose.csv, basename retourne un array donc un tableau ayant comme valeur chacun des
|
||||
|
||||
// fichiers (chemain absolu) contenu dans le repertoir $directory, ici le repertoir contient normalement une seul fichier a la fois , donc $fichier[]
|
||||
$fic = $fichier ; // On definti notre variable $fic comme etant notre fichier.
|
||||
|
||||
#########################################################
|
||||
##### Teste de validité du nom du fichier #####
|
||||
#########################################################
|
||||
|
||||
$detect1 = strstr($nomfichier, 'valo_commentaires_');
|
||||
$detect2 = strstr($nomfichier, 'valo_formules_');
|
||||
$detect3 = strstr($nomfichier, 'scores_formules_');
|
||||
$detect4 = strstr($nomfichier, 'scores_commentaires_');
|
||||
|
||||
|
||||
if ($detect1 !== false or $detect2 !== false or $detect3 !== false or $detect4 !== false)
|
||||
{
|
||||
echo "\n"." Nom du fichier ok"."\n" ;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "\n" . "le nom du fichier est incorrect" . "\n";
|
||||
echo "\n" . "le nom du fichier doit obliqatoirement etre compose de la sorte :" . "\n";
|
||||
echo "\n" . 'valo_commentaires_' . "\n";
|
||||
echo "\n" ."ou"."\n";
|
||||
echo "\n" . 'valo_formules_' . "\n";
|
||||
echo "\n" ."ou"."\n";
|
||||
echo "\n" . 'scores_formules_' . "\n";
|
||||
echo "\n" ."ou"."\n";
|
||||
echo "\n" . 'scores_commentaires_' . "\n";
|
||||
|
||||
Exit;
|
||||
}
|
||||
|
||||
|
||||
#########################################################
|
||||
##### On indique si le fichier est present ou non #####
|
||||
#########################################################
|
||||
|
||||
if ((file_exists($fichier)))
|
||||
{
|
||||
echo "\n Fichier $nomfichier au format csv trouve a l'emplacement prevu : \n";
|
||||
echo "\n"." La taille du fichier est de :".filesize($fic)." octets"."\n";
|
||||
$file = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "\n". "Pas de fichier .csv present a l'endroit indique"."\n";
|
||||
$file = false;
|
||||
exit;
|
||||
}
|
||||
|
||||
#########################################################
|
||||
##### taille du contenu du fichier #####
|
||||
#########################################################
|
||||
|
||||
# déclaration variables :
|
||||
|
||||
$fileopen = fopen($fic, 'r');
|
||||
$contenufichier = fgetcsv($fileopen);
|
||||
$nblignes=0;
|
||||
$cnbl = count($nblignes);
|
||||
$fific = file($fic); // retourner le contenu du fichier dans une chaîne de caractères.
|
||||
|
||||
|
||||
foreach ($fific as $line_num => $line)
|
||||
{
|
||||
$nblignes++;
|
||||
}
|
||||
echo "\n"." le fichier contient " . $nblignes . " lignes."."\n" ;
|
||||
|
||||
|
||||
#########################################################
|
||||
##### Routage vers commentaires ou formules #####
|
||||
#########################################################
|
||||
|
||||
#variables :
|
||||
|
||||
$doublon = 0; // On initialise la variable doublon.
|
||||
$row = 0 ; // On initialise les lignes.
|
||||
$verif = array() ; // creation d'un tableau
|
||||
$nom_fic = basename($fic) ;
|
||||
$col3= 0;
|
||||
|
||||
#########################################################
|
||||
##### Identification du type de fichier #####
|
||||
#########################################################
|
||||
|
||||
//On commance rechercher si le nom du fichier contient "COMMENTAIRE" pour 4 colonnes sinon 2 colonnes
|
||||
if (strstr($nom_fic, 'commentaires'))
|
||||
{
|
||||
$nbcol_cle = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
$nbcol_cle = 2;
|
||||
}
|
||||
|
||||
// Si $fic est bien ouvert on commence le traitement.
|
||||
if ($file = true )
|
||||
{
|
||||
$fileopen2 = fopen($fic, "r+");
|
||||
|
||||
if($fileopen2)
|
||||
{
|
||||
$contenufichier=fgetcsv($fileopen2);
|
||||
$nblignes = file($fic);
|
||||
|
||||
// Tant qu'il y a des lignes, lis les et fait en un tableau.
|
||||
while (($data = fgetcsv($fileopen2,0,';','"')) !== FALSE)
|
||||
{
|
||||
$num = count($row); //compte nombre de partits dans la phrase
|
||||
$row++;
|
||||
|
||||
// On fait une concatenation des colonnes de $fic dans un nouveau tableau nomme $cle.
|
||||
// Cela nous permettera de dedoublonner par la suite.
|
||||
|
||||
if ($nbcol_cle == 4) // si nbcol = 4 alors notre clé sera composée de 4 colonnes sinon 3
|
||||
{
|
||||
$cle = $data[0].$data[1].$data[2].$data[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
$cle = $data[0].$data[1].$data[2];
|
||||
}
|
||||
|
||||
#########################################################
|
||||
##### Dédoublonnage #####
|
||||
#########################################################
|
||||
|
||||
// On regarde si on retrouve les valeurs de $verif dans $cle
|
||||
if (in_array($cle, $verif, TRUE))
|
||||
{
|
||||
$doublon = $doublon + 1; // On définit un compteur qui nous indiquera le nombre de doublons
|
||||
echo "\n"."Attention vous avez $doublon doublon(s) dans votre fichier !\n";
|
||||
echo "\n"."il semblerait qu'il soit present a la ligne $row contenant $cle "."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
// Ajout de la cle au tableau indexe numeriquement
|
||||
$verif[] = $cle ;
|
||||
}
|
||||
#########################################################
|
||||
##### Routage commentaires ou formules #####
|
||||
##### et verification des champs #####
|
||||
#########################################################
|
||||
if (strstr ($nom_fic , 'commentaires'))// le nom du fichier contient 'commentaires' alors ...
|
||||
{
|
||||
// On teste les champs vide
|
||||
if (strlen($data[0])== 0 or strlen($data[1]) == 0
|
||||
or strlen($data[2]) == 0 or strlen($data[3]) == 0)
|
||||
{
|
||||
echo "\n"."Erreur ! Vous avez des champs vides commentaires , sur la ligne $num"."\n"."contenant $data[1].$data[2].$data[3].$data[4].$data[5].$data[6].$data[7]";
|
||||
}
|
||||
|
||||
if ($data[0] == 0)
|
||||
{
|
||||
echo "\n"."erreur code commentaire ". $data[0] ." null"."\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
if($data[2] < 0)
|
||||
{
|
||||
echo "\n"."erreur code ligne " . $data[2] . "null"."\n";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
elseif (strstr ($nom_fic , 'formules'))
|
||||
{
|
||||
if (strlen($data[0]) == 0 or strlen($data[1]) == 0 )
|
||||
{
|
||||
echo "\n"." Erreur vous avez des champs vides formules , sur la ligne $row"."\n"."contenant $data[0].$data[1]. . ";
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($data[0] == 0)
|
||||
{
|
||||
echo "\n"."erreur code commentaire " . $data[0] . " null"."\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
if($data[1] < 0)
|
||||
{
|
||||
echo "\n"."erreur code code ligne". $data[1] ."null"."\n";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($doublon >= 1)
|
||||
{
|
||||
$ok = false;
|
||||
echo "\n"." $doublon Doublons détectés dans le fichier."."\n";
|
||||
// Quitte avec un code d'erreur: doublon détecté.
|
||||
exit(1);
|
||||
|
||||
}
|
||||
elseif ($doublon == 0 && !file_exists($fic))
|
||||
{
|
||||
$ok = false;
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// le script appelant continue.
|
||||
$ok = true; // petit marqueur de fonctionnement du script jusqu'a présent
|
||||
echo "\n Le fichier ne comporte pas de doublon. \n";
|
||||
}
|
||||
|
||||
fclose($fileopen);
|
||||
|
||||
|
||||
echo "\n Bon, maintenant on va passer a la base de donnee \n";
|
||||
|
||||
#########################################################
|
||||
##### ________ ____ ____ #####
|
||||
### | __ \ | \ | \ ###
|
||||
# | / | |\ \ | |\ \ #
|
||||
### | __ \ | |/ / | |/ / ###
|
||||
##### |_______/ |___/ |___/ #####
|
||||
#########################################################
|
||||
|
||||
// si notre scripte est bon on passe a la suite
|
||||
$c = new Zend_Config($application->getOptions());
|
||||
try {
|
||||
$db = Zend_Db::factory($c->profil->db->metier);
|
||||
$db->getConnection();
|
||||
// print_r (get_class_methods($db));
|
||||
}
|
||||
catch (Zend_Exception $e)
|
||||
{
|
||||
echo $e->getMessage();
|
||||
}
|
||||
|
||||
if ($db->isConnected())
|
||||
{
|
||||
echo "\n***********************************************\n";
|
||||
echo "\n Connection a la BDD ok \n";
|
||||
echo "\n***********************************************\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "\n***********************************************\n";
|
||||
echo "\n !!!! Erreur / ! Pas connecte a la BDD !!!! \n";
|
||||
echo "\n***********************************************\n";
|
||||
}
|
||||
|
||||
$pathCache = APPLICATION_PATH . '/../vendor/scores/library/src/Metier/Scores/Variables';
|
||||
$copy_fic = $nomfichier;
|
||||
|
||||
if($nomfichier) // Si le nom du fichier comprend 'scores' ou 'valo'...
|
||||
{
|
||||
// On découpe la chaine de caractère à chaque "/" et on fait un array.
|
||||
$token = basename($copy_fic);
|
||||
|
||||
// On prend ce qui se trouve avant le point
|
||||
$token1 = strtok($token, ".");
|
||||
|
||||
// On effece '_utf8' et '.csv'
|
||||
$nomtabletemp =(str_replace('_utf8', '', $token));
|
||||
$nomtable =(str_replace('.csv','', $nomtabletemp));
|
||||
|
||||
// Affichage du nom de la table
|
||||
echo "\n Le nom de la table est : $nomtable . \n";
|
||||
}
|
||||
|
||||
####################################################
|
||||
##### // Création de la Table Ccmmentaires \\ #####
|
||||
####################################################
|
||||
|
||||
if (strstr($nomtable,"commentaires"))
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
// Création d'une table "TEXTE"
|
||||
$sql_ctc_query = $db->query("CREATE TABLE $nomtable
|
||||
(
|
||||
code int(8) NOT NULL,
|
||||
langue char(2) NOT NULL,
|
||||
cycle smallint(3) NOT NULL,
|
||||
ligne char(4) NOT NULL,
|
||||
commentaire longtext,
|
||||
tri varchar(5) DEFAULT NULL,
|
||||
deleted varchar(2) DEFAULT NULL,
|
||||
idUser varchar(0) DEFAULT NULL,
|
||||
dateInsert varchar(15) DEFAULT NULL,
|
||||
dateUpdate varchar(0) DEFAULT NULL,
|
||||
PRIMARY KEY (code,langue,cycle,ligne)
|
||||
)
|
||||
ENGINE = MyISAM DEFAULT CHARSET=latin1 COMMENT= 'Commentaires Valorisation - Liste des commentaires';");
|
||||
}
|
||||
catch (Zend_Exception $e)
|
||||
{
|
||||
echo $e->getMessage()."\n";
|
||||
echo "\n"."!!!!! ERREUR ! / CHARGEMENT ARRETE !!!!!"."\n"."\n";
|
||||
|
||||
}
|
||||
echo "\n" . " Table $nomtable cree." ."\n";
|
||||
}
|
||||
|
||||
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
$fileopen2 = fopen($fic, "r+");
|
||||
$nbr=0;
|
||||
|
||||
if($fileopen2)
|
||||
{
|
||||
$contenufichier=fgetcsv($fileopen2);
|
||||
$nblignes = file($fic);
|
||||
$vide = "";
|
||||
$null = null;
|
||||
$zero = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
exit;
|
||||
echo "\n"."Erreur a l'ouverture du fichier"."\n";
|
||||
}
|
||||
|
||||
if(strstr($nomtable,"commentaires"))
|
||||
{
|
||||
// Tant qu'il y a des lignes, lis les et fait en un tableau.
|
||||
while (($data = fgetcsv($fileopen2,0,';','"')) !== FALSE)
|
||||
{
|
||||
|
||||
####################################################
|
||||
##### encodage et remplacement du contenu #####
|
||||
####################################################
|
||||
|
||||
$data[4] = str_replace(chr(93), "]", $data[4]); // crochet fermant
|
||||
$data[4] = str_replace(chr(92), "\\" , $data[4]); // anti slash
|
||||
$data[4] = str_replace(chr(128), '€', $data[4]); // devise euros
|
||||
$data[4] = str_replace(chr(130), ',', $data[4]); // baseline single quote
|
||||
$data[4] = str_replace(chr(132), '"', $data[4]); // baseline double quote
|
||||
$data[4] = str_replace(chr(133), '...', $data[4]); // ellipsis
|
||||
$data[4] = str_replace(chr(145), "'", $data[4]); // left single quote
|
||||
$data[4] = str_replace(chr(146), "'", $data[4]); // right single quote
|
||||
$data[4] = str_replace(chr(147), '"', $data[4]); // left double quote
|
||||
$data[4] = str_replace(chr(148), '"', $data[4]); // right double quote
|
||||
$data[4] = str_replace(chr(150), '–', $data[4]); // tiret du 6
|
||||
|
||||
|
||||
$data[5] = str_replace(chr(93), "]", $data[5]); // crochet fermant
|
||||
$data[5] = str_replace(chr(92), "\\" , $data[5]); // anti slash
|
||||
$data[5] = str_replace(chr(128), '€', $data[5]); // devise euros
|
||||
$data[5] = str_replace(chr(130), ',', $data[5]); // baseline single quote
|
||||
$data[5] = str_replace(chr(132), '"', $data[5]); // baseline double quote
|
||||
$data[5] = str_replace(chr(133), '...', $data[5]); // ellipsis
|
||||
$data[5] = str_replace(chr(145), "'", $data[5]); // left single quote
|
||||
$data[5] = str_replace(chr(146), "'", $data[5]); // right single quote
|
||||
$data[5] = str_replace(chr(147), '"', $data[5]); // left double quote
|
||||
$data[5] = str_replace(chr(148), '"', $data[5]); // right double quote
|
||||
$data[5] = str_replace(chr(150), '–', $data[5]); // tiret du 6
|
||||
|
||||
$encode = mb_detect_encoding($data[4]); // detection de l'encodage.
|
||||
$encode = mb_detect_encoding($data[5]); // detection de l'encodage.
|
||||
$data[4] = mb_convert_encoding($data[4], $encode, 'UTF-8');
|
||||
$data[5] = mb_convert_encoding($data[5], $encode, 'UTF-8');
|
||||
|
||||
// $Zdata4 = '"'.$db->->real_escape_string($data[4]);
|
||||
// $Zdata4 = $db->quote($data[4]);
|
||||
|
||||
//$Zdata4 = mysqli_real_escape_string($db, $data[4]);
|
||||
|
||||
if ($data[5] == null)
|
||||
{
|
||||
$data[5] = 0;
|
||||
}
|
||||
|
||||
$zdata4= $db->quote($data[4]);
|
||||
$nbr++;
|
||||
|
||||
// ESSAI 1
|
||||
$sql_insert = array
|
||||
(
|
||||
'code' => "$data[0]",
|
||||
'langue' => "$data[1]",
|
||||
'cycle' => "$data[2]",
|
||||
'ligne' => "$data[3]",
|
||||
'commentaire' => "$data[4]",
|
||||
'tri' => "$data[5]",
|
||||
'deleted' => "$null",
|
||||
'idUser' => "$null",
|
||||
'dateInsert' => "$null",
|
||||
'dateUpdate' => "$null"
|
||||
);
|
||||
|
||||
try
|
||||
{
|
||||
# $num = count($row); // On compte nombre de parti dans la phrase
|
||||
# $row++; // à chaques tour de boucle j'ajoute 1 à $row
|
||||
|
||||
|
||||
// ESSAI 2
|
||||
/*
|
||||
$sql_itc = $db->query("INSERT INTO $nomtable
|
||||
(
|
||||
code, langue, cycle, ligne, commentaire, tri, deleted, idUser, dateInsert, dateUpdate)
|
||||
VALUES
|
||||
(
|
||||
".$data[0].",".$data[1].",".$data[2].",".$data[3].",".$Zdata4.",".$data[5].",'','','',)
|
||||
");
|
||||
*/
|
||||
|
||||
$db->insert($nomtable, $sql_insert);
|
||||
|
||||
//`
|
||||
// Astuce !! La structure de $data[0] étant un int on retire les "
|
||||
// Astuce !! La colonne 5 contenant des apostrophs étant interprété par le sql comme un nouveau champ il est necessaire de protéger ce champs, du coup in ajoute la fonction mysql_real_escape_string() pour insérer un antislash devant les caractères " NULL, \x00, \n, \r, \, ', " et \x1a. "
|
||||
}
|
||||
|
||||
// Renseignement sur les erreurs possibles
|
||||
#echo ("$sql_itt");
|
||||
catch(Zend_Exception $e)
|
||||
{
|
||||
echo "\n" . $e->getMessage()."\n";
|
||||
|
||||
//echo "\n"."!!!!!!!!!!!!!!!!!!!!! Import de la table $nomtable echouee. !!!!!!!!!!!!!!!!!!!!!"."\n"."\n";
|
||||
//$sql_erase = $db->query("DROP TABLE $nomtable;");
|
||||
//echo "La table $nomtable a ete effacee !! \n ";
|
||||
}
|
||||
}
|
||||
|
||||
echo "\n"."Import de la table $nomtable . ok". "\n";
|
||||
|
||||
// comptage sql
|
||||
$comptage = count($sql_itc_query);
|
||||
echo "\n"."Nombre de lignes importees : "."$nbr"."\n";
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
elseif(strstr($nomtable,"formules"))
|
||||
{
|
||||
####################################################
|
||||
// Création de la Table formules \\
|
||||
####################################################
|
||||
try{
|
||||
$sql_ctf_query = $db->query("CREATE TABLE $nomtable
|
||||
(
|
||||
code int(8) NOT NULL DEFAULT '0',
|
||||
ligne char(4) NOT NULL DEFAULT '',
|
||||
remarque varchar(120) DEFAULT NULL,
|
||||
operande varchar(7) DEFAULT NULL,
|
||||
ope1 varchar(255) DEFAULT NULL,
|
||||
operation varchar(9) DEFAULT NULL,
|
||||
valeur varchar(255) DEFAULT NULL,
|
||||
tri varchar(0) DEFAULT NULL,
|
||||
deleted varchar(0) DEFAULT NULL,
|
||||
idUser varchar(0) DEFAULT NULL,
|
||||
dateInsert varchar(0) DEFAULT NULL,
|
||||
dateUpdate varchar(0) DEFAULT NULL,
|
||||
PRIMARY KEY (code,ligne)
|
||||
)
|
||||
ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Criteres Valorisation - Formules de calculs' ;");
|
||||
|
||||
}
|
||||
catch (Zend_Exception $e)
|
||||
{
|
||||
echo $e->getMessage()."\n";
|
||||
echo "\n"."!!!!!!!!!!!!!!!!!!!!! CHARGEMENT ARRETE !!!!!!!!!!!!!!!!!!!!!"."\n"."\n";
|
||||
}
|
||||
echo "\n Table $nomtable cree.\n";
|
||||
|
||||
|
||||
// Tant qu'il y a des lignes, lis les et fait en un tableau.
|
||||
while (($data = fgetcsv($fileopen2,0,';','"')) !== FALSE)
|
||||
{
|
||||
|
||||
|
||||
####################################################
|
||||
##### encodage et remplacement du contenu #####
|
||||
####################################################
|
||||
|
||||
$data[2] = str_replace(chr(93), "]", $data[2]); // crochet fermant
|
||||
$data[2] = str_replace(chr(92), "\\" , $data[2]); // anti slash
|
||||
$data[2] = str_replace(chr(128), '€', $data[2]); // devise euros
|
||||
$data[2] = str_replace(chr(130), ',', $data[2]); // baseline single quote
|
||||
$data[2] = str_replace(chr(132), '"', $data[2]); // baseline double quote
|
||||
$data[2] = str_replace(chr(133), '...', $data[2]); // ellipsis
|
||||
$data[2] = str_replace(chr(145), "'", $data[2]); // left single quote
|
||||
$data[2] = str_replace(chr(146), "'", $data[2]); // right single quote
|
||||
$data[2] = str_replace(chr(147), '"', $data[2]); // left double quote
|
||||
$data[2] = str_replace(chr(148), '"', $data[2]); // right double quote
|
||||
$data[2] = str_replace(chr(150), '–', $data[2]); // tiret du 6
|
||||
|
||||
|
||||
$data[4] = str_replace(chr(93), "]", $data[4]); // crochet fermant
|
||||
$data[4] = str_replace(chr(92), "\\" , $data[4]); // anti slash
|
||||
$data[4] = str_replace(chr(128), '€', $data[4]); // devise euros
|
||||
$data[4] = str_replace(chr(130), ',', $data[4]); // baseline single quote
|
||||
$data[4] = str_replace(chr(132), '"', $data[4]); // baseline double quote
|
||||
$data[4] = str_replace(chr(133), '...', $data[4]); // ellipsis
|
||||
$data[4] = str_replace(chr(145), "'", $data[4]); // left single quote
|
||||
$data[4] = str_replace(chr(146), "'", $data[4]); // right single quote
|
||||
$data[4] = str_replace(chr(147), '"', $data[4]); // left double quote
|
||||
$data[4] = str_replace(chr(148), '"', $data[4]); // right double quote
|
||||
$data[4] = str_replace(chr(150), '–', $data[4]); // tiret du 6
|
||||
|
||||
|
||||
$data[5] = str_replace(chr(93), "]", $data[5]); // crochet fermant
|
||||
$data[5] = str_replace(chr(92), "\\" , $data[5]); // anti slash
|
||||
$data[5] = str_replace(chr(128), '€', $data[5]); // devise euros
|
||||
$data[5] = str_replace(chr(130), ',', $data[5]); // baseline single quote
|
||||
$data[5] = str_replace(chr(132), '"', $data[5]); // baseline double quote
|
||||
$data[5] = str_replace(chr(133), '...', $data[5]); // ellipsis
|
||||
$data[5] = str_replace(chr(145), "'", $data[5]); // left single quote
|
||||
$data[5] = str_replace(chr(146), "'", $data[5]); // right single quote
|
||||
$data[5] = str_replace(chr(147), '"', $data[5]); // left double quote
|
||||
$data[5] = str_replace(chr(148), '"', $data[5]); // right double quote
|
||||
$data[5] = str_replace(chr(150), '–', $data[5]); // tiret du 6
|
||||
|
||||
$data[6] = str_replace(chr(93), "]", $data[6]); // crochet fermant
|
||||
$data[6] = str_replace(chr(92), "\\" , $data[6]); // anti slash
|
||||
$data[6] = str_replace(chr(128), '€', $data[6]); // devise euros
|
||||
$data[6] = str_replace(chr(130), ',', $data[6]); // baseline single quote
|
||||
$data[6] = str_replace(chr(132), '"', $data[6]); // baseline double quote
|
||||
$data[6] = str_replace(chr(133), '...', $data[6]); // ellipsis
|
||||
$data[6] = str_replace(chr(145), "'", $data[6]); // left single quote
|
||||
$data[6] = str_replace(chr(146), "'", $data[6]); // right single quote
|
||||
$data[6] = str_replace(chr(147), '"', $data[6]); // left double quote
|
||||
$data[6] = str_replace(chr(148), '"', $data[6]); // right double quote
|
||||
$data[6] = str_replace(chr(150), '–', $data[6]); // tiret du 6
|
||||
|
||||
$encode = mb_detect_encoding($data[2]); // detection de l'encodage.
|
||||
$encode = mb_detect_encoding($data[5]); // detection de l'encodage.
|
||||
$encode = mb_detect_encoding($data[4]); // detection de l'encodage.
|
||||
$encode = mb_detect_encoding($data[6]); // detection de l'encodage.
|
||||
|
||||
$data[2] = mb_convert_encoding($data[2], $encode, 'UTF-8');
|
||||
$data[4] = mb_convert_encoding($data[4], $encode, 'UTF-8');
|
||||
$data[5] = mb_convert_encoding($data[5], $encode, 'UTF-8');
|
||||
$data[6] = mb_convert_encoding($data[6], $encode, 'UTF-8');
|
||||
|
||||
|
||||
$sql_insert = array(
|
||||
'code' => "$data[0]",
|
||||
'ligne' => "$data[1]",
|
||||
'remarque' => "$data[2]",
|
||||
'operande' => "$data[3]",
|
||||
'ope1' => "$data[4]",
|
||||
'operation' => "$data[5]",
|
||||
'valeur' => "$data[6]",
|
||||
'tri' => "$null",
|
||||
'deleted' => "$null",
|
||||
'idUser' => "$null",
|
||||
'dateInsert' => "$null",
|
||||
'dateUpdate' => "$null"
|
||||
);
|
||||
$nbr++;
|
||||
try{
|
||||
$db->insert($nomtable, $sql_insert);
|
||||
}
|
||||
catch (Zend_Exception $e)
|
||||
{
|
||||
echo $e->getMessage()."\n";
|
||||
echo "\n"."!!!!! ERREUR ! / CHARGEMENT ARRETE !!!!!"."\n"."\n";
|
||||
}
|
||||
}
|
||||
|
||||
echo "\n"." Import de la table $nomtable ok."."\n";
|
||||
|
||||
// comptage sql
|
||||
$comptage = count($sql_insert);
|
||||
echo "\n"." Nombre de lignes importees : "."$nbr"."\n";
|
||||
fclose($fileopen2);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
// Exécution de la requête
|
||||
//$result = $db->query($sql_ctt);
|
||||
// Renseignement sur les erreurs possibles
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// echo "<strong>" . $Erreur . "</strong> <br /> <br />\n";
|
||||
//
|
||||
// if ($sql_ctt_query) // si code retour OK
|
||||
// {
|
||||
// echo "Création de la table $nomtable ok.<br />";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// echo "Création de la table $nomtable échouée.<br />";
|
||||
// }
|
47
bin/library-sfr.php
Executable file
47
bin/library-sfr.php
Executable file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
require_once realpath(__DIR__ . '/../../../../application/bin.bootstrap.php');
|
||||
|
||||
// --- Options
|
||||
$displayUsage = false;
|
||||
try {
|
||||
$opts = new Zend_Console_Getopt(array(
|
||||
'help|?' => "Aide.",
|
||||
'compile-s' => "Génére le cache des règles, sans paramètres (tout), avec paramètres (VORD, VORP, PO)",
|
||||
'version=s' => "Version des régles",
|
||||
));
|
||||
$opts->parse();
|
||||
$optionsNb = count($opts->getOptions());
|
||||
} catch (Zend_Console_Getopt_Exception $e) {
|
||||
$displayUsage = true;
|
||||
}
|
||||
|
||||
// --- Aide / Options
|
||||
if ($optionsNb == 0 || isset($opts->help)) {
|
||||
$displayUsage = true;
|
||||
}
|
||||
|
||||
// --- Usage
|
||||
if ($displayUsage) {
|
||||
echo "\nRegles SFR\n\n";
|
||||
echo $opts->getUsageMessage();
|
||||
exit;
|
||||
}
|
||||
|
||||
$types = array('VORD', 'VORP', 'PO');
|
||||
|
||||
if ( $opts->compile!='' && in_array($opts->compile, $types) ) {
|
||||
$types = array($opts->compile);
|
||||
}
|
||||
|
||||
if ( count($types) > 0 ) {
|
||||
|
||||
foreach ( $types as $type ) {
|
||||
$ruleSfrM = new Metier_Sfr_Compile($conn);
|
||||
$ruleSfrM->setVersion($opts->version);
|
||||
$ruleSfrM->construct($type);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,26 +1,35 @@
|
||||
{
|
||||
"name": "scores/library",
|
||||
"description": "library",
|
||||
"require": {
|
||||
"zendframework/zendframework1": "^1.12",
|
||||
"doctrine/dbal": "^2.5",
|
||||
"monolog/monolog": "^1.22"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^4.8",
|
||||
"squizlabs/php_codesniffer": "2.*"
|
||||
},
|
||||
"include-path": ["src/"],
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"src/Metier/",
|
||||
"src/Scores/"
|
||||
]
|
||||
},
|
||||
"authors": [
|
||||
"name" : "scores/library",
|
||||
"description" : "library",
|
||||
"authors" : [
|
||||
{
|
||||
"name": "Scores et Decisions",
|
||||
"email": "supportdev@scores-decisions.com"
|
||||
}
|
||||
]
|
||||
"name" : "Scores et Decisions",
|
||||
"email" : "supportdev@scores-decisions.com"
|
||||
}
|
||||
],
|
||||
"require" : {
|
||||
"zendframework/zendframework1" : "^1.12",
|
||||
"doctrine/dbal" : "^2.5",
|
||||
"monolog/monolog" : "^1.22"
|
||||
},
|
||||
"require-dev" : {
|
||||
"phpunit/phpunit" : "^4.8",
|
||||
"squizlabs/php_codesniffer" : "2.*"
|
||||
},
|
||||
"include-path" : [
|
||||
"src/"
|
||||
],
|
||||
"autoload" : {
|
||||
"classmap" : [
|
||||
"src/Metier/",
|
||||
"src/Scores/"
|
||||
]
|
||||
},
|
||||
"bin" : [
|
||||
"bin/library-cache.php",
|
||||
"bin/library-log.php",
|
||||
"bin/library-ratios.php",
|
||||
"bin/library-ratiosload.php",
|
||||
"bin/library-sfr.php"
|
||||
]
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
class Metier_Defaillance_Detect
|
||||
{
|
||||
protected $debug = true;
|
||||
protected $debug = false;
|
||||
|
||||
/**
|
||||
* Code de la forme juridique
|
||||
@ -23,7 +23,7 @@ class Metier_Defaillance_Detect
|
||||
|
||||
/**
|
||||
* Actif RCS
|
||||
* @var int
|
||||
* @var unknown
|
||||
*/
|
||||
protected $RcsActif;
|
||||
|
||||
@ -34,7 +34,7 @@ class Metier_Defaillance_Detect
|
||||
protected $EtabActifNb;
|
||||
|
||||
/**
|
||||
* Registre des métiers
|
||||
* Rgsitre des métiers
|
||||
* @var int
|
||||
*/
|
||||
protected $NumRM;
|
||||
@ -45,13 +45,6 @@ class Metier_Defaillance_Detect
|
||||
*/
|
||||
protected $IsRCS;
|
||||
|
||||
/**
|
||||
* Date Radiation au Greffe
|
||||
* @var int
|
||||
* Date au format AAAAMMJJ
|
||||
*/
|
||||
protected $GreffeRadiationDate;
|
||||
|
||||
protected $Situation = '';
|
||||
protected $SituationDateStart;
|
||||
protected $SituationDateEnd;
|
||||
@ -70,18 +63,11 @@ class Metier_Defaillance_Detect
|
||||
protected $ProcolMaxYear = 12;
|
||||
|
||||
protected $Even;
|
||||
protected $EvenDate;
|
||||
protected $EvenDateJugement;
|
||||
protected $EvenTxt;
|
||||
protected $EvenDelete = 0;
|
||||
|
||||
protected $EvenIndex = 0;
|
||||
protected $EvenNb = 0;
|
||||
|
||||
/**
|
||||
* Date de référence (aujourd'hui la majorité du temps)
|
||||
* @var string
|
||||
*/
|
||||
protected $DateRef;
|
||||
protected $DateToday;
|
||||
|
||||
/**
|
||||
* Timeline des événements de défaillance
|
||||
@ -101,7 +87,7 @@ class Metier_Defaillance_Detect
|
||||
}
|
||||
|
||||
// Définir la date du jour
|
||||
$this->DateRef = date('Ymd');
|
||||
$this->DateToday = date('Ymd');
|
||||
|
||||
// Liste des événements au départ d'une procol
|
||||
$this->ListEvenProcol = include __DIR__ . '/EvenProcol.php';
|
||||
@ -119,85 +105,41 @@ class Metier_Defaillance_Detect
|
||||
$this->ListEvenProcolDelete = include __DIR__ . '/ProcolDelete.php';
|
||||
}
|
||||
|
||||
public function setEvenNb($val)
|
||||
{
|
||||
$this->EvenNb = $val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Code Forme Juridique
|
||||
* @param string $val
|
||||
*/
|
||||
public function setFJ($val)
|
||||
{
|
||||
$this->FJ = $val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Date de cloture du bilan
|
||||
* @param int $val
|
||||
* Date au format AAAAMMJJ
|
||||
*/
|
||||
public function setBilanCloture($val)
|
||||
{
|
||||
$this->BilanCloture = $val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Insee Actif
|
||||
* @param int $val
|
||||
*/
|
||||
public function setInseeActif($val)
|
||||
{
|
||||
$this->InseeActif = $val;
|
||||
}
|
||||
|
||||
/**
|
||||
* RCS Actif
|
||||
* @param int $val
|
||||
*/
|
||||
public function setRcsActif($val)
|
||||
{
|
||||
$this->RcsActif = $val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Nombre d'etablissement Actif
|
||||
* @param int $val
|
||||
*/
|
||||
public function setEtabActif($val)
|
||||
{
|
||||
$this->EtabActifNb = $val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Est présent au registre des métiers
|
||||
* @param int $val
|
||||
*/
|
||||
public function setRM($val)
|
||||
{
|
||||
$this->IsRM = $val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Est présent au Greffe
|
||||
* @param int $val
|
||||
*/
|
||||
public function setGreffe($val)
|
||||
{
|
||||
$this->IsRCS = $val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Date de radiation au Greffe
|
||||
* @param string $date
|
||||
*/
|
||||
public function setGreffeRadiation($date)
|
||||
{
|
||||
$date = intval(str_replace('-', '', $date));
|
||||
$this->GreffeRadiationDate = $date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne la situation
|
||||
* @return string
|
||||
@ -264,9 +206,8 @@ class Metier_Defaillance_Detect
|
||||
public function parse($ann)
|
||||
{
|
||||
$this->Even = $ann->code;
|
||||
$this->EvenDate = $ann->date;
|
||||
$this->EvenDateJugement = $ann->date;
|
||||
$this->EvenTxt = $ann->txt;
|
||||
$this->EvenIndex++;
|
||||
|
||||
if ($this->debug) {
|
||||
file_put_contents('procol.log', "Annonce : ".$ann->date . '-' . $ann->code."\n", FILE_APPEND);
|
||||
@ -285,7 +226,7 @@ class Metier_Defaillance_Detect
|
||||
}
|
||||
|
||||
// --- Variable pour le plan
|
||||
$this->PlanDateStart = $this->EvenDate;
|
||||
$this->PlanDateStart = $this->EvenDateJugement;
|
||||
$this->planPeriod($this->EvenTxt);
|
||||
$this->planEnd();
|
||||
|
||||
@ -312,24 +253,17 @@ class Metier_Defaillance_Detect
|
||||
$result = $this->params($rule['params']);
|
||||
if ($result === true) {
|
||||
// Defintion paramètres situation
|
||||
$this->SituationDateStart = $this->EvenDate;
|
||||
$this->SituationDateStart = $this->EvenDateJugement;
|
||||
$this->situationEnd();
|
||||
|
||||
$dateEnd = $this->SituationDateEnd;
|
||||
if ($this->Situation == 'PL') {
|
||||
$dateEnd = $this->PlanDateEnd;
|
||||
}
|
||||
|
||||
// Enregistrement dans la timeline
|
||||
$this->Timeline[] = array(
|
||||
'Situation' => $this->Situation,
|
||||
'Even' => $this->Even,
|
||||
'DateStart' => $this->SituationDateStart,
|
||||
'DateEnd' => $dateEnd,
|
||||
'DateEnd' => $this->SituationDateEnd,
|
||||
);
|
||||
if ($this->debug) {
|
||||
file_put_contents('procol.log', print_r($this->Timeline, 1)."\n", FILE_APPEND);
|
||||
}
|
||||
file_put_contents('procol.log', print_r($this->Timeline, 1)."\n", FILE_APPEND);
|
||||
}
|
||||
|
||||
if ($this->debug) {
|
||||
|
@ -16,32 +16,32 @@ return array(
|
||||
'name' => 'PLAN',
|
||||
'value' => 'CONTINUE',
|
||||
'params' => array(
|
||||
//array('var' => 'PlanPeriod', 'op' => 'EGAL', 'value'=> array(0,120)),
|
||||
array('var' => 'Even', 'op' => 'EGAL', 'value' => array(
|
||||
1407, // Modification de plan
|
||||
1409, // Modification du plan de continuation
|
||||
1413, // Arrêt du plan de continuation
|
||||
1414, // Arrêt du plan de redressement
|
||||
1101, // Arrêt du plan de sauvegarde
|
||||
array( 'var' => 'PlanPeriod', 'op' => 'EGAL', 'value'=> array(0,120)),
|
||||
array( 'var' => 'Even', 'op' => 'EGAL', 'value' => array(
|
||||
'1407', // Modification de plan
|
||||
'1409', // Modification du plan de continuation
|
||||
'1413', // Arrêt du plan de continuation
|
||||
'1414', // Arrêt du plan de redressement
|
||||
'1101', // Arrêt du plan de sauvegarde
|
||||
)),
|
||||
array('var' => 'Situation', 'op' => 'SET', 'value' => 'PL'),
|
||||
array( 'var' => 'Situation', 'op' => 'SET', 'value' => 'PL'),
|
||||
),
|
||||
),
|
||||
// --- Period par defaut
|
||||
// -- Period par defaut
|
||||
array(
|
||||
'name' => 'PLAN-DUREE-DEFAUT1',
|
||||
'value' => 'CONTINUE',
|
||||
'params' => array(
|
||||
array('var' => 'PlanPeriod', 'op' => 'MAX', 'value'=> 1),
|
||||
array('var' => 'PlanPeriod', 'op' => 'SET', 'value' => 120),
|
||||
array( 'var' => 'PlanPeriod', 'op' => 'MAX', 'value'=> 1),
|
||||
array( 'var' => 'PlanPeriod', 'op' => 'SET', 'value' => 120),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'name' => 'PLAN-DUREE-DEFAUT2',
|
||||
'value' => 'CONTINUE',
|
||||
'params' => array(
|
||||
array('var' => 'PlanPeriod', 'op' => 'MIN', 'value'=> 120),
|
||||
array('var' => 'PlanPeriod', 'op' => 'SET', 'value' => 120),
|
||||
array( 'var' => 'PlanPeriod', 'op' => 'MIN', 'value'=> 120),
|
||||
array( 'var' => 'PlanPeriod', 'op' => 'SET', 'value' => 120),
|
||||
),
|
||||
),
|
||||
// --- Period par default pour FJ spécifique
|
||||
@ -49,8 +49,8 @@ return array(
|
||||
'name' => 'PLAN-DUREE-FJ1',
|
||||
'value' => 'CONTINUE',
|
||||
'params' => array(
|
||||
array('var' => 'PlanPeriod', 'op' => 'MAX', 'value'=> 1),
|
||||
array('var' => 'FJ', 'op' => 'EGAL', 'value' => array(
|
||||
array( 'var' => 'PlanPeriod', 'op' => 'MAX', 'value'=> 1),
|
||||
array( 'var' => 'FJ', 'op' => 'EGAL', 'value' => array(
|
||||
16,1600, // Exploitant agricole
|
||||
63,6316,6317,6318, // Société coopérative agricole
|
||||
5431,5432,5531,5532, // SMIA, SICA
|
||||
@ -58,7 +58,7 @@ return array(
|
||||
6533,6534,6535, // GAEC, GFA, Gpt Agricole Foncier
|
||||
6597,6598,
|
||||
)),
|
||||
array('var' => 'PlanPeriod', 'op' => 'SET', 'value' => 180),
|
||||
array( 'var' => 'PlanPeriod', 'op' => 'SET', 'value' => 180),
|
||||
),
|
||||
),
|
||||
// --- Period par default pour FJ spécifique
|
||||
@ -66,8 +66,8 @@ return array(
|
||||
'name' => 'PLAN-DUREE-FJ2',
|
||||
'value' => 'CONTINUE',
|
||||
'params' => array(
|
||||
array('var' => 'PlanPeriod', 'op' => 'MIN', 'value'=> 120),
|
||||
array('var' => 'FJ', 'op' => 'EGAL', 'value' => array(
|
||||
array( 'var' => 'PlanPeriod', 'op' => 'MIN', 'value'=> 120),
|
||||
array( 'var' => 'FJ', 'op' => 'EGAL', 'value' => array(
|
||||
16,1600, // Exploitant agricole
|
||||
63,6316,6317,6318, // Société coopérative agricole
|
||||
5431,5432,5531,5532, // SMIA, SICA
|
||||
@ -75,7 +75,7 @@ return array(
|
||||
6533,6534,6535, // GAEC, GFA, Gpt Agricole Foncier
|
||||
6597,6598,
|
||||
)),
|
||||
array('var' => 'PlanPeriod', 'op' => 'SET', 'value' => '180'),
|
||||
array( 'var' => 'PlanPeriod', 'op' => 'SET', 'value' => '180'),
|
||||
),
|
||||
),
|
||||
// --- Elimination du plan : période atteinte
|
||||
@ -83,9 +83,9 @@ return array(
|
||||
'name' => 'PLAN-PERIOD-ATTEINTE',
|
||||
'value' => 'CONTINUE',
|
||||
'params' => array(
|
||||
array('var' => 'Situation', 'op' => 'EGAL', 'value' => 'PL'),
|
||||
array('var' => 'PlanDateEnd', 'op' => 'MIN', 'value' => 'DateRef'),
|
||||
array('var' => 'Situation', 'op' => 'SET', 'value' => ''),
|
||||
array( 'var' => 'Situation', 'op' => 'EGAL', 'value' => 'PL'),
|
||||
array( 'var' => 'PlanDateEnd', 'op' => 'MIN', 'value' => 'DateToday'),
|
||||
array( 'var' => 'Situation', 'op' => 'SET', 'value' => ''),
|
||||
),
|
||||
),
|
||||
// --- Elimination du plan : appel de jugement
|
||||
@ -93,9 +93,9 @@ return array(
|
||||
'name' => 'PLAN-APPEL-JUGEMENT',
|
||||
'value' => 'CONTINUE',
|
||||
'params' => array(
|
||||
array('var' => 'Situation', 'op' => 'EGAL', 'value' => 'PL'),
|
||||
array('var' => 'EvenDelete', 'op' => 'EGAL', 'value' => 4),
|
||||
array('var' => 'Situation', 'op' => 'SET', 'value' => 'PA'),
|
||||
array( 'var' => 'Situation', 'op' => 'EGAL', 'value' => 'PL'),
|
||||
array( 'var' => 'EvenDelete', 'op' => 'EGAL', 'value' => 4),
|
||||
array( 'var' => 'Situation', 'op' => 'SET', 'value' => 'PA'),
|
||||
),
|
||||
),
|
||||
// --- Elimination du plan : cutoff
|
||||
@ -103,10 +103,10 @@ return array(
|
||||
'name' => 'PLAN-CUT-OFF',
|
||||
'value' => 'CONTINUE',
|
||||
'params' => array(
|
||||
array('var' => 'Situation', 'op' => 'EGAL', 'value' => 'PL'),
|
||||
array('var' => 'Cutoff', 'op' => 'EGAL', 'value' => true),
|
||||
array('var' => 'ScoreSolv', 'op' => 'MIN', 'value' => 0),
|
||||
array('var' => 'Situation', 'op' => 'SET', 'value' => ''),
|
||||
array( 'var' => 'Situation', 'op' => 'EGAL', 'value' => 'PL'),
|
||||
array( 'var' => 'Cutoff', 'op' => 'EGAL', 'value' => true),
|
||||
array( 'var' => 'ScoreSolv', 'op' => 'MIN', 'value' => 0),
|
||||
array( 'var' => 'Situation', 'op' => 'SET', 'value' => ''),
|
||||
),
|
||||
),
|
||||
// --- Début de procol
|
||||
@ -114,8 +114,8 @@ return array(
|
||||
'name' => 'PROCOL-START',
|
||||
'value' => 'CONTINUE',
|
||||
'params' => array(
|
||||
array('var' => 'Even', 'op' => 'EGAL', 'value' => 'ListEvenProcol'),
|
||||
array('var' => 'Situation', 'op' => 'SET', 'value' => 'P'),
|
||||
array( 'var' => 'Even', 'op' => 'EGAL', 'value' => 'ListEvenProcol'),
|
||||
array( 'var' => 'Situation', 'op' => 'SET', 'value' => 'P'),
|
||||
),
|
||||
),
|
||||
// --- Pas de mention de la procol
|
||||
@ -123,9 +123,9 @@ return array(
|
||||
'name' => 'PROCOL-EFFACEMENT-1',
|
||||
'value' => 'CONTINUE',
|
||||
'params' => array(
|
||||
array('var' => 'Situation', 'op' => 'EGAL', 'value' => 'P'),
|
||||
array('var' => 'EvenDelete', 'op' => 'EGAL', 'value' => 1),
|
||||
array('var' => 'Situation', 'op' => 'SET', 'value' => ''),
|
||||
array( 'var' => 'Situation', 'op' => 'EGAL', 'value' => 'P'),
|
||||
array( 'var' => 'EvenDelete', 'op' => 'EGAL', 'value' => 1),
|
||||
array( 'var' => 'Situation', 'op' => 'SET', 'value' => ''),
|
||||
),
|
||||
),
|
||||
// --- Ne pas mentionner la procol si CJ=1xxx
|
||||
@ -133,11 +133,11 @@ return array(
|
||||
'name' => 'PROCOL-EFFACEMENT-2.1',
|
||||
'value' => 'CONTINUE',
|
||||
'params' => array(
|
||||
array('var' => 'Situation', 'op' => 'EGAL', 'value' => 'P'),
|
||||
array('var' => 'EvenDelete', 'op' => 'EGAL', 'value' => 2),
|
||||
array('var' => 'FJ', 'op' => 'MIN', 'value' => 1000),
|
||||
array('var' => 'FJ', 'op' => 'MAX', 'value' => 1999),
|
||||
array('var' => 'Situation', 'op' => 'SET', 'value' => ''),
|
||||
array( 'var' => 'Situation', 'op' => 'EGAL', 'value' => 'P'),
|
||||
array( 'var' => 'EvenDelete', 'op' => 'EGAL', 'value' => 2),
|
||||
array( 'var' => 'FJ', 'op' => 'MIN', 'value' => 1000),
|
||||
array( 'var' => 'FJ', 'op' => 'MAX', 'value' => 1999),
|
||||
array( 'var' => 'Situation', 'op' => 'SET', 'value' => ''),
|
||||
),
|
||||
),
|
||||
// --- Ne pas mentionner la procol si actif et CJ!=9xxx et even de plus d'un mois
|
||||
@ -145,12 +145,12 @@ return array(
|
||||
'name' => 'PROCOL-EFFACEMENT-2.2',
|
||||
'value' => 'CONTINUE',
|
||||
'params' => array(
|
||||
array('var' => 'Situation', 'op' => 'EGAL', 'value' => 'P'),
|
||||
array('var' => 'EvenDelete', 'op' => 'EGAL', 'value' => 2),
|
||||
array('var' => 'InseeActif', 'op' => 'EGAL', 'value' => 1),
|
||||
array('var' => 'FJ', 'op' => 'MAX', 'value' => 9000),
|
||||
array('var' => 'SituationNbMonthPast', 'op' => 'MIN', 'value' => 1),
|
||||
array('var' => 'Situation', 'op' => 'SET', 'value' => ''),
|
||||
array( 'var' => 'Situation', 'op' => 'EGAL', 'value' => 'P'),
|
||||
array( 'var' => 'EvenDelete', 'op' => 'EGAL', 'value' => 2),
|
||||
array( 'var' => 'InseeActif', 'op' => 'EGAL', 'value' => 1),
|
||||
array( 'var' => 'FJ', 'op' => 'MAX', 'value' => 9000),
|
||||
array( 'var' => 'SituationNbMonthPast', 'op' => 'MIN', 'value' => 1),
|
||||
array( 'var' => 'Situation', 'op' => 'SET', 'value' => ''),
|
||||
),
|
||||
),
|
||||
// --- Pas Procol si actif RCS
|
||||
@ -158,10 +158,10 @@ return array(
|
||||
'name' => 'PROCOL-EFFACEMENT-3',
|
||||
'value' => 'CONTINUE',
|
||||
'params' => array(
|
||||
array('var' => 'Situation', 'op' => 'EGAL', 'value' => 'P'),
|
||||
array('var' => 'EvenDelete', 'op' => 'EGAL', 'value' => 3),
|
||||
array('var' => 'RcsActif', 'op' => 'EGAL', 'value' => 1),
|
||||
array('var' => 'Situation', 'op' => 'SET', 'value' => ''),
|
||||
array( 'var' => 'Situation', 'op' => 'EGAL', 'value' => 'P'),
|
||||
array( 'var' => 'EvenDelete', 'op' => 'EGAL', 'value' => 3),
|
||||
array( 'var' => 'RcsActif', 'op' => 'EGAL', 'value' => 1),
|
||||
array( 'var' => 'Situation', 'op' => 'SET', 'value' => ''),
|
||||
),
|
||||
),
|
||||
// --- Le dernier jugement est un appel => Procol Suspendu
|
||||
@ -169,9 +169,9 @@ return array(
|
||||
'name' => 'PROCOL-EFFACEMENT-4',
|
||||
'value' => 'CONTINUE',
|
||||
'params' => array(
|
||||
array('var' => 'Situation', 'op' => 'EGAL', 'value' => 'P'),
|
||||
array('var' => 'EvenDelete', 'op' => 'EGAL', 'value' => 4),
|
||||
array('var' => 'Situation', 'op' => 'SET', 'value' => 'PA'),
|
||||
array( 'var' => 'Situation', 'op' => 'EGAL', 'value' => 'P'),
|
||||
array( 'var' => 'EvenDelete', 'op' => 'EGAL', 'value' => 4),
|
||||
array( 'var' => 'Situation', 'op' => 'SET', 'value' => 'PA'),
|
||||
),
|
||||
),
|
||||
// --- Procédure trop ancienne plus de 12 ans et actif
|
||||
@ -179,10 +179,10 @@ return array(
|
||||
'name' => 'PROCOL-ANCIEN',
|
||||
'value' => 'CONTINUE',
|
||||
'params' => array(
|
||||
array('var' => 'Situation', 'op' => 'EGAL', 'value' => 'P'),
|
||||
array('var' => 'InseeActif', 'op' => 'EGAL', 'value' => 1),
|
||||
array('var' => 'SituationDateEnd', 'op' => 'MAX', 'value' => 'DateRef'),
|
||||
array('var' => 'Situation', 'op' => 'SET', 'value' => ''),
|
||||
array( 'var' => 'Situation', 'op' => 'EGAL', 'value' => 'P'),
|
||||
array( 'var' => 'InseeActif', 'op' => 'EGAL', 'value' => 1),
|
||||
array( 'var' => 'SituationDateEnd', 'op' => 'MAX', 'value' => 'DateToday'),
|
||||
array( 'var' => 'Situation', 'op' => 'SET', 'value' => ''),
|
||||
),
|
||||
),
|
||||
// --- En Procol mais présence d'une annonce de cloture ou LJ avec Bilan publié ultérieurement
|
||||
@ -190,13 +190,13 @@ return array(
|
||||
'name' => 'PROCOL-CLOTURE-LJ-BILAN',
|
||||
'value' => 'CONTINUE',
|
||||
'params' => array(
|
||||
array('var' => 'Situation', 'op' => 'EGAL', 'value' => 'P'),
|
||||
array('var' => 'Even', 'op' => 'EGAL', 'value' => array(
|
||||
array( 'var' => 'Situation', 'op' => 'EGAL', 'value' => 'P'),
|
||||
array( 'var' => 'Even', 'op' => 'EGAL', 'value' => array(
|
||||
1300,1301,1302,1303,1304,1305,1306,1307,1308,1309,1311,1312,1313,
|
||||
1500,1501,1502,1503,1504
|
||||
)),
|
||||
array('var' => 'BilanCloture', 'op' => 'MIN', 'value' => 'EvenDate'),
|
||||
array('var' => 'Situation', 'op' => 'SET', 'value' => ''),
|
||||
array( 'var' => 'BilanCloture', 'op' => 'MIN', 'value' => 'DateToday'),
|
||||
array( 'var' => 'Situation', 'op' => 'SET', 'value' => ''),
|
||||
),
|
||||
),
|
||||
// --- En Procol mais présence d'une annonce LJ avec Bilan publié ultérieurement, uniquement FJ!=1xxx
|
||||
@ -204,17 +204,17 @@ return array(
|
||||
'name' => 'PROCOL-CLOTURE',
|
||||
'value' => 'CONTINUE',
|
||||
'params' => array(
|
||||
array('var' => 'Situation', 'op' => 'EGAL', 'value' => 'P'),
|
||||
array('var' => 'FJ', 'op' => 'MIN', 'value' => 1999),
|
||||
array( 'var' => 'Situation', 'op' => 'EGAL', 'value' => 'P'),
|
||||
array( 'var' => 'FJ', 'op' => 'MIN', 'value' => 1999),
|
||||
//Si l'evenement procol de départ, précédent est
|
||||
array('var' => 'SituationLastEven', 'op' => 'EGAL', 'value' => array(
|
||||
array( 'var' => 'SituationLastEven', 'op' => 'EGAL', 'value' => array(
|
||||
1300,1301,1302,1303,1304,1305,1306,1307,1308,1309,1311,1312,1313,1314,1417
|
||||
)),
|
||||
array('var' => 'Even', 'op' => 'EGAL', 'value' => array(
|
||||
array( 'var' => 'Even', 'op' => 'EGAL', 'value' => array(
|
||||
1502,1503
|
||||
)),
|
||||
array('var' => 'BilanCloture', 'op' => 'MIN', 'value' => 'EvenDate'),
|
||||
array('var' => 'Situation', 'op' => 'SET', 'value' => 'CL'),
|
||||
array( 'var' => 'BilanCloture', 'op' => 'MIN', 'value' => 'DateToday'),
|
||||
array( 'var' => 'Situation', 'op' => 'SET', 'value' => 'CL'),
|
||||
),
|
||||
),
|
||||
// --- En procol mais cutoff manuel
|
||||
@ -222,10 +222,10 @@ return array(
|
||||
'name' => 'PROCOL-CUT-OFF',
|
||||
'value' => 'CONTINUE',
|
||||
'params' => array(
|
||||
array('var' => 'Situation', 'op' => 'EGAL', 'value' => 'P'),
|
||||
array('var' => 'Cutoff', 'op' => 'EGAL', 'value' => true),
|
||||
array('var' => 'ScoreSolv', 'op' => 'MIN', 'value' => 0),
|
||||
array('var' => 'Situation', 'op' => 'SET', 'value' => ''),
|
||||
array( 'var' => 'Situation', 'op' => 'EGAL', 'value' => 'P'),
|
||||
array( 'var' => 'Cutoff', 'op' => 'EGAL', 'value' => true),
|
||||
array( 'var' => 'ScoreSolv', 'op' => 'MIN', 'value' => 0),
|
||||
array( 'var' => 'Situation', 'op' => 'SET', 'value' => ''),
|
||||
),
|
||||
),
|
||||
// --- Absorbé ?? ICI uniquement lorsque Situation = ''
|
||||
@ -233,9 +233,9 @@ return array(
|
||||
'name' => 'ABSORPTION',
|
||||
'value' => 'CONTINUE',
|
||||
'params' => array(
|
||||
array('var' => 'Situation', 'op' => 'EGAL', 'value' => ''),
|
||||
array('var' => 'Even', 'op' => 'EGAL', 'value' => 'ListEvenAbsorption'),
|
||||
array('var' => 'Situation', 'op' => 'SET', 'value' => 'A'),
|
||||
array( 'var' => 'Situation', 'op' => 'EGAL', 'value' => ''),
|
||||
array( 'var' => 'Even', 'op' => 'EGAL', 'value' => 'ListEvenAbsorption'),
|
||||
array( 'var' => 'Situation', 'op' => 'SET', 'value' => 'A'),
|
||||
),
|
||||
),
|
||||
// --- Dissolution ?? ICI uniquement lorsque Situation = ''
|
||||
@ -243,9 +243,9 @@ return array(
|
||||
'name' => 'DISSOLUTION',
|
||||
'value' => 'CONTINUE',
|
||||
'params' => array(
|
||||
array('var' => 'Situation', 'op' => 'EGAL', 'value' => ''),
|
||||
array('var' => 'Even', 'op' => 'EGAL', 'value' => 'ListEvenDissolution'),
|
||||
array('var' => 'Situation', 'op' => 'SET', 'value' => 'D'),
|
||||
array( 'var' => 'Situation', 'op' => 'EGAL', 'value' => ''),
|
||||
array( 'var' => 'Even', 'op' => 'EGAL', 'value' => 'ListEvenDissolution'),
|
||||
array( 'var' => 'Situation', 'op' => 'SET', 'value' => 'D'),
|
||||
),
|
||||
),
|
||||
// --- Dissolution mais bilan après événements ?? ICI uniquement lorsque Situation = ''
|
||||
@ -253,10 +253,10 @@ return array(
|
||||
'name' => 'DISSOLUTION-AVEC-BILAN',
|
||||
'value' => 'CONTINUE',
|
||||
'params' => array(
|
||||
array('var' => 'Situation', 'op' => 'EGAL', 'value' => ''),
|
||||
array('var' => 'Even', 'op' => 'EGAL', 'value' => 'ListEvenDissolution'),
|
||||
array('var' => 'BilanCloture', 'op' => 'MIN', 'value' => 'EvenDate'),
|
||||
array('var' => 'Situation', 'op' => 'SET', 'value' => ''),
|
||||
array( 'var' => 'Situation', 'op' => 'EGAL', 'value' => ''),
|
||||
array( 'var' => 'Even', 'op' => 'EGAL', 'value' => 'ListEvenDissolution'),
|
||||
array( 'var' => 'BilanCloture', 'op' => 'MIN', 'value' => 'EvenDateJugement'),
|
||||
array( 'var' => 'Situation', 'op' => 'SET', 'value' => ''),
|
||||
),
|
||||
),
|
||||
// --- Radiation RM
|
||||
@ -264,10 +264,10 @@ return array(
|
||||
'name' => 'RADIATION-RM',
|
||||
'value' => 'CONTINUE',
|
||||
'params' => array(
|
||||
array('var' => 'Situation', 'op' => 'EGAL', 'value' => ''),
|
||||
array('var' => 'IsRM', 'op' => 'EGAL', 'value' => 1),
|
||||
array('var' => 'InseeActif', 'op' => 'EGAL', 'value' => 0),
|
||||
array('var' => 'Situation', 'op' => 'SET', 'value' => 'RR'),
|
||||
array( 'var' => 'Situation', 'op' => 'EGAL', 'value' => ''),
|
||||
array( 'var' => 'IsRM', 'op' => 'EGAL', 'value' => 1),
|
||||
array( 'var' => 'InseeActif', 'op' => 'EGAL', 'value' => 0),
|
||||
array( 'var' => 'Situation', 'op' => 'SET', 'value' => 'RR'),
|
||||
),
|
||||
),
|
||||
// --- Radiation RCS
|
||||
@ -275,22 +275,10 @@ return array(
|
||||
'name' => 'RADIATION-RCS',
|
||||
'value' => 'CONTINUE',
|
||||
'params' => array(
|
||||
array('var' => 'Situation', 'op' => 'EGAL', 'value' => ''),
|
||||
array('var' => 'IsRCS', 'op' => 'EGAL', 'value' => 1),
|
||||
array('var' => 'InseeActif', 'op' => 'EGAL', 'value' => 0),
|
||||
array('var' => 'EvenNb', 'op' => 'MIN', 'value' => 'EvenIndex'),
|
||||
array('var' => 'Situation', 'op' => 'SET', 'value' => 'RR'),
|
||||
),
|
||||
),
|
||||
// --- Radiation RCS avec Date
|
||||
array(
|
||||
'name' => 'RADIATION-DATE',
|
||||
'value' => 'CONTINUE',
|
||||
'params' => array(
|
||||
array('var' => 'Situation', 'op' => 'EGAL', 'value' => ''),
|
||||
array('var' => 'GreffeRadiationDate', 'op' => 'MIN', 'value' => 0),
|
||||
array('var' => 'EvenNb', 'op' => 'MIN', 'value' => 'EvenIndex'),
|
||||
array('var' => 'Situation', 'op' => 'SET', 'value' => 'RR'),
|
||||
array( 'var' => 'Situation', 'op' => 'EGAL', 'value' => ''),
|
||||
array( 'var' => 'IsRCS', 'op' => 'EGAL', 'value' => 1),
|
||||
array( 'var' => 'InseeActif', 'op' => 'EGAL', 'value' => 0),
|
||||
array( 'var' => 'Situation', 'op' => 'SET', 'value' => 'RR'),
|
||||
),
|
||||
),
|
||||
// --- Radiation Publié 1
|
||||
@ -298,22 +286,22 @@ return array(
|
||||
'name' => 'RADIATION-PUB1',
|
||||
'value' => 'CONTINUE',
|
||||
'params' => array(
|
||||
array('var' => 'Situation', 'op' => 'EGAL', 'value' => ''),
|
||||
array('var' => 'Even', 'op' => 'EGAL', 'value' => 'ListEvenRadiation'),
|
||||
array('var' => 'EtabActifNb', 'op' => 'EGAL', 'value' => 0),
|
||||
array('var' => 'Situation', 'op' => 'SET', 'value' => 'RP'),
|
||||
array( 'var' => 'Situation', 'op' => 'EGAL', 'value' => ''),
|
||||
array( 'var' => 'Even', 'op' => 'EGAL', 'value' => 'ListEvenRadiation'),
|
||||
array( 'var' => 'EtabActifNb', 'op' => 'EGAL', 'value' => 0),
|
||||
array( 'var' => 'Situation', 'op' => 'SET', 'value' => 'RP'),
|
||||
),
|
||||
),
|
||||
// --- Radiation Publié 2
|
||||
// Radiation Publié 2
|
||||
array(
|
||||
'name' => 'RADIATION-PUB2',
|
||||
'value' => 'CONTINUE',
|
||||
'params' => array(
|
||||
array('var' => 'Situation', 'op' => 'EGAL', 'value' => ''),
|
||||
array('var' => 'Even', 'op' => 'EGAL', 'value' => 'ListEvenRadiation'),
|
||||
array('var' => 'InseeActif', 'op' => 'EGAL', 'value' => 0),
|
||||
array('var' => 'IsRCS', 'op' => 'EGAL', 'value' => 1),
|
||||
array('var' => 'Situation', 'op' => 'SET', 'value' => 'RP'),
|
||||
array( 'var' => 'Situation', 'op' => 'EGAL', 'value' => ''),
|
||||
array( 'var' => 'Even', 'op' => 'EGAL', 'value' => 'ListEvenRadiation'),
|
||||
array( 'var' => 'InseeActif', 'op' => 'EGAL', 'value' => 0),
|
||||
array( 'var' => 'IsRCS', 'op' => 'EGAL', 'value' => 1),
|
||||
array( 'var' => 'Situation', 'op' => 'SET', 'value' => 'RP'),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
@ -44,7 +44,7 @@ return array(
|
||||
1201, //Conversion sauvegarde en Redressement Judiciaire
|
||||
1202, //Renouvellement de la période d'observation
|
||||
1203, //Avis de dépôt de l'état de collocation
|
||||
//1204, //Avis de dépôt de l'état des créances
|
||||
1204, //Avis de dépôt de l'état des créances
|
||||
1205, //Avis de dépôt de l'état des créances complémentaires nées après jugement d'ouverture
|
||||
1206, //Avis de dépôt de l'état des créances nées après jugement d'ouverture
|
||||
1207, //Règlements amiables
|
||||
@ -88,8 +88,8 @@ return array(
|
||||
1410, //Suite de jugement/règlement/liquidation
|
||||
1411, //Arrêt du plan de cession
|
||||
1412, //Arrêt du plan de cession partielle
|
||||
//1413, //Arrêt du plan de continuation
|
||||
//1414, //Arrêt du plan de redressement => Supprimer les éléments
|
||||
1413, //Arrêt du plan de continuation
|
||||
1414, //Arrêt du plan de redressement
|
||||
1415, //Prolongement du plan cession
|
||||
1416, //Jugement constatant la bonne exécution du plan
|
||||
1417, //Jugement d'extension de liquidation judiciaire
|
||||
|
@ -86,29 +86,14 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
protected $iDb;
|
||||
|
||||
/**
|
||||
* MInsee
|
||||
*/
|
||||
public function __construct($db = null)
|
||||
{
|
||||
if ($db === null) {
|
||||
$this->iDb = new Metier_Util_Db();
|
||||
} else {
|
||||
$this->iDb = $db;
|
||||
}
|
||||
|
||||
$this->conn = Zend_Registry::get('doctrine');
|
||||
|
||||
$this->iBodacc = new Metier_Bodacc_MBodacc();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Logger from app registry
|
||||
*/
|
||||
public function setLogger()
|
||||
{
|
||||
if (Zend_Registry::isRegistered('logger')) {
|
||||
$this->logger = Zend_Registry::get('logger');
|
||||
}
|
||||
@ -374,7 +359,9 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
*/
|
||||
public function rechercheDir($nom, $prenom='', $fonction='', $dateNaiss='', $villeNaiss='', $deb=0, $nbRep=20, $maxRep=200, $pertinence=false)
|
||||
{
|
||||
Metier_Util_Log::write('I', "rechercheDir de $nom, $prenom, $fonction, $dateNaiss, $villeNaiss (Max Rep=$nbRep)", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->info("rechercheDir de $nom, $prenom, $fonction, $dateNaiss, $villeNaiss (Max Rep=$nbRep)");
|
||||
}
|
||||
$jour = $mois = $annee = '';
|
||||
if ($dateNaiss != '' && $dateNaiss != '//' && $dateNaiss != '0/0/0') {
|
||||
$tabDateNaiss = explode('/', $dateNaiss);
|
||||
@ -1256,7 +1243,9 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
IF (e.adr_dep=99, (SELECT libPays FROM jo.tabPays p WHERE p.codePaysInsee=e.adr_com) , 'France') AS libPays";
|
||||
|
||||
if ($typeId == 'TEL') {
|
||||
Metier_Util_Log::write('I', "Recherche par TEL de $id avec un maximum de $nbRep réponses", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->info("Recherche par TEL de $id avec un maximum de $nbRep réponses");
|
||||
}
|
||||
try {
|
||||
$stmt = $this->conn->executeQuery("SELECT count(*) AS nb FROM jo.etablissements
|
||||
WHERE TEL=$id OR FAX=$id $filtreActif");
|
||||
@ -1493,7 +1482,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
'Capital' => $etab['capital'],
|
||||
'CapitalDev' => $etab['capitalDev'],
|
||||
'TrancheCA' => $etab['tca'],
|
||||
'TrancheCALib' => self::$tabTCA[$etab['tca']],
|
||||
'TrancheCALib' => isset(self::$tabTCA[$etab['tca']])?self::$tabTCA[$etab['tca']]:null,
|
||||
'EffEnTr' => $etab['teff_entrep'],
|
||||
'EffEnTrLib' => self::$tabEffectif[$etab['teff_entrep']],
|
||||
'EffEtTr' => $etab['teff_etab'],
|
||||
@ -1798,33 +1787,37 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
$date = $this->companyEvenDateStop;
|
||||
}
|
||||
|
||||
$db = Zend_Db_Table_Abstract::getDefaultAdapter();
|
||||
$sql = $db->select()
|
||||
->from(array('e'=>'insee_even'), array(
|
||||
'CONCAT(LPAD(e.insSIREN,9,0), LPAD(e.insNIC,5,0)) AS Siret',
|
||||
'LPAD(e.insSIREN,9,0) AS Siren',
|
||||
'LPAD(e.insNIC,5,0) AS Nic',
|
||||
'insSIEGE AS Siege',
|
||||
'insNOMEN AS Nom',
|
||||
'insCODPOS AS CP',
|
||||
'insCJ AS FJ',
|
||||
'insAPEN700 AS NafEnt',
|
||||
'insAPEN700 AS NafEtab',
|
||||
'insTEFEN AS EffEnTr',
|
||||
'insEFENCENT AS Effectif',
|
||||
'insDCRET AS DateCreaEt',
|
||||
'insDCREN AS DateCreaEn',
|
||||
'insEVE',
|
||||
), 'insee')
|
||||
->joinLeft(array('i'=>'insee_notices'), 'i.insSIREN=e.insSIREN AND i.insNIC=e.insNIC', array(
|
||||
'insRECME AS RECME',
|
||||
), 'insee')
|
||||
->where('e.insSIREN = ?', $siren)
|
||||
->where('idFlux < ?', $date)
|
||||
->order('idFlux DESC')->order('insSIEGE DESC')->limit(1);
|
||||
$result = $db->fetchRow($sql, null, Zend_Db::FETCH_ASSOC);
|
||||
if ($result !== null) {
|
||||
$identite = $result;
|
||||
$sql = "SELECT CONCAT(LPAD(e.insSIREN,9,0), LPAD(e.insNIC,5,0)) AS Siret,
|
||||
LPAD(e.insSIREN,9,0) AS Siren,
|
||||
LPAD(e.insNIC,5,0) AS Nic,
|
||||
e.insSIEGE AS Siege,
|
||||
e.insNOMEN AS Nom,
|
||||
e.insCODPOS AS CP,
|
||||
e.insCJ AS FJ,
|
||||
e.insAPEN700 AS NafEnt,
|
||||
e.insAPEN700 AS NafEtab,
|
||||
e.insTEFEN AS EffEnTr,
|
||||
e.insEFENCENT AS Effectif,
|
||||
e.insDCRET AS DateCreaEt,
|
||||
e.insDCREN AS DateCreaEn,
|
||||
e.insEVE,
|
||||
i.insRECME AS RECME
|
||||
FROM insee.insee_even e
|
||||
LEFT OUTER JOIN insee.insee_notices i ON (i.insSIREN=e.insSIREN AND i.insNIC=e.insNIC)
|
||||
WHERE e.insSIREN=:siren AND idFlux<:date ORDER BY idFlux DESC, insSIEGE DESC LIMIT 0,1";
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->bindValue('date', $date);
|
||||
$stmt->execute();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$identite = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
}
|
||||
// --- Recherche dans le stock
|
||||
else {
|
||||
@ -1834,31 +1827,37 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
break;
|
||||
}
|
||||
}
|
||||
$sql = $db->select()
|
||||
->from(array('e'=>$notice), array(
|
||||
'CONCAT(LPAD(SIREN,9,0), LPAD(NIC,5,0)) AS Siret',
|
||||
'LPAD(SIREN,9,0) AS Siren',
|
||||
'LPAD(NIC,5,0) AS Nic',
|
||||
'SIEGE AS Siege',
|
||||
'NOMEN_LONG AS Nom',
|
||||
'CODPOS AS CP',
|
||||
'CJ AS FJ',
|
||||
'APEN700 AS NafEnt',
|
||||
'APEN700 AS NafEtab',
|
||||
'TEFEN AS EffEnTr',
|
||||
'EFENCENT AS Effectif',
|
||||
'DCRET AS DateCreaEt',
|
||||
'insDCREN AS DateCreaEn',
|
||||
), 'historiques')
|
||||
->joinLeft(array('i'=>'insee_notices'), 'i.insSIREN=e.SIREN AND i.insNIC=e.NIC', array(
|
||||
'insRECME AS RECME',
|
||||
), 'insee')
|
||||
->where('e.insSIREN = ?', $siren)
|
||||
->where('idFlux < ?', $date)
|
||||
->order('idFlux DESC')->order('insSIEGE DESC')->limit(1);
|
||||
$result = $db->fetchRow($sql, null, Zend_Db::FETCH_ASSOC);
|
||||
if ($result !== null) {
|
||||
$identite = $result;
|
||||
|
||||
$sql = "SELECT CONCAT(LPAD(e.SIREN,9,0), LPAD(e.NIC,5,0)) AS Siret,
|
||||
LPAD(e.SIREN,9,0) AS Siren,
|
||||
LPAD(e.NIC,5,0) AS Nic,
|
||||
e.SIEGE AS Siege,
|
||||
e.NOMEN_LONG AS Nom,
|
||||
e.CODPOS AS CP,
|
||||
e.CJ AS FJ,
|
||||
e.APEN700 AS NafEnt,
|
||||
e.APEN700 AS NafEtab,
|
||||
e.TEFEN AS EffEnTr,
|
||||
e.EFENCENT AS Effectif,
|
||||
e.DCRET AS DateCreaEt,
|
||||
insDCREN AS DateCreaEn
|
||||
i.insRECME AS RECME
|
||||
FROM insee.$notice e
|
||||
LEFT OUTER JOIN insee.insee_notices i ON (i.insSIREN=e.SIREN AND i.insNIC=e.NIC)
|
||||
WHERE e.insSIREN=:siren AND idFlux<:date ORDER BY idFlux DESC, insSIEGE DESC LIMIT 0,1";
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->bindValue('date', $date);
|
||||
$stmt->execute();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$identite = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
}
|
||||
}
|
||||
if (count($identite) > 0) {
|
||||
@ -1881,15 +1880,22 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
}
|
||||
|
||||
// --- Capital
|
||||
$sql = $db->select()
|
||||
->from('rncs_modifs', array('valeur'), 'jo')
|
||||
->where('champs = ?', 'capitalMontant')
|
||||
->where('siren = ? ', $siren)
|
||||
->where('flux < ?', $date)
|
||||
->order('flux DESC')->limit(1);
|
||||
$result = $db->fetchRow($sql, null, Zend_Db::FETCH_OBJ);
|
||||
$sql = "SELECT valeur FROM jo.rncs_modifs
|
||||
WHERE champs='capitalMontant' AND siren=:siren AND flux<:date
|
||||
ORDER BY flux DESC LIMIT 0,1";
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->bindValue('date', $date);
|
||||
$stmt->execute();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
$identite['Capital'] = '';
|
||||
if ($result !== null) {
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$result = $stmt->fetch(\PDO::FETCH_OBJ);
|
||||
$identite['Capital'] = $result->valeur;
|
||||
}
|
||||
|
||||
@ -2239,7 +2245,9 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
|
||||
$iTva = new Metier_Partenaires_MTva();
|
||||
$iTva->setCompanyId($siren);
|
||||
$iTva->setRemote();
|
||||
if ($tabInsee['ACTIF']==1 && (date('H')<10 || date('H')>=18)) {
|
||||
$iTva->setRemote();
|
||||
}
|
||||
$iTva->getTVA();
|
||||
$vatNumber = $iTva->vatNumber;
|
||||
$vatDefined = $iTva->vatDefined;
|
||||
@ -2655,17 +2663,17 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
'5510Z', // Hôtels et hébergement similaire
|
||||
'5520Z', // Hébergement touristique et autre hébergement de co
|
||||
'5530Z', // Terrains de camping et parcs pour caravanes ou véh
|
||||
'702A', // Location de logements
|
||||
'702A', // Location de logements
|
||||
'6820A', // Location de logements
|
||||
'6820B', // Location de terrains et d'autres biens immobiliers
|
||||
'551A', // Hôtels touristiques avec restaurant
|
||||
'551A', // Hôtels touristiques avec restaurant
|
||||
'5610A', // Restauration traditionnelle
|
||||
'741J', // Administration d'entreprises
|
||||
'741J', // Administration d'entreprises
|
||||
'7010Z', // Activités des sièges sociaux
|
||||
'552C', // Exploitation de terrains de camping
|
||||
'702C', // Location d'autres biens immobiliers
|
||||
'551C', // Hôtels touristiques sans restaurant
|
||||
'553A', // Restauration de type traditionnel
|
||||
'552C', // Exploitation de terrains de camping
|
||||
'702C', // Location d'autres biens immobiliers
|
||||
'551C', // Hôtels touristiques sans restaurant
|
||||
'553A', // Restauration de type traditionnel
|
||||
);
|
||||
if (in_array($tabInsee['APE_ENT'], $tabNafTourisme)
|
||||
|| in_array($tabInsee['APE_ETAB'], $tabNafTourisme)) {
|
||||
@ -2784,6 +2792,149 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
));
|
||||
}
|
||||
|
||||
// --- Situation Juridique
|
||||
if (intval($siren) > 100) {
|
||||
if ($this->debug) {
|
||||
file_put_contents('procol.log', "=== Situation Juridique ===\n");
|
||||
}
|
||||
|
||||
$tabAnn = $this->getAnnoncesLegales($siren, 0, '', false, false);
|
||||
|
||||
if (count($tabAnn) > 0) {
|
||||
// Date de dernière mise à jour
|
||||
$tabDates = array();
|
||||
foreach ($tabAnn as $iAnn => $ann) {
|
||||
$tabDates[] = $ann['dateInsertionSD'];
|
||||
}
|
||||
rsort($tabDates);
|
||||
$tabRet['dateMajANN'] = Metier_Util_Date::dateT('Y-m-d', 'Y-m-d', $tabDates[0]);
|
||||
if ($tabRet['dateMajANN'] == '--') {
|
||||
$tabRet['dateMajANN'] = '';
|
||||
} else {
|
||||
$dateAnnLastCompare = DateTime::createFromFormat('Y-m-d', $tabRet['dateMajANN']);
|
||||
}
|
||||
|
||||
// Procol
|
||||
$tabProcol = $this->getAnnoncesLegales($siren, 0, 'P', false);
|
||||
if (count($tabProcol) > 0) {
|
||||
$tabDates = array();
|
||||
foreach ($tabProcol as $iProcol => $procol) {
|
||||
$tabDates[] = $procol['dateJugement'];
|
||||
}
|
||||
rsort($tabDates);
|
||||
$dateProcol = str_replace('-', '', $tabDates[0])*1;
|
||||
// Plan
|
||||
if ($this->dureePlan > 0 && date('Ymd') < $this->finPlan) {
|
||||
if ($this->debug) {
|
||||
file_put_contents('procol.log', "Plan (PL) : ".$this->dureePlan."-".$this->finPlan."\n", FILE_APPEND);
|
||||
}
|
||||
$tabRet['SituationJuridique'] = 'PL';
|
||||
}
|
||||
// Plan révolu
|
||||
elseif ($this->dureePlan > 0 && date('Ymd') >= $this->finPlan) {
|
||||
if ($this->debug) {
|
||||
file_put_contents('procol.log', "Plan revolu : ".$this->dureePlan."-".$this->finPlan."\n", FILE_APPEND);
|
||||
}
|
||||
$tabRet['SituationJuridique'] = '';
|
||||
}
|
||||
// Appel de jugement
|
||||
elseif ($this->appelJugement) {
|
||||
$tabRet['SituationJuridique'] = 'PA';
|
||||
}
|
||||
// Jugement de cloture après LJ
|
||||
elseif ($this->SituationCloture) {
|
||||
if ($this->debug) {
|
||||
file_put_contents('procol.log', "Cloture (CL) "."\n", FILE_APPEND);
|
||||
}
|
||||
$tabRet['SituationJuridique'] = 'CL';
|
||||
}
|
||||
// En cours de procédure
|
||||
else {
|
||||
if ($this->debug) {
|
||||
file_put_contents('procol.log', "Procol (P) "."\n", FILE_APPEND);
|
||||
}
|
||||
$tabRet['SituationJuridique'] = 'P';
|
||||
}
|
||||
|
||||
// RAZ SituationJuridique si cutoff plus récent que dernière procol
|
||||
try {
|
||||
$stmt = $this->conn->executeQuery("SELECT encours, scoreSolv, scoreDir, scoreConf,
|
||||
DATE(dateInsert)*1 AS dateInsert, DATE(dateUpdate)*1 AS dateUpdate
|
||||
FROM jo.scores_cutoff WHERE siren=$siren");
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$result = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
if ($result['scoreSolv'] > 0) {
|
||||
//Tri des dates de procol
|
||||
$tabDates = array();
|
||||
foreach ($tabProcol as $iProcol => $procol) {
|
||||
$tabDates[] = $procol['dateJugement'];
|
||||
}
|
||||
rsort($tabDates);
|
||||
$dateProcol = str_replace('-', '', $tabDates[0])*1;
|
||||
if ($result['dateUpdate'] > $result['dateInsert']) {
|
||||
$dateMaj = str_replace('-', '', $result['dateUpdate']);
|
||||
} else {
|
||||
$dateMaj = str_replace('-', '', $result['dateInsert']);
|
||||
}
|
||||
if ($dateProcol <= $dateMaj) {
|
||||
$tabRet['SituationJuridique'] = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Absorption
|
||||
if ($identite['SituationJuridique'] == '') {
|
||||
$tabAnn = $this->getAnnoncesLegales($siren, 0, 'A', false);
|
||||
$nbAnn = count($tabAnn);
|
||||
if ($nbAnn > 0) {
|
||||
if ($this->debug) {
|
||||
file_put_contents('procol.log', "DETECTION ABSORPTION\n", FILE_APPEND);
|
||||
}
|
||||
$dateAnn = $tabAnn[$nbAnn-1]['dateInsertionSD'];
|
||||
$dateAnnCompare = DateTime::createFromFormat('Y-m-d H:i:s', $dateAnn);
|
||||
$dateAnnCompare->add(new DateInterval('P364D'));
|
||||
if ($dateAnnCompare > $dateAnnLastCompare) {
|
||||
$tabRet['SituationJuridique'] = 'A';
|
||||
if ($this->debug) {
|
||||
file_put_contents('procol.log', "Entreprise absorbée\n", FILE_APPEND);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Dissolution
|
||||
if ($identite['SituationJuridique'] == '') {
|
||||
$tabAnn = $this->getAnnoncesLegales($siren, 0, 'D', false);
|
||||
$nbAnn = count($tabAnn);
|
||||
if ($nbAnn > 0) {
|
||||
if ($this->debug) {
|
||||
file_put_contents('procol.log', "DETECTION DISSOLUTION\n", FILE_APPEND);
|
||||
}
|
||||
$dateAnn = $tabAnn[$nbAnn-1]['dateInsertionSD'];
|
||||
$dateAnnCompare = DateTime::createFromFormat('Y-m-d H:i:s', $dateAnn);
|
||||
$dateAnnCompare->add(new DateInterval('P364D'));
|
||||
if ($dateAnnCompare > $dateAnnLastCompare) {
|
||||
$tabRet['SituationJuridique'] = 'D';
|
||||
if ($this->debug) {
|
||||
file_put_contents('procol.log', "Entreprise dissolue\n", FILE_APPEND);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->debug) {
|
||||
file_put_contents('procol.log', "SituationJuridique = ".$tabRet['SituationJuridique']."\n", FILE_APPEND);
|
||||
}
|
||||
$timer['getAnnoncesLegales'] = microtime(true);
|
||||
} // Fin Situation Juridique
|
||||
|
||||
if (($tabInsee['CJ'] > 0 && $tabInsee['CJ'] < 20
|
||||
|| $tabInsee['CJ'] > 999 && $tabInsee['CJ'] < 2000) && $tabInsee['DIR_FCT']=='') {
|
||||
$tabRet['dir1Titre'] = self::$tabFct['PP'];
|
||||
@ -3272,34 +3423,34 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
if (strtoupper(trim($entrep['sigle'])) != strtoupper(trim($tabRet['Sigle']))) {
|
||||
$tabRet['sigleLong'] = strtoupper($entrep['sigle']);
|
||||
}
|
||||
$tabRet['dateImmat'] = $entrep['dateImma'];
|
||||
$tabRet['dateRad'] = $entrep['dateRad'];
|
||||
$tabRet['Capital'] = $entrep['capitalMontant']+($entrep['capitalCent']/100);
|
||||
$tabRet['CapitalDev'] = $entrep['capitalDevIso'];
|
||||
$tabRet['CapitalType'] = trim(strtoupper(substr($entrep['capitalType'], 0, 1)));
|
||||
$tabRet['dateImmat'] = $entrep['dateImma'];
|
||||
$tabRet['dateRad'] = $entrep['dateRad'];
|
||||
$tabRet['Capital'] = $entrep['capitalMontant']+($entrep['capitalCent']/100);
|
||||
$tabRet['CapitalDev'] = $entrep['capitalDevIso'];
|
||||
$tabRet['CapitalType'] = trim(strtoupper(substr($entrep['capitalType'], 0, 1)));
|
||||
|
||||
// Par défaut, la Forme juridique qui fait foie est celle de l'INPI
|
||||
$fjInpi = $entrep['cj']*1;
|
||||
if ($tabRet['FJ']*1 != $fjInpi && $fjInpi>0) {
|
||||
$tabRet['FJ2'] = $tabRet['FJ'];
|
||||
$tabRet['FJ2_Lib'] = $tabRet['FJ_lib'];
|
||||
$tabRet['FJ'] = $fjInpi;
|
||||
$tabRet['FJ_lib'] = $this->getLibelleFJ($fjInpi);
|
||||
$tabRet['FJ2'] = $tabRet['FJ'];
|
||||
$tabRet['FJ2_Lib'] = $tabRet['FJ_lib'];
|
||||
$tabRet['FJ'] = $fjInpi;
|
||||
$tabRet['FJ_lib'] = $this->getLibelleFJ($fjInpi);
|
||||
} else {
|
||||
$tabRet['FJ2'] = $tabRet['FJ'];
|
||||
$tabRet['FJ2_Lib'] = $tabRet['FJ_lib'];
|
||||
$tabRet['FJ2'] = $tabRet['FJ'];
|
||||
$tabRet['FJ2_Lib'] = $tabRet['FJ_lib'];
|
||||
}
|
||||
if ($fjInpi >= 1000 && $fjInpi < 2000) {
|
||||
$tabRet['dir1Titre'] = 'Personne physique';
|
||||
$tabRet['dir1Code'] = '1050';
|
||||
$tabRet['dir1Titre'] = 'Personne physique';
|
||||
$tabRet['dir1Code'] = '1050';
|
||||
$tabRet['dir1NomPrenom'] = strtoupper($entrep['nom']).' '.
|
||||
ucwords(strtolower($entrep['prenom']));
|
||||
$tabRet['dir1Nom'] = strtoupper($entrep['nom']);
|
||||
$tabRet['dir1Prenom'] = ucwords(strtolower($entrep['prenom']));
|
||||
$tabRet['dir1NomUsage'] = strtoupper($entrep['nomUsage']);
|
||||
$tabRet['dir1DateNaiss'] = $entrep['dateNaiss'];
|
||||
$tabRet['dir1LieuNaiss'] = $entrep['lieuNaiss'];
|
||||
$tabRet['dir1Genre'] = $entrep['sexe'];
|
||||
$tabRet['dir1Nom'] = strtoupper($entrep['nom']);
|
||||
$tabRet['dir1Prenom'] = ucwords(strtolower($entrep['prenom']));
|
||||
$tabRet['dir1NomUsage'] = strtoupper($entrep['nomUsage']);
|
||||
$tabRet['dir1DateNaiss'] = $entrep['dateNaiss'];
|
||||
$tabRet['dir1LieuNaiss'] = $entrep['lieuNaiss'];
|
||||
$tabRet['dir1Genre'] = $entrep['sexe'];
|
||||
}
|
||||
|
||||
if ($tabRet['DateMajRCS'] == '') {
|
||||
@ -3316,6 +3467,10 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
// On signal que l'entreprise est radié du RCS
|
||||
else {
|
||||
$tabRet['EntActiveRCS'] = 0;
|
||||
// On signal que l'entreprise est radié du RCS
|
||||
if ($tabRet['SituationJuridique'] == '') {
|
||||
$tabRet['SituationJuridique'] = 'RR';
|
||||
}
|
||||
}
|
||||
|
||||
// Spécificité EIRL
|
||||
@ -3445,6 +3600,10 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
// On signal que l'entreprise est radié du RCS
|
||||
else {
|
||||
$tabRet['EntActiveRCS'] = 0;
|
||||
// On signal que l'entreprise est radié du RCS
|
||||
if ($tabRet['SituationJuridique'] == '') {
|
||||
$tabRet['SituationJuridique'] = 'RR';
|
||||
}
|
||||
}
|
||||
|
||||
$tabRet['NomCommercial'] = $rmEntrep['nomCommercial'];
|
||||
@ -3464,25 +3623,24 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
$tabRet['dir1Code'] = '1050';
|
||||
}
|
||||
|
||||
if ($accesDist
|
||||
if ($accesDist &&
|
||||
// Département couvert par Infogreffe
|
||||
&& !in_array($tabRet['Dept'], array(57, 67, 68, 97, 98, 99)) &&
|
||||
!in_array($tabRet['Dept'], array(57, 67, 68, 97, 98, 99)) &&
|
||||
// Forme Juridique présente au greffe
|
||||
(in_array($tabInsee['CJ'], array(1100, 1200, 1300, 1700, 9900))
|
||||
|| ($tabInsee['CJ']>=3100 && $tabInsee['CJ']<=3299)
|
||||
|| ($tabInsee['CJ']>=4100 && $tabInsee['CJ']<=4199)
|
||||
|| ($tabInsee['CJ']>=5100 && $tabInsee['CJ']<=5899)
|
||||
|| ($tabInsee['CJ']>=6100 && $tabInsee['CJ']<=6599)
|
||||
|| preg_match('/EIRL/', $nom) || preg_match('/EIRL/', $nom2)
|
||||
|| preg_match('/EIRL/', $tabRet['Sigle'])
|
||||
|| preg_match('/EIRL/', $tabRet['Enseigne'])
|
||||
|| preg_match('/EIRL/', $tabRet['Adresse'])
|
||||
|| preg_match('/EIRL/', $tabRet['Adresse2']) )
|
||||
&& ($tabInsee['CJ']==1700 || // Agents commerciaux (uniquement au Greffes RSAC)
|
||||
$tabRet['numRC']=='' || // Numéro de RCS absent = Anomalie (<à3%)
|
||||
$tabRet['Tribunal']=='' || // Tribunal absent = anomalie
|
||||
str_replace('-', '', $tabRet['dateImmat'])*1==0 || // Pas de date d'immat = anomalie (<à9%)
|
||||
($nbEtab*1 == 0 && str_replace('-', '', $tabRet['dateRad'])*1==0) // Inactif sans date de RAD
|
||||
(in_array($tabInsee['CJ'], array(1100,1200,1300,1700,9900)) ||
|
||||
($tabInsee['CJ']>=3100 && $tabInsee['CJ']<=3299) ||
|
||||
($tabInsee['CJ']>=4100 && $tabInsee['CJ']<=4199) ||
|
||||
($tabInsee['CJ']>=5100 && $tabInsee['CJ']<=5899) ||
|
||||
($tabInsee['CJ']>=6100 && $tabInsee['CJ']<=6599) ||
|
||||
preg_match('/EIRL/', $nom) || preg_match('/EIRL/', $nom2) ||
|
||||
preg_match('/EIRL/', $tabRet['Sigle']) || preg_match('/EIRL/', $tabRet['Enseigne']) ||
|
||||
preg_match('/EIRL/', $tabRet['Adresse']) || preg_match('/EIRL/', $tabRet['Adresse2'])
|
||||
)
|
||||
&& ($tabInsee['CJ'] == 1700 || // Agents commerciaux (uniquement au Greffes RSAC)
|
||||
$tabRet['numRC'] == '' || // Numéro de RCS absent = Anomalie (<à3%)
|
||||
$tabRet['Tribunal'] == '' || // Tribunal absent = anomalie
|
||||
str_replace('-', '', $tabRet['dateImmat'])*1 == 0 || // Pas de date d'immat = anomalie (<à9%)
|
||||
($nbEtab*1 == 0 && str_replace('-', '', $tabRet['dateRad'])*1 == 0) // Inactif sans date de RAD
|
||||
)
|
||||
) {
|
||||
if ($this->debugtime) {
|
||||
@ -3495,7 +3653,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
$iRncs = new Metier_Partenaires_MRncs();
|
||||
|
||||
if ($this->debugtime) {
|
||||
$duree = round(microtime(1)-$tdeb, 3);
|
||||
$duree=round(microtime(1)-$tdeb, 3);
|
||||
file_put_contents(LOG_PATH.'/accesDistant.log', date('YmdHis').";$siren;MGreffes APRES ($duree s)\n", FILE_APPEND);
|
||||
}
|
||||
|
||||
@ -3509,11 +3667,12 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
if (str_replace('-', '', $tabRet['dateImmat'])*1 == 0) {
|
||||
$tabRet['dateImmat'] = $etabG['DateCreation'];
|
||||
}
|
||||
|
||||
if (str_replace('-', '', $tabRet['dateRad'])*1==0) {
|
||||
$tabRet['dateRad'] = $etabG['DateRadiation'];
|
||||
if (str_replace('-', '', $tabRet['dateRad'])*1 == 0) {
|
||||
$tabRet['dateRad'] = $etabG['DateRadiation'];
|
||||
if (str_replace('-', '', $tabRet['dateRad'])*1 > 0 && $tabRet['SituationJuridique'] == '') {
|
||||
$tabRet['SituationJuridique'] = 'RR';
|
||||
}
|
||||
}
|
||||
|
||||
if (preg_match('/[A-Z]/i', substr($tabRet['AutreId'], 2, 2)) || $tabRet['AutreId']=='') {
|
||||
$tabRet['AutreId'] = $etabG['NumRC2'];
|
||||
}
|
||||
@ -3526,6 +3685,9 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
$tabRad = $this->getAnnoncesLegales($siren, 0, 'R');
|
||||
// Il y a au moins une annonce de radiation au Bodacc
|
||||
if (count($tabRad) > 0) {
|
||||
if ($tabRet['SituationJuridique'] == '') {
|
||||
$tabRet['SituationJuridique'] = 'RP';
|
||||
}
|
||||
$dateEff = str_replace('-', '', $tabRad[0]['dateEffet'])*1;
|
||||
$dateJug = str_replace('-', '', $tabRad[0]['dateJugement'])*1;
|
||||
$datePar = str_replace('-', '', $tabRad[0]['DateParution'])*1;
|
||||
@ -3668,84 +3830,15 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
$timer['infosBoursieres'] = microtime(true);
|
||||
}
|
||||
|
||||
// --- Situation Juridique
|
||||
$situation = '';
|
||||
if (intval($siren) > 100) {
|
||||
$annoncesList = $this->getAnnoncesLegales($siren);
|
||||
$annoncesNb = count($annoncesList);
|
||||
$detect = new Metier_Defaillance_Detect();
|
||||
$detect->setEvenNb($annoncesNb);
|
||||
$detect->setFJ($tabInsee['CJ']);
|
||||
$detect->setInseeActif($tabInsee['ACTIF']);
|
||||
$detect->setEtabActif($nbEtab);
|
||||
if ($tabRet['numGreffe']*1 > 0) {
|
||||
$detect->setGreffe(1);
|
||||
}
|
||||
$detect->setRcsActif($tabRet['EntActiveRCS']);
|
||||
if (isset($entrep['numRM'])) {
|
||||
$detect->setRM(1);
|
||||
}
|
||||
$detect->setBilanCloture($tabRet['bilanDate']);
|
||||
if (isset($tabRet['dateRad'])) {
|
||||
$detect->setGreffeRadiation($tabRet['dateRad']);
|
||||
}
|
||||
if ($annoncesNb > 0) {
|
||||
// Parcours annonces
|
||||
$tabJugements = array();
|
||||
foreach ($annoncesList as $i => $ann) {
|
||||
$date = str_replace('-','', $ann['dateJugement']);
|
||||
if (intval($date) == 0) {
|
||||
$date = str_replace('-','', $ann['dateParution']);
|
||||
}
|
||||
if (!empty($date)) {
|
||||
$tabJugements[$date] = $ann;
|
||||
}
|
||||
}
|
||||
ksort($tabJugements);
|
||||
foreach ($tabJugements as $ann) {
|
||||
$annFormat = new stdClass();
|
||||
$date = str_replace('-', '', $ann['dateJugement']);
|
||||
if (intval($date) == 0) {
|
||||
$date = str_replace('-','', $ann['dateParution']);
|
||||
}
|
||||
$annFormat->date = $date;
|
||||
$annFormat->code = $ann['evenements'][0]['CodeEven'];
|
||||
$annFormat->txt = $ann['texteAnnonce'];
|
||||
|
||||
$detect->parse($annFormat);
|
||||
$situation = $detect->getSituation();
|
||||
|
||||
// Date de radiation
|
||||
if ($situation == 'RP') {
|
||||
$timeline = $detect->getTimeline();
|
||||
$last = end($timeline);
|
||||
$tabRet['dateRad'] = $last->DateStart;
|
||||
}
|
||||
}
|
||||
}
|
||||
$tabRet['SituationJuridique'] = $situation;
|
||||
// Fin Situation Juridique
|
||||
|
||||
// Date de dernière mise à jour
|
||||
if ($annoncesNb > 0) {
|
||||
$annonceLast = end($annoncesList);
|
||||
$tabRet['dateMajANN'] = Metier_Util_Date::dateT('Y-m-d', 'Y-m-d', $annonceLast['dateInsertionSD']);
|
||||
if ($tabRet['dateMajANN'] == '--') {
|
||||
$tabRet['dateMajANN'] = '';
|
||||
}
|
||||
}
|
||||
$timer['getAnnoncesLegales'] = microtime(true);
|
||||
}
|
||||
|
||||
// Date de dernière mise à jour
|
||||
$lastMaj = str_replace('-', '', $tabRet['DateMajINSEE'])*1;
|
||||
if (str_replace('-', '', $tabRet['DateMajRCS'])*1 > $lastMaj) {
|
||||
$lastMaj = str_replace('-', '', $tabRet['DateMajRCS'])*1;
|
||||
}
|
||||
if (str_replace('-', '', $tabRet['bilanDateMaj'])*1 > $lastMaj) {
|
||||
if (str_replace('-', '', $tabRet['bilanDateMaj'])*1>$lastMaj) {
|
||||
$lastMaj = str_replace('-', '', $tabRet['bilanDateMaj'])*1;
|
||||
}
|
||||
if (str_replace('-', '', $tabRet['dateMajANN'])*1 > $lastMaj) {
|
||||
if (str_replace('-', '', $tabRet['dateMajANN'])*1>$lastMaj) {
|
||||
$lastMaj = str_replace('-', '', $tabRet['dateMajANN'])*1;
|
||||
}
|
||||
$tabRet['dateMajIdentite'] = Metier_Util_Date::dateT('Ymd', 'Y-m-d', $lastMaj);
|
||||
@ -4784,13 +4877,42 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
*/
|
||||
public function getAnnoncesLegalesPlan($type, $fj, $annonce)
|
||||
{
|
||||
// --- Bodacc
|
||||
if ($type == 'bodacc') {
|
||||
$tabEven = explode(';', $annonce['typeEven']);
|
||||
foreach ($tabEven as $even) {
|
||||
$this->matchPlanDuree($even, $annonce['dateJugement'], $annonce['annonce']);
|
||||
}
|
||||
}
|
||||
// --- Annonce
|
||||
if ($type == 'annonce') {
|
||||
$this->matchPlanDuree($annonce['typeEven'], $annonce['dateJugement'], $annonce['annonce']);
|
||||
}
|
||||
|
||||
// --- Historique
|
||||
if ($type == 'histo') {
|
||||
$this->matchPlanDuree($annonce['CODEVE'], $annonce['DATE'], $annonce['annonceTxt']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected function matchPlanDuree($eve, $date, $txt)
|
||||
{
|
||||
if ($this->debug) {
|
||||
file_put_contents('procol.log', "MATCH DUREE PLAN : ", FILE_APPEND);
|
||||
}
|
||||
|
||||
$evenDetect = array(
|
||||
'75', // Histo
|
||||
'1407', // Modification de plan
|
||||
'1409', // Modification du plan de continuation
|
||||
'1413', // Arrêt du plan de continuation
|
||||
'1414', // Arrêt du plan de redressement
|
||||
'1101', // Arrêt du plan de sauvegarde
|
||||
);
|
||||
|
||||
$fjDetect = array(
|
||||
16,1600, // Exploitant agricole
|
||||
63,6316,6317,6318, // Société coopérative agricole
|
||||
@ -4800,80 +4922,41 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
6597,6598,
|
||||
);
|
||||
|
||||
// --- Bodacc
|
||||
if ($type == 'bodacc') {
|
||||
$tabEven = explode(';', $annonce['typeEven']);
|
||||
foreach ($tabEven as $even) {
|
||||
if (intval($even)!=0) {
|
||||
if (($this->dureePlan==0 || $this->dureePlan==120) && in_array($even, $evenDetect)) {
|
||||
if ($this->debug) {
|
||||
file_put_contents('procol.log', "BODACC MATCH DUREE PLAN \n", FILE_APPEND);
|
||||
}
|
||||
// --- Lecture dureePlan dans annonce
|
||||
$this->debutPlan = str_replace('-', '', $annonce['dateJugement']); // SSAAMMJJ
|
||||
if (preg_match('/dur.e(?:.*)plan(?:.*)(\d+)\s+ans?/Uisu', $annonce['annonce'], $matches)) {
|
||||
$this->dureePlan = $matches[1]*12; // 10 ans = 120 mois
|
||||
}
|
||||
|
||||
// --- Duree du Plan par défaut sur FJ et par défaut
|
||||
if ($this->dureePlan<1 || $this->dureePlan>120) {
|
||||
if (in_array($fj, $fjDetect)) {
|
||||
$this->dureePlan = 180; // 15 ans
|
||||
} else {
|
||||
$this->dureePlan = 120; // 10 ans = 120 mois
|
||||
}
|
||||
}
|
||||
$this->finPlan = Metier_Util_Date::period2Days($this->debutPlan, $this->dureePlan.' mois');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --- Historique
|
||||
if ($type == 'histo') {
|
||||
if (($this->dureePlan==0 || $this->dureePlan==120) && $annonce['CODEVE']==75) { // Modification de plan
|
||||
$this->debutPlan = $annonce['DATE']; // SSAAMMJJ
|
||||
if (preg_match('/dur.e(?:.*)plan(?:.*)(\d+)\s+ans?/Uisu', $annonce['annonceTxt'], $matches)) {
|
||||
if (in_array($eve, $evenDetect)) {
|
||||
if (($this->dureePlan == 0 || $this->dureePlan == 120)) {
|
||||
// --- Lecture dureePlan dans annonce
|
||||
$this->debutPlan = str_replace('-', '', $date); // SSAAMMJJ
|
||||
if (preg_match('/dur.e(?:.*)plan(?:.*)(\d+)\s+ans?/Uisu', $txt, $matches)) {
|
||||
$this->dureePlan = $matches[1]*12; // 10 ans = 120 mois
|
||||
if ($this->debug) {
|
||||
file_put_contents('procol.log', "HISTO MATCH DUREE PLAN \n", FILE_APPEND);
|
||||
}
|
||||
}
|
||||
if (preg_match('/dur.e(?:.*)plan(?:.*)(\d+)\s+mois?/Uisu', $txt, $matches)) {
|
||||
$this->dureePlan = $matches[1];
|
||||
}
|
||||
// --- Duree du Plan par défaut sur FJ et par défaut
|
||||
if ($this->dureePlan<1 || $this->dureePlan>120) {
|
||||
if ($this->dureePlan < 1 || $this->dureePlan > 120) {
|
||||
if (in_array($fj, $fjDetect)) {
|
||||
$this->dureePlan = 180; // 15 ans
|
||||
} else {
|
||||
$this->dureePlan = 120; // 10 ans = 120 mois
|
||||
}
|
||||
}
|
||||
if ($this->debug) {
|
||||
file_put_contents('procol.log', $this->dureePlan." mois", FILE_APPEND);
|
||||
}
|
||||
$this->finPlan = Metier_Util_Date::period2Days($this->debutPlan, $this->dureePlan.' mois');
|
||||
}
|
||||
}
|
||||
|
||||
// --- Annonce
|
||||
if ($type == 'annonce') {
|
||||
if (($this->dureePlan<1 || $this->dureePlan==120) && in_array($annonce['typeEven'], $evenDetect)) {
|
||||
$this->debutPlan = str_replace('-', '', $annonce['dateJugement']); // SSAAMMJJ
|
||||
if (preg_match('/dur.e(?:.*)plan(?:.*)(\d+)\s+ans?/Uisu', $annonce['annonce'], $matches)) {
|
||||
$this->dureePlan = $matches[1]*12; // 10 ans = 120 mois
|
||||
} elseif (preg_match('/dur.e(?:.*)plan(?:.*)(\d+)\s+ans?/Uisu', $annonce['annonce'], $matches)) {
|
||||
$this->dureePlan = $matches[1]*12; // 10 ans = 120 mois
|
||||
}
|
||||
if ($this->dureePlan<1 || $this->dureePlan>120) {
|
||||
if (in_array($fj, $fjDetect)) {
|
||||
$this->dureePlan = 180; // 15 ans
|
||||
} else {
|
||||
$this->dureePlan = 120; // 10 ans = 120 mois
|
||||
}
|
||||
}
|
||||
$this->finPlan = Metier_Util_Date::period2Days($this->debutPlan, $this->dureePlan.' mois');
|
||||
}
|
||||
if ($this->debug) {
|
||||
file_put_contents('procol.log', "\n", FILE_APPEND);
|
||||
}
|
||||
}
|
||||
|
||||
protected function getAnnoncesLegalesEffacement($siren, $rubrique, $tabRet)
|
||||
{
|
||||
if ($this->debug) {
|
||||
file_put_contents('procol.log', "Effacement Procol\n", FILE_APPEND);
|
||||
}
|
||||
$effacement = false;
|
||||
$MaxPeriodProcol = 80000;
|
||||
// --- Si il y a des annonces
|
||||
@ -4883,13 +4966,9 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
// --- Liste des jugements principaux - Tri chronologique par date de jugement
|
||||
foreach ($tabRet as $i => $ann) {
|
||||
$item = new stdClass();
|
||||
$dateEff = str_replace('-', '', $ann['dateEffet'])*1;
|
||||
$dateJug = str_replace('-', '', $ann['dateJugement'])*1;
|
||||
$datePar = str_replace('-', '', $ann['DateParution'])*1;
|
||||
if ($dateEff > 0) {
|
||||
$item->date = $dateEff;
|
||||
$item->dateISO8601 = $ann['dateEffet'];
|
||||
} elseif ($dateJug > 0) {
|
||||
if ($dateJug > 0) {
|
||||
$item->date = $dateJug;
|
||||
$item->dateISO8601 = $ann['dateJugement'];
|
||||
} elseif ($datePar > 0) {
|
||||
@ -4912,7 +4991,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
// --- Gestions des conditions pour l'affichage de l'indicateur procédure collectives
|
||||
if ($rubrique == 'P') {
|
||||
if ($this->debug) {
|
||||
file_put_contents('procol.log', "Rubrique P = ".print_r($tabRet, 1)."\n", FILE_APPEND);
|
||||
file_put_contents('procol.log', "Rubrique P\n", FILE_APPEND);
|
||||
}
|
||||
// Si plan recherche des annonces suivantes
|
||||
if ($this->dureePlan > 0) {
|
||||
@ -4936,7 +5015,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
1417, 1418, 1419,
|
||||
// Cloture
|
||||
1500, 1501, 1502, 1503, 1504, 1514 ))) {
|
||||
$this->dureePlan = 0;
|
||||
$this->dureePlan = 0;
|
||||
}
|
||||
}
|
||||
if ($this->debug) {
|
||||
@ -5510,9 +5589,6 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->debug && $rubrique == 'D') {
|
||||
file_put_contents('procol.log', $sql."\n", FILE_APPEND);
|
||||
}
|
||||
try {
|
||||
$stmt = $this->conn->executeQuery($sql);
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
@ -5782,6 +5858,8 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
$adresse.=ucfirst(strtolower($ann['adresse'])).', ';
|
||||
|
||||
$adresse=trim(preg_replace('/^0+/', '', preg_replace('/ +/', ' ', $adresse)));
|
||||
if(!isset($ann['siren'])){$ann['siren']=null;}
|
||||
if(!isset($ann['triNom'])){$ann['triNom']=null;}
|
||||
if (preg_match('/(3100|3200|3300|3999)/', $ann['typeEven'].';'.$ann['strEven'])) {
|
||||
$depotComptes = true;
|
||||
$strRCS = 'Siren : '. $ann['siren'] . '. ';
|
||||
@ -6318,7 +6396,9 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
}
|
||||
}
|
||||
|
||||
Metier_Util_Log::write('I', "getAnnoncesBoamp(siren=$siren, idAnnonce=$idAnnonce, $idA)", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->info("getAnnoncesBoamp(siren=$siren, idAnnonce=$idAnnonce, $idA)");
|
||||
}
|
||||
return $tabRet;
|
||||
}
|
||||
|
||||
@ -6376,8 +6456,9 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
*/
|
||||
public function getAnnoncesAsso($siren, $idAnnonce=0, $offset=0, $lignes=100)
|
||||
{
|
||||
Metier_Util_Log::write('I', "Début getAnnoncesAsso(siren=$siren, idAnnonce=$idAnnonce)", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->info("Début getAnnoncesAsso(siren=$siren, idAnnonce=$idAnnonce)");
|
||||
}
|
||||
$siretMin = $siren.'00000';
|
||||
$siretMax = $siren.'99999';
|
||||
$strIdAnn = '';
|
||||
@ -6480,7 +6561,9 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
}
|
||||
}
|
||||
|
||||
Metier_Util_Log::write('I', "Fin getAnnoncesAsso(siren=$siren, idAnnonce=$idAnnonce) : ".count($tabRet).' annonce(s)', __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->info("Fin getAnnoncesAsso(siren=$siren, idAnnonce=$idAnnonce) : ".count($tabRet).' annonce(s)');
|
||||
}
|
||||
return $tabRet;
|
||||
}
|
||||
|
||||
|
@ -2653,4 +2653,11 @@ return array(
|
||||
'Version' => 16,
|
||||
'LienEtab' => 0,
|
||||
),
|
||||
'3250' => array(
|
||||
'libEven' => "Depots des comptes annuels confidentiel",
|
||||
'Bodacc_Code' => "BODC",
|
||||
'Rubrique' => "comptes",
|
||||
'Version' => 18,
|
||||
'LienEtab' => 0,
|
||||
),
|
||||
);
|
||||
|
@ -610,24 +610,24 @@ class Scores_Extract_Dict
|
||||
'help' => "Multiple, entrer les colonnes souhaitées.
|
||||
NB le fichier en sortie contiendra plus de lignes que le fichier en entrée.",
|
||||
'columns' => array(
|
||||
'idAffaire' => 'identifiant de l\'afaire',
|
||||
'tiers' => 'En qualité de DE = Demandeur, DF = Défendeur',
|
||||
'statusCode' => 'Etat de l\'affaire abrégé',
|
||||
'statusLabel' => 'Etat de l\'affaire',
|
||||
'categoryCode' => 'Nature de demande abregée',
|
||||
'categoryLabel' => 'Nature de demande',
|
||||
'label' => 'Nature de demande',
|
||||
'dateAffaire' => 'Date d\'enrôlement au greffe',
|
||||
'nomPartie' => 'Nom de l\'acteur',
|
||||
'nomDemandeur' => 'Nom du/des demandeur(s)',
|
||||
'nomDefendeur' => 'Nom du/des défendeur(s)',
|
||||
'codeGreffe' => 'Code du greffe',
|
||||
'nomGreffe' => 'Nom du greffe',
|
||||
'parties' => 'Detail des parties du dossier',
|
||||
'representants' => 'Représentants',
|
||||
'nomsRepresentants' => 'Noms du/des représentants',
|
||||
'categorieAffaire' => 'Categorie d\'affaire',
|
||||
'historique' => 'Historique des actions : date, libellé',
|
||||
'IdAffaire' => 'identifiant de l\'afaire',
|
||||
'Tiers' => 'En qualité de DE = Demandeur, DF = Défendeur',
|
||||
'StatusCode' => 'Etat de l\'affaire abrégé',
|
||||
'StatusLabel' => 'Etat de l\'affaire',
|
||||
'CategoryCode' => 'Nature de demande abregée',
|
||||
'CategoryLabel' => 'Nature de demande',
|
||||
'Label' => 'Nature de demande',
|
||||
'DateAffaire' => 'Date d\'enrôlement au greffe',
|
||||
'NomPartie' => 'Nom de l\'acteur',
|
||||
'NomDemandeur' => 'Nom du/des demandeur(s)',
|
||||
'NomDefendeur' => 'Nom du/des défendeur(s)',
|
||||
'CodeGreffe' => 'Code du greffe',
|
||||
'NomGreffe' => 'Nom du greffe',
|
||||
'Parties' => 'Detail des parties du dossier',
|
||||
'Representants' => 'Représentants',
|
||||
'NomsRepresentants' => 'Noms du/des représentants',
|
||||
'CategorieAffaire' => 'Categorie d\'affaire',
|
||||
'Historique' => 'Historique des actions : date, libellé',
|
||||
)
|
||||
),
|
||||
'contentieuxlisteDFseuls'=> array(
|
||||
@ -636,24 +636,24 @@ class Scores_Extract_Dict
|
||||
'help' => "Multiple, entrer les colonnes souhaitées.
|
||||
NB le fichier en sortie contiendra plus de lignes que le fichier en entrée.",
|
||||
'columns' => array(
|
||||
'idAffaire' => 'identifiant de l\'afaire',
|
||||
'tiers' => 'En qualité de DE = Demandeur, DF = Défendeur',
|
||||
'statusCode' => 'Etat de l\'affaire abrégé',
|
||||
'statusLabel' => 'Etat de l\'affaire',
|
||||
'categoryCode' => 'Nature de demande abregée',
|
||||
'categoryLabel' => 'Nature de demande',
|
||||
'label' => 'Nature de demande',
|
||||
'dateAffaire' => 'Date d\'enrôlement au greffe',
|
||||
'nomPartie' => 'Nom de l\'acteur',
|
||||
'nomDemandeur' => 'Nom du/des demandeur(s)',
|
||||
'nomDefendeur' => 'Nom du/des défendeur(s)',
|
||||
'codeGreffe' => 'Code du greffe',
|
||||
'nomGreffe' => 'Nom du greffe',
|
||||
'parties' => 'Detail des parties du dossier',
|
||||
'representants' => 'Représentants',
|
||||
'nomsRepresentants' => 'Noms du/des représentants',
|
||||
'categorieAffaire' => 'Categorie d\'affaire',
|
||||
'historique' => 'Historique des actions : date, libellé',
|
||||
'IdAffaire' => 'identifiant de l\'afaire',
|
||||
'Tiers' => 'En qualité de DE = Demandeur, DF = Défendeur',
|
||||
'StatusCode' => 'Etat de l\'affaire abrégé',
|
||||
'StatusLabel' => 'Etat de l\'affaire',
|
||||
'CategoryCode' => 'Nature de demande abregée',
|
||||
'CategoryLabel' => 'Nature de demande',
|
||||
'Label' => 'Nature de demande',
|
||||
'DateAffaire' => 'Date d\'enrôlement au greffe',
|
||||
'NomPartie' => 'Nom de l\'acteur',
|
||||
'NomDemandeur' => 'Nom du/des demandeur(s)',
|
||||
'NomDefendeur' => 'Nom du/des défendeur(s)',
|
||||
'CodeGreffe' => 'Code du greffe',
|
||||
'NomGreffe' => 'Nom du greffe',
|
||||
'Parties' => 'Detail des parties du dossier',
|
||||
'Representants' => 'Représentants',
|
||||
'NomsRepresentants' => 'Noms du/des représentants',
|
||||
'CategorieAffaire' => 'Categorie d\'affaire',
|
||||
'Historique' => 'Historique des actions : date, libellé',
|
||||
)
|
||||
),
|
||||
);
|
||||
|
@ -258,8 +258,8 @@ class Scores_Ws_Server
|
||||
$this->logger = Zend_Registry::get('logger');
|
||||
}
|
||||
|
||||
$this->listeDroits = include APPLICATION_PATH . '/../library/Scores/Account/Access.php';
|
||||
$this->listeCategory = include APPLICATION_PATH . '/../library/Scores/Account/Category.php';
|
||||
$this->listeDroits = include APPLICATION_PATH . '/../vendor/scores/library/src/Scores/Account/Access.php';
|
||||
$this->listeCategory = include APPLICATION_PATH . '/../vendor/scores/library/src/Scores/Account/Category.php';
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user