Modification méthode téléchargement des fichiers pdf historique bodacc

This commit is contained in:
Michael RICOIS 2012-09-10 14:03:47 +00:00
parent c347098cc8
commit 6c57260088
2 changed files with 23 additions and 14 deletions

View File

@ -188,12 +188,21 @@ class RechercheController extends Zend_Controller_Action
}
//Change URL to download file
$fichier = str_replace("http://wse.scores-decisions.com:8081/fichier/bodacc/q",'',$annonce->Fichier);
//$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);
$annonces[] = array (
'annee' => $annonce->Annee,
'code' => $code,
'text' => $texte,
'file' => $this->view->url(array('controller'=>'telechargement', 'action'=>'histopdf')).'/q'.$fichier,
'file' => $this->view->url(array(
'controller'=>'telechargement',
'action'=>'histopdf',
'q' => $fichier,
'host' => base64_encode($host))
),
);
}
$this->view->assign('annonces', $annonces);
@ -363,7 +372,7 @@ class RechercheController extends Zend_Controller_Action
//Giant
if( !empty($params['pays']) && $type == 'ent' ){
Zend_Registry::get('firebug')->info('RECHERCHE GIANT');
$this->_forward('search', 'giant', null, $params);
$this->_forward('search', 'international', null, $params);
//Recherche
} else {
@ -401,7 +410,9 @@ class RechercheController extends Zend_Controller_Action
$cpVille = cleanutf8($params['cpVille']);
$cpVille = str_replace(array('(',')', '/'), array('', '', ' '), $cpVille);
if (preg_match("/^([0-9]{2,5})([\D]*)/i", $cpVille, $matches)) {
//( (2[A|B]) | [0-9]{2,5} )
if (preg_match("/^(2[A|B]|[0-9]{2,5})(.*)/i", $cpVille, $matches)) {
$cp = trim($matches[1]);
$ville = trim($matches[2]);
} else {
@ -419,8 +430,6 @@ class RechercheController extends Zend_Controller_Action
$criteres['naf'] = $naf;
$criteres['siege'] = false;
Zend_Registry::get('firebug')->info($params['filtre']);
//Affichage du filtre actif/inactif
$filtres = array(
'tout' => array(
@ -743,11 +752,13 @@ class RechercheController extends Zend_Controller_Action
public function ipariAction()
{
$siret = $this->getRequest()->getParam('siret');
$user = new Scores_Utilisateur();
$url = 'http://ipari.scores-decisions.com/?action=logon&login='.$user->getLogin().
'&hach='.$user->getPassword().'&pass=';
if (!empty($this->siret)){
$url.= '&siret='.$this->siret;
if (!empty($siret)){
$url.= '&siret='.$siret;
}
$this->_redirect($url);
}

View File

@ -229,15 +229,14 @@ class TelechargementController extends Zend_Controller_Action
$request = $this->getRequest();
$url = "http://wse.scores-decisions.com:8081/fichier/bodacc";
$q = $request->getParam('q', '');
$host = base64_decode($request->getParam('host', ''));
//Authenticate info
$auth = Zend_Auth::getInstance();
$identity = $auth->getIdentity();
$authinfo = '/login/'.$identity->username.'/hach/'.$identity->password;
$url = $url.$authinfo.'/q/'.$q;
$url = $host.$authinfo.'/q/'.$q;
$file = $this->getFile($url, uniqid().'.pdf');
@ -252,7 +251,6 @@ class TelechargementController extends Zend_Controller_Action
echo "Erreur lors du téléchargement du fichier.";
}
}
exit;
}
/**