2011-01-06 08:37:20 +00:00
|
|
|
<?php
|
|
|
|
class RechercheController extends Zend_Controller_Action
|
|
|
|
{
|
2013-11-13 14:10:30 +00:00
|
|
|
protected $theme;
|
2011-01-06 08:37:20 +00:00
|
|
|
|
2011-08-25 08:57:37 +00:00
|
|
|
public function init()
|
|
|
|
{
|
|
|
|
/** Pour Giant **/
|
|
|
|
if(isset($_SESSION['recherche']['giant']))
|
|
|
|
unset($_SESSION['recherche']['giant']);
|
2011-05-26 13:14:06 +00:00
|
|
|
|
2011-09-13 20:14:10 +00:00
|
|
|
require_once 'Scores/WsScores.php';
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2013-11-13 14:10:30 +00:00
|
|
|
$this->theme = Zend_Registry::get('theme');
|
|
|
|
$this->view->inlineScript()->appendFile($this->theme->pathScript.'/recherche.js', 'text/javascript');
|
2011-08-25 08:57:37 +00:00
|
|
|
}
|
2011-01-06 08:37:20 +00:00
|
|
|
|
|
|
|
public function indexAction()
|
|
|
|
{
|
2013-12-26 14:42:44 +00:00
|
|
|
$this->forward('entreprise');
|
2011-01-06 08:37:20 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-05-26 13:14:06 +00:00
|
|
|
/**
|
|
|
|
* Affiche le formulaire de recherche entreprise
|
|
|
|
*/
|
2011-01-07 17:16:07 +00:00
|
|
|
public function entrepriseAction()
|
|
|
|
{
|
2011-05-19 13:55:35 +00:00
|
|
|
$request = $this->getRequest();
|
2013-12-26 14:42:44 +00:00
|
|
|
$this->view->headTitle()->prepend('Recherche Entreprise');
|
2013-05-17 07:06:21 +00:00
|
|
|
$form = new Application_Form_RechercheEntreprise();
|
2011-06-08 13:43:49 +00:00
|
|
|
if ( $request->isPost() || $request->isGet() ){
|
|
|
|
$form->populate($request->getParams());
|
|
|
|
}
|
2011-09-02 14:46:43 +00:00
|
|
|
$this->view->assign('message', $request->getParam('message'));
|
|
|
|
$this->view->assign('form', $form);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
|
|
|
$user = new Scores_Utilisateur();
|
2012-12-26 10:36:47 +00:00
|
|
|
$this->view->assign('SEARCHENT', $user->checkPerm('SEARCHENT'));
|
2012-05-20 16:31:28 +00:00
|
|
|
$this->view->assign('RefClient', $user->checkPref('rechref'));
|
2011-01-07 17:16:07 +00:00
|
|
|
}
|
2011-02-16 15:47:05 +00:00
|
|
|
|
2011-05-26 13:14:06 +00:00
|
|
|
/**
|
|
|
|
* Affiche le formulaire de recherche dirigeants
|
|
|
|
*/
|
2011-04-11 15:51:41 +00:00
|
|
|
public function dirigeantAction()
|
|
|
|
{
|
2011-08-19 14:39:49 +00:00
|
|
|
$request = $this->getRequest();
|
2013-12-26 14:42:44 +00:00
|
|
|
$this->view->headTitle()->prepend('Recherche Dirigeant');
|
2013-05-17 07:06:21 +00:00
|
|
|
$form = new Application_Form_RechercheDirigeant();
|
2011-08-19 14:37:17 +00:00
|
|
|
if ( $request->isPost() || $request->isGet() ){
|
|
|
|
$form->populate($request->getParams());
|
2012-05-20 16:31:28 +00:00
|
|
|
}
|
2011-04-13 12:53:09 +00:00
|
|
|
$this->view->assign('form', $form);
|
2011-04-11 14:19:14 +00:00
|
|
|
}
|
2013-10-23 14:20:56 +00:00
|
|
|
|
2013-09-16 15:41:31 +00:00
|
|
|
/**
|
|
|
|
* Affiche le formulaire de recherche WorldCheck
|
|
|
|
*/
|
|
|
|
public function worldcheckAction()
|
|
|
|
{
|
|
|
|
$request = $this->getRequest();
|
2013-12-26 14:42:44 +00:00
|
|
|
$this->view->headTitle()->prepend('Recherche WorldCheck');
|
2013-09-16 15:41:31 +00:00
|
|
|
$form = new Application_Form_RechercheWorldcheck();
|
|
|
|
if ( $request->isPost() || $request->isGet() ){
|
|
|
|
$form->populate($request->getParams());
|
|
|
|
}
|
|
|
|
$this->view->assign('form', $form);
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-08-16 13:49:22 +00:00
|
|
|
/**
|
|
|
|
* Affiche le formulaire de recherche actionnaire
|
|
|
|
* @todo : style pour les pourcentages
|
|
|
|
*/
|
|
|
|
public function actionnaireAction()
|
|
|
|
{
|
2012-01-24 15:50:09 +00:00
|
|
|
$request = $this->getRequest();
|
2011-08-16 13:49:22 +00:00
|
|
|
$this->view->headTitle()->append('Recherche Actionnaire');
|
2013-05-17 07:06:21 +00:00
|
|
|
$form = new Application_Form_RechercheActionnaire();
|
2012-01-24 15:50:09 +00:00
|
|
|
if ( $request->isPost() || $request->isGet() ){
|
|
|
|
$form->populate($request->getParams());
|
2012-05-20 16:31:28 +00:00
|
|
|
}
|
2011-08-16 13:49:22 +00:00
|
|
|
$this->view->assign('form', $form);
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-05-26 13:14:06 +00:00
|
|
|
/**
|
|
|
|
* Affiche le formulaire de recherche annonces
|
|
|
|
*/
|
2011-04-11 15:51:41 +00:00
|
|
|
public function annonceAction()
|
|
|
|
{
|
2013-12-26 14:42:44 +00:00
|
|
|
$this->view->headTitle()->prepend('Recherche Annonce');
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2013-11-29 13:54:52 +00:00
|
|
|
$session = new Scores_Session_Recherche();
|
2012-01-03 14:46:22 +00:00
|
|
|
$recherche = $session->item(0);
|
|
|
|
if ($recherche['type']=='annonce') {
|
2012-05-20 16:31:28 +00:00
|
|
|
$params = $recherche['params']['formA'];
|
2012-01-03 14:46:22 +00:00
|
|
|
} else {
|
|
|
|
$params = array();
|
|
|
|
}
|
|
|
|
$this->view->assign('recherche', $params);
|
2011-04-11 14:19:14 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-08-12 13:01:39 +00:00
|
|
|
public function annoncelisteAction()
|
|
|
|
{
|
2012-05-20 16:31:28 +00:00
|
|
|
$request = $this->getRequest();
|
2011-08-12 13:01:39 +00:00
|
|
|
$params = $request->getParams();
|
2012-02-03 20:58:57 +00:00
|
|
|
$token = $request->getParam('token', null);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2013-11-29 13:54:52 +00:00
|
|
|
$session = new Scores_Session_Recherche();
|
2011-09-19 21:38:36 +00:00
|
|
|
|
2012-05-20 16:31:28 +00:00
|
|
|
if (array_key_exists('formA', $params)) {
|
2012-02-08 10:21:47 +00:00
|
|
|
$token = $session->save('annonce', $params);
|
2012-05-20 16:31:28 +00:00
|
|
|
} else {
|
2012-02-03 20:58:57 +00:00
|
|
|
$recherche = $session->get($token);
|
2012-05-20 16:31:28 +00:00
|
|
|
$params = $recherche['params'];
|
|
|
|
}
|
|
|
|
|
2011-08-12 13:01:39 +00:00
|
|
|
if( !isset($params['formA']['annee']) && isset($params['formA']['dateparution']) )
|
|
|
|
{
|
|
|
|
$dateparution = str_replace('/', '', $dateparution);
|
|
|
|
$jj = substring($annee, 0, 2);
|
|
|
|
$mm = substring($annee, 2, 2);
|
|
|
|
$aa = substring($annee, 4, 4);
|
|
|
|
$dateparution = $aa.$mm.$jj;
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-08-12 13:01:39 +00:00
|
|
|
$p = $request->getParam('p', 0);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-08-12 13:01:39 +00:00
|
|
|
if($params['formA']['histo']!='on')
|
|
|
|
{
|
|
|
|
$ra = array();
|
|
|
|
$ra['dateAnnee'] = $params['formA']['annee'];
|
|
|
|
$ra['numParution'] = $params['formA']['nparution'];
|
|
|
|
if($params['formA']['source']=='bodacc')
|
|
|
|
{
|
|
|
|
$ra['source'] = strtoupper('bod'.$params['formA']['bodacc']);
|
|
|
|
$ra['numAnnonce'] = $params['formA']['nannonce'];
|
|
|
|
}
|
|
|
|
elseif($params['formA']['source']=='balo')
|
|
|
|
{
|
|
|
|
$ra['source'] = strtoupper($params['formA']['source']);
|
|
|
|
$ra['numAnnonce'] = $params['formA']['naffaire'];
|
|
|
|
}
|
|
|
|
elseif($params['source']=='asso')
|
|
|
|
{
|
|
|
|
$ra['source'] = strtoupper($params['formA']['source']);
|
|
|
|
$ra['numAnnonce'] = $params['formA']['nannonce'];
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-09-13 20:14:10 +00:00
|
|
|
$ws = new WsScores();
|
|
|
|
$result = $ws->rechercheAnnonce($ra['source'], $ra['dateAnnee'], $ra['numParution'], $ra['numAnnonce']);
|
|
|
|
$infos = $result->result->item;
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-08-12 13:01:39 +00:00
|
|
|
$parametresTxt = array(
|
2012-05-20 16:31:28 +00:00
|
|
|
'source'=>'Source',
|
|
|
|
'annee'=>'Année',
|
|
|
|
'dateparution'=>'Date de parution',
|
|
|
|
'nparution'=>'Numéro de parution',
|
|
|
|
'bpage'=>'Page',
|
|
|
|
'nannonce'=>'Numéro d\'annonce',
|
|
|
|
'naffaire'=>'Numéro d\'affaire',
|
2011-08-12 13:01:39 +00:00
|
|
|
'txt'=>'Recherche');
|
|
|
|
$strCriteres = '';
|
|
|
|
foreach ($parametresTxt as $key => $param) {
|
|
|
|
if($params['formA'][$key]!='' && $param!='') {
|
|
|
|
$strCriteres.= $param.' : '.$params['formA'][$key].' ';
|
|
|
|
}
|
|
|
|
}
|
2011-09-13 20:14:10 +00:00
|
|
|
$this->view->assign('criteres', $result->criteres);
|
|
|
|
$this->view->assign('infos', $infos);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-09-13 20:14:10 +00:00
|
|
|
} else {
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-08-12 13:01:39 +00:00
|
|
|
//Suppression des caractères accentués
|
2015-03-20 09:46:52 +00:00
|
|
|
$txt = Scores_Locale_String::cleanstring($params['formA']['txt']);
|
2011-08-12 13:01:39 +00:00
|
|
|
//Remplacement du caractère § par ~
|
|
|
|
$txt = str_replace('$', '~', $txt);
|
|
|
|
// Recherche siren tenant compte des anomalies d'OCR
|
|
|
|
$txt = preg_replace('/([0-9]{3})([0-9]{3})([0-9]{3})/','"$1$2$3"|"$1 $2$3"|"$1$2 $3"|"$1 $2 $3"', $txt);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-09-13 20:14:10 +00:00
|
|
|
$ws = new WsScores();
|
|
|
|
$result = $ws->rechercheHisto($txt, $params['formA']['annee'], $params['formA']['bodacc'], $p);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-09-13 20:14:10 +00:00
|
|
|
$infos = $result->reponses->item;
|
2012-06-05 13:32:45 +00:00
|
|
|
$mots = $result->mots->item;
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2012-06-05 13:32:45 +00:00
|
|
|
$annonces = array();
|
|
|
|
foreach($infos as $annonce)
|
|
|
|
{
|
|
|
|
|
|
|
|
//Mark all search words in bold
|
2012-11-20 07:11:02 +00:00
|
|
|
$texte = $annonce->Texte;
|
|
|
|
foreach( $mots as $mot ){
|
|
|
|
$texte = preg_replace('/'.$mot.'/i', '<b>'.strtoupper($mot).'</b>', $texte);
|
2012-06-05 13:32:45 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2012-06-05 13:32:45 +00:00
|
|
|
//Transform Code as a better text
|
|
|
|
$code = $annonce->Code;
|
2012-11-20 07:11:02 +00:00
|
|
|
if( substr($code,0,3)=='BOD' )
|
|
|
|
{
|
|
|
|
$code = '<u>BODACC :</u> '.substr($code,3,1);
|
2012-06-05 13:32:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//Change URL to download file
|
2012-09-10 14:03:47 +00:00
|
|
|
//$fichier = str_replace("http://wse.scores-decisions.com:8081/fichier/bodacc/q",'',$annonce->Fichier);
|
|
|
|
$pos = strrpos($annonce->Fichier, '/q/');
|
|
|
|
$host = substr($annonce->Fichier, 0, $pos);
|
|
|
|
$fichier = substr($annonce->Fichier, $pos+3);
|
2012-12-26 10:36:47 +00:00
|
|
|
|
2012-06-05 13:32:45 +00:00
|
|
|
$annonces[] = array (
|
|
|
|
'annee' => $annonce->Annee,
|
|
|
|
'code' => $code,
|
|
|
|
'text' => $texte,
|
2012-09-10 14:03:47 +00:00
|
|
|
'file' => $this->view->url(array(
|
|
|
|
'controller'=>'telechargement',
|
|
|
|
'action'=>'histopdf',
|
|
|
|
'q' => $fichier,
|
2014-08-11 12:11:23 +00:00
|
|
|
'host' => base64_encode($host)), 'default', true
|
2012-09-10 14:03:47 +00:00
|
|
|
),
|
2012-06-05 13:32:45 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
$this->view->assign('annonces', $annonces);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-08-12 13:01:39 +00:00
|
|
|
$parametresTxt = array(
|
|
|
|
'source'=>'Source',
|
|
|
|
'bodacc'=>'Type',
|
|
|
|
'histo'=>'',
|
|
|
|
'annee'=>'Année',
|
|
|
|
'dateparution'=>'Date de parution',
|
|
|
|
'nparution'=>'Numéro de parution',
|
|
|
|
'bpage'=>'Page',
|
|
|
|
'nannonce'=>'Numéro d\'annonce',
|
|
|
|
'naffaire'=>'Numéro d\'affaire',
|
|
|
|
'txt'=>'Recherche');
|
|
|
|
$strCriteres = '';
|
|
|
|
foreach ($parametresTxt as $key => $param) {
|
|
|
|
if($params['formA'][$key]!='' && $param!='') {
|
|
|
|
$strCriteres.= $param.' : '.$params['formA'][$key].', ';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-09-20 08:24:27 +00:00
|
|
|
$this->view->assign('p', $p);
|
2012-02-03 20:58:57 +00:00
|
|
|
$this->view->assign('token', $token);
|
|
|
|
|
2012-05-20 16:31:28 +00:00
|
|
|
$user = new Scores_Utilisateur();
|
2012-02-03 20:58:57 +00:00
|
|
|
$this->view->assign('userNbReponses', $user->getNbRep());
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-09-13 20:14:10 +00:00
|
|
|
$this->view->assign('nbReponses', $result->nbReponses);
|
|
|
|
$this->view->assign('nbReponsesTotal', $result->nbReponsesTotal);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-08-12 13:01:39 +00:00
|
|
|
$this->view->assign('strCriteres', $strCriteres);
|
|
|
|
$this->view->assign('histo', $params['formA']['histo']);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-08-12 13:01:39 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-02-16 15:47:05 +00:00
|
|
|
public function internationaleAction(){}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-04-11 14:19:14 +00:00
|
|
|
public function lastAction()
|
|
|
|
{
|
|
|
|
$this->view->headTitle()->append('Liste des dernières recherches');
|
2012-01-24 15:50:09 +00:00
|
|
|
// @todo : Attention lorsqu'il n'y pas de recherche enregistré
|
2013-11-29 13:54:52 +00:00
|
|
|
$rechercheSession = new Scores_Session_Recherche();
|
2011-08-12 20:28:22 +00:00
|
|
|
$derniereRecherche = $rechercheSession->item(0);
|
|
|
|
$params = array_merge(array('type'=> $derniereRecherche['type']), $derniereRecherche['params']);
|
|
|
|
$this->_forward('liste', 'recherche', null, $params);
|
2011-05-18 15:42:35 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-05-18 15:42:35 +00:00
|
|
|
public function listAction()
|
|
|
|
{
|
|
|
|
$this->view->headTitle()->append('Liste des dernières recherches');
|
2013-11-29 13:54:52 +00:00
|
|
|
$rechercheSession = new Scores_Session_Recherche();
|
2011-05-26 13:14:06 +00:00
|
|
|
$this->view->assign('historique', $rechercheSession->liste());
|
2011-04-11 14:19:14 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-04-11 14:19:14 +00:00
|
|
|
public function enqueteAction()
|
|
|
|
{
|
|
|
|
$this->view->headTitle()->append('Enquête');
|
2012-05-20 16:31:28 +00:00
|
|
|
|
|
|
|
$user = new Scores_Utilisateur();
|
2011-04-11 14:19:14 +00:00
|
|
|
if (!$user->checkPerm('INVESTIG')){
|
2011-04-11 15:51:41 +00:00
|
|
|
$this->renderScript('error/error-perms.phtml');
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2013-05-17 07:06:21 +00:00
|
|
|
$form = new Application_Form_RechercheEnquete();
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-05-19 13:55:35 +00:00
|
|
|
$request = $this->getRequest();
|
|
|
|
if ($request->isPost() && $form->isValid($request->getParams())) {
|
|
|
|
|
|
|
|
Zend_Registry::get('firebug')->info($form->getValues());
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2012-11-05 15:33:01 +00:00
|
|
|
$c = Zend_Registry::get('config');
|
2012-11-16 14:12:03 +00:00
|
|
|
$path = realpath($c->profil->path->data).'/log';
|
2011-05-19 13:55:35 +00:00
|
|
|
$fp = fopen($path.'/enquetes.csv', 'a');
|
2011-05-26 13:14:06 +00:00
|
|
|
fwrite($fp, date('Y/m/d H:i:s').' - '.print_r($form->getValues(),true)."\n");
|
2011-05-19 13:55:35 +00:00
|
|
|
fclose($fp);
|
|
|
|
$message = "Détail de la demande d'investigation<br/>";
|
|
|
|
foreach($form->getValues() as $key => $value) {
|
|
|
|
$message.= ucwords($key)." : ".$value."<br/>";
|
|
|
|
}
|
|
|
|
$message.= "<br/>";
|
|
|
|
$message.= "Identité du demandeur<br/>";
|
|
|
|
$message.= "Login : ".$user->getLogin()."<br/>";
|
|
|
|
$message.= "Email : ".$user->getEmail()."<br/>";
|
|
|
|
$message.= "Nom : ".$user->getNom()."<br/>";
|
|
|
|
$message.= "Prénom : ".$user->getPrenom()."<br/>";
|
|
|
|
$objet = "Demande d'investigation";
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2013-10-25 14:30:46 +00:00
|
|
|
$mail = new Scores_Mail();
|
2011-05-19 13:55:35 +00:00
|
|
|
$mail->setFrom('contact');
|
2013-03-21 08:39:06 +00:00
|
|
|
$mail->addToKey('support');
|
2011-05-19 13:55:35 +00:00
|
|
|
$mail->setSubject($objet);
|
|
|
|
$mail->setBodyHtml($message);
|
|
|
|
$mail->send();
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-05-19 13:55:35 +00:00
|
|
|
} else {
|
|
|
|
//Affichage formulaire
|
|
|
|
$data = array( 'email' => $user->getEmail() );
|
|
|
|
if ($request->isPost()){
|
|
|
|
$data = $form->getValues();
|
|
|
|
}
|
|
|
|
$form->populate($data);
|
|
|
|
$this->view->assign('form', $form);
|
|
|
|
}
|
2011-04-11 14:19:14 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-05-26 13:14:06 +00:00
|
|
|
/**
|
|
|
|
* Affiche les résultats d'une recherche
|
|
|
|
*/
|
2011-04-11 14:19:14 +00:00
|
|
|
public function listeAction()
|
|
|
|
{
|
|
|
|
$request = $this->getRequest();
|
2011-04-11 14:32:37 +00:00
|
|
|
$params = $request->getParams();
|
2011-06-10 15:01:46 +00:00
|
|
|
$type = $request->getParam('type', '');
|
2012-02-03 20:58:57 +00:00
|
|
|
$token = $request->getParam('token', null);
|
2012-04-23 16:11:49 +00:00
|
|
|
$filtre = $request->getParam('filtre', 'tout');
|
2012-12-26 10:36:47 +00:00
|
|
|
|
2011-08-19 15:49:29 +00:00
|
|
|
//On vérifie que le formulaire ait au moins un des champs rempli
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2012-03-08 15:55:38 +00:00
|
|
|
$action = 'entreprise';
|
|
|
|
switch($type){
|
2012-05-20 16:31:28 +00:00
|
|
|
case 'ent':
|
|
|
|
$action = 'entreprise';
|
2013-05-17 07:06:21 +00:00
|
|
|
$listParams = array('siret', 'raisonSociale', 'numero', 'voie', 'cpVille', 'telFax', 'naf', 'fj');
|
2012-03-08 15:55:38 +00:00
|
|
|
break;
|
2012-05-20 16:31:28 +00:00
|
|
|
case 'dir':
|
|
|
|
$action = 'dirigeant';
|
2012-03-08 15:55:38 +00:00
|
|
|
$listParams = array('dirNom', 'dirPrenom', 'dirDateNaissJJ', 'dirDateNaissMM', 'dirDateNaissAAAA', 'dirCpVille');
|
|
|
|
break;
|
2012-05-20 16:31:28 +00:00
|
|
|
case 'act':
|
|
|
|
$action = 'actionnaire';
|
2012-03-08 15:55:38 +00:00
|
|
|
$listParams = array('siret', 'actNomRs', 'cpVille', 'pays', 'cpVille', 'pctMin', 'pctMax');
|
|
|
|
break;
|
2013-09-16 15:41:31 +00:00
|
|
|
case 'wcheck':
|
|
|
|
$action = 'worldcheck';
|
|
|
|
$listParams = array('dirNom', 'dirPrenom', 'dirType');
|
|
|
|
break;
|
2012-05-20 16:31:28 +00:00
|
|
|
}
|
|
|
|
|
2013-11-29 13:54:52 +00:00
|
|
|
$rechercheParams = new Scores_Session_Recherche();
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-06-14 10:12:53 +00:00
|
|
|
//Si le formulaire a été soumis alors on enregistre en session et on redirige
|
2012-05-20 16:31:28 +00:00
|
|
|
if ( !empty($type) ) {
|
2012-03-26 09:38:04 +00:00
|
|
|
//Vérification si au moins un champs a été saisie
|
|
|
|
$nbField = count($listParams);
|
2012-11-20 07:11:02 +00:00
|
|
|
foreach($listParams as $key){
|
|
|
|
if(!empty($params[$key])){
|
2013-09-16 15:41:31 +00:00
|
|
|
$params[$key] = strip_tags($params[$key]);
|
2012-03-26 09:38:04 +00:00
|
|
|
} else {
|
|
|
|
$nbField--;
|
2012-11-20 07:11:02 +00:00
|
|
|
}
|
2012-03-26 09:38:04 +00:00
|
|
|
}
|
|
|
|
if ($nbField==0){
|
2012-11-20 07:11:02 +00:00
|
|
|
$this->_redirect('/recherche/'.$action);
|
2012-03-26 09:38:04 +00:00
|
|
|
}
|
2013-10-23 14:20:56 +00:00
|
|
|
|
2013-09-16 15:41:31 +00:00
|
|
|
//Worldcheck - Vérification si les champs demandés (NOM et TYPE) ont été saisie
|
|
|
|
if ($type=='wcheck')
|
|
|
|
{
|
|
|
|
$required = array('dirNom', 'dirType');
|
|
|
|
foreach($required as $item){
|
|
|
|
if(empty($params[$item])){
|
|
|
|
$this->_redirect('/recherche/worldcheck');
|
|
|
|
break;
|
|
|
|
}
|
2013-10-23 14:20:56 +00:00
|
|
|
}
|
2013-09-16 15:41:31 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2012-03-26 09:38:04 +00:00
|
|
|
//Redirection
|
2012-02-03 20:58:57 +00:00
|
|
|
$token = $rechercheParams->save($type, $params);
|
|
|
|
$this->_redirect('recherche/liste/token/'.$token);
|
2011-06-14 10:12:53 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-06-14 10:12:53 +00:00
|
|
|
//On selectionne en session
|
2011-06-10 15:01:46 +00:00
|
|
|
if (count($rechercheParams->liste())>0){
|
2012-02-03 20:58:57 +00:00
|
|
|
$recherche = $rechercheParams->get($token);
|
2011-06-10 15:01:46 +00:00
|
|
|
$type = $recherche['type'];
|
|
|
|
$params = $recherche['params'];
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-04-15 12:40:29 +00:00
|
|
|
//Giant
|
2011-08-25 08:57:37 +00:00
|
|
|
if( !empty($params['pays']) && $type == 'ent' ){
|
2011-08-26 07:27:48 +00:00
|
|
|
Zend_Registry::get('firebug')->info('RECHERCHE GIANT');
|
2012-10-21 15:13:59 +00:00
|
|
|
$this->_forward('search', 'giant', null, $params);
|
2013-09-16 15:41:31 +00:00
|
|
|
//Worldcheck
|
|
|
|
} elseif ($type == 'wcheck' ) {
|
|
|
|
$this->_forward('index', 'worldcheck', null, $params);
|
2013-10-23 14:20:56 +00:00
|
|
|
//Recherche
|
2011-09-02 15:17:08 +00:00
|
|
|
} else {
|
2011-08-26 07:27:48 +00:00
|
|
|
|
2012-05-20 16:31:28 +00:00
|
|
|
$user = new Scores_Utilisateur();
|
2012-12-26 10:36:47 +00:00
|
|
|
$this->view->assign('IDENTITE', $user->checkPerm('IDENTITE'));
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2014-02-25 20:39:38 +00:00
|
|
|
//Pagination
|
|
|
|
$page = $request->getParam('page', 1);
|
|
|
|
if ( $page <= 0 ) $page = 1;
|
|
|
|
$nbAffichage = $user->getNbRep();
|
|
|
|
$position = ($page - 1 ) * $nbAffichage;
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-09-02 15:17:08 +00:00
|
|
|
require_once 'Scores/WsScores.php';
|
|
|
|
$ws = new WsScores();
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-09-02 15:17:08 +00:00
|
|
|
//Criteres recherche entreprise
|
2012-04-23 16:11:49 +00:00
|
|
|
if ( $type=='ent' ) {
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-09-02 15:17:08 +00:00
|
|
|
// Type de recherche = entreprises
|
|
|
|
$telFax = trim(preg_replace('/[^0-9]/', '', $params['telFax']));
|
|
|
|
$naf = trim(preg_replace('/[^0-9A-Z]/i', '', $params['naf']));
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-09-02 15:17:08 +00:00
|
|
|
// Traitement des données formulaire
|
2015-03-20 09:46:52 +00:00
|
|
|
$raisonSociale = Scores_Locale_String::cleanutf8($params['raisonSociale']);
|
2012-04-24 09:40:47 +00:00
|
|
|
$raisonSociale = str_replace(array('(',')', '/'), array('', '', ' '), $raisonSociale);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-10-25 08:21:13 +00:00
|
|
|
$numVoie = preg_replace('/[^0-9]/', '', $params['numero']);
|
2011-09-02 15:17:08 +00:00
|
|
|
if ($numVoie > 9999) {
|
2012-04-17 14:10:30 +00:00
|
|
|
$numVoie = '';
|
2011-09-02 15:17:08 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2015-03-20 09:46:52 +00:00
|
|
|
$libVoie = Scores_Locale_String::cleanutf8($params['voie']);
|
2012-04-17 14:10:30 +00:00
|
|
|
$libVoie = str_replace(array('(',')', '/'), array('', '', ' '), $libVoie);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2015-03-20 09:46:52 +00:00
|
|
|
$cpVille = Scores_Locale_String::cleanutf8($params['cpVille']);
|
2012-04-17 14:10:30 +00:00
|
|
|
$cpVille = str_replace(array('(',')', '/'), array('', '', ' '), $cpVille);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2012-12-26 10:36:47 +00:00
|
|
|
|
2012-09-10 14:03:47 +00:00
|
|
|
//( (2[A|B]) | [0-9]{2,5} )
|
|
|
|
if (preg_match("/^(2[A|B]|[0-9]{2,5})(.*)/i", $cpVille, $matches)) {
|
2011-09-02 15:17:08 +00:00
|
|
|
$cp = trim($matches[1]);
|
|
|
|
$ville = trim($matches[2]);
|
|
|
|
} else {
|
|
|
|
$cp = '';
|
|
|
|
$ville = trim($cpVille);
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-09-02 15:17:08 +00:00
|
|
|
$criteres = array();
|
2012-02-16 09:04:48 +00:00
|
|
|
$criteres['identifiant'] = str_replace(array(' ', '.'), array('',''), trim($params['siret']));
|
2011-09-02 15:17:08 +00:00
|
|
|
$criteres['raisonSociale'] = $raisonSociale;
|
|
|
|
$criteres['adresse'] = $numVoie.' '.$libVoie;
|
|
|
|
$criteres['codePostal']= $cp;
|
|
|
|
$criteres['ville'] = $ville;
|
|
|
|
$criteres['telFax'] = $telFax;
|
|
|
|
$criteres['naf'] = $naf;
|
|
|
|
$criteres['siege'] = false;
|
2013-05-14 09:32:08 +00:00
|
|
|
$criteres['fj'] = array_key_exists('fj', $params) ? $params['fj'] : '';
|
2012-12-26 10:36:47 +00:00
|
|
|
|
2012-11-20 07:11:02 +00:00
|
|
|
//Affichage du filtre actif/inactif
|
|
|
|
$filtres = array(
|
|
|
|
'tout' => array(
|
|
|
|
'txt'=>'Afficher tous les résultats',
|
|
|
|
'select'=>'',
|
|
|
|
'value' => 2,
|
|
|
|
),
|
|
|
|
'actif' => array(
|
|
|
|
'txt'=>'Afficher uniquement les actifs',
|
|
|
|
'select'=>'',
|
|
|
|
'value' => 1,
|
|
|
|
),
|
|
|
|
'inactif' => array(
|
|
|
|
'txt'=>'Afficher uniquement les inactifs',
|
|
|
|
'select'=>'',
|
|
|
|
'value' => 0,
|
|
|
|
),
|
|
|
|
);
|
|
|
|
$filtres[$filtre]['select'] = ' selected';
|
2012-04-23 16:11:49 +00:00
|
|
|
$this->view->assign('filtres', $filtres);
|
2012-12-26 10:36:47 +00:00
|
|
|
|
2012-04-23 16:11:49 +00:00
|
|
|
$criteres['actif'] = $filtres[$filtre]['value'];
|
2012-12-26 10:36:47 +00:00
|
|
|
|
2012-09-10 14:03:47 +00:00
|
|
|
$reponse = $ws->searchEntreprise($criteres, $position);
|
2012-12-26 10:36:47 +00:00
|
|
|
|
2012-04-23 16:11:49 +00:00
|
|
|
unset($criteres['actif']);
|
2012-12-26 10:36:47 +00:00
|
|
|
|
2012-01-25 20:08:54 +00:00
|
|
|
$this->view->assign('rechCsv', $user->checkPerm('rechcsv'));
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-09-02 15:17:08 +00:00
|
|
|
//Criteres recherche dirigeants
|
2014-12-09 11:26:12 +00:00
|
|
|
} else if ( $type == 'dir' ) {
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-09-02 15:17:08 +00:00
|
|
|
// Type de recherche = dirigeants
|
2012-04-04 11:42:00 +00:00
|
|
|
//$dirNom = preg_replace('/[^0-9A-Z]/', ' ', strtoupper($params['dirNom']));
|
|
|
|
//$dirPrenom = preg_replace('/[^0-9A-Z]/', ' ', strtoupper($params['dirPrenom']));
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2012-11-20 07:11:02 +00:00
|
|
|
$dirNom = $params['dirNom'];
|
2012-04-04 11:42:00 +00:00
|
|
|
$dirPrenom = $params['dirPrenom'];
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-09-02 15:17:08 +00:00
|
|
|
$dirDateNaissJJ = preg_replace('/[^0-9]/', '', $params['dirDateNaissJJ']);
|
|
|
|
if (intval($dirDateNaissJJ)<0 || intval($dirDateNaissJJ>31)){
|
|
|
|
//die('Jour de naissance incorrect !');
|
|
|
|
}
|
|
|
|
$dirDateNaissMM = preg_replace('/[^0-9]/', '', $params['dirDateNaissMM']);
|
|
|
|
if (intval($dirDateNaissMM)<0 || intval($dirDateNaissMM>31)){
|
|
|
|
//die('Mois de naissance incorrect !');
|
|
|
|
}
|
|
|
|
$dirDateNaissAAAA = preg_replace('/[^0-9]/', '', $params['dirDateNaissAAAA']);
|
|
|
|
$year = date('Y')-18;
|
|
|
|
if (intval($dirDateNaissAAAA)<0 || intval($dirDateNaissAAAA)>$year){
|
|
|
|
//die('Année de naissance incorrecte !');
|
|
|
|
}
|
|
|
|
$dirDateNaiss = $dirDateNaissJJ.'/'.$dirDateNaissMM.'/'.$dirDateNaissAAAA;
|
|
|
|
if ($dirDateNaiss=='//') $dirDateNaiss = '';
|
|
|
|
$dirCpVille = preg_replace('/ +/',' ', preg_replace('/[^0-9A-Z]/', ' ',
|
2011-10-25 09:27:37 +00:00
|
|
|
strtoupper($params['dirCpVille']))
|
2011-09-02 15:17:08 +00:00
|
|
|
);
|
2011-10-25 09:21:37 +00:00
|
|
|
/*
|
2011-09-02 15:17:08 +00:00
|
|
|
if (preg_match('/^([0-9]{2,5})([\D]+)/i', $dirCpVille, $matches))
|
|
|
|
{
|
|
|
|
$dirCp = trim($matches[1]);
|
|
|
|
$dirVille = trim($matches[2]);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$dirVille = trim($dirCpVille);
|
2011-10-25 09:27:37 +00:00
|
|
|
}
|
|
|
|
*/
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-09-02 15:17:08 +00:00
|
|
|
$criteres = array();
|
|
|
|
$criteres['dirNom'] = $dirNom;
|
|
|
|
$criteres['dirPrenom'] = $dirPrenom;
|
|
|
|
$criteres['dirDateNaiss'] = $dirDateNaiss;
|
2011-10-25 09:21:37 +00:00
|
|
|
$criteres['lieuNaiss'] = $dirCpVille;
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-12 08:50:24 +00:00
|
|
|
$reponse = $ws->searchDir($criteres, $position, $user->getNbRep());
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-09-02 15:17:08 +00:00
|
|
|
} elseif ($type == 'act') {
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-09-02 15:17:08 +00:00
|
|
|
$siret = preg_replace('/[^0-9]/', '',$params['siret']);
|
|
|
|
$actNomRs = trim($params['actNomRs']);
|
|
|
|
$pays = $params['pays'];
|
|
|
|
$pctMin = preg_replace('/[^0-9]/', '', trim($params['pctMin']));
|
|
|
|
$pctMax = preg_replace('/[^0-9]/', '', trim($params['pctMax']));
|
|
|
|
$cpVille = preg_replace('/ +/',' ', preg_replace('/[^0-9A-Z]/', ' ',strtoupper($params['cpVille'])));
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-11-17 10:43:19 +00:00
|
|
|
$criteres = array();
|
|
|
|
$criteres['siret'] = $siret;
|
|
|
|
$criteres['actNomRs'] = $actNomRs;
|
|
|
|
$criteres['pctMin'] = $pctMin;
|
|
|
|
$criteres['pctMax'] = $pctMax;
|
|
|
|
$criteres['cpVille'] = $cpVille;
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-11-17 10:43:19 +00:00
|
|
|
$reponse = $ws->searchAct($actNomRs, $cpVille, $siret, $pays, $pctMin, $pctMax, $position);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-09-02 15:17:08 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-12 10:14:05 +00:00
|
|
|
$nbReponses = 0;
|
|
|
|
$nbReponsesTotal = 0;
|
2012-05-20 16:31:28 +00:00
|
|
|
|
|
|
|
if (is_object($reponse) && $reponse !== false)
|
2011-09-02 15:17:08 +00:00
|
|
|
{
|
|
|
|
$etabs = $reponse->result->item;
|
|
|
|
$criteresTexte = '';
|
|
|
|
foreach ($criteres as $value){
|
|
|
|
if (!empty($value)) $criteresTexte.= $value.' ';
|
|
|
|
}
|
|
|
|
$criteresTexte = trim($criteresTexte);
|
2012-02-06 08:33:10 +00:00
|
|
|
$params['controller'] = 'recherche';
|
2011-09-02 15:17:08 +00:00
|
|
|
if ($type=='ent'){
|
2012-05-20 16:31:28 +00:00
|
|
|
$params['action'] = 'entreprise';
|
2011-09-02 15:17:08 +00:00
|
|
|
} elseif ($type=='dir') {
|
|
|
|
$params['action'] = 'dirigeant';
|
|
|
|
} elseif ($type=='act'){
|
2012-05-20 16:31:28 +00:00
|
|
|
$params['action'] = 'actionnaire';
|
2011-09-02 15:17:08 +00:00
|
|
|
}
|
2012-04-24 09:40:47 +00:00
|
|
|
foreach ($params as $key => $param) {
|
2012-05-20 16:31:28 +00:00
|
|
|
$params[$key] = str_replace('/', ' ', $params[$key]);
|
2012-04-24 09:40:47 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2014-08-11 12:11:23 +00:00
|
|
|
$criteresLien = $this->view->url($params, 'default', true);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-09-02 15:17:08 +00:00
|
|
|
$liste = array();
|
|
|
|
if (count($etabs)>0) {
|
|
|
|
foreach($etabs as $i => $etab) {
|
|
|
|
$item = array();
|
2011-09-12 09:20:03 +00:00
|
|
|
$item['position'] = ($position)+$i+1;
|
2011-09-02 15:17:08 +00:00
|
|
|
$item['id'] = $etab->id;
|
|
|
|
$item['siren'] = $etab->Siren;
|
|
|
|
$item['siret'] = $etab->Siren.$etab->Nic;
|
|
|
|
$item['InfoSiret'] = $etab->Siren.' '.$etab->Nic;
|
|
|
|
$item['InfoNom'] = $etab->Nom;
|
2013-12-26 14:42:44 +00:00
|
|
|
$item['source'] = $etab->Source;
|
|
|
|
$item['sourceId'] = $etab->SourceId;
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-09-02 15:17:08 +00:00
|
|
|
$nomDetail = '';
|
|
|
|
if ($etab->Nom2<>'' || $etab->Enseigne<>'' || $etab->Sigle<>'') {
|
|
|
|
$nomDetail.= '<i>';
|
|
|
|
if ($etab->Nom2!='') $nomDetail.= $etab->Nom2.'<br/>';
|
|
|
|
if ($etab->Enseigne<>'') $nomDetail.= 'Enseigne : '.$etab->Enseigne.' ';
|
|
|
|
if ($etab->Sigle<>'') $nomDetail.= 'Sigle : '.$etab->Sigle;
|
|
|
|
$nomDetail.= '</i><br/>';
|
2011-06-30 14:20:23 +00:00
|
|
|
}
|
2011-09-02 15:17:08 +00:00
|
|
|
$item['InfoNomDetail'] = $nomDetail;
|
|
|
|
$item['InfoSiret'] = substr($etab->Siren,0,3).' '.
|
|
|
|
substr($etab->Siren,3,3).' '.
|
|
|
|
substr($etab->Siren,6,3).' '.
|
|
|
|
$etab->Nic;
|
|
|
|
$infoEtab = '';
|
2013-03-05 14:01:41 +00:00
|
|
|
|
|
|
|
if (null !== $etab->Pays && strtolower($etab->Pays)!='france') {
|
|
|
|
$infoEtab.= "Etablissement à l'étranger";
|
2011-09-02 15:17:08 +00:00
|
|
|
} else {
|
2013-03-05 14:01:41 +00:00
|
|
|
if ($etab->Siege==1){
|
|
|
|
$infoEtab.= 'Établissement siège ';
|
|
|
|
} elseif ($etab->Siege==2) {
|
|
|
|
$infoEtab.= 'Établissement principal ';
|
|
|
|
} else {
|
|
|
|
$infoEtab.= 'Établissement secondaire ';
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($etab->Actif==1){
|
|
|
|
$infoEtab.= 'actif';
|
|
|
|
} else {
|
|
|
|
$infoEtab.= 'inactif';
|
|
|
|
}
|
2013-05-14 09:32:08 +00:00
|
|
|
|
|
|
|
//Etablissement communiqués par le RCS n'ayant pas de NIC à l'INSEE
|
|
|
|
if (intval($etab->Nic)==0 || intval($etab->Nic)>=99990) {
|
2013-03-05 14:01:41 +00:00
|
|
|
$infoEtab.=' provisoire';
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($etab->Siege!=1 || ($etab->Siege==1 && $etab->Actif!=1)) {
|
|
|
|
$url = $this->view->url(array(
|
|
|
|
'controller'=>'identite',
|
|
|
|
'action'=>'fiche',
|
|
|
|
'id' => $etab->id,
|
|
|
|
'siret' => $etab->Siren,
|
2014-08-11 12:11:23 +00:00
|
|
|
), 'default', true);
|
2013-03-05 14:01:41 +00:00
|
|
|
|
|
|
|
if ( $user->checkPerm('IDENTITE') ) {
|
|
|
|
$infoEtab.= ' <a title="Voir la fiche d\'identité du siège de cette entreprise"'.
|
|
|
|
' href="'.$url.'">(Accès ';
|
|
|
|
if ($etab->Siege==1) {
|
|
|
|
$infoEtab.= 'dernier ';
|
|
|
|
}
|
|
|
|
$infoEtab.= 'siège)</a>';
|
|
|
|
}
|
|
|
|
}
|
2011-09-02 15:17:08 +00:00
|
|
|
}
|
2013-01-22 15:37:14 +00:00
|
|
|
|
2011-09-02 15:17:08 +00:00
|
|
|
$item['InfoEtab'] = $infoEtab;
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2014-02-13 14:41:39 +00:00
|
|
|
$adresse = $etab->Adresse;
|
|
|
|
if ( !empty($etab->Adresse2) ) {
|
|
|
|
$adresse.= '<br/>'.$etab->Adresse2;
|
2011-09-02 15:17:08 +00:00
|
|
|
}
|
2014-02-13 14:41:39 +00:00
|
|
|
if ( !empty($etab->Ville) && intval($etab->CP) > 0) {
|
|
|
|
$adresse.= '<br/><b>'.$etab->CP." ".$etab->Ville."</b>";
|
2013-11-13 14:10:30 +00:00
|
|
|
}
|
2014-02-13 14:41:39 +00:00
|
|
|
if (null !== $etab->Pays) {
|
2013-03-05 14:01:41 +00:00
|
|
|
$adresse.= '<br/><b>'.$etab->Pays.'</b>';
|
|
|
|
}
|
|
|
|
|
2011-09-02 15:17:08 +00:00
|
|
|
$item['InfoAdresse'] = $adresse;
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2012-11-20 07:11:02 +00:00
|
|
|
if ( $etab->Actif!=1 ) {
|
|
|
|
$item['class'] = 'StyleInfoData';
|
2012-04-04 14:26:08 +00:00
|
|
|
} else {
|
|
|
|
$item['class'] = 'StyleInfoDataActif';
|
2012-05-20 16:31:28 +00:00
|
|
|
}
|
|
|
|
|
2011-09-02 15:17:08 +00:00
|
|
|
$forme = '';
|
2013-03-05 14:01:41 +00:00
|
|
|
if ( trim($etab->FJ)!='' && intval($etab->FJ)!=0 )
|
2011-09-02 15:17:08 +00:00
|
|
|
{
|
|
|
|
$forme = '<i>Forme : '.$etab->FJLib.' ('.$etab->FJ.')</i><br/>';
|
|
|
|
}
|
|
|
|
$item['InfoForme'] = $forme;
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-09-02 15:17:08 +00:00
|
|
|
$activite = '';
|
|
|
|
if (trim($etab->NafEnt)!='')
|
|
|
|
{
|
|
|
|
$activite = '<i>Activité : '.$etab->NafEntLib.' ('.$etab->NafEnt.')</i><br/>';
|
|
|
|
}
|
|
|
|
$item['InfoActivite'] = $activite;
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2014-12-09 11:26:12 +00:00
|
|
|
if ( $type == 'dir' ) {
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-09-02 15:17:08 +00:00
|
|
|
$item['InfoDirigeant'] = '<u>Dirigeant recherché :</u> ';
|
|
|
|
if ($etab->DirRs!='') {
|
|
|
|
$item['InfoDirigeant'].= '<b>'.$etab->DirRs.'</b>, représenté par ';
|
|
|
|
}
|
|
|
|
$item['InfoDirigeant'].= $etab->DirNom .' '. $etab->DirPrenom;
|
2014-12-09 11:26:12 +00:00
|
|
|
if ( $etab->DirNomUsage != '' && $etab->DirNomUsage != $etab->DirNom) {
|
2011-09-02 15:17:08 +00:00
|
|
|
$item['InfoDirigeant'].= ' ('. $etab->DirNomUsage . ')';
|
|
|
|
}
|
|
|
|
$item['InfoDirigeant'].= '<i>, '.$etab->DirFonction.'</i><br/>';
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2014-12-09 11:26:12 +00:00
|
|
|
} elseif ( $type == 'act' ) {
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-09-02 15:17:08 +00:00
|
|
|
$item['InfoActionnaire'] = '<u>Actionnaire recherché :</u> ';
|
|
|
|
if ($etab->ActNomRs<>'') {
|
|
|
|
$item['InfoActionnaire'].= '<b>'. $etab->ActNomRs . '</b >';
|
2012-05-20 16:31:28 +00:00
|
|
|
if ($etab->ActPays!='' && $etab->ActPays!='FRA')
|
2011-09-02 15:17:08 +00:00
|
|
|
$item['InfoActionnaire'].= ' ('.$etab->ActPays.')';
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-09-02 15:17:08 +00:00
|
|
|
$preDate = ', le ';
|
|
|
|
if ($etab->ActActif==0){
|
|
|
|
$preDate = ', avant le ';
|
|
|
|
}
|
2013-10-25 14:30:46 +00:00
|
|
|
$date = new Zend_Date($etab->ActDateLien, 'yyyy-MM-dd');
|
|
|
|
if ($etab->ActDateLien!='') $item['InfoActionnaire'].= $preDate.$date->toString('dd/MM/yyyy');
|
2011-09-02 15:17:08 +00:00
|
|
|
if ($etab->ActPmin!='') {
|
|
|
|
if($etab->ActPmin<1){
|
|
|
|
$item['InfoActionnaire'].= ', minoritaire ';
|
|
|
|
} else {
|
|
|
|
$item['InfoActionnaire'].= ', à '.$etab->ActPmin.' %';
|
|
|
|
}
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
}
|
2011-09-02 15:17:08 +00:00
|
|
|
$item['InfoActionnaire'].= '<br/>';
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2013-01-19 19:41:20 +00:00
|
|
|
//Affichage accès direct aux pages
|
|
|
|
$liens = array();
|
2015-03-06 09:14:43 +00:00
|
|
|
/**
|
|
|
|
* test en dur clients pour bilans
|
|
|
|
* @todo client = 34
|
|
|
|
* @todo client = 60
|
|
|
|
*/
|
2012-12-26 10:36:47 +00:00
|
|
|
if ($user->getIdClient()==34 || $user->getIdClient()==60) {
|
2011-09-09 13:36:43 +00:00
|
|
|
$liens[] = array(
|
2012-03-19 16:07:36 +00:00
|
|
|
'title' => 'Comptes annuels',
|
2012-02-03 20:58:57 +00:00
|
|
|
'href' => $this->view->url(array(
|
2012-05-20 16:31:28 +00:00
|
|
|
'controller'=>'pieces',
|
|
|
|
'action'=>'bilans',
|
|
|
|
'siret'=>$etab->Siren.$etab->Nic,
|
2014-08-11 12:11:23 +00:00
|
|
|
'id'=>$etab->id), 'default', true),
|
2011-09-09 13:36:43 +00:00
|
|
|
);
|
|
|
|
$liens[] = array(
|
2012-03-19 16:07:36 +00:00
|
|
|
'title' => 'Actes et status',
|
2012-02-03 20:58:57 +00:00
|
|
|
'href' => $this->view->url(array(
|
2012-05-20 16:31:28 +00:00
|
|
|
'controller'=>'pieces', 'action'=>'actes',
|
2014-08-11 12:11:23 +00:00
|
|
|
'siret'=>$etab->Siren.$etab->Nic, 'id'=>$etab->id), 'default', true),
|
2011-09-09 13:36:43 +00:00
|
|
|
);
|
2013-01-19 19:41:20 +00:00
|
|
|
}
|
|
|
|
|
2015-03-06 09:14:43 +00:00
|
|
|
/**
|
|
|
|
* test en dur clients pour fiche
|
|
|
|
* @todo client = 60
|
|
|
|
*/
|
2013-01-19 19:41:20 +00:00
|
|
|
if ($user->getIdClient()==60) {
|
|
|
|
$liens[] = array(
|
|
|
|
'title' => 'Fiche AGS',
|
|
|
|
'href' => $this->view->url(array(
|
|
|
|
'controller'=>'identite', 'action'=>'fichepc',
|
2014-08-11 12:11:23 +00:00
|
|
|
'siret'=>$etab->Siren.$etab->Nic, 'id'=>$etab->id), 'default', true),
|
2013-01-19 19:41:20 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
if (count($liens)>0) {
|
|
|
|
$item['lien'] = $liens;
|
2011-09-09 13:36:43 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-09-02 15:17:08 +00:00
|
|
|
$liste[] = $item;
|
|
|
|
}
|
2011-06-30 12:14:14 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
|
|
|
} elseif (is_string($reponse)){
|
2011-09-02 15:17:08 +00:00
|
|
|
$this->_forward('entreprise', 'recherche', null, array_merge(
|
|
|
|
$params, array('message' => $reponse))
|
|
|
|
);
|
|
|
|
} else {
|
2012-05-20 16:31:28 +00:00
|
|
|
$this->_forward('soap', 'error');
|
2011-04-11 14:19:14 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-09-02 15:17:08 +00:00
|
|
|
$this->view->assign('blockInvestig', $user->checkPerm('INVESTIG'));
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-09-02 15:17:08 +00:00
|
|
|
if ($type=='dir') {
|
|
|
|
$this->view->assign('blockDirToEntreprise', true);
|
2012-02-03 20:58:57 +00:00
|
|
|
$this->view->assign('searchDirToEntrepriseTxt', trim($criteres['dirNom'].' '.$criteres['dirPrenom']));
|
2011-09-02 15:17:08 +00:00
|
|
|
$this->view->assign('searchDirToEntrepriseLien', $this->view->url(array(
|
2012-02-13 10:23:07 +00:00
|
|
|
'controller' => 'recherche',
|
2012-02-13 08:01:19 +00:00
|
|
|
'action' => 'liste',
|
2011-09-02 15:17:08 +00:00
|
|
|
'type' => 'ent',
|
2012-02-03 20:58:57 +00:00
|
|
|
'raisonSociale' => trim($criteres['dirNom'].' '.$criteres['dirPrenom'])
|
2014-08-11 12:11:23 +00:00
|
|
|
), 'default', true));
|
2011-09-02 15:17:08 +00:00
|
|
|
} else {
|
|
|
|
$this->view->assign('blockDirToEntreprise', false);
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2014-02-25 20:39:38 +00:00
|
|
|
$this->view->assign('liste', $liste);
|
|
|
|
|
|
|
|
//Calcul pagination
|
|
|
|
$nbReponses = $reponse->nbReponses;
|
|
|
|
$nbReponsesTotal = $reponse->nbReponsesTotal;
|
|
|
|
if ($nbReponses < $nbReponsesTotal) {
|
|
|
|
$pageTotal = ceil( $nbReponsesTotal / $nbAffichage );
|
|
|
|
$pageCurrent = $page;
|
|
|
|
$pagePrev = $page - 1;
|
|
|
|
if ($pagePrev < 1) {
|
|
|
|
$pagePrev = 1;
|
|
|
|
}
|
|
|
|
$pageNext = $page + 1;
|
|
|
|
if( $pageNext > $pageTotal ) {
|
|
|
|
$pageNext = $pageTotal;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$pageTotal = $pageCurrent = 1;
|
|
|
|
}
|
|
|
|
$this->view->assign('PageTotal', $pageTotal);
|
|
|
|
$this->view->assign('PagePrev', $pagePrev);
|
|
|
|
$this->view->assign('PageNext', $pageNext);
|
|
|
|
$this->view->assign('PageCurrent', $pageCurrent);
|
|
|
|
|
2011-12-12 10:14:05 +00:00
|
|
|
$this->view->assign('nbReponses', empty($nbReponses) ? 0 : $nbReponses);
|
|
|
|
$this->view->assign('nbReponsesTotal', empty($nbReponsesTotal) ? 0 : $nbReponsesTotal);
|
2014-02-25 20:39:38 +00:00
|
|
|
|
|
|
|
$this->view->assign('token', $token);
|
|
|
|
|
2011-09-02 15:17:08 +00:00
|
|
|
$this->view->assign('criteresTexte', $criteresTexte);
|
|
|
|
$this->view->assign('criteresLien', $criteresLien);
|
2014-02-25 20:39:38 +00:00
|
|
|
$this->view->assign('info', $reponse->info);
|
2011-04-11 14:19:14 +00:00
|
|
|
}
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-04-11 14:19:14 +00:00
|
|
|
public function ipariAction()
|
|
|
|
{
|
2012-09-10 14:03:47 +00:00
|
|
|
$siret = $this->getRequest()->getParam('siret');
|
2012-12-26 10:36:47 +00:00
|
|
|
|
2012-09-10 14:03:47 +00:00
|
|
|
$user = new Scores_Utilisateur();
|
2011-06-30 14:24:47 +00:00
|
|
|
$url = 'http://ipari.scores-decisions.com/?action=logon&login='.$user->getLogin().
|
|
|
|
'&hach='.$user->getPassword().'&pass=';
|
2012-09-10 14:03:47 +00:00
|
|
|
if (!empty($siret)){
|
|
|
|
$url.= '&siret='.$siret;
|
2011-06-30 14:24:47 +00:00
|
|
|
}
|
|
|
|
$this->_redirect($url);
|
2011-04-11 14:19:14 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-04-27 09:10:39 +00:00
|
|
|
public function nafAction()
|
|
|
|
{
|
|
|
|
$this->_helper->layout()->disableLayout();
|
2013-03-12 14:39:22 +00:00
|
|
|
|
|
|
|
$q = strtolower($this->getRequest()->getParam('q', null));
|
2011-04-27 09:10:39 +00:00
|
|
|
$output = array();
|
2013-03-12 14:39:22 +00:00
|
|
|
|
|
|
|
if ( null !== $q ) {
|
|
|
|
$naf = new Application_Model_Naf5();
|
|
|
|
$sql = $naf->select('codNaf5, libNaf5');
|
|
|
|
if ( is_numeric(substr($q,0,4)) ) {
|
|
|
|
$sql->where("codNaf5 LIKE '%".$q."%'");
|
|
|
|
} else {
|
|
|
|
$queries = explode(' ', $q);
|
|
|
|
if (count($queries)>0) {
|
|
|
|
$where = '';
|
|
|
|
foreach ($queries as $item) {
|
|
|
|
if (strlen($item)>2) {
|
2013-05-14 09:32:08 +00:00
|
|
|
if (empty($where)) {
|
|
|
|
$op = 'LIKE ';
|
|
|
|
} else {
|
|
|
|
$op = ' OR ';
|
|
|
|
}
|
|
|
|
$where.= $op.'"%'.strtolower($item).'%"';
|
|
|
|
}
|
2013-03-12 14:39:22 +00:00
|
|
|
}
|
|
|
|
$sql->where("LOWER(libNaf5) ".$where);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$rows = $naf->fetchAll($sql);
|
|
|
|
if ( count($rows)>0 ) {
|
|
|
|
$separator = " , ";
|
|
|
|
foreach ($rows as $item) {
|
|
|
|
if (strpos(strtolower($item->codNaf5), $q) !== false ||
|
|
|
|
strpos(strtolower($item->libNaf5), $q) !== false ) {
|
|
|
|
$output[] = array(
|
|
|
|
'label' => $item->codNaf5 . $separator . $item->libNaf5,
|
|
|
|
'value' => $item->codNaf5,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->view->assign('output', $output);
|
2011-04-27 09:10:39 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2013-05-14 09:32:08 +00:00
|
|
|
public function fjAction()
|
|
|
|
{
|
|
|
|
$this->_helper->layout()->disableLayout();
|
|
|
|
|
|
|
|
$q = strtolower($this->getRequest()->getParam('q', null));
|
|
|
|
$output = array();
|
|
|
|
|
|
|
|
if ( null !== $q ) {
|
|
|
|
$table = new Application_Model_TabFJur();
|
|
|
|
$sql = $table->select('code, libelle');
|
|
|
|
$sql->where('LENGTH(code)=4');
|
|
|
|
if ( is_numeric(substr($q,0,4)) ) {
|
|
|
|
$sql->where("code LIKE '%".$q."%'");
|
|
|
|
} else {
|
|
|
|
$queries = explode(' ', $q);
|
|
|
|
if (count($queries)>0) {
|
|
|
|
$where = '';
|
|
|
|
foreach ($queries as $item) {
|
|
|
|
if (strlen($item)>2) {
|
|
|
|
if (empty($where)) {
|
|
|
|
$op = 'LIKE ';
|
|
|
|
} else {
|
|
|
|
$op = ' OR ';
|
|
|
|
}
|
|
|
|
$where.= $op.'"%'.strtolower($item).'%"';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$sql->where("LOWER(libelle) ".$where);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Zend_Registry::get('firebug')->info($where);
|
|
|
|
|
|
|
|
$rows = $table->fetchAll($sql);
|
|
|
|
if ( count($rows)>0 ) {
|
|
|
|
$separator = " , ";
|
|
|
|
foreach ($rows as $item) {
|
|
|
|
$output[] = array(
|
|
|
|
'label' => $item->code . $separator . $item->libelle,
|
|
|
|
'value' => $item->code,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->view->assign('output', $output);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-12-09 15:27:22 +00:00
|
|
|
public function refclientAction()
|
|
|
|
{
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-09 15:27:22 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-09 15:27:22 +00:00
|
|
|
public function refclientlisteAction()
|
|
|
|
{
|
|
|
|
$request = $this->getRequest();
|
2012-05-20 16:31:28 +00:00
|
|
|
$params = $request->getParams();
|
2011-12-09 15:27:22 +00:00
|
|
|
$type = $request->getParam('type', '');
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2013-11-29 13:54:52 +00:00
|
|
|
$rechercheParams = new Scores_Session_Recherche();
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-09 15:27:22 +00:00
|
|
|
//Si le formulaire a été soumis alors on enregistre en session et on redirige
|
|
|
|
if ( !empty($type) ) {
|
|
|
|
$rechercheParams->save($type, $params);
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-09 15:27:22 +00:00
|
|
|
//On selectionne en session
|
|
|
|
if (count($rechercheParams->liste())>0){
|
|
|
|
$recherche = $rechercheParams->item(0);
|
|
|
|
$type = $recherche['type'];
|
|
|
|
$params = $recherche['params'];
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
|
|
|
$user = new Scores_Utilisateur();
|
|
|
|
|
2012-02-10 16:27:15 +00:00
|
|
|
$this->view->assign('login', $user->getLogin());
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-09 15:27:22 +00:00
|
|
|
$page = $request->getParam('page', 1);
|
|
|
|
if ($page==0) $page = 1;
|
|
|
|
$page = $page-1;
|
|
|
|
$position = $page*$user->getNbRep();
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-09 15:27:22 +00:00
|
|
|
$nbReponses = 0;
|
|
|
|
$nbReponsesTotal = 0;
|
|
|
|
$liste = array();
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-09 15:27:22 +00:00
|
|
|
$ws = new WsScores();
|
2012-05-20 16:31:28 +00:00
|
|
|
$reponses = $ws->searchRefClient($params['ref'], $position, $user->getNbRep());
|
2011-12-09 15:27:22 +00:00
|
|
|
if ($reponses !== false){
|
2012-05-20 16:31:28 +00:00
|
|
|
$nbReponses = $reponses->nbReponses;
|
2011-12-09 15:27:22 +00:00
|
|
|
$nbReponsesTotal = $reponses->nbReponsesTotal;
|
|
|
|
$etabs = $reponses->result->item;
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-09 15:27:22 +00:00
|
|
|
if (count($etabs)>0) {
|
|
|
|
foreach($etabs as $i => $etab) {
|
|
|
|
$item = array();
|
|
|
|
$item['position'] = ($position)+$i+1;
|
|
|
|
$item['id'] = $etab->id;
|
|
|
|
$item['siren'] = $etab->Siren;
|
|
|
|
$item['siret'] = $etab->Siren.$etab->Nic;
|
|
|
|
$item['InfoSiret'] = $etab->Siren.' '.$etab->Nic;
|
|
|
|
$item['InfoNom'] = $etab->Nom;
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-09 15:27:22 +00:00
|
|
|
$nomDetail = '';
|
|
|
|
if ($etab->Nom2<>'' || $etab->Enseigne<>'' || $etab->Sigle<>'') {
|
|
|
|
$nomDetail.= '<i>';
|
|
|
|
if ($etab->Nom2!='') $nomDetail.= $etab->Nom2.'<br/>';
|
|
|
|
if ($etab->Enseigne<>'') $nomDetail.= 'Enseigne : '.$etab->Enseigne.' ';
|
|
|
|
if ($etab->Sigle<>'') $nomDetail.= 'Sigle : '.$etab->Sigle;
|
|
|
|
$nomDetail.= '</i><br/>';
|
|
|
|
}
|
|
|
|
$item['InfoNomDetail'] = $nomDetail;
|
|
|
|
$item['InfoSiret'] = substr($etab->Siren,0,3).' '.
|
|
|
|
substr($etab->Siren,3,3).' '.
|
|
|
|
substr($etab->Siren,6,3).' '.
|
|
|
|
$etab->Nic;
|
|
|
|
$infoEtab = '';
|
|
|
|
if ($etab->Siege==1){
|
|
|
|
$infoEtab.= 'Établissement siège ';
|
|
|
|
} else {
|
|
|
|
$infoEtab.= 'Établissement secondaire ';
|
|
|
|
}
|
|
|
|
if ($etab->Actif==1){
|
|
|
|
$infoEtab.= 'actif';
|
|
|
|
} else {
|
|
|
|
$infoEtab.= 'inactif';
|
|
|
|
}
|
|
|
|
if (intval($etab->Nic)==0 || intval($item->Nic)>=99990) {
|
|
|
|
$infoEtab.=' provisoire';
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-09 15:27:22 +00:00
|
|
|
if ($etab->Siege!=1 || ($etab->Siege==1 && $etab->Actif!=1)) {
|
|
|
|
$url = $this->view->url(array(
|
|
|
|
'controller'=>'identite',
|
|
|
|
'action'=>'fiche',
|
|
|
|
'id' => $etab->id,
|
|
|
|
'siret' => $etab->Siren,
|
2014-08-11 12:11:23 +00:00
|
|
|
), 'default', true);
|
2011-12-09 15:27:22 +00:00
|
|
|
$infoEtab.= ' <a title="Voir la fiche d\'identité du siège de cette entreprise"'.
|
|
|
|
' href="'.$url.'">(Accès siège)</a>';
|
|
|
|
}
|
|
|
|
$item['InfoEtab'] = $infoEtab;
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-09 15:27:22 +00:00
|
|
|
$adresse = $etab->Adresse.'<br/>';
|
|
|
|
if (isset($etab->Adresse2) && $etab->Adresse2 != '') {
|
|
|
|
$adresse.= $etab->Adresse2.'<br/>';
|
|
|
|
}
|
|
|
|
$adresse.= "<b>".$etab->CP." ".$etab->Ville."</b>";
|
|
|
|
$item['InfoAdresse'] = $adresse;
|
2012-05-20 16:31:28 +00:00
|
|
|
|
|
|
|
|
2011-12-09 15:27:22 +00:00
|
|
|
$forme = '';
|
|
|
|
if (trim($etab->FJ)!='')
|
|
|
|
{
|
|
|
|
$forme = '<i>Forme : '.$etab->FJLib.' ('.$etab->FJ.')</i><br/>';
|
|
|
|
}
|
|
|
|
$item['InfoForme'] = $forme;
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-09 15:27:22 +00:00
|
|
|
$activite = '';
|
|
|
|
if (trim($etab->NafEnt)!='')
|
|
|
|
{
|
|
|
|
$activite = '<i>Activité : '.$etab->NafEntLib.' ('.$etab->NafEnt.')</i><br/>';
|
|
|
|
}
|
|
|
|
$item['InfoActivite'] = $activite;
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2012-02-06 14:41:42 +00:00
|
|
|
$item['login'] = $etab->Infos->login;
|
|
|
|
$item['email'] = $etab->Infos->email;
|
2011-12-09 16:03:57 +00:00
|
|
|
$item['source'] = $etab->Infos->source;
|
|
|
|
$item['ref'] = $etab->Infos->ref;
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2013-10-25 14:30:46 +00:00
|
|
|
$date = new Zend_Date($etab->Infos->dateAjout, 'yyyy-MM-dd');
|
|
|
|
$item['dateAjout'] = $date->toString('dd/MM/yyyy');
|
|
|
|
if ( $etab->Infos->dateEnvoi!='0000-00-00' ) {
|
|
|
|
$date = new Zend_Date($etab->Infos->dateEnvoi, 'yyyy-MM-dd');
|
|
|
|
$item['dateEnvoi'] = $date->toString('dd/MM/yyyy');
|
|
|
|
} else {
|
|
|
|
$item['dateEnvoi'] = '';
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-09 15:27:22 +00:00
|
|
|
$liste[] = $item;
|
|
|
|
}
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-09 15:27:22 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-09 15:27:22 +00:00
|
|
|
if ($nbReponses < $nbReponsesTotal) {
|
|
|
|
$totPage = ceil($nbReponsesTotal/$user->getNbRep());
|
|
|
|
$curPage = $page+1;
|
|
|
|
} else {
|
|
|
|
$totPage = $curPage = 1;
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-09 15:27:22 +00:00
|
|
|
$this->view->assign('nbReponses', $nbReponses);
|
|
|
|
$this->view->assign('nbReponsesTotal', $nbReponsesTotal);
|
|
|
|
$this->view->assign('totPage', $totPage);
|
|
|
|
$this->view->assign('curPage', $curPage);
|
|
|
|
$this->view->assign('liste', $liste);
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-12 15:58:40 +00:00
|
|
|
public function csvAction()
|
|
|
|
{
|
|
|
|
$this->_helper->layout()->disableLayout();
|
|
|
|
$this->_helper->viewRenderer->setNoRender(true);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2013-11-29 13:54:52 +00:00
|
|
|
$rechercheParams = new Scores_Session_Recherche();
|
2011-12-12 15:58:40 +00:00
|
|
|
//On selectionne en session
|
|
|
|
if (count($rechercheParams->liste())>0){
|
|
|
|
$recherche = $rechercheParams->item(0);
|
|
|
|
$type = $recherche['type'];
|
|
|
|
$params = $recherche['params'];
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-12 15:58:40 +00:00
|
|
|
require_once 'Scores/WsScores.php';
|
|
|
|
$ws = new WsScores();
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-12 15:58:40 +00:00
|
|
|
//Criteres recherche entreprise
|
|
|
|
if ($type=='ent'){
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-12 15:58:40 +00:00
|
|
|
// Type de recherche = entreprises
|
|
|
|
$telFax = trim(preg_replace('/[^0-9]/', '', $params['telFax']));
|
|
|
|
$naf = trim(preg_replace('/[^0-9A-Z]/i', '', $params['naf']));
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-12 15:58:40 +00:00
|
|
|
// Traitement des données formulaire
|
|
|
|
//$raisonSociale = preg_replace('/[^0-9A-Z]/', ' ', strtoupper($params['raisonSociale']));
|
|
|
|
$raisonSociale = str_replace(array('(',')'), array('', ''), $params['raisonSociale']);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-12 15:58:40 +00:00
|
|
|
$numVoie = preg_replace('/[^0-9]/', '', $params['numero']);
|
|
|
|
if ($numVoie > 9999) {
|
|
|
|
die('Numéro de voie incorrecte !');
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2015-03-20 09:46:52 +00:00
|
|
|
$libVoie = Scores_Locale_String::cleanutf8($params['voie']);
|
|
|
|
$cpVille = Scores_Locale_String::cleanutf8($params['cpVille']);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-12 15:58:40 +00:00
|
|
|
if (preg_match("/^([0-9]{2,5})([\D]*)/i", $cpVille, $matches)) {
|
|
|
|
$cp = trim($matches[1]);
|
|
|
|
$ville = trim($matches[2]);
|
|
|
|
} else {
|
|
|
|
$cp = '';
|
|
|
|
$ville = trim($cpVille);
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-12 15:58:40 +00:00
|
|
|
$criteres = array();
|
|
|
|
$criteres['identifiant'] = str_replace(' ', '', $params['siret']);
|
|
|
|
$criteres['raisonSociale'] = $raisonSociale;
|
|
|
|
$criteres['adresse'] = $numVoie.' '.$libVoie;
|
|
|
|
$criteres['codePostal']= $cp;
|
|
|
|
$criteres['ville'] = $ville;
|
|
|
|
$criteres['telFax'] = $telFax;
|
|
|
|
$criteres['naf'] = $naf;
|
|
|
|
$criteres['siege'] = false;
|
2013-05-14 09:32:08 +00:00
|
|
|
$criteres['fj'] = $fj;
|
2012-12-26 10:36:47 +00:00
|
|
|
|
2012-04-26 07:00:20 +00:00
|
|
|
$request = $this->getRequest();
|
|
|
|
$filtre = $request->getParam('filtre', 'tout');
|
2012-12-26 10:36:47 +00:00
|
|
|
|
2012-11-20 07:11:02 +00:00
|
|
|
//Affichage du filtre actif/inactif
|
|
|
|
$filtres = array(
|
|
|
|
'tout' => array(
|
|
|
|
'txt'=>'Afficher tous les résultats',
|
|
|
|
'select'=>'',
|
|
|
|
'value' => 2,
|
|
|
|
),
|
|
|
|
'actif' => array(
|
|
|
|
'txt'=>'Afficher uniquement les actifs',
|
|
|
|
'select'=>'',
|
|
|
|
'value' => 1,
|
|
|
|
),
|
|
|
|
'inactif' => array(
|
|
|
|
'txt'=>'Afficher uniquement les inactifs',
|
|
|
|
'select'=>'',
|
|
|
|
'value' => 0,
|
|
|
|
),
|
|
|
|
);
|
2012-04-26 07:00:20 +00:00
|
|
|
$criteres['actif'] = $filtres[$filtre]['value'];
|
2012-12-26 10:36:47 +00:00
|
|
|
|
2012-01-24 16:13:18 +00:00
|
|
|
$reponse = $ws->searchEntreprise($criteres, 0, 200);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-12 15:58:40 +00:00
|
|
|
//Criteres recherche dirigeants
|
|
|
|
} else if ($type=='dir') {
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-12 15:58:40 +00:00
|
|
|
// Type de recherche = dirigeants
|
|
|
|
$dirNom = preg_replace('/[^0-9A-Z]/', ' ', strtoupper($params['dirNom']));
|
|
|
|
$dirPrenom = preg_replace('/[^0-9A-Z]/', ' ', strtoupper($params['dirPrenom']));
|
|
|
|
$dirDateNaissJJ = preg_replace('/[^0-9]/', '', $params['dirDateNaissJJ']);
|
|
|
|
$dirDateNaissMM = preg_replace('/[^0-9]/', '', $params['dirDateNaissMM']);
|
|
|
|
$dirDateNaissAAAA = preg_replace('/[^0-9]/', '', $params['dirDateNaissAAAA']);
|
|
|
|
$year = date('Y')-18;
|
|
|
|
$dirDateNaiss = $dirDateNaissJJ.'/'.$dirDateNaissMM.'/'.$dirDateNaissAAAA;
|
|
|
|
if ($dirDateNaiss=='//') $dirDateNaiss = '';
|
|
|
|
$dirCpVille = preg_replace('/ +/',' ', preg_replace('/[^0-9A-Z]/', ' ',
|
|
|
|
strtoupper($params['dirCpVille']))
|
|
|
|
);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-12 15:58:40 +00:00
|
|
|
$criteres = array();
|
|
|
|
$criteres['dirNom'] = $dirNom;
|
|
|
|
$criteres['dirPrenom'] = $dirPrenom;
|
|
|
|
$criteres['dirDateNaiss'] = $dirDateNaiss;
|
|
|
|
$criteres['lieuNaiss'] = $dirCpVille;
|
2012-05-20 16:31:28 +00:00
|
|
|
|
|
|
|
$reponse = $ws->searchDir($criteres, $position);
|
2011-12-12 15:58:40 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2012-01-17 10:27:01 +00:00
|
|
|
$etabs = $reponse->result->item;
|
2012-05-20 16:31:28 +00:00
|
|
|
|
|
|
|
$user = new Scores_Utilisateur();
|
2012-01-17 10:27:01 +00:00
|
|
|
//echo "<pre>"; print_r($etabs); echo "</pre>"; exit;
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2012-11-16 14:12:03 +00:00
|
|
|
$c = Zend_Registry::get('config');
|
|
|
|
$file = $c->profil->path->files . '/'.$user->getIdClient().'-'.$user->getLogin().'-'.date('YmdHis').'.csv';
|
2012-01-17 10:27:01 +00:00
|
|
|
|
2013-11-29 13:54:52 +00:00
|
|
|
$export = new Scores_Export_ArrayCsv($etabs, 'rechercheEntreprise');
|
2011-12-12 15:58:40 +00:00
|
|
|
$export->writeFile($file);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-12 15:58:40 +00:00
|
|
|
$content_type = 'application/csv-tab-delimited-table';
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-12 15:58:40 +00:00
|
|
|
//Envoi du fichier sur la sortie standard
|
|
|
|
if ( file_exists($file) ) {
|
|
|
|
header('Content-Transfer-Encoding: none');
|
|
|
|
header('Content-type: ' . $content_type.'');
|
|
|
|
header('Content-Length: ' . filesize($file));
|
|
|
|
header('Content-MD5: ' . base64_encode(md5_file($file)));
|
|
|
|
header('Content-Disposition: filename="' . basename($file) . '"');
|
|
|
|
header('Cache-Control: private, max-age=0, must-revalidate');
|
|
|
|
header('Pragma: public');
|
|
|
|
ini_set('zlib.output_compression', '0');
|
|
|
|
echo file_get_contents($file);
|
|
|
|
} else {
|
|
|
|
echo 'Impossible de charger le fichier.';
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-12 15:58:40 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-01-06 08:37:20 +00:00
|
|
|
}
|