Nouvelles méthodes de requête infogreffe
This commit is contained in:
parent
7445c110db
commit
227f8bd8e3
554
includes/infogreffe/infogreffews.php
Normal file
554
includes/infogreffe/infogreffews.php
Normal file
@ -0,0 +1,554 @@
|
||||
<?php
|
||||
|
||||
/** INFOGREFFE **/
|
||||
//define ('INFOGREFFE_WS_URL', 'https://webservices.infogreffe.fr/WSContextInfogreffe/INFOGREFFE');
|
||||
//define ('INFOGREFFE_WS_URI', 'https://webservices.infogreffe.fr/');
|
||||
define('INFOGREFFE_WS_URL', 'https://wsrcte.extelia.fr/WSContextInfogreffe/INFOGREFFE');
|
||||
define('INFOGREFFE_WS_URI', 'https://wsrcte.extelia.fr/');
|
||||
define('INFOGREFFE_WS_USER', '85000109');
|
||||
define('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 unknown_type $siren
|
||||
* @param unknown_type $idCommande
|
||||
* @param unknown_type $type
|
||||
* @param unknown_type $vecteur
|
||||
* @param unknown_type $option
|
||||
* @return unknown_type
|
||||
*/
|
||||
function infogreffe_requetexml($siren, $idCommande, $type, $vecteur, $option)
|
||||
{
|
||||
global $client;
|
||||
$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 => greffe
|
||||
1 => dossier_millesime
|
||||
2 => dossier_statut
|
||||
3 => dossier_chrono
|
||||
4 => num_depot
|
||||
5 => date_cloture
|
||||
*/
|
||||
$ref = explode('-', $option);
|
||||
$mil = explode('_', $ref[0]);
|
||||
|
||||
$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]));
|
||||
}
|
||||
// Commande de documents : actes
|
||||
elseif ( $type=='AC' && !empty($option) )
|
||||
{
|
||||
//Format de la variable option pour commande type AC
|
||||
/*
|
||||
0 => greffe
|
||||
1 => dossier_millesime
|
||||
2 => dossier_statut
|
||||
3 => dossier_chrono
|
||||
4 => num_depot
|
||||
5 => num_acte
|
||||
*/
|
||||
$ref = explode('-', $option);
|
||||
$commande->addChild('greffe',$ref[0]);
|
||||
$commande->addChild('dossier_millesime', $ref[1]);
|
||||
$commande->addChild('dossier_statut', $ref[2]);
|
||||
$commande->addChild('dossier_chrono', $ref[3]);
|
||||
$commande->addChild('num_depot', $ref[4]);
|
||||
$liste_actes = $commande->addChild('liste_actes');
|
||||
$liste_actes->addChild('acte')->addAttribute('num', $ref[5]);
|
||||
}
|
||||
|
||||
$xmlStr = str_replace('<?xml version="1.0"?>', '', $xml->asXML());
|
||||
//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)
|
||||
{
|
||||
|
||||
$url = 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, $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);
|
||||
|
||||
/*
|
||||
//Options pour le client soap
|
||||
$options = array(
|
||||
'location' => INFOGREFFE_WS_URL,
|
||||
'uri' => INFOGREFFE_WS_URI,
|
||||
'soap_version' => SOAP_1_1,
|
||||
'trace' => 1,
|
||||
'style' => SOAP_RPC,
|
||||
'use' => SOAP_ENCODED,
|
||||
//'encoding' => 'ISO-8859-1',
|
||||
//'features' => SOAP_SINGLE_ELEMENT_ARRAYS,
|
||||
//'features' => SOAP_SINGLE_ELEMENT_ARRAYS + SOAP_USE_XSI_ARRAY_TYPE + SOAP_WAIT_ONE_WAY_CALLS,
|
||||
);
|
||||
|
||||
try
|
||||
{
|
||||
$infogreffews = new SoapClient(null, $options);
|
||||
$result = $infogreffews->getProduitsWebServicesXML($xml);
|
||||
var_dump($result);
|
||||
$reponseXML = implode('', (array)$result);
|
||||
}
|
||||
catch (SoapFault $soapFault)
|
||||
{
|
||||
echo 'Fault :'.$soapFault;
|
||||
echo '<br/><br/>';
|
||||
echo "REQUEST HEADERS: " . htmlspecialchars($infogreffews->__getLastRequestHeaders(), ENT_NOQUOTES);
|
||||
echo '<br/><br/>';
|
||||
echo "RESPONSE HEADERS: " . htmlspecialchars($infogreffews->__getLastResponseHeaders(), ENT_NOQUOTES);
|
||||
echo '<br/><br/>';
|
||||
echo 'Request : '.$infogreffews->__getLastRequest();
|
||||
echo '<br/><br/>';
|
||||
echo 'Response : '.htmlspecialchars($infogreffews->__getLastResponse(), ENT_NOQUOTES);
|
||||
echo '<br/><br/>';;
|
||||
$reponseXML = $infogreffews->__getLastResponse();
|
||||
$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 unknown_type $xml
|
||||
* @return unknown_type
|
||||
*/
|
||||
function infogreffe_parsexml_actes($xml)
|
||||
{
|
||||
$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_chono'] = $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');
|
||||
foreach($infoActes as $infoActe)
|
||||
{
|
||||
$acte['acte'] = array();
|
||||
$acte['acte']['date_acte'] = $infoActe->getElementsByTagName('date_acte')->item(0)->nodeValue;
|
||||
$acte['acte']['num_acte'] = $infoActe->getElementsByTagName('num_acte')->item(0)->nodeValue;
|
||||
$acte['acte']['type_acte'] = $infoActe->getElementsByTagName('type_acte')->item(0)->nodeValue;
|
||||
$acte['acte']['type_acte_libelle'] = $infoActe->getElementsByTagName('type_acte_libelle')->item(0)->nodeValue;
|
||||
$acte['acte']['nbpages_acte'] = $infoActe->getElementsByTagName('nbpages_acte')->item(0)->nodeValue;
|
||||
$decision = $infoActe->getElementsByTagName('decision')->item(0);
|
||||
if($decision)
|
||||
{
|
||||
$acte['acte']['decision'] = array();
|
||||
$acte['acte']['decision']['nature'] = $decision->getElementsByTagName('nature')->item(0)->nodeValue;
|
||||
$acte['acte']['decision']['libelle'] = $decision->getElementsByTagName('libelle')->item(0)->nodeValue;
|
||||
}
|
||||
|
||||
$acte['acte']['mode_diffusion'] = array();
|
||||
$mode_diffusion = $infoActe->getElementsByTagName('mode_diffusion')->item(0)->getElementsByTagName('mode');
|
||||
foreach($mode_diffusion as $mode)
|
||||
{
|
||||
$acte['acte']['mode_diffusion'][] = $mode->getAttribute('type');
|
||||
}
|
||||
|
||||
//Génération de l'index pour le tri
|
||||
if(!empty($acte['acte']['date_acte'])){ $date = $acte['acte']['date_acte']; }
|
||||
else { $date = $acte['date_depot']; }
|
||||
|
||||
if(!empty($date) && !empty($acte['acte']['num_acte']))
|
||||
{
|
||||
$datef = substr($date,0,4).substr($date,5,2).substr($date,8,2).$acte['acte']['num_acte'];
|
||||
//Affectation liste générale avec un index permettant le tri
|
||||
$actes[$datef] = $acte;
|
||||
}
|
||||
//Prise en compte de l'acte -1
|
||||
if($acte['num_depot']==-1)
|
||||
{
|
||||
$actes['9999999999'] = $acte;
|
||||
}
|
||||
|
||||
}//Fin listes des infos 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 unknown_type $xml
|
||||
* @return unknown_type
|
||||
*/
|
||||
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_chono'] = $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;
|
||||
|
||||
$infoActe = $depot_acte->getElementsByTagName('acte');
|
||||
|
||||
$info['acte'] = array();
|
||||
$info['acte']['date_acte'] = $infoActe->getElementsByTagName('date_acte')->item(0)->nodeValue;
|
||||
$info['acte']['num_acte'] = $infoActe->getElementsByTagName('num_acte')->item(0)->nodeValue;
|
||||
$info['acte']['type_acte'] = $infoActe->getElementsByTagName('type_acte')->item(0)->nodeValue;
|
||||
$info['acte']['type_acte_libelle'] = $infoActe->getElementsByTagName('type_acte_libelle')->item(0)->nodeValue;
|
||||
$info['acte']['nbpages_acte'] = $infoActe->getElementsByTagName('nbpages_acte')->item(0)->nodeValue;
|
||||
|
||||
$decision = $infoActe->getElementsByTagName('decision')->item(0);
|
||||
if($decision)
|
||||
{
|
||||
$info['acte']['decision'] = array();
|
||||
$info['acte']['decision']['nature'] = $decision->getElementsByTagName('nature')->item(0)->nodeValue;
|
||||
$info['acte']['decision']['libelle'] = $decision->getElementsByTagName('libelle')->item(0)->nodeValue;
|
||||
}
|
||||
$info['acte']['url_acces'] = htmlspecialchars_decode($infoActe->getElementsByTagName('url_acces')->item(0)->nodeValue);
|
||||
|
||||
return $info;
|
||||
}
|
||||
|
||||
function infogreffe_parsexml_actes_c()
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 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_chono'] = $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(){}
|
||||
|
||||
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_arrange_actes($actes)
|
||||
{
|
||||
//Organisation du tableau des actes
|
||||
$tabActes = array();
|
||||
foreach($actes as $key => $acte)
|
||||
{
|
||||
if(!empty($acte['acte']['date_acte'])){ $date = $acte['acte']['date_acte']; }
|
||||
else { $date = $acte['date_depot']; }
|
||||
$type = $acte['acte']['type_acte_libelle'];
|
||||
|
||||
$decision = $acte['acte']['decision']['nature'].' '.$acte['acte']['decision']['libelle'];
|
||||
$depotNum = $acte['num_depot'];
|
||||
$depotDate = $acte['date_depot'];
|
||||
$ref =
|
||||
$acte['num_gest']['greffe'].'-'.
|
||||
$acte['num_gest']['dossier_millesime'].'-'.
|
||||
$acte['num_gest']['dossier_statut'].'-'.
|
||||
$acte['num_gest']['dossier_chono'].'-'.
|
||||
$acte['num_depot'].'-'.
|
||||
$acte['acte']['num_acte'];
|
||||
|
||||
//Recherche du fichier suivant le siren, le type de document et la reference
|
||||
|
||||
//Suppression du mode courrier si le mode telechargement existe
|
||||
$modes = $acte['acte']['mode_diffusion'];
|
||||
if(in_array('T',$modes)) { $mode = 'T'; }
|
||||
elseif(in_array('C',$modes)){ $mode = 'C'; }
|
||||
|
||||
//Valeurs de retour
|
||||
$tabActes[$key]['siren'] = $siren;
|
||||
$tabActes[$key]['type'] = $type;
|
||||
$tabActes[$key]['decision'] = $decision;
|
||||
$tabActes[$key]['num_depot'] = $depotNum;
|
||||
$tabActes[$key]['date_depot'] = $depotDate;
|
||||
$tabActes[$key]['date_acte'] = $date;
|
||||
$tabActes[$key]['mode'] = $mode;
|
||||
$tabActes[$key]['ref'] = $ref;
|
||||
}
|
||||
return $tabActes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Liste tous les actes pour un siren et gere les commandes
|
||||
* @param unknown_type $siren
|
||||
* @param unknown_type $typeCommande
|
||||
* @param unknown_type $ref
|
||||
* @return unknown_type
|
||||
*/
|
||||
function getGreffeActes($siren, $typeCommande = '', $ref = '')
|
||||
{
|
||||
$error = '';
|
||||
$result = array();
|
||||
|
||||
if(empty($typeCommande)) $typeCommande = 'XL';
|
||||
|
||||
$type = 'AC'; // Type actes
|
||||
$idCommande = 0;
|
||||
|
||||
if($typeCommande == 'XL')
|
||||
{
|
||||
$fichier = $type.'-'.$siren.'.xml';
|
||||
if(!file_exists($fichier))
|
||||
{
|
||||
$xmlRequete = infogreffe_requetexml($siren, $idCommande, $type, $vecteur, $ref);
|
||||
$xmlReponse = infogreffe_getproduitsxml($xmlRequete);
|
||||
file_put_contents($fichier, $xmlReponse);
|
||||
}
|
||||
else
|
||||
{
|
||||
$xmlReponse = file_get_contents($fichier);
|
||||
}
|
||||
if(infogreffe_erreur($xmlReponse))
|
||||
{
|
||||
$error = infogreffe_erreur_msg($xmlReponse);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Tableau d'actes
|
||||
$actes = infogreffe_parsexml_actes($xmlReponse);
|
||||
$result = infogreffe_arrange_actes($actes);
|
||||
}
|
||||
}
|
||||
//Commande d'un acte en mode téléchargement
|
||||
elseif($typeCommande=='T')
|
||||
{
|
||||
$xmlRequete = infogreffe_requetexml($siren, $idCommande, $type, $typeCommande, $ref);
|
||||
$xmlReponse = infogreffe_getproduitsxml($xmlRequete);
|
||||
$actes = infogreffe_parsexml_actes_t($xmlReponse);
|
||||
}
|
||||
//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
|
||||
}
|
||||
//Gestion du retour infogreffe
|
||||
if(infogreffe_erreur($xmlReponse))
|
||||
{
|
||||
$error = infogreffe_erreur_msg($xmlReponse);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = infogreffe_arrange_actes($actes);
|
||||
}
|
||||
return array('error' => $error , 'result' => $result );
|
||||
}
|
||||
|
||||
/**
|
||||
* Détermine si la chaine xml de retour est un message d'information ou d'erreur
|
||||
* @param $xml
|
||||
* @return unknown_type
|
||||
*/
|
||||
function infogreffe_erreur($xml)
|
||||
{
|
||||
if (strlen($xml)<200) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renvoi le code erreur infogreffe ainsi que le message
|
||||
* @param unknown_type $xml
|
||||
* @return unknown_type
|
||||
*/
|
||||
function infogreffe_erreur_msg($xml)
|
||||
{
|
||||
if (strlen($xml)<200)
|
||||
{
|
||||
$tmp = explode('-', $xml);
|
||||
$errNum = $tmp[0]*1;
|
||||
$errMsg = $tmp[1];
|
||||
}
|
||||
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)
|
||||
{
|
||||
$idCommande = 0;
|
||||
$type = 'ST'; //Type document statut
|
||||
$xmlRequete = infogreffe_requetexml($siren, $idCommande, $type, $typeCommande, $ref);
|
||||
$xmlReponse = infogreffe_getproduitsxml($xmlRequete);
|
||||
|
||||
return $xmlReponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 = '')
|
||||
{
|
||||
$error = '';
|
||||
$result = '';
|
||||
|
||||
if(empty($typeCommande)) $typeCommande = 'XL';
|
||||
$idCommande = 0;
|
||||
$type = 'BI';
|
||||
if($typeCommande=='XL')
|
||||
{
|
||||
$fichier = $type.'-'.$siren.'.xml';
|
||||
if(!file_exists($fichier))
|
||||
{
|
||||
$xmlRequete = infogreffe_requetexml($siren, $idCommande, $type, $typeCommande, $ref);
|
||||
$xmlReponse = infogreffe_getproduitsxml($xmlRequete);
|
||||
file_put_contents($fichier, $xmlReponse);
|
||||
}
|
||||
else
|
||||
{
|
||||
$xmlReponse = file_get_contents($fichier);
|
||||
}
|
||||
}
|
||||
//Gestion du retour infogreffe
|
||||
if(infogreffe_erreur($xmlReponse))
|
||||
{
|
||||
$error = infogreffe_erreur_msg($xmlReponse);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = infogreffe_parsexml_bilans($xmlReponse);
|
||||
}
|
||||
return array( 'error' => $error , 'result' => $result );
|
||||
}
|
||||
|
62
www/pages/greffes2.php
Normal file
62
www/pages/greffes2.php
Normal file
@ -0,0 +1,62 @@
|
||||
<div id="center">
|
||||
<?php
|
||||
if (!$_SESSION['connected'])
|
||||
{
|
||||
echo ('Vous devez être connecté afin de pouvoir utiliser cette fonctionnalité');
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once 'common/dates.php';
|
||||
require_once 'common/curl.php';
|
||||
require_once 'infogreffe/infogreffews.php';
|
||||
//Login de l'utilisateur
|
||||
$login = strtolower($_SESSION['tabInfo']['login']);
|
||||
//Siren
|
||||
$siren = substr($_REQUEST['siret'],0,9);
|
||||
$cj = $_SESSION['tabInfo']['entrep']['fj'];
|
||||
$dep = substr(''.$_SESSION['tabInfo']['entrep']['codeCommune'],0,2);
|
||||
//Raison sociale depuis la session
|
||||
$raisonSociale = $_SESSION['tabInfo']['entrep']['raisonSociale'];
|
||||
//TODO : Raison sociale depuis l'url (cas des associations ?)
|
||||
isset($_REQUEST['rs'])? $raisonSociale = $_REQUEST['rs'] : '';
|
||||
(isset($_REQUEST['vue']) && !empty($_REQUEST['vue'])) ? $vue = $_REQUEST['vue'] : $vue = '';
|
||||
?>
|
||||
<h1>PIÈCES OFFICIELLES</h1>
|
||||
<table>
|
||||
<tr>
|
||||
<td width="30"> </td>
|
||||
<td width="200" class="StyleInfoLib">Numéro identifiant Siren</td>
|
||||
<td width="350" class="StyleInfoData"><?=substr($siren,0,3).' '.substr($siren,3,3).' '.substr($siren,6,3)?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="30"> </td>
|
||||
<td width="200" class="StyleInfoLib">Raison Sociale</td>
|
||||
<td width="350" class="StyleInfoData"><?=$raisonSociale?></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h2>
|
||||
<?php
|
||||
if($vue=='actes')
|
||||
{
|
||||
|
||||
|
||||
|
||||
?>
|
||||
<h2>Actes & Statuts</h2>
|
||||
|
||||
<?php
|
||||
} //Fin vue actes
|
||||
elseif($vue=='bilans')
|
||||
{
|
||||
?>
|
||||
<h2>Comptes annuels</h2>
|
||||
<?php
|
||||
|
||||
|
||||
} // Fin vue bilans
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
</div>
|
Loading…
x
Reference in New Issue
Block a user