Integrate change in trunk

This commit is contained in:
Michael RICOIS 2013-05-15 10:18:51 +00:00
parent 0e21cd6d87
commit da516375cc
6 changed files with 41 additions and 46 deletions

View File

@ -62,6 +62,9 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
'scan' => Zend_Translate::LOCALE_DIRECTORY
)
);
//Always fallback to 'fr'
$translate->setLocale('fr');
$registry->set('Zend_Translate', $translate);
return $registry;

View File

@ -955,9 +955,9 @@ class FinanceController extends Zend_Controller_Action
public function bourseAction()
{
require_once 'Scores/Logo.php';
$siren = substr($this->siret, 0, 9);
$urlImg = new Logo($siren);
$sessionEntreprise = new SessionEntreprise($this->siret, $this->id);

View File

@ -4,22 +4,17 @@ class Application_Controller_Plugin_Language extends Zend_Controller_Plugin_Abst
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$registry = Zend_Registry::getInstance();
$session = new Zend_Session_Namespace('Zend_Auth');
$translate = $registry->get('Zend_Translate');
$currLocale = $translate->getLocale();
$user = new Scores_Utilisateur();
if ( $user->isLog() ) {
$lang = $request->getParam('lang', '');
switch ($lang) {
case "fr":
$langLocale = 'fr';
break;
switch ($user->getLang()) {
case "en":
$langLocale = 'en';
break;
default:
$langLocale = $session->lang !='' ? $session->lang : $user->getLang();
case "fr":
default:
$langLocale = 'fr';
}
} else {
$langLocale = 'fr';
@ -30,23 +25,7 @@ class Application_Controller_Plugin_Language extends Zend_Controller_Plugin_Abst
$registry->set('Zend_Locale', $newLocale);
$translate->setLocale($langLocale);
$this->setSessionLang($langLocale);
$registry->set('Zend_Translate', $translate);
}
/**
* Save new lang value into session
* @param string $lang
*/
protected function setSessionLang($lang)
{
$authStorage = Zend_Auth::getInstance()->getStorage();
$authData = $authStorage->read();
if($authData)
{
$authData->lang = $lang;
$authStorage->write($authData);
}
}
}

View File

@ -1,7 +1,7 @@
<?php
class Liasse
{
protected $postes = array();
protected $info = array();
protected $div;
@ -10,13 +10,13 @@ class Liasse
'K' => 1000,
'M' => 1000000,
);
public function __construct($liasse, $unit = 'K')
{
$this->div = $this->unit[$unit];
$this->setData($liasse);
}
protected function setData($data)
{
$this->info = array(
@ -31,15 +31,26 @@ class Liasse
'consolide' => $data->CONSOLIDE,
'source' => $data->SOURCE,
);
//Affectaction des postes
foreach ($data->POSTES->item as $element){
$this->postes[$element->id] = $this->dMontant($element->val);
if (in_array(array(
'YP', 'YP1', '376', // Effectifs 2033 et 2050
'M2G', 'M2H', // Autres effectifs
'ZK', 'ZK1', // Taux
'IJ', 'JG', 'JH', 'JJ', 'ZR', // pour holding/ste mere
'XP' //numero de centre de gestion agréé
), $element->id))
{
$this->postes[$element->id] = $element->val;
} else {
$this->postes[$element->id] = $this->dMontant($element->val);
}
}
//Transformation Simplifié en Normal
if ( $data->CONSOLIDE == 'S'){
$this->postes = $this->bilanSimplifie2Normal($this->postes);
$this->postes = $this->bilanSimplifie2Normal($this->postes);
}
}
@ -47,18 +58,18 @@ class Liasse
{
return $this->info[$key];
}
public function getPostes()
{
return $this->postes;
}
protected function dMontant($montant)
{
return number_format($montant/$this->div, 0, '', ' ');
}
function bilanSimplifie2Normal($bilanRS)
function bilanSimplifie2Normal($bilanRS)
{
$tabBS2BN = array(
'AH'=>'010',
@ -167,7 +178,7 @@ class Liasse
'YZ'=>'378',
'YP'=>'376',
);
$bilanRN=array();
foreach ($tabBS2BN as $posteRN => $formule) {
if (preg_match('/\+|\-/', $formule)) {
@ -198,24 +209,24 @@ class Liasse
$bilanRN['BN']=$bilanRS['050'];
$bilanRN['BO']=$bilanRS['052'];
}
if ($bilanRS['070']<>0 || $bilanRS['074']<>0 || $bilanRS['052']<>0 || $bilanRS['062']<>0)
$bilanRN['GC']=$bilanRS['256'];
elseif ($bilanRS['070']==0 && $bilanRS['074']==0 && $bilanRS['052']==0 && $bilanRS['062']==0 && $bilanRS['254']<>0)
$bilanRN['GD']=$bilanRS['256'];
if ($bilanRS['584']<>0) {
$bilanRN['HB']=$bilanRS['584'];
$bilanRN['HA']=$bilanRS['290']-$bilanRS['584'];
} else
$bilanRN['HA']=$bilanRS['290'];
if ($bilanRS['582']<>0) {
$bilanRN['HF']=$bilanRS['582'];
$bilanRN['HE']=$bilanRS['582']-$bilanRS['300'];
} else
$bilanRN['HE']=$bilanRS['300'];
return $bilanRN;
}
}

View File

@ -82,7 +82,7 @@ if ( isset($opts->reprise) )
$fichier = $infogreffe->acteFilename($cmd->siren, $cmd->ref);
break;
case 'bilan':
$path = $infogreffe->bilanPath($cmd->ref);
$path = $infogreffe->bilanPath('0000_'.$cmd->ref);
$fichier = $infogreffe->bilanFilename($cmd->siren, '0000_'.$cmd->ref);
break;
}
@ -143,8 +143,10 @@ if ( isset($opts->rapport) || isset($opts->rapportcomplet) )
$fichier = $infogreffe->acteFilename($cmd->siren, $cmd->ref);
break;
case 'bilan':
$path = $infogreffe->bilanPath($cmd->ref);
$fichier = $infogreffe->bilanFilename($cmd->siren, $cmd->ref);
$fichier = $infogreffe->bilanFilename($cmd->siren, $cmd->ref);
break;
}
//Le fichier existe, alors on a résolu le problème (mauellement ?)

View File

@ -58,7 +58,7 @@ $tempDirs = array(
),
'files' => array(
'path' => $c->profil->path->files,
'files' => array('*.pdf', '*.jpeg', '*.jpg', '*.csv', '*.xls','*.xml')
'files' => array('*.pdf', '*.jpeg', '*.jpg', '*.csv', '*.csv.bz2', '*.xls','*.xml')
),
'pages' => array(
'path' => $c->profil->path->pages,