diff --git a/application/controllers/ComptageController.php b/application/controllers/ComptageController.php index 50c148b0..15e1a3db 100644 --- a/application/controllers/ComptageController.php +++ b/application/controllers/ComptageController.php @@ -10,13 +10,13 @@ class ComptageController extends Zend_Controller_Action { $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); - + $request = $this->getRequest(); - + $object = new Object_Comptage(); echo $object->count($request->getParam('cle'), $request->getParam('valeur')); } - + public function resetAction() { require_once 'Scores/SessionCiblage.php'; @@ -26,7 +26,7 @@ class ComptageController extends Zend_Controller_Action unset($erreurs->erreurs); $this->_redirect('./'); } - + public function savedialogAction() { $this->_helper->layout()->disableLayout(); @@ -35,41 +35,41 @@ class ComptageController extends Zend_Controller_Action $session = new SessionCiblage(); $criteres = $session->getCriteres(); $this->view->criteres = $criteres; - + if (count($criteres) == 0) { $this->view->noSelection = true; } } - + public function saveAction() { $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); - $request = $this->getRequest(); + $request = $this->getRequest(); $object = new Object_Comptage(); $object->saveComptage($request->getParam('ref', '')); } - + public function updateAction() - { + { $this->_helper->layout()->disableLayout(); $request = $this->getRequest(); $idCriteres = $request->getParam('id'); - + //Récupération des critères du ciblage - $criteresM = new Table_Criteres(); + $criteresM = new Application_Model_Criteres(); $criteresRow = $criteresM->find($idCriteres); - $criteres = $criteresRow->current(); + $criteres = $criteresRow->current(); $structure = json_decode($criteres->criteres, true); - + require_once 'Scores/Field.php'; $field = new Fields(); $values = $field->getValues($structure); - + //Comptage require_once 'Scores/Ciblage.php'; $ciblage = new Ciblage($values); - + $data = array( 'idDefinition' => $idCriteres, 'resultat' => $ciblage->execute(), @@ -77,7 +77,7 @@ class ComptageController extends Zend_Controller_Action 'dateAjout' => date('YmdHis'), ); //Enregistrement - $comptageM = new Table_Comptages(); + $comptageM = new Application_Model_Comptages(); $comptageM->insert($data); //Retour comptage, unité Insee $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) .' '.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() { $this->_helper->layout()->disableLayout(); - + $request = $this->getRequest(); $object = new Object_Comptage(); $sirets = $object->count(null, null, true); @@ -118,11 +118,11 @@ class ComptageController extends Zend_Controller_Action $auth = Zend_Auth::getInstance(); $user = $auth->getIdentity(); //$object->getProfil($user->username, $user->idClient); - $table = new Table_EnrichissementProfils(); - $sql = $table->select() - ->where('login = ?', $user->username) - ->where('idClient = ?', $user->idClient); - $result = $table->fetchRow($sql); + $profilsM = new Application_Model_EnrichissementProfils(); + $sql = $profilsM->select() + ->where('login = ?', $user->username) + ->where('idClient = ?', $user->idClient); + $result = $profilsM->fetchRow($sql); if(!empty($result)) { $result = $result->toArray(); $champs = json_decode($result['criteres']); diff --git a/application/controllers/DashboardController.php b/application/controllers/DashboardController.php index 5089d3d4..39b000f0 100644 --- a/application/controllers/DashboardController.php +++ b/application/controllers/DashboardController.php @@ -54,7 +54,7 @@ class DashboardController extends Zend_Controller_Action $auth = Zend_Auth::getInstance(); $user = $auth->getIdentity(); - $criteresM = new Table_Criteres(); + $criteresM = new Application_Model_Criteres(); $sql = $criteresM->select() ->from($criteresM, array('id', 'reference', "DATE_FORMAT(dateAjout, '%d/%m/%Y') as date")) ->where("idClient = ?", $user->idClient) @@ -83,7 +83,7 @@ class DashboardController extends Zend_Controller_Action $user = $auth->getIdentity(); $config = new Zend_Config_Ini(APPLICATION_PATH.'/configs/configuration.ini'); //Criteres => Comptages (last) => enrichissement_identifiants => enrichissement_commandes - $enrichissementsM = new Table_EnrichissementIdentifiants(); + $enrichissementsM = new Application_Model_EnrichissementIdentifiants(); $sql = $enrichissementsM->select() ->setIntegrityCheck(false) diff --git a/application/controllers/EconomiqueController.php b/application/controllers/EconomiqueController.php index 5d0d01fb..dca253d0 100644 --- a/application/controllers/EconomiqueController.php +++ b/application/controllers/EconomiqueController.php @@ -28,7 +28,7 @@ class EconomiqueController extends Zend_Controller_Action $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(); $request = $this->getRequest(); - $table = new Table_Nafs(); + $table = new Application_Model_Naf(); $sql = $table->select() ->where('lib LIKE "%'.$this->getRequest()->getParam('q').'%"'); diff --git a/application/controllers/EnrichissementController.php b/application/controllers/EnrichissementController.php index 029df779..b9ee6b24 100644 --- a/application/controllers/EnrichissementController.php +++ b/application/controllers/EnrichissementController.php @@ -6,47 +6,47 @@ class EnrichissementController extends Zend_Controller_Action $this->view->headScript()->appendFile('/themes/default/scripts/enrichissement.js', 'text/javascript'); $this->view->headLink()->appendStylesheet('/themes/default/styles/enrichissement.css'); } - + /** * Enter description here ... */ public function indexAction(){} - + public function fileformAction() { $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->assign('filesize', ini_get('upload_max_filesize')); + $this->view->assign('filesize', ini_get('upload_max_filesize')); } - + public function fileuploadAction() { $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); - - $config = Zend_Registrey::get('configuration'); + + $config = Zend_Registrey::get('configuration'); $path = realpath($config->path->data).'/clients'; if(!file_exists($path)) mkdir($path); - + if ( isset($_FILES) && count($_FILES)==1 ){ $n = $_FILES['fichier']['name']; $s = $_FILES['fichier']['size']; $tmp_name = $_FILES['fichier']['tmp_name']; $name = $_REQUEST['ref']; - + $extValide = array('csv'); $extension = strrchr($n,'.'); $extension = substr($extension,1); //@todo : vérifier l'extension du fichier - + if (move_uploaded_file($tmp_name, $path.'/'.$name.'.'.$extension)){ echo "Uploadé !"; } else { echo "Erreur : ".$_FILES['fichier']['error']; } - } + } } - + /** * Etat de progression de l'upload du fichier */ @@ -54,8 +54,8 @@ class EnrichissementController extends Zend_Controller_Action { $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); - - $request = $this->getRequest(); + + $request = $this->getRequest(); $key = $request->getParam('key', ''); if ( !empty($key) ) { //$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); } } - + /** * Enregistrement de la commande pour l'ennrichissement */ @@ -71,43 +71,43 @@ class EnrichissementController extends Zend_Controller_Action { set_time_limit(60); $this->_helper->layout()->disableLayout(); - + $request = $this->getRequest(); - $idCriteres = $request->getParam('id', null); + $idCriteres = $request->getParam('id', null); $idProfil = $request->getParam('profil', null); //Vérifier les profils du client if ( $idProfil===null ){ - + //Selection du profil du client $auth = Zend_Auth::getInstance(); $user = $auth->getIdentity(); - - $profilsM = new Table_EnrichissementProfils(); + + $profilsM = new Application_Model_EnrichissementProfils(); $sql = $profilsM->select() ->from($profilsM, array('id')) ->where('idClient=?', $user->idClient) ->where('login=?', $user->username) ->where('actif=?', 1); $profil = $profilsM->fetchRow($sql); - $idProfil = $profil->id; - } - - $comptage = new Table_Comptages(); + $idProfil = $profil->id; + } + + $comptage = new Application_Model_Comptages(); $sql = $comptage->select()->where('idDefinition = ?', $idCriteres); $result = $comptage->fetchRow($sql); $idComptage = $result['id']; - + //Récupération des critères du ciblage - $criteresM = new Table_Criteres(); + $criteresM = new Application_Model_Criteres(); $criteresRow = $criteresM->find($idCriteres); $criteres = $criteresRow->current(); - + $structure = json_decode($criteres->criteres, true); require_once 'Scores/Field.php'; $field = new Fields(); - $values = $field->getValues($structure); - + $values = $field->getValues($structure); + //Récupération des SIRET require_once 'Scores/Ciblage.php'; $ciblage = new Ciblage($values, true); @@ -129,36 +129,36 @@ class EnrichissementController extends Zend_Controller_Action 'error' => '', 'dateAdded' => date('YmdHms'), ); - $identifiantsM = new Table_EnrichissementIdentifiants(); + $identifiantsM = new Application_Model_EnrichissementIdentifiants(); $idIdentifiant = $identifiantsM->insert($data); exec('php '.APPLICATION_PATH.'/../batch/enrichissement.php --id '.$idIdentifiant); } - + /** * Demande de référence pour l'enrichissement */ public function referenceAction() { - $this->_helper->layout()->disableLayout(); + $this->_helper->layout()->disableLayout(); $request = $this->getRequest(); - + //Récupération du profil de l'utilisateur $auth = Zend_Auth::getInstance(); $user = $auth->getIdentity(); - - $profilsM = new Table_EnrichissementProfils(); + + $profilsM = new Application_Model_EnrichissementProfils(); $sql = $profilsM->select() ->from($profilsM, array('id', 'reference', 'tarifLigne', 'dataInsee')) ->where('idClient=?', $user->idClient) ->where('login=?', $user->username) ->where('actif=?', 1); - $profil = $profilsM->fetchRow($sql); + $profil = $profilsM->fetchRow($sql); // if ($profil!==null) { $this->view->assign('profil', true); $idCritere = $request->getParam('id', null); - $comptagesM = new Table_Comptages(); + $comptagesM = new Application_Model_Comptages(); $sql = $comptagesM->select() ->where('idDefinition = ?', $idCritere) ->order('dateAjout DESC') @@ -173,7 +173,7 @@ class EnrichissementController extends Zend_Controller_Action $date = $date[0]; if($date != '0000-00-00') { if($date != date('Y-m-d')) { - $criteres = new Table_Criteres(); + $criteres = new Application_Model_Criteres(); $sql = $criteres->select()->where('id = ?', $idCritere); $result = $criteres->fetchRow($sql)->toArray(); $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('uniteInsee', $item['uniteInsee']); - + //Calcul du prix $redevanceInsee = 3.295/100; //Seuil de facturation 52 734 euros - $prixInsee = $item['uniteInsee']*$redevanceInsee; + $prixInsee = $item['uniteInsee']*$redevanceInsee; $infoInsee = ''; if ($profil->dataInsee){ $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; - + $this->view->prix = round($prix, 2); $this->view->prixInsee = round($prixInsee, 2); $this->view->infoInsee = $infoInsee; $this->view->id = $item['id']; - + /*$this->view->oldDate = $date; $this->view->oldResult = $oldResultat; $this->view->oldResultInsee = $oldResultatInsee; $this->view->oldPrice = round(($oldResultat* $profil->tarifLigne)+ $oldResultatInsee); $this->view->oldPriceInsee = round($oldResultatInsee*$redevanceInsee, 2);*/ - + $this->view->criteres = $criteres; - } + } } - + } - + public function downloadAction() { $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); - + $id = $this->getRequest()->getParam('id'); - $table = new Table_EnrichissementIdentifiants(); + $table = new Application_Model_EnrichissementIdentifiants(); $sql = $table->select() ->where('id = ?', $id); $result = $table->fetchRow($sql); @@ -249,5 +249,5 @@ class EnrichissementController extends Zend_Controller_Action echo 'Impossible de charger le fichier.'; } } - + } \ No newline at end of file diff --git a/application/controllers/GeographiqueController.php b/application/controllers/GeographiqueController.php index 872af1e3..005fac0a 100644 --- a/application/controllers/GeographiqueController.php +++ b/application/controllers/GeographiqueController.php @@ -49,7 +49,7 @@ class GeographiqueController extends Zend_Controller_Action protected function completedDep($q) { - $table = new Table_Departements(); + $table = new Application_Model_Departements(); $sql = $table->select() ->where('libdep LIKE "'.$q.'%"'); $result = $table->fetchAll($sql); @@ -64,7 +64,7 @@ class GeographiqueController extends Zend_Controller_Action protected function completedVil($q) { - $table = new Table_Codepostauxs(); + $table = new Application_Model_CodePostaux(); $separator = ' '; $sql = $table->select()->where('Commune LIKE "'.$q.'%"'); @@ -80,7 +80,7 @@ class GeographiqueController extends Zend_Controller_Action protected function getDeptFromReg($dep) { - $table = new Table_Departements(); + $table = new Application_Model_Departements(); $sql = $table->select() ->where('codeRegionInsee = '.$dep); $result = $table->fetchAll($sql)->toArray(); @@ -94,7 +94,7 @@ class GeographiqueController extends Zend_Controller_Action protected function completedReg($q) { - $table = new Table_Regions(); + $table = new Application_Model_Regions(); $separator = ' '; $sql = $table->select() diff --git a/application/controllers/GestionController.php b/application/controllers/GestionController.php index 911659e6..ad87a293 100644 --- a/application/controllers/GestionController.php +++ b/application/controllers/GestionController.php @@ -5,31 +5,31 @@ class GestionController extends Zend_Controller_Action { } - + public function init() { $this->view->headLink()->appendStylesheet('/themes/default/styles/dashboard.css', 'all'); $this->view->headScript()->appendFile('/themes/default/scripts/dashboard.js', 'text/javascript'); } - + public function indexAction() { - - + + } - + public function profilsAction() { - $profilsM = new Table_EnrichissementProfils(); + $profilsM = new Application_Model_EnrichissementProfils(); $sql = $profilsM->select() ->from($profilsM, array('id', 'idClient', 'login', 'reference', 'tarifLigne', 'dateAjout', 'dateSuppr', 'actif')); $profils = $profilsM->fetchAll($sql); - + $this->view->assign('profils', $profils); } - + public function profilAction(){} - + public function profiladdAction() { $request = $this->getRequest(); @@ -37,7 +37,7 @@ class GestionController extends Zend_Controller_Action //Sauvegarde du formulaire if ( $request->isPost() && $request->getParam('submit')=='Enregistrer' ){ $params = $request->getParams(); - + //Vérifier le formulaire $errForm = 0; foreach ( $params as $key => $value ) { @@ -57,8 +57,8 @@ class GestionController extends Zend_Controller_Action $dateInsee = 1; break; } - } - + } + $data = array( 'idClient' => $params['idClient'], 'login' => $params['login'], @@ -69,38 +69,38 @@ class GestionController extends Zend_Controller_Action 'dateAjout' => date('Y-m-d H:i:s'), 'actif' => 1, ); - $profilM = new Table_EnrichissementProfils(); + $profilM = new Application_Model_EnrichissementProfils(); if ( $profilM->insert($data) ){ - $this->view->assign('message', "Profil enregistré"); + $this->view->assign('message', "Profil enregistré"); } else { - $this->view->assign('message', "Erreur lors de la sauvegarde"); - } + $this->view->assign('message', "Erreur lors de la sauvegarde"); + } } else { - $this->view->assign('message', "Erreur lors de la saisie"); - } - + $this->view->assign('message', "Erreur lors de la saisie"); + } + } - + //Affichage du formulaire require_once 'Scores/Enrichissement.php'; $fieldsM = new Enrichissement(); - $allFields = $fieldsM->getFields(); - $this->view->assign('fields', $allFields); + $allFields = $fieldsM->getFields(); + $this->view->assign('fields', $allFields); } - + public function profildelAction(){} - + public function comptagesAction() { - $table = new Table_Comptages(); + $table = new Application_Model_Comptages(); $sql = $table->select() ->order('dateAjout DESC'); $this->view->comptages = $table->fetchAll($sql)->toArray(); } - + public function enrichissementsAction() { - $table = new Table_EnrichissementIdentifiants(); + $table = new Application_Model_EnrichissementIdentifiants(); $sql = $table->select() ->order('dateAdded DESC'); $this->view->enrichissements = $table->fetchAll($sql)->toArray(); @@ -109,7 +109,7 @@ class GestionController extends Zend_Controller_Action public function extractAction() { $id = $this->getRequest()->getParam('id'); - $table = new Table_EnrichissementIdentifiants(); + $table = new Application_Model_EnrichissementIdentifiants(); $sql = $table->select() ->where('idComptage = ?', $id); $result = $table->fetchRow($sql); diff --git a/application/controllers/JuridiqueController.php b/application/controllers/JuridiqueController.php index ae7a2490..ce67ff1a 100644 --- a/application/controllers/JuridiqueController.php +++ b/application/controllers/JuridiqueController.php @@ -26,7 +26,7 @@ class JuridiqueController extends Zend_Controller_Action public function completedAction() { - $table = new Table_Formejuridiques(); + $table = new Application_Model_FormJuridique(); $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(); $request = $this->getRequest(); diff --git a/batch/cron.php b/batch/cron.php index 1f014241..7946d041 100644 --- a/batch/cron.php +++ b/batch/cron.php @@ -45,7 +45,7 @@ if(isset($opts->help)) $dbConfig = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'databases'); $db = Zend_Db::factory($dbConfig->db); -$commandesM = new Table_EnrichissementCommandes($db); +$commandesM = new Application_Model_Commandes($db); $sql = $commandesM->select() ->where('idProfil != ?', 0) @@ -53,7 +53,7 @@ $sql = $commandesM->select() ->where("dateStop = '0000-00-00 00:00:00'"); $result = $commandesM->fetchAll($sql); if (count($result)>0){ - exit; + exit; } //Si pas de traitement en cours alors on lance diff --git a/batch/extract.php b/batch/extract.php index bd7d1c3e..64ba1cde 100644 --- a/batch/extract.php +++ b/batch/extract.php @@ -27,7 +27,7 @@ Class extract protected $db; protected $dbMetier; protected $reference; - + public function __construct($reference) { $this->reference = $reference; @@ -38,12 +38,12 @@ Class extract exit ( $e->getMessage() ); } } - + public function getHttp() { /* Depuis le navigateur */ } - + protected function getCj($liste) { foreach($liste as $valeur) @@ -66,7 +66,7 @@ Class extract } return ($return); } - + protected function localisationArbo($name, $valeur) { if(strlen($valeur) == 2) { @@ -97,7 +97,7 @@ Class extract } return ($return); } - + public function getMinMax($name, $valeur) { $valeur = explode(',', $valeur); @@ -116,16 +116,14 @@ Class extract } return ($valeur); } - + protected function nafArbo($key, $valeur) { $value = array(); - //$table = new Table_Nafs(); $valeur = trim($valeur); if(strlen($valeur) == 1) { - //$sql = $table->select()->where('parent = ?', $valeur); $sql = 'SELECT * FROM naf WHERE parent ='.$valeur; $result =$this->db->query($sql); $result = $result->fetchAll(); @@ -146,18 +144,18 @@ Class extract } return ($value); } - + public function getCli() { require_once('Scores/Ciblage.php'); //require_once('Scores/Field.php'); - + $sql = 'SELECT id, idDefinition, uniteInsee FROM comptages WHERE id = '.$this->reference; $fetch = $this->db->query($sql); $result = $fetch->fetchAll(); $idComptage = $result[0]['id']; $uniteInsee = $result[0]['uniteInsee']; - + $sql = 'SELECT id, criteres.criteres FROM criteres WHERE id ='.$result[0]['idDefinition']; $fetch = $this->db->query($sql); $result = $fetch->fetchAll(); @@ -199,7 +197,7 @@ Class extract $array['bilTca'] = array(4, 5, 6); $ciblage = new Ciblage($array, true); $res = $ciblage->execute(true); - + $data = array( 'idComptage' => $idComptage, 'idCriteres' => $idCriteres, diff --git a/library/Application/Controller/Plugin/Comptage.php b/library/Application/Controller/Plugin/Comptage.php index 37baad1a..17d2a20d 100644 --- a/library/Application/Controller/Plugin/Comptage.php +++ b/library/Application/Controller/Plugin/Comptage.php @@ -7,7 +7,7 @@ class Application_Controller_Plugin_Comptage extends Zend_Controller_Plugin_Abst if ($layout->isEnabled()) { $controller = $request->getControllerName(); $action = $request->getActionName(); - + if ($controller == 'index' && $action == 'index') { require_once 'Scores/SessionCiblage.php'; $session = new SessionCiblage(); @@ -15,12 +15,12 @@ class Application_Controller_Plugin_Comptage extends Zend_Controller_Plugin_Abst $auth = Zend_Auth::getInstance(); $user = $auth->getIdentity(); - + // Chargement des critères de ciblage à partir de l'enregistrement en bdd $id = $request->getParam('id', 0); if (!empty($id)) { $db = Zend_Registry::get('db'); - $criteresM = new Table_Criteres(); + $criteresM = new Application_Model_Criteres(); $sql = $criteresM->select() ->from($criteresM, array('criteres')) ->where('login = ?', $user->username) @@ -35,11 +35,11 @@ class Application_Controller_Plugin_Comptage extends Zend_Controller_Plugin_Abst $field = new Fields(); $ciblage = new Ciblage($field->getValues()); $total = $ciblage->execute(); - $insee = $ciblage->calculRedevanceInsee(); + $insee = $ciblage->calculRedevanceInsee(); $session->setNb('total', $total); $session->setNb('insee', $insee); } - } + } $view->total = number_format($session->getNb('total'), 0, '', ' '); $view->insee = number_format($session->getNb('insee'), 0, '', ' '); $view->msgComptage = true; diff --git a/library/Object/Codepostaux.php b/library/Object/Codepostaux.php index bf7f51f4..aa1e267e 100644 --- a/library/Object/Codepostaux.php +++ b/library/Object/Codepostaux.php @@ -9,12 +9,12 @@ class Object_Codepostaux extends Libs_Row $valeurs = $session->getCritere($type); return (substr($valeurs, 0, strlen($valeurs)-1)); } - + public function _jstree_undetermined($niveau, $type) { require_once('Scores/SessionCiblage.php'); $session = new SessionCiblage(); - $table = new Table_Departements(); + $table = new Application_Model_Departements(); $valeurs = explode(',', $session->getCritere($type)); //print_r($valeurs); /*$valeurs = array_merge($valeurs, explode(',', $session->getCritere('adr_com')));*/ @@ -42,7 +42,7 @@ class Object_Codepostaux extends Libs_Row } return ($in); } - + public function _getClass($valeur, $niveau) { require_once('Scores/SessionCiblage.php'); @@ -60,17 +60,17 @@ class Object_Codepostaux extends Libs_Row } else if($row > 1) return ('jstree-undetermined'); - + /*$type = explode(':', $valeur); if($type[1] == $this->_jstree_checked($type[0])) return ('jstree-checked'); else if (in_array($valeur, $this->_jstree_undetermined($niveau, $type[0]))) return ('jstree-undetermined');*/ } - + protected function getDepartement($region) { - $table = new Table_Departements(); + $table = new Application_Model_Departements(); $sql = $table->select() ->where('codeRegionInsee = '.$region); $result = $table->fetchAll($sql)->toArray(); @@ -80,73 +80,73 @@ class Object_Codepostaux extends Libs_Row } return (implode(',', $depts)); } - + /* Fonctions de construction de jstree */ public function _getRegions() { - $region = new Table_Regions(); + $region = new Application_Model_Regions(); $regions = $region->fetchAll($region->select()->order('NCCENR ASC'))->toArray(); $structure = array(); foreach($regions as $nom) { $structure[] = array( 'data' => $nom['NCCENR'], - 'attr' => array('id' => $this->getDepartement($nom['REGION']), - 'niveau' => 0, + 'attr' => array('id' => $this->getDepartement($nom['REGION']), + 'niveau' => 0, 'class' => $this->_getClass($this->getDepartement($nom['REGION']), 0) ), - 'state' => 'closed', + 'state' => 'closed', 'children' => array() ); } return (json_encode($structure)); } - + public function _getDepartements($codeRegionInsee) { //$code = explode(':', $codeRegionInsee); - $departement = new Table_Departements(); + $departement = new Application_Model_Departements(); foreach(explode(',', $codeRegionInsee) as $dept) { $departements[] = $departement->fetchAll($departement->select() ->where('numdep ='.$dept))->toArray(); } $structure = array(); - + foreach($departements as $nom) { $structure[] = array( 'data' => $nom[0]['numdep'].' '.$nom[0]['libdep'], - 'attr' => array('id' => $nom[0]['numdep'], - 'niveau' => 1, + 'attr' => array('id' => $nom[0]['numdep'], + 'niveau' => 1, 'class' => $this->_getClass($nom[0]['numdep'], 1) ), - 'state' => 'closed', + 'state' => 'closed', 'children' => array() ); } - + return (json_encode($structure)); } - + public function _getCommunes($numdep) { //$numdep = explode(':', $numdep); - $codepostau = new Table_Codepostauxs(); + $codepostau = new Application_Model_CodePostaux(); $codepostaux = $codepostau->fetchAll($codepostau->select()->where('codepos LIKE "'.$numdep.'%"'))->toArray(); $structure = array(); - + foreach($codepostaux as $nom) { $structure[] = array( 'data' => $nom['Codepos'].' '.$nom['Commune'], - 'attr' => array('id'=> $nom['INSEE'], - 'niveau' => 2, + 'attr' => array('id'=> $nom['INSEE'], + 'niveau' => 2, 'class' => $this->_getClass($nom['INSEE'], 2) ), - 'state' => 'closed', + 'state' => 'closed', 'children' => array() ); } - + return (json_encode($structure)); } } \ No newline at end of file diff --git a/library/Object/Comptage.php b/library/Object/Comptage.php index a49c0e8b..c898db5c 100644 --- a/library/Object/Comptage.php +++ b/library/Object/Comptage.php @@ -5,7 +5,7 @@ class Object_Comptage extends Libs_Row { if (empty($ref)) { echo json_encode(array( - 'error'=>1, + 'error'=>1, 'msg'=> "Référence non définie !")); } else { //Session @@ -14,13 +14,13 @@ class Object_Comptage extends Libs_Row $criteres = $session->getCriteres(); $resultat = $session->getNb('total'); $nbInsee = $session->getNb('insee'); - + //Informations utilisateur $auth = Zend_Auth::getInstance(); $user = $auth->getIdentity(); - + //Enregistrement des critères - $criteresM = new Table_Criteres(); + $criteresM = new Application_Model_Criteres(); $data = array( 'idClient' => $user->idClient, 'login' => $user->username, @@ -30,10 +30,10 @@ class Object_Comptage extends Libs_Row 'dateAjout' => date('Y-m-d H:i:s'), ); $id = $criteresM->insert($data); - + if ($id){ //Enregistrement des valeurs du comptage - $comptageM = new Table_Comptages(); + $comptageM = new Application_Model_Comptages(); $data = array( 'idDefinition' => $id, 'resultat' => $resultat, @@ -42,27 +42,27 @@ class Object_Comptage extends Libs_Row ); if ($comptageM->insert($data)) { echo json_encode(array( - 'error'=>0, + 'error'=>0, 'msg'=> "Vos critères ont été sauvegardés sous la référence $ref", 'id' => $id)); } else { echo json_encode(array( - 'error'=>1, + 'error'=>1, 'msg'=> "Erreur lors de l'enregistrement")); } } else { echo json_encode(array( - 'error'=>1, + 'error'=>1, 'msg'=> "Erreur lors de l'enregistrement")); } } } - + public function count($key, $valeur, $need = false) { require_once 'Scores/SessionCiblage.php'; $session = new SessionCiblage(); - + if(in_array($key, array('adr_dept', 'adr_com', 'adr_reg', 'adr_com_ex', 'adr_dept_ex'))) { $valeurs = explode(',', $valeur); @@ -70,7 +70,7 @@ class Object_Comptage extends Libs_Row $reg_ = $session->getCritere('adr_reg'); if(!empty($reg_)) { $reg_ = explode(',', $reg_); - $table = new Table_Departements(); + $table = new Application_Model_Departements(); $result = array(); foreach($reg_ as $item) { $sql = $table->select()->where('codeRegionInsee = ?', $item); @@ -130,7 +130,7 @@ class Object_Comptage extends Libs_Row } } else $session->setCritere($key, $valeur); - + require_once 'Scores/Field.php'; $field = new Fields(); @@ -142,10 +142,10 @@ class Object_Comptage extends Libs_Row } $total = $ciblage->execute(); $insee = $ciblage->calculRedevanceInsee(); - + $session->setNb('total', $total); $session->setNb('insee', $insee); - + //Retour comptage, unité Insee $result = array( 'count' => number_format($total, 0, '', ' '), diff --git a/library/Object/Dashboard.php b/library/Object/Dashboard.php index d1e21ee2..8c6dfc0a 100644 --- a/library/Object/Dashboard.php +++ b/library/Object/Dashboard.php @@ -1,23 +1,23 @@ getIdentity(); - - $criteresM = new Table_Criteres(); + + $criteresM = new Application_Model_Criteres(); $sql = $criteresM->select() ->from($criteresM, array('id', 'reference', 'dateAjout')) ->where("idClient = ?", $user->idClient) ->where("login = ?", $user->username) ->order('dateAjout DESC') ->limit(5); - + $rows = $criteresM->fetchAll($sql); - + $results = array(); - $comptagesM = new Table_Comptages(); + $comptagesM = new Application_Model_Comptages(); foreach($rows->toArray() as $item) { $info = array( @@ -31,21 +31,21 @@ Class Object_Dashboard ->where('idDefinition = ?', $item['id']) ->order('dateAjout DESC')->limit(1); $comptage = $comptagesM->fetchAll($sql)->toArray(); - + if (count($comptage)>0){ $info['resultat'] = $comptage[0]['resultat']; $info['uniteInsee'] = $comptage[0]['uniteInsee']; $info['dateComptage'] = $comptage[0]['dateAjout']; } - + $results[] = $info; } return ($results); } - + public function enrichissement($idComptage) { - $enrichissements = new Table_EnrichissementIdentifiants(); + $enrichissements = new Application_Model_EnrichissementIdentifiants(); $auth = Zend_Auth::getInstance(); $user = $auth->getIdentity(); $sql = $enrichissements->select() @@ -63,10 +63,10 @@ Class Object_Dashboard ->where('i.idCriteres = ?', $idComptage); return ($enrichissements->fetchAll($sql)); } - + public function enrichissements() { - $enrichissementsM = new Table_EnrichissementIdentifiants(); + $enrichissementsM = new Application_Model_EnrichissementIdentifiants(); $auth = Zend_Auth::getInstance(); $user = $auth->getIdentity(); $sql = $enrichissementsM->select() @@ -88,21 +88,21 @@ Class Object_Dashboard ->order('dateAdded DESC'); return ($enrichissementsM->fetchAll($sql)); } - + public function menu() { - + } - + public function ciblage($page) { $offset = 20; //Liste des ciblages par paquet de n $auth = Zend_Auth::getInstance(); $user = $auth->getIdentity(); - - $criteresM = new Table_Criteres(); - + + $criteresM = new Application_Model_Criteres(); + //Compter le nombre de page $sql = $criteresM->select() ->from($criteresM, array('nb' => 'COUNT(*)')) @@ -110,7 +110,7 @@ Class Object_Dashboard ->where("login = ?", $user->username); $count = $criteresM->fetchRow($sql); $nbCiblage = $count->nb; - + //Récupérer les informations $position = ($page-1)*$offset+1; $sql = $criteresM->select() @@ -119,10 +119,10 @@ Class Object_Dashboard ->where("login = ?", $user->username) ->order('dateAjout DESC') ->limitPage($position, $offset); - + $rows = $criteresM->fetchAll($sql); $results = array(); - $comptagesM = new Table_Comptages(); + $comptagesM = new Application_Model_Comptages(); foreach($rows->toArray() as $item) { $info = array( @@ -136,16 +136,16 @@ Class Object_Dashboard ->where('idDefinition = ?', $item['id']) ->order('dateAjout DESC')->limit(1); $comptage = $comptagesM->fetchAll($sql)->toArray(); - + if (count($comptage)>0){ $info['resultat'] = $comptage[0]['resultat']; $info['uniteInsee'] = $comptage[0]['uniteInsee']; $info['dateComptage'] = $comptage[0]['dateAjout']; } - + $results[] = $info; } - + return (array('ciblages' => $results, 'nbCiblage' => $nbCiblage)); } @@ -153,15 +153,15 @@ Class Object_Dashboard { $auth = Zend_Auth::getInstance(); $user = $auth->getIdentity(); - $table = new Table_Criteres(); + $table = new Application_Model_Criteres(); $sql = $table->select() ->where('idClient = ?', $user->idClient) ->where('login = ?', $user->username) ->where('id = ?', $id); - + $criteres = $table->fetchRow($sql)->toArray(); if ($criteres != null){ - $comptage = new Table_Comptages(); + $comptage = new Application_Model_Comptages(); $sql = $comptage->select() ->where('idDefinition = ?', $id)->order('dateAjout DESC'); $comptages = $comptage->fetchAll($sql)->toArray(); @@ -173,8 +173,8 @@ Class Object_Dashboard { $auth = Zend_Auth::getInstance(); $user = $auth->getIdentity(); - - $criteresM = new Table_Criteres($db); + + $criteresM = new Application_Model_Criteres(); $sql = $criteresM->select() ->from($criteresM, array('id', 'reference', "DATE_FORMAT(dateAjout, '%d/%m/%Y') as date")) ->where("idClient = ?", $user->idClient) diff --git a/library/Object/Formejuridique.php b/library/Object/Formejuridique.php index e8e1ca92..ae589695 100644 --- a/library/Object/Formejuridique.php +++ b/library/Object/Formejuridique.php @@ -6,7 +6,7 @@ class Object_Formejuridique extends Libs_Row require_once('Scores/SessionCiblage.php'); $session = new SessionCiblage(); $valeurs = explode(',', $session->getCritere('cj')); - + foreach($valeurs as $valeur) { if($valeur != '') $return[] = $valeur; @@ -15,12 +15,12 @@ class Object_Formejuridique extends Libs_Row return ($return); return (array($valeurs)); } - + protected function _jstree_undetermined() { return (array()); } - + public function _getClass($valeur) { 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())) return ('jstree-undetermined'); } - + public function _getParents() { - $formes = new Table_Formejuridiques(); + $formes = new Application_Model_FormJuridique(); $formes = $formes->fetchAll($formes->select()->where('LENGTH(fjCode) = 1'))->toArray(); $structure = array(); foreach($formes as $forme) { $structure[] = array( 'data' => $forme['fjCode'].' : '.$forme['fjLibelle'], - 'attr' => array('id' => $forme['fjCode'], + 'attr' => array('id' => $forme['fjCode'], 'class' => $this->_getClass($forme['fjCode'])), - 'state' => 'closed', + 'state' => 'closed', 'children' => array($this->_getFils($forme['fjCode'])), ); } return (json_encode($structure)); } - + public function _getFils($fjcode) { $lenth = ((strlen($fjcode) == 2)?4:2); - $formes = new Table_Formejuridiques(); + $formes = new Application_Model_FormJuridique(); $sql = $formes->select()->from('formejuridique', array( 'size' => new Zend_Db_Expr('LENGTH(fjCode)'), - 'fjCode', + 'fjCode', 'fjLibelle')) ->where('fjCode LIKE "'.$fjcode.'%"') ->having('size = ?', $lenth); @@ -69,7 +69,7 @@ class Object_Formejuridique extends Libs_Row ); $tabfj[] = $structure; } - + return ($tabfj); } } \ No newline at end of file diff --git a/library/Object/Naf.php b/library/Object/Naf.php index ffab5331..24090f4b 100644 --- a/library/Object/Naf.php +++ b/library/Object/Naf.php @@ -15,7 +15,7 @@ class Object_Naf extends Libs_Row $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'); $result = $nafM->fetchAll($sql)->toArray(); @@ -25,8 +25,8 @@ class Object_Naf extends Libs_Row $structure = array( 'data' => $item['code'].' - '.$item['lib'], 'attr' => array('id' => $item['code'], 'niveau' => $item['niveau']), - 'state' => 'closed', - 'children' => array(), + 'state' => 'closed', + 'children' => array(), ); if (in_array($item['code'], $valuesChecked)){ $structure['attr']['class'] = 'jstree-checked'; @@ -47,7 +47,7 @@ class Object_Naf extends Libs_Row $new = substr($value,0,$niveau); $out = array_merge($out, array($new), $this->getNafParent($new, $niveau1)); } elseif (strlen($value)==2 && $niveau1 === true) { - $nafM = new Table_Nafs(); + $nafM = new Application_Model_Naf(); $sql = $nafM->select() ->from($nafM, array('parent')) ->where('code = ?', $value); @@ -56,7 +56,7 @@ class Object_Naf extends Libs_Row } return $out; } - + public function ajax($parent, $niveau, $key) { //Récupération des valeurs enregistrées en session @@ -64,7 +64,7 @@ class Object_Naf extends Libs_Row $sessionCiblage = new SessionCiblage(); $val = $sessionCiblage->getCritere($key); $valuesChecked = array(); - + $valuesUndetermined = array(); if ($val != null){ $valuesChecked = explode(',',$val); @@ -72,9 +72,9 @@ class Object_Naf extends Libs_Row $valuesUndetermined = array_merge($valuesUndetermined, $this->getNafParent($value)); } } - + $niveau++; - $nafM = new Table_Nafs(); + $nafM = new Application_Model_Naf(); $sql = $nafM->select(); if (!empty($parent) && $niveau==2) { $sql->where('parent = ?', $parent); @@ -82,7 +82,7 @@ class Object_Naf extends Libs_Row $sql->where("code LIKE '".$parent."%'"); } $sql->where('niveau = ?', $niveau)->order('code ASC'); - + $result = $nafM->fetchAll($sql)->toArray(); $tabNaf = array(); foreach($result as $item){ diff --git a/library/Scores/Ciblage.php b/library/Scores/Ciblage.php index fbbb94f5..dd2d715c 100644 --- a/library/Scores/Ciblage.php +++ b/library/Scores/Ciblage.php @@ -6,21 +6,21 @@ Class Ciblage private $sphinx; private $alpha = ''; private $presentRcs = 0; - + public $index = 'ciblage'; - + public $nb_results = 5000; public $max_results = 500000; - + public $sphinx_match = SPH_MATCH_EXTENDED2; public $sphinx_sort = SPH_SORT_EXTENDED; - + protected function setMinMax($name, $valeur) { /*if(!$this->need) {*/ if(!empty($name)) { $default = Fields::getMinMax($name); - + if(empty($valeur[0])){$valeur[0] = $default[0]['min'];} if(empty($valeur[1])){$valeur[1] = $default[0]['max'];} } @@ -63,7 +63,7 @@ Class Ciblage 'total' => count($resultats), 'insee' => $this->calculRedevanceInsee(), 'result'=> $siret - ); + ); return $total; } public function calculRedevanceInsee() @@ -80,7 +80,7 @@ Class Ciblage $siret[] = $element['attrs']['siren'].$element['attrs']['nic']; } return ($siret); - } else + } else return (array()); } public function execute($need = false, $limitD = false) @@ -110,10 +110,10 @@ Class Ciblage protected function setFilterRange($name, $valeur) { $this->sphinx->SetFilterRange($name, intval($valeur[0]), intval($valeur[1])); } - + private function getListeDepartement() { - $table = new Table_Departements(); + $table = new Application_Model_Departements(); $sql = $table->select(); $result = $table->fetchAll($sql)->toArray(); foreach ($result as $dept) { @@ -124,7 +124,7 @@ Class Ciblage } 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(!strstr($this->alpha, 'adr_dept') or + if(!strstr($this->alpha, 'adr_dept') or !strstr($this->alpha, 'ape_etab') or !strstr($this->alpha, 'bilType') or !strstr($this->alpha, 'ape_entrep')) { @@ -161,7 +161,7 @@ Class Ciblage } $this->alpha .= ')'; } - + } protected function setAlpha($name, $valeur, $ex = false) { @@ -181,7 +181,7 @@ Class Ciblage protected function transformIntval($array) { $copy = array(); foreach($array as $item => $valeur) { - $copy[$item] = intval($valeur); + $copy[$item] = intval($valeur); } return ($copy); } @@ -241,7 +241,7 @@ Class Ciblage } protected function capital($valeur) { $valeur = $this->setMinMax($name, $valeur); - + $this->setFilterRange('capital', $valeur); } protected function ape_etab($valeur) { @@ -310,12 +310,12 @@ Class Ciblage } else { $format1 = explode('/', $valeur[0]); $format2 = explode('/', $valeur[1]); - + $valeur[0] = $format1[2].$format1[1].$format1[0]; $valeur[1] = $format2[2].$format2[1].$format2[0]; } $this->setFilterRange('dateCrea_etab', $valeur); - + } protected function dateCrea_ent($valeur) { if(empty($valeur[1])) {$valeur[1] = date('Ymd');} @@ -326,7 +326,7 @@ Class Ciblage } else { $format1 = explode('/', $valeur[0]); $format2 = explode('/', $valeur[1]); - + $valeur[0] = $format1[2].$format1[1].$format1[0]; $valeur[1] = $format2[2].$format2[1].$format2[0]; } @@ -341,7 +341,7 @@ Class Ciblage } else { $format1 = explode('/', $valeur[0]); $format2 = explode('/', $valeur[0]); - + $valeur[0] = $format1[2].$format1[1].$format1[0]; $valeur[1] = $format2[2].$format2[1].$format2[0]; } @@ -349,12 +349,12 @@ Class Ciblage } protected function eff_entrep($valeur) { $valeur = $this->setMinMax($name, $valeur); - + $this->setFilter('eff_entrep', $valeur); } protected function eff_etab($valeur) { $valeur = $this->setMinMax($name, $valeur); - + $this->setFilter('eff_etab', $valeur); } protected function rivoli($valeur) { @@ -369,7 +369,7 @@ Class Ciblage } protected function nbActio($valeur) { $valeur = $this->setMinMax('nbActio', $valeur); - + $this->setFilterRange('nbActio', $valeur); } protected function nbMPubli($valeur) { @@ -377,7 +377,7 @@ Class Ciblage } protected function nbPart($valeur) { $valeur = $this->setMinMax('nbPart', $valeur); - + $this->setFilterRange('nbPart', $valeur); } protected function bilDuree($valeur) { @@ -443,7 +443,7 @@ Class Ciblage protected function bilHD($valeur) { $valeur = $this->setMinMax('bilHD', $valeur); $this->setFilterRange('bilHD', $valeur); - } + } protected function bilHL($valeur) { $valeur = $this->setMinMax('bilHL', $valeur); $this->setFilterRange('bilHL', $valeur); @@ -507,7 +507,7 @@ Class Ciblage } else { $format1 = explode('/', $valeur[0]); $format2 = explode('/', $valeur[0]); - + $valeur[0] = $format1[2].$format1[1].$format1[0]; $valeur[1] = $format2[2].$format2[1].$format2[0]; } diff --git a/library/Scores/Field.php b/library/Scores/Field.php index 5736babd..d81f6bb4 100644 --- a/library/Scores/Field.php +++ b/library/Scores/Field.php @@ -1,20 +1,20 @@ array( * label => * fields => array( * select => array() * ... * ) - * famille => + * famille => * activated => * type => - * + * * 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é / ) - * ) + * ) * ) */ Class Fields @@ -22,7 +22,7 @@ Class Fields protected $fields = array ( 'siege' => array( - 'label' => 'Type d\'établissement', + 'label' => 'Type d\'établissement', 'fields' => array( 'select' => array('value' => array('1' => 'Sièges uniquement', '0' => 'Secondaires')), ), @@ -31,7 +31,7 @@ Class Fields 'type' => 'select', ), 'sirenGrp' => array( - 'label' => 'Présence d\'un groupe', + 'label' => 'Présence d\'un groupe', 'fields' => array( 'select' => array('value' => array('1' => 'Oui', '0' => 'Non')), ), @@ -40,7 +40,7 @@ Class Fields 'type' => 'select' ), 'tel' => array( - 'label' => 'Téléphone renseigné', + 'label' => 'Téléphone renseigné', 'fields' => array( 'select' => array('value' => array('1' => 'Oui', '0' => 'Non')) ), @@ -49,7 +49,7 @@ Class Fields 'type' => 'select' ), 'fax' => array( - 'label' => 'Télécopie renseignée', + 'label' => 'Télécopie renseignée', 'fields' => array( 'select' => array('value' => array('1' => 'Oui', '0' => 'Non')) ), @@ -59,7 +59,7 @@ Class Fields 'class' => null ), 'web' => array( - 'label' => 'Site Web renseigné', + 'label' => 'Site Web renseigné', 'fields' => array( 'select' => array('value' => array('1' => 'Oui', '0' => 'Non')) ), @@ -69,7 +69,7 @@ Class Fields 'class' => null ), 'mail' => array( - 'label' => 'Email de contact renseigné', + 'label' => 'Email de contact renseigné', 'fields' => array( 'select' => array('value' => array('1' => 'Oui', '0' => 'Non')) ), @@ -79,7 +79,7 @@ Class Fields 'class' => null ), 'presentRcs' => array( - 'label' => 'Etablissement présent au RNCS', + 'label' => 'Etablissement présent au RNCS', 'fields' => array( 'select' => array('value' => array('1' => 'Etablissement présent au RNCS', '0' => 'Non')) ), @@ -89,7 +89,7 @@ Class Fields 'class' => null ), 'adrDom' => array( - 'label' => 'Adresse de domiciliation', + 'label' => 'Adresse de domiciliation', 'fields' => array( 'select' => array('value' => array('1' => 'Oui', '0' => 'Non')) ), @@ -99,7 +99,7 @@ Class Fields 'class' => null ), 'dirNom' => array( - 'label' => 'Nom du principal dirigeant', + 'label' => 'Nom du principal dirigeant', 'fields' => array( 'select' => array('value' => array('1' => 'Principal dirigeant renseigné', '0' => 'Non')) ), @@ -109,7 +109,7 @@ Class Fields 'class' => null ), 'lieuAct' => array( - 'label' => 'Lieu d\'activté', + 'label' => 'Lieu d\'activté', 'fields' => array( 'interval' => array('value' => array('0', '1000')), 'textarea' => array('value' => null) @@ -120,7 +120,7 @@ Class Fields 'class' => null ), 'nbMPubli' => array( - 'label' => 'Marchés publiques remportés', + 'label' => 'Marchés publiques remportés', 'fields' => array( 'select' => array('value' => array('1' => 'Oui', '0' => 'Non')) ), @@ -130,7 +130,7 @@ Class Fields 'class' => null ), 'dateCrea_ent' => array( - 'label' => 'Date de création de l\'entreprise', + 'label' => 'Date de création de l\'entreprise', 'fields' => array( 'interval' => array('value' => array('0', '1000')) ), @@ -140,7 +140,7 @@ Class Fields 'class' => 'datepicker' ), 'dateCrea_etab' => array( - 'label' => 'Date de création de l\'établissement', + 'label' => 'Date de création de l\'établissement', 'fields' => array( 'interval' => array('value' => array('0', '1000')) ), @@ -160,7 +160,7 @@ Class Fields 'class' => null ), 'nbActio' => array( - 'label' => 'Nombre d\'actionnaires connus', + 'label' => 'Nombre d\'actionnaires connus', 'fields' => array( 'interval' => array('value' => array('0', '1000')) ), @@ -170,7 +170,7 @@ Class Fields 'class' => null ), 'part' => array( - 'label' => 'Nombre de participations connues', + 'label' => 'Nombre de participations connues', 'fields' => array( 'select' => array('value' => array('1' => 'Oui', '0' => 'Non')) ), @@ -180,7 +180,7 @@ Class Fields 'class' => null ), 'nbPart' => array( - 'label' => 'Nombre de participations connues', + 'label' => 'Nombre de participations connues', 'fields' => array( 'interval' => array('value' => array('0', '1000')) ), @@ -191,7 +191,7 @@ Class Fields ), // economique 'ape_etab' => array( - 'label' => 'Activité de l\'établissement (Code NAF)', + 'label' => 'Activité de l\'établissement (Code NAF)', 'fields' => array( 'text' => array('value' => null), 'textarea' => array('value' => null) @@ -204,7 +204,7 @@ Class Fields 'title' => 'Selection des codes NAF etablissement' ), 'ape_etab_ex' => array( - 'label' => 'Activité de l\'établissement (Exclure)', + 'label' => 'Activité de l\'établissement (Exclure)', 'fields' => array( 'text' => array('value' => null), 'textarea' => array('value' => null) @@ -217,7 +217,7 @@ Class Fields 'title' => 'Selection des codes NAF etablissement' ), 'ape_entrep' => array( - 'label' => 'Activité de l\'entreprise (Code NAF)', + 'label' => 'Activité de l\'entreprise (Code NAF)', 'fields' => array( 'text' => array('value' => null), 'textarea' => array('value' => null) @@ -230,7 +230,7 @@ Class Fields 'title' => 'Selection des codes NAF entreprise' ), 'ape_entrep_ex' => array( - 'label' => 'Activité de l\'entreprise (Exclure)', + 'label' => 'Activité de l\'entreprise (Exclure)', 'fields' => array( 'text' => array('value' => null), 'textarea' => array('value' => null) @@ -243,7 +243,7 @@ Class Fields 'title' => 'Selection des codes NAF entreprise' ), 'NaceEtab' => array( - 'label' => 'Code NACE de l\'établissement', + 'label' => 'Code NACE de l\'établissement', 'fields' => array( 'text' => array('value' => null), 'textarea' => array('value' => null) @@ -254,7 +254,7 @@ Class Fields 'class' => null ), 'NaceEntrep' => array( - 'label' => 'Code NACE de l\'entreprise', + 'label' => 'Code NACE de l\'entreprise', 'fields' => array( 'text' => array('value' => null), 'textarea' => array('value' => null) @@ -265,7 +265,7 @@ Class Fields 'class' => null ), 'age_etab' => array( - 'label' => 'Age de l\'entreprise', + 'label' => 'Age de l\'entreprise', 'fields' => array( 'interval' => array('value' => null) ), @@ -275,7 +275,7 @@ Class Fields 'class' => null ), 'age_entrep' => array( - 'label' => 'Age de l\'établissement', + 'label' => 'Age de l\'établissement', 'fields' => array( 'interval' => array('value' => null) ), @@ -285,7 +285,7 @@ Class Fields 'class' => null ), 'teff_entrep' => array( - 'label' => 'Tranche d\'effectif de l\'Entreprise', + 'label' => 'Tranche d\'effectif de l\'Entreprise', 'fields' => array( 'intervalSelect' => array('value' => array( array('0', '1 ou 2'), @@ -311,7 +311,7 @@ Class Fields 'class' => null, ), 'teff_etab' => array( - 'label' => 'Tranche d\'effectif de l\'établissement', + 'label' => 'Tranche d\'effectif de l\'établissement', 'fields' => array( 'intervalSelect' => array( 'value' => array( @@ -339,7 +339,7 @@ Class Fields 'class' => null ), 'teff_etabM' => array( - 'label' => 'Tranche d\'effectif de l\'établissement M', + 'label' => 'Tranche d\'effectif de l\'établissement M', 'fields' => array( 'select' => array('value' => array('1' => 'Oui', '0' => 'Non')) ), @@ -349,7 +349,7 @@ Class Fields 'class' => null ), 'teff_entrepM' => array( - 'label' => 'Tranche d\'effectif de l\'entreprise M', + 'label' => 'Tranche d\'effectif de l\'entreprise M', 'fields' => array( 'select' => array('value' => array('1' => 'Oui', '0' => 'Non')) ), @@ -359,7 +359,7 @@ Class Fields 'class' => null ), 'nbEtab' => array( - 'label' => 'Nombre d\'établissements', + 'label' => 'Nombre d\'établissements', 'fields' => array( 'interval' => array('value' => array('0', '10000000')) ), @@ -369,7 +369,7 @@ Class Fields 'class' => null ), 'eff_entrep' => array( - 'label' => 'Effectif réel de l\'entreprise', + 'label' => 'Effectif réel de l\'entreprise', 'fields' => array( 'interval' => array('value' => array('0', '10000000')) ), @@ -379,7 +379,7 @@ Class Fields 'class' => null ), 'eff_etab' => array( - 'label' => 'Effectif réel de l\'établissement', + 'label' => 'Effectif réel de l\'établissement', 'fields' => array( 'interval' => array('value' => array('0', '10000000')) ), @@ -389,7 +389,7 @@ Class Fields 'class' => null ), 'capital' => array( - 'label' => 'Capital de l\'entreprise', + 'label' => 'Capital de l\'entreprise', 'fields' => array( 'intervalSelect' => array( 'value' => array( @@ -409,7 +409,7 @@ Class Fields ), //geographique 'adr_com' => array( - 'label' => 'Localisation géographique', + 'label' => 'Localisation géographique', 'fields' => array( 'text' => array('value' => null), 'textarea' => array('value' => null) @@ -422,7 +422,7 @@ Class Fields 'title' => 'Localisation' ), 'adr_com_ex' => array( - 'label' => 'Localisation Villes (Exclure)', + 'label' => 'Localisation Villes (Exclure)', 'fields' => array( 'text' => array('value' => null), 'textarea' => array('value' => null) @@ -435,7 +435,7 @@ Class Fields 'title' => 'Localisation' ), 'adr_dept' => array( - 'label' => 'Liste départements', + 'label' => 'Liste départements', 'fields' => array( 'text' => array('value' => null), 'textarea' => array('value' => null) @@ -448,7 +448,7 @@ Class Fields 'title' => 'Localisation' ), 'adr_dept_ex' => array( - 'label' => 'Liste départements (Exclure)', + 'label' => 'Liste départements (Exclure)', 'fields' => array( 'text' => array('value' => null), 'textarea' => array('value' => null) @@ -461,7 +461,7 @@ Class Fields 'title' => 'Localisation' ), 'ex_domtom' => array( - 'label' => 'Exclusion des Dom-Tom', + 'label' => 'Exclusion des Dom-Tom', 'fields' => array( 'select' => array('value' => array('1' => 'Oui', '0' => 'Non')), ), @@ -473,7 +473,7 @@ Class Fields 'title' => 'Localisation' ), 'ex_entr' => array( - 'label' => 'Exclusion départements étrangés', + 'label' => 'Exclusion départements étrangés', 'fields' => array( 'select' => array('value' => array('1' => 'Oui', '0' => 'Non')), ), @@ -485,7 +485,7 @@ Class Fields 'title' => 'Localisation' ), 'ex_corse' => array( - 'label' => 'Exclusion corse', + 'label' => 'Exclusion corse', 'fields' => array( 'select' => array('value' => array('1' => 'Oui', '0' => 'Non')), ), @@ -497,7 +497,7 @@ Class Fields 'title' => 'Localisation' ), 'adr_reg' => array( - 'label' => 'Liste code région', + 'label' => 'Liste code région', 'fields' => array( 'text' => array('value' => null), 'textarea' => array('value' => null) @@ -510,7 +510,7 @@ Class Fields 'title' => 'Localisation' ), 'adr_reg_ex' => array( - 'label' => 'Liste code région (Exclure)', + 'label' => 'Liste code région (Exclure)', 'fields' => array( 'text' => array('value' => null), 'textarea' => array('value' => null) @@ -523,7 +523,7 @@ Class Fields 'title' => 'Localisation' ), 'zus' => array( - 'label' => 'Zones urbaines sensibles', + 'label' => 'Zones urbaines sensibles', 'fields' => array( 'select' => array('value' => array('1' => 'Oui', '0' => 'Non')), ), @@ -532,7 +532,7 @@ Class Fields 'type' => 'select', ), 'zru' => array( - 'label' => 'Zones de redynamisation urbaine', + 'label' => 'Zones de redynamisation urbaine', 'fields' => array( 'select' => array('value' => array('1' => 'Oui', '0' => 'Non')), ), @@ -541,7 +541,7 @@ Class Fields 'type' => 'select', ), 'zfu' => array( - 'label' => 'zones franches urbaines', + 'label' => 'zones franches urbaines', 'fields' => array( 'select' => array('value' => array('1' => 'Oui', '0' => 'Non')), ), @@ -550,7 +550,7 @@ Class Fields 'type' => 'select', ), 'cucs' => array( - 'label' => 'Contrats urbains de cohésion sociale', + 'label' => 'Contrats urbains de cohésion sociale', 'fields' => array( 'select' => array('value' => array('1' => 'Oui', '0' => 'Non')), ), @@ -559,7 +559,7 @@ Class Fields 'type' => 'select', ), 'zrr' => array( - 'label' => 'Zone de revitalisation rurale', + 'label' => 'Zone de revitalisation rurale', 'fields' => array( 'select' => array('value' => array('1' => 'Oui', '0' => 'Non')), ), @@ -568,7 +568,7 @@ Class Fields 'type' => 'select', ), 'zafr' => array( - 'label' => 'Zones Aide à finalité régionale', + 'label' => 'Zones Aide à finalité régionale', 'fields' => array( 'select' => array('value' => array('1' => 'Oui', '0' => 'Non')), ), @@ -578,7 +578,7 @@ Class Fields ), //juridique 'cj' => array( - 'label' => 'Forme Juridique', + 'label' => 'Forme Juridique', 'fields' => array( 'text' => array('value' => null), 'textarea' => array('value' => null) @@ -591,7 +591,7 @@ Class Fields 'title' => 'Forme Juridique' ), 'cj_ex' => array( - 'label' => 'Forme Juridique (Exclure)', + 'label' => 'Forme Juridique (Exclure)', 'fields' => array( 'text' => array('value' => null), 'textarea' => array('value' => null) @@ -604,7 +604,7 @@ Class Fields 'title' => 'Forme Juridique' ), 'actifEco' => array( - 'label' => 'Établissement économiquement actif', + 'label' => 'Établissement économiquement actif', 'fields' => array( 'select' => array('value' => array('1' => 'Oui', '0' => 'Non')), ), @@ -614,7 +614,7 @@ Class Fields 'class' => null ), 'procolHisto' => array( - 'label' => 'Présence procédure collective dans histo', + 'label' => 'Présence procédure collective dans histo', 'fields' => array( 'select' => array('value' => array('1' => 'Oui', '0' => 'Non')), ), @@ -624,7 +624,7 @@ Class Fields 'class' => null ), 'tvaIntraValide' => array( - 'label' => 'Numéro de TVA intracommunautaire valide', + 'label' => 'Numéro de TVA intracommunautaire valide', 'fields' => array( 'select' => array('value' => array('1' => 'Oui', '0' => 'Non')), ), @@ -634,7 +634,7 @@ Class Fields 'class' => null ), 'dateImmat' => array( - 'label' => 'Date d\'immatriculation', + 'label' => 'Date d\'immatriculation', 'fields' => array( 'interval' => array('value' => array('0', '1000')) ), @@ -645,11 +645,11 @@ Class Fields ), //financier 'bilType' => array( - 'label' => 'Type du dernier bilan', + 'label' => 'Type du dernier bilan', 'fields' => array( 'selectMultiple' => array('value' => array( - 'I' => 'Inconnue', - 'R' => 'Réel', + 'I' => 'Inconnue', + 'R' => 'Réel', 'E' => 'Estimé') ), ), @@ -659,11 +659,11 @@ Class Fields 'class' => null ), 'bilType_ex' => array( - 'label' => 'Type du dernier bilan (Exclure)', + 'label' => 'Type du dernier bilan (Exclure)', 'fields' => array( 'selectMultiple' => array('value' => array( - 'I' => 'Inconnue', - 'R' => 'Réel', + 'I' => 'Inconnue', + 'R' => 'Réel', 'E' => 'Estimé') ), ), @@ -673,11 +673,11 @@ Class Fields 'class' => null ), 'avisCs' => array( - 'label' => 'Informations de paiements', + 'label' => 'Informations de paiements', 'fields' => array( 'selectMultiple' => array('value' => array( '' => 'Risque indéterminé', - '00' => 'Aucun risque resencé', + '00' => 'Aucun risque resencé', '10' => 'Présence d\'impayé(s)', '15' => 'Présence de privilèges', '23-29-39-43' => 'Risque moyen', @@ -692,11 +692,11 @@ Class Fields 'class' => null ), 'avisCs_ex' => array( - 'label' => 'Informations de paiements (Exclure)', + 'label' => 'Informations de paiements (Exclure)', 'fields' => array( 'selectMultiple' => array('value' => array( '' => 'Risque indéterminé', - '00' => 'Aucun risque resencé', + '00' => 'Aucun risque resencé', '10' => 'Présence d\'impayé(s)', '15' => 'Présence de privilèges', '23-29-39-43' => 'Risque moyen', @@ -711,7 +711,7 @@ Class Fields 'class' => null ), 'bilDuree' => array( - 'label' => 'Durée du dernier bilan en mois', + 'label' => 'Durée du dernier bilan en mois', 'fields' => array( 'intervalSelect' => array( 'value' => array( @@ -729,7 +729,7 @@ Class Fields 'class' => null ), 'bilTca' => array( - 'label' => 'Tranche de CA issue du bilan', + 'label' => 'Tranche de CA issue du bilan', 'fields' => array( 'selectMultiple' => array('value' => array( '0' => 'Non déterminée', @@ -750,7 +750,7 @@ Class Fields 'class' => null ), 'bilTca_ex' => array( - 'label' => 'Tranche de CA issue du bilan (Exclure)', + 'label' => 'Tranche de CA issue du bilan (Exclure)', 'fields' => array( 'selectMultiple' => array('value' => array( '0' => 'Non déterminée', @@ -771,7 +771,7 @@ Class Fields 'class' => null ), 'bilAnnee' => array( - 'label' => 'Dernière année de bilan', + 'label' => 'Dernière année de bilan', 'fields' => array( 'interval' => array('value' => array('0', '1000')) ), @@ -781,7 +781,7 @@ Class Fields 'class' => null ), 'bilCloture' => array( - 'label' => 'Dernière date de clôture du bilan', + 'label' => 'Dernière date de clôture du bilan', 'fields' => array( 'interval' => array('value' => array('0', '1000')) ), @@ -791,7 +791,7 @@ Class Fields 'class' => 'datepicker' ), 'bilEE' => array( - 'label' => 'Total bilan (EE)', + 'label' => 'Total bilan (EE)', 'fields' => array( 'interval' => array('value' => array('0', '10000000')) ), @@ -801,7 +801,7 @@ Class Fields 'class' => null ), 'bilFL' => array( - 'label' => 'CA total (FL)', + 'label' => 'CA total (FL)', 'fields' => array( 'interval' => array('value' => array('0', '10000000')) ), @@ -811,7 +811,7 @@ Class Fields 'class' => null ), 'bilFK' => array( - 'label' => 'Chiffre d\'affaires Export (FK)', + 'label' => 'Chiffre d\'affaires Export (FK)', 'fields' => array( 'interval' => array('value' => array('0', '10000000')) ), @@ -821,7 +821,7 @@ Class Fields 'class' => null ), 'bilFR' => array( - 'label' => 'Produits d\'Exploitation (FR)', + 'label' => 'Produits d\'Exploitation (FR)', 'fields' => array( 'interval' => array('value' => array('0', '10000000')) ), @@ -831,7 +831,7 @@ Class Fields 'class' => null ), 'bilGF' => array( - 'label' => 'Charges d\'Exploitation (GF)', + 'label' => 'Charges d\'Exploitation (GF)', 'fields' => array( 'interval' => array('value' => array('0', '10000000')) ), @@ -841,7 +841,7 @@ Class Fields 'class' => null ), 'bilGP' => array( - 'label' => 'Charges Financières (GP)', + 'label' => 'Charges Financières (GP)', 'fields' => array( 'interval' => array('value' => array('0', '10000000')) ), @@ -851,7 +851,7 @@ Class Fields 'class' => null ), '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( 'interval' => array('value' => array('0', '10000000')) ), @@ -861,7 +861,7 @@ Class Fields 'class' => null ), 'bilHD' => array( - 'label' => 'Produits Exceptionnels (HD)', + 'label' => 'Produits Exceptionnels (HD)', 'fields' => array( 'interval' => array('value' => array('0', '10000000')) ), @@ -871,7 +871,7 @@ Class Fields 'class' => null ), 'bilHH' => array( - 'label' => 'Charges Exceptionnels (HH)', + 'label' => 'Charges Exceptionnels (HH)', 'fields' => array( 'interval' => array('value' => array('0', '10000000')) ), @@ -881,7 +881,7 @@ Class Fields 'class' => null ), 'bilHL' => array( - 'label' => 'Total des Produits (HL)', + 'label' => 'Total des Produits (HL)', 'fields' => array( 'interval' => array('value' => array('0', '10000000')) ), @@ -891,7 +891,7 @@ Class Fields 'class' => null ), 'bilHM' => array( - 'label' => 'Total des Charges (HM)', + 'label' => 'Total des Charges (HM)', 'fields' => array( 'interval' => array('value' => array('0', '10000000')) ), @@ -901,7 +901,7 @@ Class Fields 'class' => null ), 'bilHN' => array( - 'label' => 'Résultat (HN)', + 'label' => 'Résultat (HN)', 'fields' => array( 'interval' => array('value' => array('0', '10000000')) ), @@ -911,7 +911,7 @@ Class Fields 'class' => null ), 'bilYP' => array( - 'label' => 'Effectif salarié (YP)', + 'label' => 'Effectif salarié (YP)', 'fields' => array( 'interval' => array('value' => array('0', '10000000')) ), @@ -922,13 +922,13 @@ Class Fields ) ); protected $requeteSql = array('cj'); - + public function getValues($val = null) { if ( $val === null ) { require_once 'Scores/SessionCiblage.php'; $session = new SessionCiblage(); - $val = $session->getCriteres(); + $val = $session->getCriteres(); } $values = array(); foreach($val as $key => $item) @@ -936,7 +936,7 @@ Class Fields if($item != '') { if( $this->fields[$key]['type'] == 'interval' or $this->fields[$key]['type'] == 'intervalSelect' or - $this->fields[$key]['type'] == 'textarea' and + $this->fields[$key]['type'] == 'textarea' and empty($this->fields[$key]['action'])) { $values[$key] = explode(',', $item); @@ -961,7 +961,7 @@ Class Fields } return ($values); } - + public function selectArbo($name, $valeur) { $values = array(); @@ -1012,14 +1012,14 @@ Class Fields } return ($values); } - + protected function fj($name, $valeur) { - $table = new Table_Formejuridiques(); - + $table = new Application_Model_FormJuridique(); + if(strlen($valeur) < 5) { $sql = $table->select('formejuridique', array('fjCode')) - ->where('fjCode LIKE "'.$valeur.'%"'); + ->where('fjCode LIKE "'.$valeur.'%"'); } else { $sql = $table->select('formejuridique', array('fjCode')) ->where('fjCode = "'.$valeur.'"'); @@ -1032,13 +1032,13 @@ Class Fields } return ($return); } - + protected function localisationArbo($name, $valeur) { if(strlen($valeur) == 2) { switch($name) { case 'adr_reg': - $table = new Table_Departements(); + $table = new Application_Model_Departements(); $sql = $table->select() ->from('departements') ->where('codeRegionInsee ='.$valeur) @@ -1057,14 +1057,14 @@ Class Fields return (array($valeur)); return ($return); } - + protected function nafArbo($key, $valeur) { $value = array(); - $table = new Table_Nafs(); + $table = new Application_Model_Naf(); $valeur = trim($valeur); - - if(strlen($valeur) == 1) + + if(strlen($valeur) == 1) { $sql = $table->select()->where('parent = ?', $valeur); $result =$table->fetchAll($sql)->toArray(); @@ -1082,7 +1082,7 @@ Class Fields } return ($value); } - + public function __construct($batch = false) { if(!$batch) { @@ -1090,38 +1090,38 @@ Class Fields if($this->fields[$name]['type'] == 'interval') { $minmax = $this->getMinMax($name); 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']); } } } } } - + static public function getMinMax($name) { $tab = array('dateCrea_ent','dateCrea_etab'); if(!in_array($name, $tab)) { - $table = new Table_Minmaxs(); + $table = new Application_Model_MinMax(); return ($table->fetchAll($table->select()->where('cle = ?', $name))->toArray()); } return (array()); } - + public function getFields() { return ($this->fields); } - + public function get($name) { if($this->fields[$name]['activated'] == true) return ($this->fields[$name]); return (null); } - + public function getByFamille($famille) { $section = array(); - + foreach($this->fields as $name => $item) { if($item['famille'] == $famille) { $section[$name] = $item; @@ -1129,7 +1129,7 @@ Class Fields } return ($section); } - + public function getNotActivated($fields) { foreach($fields as $name => $field) @@ -1137,12 +1137,12 @@ Class Fields if(!$field['activated']) { $desactivated[$name] = ""; } else if ($field['activated']){ - + } } return (json_encode($desactivated)); } - + public function getLibelle($name) { return ($this->fields[$name]['label']);