1009 lines
33 KiB
PHP
1009 lines
33 KiB
PHP
<?php
|
||
|
||
require_once realpath(dirname(__FILE__)).'/functions.php';
|
||
require_once realpath(dirname(__FILE__)).'/constantes.php';
|
||
require_once 'mail/mail.php';
|
||
|
||
/** INFOGREFFE **/
|
||
define('INFOGREFFE_FILETIME', 8);
|
||
define('INFOGREFFE_PATH', PATH_SITE.'/cache/infogreffe/');
|
||
|
||
if( ENVIRONNEMENT=='PRD' || ENVIRONNEMENT=='REC')
|
||
{
|
||
define('INFOGREFFE_DEBUG', false);
|
||
}else{
|
||
define('INFOGREFFE_DEBUG', true);
|
||
}
|
||
|
||
$infogreffe_ws_url = INFOGREFFE_WS_URL;
|
||
$infogreffe_ws_uri = INFOGREFFE_WS_URI;
|
||
$infogreffe_ws_user = INFOGREFFE_WS_USER;
|
||
$infogreffe_ws_pass = INFOGREFFE_WS_PASS;
|
||
|
||
if(INFOGREFFE_DEBUG)
|
||
{
|
||
$infogreffe_ws_url = 'https://wsrcte.extelia.fr/WSContextInfogreffe/INFOGREFFE';
|
||
$infogreffe_ws_uri = 'https://wsrcte.extelia.fr/';
|
||
$infogreffe_ws_user = '85000109';
|
||
$infogreffe_ws_pass = '160409';
|
||
}
|
||
|
||
/**
|
||
* Génére une chaîne xml pour la requête soap défini suivant les paramètres d'infogreffe
|
||
* @param string $siren
|
||
* @param int $idCommande
|
||
* @param string $type
|
||
* @param string $vecteur
|
||
* @param string or array $option
|
||
* @return string
|
||
*/
|
||
function infogreffe_requetexml($siren, $idCommande, $type, $vecteur, $option)
|
||
{
|
||
global $client, $firephp, $infogreffe_ws_url, $infogreffe_ws_uri, $infogreffe_ws_user,
|
||
$infogreffe_ws_pass;
|
||
$xmlStr = '';
|
||
|
||
$xml = new SimpleXMLElement('<demande></demande>');
|
||
|
||
$emetteur = $xml->addChild('emetteur');
|
||
$emetteur->addChild('code_abonne', $infogreffe_ws_user);
|
||
$emetteur->addChild('mot_passe', $infogreffe_ws_pass);
|
||
$emetteur->addChild('reference_client', 'G'.$idCommande); //Générer l'identifiant de commande
|
||
|
||
$code_requete = $emetteur->addChild('code_requete');
|
||
$code_requete->addChild('type_profil', 'A');
|
||
$code_requete->addChild('origine_emetteur', 'IC');
|
||
$code_requete->addChild('nature_requete', 'C'); // C = Commande de documents
|
||
$code_requete->addChild('type_document', $type); // KB = Kbis, PN = privilèges et nantissements, BI = Bilan complet, BS = bilan saisi, ST = Dernier Statut à jour, AC = Acte, SD = Surveillance Demande et Accusé, SR = Surveillance Révélation, SP = Surveillance Portefeuille, FA = Recherche PCL, FI = Inventaire, FJ = Jugement, FO = Ordonnance, FD = Dépôt divers, LE = Liste Etablissements
|
||
$code_requete->addChild('type_requete', 'S'); // S = Simple
|
||
|
||
$mode_diffusion = $code_requete->addChild('mode_diffusion');
|
||
// Mode de diffusion : C = Courrier, T = Téléchargement, M = Mail, XL = XML
|
||
if ($vecteur=='XL' && $option=='')
|
||
{
|
||
//On ajoute tout les types de diffusions pour $vecteur = XL
|
||
$mode_diffusion->addChild('mode')->addAttribute('type', 'C');
|
||
$mode_diffusion->addChild('mode')->addAttribute('type', 'T');
|
||
}
|
||
$mode_diffusion->addChild('mode')->addAttribute('type', $vecteur);
|
||
|
||
$code_requete->addChild('media', 'WS');
|
||
|
||
$commande = $xml->addChild('commande');
|
||
$commande->addChild('num_siren', $siren);
|
||
|
||
// Commande de documents : bilan saisie ou bilan complet
|
||
if ( ($type=='BS' || $type=='BI') && $option!='' )
|
||
{
|
||
//Format de la variable option pour la commande de type BI ou BS
|
||
/*
|
||
0 => millesime
|
||
1 => date_cloture
|
||
2 => greffe
|
||
3 => dossier_millesime
|
||
4 => dossier_statut
|
||
5 => dossier_chrono
|
||
6 => num_depot
|
||
*/
|
||
$ref = explode('-', $option);
|
||
$commande->addChild('greffe',$ref[2]);
|
||
$commande->addChild('dossier_millesime',$ref[3]);
|
||
$commande->addChild('dossier_statut',$ref[4]);
|
||
$commande->addChild('dossier_chrono',$ref[5]);
|
||
$commande->addChild('num_depot',$ref[6]);
|
||
$commande->addChild('date_cloture',WDate::dateT('Ymd','d/m/Y', $ref[1]));
|
||
|
||
$fichierOption = $option;
|
||
|
||
infogreffe_logfile(array($siren, $idCommande, $type, $vecteur, $option));
|
||
|
||
}
|
||
// Commande de documents : actes
|
||
elseif ( $type=='AC' && !empty($option) )
|
||
{
|
||
//Format de la variable option pour commande type AC
|
||
/*
|
||
0 => type_acte
|
||
1 => date de référence
|
||
2 => greffe
|
||
3 => dossier_millesime
|
||
4 => dossier_statut
|
||
5 => dossier_chrono
|
||
6 => num_depot
|
||
7 => num_acte
|
||
*/
|
||
$ref = explode('-', $option);
|
||
$num_actes = explode('|', $ref[7]);
|
||
$commande->addChild('greffe',$ref[2]);
|
||
$commande->addChild('dossier_millesime', $ref[3]);
|
||
$commande->addChild('dossier_statut', $ref[4]);
|
||
$commande->addChild('dossier_chrono', $ref[5]);
|
||
$commande->addChild('num_depot', $ref[6]);
|
||
$liste_actes = $commande->addChild('liste_actes');
|
||
if(is_array($num_actes) && count($num_actes)>1)
|
||
{
|
||
foreach($num_actes as $num_acte)
|
||
{
|
||
$liste_actes->addChild('acte')->addAttribute('num', $num_acte);
|
||
}
|
||
$fichierOption = $ref[0].'-'.$ref[1].'-'.$ref[2].'-'.$ref[3].'-'.$ref[4].'-'.$ref[5].'-'.$ref[6];
|
||
}
|
||
else
|
||
{
|
||
$liste_actes->addChild('acte')->addAttribute('num', $ref[7]);
|
||
$fichierOption = $option;
|
||
}
|
||
infogreffe_logfile(array($siren, $idCommande, $type, $vecteur, $option));
|
||
}
|
||
|
||
$xmlStr = str_replace('<?xml version="1.0"?>', '', $xml->asXML());
|
||
empty($option) ? $fichier = $type.'-'.$siren.'.xml' : $fichier = $type.'-'.$siren.'-'.$fichierOption.'.xml';
|
||
file_put_contents(INFOGREFFE_PATH.$fichier.'.query', $xmlStr);
|
||
//Retourne le xml sous forme de chaîne de caractères
|
||
return $xmlStr;
|
||
}
|
||
|
||
/**
|
||
* Requête le webservice infogreffe
|
||
* @param unknown_type $xml
|
||
* @return unknown_type
|
||
*/
|
||
function infogreffe_getproduitsxml($xml)
|
||
{
|
||
global $infogreffe_ws_url;
|
||
$req = utf8_encode($xml);
|
||
$post = '<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://webservices.infogreffe.fr/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:getProduitsWebServicesXML><param0 xsi:type="xsd:string">'.$req.'</param0></ns1:getProduitsWebServicesXML></SOAP-ENV:Body></SOAP-ENV:Envelope>';
|
||
$ch = curl_init();
|
||
curl_setopt($ch, CURLOPT_URL, $infogreffe_ws_url);
|
||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
||
curl_setopt($ch, CURLOPT_COOKIEFILE,TRUE);
|
||
curl_setopt($ch, CURLOPT_POST, TRUE);
|
||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
|
||
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
|
||
$reponseXML = curl_exec($ch);
|
||
$reponseXML = str_replace("<?xml version='1.0' encoding='UTF-8'?><SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'><SOAP-ENV:Body><ns0:getProduitsWebServicesXMLResponse xmlns:ns0='urn:local' SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'><return xsi:type='xsd:string'>", '', $reponseXML);
|
||
$reponseXML = str_replace('</return></ns0:getProduitsWebServicesXMLResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>','', $reponseXML);
|
||
return $reponseXML;
|
||
|
||
}
|
||
|
||
/**
|
||
* Format la chaine xml de liste des actes
|
||
* @param string $xml
|
||
* @return array
|
||
*/
|
||
function infogreffe_parsexml_actes($xml)
|
||
{
|
||
global $firephp;
|
||
$doc = new DOMDocument();
|
||
$doc->loadXML($xml);
|
||
|
||
$liste_depot_acte = $doc->getElementsByTagName('liste_depot_acte')->item(0);
|
||
$depot_actes = $liste_depot_acte->getElementsByTagName('depot_acte');
|
||
$actes = array();
|
||
foreach($depot_actes as $depot_acte)
|
||
{
|
||
$acte = array();
|
||
|
||
$acte['num_gest'] = array();
|
||
$num_gest = $depot_acte->getElementsByTagName('num_gest')->item(0);
|
||
$acte['num_gest']['greffe'] = $num_gest->getElementsByTagName('greffe')->item(0)->nodeValue;
|
||
$acte['num_gest']['dossier_millesime'] = $num_gest->getElementsByTagName('dossier_millesime')->item(0)->nodeValue;
|
||
$acte['num_gest']['dossier_statut'] = $num_gest->getElementsByTagName('dossier_statut')->item(0)->nodeValue;
|
||
$acte['num_gest']['dossier_chrono'] = $num_gest->getElementsByTagName('dossier_chrono')->item(0)->nodeValue;
|
||
|
||
$acte['num_siren'] = $depot_acte->getElementsByTagName('num_siren')->item(0)->nodeValue;
|
||
$acte['num_depot'] = $depot_acte->getElementsByTagName('num_depot')->item(0)->nodeValue;
|
||
$acte['date_depot'] = $depot_acte->getElementsByTagName('date_depot')->item(0)->nodeValue;
|
||
|
||
$infoActes = $depot_acte->getElementsByTagName('acte');
|
||
$acte['depot'] = array();
|
||
foreach($infoActes as $infoActe)
|
||
{
|
||
$actenum = array();
|
||
$actenum['date_acte'] = $infoActe->getElementsByTagName('date_acte')->item(0)->nodeValue;
|
||
$actenum['num_acte'] = $infoActe->getElementsByTagName('num_acte')->item(0)->nodeValue;
|
||
$actenum['type_acte'] = $infoActe->getElementsByTagName('type_acte')->item(0)->nodeValue;
|
||
$actenum['type_acte_libelle'] = $infoActe->getElementsByTagName('type_acte_libelle')->item(0)->nodeValue;
|
||
$actenum['nbpages_acte'] = $infoActe->getElementsByTagName('nbpages_acte')->item(0)->nodeValue;
|
||
$decision = $infoActe->getElementsByTagName('decision')->item(0);
|
||
if($decision)
|
||
{
|
||
$actenum['decision'] = array();
|
||
$actenum['decision']['nature'] = $decision->getElementsByTagName('nature')->item(0)->nodeValue;
|
||
$actenum['decision']['libelle'] = $decision->getElementsByTagName('libelle')->item(0)->nodeValue;
|
||
}
|
||
|
||
$actenum['mode_diffusion'] = array();
|
||
$mode_diffusion = $infoActe->getElementsByTagName('mode_diffusion')->item(0)->getElementsByTagName('mode');
|
||
foreach($mode_diffusion as $mode)
|
||
{
|
||
$actenum['mode_diffusion'][] = $mode->getAttribute('type');
|
||
}
|
||
$acte['depot'][] = $actenum;
|
||
}//Fin listes des infos acte
|
||
|
||
//Génération de l'index pour le tri
|
||
if(!empty($acte['date_depot'])){ $date = $acte['date_depot']; }
|
||
else { $date = ''; }
|
||
|
||
if(!empty($date))
|
||
{
|
||
$datef = substr($date,0,4).substr($date,5,2).substr($date,8,2);
|
||
$key = $datef.'-'.$acte['num_depot'];
|
||
//Affectation liste générale avec un index permettant le tri
|
||
$actes[$key] = $acte;
|
||
}
|
||
//Prise en compte de l'acte -1
|
||
if($acte['num_depot']==-1)
|
||
{
|
||
$actes[0] = $acte;
|
||
}
|
||
|
||
}
|
||
|
||
//Tri suivant la date d'acte ou de depot
|
||
krsort($actes);
|
||
return $actes;
|
||
}
|
||
|
||
/**
|
||
* Formate la chaine xml de commande d'un acte en mode téléchargement
|
||
* @param string $xml
|
||
* @return array
|
||
*/
|
||
function infogreffe_parsexml_actes_t($xml)
|
||
{
|
||
$doc = new DOMDocument();
|
||
$doc->loadXML($xml);
|
||
|
||
$depot_acte = $doc->getElementsByTagName('depot_acte')->item(0);
|
||
|
||
$info = array();
|
||
$info['num_gest'] = array();
|
||
|
||
$num_gest = $depot_acte->getElementsByTagName('num_gest')->item(0);
|
||
|
||
$info['num_gest']['greffe'] = $num_gest->getElementsByTagName('greffe')->item(0)->nodeValue;
|
||
$info['num_gest']['dossier_millesime'] = $num_gest->getElementsByTagName('dossier_millesime')->item(0)->nodeValue;
|
||
$info['num_gest']['dossier_statut'] = $num_gest->getElementsByTagName('dossier_statut')->item(0)->nodeValue;
|
||
$info['num_gest']['dossier_chrono'] = $num_gest->getElementsByTagName('dossier_chrono')->item(0)->nodeValue;
|
||
|
||
$info['num_siren'] = $depot_acte->getElementsByTagName('num_siren')->item(0)->nodeValue;
|
||
$info['num_depot'] = $depot_acte->getElementsByTagName('num_depot')->item(0)->nodeValue;
|
||
$info['date_depot'] = $depot_acte->getElementsByTagName('date_depot')->item(0)->nodeValue;
|
||
|
||
$infoActes = $depot_acte->getElementsByTagName('acte');
|
||
$info['actes'] = array();
|
||
foreach($infoActes as $infoActe)
|
||
{
|
||
$actenum = array();
|
||
$actenum['date_acte'] = $infoActe->getElementsByTagName('date_acte')->item(0)->nodeValue;
|
||
$actenum['num_acte'] = $infoActe->getElementsByTagName('num_acte')->item(0)->nodeValue;
|
||
$actenum['type_acte'] = $infoActe->getElementsByTagName('type_acte')->item(0)->nodeValue;
|
||
$actenum['type_acte_libelle'] = $infoActe->getElementsByTagName('type_acte_libelle')->item(0)->nodeValue;
|
||
$actenum['nbpages_acte'] = $infoActe->getElementsByTagName('nbpages_acte')->item(0)->nodeValue;
|
||
|
||
$decision = $infoActe->getElementsByTagName('decision')->item(0);
|
||
if($decision)
|
||
{
|
||
$actenum['decision'] = array();
|
||
$actenum['decision']['nature'] = $decision->getElementsByTagName('nature')->item(0)->nodeValue;
|
||
$actenum['decision']['libelle'] = $decision->getElementsByTagName('libelle')->item(0)->nodeValue;
|
||
}
|
||
$actenum['url_acces'] = htmlspecialchars_decode($infoActe->getElementsByTagName('url_acces')->item(0)->nodeValue);
|
||
$info['actes'][] = $actenum;
|
||
}
|
||
return $info;
|
||
}
|
||
|
||
/**
|
||
* Formatte la chaine xml de liste des bilans
|
||
* @param unknown_type $xml
|
||
* @return unknown_type
|
||
*/
|
||
function infogreffe_parsexml_bilans($xml)
|
||
{
|
||
$doc = new DOMDocument();
|
||
$doc->loadXML($xml);
|
||
|
||
$liste_bilan_complet = $doc->getElementsByTagName('liste_bilan_complet')->item(0);
|
||
$bilan_complet = $liste_bilan_complet->getElementsByTagName('bilan_complet');
|
||
|
||
$bilans = array();
|
||
foreach($bilan_complet as $element)
|
||
{
|
||
$bilan = array();
|
||
|
||
$bilan['num_gest'] = array();
|
||
$num_gest = $element->getElementsByTagName('num_gest')->item(0);
|
||
$bilan['num_gest']['greffe'] = $num_gest->getElementsByTagName('greffe')->item(0)->nodeValue;
|
||
$bilan['num_gest']['dossier_millesime'] = $num_gest->getElementsByTagName('dossier_millesime')->item(0)->nodeValue;
|
||
$bilan['num_gest']['dossier_statut'] = $num_gest->getElementsByTagName('dossier_statut')->item(0)->nodeValue;
|
||
$bilan['num_gest']['dossier_chrono'] = $num_gest->getElementsByTagName('dossier_chrono')->item(0)->nodeValue;
|
||
|
||
$bilan['num_siren'] = $element->getElementsByTagName('num_siren')->item(0)->nodeValue;
|
||
$bilan['date_cloture'] = $element->getElementsByTagName('date_cloture')->item(0)->nodeValue;
|
||
$bilan['date_cloture_iso'] = $element->getElementsByTagName('date_cloture_iso')->item(0)->nodeValue;
|
||
$bilan['millesime'] = $element->getElementsByTagName('millesime')->item(0)->nodeValue;
|
||
$bilan['num_depot'] = $element->getElementsByTagName('num_depot')->item(0)->nodeValue;
|
||
$bilan['type_comptes'] = $element->getElementsByTagName('type_comptes')->item(0)->nodeValue;
|
||
|
||
$mode_diffusion = $element->getElementsByTagName('mode_diffusion')->item(0)->getElementsByTagName('mode');
|
||
foreach($mode_diffusion as $mode)
|
||
{
|
||
$bilan['mode_diffusion'][] = $mode->getAttribute('type');
|
||
}
|
||
|
||
//Génération de l'index pour le tri
|
||
$date = $bilan['date_cloture_iso'];
|
||
if(!empty($date))
|
||
{
|
||
$datef = substr($date,0,4).substr($date,5,2).substr($date,8,2);
|
||
//Affectation liste générale avec un index permettant le tri
|
||
$bilans[$datef] = $bilan;
|
||
}
|
||
}
|
||
krsort($bilans);
|
||
return $bilans;
|
||
}
|
||
|
||
function infogreffe_parsexml_bilans_t($xml)
|
||
{
|
||
global $firephp;
|
||
$doc = new DOMDocument();
|
||
$doc->loadXML($xml);
|
||
$bilan_complet = $doc->getElementsByTagName('bilan_complet')->item(0);
|
||
$bilan = array();
|
||
$bilan['num_gest'] = array();
|
||
$num_gest = $bilan_complet->getElementsByTagName('num_gest')->item(0);
|
||
$bilan['num_gest']['greffe'] = $num_gest->getElementsByTagName('greffe')->item(0)->nodeValue;
|
||
$bilan['num_gest']['dossier_millesime'] = $num_gest->getElementsByTagName('dossier_millesime')->item(0)->nodeValue;
|
||
$bilan['num_gest']['dossier_statut'] = $num_gest->getElementsByTagName('dossier_statut')->item(0)->nodeValue;
|
||
$bilan['num_gest']['dossier_chrono'] = $num_gest->getElementsByTagName('dossier_chrono')->item(0)->nodeValue;
|
||
$bilan['num_siren'] = $bilan_complet->getElementsByTagName('num_siren')->item(0)->nodeValue;
|
||
$bilan['date_cloture'] = $bilan_complet->getElementsByTagName('date_cloture')->item(0)->nodeValue;
|
||
$bilan['date_cloture_iso'] = $bilan_complet->getElementsByTagName('date_cloture_iso')->item(0)->nodeValue;
|
||
$bilan['millesime'] = $bilan_complet->getElementsByTagName('millesime')->item(0)->nodeValue;
|
||
$bilan['num_depot'] = $bilan_complet->getElementsByTagName('num_depot')->item(0)->nodeValue;
|
||
$bilan['type_comptes'] = $bilan_complet->getElementsByTagName('type_comptes')->item(0)->nodeValue;
|
||
$bilan['url_acces'] = $bilan_complet->getElementsByTagName('url_acces')->item(0)->nodeValue;
|
||
return array( 'bilan' => $bilan );
|
||
}
|
||
|
||
function infogreffe_parsexml_bilans_c(){}
|
||
|
||
/**
|
||
* Formatte le tableau complet des actes pour envoyer seulement les informations nécessaires
|
||
* @param $actes
|
||
* @return unknown_type
|
||
*/
|
||
function infogreffe_format_actes($actes)
|
||
{
|
||
global $firephp;
|
||
$tabActes = array();
|
||
//Pour chaque depot
|
||
foreach($actes as $key => $depot)
|
||
{
|
||
//Pour chaque acte dans le depot
|
||
foreach($depot['depot'] as $acte)
|
||
{
|
||
//Recherche du fichier suivant le siren, le type de document et la reference
|
||
$file_exist = false;
|
||
$ref = infogreffe_acte_ref($acte, $depot);
|
||
if (strlen($depot['num_siren'])==8){
|
||
$siren = '0'.$depot['num_siren'];
|
||
} else {
|
||
$siren = $depot['num_siren'];
|
||
}
|
||
$fichier = PATH_DATA.'/pdf/'.infogreffe_acte_filename($siren,$ref);
|
||
if( file_exists($fichier) && filesize($fichier)>0 )
|
||
{
|
||
$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']); }
|
||
else { $date = WDate::dateT('Y-m-d', 'Ymd', $depot['date_depot']); }
|
||
|
||
//Suppression du mode courrier si le mode telechargement existe
|
||
$modes = $acte['mode_diffusion'];
|
||
if(is_array($modes) && !$file_exist)
|
||
{
|
||
//Pas de modes
|
||
$nomode = true;
|
||
if(in_array('T',$modes))
|
||
{
|
||
$mode = 'T';
|
||
//Reference multiacte
|
||
$ref_multi = infogreffe_acte_ref($acte, $depot, true);
|
||
$tabActe['ref_multi'] = $ref_multi;
|
||
$nomode = false;
|
||
}
|
||
elseif(in_array('C',$modes))
|
||
{
|
||
$mode = 'C';
|
||
//Reference identique
|
||
$nomode = false;
|
||
}
|
||
if($nomode && ( substr($date,0,4)>date('Y')-5 || hasModeEdition() ) )
|
||
{
|
||
$mode = 'courrier';
|
||
}
|
||
}
|
||
|
||
//Assignation
|
||
$tabActe['num_acte'] = $acte['num_acte'];
|
||
$tabActe['nbpages_acte'] = $acte['nbpages_acte'];
|
||
$tabActe['type'] = $acte['type_acte'];
|
||
$tabActe['type_lib'] = $acte['type_acte_libelle'];
|
||
$tabActe['decision'] = $acte['decision']['libelle'];
|
||
$tabActe['date_acte'] = ($date!='') ? WDate::dateT('Ymd', 'd/m/Y', $date) : '';
|
||
$tabActe['mode'] = $mode;
|
||
$tabActe['ref'] = $ref;
|
||
|
||
$tabActes[$key]['actes'][] = $tabActe;
|
||
}
|
||
|
||
$tabActes[$key]['num_depot'] = $depot['num_depot'];
|
||
$tabActes[$key]['date_depot'] = WDate::dateT('Y-m-d', 'd/m/Y', $depot['date_depot']);
|
||
|
||
}
|
||
return $tabActes;
|
||
}
|
||
|
||
function infogreffe_format_actes_t($actes)
|
||
{
|
||
$tabActes = array();
|
||
$tabActe = array();
|
||
foreach($actes['actes'] as $acte)
|
||
{
|
||
//Génération date (date_acte peut être vide)
|
||
if(!empty($acte['date_acte'])){ $date = WDate::dateT('Y-m-d', 'Ymd', $acte['date_acte']); }
|
||
else { $date = WDate::dateT('Y-m-d', 'Ymd', $actes['date_depot']); }
|
||
|
||
$tabActe = '';
|
||
|
||
$tabActe['type_acte'] = $acte['type_acte'];
|
||
$tabActe['type_acte_libelle'] = $acte['type_acte_libelle'];
|
||
$tabActe['decision'] = $acte['decision'];
|
||
$tabActe['date_acte'] = $date;
|
||
$tabActe['num_acte'] = $acte['num_acte'];
|
||
$tabActe['url_acces'] = $acte['url_acces'];
|
||
|
||
$tabActes['actes'][] = $tabActe;
|
||
}
|
||
|
||
$tabActes['num_gest'] = $actes['num_gest'];
|
||
$tabActes['num_siren'] = $actes['num_siren'];
|
||
$tabActes['num_depot'] = $actes['num_depot'];
|
||
$tabActes['date_depot'] = $actes['date_depot'];
|
||
return $tabActes;
|
||
}
|
||
|
||
/**
|
||
*
|
||
* @param unknown_type $bilans
|
||
* @return unknown_type
|
||
*/
|
||
function infogreffe_format_bilans($bilans)
|
||
{
|
||
global $firephp;
|
||
//Organisation du tableau des bilans
|
||
$tabBilans = array();
|
||
foreach($bilans as $key => $bilan)
|
||
{
|
||
$mode = '';
|
||
$nomode = true;
|
||
//Recherche du fichier suivant le siren, le type de document et la reference
|
||
$file_exist = false;
|
||
$ref = infogreffe_bilan_ref($bilan);
|
||
if (strlen($bilan['num_siren'])==8){
|
||
$siren = '0'.$bilan['num_siren'];
|
||
} else {
|
||
$siren = $bilan['num_siren'];
|
||
}
|
||
|
||
//Cas de fichier correspondant à la référence
|
||
$fichier = PATH_DATA.'/pdf/'.infogreffe_bilan_filename($siren,$ref);
|
||
if( file_exists($fichier) && filesize($fichier)>0 )
|
||
{
|
||
$mode = 'fichier';
|
||
$file_exist = true;
|
||
$nomode = false;
|
||
}
|
||
|
||
//Cas de fichier ne correspondant pas à la référence (_sociaux ou pas)
|
||
//Si AAAA_sociaux- alors on cherche sans
|
||
if (preg_match('/^[0-9]{4}_sociaux-/', $ref)){
|
||
$refR = str_replace('_sociaux-', '_-', $ref);
|
||
$fichier = PATH_DATA.'/pdf/'.infogreffe_bilan_filename($siren,$refR);
|
||
if( file_exists($fichier) && filesize($fichier)>0 )
|
||
{
|
||
$mode = 'fichier';
|
||
$file_exist = true;
|
||
$nomode = false;
|
||
$ref = $refR;
|
||
}
|
||
//Si AAAA_- alors on cherche avec
|
||
} elseif (preg_match('/^[0-9]{4}_-/', $ref)){
|
||
$refR = str_replace('_-', '_sociaux-', $ref);
|
||
$fichier = PATH_DATA.'/pdf/'.infogreffe_bilan_filename($siren,$refR);
|
||
if( file_exists($fichier) && filesize($fichier)>0 )
|
||
{
|
||
$mode = 'fichier';
|
||
$file_exist = true;
|
||
$nomode = false;
|
||
$ref = $refR;
|
||
}
|
||
}
|
||
|
||
//Cas de fichier en acte (a faire disparaitre)
|
||
$fichier = PATH_DATA.'/pdf/acte-'.$siren.'-'.$ref.'.pdf';
|
||
if( file_exists($fichier) && filesize($fichier)>0 )
|
||
{
|
||
$mode = 'fichier';
|
||
$file_exist = true;
|
||
$nomode = false;
|
||
}
|
||
//Suppression du mode courrier si le mode telechargement existe
|
||
$modes = $bilan['mode_diffusion'];
|
||
|
||
if(is_array($modes) && !empty($modes) && !$file_exist )
|
||
{
|
||
if(in_array('T',$modes)) { $mode = 'T'; $nomode = false;}
|
||
elseif(in_array('C',$modes)){ $mode = 'C'; $nomode = false;}
|
||
}
|
||
if($nomode && ( substr($bilan['date_cloture'],6,4)>date('Y')-5 || hasModeEdition() ) )
|
||
{
|
||
$mode = 'courrier';
|
||
}
|
||
//Valeurs de retour
|
||
$tabBilans[$key]['millesime'] = $bilan['millesime'];
|
||
$tabBilans[$key]['date_cloture'] = $bilan['date_cloture'];
|
||
$tabBilans[$key]['type'] = $bilan['type_comptes'];
|
||
$tabBilans[$key]['num_depot'] = $bilan['num_depot'];
|
||
$tabBilans[$key]['mode'] = $mode;
|
||
$tabBilans[$key]['ref'] = $ref;
|
||
}
|
||
return $tabBilans;
|
||
}
|
||
|
||
/**
|
||
* Liste tous les actes pour un siren et gere les commandes
|
||
* @param string $siren
|
||
* @param string $typeCommande
|
||
* @param string $ref
|
||
* @return array
|
||
*/
|
||
function getGreffeActes($siren, $typeCommande = '', $ref = '', $idCommande = 0)
|
||
{
|
||
global $firephp;
|
||
$inErreur = false;
|
||
$error = '';
|
||
$result = array();
|
||
|
||
if(empty($typeCommande)) $typeCommande = 'XL';
|
||
$type = 'AC'; // Type actes
|
||
|
||
if($typeCommande=='XL')
|
||
{
|
||
$fichier = INFOGREFFE_PATH.$type.'-'.$siren.'.xml';
|
||
if (file_exists($fichier)){
|
||
$xmlReponse = file_get_contents($fichier);
|
||
if (infogreffe_erreur($xmlReponse)){
|
||
$inErreur = true;
|
||
}
|
||
}
|
||
if (!file_exists($fichier) || infogreffe_filetimeover($fichier) || $inErreur){
|
||
$xmlRequete = infogreffe_requetexml($siren, $idCommande, $type, $typeCommande, $ref);
|
||
$xmlReponse = infogreffe_getproduitsxml($xmlRequete);
|
||
file_put_contents($fichier, $xmlReponse);
|
||
}
|
||
if(!infogreffe_erreur($xmlReponse))
|
||
{
|
||
//Tableau d'actes
|
||
$actes = infogreffe_parsexml_actes($xmlReponse);
|
||
$result = infogreffe_format_actes($actes);
|
||
}
|
||
}
|
||
//Commande d'un acte en mode téléchargement
|
||
elseif($typeCommande=='T')
|
||
{
|
||
$option = explode('-', $ref);
|
||
$num_actes = explode('|', $ref[7]);
|
||
if(is_array($num_actes) && count($num_actes)>1){
|
||
$fichierOption = $ref[0].'-'.$ref[1].'-'.$ref[2].'-'.
|
||
$ref[3].'-'.$ref[4].'-'.$ref[5].'-'.$ref[6];
|
||
}else{
|
||
$fichierOption = $ref;
|
||
}
|
||
$fichier = INFOGREFFE_PATH.$type.'-'.$siren.'-'.$fichierOption.'.xml';
|
||
if( !file_exists($fichier) || infogreffe_filetimeover($fichier) ){
|
||
$firephp->info('Mode telechargement');
|
||
$xmlRequete = infogreffe_requetexml($siren, $idCommande, $type, $typeCommande, $ref);
|
||
$xmlReponse = infogreffe_getproduitsxml($xmlRequete);
|
||
file_put_contents($fichier, $xmlReponse);
|
||
}else{
|
||
$xmlReponse = file_get_contents($fichier);
|
||
}
|
||
if(!infogreffe_erreur($xmlReponse))
|
||
{
|
||
$items = infogreffe_parsexml_actes_t($xmlReponse);
|
||
$items = infogreffe_format_actes_t($items);
|
||
//Pour chaque acte téléchagement des documents
|
||
$result = array();
|
||
$actes = $items['actes'];
|
||
unset($items['actes']);
|
||
$result = $depot = $items;
|
||
|
||
$num_gest =
|
||
$result['num_gest']['greffe'].'-'.
|
||
$result['num_gest']['dossier_millesime'].'-'.
|
||
$result['num_gest']['dossier_statut'].'-'.
|
||
$result['num_gest']['dossier_chrono'].'-'.
|
||
$result['num_depot'];
|
||
|
||
foreach($actes as $acte)
|
||
{
|
||
if(!empty($acte['date_acte'])){ $date = $acte['date_acte']; }
|
||
else { $date = WDate::dateT('Y-m-d', 'Ymd', $result['date_depot']); }
|
||
|
||
$ref = $acte['type_acte'].'-'.$date.'-'.$num_gest.'-'.$acte['num_acte'];
|
||
|
||
$fichier = infogreffe_acte_filename($siren, $ref);
|
||
|
||
//Si le fichier existe, on modifie l'url
|
||
if( file_exists(PATH_DATA.'/pdf/'.$fichier) ){
|
||
$acte['url_access'] = $fichier;
|
||
}else{
|
||
$fichierdl = infogreffe_dl($fichier, $acte['url_acces']);
|
||
$acte['url_acces'] = $fichierdl;
|
||
}
|
||
$result['actes'][] = $acte;
|
||
}
|
||
}
|
||
}
|
||
//Commande d'un acte en mode courrier
|
||
elseif($typeCommande=='C')
|
||
{
|
||
//On génére un idCommande suivant la valeur en bdd
|
||
$xmlRequete = infogreffe_requetexml($siren, $idCommande, $type, $typeCommande, $ref);
|
||
$xmlReponse = infogreffe_getproduitsxml($xmlRequete);
|
||
}
|
||
//Default mode erreur
|
||
else
|
||
{
|
||
//Paramètres incorrect
|
||
sendMail(
|
||
"Erreur : getGreffeActes",
|
||
"getGreffeActes($siren, $typeCommande , $ref, $idCommande )",
|
||
array('email' => EMAIL_SUPPORTDEV, 'name' => 'Support'),
|
||
array('email' => EMAIL_SUPPORTDEV, 'name' => 'Support')
|
||
);
|
||
}
|
||
//Gestion du retour infogreffe
|
||
if(infogreffe_erreur($xmlReponse))
|
||
{
|
||
$error = infogreffe_erreur_msg($xmlReponse);
|
||
}
|
||
return array('error' => $error , 'result' => $result );
|
||
}
|
||
|
||
/**
|
||
* Retourne si le fichier est périmé ou non
|
||
* @param string $fichier
|
||
* @return boolean
|
||
*/
|
||
function infogreffe_filetimeover($fichier)
|
||
{
|
||
$timeover = false;
|
||
$dateFile = filemtime($fichier);
|
||
$now = mktime(date('G'), date('i'), date('s'), date('m') , date('d'), date('Y'));
|
||
$maxTime = mktime(date('G',$dateFile)+INFOGREFFE_FILETIME, date('i',$dateFile), date('s',$dateFile), date("m",$dateFile), date("d",$dateFile), date("Y",$dateFile));
|
||
if($now>$maxTime) $timeover = true;
|
||
return $timeover;
|
||
}
|
||
|
||
/**
|
||
* Détermine si la chaine xml de retour est un message d'information ou d'erreur
|
||
* @param string $xml
|
||
* @return boolean
|
||
*/
|
||
function infogreffe_erreur($xml)
|
||
{
|
||
if (!empty($xml)){
|
||
$doc = new DOMDocument();
|
||
$load = $doc->loadXML($xml, LIBXML_NOERROR | LIBXML_NOWARNING);
|
||
$output = false;
|
||
if (!$load){ $output = true;}
|
||
}else{
|
||
sendMail(
|
||
"Erreur : infogreffe_erreur",
|
||
"Pas de reponse xml infogreffe",
|
||
array('email' => EMAIL_SUPPORTDEV, 'name' => 'Support'),
|
||
array('email' => EMAIL_SUPPORTDEV, 'name' => 'Support')
|
||
);
|
||
$output = true;
|
||
}
|
||
return $output;
|
||
}
|
||
|
||
/**
|
||
* Renvoi le code erreur infogreffe ainsi que le message
|
||
* @param string $xml
|
||
* @return boolean
|
||
*/
|
||
function infogreffe_erreur_msg($xml)
|
||
{
|
||
$errNum = '';
|
||
$errMsg = '';
|
||
if (!empty($xml)){
|
||
global $tabErrInfoGref;
|
||
$doc = new DOMDocument();
|
||
$load = $doc->loadXML($xml, LIBXML_NOERROR | LIBXML_NOWARNING);
|
||
FB::log($load, 'erreur_msg');
|
||
if (!$load) {
|
||
FB::info('Test erreur infogreffe');
|
||
$tmp = explode('-', $xml);
|
||
$errNum = $tmp[0]*1;
|
||
$errMsg = $tabErrInfoGref[$errNum];
|
||
if ($errNum == '23'){
|
||
$fj = $_SESSION['tabInfo']['entrep']['fj'];
|
||
$nafEn = $_SESSION['tabInfo']['entrep']['nafEn'];
|
||
if ( (substr($fj,0,2)=='53' ||
|
||
substr($fj,0,2)=='54' ||
|
||
substr($fj,0,2)=='55' ||
|
||
substr($fj,0,2)=='56' ||
|
||
substr($fj,0,2)=='57' ) && $fj!=5306 && $fj!=5307 &&
|
||
( $nafEn!='6411Z' ||
|
||
$nafEn!='6419Z' ||
|
||
$nafEn!='6621Z' ||
|
||
$nafEn!='6622Z' ||
|
||
$nafEn!='6629Z' ||
|
||
$nafEn!='6512Z' ||
|
||
$nafEn!='6520Z' ||
|
||
$nafEn!='6530Z' ||
|
||
$nafEn!='6512Z' ||
|
||
$nafEn!='8430A' ||
|
||
$nafEn!='8430B' ||
|
||
$nafEn!='6420Z' ||
|
||
$nafEn!='6430Z' ||
|
||
$nafEn!='6611Z' ||
|
||
$nafEn!='8430B' ||
|
||
$nafEn!='6612Z' ||
|
||
$nafEn!='6630Z') ){
|
||
$errMsg = 'Aucun bilan disponible.';
|
||
}
|
||
} elseif( $errNum == '5' ){
|
||
$errMsg = 'Service partenaire indisponible.';
|
||
}
|
||
}
|
||
}
|
||
return array( 'errNum' => $errNum , 'errMsg' => $errMsg );
|
||
}
|
||
|
||
/**
|
||
* Demande le dernier statut à jour auprès d'infogreffe seulement si disponible pour le siren
|
||
* Acte possédant un num_depot = 9999999999
|
||
* @param $siren
|
||
* @param $typeCommande
|
||
* @return unknown_type
|
||
*/
|
||
function getGreffeStatut($siren, $typeCommande = '', $ref = '', $idCommande = 0)
|
||
{
|
||
$type = 'ST'; //Type document statut
|
||
$xmlRequete = infogreffe_requetexml($siren, $idCommande, $type, $typeCommande, $ref);
|
||
$xmlReponse = infogreffe_getproduitsxml($xmlRequete);
|
||
//Gestion du retour infogreffe
|
||
if(infogreffe_erreur($xmlReponse))
|
||
{
|
||
$error = infogreffe_erreur_msg($xmlReponse);
|
||
}
|
||
return array('error' => $error , 'result' => $result );
|
||
}
|
||
|
||
/**
|
||
* Liste tous les bilans et gere les commandes
|
||
* @param unknown_type $siren
|
||
* @param unknown_type $typeCommande
|
||
* @param unknown_type $ref
|
||
* @return unknown_type
|
||
*/
|
||
function getGreffeBilans($siren, $typeCommande = '', $ref = '', $idCommande = 0)
|
||
{
|
||
$inErreur = false;
|
||
$error = '';
|
||
$result = '';
|
||
|
||
if(empty($typeCommande)) $typeCommande = 'XL';
|
||
$type = 'BI';
|
||
if($typeCommande=='XL')
|
||
{
|
||
$fichier = INFOGREFFE_PATH.$type.'-'.$siren.'.xml';
|
||
if (file_exists($fichier)){
|
||
$xmlReponse = file_get_contents($fichier);
|
||
if (infogreffe_erreur($xmlReponse)){
|
||
$inErreur = true;
|
||
}
|
||
}
|
||
if (!file_exists($fichier) || infogreffe_filetimeover($fichier) || $inErreur){
|
||
$xmlRequete = infogreffe_requetexml($siren, $idCommande, $type, $typeCommande, $ref);
|
||
$xmlReponse = infogreffe_getproduitsxml($xmlRequete);
|
||
file_put_contents($fichier, $xmlReponse);
|
||
}
|
||
if(!infogreffe_erreur($xmlReponse)){
|
||
$bilans = infogreffe_parsexml_bilans($xmlReponse);
|
||
$result = infogreffe_format_bilans($bilans);
|
||
}
|
||
}
|
||
//Commande d'un acte en mode téléchargement
|
||
elseif($typeCommande=='T')
|
||
{
|
||
$xmlRequete = infogreffe_requetexml($siren, $idCommande, $type, $typeCommande, $ref);
|
||
$xmlReponse = infogreffe_getproduitsxml($xmlRequete);
|
||
if(!infogreffe_erreur($xmlReponse))
|
||
{
|
||
$items = infogreffe_parsexml_bilans_t($xmlReponse);
|
||
$result = array();
|
||
$bilan = $items['bilan'];
|
||
$fichier = infogreffe_bilan_filename($siren, $ref);
|
||
$fichierdl = infogreffe_dl($fichier, $bilan['url_acces']);
|
||
$bilan['url_acces'] = $fichierdl;
|
||
$result['bilan'][] = $bilan;
|
||
}
|
||
}
|
||
//Commande d'un acte en mode courrier
|
||
elseif($typeCommande=='C')
|
||
{
|
||
//On génére un idCommande suivant la valeur en bdd
|
||
$xmlRequete = infogreffe_requetexml($siren, $idCommande, $type, $typeCommande, $ref);
|
||
$xmlReponse = infogreffe_getproduitsxml($xmlRequete);
|
||
}
|
||
//Default mode erreur
|
||
else
|
||
{
|
||
//Paramètres incorrect
|
||
sendMail(
|
||
"Erreur : getGreffeBilans",
|
||
"getGreffeBilans($siren, $typeCommande, $ref, $idCommande )",
|
||
array('email' => EMAIL_SUPPORTDEV, 'name' => 'Support'),
|
||
array('email' => EMAIL_SUPPORTDEV, 'name' => 'Support')
|
||
);
|
||
}
|
||
//Gestion du retour infogreffe
|
||
if(infogreffe_erreur($xmlReponse))
|
||
{
|
||
$error = infogreffe_erreur_msg($xmlReponse);
|
||
}
|
||
//Si résultat vide, renvoyé erreur Aucun bilans disponible
|
||
if (is_array($result) && empty($result)){
|
||
$error = array(
|
||
'errNum' => '45' ,
|
||
'errMsg' => 'AUCUN BILAN TROUVE POUR CE SIREN' );
|
||
}
|
||
return array( 'error' => $error , 'result' => $result );
|
||
}
|
||
|
||
|
||
function infogreffe_acte_ref($acte, $depot, $multi = false)
|
||
{
|
||
global $firephp;
|
||
if($depot['num_depot']>0)
|
||
{
|
||
//Numéro de gestion
|
||
$num_gest =
|
||
$depot['num_gest']['greffe'].'-'.
|
||
$depot['num_gest']['dossier_millesime'].'-'.
|
||
$depot['num_gest']['dossier_statut'].'-'.
|
||
$depot['num_gest']['dossier_chrono'].'-'.
|
||
$depot['num_depot'];
|
||
|
||
if($multi===true)
|
||
{
|
||
//Générer la ref multiactes pour le mode téléchargement
|
||
$tabActeNum = array();
|
||
foreach($depot['depot'] as $acte)
|
||
{
|
||
if(in_array('T', $acte['mode_diffusion']))
|
||
{
|
||
$tabActeNum[] = $acte['num_acte'];
|
||
}
|
||
}
|
||
$num_acte = implode('|', $tabActeNum);
|
||
}
|
||
else
|
||
{
|
||
$num_acte = $acte['num_acte'];
|
||
}
|
||
|
||
//Génération date (date_acte peut être vide)
|
||
if(!empty($acte['date_acte'])){ $date = WDate::dateT('Y-m-d', 'Ymd', $acte['date_acte']); }
|
||
else { $date = WDate::dateT('Y-m-d', 'Ymd', $depot['date_depot']); }
|
||
return $acte['type_acte'].'-'.$date.'-'.$num_gest.'-'.$num_acte;
|
||
}
|
||
else
|
||
{
|
||
//Dernier STATUT A JOUR
|
||
$dateRef = date('Y').date('m').date('d');
|
||
return 'ST-'.$dateRef.'-'.
|
||
$depot['num_gest']['greffe'].'-'.
|
||
$depot['num_gest']['dossier_millesime'].'-'.
|
||
$depot['num_gest']['dossier_statut'].'-'.
|
||
$depot['num_gest']['dossier_chrono'];
|
||
}
|
||
}
|
||
|
||
function infogreffe_acte_filename($siren, $ref)
|
||
{
|
||
return 'acte-'.$siren.'-'.$ref.'.pdf';
|
||
}
|
||
|
||
function infogreffe_bilan_ref($bilan)
|
||
{
|
||
$ref =
|
||
$bilan['millesime'].'_'.
|
||
$bilan['type_comptes'].'-'.
|
||
WDate::dateT('Y-m-d', 'Ymd', $bilan['date_cloture_iso']).'-'.
|
||
$bilan['num_gest']['greffe'].'-'.
|
||
$bilan['num_gest']['dossier_millesime'].'-'.
|
||
$bilan['num_gest']['dossier_statut'].'-'.
|
||
$bilan['num_gest']['dossier_chrono'].'-'.
|
||
$bilan['num_depot'];
|
||
return $ref;
|
||
}
|
||
|
||
function infogreffe_bilan_filename($siren, $ref)
|
||
{
|
||
return 'bilan-'.$siren.'-'.$ref.'.pdf';
|
||
}
|
||
|
||
/**
|
||
* Télécharge les fichiers d'infogreffe, et renvoi le nom du fichier ou false
|
||
* @param string $fichier
|
||
* @param string $url
|
||
* @return string or false
|
||
*/
|
||
function infogreffe_dl($fichier, $url)
|
||
{
|
||
global $firephp;
|
||
$return = false;
|
||
$path = PATH_DATA.'/pdf/';
|
||
if(!file_exists($path.$fichier) || !filesize($path.$fichier)>2000)
|
||
{
|
||
$page = getUrl($url, '', '', '', false, '', '',0,1);
|
||
if (substr($page['body'],0,4)!='%PDF')
|
||
{
|
||
$page2=parse_response($page['body']);
|
||
$body=$page2['body'];
|
||
} else {
|
||
$body=$page['body'];
|
||
}
|
||
if( ($page['code']!=408 || $page['code']!=400) && substr($body,0,4)=='%PDF')
|
||
{
|
||
//Ecriture du fichier sur le serveur en local
|
||
file_put_contents(PATH_DATA.'/pdf/'.$fichier, $body);
|
||
$return = $fichier;
|
||
}
|
||
}else{
|
||
$return = $fichier;
|
||
}
|
||
return $return;
|
||
}
|
||
|
||
function infogreffe_logfile($info){
|
||
$file = PATH_DATA.'/log/infogreffe.log';
|
||
if( !file_exists($file) ){
|
||
$entetes = array('siren', 'idCommande', 'type', 'vecteur', 'option');
|
||
$fp = fopen($file, 'w');
|
||
fputcsv($fp, $entetes);
|
||
fclose($fp);
|
||
}
|
||
$fp = fopen($file, 'a');
|
||
fputcsv($fp, $info);
|
||
fclose($fp);
|
||
}
|
||
|
||
|