67 lines
1.8 KiB
PHP
67 lines
1.8 KiB
PHP
|
#!/usr/bin/php
|
||
|
<?php
|
||
|
|
||
|
// Paramètres
|
||
|
if ( ( $argc < 5 )
|
||
|
|| in_array($argv[1], array('--help', '-help', '-h', '-?')) ) {
|
||
|
?>
|
||
|
Reprise de commande InfoGreffe courrier
|
||
|
|
||
|
Avec les options --help, -help, -h, et -?, vous obtiendrez cette aide.
|
||
|
|
||
|
Utilisation :
|
||
|
<?php echo $argv[0]; ?> /chemin/vers/fichier.csv [colonne identifiant] [colonne siren] [colonne ref]
|
||
|
<?php
|
||
|
exit;
|
||
|
}
|
||
|
|
||
|
$fichier = $argv[1];
|
||
|
$colNumId = $argv[2];
|
||
|
$colNumSiren = $argv[3];
|
||
|
$colNumRef = $argv[4];
|
||
|
|
||
|
require_once realpath(dirname(__FILE__)).'/../config/prepend.php';
|
||
|
require_once realpath(dirname(__FILE__)).'/../framework/common/dates.php';
|
||
|
require_once realpath(dirname(__FILE__)).'/../includes/infogreffe/infogreffews.php';
|
||
|
|
||
|
$typeCommande = 'C';
|
||
|
|
||
|
$row = 1;
|
||
|
if (($handle = fopen($fichier, 'r')) !== FALSE) {
|
||
|
while (($data = fgetcsv($handle, 10000, ';')) !== FALSE) {
|
||
|
$num = count($data);
|
||
|
echo "Ligne $row \n";
|
||
|
$row++;
|
||
|
for ($c=0; $c < $num; $c++) {
|
||
|
if ($colNumId == $c){ $idCommande = $data[$c]; }
|
||
|
if ($colNumSiren == $c){ $siren = $data[$c]; }
|
||
|
if ($colNumRef == $c){ $ref = $data[$c]; }
|
||
|
}
|
||
|
//Traitement
|
||
|
//Bilan
|
||
|
if( preg_match('/^([0-9]{4}_).*?$/', $ref, $matches) ){
|
||
|
//getGreffeBilans($siren, $typeCommande, $ref, $idCommande);
|
||
|
$type = 'BI';
|
||
|
//Status à jour
|
||
|
} elseif (substr($ref,0,3)=='ST-'){
|
||
|
//getGreffeStatut($siren, $typeCommande, $ref, $idCommande);
|
||
|
$type = 'ST';
|
||
|
//Actes
|
||
|
} else {
|
||
|
//getGreffeActes($siren, $typeCommande, $ref, $idCommande);
|
||
|
$type = 'AC';
|
||
|
}
|
||
|
$xmlRequete = infogreffe_requetexml($siren, $idCommande, $type, $typeCommande, $ref);
|
||
|
file_put_contents('./error/'.$siren.'-'.$ref.'.query', $xmlRequete);
|
||
|
$xmlReponse = infogreffe_getproduitsxml($xmlRequete);
|
||
|
file_put_contents('./error/'.$siren.'-'.$ref.'.xml', $xmlReponse);
|
||
|
}
|
||
|
fclose($handle);
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|