Merge
This commit is contained in:
commit
ff7707563e
@ -28,6 +28,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
|||||||
->appendFile($pathScript.'/jquery.cookie.js', 'text/javascript')
|
->appendFile($pathScript.'/jquery.cookie.js', 'text/javascript')
|
||||||
->appendFile($pathScript.'/jquery-ui.js', 'text/javascript')
|
->appendFile($pathScript.'/jquery-ui.js', 'text/javascript')
|
||||||
->appendFile($pathScript.'/jquery.qtip.js', 'text/javascript')
|
->appendFile($pathScript.'/jquery.qtip.js', 'text/javascript')
|
||||||
|
->appendFile($pathScript.'/upload.js', 'text/javascript')
|
||||||
->appendFile($pathScript.'/scripts.js', 'text/javascript');
|
->appendFile($pathScript.'/scripts.js', 'text/javascript');
|
||||||
|
|
||||||
$view->headTitle()->setSeparator(' - ');
|
$view->headTitle()->setSeparator(' - ');
|
||||||
|
@ -10,35 +10,9 @@ class DashboardController extends Libs_Controller
|
|||||||
public function indexAction()
|
public function indexAction()
|
||||||
{
|
{
|
||||||
$object = new Object_Dashboard();
|
$object = new Object_Dashboard();
|
||||||
|
|
||||||
$this->view->comptages = $object->index();
|
$this->view->comptages = $object->index();
|
||||||
|
$this->view->enrichissements = $object->enrichissements();
|
||||||
$auth = Zend_Auth::getInstance();
|
|
||||||
$user = $auth->getIdentity();
|
|
||||||
|
|
||||||
|
|
||||||
//Affichage des derniers enrichissements
|
|
||||||
$enrichissementsM = new Table_EnrichissementIdentifiants();
|
|
||||||
|
|
||||||
$sql = $enrichissementsM->select()
|
|
||||||
->setIntegrityCheck(false)
|
|
||||||
->from(
|
|
||||||
array('i' => 'enrichissement_identifiants'),
|
|
||||||
array('id', 'reference', 'fichier', 'nbLigneTotales', 'nbLigneTraites', 'error', 'dateAdded', 'dateStart', 'dateStop')
|
|
||||||
)
|
|
||||||
->join(
|
|
||||||
array('c' => 'comptages'), 'i.idComptage = c.id',
|
|
||||||
array('')
|
|
||||||
)
|
|
||||||
->join(
|
|
||||||
array('criteres' => 'criteres'), 'i.idCriteres = criteres.id',
|
|
||||||
array('')
|
|
||||||
)
|
|
||||||
->where('criteres.idClient = ?', $user->idClient)
|
|
||||||
->where('criteres.login = ?', $user->username)
|
|
||||||
->order('dateAdded DESC');
|
|
||||||
|
|
||||||
$enrichissements = $enrichissementsM->fetchAll($sql);
|
|
||||||
$this->view->assign('enrichissements', $enrichissements);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -70,10 +70,17 @@ class EnrichissementController extends Zend_Controller_Action
|
|||||||
*/
|
*/
|
||||||
public function commandeAction()
|
public function commandeAction()
|
||||||
{
|
{
|
||||||
|
$this->_helper->layout()->disableLayout();
|
||||||
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$idCriteres = $request->getParam('id', null);
|
$idCriteres = $request->getParam('id', null);
|
||||||
$idProfil = $request->getParam('profil', null);
|
$idProfil = $request->getParam('profil', null);
|
||||||
|
|
||||||
|
$comptage = new Table_Comptages();
|
||||||
|
$sql = $comptage->select()->where('idDefinition = ?', $idCriteres);
|
||||||
|
$result = $comptage->fetchRow($sql);
|
||||||
|
$idComptage = $result['idDefinition'];
|
||||||
|
|
||||||
//Vérifier les profils du client
|
//Vérifier les profils du client
|
||||||
if ( $idProfil===null ){
|
if ( $idProfil===null ){
|
||||||
//Selection du profil du client
|
//Selection du profil du client
|
||||||
@ -103,27 +110,27 @@ class EnrichissementController extends Zend_Controller_Action
|
|||||||
|
|
||||||
//Récupération des SIRET
|
//Récupération des SIRET
|
||||||
require_once 'Scores/Ciblage.php';
|
require_once 'Scores/Ciblage.php';
|
||||||
$ciblage = new Ciblage($values);
|
$ciblage = new Ciblage($values, true);
|
||||||
$infosExtraction = $ciblage->extract();
|
$infosExtraction = $ciblage->execute(true);
|
||||||
|
|
||||||
//Attention calcul uniteInsee réelle
|
//Attention calcul uniteInsee réelle
|
||||||
//car si donnée insee alors toutes les lignes doivent être comptés en unité insee
|
//car si donnée insee alors toutes les lignes doivent être comptés en unité insee
|
||||||
$data = array(
|
$data = array(
|
||||||
'idComptage' => $idComptage,
|
'idComptage' => $idComptage,
|
||||||
|
'reference' => $this->getRequest()->getParam('ref'),
|
||||||
'idCriteres' => $criteres->id,
|
'idCriteres' => $criteres->id,
|
||||||
'idProfil' => $idProfil,
|
'idProfil' => $idProfil,
|
||||||
'identifiants' => $infosExtraction['result'],
|
'identifiants' => json_encode($infosExtraction),
|
||||||
'idProfil' => $idProfil,
|
'idProfil' => $idProfil,
|
||||||
'fichier' => '',
|
'fichier' => '',
|
||||||
'nbLigneTotales' => $infosExtraction['total'],
|
'nbLigneTotales' => count($infosExtraction),
|
||||||
'nbLigneTraites' => '',
|
'nbLigneTraites' => count($infosExtraction),
|
||||||
'uniteInsee' => $infosExtraction['insee'],
|
'uniteInsee' => $ciblage->calculRedevanceInsee(),
|
||||||
'error' => '',
|
'error' => '',
|
||||||
'dateAdded' => date('YmdHis'),
|
'dateAdded' => date('YmdHis'),
|
||||||
);
|
);
|
||||||
$identifiantsM = new Table_EnrichissementIdentifiants();
|
$identifiantsM = new Table_EnrichissementIdentifiants();
|
||||||
$idIdentifiant = $identifiantsM->insert($data);
|
$idIdentifiant = $identifiantsM->insert($data);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
Class ExtractController extends Zend_Controller_Action
|
||||||
|
{
|
||||||
|
public function indexAction()
|
||||||
|
{
|
||||||
|
$this->_helper->layout()->disableLayout();
|
||||||
|
$this->_helper->viewRenderer->setNoRender(true);
|
||||||
|
require_once 'Scores/Ciblage.php';
|
||||||
|
require_once 'Scores/Field.php';
|
||||||
|
|
||||||
|
$field = new Fields();
|
||||||
|
$ciblage = new Ciblage($field->getValues());
|
||||||
|
|
||||||
|
$ciblage->extract();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function batchAction()
|
||||||
|
{
|
||||||
|
$action = $this->getRequest();
|
||||||
|
$request = $action->getParam('reference');
|
||||||
|
}
|
||||||
|
}
|
@ -54,7 +54,7 @@ class GeographiqueController extends Libs_Controller
|
|||||||
foreach ($result as $item) {
|
foreach ($result as $item) {
|
||||||
$output[] = array(
|
$output[] = array(
|
||||||
'label' => $item->libdep . $separator . $item->numdep,
|
'label' => $item->libdep . $separator . $item->numdep,
|
||||||
'value' => 'D'.$item->numdep
|
'value' => $item->numdep
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return ($output);
|
return ($output);
|
||||||
@ -63,6 +63,7 @@ class GeographiqueController extends Libs_Controller
|
|||||||
protected function completedVil($q)
|
protected function completedVil($q)
|
||||||
{
|
{
|
||||||
$table = new Table_Codepostauxs();
|
$table = new Table_Codepostauxs();
|
||||||
|
$separator = ' ';
|
||||||
|
|
||||||
$sql = $table->select()->where('Commune LIKE "'.$q.'%"');
|
$sql = $table->select()->where('Commune LIKE "'.$q.'%"');
|
||||||
$result = $table->fetchAll($sql);
|
$result = $table->fetchAll($sql);
|
||||||
@ -78,6 +79,7 @@ class GeographiqueController extends Libs_Controller
|
|||||||
protected function completedReg($q)
|
protected function completedReg($q)
|
||||||
{
|
{
|
||||||
$table = new Table_Regions();
|
$table = new Table_Regions();
|
||||||
|
$separator = ' ';
|
||||||
|
|
||||||
$sql = $table->select()
|
$sql = $table->select()
|
||||||
->where('NCCENR LIKE "%'.$q.'%"');
|
->where('NCCENR LIKE "%'.$q.'%"');
|
||||||
@ -85,7 +87,7 @@ class GeographiqueController extends Libs_Controller
|
|||||||
foreach ($result as $item) {
|
foreach ($result as $item) {
|
||||||
$output[] = array(
|
$output[] = array(
|
||||||
'label' => $item->NCCENR . $separator . $item->REGION,
|
'label' => $item->NCCENR . $separator . $item->REGION,
|
||||||
'value' => 'R'.$item->REGION
|
'value' => $item->REGION
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return ($output);
|
return ($output);
|
||||||
|
@ -24,26 +24,27 @@ class Object_Codepostaux extends Libs_Row
|
|||||||
$in = array();
|
$in = array();
|
||||||
|
|
||||||
foreach($valeurs as $valeur) {
|
foreach($valeurs as $valeur) {
|
||||||
|
$type = explode(':', $valeur);
|
||||||
if($niveau == 0) {
|
if($niveau == 0) {
|
||||||
if ($valeur[0] == 'D'){
|
if ($type[0] == 'adr_dept'){
|
||||||
$valeur = substr($valeur, 1, strlen($valeur));
|
$valeur = $type[1];
|
||||||
$insee = $table->fetchAll($table->select('departements', array('codeRegionInsee'))
|
$insee = $table->fetchAll($table->select('departements', array('codeRegionInsee'))
|
||||||
->where('numdep = ?', substr($valeur, 0, 2)))->toArray();
|
->where('numdep = ?', substr($valeur, 0, 2)))->toArray();
|
||||||
foreach ($insee as $code)
|
foreach ($insee as $code)
|
||||||
$in[] = 'R'.$code['codeRegionInsee'];
|
$in[] = 'adr_reg:'.$code['codeRegionInsee'];
|
||||||
} else{
|
} else{
|
||||||
$valeur = substr($valeur, 0, strlen($valeur));
|
$valeur = $type[1];
|
||||||
$insee = $table->fetchAll($table->select('departements', array('codeRegionInsee'))
|
$insee = $table->fetchAll($table->select('departements', array('codeRegionInsee'))
|
||||||
->where('numdep = ?', substr($valeur, 0, 2)))->toArray();
|
->where('numdep = ?', substr($valeur, 0, 2)))->toArray();
|
||||||
foreach ($insee as $code)
|
foreach ($insee as $code)
|
||||||
$in[] = 'R'.$code['codeRegionInsee'];
|
$in[] = 'adr_reg:'.$code['codeRegionInsee'];
|
||||||
}
|
}
|
||||||
} else if ($niveau == 1) {
|
} else if ($niveau == 1) {
|
||||||
$valeur = substr($valeur, 0, strlen($valeur));
|
$valeur = $type[1];
|
||||||
$insee = $table->fetchAll($table->select('departements', array('codeRegionInsee'))
|
$insee = $table->fetchAll($table->select('departements', array('codeRegionInsee'))
|
||||||
->where('numdep = ?', substr($valeur, 0, 2)))->toArray();
|
->where('numdep = ?', substr($valeur, 0, 2)))->toArray();
|
||||||
foreach ($insee as $code)
|
foreach ($insee as $code)
|
||||||
$in[] = 'D'.$code['numdep'];
|
$in[] = 'adr_dept:'.$code['numdep'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ($in);
|
return ($in);
|
||||||
@ -67,9 +68,9 @@ class Object_Codepostaux extends Libs_Row
|
|||||||
foreach($regions as $nom) {
|
foreach($regions as $nom) {
|
||||||
$structure[] = array(
|
$structure[] = array(
|
||||||
'data' => $nom['NCCENR'],
|
'data' => $nom['NCCENR'],
|
||||||
'attr' => array('id' => 'R'.$nom['REGION'],
|
'attr' => array('id' => 'adr_reg:'.$nom['REGION'],
|
||||||
'niveau' => 0,
|
'niveau' => 0,
|
||||||
'class' => $this->_getClass('R'.$nom['REGION'], 0)
|
'class' => $this->_getClass('adr_reg:'.$nom['REGION'], 0)
|
||||||
),
|
),
|
||||||
'state' => 'closed',
|
'state' => 'closed',
|
||||||
'children' => array()
|
'children' => array()
|
||||||
@ -81,17 +82,18 @@ class Object_Codepostaux extends Libs_Row
|
|||||||
|
|
||||||
public function _getDepartements($codeRegionInsee)
|
public function _getDepartements($codeRegionInsee)
|
||||||
{
|
{
|
||||||
|
$code = explode(':', $codeRegionInsee);
|
||||||
$departement = new Table_Departements();
|
$departement = new Table_Departements();
|
||||||
$departements = $departement->fetchAll($departement->select()
|
$departements = $departement->fetchAll($departement->select()
|
||||||
->where('codeRegionInsee ='.substr($codeRegionInsee, 1, strlen($codeRegionInsee))))->toArray();
|
->where('codeRegionInsee ='.$code[1]))->toArray();
|
||||||
$structure = array();
|
$structure = array();
|
||||||
|
|
||||||
foreach($departements as $nom) {
|
foreach($departements as $nom) {
|
||||||
$structure[] = array(
|
$structure[] = array(
|
||||||
'data' => $nom['libdep'],
|
'data' => $nom['numdep'].' '.$nom['libdep'],
|
||||||
'attr' => array('id' => 'D'.$nom['numdep'],
|
'attr' => array('id' => 'adr_dept:'.$nom['numdep'],
|
||||||
'niveau' => 1,
|
'niveau' => 1,
|
||||||
'class' => $this->_getClass('D'.$nom['numdep'], 1)
|
'class' => $this->_getClass('adr_dept:'.$nom['numdep'], 1)
|
||||||
),
|
),
|
||||||
'state' => 'closed',
|
'state' => 'closed',
|
||||||
'children' => array()
|
'children' => array()
|
||||||
@ -103,17 +105,17 @@ class Object_Codepostaux extends Libs_Row
|
|||||||
|
|
||||||
public function _getCommunes($numdep)
|
public function _getCommunes($numdep)
|
||||||
{
|
{
|
||||||
$numdep = substr($numdep, 1, strlen($numdep));
|
$numdep = explode(':', $numdep);
|
||||||
$codepostau = new Table_Codepostauxs();
|
$codepostau = new Table_Codepostauxs();
|
||||||
$codepostaux = $codepostau->fetchAll($codepostau->select()->where('codepos LIKE "'.$numdep.'%"'))->toArray();
|
$codepostaux = $codepostau->fetchAll($codepostau->select()->where('codepos LIKE "'.$numdep[1].'%"'))->toArray();
|
||||||
$structure = array();
|
$structure = array();
|
||||||
|
|
||||||
foreach($codepostaux as $nom) {
|
foreach($codepostaux as $nom) {
|
||||||
$structure[] = array(
|
$structure[] = array(
|
||||||
'data' => $nom['Commune'],
|
'data' => $nom['Codepos'].' '.$nom['Commune'],
|
||||||
'attr' => array('id'=> $nom['INSEE'],
|
'attr' => array('id'=> 'adr_com:'.$nom['INSEE'],
|
||||||
'niveau' => 2,
|
'niveau' => 2,
|
||||||
'class' => $this->_getClass($nom['INSEE'], 2)
|
'class' => $this->_getClass('adr_com:'.$nom['INSEE'], 2)
|
||||||
),
|
),
|
||||||
'state' => 'closed',
|
'state' => 'closed',
|
||||||
'children' => array()
|
'children' => array()
|
||||||
|
@ -66,21 +66,32 @@ class Object_Comptage extends Libs_Row
|
|||||||
$session->setCritere($key, $valeur);
|
$session->setCritere($key, $valeur);
|
||||||
if($valeur[strlen($valeur)] == ',')
|
if($valeur[strlen($valeur)] == ',')
|
||||||
$valeur = substr($valeur, 0, strlen($valeur) -1);
|
$valeur = substr($valeur, 0, strlen($valeur) -1);
|
||||||
if($key == 'reg' or $key == 'vil' or $key == 'dep') {
|
if($key == 'vil' or $key == 'adr_reg' or $key == 'adr_dept') {
|
||||||
$key = 'adr_com';
|
$key = 'adr_com';
|
||||||
if($session->getCritere('reg')){
|
|
||||||
$reg = trim($session->getCritere('reg'));
|
|
||||||
}
|
|
||||||
if($session->getCritere('vil')){
|
if($session->getCritere('vil')){
|
||||||
$vil = trim($session->getCritere('vil'));
|
$valeurs = explode(',', $session->getCritere('vil'));
|
||||||
|
foreach($valeurs as $valeur) {
|
||||||
|
$vil .= 'adr_com:'.trim($valeur).',';
|
||||||
}
|
}
|
||||||
if($session->getCritere('dep')){
|
//$vil = substr($vil, 0, strlen($vil)-1);
|
||||||
$dep = trim($session->getCritere('dep'));
|
|
||||||
}
|
}
|
||||||
$valeur = implode('', array($reg, $vil, $dep));
|
if($session->getCritere('adr_reg')) {
|
||||||
|
$valeurs = explode(',', $session->getCritere('adr_reg'));
|
||||||
|
foreach($valeurs as $valeur) {
|
||||||
|
$reg .= 'adr_reg:'.trim($valeur).',';
|
||||||
|
}
|
||||||
|
//$reg = substr($reg, 0, strlen($reg)-1);
|
||||||
|
}
|
||||||
|
if($session->getCritere('adr_dept')) {
|
||||||
|
$valeurs = explode(',', $session->getCritere('adr_dept'));
|
||||||
|
foreach($valeurs as $valeur) {
|
||||||
|
$dept .= 'adr_dept:'.trim($valeur).',';
|
||||||
|
}
|
||||||
|
//$dept = substr($dept, 0, strlen($dept)-1);
|
||||||
|
}
|
||||||
|
$valeur = $vil.$dept.$reg;
|
||||||
$session->setCritere($key, $valeur);
|
$session->setCritere($key, $valeur);
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once 'Scores/Field.php';
|
require_once 'Scores/Field.php';
|
||||||
$field = new Fields();
|
$field = new Fields();
|
||||||
|
|
||||||
|
@ -43,6 +43,31 @@ Class Object_Dashboard
|
|||||||
return ($results);
|
return ($results);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function enrichissements()
|
||||||
|
{
|
||||||
|
$enrichissementsM = new Table_EnrichissementIdentifiants();
|
||||||
|
$auth = Zend_Auth::getInstance();
|
||||||
|
$user = $auth->getIdentity();
|
||||||
|
$sql = $enrichissementsM->select()
|
||||||
|
->setIntegrityCheck(false)
|
||||||
|
->from(
|
||||||
|
array('i' => 'enrichissement_identifiants'),
|
||||||
|
array('id', 'reference', 'fichier', 'nbLigneTotales', 'nbLigneTraites', 'error', 'dateAdded', 'dateStart', 'dateStop')
|
||||||
|
)
|
||||||
|
->join(
|
||||||
|
array('c' => 'comptages'), 'i.idComptage = c.id',
|
||||||
|
array('')
|
||||||
|
)
|
||||||
|
->join(
|
||||||
|
array('criteres' => 'criteres'), 'i.idCriteres = criteres.id',
|
||||||
|
array('')
|
||||||
|
)
|
||||||
|
->where('criteres.idClient = ?', $user->idClient)
|
||||||
|
->where('criteres.login = ?', $user->username)
|
||||||
|
->order('dateAdded DESC');
|
||||||
|
return ($enrichissementsM->fetchAll($sql));
|
||||||
|
}
|
||||||
|
|
||||||
public function menu()
|
public function menu()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
|
|||||||
}
|
}
|
||||||
$html.= $this->structureHTML(
|
$html.= $this->structureHTML(
|
||||||
$label,
|
$label,
|
||||||
$this->textHTML($name, $field, $name));
|
$this->textHTML($name, $field, $name), $field['help'][ucfirst($name)]);
|
||||||
break;
|
break;
|
||||||
case 'textarea':
|
case 'textarea':
|
||||||
$html.= $this->structureHTML(
|
$html.= $this->structureHTML(
|
||||||
@ -74,11 +74,11 @@ Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
|
|||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function structureHTML($label, $html, $liens = array())
|
private function structureHTML($label, $html, $help = null)
|
||||||
{
|
{
|
||||||
$out = '';
|
$out = '';
|
||||||
$out.= $this->structureLabel($label);
|
$out.= $this->structureLabel($label, $help);
|
||||||
$out.= '<div class="field">'.$html.$this->structureLink($liens).'</div>';
|
$out.= '<div class="field">'.$html.'</div>';
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,26 +86,14 @@ Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
|
|||||||
* Définition du label
|
* Définition du label
|
||||||
* @param unknown_type $label
|
* @param unknown_type $label
|
||||||
*/
|
*/
|
||||||
private function structureLabel($label)
|
private function structureLabel($label, $help)
|
||||||
{
|
{
|
||||||
return '<label>'.$label.'</label>';
|
$return = '<label>'.$label.'</label>';
|
||||||
}
|
if($help)
|
||||||
|
$return .= '<p style="font-size:9px;">'.$help.'</p>';
|
||||||
|
|
||||||
/**
|
|
||||||
* Définition des liens
|
return ($return);
|
||||||
*/
|
|
||||||
private function structureLink($liens = array())
|
|
||||||
{
|
|
||||||
$html = '';
|
|
||||||
if (count($liens)>0) {
|
|
||||||
foreach($liens as $lien){
|
|
||||||
$html.= '<a href="'.$lien['url'].'">'.$lien['lib'].'</a>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!empty($html)) {
|
|
||||||
return '<span>'.$html.'</span>';
|
|
||||||
}
|
|
||||||
return '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function intervalSelectHTML($name, $field)
|
private function intervalSelectHTML($name, $field)
|
||||||
@ -133,7 +121,6 @@ Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
|
|||||||
private function selectMultipleHTML($name, $field)
|
private function selectMultipleHTML($name, $field)
|
||||||
{
|
{
|
||||||
$session = new SessionCiblage();
|
$session = new SessionCiblage();
|
||||||
|
|
||||||
$return = '<select class="criteres" name="'.$name.'">';
|
$return = '<select class="criteres" name="'.$name.'">';
|
||||||
$return .= '<option value="tous">Tous</option>';
|
$return .= '<option value="tous">Tous</option>';
|
||||||
foreach($field['fields'][$field['type']]['value'] as $value => $label) {
|
foreach($field['fields'][$field['type']]['value'] as $value => $label) {
|
||||||
@ -204,12 +191,6 @@ Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
|
|||||||
case 'ape_etab':
|
case 'ape_etab':
|
||||||
$type = 'Naf';
|
$type = 'Naf';
|
||||||
break;
|
break;
|
||||||
case 'dep':
|
|
||||||
$type = 'Dep';
|
|
||||||
break;
|
|
||||||
case 'reg':
|
|
||||||
$type = 'Reg';
|
|
||||||
break;
|
|
||||||
case 'vil':
|
case 'vil':
|
||||||
$type= 'Vil';
|
$type= 'Vil';
|
||||||
break;
|
break;
|
||||||
@ -219,7 +200,7 @@ Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
|
|||||||
}
|
}
|
||||||
/* Modifier les données */
|
/* Modifier les données */
|
||||||
$return = '<textarea rows="5" style="border:1px inset silver;width:60%" class="criteres complited'.$type.'" id="textarea_'.$name.'" name="'.$name.'">'.$session->getCritere($name).'</textarea>';
|
$return = '<textarea rows="5" style="border:1px inset silver;width:60%" class="criteres complited'.$type.'" id="textarea_'.$name.'" name="'.$name.'">'.$session->getCritere($name).'</textarea>';
|
||||||
$return .= '<a href="" class="autocomplet" textarea="'.$name.'">Valider</a>';
|
$return .= '<a href="" class="autocomplet" textarea="'.$name.'">Valider</a> <a href="">Aide</a>';
|
||||||
return ($return);
|
return ($return);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
|
|
||||||
<div id="lastEnrichissement">
|
<div id="lastEnrichissement">
|
||||||
<h2>Vos derniers enrichissements</h2>
|
<h2>Vos derniers enrichissements</h2>
|
||||||
<?php if(count($this->enrichissement) > 0):?>
|
<?php if(count($this->enrichissements) > 0):?>
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@ -64,7 +64,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php foreach($this->enrichissement as $item):?>
|
<?php foreach($this->enrichissements as $item):?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?=$item['reference']?></td>
|
<td><?=$item['reference']?></td>
|
||||||
<td><?=number_format($item['nbLigneTotales'], 0, ',', ' ')?></td>
|
<td><?=number_format($item['nbLigneTotales'], 0, ',', ' ')?></td>
|
||||||
|
@ -1 +1,9 @@
|
|||||||
<?php
|
Votre commande a bien été prise en compte sous la référence
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$('#dialog').dialog({ buttons: [ {
|
||||||
|
text: "Quitter",
|
||||||
|
click: function() { $(this).dialog('close'); }
|
||||||
|
} ] });
|
||||||
|
</script>
|
@ -7,8 +7,8 @@ Erreur
|
|||||||
Vous pouvez prendre contact avec le service commercial en cliquant ici.
|
Vous pouvez prendre contact avec le service commercial en cliquant ici.
|
||||||
Vos critères seront enregistrées et une référence vous sera fourni.</p>
|
Vos critères seront enregistrées et une référence vous sera fourni.</p>
|
||||||
<?php } else {?>
|
<?php } else {?>
|
||||||
|
<div id="update">
|
||||||
<p>Votre ciblage a été actualisé</p>
|
<p>Votre ciblage a été actualisé</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Nombre d'unités : <?=$this->resultat?><br/>
|
Nombre d'unités : <?=$this->resultat?><br/>
|
||||||
Nombre d'unités Insee : <?=$this->uniteInsee?><br/>
|
Nombre d'unités Insee : <?=$this->uniteInsee?><br/>
|
||||||
@ -25,11 +25,27 @@ Nombre d'unités Insee : <?=$this->uniteInsee?><br/>
|
|||||||
Les informations permettant l'enrichissement seront enregistrées, après la saisie de votre référence.
|
Les informations permettant l'enrichissement seront enregistrées, après la saisie de votre référence.
|
||||||
</p>
|
</p>
|
||||||
<br/>
|
<br/>
|
||||||
<form>
|
<form name="commande" method="post" action="<?=$this->url(array('controller'=>'enrichissement', 'action'=>'commande'))?>">
|
||||||
<input type="hidden" name="id" value="<?=$this->id?>" />
|
<input type="hidden" name="id" value="<?=$this->id?>" />
|
||||||
<label>Référence : </label><input type="text" name="ref">
|
<label>Référence : </label><input type="text" name="ref">
|
||||||
</form>
|
</form>
|
||||||
<script>
|
<script>
|
||||||
|
$('#dialog').dialog({ buttons: [ {
|
||||||
|
text: "Valider",
|
||||||
|
click: function() {
|
||||||
|
$.post(
|
||||||
|
$('form[name=commande]').attr('action'),
|
||||||
|
$('form[name=commande]').serialize(),
|
||||||
|
function(data){
|
||||||
|
$('div#update').html(data);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: "Quitter",
|
||||||
|
click: function() { $(this).dialog("close"); }
|
||||||
|
}
|
||||||
|
] });
|
||||||
</script>
|
</script>
|
||||||
|
</div>
|
||||||
<?php }?>
|
<?php }?>
|
@ -1,9 +1,15 @@
|
|||||||
<div id="geographique">
|
<div id="geographique">
|
||||||
<ul id="fieldsblock">
|
<ul id="fieldsblock">
|
||||||
<li><?php echo $this->Field('adr_com', $this->fields->get('adr_com'));?></li>
|
<li><?php echo $this->Field('adr_com', $this->fields->get('adr_com'));?></li>
|
||||||
<li style="background-image:none;height:80px;"><?php echo $this->Field('vil', $this->fields->get('adr_com'), 'text');?></li>
|
<li style="background-image:none;height:80px;">
|
||||||
<li style="background-image:none;height:80px;"><?php echo $this->Field('dep', $this->fields->get('adr_com'), 'text');?></li>
|
<?php echo $this->Field('vil', $this->fields->get('adr_com'), 'text');?>
|
||||||
<li style="background-image:none;height:80px;"><?php echo $this->Field('reg', $this->fields->get('adr_com'), 'text');?></li>
|
</li>
|
||||||
|
<li style="background-image:none;height:80px;">
|
||||||
|
<?php echo $this->Field('adr_dept', $this->fields->get('adr_dept'), 'text');?>
|
||||||
|
</li>
|
||||||
|
<li style="background-image:none;height:80px;">
|
||||||
|
<?php echo $this->Field('adr_reg', $this->fields->get('adr_reg'), 'text');?>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div style="text-align:right;margin-top:20px;">
|
<div style="text-align:right;margin-top:20px;">
|
||||||
|
@ -1,29 +1,33 @@
|
|||||||
<h1>Vos critères de selections</h1>
|
|
||||||
<style>
|
<style>
|
||||||
.color {
|
.color {
|
||||||
background-color:#DEDEDE;
|
background-color:#DEDEDE;
|
||||||
}
|
}
|
||||||
|
a
|
||||||
|
{
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
#criteres_ra
|
#criteres_ra
|
||||||
{
|
{
|
||||||
|
width:93%;
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#criteres_ra tr td {
|
#criteres_ra tr td {
|
||||||
border-left: 1px solid black;
|
border-left: 1px solid black;
|
||||||
|
border-right: 1px solid black;
|
||||||
padding-left:5px;
|
padding-left:5px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<table id="criteres_ra" style="margin-top:15px">
|
<table id="criteres_ra" style="margin:10px">
|
||||||
<tr>
|
<tr>
|
||||||
<td><b>Champ séléction</b></td>
|
<td id="Valide" style="text-align: center" colspan="3"><a class="saveciblage" href="/comptage/savedialog">Valider mon comptage</a></td>
|
||||||
<td><b>Votre critère</b></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<?php $color = 0;foreach($this->criteres as $critere => $valeur):?>
|
<?php $color = 0;foreach($this->criteres as $critere => $valeur):?>
|
||||||
<?php $label = $this->field->get($critere); ?>
|
<?php $label = $this->field->get($critere); ?>
|
||||||
<?php if($valeur != 'tous' and $valeur != null and $valeur != 'null' and $valeur != ','):?>
|
<?php if($valeur != 'tous' and $valeur != null and $valeur != 'null' and $valeur != ',' and $critere != 'adr_com'):?>
|
||||||
<?php $valeur = explode(',', $valeur); ?>
|
<?php $valeur = explode(',', $valeur); ?>
|
||||||
<tr <?php echo ((($color%2) == 0)?'class="color"':''); $color++;?>>
|
<tr <?php echo ((($color%2) == 0)?'class="color"':''); $color++;?>>
|
||||||
<td valign="top" style="width:150px">
|
<td valign="top" style="padding:5px;width:150px">
|
||||||
<?php echo $label['label'];?>
|
<?php echo $label['label'];?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@ -39,10 +43,11 @@
|
|||||||
<?php echo $val;?>
|
<?php echo $val;?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td style="text-align: center">
|
||||||
<a class="remove" href="index/remove/critere/<?php echo $critere;?>">
|
<a class="remove" href="index/remove/critere/<?php echo $critere;?>">
|
||||||
<img src="/themes/default/images/cross.png" />
|
<img width="14px;" src="/themes/default/images/cross.png" />
|
||||||
</a>
|
</a>
|
||||||
|
<img src="/themes/default/images/help.png" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endif;?>
|
<?php endif;?>
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
<div id="juridique">
|
<div id="juridique">
|
||||||
<ul id="fieldsblock">
|
<ul id="fieldsblock">
|
||||||
<li><?php echo $this->Field('cj', $this->fields->get('cj'));?></li>
|
<li><?php echo $this->Field('cj', $this->fields->get('cj'));?></li>
|
||||||
<li style="background-image:none;height:80px;"><?php echo $this->Field('cj', $this->fields->get('cj'), 'text');?></li>
|
<li style="background-image:none;height:80px;">
|
||||||
|
<i>Indiquez les formes juridiques ou les codes (insee) sur un deux ou quatres chiffres séparés par des virgules.
|
||||||
|
Si vous disposez d'une liste sous forme excel glissez le fichier dans l'encadré</i>
|
||||||
|
<?php echo $this->Field('cj', $this->fields->get('cj'), 'text');?>
|
||||||
|
</li>
|
||||||
<li><?php echo $this->Field('actifEco', $this->fields->get('actifEco'));?></li>
|
<li><?php echo $this->Field('actifEco', $this->fields->get('actifEco'));?></li>
|
||||||
<li><?php echo $this->Field('procolHisto', $this->fields->get('procolHisto'));?></li>
|
<li><?php echo $this->Field('procolHisto', $this->fields->get('procolHisto'));?></li>
|
||||||
<li><?php echo $this->Field('tvaIntraValide', $this->fields->get('tvaIntraValide'));?></li>
|
<li><?php echo $this->Field('tvaIntraValide', $this->fields->get('tvaIntraValide'));?></li>
|
||||||
|
@ -14,7 +14,6 @@ set_include_path(implode(PATH_SEPARATOR, array(
|
|||||||
realpath(APPLICATION_PATH . '/../library'),
|
realpath(APPLICATION_PATH . '/../library'),
|
||||||
get_include_path(),
|
get_include_path(),
|
||||||
)));
|
)));
|
||||||
|
|
||||||
/** Zend_Application */
|
/** Zend_Application */
|
||||||
require_once 'Zend/Application.php';
|
require_once 'Zend/Application.php';
|
||||||
|
|
||||||
@ -30,7 +29,7 @@ try {
|
|||||||
array(
|
array(
|
||||||
'help|?' => "Aide.",
|
'help|?' => "Aide.",
|
||||||
'id=s' => "Identifiant du traitement",
|
'id=s' => "Identifiant du traitement",
|
||||||
'file=s' => "Traitement manuel avec spécification du fichier"
|
'file=s' => "Identifiant pour les traitements par fichier"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$opts->parse();
|
$opts->parse();
|
||||||
@ -55,22 +54,90 @@ try {
|
|||||||
}
|
}
|
||||||
//Définition bdd metier
|
//Définition bdd metier
|
||||||
try {
|
try {
|
||||||
$dbMetier = Zend_Db::factory('Mysqli', $dbConfig->jo);
|
$dbMetier = Zend_Db::factory($dbConfig->jo);
|
||||||
} catch ( Exception $e ) {
|
} catch ( Exception $e ) {
|
||||||
exit ( $e->getMessage() );
|
exit ( $e->getMessage() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($opts->id) {
|
$liste = array();
|
||||||
$commandesM = new Table_EnrichissementCommandes($db);
|
|
||||||
$commande = $commandesM->find(intval($opts->id))->current();
|
|
||||||
|
|
||||||
|
if ($opts->id)
|
||||||
|
{
|
||||||
|
|
||||||
} else {
|
//$commandesM = new Table_EnrichissementCommandes($db);
|
||||||
|
$sql = $db->select()
|
||||||
|
->from('enrichissement_identifiants')
|
||||||
|
->where('idComptage = ?', intval($opts->id));
|
||||||
|
$commande = $db->fetchRow($sql);
|
||||||
|
$identifiants = json_decode($commande['identifiants'], true);
|
||||||
|
|
||||||
$file = $opts->file;
|
//$profilM = new Table_EnrichissementProfils($db);
|
||||||
|
$sql = $db->select()
|
||||||
|
->from('enrichissement_profils')
|
||||||
|
->where('id = ?', $commande['idProfil']);
|
||||||
|
$profil = $db->fetchRow($sql);
|
||||||
|
$dataProfil = json_decode($profil['criteres'], true);
|
||||||
|
} else if ($opts->file)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( count($identifiants)>0 && count($dataProfil)>0 )
|
||||||
|
{
|
||||||
|
$outFile = uniqid($commande->reference.'-').'.csv';
|
||||||
|
|
||||||
|
require_once 'Scores/Enrichissement.php';
|
||||||
|
$dico = new Enrichissement();
|
||||||
|
$fields = $dico->getFields();
|
||||||
|
|
||||||
|
//Entete, Valeur de remplacement et Requete SQL
|
||||||
|
$tabEntete = array('siren', 'nic');
|
||||||
|
$tabEnteteLabel = array('SIREN', 'NIC');
|
||||||
|
$sql = 'SELECT siren, nic,';
|
||||||
|
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.= '';
|
||||||
|
} else {
|
||||||
|
$sql.= ' '.$fields[$item]['column'].' AS '.$item.',';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
//Ajouter le champ presentRcs
|
||||||
|
$tabEntete[] = 'presentRcs';
|
||||||
|
$tabEnteteLabel[] = 'RCS';
|
||||||
|
$sql.= ' presentRcs';
|
||||||
|
|
||||||
|
//Pour chaque identifiant traiter les données
|
||||||
|
$row = 0;
|
||||||
|
$fp = fopen($outFile, 'w');
|
||||||
|
//Ecrire l'entete
|
||||||
|
if (count($tabEnteteLabel)>0){
|
||||||
|
fputcsv($fp, $tabEnteteLabel, ',', '"');
|
||||||
|
}
|
||||||
|
$model = $sql;
|
||||||
|
foreach ($identifiants as $siret )
|
||||||
|
{
|
||||||
|
$sql = $model .' FROM etablissements_act WHERE siren='.substr($siret,0,9).' AND nic='.substr($siret,9,5);
|
||||||
|
$result = $dbMetier->fetchAll($sql);
|
||||||
|
$tabData = $result[0];
|
||||||
|
//Trier pour la sortie
|
||||||
|
$tabSortie = array();
|
||||||
|
foreach($tabEntete as $key){
|
||||||
|
$tabSortie[] = isset($tabData[$key]) ? $tabData[$key] : '';
|
||||||
|
}
|
||||||
|
fputcsv($fp, $tabSortie, ',', '"');
|
||||||
|
|
||||||
|
$row++;
|
||||||
|
}
|
||||||
|
echo $row .' Lignes !';
|
||||||
|
fclose($fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* == FUNCTION == */
|
/* == FUNCTION == */
|
||||||
|
|
||||||
|
188
batch/extract.php
Normal file
188
batch/extract.php
Normal file
@ -0,0 +1,188 @@
|
|||||||
|
<?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'
|
||||||
|
);
|
||||||
|
require_once APPLICATION_PATH . '/../library/Zend/Loader/Autoloader.php';
|
||||||
|
|
||||||
|
Class extract
|
||||||
|
{
|
||||||
|
protected $db;
|
||||||
|
protected $dbMetier;
|
||||||
|
protected $reference;
|
||||||
|
|
||||||
|
public function __construct($reference)
|
||||||
|
{
|
||||||
|
$this->reference = $reference;
|
||||||
|
$dbConfig = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'databases');
|
||||||
|
try {
|
||||||
|
$this->db = Zend_Db::factory($dbConfig->db);
|
||||||
|
} catch ( Exception $e ) {
|
||||||
|
exit ( $e->getMessage() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getHttp()
|
||||||
|
{
|
||||||
|
/* Depuis le navigateur */
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getCj($liste)
|
||||||
|
{
|
||||||
|
foreach($liste as $valeur)
|
||||||
|
{
|
||||||
|
if(strlen($valeur) < 5) {
|
||||||
|
$sql = $this->db->select('formejuridique', array('fjCode'))
|
||||||
|
->from('formejuridique')
|
||||||
|
->where('fjCode LIKE "'.$valeur.'%"');
|
||||||
|
} else {
|
||||||
|
$sql = $this->db->select('formejuridique', array('fjCode'))
|
||||||
|
->from('formejuridique')
|
||||||
|
->where('fjCode = "'.$valeur.'"');exit;
|
||||||
|
}
|
||||||
|
$result = $this->db->fetchAll($sql);
|
||||||
|
foreach ($result as $code) {
|
||||||
|
if(strlen($code['fjCode']) > 2) {
|
||||||
|
$return[] = $code['fjCode'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ($return);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function localisationArbo($name, $valeur)
|
||||||
|
{
|
||||||
|
if(strlen($valeur) == 2) {
|
||||||
|
switch($name) {
|
||||||
|
case 'adr_reg':
|
||||||
|
$return = array();
|
||||||
|
$sql = $this->db->select()
|
||||||
|
->from('departements')
|
||||||
|
->join(array('cp' => 'codepostaux'), 'cp.codepos LIKE CONCAT(departements.numdep, "%")', array('INSEE'))
|
||||||
|
->where('codeRegionInsee ='.$valeur);
|
||||||
|
$result = $this->db->fetchAll($sql);
|
||||||
|
foreach ($result as $res) {
|
||||||
|
$return[] = trim($res['INSEE']);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'adr_dept':
|
||||||
|
$return = array();
|
||||||
|
$sql = $this->db->select()
|
||||||
|
->from('departements')
|
||||||
|
->join(array('cp' => 'codepostaux'), 'cp.codepos LIKE CONCAT(departements.numdep, "%")', array('INSEE'))
|
||||||
|
->where('numdep ='.$valeur);
|
||||||
|
$result = $this->db->fetchAll($sql);
|
||||||
|
foreach ($result as $res) {
|
||||||
|
$return[] = trim($res['INSEE']);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ($return);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMinMax($name, $valeur)
|
||||||
|
{
|
||||||
|
$valeur = explode(',', $valeur);
|
||||||
|
if(count($valeur) > 1)
|
||||||
|
{
|
||||||
|
$sql = 'SELECT min, max FROM minmax WHERE cle ="'.$name.'"';
|
||||||
|
$result = $this->db->query($sql);
|
||||||
|
$result = $result->fetchAll();
|
||||||
|
if(empty($valeur[0])){
|
||||||
|
echo $name;
|
||||||
|
$valeur[0] = $result[0]['min'];
|
||||||
|
}
|
||||||
|
if(empty($valeur[1])){
|
||||||
|
$valeur[1] = $result[0]['max'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ($valeur);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCli()
|
||||||
|
{
|
||||||
|
require_once('Scores/Ciblage.php');
|
||||||
|
//require_once('Scores/Field.php');
|
||||||
|
|
||||||
|
$sql = 'SELECT id, idDefinition, uniteInsee FROM comptages WHERE id = '.$this->reference;
|
||||||
|
$fetch = $this->db->query($sql);
|
||||||
|
$result = $fetch->fetchAll();
|
||||||
|
$idComptage = $result[0]['id'];
|
||||||
|
$uniteInsee = $result[0]['uniteInsee'];
|
||||||
|
|
||||||
|
$sql = 'SELECT id, criteres.criteres FROM criteres WHERE id ='.$result[0]['idDefinition'];
|
||||||
|
$fetch = $this->db->query($sql);
|
||||||
|
$result = $fetch->fetchAll();
|
||||||
|
$idCriteres = $result[0]['id'];
|
||||||
|
|
||||||
|
$structure = json_decode($result[0]['criteres']);
|
||||||
|
$element = array();
|
||||||
|
foreach ($structure as $name => $valeur){
|
||||||
|
if($name == 'adr_com') {
|
||||||
|
$liste = explode(',', $valeur);
|
||||||
|
$codes = array();
|
||||||
|
foreach ($liste as $element) {
|
||||||
|
$val = explode(':', $element);
|
||||||
|
if(!empty($val[1]))
|
||||||
|
$codes = array_merge($this->localisationArbo($val[0], $val[1]), $codes);
|
||||||
|
}
|
||||||
|
$array['adr_com'] = $codes;
|
||||||
|
}
|
||||||
|
else if($name == 'cj') {
|
||||||
|
$array['cj'] = $this->getCj(explode(',', $valeur));
|
||||||
|
}
|
||||||
|
else if($name == 'ape_etab')
|
||||||
|
$array['ape_etab'] = explode(',', $structure->ape_etab);
|
||||||
|
else {
|
||||||
|
$valeur = $this->getMinMax($name, $valeur);
|
||||||
|
$array[$name] = $valeur;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$ciblage = new Ciblage($array, true);
|
||||||
|
$res = $ciblage->execute(true);
|
||||||
|
$data = array(
|
||||||
|
'idComptage' => $idComptage,
|
||||||
|
'idCriteres' => $idCriteres,
|
||||||
|
'idProfil' => 1,
|
||||||
|
'reference' => 'batch',
|
||||||
|
'identifiants' => json_encode($res),
|
||||||
|
'nbLigneTotales' => count($res),
|
||||||
|
'nbLigneTraites' => count($res),
|
||||||
|
'uniteInsee' => $uniteInsee,
|
||||||
|
'error' => 0
|
||||||
|
);
|
||||||
|
$this->db->insert('enrichissement_identifiants',$data);
|
||||||
|
$fd = fopen($idComptage.'_batch'.date('Y-m-d-hms').'.csv', 'x+');
|
||||||
|
try {
|
||||||
|
$array = array();
|
||||||
|
foreach($res as $field) {
|
||||||
|
fputcsv($fd, array($field), ';');
|
||||||
|
}
|
||||||
|
} catch(Exception $e) {
|
||||||
|
echo $e->getMessage();
|
||||||
|
}
|
||||||
|
fclose($fd);
|
||||||
|
echo count($res).' Success !';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$a = new extract('36');
|
||||||
|
$a->getCli();
|
@ -80,12 +80,15 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $auth && $auth->getIdentity()->profil=='SuperAdministrateur' ){
|
if ( APPLICATION_ENV=='development' && $auth && $auth->getIdentity()->idClient==1 ) {
|
||||||
|
$layout = Zend_Layout::getMVCInstance();
|
||||||
|
$view = $layout->getView();
|
||||||
|
$view->admin = true;
|
||||||
|
} elseif ( $auth && $auth->getIdentity()->profil=='SuperAdministrateur' ){
|
||||||
$layout = Zend_Layout::getMVCInstance();
|
$layout = Zend_Layout::getMVCInstance();
|
||||||
$view = $layout->getView();
|
$view = $layout->getView();
|
||||||
$view->admin = true;
|
$view->admin = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -6,10 +6,11 @@ Class Ciblage
|
|||||||
private $sphinx;
|
private $sphinx;
|
||||||
private $alpha = '';
|
private $alpha = '';
|
||||||
private $presentRcs = 0;
|
private $presentRcs = 0;
|
||||||
|
private $need;
|
||||||
|
|
||||||
public $index = 'ciblage';
|
public $index = 'ciblage';
|
||||||
|
|
||||||
public $nb_results = 5000;
|
public $nb_results = 50000;
|
||||||
public $max_results = 500000;
|
public $max_results = 500000;
|
||||||
|
|
||||||
public $mysql_host = '192.168.78.230';
|
public $mysql_host = '192.168.78.230';
|
||||||
@ -24,6 +25,7 @@ Class Ciblage
|
|||||||
|
|
||||||
protected function setMinMax($name, $valeur)
|
protected function setMinMax($name, $valeur)
|
||||||
{
|
{
|
||||||
|
if(!$this->need) {
|
||||||
if(!empty($name)) {
|
if(!empty($name)) {
|
||||||
$default = Fields::getMinMax($name);
|
$default = Fields::getMinMax($name);
|
||||||
|
|
||||||
@ -31,11 +33,13 @@ Class Ciblage
|
|||||||
if(empty($valeur[1])){$valeur[1] = $default[0]['max'];}
|
if(empty($valeur[1])){$valeur[1] = $default[0]['max'];}
|
||||||
}
|
}
|
||||||
return ($valeur);
|
return ($valeur);
|
||||||
|
}
|
||||||
|
return ($valeur);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __construct($structure, $need = false)
|
public function __construct($structure, $need = false)
|
||||||
{
|
{
|
||||||
|
$this->need = true;
|
||||||
$this->sphinx = new SphinxClient();
|
$this->sphinx = new SphinxClient();
|
||||||
$this->sphinx->SetServer($this->sphinx_host, $this->sphinx_port);
|
$this->sphinx->SetServer($this->sphinx_host, $this->sphinx_port);
|
||||||
$this->sphinx->SetMatchMode(SPH_MATCH_EXTENDED2);
|
$this->sphinx->SetMatchMode(SPH_MATCH_EXTENDED2);
|
||||||
@ -75,13 +79,32 @@ Class Ciblage
|
|||||||
return ($resSphinx['total_found']);
|
return ($resSphinx['total_found']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getSiret($structure)
|
||||||
|
{
|
||||||
|
$siret = array();
|
||||||
|
foreach($structure['matches'] as $element)
|
||||||
|
{
|
||||||
|
$siret[] = $element['attrs']['siren'].$element['attrs']['nic'];
|
||||||
|
}
|
||||||
|
return ($siret);
|
||||||
|
}
|
||||||
|
|
||||||
public function execute($need = false)
|
public function execute($need = false)
|
||||||
{
|
{
|
||||||
$resSphinx = $this->sphinx->Query($this->alpha, $this->index);
|
/* Retourne les resultats */
|
||||||
|
|
||||||
if($need) {
|
if($need) {
|
||||||
return ($resSphinx);
|
$return = array();
|
||||||
}
|
$limit = 0;
|
||||||
|
do {
|
||||||
|
$this->sphinx->SetLimits($limit, 1000, 50000);
|
||||||
|
$resSphinx = $this->sphinx->Query($this->alpha, $this->index);
|
||||||
|
if(is_array($resSphinx))
|
||||||
|
$return = array_merge($return, $this->getSiret($resSphinx));
|
||||||
|
$limit = $limit + 1000;
|
||||||
|
}while($limit < $resSphinx['total_found']);
|
||||||
|
return ($return);
|
||||||
|
} else
|
||||||
|
$resSphinx = $this->sphinx->Query($this->alpha, $this->index);
|
||||||
return ($resSphinx['total_found']);
|
return ($resSphinx['total_found']);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,14 +168,6 @@ Class Ciblage
|
|||||||
$this->setFilter('siege', $valeur);
|
$this->setFilter('siege', $valeur);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function adr_cp($valeur) {
|
|
||||||
$this->setFilter('adr_cp', $valeur);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function adr_dep($valeur) {
|
|
||||||
$this->setAlpha('adr_dep', $valeur);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function adr_com($valeur) {
|
protected function adr_com($valeur) {
|
||||||
$this->setFilter('adr_com', $valeur);
|
$this->setFilter('adr_com', $valeur);
|
||||||
}
|
}
|
||||||
@ -209,7 +224,7 @@ Class Ciblage
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected function teff_etab($valeur) {
|
protected function teff_etab($valeur) {
|
||||||
$valeur = $this->setMinMax($name, $valeur);
|
//$valeur = $this->setMinMax($name, $valeur);
|
||||||
|
|
||||||
$this->setFilterRange('teff_etab', $valeur);
|
$this->setFilterRange('teff_etab', $valeur);
|
||||||
}
|
}
|
||||||
|
@ -3,45 +3,45 @@ class Enrichissement
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Déclaration des colonnes de la table de données pour la transposition
|
* Déclaration des colonnes de la table de données pour la transposition
|
||||||
*
|
* siren + nic + presentRcs
|
||||||
*/
|
*/
|
||||||
protected $columns = array(
|
protected $columns = array(
|
||||||
'id' => array(),
|
'id' => array(), //Non utilisé
|
||||||
'source' => array(),
|
'source' => array(),
|
||||||
'source_id' => array(),
|
'source_id' => array(),
|
||||||
'triCode' => array(),
|
'triCode' => array(),
|
||||||
'autre_id' => array(),
|
'autre_id' => array(),
|
||||||
'siren' => array(),
|
'siren' => array(), //Obligatoire
|
||||||
'nic' => array(),
|
'nic' => array(), //Obligatoire
|
||||||
'actif' => array(
|
'actif' => array(
|
||||||
'value' => array(
|
'values' => array(
|
||||||
'1' => "actif",
|
'1' => "actif",
|
||||||
'0' => "inactif",
|
'0' => "inactif",
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
'siege' => array(
|
'siege' => array(
|
||||||
'value' => array(
|
'values' => array(
|
||||||
'1' => "Etablissement Siege",
|
'1' => "Etablissement Siege",
|
||||||
'0' => "Etablissement Secondaire",
|
'0' => "Etablissement Secondaire",
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
'raisonSociale' => array(),
|
'raisonSociale' => array(), //Raison Sociale
|
||||||
'enseigne' => array(),
|
'enseigne' => array(), //Enseigne
|
||||||
'sigle' => array(),
|
'sigle' => array(), //Sigle
|
||||||
'identite_pre' => array(),
|
'identite_pre' => array(),
|
||||||
'marques' => array(),
|
'marques' => array(),
|
||||||
'adr_num' => array(),
|
'adr_num' => array(), //Adresse
|
||||||
'adr_btq' => array(),
|
'adr_btq' => array(), //Adresse
|
||||||
'adr_typeVoie' => array(),
|
'adr_typeVoie' => array(), //Adresse
|
||||||
'adr_libVoie' => array(),
|
'adr_libVoie' => array(), //Adresse
|
||||||
'adr_comp' => array(),
|
'adr_comp' => array(), //Adresse - Complément
|
||||||
'adr_cp' => array(),
|
'adr_cp' => array(), //Adresse
|
||||||
'adr_ville' => array(),
|
'adr_ville' => array(), //Adresse
|
||||||
'adr_dep' => array(),
|
'adr_dep' => array(), //Département | Code Commune
|
||||||
'adr_com' => array(),
|
'adr_com' => array(), //Code Commune
|
||||||
'tel' => array(),
|
'tel' => array(), //Telephone
|
||||||
'fax' => array(),
|
'fax' => array(), //Fax
|
||||||
'cj' => array(),
|
'cj' => array(), //Forme Juridique
|
||||||
'capital' => array(),
|
'capital' => array(),
|
||||||
'capitalDev' => array(),
|
'capitalDev' => array(),
|
||||||
'capitalSrc' => array(),
|
'capitalSrc' => array(),
|
||||||
@ -133,10 +133,40 @@ class Enrichissement
|
|||||||
'label' => "Sigle",
|
'label' => "Sigle",
|
||||||
'column' => 'sigle'
|
'column' => 'sigle'
|
||||||
),
|
),
|
||||||
|
'identite_pre' => array(
|
||||||
|
'label' => "Identite Précédente",
|
||||||
|
'column' => 'identite_pre'
|
||||||
|
),
|
||||||
'marques' => array(
|
'marques' => array(
|
||||||
'label' => "Marques déposées",
|
'label' => "Marques déposées",
|
||||||
'column' => 'marques'
|
'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(
|
'tel' => array(
|
||||||
'label' => "Téléphone",
|
'label' => "Téléphone",
|
||||||
'column' => 'tel'
|
'column' => 'tel'
|
||||||
@ -151,16 +181,43 @@ class Enrichissement
|
|||||||
),
|
),
|
||||||
'dirigeant' => array(
|
'dirigeant' => array(
|
||||||
'label' => "Dirigeant",
|
'label' => "Dirigeant",
|
||||||
'column' => array('dirCiv', 'dirNom', 'dirPrenom', 'dirDateNaiss', 'dirFct')
|
'column' => 'dirigeant',
|
||||||
|
'sql' => "CONCAT_WS(' ', dirCiv, dirNom, dirPrenom) AS dirigeant",
|
||||||
),
|
),
|
||||||
|
'dirigeantFct' => array(
|
||||||
|
'label' => "Dirigeant - Fonction",
|
||||||
|
'column' => 'dirFct',
|
||||||
|
),
|
||||||
|
'dirigeantnaiss' => array(
|
||||||
|
'label' => "Dirigeant - Date de naissance",
|
||||||
|
'column' => 'dirFct'
|
||||||
|
),
|
||||||
|
'nafetablissement' => array(
|
||||||
|
'label' => "Code NAF Etablissement",
|
||||||
|
'column' => 'ape4_etab'
|
||||||
|
),
|
||||||
|
'nafentreprise' => array(
|
||||||
|
'label' => "Code NAF Entreprise",
|
||||||
|
'column' => 'ape4_entrep'
|
||||||
|
),
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
public function __construct(){}
|
public function __construct(){}
|
||||||
|
|
||||||
|
|
||||||
public function getFields()
|
public function getFields()
|
||||||
{
|
{
|
||||||
return $this->fields;
|
return $this->fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -375,6 +375,32 @@ Class Fields
|
|||||||
'action' => 'geographique',
|
'action' => 'geographique',
|
||||||
'title' => 'Localisation'
|
'title' => 'Localisation'
|
||||||
),
|
),
|
||||||
|
'adr_dept' => array(
|
||||||
|
'label' => 'Liste départements',
|
||||||
|
'fields' => array(
|
||||||
|
'text' => array('value' => null),
|
||||||
|
'textarea' => array('value' => null)
|
||||||
|
),
|
||||||
|
'famille' => 'geographique',
|
||||||
|
'activated' => true,
|
||||||
|
'type' => 'textarea',
|
||||||
|
'class' => null,
|
||||||
|
'action' => '',
|
||||||
|
'title' => 'Localisation'
|
||||||
|
),
|
||||||
|
'adr_reg' => array(
|
||||||
|
'label' => 'Liste code région',
|
||||||
|
'fields' => array(
|
||||||
|
'text' => array('value' => null),
|
||||||
|
'textarea' => array('value' => null)
|
||||||
|
),
|
||||||
|
'famille' => 'geographique',
|
||||||
|
'activated' => true,
|
||||||
|
'type' => 'textarea',
|
||||||
|
'class' => null,
|
||||||
|
'action' => '',
|
||||||
|
'title' => 'Localisation'
|
||||||
|
),
|
||||||
//juridique
|
//juridique
|
||||||
'cj' => array(
|
'cj' => array(
|
||||||
'label' => 'Forme Juridique',
|
'label' => 'Forme Juridique',
|
||||||
@ -658,7 +684,7 @@ Class Fields
|
|||||||
$val = $session->getCriteres();
|
$val = $session->getCriteres();
|
||||||
}
|
}
|
||||||
$values = array();
|
$values = array();
|
||||||
|
unset($val['vil']);
|
||||||
foreach($val as $key => $item)
|
foreach($val as $key => $item)
|
||||||
{
|
{
|
||||||
if($item != '') {
|
if($item != '') {
|
||||||
@ -669,7 +695,15 @@ Class Fields
|
|||||||
{
|
{
|
||||||
$values[$key] = explode(',', $item);
|
$values[$key] = explode(',', $item);
|
||||||
} else if (!empty($this->fields[$key]['action'])) {
|
} else if (!empty($this->fields[$key]['action'])) {
|
||||||
|
if($key == 'adr_reg' or $key == 'adr_dept') {
|
||||||
|
$key = 'adr_com';
|
||||||
|
}
|
||||||
|
if(!empty($values[$key])) {
|
||||||
|
$values[$key] = array_merge($this->selectArbo($key, $item), $values[$key]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
$values[$key] = $this->selectArbo($key, $item);
|
$values[$key] = $this->selectArbo($key, $item);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$values[$key] = $item;
|
$values[$key] = $item;
|
||||||
}
|
}
|
||||||
@ -687,24 +721,32 @@ Class Fields
|
|||||||
case 'ape_entrep' :
|
case 'ape_entrep' :
|
||||||
$nafs = explode(',', $valeur);
|
$nafs = explode(',', $valeur);
|
||||||
foreach($nafs as $naf) {
|
foreach($nafs as $naf) {
|
||||||
if($naf != ' ')
|
if($naf != ' ') {
|
||||||
$values = array_merge($values, $this->nafArbo($name, $naf));
|
$values = array_merge($values, $this->nafArbo($name, $naf));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'adr_dept':
|
||||||
|
case 'adr_reg':
|
||||||
case 'adr_com':
|
case 'adr_com':
|
||||||
$valeurs = explode(',', $valeur);
|
$valeurs = explode(',', $valeur);
|
||||||
foreach($valeurs as $element) {
|
foreach($valeurs as $element) {
|
||||||
$array = $this->localisationArbo($name, $element);
|
if(!empty($element)) {
|
||||||
if(!empty($array))
|
$val = explode(':', $element);
|
||||||
|
$array = array_diff($this->localisationArbo($val[0], $val[1]), $values);
|
||||||
|
if(!empty($array)) {
|
||||||
$values = array_merge($values, $array);
|
$values = array_merge($values, $array);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'cj':
|
case 'cj':
|
||||||
$valeurs = explode(',', $valeur);
|
$valeurs = explode(',', $valeur);
|
||||||
foreach($valeurs as $valeur)
|
foreach($valeurs as $valeur) {
|
||||||
|
if($valeur != ' ' and !empty($valeur))
|
||||||
$values = array_merge($values, $this->fj($name, $valeur));
|
$values = array_merge($values, $this->fj($name, $valeur));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return ($values);
|
return ($values);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -715,11 +757,11 @@ Class Fields
|
|||||||
if(strlen($valeur) < 5) {
|
if(strlen($valeur) < 5) {
|
||||||
$sql = $table->select('formejuridique', array('fjCode'))
|
$sql = $table->select('formejuridique', array('fjCode'))
|
||||||
->where('fjCode LIKE "'.$valeur.'%"');
|
->where('fjCode LIKE "'.$valeur.'%"');
|
||||||
} else
|
} else {
|
||||||
$sql = $table->select('formejuridique', array('fjCode'))
|
$sql = $table->select('formejuridique', array('fjCode'))
|
||||||
->where('fjCode = "'.$valeur.'"');
|
->where('fjCode = "'.$valeur.'"');
|
||||||
|
}
|
||||||
$result = $table->fetchAll($sql)->toArray();
|
$result = $table->fetchAll($sql)->toArray();
|
||||||
|
|
||||||
foreach ($result as $code) {
|
foreach ($result as $code) {
|
||||||
if(strlen($code['fjCode']) > 2) {
|
if(strlen($code['fjCode']) > 2) {
|
||||||
$return[] = $code['fjCode'];
|
$return[] = $code['fjCode'];
|
||||||
@ -730,72 +772,44 @@ Class Fields
|
|||||||
|
|
||||||
protected function localisationArbo($name, $valeur)
|
protected function localisationArbo($name, $valeur)
|
||||||
{
|
{
|
||||||
if(strlen($valeur) <= 3) {
|
if(strlen($valeur) == 2) {
|
||||||
switch($valeur[0]) {
|
switch($name) {
|
||||||
case 'R':
|
case 'adr_reg':
|
||||||
$table = new Table_Departements();
|
$table = new Table_Departements();
|
||||||
$sql = $table->select()
|
$sql = $table->select()
|
||||||
->from('departements')
|
->from('departements')
|
||||||
->join(array('cp' => 'codepostaux'), 'cp.codepos LIKE CONCAT(departements.numdep, "%")', array('INSEE'))
|
->join(array('cp' => 'codepostaux'), 'cp.codepos LIKE CONCAT(departements.numdep, "%")', array('INSEE'))
|
||||||
->where('codeRegionInsee ='.substr($valeur, 1, strlen($valeur)))
|
->where('codeRegionInsee ='.$valeur)
|
||||||
->setIntegrityCheck(false);
|
->setIntegrityCheck(false);
|
||||||
$result = $table->fetchAll($sql)->toArray();
|
$result = $table->fetchAll($sql)->toArray();
|
||||||
|
|
||||||
foreach ($result as $res) {
|
foreach ($result as $res) {
|
||||||
$return[] = $res['INSEE'];
|
$return[] = trim($res['INSEE']);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'D':
|
case 'adr_dept':
|
||||||
$table = new Table_Departements();
|
$table = new Table_Departements();
|
||||||
$sql = $table->select()
|
$sql = $table->select()
|
||||||
->from('departements')
|
->from('departements')
|
||||||
->join(array('cp' => 'codepostaux'), 'cp.codepos LIKE CONCAT(departements.numdep, "%")', array('INSEE'))
|
->join(array('cp' => 'codepostaux'), 'cp.codepos LIKE CONCAT(departements.numdep, "%")', array('INSEE'))
|
||||||
->where('numdep ='.substr($valeur, 1, strlen($valeur)))
|
->where('numdep ='.$valeur)
|
||||||
->setIntegrityCheck(false);
|
->setIntegrityCheck(false);
|
||||||
$result = $table->fetchAll($sql)->toArray();
|
$result = $table->fetchAll($sql)->toArray();
|
||||||
foreach ($result as $res) {
|
foreach ($result as $res) {
|
||||||
$return[] = $res['INSEE'];
|
$return[] = trim($res['INSEE']);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
return (array($valeur));
|
return (array($valeur));
|
||||||
|
|
||||||
return ($return);
|
return ($return);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function deptArbo($name, $valeur)
|
|
||||||
{
|
|
||||||
if(strlen($valeur) < 5){
|
|
||||||
if($valeur[0] == 'D') {
|
|
||||||
$codepostaux = new Table_Codepostauxs();
|
|
||||||
$sql = $codepostaux->select()->where('Codepos LIKE "'.substr($valeur, 1).'%"');
|
|
||||||
$codes = $codepostaux->fetchAll($sql)->toArray();
|
|
||||||
foreach($codes as $code) {
|
|
||||||
$values[] = $code['Codepos'];
|
|
||||||
}
|
|
||||||
} else if($valeur[0] == 'R') {
|
|
||||||
$departements = new Table_Departements();
|
|
||||||
$codepostaux = new Table_Codepostauxs();
|
|
||||||
$sql = $departements->select()->from('departements', array('numdep'))->where('codeRegionInsee = ?', substr($valeur, 1));
|
|
||||||
$results = $departements->fetchAll($sql)->toArray();
|
|
||||||
foreach($results as $result) {
|
|
||||||
$sql = $codepostaux->select()->from('codepostaux', array('Codepos'))->where('Codepos LIKE "'.$result['numdep'].'%"');
|
|
||||||
$codes = $codepostaux->fetchAll($sql)->toArray();
|
|
||||||
foreach($codes as $code) {
|
|
||||||
$values[] = $code['Codepos'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ($values);
|
|
||||||
}
|
|
||||||
return (array($valeur));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function nafArbo($key, $valeur)
|
protected function nafArbo($key, $valeur)
|
||||||
{
|
{
|
||||||
$value = array();
|
$value = array();
|
||||||
$table = new Table_Nafs();
|
$table = new Table_Nafs();
|
||||||
|
$valeur = trim($valeur);
|
||||||
|
|
||||||
if(strlen($valeur) == 1)
|
if(strlen($valeur) == 1)
|
||||||
{
|
{
|
||||||
@ -816,16 +830,20 @@ Class Fields
|
|||||||
return ($value);
|
return ($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __construct()
|
public function __construct($batch = false)
|
||||||
{
|
{
|
||||||
|
if(!$batch) {
|
||||||
foreach($this->fields as $name => $valeur) {
|
foreach($this->fields as $name => $valeur) {
|
||||||
if($this->fields[$name]['type'] == 'interval') {
|
if($this->fields[$name]['type'] == 'interval') {
|
||||||
$minmax = $this->getMinMax($name);
|
$minmax = $this->getMinMax($name);
|
||||||
$this->fields[$name]['fields'][$this->fields['type']]['value']
|
if(!empty($minmax)) {
|
||||||
|
$this->fields[$name]['fields'][$this->fields[$name]['type']]['value']
|
||||||
= array($minmax[0]['min'], $minmax[0]['max']);
|
= array($minmax[0]['min'], $minmax[0]['max']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static public function getMinMax($name)
|
static public function getMinMax($name)
|
||||||
{
|
{
|
||||||
|
93
library/Scores/Mail.php
Normal file
93
library/Scores/Mail.php
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
<?php
|
||||||
|
class Mail
|
||||||
|
{
|
||||||
|
protected $config;
|
||||||
|
protected $mail;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gestion de l'envoi des mails en fonction de la configuration
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'mail');
|
||||||
|
$this->mail = new Zend_Mail();
|
||||||
|
if ($this->config->method == 'smtp') {
|
||||||
|
$tr = new Zend_Mail_Transport_Smtp($this->config->smtp_host);
|
||||||
|
$this->mail->setDefaultTransport($tr);
|
||||||
|
} else {
|
||||||
|
$tr = new Zend_Mail_Transport_Sendmail();
|
||||||
|
$this->mail->setDefaultTransport($tr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Champ From en fonction de la clé de configuration (configuration.ini)
|
||||||
|
* @param string $configKey
|
||||||
|
*/
|
||||||
|
public function setFrom($configKey)
|
||||||
|
{
|
||||||
|
$email = $this->config->$configKey;
|
||||||
|
$this->mail->setFrom($email, ucfirst($configKey));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Champ To en fonction de la clé de configuration (configuration.ini)
|
||||||
|
* @param string $configKey
|
||||||
|
*/
|
||||||
|
public function addToKey($configKey)
|
||||||
|
{
|
||||||
|
$email = $this->config->$configKey;
|
||||||
|
$this->mail->addTo($email, ucfirst($configKey));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ajout d'un champ To en spécifiant l'email et le nom qui doit apparaitre
|
||||||
|
* @param string $email
|
||||||
|
* @param string $nom
|
||||||
|
*/
|
||||||
|
public function addTo($email, $nom = '')
|
||||||
|
{
|
||||||
|
$this->mail->addTo($email, $this->txtConvert($nom));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Définit le sujet de l'email
|
||||||
|
* @param string $texte
|
||||||
|
*/
|
||||||
|
public function setSubject($texte = '')
|
||||||
|
{
|
||||||
|
$this->mail->setSubject($this->txtConvert($texte));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Définit le corps de l'email au format texte
|
||||||
|
* @param string $texte
|
||||||
|
*/
|
||||||
|
public function setBodyTexte($texte = '')
|
||||||
|
{
|
||||||
|
$this->mail->setBodyText($this->txtConvert($texte));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Définit le corps de l'email au format html
|
||||||
|
* @param string $html
|
||||||
|
*/
|
||||||
|
public function setBodyHtml($html = '')
|
||||||
|
{
|
||||||
|
$this->mail->setBodyHtml($this->txtConvert($html));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Envoi de l'emai
|
||||||
|
*/
|
||||||
|
public function send()
|
||||||
|
{
|
||||||
|
$this->mail->send();
|
||||||
|
}
|
||||||
|
|
||||||
|
//We suppose that character encoding of strings is UTF-8 on PHP script.
|
||||||
|
protected function txtConvert($string) {
|
||||||
|
return mb_convert_encoding($string, 'ISO-8859-1', 'UTF-8');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
BIN
public/themes/default/images/help.png
Normal file
BIN
public/themes/default/images/help.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 900 B |
@ -40,7 +40,7 @@ $(document).ready(function(){
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('textarea.complitedDep').autocomplete({
|
$('#textarea_adr_dept').autocomplete({
|
||||||
delay:600,
|
delay:600,
|
||||||
source: function(request, response) {
|
source: function(request, response) {
|
||||||
$.getJSON('/geographique/completed/dep/1', { q: extractLast( request.term ) },
|
$.getJSON('/geographique/completed/dep/1', { q: extractLast( request.term ) },
|
||||||
@ -57,7 +57,7 @@ $(document).ready(function(){
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('textarea.complitedReg').autocomplete({
|
$('#textarea_adr_reg').autocomplete({
|
||||||
delay:600,
|
delay:600,
|
||||||
source: function(request, response) {
|
source: function(request, response) {
|
||||||
$.getJSON('/geographique/completed/reg/1', { q: extractLast( request.term ) },
|
$.getJSON('/geographique/completed/reg/1', { q: extractLast( request.term ) },
|
||||||
|
@ -32,7 +32,7 @@ $(document).ready(function(){
|
|||||||
bgiframe: true,
|
bgiframe: true,
|
||||||
title: title,
|
title: title,
|
||||||
width: 500,
|
width: 500,
|
||||||
height: 300,
|
height: 400,
|
||||||
modal: true,
|
modal: true,
|
||||||
open: function(event, ui) {
|
open: function(event, ui) {
|
||||||
$(this).html('Chargement...');
|
$(this).html('Chargement...');
|
||||||
|
@ -5,7 +5,7 @@ $(document).ready(function(){
|
|||||||
function(){ $('#control').css('display', 'none'); }
|
function(){ $('#control').css('display', 'none'); }
|
||||||
);
|
);
|
||||||
|
|
||||||
$('#saveciblage').on('click', function(){
|
$('.saveciblage').on('click', function(){
|
||||||
var title = 'Sauvegarde du profil de ciblage';
|
var title = 'Sauvegarde du profil de ciblage';
|
||||||
var href = $(this).attr('href');
|
var href = $(this).attr('href');
|
||||||
var dialogOpts = {
|
var dialogOpts = {
|
||||||
|
14
public/themes/default/scripts/upload.js
Normal file
14
public/themes/default/scripts/upload.js
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
$(document).ready(function(){
|
||||||
|
$('.upload').change(function(){
|
||||||
|
term = $(this).val();
|
||||||
|
a = term.split('/');
|
||||||
|
$.ajax(
|
||||||
|
'/upload/arborescance/'+a,
|
||||||
|
{
|
||||||
|
type : "GET",
|
||||||
|
cache : false,
|
||||||
|
data : $(this).serializeArray()
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
@ -5,7 +5,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#geographique li {
|
#geographique li {
|
||||||
height:20px;
|
height:30px;
|
||||||
padding:5px;
|
padding:5px;
|
||||||
border:1px solid silver;
|
border:1px solid silver;
|
||||||
margin-top:2px;
|
margin-top:2px;
|
||||||
|
@ -15,6 +15,18 @@ em { font-style: italic }
|
|||||||
a img { border:none } /* Gets rid of IE's blue borders */
|
a img { border:none } /* Gets rid of IE's blue borders */
|
||||||
|
|
||||||
|
|
||||||
|
#Valide
|
||||||
|
{
|
||||||
|
padding:5px;
|
||||||
|
border:1px solid black;
|
||||||
|
background-color:#182838;
|
||||||
|
}
|
||||||
|
|
||||||
|
#Valide a
|
||||||
|
{
|
||||||
|
color:white;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
/* Main
|
/* Main
|
||||||
----------------------------------*/
|
----------------------------------*/
|
||||||
body {
|
body {
|
||||||
|
Loading…
Reference in New Issue
Block a user