issue #0001090 : Integrate all changes from branch 2.3
This commit is contained in:
parent
9cc18d0d02
commit
abd03f95df
@ -391,7 +391,7 @@ class DashboardController extends Zend_Controller_Action
|
||||
|
||||
$document = 'Bilan de '.$matches[1];
|
||||
|
||||
require_once 'Scores/Infogreffe.php';
|
||||
require_once 'Infogreffe/Infogreffe.php';
|
||||
$infogreffe = new Infogreffe();
|
||||
$path = $infogreffe->bilanPath($listCommandes[$i]->refDocument);
|
||||
$fichier = $infogreffe->bilanFilename($listCommandes[$i]->siren, $listCommandes[$i]->refDocument);
|
||||
|
@ -99,7 +99,7 @@ class FichierController extends Zend_Controller_Action
|
||||
$file = $this->getRequest()->getParam('fichier');
|
||||
$configuration = Zend_Registry::get('configuration');
|
||||
//bilan
|
||||
if (preg_match('/^bilan-(consolide|sociaux)-([0-9]{8})/', $file, $matches)) {
|
||||
if (preg_match('/^bilan-[0-9]{9}-(consolides|sociaux)-([0-9]{8})/', $file, $matches)) {
|
||||
$directory = realpath($configuration->path->data).
|
||||
'/'.'greffes/bilans/'.$matches[1].'/'.substr($matches[2],0,4);
|
||||
}
|
||||
|
@ -772,12 +772,12 @@ class PiecesController extends Zend_Controller_Action
|
||||
$ws->setLog('greffe_bilans', $siren, 0, $ref);
|
||||
$info = unserialize($info);
|
||||
|
||||
require_once 'Scores/Infogreffe.php';
|
||||
require_once 'Infogreffe/Infogreffe.php';
|
||||
$infogreffe = new Infogreffe();
|
||||
$path = $infogreffe->bilanPath($ref);
|
||||
$file = $infogreffe->bilanFilename($siren, $ref);
|
||||
|
||||
$href = '/fichier/'.$path.$file;
|
||||
$href = '/fichier/pdf/'.$file;
|
||||
echo '<br/><a href="'.$href.'" target="_blank">Ouvrir le bilan millésime '.$info['type'].'</a>';
|
||||
|
||||
break;
|
||||
@ -830,12 +830,12 @@ class PiecesController extends Zend_Controller_Action
|
||||
$repErreur = $erreur->fetchAll($sql)->toArray();
|
||||
if (count($repErreur)>0){
|
||||
//Téléchagement
|
||||
require_once 'Scores/Infogreffe.php';
|
||||
require_once 'Infogreffe/Infogreffe.php';
|
||||
$infogreffe = new Infogreffe();
|
||||
$path = $infogreffe->bilanPath($ref);
|
||||
$fichier = $infogreffe->bilanFilename($siren, $ref);
|
||||
|
||||
if (infogreffe_dl($fichier, $repErreur[0]['url'], false)) {
|
||||
if ($infogreffe->dl($fichier, $repErreur[0]['url'], false)) {
|
||||
$erreur->update(array('erreur'=>''), "siren='$siren' AND type='bilan' AND ref='$ref'");
|
||||
$ws->setLog('greffe_bilans', $siren, 0, $ref);
|
||||
echo '<br/><a href="/fichier/pdf/'.$fichier.'" target="_blank">Ouvrir le fichier '.$info['type_lib'].' </a>';
|
||||
@ -845,7 +845,7 @@ class PiecesController extends Zend_Controller_Action
|
||||
|
||||
} else {
|
||||
|
||||
require_once 'Scores/Infogreffe.php';
|
||||
require_once 'Infogreffe/Infogreffe.php';
|
||||
$infogreffe = new Infogreffe();
|
||||
$reponse = $infogreffe->getGreffeBilans($siren, $vecteur, $ref);
|
||||
|
||||
@ -865,7 +865,7 @@ class PiecesController extends Zend_Controller_Action
|
||||
if($item['url_acces']!==false) {
|
||||
$ws->setLog('greffe_bilans', $siren, 0, $ref);
|
||||
$path = $infogreffe->bilanPath($ref);
|
||||
$href = '/fichier/'.$path.$item['url_acces'];
|
||||
$href = '/fichier/pdf/'.$item['url_acces'];
|
||||
echo '<br/><a href="'.$href.'" target="_blank">Ouvrir le bilan millésime '.$item['millesime'].'</a>';
|
||||
} else {
|
||||
$ws->setLog('greffe_bilans', $siren, 0, 'Erreur telechargement '.$ref);
|
||||
|
@ -205,7 +205,7 @@ foreach ($tabCommandes as $ref => $commande){
|
||||
$sirenC = $commande['siren'];
|
||||
$refC = $commande['refDocument'];
|
||||
|
||||
require_once 'Scores/Infogreffe.php';
|
||||
require_once 'Infogreffe/Infogreffe.php';
|
||||
$infogreffe = new Infogreffe();
|
||||
if (preg_match('/^([0-9]{4}_).*?$/', $refC, $matches)){
|
||||
$path = $infogreffe->bilanPath($refC);
|
||||
|
@ -70,7 +70,7 @@ if ( isset($opts->reprise) )
|
||||
|
||||
foreach($repErreur as $cmd)
|
||||
{
|
||||
require_once 'Scores/Infogreffe.php';
|
||||
require_once 'Infogreffe/Infogreffe.php';
|
||||
$infogreffe = new Infogreffe();
|
||||
switch($cmd->type){
|
||||
case 'acte':
|
||||
@ -127,7 +127,7 @@ if ( isset($opts->rapport) || isset($opts->rapportcomplet) )
|
||||
$emailTxt.= '<tbody>';
|
||||
foreach($repErreur as $cmd)
|
||||
{
|
||||
require_once 'Scores/Infogreffe.php';
|
||||
require_once 'Infogreffe/Infogreffe.php';
|
||||
$infogreffe = new Infogreffe();
|
||||
switch($cmd->type){
|
||||
case 'acte':
|
||||
|
@ -605,11 +605,26 @@ class Infogreffe
|
||||
$siren = $depot['num_siren'];
|
||||
}
|
||||
$fichier = $this->pathData.$this->actePath($ref).$this->acteFilename($siren,$ref);
|
||||
Zend_Registry::get('firebug')->info($fichier);
|
||||
if( file_exists($fichier) && filesize($fichier)>0 )
|
||||
{
|
||||
$mode = 'fichier';
|
||||
$file_exist = true;
|
||||
}
|
||||
|
||||
//As type_acte change, try to detect file by a pattern
|
||||
//acte-388048308-ACSSPRH-20090630-9201-00-B-01374-30975-02.pdf
|
||||
$filePattern = $this->acteFilename($siren,$ref);
|
||||
$posBegin = 15;
|
||||
$posEnd = strpos($filePattern, '-', $posBegin);
|
||||
$filePattern = substr_replace($filePattern, '*', $posBegin, $posEnd-$posBegin);
|
||||
Zend_Registry::get('firebug')->info($filePattern);
|
||||
$detectedFiles = glob($this->pathData.$this->actePath($ref).$filePattern);
|
||||
if ($detectedFiles!==false && count($detectedFiles)>0) {
|
||||
$ref = str_replace('.pdf', '',substr(basename($detectedFiles[0]),15));
|
||||
$mode = 'fichier';
|
||||
$file_exist = true;
|
||||
}
|
||||
|
||||
//Génération date (date_acte peut être vide)
|
||||
if(!empty($acte['date_acte'])){ $date = WDate::dateT('Y-m-d', 'Ymd', $acte['date_acte']); }
|
||||
@ -711,9 +726,10 @@ class Infogreffe
|
||||
} else {
|
||||
$siren = $bilan['num_siren'];
|
||||
}
|
||||
|
||||
|
||||
//Cas de fichier correspondant à la référence
|
||||
$fichier = $this->pathData.$this->bilanPath($ref).$this->bilanFilename($siren,$ref);
|
||||
Zend_Registry::get('firebug')->info('Fichier : '.$fichier);
|
||||
if( file_exists($fichier) && filesize($fichier)>0 )
|
||||
{
|
||||
$mode = 'fichier';
|
||||
@ -1157,7 +1173,10 @@ class Infogreffe
|
||||
preg_match('/^([0-9]{4})_([a-z]{0,})-([0-9]{8})/', $ref, $matches);
|
||||
$type = $matches[2];
|
||||
$dateCloture = $matches[3];
|
||||
return 'bilan-'.$siren.'-'.type.'-'.$dateCloture.'.pdf';
|
||||
if ($type=='') {
|
||||
$type = 'sociaux';
|
||||
}
|
||||
return 'bilan-'.$siren.'-'.$type.'-'.$dateCloture.'.pdf';
|
||||
}
|
||||
|
||||
function bilanPath($ref)
|
||||
@ -1165,6 +1184,9 @@ class Infogreffe
|
||||
preg_match('/^([0-9]{4})_([a-z]{0,})-([0-9]{8})/', $ref, $matches);
|
||||
$type = $matches[2];
|
||||
$dateCloture = $matches[3];
|
||||
if ($type=='') {
|
||||
$type = 'sociaux';
|
||||
}
|
||||
return '/greffes/bilans/'.$type.'/'.substr($dateCloture,0,4).'/';
|
||||
}
|
||||
|
||||
@ -1183,6 +1205,9 @@ class Infogreffe
|
||||
if ( !is_dir($path.$wholePath) ) {
|
||||
mkdir($path.$wholePath, 0777, true);
|
||||
}
|
||||
|
||||
Zend_Registry::get('firebug')->info($fichier);
|
||||
Zend_Registry::get('firebug')->info($url);
|
||||
|
||||
if(!file_exists($path.$fichier) || !filesize($path.$fichier)>2000)
|
||||
{
|
||||
@ -1197,13 +1222,18 @@ class Infogreffe
|
||||
}
|
||||
if( ($page['code']!=408 || $page['code']!=400) && substr($body,0,4)=='%PDF') {
|
||||
//Ecriture du fichier sur le serveur en local
|
||||
file_put_contents($path.$fichier, $body);
|
||||
$return = $fichier;
|
||||
$erreurDL = '';
|
||||
Zend_Registry::get('firebug')->info($path.$fichier);
|
||||
if ( file_put_contents($path.$fichier, $body) ) {
|
||||
$return = basename($fichier);
|
||||
$erreurDL = '';
|
||||
} else {
|
||||
$return = false;
|
||||
$erreurDL = "Erreur lors de l'ecriture du fichier";
|
||||
}
|
||||
}
|
||||
if ($trace) {
|
||||
$erreur = new Application_Model_CommandesErreur();
|
||||
preg_match('/^(acte|bilan)-([0-9]{9})-(.*)\.pdf$/', $fichier, $ref);
|
||||
preg_match('/(acte|bilan)-([0-9]{9})-(.*)\.pdf$/', $fichier, $ref);
|
||||
$data = array(
|
||||
'siren' => $ref[2],
|
||||
'type' => $ref[1],
|
||||
@ -1215,7 +1245,7 @@ class Infogreffe
|
||||
$erreur->insert($data);
|
||||
}
|
||||
} else {
|
||||
$return = $fichier;
|
||||
$return = basename($fichier);
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user