Génération cache contentieux AffairesTypes

This commit is contained in:
Michael RICOIS 2016-05-18 14:43:34 +02:00
parent 5469feabb5
commit 49e90814d6

View File

@ -37,18 +37,19 @@ if( count($opts->getOptions())==0 || isset($opts->help))
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",
'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",
);
echo "\n";
foreach ( $tabItems as $code => $label ) {
@ -394,3 +395,26 @@ if ( $opts->generate == 'CodesFJ' ) {
fwrite($fp, ");\n");
}
/**
* Cache AffairesTypes
* Code Nature des contentieux
*/
$c = new Zend_Config($application->getOptions());
$db = Zend_Db::factory($c->profil->db->metier);
$result = $db->query("SELECT code, label FROM jo.greffes_affaires_nature");
$result->setFetchMode(Zend_Db::FETCH_OBJ);
$rows = $result->fetchAll();
$fp=fopen(APPLICATION_PATH . '/../library/Partenaires/Cache/AffairesTypes.php','w');
fwrite($fp, "<?php\n");
fwrite($fp, "return array(\n");
if ( count($rows) > 0 ) {
foreach($rows as $item) {
fwrite($fp, "\t" . $item->code . " => \"" . $item->label ."\",\n");
}
}
fwrite($fp, ");\n");