SFR : Nom de prestation + données entrantes du fichier

This commit is contained in:
Michael RICOIS 2013-08-26 09:46:25 +00:00
parent 13c820611f
commit 56b16977cc

View File

@ -92,7 +92,7 @@ $fileErrorOptionsOut = array(
$client = 'SFR';
$typeDepot = 'SFTP';
$prestation = 'FICH_RCE';
// => Manual Mode
if ( $opts->manual ) {
@ -142,17 +142,18 @@ else {
//Read file
$result = execFileIn($filepath, $fileOptionsIn, array('ok'=>$fileOkOptionsOut, 'error'=>$fileErrorOptionsOut));
$rows = 0;
foreach($result as $code => $file) {
$dateBegin = date('YmdHis');
$filename = $file['name'] . $dateBegin . '.csv';
execFileOut($pathOut . DIRECTORY_SEPARATOR . $filename, $file);
$rows = execFileOut($pathOut . DIRECTORY_SEPARATOR . $filename, $file);
$dateEnd = date('YmdHis');
$fluxoutM->insert(array(
'client' => $client,
'name' => $name,
'name' => $prestation,
'nbLines' => $rows,
'dateBegin' => $dateBegin,
'dateEnd' => $dateEnd,
@ -202,16 +203,21 @@ function execInternal($values, $row, $debug = false)
echo " - Erreur 1020.".PHP_EOL;
}
if ($error == 0 ){
if ($error == 0 ) {
//Calculate data
require_once 'Metier/Sfr/Sfr.php';
$sfrM = new Metier_Sfr();
//Set Values
$sfrM->setVal('ValContratDate', $values['dateContrat']);
$sfrM->setVal('ValIR', $values['ir']);
//Evaluate
$sfrM->evaluate($siren);
$values['idVOR'] = $sfrM->getIndicateur();
$values['commentaire'] = $sfrM->getComment();
$values['PO'] = $sfrM->getPo();
if ($debug) {
$valuesDebug = $sfrM->getValDebug();
$values = array_merge($values, $valuesDebug);
@ -231,9 +237,9 @@ function execInternal($values, $row, $debug = false)
/**
*
* @param unknown $filepath
* @param unknown $fileOptionsIn
* @param unknown $filesOptionsOut
* @param string $debug
* @param array $fileOptionsIn
* @param array $filesOptionsOut
* @param boolean $debug
* @return Ambigous <multitype:, unknown, number, unknown, string, mixed, NULL>
*/
function execFileIn($filepath, $fileOptionsIn, $filesOptionsOut = array(), $debug = false)
@ -337,6 +343,8 @@ function execFileOut($file, $options)
}
}
fclose($fp);
return count($options['line']);
}