Update
This commit is contained in:
parent
9cc95bcd91
commit
7a6e3663e5
@ -60,12 +60,11 @@ class ComptageController extends Zend_Controller_Action
|
||||
} else {
|
||||
$error = 2;
|
||||
}
|
||||
|
||||
//@todo : Ajouter les critères sous forme json_encode
|
||||
|
||||
//Retour comptage, unité Insee
|
||||
$result = array(
|
||||
'count' => number_format($total, 0, '', ' '),
|
||||
'insee' => ($insee!==null) ? number_format($insee, 0, '', ' ') : null,
|
||||
'count' => $total,
|
||||
'insee' => $insee,
|
||||
'error' => $error,
|
||||
);
|
||||
|
||||
@ -247,65 +246,68 @@ class ComptageController extends Zend_Controller_Action
|
||||
$result = $profilsM->fetchRow($sql);
|
||||
|
||||
$profil = json_decode($result['criteres'], true);
|
||||
|
||||
|
||||
//No profil, define it
|
||||
if (count($profil)==0) {
|
||||
$profil = array('raisonSociale');
|
||||
}
|
||||
|
||||
$extractSql = $extractLabel = array();
|
||||
//$extractSql[] = "CONCAT(LPAD(siren, 9, '000000000'), LPAD(nic, 5, '00000')) AS siret";
|
||||
//$extractLabel[] = 'SIRET';
|
||||
require_once 'Scores/Enrichissement.php';
|
||||
$enrichissement = new Enrichissement();
|
||||
$data = $enrichissement->getFields();
|
||||
|
||||
foreach ( $data as $key => $item ) {
|
||||
if (in_array($key, $profil)) {
|
||||
if ( array_key_exists('sql', $item) ) {
|
||||
$extractSql[] = $item['sql'];
|
||||
} else {
|
||||
$extractSql[] = $item['column'];
|
||||
}
|
||||
$extractLabel[] = $item['label'];
|
||||
}
|
||||
/*if ( array_key_exists('join', $item) ) {
|
||||
|
||||
//Automatic column name .Lib
|
||||
$joinColumn = $data[$item]['join']['column'];
|
||||
$colName = $data[$item]['column'].$joinColumn;
|
||||
$tabEntete[] = $colName;
|
||||
//label
|
||||
$extractLabel[] = $data[$item]['join']['label'];
|
||||
//Sql
|
||||
$tableAlias = array($data[$item]['column'].'_'.$joinColumn=>$data[$item]['join']['table']);
|
||||
$extractSql[] = $data[$item]['column'].'_'.$joinColumn.'.'.$joinColumn.' AS '.$colName.',';
|
||||
$join[]= array($tableAlias,$data[$item]['join']['stat']);
|
||||
}*/
|
||||
}
|
||||
|
||||
$sqlSelect = 'SELECT LPAD(siren, 9, 000000000) AS siren, LPAD(nic,5,00000) AS nic,';
|
||||
$sqlFrom = 'jo.etablissements_act';
|
||||
$sqlWhere = '';
|
||||
foreach ( $dataProfil as $item ) {
|
||||
|
||||
//Get item
|
||||
if ( array_key_exists($item, $fields) ) {
|
||||
$field = $fields[$item];
|
||||
|
||||
//Définition de l'entete
|
||||
$tabEnteteLabel[] = $field['label'];
|
||||
$tabEntete[] = $item;
|
||||
|
||||
//Construction de la requete SQL
|
||||
if ( array_key_exists('sql', $field) ) {
|
||||
$sqlSelect.= ' '.$field['sql'].', ';
|
||||
} else {
|
||||
$sqlSelect.= ' '.$field['column'].' AS '.$item.',';
|
||||
}
|
||||
|
||||
//Pour les champs de type "code", ajouter le libellé
|
||||
if ( array_key_exists('join', $field) ) {
|
||||
$tabEnteteLabel[] = $field['join']['label'];
|
||||
$joinColumn = $item.'Lib';
|
||||
$tabEntete[] = $joinColumn;
|
||||
|
||||
//Sql
|
||||
$tableAlias = $item.'L';
|
||||
$sqlSelect.= $tableAlias.'.'.$field['join']['column'].' AS '.$joinColumn;
|
||||
$sqlFrom.= ','.$field['join']['column'].' AS '.$tableAlias;
|
||||
$sqlWhere = ' AND WHERE '.$field['join']['cond'];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$db = Zend_Db_Table::getDefaultAdapter();
|
||||
$sql = $db->select()
|
||||
->from(array('jo_act' => 'jo.etablissements_act'), $extractSql);
|
||||
if($join){
|
||||
foreach ($join as $params ){
|
||||
$sql->joinLeft($params[0], $params[1], array());
|
||||
|
||||
}
|
||||
}
|
||||
$sql = $sqlSelect . ' FROM jo.etablissements_act ' . $sqlFrom . ' WHERE ';
|
||||
|
||||
$i = 0;
|
||||
$where = '';
|
||||
foreach($sirets as $siret) {
|
||||
if ($i>0) {
|
||||
foreach ( $sirets as $siret ) {
|
||||
if ( $i>0 ) {
|
||||
$where.=' OR ';
|
||||
}
|
||||
$where.= "(siren='".substr($siret,0,9)."' AND nic='".substr($siret,9,5)."')";
|
||||
$i++;
|
||||
}
|
||||
|
||||
$sql->where($where);
|
||||
$sql.= $sqlWhere;
|
||||
|
||||
$result = $db->fetchAll($sql);
|
||||
|
||||
|
||||
$liste = array();
|
||||
foreach ($result as $l => $line) {
|
||||
$tmp = array();
|
||||
|
@ -13,17 +13,39 @@ class IndexController extends Zend_Controller_Action
|
||||
|
||||
public function criteresAction()
|
||||
{
|
||||
$ajax = $this->getRequest()->getParam('ajax');
|
||||
if($ajax)
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$request = $this->getRequest();
|
||||
if ( $request->isXmlHttpRequest() ) {
|
||||
$this->_helper->layout()->disableLayout();
|
||||
}
|
||||
|
||||
//Informations utilisateur
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
|
||||
$fields = new Scores_Fields();
|
||||
|
||||
$infosCriteres = array();
|
||||
$total = $request->getParam('total');
|
||||
if ( $total !== null ) {
|
||||
$this->view->dataCount = number_format($total, 0, '', ' ');
|
||||
} else {
|
||||
$this->view->dataCount = number_format($fields->getNb('total'), 0, '', ' ');
|
||||
}
|
||||
|
||||
$insee = $request->getParam('insee');
|
||||
if ( $insee !== null ) {
|
||||
$this->view->dataInsee = number_format($insee, 0, '', ' ');
|
||||
} else {
|
||||
if ( $user->preferences['interface']['insee'] == 1 ) {
|
||||
$insee = number_format($fields->getNb('insee'), 0, '', ' ');
|
||||
} else {
|
||||
$insee = null;
|
||||
}
|
||||
}
|
||||
|
||||
$decodeCriteres = $fields->getCriteres();
|
||||
|
||||
//Construction affichage des critères
|
||||
//Construction affichage des critères
|
||||
$infosCriteres = array();
|
||||
foreach ( $decodeCriteres as $key => $item ) {
|
||||
|
||||
$inValue = $fields->getValueLabel($key, $item['in']);
|
||||
|
@ -123,9 +123,9 @@ class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
|
||||
$title = ' title="'.$title.'"';
|
||||
}
|
||||
|
||||
$out.= '<div id="field_'.$type.'_'.$this->name.'" '.$class.''.$style.''.$title.'>';
|
||||
$out.= '<div id="field_'.$type.'_'.$this->name.'" '.$class.''.$style.''.$title.'>';
|
||||
$out.= $this->structureLabel($this->view->translate($label));
|
||||
$out.= '<div class="field">'.$html.'</div>';
|
||||
$out.= '<div class="field panel-body">'.$html.'</div>';
|
||||
$out.= '</div>';
|
||||
|
||||
}
|
||||
@ -250,9 +250,9 @@ class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
|
||||
<input type="radio" name="options" id="option1" value="'.$value.'">'.$this->view->translate($label).'</label>';
|
||||
}
|
||||
$return .= '</div>';
|
||||
|
||||
|
||||
return $return;
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected function intervalDateHTML($name, $options)
|
||||
|
@ -9,24 +9,24 @@
|
||||
</div>
|
||||
<div id="collapse-1" class="panel-collapse collapse">
|
||||
<div class="panel-body">
|
||||
|
||||
|
||||
<div id="entreprise">
|
||||
<?=$this->Field('siege')?>
|
||||
<?=$this->Field('groupe')?>
|
||||
<?=$this->Field('tel')?>
|
||||
<?=$this->Field('fax')?>
|
||||
<?=$this->Field('web')?>
|
||||
<?=$this->Field('mail')?>
|
||||
<?=$this->Field('presentRcs')?>
|
||||
<?=$this->Field('adrDom')?>
|
||||
<?=$this->Field('dirNom')?>
|
||||
<?=$this->Field('dateCrea_etab')?>
|
||||
<?=$this->Field('participation')?>
|
||||
<?=$this->Field('nbMPubli')?>
|
||||
<?=$this->Field('dateCrea_ent')?>
|
||||
<?=$this->Field('action')?>
|
||||
<?=$this->Field('nbActio')?>
|
||||
<?=$this->Field('nbPart')?>
|
||||
<?=$this->Field('siege')?>
|
||||
<?=$this->Field('groupe')?>
|
||||
<?=$this->Field('tel')?>
|
||||
<?=$this->Field('fax')?>
|
||||
<?=$this->Field('web')?>
|
||||
<?=$this->Field('mail')?>
|
||||
<?=$this->Field('presentRcs')?>
|
||||
<?=$this->Field('adrDom')?>
|
||||
<?=$this->Field('dirNom')?>
|
||||
<?=$this->Field('dateCrea_etab')?>
|
||||
<?=$this->Field('participation')?>
|
||||
<?=$this->Field('nbMPubli')?>
|
||||
<?=$this->Field('dateCrea_ent')?>
|
||||
<?=$this->Field('action')?>
|
||||
<?=$this->Field('nbActio')?>
|
||||
<?=$this->Field('nbPart')?>
|
||||
</div>
|
||||
<div id="link">
|
||||
<a class="resetFamille" id="entreprise">Réinitialiser les critères entreprises</a>
|
||||
|
@ -1,6 +1,12 @@
|
||||
<p class="alert alert-info" id="comptage">
|
||||
<span class="valeur">Unités : <?=$this->dataCount?></span>
|
||||
<?php if ( $this->dataInsee > 0 ) {?>
|
||||
(dont <span class="valeur"><?=$this->dataInsee?></span> unitée(s) insee)
|
||||
<?php }?>
|
||||
</p>
|
||||
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading"><h3 class="panel-title">Résumé de vos critères</h3></div>
|
||||
<div class="panel-body">
|
||||
<?php if ( count($this->infos)>0 ) {?>
|
||||
<?php foreach($this->infos as $critere => $item) {?>
|
||||
<div class="alert alert-info">
|
||||
@ -13,10 +19,8 @@
|
||||
<?php }?></p>
|
||||
</div>
|
||||
<?php }?>
|
||||
<?php }else{?><div class="alert alert-warning">Aucune sélection.</div><?}?>
|
||||
</div>
|
||||
<?php } else {?><div class="alert alert-warning">Aucune sélection.</div><?}?>
|
||||
<a href="/comptage/reset" class="btn btn-primary btn-block">Initialiser les critères</a>
|
||||
<a href="/comptage/previsualisation" class="btn btn-primary btn-block">Prévisualiser</a>
|
||||
<a href="/comptage/savedialog" class="saveciblage btn btn-primary btn-block">Extraire</a>
|
||||
|
||||
</div>
|
24
library/Scores/Ciblage/Dict.php
Normal file
24
library/Scores/Ciblage/Dict.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
class Scores_Ciblage_Dict
|
||||
{
|
||||
|
||||
/**
|
||||
* key
|
||||
* label
|
||||
* title
|
||||
* family
|
||||
* display
|
||||
* type => ArrayOf (one, many, range, rangedate, tree, search, list)
|
||||
* values => array(key => label)
|
||||
*
|
||||
* extract
|
||||
* label => string | array
|
||||
* columnName => string | array
|
||||
* sql => select AS or JOIN
|
||||
* values => static value array(key => label)
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
}
|
1
library/Scores/Ciblage/Engine.php
Normal file
1
library/Scores/Ciblage/Engine.php
Normal file
@ -0,0 +1 @@
|
||||
<?php
|
419
library/Scores/Ciblage/Extract.php
Normal file
419
library/Scores/Ciblage/Extract.php
Normal file
@ -0,0 +1,419 @@
|
||||
<?php
|
||||
class Scores_Ciblage_Extract
|
||||
{
|
||||
/**
|
||||
* Déclaration des colonnes de la table de données pour la transposition
|
||||
* siren + nic + presentRcs
|
||||
*/
|
||||
protected $columns = array(
|
||||
'id' => array(), //Non utilisé
|
||||
'source' => array(),
|
||||
'source_id' => array(),
|
||||
'triCode' => array(),
|
||||
'autre_id' => array(),
|
||||
'siren' => array(), //Obligatoire
|
||||
'nic' => array(), //Obligatoire
|
||||
'actif' => array(
|
||||
'values' => array(
|
||||
'1' => "actif",
|
||||
'0' => "inactif",
|
||||
)
|
||||
),
|
||||
'siege' => array(
|
||||
'values' => array(
|
||||
'1' => "Etablissement Siege",
|
||||
'0' => "Etablissement Secondaire",
|
||||
)
|
||||
),
|
||||
'raisonSociale' => array(), //Raison Sociale
|
||||
'enseigne' => array(), //Enseigne
|
||||
'sigle' => array(), //Sigle
|
||||
'identite_pre' => array(), //Identite Précédente
|
||||
'marques' => array(),
|
||||
'adr_num' => array(), //Adresse
|
||||
'adr_btq' => array(), //Adresse
|
||||
'adr_typeVoie' => array(), //Adresse
|
||||
'adr_libVoie' => array(), //Adresse
|
||||
'adr_comp' => array(), //Adresse - Complément
|
||||
'adr_cp' => array(), //Adresse
|
||||
'adr_ville' => array(), //Adresse
|
||||
'adr_dep' => array(), //Département | Code Commune
|
||||
'adr_com' => array(), //Code Commune
|
||||
'tel' => array(), //Telephone
|
||||
'fax' => array(), //Fax
|
||||
'cj' => array(), //Forme Juridique
|
||||
'capital' => array(),
|
||||
'capitalDev' => array(),
|
||||
'capitalSrc' => array(),
|
||||
'ape_etab' => array(),
|
||||
'ape_entrep' => array(),
|
||||
'age_entrep' => array(),
|
||||
'age_etab' => array(),
|
||||
'tca' => array(),
|
||||
'tcaexp' => array(),
|
||||
'teff_entrep' => array(
|
||||
'values' => array(
|
||||
'NN' => "Unités non employeuses", //@todo : a vérifier NULL dans la base
|
||||
'0' => "0 salarié",
|
||||
'1' => "1 ou 2 salariés",
|
||||
'2' => "3 à 5 salariés",
|
||||
'3' => "6 à 9 salariés",
|
||||
'11' => "10 à 19 salariés",
|
||||
'12' => "20 à 49 salariés",
|
||||
'21' => "50 à 99 salariés",
|
||||
'22' => "100 à 199 salariés",
|
||||
'31' => "200 à 249 salariés",
|
||||
'32' => "250 à 499 salariés",
|
||||
'41' => "500 à 999 salariés",
|
||||
'42' => "1 000 à 1 999 salariés",
|
||||
'51' => "2 000 à 4 999 salariés",
|
||||
'52' => "5 000 à 9 999 salariés",
|
||||
'53' => "10 000 salariés et plus",
|
||||
),
|
||||
),
|
||||
'teff_etab' => array(
|
||||
'values' => array(
|
||||
'NN' => "Unités non employeuses", //@todo : a vérifier NULL dans la base
|
||||
'0' => "0 salarié",
|
||||
'1' => "1 ou 2 salariés",
|
||||
'2' => "3 à 5 salariés",
|
||||
'3' => "6 à 9 salariés",
|
||||
'11' => "10 à 19 salariés",
|
||||
'12' => "20 à 49 salariés",
|
||||
'21' => "50 à 99 salariés",
|
||||
'22' => "100 à 199 salariés",
|
||||
'31' => "200 à 249 salariés",
|
||||
'32' => "250 à 499 salariés",
|
||||
'41' => "500 à 999 salariés",
|
||||
'42' => "1 000 à 1 999 salariés",
|
||||
'51' => "2 000 à 4 999 salariés",
|
||||
'52' => "5 000 à 9 999 salariés",
|
||||
'53' => "10 000 salariés et plus",
|
||||
),
|
||||
),
|
||||
'rang' => array(),
|
||||
'web' => array(),
|
||||
'mail' => array(),
|
||||
'adrDom' => array(),
|
||||
'lieuAct' => array(),
|
||||
'actifEco' => array(),
|
||||
'presentRcs' => array(),
|
||||
'procolHisto' => array(),
|
||||
'tvaIntraCle' => array(),
|
||||
'tvaIntraValide' => array(),
|
||||
'ape4_etab' => array(),
|
||||
'ape4_entrep' => array(),
|
||||
'NaceEtab' => array(),
|
||||
'NaceEntrep' => array(),
|
||||
'dateCrea_etab' => array(),
|
||||
'dateCrea_ent' => array(),
|
||||
'dateImmat' => array(),
|
||||
'eff_entrep' => array(),
|
||||
'eff_etab' => array(),
|
||||
'distSP' => array(),
|
||||
'achPost' => array(),
|
||||
'rivoli' => array(),
|
||||
'dirCiv' => array(),
|
||||
'dirNom' => array(),
|
||||
'dirPrenom' => array(),
|
||||
'dirDateNaiss' => array(),
|
||||
'dirFct' => array(),
|
||||
'nbEtab' => array(),
|
||||
'nbMPubli' => array(),
|
||||
'sirenGrp' => array(),
|
||||
'nbActio' => array(),
|
||||
'nbPart' => array(),
|
||||
'bilType' => array(
|
||||
'values' => array(
|
||||
'1' => 'Inconnus', // I
|
||||
'2' => 'Réels', // R
|
||||
'3' => 'Estimés' //E
|
||||
)
|
||||
),
|
||||
'bilAnnee' => array(),
|
||||
'bilCloture' => array(),
|
||||
'bilDuree' => array(),
|
||||
'bilTca' => array(),
|
||||
'bilEE' => array(),
|
||||
'bilFL' => array(),
|
||||
'bilFK' => array(),
|
||||
'bilFR' => array(),
|
||||
'bilGF' => array(),
|
||||
'bilGP' => array(),
|
||||
'bilGU' => array(),
|
||||
'bilGW' => array(),
|
||||
'bilHD' => array(),
|
||||
'bilHH' => array(),
|
||||
'bilHL' => array(),
|
||||
'bilHM' => array(),
|
||||
'bilHN' => array(),
|
||||
'bilYP' => array(),
|
||||
'avisCs' => array(),
|
||||
);
|
||||
|
||||
/**
|
||||
* Déclaration des champs exportable
|
||||
* @var array
|
||||
*/
|
||||
protected $fields = array(
|
||||
'siege' => array(
|
||||
'label' => "Type d'établissement",
|
||||
'column' => 'siege',
|
||||
),
|
||||
'raisonSociale' => array(
|
||||
'label' => "Raison Sociale",
|
||||
'column' => 'raisonSociale'
|
||||
),
|
||||
'enseigne' => array(
|
||||
'label' => "Enseigne",
|
||||
'column' => 'enseigne'
|
||||
),
|
||||
'sigle' => array(
|
||||
'label' => "Sigle",
|
||||
'column' => 'sigle'
|
||||
),
|
||||
'identite_pre' => array(
|
||||
'label' => "Identite Précédente",
|
||||
'column' => 'identite_pre'
|
||||
),
|
||||
'marques' => array(
|
||||
'label' => "Marques déposées",
|
||||
'column' => 'marques'
|
||||
),
|
||||
'adresse' => array(
|
||||
'label' => 'Adresse',
|
||||
'column' => 'adresse',
|
||||
'sql' => "CONCAT_WS(' ', adr_num, adr_btq, adr_typeVoie, adr_libVoie) as adresse",
|
||||
),
|
||||
'adr_comp' => array(
|
||||
'label' => 'Adresse - Complément',
|
||||
'column' => 'adr_comp',
|
||||
),
|
||||
'codepostal' => array(
|
||||
'label' => 'Code Postal',
|
||||
'column' => 'adr_cp',
|
||||
),
|
||||
'departement' => array(
|
||||
'label' => 'Département',
|
||||
'column' => 'adr_dep',
|
||||
),
|
||||
'ville' => array(
|
||||
'label' => 'Ville',
|
||||
'column' => 'adr_ville',
|
||||
),
|
||||
'codecommune' => array(
|
||||
'label' => 'Code Commune',
|
||||
'column' => 'codecom',
|
||||
'sql' => 'CONCAT(adr_dep, adr_com) as codecom',
|
||||
),
|
||||
'tel' => array(
|
||||
'label' => "Téléphone",
|
||||
'column' => 'tel' ,
|
||||
'sql' => 'LPAD(tel, 10, 0000000000) AS tel'
|
||||
),
|
||||
'fax' => array(
|
||||
'label' => "Fax",
|
||||
'column' => 'fax',
|
||||
'sql' => 'LPAD(fax, 10, 0000000000) AS fax'
|
||||
),
|
||||
'cj' => array(
|
||||
'label' => "Code Forme juridique",
|
||||
'column' => 'cj',
|
||||
'join' => array(
|
||||
'label'=>'Forme juridique',
|
||||
'column'=>'libelle',
|
||||
'table'=>'jo.tabFJur',
|
||||
'cond'=>'jo.etablissements_act.cj=cj_libelle.code'
|
||||
)
|
||||
),
|
||||
'dirigeant' => array(
|
||||
'label' => "Dirigeant",
|
||||
'column' => 'dirigeant',
|
||||
'sql' => "CONCAT_WS(' ', dirCiv, dirNom, dirPrenom) AS dirigeant",
|
||||
),
|
||||
'dirigeantFct' => array(
|
||||
'label' => "Dirigeant - Code Fonction",
|
||||
'column' => 'dirFct',
|
||||
'join' => array(
|
||||
'label'=>'Dirigeant - Libelle Fonction',
|
||||
'column'=>'libelle',
|
||||
'table'=>'jo.bodacc_fonctions',
|
||||
'stat'=>'jo.etablissements_act.dirFct=dirFct_libelle.codeFct'
|
||||
)
|
||||
),
|
||||
/*'dirigeantFct' => array(
|
||||
'label' => array("Dirigeant - Code Fonction","Dirigeant - Libelle Fonction"),
|
||||
'column' => 'libelle',
|
||||
'sql' => array('dirFct',"jo_fonctions.libelle"),
|
||||
),*/
|
||||
|
||||
'dirigeantnaiss' => array(
|
||||
'label' => "Dirigeant - Date de naissance",
|
||||
'column' => 'dirDateNaiss'
|
||||
),
|
||||
'nafetablissement' => array(
|
||||
'label' => "Code NAF Etablissement",
|
||||
'column' => 'ape_etab',
|
||||
'join' => array('Libelle NAF Etablissement',
|
||||
'column'=>'libNaf5',
|
||||
'table'=>'jo.tabNaf5',
|
||||
'stat'=>'jo.etablissements_act.ape_etab=ape_etab_libNaf5.codNaf5')
|
||||
),
|
||||
/*'libNaf5_etab' => array(
|
||||
'label' => "Libelle NAF Etablissement",
|
||||
'column' => 'ape_etab',
|
||||
'sql' => "jo_etab.libNaf5 AS etab_libNaf5",
|
||||
),*/
|
||||
'nafentreprise' => array(
|
||||
'label' => "Code NAF Entreprise",
|
||||
'column' => 'ape_entrep',
|
||||
'join' => array('Libelle NAF Entreprise',
|
||||
'column'=>'libNaf5',
|
||||
'table'=>'jo.tabNaf5',
|
||||
'stat'=>'jo.etablissements_act.ape_entrep=ape_entrep_libNaf5.codNaf5')
|
||||
),
|
||||
/*'libNaf5_entrep' => array(
|
||||
'label' => "Libelle NAF Entreprise",
|
||||
'column' => 'ape_entrep',
|
||||
'sql' => "jo_entrep.libNaf5 AS entrep_libNaf5",
|
||||
),*/
|
||||
'effetablissement' => array(
|
||||
'label' => "Effectif Etablissement",
|
||||
'column' => 'eff_etab'
|
||||
),
|
||||
'effentreprise' => array(
|
||||
'label' => "Effectif Entreprise",
|
||||
'column' => 'eff_entrep'
|
||||
),
|
||||
'teffetablissement' => array(
|
||||
'label' => "Code Tranche Effectif Etablissement",
|
||||
'column' => 'teff_etab'
|
||||
|
||||
),
|
||||
'teffentreprise' => array(
|
||||
'label' => "Code Tranche Effectif Entreprise",
|
||||
'column' => 'teff_entrep'
|
||||
|
||||
),
|
||||
'capital' => array(
|
||||
'label' => "Capital",
|
||||
'column' => 'capital'
|
||||
),
|
||||
'capitaldev' => array(
|
||||
'label' => "Devise Capital",
|
||||
'column' => 'capitalDev'
|
||||
),
|
||||
'ageentrep' => array(
|
||||
'label' => "Age de l'entreprise",
|
||||
'column' => 'age_entrep'
|
||||
),
|
||||
'ageetab' => array(
|
||||
'label' => "Age de l'établissement",
|
||||
'column' => 'age_etab'
|
||||
),
|
||||
//autre_id
|
||||
//capital
|
||||
//tca
|
||||
//tcaexp
|
||||
'nomcommercial' => array(
|
||||
'label' => "Nom commercial",
|
||||
'column' => 'nomCommercial',
|
||||
),
|
||||
'siteweb' => array(
|
||||
'label' => "Site web",
|
||||
'column' => 'web',
|
||||
),
|
||||
'mail' => array(
|
||||
'label' => "Adresse email",
|
||||
'column' => 'mail',
|
||||
),
|
||||
//adrDom
|
||||
//lieuAct
|
||||
//explen
|
||||
//explet
|
||||
//actifEco
|
||||
//procolHisto
|
||||
//tvaIntraCle
|
||||
//ape4_etab
|
||||
//ape4_entrep
|
||||
//NaceEtab
|
||||
//NaceEntrep
|
||||
//dateCrea_etab
|
||||
//dateCrea_ent
|
||||
//dateImmat
|
||||
//distSP
|
||||
//achPost
|
||||
//rivoli
|
||||
//lambert
|
||||
//zus
|
||||
//zru
|
||||
//zfu
|
||||
//cucs
|
||||
//zrr
|
||||
//zafr
|
||||
'nbetab' => array(
|
||||
'label' => "Nombre d'établissements",
|
||||
'column' => 'nbEtab',
|
||||
),
|
||||
'nbmpubli' => array(
|
||||
'label' => "Nombre de marché public remporté",
|
||||
'column' => 'nbMPubli',
|
||||
),
|
||||
'sirengrp' => array(
|
||||
'label' => "SIREN du groupe",
|
||||
'column' => 'sirenGrp',
|
||||
),
|
||||
'nbactio' => array(
|
||||
'label' => "Nombre d'actionnaires",
|
||||
'column' => 'nbActio',
|
||||
),
|
||||
'nbpart' => array(
|
||||
'label' => "Nombre de participations",
|
||||
'column' => 'nbPart',
|
||||
),
|
||||
'bilfl' => array(
|
||||
'label' => "CA total (FL)",
|
||||
'column' => 'bilFL',
|
||||
),
|
||||
'bilcloture' => array(
|
||||
'label' => 'Date de clôture du bilan',
|
||||
'column' => 'bilCloture',
|
||||
),
|
||||
'biltype' => array(
|
||||
'label' => 'Type du bilan',
|
||||
'column' => 'bilType',
|
||||
),
|
||||
//bilAnnee
|
||||
//bilDuree
|
||||
//avisCs
|
||||
//risque
|
||||
);
|
||||
|
||||
public function __construct(){}
|
||||
|
||||
public function getFields()
|
||||
{
|
||||
return $this->fields;
|
||||
}
|
||||
|
||||
public function getSql($key)
|
||||
{
|
||||
if ( array_key_exists($key, $this->columns) ) {
|
||||
if ( array_key_exists('sql', $this->columns[$key]) ){
|
||||
return $this->columns[$key]['sql'];
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
public function getColumnValue($key)
|
||||
{
|
||||
if ( array_key_exists($key, $this->columns) ) {
|
||||
if ( array_key_exists('values', $this->columns[$key]) && count($this->columns[$key]['values'])>0 ){
|
||||
return $this->columns[$key]['values'];
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
6
library/Scores/Ciblage/Field.php
Normal file
6
library/Scores/Ciblage/Field.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
class Scores_Ciblage_Field
|
||||
{
|
||||
|
||||
|
||||
}
|
@ -1,151 +1,6 @@
|
||||
<?php
|
||||
class Enrichissement
|
||||
{
|
||||
/**
|
||||
* Déclaration des colonnes de la table de données pour la transposition
|
||||
* siren + nic + presentRcs
|
||||
*/
|
||||
protected $columns = array(
|
||||
'id' => array(), //Non utilisé
|
||||
'source' => array(),
|
||||
'source_id' => array(),
|
||||
'triCode' => array(),
|
||||
'autre_id' => array(),
|
||||
'siren' => array(), //Obligatoire
|
||||
'nic' => array(), //Obligatoire
|
||||
'actif' => array(
|
||||
'values' => array(
|
||||
'1' => "actif",
|
||||
'0' => "inactif",
|
||||
)
|
||||
),
|
||||
'siege' => array(
|
||||
'values' => array(
|
||||
'1' => "Etablissement Siege",
|
||||
'0' => "Etablissement Secondaire",
|
||||
)
|
||||
),
|
||||
'raisonSociale' => array(), //Raison Sociale
|
||||
'enseigne' => array(), //Enseigne
|
||||
'sigle' => array(), //Sigle
|
||||
'identite_pre' => array(), //Identite Précédente
|
||||
'marques' => array(),
|
||||
'adr_num' => array(), //Adresse
|
||||
'adr_btq' => array(), //Adresse
|
||||
'adr_typeVoie' => array(), //Adresse
|
||||
'adr_libVoie' => array(), //Adresse
|
||||
'adr_comp' => array(), //Adresse - Complément
|
||||
'adr_cp' => array(), //Adresse
|
||||
'adr_ville' => array(), //Adresse
|
||||
'adr_dep' => array(), //Département | Code Commune
|
||||
'adr_com' => array(), //Code Commune
|
||||
'tel' => array(), //Telephone
|
||||
'fax' => array(), //Fax
|
||||
'cj' => array(), //Forme Juridique
|
||||
'capital' => array(),
|
||||
'capitalDev' => array(),
|
||||
'capitalSrc' => array(),
|
||||
'ape_etab' => array(),
|
||||
'ape_entrep' => array(),
|
||||
'age_entrep' => array(),
|
||||
'age_etab' => array(),
|
||||
'tca' => array(),
|
||||
'tcaexp' => array(),
|
||||
'teff_entrep' => array(
|
||||
'values' => array(
|
||||
'NN' => "Unités non employeuses", //@todo : a vérifier NULL dans la base
|
||||
'0' => "0 salarié",
|
||||
'1' => "1 ou 2 salariés",
|
||||
'2' => "3 à 5 salariés",
|
||||
'3' => "6 à 9 salariés",
|
||||
'11' => "10 à 19 salariés",
|
||||
'12' => "20 à 49 salariés",
|
||||
'21' => "50 à 99 salariés",
|
||||
'22' => "100 à 199 salariés",
|
||||
'31' => "200 à 249 salariés",
|
||||
'32' => "250 à 499 salariés",
|
||||
'41' => "500 à 999 salariés",
|
||||
'42' => "1 000 à 1 999 salariés",
|
||||
'51' => "2 000 à 4 999 salariés",
|
||||
'52' => "5 000 à 9 999 salariés",
|
||||
'53' => "10 000 salariés et plus",
|
||||
),
|
||||
),
|
||||
'teff_etab' => array(
|
||||
'values' => array(
|
||||
'NN' => "Unités non employeuses", //@todo : a vérifier NULL dans la base
|
||||
'0' => "0 salarié",
|
||||
'1' => "1 ou 2 salariés",
|
||||
'2' => "3 à 5 salariés",
|
||||
'3' => "6 à 9 salariés",
|
||||
'11' => "10 à 19 salariés",
|
||||
'12' => "20 à 49 salariés",
|
||||
'21' => "50 à 99 salariés",
|
||||
'22' => "100 à 199 salariés",
|
||||
'31' => "200 à 249 salariés",
|
||||
'32' => "250 à 499 salariés",
|
||||
'41' => "500 à 999 salariés",
|
||||
'42' => "1 000 à 1 999 salariés",
|
||||
'51' => "2 000 à 4 999 salariés",
|
||||
'52' => "5 000 à 9 999 salariés",
|
||||
'53' => "10 000 salariés et plus",
|
||||
),
|
||||
),
|
||||
'rang' => array(),
|
||||
'web' => array(),
|
||||
'mail' => array(),
|
||||
'adrDom' => array(),
|
||||
'lieuAct' => array(),
|
||||
'actifEco' => array(),
|
||||
'presentRcs' => array(),
|
||||
'procolHisto' => array(),
|
||||
'tvaIntraCle' => array(),
|
||||
'tvaIntraValide' => array(),
|
||||
'ape4_etab' => array(),
|
||||
'ape4_entrep' => array(),
|
||||
'NaceEtab' => array(),
|
||||
'NaceEntrep' => array(),
|
||||
'dateCrea_etab' => array(),
|
||||
'dateCrea_ent' => array(),
|
||||
'dateImmat' => array(),
|
||||
'eff_entrep' => array(),
|
||||
'eff_etab' => array(),
|
||||
'distSP' => array(),
|
||||
'achPost' => array(),
|
||||
'rivoli' => array(),
|
||||
'dirCiv' => array(),
|
||||
'dirNom' => array(),
|
||||
'dirPrenom' => array(),
|
||||
'dirDateNaiss' => array(),
|
||||
'dirFct' => array(),
|
||||
'nbEtab' => array(),
|
||||
'nbMPubli' => array(),
|
||||
'sirenGrp' => array(),
|
||||
'nbActio' => array(),
|
||||
'nbPart' => array(),
|
||||
'bilType' => array(),
|
||||
'bilAnnee' => array(),
|
||||
'bilCloture' => array(),
|
||||
'bilDuree' => array(),
|
||||
'bilTca' => array(),
|
||||
'bilEE' => array(),
|
||||
'bilFL' => array(),
|
||||
'bilFK' => array(),
|
||||
'bilFR' => array(),
|
||||
'bilGF' => array(),
|
||||
'bilGP' => array(),
|
||||
'bilGU' => array(),
|
||||
'bilGW' => array(),
|
||||
'bilHD' => array(),
|
||||
'bilHH' => array(),
|
||||
'bilHL' => array(),
|
||||
'bilHM' => array(),
|
||||
'bilHN' => array(),
|
||||
'bilYP' => array(),
|
||||
'avisCs' => array(),
|
||||
|
||||
);
|
||||
|
||||
/**
|
||||
* Déclaration des champs exportable
|
||||
* @var array
|
||||
@ -154,6 +9,10 @@ class Enrichissement
|
||||
'siege' => array(
|
||||
'label' => "Type d'établissement",
|
||||
'column' => 'siege',
|
||||
'values' => array(
|
||||
'1' => "Etablissement Siege",
|
||||
'0' => "Etablissement Secondaire",
|
||||
),
|
||||
),
|
||||
'raisonSociale' => array(
|
||||
'label' => "Raison Sociale",
|
||||
@ -214,10 +73,12 @@ class Enrichissement
|
||||
'cj' => array(
|
||||
'label' => "Code Forme juridique",
|
||||
'column' => 'cj',
|
||||
'join' => array('label'=>'Forme juridique',
|
||||
'column'=>'libelle',
|
||||
'table'=>'jo.tabFJur',
|
||||
'stat'=>'jo.etablissements_act.cj=cj_libelle.code')
|
||||
'join' => array(
|
||||
'label' => 'Forme juridique',
|
||||
'column' => 'libelle',
|
||||
'table' => 'jo.tabFJur',
|
||||
'cond' => 'jo.etablissements_act.cj = cj_libelle.code'
|
||||
)
|
||||
),
|
||||
'dirigeant' => array(
|
||||
'label' => "Dirigeant",
|
||||
@ -227,17 +88,12 @@ class Enrichissement
|
||||
'dirigeantFct' => array(
|
||||
'label' => "Dirigeant - Code Fonction",
|
||||
'column' => 'dirFct',
|
||||
'join' => array('label'=>'Dirigeant - Libelle Fonction',
|
||||
'column'=>'libelle',
|
||||
'table'=>'jo.bodacc_fonctions',
|
||||
'stat'=>'jo.etablissements_act.dirFct=dirFct_libelle.codeFct')
|
||||
'join' => array(
|
||||
'label' => 'Dirigeant - Libelle Fonction',
|
||||
'column' => 'libelle',
|
||||
'table' => 'jo.bodacc_fonctions',
|
||||
'cond' => 'jo.etablissements_act.dirFct = dirFct_libelle.codeFct')
|
||||
),
|
||||
/*'dirigeantFct' => array(
|
||||
'label' => array("Dirigeant - Code Fonction","Dirigeant - Libelle Fonction"),
|
||||
'column' => 'libelle',
|
||||
'sql' => array('dirFct',"jo_fonctions.libelle"),
|
||||
),*/
|
||||
|
||||
'dirigeantnaiss' => array(
|
||||
'label' => "Dirigeant - Date de naissance",
|
||||
'column' => 'dirDateNaiss'
|
||||
@ -245,29 +101,21 @@ class Enrichissement
|
||||
'nafetablissement' => array(
|
||||
'label' => "Code NAF Etablissement",
|
||||
'column' => 'ape_etab',
|
||||
'join' => array('Libelle NAF Etablissement',
|
||||
'column'=>'libNaf5',
|
||||
'table'=>'jo.tabNaf5',
|
||||
'stat'=>'jo.etablissements_act.ape_etab=ape_etab_libNaf5.codNaf5')
|
||||
'join' => array(
|
||||
'label' => 'NAF Etablissement - Libelle',
|
||||
'column' => 'libNaf5',
|
||||
'table' => 'jo.tabNaf5',
|
||||
'cond' => 'jo.etablissements_act.ape_etab = ape_etab_libNaf5.codNaf5')
|
||||
),
|
||||
/*'libNaf5_etab' => array(
|
||||
'label' => "Libelle NAF Etablissement",
|
||||
'column' => 'ape_etab',
|
||||
'sql' => "jo_etab.libNaf5 AS etab_libNaf5",
|
||||
),*/
|
||||
'nafentreprise' => array(
|
||||
'label' => "Code NAF Entreprise",
|
||||
'column' => 'ape_entrep',
|
||||
'join' => array('Libelle NAF Entreprise',
|
||||
'column'=>'libNaf5',
|
||||
'table'=>'jo.tabNaf5',
|
||||
'stat'=>'jo.etablissements_act.ape_entrep=ape_entrep_libNaf5.codNaf5')
|
||||
'join' => array(
|
||||
'label' => 'NAF Entreprise - Libelle',
|
||||
'column' => 'libNaf5',
|
||||
'table' => 'jo.tabNaf5',
|
||||
'cond' => 'jo.etablissements_act.ape_entrep = ape_entrep_libNaf5.codNaf5')
|
||||
),
|
||||
/*'libNaf5_entrep' => array(
|
||||
'label' => "Libelle NAF Entreprise",
|
||||
'column' => 'ape_entrep',
|
||||
'sql' => "jo_entrep.libNaf5 AS entrep_libNaf5",
|
||||
),*/
|
||||
'effetablissement' => array(
|
||||
'label' => "Effectif Etablissement",
|
||||
'column' => 'eff_etab'
|
||||
@ -278,11 +126,47 @@ class Enrichissement
|
||||
),
|
||||
'teffetablissement' => array(
|
||||
'label' => "Code Tranche Effectif Etablissement",
|
||||
'column' => 'teff_etab'
|
||||
'column' => 'teff_etab',
|
||||
'values' => array(
|
||||
'NN' => "Unités non employeuses", //@todo : a vérifier NULL dans la base
|
||||
'0' => "0 salarié",
|
||||
'1' => "1 ou 2 salariés",
|
||||
'2' => "3 à 5 salariés",
|
||||
'3' => "6 à 9 salariés",
|
||||
'11' => "10 à 19 salariés",
|
||||
'12' => "20 à 49 salariés",
|
||||
'21' => "50 à 99 salariés",
|
||||
'22' => "100 à 199 salariés",
|
||||
'31' => "200 à 249 salariés",
|
||||
'32' => "250 à 499 salariés",
|
||||
'41' => "500 à 999 salariés",
|
||||
'42' => "1 000 à 1 999 salariés",
|
||||
'51' => "2 000 à 4 999 salariés",
|
||||
'52' => "5 000 à 9 999 salariés",
|
||||
'53' => "10 000 salariés et plus",
|
||||
),
|
||||
),
|
||||
'teffentreprise' => array(
|
||||
'label' => "Code Tranche Effectif Entreprise",
|
||||
'column' => 'teff_entrep'
|
||||
'column' => 'teff_entrep',
|
||||
'values' => array(
|
||||
'NN' => "Unités non employeuses", //@todo : a vérifier NULL dans la base
|
||||
'0' => "0 salarié",
|
||||
'1' => "1 ou 2 salariés",
|
||||
'2' => "3 à 5 salariés",
|
||||
'3' => "6 à 9 salariés",
|
||||
'11' => "10 à 19 salariés",
|
||||
'12' => "20 à 49 salariés",
|
||||
'21' => "50 à 99 salariés",
|
||||
'22' => "100 à 199 salariés",
|
||||
'31' => "200 à 249 salariés",
|
||||
'32' => "250 à 499 salariés",
|
||||
'41' => "500 à 999 salariés",
|
||||
'42' => "1 000 à 1 999 salariés",
|
||||
'51' => "2 000 à 4 999 salariés",
|
||||
'52' => "5 000 à 9 999 salariés",
|
||||
'53' => "10 000 salariés et plus",
|
||||
),
|
||||
),
|
||||
'capital' => array(
|
||||
'label' => "Capital",
|
||||
@ -360,9 +244,24 @@ class Enrichissement
|
||||
'label' => "Nombre de participations",
|
||||
'column' => 'nbPart',
|
||||
),
|
||||
//bilType
|
||||
'bilfl' => array(
|
||||
'label' => "CA total (FL)",
|
||||
'column' => 'bilFL',
|
||||
),
|
||||
'bilcloture' => array(
|
||||
'label' => 'Date de clôture du bilan',
|
||||
'column' => 'bilCloture',
|
||||
),
|
||||
'biltype' => array(
|
||||
'label' => 'Type du bilan',
|
||||
'column' => 'bilType',
|
||||
'values' => array(
|
||||
'1' => 'Inconnus',
|
||||
'2' => 'Réels',
|
||||
'3' => 'Estimés'
|
||||
)
|
||||
),
|
||||
//bilAnnee
|
||||
//bilCloture
|
||||
//bilDuree
|
||||
//avisCs
|
||||
//risque
|
||||
@ -377,20 +276,20 @@ class Enrichissement
|
||||
|
||||
public function getSql($key)
|
||||
{
|
||||
if ( array_key_exists($key, $this->columns) ) {
|
||||
if ( array_key_exists('sql', $this->columns[$key]) ){
|
||||
return $this->columns[$key]['sql'];
|
||||
if ( array_key_exists($key, $this->fields) ) {
|
||||
if ( array_key_exists('sql', $this->fields[$key]) ){
|
||||
return $this->fields[$key]['sql'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
public function getColumnValue($key)
|
||||
{
|
||||
if ( array_key_exists($key, $this->columns) ) {
|
||||
if ( array_key_exists('values', $this->columns[$key]) && count($this->columns[$key]['values'])>0 ){
|
||||
return $this->columns[$key]['values'];
|
||||
if ( array_key_exists($key, $this->fields) ) {
|
||||
if ( array_key_exists('values', $this->fields[$key]) && count($this->fields[$key]['values'])>0 ){
|
||||
return $this->fields[$key]['values'];
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
@ -1,26 +1,5 @@
|
||||
$(document).ready(function()
|
||||
{
|
||||
|
||||
/*$('.panel-group').tabs({
|
||||
cookie: { expires: 1 }
|
||||
});
|
||||
|
||||
$('div.fieldgrp').each(function(){
|
||||
var title = $(this).attr('title');
|
||||
if (title) {
|
||||
$(this).qtip({
|
||||
solo:true, content: title,
|
||||
style: { width: 600, classes: "ui-tooltip-dark" },
|
||||
position: {
|
||||
my: "top left",
|
||||
at: "bottom right",
|
||||
viewport : $(window),
|
||||
effect: false
|
||||
}
|
||||
});
|
||||
}
|
||||
});*/
|
||||
|
||||
$('div#panel').delegate('div#criteres a.criterelist', 'click', function(e){
|
||||
e.preventDefault();
|
||||
var title = $(this).attr('title');
|
||||
@ -240,46 +219,21 @@ $(document).ready(function()
|
||||
|
||||
});
|
||||
|
||||
function set(key, value, ex)
|
||||
{
|
||||
function set(key, value, ex) {
|
||||
ex = typeof ex !== 'undefined' ? ex : 0;
|
||||
$('#comptage').css('display', 'none');
|
||||
$('#attente').css('display', 'block');
|
||||
$('#panel').html('<img src="/themes/default/images/ajax.gif" />');
|
||||
$('#panel').html('<span class="glyphicon glyphicon-refresh img-rounded"></span>');
|
||||
$.post('/comptage/index', { cle:key, valeur:value, exclude:ex }, function(data, status) {
|
||||
//
|
||||
if (data.error==0) {
|
||||
//Count html result
|
||||
var html = 'Sélection : <span class="valeur">'+data.count+'</span>';
|
||||
if (data.insee>0) {
|
||||
html = html + ' (dont <span class="valeur">'+data.insee +'</span> unité(s) insee)';
|
||||
}
|
||||
$('#comptage').html(html).css('display','block');
|
||||
|
||||
if (data.error==1) {
|
||||
$('div#actionMessage').html('<div class="alert alert-danger"><strong>Erreur !</strong> Un problème technique est survenu.</div>');
|
||||
}
|
||||
|
||||
if (data.error==2) {
|
||||
$('div#actionMessage').html(
|
||||
'<div class="ui-state-highlight ui-corner-all" style="padding: .7em;">'+
|
||||
'<p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>'+
|
||||
'<strong>Information : </strong>Valeur saisi incorrecte.</p>'+
|
||||
'</div>');
|
||||
$('#comptage').css('display','block');
|
||||
$('div#actionMessage').html('<div class="alert alert-warning"><strong>Information !</strong> Valeur saisi incorrecte.</div>');
|
||||
}
|
||||
|
||||
if (data.error==1) {
|
||||
$('div#actionMessage').html(
|
||||
'<div class="ui-state-error ui-corner-all" style="padding: .7em;">'+
|
||||
'<p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span>'+
|
||||
'<strong>Erreur : </strong>Un problème technique est survenu.</p>'+
|
||||
'</div>');
|
||||
$('#comptage').css('display','block');
|
||||
}
|
||||
|
||||
//
|
||||
$('#attente').css('display', 'none');
|
||||
|
||||
//Resume criteres content
|
||||
$.get('/index/criteres/ajax/1', function(data) { $('#panel').html(data); });
|
||||
$.post('/index/criteres', { total:data.count, insee:data.insee }, function(data) { $('#panel').html(data); });
|
||||
|
||||
}, 'json').error(function(){ alert('Erreur inconnue'); });
|
||||
}
|
||||
|
@ -1,25 +1,8 @@
|
||||
$(document).ready(function(){
|
||||
|
||||
/*$('#message').hover(
|
||||
function(){ $('#control').css('display', 'block'); },
|
||||
function(){ $('#control').css('display', 'none'); }
|
||||
);*/
|
||||
|
||||
$('img.flag').on('click', function() {
|
||||
var url = window.location.href;
|
||||
$.post('/user/lang', {lang: $(this).attr('id')}, function(data){
|
||||
window.location.href = url;
|
||||
});
|
||||
});
|
||||
|
||||
$(window).scroll(function() {
|
||||
var offset = $(window).scrollTop();
|
||||
var headerHeight = $('div#header').height();
|
||||
if (offset>headerHeight-15) {
|
||||
$('div#navigation').addClass('navigationFix');
|
||||
} else {
|
||||
$('div#navigation').removeClass('navigationFix');
|
||||
}
|
||||
$('div#dialog').on('hidden.bs.modal', function () {
|
||||
$(this).removeData('bs.modal');
|
||||
$(this).find('div.modal-dialog').remove();
|
||||
});
|
||||
|
||||
$('body').delegate('.saveciblage', 'click', function(){
|
||||
|
@ -1,58 +0,0 @@
|
||||
<?php
|
||||
// Define path to application directory
|
||||
defined('APPLICATION_PATH')
|
||||
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../../application'));
|
||||
|
||||
// Define application environment
|
||||
define('APPLICATION_ENV', 'production');
|
||||
|
||||
// Ensure library/ is on include_path
|
||||
set_include_path(implode(PATH_SEPARATOR, array(
|
||||
realpath(APPLICATION_PATH . '/../library'),
|
||||
get_include_path(),
|
||||
)));
|
||||
|
||||
/** Zend_Application */
|
||||
require_once 'Zend/Application.php';
|
||||
|
||||
// Create application, bootstrap, and run
|
||||
$application = new Zend_Application(
|
||||
APPLICATION_ENV,
|
||||
APPLICATION_PATH . '/configs/application.ini'
|
||||
);
|
||||
|
||||
try {
|
||||
$opts = new Zend_Console_Getopt(
|
||||
//Options
|
||||
array(
|
||||
'help|?' => "Aide.",
|
||||
'cron' => "",
|
||||
)
|
||||
);
|
||||
$opts->parse();
|
||||
} catch (Zend_Console_Getopt_Exception $e) {
|
||||
echo $e->getUsageMessage();
|
||||
exit;
|
||||
}
|
||||
|
||||
//Usage
|
||||
if(isset($opts->help))
|
||||
{
|
||||
echo $opts->getUsageMessage();
|
||||
exit;
|
||||
}
|
||||
|
||||
//Cron indexing
|
||||
if(isset($opts->cron))
|
||||
{
|
||||
$dbConfig = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'databases');
|
||||
$db = Zend_Db::factory($dbConfig->jo);
|
||||
//Début de l'indexation
|
||||
|
||||
//Execution de l'indexation
|
||||
|
||||
//Fin de l'indexation
|
||||
|
||||
//Minimum - Maximum
|
||||
|
||||
}
|
@ -51,8 +51,8 @@ $frontendOptions = array(
|
||||
'automatic_serialization' => true
|
||||
);
|
||||
$backendOptions = array();
|
||||
//$cache = Zend_Cache::factory('Core','Apc', $frontendOptions, $backendOptions);
|
||||
//Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);
|
||||
$cache = Zend_Cache::factory('Core','Apc', $frontendOptions, $backendOptions);
|
||||
Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);
|
||||
|
||||
//Définition bdd
|
||||
try {
|
||||
@ -101,54 +101,48 @@ $dico = new Enrichissement();
|
||||
$fields = $dico->getFields();
|
||||
|
||||
//Entete, Valeur de remplacement et Requete SQL
|
||||
$tabEntete = array('siret','siren', 'nic');
|
||||
$tabEnteteLabel = array('SIRET','SIREN', 'NIC');
|
||||
$sql = 'CONCAT(siren, nic) as siret, LPAD(siren, 9, 000000000) AS siren, LPAD(nic,5,00000) AS nic,';
|
||||
$from = 'jo.etablissements_act';
|
||||
$addWhere = '';
|
||||
$tabEntete = array('siren', 'nic');
|
||||
$tabEnteteLabel = array('SIREN', 'NIC');
|
||||
$sqlSelect = 'SELECT LPAD(siren, 9, 000000000) AS siren, LPAD(nic,5,00000) AS nic,';
|
||||
$sqlFrom = 'jo.etablissements_act';
|
||||
$sqlWhere = '';
|
||||
foreach ( $dataProfil as $item ) {
|
||||
//Définition de l'entete
|
||||
$tabEnteteLabel[] = $fields[$item]['label'];
|
||||
$tabEntete[] = $item;
|
||||
|
||||
//Construction de la requete SQL
|
||||
if ( array_key_exists('sql', $fields[$item]) ) {
|
||||
$sql.= ' '.$fields[$item]['sql'].', ';
|
||||
} else {
|
||||
$sql.= ' '.$fields[$item]['column'].' AS '.$item.',';
|
||||
}
|
||||
//Get item
|
||||
if ( array_key_exists($item, $fields) ) {
|
||||
$field = $fields[$item];
|
||||
|
||||
//Pour les champs de type "code", ajouter le libellé
|
||||
if ( array_key_exists('join', $fields[$item]) ) {
|
||||
|
||||
//Automatic column name .Lib
|
||||
$joinColumn = $fields[$item]['join']['column'];
|
||||
$colName = $fields[$item]['column'].$joinColumn;
|
||||
$tabEntete[] = $colName;
|
||||
//label
|
||||
$tabEnteteLabel[] = $fields[$item]['join']['label'];
|
||||
//Sql
|
||||
$tableAlias = array($fields[$item]['column'].'_'.$joinColumn=>$fields[$item]['join']['table']);
|
||||
$sql.= $fields[$item]['column'].'_'.$joinColumn.'.'.$joinColumn.' AS '.$colName.',';
|
||||
$join[]= array($tableAlias,$fields[$item]['join']['stat']);
|
||||
}
|
||||
//Définition de l'entete
|
||||
$tabEnteteLabel[] = $field['label'];
|
||||
$tabEntete[] = $item;
|
||||
|
||||
//Construction de la requete SQL
|
||||
if ( array_key_exists('sql', $field) ) {
|
||||
$sqlSelect.= ' '.$field['sql'].', ';
|
||||
} else {
|
||||
$sqlSelect.= ' '.$field['column'].' AS '.$item.',';
|
||||
}
|
||||
|
||||
//Pour les champs de type "code", ajouter le libellé
|
||||
if ( array_key_exists('join', $field) ) {
|
||||
$tabEnteteLabel[] = $field['join']['label'];
|
||||
$joinColumn = $item.'Lib';
|
||||
$tabEntete[] = $joinColumn;
|
||||
|
||||
//Sql
|
||||
$tableAlias = $item.'L';
|
||||
$sqlSelect.= $tableAlias.'.'.$field['join']['column'].' AS '.$joinColumn;
|
||||
$sqlFrom.= ','.$field['join']['column'].' AS '.$tableAlias;
|
||||
$sqlWhere = ' AND WHERE '.$field['join']['cond'];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//Ajouter le champ presentRcs
|
||||
$tabEntete[] = 'presentRcs';
|
||||
$tabEnteteLabel[] = 'RCS';
|
||||
$sql .= ' presentRcs AS presentRcs';
|
||||
$sqlFrom .= ' presentRcs';
|
||||
|
||||
//add Tranche Effectif
|
||||
$teff_etab = $dico->getColumnValue('teff_etab');
|
||||
$teff_entrep = $dico->getColumnValue('teff_entrep');
|
||||
$tabEntete[] = 'teff_etabLib';
|
||||
$tabEntete[] = 'teff_entrepLib';
|
||||
$tabEnteteLabel[] = 'Libelle Tranche Effectif Etablissement ';
|
||||
$tabEnteteLabel[] = 'Libelle Tranche Effectif Entreprise';
|
||||
//Convert
|
||||
$tabEnteteLabel = array_map('utf8_decode',array_values($tabEnteteLabel));
|
||||
//Pour chaque identifiant traiter les données
|
||||
$row = 0;
|
||||
$fp = fopen($path.'/'.$outFile, 'w');
|
||||
@ -165,53 +159,37 @@ if ($opts->id) {
|
||||
"id = ".$commande->id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$model = $sql;
|
||||
$traite = 0;
|
||||
//Date de debut de traitement.
|
||||
$dateStart = date('YmdHms');
|
||||
$db = Zend_Db_Table::getDefaultAdapter();
|
||||
$sql = $db->select()
|
||||
->from($from,$model);
|
||||
if($join){
|
||||
foreach ($join as $params ){
|
||||
$sql->joinLeft($params[0], $params[1], array());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$where = '';
|
||||
foreach ($identifiants as $key=>$siret )
|
||||
foreach ($identifiants as $siret )
|
||||
{
|
||||
if ($key>0) {
|
||||
$where.=' OR ';
|
||||
}
|
||||
$where.="(siren='".substr($siret,0,9)."' AND nic='".substr($siret,9,5)."')";
|
||||
}
|
||||
$sql->where($where);
|
||||
try {
|
||||
$result = $db->fetchAll($sql);
|
||||
} catch(Exception $e) {
|
||||
echo $e;
|
||||
}
|
||||
foreach ($result as $tabData) {
|
||||
if (array_key_exists('teffetablissement', $tabData)) {
|
||||
$tabData['teff_etabLib']=$teff_etab[$tabData['teffetablissement']];
|
||||
}
|
||||
if(array_key_exists('teffentreprise', $tabData)){
|
||||
$tabData['teff_entrepLib']=$teff_etab[$tabData['teffentreprise']];
|
||||
}
|
||||
if (array_key_exists('siege', $tabData)) {
|
||||
($tabData[siege])?$tabData[siege]='Siège':$tabData[siege]='Secondaire';
|
||||
$sql = $sqlSelect . ' FROM jo.etablissements_act ' . $sqlFrom .
|
||||
' WHERE siren='.substr($siret,0,9).' AND nic='.substr($siret,9,5) . $sqlWhere;
|
||||
try {
|
||||
$result = $db->fetchRow($sql);
|
||||
$traite++;
|
||||
} catch(Exception $e) {
|
||||
echo $sql;
|
||||
}
|
||||
$tabData = $result->toArray();
|
||||
//Trier pour la sortie
|
||||
$tabSortie = array();
|
||||
foreach($tabEntete as $key){
|
||||
foreach($tabEntete as $key) {
|
||||
//Add static values
|
||||
if ( array_key_exists($key, $fields) ) {
|
||||
if ( array_key_exists('values', $fields[$key]) ) {
|
||||
$values = $fields[$key]['values'];
|
||||
//Remplace value if exist
|
||||
if ( in_array($tabData[$key], $values) ) {
|
||||
$tabData[$key] = $values[$tabData[$key]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Order data for CSV file
|
||||
$tabSortie[] = isset($tabData[$key]) ? $tabData[$key] : '';
|
||||
}
|
||||
//Convert
|
||||
$tabSortie = array_map('utf8_decode',array_values($tabSortie));
|
||||
|
||||
fputcsv($fp, $tabSortie, ',', '"');
|
||||
|
||||
//Mise à jour des lignes traitées dans la base
|
||||
|
Loading…
Reference in New Issue
Block a user