2009-02-17 13:14:53 +00:00
< ? php
if ( ! $_SESSION [ 'connected' ])
echo ( 'Vous devez <20> tre connect<63> afin de pouvoir utiliser cette fonctionnalit<69> ' );
else { // On est bien connect<63>
2009-04-01 12:45:45 +00:00
2009-06-02 13:33:38 +00:00
require_once 'common/curl.php' ;
require_once 'inpi/inpi.php' ;
2009-04-01 12:45:45 +00:00
$tabInfo = $_SESSION [ 'tabInfo' ];
2009-02-17 13:14:53 +00:00
define ( 'RNCS_WS_URL' , 'http://www.services.ort.fr/ProtocoleRNCS/access' );
define ( 'RNCS_WS_USER' , '167260' );
define ( 'RNCS_WS_PASS' , '100356' );
2009-06-02 13:33:38 +00:00
$cmdPages = $cmdNom = '' ;
2009-02-17 13:14:53 +00:00
2009-06-02 13:33:38 +00:00
if ( isset ( $_REQUEST [ 'pages' ])) $cmdPages = $_REQUEST [ 'pages' ];
if ( isset ( $_REQUEST [ 'nom' ])) $cmdNom = $_REQUEST [ 'nom' ];
if ( isset ( $_REQUEST [ 'vue' ])) $vue = $_REQUEST [ 'vue' ];
2009-02-17 13:14:53 +00:00
if ( $vue == 'bilans' ) $presta = '12004' ;
else $presta = '12003' ;
if ( $cmdNom && $cmdPages ) $type = 'QDOC' ;
else $type = 'QVIT' ;
$prod = array ( 'Type' => $type ,
'Presta' => $presta ,
'Num' => '2' , //2,
'Ver' => '2' , //2,
'Siren' => $siren ,
'CmdNom' => $cmdNom ,
'CmdPages' => $cmdPages ,
'CmdBilan' => '' ,
);
$ref = '' ;
2009-06-02 13:33:38 +00:00
$req = requeteInpi ( $prod , $ref );
$postData = array ( '' => $req );
$cookie = $referer = '' ;
2009-02-17 13:14:53 +00:00
2009-06-02 13:33:38 +00:00
if (( ! $cmdNom && ! $cmdPages ) ||
( $cmdNom && $cmdPages && ! file_exists ( PATH_DATA . '/pdf/rncs-' . $siren . '-' . $cmdNom . '-' . $cmdPages . '.pdf' ))
){
$page = getUrl ( RNCS_WS_URL , $cookie , $postData , $referer , false , 'www.services.ort.fr' , '' , 7 );
$firephp -> log ( $page , 'page' );
$body = $page [ 'body' ];
if ( $page [ 'code' ] == 408 ){
$erreurAccesInpi = TRUE ;
}
} else {
$body = '' ;
}
2009-02-17 13:14:53 +00:00
2009-06-02 13:33:38 +00:00
/** ERREUR PROTOCOL **/
2009-02-17 13:14:53 +00:00
preg_match ( '/<ort:_13 type="020">(.*)<\/ort:_13>/Uis' , $body , $matches );
if ( $matches [ 1 ] * 1 <> 0 ) {
$errNumInpi = $matches [ 1 ];
$errMsgInpi = $tabErreurInpi [ $errNumInpi ];
echo " <!-- ERREUR INPI 13 n<> $errNumInpi = $errMsgInpi !!! --> \n " ;
}
2009-06-02 13:33:38 +00:00
/** ERREUR APPLICATIVES NUMERIQUES **/
2009-02-17 13:14:53 +00:00
preg_match ( '/<ort:_96 type="020">(.*)<\/ort:_96>/Uis' , $body , $matches );
if ( $matches [ 1 ] * 1 <> 0 ) {
$errNumInpi = $matches [ 1 ];
$errMsgInpi = $tabErreurInpi [ $errNumInpi ];
echo " <!-- ERREUR INPI 96 n<> $errNumInpi = $errMsgInpi !!! --> \n " ;
}
2009-06-02 13:33:38 +00:00
/** ERREUR APPLICATIVES TEXTE **/
2009-02-17 13:14:53 +00:00
preg_match ( '/<ort:_97 type="010">(.*)<\/ort:_97>/Uis' , $body , $matches );
if ( $matches [ 1 ] * 1 <> 0 ) {
$errMsgInpi = $matches [ 1 ];
echo " <!-- ERREUR INPI 97 : $errMsgInpi !!! --> \n " ;
}
if ( $vue == 'bilans' )
$pregmatch = preg_match_all ( '/<ort\:_201 type="110">(?:.*)<ort\:_103000040 type="010">(.*)<\/ort:_103000040>(?:.*)<ort\:_103000452 type="010">(.*)<\/ort:_103000452>(?:.*)<ort\:_103000402 type="010">(.*)<\/ort:_103000402>(?:.*)<ort\:_103000403 type="010">(.*)<\/ort:_103000403>(?:.*)<ort\:_103000404 type="010">(.*)<\/ort:_103000404>(?:.*)<\/ort:_201>/Uis' , $body , $matches );
else
$pregmatch = preg_match_all ( '/<ort\:_201 type="110">(?:.*)<ort\:_103000452 type="010">(.*)<\/ort:_103000452>(?:.*)<ort\:_103000402 type="010">(.*)<\/ort:_103000402>(?:.*)<ort\:_103000403 type="010">(.*)<\/ort:_103000403>(?:.*)<ort\:_103000404 type="010">(.*)<\/ort:_103000404>(?:.*)<\/ort:_201>/Uis' , $body , $matches );
2009-03-25 14:38:22 +00:00
$O2 = $client -> setLog ( 'inpi_' . $vue , $siret , 0 , trim ( $cmdNom . ' ' . $cmdPages ));
2009-02-17 13:14:53 +00:00
if ( $origine == 'G' && count ( $matches [ 0 ]) == 0 )
$vecteurTinit = true ;
else {
?>
< script language = " javascript " >
function ajax ()
{
var xhr = null ;
if ( window . XMLHttpRequest ) {
xhr = new XMLHttpRequest ();
}
else if ( window . ActiveXObject )
{
xhr = new ActiveXObject ( " Microsoft.XMLHTTP " );
}
//on d<> finit l'appel de la fonction au retour serveur
xhr . onreadystatechange = function () { alert_ajax ( xhr ); };
////on affiche le message d'acceuil
//document.getElementById("message").className="tumevois";
//on appelle le fichier reponse.txt
xhr . open ( " GET " , " /?page=attente&siret=<?= $siret ?>&ref=rncs-<?= $cmdNom ?>-<?= $cmdPages ?> " , true );
xhr . send ( null );
}
function alert_ajax ( xhr )
{
if ( xhr . readyState == 4 )
{
document . getElementById ( " attente " ) . className = " attenteCachee " ;
document . getElementById ( " lien " ) . className = " attenteVisible " ;
if ( xhr . responseText * 1 < 0 ) alert ( 'Erreur n<> ' + xhr . responseText + ' lors du t<> l<EFBFBD> chargement du document.\nMerci de r<> essayer plus tard !' );
/*
var docXML = xhr . responseXML ;
var items = docXML . getElementsByTagName ( " level " )
//on fait juste une boucle sur chaque element "donnee" trouv<75>
for ( i = 0 ; i < items . length ; i ++ )
{
alert ( items . item ( i ) . firstChild . data );
}
*/
}
}
</ script >
< ? if ( $errNum == 0 ) { ?>
< table width = " 580 " border = " 0 " align = " left " bgcolor = " #FFFFFF " >
< tr >
< td colspan = " 3 " align = " center " >< img src = " ./img/rub_pieces.png " width = " 577 " height = " 36 " /></ td >
</ tr >
< tr >
< td width = " 30 " >& nbsp ; </ td >
< td width = " 200 " class = " StyleInfoLib " > Num & eacute ; 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 " >& nbsp ; </ td >
< td width = " 200 " class = " StyleInfoLib " > Raison Sociale </ td >
< td width = " 350 " class = " StyleInfoData " >< ? = $raisonSociale ?> </td>
</ tr >
< tr >
< td colspan = " 3 " >& nbsp ; </ td >
</ tr >
2009-04-10 08:38:50 +00:00
< ?
}
2009-02-17 13:14:53 +00:00
2009-04-10 08:38:50 +00:00
if ( $vue == 'bilans' ) { // D<> but BILANS
if ( $errNum == 0 ) {
?>
< tr >
< td colspan = " 3 " >< img src = " ./img/srub_comptes_ann.png " width = " 576 " height = " 27 " /></ td >
</ tr >
< ?
}
2009-02-17 13:14:53 +00:00
2009-04-10 08:38:50 +00:00
if ( ! $cmdNom && $pregmatch ) {
2009-02-17 13:14:53 +00:00
?>
2009-04-10 08:38:50 +00:00
< tr >
< td width = " 580 " colspan = " 3 " >
< table style = " width:530px;margin-top:5px;margin-bottom:5px;margin-left:10px;margin-right:10px " class = " table-classic " >< tr class = " titre " >< td class = " titre " style = " width:70px " > Date </ td >< td align = " center " class = " titre " style = " width:260px " > Type </ td >< td align = " center " class = " titre " style = " width:200px " > D & eacute ; cisions </ td ></ tr >
2009-02-17 13:14:53 +00:00
< ? php
2009-04-10 08:38:50 +00:00
foreach ( $matches [ 0 ] as $k => $acte ) {
$dateAff = $matches [ 2 ][ $k ];
$acte = array ();
$acte [ 'type' ] = $matches [ 5 ][ $k ] . ' (' . $matches [ 1 ][ $k ] . ')' ;
$acte [ 'decisions' ] = $matches [ 4 ][ $k ] . ' page' ;
if ( $matches [ 4 ][ $k ] > 1 ) $acte [ 'decisions' ] .= 's' ;
$acte [ 'depot_num' ] = $matches [ 3 ][ $k ];
$cmdNom = $matches [ 3 ][ $k ];
$cmdPages = $matches [ 4 ][ $k ];
2009-06-02 13:33:38 +00:00
$href = '/?page=greffes&siret=' . $siret . '&nom=' . $cmdNom . '&pages=' . $cmdPages . '&vue=rcs' ;
if ( ! preg_match ( '/ACTES/i' , $_SESSION [ 'tabInfo' ][ 'droits' ])){ $href = '#' ; }
2009-04-10 08:38:50 +00:00
if ( file_exists ( PATH_DATA . '/pdf/rncs-' . $siren . '-' . $cmdNom . '-' . $cmdPages . '.pdf' )) {
$alt = " Cliquez ici pour t<> l<EFBFBD> charger instantan<61> ment le document correspondant " ;
$pdf = '<img src="/img/icone_pdf.gif" />' ;
2009-06-02 13:33:38 +00:00
if ( ! preg_match ( '/ACTES/i' , $_SESSION [ 'tabInfo' ][ 'droits' ])){ $alt = " Vous n'avez pas les droits n<> cessaire pour t<> l<EFBFBD> charger instantan<61> ment le document correspondant " ; }
2009-04-10 08:38:50 +00:00
} else {
$alt = " T<EFBFBD> l<EFBFBD> chargement long (entre 1 et 15 minutes) ! " ;
$pdf = '<img src="/img/icone_pdf_wait2.png" />' ;
2009-06-02 13:33:38 +00:00
if ( ! preg_match ( '/ACTES/i' , $_SESSION [ 'tabInfo' ][ 'droits' ])){ $alt = " Vous n'avez pas les droits n<> cessaire pour t<> l<EFBFBD> charger le document correspondant " ; }
2009-04-10 08:38:50 +00:00
}
2009-02-17 13:14:53 +00:00
?>
2009-06-02 13:33:38 +00:00
< tr class = " ligne " >< td style = " width:13% " class = " titre " >< ? = $dateAff ?> </td>
< td style = " width:48%;text-align:center " class = " std " >
< a title = " <?= $alt ?> " href = " <?= $href ?> " >< u >< ? = $acte [ 'type' ] ?> </u> <?=$pdf?></a>
</ td >
< td style = " width:39% " class = " last " >
< ? = $acte [ 'decisions' ]; if ( trim ( $acte [ 'decisions' ]) <> '' ) echo '<br/>' ; ?> D<> p<EFBFBD> t num<75> ro <?=$acte['depot_num']?>
</ td >
</ tr >
< ? php
2009-04-10 08:38:50 +00:00
}
2009-06-02 13:33:38 +00:00
?>
</ table >
< ? php
2009-04-10 08:38:50 +00:00
} elseif ( $cmdNom && $cmdPages ) {
if ( ! file_exists ( PATH_DATA . '/pdf/rncs-' . $siren . '-' . $cmdNom . '-' . $cmdPages . '.pdf' )) {
2009-02-17 13:14:53 +00:00
?>
2009-04-10 08:38:50 +00:00
< script language = " javascript " > ajax (); </ script >
< tr >
< td width = " 30 " >& nbsp ; </ td >
< td width = " 550 " colspan = " 2 " class = " StyleInfoData " >< div class = " attenteVisible " id = " attente " > Votre commande est prise en compte . Veuillez Patienter ... < img src = " /img/ajax/1-1.gif " /></ div >< br />< div class = " attenteCachee " id = " lien " >< u >< a title = " Cliquez ici pour visualiser le document " target = " _blank " href = " /?page=actes&siret=<?= $siret ?>&ref=rncs-<?= $cmdNom ?>-<?= $cmdPages ?> " > Visualiser le document < img src = " /img/icone_pdf.gif " /></ a ></ u ></ div ></ td >
</ tr >
< ?
} else {
?>
< tr >
< td width = " 30 " >& nbsp ; </ td >
< td width = " 550 " colspan = " 2 " class = " StyleInfoData " >< u >< a title = " Cliquez ici pour visualiser le document " target = " _blank " href = " /?page=actes&siret=<?= $siret ?>&ref=rncs-<?= $cmdNom ?>-<?= $cmdPages ?> " > Visualiser le document < img src = " /img/icone_pdf.gif " /></ a ></ u ></ td >
</ tr >
2009-02-17 13:14:53 +00:00
< ?
2009-04-10 08:38:50 +00:00
$message = 'Commande RNCS' ;
2009-02-17 13:14:53 +00:00
mail ( 'ylenaour@scores-decisions.com' , " Commande de bilans RNCS pour $siren " ,
'REQUEST=' . EOL . print_r ( $_REQUEST , true ) . 'EOL' .
'SERVER=' . EOL . print_r ( $_SERVER , true ) . 'EOL' .
'SESSION=' . EOL . print_r ( $_SESSION , true ) . 'EOL' .
'ENV=' . EOL . print_r ( $_ENV , true ) . 'EOL' .
'tabInfo=' . print_r ( $tabInfo , true ));
2009-04-10 08:38:50 +00:00
}
2009-02-17 13:14:53 +00:00
2009-04-10 08:38:50 +00:00
} elseif ( isset ( $erreurAccesInpi ) && $erreurAccesInpi ) {
?>
< tr >
< td width = " 30 " >& nbsp ; </ td >
< td width = " 550 " colspan = " 2 " class = " StyleInfoData " >< ? php print $body ; ?> </td>
</ tr >
< ? php
} else {
2009-02-17 13:14:53 +00:00
?>
< tr >
< td width = " 30 " >& nbsp ; </ td >
< td width = " 550 " colspan = " 2 " class = " StyleInfoData " > Aucun bilan n ' a & eacute ; t & eacute ; d & eacute ; p & ocirc ; s & eacute ; pour cette entreprise .</ td >
</ tr >
< ?
}
2009-04-10 08:38:50 +00:00
} // Fin BILANS
else { // D<> but ACTES
if ( $errNum == 0 ) {
?>
< tr >
< td colspan = " 3 " >< img src = " ./img/srub_actes.png " width = " 576 " height = " 27 " /></ td >
</ tr >
2009-02-17 13:14:53 +00:00
< ?
2009-04-10 08:38:50 +00:00
}
2009-02-17 13:14:53 +00:00
if ( ! $cmdNom && $pregmatch ) {
?>
< tr >
< td width = " 580 " colspan = " 3 " >
< table style = " width:530px;margin-top:5px;margin-bottom:5px;margin-left:10px;margin-right:10px " class = " table-classic " >< tr class = " titre " >< td class = " titre " style = " width:70px " > Date </ td >< td align = " center " class = " titre " style = " width:260px " > Type </ td >< td align = " center " class = " titre " style = " width:200px " > D & eacute ; cisions </ td ></ tr >
< ? php
foreach ( $matches [ 0 ] as $k => $acte ) {
$dateAff = $matches [ 1 ][ $k ];
$acte = array ();
$acte [ 'type' ] = strtr ( $matches [ 4 ][ $k ], array ( ' - ' => '<br/>' ));
$acte [ 'decisions' ] = $matches [ 3 ][ $k ] . ' page' ;
if ( $matches [ 3 ][ $k ] > 1 ) $acte [ 'decisions' ] .= 's' ;
$acte [ 'depot_num' ] = $matches [ 2 ][ $k ];
$cmdNom = $matches [ 2 ][ $k ];
$cmdPages = $matches [ 3 ][ $k ];
2009-06-02 13:33:38 +00:00
$href = '/?page=greffes&siret=' . $siret . '&nom=' . $matches [ 2 ][ $k ] . '&pages=' . $matches [ 3 ][ $k ] . '&vue=rcs' ;
if ( ! preg_match ( '/ACTES/i' , $_SESSION [ 'tabInfo' ][ 'droits' ])){ $href = '#' ; }
2009-03-02 11:27:23 +00:00
if ( file_exists ( PATH_DATA . '/pdf/rncs-' . $siren . '-' . $cmdNom . '-' . $cmdPages . '.pdf' )) {
2009-02-17 13:14:53 +00:00
$alt = " Cliquez ici pour t<> l<EFBFBD> charger instantan<61> ment le document correspondant " ;
$pdf = '<img src="/img/icone_pdf.gif" />' ;
2009-06-02 13:33:38 +00:00
if ( ! preg_match ( '/ACTES/i' , $_SESSION [ 'tabInfo' ][ 'droits' ])){ $alt = " Vous n'avez pas les droits n<> cessaire pour t<> l<EFBFBD> charger instantan<61> ment le document correspondant " ; }
2009-02-17 13:14:53 +00:00
} else {
$alt = " T<EFBFBD> l<EFBFBD> chargement long (entre 1 et 15 minutes) ! " ;
$pdf = '<img src="/img/icone_pdf_wait2.png" />' ;
2009-06-02 13:33:38 +00:00
if ( ! preg_match ( '/ACTES/i' , $_SESSION [ 'tabInfo' ][ 'droits' ])){ $alt = " Vous n'avez pas les droits n<> cessaire pour t<> l<EFBFBD> charger le document correspondant " ; }
2009-02-17 13:14:53 +00:00
}
?>
2009-06-02 13:33:38 +00:00
< tr class = " ligne " >
< td style = " width:13% " class = " titre " >< ? = $dateAff ?> </td>
< td style = " width:48%;text-align:center " class = " std " >
< a title = " <?= $alt ?> " href = " <?= $href ?> " >< u >< ? = $acte [ 'type' ] ?> </u> <?=$pdf?></a>
</ td >
< td style = " width:39% " class = " last " >
< ? = $acte [ 'decisions' ]; if ( trim ( $acte [ 'decisions' ]) <> '' ) echo '<br/>' ; ?> D<EFBFBD> p<EFBFBD> t num<75> ro <?=$acte['depot_num']?><!-- du <?=WDate::dateT('Y-m-d','d/m/Y', $acte['depot_date'])?>-->
</ td >
</ tr >
< ? php
2009-02-17 13:14:53 +00:00
}
2009-06-02 13:33:38 +00:00
?>
</ table >
< ? php
2009-04-10 08:38:50 +00:00
} elseif ( $cmdNom && $cmdPages ) {
2009-03-02 11:27:23 +00:00
if ( ! file_exists ( PATH_DATA . '/pdf/rncs-' . $siren . '-' . $cmdNom . '-' . $cmdPages . '.pdf' )) {
2009-02-17 13:14:53 +00:00
?>
< script language = " javascript " > ajax (); </ script >
< tr >
< td width = " 30 " >& nbsp ; </ td >
< td width = " 550 " colspan = " 2 " class = " StyleInfoData " >< div class = " attenteVisible " id = " attente " > Votre commande est prise en compte . Veuillez Patienter ... < img src = " /img/ajax/1-1.gif " /></ div >< br />< div class = " attenteCachee " id = " lien " >< u >< a title = " Cliquez ici pour visualiser le document " target = " _blank " href = " /?page=actes&siret=<?= $siret ?>&ref=rncs-<?= $cmdNom ?>-<?= $cmdPages ?> " > Visualiser le document < img src = " /img/icone_pdf.gif " /></ a ></ u ></ div ></ td >
</ tr >
< ? } else { ?>
< tr >
< td width = " 30 " >& nbsp ; </ td >
< td width = " 550 " colspan = " 2 " class = " StyleInfoData " >< u >< a title = " Cliquez ici pour visualiser le document " target = " _blank " href = " /?page=actes&siret=<?= $siret ?>&ref=rncs-<?= $cmdNom ?>-<?= $cmdPages ?> " > Visualiser le document < img src = " /img/icone_pdf.gif " /></ a ></ u ></ td >
</ tr >
< ?
2009-06-03 17:01:58 +00:00
$message = 'Commande RNCS' ;
2009-02-17 13:14:53 +00:00
mail ( 'ylenaour@scores-decisions.com' , " Commande de pi<70> ces RNCS pour $siren " ,
'REQUEST=' . EOL . print_r ( $_REQUEST , true ) . 'EOL' .
'SERVER=' . EOL . print_r ( $_SERVER , true ) . 'EOL' .
'SESSION=' . EOL . print_r ( $_SESSION , true ) . 'EOL' .
'ENV=' . EOL . print_r ( $_ENV , true ) . 'EOL' .
'tabInfo=' . print_r ( $tabInfo , true ));
}
2009-04-10 08:38:50 +00:00
} elseif ( isset ( $erreurAccesInpi ) && $erreurAccesInpi ) {
?>
< tr >
< td width = " 30 " >& nbsp ; </ td >
< td width = " 550 " colspan = " 2 " class = " StyleInfoData " >< ? php print $body ; ?> </td>
</ tr >
< ? php
2009-02-17 13:14:53 +00:00
} else {
?>
< tr >
< td width = " 30 " >& nbsp ; </ td >
< td width = " 550 " colspan = " 2 " class = " StyleInfoData " > Aucun acte n ' a & eacute ; t & eacute ; d & eacute ; p & ocirc ; s & eacute ; pour cette entreprise .</ td >
</ tr >
< ?
}
} // Fin ACTES
2009-06-02 13:33:38 +00:00
?>
</ table >
< ? php
2009-04-10 08:38:50 +00:00
}
2009-06-02 13:33:38 +00:00
}
?>