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