cli getTemoinPdf

This commit is contained in:
Michael RICOIS 2017-01-16 17:12:04 +01:00
parent 7b441166ec
commit e8d13e6044
4 changed files with 550 additions and 25 deletions

View File

@ -141,7 +141,7 @@ class JuridiqueController extends Zend_Controller_Action
);
$this->view->assign('source', $session->getSource());
if ( intval($this->siret)==0 ){
if (intval($this->siret) == 0){
$this->view->assign('sourceId', $session->getSourceId());
} else {
$this->view->assign('sourceId', null);
@ -149,23 +149,44 @@ class JuridiqueController extends Zend_Controller_Action
$this->view->assign('idAnn', $idAnn);
$this->view->assign('annonce', $annonce);
if ($request->getParam('q')=='ajax')
{
if ($request->getParam('q') == 'ajax') {
$this->_helper->layout()->disableLayout();
//$this->_helper->viewRenderer->setNoRender(true);
$this->renderScript('juridique/annonce-ajax.phtml');
} else {
$this->view->assign('PageCurrent', $page);
//Définir url pour téléchargement pdf
if (in_array($annonce['Code'], array('BODA', 'BODB', 'BODC')) &&
intval($annonce['Annee']) >= 2008) {
$lienBodacc = $this->view->url(array('controller' => 'juridique',
'action' => 'bodaccpdf', 'type' => substr($annonce['Code'],3,1),
'annee' => $annonce['Annee'], 'num' => $annonce['Num'],
), 'default', true);
$this->view->assign('lienBodacc', $lienBodacc);
if (in_array($annonce['Code'], array('BODA', 'BODB', 'BODC'))) {
$datePublication = DateTime::createFromFormat('Y-m-d', $ann->DateParution);
$dateBodacc = DateTime::createFromFormat('Ymd', '20080101');
$dateTemoinA = DateTime::createFromFormat('Ymd', '20161115');
$dateTemoinB = DateTime::createFromFormat('Ymd', '20161011');
$dateTemoinC = DateTime::createFromFormat('Ymd', '20160223');
if ($annonce['Code'] == 'BODA' && $datePublication >= $dateTemoinA) {
$lienBodacc = $this->view->url(array('controller'=>'juridique',
'action'=>'temoinpdf', 'type'=>substr($annonce['Code'],3,1),
'annee'=>$annonce['Annee'], 'num'=>$annonce['Num']), 'default', true);
$this->view->assign('bodaccLink', $lienBodacc);
$this->view->assign('bodaccLinkLabel', 'Télécharger le témoin de publication');
} elseif ($annonce['Code'] == 'BODB' && $datePublication >= $dateTemoinB) {
$lienBodacc = $this->view->url(array('controller'=>'juridique',
'action'=>'temoinpdf', 'type'=>substr($annonce['Code'],3,1),
'annee'=>$annonce['Annee'], 'num'=>$annonce['Num']), 'default', true);
$this->view->assign('bodaccLink', $lienBodacc);
$this->view->assign('bodaccLinkLabel', 'Télécharger le témoin de publication');
} elseif ($annonce['Code'] == 'BODC' && $datePublication >= $dateTemoinC) {
$lienBodacc = $this->view->url(array('controller'=>'juridique',
'action'=>'temoinpdf', 'type'=>substr($annonce['Code'],3,1),
'annee'=>$annonce['Annee'], 'num'=>$annonce['Num']), 'default', true);
$this->view->assign('bodaccLink', $lienBodacc);
$this->view->assign('bodaccLinkLabel', 'Télécharger le témoin de publication');
} elseif ($datePublication >= $dateBodacc) {
$lienBodacc = $this->view->url(array('controller'=>'juridique',
'action'=> 'bodaccpdf', 'type'=>substr($annonce['Code'],3,1),
'annee' => $annonce['Annee'], 'num'=>$annonce['Num']), 'default', true);
$this->view->assign('bodaccLink', $lienBodacc);
$this->view->assign('bodaccLinkLabel', 'Télécharger le bulletin officiel');
}
}
$this->renderScript('juridique/annonce.phtml');
@ -511,6 +532,9 @@ class JuridiqueController extends Zend_Controller_Action
}
/**
* Gestion téléchargement du Bodacc au format pdf
*/
public function bodaccpdfAction()
{
$this->_helper->layout()->disableLayout();
@ -520,12 +544,7 @@ class JuridiqueController extends Zend_Controller_Action
$type = $request->getParam('type');
$annee = $request->getParam('annee');
$num = $request->getParam('num');
//$num doit être retraité pour être sur 4 position
$c = strlen($num);
for($i=0;$i<4-$c;$i++){
$num = '0'.$num;
}
$num = str_pad($num, 4, '0', STR_PAD_LEFT);
$c = Zend_Registry::get('config');
$file = $c->profil->path->shared.'/persist/bodacc/'.$type.'/'.$annee.'/'.
@ -544,6 +563,16 @@ class JuridiqueController extends Zend_Controller_Action
}
}
/**
* Gestion du téléchargement du témoin de publication au bodacc
*/
public function temoinpdfAction()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$request = $this->getRequest();
}
public function annoncenumAction()
{

View File

@ -105,15 +105,15 @@ if ($this->hasModeEdition){
<p><code><?=$this->RemplaceSiren($this->annonce['Texte'])?></code></p>
</div>
<?php if ($this->bodaccLink) { ?>
<div class="paragraph" style="text-align:center;">
<?php if ( $this->lienBodacc ) { ?>
<span id="bodacc" style="padding-bottom:10px;border-bottom:1px solid #cccccc;">
<a href="<?=$this->lienBodacc?>">
<a href="<?=$this->bodaccLink?>">
<img src="/themes/default/images/interfaces/pdf.png" alt="Bodacc au format PDF">
Télécharger le bulletin officiel</a>
<?=$this->bodaccLinkLabel?></a>
</span>
<?php } ?>
</div>
<?php } ?>
<div class="paragraph">
<?php if (count($this->annonce['Entites'])>0) {?>

View File

@ -6,7 +6,8 @@
"phpoffice/phpexcel": "1.8.0",
"spipu/html2pdf": "^4.6",
"setasign/fpdi": "^1.6",
"cybermonde/odtphp": "^1.7"
"cybermonde/odtphp": "^1.7",
"fabpot/goutte": "^3.2"
},
"require-dev": {
"ccampbell/chromephp": "^4.1"

497
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "0e96a441bb527ec0321169f4307e8acd",
"content-hash": "a5c564ae11b76baad05fe73b3b809099",
"packages": [
{
"name": "cybermonde/odtphp",
@ -41,6 +41,226 @@
],
"time": "2015-06-02T07:28:25+00:00"
},
{
"name": "fabpot/goutte",
"version": "v3.2.1",
"source": {
"type": "git",
"url": "https://github.com/FriendsOfPHP/Goutte.git",
"reference": "db5c28f4a010b4161d507d5304e28a7ebf211638"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/FriendsOfPHP/Goutte/zipball/db5c28f4a010b4161d507d5304e28a7ebf211638",
"reference": "db5c28f4a010b4161d507d5304e28a7ebf211638",
"shasum": ""
},
"require": {
"guzzlehttp/guzzle": "^6.0",
"php": ">=5.5.0",
"symfony/browser-kit": "~2.1|~3.0",
"symfony/css-selector": "~2.1|~3.0",
"symfony/dom-crawler": "~2.1|~3.0"
},
"type": "application",
"extra": {
"branch-alias": {
"dev-master": "3.2-dev"
}
},
"autoload": {
"psr-4": {
"Goutte\\": "Goutte"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
}
],
"description": "A simple PHP Web Scraper",
"homepage": "https://github.com/FriendsOfPHP/Goutte",
"keywords": [
"scraper"
],
"time": "2017-01-03T13:21:43+00:00"
},
{
"name": "guzzlehttp/guzzle",
"version": "6.2.2",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
"reference": "ebf29dee597f02f09f4d5bbecc68230ea9b08f60"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/ebf29dee597f02f09f4d5bbecc68230ea9b08f60",
"reference": "ebf29dee597f02f09f4d5bbecc68230ea9b08f60",
"shasum": ""
},
"require": {
"guzzlehttp/promises": "^1.0",
"guzzlehttp/psr7": "^1.3.1",
"php": ">=5.5"
},
"require-dev": {
"ext-curl": "*",
"phpunit/phpunit": "^4.0",
"psr/log": "^1.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "6.2-dev"
}
},
"autoload": {
"files": [
"src/functions_include.php"
],
"psr-4": {
"GuzzleHttp\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
}
],
"description": "Guzzle is a PHP HTTP client library",
"homepage": "http://guzzlephp.org/",
"keywords": [
"client",
"curl",
"framework",
"http",
"http client",
"rest",
"web service"
],
"time": "2016-10-08T15:01:37+00:00"
},
{
"name": "guzzlehttp/promises",
"version": "v1.3.1",
"source": {
"type": "git",
"url": "https://github.com/guzzle/promises.git",
"reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646",
"reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646",
"shasum": ""
},
"require": {
"php": ">=5.5.0"
},
"require-dev": {
"phpunit/phpunit": "^4.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4-dev"
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\Promise\\": "src/"
},
"files": [
"src/functions_include.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
}
],
"description": "Guzzle promises library",
"keywords": [
"promise"
],
"time": "2016-12-20T10:07:11+00:00"
},
{
"name": "guzzlehttp/psr7",
"version": "1.3.1",
"source": {
"type": "git",
"url": "https://github.com/guzzle/psr7.git",
"reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/5c6447c9df362e8f8093bda8f5d8873fe5c7f65b",
"reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b",
"shasum": ""
},
"require": {
"php": ">=5.4.0",
"psr/http-message": "~1.0"
},
"provide": {
"psr/http-message-implementation": "1.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4-dev"
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\Psr7\\": "src/"
},
"files": [
"src/functions_include.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
}
],
"description": "PSR-7 message implementation",
"keywords": [
"http",
"message",
"stream",
"uri"
],
"time": "2016-06-24T23:00:38+00:00"
},
{
"name": "phpoffice/phpexcel",
"version": "1.8.0",
@ -98,6 +318,56 @@
],
"time": "2014-03-02T15:22:49+00:00"
},
{
"name": "psr/http-message",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-message.git",
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for HTTP messages",
"homepage": "https://github.com/php-fig/http-message",
"keywords": [
"http",
"http-message",
"psr",
"psr-7",
"request",
"response"
],
"time": "2016-08-06T14:39:51+00:00"
},
{
"name": "setasign/fpdi",
"version": "1.6.1",
@ -200,6 +470,231 @@
],
"time": "2016-04-05T12:25:17+00:00"
},
{
"name": "symfony/browser-kit",
"version": "v3.2.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/browser-kit.git",
"reference": "548f8230bad9f77463b20b15993a008f03e96db5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/browser-kit/zipball/548f8230bad9f77463b20b15993a008f03e96db5",
"reference": "548f8230bad9f77463b20b15993a008f03e96db5",
"shasum": ""
},
"require": {
"php": ">=5.5.9",
"symfony/dom-crawler": "~2.8|~3.0"
},
"require-dev": {
"symfony/css-selector": "~2.8|~3.0",
"symfony/process": "~2.8|~3.0"
},
"suggest": {
"symfony/process": ""
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.2-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\BrowserKit\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony BrowserKit Component",
"homepage": "https://symfony.com",
"time": "2017-01-02T20:32:22+00:00"
},
{
"name": "symfony/css-selector",
"version": "v3.2.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/css-selector.git",
"reference": "f0e628f04fc055c934b3211cfabdb1c59eefbfaa"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/css-selector/zipball/f0e628f04fc055c934b3211cfabdb1c59eefbfaa",
"reference": "f0e628f04fc055c934b3211cfabdb1c59eefbfaa",
"shasum": ""
},
"require": {
"php": ">=5.5.9"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.2-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\CssSelector\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jean-François Simon",
"email": "jeanfrancois.simon@sensiolabs.com"
},
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony CssSelector Component",
"homepage": "https://symfony.com",
"time": "2017-01-02T20:32:22+00:00"
},
{
"name": "symfony/dom-crawler",
"version": "v3.2.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/dom-crawler.git",
"reference": "27d9790840a4efd3b7bb8f5f4f9efc27b36b7024"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/27d9790840a4efd3b7bb8f5f4f9efc27b36b7024",
"reference": "27d9790840a4efd3b7bb8f5f4f9efc27b36b7024",
"shasum": ""
},
"require": {
"php": ">=5.5.9",
"symfony/polyfill-mbstring": "~1.0"
},
"require-dev": {
"symfony/css-selector": "~2.8|~3.0"
},
"suggest": {
"symfony/css-selector": ""
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.2-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\DomCrawler\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony DomCrawler Component",
"homepage": "https://symfony.com",
"time": "2017-01-02T20:32:22+00:00"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.3.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "e79d363049d1c2128f133a2667e4f4190904f7f4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/e79d363049d1c2128f133a2667e4f4190904f7f4",
"reference": "e79d363049d1c2128f133a2667e4f4190904f7f4",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"suggest": {
"ext-mbstring": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for the Mbstring extension",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"mbstring",
"polyfill",
"portable",
"shim"
],
"time": "2016-11-14T01:06:16+00:00"
},
{
"name": "tecnickcom/tcpdf",
"version": "6.2.12",