2010-07-08 10:15:02 +00:00
|
|
|
<?php
|
|
|
|
$firephp->info('DL fichier');
|
|
|
|
//Enregistrement dans la bdd des informations concernant l'acte
|
|
|
|
$error = '';
|
|
|
|
switch($vue)
|
|
|
|
{
|
|
|
|
case 'actes':
|
|
|
|
$info = unserialize(urldecode($_REQUEST['info']));
|
|
|
|
//Pour les actes multiples
|
|
|
|
//Vérifier que le fichier n'est pas déjà présent en local
|
|
|
|
$option = explode('-',$ref);
|
|
|
|
$num_actes = explode('|',$option[7]);
|
|
|
|
if(is_array($num_actes) && count($num_actes)>1){
|
|
|
|
$date = substr($info['date_acte'],6,4).
|
|
|
|
substr($info['date_acte'],3,2).
|
|
|
|
substr($info['date_acte'],0,2);
|
|
|
|
$option_reel = $info['type'].'-'.$date.'-'.
|
|
|
|
$option[2].'-'.$option[3].'-'.
|
|
|
|
$option[4].'-'.$option[5].'-'.
|
|
|
|
$option[6].'-'.$info['num_acte'];
|
|
|
|
$file = 'acte-'.$siren.'-'.$option_reel.'.pdf';
|
|
|
|
|
|
|
|
if( file_exists(PATH_DATA.'/pdf/'.$file) ){
|
|
|
|
if(!INFOGREFFE_DEBUG) {
|
|
|
|
$client->setLog('greffe_'.$vue, $siren, 0, $option_reel);
|
|
|
|
}
|
2010-07-15 15:03:52 +00:00
|
|
|
$message.= '<br/><a href="./pdf/'.$file.'" target="_blank">'.
|
2010-07-08 10:15:02 +00:00
|
|
|
'Ouvrir le fichier '.$info['type_lib'].
|
|
|
|
' </a>';
|
|
|
|
echo $message;
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//Process normal
|
|
|
|
$reponse = getGreffeActes($siren, $vecteur, $ref);
|
|
|
|
|
|
|
|
if(empty($reponse['error'])){
|
|
|
|
$items = $reponse['result']['actes'];
|
|
|
|
}else{
|
|
|
|
$error = $reponse['error']['errNum'].' - '.
|
|
|
|
$reponse['error']['errMsg'];
|
|
|
|
}
|
|
|
|
if($error=='')
|
|
|
|
{
|
|
|
|
$firephp->log($items, 'items');
|
|
|
|
foreach($items as $item)
|
|
|
|
{
|
|
|
|
$firephp->log($info, 'info');
|
|
|
|
if($item['num_acte']==$info['num_acte'])
|
|
|
|
{
|
|
|
|
$firephp->info('ACTE DL');
|
|
|
|
$firephp->log($item, 'item');
|
|
|
|
if($item['url_acces']!==false)
|
|
|
|
{
|
|
|
|
if(!INFOGREFFE_DEBUG) $client->setLog('greffe_'.$vue, $siren, 0, $option_reel);
|
2010-07-15 15:03:52 +00:00
|
|
|
$message.= '<br/><a href="./pdf/'.$item['url_acces'].'" target="_blank">Ouvrir le fichier '.$item['type_acte_libelle'].' </a>';
|
2010-07-08 10:15:02 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$message.= '<br/>Impossible de télécharger le fichier '.$item['type_acte_libelle'].' auprès de notre partenaire.';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
echo $message;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo '<br/>Erreur : '.$error;
|
|
|
|
if(!INFOGREFFE_DEBUG) $client->setLog('greffe_'.$vue, $siren, 0, 'Erreur '.$reponse['error']['errNum']);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'bilans':
|
|
|
|
$reponse = getGreffeBilans($siren, $vecteur, $ref);
|
|
|
|
|
|
|
|
if(empty($reponse['error'])) $items = $reponse['result']['bilan'];
|
|
|
|
else $error = $reponse['error']['errNum'].' - '.$reponse['error']['errMsg'];
|
|
|
|
if($error=='')
|
|
|
|
{
|
|
|
|
$firephp->log($items, 'items');
|
|
|
|
$info = unserialize(urldecode($_REQUEST['info']));
|
|
|
|
foreach($items as $item)
|
|
|
|
{
|
|
|
|
$firephp->log($info, 'info');
|
|
|
|
$firephp->info('ACTE DL');
|
|
|
|
$firephp->log($item, 'item');
|
|
|
|
if($item['url_acces']!==false)
|
|
|
|
{
|
|
|
|
if(!INFOGREFFE_DEBUG) $client->setLog('greffe_'.$vue, $siren, 0, $ref);
|
2010-07-15 15:03:52 +00:00
|
|
|
$message.= '<br/><a href="./pdf/'.$item['url_acces'].'" target="_blank">Ouvrir le bilan millésime '.$item['millesime'].'</a>';
|
2010-07-08 10:15:02 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$message.= '<br/>Impossible de télécharger le fichier auprès de notre partenaire.';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
echo $message;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo '<br/>Erreur : '.$error;
|
|
|
|
if(!INFOGREFFE_DEBUG) $client->setLog('greffe_'.$vue, $siren, 0, 'Erreur '.$reponse['error']['errNum']);
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|