batch/build/clientSfrDebugScore.php
Michael RICOIS 627c5f1f56 PHP-CS-Fixer
2016-11-29 16:59:35 +01:00

56 lines
1.6 KiB
PHP

<?php
// --- Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(__DIR__ . '/../application'));
// --- Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
// --- Composer autoload
require_once realpath(__DIR__ . '/../vendor/autoload.php');
// Create application, bootstrap, and run
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
require_once APPLICATION_PATH.'/configs/config.php';
require_once 'framework/fwk.php';
require_once 'framework/common/chiffres.php';
require_once 'framework/common/dates.php';
require_once 'framework/mail/sendMail.php';
require_once 'framework/common/mysql.php';
$c = new Zend_Config($application->getOptions());
$db = Zend_Db::factory($c->profil->db->metier);
Zend_Db_Table_Abstract::setDefaultAdapter($db);
$fp = fopen('return.csv', 'w');
if (($handle = fopen('sfrFeuBicolore201511.csv', 'r')) !== false) {
$row = 0;
while (($data = fgetcsv($handle, 0, ",", '"')) !== false) {
$row++;
echo date('Y-m-d H:i:s')." - Ligne $row : ";
//Set values from file
$values = array();
$siren = $data[0];
echo $siren;
$sfr = new Metier_Sfr_Scoring('1.3');
$sfr->evaluate($siren);
$indicateur = $sfr->getIndicateur();
$po = $sfr->getPo();
$comment = $sfr->getComment();
fputcsv($fp, array($siren, $indicateur, $po, $comment), ',', '"');
echo "\n";
}
}
fclose($handle);
fclose($fp);