This commit is contained in:
Michael RICOIS 2011-12-09 15:27:22 +00:00
parent 0974d4215a
commit 615db96c8a
8 changed files with 255 additions and 3 deletions

View File

@ -35,6 +35,10 @@ class RechercheController extends Zend_Controller_Action
}
$this->view->assign('message', $request->getParam('message'));
$this->view->assign('form', $form);
require_once 'Scores/Utilisateur.php';
$user = new Utilisateur();
$this->view->assign('RefClient', true);
}
/**
@ -333,7 +337,6 @@ class RechercheController extends Zend_Controller_Action
require_once 'Scores/WsScores.php';
$ws = new WsScores();
//Criteres recherche entreprise
if ($type=='ent'){
@ -672,4 +675,138 @@ class RechercheController extends Zend_Controller_Action
echo json_encode($output);
}
public function refclientAction()
{
}
public function refclientlisteAction()
{
$request = $this->getRequest();
$params = $request->getParams();
$type = $request->getParam('type', '');
$rechercheParams = new RechercheHistorique();
//Si le formulaire a été soumis alors on enregistre en session et on redirige
if ( !empty($type) ) {
$rechercheParams->save($type, $params);
}
//On selectionne en session
if (count($rechercheParams->liste())>0){
$recherche = $rechercheParams->item(0);
$type = $recherche['type'];
$params = $recherche['params'];
}
$user = new Utilisateur();
$page = $request->getParam('page', 1);
if ($page==0) $page = 1;
$page = $page-1;
$position = $page*$user->getNbRep();
$nbReponses = 0;
$nbReponsesTotal = 0;
$liste = array();
$ws = new WsScores();
$reponses = $ws->searchRefClient($params['ref'], $position, $user->getNbRep());
if ($reponses !== false){
$nbReponses = $reponses->nbReponses;
$nbReponsesTotal = $reponses->nbReponsesTotal;
$etabs = $reponses->result->item;
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;
$nomDetail = '';
if ($etab->Nom2<>'' || $etab->Enseigne<>'' || $etab->Sigle<>'') {
$nomDetail.= '<i>';
if ($etab->Nom2!='') $nomDetail.= $etab->Nom2.'<br/>';
if ($etab->Enseigne<>'') $nomDetail.= 'Enseigne : '.$etab->Enseigne.'&nbsp;&nbsp;&nbsp;&nbsp;';
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.= '&Eacute;tablissement si&egrave;ge ';
} else {
$infoEtab.= '&Eacute;tablissement secondaire ';
}
if ($etab->Actif==1){
$infoEtab.= 'actif';
} else {
$infoEtab.= 'inactif';
}
if (intval($etab->Nic)==0 || intval($item->Nic)>=99990) {
$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,
));
$infoEtab.= ' <a title="Voir la fiche d\'identité du siège de cette entreprise"'.
' href="'.$url.'">(Accès siège)</a>';
}
$item['InfoEtab'] = $infoEtab;
$adresse = $etab->Adresse.'<br/>';
if (isset($etab->Adresse2) && $etab->Adresse2 != '') {
$adresse.= $etab->Adresse2.'<br/>';
}
$adresse.= "<b>".$etab->CP." ".$etab->Ville."</b>";
$item['InfoAdresse'] = $adresse;
$forme = '';
if (trim($etab->FJ)!='')
{
$forme = '<i>Forme : '.$etab->FJLib.' ('.$etab->FJ.')</i><br/>';
}
$item['InfoForme'] = $forme;
$activite = '';
if (trim($etab->NafEnt)!='')
{
$activite = '<i>Activit&eacute; : '.$etab->NafEntLib.' ('.$etab->NafEnt.')</i><br/>';
}
$item['InfoActivite'] = $activite;
$liste[] = $item;
}
}
}
if ($nbReponses < $nbReponsesTotal) {
$totPage = ceil($nbReponsesTotal/$user->getNbRep());
$curPage = $page+1;
} else {
$totPage = $curPage = 1;
}
$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);
}
}

View File

@ -44,4 +44,8 @@ $form = $this->form;
</div>
</form>
</div>
<?php if ($this->RefClient):?>
<?=$this->action('refclient', 'recherche')?>
<?php endif;?>
</div>

View File

@ -0,0 +1,10 @@
<h3 style="color:#ffffff;font-size:medium;font-weight:bold;">RECHERCHE SURVEILLANCE</h3>
<form class="recherche" name="refclient" method="post" action="<?=$this->url(array(
'controller'=>'recherche', 'action'=>'refclientliste'), null, true)?>">
<input type="hidden" name="type" value="refclient" />
<div class="row">
<label style="font-size:1.1em;padding: 0.4em 5px 0.4em 0;">Référence client</label>
<input type="text" name="ref" value="" style="font-size:1.1em;padding: 0.4em 1em;" />
<input class="button" type="submit" name="submit" value="Rechercher" />
</div>
</form>

View File

@ -0,0 +1,72 @@
<div id="center">
<div id="recherche-info">
<p class="StyleInfoLib">
<?=$this->nbReponsesTotal?> r&eacute;ponse<?php if ($this->nbReponsesTotal>1){?>s<?php }?>
<?php if ($this->totPage!=1) {?>
<?php echo $this->nbReponses?> r&eacute;sultats affich&eacute;s.
Page <?php echo $this->curPage.'/'.$this->totPage.'.';?>
<?php }?>
</p>
</div>
<ol>
<?php foreach ( $this->liste as $item ) {?>
<li style="list-style-type:decimal;" class="StyleInfoData" type="1" value="<?=$item['position']?>">
<b><a title="Voir la fiche d'identité de cet établissement" href="<?php
echo $this->url(array(
'controller' => 'identite',
'action' => 'fiche',
'id' => $item['id'],
'siret' => $item['siret']
));
?>"><?=$item['InfoNom']?></a></b><br/>
<?=$item['InfoNomDetail']?>
<b>RCS <?=$item['InfoSiret']?></b>
<br/>
<b><?=$item['InfoEtab']?></b><br/>
<?=$item['InfoAdresse']?><br/>
<?=$item['InfoForme']?>
<?=$item['InfoActivite']?>
<?php if (isset($item['InfoDirigeant'])) { ?>
<?=$item['InfoDirigeant']?>
<?php } elseif(isset($item['InfoActionnaire'])) {?>
<?=$item['InfoActionnaire']?>
<?php }?>
<?php if (isset($item['lien']) && count($item['lien'])>0){?>
<br/> Liens : <?php foreach($item['lien'] as $lien){?>
<a href="<?=$item['href']?>"><?=$item['title']?></a>
<?php }?>
<?php }?>
</li>
<?php }?>
</ol>
<div id="recherche-page">
<?php
if ($this->curPage>1) {
?>
<a href="<?=$this->url(array('action'=>'liste', 'page'=>$this->curPage-1))?>" title="Page précédente...">
<img src="/themes/default/images/boutton_precedent_off.gif"
onmouseover="this.src='/themes/default/images/boutton_precedent_on.gif'"
onmouseout="this.src='/themes/default/images/boutton_precedent_off.gif'"/>
</a>
<?
}
if ($this->curPage!=$this->totPage) {
?>
<span>Page <?=$this->curPage?>/<?=$this->totPage?></span>
<?php
}
if ($this->curPage<$this->totPage) {
?>
<a href="<?=$this->url(array('action'=>'liste', 'page'=>$this->curPage+1))?>" title="Page suivante...">
<img src="/themes/default/images/boutton_suivant_off.gif"
onmouseover="this.src='/themes/default/images/boutton_suivant_on.gif'"
onmouseout="this.src='/themes/default/images/boutton_suivant_off.gif'"/>
</a>
<?php }?>
</div>
<br/>
</div>

View File

@ -31,6 +31,7 @@ class Menu
array('controller'=>'recherche', 'action'=>'list'),
array('controller'=>'recherche', 'action'=>'annonceliste'),
array('controller'=>'recherche', 'action'=>'enquete'),
array('controller'=>'recherche', 'action'=>'refclientliste'),
array('controller'=>'giant', 'action'=>'search'),
array('controller'=>'giant', 'action'=>'identite'),
array('controller'=>'giant', 'action'=>'commandes'),
@ -377,6 +378,11 @@ class Menu
array(
'label' => 'GESTION S&D',
'check' => 'dashboard',
'activateMenu' => array(
array('controller'=>'dashboard', 'action'=>'clients'),
array('controller'=>'dashboard', 'action'=>'client'),
array('controller'=>'dashboard', 'action'=>'commandes'),
),
'pages' => array(
array(
'label' => "Gestion",

View File

@ -22,7 +22,8 @@ class RechercheHistorique
'ent' => array('siret', 'raisonSociale', 'numero', 'voie', 'cpVille', 'telFax', 'naf', 'pays'),
'dir' => array('dirNom', 'dirPrenom', 'dirDateNaissJJ', 'dirDateNaissMM', 'dirDateNaissAAAA', 'dirCpVille'),
'act' => array('actNomRs', 'cpVille', 'siret', 'pays', 'pctMin', 'pctMax'),
'annonce' => array('formA'),
'annonce' => array('formA'),
'refclient' => array('ref'),
);
public function __construct()

View File

@ -29,6 +29,28 @@ class WsScores
}
}
/**
* Recherche par référence client
* @param string $search
* @param integer $position
* @param integer $nbRep
*/
public function searchRefClient($search, $position=0, $nbRep=20)
{
$params = new stdClass();
$params->search = $search;
$params->position = $position;
$params->nbRep = $nbRep;
$client = $this->loadClient('entreprise');
try {
$reponse = $client->searchRefClient($params);
return $reponse->searchRefClientResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* Enter description here ...
* @param unknown_type $siren

View File

@ -8,7 +8,7 @@
}
#recherche {
margin:78px auto;
margin:78px auto 20px auto;
}
#recherche h3 {