Autoloading : Session Entreprise

This commit is contained in:
Michael RICOIS 2013-11-21 13:23:06 +00:00
parent e85d54a986
commit 4509af069e
11 changed files with 53 additions and 84 deletions

View File

@ -11,7 +11,6 @@ class DirigeantController extends Zend_Controller_Action
$this->id = $request->getParam('id', 0);
require_once 'Scores/WsScores.php';
require_once 'Scores/SessionEntreprise.php';
}
/**
@ -34,7 +33,7 @@ class DirigeantController extends Zend_Controller_Action
$dirigeants = $infos->result->item;
$user = new Scores_Utilisateur();
$session = new SessionEntreprise($this->siret, $this->id);
$session = new Scores_Session_Entreprise($this->siret, $this->id);
if ($user->checkPerm('dirigeantsop')){
$href = $this->view->url(array('controller'=>'dirigeant', 'action'=>'op', 'siret'=>$this->siret));
@ -73,7 +72,7 @@ class DirigeantController extends Zend_Controller_Action
$dirigeants = $infos->result->item;
$session = new SessionEntreprise($this->siret, $this->id);
$session = new Scores_Session_Entreprise($this->siret, $this->id);
$this->view->assign('dirigeants', $dirigeants);
$this->view->assign('exportObjet', $dirigeants);
@ -102,7 +101,7 @@ class DirigeantController extends Zend_Controller_Action
$dirigeants = $infos->item;
$session = new SessionEntreprise($this->siret, $this->id);
$session = new Scores_Session_Entreprise($this->siret, $this->id);
$this->view->assign('siren', $siren);
$this->view->assign('siret', $this->siret);

View File

@ -11,7 +11,6 @@ class EvaluationController extends Zend_Controller_Action
$this->id = $request->getParam('id', 0);
require_once 'Scores/WsScores.php';
require_once 'Scores/SessionEntreprise.php';
require_once 'Scores/IdentiteEntreprise.php';
}
@ -113,7 +112,7 @@ class EvaluationController extends Zend_Controller_Action
$siren = substr($this->siret,0,9);
$ws = new WsScores();
$entreprise = new SessionEntreprise($this->siret, $this->id);
$entreprise = new Scores_Session_Entreprise($this->siret, $this->id);
$identite = $ws->getIdentite($siren);
$indiscore = $ws->getIndiScore($siren);
$infos = $ws->getRatios($siren, 'indiscore2'); // @todo : vérifier la page
@ -277,7 +276,7 @@ class EvaluationController extends Zend_Controller_Action
));
}
$sessionEntreprise = new SessionEntreprise($this->siret, $this->id);
$sessionEntreprise = new Scores_Session_Entreprise($this->siret, $this->id);
$ws = new WsScores();
$siren = substr($this->siret,0,9);
@ -360,7 +359,7 @@ class EvaluationController extends Zend_Controller_Action
$this->view->assign('siret', $this->siret);
$this->view->assign('id', $this->id);
$sessionEntreprise = new SessionEntreprise($this->siret, $this->id);
$sessionEntreprise = new Scores_Session_Entreprise($this->siret, $this->id);
$this->view->assign('rs', $sessionEntreprise->getRaisonSociale());
} else {
@ -787,7 +786,7 @@ class EvaluationController extends Zend_Controller_Action
if (!empty($companyname)) {
$this->view->raisonSociale = $companyname;
} else {
$session = new SessionEntreprise($this->siret, $this->id);
$session = new Scores_Session_Entreprise($this->siret, $this->id);
$this->view->raisonSociale = $session->getRaisonSociale();
}
$this->view->emailCommande = $user->getEmail();
@ -848,7 +847,7 @@ class EvaluationController extends Zend_Controller_Action
if(!$user->checkPerm('INDISCORE3') && !$user->checkPerm('INDISCORE3P'))
$this->_forward('perms', 'error');
$sessionEntreprise = new SessionEntreprise($this->siret, $this->id);
$sessionEntreprise = new Scores_Session_Entreprise($this->siret, $this->id);
$ws = new WsScores();
$siren = substr($this->siret,0,9);

View File

@ -6,7 +6,6 @@ class FinanceController extends Zend_Controller_Action
public function init()
{
require_once 'Scores/SessionEntreprise.php';
require_once 'Scores/WsScores.php';
$request = $this->getRequest();
@ -27,7 +26,7 @@ class FinanceController extends Zend_Controller_Action
public function syntheseAction()
{
$user = new Scores_Utilisateur();
$session = new SessionEntreprise($this->siret, $this->id);
$session = new Scores_Session_Entreprise($this->siret, $this->id);
$request = $this->getRequest();
$typeBilan = $request->getParam('typeBilan', 'N');
@ -206,7 +205,7 @@ class FinanceController extends Zend_Controller_Action
$request = $this->getRequest();
$autrePage = $request->getParam('apage');
$typeBilan = $request->getParam('typeBilan', 'N');
$entreprise = new SessionEntreprise($this->siret, $this->id);
$entreprise = new Scores_Session_Entreprise($this->siret, $this->id);
//Récupération des informations
if (empty($autrePage)) {
@ -466,7 +465,7 @@ class FinanceController extends Zend_Controller_Action
}
$typeBilan = $request->getParam('typeBilan', 'N');
$entreprise = new SessionEntreprise($this->siret, $this->id);
$entreprise = new Scores_Session_Entreprise($this->siret, $this->id);
$tabRatio = array(
array('titre' => 'EQUILIBRE FINANCIER'),
@ -645,7 +644,7 @@ class FinanceController extends Zend_Controller_Action
$unite = $request->getParam('unit', '€');
$type = $request->getParam('type', '');
$date = $request->getParam('date', '');
$entreprise = new SessionEntreprise($this->siret, $this->id);
$entreprise = new Scores_Session_Entreprise($this->siret, $this->id);
switch($type)
{
@ -742,7 +741,7 @@ class FinanceController extends Zend_Controller_Action
$type = 'réel normal ou simplifié';
break;
}
$session = new SessionEntreprise($params['siren']);
$session = new Scores_Session_Entreprise($params['siren']);
$this->view->assign('raisonSociale', $session->getRaisonSociale());
$this->view->assign('size', filesize($file));
$this->view->assign('name', $name);
@ -893,7 +892,7 @@ class FinanceController extends Zend_Controller_Action
$listBilan = $ws->getListeBilans(substr($this->siret, 0, 9));
if ($listBilan === false) $this->_forward('soap', 'error');
$entreprise = new SessionEntreprise($this->siret, $this->id);
$entreprise = new Scores_Session_Entreprise($this->siret, $this->id);
if( $listBilan->nbReponses > 0 )
{
@ -966,7 +965,7 @@ class FinanceController extends Zend_Controller_Action
$urlImg = new Logo($siren);
$sessionEntreprise = new SessionEntreprise($this->siret, $this->id);
$sessionEntreprise = new Scores_Session_Entreprise($this->siret, $this->id);
$ws = new WsScores();
$infos = $ws->getInfosBourse($siren);
@ -1006,7 +1005,7 @@ class FinanceController extends Zend_Controller_Action
$infos = $this->getRequest()->getParam('infos');
}
$entreprise = new SessionEntreprise($this->siret, $this->id);
$entreprise = new Scores_Session_Entreprise($this->siret, $this->id);
$this->view->assign('banques', $infos->result->item);
$this->view->assign('raisonSociale', $entreprise->getRaisonSociale());
$this->view->assign('siren', substr($this->siret, 0, 9));
@ -1027,7 +1026,7 @@ class FinanceController extends Zend_Controller_Action
$siren = substr($this->siret, 0, 9);
$ws = new WsScores();
$entreprise = new SessionEntreprise($this->siret, $this->id);
$entreprise = new Scores_Session_Entreprise($this->siret, $this->id);
$this->view->assign('raisonSociale', $entreprise->getRaisonSociale());
$infos = $ws->getRatios($siren, 'ratios');
@ -1256,7 +1255,7 @@ class FinanceController extends Zend_Controller_Action
public function subventionsAction()
{
$sessionEntreprise = new SessionEntreprise($this->siret, $this->id);
$sessionEntreprise = new Scores_Session_Entreprise($this->siret, $this->id);
$siren = substr($this->siret, 0, 9);
$this->view->assign('raisonSociale', $sessionEntreprise->getRaisonSociale());
$this->view->assign('id', $this->id);
@ -1276,7 +1275,7 @@ class FinanceController extends Zend_Controller_Action
public function subventionAction()
{
$sessionEntreprise = new SessionEntreprise($this->siret, $this->id);
$sessionEntreprise = new Scores_Session_Entreprise($this->siret, $this->id);
$siren = substr($this->siret, 0, 9);
$this->view->assign('raisonSociale', $sessionEntreprise->getRaisonSociale());
$this->view->assign('id', $this->id);

View File

@ -14,7 +14,6 @@ class IdentiteController extends Zend_Controller_Action
$this->id = $request->getParam('id', 0);
require_once 'Scores/WsScores.php';
require_once 'Scores/SessionEntreprise.php';
require_once 'Scores/IdentiteEntreprise.php';
}
@ -72,7 +71,7 @@ class IdentiteController extends Zend_Controller_Action
} else {
//Mise en session
$session = new SessionEntreprise($this->siret, $this->id, true);
$session = new Scores_Session_Entreprise($this->siret, $this->id, true);
$session->setInfoEntrep($infos);
//Date de dernière mise à jour
@ -209,7 +208,7 @@ class IdentiteController extends Zend_Controller_Action
if ($infos === false) $this->_forward('soap', 'error');
//Mise en session
$session = new SessionEntreprise($this->siret, $this->id);
$session = new Scores_Session_Entreprise($this->siret, $this->id);
$session->setInfoEntrep($infos->Identite);
//Element Fiche identite
@ -314,7 +313,7 @@ class IdentiteController extends Zend_Controller_Action
$actif = $this->getRequest()->getParam('actif', -1);
$this->view->headTitle()->append('Liste des établissements - Siren '.$siren);
$session = new SessionEntreprise($this->siret, $this->id);
$session = new Scores_Session_Entreprise($this->siret, $this->id);
$user = new Scores_Utilisateur();
$ws = new WsScores();
@ -360,7 +359,7 @@ class IdentiteController extends Zend_Controller_Action
$siren = substr($this->siret,0,9);
$actif = $this->getRequest()->getParam('actif', -1);
$session = new SessionEntreprise($this->siret, $this->id);
$session = new Scores_Session_Entreprise($this->siret, $this->id);
$user = new Scores_Utilisateur();
$ws = new WsScores();
@ -579,7 +578,7 @@ class IdentiteController extends Zend_Controller_Action
//Define SIREN if exist
if ( intval($identite->siren)!=0 ) {
$siren = $identite->siren;
$session = new SessionEntreprise($siren, null, true);
$session = new Scores_Session_Entreprise($siren, null, true);
$this->view->assign('siren', $siren);
$this->view->assign('siret', $session->getSiret());
$this->view->assign('isin', $session->getIsin());
@ -599,7 +598,7 @@ class IdentiteController extends Zend_Controller_Action
$this->view->headTitle()->append('Liens inter-entreprises - Siren '.$siren);
$session = new SessionEntreprise($this->siret, $this->id);
$session = new Scores_Session_Entreprise($this->siret, $this->id);
$this->view->assign('isin', $session->getIsin());
$this->view->assign('siren', $siren);
@ -970,7 +969,7 @@ class IdentiteController extends Zend_Controller_Action
$siren = substr($this->siret,0,9);
$this->view->headTitle()->append('Evènements - Siren '.$siren);
$session = new SessionEntreprise($this->siret, $this->id);
$session = new Scores_Session_Entreprise($this->siret, $this->id);
$ws = new WsScores();
$infos = $ws->getListeEvenements($siren);
@ -996,7 +995,7 @@ class IdentiteController extends Zend_Controller_Action
$user = new Scores_Utilisateur();
if ($user->checkPref('news'))
{
$session = new SessionEntreprise($this->siret, $this->id);
$session = new Scores_Session_Entreprise($this->siret, $this->id);
$items = array();
if ($googleNews!==false){

View File

@ -11,7 +11,6 @@ class JuridiqueController extends Zend_Controller_Action
$this->id = $request->getParam('id', 0);
require_once 'Scores/WsScores.php';
require_once 'Scores/SessionEntreprise.php';
}
/**
@ -38,7 +37,7 @@ class JuridiqueController extends Zend_Controller_Action
}
}
$session = new SessionEntreprise($this->siret, $this->id);
$session = new Scores_Session_Entreprise($this->siret, $this->id);
$fj = $session->getFormeJuridique();
if ( $fj>9000 && $fj<9999 && intval($siren)==0 ) {
$vue = 'asso';
@ -224,7 +223,7 @@ class JuridiqueController extends Zend_Controller_Action
$request = $this->getRequest();
$idAnn = $request->getParam('idann', false);
$siren = substr($this->siret, 0,9);
$session = new SessionEntreprise($this->siret, $this->id);
$session = new Scores_Session_Entreprise($this->siret, $this->id);
$ws = new WsScores();
if ($idAnn!=false) {
@ -271,7 +270,7 @@ class JuridiqueController extends Zend_Controller_Action
$request = $this->getRequest();
$type = $request->getParam('type', '');
$siren = substr($this->siret,0,9);
$session = new SessionEntreprise($this->siret, $this->id);
$session = new Scores_Session_Entreprise($this->siret, $this->id);
$abbrev = array(
' TGI ' => 'TRIBUNAL DE GRANDE INSTANCE DE ',
@ -312,7 +311,7 @@ class JuridiqueController extends Zend_Controller_Action
public function conventionsAction()
{
$siren = substr($this->siret, 0,9);
$session = new SessionEntreprise($this->siret, $this->id);
$session = new Scores_Session_Entreprise($this->siret, $this->id);
$this->view->assign('siren', $siren);
$this->view->assign('siret', $this->siret);
$this->view->assign('raisonSociale', $session->getRaisonSociale());
@ -334,7 +333,7 @@ class JuridiqueController extends Zend_Controller_Action
$request = $this->getRequest();
$idObject = $request->getParam('idObject', 0);
$siren = substr($this->siret, 0,9);
$session = new SessionEntreprise($this->siret, $this->id);
$session = new Scores_Session_Entreprise($this->siret, $this->id);
$this->view->assign('siren', $siren);
$this->view->assign('siret', $this->siret);
$this->view->assign('raisonSociale', $session->getRaisonSociale());

View File

@ -20,13 +20,12 @@ class PiecesController extends Zend_Controller_Action
public function init()
{
require_once 'Scores/WsScores.php';
require_once 'Scores/SessionEntreprise.php';
require_once 'Infogreffe/Infogreffe.php';
$request = $this->getRequest();
$this->siret = $request->getParam('siret');
$this->id = $request->getParam('id', 0);
$this->entrep = new SessionEntreprise($this->siret, $this->id);
$this->entrep = new Scores_Session_Entreprise($this->siret, $this->id);
}
public function indexAction(){}
@ -659,7 +658,7 @@ class PiecesController extends Zend_Controller_Action
$this->view->assign('siret', $this->siret);
$this->view->assign('siren', $this->siren);
$session = new SessionEntreprise($this->siret, $this->id);
$session = new Scores_Session_Entreprise($this->siret, $this->id);
$this->view->assign('raisonSociale', $session->getRaisonSociale());
$user = new Scores_Utilisateur();
@ -1106,7 +1105,7 @@ class PiecesController extends Zend_Controller_Action
$siren = substr($this->siret, 0, 9);
$session = new SessionEntreprise($this->siret, $this->id);
$session = new Scores_Session_Entreprise($this->siret, $this->id);
$user = new Scores_Utilisateur();
$permKbis = false;
@ -1364,7 +1363,7 @@ class PiecesController extends Zend_Controller_Action
}
}
$session = new SessionEntreprise($this->siret);
$session = new Scores_Session_Entreprise($this->siret);
if (substr($session->AutreId,0.1)=='W'){
foreach (glob("$path/ST-".$session->AutreId."-*.pdf") as $filename) {
preg_match('/ST-(.*)-([0-9]{8})\.pdf$/', $filename, $matches);
@ -1525,7 +1524,7 @@ class PiecesController extends Zend_Controller_Action
$user = new Scores_Utilisateur();
$session = new SessionEntreprise($params['siret']);
$session = new Scores_Session_Entreprise($params['siret']);
$this->view->assign('raisonSociale', $session->getRaisonSociale());
$this->view->assign('siren', $params['siret']);
$this->view->assign('email', $user->getEmail());
@ -1656,7 +1655,7 @@ class PiecesController extends Zend_Controller_Action
if (!empty($type)){
$detail = true;
}
$session = new SessionEntreprise($this->siret, $this->id);
$session = new Scores_Session_Entreprise($this->siret, $this->id);
$ws = new WsScores();
if ($detail){
$infos = $ws->getPrivilegesDetail($siren, array($type));

View File

@ -81,7 +81,6 @@ class SaisieController extends Zend_Controller_Action
public function init()
{
require_once 'Scores/WsScores.php';
require_once 'Scores/SessionEntreprise.php';
require_once 'Scores/IdentiteEntreprise.php';
$ws = new WsScores();
@ -140,7 +139,7 @@ class SaisieController extends Zend_Controller_Action
$devises = $devisesReponse->result->item;
//Mise en session
$session = new SessionEntreprise($siret, $id, true);
$session = new Scores_Session_Entreprise($siret, $id, true);
$session->setInfoEntrep($infos);
$sessionSaisie = new Zend_Session_Namespace('saisie');
@ -281,7 +280,7 @@ class SaisieController extends Zend_Controller_Action
$siret = $request->getParam('siret');
$id = $request->getParam('id', 0);
$session = new SessionEntreprise($siret, $id);
$session = new Scores_Session_Entreprise($siret, $id);
$ws = new WsScores();
@ -807,7 +806,7 @@ class SaisieController extends Zend_Controller_Action
$this->view->inlineScript()->appendFile('/libs/form/jquery.form.js');
if ( intval($siren)==0 ) {
$session = new SessionEntreprise();
$session = new Scores_Session_Entreprise();
$siren = '';
if ( substr($session->AutreId,0,1)=='W' ) {
$siren = $session->AutreId;
@ -830,7 +829,7 @@ class SaisieController extends Zend_Controller_Action
$siren = substr($siret,0,9);
$this->view->assign('siren', $siren);
$session = new SessionEntreprise($siret, $id);
$session = new Scores_Session_Entreprise($siret, $id);
$this->view->assign('siret', $siret);
$this->view->assign('raisonSociale', $session->getRaisonSociale());
@ -1346,11 +1345,11 @@ class SaisieController extends Zend_Controller_Action
//Override session session
if ( intval($result->siren) != 0 ) {
$siren = $result->siren;
$session = new SessionEntreprise($siren);
$session = new Scores_Session_Entreprise($siren);
}
} elseif ($siren !== null) {
$session = new SessionEntreprise($siren);
$session = new Scores_Session_Entreprise($siren);
$rs = $session->getRaisonSociale();
}
@ -1959,7 +1958,7 @@ class SaisieController extends Zend_Controller_Action
$this->view->headTitle()->append('Saisie - '.$siret);
$session = new SessionEntreprise($siret, $id);
$session = new Scores_Session_Entreprise($siret, $id);
$isin = $session->getIsin();
$ws = new WsScores();

View File

@ -56,7 +56,7 @@ class Annonces
' du '.$this->dateAnnonce($ann->DateParution);
} else {
$view = new Zend_View();
$session = new SessionEntreprise(null);
$session = new Scores_Session_Entreprise(null);
$href = $view->url(array(
'controller' => 'juridique',
'action' => 'competences',

View File

@ -489,8 +489,6 @@ class Scores_Menu
*/
public function __construct($parameters)
{
require_once 'Scores/SessionEntreprise.php';
//Special case, edit foreign company
if (array_key_exists('lienref', $parameters)) {
$this->lienref = $parameters['lienref'];
@ -504,7 +502,7 @@ class Scores_Menu
$this->id = $parameters['id'];
}
if (empty($this->siret) && empty($this->id)) {
$session = new SessionEntreprise(null);
$session = new Scores_Session_Entreprise(null);
$this->siret = $session->getSiret();
$this->id = $session->getId();
}

View File

@ -1,22 +0,0 @@
<?php
class SelectLang
{
protected $curLang = 'fr';
public function __construct()
{
$utilisateur = new Scores_Utilisateur();
$this->curLang = $utilisateur->getLang();
}
/**
* Retourne le titre de la colonne de la table selon la langue choisie
* @param string Column Name
* @return string New Column Name
*/
public function langSetDB($colName)
{
$newColName = ($this->curLang == 'fr') ? $colName : $colName.ucfirst($this->curLang);
return $newColName;
}
}

View File

@ -1,5 +1,5 @@
<?php
class SessionEntreprise
class Scores_Session_Entreprise
{
protected $index = 'entrep';