Correction Bilan association
This commit is contained in:
parent
c087d459ff
commit
e08564bad5
@ -19,7 +19,6 @@ class PiecesController extends Zend_Controller_Action
|
||||
public function init()
|
||||
{
|
||||
require_once 'Scores/WsScores.php';
|
||||
require_once 'Infogreffe/Infogreffe.php';
|
||||
|
||||
$request = $this->getRequest();
|
||||
$this->siret = $request->getParam('siret');
|
||||
@ -937,8 +936,8 @@ class PiecesController extends Zend_Controller_Action
|
||||
if ( $user->checkPerm('actes') ) {
|
||||
if ( !empty($item->File) ) {
|
||||
$href = $this->view->url(array(
|
||||
'controller'=>'telechargement',
|
||||
'action'=>'bilan',
|
||||
'controller'=>'pieces',
|
||||
'action'=>'associationbilan',
|
||||
'siren'=> $siren,
|
||||
'dateCloture'=> $item->DateCloture,
|
||||
'reference'=> $item->File,
|
||||
@ -984,23 +983,45 @@ class PiecesController extends Zend_Controller_Action
|
||||
{
|
||||
//Désactivation affichage
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$request = $this->getRequest();
|
||||
$siren = $request->getParam('siren');
|
||||
$diffusion = $request->getParam('diffusion');
|
||||
$diffusion = 'T';
|
||||
$dateCloture = $request->getParam('dateCloture');
|
||||
$reference = $request->getParam('reference');
|
||||
$type = 'association';
|
||||
|
||||
//Récupération du l'URL
|
||||
$ws = new WsScores();
|
||||
$url = $ws->getPiecesBilan($siren, $diffusion, $dateCloture, $reference);
|
||||
$url = $ws->getPiecesBilan($siren, $type, $diffusion, $dateCloture, $reference);
|
||||
|
||||
if ( !empty($url) ) {
|
||||
|
||||
try {
|
||||
$client = new Zend_Http_Client($url);
|
||||
$client->setStream();
|
||||
$stream = $client->request('GET');
|
||||
if ( $stream->isSuccessful() && substr($stream->getBody(),0,4)=='%PDF' ) {
|
||||
$c = Zend_Registry::get('config');
|
||||
$file = 'bilan-'.$siren.'-'.$type.'-'.$dateCloture.'.pdf';
|
||||
if (copy($stream->getStreamName(), $c->profil->path->files . '/' . $file)) {
|
||||
$this->view->assign('url', $this->view->url(array(
|
||||
'controller' => 'fichier',
|
||||
'action' => 'greffe',
|
||||
), null, true).'/'.$file);
|
||||
} else {
|
||||
$this->view->assign('msg', "Impossible de distribuer le fichier.");
|
||||
}
|
||||
} else {
|
||||
$this->view->assign('msg', "Erreur lors du téléchargement du fichier.");
|
||||
}
|
||||
} catch (Zend_Http_Client_Exception $e) {
|
||||
Zend_Registry::get('firebug')->info('HTTP Exception : '.$e->getMessage());
|
||||
$this->view->assign('msg', "Erreur lors du téléchargement du fichier.");
|
||||
}
|
||||
|
||||
//Téléchargement du fichier
|
||||
if( $url !== false) {
|
||||
echo '<br/><a href="'.$url.'" target="_blank">Cliquez ici pour ouvrir le fichier</a>';
|
||||
} else {
|
||||
echo '<br/>Fichier indisponible !';
|
||||
$this->view->assign('msg', "Fichier indisponible !");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,5 @@
|
||||
<?php if($this->msg) {?>
|
||||
<?=$this->msg?>
|
||||
<?php } else {?>
|
||||
<a href="<?=$this->url?>" target="_blank">Télécharger le fichier</a>
|
||||
<?php }?>
|
Loading…
Reference in New Issue
Block a user