2012-07-28 14:21:05 +02:00
|
|
|
|
#!/usr/bin/php -c/var/www/batch/config/php_batch_sd.ini
|
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/** @todo Faire tourner le premier lundi du mois
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
|
|
function exporte($txt, $lon=-1, $sep="|") {
|
2013-06-19 10:24:49 +02:00
|
|
|
|
$txt=strtr(trim($txt),array('''=>"'",'&'=>'&', '²'=>'<27>', "\r"=>'', "\n"=>'', "\t"=>''));
|
2012-07-28 14:21:05 +02:00
|
|
|
|
|
|
|
|
|
if ($lon==-1) return $txt.$sep;
|
|
|
|
|
elseif ($sep=='') return sprintf("%-".$lon.'.'.$lon."s", $txt);
|
|
|
|
|
else return trim(sprintf("%-".$lon.'.'.$lon."s", $txt)).$sep;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function choixAdr($bodEtab, $bodSiege, $insee) {
|
|
|
|
|
|
|
|
|
|
if (strlen(trim($bodSiege))>0) $adr=trim($bodSiege);
|
|
|
|
|
elseif (strlen(trim($bodEtab))>0) $adr=trim($bodEtab);
|
|
|
|
|
else $adr='';
|
|
|
|
|
|
|
|
|
|
if (isset($insee) && trim($insee)<>'') return $insee;
|
|
|
|
|
else return $adr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
error_reporting(E_ALL);
|
|
|
|
|
|
|
|
|
|
include_once(FWK_PATH.'common/chiffres.php');
|
|
|
|
|
include_once(FWK_PATH.'common/dates.php');
|
|
|
|
|
include_once(INCLUDE_PATH.'partenaires/classMBilans.php');
|
|
|
|
|
include_once(INCLUDE_PATH.'insee/classMInsee.php');
|
|
|
|
|
include_once(INCLUDE_PATH.'scores/classMFinancier.php');
|
|
|
|
|
include_once(INCLUDE_PATH.'scores/classMScores.php');
|
|
|
|
|
include_once(FWK_PATH.'mail/sendMail.php');
|
|
|
|
|
include_once(INCLUDE_PATH.'partenaires/classMLiens.php');
|
|
|
|
|
|
|
|
|
|
$iDb=new WDB('jo');
|
|
|
|
|
|
|
|
|
|
$iInsee=new MInsee();
|
|
|
|
|
|
2013-06-19 10:24:49 +02:00
|
|
|
|
$strInfoScript='Usage : '.basename($argv[0]). " [OPTION] [Stock Adecco <20> charger]
|
|
|
|
|
Traitement sp<EFBFBD>cifique Kompass.
|
2012-07-28 14:21:05 +02:00
|
|
|
|
|
|
|
|
|
Options :
|
2013-06-19 10:24:49 +02:00
|
|
|
|
-1 Prestation 1 Mise <EFBFBD> disposition du stock des Entrep Risques Fort
|
|
|
|
|
-3 Prestation 3 Transformation de la surveillance Bodacc en sp<EFBFBD>cifique Kompass
|
|
|
|
|
-4 Prestation 4 Mise <EFBFBD> disposition de la base Liens
|
|
|
|
|
-5 Prestation 5 Mise <EFBFBD> disposition de la base Ratios
|
|
|
|
|
-v Verbosit<EFBFBD> maximum
|
2012-07-28 14:21:05 +02:00
|
|
|
|
";
|
|
|
|
|
|
|
|
|
|
$argv=$_SERVER['argv'];
|
|
|
|
|
if ($_SERVER['argc']>1)
|
|
|
|
|
{
|
|
|
|
|
for ($i=1; isset($argv[$i]); $i++) {
|
|
|
|
|
if (substr($argv[$i],0,1)=='-') {
|
|
|
|
|
switch (strtolower(substr($argv[$i],1,1))) {
|
|
|
|
|
case '1': $presta=1; break;
|
|
|
|
|
case '3': $presta=3; break;
|
|
|
|
|
case '4': $presta=4; break;
|
|
|
|
|
case '5': $presta=5; break;
|
|
|
|
|
case '-':
|
|
|
|
|
case '?': die($strInfoScript); break;
|
|
|
|
|
default: die('Option '. $argv[$i] . " inconnue !\n");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
} else $tabFichier[]=$argv[$i];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$tabLignes=file($tabFichier[0]);
|
|
|
|
|
|
|
|
|
|
$iTel=new MTel(false);
|
|
|
|
|
|
|
|
|
|
foreach ($tabLignes as $i=>$ligne) {
|
|
|
|
|
$tmp1=explode("\t", $ligne);
|
|
|
|
|
$siren=trim($tmp1[0]);
|
|
|
|
|
$nic=trim($tmp1[1]);
|
|
|
|
|
//$tmp1=$iTel->getTel($siren);
|
|
|
|
|
$tmp=$iTel->getTel($siren, $nic);
|
|
|
|
|
//echo "$siren $nic".EOL;
|
|
|
|
|
if (count($tmp)==0) echo "$siren,$nic".EOL;
|
|
|
|
|
else {
|
|
|
|
|
$tel=$mob=$ttel='';
|
|
|
|
|
foreach ($tmp as $tmp2) {
|
|
|
|
|
if ($tmp2['typeTel']=='tel' && $tmp2['telephone']>=600000000 && $tmp2['telephone']<800000000) {
|
|
|
|
|
$mob=implode('.', str_split($tmp2['telephone'],2));
|
|
|
|
|
$ttel='M';
|
|
|
|
|
} elseif ($tmp2['typeTel']=='tel') {
|
|
|
|
|
$tel=implode('.', str_split($tmp2['telephone'],2));
|
|
|
|
|
$ttel='F';
|
|
|
|
|
} elseif ($tmp2['typeTel']=='mob' && $tmp2['telephone']>=600000000 && $tmp2['telephone']<800000000) {
|
|
|
|
|
$mob=implode('.', str_split($tmp2['telephone'],2));
|
|
|
|
|
$ttel='M';
|
|
|
|
|
} elseif ($tmp2['typeTel']=='mob') {
|
|
|
|
|
$tel=implode('.', str_split($tmp2['telephone'],2));
|
|
|
|
|
$ttel='F';
|
|
|
|
|
} elseif ($tmp2['typeTel']=='fax' && $tmp2['telephone']>=600000000 && $tmp2['telephone']<800000000) {
|
|
|
|
|
$mob=implode('.', str_split($tmp2['telephone'],2));
|
|
|
|
|
$ttel='M';
|
|
|
|
|
}
|
|
|
|
|
//if ($tmp2['typeTel']=='fax')
|
|
|
|
|
// $fax=implode('.', str_split($tmp2['telephone'],2));
|
|
|
|
|
/*if ($tmp2['typeTel']=='web' && $tab['web']=='') $tab['web']=$tmp2['infoTel'];
|
|
|
|
|
if ($tmp2['typeTel']=='mail' && $tab['mail']=='') $tab['mail']=$tmp2['infoTel'];
|
|
|
|
|
if ($tmp2['typeTel']=='an8') $activitePJ_An8=$tmp2['infoTel'];*/
|
|
|
|
|
|
|
|
|
|
if ($tel<>'' && $mob<>'') break;//$ttel<>'')
|
|
|
|
|
}
|
|
|
|
|
echo "$siren,$nic,$tel,$mob".EOL;
|
|
|
|
|
}
|
|
|
|
|
//print_r($tmp);
|
|
|
|
|
//die();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* $activitePJ_An8='';
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
die();
|
|
|
|
|
|
|
|
|
|
?>
|