modification structure des infos, ajout bridage commandes multiples, issue #0000191
This commit is contained in:
parent
993b34bd00
commit
491fd8edd9
@ -14,23 +14,23 @@ function cmdDernierStatut($siren, $acteS)
|
||||
$q = Doctrine_Query::create()
|
||||
->from('Commandes')
|
||||
->where('siren = ?', $siren)
|
||||
->orderBy('dateCommande DESC');
|
||||
|
||||
->orderBy('dateCommande DESC');
|
||||
|
||||
$lib = 'Voir le dernier ficher dans le système.';
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
$q = Doctrine_Query::create()
|
||||
->from('Commandes')
|
||||
->where('siren = ?', $siren)
|
||||
->andWhere('login = ?', $_SESSION['tabInfo']['login'])
|
||||
->orderBy('dateCommande DESC');
|
||||
->orderBy('dateCommande DESC');
|
||||
|
||||
$lib = 'Télécharger votre dernière commande.';
|
||||
}
|
||||
$firephp->log($q->getSql(), 'SQL');
|
||||
$firephp->log($q->getParams(), 'SQL');
|
||||
$commandes = $q->execute();
|
||||
$commandes = $q->execute();
|
||||
$nbCommandes = $commandes->count();
|
||||
$firephp->log($nbCommandes, 'nbCommandes');
|
||||
if($nbCommandes>0)
|
||||
@ -40,7 +40,7 @@ function cmdDernierStatut($siren, $acteS)
|
||||
if(substr($commande->refDocument, 0, 3) == 'ST-')
|
||||
{
|
||||
$ref = trim($commande->refDocument);
|
||||
$refFile =
|
||||
$refFile =
|
||||
PATH_DATA.
|
||||
'/pdf/acte-'.
|
||||
$siren.'-'.trim($commande->refDocument).'.pdf';
|
||||
@ -52,11 +52,11 @@ function cmdDernierStatut($siren, $acteS)
|
||||
$firephp->log($refFile, 'refFile');
|
||||
if( $checkFile && file_exists($refFile) )
|
||||
{
|
||||
$lienCommande =
|
||||
$lienCommande =
|
||||
'<br/>'.
|
||||
'<a href="'.
|
||||
'./datafile.php?q=acte-'.$siren.'-'.$ref.'.pdf&type=pdf'.
|
||||
'" target="_blank">'.$lib.'</a>';
|
||||
'" target="_blank">'.$lib.'</a>';
|
||||
}
|
||||
return $lienCommande;
|
||||
}
|
||||
@ -91,7 +91,7 @@ function theme_greffeactes($items, $headers)
|
||||
//=> Cellule 2
|
||||
//=> Cellule 2
|
||||
$data = '';
|
||||
$data.= $acteS['actes'][0]['type'].' ';
|
||||
$data.= $acteS['actes'][0]['type_lib'].' ';
|
||||
//Génération du lien de commande suivant le mode de diffusion
|
||||
$params = 'vue=statuts&siret='.$siren.'&ref='.$acteS['actes'][0]['ref'];
|
||||
switch($acteS['actes'][0]['mode'])
|
||||
@ -117,13 +117,13 @@ function theme_greffeactes($items, $headers)
|
||||
//=> Cellule 3
|
||||
$data = 'Le dernier statut à jour';
|
||||
$cells[] = array( 'data'=> $data, 'attrs'=>array('class'=>'decision') );
|
||||
$rows[] = array( 'data' => $cells );
|
||||
$rows[] = array( 'data' => $cells );
|
||||
//Suppression du dernier statut à jour
|
||||
unset($items[0]);
|
||||
}
|
||||
//Fin traitement dernier statut à jour
|
||||
foreach($items as $key => $depot)
|
||||
{
|
||||
{
|
||||
//Parcours standard des actes pour affichage
|
||||
foreach($depot['actes'] as $num => $acte)
|
||||
{
|
||||
@ -132,11 +132,12 @@ function theme_greffeactes($items, $headers)
|
||||
$cells[] = array( 'data'=> $acte['date_acte'] , 'attrs'=>array('class'=>'date') );
|
||||
//=> Cellule 2
|
||||
$data = '';
|
||||
$data.= $acte['type'].' ';
|
||||
$data.= $acte['type_lib'].' ';
|
||||
$infos = array(
|
||||
'num_acte' => $acte['num_acte'],
|
||||
'date_acte' => $acte['date_acte'],
|
||||
'type' => $acte['type'],
|
||||
'type_lib' => $acte['type_lib'],
|
||||
'decision' => $acte['decision']
|
||||
);
|
||||
//Génération du lien de commande suivant le mode de diffusion
|
||||
@ -226,11 +227,11 @@ function theme_greffeactes($items, $headers)
|
||||
$data.= ', '.$acte['nbpages_acte'].' page';
|
||||
}
|
||||
$cells[] = array( 'data'=> $data, 'attrs'=>array('class'=>'decision') );
|
||||
$rows[] = array( 'data' => $cells );
|
||||
$rows[] = array( 'data' => $cells );
|
||||
} // Fin acte
|
||||
} // Fin depot
|
||||
} // Fin depot
|
||||
$data = array( 'head' => array( 'data' => $head ) , 'body' => array( 'data' => $rows ) );
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
@ -248,7 +249,7 @@ function theme_greffebilans($items, $headers)
|
||||
}
|
||||
$head = $cells;
|
||||
//Fin Définition entetes
|
||||
|
||||
|
||||
foreach($items as $key => $item)
|
||||
{
|
||||
$cells = array();
|
||||
@ -330,16 +331,16 @@ function theme_greffebilans($items, $headers)
|
||||
$cells[] = array( 'data'=> $data , 'attrs'=>array('class'=>'type') );
|
||||
$data = '<br/>Dépot n°'.$item['num_depot'];
|
||||
$cells[] = array( 'data'=> $data , 'attrs'=>array('class'=>'decision') );
|
||||
$rows[] = array( 'data' => $cells );
|
||||
}
|
||||
$rows[] = array( 'data' => $cells );
|
||||
}
|
||||
$data = array( 'head' => array( 'data' => $head ) , 'body' => array( 'data' => $rows ) );
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
function lien_factice($siret, $ref, $lib)
|
||||
{
|
||||
$ref_exploded = explode('|',$ref);
|
||||
$ref_exploded = explode('|',$ref);
|
||||
$ref = $ref_exploded[0];
|
||||
$output = '';
|
||||
if(hasModeEdition())
|
||||
@ -352,18 +353,18 @@ function lien_factice($siret, $ref, $lib)
|
||||
function sendCmdMail($sujet, $message)
|
||||
{
|
||||
require_once 'mail/mail.php';
|
||||
sendMail(
|
||||
"Erreur SOAP - (Date :".date("d")."/".date("m")."/".date("Y").")",
|
||||
$message,
|
||||
sendMail(
|
||||
"Erreur SOAP - (Date :".date("d")."/".date("m")."/".date("Y").")",
|
||||
$message,
|
||||
//From
|
||||
array(
|
||||
array(
|
||||
'email' => 'contact@scores-decisions.com',
|
||||
'name' => 'Contact',
|
||||
),
|
||||
),
|
||||
//TO
|
||||
array(
|
||||
0 => array(
|
||||
'email'=> 'pieces@scores-decisions.com',
|
||||
'email'=> 'pieces@scores-decisions.com',
|
||||
'name' => 'Pieces'
|
||||
)
|
||||
)
|
||||
|
@ -18,7 +18,7 @@ if(INFOGREFFE_DEBUG)
|
||||
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');
|
||||
define('INFOGREFFE_WS_PASS', '160409');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -34,21 +34,21 @@ function infogreffe_requetexml($siren, $idCommande, $type, $vecteur, $option)
|
||||
{
|
||||
global $client, $firephp;
|
||||
$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('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=='')
|
||||
@ -58,14 +58,14 @@ function infogreffe_requetexml($siren, $idCommande, $type, $vecteur, $option)
|
||||
$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!='' )
|
||||
|
||||
// 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
|
||||
/*
|
||||
@ -84,16 +84,14 @@ function infogreffe_requetexml($siren, $idCommande, $type, $vecteur, $option)
|
||||
$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;
|
||||
|
||||
|
||||
}
|
||||
// Commande de documents : actes
|
||||
elseif ( $type=='AC' && !empty($option) )
|
||||
elseif ( $type=='AC' && !empty($option) )
|
||||
{
|
||||
//Format de la variable option pour commande type AC
|
||||
|
||||
|
||||
/*
|
||||
0 => type_acte
|
||||
1 => date de référence
|
||||
@ -105,9 +103,9 @@ function infogreffe_requetexml($siren, $idCommande, $type, $vecteur, $option)
|
||||
7 => num_acte
|
||||
*/
|
||||
$ref = explode('-', $option);
|
||||
$num_actes = explode('|', $ref[7]);
|
||||
$num_actes = explode('|', $ref[7]);
|
||||
$firephp->log($ref, 'ref');
|
||||
$firephp->log($num_actes, 'ref');
|
||||
$firephp->log($num_actes, 'ref');
|
||||
$commande->addChild('greffe',$ref[2]);
|
||||
$commande->addChild('dossier_millesime', $ref[3]);
|
||||
$commande->addChild('dossier_statut', $ref[4]);
|
||||
@ -115,11 +113,11 @@ function infogreffe_requetexml($siren, $idCommande, $type, $vecteur, $option)
|
||||
$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
|
||||
@ -128,7 +126,7 @@ function infogreffe_requetexml($siren, $idCommande, $type, $vecteur, $option)
|
||||
$fichierOption = $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);
|
||||
@ -156,7 +154,7 @@ function infogreffe_getproduitsxml($xml)
|
||||
$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;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -169,56 +167,56 @@ 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;
|
||||
$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']['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');
|
||||
$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
|
||||
|
||||
//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);
|
||||
@ -231,9 +229,9 @@ function infogreffe_parsexml_actes($xml)
|
||||
{
|
||||
$actes[0] = $acte;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//Tri suivant la date d'acte ou de depot
|
||||
krsort($actes);
|
||||
$firephp->log($actes, 'actes');
|
||||
@ -249,23 +247,23 @@ function infogreffe_parsexml_actes_t($xml)
|
||||
{
|
||||
$doc = new DOMDocument();
|
||||
$doc->loadXML($xml);
|
||||
|
||||
|
||||
$depot_acte = $doc->getElementsByTagName('depot_acte')->item(0);
|
||||
|
||||
$info = array();
|
||||
|
||||
$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)
|
||||
@ -276,15 +274,15 @@ function infogreffe_parsexml_actes_t($xml)
|
||||
$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']['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);
|
||||
$actenum['url_acces'] = htmlspecialchars_decode($infoActe->getElementsByTagName('url_acces')->item(0)->nodeValue);
|
||||
$info['actes'][] = $actenum;
|
||||
}
|
||||
return $info;
|
||||
@ -299,7 +297,7 @@ 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');
|
||||
|
||||
@ -307,28 +305,28 @@ function infogreffe_parsexml_bilans($xml)
|
||||
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');
|
||||
|
||||
$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
|
||||
|
||||
//Génération de l'index pour le tri
|
||||
$date = $bilan['date_cloture_iso'];
|
||||
if(!empty($date))
|
||||
{
|
||||
@ -343,7 +341,7 @@ function infogreffe_parsexml_bilans($xml)
|
||||
|
||||
function infogreffe_parsexml_bilans_t($xml)
|
||||
{
|
||||
global $firephp;
|
||||
global $firephp;
|
||||
$doc = new DOMDocument();
|
||||
$doc->loadXML($xml);
|
||||
$bilan_complet = $doc->getElementsByTagName('bilan_complet')->item(0);
|
||||
@ -377,10 +375,10 @@ function infogreffe_format_actes($actes)
|
||||
$tabActes = array();
|
||||
//Pour chaque depot
|
||||
foreach($actes as $key => $depot)
|
||||
{
|
||||
//Pour chaque acte dans le 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);
|
||||
@ -390,29 +388,29 @@ function infogreffe_format_actes($actes)
|
||||
$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']); }
|
||||
|
||||
|
||||
$firephp->log($ref, 'ref');
|
||||
|
||||
|
||||
//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';
|
||||
$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;
|
||||
@ -422,22 +420,23 @@ function infogreffe_format_actes($actes)
|
||||
$mode = 'courrier';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Assignation
|
||||
$tabActe['num_acte'] = $acte['num_acte'];
|
||||
$tabActe['nbpages_acte'] = $acte['nbpages_acte'];
|
||||
$tabActe['type'] = $acte['type_acte_libelle'];
|
||||
$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']);
|
||||
|
||||
|
||||
}
|
||||
$firephp->log($tabActes, 'actes');
|
||||
return $tabActes;
|
||||
@ -445,26 +444,26 @@ function infogreffe_format_actes($actes)
|
||||
|
||||
function infogreffe_format_actes_t($actes)
|
||||
{
|
||||
$tabActes = array();
|
||||
$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'];
|
||||
@ -473,7 +472,7 @@ function infogreffe_format_actes_t($actes)
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param unknown_type $bilans
|
||||
* @return unknown_type
|
||||
*/
|
||||
@ -503,19 +502,19 @@ function infogreffe_format_bilans($bilans)
|
||||
$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() ) )
|
||||
if($nomode && ( substr($bilan['date_cloture'],6,4)>date('Y')-5 || hasModeEdition() ) )
|
||||
{
|
||||
$mode = 'courrier';
|
||||
}
|
||||
$mode = 'courrier';
|
||||
}
|
||||
$firephp->log($mode,$bilan['millesime']);
|
||||
//Valeurs de retour
|
||||
$tabBilans[$key]['millesime'] = $bilan['millesime'];
|
||||
@ -540,11 +539,11 @@ function getGreffeActes($siren, $typeCommande = '', $ref = '', $idCommande = 0)
|
||||
global $firephp;
|
||||
$error = '';
|
||||
$result = array();
|
||||
|
||||
|
||||
if(empty($typeCommande)) $typeCommande = 'XL';
|
||||
$firephp->log($typeCommande,'typeCommande');
|
||||
$type = 'AC'; // Type actes
|
||||
|
||||
|
||||
if($typeCommande=='XL')
|
||||
{
|
||||
$fichier = INFOGREFFE_PATH.$type.'-'.$siren.'.xml';
|
||||
@ -554,13 +553,13 @@ function getGreffeActes($siren, $typeCommande = '', $ref = '', $idCommande = 0)
|
||||
$xmlReponse = infogreffe_getproduitsxml($xmlRequete);
|
||||
file_put_contents($fichier, $xmlReponse);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
$xmlReponse = file_get_contents($fichier);
|
||||
}
|
||||
if(!infogreffe_erreur($xmlReponse))
|
||||
{
|
||||
//Tableau d'actes
|
||||
//Tableau d'actes
|
||||
$actes = infogreffe_parsexml_actes($xmlReponse);
|
||||
$result = infogreffe_format_actes($actes);
|
||||
}
|
||||
@ -568,11 +567,26 @@ function getGreffeActes($siren, $typeCommande = '', $ref = '', $idCommande = 0)
|
||||
//Commande d'un acte en mode téléchargement
|
||||
elseif($typeCommande=='T')
|
||||
{
|
||||
$firephp->info('Mode telechargement');
|
||||
$xmlRequete = infogreffe_requetexml($siren, $idCommande, $type, $typeCommande, $ref);
|
||||
$firephp->log($xmlRequete, 'Telechargement requete xml');
|
||||
$xmlReponse = infogreffe_getproduitsxml($xmlRequete);
|
||||
$firephp->log($xmlReponse, 'Telechargement reponse xml');
|
||||
$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 = $option;
|
||||
}
|
||||
$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);
|
||||
|
||||
$firephp->log($xmlRequete, 'Telechargement requete xml');
|
||||
$firephp->log($xmlReponse, 'Telechargement reponse xml');
|
||||
}else{
|
||||
$xmlReponse = file_get_contents($fichier);
|
||||
}
|
||||
if(!infogreffe_erreur($xmlReponse))
|
||||
{
|
||||
$items = infogreffe_parsexml_actes_t($xmlReponse);
|
||||
@ -582,27 +596,31 @@ function getGreffeActes($siren, $typeCommande = '', $ref = '', $idCommande = 0)
|
||||
$actes = $items['actes'];
|
||||
unset($items['actes']);
|
||||
$result = $depot = $items;
|
||||
|
||||
$num_gest =
|
||||
|
||||
$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);
|
||||
$firephp->log($fichier, 'fichier');
|
||||
|
||||
$fichierdl = infogreffe_dl($fichier, $acte['url_acces']);
|
||||
$acte['url_acces'] = $fichierdl;
|
||||
|
||||
//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;
|
||||
}
|
||||
}
|
||||
@ -612,7 +630,7 @@ function getGreffeActes($siren, $typeCommande = '', $ref = '', $idCommande = 0)
|
||||
{
|
||||
//On génére un idCommande suivant la valeur en bdd
|
||||
$xmlRequete = infogreffe_requetexml($siren, $idCommande, $type, $typeCommande, $ref);
|
||||
$xmlReponse = infogreffe_getproduitsxml($xmlRequete);
|
||||
$xmlReponse = infogreffe_getproduitsxml($xmlRequete);
|
||||
}
|
||||
//Default mode erreur
|
||||
else
|
||||
@ -670,7 +688,7 @@ function infogreffe_erreur_msg($xml)
|
||||
}
|
||||
|
||||
/**
|
||||
* Demande le dernier statut à jour auprès d'infogreffe seulement si disponible pour le siren
|
||||
* 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
|
||||
@ -701,7 +719,7 @@ function getGreffeBilans($siren, $typeCommande = '', $ref = '', $idCommande = 0)
|
||||
global $firephp;
|
||||
$error = '';
|
||||
$result = '';
|
||||
|
||||
|
||||
if(empty($typeCommande)) $typeCommande = 'XL';
|
||||
$type = 'BI';
|
||||
if($typeCommande=='XL')
|
||||
@ -713,7 +731,7 @@ function getGreffeBilans($siren, $typeCommande = '', $ref = '', $idCommande = 0)
|
||||
$xmlReponse = infogreffe_getproduitsxml($xmlRequete);
|
||||
file_put_contents($fichier, $xmlReponse);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
$xmlReponse = file_get_contents($fichier);
|
||||
}
|
||||
@ -747,13 +765,13 @@ function getGreffeBilans($siren, $typeCommande = '', $ref = '', $idCommande = 0)
|
||||
{
|
||||
//On génére un idCommande suivant la valeur en bdd
|
||||
$xmlRequete = infogreffe_requetexml($siren, $idCommande, $type, $typeCommande, $ref);
|
||||
$xmlReponse = infogreffe_getproduitsxml($xmlRequete);
|
||||
$xmlReponse = infogreffe_getproduitsxml($xmlRequete);
|
||||
}
|
||||
//Default mode erreur
|
||||
else
|
||||
{
|
||||
//Paramètres incorrect
|
||||
}
|
||||
}
|
||||
//Gestion du retour infogreffe
|
||||
if(infogreffe_erreur($xmlReponse))
|
||||
{
|
||||
@ -767,17 +785,17 @@ function infogreffe_acte_ref($acte, $depot, $multi = false)
|
||||
{
|
||||
global $firephp;
|
||||
if($depot['num_depot']>0)
|
||||
{
|
||||
{
|
||||
//Numéro de gestion
|
||||
$num_gest =
|
||||
$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)
|
||||
@ -793,7 +811,7 @@ function infogreffe_acte_ref($acte, $depot, $multi = false)
|
||||
{
|
||||
$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']); }
|
||||
@ -803,7 +821,7 @@ function infogreffe_acte_ref($acte, $depot, $multi = false)
|
||||
else
|
||||
{
|
||||
//Dernier STATUT A JOUR
|
||||
$dateRef = date('Y').date('m').date('d');
|
||||
$dateRef = date('Y').date('m').date('d');
|
||||
return 'ST-'.$dateRef.'-'.
|
||||
$depot['num_gest']['greffe'].'-'.
|
||||
$depot['num_gest']['dossier_millesime'].'-'.
|
||||
@ -819,7 +837,7 @@ function infogreffe_acte_filename($siren, $ref)
|
||||
|
||||
function infogreffe_bilan_ref($bilan)
|
||||
{
|
||||
$ref =
|
||||
$ref =
|
||||
$bilan['millesime'].'_'.
|
||||
$bilan['type_comptes'].'-'.
|
||||
WDate::dateT('Y-m-d', 'Ymd', $bilan['date_cloture_iso']).'-'.
|
||||
@ -852,7 +870,7 @@ function infogreffe_dl($fichier, $url)
|
||||
{
|
||||
$firephp->log($url, 'url');
|
||||
$page = getUrl($url, '', '', '', false, '', '',0,1);
|
||||
if (substr($page['body'],0,4)!='%PDF')
|
||||
if (substr($page['body'],0,4)!='%PDF')
|
||||
{
|
||||
$page2=parse_response($page['body']);
|
||||
$body=$page2['body'];
|
||||
|
Loading…
x
Reference in New Issue
Block a user