Merge from branch 1.3
This commit is contained in:
commit
4b6eed1957
@ -95,10 +95,10 @@ if ( count($identifiants)==0 || count($dataProfil)==0 ) {
|
||||
//Let's go
|
||||
$mois = substr($commande->dateAdded,0,4).substr($commande->dateAdded,5,2);
|
||||
|
||||
if(!file_exists($config->path->data.'/'.$mois))
|
||||
mkdir($config->path->data.'/'.$mois);
|
||||
$path = $config->profil->path->data.'/'.$mois;
|
||||
if(!file_exists($path))
|
||||
mkdir($path);
|
||||
|
||||
$path = $config->path->data.'/'.$mois;
|
||||
$outFile = $profil->login.'_'.$opts->id.'_'.date('YmdHis').'.csv';
|
||||
|
||||
require_once 'Scores/Enrichissement.php';
|
||||
@ -109,6 +109,8 @@ $fields = $dico->getFields();
|
||||
$tabEntete = array('siren', 'nic');
|
||||
$tabEnteteLabel = array('SIREN', 'NIC');
|
||||
$sql = 'SELECT LPAD(siren, 9, 000000000) AS siren, LPAD(nic,5,00000) AS nic,';
|
||||
$from = 'etablissements_act';
|
||||
$addWhere = '';
|
||||
foreach ( $dataProfil as $item ) {
|
||||
//Définition de l'entete
|
||||
$tabEnteteLabel[] = $fields[$item]['label'];
|
||||
@ -120,6 +122,21 @@ foreach ( $dataProfil as $item ) {
|
||||
} else {
|
||||
$sql.= ' '.$fields[$item]['column'].' AS '.$item.',';
|
||||
}
|
||||
|
||||
//Pour les champs de type "code", ajouter le libellé
|
||||
if ( array_key_exists('join', $fields[$item]) ) {
|
||||
//Automatic column name .Lib
|
||||
$joinColumn = $item.'Lib';
|
||||
$tabEntete[] = $joinColumn;
|
||||
//label
|
||||
$tabEnteteLabel[] = $fields[$item]['join']['label'];
|
||||
//Sql
|
||||
$tableAlias = $item.'T';
|
||||
$sql.= $tableAlias.'.'.$fields[$item]['join']['column'].' AS '.$joinColumn;
|
||||
$from.= ','.$fields[$item]['join']['column'].' AS '.$tableAlias;
|
||||
$addWhere = ' AND WHERE '.$fields[$item]['column'].'='.$tableAlias.'.'.$fields[$item]['join']['column'];
|
||||
}
|
||||
|
||||
}
|
||||
//Ajouter le champ presentRcs
|
||||
$tabEntete[] = 'presentRcs';
|
||||
|
Loading…
Reference in New Issue
Block a user