From 1b45991ab2f1c8648c058be26e83fa6481f5e8e0 Mon Sep 17 00:00:00 2001 From: Michael RICOIS Date: Mon, 30 Jan 2012 21:09:14 +0000 Subject: [PATCH] Diverses corrections --- batch/enrichissement.php | 33 +++++++++++++++--------------- config/stockage.php | 19 ++--------------- library/framework/common/mysql.php | 3 ++- 3 files changed, 20 insertions(+), 35 deletions(-) diff --git a/batch/enrichissement.php b/batch/enrichissement.php index 3b2d7143..2ea14eb2 100644 --- a/batch/enrichissement.php +++ b/batch/enrichissement.php @@ -6,7 +6,7 @@ defined('APPLICATION_PATH') // Define application environment defined('APPLICATION_ENV') - || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production')); + || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'development')); // Ensure library/ is on include_path set_include_path(implode(PATH_SEPARATOR, array( @@ -407,7 +407,7 @@ if ($opts->id) { } foreach($tabIdentifiant as $item) { - echo "Ligne $row+1\n"; + echo "Ligne ".($row+1)."\n"; $siretValide = false; $sirenValide = false; @@ -700,15 +700,13 @@ function bilanNEntete($values) function bilanNData($siren, $nic, $values = false) { require_once 'Metier/partenaires/classMBilans.php'; - $tabPostes = explode(',', $values); - + $tabPostes = explode(',', $values); $annee = 0; $tabData = array(); $mBil = new MBilans($siren); $tabBilans = $mBil->listeBilans(false, 9); - print_r($tabBilans); if (count($tabBilans)>0) { - $tabBi = findBilan($tabBilans, $annee); + $tabBi = findBilan($siren, $tabBilans, $annee); $tabData['bilanNdateCloture'] = $tabBi['DATE_CLOTURE']; $tabData['bilanNdureeMois'] = $tabBi['DUREE_MOIS']; if (count($tabPostes)>0) { @@ -742,13 +740,12 @@ function bilanN1Data($siren, $nic, $values = false) { require_once 'Metier/partenaires/classMBilans.php'; $tabPostes = explode(',', $values); - $annee = 1; $tabData = array(); $mBil = new MBilans($siren); $tabBilans = $mBil->listeBilans(false, 9); if (count($tabBilans)>0) { - $tabBi = findBilan($tabBilans, $annee); + $tabBi = findBilan($siren, $tabBilans, $annee); $tabData['bilanNdateCloture'] = $tabBi['DATE_CLOTURE']; $tabData['bilanNdureeMois'] = $tabBi['DUREE_MOIS']; if (count($tabPostes)>0) { @@ -782,13 +779,12 @@ function bilanN2Data($siren, $nic, $values = false) { require_once 'Metier/partenaires/classMBilans.php'; $tabPostes = explode(',', $values); - $annee = 2; $tabData = array(); $mBil = new MBilans($siren); $tabBilans = $mBil->listeBilans(false, 9); if (count($tabBilans)>0) { - $tabBi = findBilan($tabBilans, $annee); + $tabBi = findBilan($siren, $tabBilans, $annee); $tabData['bilanNdateCloture'] = $tabBi['DATE_CLOTURE']; $tabData['bilanNdureeMois'] = $tabBi['DUREE_MOIS']; if (count($tabPostes)>0) { @@ -802,16 +798,19 @@ function bilanN2Data($siren, $nic, $values = false) return $tabData; } -function findBilan($tabBilans, $position = 0) +function findBilan($siren, $tabBilans, $position = 0) { + require_once 'Metier/partenaires/classMBilans.php'; + $mBil = new MBilans($siren); //Trier et Supprimer les bilans consolidés $tabBilN = $tabBilS = array(); - foreach ($tabBilans as $typeMil => $bilan) { - $annee = substr($typeMil,1); - if (substr($typeMil,0,1)=='N'){ - $tabBilN[$annee] = $mBil->getBilan(substr($typeMil,1), substr($typeMil,0,1)); - } elseif (substr($typeMil,0,1)=='S'){ - $tabBilS[$annee] = $mBil->getBilan(substr($typeMil,1), substr($typeMil,0,1)); + foreach ($tabBilans as $typeMil => $bilan) { + $temp = $mBil->getBilan(substr($typeMil,1), substr($typeMil,0,1)); + $annee = $bilan['millesime']; + if (substr($typeMil,0,1)=='N') { + $tabBilN[$annee] = $temp; + } elseif (substr($typeMil,0,1)=='S') { + $tabBilS[$annee] = $temp; } } $tabBil = $tabBilN + $tabBilS; //On comble les trous par des bilans simplifié diff --git a/config/stockage.php b/config/stockage.php index 9ee09d40..703fbbef 100644 --- a/config/stockage.php +++ b/config/stockage.php @@ -1,23 +1,8 @@ database=MYSQL_DEFAULT_DB; else $this->database=$database; - if (defined(MYSQL_PORT)) $this->host = $this->host.':'.MYSQL_PORT; + //if (defined(MYSQL_PORT)) $this->host = $this->host.':'.MYSQL_PORT; + $this->host = $this->host.':53336'; $this->con_id = mysql_connect($this->host, $this->user, $this->password); if (!($this->con_id === false)) {