Compare commits

...

15 Commits

Author SHA1 Message Date
Claire DELBOS
b57144442d Merge branch 'develop' 2017-04-13 09:46:10 +02:00
Claire DELBOS
3f003800fd BUG enrichissement 2017-04-13 09:43:03 +02:00
potier
c130f972ac Merge branch 'develop' into 'master'
Develop into master : header path

See merge request !2
2017-04-11 08:46:47 +00:00
Michael RICOIS
0727603bac MAJ Table Evenements 2017-04-11 10:24:54 +02:00
Michael RICOIS
97b7b45248 Bin Header file path 2017-04-11 10:21:15 +02:00
potier
f1551f13bd Merge branch 'develop' into 'master'
Develop into master : path library + add file in bin

See merge request !1
2017-04-11 07:29:49 +00:00
benoitpotier
3f7a1deba5 change path library 2017-04-11 09:24:43 +02:00
benoitpotier
ba51eed034 change path library 2017-04-11 09:10:29 +02:00
Michael RICOIS
8af826eb9b Composer : extra trailing comma 2017-04-10 16:39:56 +02:00
Michael RICOIS
92a523e7a7 Composer validate syntax 2017-04-10 16:38:39 +02:00
Michael RICOIS
d5e9d3a753 Composer syntax 2017-04-10 16:32:45 +02:00
Michael RICOIS
7aa9f88661 Reference bin file to automaticallly place in vendor/bin
- https://getcomposer.org/doc/articles/vendor-binaries.md
2017-04-10 16:30:03 +02:00
Michael RICOIS
501501693d Common bin for library 2017-04-10 16:27:41 +02:00
Michael RICOIS
ed7f18505b Revert "Add bin for library"
This reverts commit 558548b2db4204057af76f6c1aebdb04b1f92a7d.
2017-04-10 16:23:08 +02:00
Michael RICOIS
1477aae85b Add bin for library 2017-04-10 16:23:08 +02:00
9 changed files with 2275 additions and 62 deletions

391
bin/library-cache.php Executable file
View 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
View 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

File diff suppressed because it is too large Load Diff

632
bin/library-ratiosload.php Executable file
View 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
View 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);
}
}

View File

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

View File

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

View File

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

View File

@ -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';
}
/**