Cas AffaireType

This commit is contained in:
Michael RICOIS 2016-07-12 17:28:30 +02:00
parent 6c68a247dd
commit 5697797219

View File

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