Ok pour les modeles

This commit is contained in:
Michael RICOIS 2012-05-02 19:06:36 +00:00
parent c52157ea20
commit 10d5a73b4f
17 changed files with 349 additions and 351 deletions

View File

@ -10,13 +10,13 @@ class ComptageController extends Zend_Controller_Action
{ {
$this->_helper->layout()->disableLayout(); $this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true); $this->_helper->viewRenderer->setNoRender(true);
$request = $this->getRequest(); $request = $this->getRequest();
$object = new Object_Comptage(); $object = new Object_Comptage();
echo $object->count($request->getParam('cle'), $request->getParam('valeur')); echo $object->count($request->getParam('cle'), $request->getParam('valeur'));
} }
public function resetAction() public function resetAction()
{ {
require_once 'Scores/SessionCiblage.php'; require_once 'Scores/SessionCiblage.php';
@ -26,7 +26,7 @@ class ComptageController extends Zend_Controller_Action
unset($erreurs->erreurs); unset($erreurs->erreurs);
$this->_redirect('./'); $this->_redirect('./');
} }
public function savedialogAction() public function savedialogAction()
{ {
$this->_helper->layout()->disableLayout(); $this->_helper->layout()->disableLayout();
@ -35,41 +35,41 @@ class ComptageController extends Zend_Controller_Action
$session = new SessionCiblage(); $session = new SessionCiblage();
$criteres = $session->getCriteres(); $criteres = $session->getCriteres();
$this->view->criteres = $criteres; $this->view->criteres = $criteres;
if (count($criteres) == 0) { if (count($criteres) == 0) {
$this->view->noSelection = true; $this->view->noSelection = true;
} }
} }
public function saveAction() public function saveAction()
{ {
$this->_helper->layout()->disableLayout(); $this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true); $this->_helper->viewRenderer->setNoRender(true);
$request = $this->getRequest(); $request = $this->getRequest();
$object = new Object_Comptage(); $object = new Object_Comptage();
$object->saveComptage($request->getParam('ref', '')); $object->saveComptage($request->getParam('ref', ''));
} }
public function updateAction() public function updateAction()
{ {
$this->_helper->layout()->disableLayout(); $this->_helper->layout()->disableLayout();
$request = $this->getRequest(); $request = $this->getRequest();
$idCriteres = $request->getParam('id'); $idCriteres = $request->getParam('id');
//Récupération des critères du ciblage //Récupération des critères du ciblage
$criteresM = new Table_Criteres(); $criteresM = new Application_Model_Criteres();
$criteresRow = $criteresM->find($idCriteres); $criteresRow = $criteresM->find($idCriteres);
$criteres = $criteresRow->current(); $criteres = $criteresRow->current();
$structure = json_decode($criteres->criteres, true); $structure = json_decode($criteres->criteres, true);
require_once 'Scores/Field.php'; require_once 'Scores/Field.php';
$field = new Fields(); $field = new Fields();
$values = $field->getValues($structure); $values = $field->getValues($structure);
//Comptage //Comptage
require_once 'Scores/Ciblage.php'; require_once 'Scores/Ciblage.php';
$ciblage = new Ciblage($values); $ciblage = new Ciblage($values);
$data = array( $data = array(
'idDefinition' => $idCriteres, 'idDefinition' => $idCriteres,
'resultat' => $ciblage->execute(), 'resultat' => $ciblage->execute(),
@ -77,7 +77,7 @@ class ComptageController extends Zend_Controller_Action
'dateAjout' => date('YmdHis'), 'dateAjout' => date('YmdHis'),
); );
//Enregistrement //Enregistrement
$comptageM = new Table_Comptages(); $comptageM = new Application_Model_Comptages();
$comptageM->insert($data); $comptageM->insert($data);
//Retour comptage, unité Insee //Retour comptage, unité Insee
$result = array( $result = array(
@ -86,13 +86,13 @@ class ComptageController extends Zend_Controller_Action
'dateAjout' => substr($data['dateAjout'],6,2).'/'.substr($data['dateAjout'],4,2).'/'.substr($data['dateAjout'],6,2) 'dateAjout' => substr($data['dateAjout'],6,2).'/'.substr($data['dateAjout'],4,2).'/'.substr($data['dateAjout'],6,2)
.' '.substr($data['dateAjout'],8,2).':'.substr($data['dateAjout'],10,2).':'.substr($data['dateAjout'],12,2), .' '.substr($data['dateAjout'],8,2).':'.substr($data['dateAjout'],10,2).':'.substr($data['dateAjout'],12,2),
); );
$this->view->result = $result; $this->view->result = $result;
} }
public function previsualisationAction() public function previsualisationAction()
{ {
$this->_helper->layout()->disableLayout(); $this->_helper->layout()->disableLayout();
$request = $this->getRequest(); $request = $this->getRequest();
$object = new Object_Comptage(); $object = new Object_Comptage();
$sirets = $object->count(null, null, true); $sirets = $object->count(null, null, true);
@ -118,11 +118,11 @@ class ComptageController extends Zend_Controller_Action
$auth = Zend_Auth::getInstance(); $auth = Zend_Auth::getInstance();
$user = $auth->getIdentity(); $user = $auth->getIdentity();
//$object->getProfil($user->username, $user->idClient); //$object->getProfil($user->username, $user->idClient);
$table = new Table_EnrichissementProfils(); $profilsM = new Application_Model_EnrichissementProfils();
$sql = $table->select() $sql = $profilsM->select()
->where('login = ?', $user->username) ->where('login = ?', $user->username)
->where('idClient = ?', $user->idClient); ->where('idClient = ?', $user->idClient);
$result = $table->fetchRow($sql); $result = $profilsM->fetchRow($sql);
if(!empty($result)) { if(!empty($result)) {
$result = $result->toArray(); $result = $result->toArray();
$champs = json_decode($result['criteres']); $champs = json_decode($result['criteres']);

View File

@ -54,7 +54,7 @@ class DashboardController extends Zend_Controller_Action
$auth = Zend_Auth::getInstance(); $auth = Zend_Auth::getInstance();
$user = $auth->getIdentity(); $user = $auth->getIdentity();
$criteresM = new Table_Criteres(); $criteresM = new Application_Model_Criteres();
$sql = $criteresM->select() $sql = $criteresM->select()
->from($criteresM, array('id', 'reference', "DATE_FORMAT(dateAjout, '%d/%m/%Y') as date")) ->from($criteresM, array('id', 'reference', "DATE_FORMAT(dateAjout, '%d/%m/%Y') as date"))
->where("idClient = ?", $user->idClient) ->where("idClient = ?", $user->idClient)
@ -83,7 +83,7 @@ class DashboardController extends Zend_Controller_Action
$user = $auth->getIdentity(); $user = $auth->getIdentity();
$config = new Zend_Config_Ini(APPLICATION_PATH.'/configs/configuration.ini'); $config = new Zend_Config_Ini(APPLICATION_PATH.'/configs/configuration.ini');
//Criteres => Comptages (last) => enrichissement_identifiants => enrichissement_commandes //Criteres => Comptages (last) => enrichissement_identifiants => enrichissement_commandes
$enrichissementsM = new Table_EnrichissementIdentifiants(); $enrichissementsM = new Application_Model_EnrichissementIdentifiants();
$sql = $enrichissementsM->select() $sql = $enrichissementsM->select()
->setIntegrityCheck(false) ->setIntegrityCheck(false)

View File

@ -28,7 +28,7 @@ class EconomiqueController extends Zend_Controller_Action
$this->_helper->layout()->disableLayout(); $this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(); $this->_helper->viewRenderer->setNoRender();
$request = $this->getRequest(); $request = $this->getRequest();
$table = new Table_Nafs(); $table = new Application_Model_Naf();
$sql = $table->select() $sql = $table->select()
->where('lib LIKE "%'.$this->getRequest()->getParam('q').'%"'); ->where('lib LIKE "%'.$this->getRequest()->getParam('q').'%"');

View File

@ -6,47 +6,47 @@ class EnrichissementController extends Zend_Controller_Action
$this->view->headScript()->appendFile('/themes/default/scripts/enrichissement.js', 'text/javascript'); $this->view->headScript()->appendFile('/themes/default/scripts/enrichissement.js', 'text/javascript');
$this->view->headLink()->appendStylesheet('/themes/default/styles/enrichissement.css'); $this->view->headLink()->appendStylesheet('/themes/default/styles/enrichissement.css');
} }
/** /**
* Enter description here ... * Enter description here ...
*/ */
public function indexAction(){} public function indexAction(){}
public function fileformAction() public function fileformAction()
{ {
$this->view->headScript()->appendFile('/themes/default/scripts/jquery.form.js', 'text/javascript'); $this->view->headScript()->appendFile('/themes/default/scripts/jquery.form.js', 'text/javascript');
$this->view->headScript()->appendFile('/themes/default/scripts/jqueryprogressbar.js', 'text/javascript'); $this->view->headScript()->appendFile('/themes/default/scripts/jqueryprogressbar.js', 'text/javascript');
$this->view->assign('filesize', ini_get('upload_max_filesize')); $this->view->assign('filesize', ini_get('upload_max_filesize'));
} }
public function fileuploadAction() public function fileuploadAction()
{ {
$this->_helper->layout()->disableLayout(); $this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true); $this->_helper->viewRenderer->setNoRender(true);
$config = Zend_Registrey::get('configuration'); $config = Zend_Registrey::get('configuration');
$path = realpath($config->path->data).'/clients'; $path = realpath($config->path->data).'/clients';
if(!file_exists($path)) mkdir($path); if(!file_exists($path)) mkdir($path);
if ( isset($_FILES) && count($_FILES)==1 ){ if ( isset($_FILES) && count($_FILES)==1 ){
$n = $_FILES['fichier']['name']; $n = $_FILES['fichier']['name'];
$s = $_FILES['fichier']['size']; $s = $_FILES['fichier']['size'];
$tmp_name = $_FILES['fichier']['tmp_name']; $tmp_name = $_FILES['fichier']['tmp_name'];
$name = $_REQUEST['ref']; $name = $_REQUEST['ref'];
$extValide = array('csv'); $extValide = array('csv');
$extension = strrchr($n,'.'); $extension = strrchr($n,'.');
$extension = substr($extension,1); $extension = substr($extension,1);
//@todo : vérifier l'extension du fichier //@todo : vérifier l'extension du fichier
if (move_uploaded_file($tmp_name, $path.'/'.$name.'.'.$extension)){ if (move_uploaded_file($tmp_name, $path.'/'.$name.'.'.$extension)){
echo "Uploadé !"; echo "Uploadé !";
} else { } else {
echo "Erreur : ".$_FILES['fichier']['error']; echo "Erreur : ".$_FILES['fichier']['error'];
} }
} }
} }
/** /**
* Etat de progression de l'upload du fichier * Etat de progression de l'upload du fichier
*/ */
@ -54,8 +54,8 @@ class EnrichissementController extends Zend_Controller_Action
{ {
$this->_helper->layout()->disableLayout(); $this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true); $this->_helper->viewRenderer->setNoRender(true);
$request = $this->getRequest(); $request = $this->getRequest();
$key = $request->getParam('key', ''); $key = $request->getParam('key', '');
if ( !empty($key) ) { if ( !empty($key) ) {
//$rep sera égal à false si la clef n'existe pas dans le cache apc //$rep sera égal à false si la clef n'existe pas dans le cache apc
@ -63,7 +63,7 @@ class EnrichissementController extends Zend_Controller_Action
echo json_encode($rep); echo json_encode($rep);
} }
} }
/** /**
* Enregistrement de la commande pour l'ennrichissement * Enregistrement de la commande pour l'ennrichissement
*/ */
@ -71,43 +71,43 @@ class EnrichissementController extends Zend_Controller_Action
{ {
set_time_limit(60); set_time_limit(60);
$this->_helper->layout()->disableLayout(); $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);
//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
$auth = Zend_Auth::getInstance(); $auth = Zend_Auth::getInstance();
$user = $auth->getIdentity(); $user = $auth->getIdentity();
$profilsM = new Table_EnrichissementProfils(); $profilsM = new Application_Model_EnrichissementProfils();
$sql = $profilsM->select() $sql = $profilsM->select()
->from($profilsM, array('id')) ->from($profilsM, array('id'))
->where('idClient=?', $user->idClient) ->where('idClient=?', $user->idClient)
->where('login=?', $user->username) ->where('login=?', $user->username)
->where('actif=?', 1); ->where('actif=?', 1);
$profil = $profilsM->fetchRow($sql); $profil = $profilsM->fetchRow($sql);
$idProfil = $profil->id; $idProfil = $profil->id;
} }
$comptage = new Table_Comptages(); $comptage = new Application_Model_Comptages();
$sql = $comptage->select()->where('idDefinition = ?', $idCriteres); $sql = $comptage->select()->where('idDefinition = ?', $idCriteres);
$result = $comptage->fetchRow($sql); $result = $comptage->fetchRow($sql);
$idComptage = $result['id']; $idComptage = $result['id'];
//Récupération des critères du ciblage //Récupération des critères du ciblage
$criteresM = new Table_Criteres(); $criteresM = new Application_Model_Criteres();
$criteresRow = $criteresM->find($idCriteres); $criteresRow = $criteresM->find($idCriteres);
$criteres = $criteresRow->current(); $criteres = $criteresRow->current();
$structure = json_decode($criteres->criteres, true); $structure = json_decode($criteres->criteres, true);
require_once 'Scores/Field.php'; require_once 'Scores/Field.php';
$field = new Fields(); $field = new Fields();
$values = $field->getValues($structure); $values = $field->getValues($structure);
//Récupération des SIRET //Récupération des SIRET
require_once 'Scores/Ciblage.php'; require_once 'Scores/Ciblage.php';
$ciblage = new Ciblage($values, true); $ciblage = new Ciblage($values, true);
@ -129,36 +129,36 @@ class EnrichissementController extends Zend_Controller_Action
'error' => '', 'error' => '',
'dateAdded' => date('YmdHms'), 'dateAdded' => date('YmdHms'),
); );
$identifiantsM = new Table_EnrichissementIdentifiants(); $identifiantsM = new Application_Model_EnrichissementIdentifiants();
$idIdentifiant = $identifiantsM->insert($data); $idIdentifiant = $identifiantsM->insert($data);
exec('php '.APPLICATION_PATH.'/../batch/enrichissement.php --id '.$idIdentifiant); exec('php '.APPLICATION_PATH.'/../batch/enrichissement.php --id '.$idIdentifiant);
} }
/** /**
* Demande de référence pour l'enrichissement * Demande de référence pour l'enrichissement
*/ */
public function referenceAction() public function referenceAction()
{ {
$this->_helper->layout()->disableLayout(); $this->_helper->layout()->disableLayout();
$request = $this->getRequest(); $request = $this->getRequest();
//Récupération du profil de l'utilisateur //Récupération du profil de l'utilisateur
$auth = Zend_Auth::getInstance(); $auth = Zend_Auth::getInstance();
$user = $auth->getIdentity(); $user = $auth->getIdentity();
$profilsM = new Table_EnrichissementProfils(); $profilsM = new Application_Model_EnrichissementProfils();
$sql = $profilsM->select() $sql = $profilsM->select()
->from($profilsM, array('id', 'reference', 'tarifLigne', 'dataInsee')) ->from($profilsM, array('id', 'reference', 'tarifLigne', 'dataInsee'))
->where('idClient=?', $user->idClient) ->where('idClient=?', $user->idClient)
->where('login=?', $user->username) ->where('login=?', $user->username)
->where('actif=?', 1); ->where('actif=?', 1);
$profil = $profilsM->fetchRow($sql); $profil = $profilsM->fetchRow($sql);
// //
if ($profil!==null) if ($profil!==null)
{ {
$this->view->assign('profil', true); $this->view->assign('profil', true);
$idCritere = $request->getParam('id', null); $idCritere = $request->getParam('id', null);
$comptagesM = new Table_Comptages(); $comptagesM = new Application_Model_Comptages();
$sql = $comptagesM->select() $sql = $comptagesM->select()
->where('idDefinition = ?', $idCritere) ->where('idDefinition = ?', $idCritere)
->order('dateAjout DESC') ->order('dateAjout DESC')
@ -173,7 +173,7 @@ class EnrichissementController extends Zend_Controller_Action
$date = $date[0]; $date = $date[0];
if($date != '0000-00-00') { if($date != '0000-00-00') {
if($date != date('Y-m-d')) { if($date != date('Y-m-d')) {
$criteres = new Table_Criteres(); $criteres = new Application_Model_Criteres();
$sql = $criteres->select()->where('id = ?', $idCritere); $sql = $criteres->select()->where('id = ?', $idCritere);
$result = $criteres->fetchRow($sql)->toArray(); $result = $criteres->fetchRow($sql)->toArray();
$criteres = json_decode($result['criteres'], true); $criteres = json_decode($result['criteres'], true);
@ -188,41 +188,41 @@ class EnrichissementController extends Zend_Controller_Action
$this->view->assign('resultat', $item['resultat']); $this->view->assign('resultat', $item['resultat']);
$this->view->assign('uniteInsee', $item['uniteInsee']); $this->view->assign('uniteInsee', $item['uniteInsee']);
//Calcul du prix //Calcul du prix
$redevanceInsee = 3.295/100; //Seuil de facturation 52 734 euros $redevanceInsee = 3.295/100; //Seuil de facturation 52 734 euros
$prixInsee = $item['uniteInsee']*$redevanceInsee; $prixInsee = $item['uniteInsee']*$redevanceInsee;
$infoInsee = ''; $infoInsee = '';
if ($profil->dataInsee){ if ($profil->dataInsee){
$prixInsee = $item['resultat']*$redevanceInsee; $prixInsee = $item['resultat']*$redevanceInsee;
$infoInsee = "Votre profil inclus au moins une donnée Insee, la redevance sera applicable sur chaque ligne."; $infoInsee = "Votre profil inclus au moins une donnée Insee, la redevance sera applicable sur chaque ligne.";
} }
$prix = $item['resultat'] * $profil->tarifLigne + $prixInsee; $prix = $item['resultat'] * $profil->tarifLigne + $prixInsee;
$this->view->prix = round($prix, 2); $this->view->prix = round($prix, 2);
$this->view->prixInsee = round($prixInsee, 2); $this->view->prixInsee = round($prixInsee, 2);
$this->view->infoInsee = $infoInsee; $this->view->infoInsee = $infoInsee;
$this->view->id = $item['id']; $this->view->id = $item['id'];
/*$this->view->oldDate = $date; /*$this->view->oldDate = $date;
$this->view->oldResult = $oldResultat; $this->view->oldResult = $oldResultat;
$this->view->oldResultInsee = $oldResultatInsee; $this->view->oldResultInsee = $oldResultatInsee;
$this->view->oldPrice = round(($oldResultat* $profil->tarifLigne)+ $oldResultatInsee); $this->view->oldPrice = round(($oldResultat* $profil->tarifLigne)+ $oldResultatInsee);
$this->view->oldPriceInsee = round($oldResultatInsee*$redevanceInsee, 2);*/ $this->view->oldPriceInsee = round($oldResultatInsee*$redevanceInsee, 2);*/
$this->view->criteres = $criteres; $this->view->criteres = $criteres;
} }
} }
} }
public function downloadAction() public function downloadAction()
{ {
$this->_helper->layout()->disableLayout(); $this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true); $this->_helper->viewRenderer->setNoRender(true);
$id = $this->getRequest()->getParam('id'); $id = $this->getRequest()->getParam('id');
$table = new Table_EnrichissementIdentifiants(); $table = new Application_Model_EnrichissementIdentifiants();
$sql = $table->select() $sql = $table->select()
->where('id = ?', $id); ->where('id = ?', $id);
$result = $table->fetchRow($sql); $result = $table->fetchRow($sql);
@ -249,5 +249,5 @@ class EnrichissementController extends Zend_Controller_Action
echo 'Impossible de charger le fichier.'; echo 'Impossible de charger le fichier.';
} }
} }
} }

View File

@ -49,7 +49,7 @@ class GeographiqueController extends Zend_Controller_Action
protected function completedDep($q) protected function completedDep($q)
{ {
$table = new Table_Departements(); $table = new Application_Model_Departements();
$sql = $table->select() $sql = $table->select()
->where('libdep LIKE "'.$q.'%"'); ->where('libdep LIKE "'.$q.'%"');
$result = $table->fetchAll($sql); $result = $table->fetchAll($sql);
@ -64,7 +64,7 @@ class GeographiqueController extends Zend_Controller_Action
protected function completedVil($q) protected function completedVil($q)
{ {
$table = new Table_Codepostauxs(); $table = new Application_Model_CodePostaux();
$separator = ' '; $separator = ' ';
$sql = $table->select()->where('Commune LIKE "'.$q.'%"'); $sql = $table->select()->where('Commune LIKE "'.$q.'%"');
@ -80,7 +80,7 @@ class GeographiqueController extends Zend_Controller_Action
protected function getDeptFromReg($dep) protected function getDeptFromReg($dep)
{ {
$table = new Table_Departements(); $table = new Application_Model_Departements();
$sql = $table->select() $sql = $table->select()
->where('codeRegionInsee = '.$dep); ->where('codeRegionInsee = '.$dep);
$result = $table->fetchAll($sql)->toArray(); $result = $table->fetchAll($sql)->toArray();
@ -94,7 +94,7 @@ class GeographiqueController extends Zend_Controller_Action
protected function completedReg($q) protected function completedReg($q)
{ {
$table = new Table_Regions(); $table = new Application_Model_Regions();
$separator = ' '; $separator = ' ';
$sql = $table->select() $sql = $table->select()

View File

@ -5,31 +5,31 @@ class GestionController extends Zend_Controller_Action
{ {
} }
public function init() public function init()
{ {
$this->view->headLink()->appendStylesheet('/themes/default/styles/dashboard.css', 'all'); $this->view->headLink()->appendStylesheet('/themes/default/styles/dashboard.css', 'all');
$this->view->headScript()->appendFile('/themes/default/scripts/dashboard.js', 'text/javascript'); $this->view->headScript()->appendFile('/themes/default/scripts/dashboard.js', 'text/javascript');
} }
public function indexAction() public function indexAction()
{ {
} }
public function profilsAction() public function profilsAction()
{ {
$profilsM = new Table_EnrichissementProfils(); $profilsM = new Application_Model_EnrichissementProfils();
$sql = $profilsM->select() $sql = $profilsM->select()
->from($profilsM, array('id', 'idClient', 'login', 'reference', 'tarifLigne', 'dateAjout', 'dateSuppr', 'actif')); ->from($profilsM, array('id', 'idClient', 'login', 'reference', 'tarifLigne', 'dateAjout', 'dateSuppr', 'actif'));
$profils = $profilsM->fetchAll($sql); $profils = $profilsM->fetchAll($sql);
$this->view->assign('profils', $profils); $this->view->assign('profils', $profils);
} }
public function profilAction(){} public function profilAction(){}
public function profiladdAction() public function profiladdAction()
{ {
$request = $this->getRequest(); $request = $this->getRequest();
@ -37,7 +37,7 @@ class GestionController extends Zend_Controller_Action
//Sauvegarde du formulaire //Sauvegarde du formulaire
if ( $request->isPost() && $request->getParam('submit')=='Enregistrer' ){ if ( $request->isPost() && $request->getParam('submit')=='Enregistrer' ){
$params = $request->getParams(); $params = $request->getParams();
//Vérifier le formulaire //Vérifier le formulaire
$errForm = 0; $errForm = 0;
foreach ( $params as $key => $value ) { foreach ( $params as $key => $value ) {
@ -57,8 +57,8 @@ class GestionController extends Zend_Controller_Action
$dateInsee = 1; $dateInsee = 1;
break; break;
} }
} }
$data = array( $data = array(
'idClient' => $params['idClient'], 'idClient' => $params['idClient'],
'login' => $params['login'], 'login' => $params['login'],
@ -69,38 +69,38 @@ class GestionController extends Zend_Controller_Action
'dateAjout' => date('Y-m-d H:i:s'), 'dateAjout' => date('Y-m-d H:i:s'),
'actif' => 1, 'actif' => 1,
); );
$profilM = new Table_EnrichissementProfils(); $profilM = new Application_Model_EnrichissementProfils();
if ( $profilM->insert($data) ){ if ( $profilM->insert($data) ){
$this->view->assign('message', "Profil enregistré"); $this->view->assign('message', "Profil enregistré");
} else { } else {
$this->view->assign('message', "Erreur lors de la sauvegarde"); $this->view->assign('message', "Erreur lors de la sauvegarde");
} }
} else { } else {
$this->view->assign('message', "Erreur lors de la saisie"); $this->view->assign('message', "Erreur lors de la saisie");
} }
} }
//Affichage du formulaire //Affichage du formulaire
require_once 'Scores/Enrichissement.php'; require_once 'Scores/Enrichissement.php';
$fieldsM = new Enrichissement(); $fieldsM = new Enrichissement();
$allFields = $fieldsM->getFields(); $allFields = $fieldsM->getFields();
$this->view->assign('fields', $allFields); $this->view->assign('fields', $allFields);
} }
public function profildelAction(){} public function profildelAction(){}
public function comptagesAction() public function comptagesAction()
{ {
$table = new Table_Comptages(); $table = new Application_Model_Comptages();
$sql = $table->select() $sql = $table->select()
->order('dateAjout DESC'); ->order('dateAjout DESC');
$this->view->comptages = $table->fetchAll($sql)->toArray(); $this->view->comptages = $table->fetchAll($sql)->toArray();
} }
public function enrichissementsAction() public function enrichissementsAction()
{ {
$table = new Table_EnrichissementIdentifiants(); $table = new Application_Model_EnrichissementIdentifiants();
$sql = $table->select() $sql = $table->select()
->order('dateAdded DESC'); ->order('dateAdded DESC');
$this->view->enrichissements = $table->fetchAll($sql)->toArray(); $this->view->enrichissements = $table->fetchAll($sql)->toArray();
@ -109,7 +109,7 @@ class GestionController extends Zend_Controller_Action
public function extractAction() public function extractAction()
{ {
$id = $this->getRequest()->getParam('id'); $id = $this->getRequest()->getParam('id');
$table = new Table_EnrichissementIdentifiants(); $table = new Application_Model_EnrichissementIdentifiants();
$sql = $table->select() $sql = $table->select()
->where('idComptage = ?', $id); ->where('idComptage = ?', $id);
$result = $table->fetchRow($sql); $result = $table->fetchRow($sql);

View File

@ -26,7 +26,7 @@ class JuridiqueController extends Zend_Controller_Action
public function completedAction() public function completedAction()
{ {
$table = new Table_Formejuridiques(); $table = new Application_Model_FormJuridique();
$this->_helper->layout()->disableLayout(); $this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(); $this->_helper->viewRenderer->setNoRender();
$request = $this->getRequest(); $request = $this->getRequest();

View File

@ -45,7 +45,7 @@ if(isset($opts->help))
$dbConfig = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'databases'); $dbConfig = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'databases');
$db = Zend_Db::factory($dbConfig->db); $db = Zend_Db::factory($dbConfig->db);
$commandesM = new Table_EnrichissementCommandes($db); $commandesM = new Application_Model_Commandes($db);
$sql = $commandesM->select() $sql = $commandesM->select()
->where('idProfil != ?', 0) ->where('idProfil != ?', 0)
@ -53,7 +53,7 @@ $sql = $commandesM->select()
->where("dateStop = '0000-00-00 00:00:00'"); ->where("dateStop = '0000-00-00 00:00:00'");
$result = $commandesM->fetchAll($sql); $result = $commandesM->fetchAll($sql);
if (count($result)>0){ if (count($result)>0){
exit; exit;
} }
//Si pas de traitement en cours alors on lance //Si pas de traitement en cours alors on lance

View File

@ -27,7 +27,7 @@ Class extract
protected $db; protected $db;
protected $dbMetier; protected $dbMetier;
protected $reference; protected $reference;
public function __construct($reference) public function __construct($reference)
{ {
$this->reference = $reference; $this->reference = $reference;
@ -38,12 +38,12 @@ Class extract
exit ( $e->getMessage() ); exit ( $e->getMessage() );
} }
} }
public function getHttp() public function getHttp()
{ {
/* Depuis le navigateur */ /* Depuis le navigateur */
} }
protected function getCj($liste) protected function getCj($liste)
{ {
foreach($liste as $valeur) foreach($liste as $valeur)
@ -66,7 +66,7 @@ Class extract
} }
return ($return); return ($return);
} }
protected function localisationArbo($name, $valeur) protected function localisationArbo($name, $valeur)
{ {
if(strlen($valeur) == 2) { if(strlen($valeur) == 2) {
@ -97,7 +97,7 @@ Class extract
} }
return ($return); return ($return);
} }
public function getMinMax($name, $valeur) public function getMinMax($name, $valeur)
{ {
$valeur = explode(',', $valeur); $valeur = explode(',', $valeur);
@ -116,16 +116,14 @@ Class extract
} }
return ($valeur); return ($valeur);
} }
protected function nafArbo($key, $valeur) protected function nafArbo($key, $valeur)
{ {
$value = array(); $value = array();
//$table = new Table_Nafs();
$valeur = trim($valeur); $valeur = trim($valeur);
if(strlen($valeur) == 1) if(strlen($valeur) == 1)
{ {
//$sql = $table->select()->where('parent = ?', $valeur);
$sql = 'SELECT * FROM naf WHERE parent ='.$valeur; $sql = 'SELECT * FROM naf WHERE parent ='.$valeur;
$result =$this->db->query($sql); $result =$this->db->query($sql);
$result = $result->fetchAll(); $result = $result->fetchAll();
@ -146,18 +144,18 @@ Class extract
} }
return ($value); return ($value);
} }
public function getCli() public function getCli()
{ {
require_once('Scores/Ciblage.php'); require_once('Scores/Ciblage.php');
//require_once('Scores/Field.php'); //require_once('Scores/Field.php');
$sql = 'SELECT id, idDefinition, uniteInsee FROM comptages WHERE id = '.$this->reference; $sql = 'SELECT id, idDefinition, uniteInsee FROM comptages WHERE id = '.$this->reference;
$fetch = $this->db->query($sql); $fetch = $this->db->query($sql);
$result = $fetch->fetchAll(); $result = $fetch->fetchAll();
$idComptage = $result[0]['id']; $idComptage = $result[0]['id'];
$uniteInsee = $result[0]['uniteInsee']; $uniteInsee = $result[0]['uniteInsee'];
$sql = 'SELECT id, criteres.criteres FROM criteres WHERE id ='.$result[0]['idDefinition']; $sql = 'SELECT id, criteres.criteres FROM criteres WHERE id ='.$result[0]['idDefinition'];
$fetch = $this->db->query($sql); $fetch = $this->db->query($sql);
$result = $fetch->fetchAll(); $result = $fetch->fetchAll();
@ -199,7 +197,7 @@ Class extract
$array['bilTca'] = array(4, 5, 6); $array['bilTca'] = array(4, 5, 6);
$ciblage = new Ciblage($array, true); $ciblage = new Ciblage($array, true);
$res = $ciblage->execute(true); $res = $ciblage->execute(true);
$data = array( $data = array(
'idComptage' => $idComptage, 'idComptage' => $idComptage,
'idCriteres' => $idCriteres, 'idCriteres' => $idCriteres,

View File

@ -7,7 +7,7 @@ class Application_Controller_Plugin_Comptage extends Zend_Controller_Plugin_Abst
if ($layout->isEnabled()) { if ($layout->isEnabled()) {
$controller = $request->getControllerName(); $controller = $request->getControllerName();
$action = $request->getActionName(); $action = $request->getActionName();
if ($controller == 'index' && $action == 'index') { if ($controller == 'index' && $action == 'index') {
require_once 'Scores/SessionCiblage.php'; require_once 'Scores/SessionCiblage.php';
$session = new SessionCiblage(); $session = new SessionCiblage();
@ -15,12 +15,12 @@ class Application_Controller_Plugin_Comptage extends Zend_Controller_Plugin_Abst
$auth = Zend_Auth::getInstance(); $auth = Zend_Auth::getInstance();
$user = $auth->getIdentity(); $user = $auth->getIdentity();
// Chargement des critères de ciblage à partir de l'enregistrement en bdd // Chargement des critères de ciblage à partir de l'enregistrement en bdd
$id = $request->getParam('id', 0); $id = $request->getParam('id', 0);
if (!empty($id)) { if (!empty($id)) {
$db = Zend_Registry::get('db'); $db = Zend_Registry::get('db');
$criteresM = new Table_Criteres(); $criteresM = new Application_Model_Criteres();
$sql = $criteresM->select() $sql = $criteresM->select()
->from($criteresM, array('criteres')) ->from($criteresM, array('criteres'))
->where('login = ?', $user->username) ->where('login = ?', $user->username)
@ -35,11 +35,11 @@ class Application_Controller_Plugin_Comptage extends Zend_Controller_Plugin_Abst
$field = new Fields(); $field = new Fields();
$ciblage = new Ciblage($field->getValues()); $ciblage = new Ciblage($field->getValues());
$total = $ciblage->execute(); $total = $ciblage->execute();
$insee = $ciblage->calculRedevanceInsee(); $insee = $ciblage->calculRedevanceInsee();
$session->setNb('total', $total); $session->setNb('total', $total);
$session->setNb('insee', $insee); $session->setNb('insee', $insee);
} }
} }
$view->total = number_format($session->getNb('total'), 0, '', ' '); $view->total = number_format($session->getNb('total'), 0, '', ' ');
$view->insee = number_format($session->getNb('insee'), 0, '', ' '); $view->insee = number_format($session->getNb('insee'), 0, '', ' ');
$view->msgComptage = true; $view->msgComptage = true;

View File

@ -9,12 +9,12 @@ class Object_Codepostaux extends Libs_Row
$valeurs = $session->getCritere($type); $valeurs = $session->getCritere($type);
return (substr($valeurs, 0, strlen($valeurs)-1)); return (substr($valeurs, 0, strlen($valeurs)-1));
} }
public function _jstree_undetermined($niveau, $type) public function _jstree_undetermined($niveau, $type)
{ {
require_once('Scores/SessionCiblage.php'); require_once('Scores/SessionCiblage.php');
$session = new SessionCiblage(); $session = new SessionCiblage();
$table = new Table_Departements(); $table = new Application_Model_Departements();
$valeurs = explode(',', $session->getCritere($type)); $valeurs = explode(',', $session->getCritere($type));
//print_r($valeurs); //print_r($valeurs);
/*$valeurs = array_merge($valeurs, explode(',', $session->getCritere('adr_com')));*/ /*$valeurs = array_merge($valeurs, explode(',', $session->getCritere('adr_com')));*/
@ -42,7 +42,7 @@ class Object_Codepostaux extends Libs_Row
} }
return ($in); return ($in);
} }
public function _getClass($valeur, $niveau) public function _getClass($valeur, $niveau)
{ {
require_once('Scores/SessionCiblage.php'); require_once('Scores/SessionCiblage.php');
@ -60,17 +60,17 @@ class Object_Codepostaux extends Libs_Row
} }
else if($row > 1) else if($row > 1)
return ('jstree-undetermined'); return ('jstree-undetermined');
/*$type = explode(':', $valeur); /*$type = explode(':', $valeur);
if($type[1] == $this->_jstree_checked($type[0])) if($type[1] == $this->_jstree_checked($type[0]))
return ('jstree-checked'); return ('jstree-checked');
else if (in_array($valeur, $this->_jstree_undetermined($niveau, $type[0]))) else if (in_array($valeur, $this->_jstree_undetermined($niveau, $type[0])))
return ('jstree-undetermined');*/ return ('jstree-undetermined');*/
} }
protected function getDepartement($region) protected function getDepartement($region)
{ {
$table = new Table_Departements(); $table = new Application_Model_Departements();
$sql = $table->select() $sql = $table->select()
->where('codeRegionInsee = '.$region); ->where('codeRegionInsee = '.$region);
$result = $table->fetchAll($sql)->toArray(); $result = $table->fetchAll($sql)->toArray();
@ -80,73 +80,73 @@ class Object_Codepostaux extends Libs_Row
} }
return (implode(',', $depts)); return (implode(',', $depts));
} }
/* Fonctions de construction de jstree */ /* Fonctions de construction de jstree */
public function _getRegions() public function _getRegions()
{ {
$region = new Table_Regions(); $region = new Application_Model_Regions();
$regions = $region->fetchAll($region->select()->order('NCCENR ASC'))->toArray(); $regions = $region->fetchAll($region->select()->order('NCCENR ASC'))->toArray();
$structure = array(); $structure = array();
foreach($regions as $nom) { foreach($regions as $nom) {
$structure[] = array( $structure[] = array(
'data' => $nom['NCCENR'], 'data' => $nom['NCCENR'],
'attr' => array('id' => $this->getDepartement($nom['REGION']), 'attr' => array('id' => $this->getDepartement($nom['REGION']),
'niveau' => 0, 'niveau' => 0,
'class' => $this->_getClass($this->getDepartement($nom['REGION']), 0) 'class' => $this->_getClass($this->getDepartement($nom['REGION']), 0)
), ),
'state' => 'closed', 'state' => 'closed',
'children' => array() 'children' => array()
); );
} }
return (json_encode($structure)); return (json_encode($structure));
} }
public function _getDepartements($codeRegionInsee) public function _getDepartements($codeRegionInsee)
{ {
//$code = explode(':', $codeRegionInsee); //$code = explode(':', $codeRegionInsee);
$departement = new Table_Departements(); $departement = new Application_Model_Departements();
foreach(explode(',', $codeRegionInsee) as $dept) { foreach(explode(',', $codeRegionInsee) as $dept) {
$departements[] = $departement->fetchAll($departement->select() $departements[] = $departement->fetchAll($departement->select()
->where('numdep ='.$dept))->toArray(); ->where('numdep ='.$dept))->toArray();
} }
$structure = array(); $structure = array();
foreach($departements as $nom) { foreach($departements as $nom) {
$structure[] = array( $structure[] = array(
'data' => $nom[0]['numdep'].' '.$nom[0]['libdep'], 'data' => $nom[0]['numdep'].' '.$nom[0]['libdep'],
'attr' => array('id' => $nom[0]['numdep'], 'attr' => array('id' => $nom[0]['numdep'],
'niveau' => 1, 'niveau' => 1,
'class' => $this->_getClass($nom[0]['numdep'], 1) 'class' => $this->_getClass($nom[0]['numdep'], 1)
), ),
'state' => 'closed', 'state' => 'closed',
'children' => array() 'children' => array()
); );
} }
return (json_encode($structure)); return (json_encode($structure));
} }
public function _getCommunes($numdep) public function _getCommunes($numdep)
{ {
//$numdep = explode(':', $numdep); //$numdep = explode(':', $numdep);
$codepostau = new Table_Codepostauxs(); $codepostau = new Application_Model_CodePostaux();
$codepostaux = $codepostau->fetchAll($codepostau->select()->where('codepos LIKE "'.$numdep.'%"'))->toArray(); $codepostaux = $codepostau->fetchAll($codepostau->select()->where('codepos LIKE "'.$numdep.'%"'))->toArray();
$structure = array(); $structure = array();
foreach($codepostaux as $nom) { foreach($codepostaux as $nom) {
$structure[] = array( $structure[] = array(
'data' => $nom['Codepos'].' '.$nom['Commune'], 'data' => $nom['Codepos'].' '.$nom['Commune'],
'attr' => array('id'=> $nom['INSEE'], 'attr' => array('id'=> $nom['INSEE'],
'niveau' => 2, 'niveau' => 2,
'class' => $this->_getClass($nom['INSEE'], 2) 'class' => $this->_getClass($nom['INSEE'], 2)
), ),
'state' => 'closed', 'state' => 'closed',
'children' => array() 'children' => array()
); );
} }
return (json_encode($structure)); return (json_encode($structure));
} }
} }

View File

@ -5,7 +5,7 @@ class Object_Comptage extends Libs_Row
{ {
if (empty($ref)) { if (empty($ref)) {
echo json_encode(array( echo json_encode(array(
'error'=>1, 'error'=>1,
'msg'=> "Référence non définie !")); 'msg'=> "Référence non définie !"));
} else { } else {
//Session //Session
@ -14,13 +14,13 @@ class Object_Comptage extends Libs_Row
$criteres = $session->getCriteres(); $criteres = $session->getCriteres();
$resultat = $session->getNb('total'); $resultat = $session->getNb('total');
$nbInsee = $session->getNb('insee'); $nbInsee = $session->getNb('insee');
//Informations utilisateur //Informations utilisateur
$auth = Zend_Auth::getInstance(); $auth = Zend_Auth::getInstance();
$user = $auth->getIdentity(); $user = $auth->getIdentity();
//Enregistrement des critères //Enregistrement des critères
$criteresM = new Table_Criteres(); $criteresM = new Application_Model_Criteres();
$data = array( $data = array(
'idClient' => $user->idClient, 'idClient' => $user->idClient,
'login' => $user->username, 'login' => $user->username,
@ -30,10 +30,10 @@ class Object_Comptage extends Libs_Row
'dateAjout' => date('Y-m-d H:i:s'), 'dateAjout' => date('Y-m-d H:i:s'),
); );
$id = $criteresM->insert($data); $id = $criteresM->insert($data);
if ($id){ if ($id){
//Enregistrement des valeurs du comptage //Enregistrement des valeurs du comptage
$comptageM = new Table_Comptages(); $comptageM = new Application_Model_Comptages();
$data = array( $data = array(
'idDefinition' => $id, 'idDefinition' => $id,
'resultat' => $resultat, 'resultat' => $resultat,
@ -42,27 +42,27 @@ class Object_Comptage extends Libs_Row
); );
if ($comptageM->insert($data)) { if ($comptageM->insert($data)) {
echo json_encode(array( echo json_encode(array(
'error'=>0, 'error'=>0,
'msg'=> "Vos critères ont été sauvegardés sous la référence $ref", 'msg'=> "Vos critères ont été sauvegardés sous la référence $ref",
'id' => $id)); 'id' => $id));
} else { } else {
echo json_encode(array( echo json_encode(array(
'error'=>1, 'error'=>1,
'msg'=> "Erreur lors de l'enregistrement")); 'msg'=> "Erreur lors de l'enregistrement"));
} }
} else { } else {
echo json_encode(array( echo json_encode(array(
'error'=>1, 'error'=>1,
'msg'=> "Erreur lors de l'enregistrement")); 'msg'=> "Erreur lors de l'enregistrement"));
} }
} }
} }
public function count($key, $valeur, $need = false) public function count($key, $valeur, $need = false)
{ {
require_once 'Scores/SessionCiblage.php'; require_once 'Scores/SessionCiblage.php';
$session = new SessionCiblage(); $session = new SessionCiblage();
if(in_array($key, array('adr_dept', 'adr_com', 'adr_reg', 'adr_com_ex', 'adr_dept_ex'))) if(in_array($key, array('adr_dept', 'adr_com', 'adr_reg', 'adr_com_ex', 'adr_dept_ex')))
{ {
$valeurs = explode(',', $valeur); $valeurs = explode(',', $valeur);
@ -70,7 +70,7 @@ class Object_Comptage extends Libs_Row
$reg_ = $session->getCritere('adr_reg'); $reg_ = $session->getCritere('adr_reg');
if(!empty($reg_)) { if(!empty($reg_)) {
$reg_ = explode(',', $reg_); $reg_ = explode(',', $reg_);
$table = new Table_Departements(); $table = new Application_Model_Departements();
$result = array(); $result = array();
foreach($reg_ as $item) { foreach($reg_ as $item) {
$sql = $table->select()->where('codeRegionInsee = ?', $item); $sql = $table->select()->where('codeRegionInsee = ?', $item);
@ -130,7 +130,7 @@ class Object_Comptage extends Libs_Row
} }
} else } else
$session->setCritere($key, $valeur); $session->setCritere($key, $valeur);
require_once 'Scores/Field.php'; require_once 'Scores/Field.php';
$field = new Fields(); $field = new Fields();
@ -142,10 +142,10 @@ class Object_Comptage extends Libs_Row
} }
$total = $ciblage->execute(); $total = $ciblage->execute();
$insee = $ciblage->calculRedevanceInsee(); $insee = $ciblage->calculRedevanceInsee();
$session->setNb('total', $total); $session->setNb('total', $total);
$session->setNb('insee', $insee); $session->setNb('insee', $insee);
//Retour comptage, unité Insee //Retour comptage, unité Insee
$result = array( $result = array(
'count' => number_format($total, 0, '', ' '), 'count' => number_format($total, 0, '', ' '),

View File

@ -1,23 +1,23 @@
<?php <?php
Class Object_Dashboard Class Object_Dashboard
{ {
public function index() public function index()
{ {
$auth = Zend_Auth::getInstance(); $auth = Zend_Auth::getInstance();
$user = $auth->getIdentity(); $user = $auth->getIdentity();
$criteresM = new Table_Criteres(); $criteresM = new Application_Model_Criteres();
$sql = $criteresM->select() $sql = $criteresM->select()
->from($criteresM, array('id', 'reference', 'dateAjout')) ->from($criteresM, array('id', 'reference', 'dateAjout'))
->where("idClient = ?", $user->idClient) ->where("idClient = ?", $user->idClient)
->where("login = ?", $user->username) ->where("login = ?", $user->username)
->order('dateAjout DESC') ->order('dateAjout DESC')
->limit(5); ->limit(5);
$rows = $criteresM->fetchAll($sql); $rows = $criteresM->fetchAll($sql);
$results = array(); $results = array();
$comptagesM = new Table_Comptages(); $comptagesM = new Application_Model_Comptages();
foreach($rows->toArray() as $item) foreach($rows->toArray() as $item)
{ {
$info = array( $info = array(
@ -31,21 +31,21 @@ Class Object_Dashboard
->where('idDefinition = ?', $item['id']) ->where('idDefinition = ?', $item['id'])
->order('dateAjout DESC')->limit(1); ->order('dateAjout DESC')->limit(1);
$comptage = $comptagesM->fetchAll($sql)->toArray(); $comptage = $comptagesM->fetchAll($sql)->toArray();
if (count($comptage)>0){ if (count($comptage)>0){
$info['resultat'] = $comptage[0]['resultat']; $info['resultat'] = $comptage[0]['resultat'];
$info['uniteInsee'] = $comptage[0]['uniteInsee']; $info['uniteInsee'] = $comptage[0]['uniteInsee'];
$info['dateComptage'] = $comptage[0]['dateAjout']; $info['dateComptage'] = $comptage[0]['dateAjout'];
} }
$results[] = $info; $results[] = $info;
} }
return ($results); return ($results);
} }
public function enrichissement($idComptage) public function enrichissement($idComptage)
{ {
$enrichissements = new Table_EnrichissementIdentifiants(); $enrichissements = new Application_Model_EnrichissementIdentifiants();
$auth = Zend_Auth::getInstance(); $auth = Zend_Auth::getInstance();
$user = $auth->getIdentity(); $user = $auth->getIdentity();
$sql = $enrichissements->select() $sql = $enrichissements->select()
@ -63,10 +63,10 @@ Class Object_Dashboard
->where('i.idCriteres = ?', $idComptage); ->where('i.idCriteres = ?', $idComptage);
return ($enrichissements->fetchAll($sql)); return ($enrichissements->fetchAll($sql));
} }
public function enrichissements() public function enrichissements()
{ {
$enrichissementsM = new Table_EnrichissementIdentifiants(); $enrichissementsM = new Application_Model_EnrichissementIdentifiants();
$auth = Zend_Auth::getInstance(); $auth = Zend_Auth::getInstance();
$user = $auth->getIdentity(); $user = $auth->getIdentity();
$sql = $enrichissementsM->select() $sql = $enrichissementsM->select()
@ -88,21 +88,21 @@ Class Object_Dashboard
->order('dateAdded DESC'); ->order('dateAdded DESC');
return ($enrichissementsM->fetchAll($sql)); return ($enrichissementsM->fetchAll($sql));
} }
public function menu() public function menu()
{ {
} }
public function ciblage($page) public function ciblage($page)
{ {
$offset = 20; $offset = 20;
//Liste des ciblages par paquet de n //Liste des ciblages par paquet de n
$auth = Zend_Auth::getInstance(); $auth = Zend_Auth::getInstance();
$user = $auth->getIdentity(); $user = $auth->getIdentity();
$criteresM = new Table_Criteres(); $criteresM = new Application_Model_Criteres();
//Compter le nombre de page //Compter le nombre de page
$sql = $criteresM->select() $sql = $criteresM->select()
->from($criteresM, array('nb' => 'COUNT(*)')) ->from($criteresM, array('nb' => 'COUNT(*)'))
@ -110,7 +110,7 @@ Class Object_Dashboard
->where("login = ?", $user->username); ->where("login = ?", $user->username);
$count = $criteresM->fetchRow($sql); $count = $criteresM->fetchRow($sql);
$nbCiblage = $count->nb; $nbCiblage = $count->nb;
//Récupérer les informations //Récupérer les informations
$position = ($page-1)*$offset+1; $position = ($page-1)*$offset+1;
$sql = $criteresM->select() $sql = $criteresM->select()
@ -119,10 +119,10 @@ Class Object_Dashboard
->where("login = ?", $user->username) ->where("login = ?", $user->username)
->order('dateAjout DESC') ->order('dateAjout DESC')
->limitPage($position, $offset); ->limitPage($position, $offset);
$rows = $criteresM->fetchAll($sql); $rows = $criteresM->fetchAll($sql);
$results = array(); $results = array();
$comptagesM = new Table_Comptages(); $comptagesM = new Application_Model_Comptages();
foreach($rows->toArray() as $item) foreach($rows->toArray() as $item)
{ {
$info = array( $info = array(
@ -136,16 +136,16 @@ Class Object_Dashboard
->where('idDefinition = ?', $item['id']) ->where('idDefinition = ?', $item['id'])
->order('dateAjout DESC')->limit(1); ->order('dateAjout DESC')->limit(1);
$comptage = $comptagesM->fetchAll($sql)->toArray(); $comptage = $comptagesM->fetchAll($sql)->toArray();
if (count($comptage)>0){ if (count($comptage)>0){
$info['resultat'] = $comptage[0]['resultat']; $info['resultat'] = $comptage[0]['resultat'];
$info['uniteInsee'] = $comptage[0]['uniteInsee']; $info['uniteInsee'] = $comptage[0]['uniteInsee'];
$info['dateComptage'] = $comptage[0]['dateAjout']; $info['dateComptage'] = $comptage[0]['dateAjout'];
} }
$results[] = $info; $results[] = $info;
} }
return (array('ciblages' => $results, 'nbCiblage' => $nbCiblage)); return (array('ciblages' => $results, 'nbCiblage' => $nbCiblage));
} }
@ -153,15 +153,15 @@ Class Object_Dashboard
{ {
$auth = Zend_Auth::getInstance(); $auth = Zend_Auth::getInstance();
$user = $auth->getIdentity(); $user = $auth->getIdentity();
$table = new Table_Criteres(); $table = new Application_Model_Criteres();
$sql = $table->select() $sql = $table->select()
->where('idClient = ?', $user->idClient) ->where('idClient = ?', $user->idClient)
->where('login = ?', $user->username) ->where('login = ?', $user->username)
->where('id = ?', $id); ->where('id = ?', $id);
$criteres = $table->fetchRow($sql)->toArray(); $criteres = $table->fetchRow($sql)->toArray();
if ($criteres != null){ if ($criteres != null){
$comptage = new Table_Comptages(); $comptage = new Application_Model_Comptages();
$sql = $comptage->select() $sql = $comptage->select()
->where('idDefinition = ?', $id)->order('dateAjout DESC'); ->where('idDefinition = ?', $id)->order('dateAjout DESC');
$comptages = $comptage->fetchAll($sql)->toArray(); $comptages = $comptage->fetchAll($sql)->toArray();
@ -173,8 +173,8 @@ Class Object_Dashboard
{ {
$auth = Zend_Auth::getInstance(); $auth = Zend_Auth::getInstance();
$user = $auth->getIdentity(); $user = $auth->getIdentity();
$criteresM = new Table_Criteres($db); $criteresM = new Application_Model_Criteres();
$sql = $criteresM->select() $sql = $criteresM->select()
->from($criteresM, array('id', 'reference', "DATE_FORMAT(dateAjout, '%d/%m/%Y') as date")) ->from($criteresM, array('id', 'reference', "DATE_FORMAT(dateAjout, '%d/%m/%Y') as date"))
->where("idClient = ?", $user->idClient) ->where("idClient = ?", $user->idClient)

View File

@ -6,7 +6,7 @@ class Object_Formejuridique extends Libs_Row
require_once('Scores/SessionCiblage.php'); require_once('Scores/SessionCiblage.php');
$session = new SessionCiblage(); $session = new SessionCiblage();
$valeurs = explode(',', $session->getCritere('cj')); $valeurs = explode(',', $session->getCritere('cj'));
foreach($valeurs as $valeur) { foreach($valeurs as $valeur) {
if($valeur != '') if($valeur != '')
$return[] = $valeur; $return[] = $valeur;
@ -15,12 +15,12 @@ class Object_Formejuridique extends Libs_Row
return ($return); return ($return);
return (array($valeurs)); return (array($valeurs));
} }
protected function _jstree_undetermined() protected function _jstree_undetermined()
{ {
return (array()); return (array());
} }
public function _getClass($valeur) public function _getClass($valeur)
{ {
if(in_array($valeur, $this->_jstree_checked())) if(in_array($valeur, $this->_jstree_checked()))
@ -28,32 +28,32 @@ class Object_Formejuridique extends Libs_Row
else if (in_array($valeur, $this->_jstree_undetermined())) else if (in_array($valeur, $this->_jstree_undetermined()))
return ('jstree-undetermined'); return ('jstree-undetermined');
} }
public function _getParents() public function _getParents()
{ {
$formes = new Table_Formejuridiques(); $formes = new Application_Model_FormJuridique();
$formes = $formes->fetchAll($formes->select()->where('LENGTH(fjCode) = 1'))->toArray(); $formes = $formes->fetchAll($formes->select()->where('LENGTH(fjCode) = 1'))->toArray();
$structure = array(); $structure = array();
foreach($formes as $forme) { foreach($formes as $forme) {
$structure[] = array( $structure[] = array(
'data' => $forme['fjCode'].' : '.$forme['fjLibelle'], 'data' => $forme['fjCode'].' : '.$forme['fjLibelle'],
'attr' => array('id' => $forme['fjCode'], 'attr' => array('id' => $forme['fjCode'],
'class' => $this->_getClass($forme['fjCode'])), 'class' => $this->_getClass($forme['fjCode'])),
'state' => 'closed', 'state' => 'closed',
'children' => array($this->_getFils($forme['fjCode'])), 'children' => array($this->_getFils($forme['fjCode'])),
); );
} }
return (json_encode($structure)); return (json_encode($structure));
} }
public function _getFils($fjcode) public function _getFils($fjcode)
{ {
$lenth = ((strlen($fjcode) == 2)?4:2); $lenth = ((strlen($fjcode) == 2)?4:2);
$formes = new Table_Formejuridiques(); $formes = new Application_Model_FormJuridique();
$sql = $formes->select()->from('formejuridique', array( $sql = $formes->select()->from('formejuridique', array(
'size' => new Zend_Db_Expr('LENGTH(fjCode)'), 'size' => new Zend_Db_Expr('LENGTH(fjCode)'),
'fjCode', 'fjCode',
'fjLibelle')) 'fjLibelle'))
->where('fjCode LIKE "'.$fjcode.'%"') ->where('fjCode LIKE "'.$fjcode.'%"')
->having('size = ?', $lenth); ->having('size = ?', $lenth);
@ -69,7 +69,7 @@ class Object_Formejuridique extends Libs_Row
); );
$tabfj[] = $structure; $tabfj[] = $structure;
} }
return ($tabfj); return ($tabfj);
} }
} }

View File

@ -15,7 +15,7 @@ class Object_Naf extends Libs_Row
$valuesUndetermined = array_merge($valuesUndetermined, $this->getNafParent($value, true)); $valuesUndetermined = array_merge($valuesUndetermined, $this->getNafParent($value, true));
} }
} }
$nafM = new Table_Nafs(); $nafM = new Application_Model_Naf();
$sql = $nafM->select()->where('niveau = ?', $niveau)->order('code ASC'); $sql = $nafM->select()->where('niveau = ?', $niveau)->order('code ASC');
$result = $nafM->fetchAll($sql)->toArray(); $result = $nafM->fetchAll($sql)->toArray();
@ -25,8 +25,8 @@ class Object_Naf extends Libs_Row
$structure = array( $structure = array(
'data' => $item['code'].' - '.$item['lib'], 'data' => $item['code'].' - '.$item['lib'],
'attr' => array('id' => $item['code'], 'niveau' => $item['niveau']), 'attr' => array('id' => $item['code'], 'niveau' => $item['niveau']),
'state' => 'closed', 'state' => 'closed',
'children' => array(), 'children' => array(),
); );
if (in_array($item['code'], $valuesChecked)){ if (in_array($item['code'], $valuesChecked)){
$structure['attr']['class'] = 'jstree-checked'; $structure['attr']['class'] = 'jstree-checked';
@ -47,7 +47,7 @@ class Object_Naf extends Libs_Row
$new = substr($value,0,$niveau); $new = substr($value,0,$niveau);
$out = array_merge($out, array($new), $this->getNafParent($new, $niveau1)); $out = array_merge($out, array($new), $this->getNafParent($new, $niveau1));
} elseif (strlen($value)==2 && $niveau1 === true) { } elseif (strlen($value)==2 && $niveau1 === true) {
$nafM = new Table_Nafs(); $nafM = new Application_Model_Naf();
$sql = $nafM->select() $sql = $nafM->select()
->from($nafM, array('parent')) ->from($nafM, array('parent'))
->where('code = ?', $value); ->where('code = ?', $value);
@ -56,7 +56,7 @@ class Object_Naf extends Libs_Row
} }
return $out; return $out;
} }
public function ajax($parent, $niveau, $key) public function ajax($parent, $niveau, $key)
{ {
//Récupération des valeurs enregistrées en session //Récupération des valeurs enregistrées en session
@ -64,7 +64,7 @@ class Object_Naf extends Libs_Row
$sessionCiblage = new SessionCiblage(); $sessionCiblage = new SessionCiblage();
$val = $sessionCiblage->getCritere($key); $val = $sessionCiblage->getCritere($key);
$valuesChecked = array(); $valuesChecked = array();
$valuesUndetermined = array(); $valuesUndetermined = array();
if ($val != null){ if ($val != null){
$valuesChecked = explode(',',$val); $valuesChecked = explode(',',$val);
@ -72,9 +72,9 @@ class Object_Naf extends Libs_Row
$valuesUndetermined = array_merge($valuesUndetermined, $this->getNafParent($value)); $valuesUndetermined = array_merge($valuesUndetermined, $this->getNafParent($value));
} }
} }
$niveau++; $niveau++;
$nafM = new Table_Nafs(); $nafM = new Application_Model_Naf();
$sql = $nafM->select(); $sql = $nafM->select();
if (!empty($parent) && $niveau==2) { if (!empty($parent) && $niveau==2) {
$sql->where('parent = ?', $parent); $sql->where('parent = ?', $parent);
@ -82,7 +82,7 @@ class Object_Naf extends Libs_Row
$sql->where("code LIKE '".$parent."%'"); $sql->where("code LIKE '".$parent."%'");
} }
$sql->where('niveau = ?', $niveau)->order('code ASC'); $sql->where('niveau = ?', $niveau)->order('code ASC');
$result = $nafM->fetchAll($sql)->toArray(); $result = $nafM->fetchAll($sql)->toArray();
$tabNaf = array(); $tabNaf = array();
foreach($result as $item){ foreach($result as $item){

View File

@ -6,21 +6,21 @@ Class Ciblage
private $sphinx; private $sphinx;
private $alpha = ''; private $alpha = '';
private $presentRcs = 0; private $presentRcs = 0;
public $index = 'ciblage'; public $index = 'ciblage';
public $nb_results = 5000; public $nb_results = 5000;
public $max_results = 500000; public $max_results = 500000;
public $sphinx_match = SPH_MATCH_EXTENDED2; public $sphinx_match = SPH_MATCH_EXTENDED2;
public $sphinx_sort = SPH_SORT_EXTENDED; public $sphinx_sort = SPH_SORT_EXTENDED;
protected function setMinMax($name, $valeur) protected function setMinMax($name, $valeur)
{ {
/*if(!$this->need) {*/ /*if(!$this->need) {*/
if(!empty($name)) { if(!empty($name)) {
$default = Fields::getMinMax($name); $default = Fields::getMinMax($name);
if(empty($valeur[0])){$valeur[0] = $default[0]['min'];} if(empty($valeur[0])){$valeur[0] = $default[0]['min'];}
if(empty($valeur[1])){$valeur[1] = $default[0]['max'];} if(empty($valeur[1])){$valeur[1] = $default[0]['max'];}
} }
@ -63,7 +63,7 @@ Class Ciblage
'total' => count($resultats), 'total' => count($resultats),
'insee' => $this->calculRedevanceInsee(), 'insee' => $this->calculRedevanceInsee(),
'result'=> $siret 'result'=> $siret
); );
return $total; return $total;
} }
public function calculRedevanceInsee() public function calculRedevanceInsee()
@ -80,7 +80,7 @@ Class Ciblage
$siret[] = $element['attrs']['siren'].$element['attrs']['nic']; $siret[] = $element['attrs']['siren'].$element['attrs']['nic'];
} }
return ($siret); return ($siret);
} else } else
return (array()); return (array());
} }
public function execute($need = false, $limitD = false) public function execute($need = false, $limitD = false)
@ -110,10 +110,10 @@ Class Ciblage
protected function setFilterRange($name, $valeur) { protected function setFilterRange($name, $valeur) {
$this->sphinx->SetFilterRange($name, intval($valeur[0]), intval($valeur[1])); $this->sphinx->SetFilterRange($name, intval($valeur[0]), intval($valeur[1]));
} }
private function getListeDepartement() private function getListeDepartement()
{ {
$table = new Table_Departements(); $table = new Application_Model_Departements();
$sql = $table->select(); $sql = $table->select();
$result = $table->fetchAll($sql)->toArray(); $result = $table->fetchAll($sql)->toArray();
foreach ($result as $dept) { foreach ($result as $dept) {
@ -124,7 +124,7 @@ Class Ciblage
} }
protected function writeRequest($name, $valeur, $ex, $or = false) { protected function writeRequest($name, $valeur, $ex, $or = false) {
if(in_array($name, array('adr_com_ex', 'adr_dept_ex', 'bilType_ex', 'ape_etab_ex', 'ape_entrep_ex'))) { if(in_array($name, array('adr_com_ex', 'adr_dept_ex', 'bilType_ex', 'ape_etab_ex', 'ape_entrep_ex'))) {
if(!strstr($this->alpha, 'adr_dept') or if(!strstr($this->alpha, 'adr_dept') or
!strstr($this->alpha, 'ape_etab') or !strstr($this->alpha, 'ape_etab') or
!strstr($this->alpha, 'bilType') or !strstr($this->alpha, 'bilType') or
!strstr($this->alpha, 'ape_entrep')) { !strstr($this->alpha, 'ape_entrep')) {
@ -161,7 +161,7 @@ Class Ciblage
} }
$this->alpha .= ')'; $this->alpha .= ')';
} }
} }
protected function setAlpha($name, $valeur, $ex = false) protected function setAlpha($name, $valeur, $ex = false)
{ {
@ -181,7 +181,7 @@ Class Ciblage
protected function transformIntval($array) { protected function transformIntval($array) {
$copy = array(); $copy = array();
foreach($array as $item => $valeur) { foreach($array as $item => $valeur) {
$copy[$item] = intval($valeur); $copy[$item] = intval($valeur);
} }
return ($copy); return ($copy);
} }
@ -241,7 +241,7 @@ Class Ciblage
} }
protected function capital($valeur) { protected function capital($valeur) {
$valeur = $this->setMinMax($name, $valeur); $valeur = $this->setMinMax($name, $valeur);
$this->setFilterRange('capital', $valeur); $this->setFilterRange('capital', $valeur);
} }
protected function ape_etab($valeur) { protected function ape_etab($valeur) {
@ -310,12 +310,12 @@ Class Ciblage
} else { } else {
$format1 = explode('/', $valeur[0]); $format1 = explode('/', $valeur[0]);
$format2 = explode('/', $valeur[1]); $format2 = explode('/', $valeur[1]);
$valeur[0] = $format1[2].$format1[1].$format1[0]; $valeur[0] = $format1[2].$format1[1].$format1[0];
$valeur[1] = $format2[2].$format2[1].$format2[0]; $valeur[1] = $format2[2].$format2[1].$format2[0];
} }
$this->setFilterRange('dateCrea_etab', $valeur); $this->setFilterRange('dateCrea_etab', $valeur);
} }
protected function dateCrea_ent($valeur) { protected function dateCrea_ent($valeur) {
if(empty($valeur[1])) {$valeur[1] = date('Ymd');} if(empty($valeur[1])) {$valeur[1] = date('Ymd');}
@ -326,7 +326,7 @@ Class Ciblage
} else { } else {
$format1 = explode('/', $valeur[0]); $format1 = explode('/', $valeur[0]);
$format2 = explode('/', $valeur[1]); $format2 = explode('/', $valeur[1]);
$valeur[0] = $format1[2].$format1[1].$format1[0]; $valeur[0] = $format1[2].$format1[1].$format1[0];
$valeur[1] = $format2[2].$format2[1].$format2[0]; $valeur[1] = $format2[2].$format2[1].$format2[0];
} }
@ -341,7 +341,7 @@ Class Ciblage
} else { } else {
$format1 = explode('/', $valeur[0]); $format1 = explode('/', $valeur[0]);
$format2 = explode('/', $valeur[0]); $format2 = explode('/', $valeur[0]);
$valeur[0] = $format1[2].$format1[1].$format1[0]; $valeur[0] = $format1[2].$format1[1].$format1[0];
$valeur[1] = $format2[2].$format2[1].$format2[0]; $valeur[1] = $format2[2].$format2[1].$format2[0];
} }
@ -349,12 +349,12 @@ Class Ciblage
} }
protected function eff_entrep($valeur) { protected function eff_entrep($valeur) {
$valeur = $this->setMinMax($name, $valeur); $valeur = $this->setMinMax($name, $valeur);
$this->setFilter('eff_entrep', $valeur); $this->setFilter('eff_entrep', $valeur);
} }
protected function eff_etab($valeur) { protected function eff_etab($valeur) {
$valeur = $this->setMinMax($name, $valeur); $valeur = $this->setMinMax($name, $valeur);
$this->setFilter('eff_etab', $valeur); $this->setFilter('eff_etab', $valeur);
} }
protected function rivoli($valeur) { protected function rivoli($valeur) {
@ -369,7 +369,7 @@ Class Ciblage
} }
protected function nbActio($valeur) { protected function nbActio($valeur) {
$valeur = $this->setMinMax('nbActio', $valeur); $valeur = $this->setMinMax('nbActio', $valeur);
$this->setFilterRange('nbActio', $valeur); $this->setFilterRange('nbActio', $valeur);
} }
protected function nbMPubli($valeur) { protected function nbMPubli($valeur) {
@ -377,7 +377,7 @@ Class Ciblage
} }
protected function nbPart($valeur) { protected function nbPart($valeur) {
$valeur = $this->setMinMax('nbPart', $valeur); $valeur = $this->setMinMax('nbPart', $valeur);
$this->setFilterRange('nbPart', $valeur); $this->setFilterRange('nbPart', $valeur);
} }
protected function bilDuree($valeur) { protected function bilDuree($valeur) {
@ -443,7 +443,7 @@ Class Ciblage
protected function bilHD($valeur) { protected function bilHD($valeur) {
$valeur = $this->setMinMax('bilHD', $valeur); $valeur = $this->setMinMax('bilHD', $valeur);
$this->setFilterRange('bilHD', $valeur); $this->setFilterRange('bilHD', $valeur);
} }
protected function bilHL($valeur) { protected function bilHL($valeur) {
$valeur = $this->setMinMax('bilHL', $valeur); $valeur = $this->setMinMax('bilHL', $valeur);
$this->setFilterRange('bilHL', $valeur); $this->setFilterRange('bilHL', $valeur);
@ -507,7 +507,7 @@ Class Ciblage
} else { } else {
$format1 = explode('/', $valeur[0]); $format1 = explode('/', $valeur[0]);
$format2 = explode('/', $valeur[0]); $format2 = explode('/', $valeur[0]);
$valeur[0] = $format1[2].$format1[1].$format1[0]; $valeur[0] = $format1[2].$format1[1].$format1[0];
$valeur[1] = $format2[2].$format2[1].$format2[0]; $valeur[1] = $format2[2].$format2[1].$format2[0];
} }

View File

@ -1,20 +1,20 @@
<?php <?php
/** /**
* Structure * Structure
* [name] => array( * [name] => array(
* label => * label =>
* fields => array( * fields => array(
* select => array() * select => array()
* ... * ...
* ) * )
* famille => * famille =>
* activated => * activated =>
* type => * type =>
* *
* export => array( //Si présent paramètres pour l'enrichissement * export => array( //Si présent paramètres pour l'enrichissement
* 'label' => Libellé pour affichage dans l'enrichissement * 'label' => Libellé pour affichage dans l'enrichissement
* 'valuedesc' => array( / valeur => libellé / ) * 'valuedesc' => array( / valeur => libellé / )
* ) * )
* ) * )
*/ */
Class Fields Class Fields
@ -22,7 +22,7 @@ Class Fields
protected $fields = array protected $fields = array
( (
'siege' => array( 'siege' => array(
'label' => 'Type d\'établissement', 'label' => 'Type d\'établissement',
'fields' => array( 'fields' => array(
'select' => array('value' => array('1' => 'Sièges uniquement', '0' => 'Secondaires')), 'select' => array('value' => array('1' => 'Sièges uniquement', '0' => 'Secondaires')),
), ),
@ -31,7 +31,7 @@ Class Fields
'type' => 'select', 'type' => 'select',
), ),
'sirenGrp' => array( 'sirenGrp' => array(
'label' => 'Présence d\'un groupe', 'label' => 'Présence d\'un groupe',
'fields' => array( 'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non')), 'select' => array('value' => array('1' => 'Oui', '0' => 'Non')),
), ),
@ -40,7 +40,7 @@ Class Fields
'type' => 'select' 'type' => 'select'
), ),
'tel' => array( 'tel' => array(
'label' => 'Téléphone renseigné', 'label' => 'Téléphone renseigné',
'fields' => array( 'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non')) 'select' => array('value' => array('1' => 'Oui', '0' => 'Non'))
), ),
@ -49,7 +49,7 @@ Class Fields
'type' => 'select' 'type' => 'select'
), ),
'fax' => array( 'fax' => array(
'label' => 'Télécopie renseignée', 'label' => 'Télécopie renseignée',
'fields' => array( 'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non')) 'select' => array('value' => array('1' => 'Oui', '0' => 'Non'))
), ),
@ -59,7 +59,7 @@ Class Fields
'class' => null 'class' => null
), ),
'web' => array( 'web' => array(
'label' => 'Site Web renseigné', 'label' => 'Site Web renseigné',
'fields' => array( 'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non')) 'select' => array('value' => array('1' => 'Oui', '0' => 'Non'))
), ),
@ -69,7 +69,7 @@ Class Fields
'class' => null 'class' => null
), ),
'mail' => array( 'mail' => array(
'label' => 'Email de contact renseigné', 'label' => 'Email de contact renseigné',
'fields' => array( 'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non')) 'select' => array('value' => array('1' => 'Oui', '0' => 'Non'))
), ),
@ -79,7 +79,7 @@ Class Fields
'class' => null 'class' => null
), ),
'presentRcs' => array( 'presentRcs' => array(
'label' => 'Etablissement présent au RNCS', 'label' => 'Etablissement présent au RNCS',
'fields' => array( 'fields' => array(
'select' => array('value' => array('1' => 'Etablissement présent au RNCS', '0' => 'Non')) 'select' => array('value' => array('1' => 'Etablissement présent au RNCS', '0' => 'Non'))
), ),
@ -89,7 +89,7 @@ Class Fields
'class' => null 'class' => null
), ),
'adrDom' => array( 'adrDom' => array(
'label' => 'Adresse de domiciliation', 'label' => 'Adresse de domiciliation',
'fields' => array( 'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non')) 'select' => array('value' => array('1' => 'Oui', '0' => 'Non'))
), ),
@ -99,7 +99,7 @@ Class Fields
'class' => null 'class' => null
), ),
'dirNom' => array( 'dirNom' => array(
'label' => 'Nom du principal dirigeant', 'label' => 'Nom du principal dirigeant',
'fields' => array( 'fields' => array(
'select' => array('value' => array('1' => 'Principal dirigeant renseigné', '0' => 'Non')) 'select' => array('value' => array('1' => 'Principal dirigeant renseigné', '0' => 'Non'))
), ),
@ -109,7 +109,7 @@ Class Fields
'class' => null 'class' => null
), ),
'lieuAct' => array( 'lieuAct' => array(
'label' => 'Lieu d\'activté', 'label' => 'Lieu d\'activté',
'fields' => array( 'fields' => array(
'interval' => array('value' => array('0', '1000')), 'interval' => array('value' => array('0', '1000')),
'textarea' => array('value' => null) 'textarea' => array('value' => null)
@ -120,7 +120,7 @@ Class Fields
'class' => null 'class' => null
), ),
'nbMPubli' => array( 'nbMPubli' => array(
'label' => 'Marchés publiques remportés', 'label' => 'Marchés publiques remportés',
'fields' => array( 'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non')) 'select' => array('value' => array('1' => 'Oui', '0' => 'Non'))
), ),
@ -130,7 +130,7 @@ Class Fields
'class' => null 'class' => null
), ),
'dateCrea_ent' => array( 'dateCrea_ent' => array(
'label' => 'Date de création de l\'entreprise', 'label' => 'Date de création de l\'entreprise',
'fields' => array( 'fields' => array(
'interval' => array('value' => array('0', '1000')) 'interval' => array('value' => array('0', '1000'))
), ),
@ -140,7 +140,7 @@ Class Fields
'class' => 'datepicker' 'class' => 'datepicker'
), ),
'dateCrea_etab' => array( 'dateCrea_etab' => array(
'label' => 'Date de création de l\'établissement', 'label' => 'Date de création de l\'établissement',
'fields' => array( 'fields' => array(
'interval' => array('value' => array('0', '1000')) 'interval' => array('value' => array('0', '1000'))
), ),
@ -160,7 +160,7 @@ Class Fields
'class' => null 'class' => null
), ),
'nbActio' => array( 'nbActio' => array(
'label' => 'Nombre d\'actionnaires connus', 'label' => 'Nombre d\'actionnaires connus',
'fields' => array( 'fields' => array(
'interval' => array('value' => array('0', '1000')) 'interval' => array('value' => array('0', '1000'))
), ),
@ -170,7 +170,7 @@ Class Fields
'class' => null 'class' => null
), ),
'part' => array( 'part' => array(
'label' => 'Nombre de participations connues', 'label' => 'Nombre de participations connues',
'fields' => array( 'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non')) 'select' => array('value' => array('1' => 'Oui', '0' => 'Non'))
), ),
@ -180,7 +180,7 @@ Class Fields
'class' => null 'class' => null
), ),
'nbPart' => array( 'nbPart' => array(
'label' => 'Nombre de participations connues', 'label' => 'Nombre de participations connues',
'fields' => array( 'fields' => array(
'interval' => array('value' => array('0', '1000')) 'interval' => array('value' => array('0', '1000'))
), ),
@ -191,7 +191,7 @@ Class Fields
), ),
// economique // economique
'ape_etab' => array( 'ape_etab' => array(
'label' => 'Activité de l\'établissement (Code NAF)', 'label' => 'Activité de l\'établissement (Code NAF)',
'fields' => array( 'fields' => array(
'text' => array('value' => null), 'text' => array('value' => null),
'textarea' => array('value' => null) 'textarea' => array('value' => null)
@ -204,7 +204,7 @@ Class Fields
'title' => 'Selection des codes NAF etablissement' 'title' => 'Selection des codes NAF etablissement'
), ),
'ape_etab_ex' => array( 'ape_etab_ex' => array(
'label' => 'Activité de l\'établissement (Exclure)', 'label' => 'Activité de l\'établissement (Exclure)',
'fields' => array( 'fields' => array(
'text' => array('value' => null), 'text' => array('value' => null),
'textarea' => array('value' => null) 'textarea' => array('value' => null)
@ -217,7 +217,7 @@ Class Fields
'title' => 'Selection des codes NAF etablissement' 'title' => 'Selection des codes NAF etablissement'
), ),
'ape_entrep' => array( 'ape_entrep' => array(
'label' => 'Activité de l\'entreprise (Code NAF)', 'label' => 'Activité de l\'entreprise (Code NAF)',
'fields' => array( 'fields' => array(
'text' => array('value' => null), 'text' => array('value' => null),
'textarea' => array('value' => null) 'textarea' => array('value' => null)
@ -230,7 +230,7 @@ Class Fields
'title' => 'Selection des codes NAF entreprise' 'title' => 'Selection des codes NAF entreprise'
), ),
'ape_entrep_ex' => array( 'ape_entrep_ex' => array(
'label' => 'Activité de l\'entreprise (Exclure)', 'label' => 'Activité de l\'entreprise (Exclure)',
'fields' => array( 'fields' => array(
'text' => array('value' => null), 'text' => array('value' => null),
'textarea' => array('value' => null) 'textarea' => array('value' => null)
@ -243,7 +243,7 @@ Class Fields
'title' => 'Selection des codes NAF entreprise' 'title' => 'Selection des codes NAF entreprise'
), ),
'NaceEtab' => array( 'NaceEtab' => array(
'label' => 'Code NACE de l\'établissement', 'label' => 'Code NACE de l\'établissement',
'fields' => array( 'fields' => array(
'text' => array('value' => null), 'text' => array('value' => null),
'textarea' => array('value' => null) 'textarea' => array('value' => null)
@ -254,7 +254,7 @@ Class Fields
'class' => null 'class' => null
), ),
'NaceEntrep' => array( 'NaceEntrep' => array(
'label' => 'Code NACE de l\'entreprise', 'label' => 'Code NACE de l\'entreprise',
'fields' => array( 'fields' => array(
'text' => array('value' => null), 'text' => array('value' => null),
'textarea' => array('value' => null) 'textarea' => array('value' => null)
@ -265,7 +265,7 @@ Class Fields
'class' => null 'class' => null
), ),
'age_etab' => array( 'age_etab' => array(
'label' => 'Age de l\'entreprise', 'label' => 'Age de l\'entreprise',
'fields' => array( 'fields' => array(
'interval' => array('value' => null) 'interval' => array('value' => null)
), ),
@ -275,7 +275,7 @@ Class Fields
'class' => null 'class' => null
), ),
'age_entrep' => array( 'age_entrep' => array(
'label' => 'Age de l\'établissement', 'label' => 'Age de l\'établissement',
'fields' => array( 'fields' => array(
'interval' => array('value' => null) 'interval' => array('value' => null)
), ),
@ -285,7 +285,7 @@ Class Fields
'class' => null 'class' => null
), ),
'teff_entrep' => array( 'teff_entrep' => array(
'label' => 'Tranche d\'effectif de l\'Entreprise', 'label' => 'Tranche d\'effectif de l\'Entreprise',
'fields' => array( 'fields' => array(
'intervalSelect' => array('value' => array( 'intervalSelect' => array('value' => array(
array('0', '1 ou 2'), array('0', '1 ou 2'),
@ -311,7 +311,7 @@ Class Fields
'class' => null, 'class' => null,
), ),
'teff_etab' => array( 'teff_etab' => array(
'label' => 'Tranche d\'effectif de l\'établissement', 'label' => 'Tranche d\'effectif de l\'établissement',
'fields' => array( 'fields' => array(
'intervalSelect' => array( 'intervalSelect' => array(
'value' => array( 'value' => array(
@ -339,7 +339,7 @@ Class Fields
'class' => null 'class' => null
), ),
'teff_etabM' => array( 'teff_etabM' => array(
'label' => 'Tranche d\'effectif de l\'établissement M', 'label' => 'Tranche d\'effectif de l\'établissement M',
'fields' => array( 'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non')) 'select' => array('value' => array('1' => 'Oui', '0' => 'Non'))
), ),
@ -349,7 +349,7 @@ Class Fields
'class' => null 'class' => null
), ),
'teff_entrepM' => array( 'teff_entrepM' => array(
'label' => 'Tranche d\'effectif de l\'entreprise M', 'label' => 'Tranche d\'effectif de l\'entreprise M',
'fields' => array( 'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non')) 'select' => array('value' => array('1' => 'Oui', '0' => 'Non'))
), ),
@ -359,7 +359,7 @@ Class Fields
'class' => null 'class' => null
), ),
'nbEtab' => array( 'nbEtab' => array(
'label' => 'Nombre d\'établissements', 'label' => 'Nombre d\'établissements',
'fields' => array( 'fields' => array(
'interval' => array('value' => array('0', '10000000')) 'interval' => array('value' => array('0', '10000000'))
), ),
@ -369,7 +369,7 @@ Class Fields
'class' => null 'class' => null
), ),
'eff_entrep' => array( 'eff_entrep' => array(
'label' => 'Effectif réel de l\'entreprise', 'label' => 'Effectif réel de l\'entreprise',
'fields' => array( 'fields' => array(
'interval' => array('value' => array('0', '10000000')) 'interval' => array('value' => array('0', '10000000'))
), ),
@ -379,7 +379,7 @@ Class Fields
'class' => null 'class' => null
), ),
'eff_etab' => array( 'eff_etab' => array(
'label' => 'Effectif réel de l\'établissement', 'label' => 'Effectif réel de l\'établissement',
'fields' => array( 'fields' => array(
'interval' => array('value' => array('0', '10000000')) 'interval' => array('value' => array('0', '10000000'))
), ),
@ -389,7 +389,7 @@ Class Fields
'class' => null 'class' => null
), ),
'capital' => array( 'capital' => array(
'label' => 'Capital de l\'entreprise', 'label' => 'Capital de l\'entreprise',
'fields' => array( 'fields' => array(
'intervalSelect' => array( 'intervalSelect' => array(
'value' => array( 'value' => array(
@ -409,7 +409,7 @@ Class Fields
), ),
//geographique //geographique
'adr_com' => array( 'adr_com' => array(
'label' => 'Localisation géographique', 'label' => 'Localisation géographique',
'fields' => array( 'fields' => array(
'text' => array('value' => null), 'text' => array('value' => null),
'textarea' => array('value' => null) 'textarea' => array('value' => null)
@ -422,7 +422,7 @@ Class Fields
'title' => 'Localisation' 'title' => 'Localisation'
), ),
'adr_com_ex' => array( 'adr_com_ex' => array(
'label' => 'Localisation Villes (Exclure)', 'label' => 'Localisation Villes (Exclure)',
'fields' => array( 'fields' => array(
'text' => array('value' => null), 'text' => array('value' => null),
'textarea' => array('value' => null) 'textarea' => array('value' => null)
@ -435,7 +435,7 @@ Class Fields
'title' => 'Localisation' 'title' => 'Localisation'
), ),
'adr_dept' => array( 'adr_dept' => array(
'label' => 'Liste départements', 'label' => 'Liste départements',
'fields' => array( 'fields' => array(
'text' => array('value' => null), 'text' => array('value' => null),
'textarea' => array('value' => null) 'textarea' => array('value' => null)
@ -448,7 +448,7 @@ Class Fields
'title' => 'Localisation' 'title' => 'Localisation'
), ),
'adr_dept_ex' => array( 'adr_dept_ex' => array(
'label' => 'Liste départements (Exclure)', 'label' => 'Liste départements (Exclure)',
'fields' => array( 'fields' => array(
'text' => array('value' => null), 'text' => array('value' => null),
'textarea' => array('value' => null) 'textarea' => array('value' => null)
@ -461,7 +461,7 @@ Class Fields
'title' => 'Localisation' 'title' => 'Localisation'
), ),
'ex_domtom' => array( 'ex_domtom' => array(
'label' => 'Exclusion des Dom-Tom', 'label' => 'Exclusion des Dom-Tom',
'fields' => array( 'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non')), 'select' => array('value' => array('1' => 'Oui', '0' => 'Non')),
), ),
@ -473,7 +473,7 @@ Class Fields
'title' => 'Localisation' 'title' => 'Localisation'
), ),
'ex_entr' => array( 'ex_entr' => array(
'label' => 'Exclusion départements étrangés', 'label' => 'Exclusion départements étrangés',
'fields' => array( 'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non')), 'select' => array('value' => array('1' => 'Oui', '0' => 'Non')),
), ),
@ -485,7 +485,7 @@ Class Fields
'title' => 'Localisation' 'title' => 'Localisation'
), ),
'ex_corse' => array( 'ex_corse' => array(
'label' => 'Exclusion corse', 'label' => 'Exclusion corse',
'fields' => array( 'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non')), 'select' => array('value' => array('1' => 'Oui', '0' => 'Non')),
), ),
@ -497,7 +497,7 @@ Class Fields
'title' => 'Localisation' 'title' => 'Localisation'
), ),
'adr_reg' => array( 'adr_reg' => array(
'label' => 'Liste code région', 'label' => 'Liste code région',
'fields' => array( 'fields' => array(
'text' => array('value' => null), 'text' => array('value' => null),
'textarea' => array('value' => null) 'textarea' => array('value' => null)
@ -510,7 +510,7 @@ Class Fields
'title' => 'Localisation' 'title' => 'Localisation'
), ),
'adr_reg_ex' => array( 'adr_reg_ex' => array(
'label' => 'Liste code région (Exclure)', 'label' => 'Liste code région (Exclure)',
'fields' => array( 'fields' => array(
'text' => array('value' => null), 'text' => array('value' => null),
'textarea' => array('value' => null) 'textarea' => array('value' => null)
@ -523,7 +523,7 @@ Class Fields
'title' => 'Localisation' 'title' => 'Localisation'
), ),
'zus' => array( 'zus' => array(
'label' => 'Zones urbaines sensibles', 'label' => 'Zones urbaines sensibles',
'fields' => array( 'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non')), 'select' => array('value' => array('1' => 'Oui', '0' => 'Non')),
), ),
@ -532,7 +532,7 @@ Class Fields
'type' => 'select', 'type' => 'select',
), ),
'zru' => array( 'zru' => array(
'label' => 'Zones de redynamisation urbaine', 'label' => 'Zones de redynamisation urbaine',
'fields' => array( 'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non')), 'select' => array('value' => array('1' => 'Oui', '0' => 'Non')),
), ),
@ -541,7 +541,7 @@ Class Fields
'type' => 'select', 'type' => 'select',
), ),
'zfu' => array( 'zfu' => array(
'label' => 'zones franches urbaines', 'label' => 'zones franches urbaines',
'fields' => array( 'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non')), 'select' => array('value' => array('1' => 'Oui', '0' => 'Non')),
), ),
@ -550,7 +550,7 @@ Class Fields
'type' => 'select', 'type' => 'select',
), ),
'cucs' => array( 'cucs' => array(
'label' => 'Contrats urbains de cohésion sociale', 'label' => 'Contrats urbains de cohésion sociale',
'fields' => array( 'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non')), 'select' => array('value' => array('1' => 'Oui', '0' => 'Non')),
), ),
@ -559,7 +559,7 @@ Class Fields
'type' => 'select', 'type' => 'select',
), ),
'zrr' => array( 'zrr' => array(
'label' => 'Zone de revitalisation rurale', 'label' => 'Zone de revitalisation rurale',
'fields' => array( 'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non')), 'select' => array('value' => array('1' => 'Oui', '0' => 'Non')),
), ),
@ -568,7 +568,7 @@ Class Fields
'type' => 'select', 'type' => 'select',
), ),
'zafr' => array( 'zafr' => array(
'label' => 'Zones Aide à finalité régionale', 'label' => 'Zones Aide à finalité régionale',
'fields' => array( 'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non')), 'select' => array('value' => array('1' => 'Oui', '0' => 'Non')),
), ),
@ -578,7 +578,7 @@ Class Fields
), ),
//juridique //juridique
'cj' => array( 'cj' => array(
'label' => 'Forme Juridique', 'label' => 'Forme Juridique',
'fields' => array( 'fields' => array(
'text' => array('value' => null), 'text' => array('value' => null),
'textarea' => array('value' => null) 'textarea' => array('value' => null)
@ -591,7 +591,7 @@ Class Fields
'title' => 'Forme Juridique' 'title' => 'Forme Juridique'
), ),
'cj_ex' => array( 'cj_ex' => array(
'label' => 'Forme Juridique (Exclure)', 'label' => 'Forme Juridique (Exclure)',
'fields' => array( 'fields' => array(
'text' => array('value' => null), 'text' => array('value' => null),
'textarea' => array('value' => null) 'textarea' => array('value' => null)
@ -604,7 +604,7 @@ Class Fields
'title' => 'Forme Juridique' 'title' => 'Forme Juridique'
), ),
'actifEco' => array( 'actifEco' => array(
'label' => 'Établissement économiquement actif', 'label' => 'Établissement économiquement actif',
'fields' => array( 'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non')), 'select' => array('value' => array('1' => 'Oui', '0' => 'Non')),
), ),
@ -614,7 +614,7 @@ Class Fields
'class' => null 'class' => null
), ),
'procolHisto' => array( 'procolHisto' => array(
'label' => 'Présence procédure collective dans histo', 'label' => 'Présence procédure collective dans histo',
'fields' => array( 'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non')), 'select' => array('value' => array('1' => 'Oui', '0' => 'Non')),
), ),
@ -624,7 +624,7 @@ Class Fields
'class' => null 'class' => null
), ),
'tvaIntraValide' => array( 'tvaIntraValide' => array(
'label' => 'Numéro de TVA intracommunautaire valide', 'label' => 'Numéro de TVA intracommunautaire valide',
'fields' => array( 'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non')), 'select' => array('value' => array('1' => 'Oui', '0' => 'Non')),
), ),
@ -634,7 +634,7 @@ Class Fields
'class' => null 'class' => null
), ),
'dateImmat' => array( 'dateImmat' => array(
'label' => 'Date d\'immatriculation', 'label' => 'Date d\'immatriculation',
'fields' => array( 'fields' => array(
'interval' => array('value' => array('0', '1000')) 'interval' => array('value' => array('0', '1000'))
), ),
@ -645,11 +645,11 @@ Class Fields
), ),
//financier //financier
'bilType' => array( 'bilType' => array(
'label' => 'Type du dernier bilan', 'label' => 'Type du dernier bilan',
'fields' => array( 'fields' => array(
'selectMultiple' => array('value' => array( 'selectMultiple' => array('value' => array(
'I' => 'Inconnue', 'I' => 'Inconnue',
'R' => 'Réel', 'R' => 'Réel',
'E' => 'Estimé') 'E' => 'Estimé')
), ),
), ),
@ -659,11 +659,11 @@ Class Fields
'class' => null 'class' => null
), ),
'bilType_ex' => array( 'bilType_ex' => array(
'label' => 'Type du dernier bilan (Exclure)', 'label' => 'Type du dernier bilan (Exclure)',
'fields' => array( 'fields' => array(
'selectMultiple' => array('value' => array( 'selectMultiple' => array('value' => array(
'I' => 'Inconnue', 'I' => 'Inconnue',
'R' => 'Réel', 'R' => 'Réel',
'E' => 'Estimé') 'E' => 'Estimé')
), ),
), ),
@ -673,11 +673,11 @@ Class Fields
'class' => null 'class' => null
), ),
'avisCs' => array( 'avisCs' => array(
'label' => 'Informations de paiements', 'label' => 'Informations de paiements',
'fields' => array( 'fields' => array(
'selectMultiple' => array('value' => array( 'selectMultiple' => array('value' => array(
'' => 'Risque indéterminé', '' => 'Risque indéterminé',
'00' => 'Aucun risque resencé', '00' => 'Aucun risque resencé',
'10' => 'Présence d\'impayé(s)', '10' => 'Présence d\'impayé(s)',
'15' => 'Présence de privilèges', '15' => 'Présence de privilèges',
'23-29-39-43' => 'Risque moyen', '23-29-39-43' => 'Risque moyen',
@ -692,11 +692,11 @@ Class Fields
'class' => null 'class' => null
), ),
'avisCs_ex' => array( 'avisCs_ex' => array(
'label' => 'Informations de paiements (Exclure)', 'label' => 'Informations de paiements (Exclure)',
'fields' => array( 'fields' => array(
'selectMultiple' => array('value' => array( 'selectMultiple' => array('value' => array(
'' => 'Risque indéterminé', '' => 'Risque indéterminé',
'00' => 'Aucun risque resencé', '00' => 'Aucun risque resencé',
'10' => 'Présence d\'impayé(s)', '10' => 'Présence d\'impayé(s)',
'15' => 'Présence de privilèges', '15' => 'Présence de privilèges',
'23-29-39-43' => 'Risque moyen', '23-29-39-43' => 'Risque moyen',
@ -711,7 +711,7 @@ Class Fields
'class' => null 'class' => null
), ),
'bilDuree' => array( 'bilDuree' => array(
'label' => 'Durée du dernier bilan en mois', 'label' => 'Durée du dernier bilan en mois',
'fields' => array( 'fields' => array(
'intervalSelect' => array( 'intervalSelect' => array(
'value' => array( 'value' => array(
@ -729,7 +729,7 @@ Class Fields
'class' => null 'class' => null
), ),
'bilTca' => array( 'bilTca' => array(
'label' => 'Tranche de CA issue du bilan', 'label' => 'Tranche de CA issue du bilan',
'fields' => array( 'fields' => array(
'selectMultiple' => array('value' => array( 'selectMultiple' => array('value' => array(
'0' => 'Non déterminée', '0' => 'Non déterminée',
@ -750,7 +750,7 @@ Class Fields
'class' => null 'class' => null
), ),
'bilTca_ex' => array( 'bilTca_ex' => array(
'label' => 'Tranche de CA issue du bilan (Exclure)', 'label' => 'Tranche de CA issue du bilan (Exclure)',
'fields' => array( 'fields' => array(
'selectMultiple' => array('value' => array( 'selectMultiple' => array('value' => array(
'0' => 'Non déterminée', '0' => 'Non déterminée',
@ -771,7 +771,7 @@ Class Fields
'class' => null 'class' => null
), ),
'bilAnnee' => array( 'bilAnnee' => array(
'label' => 'Dernière année de bilan', 'label' => 'Dernière année de bilan',
'fields' => array( 'fields' => array(
'interval' => array('value' => array('0', '1000')) 'interval' => array('value' => array('0', '1000'))
), ),
@ -781,7 +781,7 @@ Class Fields
'class' => null 'class' => null
), ),
'bilCloture' => array( 'bilCloture' => array(
'label' => 'Dernière date de clôture du bilan', 'label' => 'Dernière date de clôture du bilan',
'fields' => array( 'fields' => array(
'interval' => array('value' => array('0', '1000')) 'interval' => array('value' => array('0', '1000'))
), ),
@ -791,7 +791,7 @@ Class Fields
'class' => 'datepicker' 'class' => 'datepicker'
), ),
'bilEE' => array( 'bilEE' => array(
'label' => 'Total bilan (EE)', 'label' => 'Total bilan (EE)',
'fields' => array( 'fields' => array(
'interval' => array('value' => array('0', '10000000')) 'interval' => array('value' => array('0', '10000000'))
), ),
@ -801,7 +801,7 @@ Class Fields
'class' => null 'class' => null
), ),
'bilFL' => array( 'bilFL' => array(
'label' => 'CA total (FL)', 'label' => 'CA total (FL)',
'fields' => array( 'fields' => array(
'interval' => array('value' => array('0', '10000000')) 'interval' => array('value' => array('0', '10000000'))
), ),
@ -811,7 +811,7 @@ Class Fields
'class' => null 'class' => null
), ),
'bilFK' => array( 'bilFK' => array(
'label' => 'Chiffre d\'affaires Export (FK)', 'label' => 'Chiffre d\'affaires Export (FK)',
'fields' => array( 'fields' => array(
'interval' => array('value' => array('0', '10000000')) 'interval' => array('value' => array('0', '10000000'))
), ),
@ -821,7 +821,7 @@ Class Fields
'class' => null 'class' => null
), ),
'bilFR' => array( 'bilFR' => array(
'label' => 'Produits d\'Exploitation (FR)', 'label' => 'Produits d\'Exploitation (FR)',
'fields' => array( 'fields' => array(
'interval' => array('value' => array('0', '10000000')) 'interval' => array('value' => array('0', '10000000'))
), ),
@ -831,7 +831,7 @@ Class Fields
'class' => null 'class' => null
), ),
'bilGF' => array( 'bilGF' => array(
'label' => 'Charges d\'Exploitation (GF)', 'label' => 'Charges d\'Exploitation (GF)',
'fields' => array( 'fields' => array(
'interval' => array('value' => array('0', '10000000')) 'interval' => array('value' => array('0', '10000000'))
), ),
@ -841,7 +841,7 @@ Class Fields
'class' => null 'class' => null
), ),
'bilGP' => array( 'bilGP' => array(
'label' => 'Charges Financières (GP)', 'label' => 'Charges Financières (GP)',
'fields' => array( 'fields' => array(
'interval' => array('value' => array('0', '10000000')) 'interval' => array('value' => array('0', '10000000'))
), ),
@ -851,7 +851,7 @@ Class Fields
'class' => null 'class' => null
), ),
'bilGW' => array( 'bilGW' => array(
'label' => 'R.C.A.I - Résultat courant av. impôt (GW)', 'label' => 'R.C.A.I - Résultat courant av. impôt (GW)',
'fields' => array( 'fields' => array(
'interval' => array('value' => array('0', '10000000')) 'interval' => array('value' => array('0', '10000000'))
), ),
@ -861,7 +861,7 @@ Class Fields
'class' => null 'class' => null
), ),
'bilHD' => array( 'bilHD' => array(
'label' => 'Produits Exceptionnels (HD)', 'label' => 'Produits Exceptionnels (HD)',
'fields' => array( 'fields' => array(
'interval' => array('value' => array('0', '10000000')) 'interval' => array('value' => array('0', '10000000'))
), ),
@ -871,7 +871,7 @@ Class Fields
'class' => null 'class' => null
), ),
'bilHH' => array( 'bilHH' => array(
'label' => 'Charges Exceptionnels (HH)', 'label' => 'Charges Exceptionnels (HH)',
'fields' => array( 'fields' => array(
'interval' => array('value' => array('0', '10000000')) 'interval' => array('value' => array('0', '10000000'))
), ),
@ -881,7 +881,7 @@ Class Fields
'class' => null 'class' => null
), ),
'bilHL' => array( 'bilHL' => array(
'label' => 'Total des Produits (HL)', 'label' => 'Total des Produits (HL)',
'fields' => array( 'fields' => array(
'interval' => array('value' => array('0', '10000000')) 'interval' => array('value' => array('0', '10000000'))
), ),
@ -891,7 +891,7 @@ Class Fields
'class' => null 'class' => null
), ),
'bilHM' => array( 'bilHM' => array(
'label' => 'Total des Charges (HM)', 'label' => 'Total des Charges (HM)',
'fields' => array( 'fields' => array(
'interval' => array('value' => array('0', '10000000')) 'interval' => array('value' => array('0', '10000000'))
), ),
@ -901,7 +901,7 @@ Class Fields
'class' => null 'class' => null
), ),
'bilHN' => array( 'bilHN' => array(
'label' => 'Résultat (HN)', 'label' => 'Résultat (HN)',
'fields' => array( 'fields' => array(
'interval' => array('value' => array('0', '10000000')) 'interval' => array('value' => array('0', '10000000'))
), ),
@ -911,7 +911,7 @@ Class Fields
'class' => null 'class' => null
), ),
'bilYP' => array( 'bilYP' => array(
'label' => 'Effectif salarié (YP)', 'label' => 'Effectif salarié (YP)',
'fields' => array( 'fields' => array(
'interval' => array('value' => array('0', '10000000')) 'interval' => array('value' => array('0', '10000000'))
), ),
@ -922,13 +922,13 @@ Class Fields
) )
); );
protected $requeteSql = array('cj'); protected $requeteSql = array('cj');
public function getValues($val = null) public function getValues($val = null)
{ {
if ( $val === null ) { if ( $val === null ) {
require_once 'Scores/SessionCiblage.php'; require_once 'Scores/SessionCiblage.php';
$session = new SessionCiblage(); $session = new SessionCiblage();
$val = $session->getCriteres(); $val = $session->getCriteres();
} }
$values = array(); $values = array();
foreach($val as $key => $item) foreach($val as $key => $item)
@ -936,7 +936,7 @@ Class Fields
if($item != '') { if($item != '') {
if( $this->fields[$key]['type'] == 'interval' or if( $this->fields[$key]['type'] == 'interval' or
$this->fields[$key]['type'] == 'intervalSelect' or $this->fields[$key]['type'] == 'intervalSelect' or
$this->fields[$key]['type'] == 'textarea' and $this->fields[$key]['type'] == 'textarea' and
empty($this->fields[$key]['action'])) empty($this->fields[$key]['action']))
{ {
$values[$key] = explode(',', $item); $values[$key] = explode(',', $item);
@ -961,7 +961,7 @@ Class Fields
} }
return ($values); return ($values);
} }
public function selectArbo($name, $valeur) public function selectArbo($name, $valeur)
{ {
$values = array(); $values = array();
@ -1012,14 +1012,14 @@ Class Fields
} }
return ($values); return ($values);
} }
protected function fj($name, $valeur) protected function fj($name, $valeur)
{ {
$table = new Table_Formejuridiques(); $table = new Application_Model_FormJuridique();
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.'"');
@ -1032,13 +1032,13 @@ Class Fields
} }
return ($return); return ($return);
} }
protected function localisationArbo($name, $valeur) protected function localisationArbo($name, $valeur)
{ {
if(strlen($valeur) == 2) { if(strlen($valeur) == 2) {
switch($name) { switch($name) {
case 'adr_reg': case 'adr_reg':
$table = new Table_Departements(); $table = new Application_Model_Departements();
$sql = $table->select() $sql = $table->select()
->from('departements') ->from('departements')
->where('codeRegionInsee ='.$valeur) ->where('codeRegionInsee ='.$valeur)
@ -1057,14 +1057,14 @@ Class Fields
return (array($valeur)); return (array($valeur));
return ($return); return ($return);
} }
protected function nafArbo($key, $valeur) protected function nafArbo($key, $valeur)
{ {
$value = array(); $value = array();
$table = new Table_Nafs(); $table = new Application_Model_Naf();
$valeur = trim($valeur); $valeur = trim($valeur);
if(strlen($valeur) == 1) if(strlen($valeur) == 1)
{ {
$sql = $table->select()->where('parent = ?', $valeur); $sql = $table->select()->where('parent = ?', $valeur);
$result =$table->fetchAll($sql)->toArray(); $result =$table->fetchAll($sql)->toArray();
@ -1082,7 +1082,7 @@ Class Fields
} }
return ($value); return ($value);
} }
public function __construct($batch = false) public function __construct($batch = false)
{ {
if(!$batch) { if(!$batch) {
@ -1090,38 +1090,38 @@ Class Fields
if($this->fields[$name]['type'] == 'interval') { if($this->fields[$name]['type'] == 'interval') {
$minmax = $this->getMinMax($name); $minmax = $this->getMinMax($name);
if(!empty($minmax)) { if(!empty($minmax)) {
$this->fields[$name]['fields'][$this->fields[$name]['type']]['value'] $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)
{ {
$tab = array('dateCrea_ent','dateCrea_etab'); $tab = array('dateCrea_ent','dateCrea_etab');
if(!in_array($name, $tab)) { if(!in_array($name, $tab)) {
$table = new Table_Minmaxs(); $table = new Application_Model_MinMax();
return ($table->fetchAll($table->select()->where('cle = ?', $name))->toArray()); return ($table->fetchAll($table->select()->where('cle = ?', $name))->toArray());
} }
return (array()); return (array());
} }
public function getFields() { public function getFields() {
return ($this->fields); return ($this->fields);
} }
public function get($name) { public function get($name) {
if($this->fields[$name]['activated'] == true) if($this->fields[$name]['activated'] == true)
return ($this->fields[$name]); return ($this->fields[$name]);
return (null); return (null);
} }
public function getByFamille($famille) public function getByFamille($famille)
{ {
$section = array(); $section = array();
foreach($this->fields as $name => $item) { foreach($this->fields as $name => $item) {
if($item['famille'] == $famille) { if($item['famille'] == $famille) {
$section[$name] = $item; $section[$name] = $item;
@ -1129,7 +1129,7 @@ Class Fields
} }
return ($section); return ($section);
} }
public function getNotActivated($fields) public function getNotActivated($fields)
{ {
foreach($fields as $name => $field) foreach($fields as $name => $field)
@ -1137,12 +1137,12 @@ Class Fields
if(!$field['activated']) { if(!$field['activated']) {
$desactivated[$name] = ""; $desactivated[$name] = "";
} else if ($field['activated']){ } else if ($field['activated']){
} }
} }
return (json_encode($desactivated)); return (json_encode($desactivated));
} }
public function getLibelle($name) public function getLibelle($name)
{ {
return ($this->fields[$name]['label']); return ($this->fields[$name]['label']);