2013-11-05 11:18:30 +00:00
|
|
|
<?php
|
2015-09-17 19:57:13 +00:00
|
|
|
// --- Define path to application directory
|
2013-11-05 11:18:30 +00:00
|
|
|
defined('APPLICATION_PATH')
|
2015-09-17 19:57:13 +00:00
|
|
|
|| define('APPLICATION_PATH', realpath(__DIR__ . '/../../application'));
|
2013-11-05 11:18:30 +00:00
|
|
|
|
2015-09-17 19:57:13 +00:00
|
|
|
// --- Define application environment
|
2013-11-05 11:18:30 +00:00
|
|
|
defined('APPLICATION_ENV')
|
2015-09-17 19:57:13 +00:00
|
|
|
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
|
2013-11-05 11:18:30 +00:00
|
|
|
|
2015-09-18 09:53:21 +00:00
|
|
|
// --- Composer autoload
|
2015-09-17 19:57:13 +00:00
|
|
|
require_once realpath(__DIR__ . '/../../vendor/autoload.php');
|
2014-02-07 16:14:36 +00:00
|
|
|
|
2015-09-17 19:57:13 +00:00
|
|
|
// --- Create application, bootstrap, and run
|
|
|
|
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
|
2013-11-05 11:18:30 +00:00
|
|
|
|
2016-09-29 17:13:33 +02:00
|
|
|
// --- Options
|
2016-07-18 10:39:49 +02:00
|
|
|
$displayUsage = false;
|
2013-11-05 11:18:30 +00:00
|
|
|
try {
|
2016-09-29 17:13:33 +02:00
|
|
|
$opts = new Zend_Console_Getopt(array(
|
|
|
|
'help|?' => "Aide.",
|
2016-09-30 16:01:35 +02:00
|
|
|
'list' => "List item.",
|
|
|
|
'generate|g=s' => "Generate the specify cache.",
|
2016-09-29 17:13:33 +02:00
|
|
|
));
|
2013-11-05 11:18:30 +00:00
|
|
|
$opts->parse();
|
|
|
|
} catch (Zend_Console_Getopt_Exception $e) {
|
2016-07-18 10:39:49 +02:00
|
|
|
$displayUsage = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// --- Aide / Options
|
|
|
|
if (count($opts->getOptions())==0 || isset($opts->help)) {
|
|
|
|
$displayUsage = true;
|
2013-11-05 11:18:30 +00:00
|
|
|
}
|
|
|
|
|
2016-07-18 10:39:49 +02:00
|
|
|
// --- Usage
|
|
|
|
if ($displayUsage) {
|
|
|
|
echo "\nGénération Table Static Metier\n\n";
|
2013-11-05 11:18:30 +00:00
|
|
|
echo $opts->getUsageMessage();
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( $opts->list ) {
|
|
|
|
$tabItems = array(
|
2016-05-18 14:43:34 +02:00
|
|
|
'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",
|
2016-07-18 10:39:49 +02:00
|
|
|
'ProcolDelete' => "Codes effacement de procol",
|
2013-11-05 11:18:30 +00:00
|
|
|
);
|
|
|
|
echo "\n";
|
|
|
|
foreach ( $tabItems as $code => $label ) {
|
|
|
|
echo "\t" . $code . " => ". $label . PHP_EOL;
|
|
|
|
}
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
// Database
|
|
|
|
$c = new Zend_Config($this->getOptions());
|
|
|
|
$config = new \Doctrine\DBAL\Configuration();
|
|
|
|
$connectionParams = array(
|
|
|
|
'dbname' => $c->profil->db->metier->params->dbname,
|
|
|
|
'user' => $c->profil->db->metier->params->username,
|
|
|
|
'password' => $c->profil->db->metier->params->password,
|
|
|
|
'host' => $c->profil->db->metier->params->host,
|
|
|
|
'charset' => 'utf8',
|
|
|
|
'driver' => 'pdo_mysql',
|
|
|
|
);
|
|
|
|
|
|
|
|
try {
|
|
|
|
$conn = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config);
|
|
|
|
} catch (\Doctrine\DBAL\DBALException $e) {
|
|
|
|
echo "Connection Database impossible.\n";
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2013-11-05 11:18:30 +00:00
|
|
|
/**
|
|
|
|
* Cache des Tribunaux Bodacc
|
|
|
|
*/
|
|
|
|
if( $opts->generate == 'Tribunaux' ) {
|
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
$sql = "SELECT triCode, triNom, triCP, triSiret FROM jo.tribunaux WHERE triCode IS NOT NULL";
|
|
|
|
$stmt = $conn->prepare($sql);
|
|
|
|
$stmt->execute();
|
|
|
|
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
2013-11-05 11:18:30 +00:00
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
$fp = fopen(APPLICATION_PATH . '/../library/Metier/Table/BodaccTribunaux.php','w');
|
2013-11-05 11:18:30 +00:00
|
|
|
fwrite($fp, "<?php\n");
|
|
|
|
fwrite($fp, "return array(\n");
|
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
if ($stmt->rowCount() > 0) {
|
|
|
|
foreach($result as $item) {
|
|
|
|
$dep = intval(substr($item->triCP, 0, 2));
|
|
|
|
if ($dep == 97 || $dep == 98) {
|
|
|
|
$dep = intval(substr($item->triCP, 0, 3));
|
|
|
|
}
|
2013-11-05 11:18:30 +00:00
|
|
|
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' ) {
|
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
$sql = "SELECT codeFct, libelle FROM jo.bodacc_fonctions";
|
|
|
|
$stmt = $conn->prepare($sql);
|
|
|
|
$stmt->execute();
|
|
|
|
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
2013-11-05 11:18:30 +00:00
|
|
|
|
2016-07-18 10:39:49 +02:00
|
|
|
$fp=fopen(APPLICATION_PATH . '/../library/Metier/Table/FctDir.php','w');
|
2013-11-05 11:18:30 +00:00
|
|
|
fwrite($fp, "<?php\n");
|
|
|
|
fwrite($fp, "return array(\n");
|
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
if ($stmt->rowCount() > 0) {
|
2013-11-05 11:18:30 +00:00
|
|
|
foreach($rows as $item) {
|
|
|
|
fwrite($fp, "\t'" . intval($item->codeFct) . "' => \"". $item->libelle . "\",\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fwrite($fp, ");\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Cache Evenements
|
|
|
|
*/
|
|
|
|
if ( $opts->generate == 'Evenements' ) {
|
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
$sql = "SELECT codEven, libEven, Bodacc_Code, Rubrique, version, lienEtab FROM jo.tabEvenements";
|
|
|
|
$stmt = $conn->prepare($sql);
|
|
|
|
$stmt->execute();
|
|
|
|
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
2013-11-05 11:18:30 +00:00
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
$fp = fopen(APPLICATION_PATH . '/../library/Metier/Table/Evenements.php','w');
|
2013-11-05 11:18:30 +00:00
|
|
|
fwrite($fp, "<?php\n");
|
|
|
|
fwrite($fp, "return array(\n");
|
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
if ($stmt->rowCount() > 0) {
|
2013-11-05 11:18:30 +00:00
|
|
|
foreach($rows 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' ) {
|
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
$sql = "SELECT libDeviseBodacc, devIso FROM jo.bodacc_devises";
|
|
|
|
$stmt = $conn->prepare($sql);
|
|
|
|
$stmt->execute();
|
|
|
|
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
2013-11-05 11:18:30 +00:00
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
$fp = fopen(APPLICATION_PATH . '/../library/Metier/Table/Devises.php','w');
|
2013-11-05 11:18:30 +00:00
|
|
|
fwrite($fp, "<?php\n");
|
|
|
|
fwrite($fp, "return array(\n");
|
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
if ($stmt->rowCount() > 0) {
|
2013-11-05 11:18:30 +00:00
|
|
|
foreach($rows as $item) {
|
|
|
|
fwrite($fp, "\t\"" . $item->libDeviseBodacc . "\" => \"" . $item->devIso ."\",\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fwrite($fp, ");\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Cache Tribunaux RNCS
|
|
|
|
*/
|
|
|
|
if ( $opts->generate == 'RncsTribunaux' ) {
|
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
$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);
|
2013-11-05 11:18:30 +00:00
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
$fp = fopen(APPLICATION_PATH . '/../library/Metier/Table/RncsTribunaux.php','w');
|
2013-11-05 11:18:30 +00:00
|
|
|
fwrite($fp, "<?php\n");
|
|
|
|
fwrite($fp, "return array(\n");
|
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
if ($stmt->rowCount() > 0) {
|
2013-11-05 11:18:30 +00:00
|
|
|
foreach($rows as $item) {
|
|
|
|
fwrite($fp, "\t" . intval($item->triNumGreffe) . " => array(");
|
|
|
|
fwrite($fp, "'Id'=>\"" . $item->triId . "\", 'Nom'=>\"".$item->triNom."\", 'Code'=>\"".$item->triCode."\"");
|
|
|
|
fwrite($fp, "),\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fwrite($fp, ");\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Cache Devises Inpi
|
|
|
|
*/
|
|
|
|
if ( $opts->generate == 'DevisesInpi' ) {
|
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
$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);
|
2013-11-05 11:18:30 +00:00
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
$fp = fopen(APPLICATION_PATH . '/../library/Metier/Table/DevisesInpi.php','w');
|
2013-11-05 11:18:30 +00:00
|
|
|
fwrite($fp, "<?php\n");
|
|
|
|
fwrite($fp, "return array(\n");
|
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
if ($stmt->rowCount() > 0) {
|
2013-11-05 11:18:30 +00:00
|
|
|
foreach($rows as $item) {
|
|
|
|
fwrite($fp, "\t" . intval($item->devInpi) . " => \"" . $item->devIso . "\",\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fwrite($fp, ");\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Cache Jugements
|
|
|
|
*/
|
|
|
|
if ( $opts->generate == 'Jugements' ) {
|
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
$sql = "SELECT codJugement, codEven FROM jo.tabJugeRncs";
|
|
|
|
$stmt = $conn->prepare($sql);
|
|
|
|
$stmt->execute();
|
|
|
|
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
2013-11-05 11:18:30 +00:00
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
$fp = fopen(APPLICATION_PATH . '/../library/Metier/Table/Jugements.php','w');
|
2013-11-05 11:18:30 +00:00
|
|
|
fwrite($fp, "<?php\n");
|
|
|
|
fwrite($fp, "return array(\n");
|
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
if ($stmt->rowCount() > 0) {
|
2013-11-05 11:18:30 +00:00
|
|
|
foreach($rows as $item) {
|
|
|
|
fwrite($fp, "\t" . intval($item->codJugement) . " => " . $item->codEven . ",\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fwrite($fp, ");\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Cache PaysInpi
|
|
|
|
*/
|
|
|
|
if ( $opts->generate == 'PaysInpi' ) {
|
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
$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);
|
2013-11-05 11:18:30 +00:00
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
$fp = fopen(APPLICATION_PATH . '/../library/Metier/Table/PaysInpi.php','w');
|
2013-11-05 11:18:30 +00:00
|
|
|
fwrite($fp, "<?php\n");
|
|
|
|
fwrite($fp, "return array(\n");
|
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
if ($stmt->rowCount() > 0) {
|
2013-11-05 11:18:30 +00:00
|
|
|
foreach($rows as $item) {
|
|
|
|
fwrite($fp, "\t" . intval($item->codePaysInpi) . " => \"" . $item->codPays . "\",\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fwrite($fp, ");\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Cache CodesNaf
|
|
|
|
*/
|
|
|
|
if ( $opts->generate == 'CodesNaf' ) {
|
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
$sql = "SELECT codNaf700 AS naf, libNaf700 AS LibNaf FROM jo.tabNaf4";
|
|
|
|
$stmt = $conn->prepare($sql);
|
|
|
|
$stmt->execute();
|
|
|
|
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
2013-11-05 11:18:30 +00:00
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
$fp = fopen(APPLICATION_PATH . '/../library/Metier/Table/CodesNaf.php','w');
|
2013-11-05 11:18:30 +00:00
|
|
|
fwrite($fp, "<?php\n");
|
|
|
|
fwrite($fp, "return array(\n");
|
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
if ($stmt->rowCount() > 0) {
|
2013-11-05 11:18:30 +00:00
|
|
|
foreach($rows as $item) {
|
|
|
|
fwrite($fp, "\t'" . $item->naf . "' => \"" . $item->LibNaf . "\",\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
$sql = "SELECT codNaf5 AS naf, libNaf5 AS LibNaf FROM jo.tabNaf5";
|
|
|
|
$stmt = $conn->prepare($sql);
|
|
|
|
$stmt->execute();
|
|
|
|
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
2013-11-05 11:18:30 +00:00
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
if ($stmt->rowCount() > 0) {
|
2013-11-05 11:18:30 +00:00
|
|
|
foreach($rows as $item) {
|
|
|
|
fwrite($fp, "\t'" . $item->naf . "' => \"" . $item->LibNaf. "\",\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fwrite($fp, ");\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Cache CodesNace
|
|
|
|
*/
|
|
|
|
if ( $opts->generate == 'CodesNace' ) {
|
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
$sql = "SELECT codNaf5 AS naf, libNaf5 AS LibNaf, codNaf1 FROM jo.tabNaf5";
|
|
|
|
$stmt = $conn->prepare($sql);
|
|
|
|
$stmt->execute();
|
|
|
|
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
2013-11-05 11:18:30 +00:00
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
$fp = fopen(APPLICATION_PATH . '/../library/Metier/Table/CodesNace.php','w');
|
2013-11-05 11:18:30 +00:00
|
|
|
fwrite($fp, "<?php\n");
|
|
|
|
fwrite($fp, "return array(\n");
|
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
if ($stmt->rowCount() > 0) {
|
2013-11-05 11:18:30 +00:00
|
|
|
foreach($rows 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' ) {
|
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
$sql = "SELECT codNafa AS nafa, libNafa FROM jo.tabNafa";
|
|
|
|
$stmt = $conn->prepare($sql);
|
|
|
|
$stmt->execute();
|
|
|
|
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
2013-11-05 11:18:30 +00:00
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
$fp = fopen(APPLICATION_PATH . '/../library/Metier/Table/CodesNafa.php','w');
|
2013-11-05 11:18:30 +00:00
|
|
|
fwrite($fp, "<?php\n");
|
|
|
|
fwrite($fp, "return array(\n");
|
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
if ($stmt->rowCount() > 0) {
|
2013-11-05 11:18:30 +00:00
|
|
|
foreach($rows as $item) {
|
|
|
|
fwrite($fp, "\t'" . $item->nafa . "' => \"" . $item->libNafa ."\",\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fwrite($fp, ");\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Cache CodesFJ
|
|
|
|
*/
|
|
|
|
if ( $opts->generate == 'CodesFJ' ) {
|
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
$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);
|
2013-11-05 11:18:30 +00:00
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
$fp = fopen(APPLICATION_PATH . '/../library/Metier/Table/CodesFJ.php','w');
|
2013-11-05 11:18:30 +00:00
|
|
|
fwrite($fp, "<?php\n");
|
|
|
|
fwrite($fp, "return array(\n");
|
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
if ($stmt->rowCount() > 0) {
|
2013-11-05 11:18:30 +00:00
|
|
|
foreach($rows as $item) {
|
|
|
|
fwrite($fp, "\t" . $item->FJ . " => \"" . str_replace('"','\"',$item->libFJ) ."\",\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fwrite($fp, ");\n");
|
|
|
|
}
|
2016-05-18 14:43:34 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Cache AffairesTypes
|
|
|
|
* Code Nature des contentieux
|
|
|
|
*/
|
2016-07-12 17:28:30 +02:00
|
|
|
if ( $opts->generate == 'AffairesTypes' ) {
|
2016-05-18 14:43:34 +02:00
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
$sql = "SELECT code, label FROM jo.greffes_affaires_nature";
|
|
|
|
$stmt = $conn->prepare($sql);
|
|
|
|
$stmt->execute();
|
|
|
|
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
2016-05-18 14:43:34 +02:00
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
$fp = fopen(APPLICATION_PATH . '/../library/Metier/Table/AffairesTypes.php','w');
|
2016-07-12 17:28:30 +02:00
|
|
|
fwrite($fp, "<?php\n");
|
|
|
|
fwrite($fp, "return array(\n");
|
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
if ($stmt->rowCount() > 0) {
|
2016-07-12 17:28:30 +02:00
|
|
|
foreach($rows as $item) {
|
2016-07-18 10:39:49 +02:00
|
|
|
fwrite($fp, "\t'" . $item->code . "' => \"" . $item->label ."\",\n");
|
2016-07-12 17:28:30 +02:00
|
|
|
}
|
2016-05-18 14:43:34 +02:00
|
|
|
}
|
2016-07-12 17:28:30 +02:00
|
|
|
fwrite($fp, ");\n");
|
2016-07-18 10:39:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Procol Delete
|
|
|
|
*/
|
|
|
|
if ( $opts->generate == 'ProcolDelete' ) {
|
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
$sql = "SELECT codEven, affProcol FROM jo.tabEvenements WHERE affProcol>0";
|
|
|
|
$stmt = $conn->prepare($sql);
|
|
|
|
$stmt->execute();
|
|
|
|
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
2016-07-18 10:39:49 +02:00
|
|
|
|
2016-08-30 10:24:06 +02:00
|
|
|
$fp = fopen(APPLICATION_PATH . '/../library/Metier/Defaillance/ProcolDelete.php', 'w');
|
2016-07-18 10:39:49 +02:00
|
|
|
fwrite($fp, "<?php\n");
|
|
|
|
fwrite($fp, "return array(\n");
|
|
|
|
|
2016-09-30 16:01:35 +02:00
|
|
|
if ($stmt->rowCount() > 0) {
|
2016-07-18 10:39:49 +02:00
|
|
|
foreach($rows as $item) {
|
|
|
|
fwrite($fp, "\t" . $item->codEven . " => " . $item->affProcol .",\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fwrite($fp, ");\n");
|
2016-05-18 14:43:34 +02:00
|
|
|
}
|
|
|
|
|
2016-07-18 10:39:49 +02:00
|
|
|
|