global $tabOrt2Sd;
$tabOrt2Sd=array( '_130000001'=>'SIREN',
'_103000040'=>'CONSOLIDE',
'_103000033'=>'DATE_CLOTURE',
'_103000023'=>'DUREE_MOIS',
'_103000202'=>'MONNAIE_ORI',
'_103000205'=>'MONNAIE_ORI_UNITE',
'_103000211'=>'MONNAIE',
'_103000214'=>'MONNAIE_LIV_UNITE',
'_103000029'=>'AVIS_CAC',
'_130000009'=>'CODE_NAF',
'_103101001'=>'AA',
'_103101002'=>'AB',
'_103101003'=>'AC',
'_103101004'=>'AC1',
'_103101005'=>'AD',
'_103101006'=>'AE',
'_103101007'=>'AE1',
'_103101008'=>'AF',
'_103101009'=>'AG',
'_103101010'=>'AG1',
'_103101011'=>'AH',
'_103101012'=>'AI',
'_103101013'=>'AI1',
'_103101014'=>'AJ',
'_103101015'=>'AK',
'_103101016'=>'AK1',
'_103101017'=>'AL',
'_103101018'=>'AM',
'_103101019'=>'AM1',
'_103101020'=>'AN',
'_103101021'=>'AO',
'_103101022'=>'AO1',
'_103101023'=>'AP',
'_103101024'=>'AQ',
'_103101025'=>'AQ1',
'_103101026'=>'AR',
'_103101027'=>'AS',
'_103101028'=>'AS1',
'_103101029'=>'AT',
'_103101030'=>'AU',
'_103101031'=>'AU1',
'_103101032'=>'AV',
'_103101033'=>'AW',
'_103101034'=>'AW1',
'_103101035'=>'AX',
'_103101036'=>'AY',
'_103101037'=>'AY1',
'_103101038'=>'CS',
'_103101039'=>'CT',
'_103101040'=>'CT1',
'_103101041'=>'CU',
'_103101042'=>'CV',
'_103101043'=>'CV1',
'_103101044'=>'BB',
'_103101045'=>'BC',
'_103101046'=>'BC1',
'_103101047'=>'BD',
'_103101048'=>'BE',
'_103101049'=>'BE1',
'_103101050'=>'BF',
'_103101051'=>'BG',
'_103101052'=>'BG1',
'_103101053'=>'BH',
'_103101054'=>'BI',
'_103101055'=>'BI1',
'_103101056'=>'BJ',
'_103101057'=>'BK',
'_103101058'=>'BK1',
'_103101059'=>'BL',
'_103101060'=>'BM',
'_103101061'=>'BM1',
'_103101062'=>'BN',
'_103101063'=>'BO',
'_103101064'=>'BO1',
'_103101065'=>'BP',
'_103101066'=>'BQ',
'_103101067'=>'BQ1',
'_103101068'=>'BR',
'_103101069'=>'BS',
'_103101070'=>'BS1',
'_103101071'=>'BT',
'_103101072'=>'BU',
'_103101073'=>'BU1',
'_103101074'=>'BV',
'_103101075'=>'BW',
'_103101076'=>'BW1',
'_103101077'=>'BX',
'_103101078'=>'BY',
'_103101079'=>'BY1',
'_103101080'=>'BZ',
'_103101081'=>'CA',
'_103101082'=>'CA1',
'_103101083'=>'CB',
'_103101084'=>'CC',
'_103101085'=>'CC1',
'_103101086'=>'CD',
'_103101087'=>'CE',
'_103101088'=>'CE1',
'_103101089'=>'CF',
'_103101090'=>'CG',
'_103101091'=>'CG1',
'_103101092'=>'CH',
'_103101093'=>'CI',
'_103101094'=>'CI1',
'_103101095'=>'CJ',
'_103101096'=>'CK',
'_103101097'=>'CK1',
'_103101098'=>'CL',
'_103101099'=>'CM',
'_103101100'=>'CN',
'_103101101'=>'CO',
'_103101102'=>'1A',
'_103101103'=>'1A1',
'_103101104'=>'CP',
'_103101105'=>'CR',
'_103102001'=>'DA',
'_103102002'=>'DB',
'_103102003'=>'EK',
'_103102004'=>'DC',
'_103102005'=>'DD',
'_103102006'=>'DE',
'_103102007'=>'DF',
'_103102008'=>'DG',
'_103102009'=>'DH',
'_103102010'=>'DI',
'_103102011'=>'DJ',
'_103102012'=>'DK',
'_103102013'=>'DL',
'_103102014'=>'DM',
'_103102015'=>'DN',
'_103102016'=>'DO',
'_103102017'=>'DP',
'_103102018'=>'DQ',
'_103102019'=>'DR',
'_103102020'=>'DS',
'_103102021'=>'DT',
'_103102022'=>'DU',
'_103102023'=>'DV',
'_103102024'=>'DW',
'_103102025'=>'DX',
'_103102026'=>'DY',
'_103102027'=>'DZ',
'_103102028'=>'EA',
'_103102029'=>'EB',
'_103102030'=>'EC',
'_103102031'=>'ED',
'_103102032'=>'EE',
'_103102033'=>'EF',
'_103102034'=>'EG',
'_103102035'=>'EH',
'_103102036'=>'EI',
'_103103001'=>'FA',
'_103103002'=>'FB',
'_103103003'=>'FC',
'_103103004'=>'FD',
'_103103005'=>'FE',
'_103103006'=>'FF',
'_103103007'=>'FG',
'_103103008'=>'FH',
'_103103009'=>'FI',
'_103103010'=>'FJ',
'_103103011'=>'FK',
'_103103012'=>'FL',
'_103103013'=>'FM',
'_103103014'=>'FN',
'_103103015'=>'FO',
'_103103016'=>'FP',
'_103103017'=>'FQ',
'_103103018'=>'FR',
'_103103019'=>'FS',
'_103103020'=>'FT',
'_103103021'=>'FU',
'_103103022'=>'FV',
'_103103023'=>'FW',
'_103103024'=>'FX',
'_103103025'=>'FY',
'_103103026'=>'FZ',
'_103103027'=>'GA',
'_103103028'=>'GB',
'_103103029'=>'GC',
'_103103030'=>'GD',
'_103103031'=>'GE',
'_103103032'=>'GF',
'_103103033'=>'GG',
'_103103034'=>'GH',
'_103103035'=>'GI',
'_103103036'=>'GJ',
'_103103037'=>'GK',
'_103103038'=>'GL',
'_103103039'=>'GM',
'_103103040'=>'GN',
'_103103041'=>'GO',
'_103103042'=>'GP',
'_103103043'=>'GQ',
'_103103044'=>'GR',
'_103103045'=>'GS',
'_103103046'=>'GT',
'_103103047'=>'GU',
'_103103048'=>'GV',
'_103103049'=>'GW',
'_103103050'=>'HA',
'_103103051'=>'HB',
'_103103052'=>'HC',
'_103103053'=>'HD',
'_103103054'=>'HE',
'_103103055'=>'HF',
'_103103056'=>'HG',
'_103103057'=>'HH',
'_103103058'=>'HI',
'_103103059'=>'HJ',
'_103103060'=>'HK',
'_103103061'=>'HL',
'_103103062'=>'HM',
'_103103063'=>'HN',
'_103103064'=>'HP',
'_103103065'=>'HQ',
'_103104077'=>'A1',
'_103104078'=>'A2',
'_103104079'=>'A3',
'_103104080'=>'A4',
'_103104001'=>'KF',
'_103104002'=>'LP',
'_103104003'=>'0J',
'_103104004'=>'MY',
'_103104005'=>'NC',
'_103104006'=>'2E',
'_103104007'=>'0K',
'_103104008'=>'PD',
'_103104009'=>'PH',
'_103104010'=>'QX',
'_103104011'=>'ON',
'_103104012'=>'OP',
'_103104013'=>'OQ',
'_103104014'=>'OR',
'_103104015'=>'SM',
'_103104016'=>'SP',
'_103104017'=>'5R',
'_103104018'=>'5S',
'_103104019'=>'5T',
'_103104020'=>'5U',
'_103104021'=>'7B',
'_103104022'=>'TY',
'_103104023'=>'TZ',
'_103104024'=>'UA',
'_103104025'=>'UF',
'_103104026'=>'UH',
'_103104027'=>'UK',
'_103104028'=>'UM',
'_103104029'=>'UR',
'_103104030'=>'UV',
'_103104031'=>'VA',
'_103104032'=>'UY',
'_103104033'=>'UZ',
'_103104034'=>'VB',
'_103104035'=>'VN',
'_103104036'=>'VT',
'_103104037'=>'VU',
'_103104038'=>'VV',
'_103104039'=>'7Y1',
'_103104040'=>'7Z1',
'_103104041'=>'VG',
'_103104042'=>'VG1',
'_103104043'=>'VH',
'_103104044'=>'VH1',
'_103104045'=>'8A1',
'_103104046'=>'8B1',
'_103104047'=>'8C',
'_103104048'=>'8C1',
'_103104049'=>'8D',
'_103104050'=>'8D1',
'_103104051'=>'8E1',
'_103104052'=>'VW',
'_103104053'=>'VW1',
'_103104054'=>'VX',
'_103104055'=>'VX1',
'_103104056'=>'VQ',
'_103104057'=>'VQ1',
'_103104058'=>'8J1',
'_103104059'=>'VI',
'_103104060'=>'VI1',
'_103104061'=>'8K1',
'_103104062'=>'SZ1',
'_103104063'=>'8L1',
'_103104064'=>'VY',
'_103104065'=>'VZ',
'_103104066'=>'VZ1',
'_103104067'=>'VZ2',
'_103104068'=>'YQ',
'_103104069'=>'YR',
'_103104070'=>'YS',
'_103104071'=>'YT',
'_103104072'=>'YU',
'_103104073'=>'YV',
'_103104074'=>'YY',
'_103104075'=>'YZ',
'_103104076'=>'YP',
'_103104081'=>'CZ',
'_103104082'=>'KB',
'_103104083'=>'KC',
'_103104084'=>'KD',
'_103104085'=>'KE',
'_103104086'=>'LN',
'_103104087'=>'LO',
'_103104088'=>'LQ',
'_103104089'=>'LR',
'_103104090'=>'LS',
'_103104091'=>'0G',
'_103104092'=>'0H',
'_103104093'=>'NL',
'_103104094'=>'LT',
'_103104095'=>'LU',
'_103104096'=>'NO',
'_103104097'=>'LV',
'_103104098'=>'LW',
'_103104099'=>'NN',
'_103104100'=>'NG',
'_103104101'=>'NH',
'_103104102'=>'NM',
'_103104103'=>'NJ',
'_103104104'=>'NK',
'_103104105'=>'NP',
'_103104106'=>'0L',
'_103104107'=>'PA',
'_103104108'=>'PB',
'_103104109'=>'PC',
'_103104110'=>'PE',
'_103104111'=>'PF',
'_103104112'=>'PG',
'_103104113'=>'QU',
'_103104114'=>'QV',
'_103104115'=>'QW',
'_103104116'=>'Z91',
'_103104117'=>'Z92',
'_103104118'=>'SN',
'_103104119'=>'SP_1',
'_103104120'=>'SP_2',
'_103104121'=>'SR',
'_103104122'=>'TO',
'_103104123'=>'3Z',
'_103104124'=>'TS',
'_103104125'=>'TT',
'_103104126'=>'TU',
'_103104127'=>'4D',
'_103104128'=>'4H',
'_103104129'=>'4M',
'_103104130'=>'4S',
'_103104131'=>'4W',
'_103104132'=>'5A',
'_103104133'=>'5E',
'_103104134'=>'5K',
'_103104135'=>'5P',
'_103104136'=>'5Y',
'_103104137'=>'5Z',
'_103104138'=>'TV',
'_103104139'=>'TW',
'_103104140'=>'TX',
'_103104141'=>'6A',
'_103104142'=>'6B',
'_103104143'=>'6C',
'_103104144'=>'6D',
'_103104145'=>'6E',
'_103104146'=>'6F',
'_103104147'=>'6G',
'_103104148'=>'6H',
'_103104149'=>'02',
'_103104150'=>'03',
'_103104151'=>'04',
'_103104152'=>'05',
'_103104153'=>'06',
'_103104154'=>'07',
'_103104155'=>'08',
'_103104156'=>'09',
'_103104157'=>'6N',
'_103104158'=>'6P',
'_103104159'=>'6R',
'_103104160'=>'6S',
'_103104161'=>'6T',
'_103104162'=>'6U',
'_103104163'=>'6V',
'_103104164'=>'6W',
'_103104165'=>'6X',
'_103104166'=>'6Y',
'_103104167'=>'6Z',
'_103104168'=>'7A',
'_103104169'=>'7C',
'_103104170'=>'UB',
'_103104171'=>'UC',
'_103104172'=>'UD',
'_103104173'=>'UE',
'_103104174'=>'UG',
'_103104175'=>'UJ',
'_103104176'=>'UL',
'_103104177'=>'UP',
'_103104178'=>'UT',
'_103104179'=>'UX',
'_103104180'=>'UQ',
'_103104181'=>'UU',
'_103104182'=>'VM',
'_103104183'=>'VP',
'_103104184'=>'VC',
'_103104185'=>'VR',
'_103104186'=>'VS',
'_103104187'=>'7Y',
'_103104188'=>'7Y2',
'_103104189'=>'7Z',
'_103104190'=>'7Z2',
'_103104191'=>'VG2',
'_103104192'=>'VH2',
'_103104193'=>'8A',
'_103104194'=>'8A2',
'_103104195'=>'8B',
'_103104196'=>'8B2',
'_103104197'=>'8C2',
'_103104198'=>'8D2',
'_103104199'=>'8E',
'_103104200'=>'8E2',
'_103104201'=>'VW2',
'_103104202'=>'VX2',
'_103104203'=>'VQ2',
'_103104204'=>'8J',
'_103104205'=>'8J2',
'_103104206'=>'8J3',
'_103104207'=>'VI2',
'_103104208'=>'VI3',
'_103104209'=>'8K',
'_103104210'=>'8K2',
'_103104211'=>'SZ',
'_103104212'=>'SZ2',
'_103104213'=>'8L',
'_103104214'=>'8L2',
'_103104215'=>'VJ',
'_103104216'=>'VK',
'_103104217'=>'ZE',
'_103104218'=>'XQ',
'_103104219'=>'SS',
'_103104220'=>'ST',
'_103104221'=>'ZJ',
'_103104222'=>'YW',
'_103104223'=>'9Z',
'_103104224'=>'YX',
'_103104225'=>'9X',
'_103102037'=>'B1',
'_103102038'=>'EJ',
);
include_once(FWK_PATH.'common/curl.php');
define('RNCS_WS_URL', 'http://www.services.ort.fr/ProtocoleRNCS/access');
define('RNCS_WS_USER', '167260');
define('RNCS_WS_PASS', '100356');
class MRncsFlux {
public $body = '';
public $header = '';
public $codeRetour = 0;
public $errMsgInpi='';
public $errNumInpi='';
public $cookie='';
public $iDb;
public $tabVitrine=array();
public $tabFctDir=array( 100 =>array('codeSd'=>'1300', 'lib'=>'Président'),
110 =>array('codeSd'=>'1306', 'lib'=>'Président du conseil d\'administration'),
120 =>array('codeSd'=>'1301', 'lib'=>'Président directeur Général'),
140 =>array('codeSd'=>'1650', 'lib'=>'Gouverneur'),
150 =>array('codeSd'=>'1651', 'lib'=>'Sous-gouverneur'),
200 =>array('codeSd'=>'0900', 'lib'=>'Gérant'),
210 =>array('codeSd'=>'0912', 'lib'=>'Gérant non associé'),
300 =>array('codeSd'=>'0400', 'lib'=>'Co-gérant'),
400 =>array('codeSd'=>'0709', 'lib'=>'Directeur général'),
410 =>array('codeSd'=>'0713', 'lib'=>'Directeur général non administrateur'),
420 =>array('codeSd'=>'0708', 'lib'=>'Directeur général unique'),
430 =>array('codeSd'=>'0704', 'lib'=>'Directeur général délégué'),
500 =>array('codeSd'=>'1800', 'lib'=>'Vice-président'),
600 =>array('codeSd'=>'0100', 'lib'=>'Administrateur'),
610 =>array('codeSd'=>'0101', 'lib'=>'Administrateur délégué'),
700 =>array('codeSd'=>'1308', 'lib'=>'Président du directoire'),
900 =>array('codeSd'=>'1307', 'lib'=>'Président du conseil de surveillance'),
1200=>array('codeSd'=>'0209', 'lib'=>'Associé-gérant'),
1300=>array('codeSd'=>'0603', 'lib'=>'Contrôleur de gestion'),
4100=>array('codeSd'=>'1900', 'lib'=>'Liquidateur'),
4300=>array('codeSd'=>'0108', 'lib'=>'Administrateur provisoire'),
4400=>array('codeSd'=>'1401', 'lib'=>'Représentant en France d\'une société étrangère'),
);
public $tabErreurInpi=array(0=>"Aucune erreur",
10=>"Erreur de protocole avec système distant",
11=>"Système distant inaccessible",
101=>"Type de requête invalide",
102=>"Code d'erreur appelant invalide",
103=>"Identification non reconnue",
107=>"Date invalide",
108=>"Heure invalide",
110=>"Code produit inconnu",
115=>"Numéro de champ invalide",
116=>"Longueur de champ invalide",
121=>"Code de protocole invalide",
122=>"Code base de données invalide",
900=>"Erreur applicative",
990100=>"+ de 50 entreprises trouvées",
990101=>"Recherche complexe",
990102=>"Critères saisis insuffisants",
990103=>"Requête trop imprécise",
990104=>"Dénomination non significative",
990105=>"Critère commune non générall",
990106=>"Critère voie trop général",
990107=>"Commune obligatoire avec rue",
990108=>"Commune non identifiée",
990109=>"Entreprise non identifiée",
990110=>"Erreur système",
990111=>"Devise incorrecte",
990112=>"Autre erreur",
990113=>"Donnée incorrecte",
990114=>"Valeur incohérente",
990115=>"Surveillance impossible",
990116=>"Entreprise non surveillée",
990117=>"Entreprise déjà surveillée",
990118=>"Produit indisponible",
990119=>"Erreur base de données",
990120=>"Erreur facturation",
);
function __construct() {
$this->iDb=new WDB();
}
function getVitrine($siren) {
$this->tabVitrine=$this->query($siren, array('Type'=>'QVIT'));
return $this->tabVitrine;
}
/*
$cmdPages=$cmdNom='';
if (isset($_REQUEST['pages'])) $cmdPages=$_REQUEST['pages'];
if (isset($_REQUEST['nom'])) $cmdNom=$_REQUEST['nom'];
if (isset($_REQUEST['vue'])) $vue=$_REQUEST['vue'];
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='';
*/
public function query($siren, $prod=array()) {
/*$prod=array('Type'=>$type,
'Presta'=>$presta,
'Siren'=>$siren,
'CmdNom'=>$cmdNom,
'CmdPages'=>$cmdPages,
'CmdBilan'=>'',
'Ref'=>'',
);
*/
$option='';
if ( ($prod['Type']=='QDOC' || $prod['Presta']==12004 || $prod['Presta']==12003) && !isset($prod['Num'])) {
$prod['Num']=2;
$prod['Ver']=2;
} elseif (!isset($prod['Num'])) {
$prod['Num']=1;
$prod['Ver']=3;
}
$req= ''. "\n".
'