Inlcude all libs

This commit is contained in:
Michael RICOIS 2013-10-15 15:30:21 +00:00
parent 63e507d49f
commit b7be1a7ab0
316 changed files with 12175 additions and 2 deletions

View File

@ -0,0 +1,5 @@
<?php
class PrestaController extends Zend_Controller_Action
{
public function indexAction(){}
}

View File

@ -0,0 +1,34 @@
<?php
class ReportController extends Zend_Controller_Action
{
public function indexAction()
{
$request = $this->getRequest();
//Get parameters
$siren = $request->getParam('siren');
//Control the prestation with the database - inject additionnaly parameters
//Launch report
$report = new Scores_Partner_Report('indiscore3', '552144503', 'mricois', 'ju2loh6o');
$html = $report->getContent();
file_put_contents('test.html', $html);
//Write links to get the HTML and/or PDF
}
public function pdfAction()
{
//Unlink the file
//if HTML exist, make a pdf
//Distribute it to the output
}
}

View File

@ -0,0 +1,37 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Extranet - Erreur</title>
</head>
<body>
<div id="center">
<h1>Erreur</h1>
<div class="paragraph">
<b><?php echo $this->message ?></b>
</div>
<?php if (isset($this->exception)): ?>
<h2>Exception information:</h2>
<div class="paragraph">
<p>
<b>Message:</b> <pre><?php echo $this->exception->getMessage() ?></pre>
</p>
</div>
<br/>
<h2>Stack trace:</h2>
<div class="paragraph">
<pre><?php echo $this->exception->getTraceAsString() ?></pre>
</div>
<br/>
<h2>Request Parameters:</h2>
<div class="paragraph">
<pre><?php echo var_export($this->request->getParams(), true) ?></pre>
</div>
<?php endif ?>
</div>
</body>
</html>

View File

@ -1,7 +1,7 @@
<!-- Jumbotron -->
<div class="jumbotron">
<h1>Programme Partenaires</h1>
<p class="lead">Créer de la valeur ajoutée avec nos solutions autour de notre expertises sur les entreprises.</p>
<p class="lead">Créer de la valeur ajoutée avec nos solutions autour de notre expertise sur les entreprises.</p>
<p><a class="btn btn-lg btn-success" href="#">Détails</a></p>
</div>
@ -9,7 +9,7 @@
<div class="row">
<div class="col-lg-4">
<h2>Rapport financier</h2>
<p>Créer des rapports financier en marque blanche</p>
<p>Créer des rapports financiers en marque blanche</p>
<p><a class="btn btn-primary" href="#">Details &raquo;</a></p>
</div>
<div class="col-lg-4">

View File

@ -0,0 +1 @@
<?php

View File

@ -0,0 +1 @@
<?php

447
library/Scores/Annonces.php Normal file
View File

@ -0,0 +1,447 @@
<?php
require_once 'common/dates.php';
class Annonces
{
public $annoncesBodacc = array();
public $annoncesBalo = array();
public $annoncesAsso = array();
public $annoncesBomp = array();
protected $annonces;
public function __construct($annonces = array())
{
if (is_array($annonces) && count($annonces)>0) {
$this->annonces = $annonces;
$this->triAnnonces();
krsort($this->annoncesBodacc);
krsort($this->annoncesBalo);
krsort($this->annoncesAsso);
krsort($this->annoncesBomp);
}
}
/**
* Enter description here ...
* @param unknown_type $ann
*/
public function getAnnonceDesc($ann)
{
if ($this->isBalo($ann->BodaccCode)) {
return 'BALO n&deg;'.$ann->BodaccNum.' du '.
$this->dateAnnonce($ann->DateParution).'.';
} elseif ($this->isAsso($ann->BodaccCode)) {
return 'J.O. ASSOCIATION n&deg;'.$ann->BodaccNum.' du '.
$this->dateAnnonce($ann->DateParution).'.';
} elseif ($this->isBomp($ann->BodaccCode)){
return 'Annonce n&deg;'.$ann->NumAnnonce . '. ' .
'Source ' . $ann->BodaccCode . ' ' .
'n&deg;' . ($ann->BodaccNum*1) . ' ' .
' du '.$this->dateAnnonce($ann->DateParution).
'. D&eacute;partement n&deg;'.$ann->Departement.'.';
} else {
$tabSource = explode('-', $ann->BodaccCode);
$source = $tabSource[0];
$idSource = $tabSource[1];
if ($source[0] == 'B') {
$logo = '/themes/default/images/annonces/logo_jo.png';
if ($ann->BodaccNum==0){
$libelle = 'Source BODACC '.substr($ann->BodaccCode,-1).
' du '.$this->dateAnnonce($ann->DateParution);
} else {
$view = new Zend_View();
$session = new SessionEntreprise(null);
$href = $view->url(array(
'controller' => 'juridique',
'action' => 'competences',
'type' => 'tri',
'siret' => $session->getSiret(),
), null, true);
$libelle = 'Source BODACC n&deg;'.$ann->BodaccNum.'&nbsp;'.
substr($ann->BodaccCode,-1).
' du '.$this->dateAnnonce($ann->DateParution).
'. D&eacute;partement n&deg;'.$ann->Departement.
'. <a href="'.$href.'">'.$ann->Tribunal.'</a>';
}
} elseif ($source[0] == 'G' || $source[0] == 'T') {
$logo = '/themes/default/images/annonces/logo_greffe.png';
$libelle = 'Source Greffe du Tribunal'.
' du '.$this->dateAnnonce($ann->DateParution).
'. D&eacute;partement n&deg;'.$ann->Departement.
'. <a href="'.$href.'">'.$ann->Tribunal.'</a>';
} elseif ($source[0] == 'P') {
$logo = '/themes/default/images/annonces/logo_inpi.png';
$libelle = 'Source Registre National du Commerce';
} else {
$logo = '/themes/default/images/annonces/logo_jal.png';
$libelle = '';
$user = new Scores_Utilisateur();
if( $user->checkModeEdition() &&
(substr($source,0,2)=='JT' || $source=='ANTE') ){
$libelle = '<b>Source TESSI</b> - ';
}
$libelle.= 'Source Journal Annonces L&eacute;gales';
}
return '<img src="'.$logo.'" /> '.$libelle.'.';
}
}
/**
*
* Enter description here ...
* @param unknown_type $ann
*/
public function getAnnonceEntree($ann)
{
if ($this->isBalo($ann->BodaccCode)) {
return 'Entr&eacute; n&deg;'.$ann->NumAnnonce.'.';
} elseif ($this->isAsso($ann->BodaccCode)) {
return 'Annonce n&deg;'.$ann->NumAnnonce.'.';
} elseif ($this->isBomp($ann->BodaccCode)){
return '';
} else {
if ($ann->dateInsertionSD!='') {
return ' - Entr&eacute;e en base : '.
$this->dateAnnonce($ann->dateInsertionSD);
}
}
}
/**
*
* Enter description here ...
* @param unknown_type $ann
*/
public function getAnnonceEntreeSD($ann)
{
if ($this->isBodacc($annBodaccCode)) {
} elseif ($this->isBalo($ann->BodaccCode)) {
return 'Entr&eacute;e en base S&amp;D : '.
$this->dateAnnonce($ann->dateInsertionSD).'.';
} elseif ($this->isAsso($ann->BodaccCode)) {
return 'Entr&eacute;e en base S&amp;D : '.
$this->dateAnnonce($ann->dateInsertionSD).'.';
} elseif ($this->isBomp($ann->BodaccCode)){
return '';
} else {
}
}
/**
*
* Enter description here ...
* @param unknown_type $ann
*/
public function getAnnonceEven($ann)
{
$output = '';
foreach ($ann->evenements->item as $i=>$even) {
$output.= $even->LibEven.'<br/>';
}
return $output;
}
/**
*
* Enter description here ...
* @param unknown_type $ann
*/
public function getAnnonceTexte($ann)
{
/*
$pattern = "/((?:[0-9]{9,9})|(?:[0-9]{3,3} [0-9]{3,3} [0-9]{3,3})|(?:[0-9]{3,3}\.[0-9]{3,3}\.[0-9]{3,3})|(?:[0-9]{3,3}-[0-9]{3,3}-[0-9]{3,3}))/";
return preg_replace_callback($pattern, 'replace_siren', $ann['texteAnnonce']);
*/
return $ann->texteAnnonce;
}
public function getAnnonceEntite($ann)
{
return $ann->entites->item;
}
/**
*
* Enter description here ...
* @param unknown_type $ann
*/
public function getAnnonceResume($ann)
{
return array(
'date' => $this->dateAnnonce($ann->DateParution),
'title' => $this->logoTitleAnnonce($ann),
'logo' => $this->logoAnnonce($ann),
'idAnn' => $ann->id,
'lib' => $this->libAnnonce($ann),
'texte' => $this->getAnnonceTexte($ann),
'type' => $this->getType($ann),
'deleted' => $ann->deleted,
);
}
/**
*
* Enter description here ...
* @param unknown_type $ann
*/
protected function hrefAnnonce($ann)
{
/*
$href = false;
if ($this->isBodacc($ann->BodaccCode)) {
$href = 'idan='.$ann->id.'&vue=bodacc';
} elseif ($this->isBalo($ann->BodaccCode)) {
$href = 'idan='.$ann->id.'&vue=balo';
} elseif ($this->isAsso($ann->BodaccCode)) {
$href = 'idan='.$ann->id.'&vue=asso';
} elseif ($this->isBomp($ann->BodaccCode)){
$href = 'idan='.$ann->id.'&vue=bomp';
} else {
$href = 'idan='.$ann->id.'&vue=bodacc';
}
return $href;
*/
}
/**
* Retourne une date formatté
* @param string $date
*/
protected function dateAnnonce($date)
{
return WDate::dateT('Y-m-d', 'd/m/Y', $date);
}
protected function logoTitleAnnonce($ann)
{
$title = '';
if ($this->isBalo($ann->BodaccCode)) {
$title = 'Source BALO n°'.$annBodaccNum;
} elseif ($this->isAsso($ann->BodaccCode)) {
$title = 'Source JO ASSOCIATION n°'.$ann->BodaccNum;
} elseif ($this->isBomp($ann->BodaccCode)) {
if ($ann->BodaccCode == 'MAPA' ) {
$title = 'Source '.$ann->BodaccCode . ' ' .
($ann->BodaccNum*1);
} else {
$title = 'Source '.$ann->BodaccCode . ' ' .
'n&deg;' . ($ann->BodaccNum*1) . ' de ' .
substr($ann->DateParution,0,4);
}
} else {
$tabSource = explode('-', $ann->BodaccCode);
$source = $tabSource[0];
$idSource = $tabSource[1];
if ($source[0] == 'B') {
$title = 'Source BODACC ' . $ann->BodaccNum . ' ' .
substr($source,-1) . ' ' .
'de ' . substr($ann->DateParution,0,4);
} else if ($source[0] == 'G' || $source[0] == 'T') {
$title = 'Source Collecte Greffe';
} else if ($source[0] == 'P') {
$title = 'Source Collecte RNCS';
} else {
$title = 'Source Collecte JAL';
if ($idSource>0) $title.= ' '.$idSource;
}
}
return $title;
}
/**
* logoAnnonce
* @param array $ann
*/
protected function logoAnnonce($ann)
{
$src = '';
if ($this->isBalo($ann->BodaccCode)) {
$src = 'logo_jo.png';
} elseif ($this->isAsso($ann->BodaccCode)) {
$src = 'logo_jo.png';
} elseif ($this->isBomp($ann->BodaccCode)) {
$src = 'logo_jo.png';
} else {
$tabSource = explode('-', $ann->BodaccCode);
$source = $tabSource[0];
if ($source[0] == 'B') {
$src = 'logo_jo.png';
} else if ($source[0] == 'G' || $source[0] == 'T') {
$src = 'logo_greffe.png';
} else if ($source[0] == 'P') {
$src = 'logo_inpi.png';
} else {
$src = 'logo_jal.png';
}
}
if ($src != '') {
return $src;
} else {
return false;
}
}
/**
* Retourne le libellé de l'annonce
* @param array $ann
*/
protected function libAnnonce($ann)
{
$lib = '';
foreach ($ann->evenements->item as $i=>$even) {
$lib.= $even->LibEven;
$tabSource = explode('-', $ann->BodaccCode);
$source = $tabSource[0];
$idSource = $tabSource[1];
$numEven = $even->CodeEven*1;
if ($numEven>3000 && $numEven<3999) {
if (isset($ann->dateEffet)){
$lib.= ' (clôture au '.WDate::dateT('Y-m-d','d/m/Y',$ann->dateEffet).')';
}
}
$user = new Scores_Utilisateur();
if( $user->checkModeEdition() &&
(substr($source,0,2)=='JT' || $source=='ANTE') ){
$lib.= ' - <b>(Source TESSI)</b>';
}
$lib.= '<br/>';
}
return $lib;
}
/**
* Tri les annonces en fonction de la source
*/
protected function triAnnonces()
{
foreach ($this->annonces as $i => $ann)
{
//Génération id pour tri
$id = WDate::dateT('Y-m-d','Ymd',$ann->DateParution).':'.$ann->id;
if ($this->isBodacc($ann->BodaccCode)){
$this->annoncesBodacc[$id] = $ann;
} elseif ($this->isBalo($ann->BodaccCode)) {
$this->annoncesBalo[$id] = $ann;
} elseif ($this->isAsso($ann->BodaccCode)) {
$this->annoncesAsso[$id] = $ann;
} elseif ($this->isBomp($ann->BodaccCode)){
$this->annoncesBomp[$id] = $ann;
} else {
$this->annoncesBodacc[$id] = $ann;
}
}
}
public function getAnnee($ann)
{
return WDate::dateT('Y-m-d','Y',$ann->DateParution);
}
public function getNum($ann)
{
return $ann->BodaccNum;
}
public function getType($ann)
{
if ($this->isBodacc($ann->BodaccCode)){
return 'bodacc';
} elseif ($this->isBalo($ann->BodaccCode)) {
return 'balo';
} elseif ($this->isAsso($ann->BodaccCode)) {
return 'asso';
} elseif ($this->isBomp($ann->BodaccCode)){
return 'bomp';
} else {
return 'bodacc';
}
}
public function getCode($ann)
{
return $ann->BodaccCode;
}
public function isDeleted($ann)
{
if ($ann->deleted!='') {
return $this->dateAnnonce($ann->deleted);
}
return '';
}
/**
* Détermine si l'annonce est une annonce BODACC
* @param string $code
*/
protected function isBodacc($code)
{
if (in_array($code, array('BODA', 'BODB', 'BODC'))){
return true;
} else {
return false;
}
}
/**
* Détermine si l'annonce est une annonce BALO
* @param string $code
*/
protected function isBalo($code)
{
if ($code == 'BALO'){
return true;
} else {
return false;
}
}
/**
* Détermine si l'annonce est une annonce ASSO
* @param string $code
*/
protected function isAsso($code)
{
if ($code == 'ASSO'){
return true;
} else {
return false;
}
}
/**
* Détermine si l'annonce est une annonce BOAMP
* @param string $code
*/
protected function isBomp($code)
{
if (in_array($code, array('BOMP A', 'BOMP B', 'BOMP C', 'MAPA'))){
return true;
} else {
return false;
}
}
}

View File

@ -0,0 +1,151 @@
<?php
class Scores_AuthAdapter implements Zend_Auth_Adapter_Interface
{
protected $_username;
protected $_password;
protected $_timeout = 1800;
protected $_checkIp = false;
public function __construct($username, $password, $iponly = false)
{
$this->_username = $username;
$this->_password = $password;
if ($iponly){
$this->_password = 'iponly:'.$_SERVER['REMOTE_ADDR'];
}
$this->_checkIp = $iponly;
}
public function authenticate()
{
$adressIp = $_SERVER['REMOTE_ADDR'];
require_once 'Scores/WsScores.php';
$ws = new WsScores($this->_username, $this->_password);
$InfosLogin = $ws->getInfosLogin($this->_username, $adressIp);
$identity = new stdClass();
$identity->username = $this->_username;
$identity->password = $this->_password;
$identity->email = $InfosLogin->result->email;
$identity->profil = $InfosLogin->result->profil;
$identity->pref = $InfosLogin->result->pref;
$identity->droits = $InfosLogin->result->droits;
$identity->droitsClients = $InfosLogin->result->droitsClients;
$identity->nom = $InfosLogin->result->nom;
$identity->prenom = $InfosLogin->result->prenom;
$identity->tel = $InfosLogin->result->tel;
$identity->fax = $InfosLogin->result->fax;
$identity->mobile = $InfosLogin->result->mobile;
$identity->id = $InfosLogin->result->id;
$identity->idClient = $InfosLogin->result->idClient;
$identity->reference = $InfosLogin->result->reference;
$identity->nbReponses = $InfosLogin->result->nbReponses;
$identity->typeScore = $InfosLogin->result->typeScore;
$identity->dateValidation = $InfosLogin->result->dateValidation;
$identity->nombreConnexions = $InfosLogin->result->nombreConnexions;
$identity->dateDerniereConnexion = $InfosLogin->result->dateDerniereConnexion;
$identity->dateDebutCompte = $InfosLogin->result->dateDebutCompte;
$identity->dateFinCompte = $InfosLogin->result->dateFinCompte;
$identity->acceptationCGU = $InfosLogin->result->acceptationCGU;
$identity->ip = $adressIp;
$identity->modeEdition = false;
$timeout = (!empty($InfosLogin->result->timeout)) ? $InfosLogin->result->timeout : $this->_timeout;
$identity->timeout = $timeout;
$identity->time = time() + $timeout;
$lang = in_array($InfosLogin->result->lang, array('fr','en')) ? $InfosLogin->result->lang : 'fr';
$identity->lang = $lang;
$identity->langtmp = $lang;
/*
* Adresse Ip interdites
*/
$ipInterdites =
'81.252.88.0-81.252.88.7' // CTE D AGGLOMERATION DE SOPHIA
. ';' . '195.200.187.163' // PacWan
. ';' . '213.11.81.41' // Verizon France SAS
. ';' . '83.206.171.252' // FR-BASE-D-INFORMATIONS-LEGALES-BI
. ';' . '81.255.32.139'
. ';' . '212.155.191.1*' // Satair A/S
. ';' . '217.70.1*.17' // OJSC "Sibirtelecom"
. ';' . '212.37.196.156' // GENERALE-MULTIMEDIA-SUD
. ';' . '80.245.60.121' // Planete Marseille - Mailclub
. ';' . '213.246.57.101' // IKOULA
. ';' . '193.104.158.0-193.104.158.255' // Altares.fr
. ';' . '195.6.3.0-195.6.3.255' // ORT
. ';' . '217.144.112.0-217.144.116.63' // Coface
;
if ( $this->checkPlagesIp($ipInterdites, $adressIp) ) {
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_UNCATEGORIZED, $identity);
}
// Renvoi
if ( is_string($InfosLogin) || $InfosLogin->error->errnum!=0){
$message = $InfosLogin;
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, $identity, array($message));
} elseif ($this->_username == $InfosLogin->result->login) {
return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $identity);
} else {
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_UNCATEGORIZED, $identity);
}
}
/**
* Controle si une adresse IP est dans une liste des IP communiquées sous la forme 192.168.3.5-192.68.3.10;192.168.3.*;192.168.3.10
* @param string $strPlageIP La plage d'adresses IP
* @param string $adresseIP L'adresse IP à tester
*/
protected function checkPlagesIp($strPlageIP, $adresseIP)
{
$connected = false;
$tabIpAllowed = explode(';', trim($strPlageIP));
if (count($tabIpAllowed)==1 && $tabIpAllowed[0]=='') $tabIpAllowed = array();
foreach ($tabIpAllowed as $ip) {
$tabPlages = explode('-', $ip);
// C'est une plage d'adresse '-'
if (isset($tabPlages[1]))
$connected = $this->in_plage($tabPlages[0],$tabPlages[1],$adresseIP);
else {
// C'est une adresse avec ou sans masque '*'
if (preg_match('/^'.str_replace('*','.*',str_replace('.','\.',$ip)).'$/', $adresseIP) )
$connected=true;
}
if ($connected) break;
}
if (count($tabIpAllowed)==0) return false;
elseif (!$connected) {
return false;
}
return true;
}
/**
* Enter description here ...
* @param unknown_type $plage_1
* @param unknown_type $plage_2
* @param unknown_type $ip
* @return boolean
*/
protected function in_plage($plage_1,$plage_2,$ip)
{
$ip2 = $this->getIpNumber($ip);
if ($ip2>=$this->getIpNumber($plage_1) && $ip2<=$this->getIpNumber($plage_2))
return true;
else
return false;
}
/**
* Converti une IP en nombre
* @param string $ip Adresse IP
* @return integer
*/
protected function getIpNumber($ip) {
$tab=explode('.', $ip);
return (($tab[0]*256*256*256) + ($tab[1]*256*256) + ($tab[2]*256) + ($tab[3]));
}
}

View File

@ -0,0 +1,282 @@
<?php
class AvisSituation
{
protected static $timeout = 10;
protected static $retryDelay = 300;
protected $fichierErreur;
protected $pathLog;
protected $pathAvisPdf;
protected $siret;
public function __construct($siret)
{
require_once 'common/curl.php';
$c = Zend_Registry::get('config');
$this->pathAvisPdf = $c->profil->path->files;
$this->pathLog = realpath($c->profil->path->data).'/log';
$this->fichierErreur = $this->pathLog.'/aviserreur.lock';
$this->siret = $siret;
}
public function erreurcpt($action)
{
switch($action){
case 'plus':
if (file_exists($this->fichierErreur)){
$handle = fopen($this->fichierErreur, 'r');
$data = fgetcsv($handle, '1000', ';');
$date_creation = $data[0];
$date_modification = time();
$nb = $data[2];
fclose($handle);
} else {
$date_creation = time();
$date_modification = time();
$nb = 0;
}
$nb++;
$handle = fopen($this->fichierErreur, 'w');
fputcsv($handle, array($date_creation, $date_modification, $nb), ';');
fclose($handle);
break;
case 'raz':
$handle = fopen($this->fichierErreur, 'w');
$date_creation = time();
$date_modification = time();
$nb = 0;
fputcsv($handle, array($date_creation, $date_modification, $nb), ';');
fclose($handle);
break;
}
}
public function nberreur()
{
if (file_exists($this->fichierErreur)){
$handle = fopen($this->fichierErreur, 'r');
$data = fgetcsv($handle, '1000', ';');
$nb = $data[2];
fclose($handle);
} else {
$nb = 1;
}
return $nb;
}
public function erreur()
{
if (file_exists($this->fichierErreur))
{
$handle = fopen($this->fichierErreur, 'r');
$data = fgetcsv($handle, '1000', ';');
$date_creation = $data[0];
$date_modification = $data[1];
$nb = $data[2];
fclose($handle);
} else {
$date_creation = 0;
$date_modification = 0;
}
if ($nb>0 && $date_modification<$date_creation+$this->retryDelay){
return true;
} else {
return false;
}
}
public function mailerreur()
{
$user = new Scores_Utilisateur();
$objet = "AVIS INSEE - (Date :".date("d")."/".date("m")."/".date("Y").")";
$texte = 'Accès impossible au site de situation INSEE : '.
$this->siret.EOL.
'http://avis-situation-sirene.insee.fr'.EOL.
'pour login '.$user->getLogin().EOL;
require_once 'Scores/Mail.php';
$mail = new Mail();
$mail->setFrom('contact');
$mail->addToKey('support');
$mail->setSubject($objet);
$mail->setBodyText($texte);
$mail->send();
}
public function erreurmsg(){
return "<h3>Le site partenaire n'a pas répondu correctement ou est indisponible. Merci d'essayer à nouveau ultérieurement.</h3>";
}
/**
* Récupére l'avis de situtation à partir du site au format pdf
* @param string $format Format 'pdf' ou 'array'
* @param boolean $force True aller obligatoirement le chercher à l'insee
* @return string Le PDF demandé
*/
public function get($format='pdf', $force=0)
{
$force=$force*1;
$date=date('Ymd');
$siren=trim(substr($this->siret,0,9));
$nic=trim(substr($this->siret,9,5));
$fichier = $this->pathAvisPdf.'/avis-'.$siren.'-'.$nic.'-'.$date.'.pdf';
if ($format!='pdf') return 'Format pdf uniquement';
if ($force==0 && file_exists($fichier))
{
// On délivre l'avis en base
return file_get_contents($fichier);
}
else
{
/** Initialisation de la session sur le site de l'Insee **/
$url = 'http://avis-situation-sirene.insee.fr/avisitu/jsp/avis.jsp';
//http://avis-situation-sirene.insee.fr/avisituV2/jsp/avis.jsp';
$referer = $cookie = '';
$page = getUrl($url, $cookie, '', $referer, false, 'avis-situation-sirene.insee.fr', '', $this->timeout);
//Code en 4xx ou 5xx signifie une erreur du serveur
$codeN = floor($page['code']/100);
if($codeN==4 || $codeN==5)
{
return false;
}
else
{
$referer = $url;
$body = $page['body'];
$serviceDispo = true;
//On doit retrouver sur la page
/*
<form name="demForm" method="post" action="/avisitu/IdentificationListeSiret.do
*/
if (preg_match("/<form name=\"demForm\" method=\"post\" action=\"\/avisitu\/IdentificationListeSiret.do/Uis", $body, $matches))
{
$fp = @fopen($fichier, "a");
@fwrite($fp, $body);
@fclose($fp);
$cookie = $page['header']['Set-Cookie'];
usleep(round(rand(500000,2000000)));
$dep=$depActif='';
if ($nic=='') $crit='S'; // l'établissement siège
else $crit=''; // établissement particulier, saisissez le NIC
/* $crit='T'; // tous les établissements de l'entreprise
$crit='T'; // tous les établissements de l'entreprise du département $dep
$crit='A'; // tous les établissements actifs de l'entreprise
$crit='A'; // tous les établissements actifs de l'entreprise du département $depActif
*/
//Post du formulaire
$url = 'http://avis-situation-sirene.insee.fr/avisitu/IdentificationListeSiret.do';
//$url='http://avis-situation-sirene.insee.fr/avisituV2/IdentificationDetailEtab.do';
$post = array(
'siren' => $siren,
'critere' => $crit, // S pour le siège ou vide avec un NIC !!!
'nic' => $nic,
'departement' => $dep,
'departement_actif' => $depActif,
'bSubmit' => 'Valider');
$page = getUrl($url, $cookie, $post, $referer, false, 'avis-situation-sirene.insee.fr', '', AVIS_TIMEOUT);
$body = $page['body'];
$fp=@fopen($fichier, "a");
@fwrite($fp, $body);
@fclose($fp);
if (preg_match("/<h3>Fiche établissement<\/h3>/Uis", $body, $matches))//<li class="ongletActif">&eacute;tablissement</li>
$tabInfos['fiche']='etab';
if (preg_match('/<div class="TitreGauche">(.*)<br\/>/Uis', $body, $matches)) {
$tabInfos['raiSoc']=trim($matches[1]);
}
if (preg_match("/Derni&egrave;re mise &agrave; jour : (.*)<\/div>/Uis", $body, $matches))
$tabInfos['dateMaj']=trim($matches[1]);
$s1=substr($siren,0,3);
$s2=substr($siren,3,3);
$s3=substr($siren,6,3);
if (preg_match('/<div class="TitreDroite">(?:.*)('.$s1.'(?:.*)'.$s2.'(?:.*)'.$s3.')(?:.*)('.$nic.')(?:.*)<\/div>/Uis', $body, $matches)) {
$tabInfos['siren'] = trim($matches[1]);
$tabInfos['nic'] = trim($matches[2]);
}
if (preg_match('/<label id="labelFiche">Etat : <\/label>(.*)depuis le(.*)<\/p>/Uis', $body, $matches)) {
$tabInfos['etat'] = trim($matches[1]);
$tabInfos['dateEtat']= trim($matches[2]);
}
if (preg_match('/<label id="labelFiche">Cat&eacute;gorie d\'&eacute;tablissement : <\/label>(.*)<\/p>/Uis', $body, $matches)) {
$tabInfos['typeEtab']= trim($matches[1]);
}
$tabAdresse=array();
if (preg_match('/<label id="labelFiche">Adresse d\'implantation : <\/label>(?:.*)<ul id="adresse">(.*)<\/ul>/Uis', $body, $matches)) {
$strTmp=trim($matches[1]);
$tabTmp=explode('</li>', $strTmp);
foreach ($tabTmp as $i=>$strTmp)
$tabAdresse[$i]=trim(str_replace('<li>','',$strTmp));
}
if (preg_match('/<label id="labelFiche">(?:.*)Catégorie juridique :(?:.*)<\/label>(.*) - (.*)<\/p>/Uis', $body, $matches)) {
$tabInfos['fjCod']= trim($matches[1]);
$tabInfos['fjLib']= trim($matches[2]);
}
if (preg_match('/<label id="labelFiche">Activité principale exercée :(?:.*)<\/label>(.*) - (.*)<\/p>/Uis', $body, $matches)) {
$tabInfos['nafCod']=trim($matches[1]);
$tabInfos['nafLib']=trim($matches[2]);
}
if (preg_match('/<label id="labelFiche">(?:.*)Tranche d&#39;effectif(.*)<\/label>(.*)<\/p>/Uis', $body, $matches)) {
$tabInfos['effPeriode']=trim($matches[1]);
$tabInfos['effTranche']=trim($matches[2]);
}
$strCsv=$siren.';'.$nic.';'.$tabInfos['fiche'].';'.$tabInfos['dateMaj'].';'.
$tabInfos['siren'].';'.$tabInfos['nic'].';'.$tabInfos['raiSoc'].';'.
$tabInfos['etat'].';'.$tabInfos['dateEtat'].';'.$tabInfos['fjCod'].';'.$tabInfos['fjLib'].';'.
$tabInfos['nafCod'].';'.$tabInfos['nafLib'].';'.$tabInfos['effPeriode'].';'.
$tabInfos['effTranche'].';'.
$tabInfos['typeEtab'].';'.@implode(';',@$tabAdresse).
";\n";
$fp=@fopen($this->pathLog."/avis.csv", "a");
@fwrite($fp, $strCsv);
@fclose($fp);
// $body contient l'avis de situation au format html
$tabErreurs=array();
if (preg_match('/name="erreurs" value="(.*)" class="erreurText" readonly/Ui', $body, $matches1) ||
preg_match('/name="erreurs_bis" value="(.*)" class="erreurTextBis" readonly/Ui', $body, $matches2)) {
$tabErreurs[]=@$matches1[1];
$tabErreurs[]=@$matches2[1];
die('<font color="red">ERREUR '.utf8_encode(implode(' ', $tabErreurs)).'</font>'); // Gérer le retour d'une erreur
}
usleep(round(rand(500000,1000000)));
if ($format=='pdf')
{
$referer = $url;
$url = 'http://avis-situation-sirene.insee.fr/avisitu/AvisPdf.do';
//$url='http://avis-situation-sirene.insee.fr/avisituV2/AvisPdf.do';
$post = array(
'siren'=>$siren,
'nic'=>$nic,
'bSubmit'=>'Avis+de+Situation'
);
$page = getUrl($url, $cookie, $post, $referer, false, 'avis-situation-sirene.insee.fr', '', AVIS_TIMEOUT);
$body = $page['body'];
$fp = @fopen($fichier, "w");
@fwrite($fp, $body);
@fclose($fp);
} // Fin format PDF
}
else
{
$body = false;
}
return $body;
} // Fin erreur initialisation
} // Fin fichier disponible
}
}

692
library/Scores/Bdf.php Normal file
View File

@ -0,0 +1,692 @@
<?php
require_once 'common/curl.php';
class BDF
{
protected $host = 'http://protectel.scrypto.fr';
protected $page = '/iBDF/RequeteLanceur.php';
protected $filetime = 8;
public function __construct(){}
// --------------------------------------------------------------------------- //
// enleveLiens
// --------------------------------------------------------------------------- //
function enleveLiens($contenu, $discriminant)
{
$pos1 = 0;
while (($pos1 = strpos($contenu, '<a ', $pos1)) != false) {
$pos2 = strpos($contenu, '</a>', $pos1);
if ($pos2 == false) {
break;
}
$pos2 += 4;
if (substr_count($contenu, $discriminant, $pos1, $pos2 - $pos1) > 0) {
$pos3 = strpos($contenu, '>', $pos1) + 1;
if ($pos3 == $pos2 - 1) {
$pos1 = $pos2;
continue;
}
$rep = strip_tags(substr($contenu, $pos3, $pos2 - $pos3 - 4));
$contenu = substr_replace($contenu, $rep, $pos1, $pos2 - $pos1);
$pos1 += strlen($rep);
} else {
$pos1 = $pos2;
}
}
return $contenu;
}
function bdf_loadpage($url)
{
$page = getUrl($url, '', '', '', false, '', '',15);
//Fichier non disponible
if($page['code']==408 || $page['code']==400){
$output = false;
//Ecriture du fichier sur le serveur en local
}else{
$body = $page['body'];
$output = $body;
}
$output = utf8_encode($output);
$output = preg_replace('/(.*)\<html/', '<html', $output);
$output = $this->bdf_removeblock($output);
$output = $this->removeTag('html', $output, true, false);
$output = $this->removeTag('head', $output, true, false);
$output = $this->removeTag('body', $output, true, false);
$output = $this->removeTag('meta', $output, false, false);
$output = $this->removeTag('title', $output, true, true);
$output = $this->removeTag('script', $output, true, true);
//$output = changeLinkToLowerCase($output);
$output = $this->bdf_lien_siren($output);
$output = stripslashes($output);
return $output;
}
function bdf_removeblock($content)
{
$output = $content;
$output = $this->enleveLiens($output, '#nullepart');
$output = $this->enleveLiens($output, 'window.print');
$output = str_replace('/PROTECTEL/FIBEN20110207/',
$this->host.'/PROTECTEL/FIBEN20110207/', $output);
return $output;
}
function removeTag($balise, $content, $endOfTag = true, $removeContent = true)
{
if( $endOfTag )
{
if( $removeContent)
$output = preg_replace('@<'.$balise.'[^>]*?>.*?</'.$balise.'>@si','',$content);
else
$output = preg_replace(array('@<'.$balise.'[^>]*?>@', '@</'.$balise.'>@'),'',$content);
}
else
{
$output = preg_replace('@<'.$balise.'[^>]*?>@','',$content);
}
return $output;
}
function changeLinkToLowerCase($content)
{
//$pattern = "/\< *[img][^\>]*[href] *= *[\"\']{0,1}([^\"\'\ >]*)/i";
$pattern = '/(\<img[^>].*?>)/ie';
$replace = "strtolower('\\1')";
$content = preg_replace($pattern,$replace,$content);
$pattern = '/(\<script[^>].*?>)/ie';
$replace = "strtolower('\\1')";
$content = preg_replace($pattern,$replace,$content);
$pattern = '/(\<link[^>].*?>)/ie';
$replace = "strtolower('\\1')";
$content = preg_replace($pattern,$replace,$content);
$pattern = '/(\<table[^>].*?>)/ie';
$replace = "strtolower('\\1')";
$content = preg_replace($pattern,$replace,$content);
return $content;
}
function bdf_lien_module($id, $service = 'fiben', $req = '', $rech = array() )
{
$func_module = 'bdf_modules_'.$service;
$modules = $this->{$func_module}();
$params = array();
if(is_array($rech) && count($rech)>0){
foreach($rech as $key => $val)
{
${$key} = $val;
}
}
//Paramètres URL
foreach($modules[$id]['params'] as $mparams => $fparams)
{
$addParams = array();
//Paramètres de chaque fonction
$func_params = array();
if(is_array($fparams)){
foreach($fparams as $fparam)
{
$func_params[] = ${$fparam};
}
}
$addParams = call_user_func_array(array($this,'bdf_param_'.$mparams), $func_params);
//Rassemblement de tout les paramètres
$params = array_merge($params, $addParams);
}
//Paramètres sous format URL
$output = '';
foreach($params as $key => $value)
{
if(!empty($output)) $output.= '&';
$output.= $key.'='.$value;
}
return $this->host.$this->page.'?'.$output;
}
function bdf_lien_siren($c)
{
$p = '/(width="160" class="clFond".*)([0-9]{3} [0-9]{3} [0-9]{3} [0-9]{5})/';
$r = '$1<a href="./?page=identite&siret=$2">$2</a>';
$c = preg_replace($p, $r, $c);
$p = '/(class="clGrasFond".*)([0-9]{3} [0-9]{3} [0-9]{3})/';
$r = '$1<a href="./?page=identite&siret=$2">$2</a>';
$c = preg_replace($p, $r, $c);
$p = '/(width="130" class="clFond".*)([0-9]{3} [0-9]{3} [0-9]{3})/';
$r = '$1<a href="./?page=identite&siret=$2">$2</a>';
$c = preg_replace($p, $r, $c);
$p = '/(class="clFond" width="80".*)([0-9]{3} [0-9]{3} [0-9]{3})/';
$r = '$1<a href="./?page=identite&siret=$2">$2</a>';
$c = preg_replace($p, $r, $c);
$p = '/(class="clTexte" width="184".*)([0-9]{3} [0-9]{3} [0-9]{3})/';
$r = '$1<a href="./?page=identite&siret=$2">$2</a>';
$c = preg_replace($p, $r, $c);
$p = '/(class="clFond" width="255".*)([0-9]{3} [0-9]{3} [0-9]{3})/';
$r = '$1<a href="./?page=identite&siret=$2">$2</a>';
$c = preg_replace($p, $r, $c);
$c = stripslashes($c);
return $c;
}
function bdf_lien_clebdf()
{
//Détection des clebdf
//Remplacement du lien
}
function bdf_lien_plusinfos()
{
}
function bdf_param_banque()
{
return array(
'Etablissement' => '12345',
'Guichet' => '00001',
);
}
function bdf_param_utilisateur()
{
return array(
'Utilisateur' => 'Dupont', //$_SESSION['tabInfo']['login']
'MDP' => '', //$_SESSION['tabInfo']['password']
);
}
function bdf_param_profil()
{
return array(
'Profil' => 'Agence',
);
}
function bdf_param_service($service = 'FIBEN')
{
return array(
'Service' => strtoupper($service),
);
}
function bdf_param_req($req)
{
return array(
'Req' => $req,
);
}
function bdf_param_typeop($id)
{
return array(
'TypeOp' => $id,
);
}
function bdf_param_denom($denom)
{
return array(
'Denom' => $denom,
);
}
function bdf_param_type($type)
{
return array(
'Type' => $type,
);
}
function bdf_param_code($code)
{
return array(
'Code' => $code,
);
}
function bdf_param_rechet($rechet)
{
if(empty($rechet)) $output = 'N';
else $output = 'O';
return array(
'RechEt' => $output,
);
}
function bdf_param_ape($ape)
{
return array(
'APE' => $ape,
);
}
function bdf_modules_fiben()
{
return array(
'27' => array(
'titre' => '27. Panorama',
'params' => array(
'banque' => array(),
'utilisateur' => array(),
'profil' => array(),
'service' => array(),
'req' => array('req'),
'typeop' => array('id')
),
),
'28'=> array(
'titre' => '28. Concours Bancaires',
'params' => array(
'banque' => array(),
'utilisateur' => array(),
'profil' => array(),
'service' => array(),
'req' => array('req'),
'typeop' => array('id')
),
),
'29'=> array(
'titre' => '29. Impayés',
'params' => array(
'banque' => array(),
'utilisateur' => array(),
'profil' => array(),
'service' => array(),
'req' => array('req'),
'typeop' => array('id')
),
),
'30'=> array(
'titre' => '30. Concours Bancaires gpe',
'params' => array(
'banque' => array(),
'utilisateur' => array(),
'profil' => array(),
'service' => array(),
'req' => array('req'),
'typeop' => array('id')
),
),
'37'=> array(
'titre' => '37. Cotation',
'params' => array(
'banque' => array(),
'utilisateur' => array(),
'profil' => array(),
'service' => array(),
'req' => array('req'),
'typeop' => array('id')
),
),
'38'=> array(
'titre' => '38. Score',
'params' => array(
'banque' => array(),
'utilisateur' => array(),
'profil' => array(),
'service' => array(),
'req' => array('req'),
'typeop' => array('id')
),
),
'40'=> array(
'titre' => '40. Relations Bancaires',
'params' => array(
'banque' => array(),
'utilisateur' => array(),
'profil' => array(),
'service' => array(),
'req' => array('req'),
'typeop' => array('id')
),
),
'41'=> array(
'titre' => '41. Etablissement secondaires',
'params' => array(
'banque' => array(),
'utilisateur' => array(),
'profil' => array(),
'service' => array(),
'req' => array('req'),
'typeop' => array('id')
),
),
'45'=> array(
'titre' => '45. Jugements',
'params' => array(
'banque' => array(),
'utilisateur' => array(),
'profil' => array(),
'service' => array(),
'req' => array('req'),
'typeop' => array('id')
),
),
'51'=> array(
'titre' => '51. Dirigeants',
'params' => array(
'banque' => array(),
'utilisateur' => array(),
'profil' => array(),
'service' => array(),
'req' => array('req'),
'typeop' => array('id')
),
),
'52'=> array(
'titre' => '52. Capital',
'params' => array(
'banque' => array(),
'utilisateur' => array(),
'profil' => array(),
'service' => array(),
'req' => array('req') ,
'typeop' => array('id')
),
),
'54'=> array(
'titre' => '54. Participation',
'params' => array(
'banque' => array(),
'utilisateur' => array(),
'profil' => array(),
'service' => array(),
'req' => array('req'),
'typeop' => array('id')
),
),
'56'=> array(
'titre' => '56. Fonction De Direction',
'params' => array(
'banque' => array(),
'utilisateur' => array(),
'profil' => array(),
'service' => array(),
'req' => array('req'),
'typeop' => array('id')
),
),
'57'=> array(
'titre' => '57. Orga liens financiers',
'params' => array(
'banque' => array(),
'utilisateur' => array(),
'profil' => array(),
'service' => array(),
'req' => array('req'),
'typeop' => array('id')
),
),
'58'=> array(
'titre' => '58. Orga liens de direction',
'params' => array(
'banque' => array(),
'utilisateur' => array(),
'profil' => array(),
'service' => array(),
'req' => array('req'),
'typeop' => array('id')
),
),
'60'=> array(
'titre' => '60. Bilan Synthètique',
'params' => array(
'banque' => array(),
'utilisateur' => array(),
'profil' => array(),
'service' => array(),
'req' => array('req'),
'typeop' => array('id')
),
),
'62'=> array(
'titre' => '62. SIG',
'params' => array(
'banque' => array(),
'utilisateur' => array(),
'profil' => array(),
'service' => array(),
'req' => array('req'),
'typeop' => array('id')
),
),
'63'=> array(
'titre' => '63. Tableaux des flux',
'params' => array(
'banque' => array(),
'utilisateur' => array(),
'profil' => array(),
'service' => array(),
'req' => array('req'),
'typeop' => array('id')
),
),
'64'=> array(
'titre' => '64. Ratios',
'params' => array(
'banque' => array(),
'utilisateur' => array(),
'profil' => array(),
'service' => array(),
'req' => array('req'),
'typeop' => array('id')
),
),
'66'=> array(
'titre' => '66. Chiffres Consolidés',
'params' => array(
'banque' => array(),
'utilisateur' => array(),
'profil' => array(),
'service' => array(),
'req' => array('req'),
'typeop' => array('id')
),
),
'67'=> array(
'titre' => '67. Comptes Consolidés',
'params' => array(
'banque' => array(),
'utilisateur' => array(),
'profil' => array(),
'service' => array(),
'req' => array('req'),
'typeop' => array('id')
),
),
'68'=> array(
'titre' => '68. Dossier Comptable',
'params' => array(
'banque' => array(),
'utilisateur' => array(),
'profil' => array(),
'service' => array(),
'req' => array('req'),
'typeop' => array('id')
),
),
'69'=> array(
'titre' => '69. Liasse Fiscale',
'params' => array(
'banque' => array(),
'utilisateur' => array(),
'profil' => array(),
'service' => array(),
'req' => array('req'),
'typeop' => array('id')
),
),
'70'=> array(
'titre' => '70. Eléments de risque',
'params' => array(
'banque' => array(),
'utilisateur' => array(),
'profil' => array(),
'service' => array(),
'req' => array('req'),
'typeop' => array('id')
),
),
'72'=> array(
'titre' => '72. Diagnostic Synthètique',
'params' => array(
'banque' => array(),
'utilisateur' => array(),
'profil' => array(),
'service' => array(),
'req' => array('req'),
'typeop' => array('id')
),
),
'DE'=> array(
'titre' => 'DE. Dossier Découverte',
'params' => array(
'banque' => array(),
'utilisateur' => array(),
'profil' => array(),
'service' => array(),
'req' => array('req'),
'typeop' => array('id')
),
),
'07'=> array(
'titre' => '07. Recherche',
'params' => array(
'banque' => array(),
'utilisateur' => array(),
'profil' => array(),
'service' => array(),
'typeop' => array('id'),
'denom' => array('denom'),
'type' => array('type'),
'code' => array('code'),
'rechet' => array('rechet'),
'ape' => array('ape'),
),
'liste' => false,
),
);
}
function bdf_modules_fcc()
{
return array(
'G'=> array(
'titre' => 'FCC Simplifié',
'params' => array(
'banque' => array(),
'utilisateur' => array(),
'profil' => array(),
'service' => array('service'),
'req' => array('req'),
'typeop' => array('id')
),
),
'D'=> array(
'titre' => 'FCC Détaillé',
'params' => array(
'banque' => array(),
'utilisateur' => array(),
'profil' => array(),
'service' => array('service'),
'req' => array('req'),
'typeop' => array('id')
),
),
);
}
function bdf_modules_ficp()
{
return array(
'G'=> array(
'titre' => 'FICP',
'params' => array(
'banque' => array(),
'utilisateur' => array(),
'profil' => array(),
'service' => array('service'),
'req' => array('req'),
'typeop' => array('id')
),
),
);
}
function bdf_filetimeover($fichier)
{
$timeover = false;
$dateFile = filemtime($fichier);
$now = mktime(date('G'), date('i'), date('s'), date('m') , date('d'), date('Y'));
$maxTime = mktime(date('G',$dateFile)+$this->filetime, date('i',$dateFile), date('s',$dateFile), date("m",$dateFile), date("d",$dateFile), date("Y",$dateFile));
if($now>$maxTime) $timeover = true;
return $timeover;
}
function displayModule($req, $module, $service, $listModules)
{
//Vérifier que le module existe
if(array_key_exists($module, $listModules))
{
$rech = array(
'denom' => $denom,
'type' => $type,
'code' => $code,
'rechet' => $rechet,
'ape' => $ape,
);
$url = $this->bdf_lien_module($module, $service, $req, $rech);
if($module=='07'){
$filename = false;
} else {
$c = Zend_Registry::get('config');
$filename = $c->profil->path->cache.'/bdf_'.$service.'_'.$req.'_'.$module.'.html';
}
//@todo : Ajouter timeover
$content = '';
if( $filename!==false && file_exists($filename) ) {
$content = file_get_contents($filename);
} else {
$content = trim($this->bdf_loadpage($url));
if( !empty($content) && $filename!==false )
{
file_put_contents($filename, $content);
}
}
return $content;
}
return false;
}
}

159
library/Scores/Cache.php Normal file
View File

@ -0,0 +1,159 @@
<?php
class Cache
{
protected $maxTime = 8;
protected $extension = '.tpl';
protected $filename = null;
protected $cache_loaded = false;
protected $file_loaded;
protected $cache = array();
/**
* Initialise le cache avec un nom
* @param string $name
*/
public function __construct($name = null)
{
$this->filename = Zend_Registry::get('config')->profil->path->cache.'/'.$name.$this->extension;
}
/**
* Détermine si le fichier de cache existe et qu'il n'est pas périmé
*/
public function exist()
{
//Fichier inexistant
if ( !file_exists($this->filename) ) {
return false;
}
//Ficher timeover
if ( $this->timeover($this->filename) ) {
return false;
}
return true;
}
/**
* Encode les données pour les placer dans le cache
* @param unknown_type $array
*/
public function setBlock($array)
{
//Ajout des blocs sérialisés
if(!empty($this->filename)){
$data = base64_encode(serialize($array));
if( !$this->_writefile($data, $this->filename) ) {
return true;
}
}
return false;
}
/**
* Récupére les données du cache et les décode
*/
public function getBlock()
{
$cache = $this->_readfile($this->filename);
if(isset($cache)){
//Traitement
$block = unserialize(base64_decode($cache));
return $block;
} else {
return false;
}
}
/**
* Détermine suivant la date de fichier si celui-ci est périmé
*/
protected function timeover()
{
$dateFile = filemtime($this->filename);
$now = mktime(date('G'), date('i'), date('s'), date("m") , date("d"), date("Y"));
$maxTime = mktime(
date('G',$dateFile)+$this->maxTime,
date('i',$dateFile),
date('s',$dateFile),
date("m",$dateFile),
date("d",$dateFile),
date("Y",$dateFile));
if( $now>$maxTime ) {
return true;
}
return false;
}
/**
* Supprime le fichier de cache
*/
public function deletefile()
{
if(file_exists($this->filename))
return unlink($this->filename);
else
return false;
}
/**
* Lit une ligne dans le fichier
*/
protected function _readfile()
{
if ( ($this->filename != $this->file_loaded) ) {
$this->file_loaded = $this->filename;
if (is_file($this->filename)) {
$cache = file_get_contents($this->filename);
$this->cache = $cache;
}
$this->cache_loaded = true;
} else {
$cache = $this->cache;
}
return $cache;
}
/**
* Ecrit une ligne dans le fichier
* @param string $line
*/
protected function _writefile($line)
{
$fp = fopen($this->filename,'a');
$result = fwrite($fp,$line."\n");
fclose($fp);
return $result;
}
/**
* Caching WorldCheck Data using Zend_cache
*
* @param array $config (elements: path, name, lifetime)
* @param object $class (object of calling class)
* @param string $function (name of member function)
* @param array $param (arguments of member function)
* @param string $file_name (cache filename)
* @return mixed (array object)
*/
public function wcCache($config, $class, $function, $param, $file_name)
{
//caching
$cache_dir = $config['path'].$config['name'];
if (!is_dir($cache_dir)) mkdir($cache_dir, 0777, true);
$frontendOptions = array(
'lifetime' => $config['lifetime'],
'automatic_serialization' => true
);
$backendOptions = array('cache_dir' => $cache_dir);
$cache = Zend_Cache::factory('Output','File',$frontendOptions,$backendOptions);
if(!($cache_data = $cache->load($file_name))) {
$cache_data = new stdClass();
$cache_data = call_user_func_array(array($class, $function), array($param));
$cache->save($cache_data, $file_name);
}
//end
return $cache_data;
}
}

View File

@ -0,0 +1,72 @@
<?php
class ExportCSV
{
protected $entete = array();
protected $enteteKey = array();
protected $data = array();
protected $type = '';
protected $list = array();
public function __construct($data = array(), $type = '')
{
$this->data = $data;
$this->type = $type;
$this->structure();
$this->prepareData();
}
protected function prepareData()
{
$row = 0;
foreach($this->data as $itemKey => $itemVal)
{
foreach($this->enteteKey as $key){
$val = html_entity_decode($itemVal->$key);
$this->list[$row][] = $val;
}
$row++;
}
}
protected function structure()
{
switch($this->type) {
case 'rechercheEntreprise':
$structure = array(
'Siren' => 'Siren',
'Nom' => 'Nom',
'Nom2' => 'Nom2',
'Enseigne' => 'Enseigne',
'Adresse' => 'Adresse',
'Adresse2' => 'Adresse2',
'CP' => 'CP',
'Ville' => 'Ville',
'Sigle' => 'Sigle',
'Siege' => 'Siege',
'Actif' => 'Actif',
'FJ' => 'FJ',
'FJLib' => 'FJLib',
'NafEnt' => 'NafEntLib',
);
break;
default:
break;
}
$this->entete = array_values($structure);
$this->enteteKey = array_keys($structure);
}
public function writeFile($filename)
{
$fp = fopen($filename, 'w');
if (count($this->entete)>0){
fputcsv($fp, $this->entete);
}
foreach ($this->list as $fields) {
$fields = array_map('htmlspecialchars_decode', $fields);
fputcsv($fp, $fields);
}
fclose($fp);
}
}

View File

@ -0,0 +1,142 @@
<?php
class GestionCommande
{
/**
* Liste les commandes Kbis par SIREN
* @param string $siren
*/
public function listCommandesKbisBySiren($siren)
{
$commandes = new Application_Model_CommandesKbis();
return $commandes->getCommandesKbisBySiren($siren);
}
/**
* Liste les commandes Kbis par numéro de commande
* @param string $num G<NNNN>
* @return array
*/
public function listCommandesKbisByNum($num)
{
$commandes = new Application_Model_CommandesKbis();
$id = substr($num, 1);
return $commandes->getCommandesKbisById($id);
}
/**
* Liste les commandes Kbis
* @param string $date
* @param int $etat
* @param string $mode
* @return array
*/
public function listCommandesKbis($date, $etat, $mode)
{
$commandes = new Application_Model_CommandesKbis();
return $commandes->getCommandes($date, $etat, $mode);
}
public function listCommandesGreffeByNum($num)
{
$commandes = new Application_Model_Commandes();
$id = substr($num, 1);
return $commandes->getCommandesById($id);
}
public function listCommandesGreffeBySiren($siren)
{
$commandes = new Application_Model_Commandes();
return $commandes->getCommandesBySiren($siren);
}
public function listCommandesGreffeByLogin($login, $timestamp)
{
$commandes = new Application_Model_Commandes();
return $commandes->getCommandesByLogin($login, $timestamp);
}
public function listCommandesGreffe($date, $etat, $mode)
{
if ($mode=='-') $mode = '';
$commandes = new Application_Model_Commandes();
return $commandes->getCommandes($date, $etat, $mode);
}
public function listAllStatus()
{
$commandeStatut = new Application_Model_CommandesStatut();
return $commandeStatut->getStatut()->toArray();
}
/**
*
* Enter description here ...
*/
public function listStatus($mode)
{
$commandeStatut = new Application_Model_CommandesStatut();
return $commandeStatut->getStatutByTypeCommande($mode)->toArray();
}
/**
* Change l'état d'une commande
* @param integer $id
* @param integer $etat
* @param string $type
*/
public function changeEtatGreffe($id, $etat, $type = 'C')
{
$commandeStatut = new Application_Model_CommandesStatut();
$sql = $commandeStatut->select()
->from('commandes_statut')
->columns('id')
->where('typeCommande = ?', $type)
->order('ordre DESC')
->limit(1);
$rows = $commandeStatut->fetchAll($sql);
$trigger = NULL;
if ($rows->count()>0){
$trigger = $rows[0]->id;
}
$commande = new Application_Model_Commandes();
$data = array( 'statutCommande' => $etat );
if ($etat == $trigger){
$data['dateReception'] = date('Y-m-d H:i:s');
}
return $commande->update($data, 'idCommande = '.$id);
}
/**
* Change l'état d'une commande
* @param integer $id
* @param integer $etat
* @param string $type
*/
public function changeEtatKbis($id, $etat, $type = 'C')
{
$commandeStatut = new Application_Model_CommandesStatut();
$sql = $commandeStatut->select()
->from('commandes_statut')
->columns('id')
->where('typeCommande = ?', $type)
->order('ordre DESC')
->limit(1);
$rows = $commandeStatut->fetchAll($sql);
$trigger = NULL;
if ($rows->count()>0){
$trigger = $rows[0]->id;
}
$commande = new Application_Model_CommandesKbis();
$data = array( 'statutCommande' => $etat );
if ($etat == $trigger){
$data['dateReception'] = date('Y-m-d H:i:s');
}
return $commande->update($data, 'id = '.$id);
}
}

50
library/Scores/Google.php Normal file
View File

@ -0,0 +1,50 @@
<?php
class Google
{
protected $url = 'http://maps.google.fr/maps?f=q&hl=fr&geocode=&q=';
protected $urlPhoto = '';
public function getGoogleKey($domain)
{
switch ($domain) {
case 'extranet.sd.dev':
return 'ABQIAAAAuKBtUyFonYJBl1fqfc78tRTTQao-JYbZvohjws19Eq-s8HocrxTKnnmfOnWxcHe01UHRIkRkZ1f17Q';
break;
case 'extranet.sd.lan':
return 'ABQIAAAAuKBtUyFonYJBl1fqfc78tRSKTEtsiH12Xc5SNL4Zmo_wRXVkrxR4jPIy3GOKGzZxBEOkvOsLG2CJ3w';
break;
case 'extranet-2.0.sd.lan':
return 'ABQIAAAAuKBtUyFonYJBl1fqfc78tRTy4fRlC-SwcCZRiggZoieobzFAiRR6bORav5_Dl3324CqVALrh-ciGFQ';
break;
case 'extranetrec.scores-decisions.com':
return 'ABQIAAAAuKBtUyFonYJBl1fqfc78tRQQcNgS-tLiAG-ic2CW9PypgC_xRhTjSL9-5iBPvj3GA1_AvZYQU_QR3Q';
break;
case 'extranet.scores-decisions.com':
//return 'ABQIAAAAuKBtUyFonYJBl1fqfc78tRQvADPcxwXf3Q2QIE-M32vuSkrxiBRLUHDB_YSLeTscTDeWRKM_wILaaw';
return 'ABQIAAAAuKBtUyFonYJBl1fqfc78tRSYaqxLwFTMDT_MtTSFor1bsUZ_ChTvuzyTINkPMlW88Ar9fofaphzN3w';
break;
}
}
protected function supprDecimales($dec)
{
if ($dec>0 )
return floor($dec);
else
return ceil($dec);
}
public function dec2dms($dec)
{
$d = $this->supprDecimales($dec);
$m = $this->supprDecimales(($dec - $d) * 60);
$s = abs(round(((($dec - $d) * 60) - $m) * 60));
$m = abs($m);
return $d.'°'.$m."'".$s.'"';
}
public function getGoogleMapLink($q)
{
return $this->url.$q;
}
}

View File

@ -0,0 +1,185 @@
<?php
/**
* https://developers.google.com/maps/documentation/streetview/
* Image de 640x640 max
* Heading 0 à 360
* 0, 45, 90, 135, 180, 225, 270, 315
* Récup de chaque image enregistré SIRET-DEG
*/
class Scores_Google_Streetview
{
/**
* Service URL
* @var string
*/
protected $url = 'http://maps.googleapis.com/maps/api/streetview?';
/**
* Max size 640x640
* @var string
*/
protected $size = '640x640';
/**
* GPS ou Adresse
* @var strign
*/
protected $location = null;
/**
* Defaut 90, Max 120, represents zoom, with smaller numbers indicating a higher level of zoom
* @var unknown
*/
protected $fov = 90;
/**
* (default is 0) Specifies the up or down angle of the camera relative to the Street View vehicle
* @var unknown
*/
protected $pitch = 0;
/**
* (optional) identifies your application for quota purposes
* @var string
*/
protected $key = null;
/**
* always false
* @var string
*/
protected $sensor = 'false';
/**
* Indicates the compass heading of the camera (0 to 360)
*/
protected $heading = 0;
/**
* Number of image by the circle (360°)
* @var int
*/
protected $nbImage = 8;
/**
* File extension
* @var string
*/
protected $extension = 'jpg';
/**
* Path where files are stored
*/
protected $path = '';
/**
*
*/
public function __construct()
{
$this->size = '320x320';
$c = Zend_Registry::get('config');
$ths->path = realpath($c->profil->path->data).'/google/streetview';
}
/**
*
* @param unknown $lattitude
* @param unknown $longitude
*/
public function setLocationGeo($lattitude, $longitude)
{
$this->location = $lattitude.','.$longitude;
}
/**
*
* @param unknown $adresse
*/
public function setLocationTxt($adresse){}
/**
*
* @param unknown $num
*/
public function setHeading($num)
{
$this->heading = $num;
}
/**
*
* @return multitype:number
*/
public function getNumDeg()
{
$mark = array();
$deg = 360/$this->nbImage;
$i=$calc=0;
while ($calc<360) {
$mark[$i] = $calc;
$calc+=$deg;
$i++;
}
return $mark;
}
/**
*
* @return string
*/
public function urlImg()
{
$url = '';
$params = array( 'size', 'location', 'fov', 'pitch', 'sensor', 'heading' );
foreach ($params as $param) {
if ( $this->{$param} !== null ) {
$url.= '&'.$param.'='. $this->{$param};
}
}
return $this->url . substr($url,1);
}
/**
*
*/
public function getImg()
{
require_once 'common/curl.php';
$page = getUrl($this->url, '', '', '', false);
if ( !in_array($page['code'], array(400, 408, 403)) ) {
$body = $page['body'];
file_put_contents($this->pathImg(), $body);
}
}
/**
*
* @return string
*/
public function pathImg()
{
$filename = $this->siret.'-'.$this->heading . '.' . $this->extension;
return $this->path . DIRECTORY_SEPARATOR . $filename;
}
/**
*
* @return string
*/
public function display()
{
$file = $this->pathImg();
if ( !file_exists($file) ) {
$this->getImg();
}
return basename($file);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,233 @@
<?php
class IdentiteProcol
{
protected $identite;
protected $annonces = array();
protected $procol;
/**
* Construit l'identite entreprise afin de retourner les éléments formatter
* pour l'affichage
* @param stdClass $infos
*
*/
public function __construct($infos)
{
$this->identite = $infos->Identite;
$this->procol = new stdClass();
$this->procol->LibTypeEtab = $infos->LibTypeEtab;
$this->procol->StatutsConstDepot = $infos->StatutsConstDepot;
$this->procol->StatutsConst = $infos->StatutsConst;
$this->procol->StatutsModifDepot = $infos->StatutsModifDepot;
$this->procol->StatutsModif = $infos->StatutsModif;
$this->procol->CessionJugeLib = $infos->CessionJugeLib;
$this->procol->CessionJugeDate = $infos->CessionJugeDate;
$this->procol->CessionAvisBodac = $infos->CessionAvisBodac;
$this->procol->CessionInvenDate = $infos->CessionInvenDate;
$this->procol->CessionCAdeclare = $infos->CessionCAdeclare;
$this->procol->CessionEffectif = $infos->CessionEffectif;
$this->procol->CessionDesc = $infos->CessionDesc;
$this->procol->CessionDescDate = $infos->CessionDescDate;
$this->procol->CessionOffreDate = $infos->CessionOffreDate;
$this->procol->CessionMandataire = $infos->CessionMandataire;
//Regroupement des annonces suivant le code even
if(count($infos->Annonces->item)>0) {
foreach ($infos->Annonces->item as $annonce) {
foreach($annonce->evenements->item as $even) {
$this->annonces[$even->CodeEven] = $annonce;
}
}
}
Zend_Registry::get('firebug')->info($this->annonces);
$this->view = new Zend_View();
}
/**
* Sélectionne les annonces
* @param string $codeAnnonces
* : => 2100:2199 Selection de toutes les annonces de 2100 à 2199
* - => 2100-2102 Selection des annonces
*/
public function searchBlockAnnonces($codeAnnonces)
{
// : => 2100:2199 Selection de toutes les annonces de 2100 à 2199
// - => 2100-2102 Selection des annonces
$listAnnonces = explode('-', $codeAnnonces);
$interAnnonces = array();
foreach($listAnnonces as $item) {
$interAnnonces[] = explode(':', $item);
}
//Remplissage du tableau pour les intervalles
for($i=0;$i<count($interAnnonces);$i++) {
if(count($interAnnonces[$i])>1) {
$start = $interAnnonces[$i][0];
$cpt = $start;
$tabTemp = array();
while($cpt<$interAnnonces[$i][1]){
$tabTemp[] = $cpt;
$cpt++;
}
$interAnnonces[$i] = $tabTemp;
}
}
$outputAnnonces = array();
//Parcours des annonces
foreach($interAnnonces as $tabCodeEven) {
foreach($tabCodeEven as $code_even) {
if(array_key_exists($code_even, $this->annonces)){
$outputAnnonces[] = $this->annonces[$code_even];
unset($this->annonces[$code_even]);
}
}
}
return $outputAnnonces;
}
/**
* Affiche les annonces sélectionnées
* @param array $annonces
* Tableau d'annonces sélectionnées
*/
public function dAnnonces($annonces)
{
$output = '';
if(is_array($annonces) && count($annonces)>0)
{
foreach($annonces as $annonce)
{
$output.= '<p class="libAnnonces">';
switch($annonce->BodaccCode)
{
case 'BALO': $vue = 'balo'; break;
case 'ASSO': $vue = 'asso'; break;
case 'BODA':
case 'BODB':
case 'BODC':
default: $vue = 'bodacc'; break;
}
$href = $this->view->url(array(
'controller' => 'juridique',
'action' => 'annonces',
'siret' => $this->identite->Siret,
'idAnn' => $annonce->id,
'vue' => $vue,
));
$output.= '<a href="'.$href.'">';
$output.= html_entity_decode($annonce->evenements->item[0]->LibEven);
$output.= '</a>';
if(!empty($annonce->dateJugement) && substr($annonce->dateJugement,0,4)!='0000') $output.= ', le '.WDate::dateT('Y-m-d','d/m/Y',$annonce->dateJugement);
elseif(!empty($annonce->dateEffet) && substr($annonce->dateEffet,0,4)!='0000') $output.= ', le '.WDate::dateT('Y-m-d','d/m/Y',$annonce->dateEffet);
$output.= ', publié au ';
$tabSource=explode('-', $annonce->BodaccCode);
$source=$tabSource[0];
$idSource=@$tabSource[1];
if ($source[0] == 'B'){
$output.= 'BODACC n&deg;'.$annonce->BodaccNum.' '.substr($source,-1);
}elseif ($source[0] == 'G' || $source[0] == 'T'){
$output.= 'Greffe';
}elseif ($source[0] == 'P'){
$output.= 'RNCS';
}else{
$output.='JAL';
}
if(!empty($annonce->DateParution)) $output.= ' le '.WDate::dateT('Y-m-d','d/m/Y',$annonce->DateParution);
$output.= '</p>';
}
}
return $output;
}
public function getTypeEtabLabel()
{
return 'Type d\'Etablissement';
}
public function getTypeEtabTexte()
{
if( $this->procol->LibTypeEtab=='N/C' || $this->procol->LibTypeEtab=='')
return false;
return $this->procol->LibTypeEtab;
}
public function getStatutsConstLabel()
{
return 'Dépot des statuts';
}
public function getStatutsConstTexte()
{
$data = '';
if(!empty($this->procol->StatutsConst) && $this->procol->StatutsConst!='0000-00-00')
{
$data.= 'Constitués le '.WDate::dateT('Y-m-d', 'd/m/Y', $this->procol->StatutsConst);
}
if(!empty($this->procol->StatutsConstDepot) && $this->procol->StatutsConstDepot!='0000-00-00')
{
$data.= ' en dépôt du '.WDate::dateT('Y-m-d', 'd/m/Y', $this->procol->StatutsConstDepot);
}
if(empty($data)) return false;
return $data;
}
public function getStatutsModifLabel()
{
return 'Modification des statuts';
}
public function getStatutsModifTexte()
{
$data = '';
if(!empty($this->procol->StatutsModif) && $this->procol->StatutsModif!='0000-00-00')
{
$data.= 'Modifiés le '.WDate::dateT('Y-m-d', 'd/m/Y', $this->procol->StatutsModif);
}
if(!empty($this->procol->StatutsModifDepot) && $this->procol->StatutsModifDepot!='0000-00-00')
{
$data.= ' en dépôt du '.WDate::dateT('Y-m-d', 'd/m/Y', $this->procol->StatutsModifDepot);
}
if(empty($data)) return false;
return $data;
}
public function getCessionOffreDateLabel()
{
return '';
}
public function getCessionOffreDateTexte()
{
if (empty($this->procol->CessionOffreDate)) return false;
return 'Offres de reprises possibles jusqu\'au '.
WDate::DateT('Y-m-d', 'd/m/Y', $this->procol->CessionOffreDate);
}
public function getCessionInvenDateLabel()
{
return '';
}
public function getCessionInvenDateTexte()
{
if (empty($this->procol->CessionInvenDate)) return false;
return 'Inventaire déposé au greffe le '.
WDate::DateT('Y-m-d', 'd/m/Y', $this->procol->CessionInvenDate);
}
public function getCessionDescLabel()
{
return '';
}
public function getCessionDescTexte()
{
if (empty($this->procol->CessionDesc)) return false;
return 'Actifs concernés '.$this->procol->CessionDesc;
}
}

62
library/Scores/Iris.php Normal file
View File

@ -0,0 +1,62 @@
<?php
class Iris
{
protected static $timeout = 10;
protected $pathIrisPdf;
protected $codeCommune;
protected $erreur = '';
public function __construct($codeCommune)
{
require_once 'common/curl.php';
$c = Zend_Registry::get('config');
$this->pathIrisPdf = realpath($c->profil->path->data).'/iris';
$this->codeCommune = $codeCommune;
}
/**
* Récupére l'avis de situtation à partir du site au format pdf
* @param string $format Format 'pdf' ou 'array'
* @param boolean $force True aller obligatoirement le chercher à l'insee
* @return string Le PDF demandé
*/
function get($format='pdf', $force=0)
{
$force=$force*1;
$date=date('Ymd');
if (!file_exists($this->pathIrisPdf)) mkdir($this->pathIrisPdf);
$fichier = $this->pathIrisPdf.'/carte_iris_'.$this->codeCommune.'.pdf';
if ($format!='pdf') return 'Format pdf uniquement';
if ($force==0 && file_exists($fichier))
{
// On délivre le fichier
return file_get_contents($fichier);
}
else
{
$url = 'http://www.insee.fr/fr/methodes/zonages/iris/cartes/carte_iris_'.$this->codeCommune.'.pdf';
$referer = $cookie = '';
$page = getUrl($url, $cookie, '', $referer, false, 'www.insee.fr', '', $this->timeout);
//Code en 4xx ou 5xx signifie une erreur du serveur
$codeN = floor($page['code']/100);
if($codeN==4 || $codeN==5 || substr($page['body'],0,4)!='%PDF')
{
$this->erreur = "Fichier introuvable à l'insee !";
return false;
}
else
{
$fp = fopen($fichier, "w");
fwrite($fp, $page['body']);
fclose($fp);
return $page['body'];
}
}
}
public function erreur()
{
return $this->erreur;
}
}

112
library/Scores/Logo.php Normal file
View File

@ -0,0 +1,112 @@
<?php
class Logo
{
protected $path = '';
protected $siren;
protected $isin = null;
protected $logoNom = '';
protected $logoSize = '';
public function __construct($siren, $isin = null)
{
$c = Zend_Registry::get('config');
$this->path = realpath($c->profil->path->data).'/logos';
$this->siren = $siren;
$this->isin = $isin;
}
public function affiche()
{
// Ne pas afficher le logo si il n'existe pas OU
// si le siren est à 0 OU si le siren est inférieur a 100
$logo = $this->exist($this->siren, $this->isin);
if ( $logo && (intval($this->siren)!=0 || intval($this->siren)>100) )
{
$tabTmp = @getimagesize($this->path.'/'.$logo);
$w = $tabTmp[0];
$h = $tabTmp[1];
if ($w > 350) {
$strSize = $this->redimage($this->path.'/'.$logo, 350, 150);
} else {
$strSize = '';
}
return '<img src="/fichier/logo/'.$logo.'" '.$strSize.'/>';
}
return '';
}
public function getFromUrl($siteWeb)
{
$img = false;
require_once 'common/curl.php';
if (substr($siteWeb,-1)!='/') $siteWeb.='/';
$arrUrl = parse_url($siteWeb);
$page = getUrl($siteWeb, '', '', '', false, $arrUrl['host'], '', 3);
$body = $page['body'];
if (preg_match('/<img(?:.*)src=(?:"|\')((?:.*)logo(?:.*)(?:gif|png|jpg|jpeg))/Ui', $body, $matches)) {
$logo = trim(strtr($matches[1],'"\'',' '));
$urlLogo = $siteWeb.$logo;
$tmp = explode('.', basename($logo));
$ext = end($tmp);
$page = getUrl($urlLogo, '', '', $siteWeb, false, $arrUrl['host']);
if($page['code']!=400)
{
$body = $page['body'];
$img = $this->path.'/'.$this->siren.'.'.$ext;
$fp = fopen($img, 'a');
fwrite($fp, $body);
fclose($fp);
chmod($img, 0755);
}
}
return $img;
}
public function exist()
{
$img_ext = array('gif', 'png', 'jpg', 'jpeg');
$ext = '';
// Recherche le logo avec le siren
$locImg = $this->path.'/'.$this->siren;
foreach($img_ext as $extension){
if( file_exists($locImg.'.'.$extension) ) {
return $this->siren.'.'.$extension;
break;
}
}
// Recherche de logos avec le code isin
if(!empty($this->isin))
{
$locImg = $this->path.'/'.$this->isin;
foreach($img_ext as $extension) {
if( file_exists($locImg.'.'.$extension) ) {
return $this->isin.'.'.$extension;
break;
}
}
}
return false;
}
function redimage($img_src,$dst_w,$dst_h) {
// Lit les dimensions de l'image
$size = getimagesize($img_src);
$src_w = $size[0]; $src_h = $size[1];
// Teste les dimensions tenant dans la zone
$test_h = round(($dst_w / $src_w) * $src_h);
$test_w = round(($dst_h / $src_h) * $src_w);
// Si Height final non précisé (0)
if(!$dst_h) $dst_h = $test_h;
// Sinon si Width final non précisé (0)
elseif(!$dst_w) $dst_w = $test_w;
// Sinon teste quel redimensionnement tient dans la zone
elseif($test_h>$dst_h) $dst_w = $test_w;
else $dst_h = $test_h;
// Affiche les dimensions optimales
return "width=".$dst_w." height=".$dst_h;
}
}

113
library/Scores/Mail.php Normal file
View File

@ -0,0 +1,113 @@
<?php
class Mail
{
protected $config;
protected $mail;
/**
* Gestion de l'envoi des mails en fonction de la configuration
*/
public function __construct()
{
$c = Zend_Registry::get('config');
$this->config = $c->profil->mail;
$this->mail = new Zend_Mail();
if ($this->config->method == 'smtp') {
$tr = new Zend_Mail_Transport_Smtp($this->config->smtp_host);
$this->mail->setDefaultTransport($tr);
} elseif ($this->config->method == 'smtpauth') {
$cnfg = array(
'auth' => 'login',
'username' => $this->config->username,
'password' => $this->config->password
);
$tr = new Zend_Mail_Transport_Smtp($this->config->smtp_host, $cnfg);
$this->mail->setDefaultTransport($tr);
} else {
$tr = new Zend_Mail_Transport_Sendmail();
$this->mail->setDefaultTransport($tr);
}
}
/**
* Champ From en fonction de la clé de configuration
* @param string $configKey
*/
public function setFrom($configKey)
{
$email = $this->config->email->$configKey;
$this->mail->setFrom($email, ucfirst($configKey));
}
/**
* Set Reply-To address
* @param string $email
*/
public function setReplyTo($email)
{
$this->mail->setReplyTo($email);
}
/**
* Champ To en fonction de la clé de configuration
* @param string $configKey
*/
public function addToKey($configKey)
{
$email = $this->config->email->$configKey;
$this->mail->addTo($email, ucfirst($configKey));
}
/**
* Ajout d'un champ To en spécifiant l'email et le nom qui doit apparaitre
* @param string $email
* @param string $nom
*/
public function addTo($email, $nom = '')
{
$this->mail->addTo($email, $this->txtConvert($nom));
}
/**
* Définit le sujet de l'email
* @param string $texte
*/
public function setSubject($texte = '')
{
$this->mail->setSubject($this->txtConvert($texte));
}
/**
* Définit le corps de l'email au format texte
* @param string $texte
*/
public function setBodyTexte($texte = '')
{
$this->mail->setBodyText($this->txtConvert($texte));
}
/**
* Définit le corps de l'email au format html
* @param string $html
*/
public function setBodyHtml($html = '')
{
$this->mail->setBodyHtml($this->txtConvert($html));
}
/**
* Envoi de l'emai
*/
public function send()
{
return $this->mail->send();
}
//We suppose that character encoding of strings is UTF-8 on PHP script.
protected function txtConvert($string) {
return mb_convert_encoding($string, 'ISO-8859-1', 'UTF-8');
}
}

76
library/Scores/Mappy.php Normal file
View File

@ -0,0 +1,76 @@
<?php
class Mappy
{
protected $login = 'scoresdecisions';
protected $password = 'g1nq3iKv';
protected $villes = array(
'BORDEAUX',
'CAEN' ,
'CANNES',
'GRENOBLE',
'LA BAULE',
'LILLE',
'LYON',
'MARSEILLE',
'MONTPELLIER',
'NANCY',
'NANTES',
'NICE',
'RENNES',
'STRASBOURG',
'TOULOUSE',
'ASNIERES-SUR-SEINE',
'BOULOGNE-BILLANCOURT',
'COURBEVOIE',
'ISSY-LES-MOULINEAUX',
'LEVALLOIS-PERRET',
'MONTROUGE',
'NANTERRE',
'NEUILLY-SUR-SEINE',
'RUEIL-MALMAISON',
'SEVRES',
'VERSAILLES',
'PARIS'
);
public function getToken()
{
$ACCESSOR_URL = 'http://axe.mappy.com/1v1/';
$timestamp = time();
$hash = md5($this->login."@".$this->password."@".$timestamp);
$preToken = $this->login."@".$timestamp."@".$hash;
$urlGetToken = $ACCESSOR_URL . 'token/generate.aspx?auth=' . urlencode($preToken) . '&ip=' . urlencode($_SERVER["REMOTE_ADDR"]);
$fh = @fopen($urlGetToken, 'rb');
if ($fh == false) return false;
$token = '';
while (!feof($fh))$token .= fread($fh, 8192);
fclose($fh);
return ($token);
}
protected function cleanAdress($ville)
{
$ville = ' '.trim(preg_replace('/([0-9]|ARRONDISSEMENT|_)/i', ' ', $ville)).' ';
$ville = trim(strtr($ville, array(' EME ' => '', ' ER ' => '')));
return (ucwords(strtolower($ville)));
}
public function villeCouverte($ville)
{
$ville = $this->cleanAdress($ville);
if (in_array(strtoupper($ville),$this->villes)){
return true;
}
return false;
}
public function getJs()
{
$token = $this->getToken();
$href = 'http://axe.mappy.com/1v1/init/get.aspx?auth='.$token.'&version=2.16&solution=ajax';
return $href;
}
}

944
library/Scores/Menu.php Normal file
View File

@ -0,0 +1,944 @@
<?php
class Menu
{
protected $menu = null;
protected $siret = null;
protected $id = 0;
protected $lienref = null;
/**
* Définition du menu avec ces groupes et pages
* Groupes
* => label : titre du menu
* => check : nom du controller
* => permission : code de la permission nécessaire pour l'affichage
* activateMenu : Définir controller/action pour activer le menu
* => controller : nom du controller
* => action : nom de l'action
* Pages
* => label : titre de la page
* => title : titre de l'infobulle
* => controller : nom du controller
* => action : nom de l'action
* => permission : code de la permission nécessaire pour l'affichage
* => forceVisible : boolean, affiche le menu en grisé même si l'utilisateur n'a pas la permission
* @var array
*/
protected $defineMenu = array(
array(
'label' => 'RECHERCHES',
'activateMenu' => array(
array('controller'=>'recherche', 'action'=>'liste'),
array('controller'=>'recherche', 'action'=>'list'),
array('controller'=>'recherche', 'action'=>'annonceliste'),
array('controller'=>'recherche', 'action'=>'enquete'),
array('controller'=>'recherche', 'action'=>'refclientliste'),
array('controller'=>'worldcheck', 'action'=>'index'),
array('controller'=>'worldcheck', 'action'=>'matchcontent'),
array('controller'=>'giant', 'action'=>'search'),
array('controller'=>'giant', 'action'=>'identite'),
array('controller'=>'giant', 'action'=>'commandes'),
array('controller'=>'giant', 'action'=>'rapport'),
),
'pages' => array(
array(
'label' => "Rechercher une entreprise",
'title' => "Rechercher une entreprise",
'controller' => 'recherche',
'action' => 'entreprise',
'forceVisible' => true,
),
array(
'label' => "Rechercher par dirigeant",
'controller' => 'recherche',
'action' => 'dirigeant',
'forceVisible' => true,
'permission' => 'SEARCHDIR',
),
array(
'label' => "Recherche Internationale",
'controller' => '',
'action' => '',
'permission' => 'INTERNATIONAL'
),
array( // idClient = 1 && idClient =
'label' => "Rechercher une annonce",
'controller' => 'recherche',
'action' => 'annonce',
'permission' => 'HISTOBODACC',
),
array(
'label' => "Rechercher par actionnaire",
'controller' => 'recherche',
'action' => 'actionnaire',
'forceVisible' => true,
'permission' => 'SEARCHACT',
),
array(
'label' => "Recherche WorldCheck",
'controller' => 'recherche',
'action' => 'worldcheck',
'forceVisible' => false,
'permission' => 'WORLDCHECK',
),
array(
'label' => "Dernière recherche",
'controller' => 'recherche',
'action' => 'last',
),
array(
'label' => "Liste des dernières recherches",
'controller' => 'recherche',
'action' => 'list',
),
array(
'label' => "Centrale IparI",
'controller' => 'recherche',
'action' => 'ipari',
'permission' => 'IPARI',
),
),
),
array(
'label' => 'IDENTITE',
'pages' => array(
array(
'label' => "Fiche d'identité",
'controller' => 'identite',
'action' => 'fiche',
'forceVisible' => true,
'permission' => 'IDENTITE',
),
array(
'label' => "Fiche Procédure Collective",
'controller' => 'identite',
'action' => 'fichepc',
'permission' => 'IDPROCOL'
),
array(
'label' => "Liste des établissements",
'controller' => 'identite',
'action' => 'etablissements',
'forceVisible' => true,
'permission' => 'ETABLISSEMENTS',
),
array(
'label' => "Liens inter-entreprises",
'controller' => 'identite',
'action' => 'liens',
'forceVisible' => true,
'permission' => 'LIENS',
),
array(
'label' => "Informations Groupe",
'controller' => 'identite',
'action' => 'groupe',
'permission' => 'GROUPE'
),
array(
'label' => "Modifications Insee",
'controller' => 'identite',
'action' => 'evenements',
'permission' => 'eveninsee',
'forceVisible' => true,
'permission' => 'EVENINSEE',
),
),
),
array(
'label' => 'DIRIGEANTS',
'activateMenu' => array(
array('controller'=>'dirigeants', 'action'=>'op'),
),
'pages' => array(
array(
'label' => "Liste des dirigeants",
'controller' => 'dirigeant',
'action' => 'liste',
'forceVisible' => true,
'permission' => 'DIRIGEANTS',
),
array(
'label' => "Historique des dirigeants",
'controller' => 'dirigeant',
'action' => 'histo',
'forceVisible' => true,
'permission' => 'DIRIGEANTS',
),
),
),
array(
'label' => 'ELEMENTS FINANCIERS',
'pages' => array(
array(
'label' => "Synthèse",
'controller' => 'finance',
'action' => 'synthese',
'forceVisible' => true,
'permission' => 'SYNTHESE',
),
array(
'label' => "Bilans, Compte de résultat",
'controller' => 'finance',
'action' => 'bilan',
'forceVisible' => true,
'permission' => 'RATIOS',
),
array(
'label' => "Ratios",
'controller' => 'finance',
'action' => 'ratios',
'forceVisible' => true,
'permission' => 'RATIOS',
),
array(
'label' => "Flux de trésorerie",
'controller' => 'finance',
'action' => 'flux',
'forceVisible' => true,
'permission' => 'FLUX',
),
array(
'label' => "Liasse fiscale",
'controller' => 'finance',
'action' => 'liasse',
'forceVisible' => true,
'permission' => 'LIASSE',
),
array(
'label' => "Bourse & Cotations",
'controller' => 'finance',
'action' => 'bourse',
'forceVisible' => true,
'permission' => 'BOURSE',
),
array(
'label' => "Relations bancaires",
'controller' => 'finance',
'action' => 'banque',
'forceVisible' => true,
'permission' => 'BANQUE',
),
),
),
array(
'label' => 'ELEMENTS JURIDIQUES',
'pages' => array(
array(
'label' => "Annonces Légales",
'controller' => 'juridique',
'action' => 'annonces',
'forceVisible' => true,
'permission' => 'ANNONCES',
),
array(
'label' => "Information Réglementée",
'controller' => 'juridique',
'action' => 'infosreg',
'forceVisible' => true,
'permission' => 'INFOSREG',
),
array(
'label' => "Compétences Territoriales",
'controller' => 'juridique',
'action' => 'competences',
'forceVisible' => true,
'permission' => 'COMPETENCES',
),
array(
'label' => "Conventions collectives",
'controller' => 'juridique',
'action' => 'conventions',
'forceVisible' => true,
'permission' => 'CONVENTIONS',
),
array(
'label' => "Marques déposées",
'controller' => 'juridique',
'action' => 'marques',
'permission' => 'MARQUES',
),
),
),
array(
'label' => 'BANQUE DE FRANCE',
'permission' => 'BDF',
'activateMenu' => array(
array('controller'=>'bdf', 'action'=>'module'),
),
'pages' => array(
array(
'label' => "27. Panorama",
'controller' => 'bdf',
'action' => 'module27',
),
array(
'label' => "28. Concours Bancaires",
'controller' => 'bdf',
'action' => 'module28',
),
array(
'label' => "29. Impayés",
'controller' => 'bdf',
'action' => 'module29',
),
array(
'label' => "40. Relations Bancaires",
'controller' => 'bdf',
'action' => 'module40',
),
array(
'label' => "51. Dirigeants",
'controller' => 'bdf',
'action' => 'module51',
),
array(
'label' => "Autres",
'controller' => 'bdf',
'action' => 'index',
),
),
),
array(
'label' => 'EVALUATION',
'activateMenu' => array(
array('controller'=>'evaluation', 'action'=> 'scoringcommande'),
array('controller'=>'evaluation', 'action'=> 'aviscredit'),
),
'pages' => array(
array(
'label' => "IndiScore",
'controller' => 'evaluation',
'action' => 'indiscore',
'permission' => array('indiscore', 'indiscorep'),
'pref' => array('demanderef'),
'forceVisible' => true,
),
array(
'label' => "Rapport de synthèse",
'controller' => 'evaluation',
'action' => 'indiscore2',
'permission' => array('INDISCORE2', 'INDISCORE2P'),
),
array(
'label' => "Rapport complet",
'controller' => 'evaluation',
'action' => 'indiscore3',
'permission' => array('INDISCORE3', 'INDISCORE3P'),
'pref' => array('demanderef'),
),
array(
'label' => "Valorisation",
'controller' => 'evaluation',
'action' => 'valorisation',
'permission' => array('VALORISATION'),
),
array(
'label' => "Scoring Credit Safe",
'controller' => 'evaluation',
'action' => 'scoring',
'permission' => 'SCORECSF',
),
array(
'label' => "Enquête commerciale",
'controller' => 'evaluation',
'action' => 'enquetec',
'permission' => 'ENQUETEC',
),
),
),
array(
'label' => 'PIECES OFFICIELLES',
'activateMenu' => array(
array('controller'=> 'pieces', 'action'=>'cmdassociation'),
array('controller'=> 'pieces', 'action'=>'associationactes'),
array('controller'=> 'pieces', 'action'=>'associationbilans'),
array('controller'=> 'pieces', 'action'=>'cmdcourrier'),
array('controller'=> 'pieces', 'action'=>'kbis'),
array('controller'=> 'pieces', 'action'=>'kbispasserelle'),
),
'pages' => array(
array(
'label' => "Commande de Pièces",
'controller' => 'pieces',
'action' => 'commande',
'permission' => array('KBIS', 'PRIVILEGES'),
),
array(
'label' => "Comptes annuels",
'controller' => 'pieces',
'action' => 'bilans',
'forceVisible' => true,
),
array(
'label' => "Actes & Statuts",
'controller' => 'pieces',
'action' => 'actes',
'forceVisible' => true,
),
array(
'label' => "Suivi Privilèges",
'controller' => 'pieces',
'action' => 'privileges',
'permission' => 'SURVPRIV',
),
),
),
array(
'label' => 'OPTIONS',
'pages' => array(
array(
'label' => 'Nouveautés',
'controller' => 'aide',
'action' => 'newliste',
),
array(
'label' => "Mes options",
'controller' => 'user',
'action' => 'index',
'permission' => 'MONPROFIL'
),
array(
'label' => "Mes surveillances",
'controller' => 'surveillance',
'action' => 'liste',
'permission' => 'SURVLISTE'
),
array(
'label' => "Monitoring",
'controller' => 'giant',
'action' => 'retrive',
),
array(
'label' => "Surveillances fichier",
'controller' => 'surveillance',
'action' => 'fichier',
),
array(
'label' => "Mon portefeuille",
'controller' => 'surveillance',
'action' => 'portefeuille',
'permission' => 'PORTEFEUILLE',
),
array(
'label' => "Administration",
'controller' => 'user',
'action' => 'liste',
),
array(
'label' => "Surveillances",
'controller' => '',
'action' => '',
),
array(
'label' => "Se déconnecter",
'controller' => 'user',
'action' => 'logout',
),
),
),
array(
'label' => 'GESTION S&D',
'check' => 'dashboard',
'activateMenu' => array(
array('controller'=>'dashboard', 'action'=>'clients'),
array('controller'=>'dashboard', 'action'=>'client'),
array('controller'=>'dashboard', 'action'=>'users'),
array('controller'=>'dashboard', 'action'=>'user'),
array('controller'=>'dashboard', 'action'=>'commandes'),
array('controller'=>'dashboard', 'action'=>'prestations'),
array('controller'=>'dashboard', 'action'=>'prestation'),
array('controller'=>'dashboard', 'action'=>'services'),
array('controller'=>'dashboard', 'action'=>'service'),
array('controller'=>'dashboard', 'action'=>'tarifs'),
array('controller'=>'dashboard', 'action'=>'tarif'),
),
'pages' => array(
array(
'label' => "Gestion",
'controller' => 'dashboard',
'action' => 'index',
),
array(
'label' => "Saisie / Edition",
'controller' => 'saisie',
'action' => 'fiche',
),
array(
'label' => "Saisie Fiche Etrangère",
'controller' => 'saisie',
'action' => 'lienetranger',
),
),
),
);
/**
* Construit le menu en fonction des paramètres de l'URL
* @param array $parameters
*/
public function __construct($parameters)
{
require_once 'Scores/SessionEntreprise.php';
//Special case, edit foreign company
if (array_key_exists('lienref', $parameters)) {
$this->lienref = $parameters['lienref'];
} else {
//French Company
if (array_key_exists('siret', $parameters)) {
$this->siret = $parameters['siret'];
}
if (array_key_exists('id', $parameters)) {
$this->id = $parameters['id'];
}
if (empty($this->siret) && empty($this->id)) {
$session = new SessionEntreprise(null);
$this->siret = $session->getSiret();
$this->id = $session->getId();
}
}
//Compute Menu
$this->menu = new Zend_Navigation();
$this->computeMenu();
}
/**
* Retourne le menu généré
*/
public function getMenu()
{
return $this->menu;
}
/**
* Retourne la permission associés à une page
* @param string $controller
* @param string $action
* @return string
*/
public function getPagePermission($controller, $action)
{
$permission = null;
foreach ( $this->defineMenu as $menu )
{
foreach ( $menu['pages'] as $item ) {
if ( $controller == $item['controller']
&& $action == $item['action']
&& array_key_exists('permission', $item) ) {
$permission = $item['permission'];
break;
}
}
}
return $permission;
}
/**
* Retourne la position du groupe à activé
* @param string $controller
* @param string $action
*/
public function getIdMenu($controller, $action)
{
$i = 0;
$stop = false;
foreach($this->defineMenu as $menu){
$perm = true;
if (array_key_exists('permission', $menu)){
$perm = $this->checkPermission($menu['permission']);
}
$visible = true;
if (array_key_exists('check', $menu)){
$visible = $this->checkMenu($menu['check']);
}
foreach($menu['pages'] as $item){
if($controller == $item['controller'] && $action == $item['action']){
$stop = true;
break;
}
}
if (array_key_exists('activateMenu', $menu)){
foreach($menu['activateMenu'] as $item){
if($controller == $item['controller'] && $action == $item['action']){
$stop = true;
break;
}
}
}
if ($stop === true) break;
if ($perm && $visible){
$i++;
}
}
return $i;
}
/**
* Parcours la définition du menu en gérant les permissions et autres
* particularités
*/
protected function computeMenu()
{
foreach($this->defineMenu as $element){
$perm = true;
if (array_key_exists('permission', $element)){
$perm = $this->checkPermission($element['permission']);
}
$visible = true;
if (array_key_exists('check', $element)){
$visible = $this->checkMenu($element['check']);
}
if ($perm && $visible){
$menu = array();
$menu['label'] = $element['label'];
$menu['uri'] = '#';
$menu['class'] = 'header';
if (array_key_exists('pages', $element)){
$menu['pages'] = $this->computePage($element['pages']);
}
$this->menu->addPage($menu);
}
}
}
/**
* Parcours les pages d'un groupe du menu pour vérifier les permissions
* et autres particularités
* @param array $pages
*/
protected function computePage($pages)
{
$computePages = array();
foreach($pages as $page){
$visible = false;
if (array_key_exists('forceVisible', $page)){
$visible = $page['forceVisible'];
}
$perm = true;
if (array_key_exists('permission', $page)){
$perm = $this->checkPermission($page['permission']);
}
if (!$perm && $visible){
$computePage = array();
$computePage['label'] = $page['label'];
$computePage['class'] = 'inactif';
$computePage['uri'] = '#';
$computePages[] = $computePage;
} elseif ($perm){
if ($this->checkParams($page['controller'], $page['action'])){
$computePage = array();
$computePage = $page;
$computePage['params'] = $this->setParams($page['controller'], $page['action']);
if (array_key_exists('pref', $page)){
if ($this->hasPref('demanderef') && in_array('demanderef', $page['pref']) ){ // @todo: Erreur data
$computePage['class'] = 'demanderef';
}
}
$computePages[] = $computePage;
} elseif ($visible) {
$computePage = array();
$computePage['label'] = $page['label'];
$computePage['class'] = 'inactif';
$computePage['uri'] = '#';
$computePages[] = $computePage;
}
}
}
return $computePages;
}
/**
* Vérifie les permissions de l'utilisateur
* @param mixed $perm
*/
protected function checkPermission($perm)
{
$hasPerm = false;
if (is_array($perm)){
$list = $perm;
} else if (is_string($perm)){
$list = (array)$perm;
}
$user = new Scores_Utilisateur();
foreach($list as $permission){
if ($user->checkPerm($permission)){
$hasPerm = true;
break;
}
}
return $hasPerm;
}
/**
* Vérifie préférence utilisateur
* @param string $pref
*/
public function hasPref($pref)
{
$user = new Scores_Utilisateur();
if ($user->checkPref($pref)){
return true;
}
return false;
}
/**
* Permet d'effectuer une vérification pour la visibilité d'un menu (Groupe)
* @param string $controller
*/
protected function checkMenu($controller)
{
switch($controller) {
case 'dashboard':
$user = new Scores_Utilisateur();
if ($user->checkModeEdition() && $user->getIdClient()==1){
return true;
}
return false;
break;
}
}
/**
* Vérifie les paramètres pour un controller et/ou une action
* @param string $controller
* @param string $action
*/
protected function checkParams($controller, $action = '')
{
switch($controller) {
case 'bdf':
return true;
break;
case 'dashboard':
return true;
break;
case 'recherche':
switch($action) {
case 'last':
case 'list':
//Vérifier la présence d'au moins une recherche
require_once 'Scores/RechercheHistorique.php';
$recherches = new RechercheHistorique();
if (count($recherches->liste()>0)){
return true;
}
return false;
break;
case 'annonce':
$user = new Scores_Utilisateur();
if($user->checkPerm('histobodacc')){
return true;
}
return false;
break;
}
return true;
break;
case 'giant':
return true;
break;
case 'user':
switch($action){
case 'liste':
$user = new Scores_Utilisateur();
if ($user->isAdmin() || $user->isSuperAdmin()){
return true;
}
return false;
break;
}
return true;
break;
case 'surveillance':
switch($action) {
case 'fichier':
$user = new Scores_Utilisateur();
if (substr($user->getLogin(),0,6)=='cnasea'
|| strtolower($user->getLogin())=='omni04'
|| strtolower($user->getLogin())=='bodacca3m'
|| strtolower($user->getLogin())=='bodaccomni'
|| strtolower($user->getLogin())=='bodacccrr'
|| strtolower($user->getLogin())=='cpcambr13'
|| strtolower($user->getLogin())=='cpcambr14'
|| strtolower($user->getLogin())=='frbsurveillance'
|| $user->getIdClient()==32
|| $user->getIdClient()==82 ) {
return true;
} else {
return false;
}
break;
}
return true;
break;
case 'identite':
switch($action) {
case 'fiche':
case 'fichepc':
if ( !empty($this->siret) && intval($this->siret)!=0 ){
return true;
}
if ( !empty($this->id) && intval($this->id)!=0 ){
return true;
}
return false;
break;
case 'groupe':
case 'etablissements':
case 'evenements':
if ( !empty($this->siret) && intval($this->siret)!=0 ){
return true;
}
return false;
break;
case 'liens':
if ( !empty($this->lienref) ){
return true;
}
if ( !empty($this->siret) && intval($this->siret)!=0 ){
return true;
}
return false;
break;
}
break;
case 'dirigeant':
if ( !empty($this->siret) && intval($this->siret)!=0 ){
return true;
}
return false;
break;
case 'finance':
if ( !empty($this->siret) && intval($this->siret)!=0 ){
return true;
}
return false;
break;
case 'juridique':
if ( !empty($this->siret) && intval($this->siret)!=0 ){
return true;
}
switch($action){
case 'annonces':
if ( !empty($this->id) && intval($this->id)!=0 ){
return true;
}
break;
}
return false;
break;
case 'evaluation':
switch($action){
case 'indiscore':
$siretSiege = substr($this->siret, 0,9);
if (!empty($siretSiege) && intval($siretSiege)!=0 ){
return true;
}
return false;
break;
}
if ( !empty($this->siret) && intval($this->siret)!=0 ){
return true;
}
return false;
break;
case 'pieces':
if ( !empty($this->siret) && intval($this->siret)!=0 ){
return true;
}
return false;
break;
case 'saisie':
switch($action){
case 'fiche':
if ( !empty($this->id) && intval($this->id)!=0 ){
return true;
}
break;
case 'lienetranger':
return true;
break;
}
return false;
break;
case 'aide':
return true;
break;
}
}
/**
* Définit les paramètres nécessaire pour les liens des pages
* @param string $controller
* @param string $action
*/
protected function setParams($controller, $action)
{
$params = array();
/**
* Réinitialiser la route pour avoir toujours les liens du menu propre
*/
$params['route'] = null;
switch($controller)
{
case 'recherche':
switch($action){
case 'ipari':
if (!empty($this->siret)) { $params['siret'] = $this->siret; }
break;
}
break;
case 'evaluation':
if (!empty($this->siret)) { $params['siret'] = substr($this->siret,0,9); }
if (!empty($this->id)) { $params['id'] = $this->id; }
break;
case 'identite':
switch($action){
case 'liens':
if (!empty($this->lienref)) { $params['lienref'] = $this->lienref; }
if (!empty($this->siret)) { $params['siret'] = $this->siret; }
if (!empty($this->id)) { $params['id'] = $this->id; }
break;
default:
if (!empty($this->siret)) { $params['siret'] = $this->siret; }
if (!empty($this->id)) { $params['id'] = $this->id; }
break;
}
break;
case 'pieces':
case 'finance':
case 'dirigeant':
if (!empty($this->siret)) { $params['siret'] = $this->siret; }
if (!empty($this->id)) { $params['id'] = $this->id; }
break;
case 'juridique':
if (!empty($this->siret)) { $params['siret'] = $this->siret; }
if (!empty($this->id)) { $params['id'] = $this->id; }
break;
case 'saisie':
switch($action){
case 'fiche':
if (!empty($this->siret)) { $params['siret'] = $this->siret; }
if (!empty($this->id)) { $params['id'] = $this->id; }
break;
}
break;
case 'bdf':
if (!empty($this->siret)) {
$params['siret'] = $this->siret;
}
break;
}
return $params;
}
}

View File

@ -0,0 +1,158 @@
<?php
class PagePrint
{
protected $controller = null;
protected $action = null;
protected $pagePRINT = array(
'identite-fiche' => 'siret,id',
'identite-fichepc' => 'siret,id',
'identite-etablissements' => 'siret,id,actif',
'identite-liens' => 'siret,id',
'identite-groupe' => 'siret',
'identite-evenements' => 'siret,id',
'dirigeant-liste' => 'siret,id',
'dirigeant-histo' => 'siret,id',
'finance-synthese' => 'siret,id,typeBilan',
'finance-bilan' => 'siret,id,typeBilan',
'finance-ratios' => 'siret,id,typeBilan,mil',
'finance-liasse' => 'siret,id,unit,date',
'finance-bourse' => 'siret,id',
'finance-banque' => 'siret,id',
'juridique-annonces' => 'siret,id,idAnn,vue,p',
'juridique-infosreg' => 'siret,id',
'juridique-competences' => 'siret,id,type',
'juridique-marques' => 'siret,id,idObject',
'evaluation-indiscore' => 'siret,id',
'evaluation-indiscore2' => 'siret,id',
'evaluation-indiscore3' => 'siret,id',
'evaluation-scoring' => 'siret,id',
'evaluation-valorisation' => 'siret,id',
'pieces-bilans' => 'siret,id',
'pieces-actes' => 'siret,id',
'giant-full' => 'Pays,Type,CompanyId',
'giant-compact' => 'Pays,Type,CompanyId',
'giant-creditrecommendation' => 'Pays,Type,CompanyId',
'surveillance-fichier' => 'nomFic,filtre',
'worldcheck-matchcontent' => 'matchIdentifier',
);
protected $pagePDF = array(
'identite-fiche' => 'siret,id',
'identite-fichepc' => 'siret,id',
'identite-etablissements' => 'siret,id,actif',
'identite-liens' => 'siret,id',
'identite-groupe' => 'siret',
'identite-evenements' => 'siret,id',
'dirigeant-liste' => 'siret,id',
'dirigeant-histo' => 'siret,id',
'finance-synthese' => 'siret,id,typeBilan',
'finance-bilan' => 'siret,id,typeBilan',
'finance-ratios' => 'siret,id,typeBilan,mil',
'finance-liasse' => 'siret,id,unit,date',
'finance-bourse' => 'siret,id',
'finance-banque' => 'siret,id',
'juridique-annonces' => 'siret,id,idAnn,vue,p',
'juridique-infosreg' => 'siret,id',
'juridique-competences' => 'siret,id,type',
'juridique-marques' => 'siret,id,idObject',
'evaluation-indiscore' => 'siret,id',
'evaluation-indiscore2' => 'siret,id',
'evaluation-indiscore3' => 'siret,id',
'evaluation-scoring' => 'siret,id',
'evaluation-valorisation' => 'siret,id',
'pieces-bilans' => 'siret,id',
'pieces-actes' => 'siret,id',
'giant-full' => 'Pays,Type,CompanyId',
'giant-compact' => 'Pays,Type,CompanyId',
'giant-creditrecommendation' => 'Pays,Type,CompanyId',
'worldcheck-matchcontent' => 'matchIdentifier',
);
protected $pageXML = array(
'identite-fiche' => 'siret,id',
'identite-fichepc' => 'siret,id',
'identite-etablissements' => 'siret,id,actif',
'identite-liens' => 'siret,id',
'identite-evenements' => 'siret,id',
'dirigeant-liste' => 'siret,id',
'dirigeant-histo' => 'siret,id',
'finance-synthese' => 'siret,id,typeBilan',
'finance-bilan' => 'siret,id,typeBilan',
'finance-ratios' => 'siret,id,typeBilan,mil',
'finance-liasse' => 'siret,id,unit,date',
'finance-bourse' => 'siret,id',
'finance-banque' => 'siret,id',
'juridique-annonces' => 'siret,id,idAnn,vue,p',
'juridique-infosreg' => 'siret,id',
'juridique-competences' => 'siret,id,type',
'juridique-marques' => 'siret,id,idObject',
'evaluation-indiscore' => 'siret,id',
'evaluation-indiscore2' => 'siret,id',
'evaluation-indiscore3' => 'siret,id',
'evaluation-valorisation' => 'siret,id',
'worldcheck-matchcontent' => 'matchIdentifier',
);
public function __construct($controller, $action)
{
$this->controller = $controller;
$this->action = $action;
}
protected function getTypeElement($type)
{
$element = array();
switch($type){
case 'print':
$element = $this->pagePRINT;
break;
case 'pdf':
$element = $this->pagePDF;
break;
case 'xml':
$element = $this->pageXML;
break;
}
return $element;
}
public function exportable($type)
{
$element = $this->getTypeElement($type);
if (array_key_exists($this->controller.'-'.$this->action, $element)){
return true;
}
return false;
}
public function filename($type, $params = array())
{
$element = $this->getTypeElement($type);
$filename = $this->controller.'-'.$this->action;
$key = $this->controller.'-'.$this->action;
if (array_key_exists($key, $element)){
$part = explode(',', $element[$key]);
foreach( $part as $item ){
if (!empty($params[$item])){
$filename.= '-'.$params[$item];
}
}
}
return $filename;
}
public function objectToXML($object, $params)
{
$serializer = new Scores_Serializer_Adapter_Xml();
try {
$content = $serializer->serialize($object);
$filename = $this->filename('xml', $params);
$c = Zend_Registry::get('config');
$path = realpath($c->profil->path->files).'/';
file_put_contents($path.$filename.'.xml', $content);
} catch (Zend_Serializer_Exception $e) {
//Error
}
}
}

View File

@ -0,0 +1,672 @@
<?php
class Scores_Partner_Report
{
protected $data = null;
protected $view = null;
protected $login;
protected $password;
protected $reportName;
protected $identifiant;
protected $report = array(
'indiscore3' => array(
0 => array(
'index' => 'Global',
'view' => 'indiscore3/header.phtml',
),
1 => array(
'index' => 'Identite',
'view' => 'indiscore3/identite.phtml',
),
2 => array(
'index' => 'Dirigeants',
'view' => 'indiscore3/dirigeants.phtml',
),
3 => array(
'index' => 'Liens',
'view' => 'indiscore3/liens.phtml',
),
4 => array(
'index' => 'Annonces',
'view' => 'indiscore3/annonces.phtml',
),
5 => array(
'index' => 'Synthese',
'view' => 'indiscore3/synthese.phtml',
),
6 => array(
'index' => 'Bilans',
'view' => 'indiscore3/bilans.phtml',
),
7 => array(
'index' => 'Ratios',
'view' => 'indiscore3/ratios.phtml',
),
8 => array(
'index' => 'Indiscore',
'view' => 'indiscore3/indiscore.phtml',
),
9 => array(
'index' => null,
'view' => 'indiscore3/footer.phtml',
),
)
);
public function __construct($name, $identifiant, $login, $password)
{
$this->reportName = $name;
$this->identifiant = $identifiant;
$this->login = $login;
$this->password = $password;
}
public function getData()
{
}
protected function getDataIndiscore3()
{
$siren = $this->identifiant;
require_once 'common/dates.php';
require_once 'Scores/WsScores.php';
$ws = new WsScores($this->login, $this->password);
$infos = $ws->getRapport($siren, 3, 0);
//Identite
require_once 'Scores/IdentiteEntreprise.php';
$identite = new IdentiteEntreprise($infos->Identite);
//Définition des blocks
$blocks = array(
'Siret',
'SiretSiege',
'TvaNumero',
'Isin',
'Capitalisation',
'NumRC',
'AutreId',
'Actif',
'SituationJuridique',
'AutreSiren',
'RaisonSociale',
'NomCommercial',
'EnseigneSigle',
'FormeJuridique',
'DateImmat',
'DateCreaEn',
'DateCreaEt',
'Adresse',
'Zones',
'Tel',
'Fax',
'Web',
'Mail',
'ActiviteEn',
'ActiviteEt',
'Naf4',
'Nace',
'NatureActivite',
'SurfaceMagasin',
'OrigineFond',
'TypeExploitation',
'Saisonnalite',
'NbEtabActif',
'Capital',
'ChiffreAffaire',
'Dirigeants',
'Effectif',
'EffectifEtab'
);
$dBlock = $identite->formatBlock($blocks);
$this->data->Identite = $infos->Identite;
$this->data->Identite->dBlock = $dBlock;
//Dirigeants
$this->data->Dirigeants->dirigeants = $infos->Dirigeants->result->item;
//Liens
$this->data->Liens->PP = false;
$this->data->Liens->FJ1 = false;
//Special legal form, go to other display
if ( ($infos->Identite->FJ>=1000 && $infos->Identite->FJ<=1999)
|| ($infos->Identite->FJ>=10 && $infos->Identite->FJ<=19) ) {
$this->data->Liens->PP = true;
}
if ( in_array($infos->Identite->FJ, array(5488,5498,5720)) ) {
$this->data->Liens->FJ1 = true;
}
$this->data->Liens->actionnaires = $infos->Liens->actionnaires->item;
$this->data->Liens->participations = $infos->Liens->participations->item;
$this->data->Liens->directions = $infos->Liens->directions->item;
$this->data->Liens->lienStatuts = '#';
//Annonces
$this->data->Annonces->AutreSource = false;
if ($infos->Identite->Source=='006') {
$this->data->Annonces->AutreSource = true;
} else {
require_once 'Scores/Annonces.php';
$objAnnonces = new Annonces($infos->Annonces->result->item);
$typeAnnonces = array(
'Bodacc',
'Balo',
'Bomp',
'Asso',
);
foreach ($typeAnnonces as $type)
{
$classType = 'annonces'.$type;
$annonces = array();
if (count($objAnnonces->$classType)>0)
{
foreach($objAnnonces->$classType as $ann)
{
$annonces[] = $objAnnonces->getAnnonceResume($ann);
}
$this->data->Annonces->{$classType} = $annonces;
}
}
}
//Ratios
$ratio = '';
require_once 'Finance/RatiosData.php';
require_once 'Finance/RatiosGraph.php';
$this->data->Ratios->siret = $infos->Identite->siret;
$this->data->Ratios->id = $infos->Identite->id;
$typeBilan = 'N';
$this->data->Ratios->typeBilan = $typeBilan;
$tabRatio = array(
array('titre' => 'EQUILIBRE FINANCIER'),
array('titre' => 'MARGE BRUTE D\'AUTOFINANCEMENT',
'stitre'=> '(MBA ou CAF)',
'ratio' => 'r233', 'parent' => 0, 'position' => '>'),
array('titre' => 'COUVERTURE du BFR',
'stitre'=> '(FR/BFR)',
'ratio' => 'r234', 'parent' => 0, 'position' => '>'),
array('titre' => 'COUVERTURE des IMMOS NETTES',
'stitre'=> '(Capitaux permanents / Immobilisations nettes)',
'ratio' => 'r237', 'parent' => 0, 'position' => '>'),
array('titre' => 'COUVERTURE du CA',
'stitre'=> '(Fond de roulement net global sur 12m x 360'.
' / Chiffre d\'affaire)',
'ratio' => 'r238', 'parent' => 0, 'position' => '>'),
array('titre' => 'SOLVABILITE',
'stitre'=> '(Capitaux propres / Ensemble des dettes)',
'ratio' => 'r239', 'parent' => 0, 'position' => '>'),
array('titre' => 'INDEPENDANCE FINANCIERE',
'stitre'=> '(Cap.propres/Capitaux permanents)',
'ratio' => 'r240', 'parent' => 0, 'position' => '>'),
array('titre' => 'PROFITABILITE'),
array('titre' => 'RENTABILITE ECONOMIQUE',
'stitre'=> '(EBE/TOTAL bilan)',
'ratio' => 'r262', 'parent' => 7, 'position' => '>'),
array('titre' => 'RENTABILITE FINANCIERE',
'stitre'=> '(Résult.Net/Cap.propres)',
'ratio' => 'r263', 'parent' => 7, 'position' => '>'),
array('titre' => 'RENTABILITE COMMERCIALE',
'stitre'=> '(Résultat net/CA)',
'ratio' => 'r264', 'parent' => 7, 'position' => '>'),
array('titre' => 'CONTRIBUTION DU CAPITAL',
'stitre'=> '(Capacité d\'autofinancement sur 12 mois'.
' / Capitaux permanents)',
'ratio' => 'r265', 'parent' => 7, 'position' => '>'),
array('titre' => 'CONTRIBUTION DE LA VA',
'stitre'=>'(Capacité d\'autofinancement / Valeur ajoutée)',
'ratio' => 'r266', 'parent' => 7, 'position' => '>'),
array('titre' => 'LIQUIDITE'),
array('titre' => 'LIQUIDITE IMMEDIATE',
'stitre'=> '(Disponibilité / Dettes CT)',
'ratio' => 'r250', 'parent' => 13, 'position' => '>'),
array('titre' => 'LIQUIDITE REDUITE',
'stitre'=>'(Disponibilité et créances réelles / Dettes CT)',
'ratio' => 'r252', 'parent' => 13, 'position' => '>'),
array('titre' => 'LIQUIDITE GENERALE',
'stitre'=> '(Act.circulant net/Dettes CT)',
'ratio' => 'r251', 'parent' => 13, 'position' => '>'),
array('titre' => 'ENDETTEMENT'),
array('titre' => 'ENDETTEMENT',
'stitre'=> '(Dettes a + 1 an / Capitaux propres)',
'ratio' => 'r244', 'parent' => 17, 'position' => '<'),
array('titre' => 'CAPACITE DE REMBOURSEMENT',
'stitre'=> '(Dettes.bancaires.(+MT+LT+C.bail)/CAF)',
'ratio' => 'r247', 'parent' => 17, 'position' => '<'),
array('titre' => 'FINANCEMENT DES STOCKS',
'stitre'=> '(Dettes aux fournisseurs / Stock)',
'ratio' => 'r248', 'parent' => 17, 'position' => '<'),
array('titre' => 'PRODUCTIVITE'),
array('titre' => 'PRODUCTIVITE DE L\'ACTIF',
'stitre'=> '(Chiffre d\'affaire / Actif comptable)',
'ratio' => 'r271', 'parent' => 21, 'position' => '>'),
array('titre' => 'DUREE CLIENT',
'stitre'=> '(Rotation clients en VJ TTC)',
'ratio' => 'r278', 'parent' => 21, 'position' => '<'),
array('titre' => 'DUREE FOURNISSEUR',
'stitre'=> '(Rotation fournisseurs en JA TTC)',
'ratio' => 'r279', 'parent' => 21, 'position' => '<'),
array('titre' => 'POIDS MASSE SALARIALE',
'stitre'=> '(Ch personnel / VA)',
'ratio' => 'r281', 'parent' => 21, 'position' => '<'),
array('titre' => 'RENDEMENT',
'stitre'=> '(Production sur 12mois / Effectif)',
'ratio' => 'r261', 'parent' => 21, 'position' => '>'),
array('titre' => 'PRODUCTIVITE',
'stitre'=> '(CA / Effectif)',
'ratio' => 'r267', 'parent' => 21, 'position' => '>')
);
if($ratio!=''){
$tabRatio = array( $ratio => $tabRatio[$ratio] );
}
$ratiosData = new RatiosData($infos->Ratios);
$nbBilanN = $ratiosData->getNbBilan('N');
$nbBilanC = $ratiosData->getNbBilan('C');
if ($typeBilan == 'N' && $nbBilanN==0){
$typeBilan = 'C';
}
if ($nbBilanN!=0 || $nbBilanC!=0)
{
//Génération Graphique evolution
$ratiosGraph = new RatiosGraph($this->siret, $this->id);
$infosAnnee = $ratiosData->getBilansInfo($typeBilan);
$annees = array_keys($infosAnnee);
rsort($annees);
$mil = $annees[0];
$tabAnnees = array();
foreach($annees as $annee){
$tabAnnees[$annee] = WDate::dateT('Ymd', 'd/m/Y', $annee);
}
$tabResult = array();
foreach($tabRatio as $item ) {
if (isset($item['ratio'])){
$dataGraph = $ratiosData->dGraph($typeBilan, $item['ratio']);
$ratiosGraph->ratiosgraph($item['ratio'], $dataGraph);
$item['entrep'] = $ratiosData->dRatio($typeBilan, $mil, $item['ratio']);
$item['secteur'] = $ratiosData->dSecteur($mil, $item['ratio']);
$item['position'] = $ratiosData->dPosition($typeBilan, $mil, $item['ratio'], $item['position']);
$item['comment'] = $ratiosData->wrapComment($item['ratio']);
}
$tabResult[] = $item;
}
$this->data->Ratios->tabResult = $tabResult;
$this->data->Ratios->annees = $tabAnnees;
$this->data->Ratios->mil = $mil;
$this->data->Ratios->typeBilan = $typeBilan ;
$this->data->Ratios->duree = $infosAnnee[$mil]->duree;
}
$this->data->Ratios->nbBilanN = $nbBilanN;
$this->data->Ratios->nbBilanC = $nbBilanC;
//Bilans
$typeBilan = 'N';
$this->data->Bilans->typeBilan = $typeBilan;
$ratiosData = new RatiosData($infos->Ratios);
$nbBilanN = $ratiosData->getNbBilan('N');
$nbBilanC = $ratiosData->getNbBilan('C');
$this->data->Bilans->nbBilanN = $nbBilanN;
$this->data->Bilans->nbBilanC = $nbBilanC;
if ($typeBilan == 'N' && $nbBilanN==0){
$typeBilan = 'C';
}
if ($nbBilanN!=0 || $nbBilanC!=0)
{
$infosAnnee = $ratiosData->getBilansInfo($typeBilan);
$annees = array_keys($infosAnnee);
$ratiosGraph = new RatiosGraph($this->siret, $this->id);
$tabRatioActif = array(
'r59' => array( 'titre' => 'Actif Immobilisé Net', 'class' => 'subhead'),
'r51' => array( 'titre' => 'Incorporelles', 'class' => ''),
'r52' => array( 'titre' => 'Corporelles', 'class' => '' ),
'r53' => array( 'titre' => 'Financières', 'class' => '' ),
'r69' => array( 'titre' => 'Actif Circulant Net', 'class' => 'subhead' ),
'r60' => array( 'titre' => 'Stock et encours', 'class' => '' ),
'r61' => array( 'titre' => 'Créances Clients', 'class' => '' ),
'r62' => array( 'titre' => 'Autres Créances', 'class' => '' ),
'00' => array( 'titre' => '', 'class' => '' ),
'r63' => array( 'titre' => 'Trésorerie Active', 'class' => '' ),
'r22' => array( 'titre' => 'TOTAL ACTIF', 'class' => 'subhead' ),
);
$totalRatioActif = 'r22';
$tabRatioPassif = array(
'r79' => array( 'titre' => 'Ressources Propres', 'class' => 'subhead'),
'r70' => array( 'titre' => 'Fonds Propres', 'class' => ''),
'r71' => array( 'titre' => 'Provisions Risques', 'class' => ''),
'r72' => array( 'titre' => 'Comptes Courants', 'class' => ''),
'r90' => array( 'titre' => 'Ressources Externes', 'class' => 'subhead'),
'r83' => array( 'titre' => 'Dettes Financières', 'class' => ''),
'r84' => array( 'titre' => 'Dettes Fournisseurs', 'class' => ''),
'r85' => array( 'titre' => 'Dettes Fiscales', 'class' => ''),
'r86' => array( 'titre' => 'Autres Dettes', 'class' => ''),
'r87' => array( 'titre' => 'Trésorerie Passive', 'class' => ''),
'r22' => array( 'titre' => 'TOTAL PASSIF', 'class' => 'subhead'),
);
$totalRatioPassif = 'r22';
$tabRatioSig = array(
'r101' => array( 'titre' => 'CHIFFRE D\'AFFAIRES HORS TAXE', 'op' => '', 'class' => 'subhead'),
'r102' => array( 'titre' => 'Achat de marchandises, de matières premières', 'op' => '-', 'class' => ''),
'r110' => array( 'titre' => 'MARGE COMMERCIALE', 'op' => '', 'class' => 'subhead'),
'r111' => array( 'titre' => 'Production vendue', 'op' => '+', 'class' => ''),
'r112' => array( 'titre' => 'Production immobilisée et stockée', 'op' => '+', 'class' => ''),
'r120' => array( 'titre' => 'PRODUCTION DE L\'EXERCICE', 'op' => '', 'class' => 'subhead'),
'r121' => array( 'titre' => 'Variation de stock de marchandises et matières premières', 'op' => '±', 'class' => ''),
'r122' => array( 'titre' => 'MARGE BRUTE', 'op' => '', 'class' => 'subhead'),
'r123' => array( 'titre' => 'Autres charges externes', 'op' => '-', 'class' => ''),
'r130' => array( 'titre' => 'VALEUR AJOUTÉE', 'op' => '', 'class' => 'subhead'),
'r132' => array( 'titre' => 'Charges de personnel', 'op' => '-', 'class' => ''),
'r133' => array( 'titre' => 'Impôts, taxes & versements assimilés', 'op' => '-', 'class' => ''),
'r131' => array( 'titre' => 'Subventions d\'exploitation', 'op' => '+', 'class' => ''),
'r140' => array( 'titre' => 'EXCÉDENT BRUT D\'EXPLOITATION (EBE)', 'op' => '', 'class' => 'subhead'),
'r141' => array( 'titre' => 'Autres produits d\'exploitation', 'op' => '+', 'class' => ''),
'r142' => array( 'titre' => 'Autres charges d\'exploitation', 'op' => '-', 'class' => ''),
'r143' => array( 'titre' => 'Reprise sur dotations & transferts de charges', 'op' => '+', 'class' => ''),
'r144' => array( 'titre' => '70% Loyer de crédit bail', 'op' => '+', 'class' => ''),
'r145' => array( 'titre' => 'Dotations d\'exploitation & provisions d\'exploitation', 'op' => '-', 'class' => ''),
'r150' => array( 'titre' => 'RÉSULTAT D\'EXPLOITATION', 'op' => '', 'class' => 'subhead'),
'r151' => array( 'titre' => 'Produits financiers', 'op' => '+', 'class' => ''),
'r152' => array( 'titre' => '30% Loyer de crédit bail', 'op' => '+', 'class' => ''),
'r153' => array( 'titre' => 'Charges financières', 'op' => '+', 'class' => ''),
'r170' => array( 'titre' => 'RÉSULTAT COURANT AVANT IMPOTS', 'op' => '', 'class' => 'subhead'),
'r171' => array( 'titre' => 'Produits exceptionnels', 'op' => '+', 'class' => ''),
'r172' => array( 'titre' => 'Charges exceptionnelles', 'op' => '-', 'class' => ''),
'r181' => array( 'titre' => 'Impôts sur les bénéfices', 'op' => '-', 'class' => ''),
'r182' => array( 'titre' => 'Participation salariale', 'op' => '-', 'class' => ''),
'r199' => array( 'titre' => 'RÉSULTAT NET', 'op' => '', 'class' => 'subhead'),
);
$totalRatioSig = 'r101';
//On prend les 5 derniers bilans pour l'affichage
$nbMaxBilan = 5;
rsort($annees);
$annees = array_slice($annees, 0, $nbMaxBilan);
sort($annees);
$tabResultActif = array();
$tabResultPassif = array();
$tabResultSig = array();
foreach($annees as $annee){
//Formatter les données Actif
$data = array();
foreach($tabRatioActif as $idRatio => $valRatio){
if ($idRatio == '00'){
$data[$idRatio] = '';
$dataTotal[$idRatio] = '';
} else {
$data[$idRatio] = $ratiosData->dRatio($typeBilan, $annee, $idRatio);
$dataTotal[$idRatio] = $ratiosData->dPercent($typeBilan, $annee, $idRatio, $totalRatioActif);
}
}
//Génération du graphique Actif
$dataGraphActif = array(
$ratiosData->graphPercent($typeBilan, $annee, 'r51', 'r22'),
$ratiosData->graphPercent($typeBilan, $annee, 'r52', 'r22'),
$ratiosData->graphPercent($typeBilan, $annee, 'r53', 'r22'),
$ratiosData->graphPercent($typeBilan, $annee, 'r60', 'r22'),
$ratiosData->graphPercent($typeBilan, $annee, 'r61', 'r22'),
$ratiosData->graphPercent($typeBilan, $annee, 'r62', 'r22'),
$ratiosData->graphPercent($typeBilan, $annee, 'r63', 'r22'),
);
$ratiosGraph->bilansgraphactif($dataGraphActif, $typeBilan, $annee);
$tabResultActif[] = array(
'dateCloture' => WDate::dateT('Ymd','d/m/Y',$annee),
'duree' => $infosAnnee[$annee]->duree.' Mois',
'entrep' => $data,
'total' => $dataTotal,
);
//Formatter les données Passif
$data = array();
foreach($tabRatioPassif as $idRatio => $valRatio){
$data[$idRatio] = $ratiosData->dRatio($typeBilan, $annee, $idRatio);
$dataTotal[$idRatio] = $ratiosData->dPercent($typeBilan, $annee, $idRatio, $totalRatioPassif);
}
//Génération données graphique passif
$dataGraphPassif = array(
$ratiosData->graphPercent($typeBilan, $annee, 'r70','r22'),
$ratiosData->graphPercent($typeBilan, $annee, 'r71','r22'),
$ratiosData->graphPercent($typeBilan, $annee, 'r72','r22'),
$ratiosData->graphPercent($typeBilan, $annee, 'r83','r22'),
$ratiosData->graphPercent($typeBilan, $annee, 'r84','r22'),
$ratiosData->graphPercent($typeBilan, $annee, 'r85','r22'),
$ratiosData->graphPercent($typeBilan, $annee, 'r86','r22'),
$ratiosData->graphPercent($typeBilan, $annee, 'r87','r22'),
);
$ratiosGraph->bilansgraphpassif($dataGraphPassif, $typeBilan, $annee);
$tabResultPassif[] = array(
'dateCloture' => WDate::dateT('Ymd','d/m/Y',$annee),
'duree' => $infosAnnee[$annee]->duree.' Mois',
'entrep' => $data,
'total' => $dataTotal,
);
//Formatter les données Sig
$data = array();
foreach($tabRatioSig as $idRatio => $valRatio){
$data[$idRatio] = $ratiosData->dRatio($typeBilan, $annee, $idRatio);
$dataTotal[$idRatio] = $ratiosData->dPercent($typeBilan, $annee, $idRatio, $totalRatioSig);
}
//Génération données graphique SIG
$dataGraphSIG = array(
$ratiosData->graphPercent($typeBilan, $annee, 'r101','r101')-$ratiosData->graphPercent($typeBilan, $annee, 'r122','r101'),
$ratiosData->graphPercent($typeBilan, $annee, 'r122','r101')-$ratiosData->graphPercent($typeBilan, $annee, 'r130','r101'),
$ratiosData->graphPercent($typeBilan, $annee, 'r130','r101')-$ratiosData->graphPercent($typeBilan, $annee, 'r140','r101'),
$ratiosData->graphPercent($typeBilan, $annee, 'r140','r101')-$ratiosData->graphPercent($typeBilan, $annee, 'r150','r101'),
$ratiosData->graphPercent($typeBilan, $annee, 'r150','r101')-$ratiosData->graphPercent($typeBilan, $annee, 'r170','r101'),
$ratiosData->graphPercent($typeBilan, $annee, 'r170','r101')-$ratiosData->graphPercent($typeBilan, $annee, 'r199','r101'),
$ratiosData->graphPercent($typeBilan, $annee, 'r199','r101'),
);
$ratiosGraph->bilansgraphsig($dataGraphSIG, $typeBilan, $annee);
$tabResultSig[] = array(
'dateCloture' => WDate::dateT('Ymd','d/m/Y',$annee),
'duree' => $infosAnnee[$annee]->duree.' Mois',
'entrep' => $data,
'total' => $dataTotal,
);
}
$this->data->Bilans->lastDateCloture = $annee;
$this->data->Bilans->tabRatioActif = $tabRatioActif;
$this->data->Bilans->tabRatioPassif = $tabRatioPassif;
$this->data->Bilans->tabRatioSig = $tabRatioSig;
$this->data->Bilans->tabResultActif = $tabResultActif;
$this->data->Bilans->tabResultPassif = $tabResultPassif;
$this->data->Bilans->tabResultSig = $tabResultSig;
}
//Synthese
$typeBilan = 'N';
//Récupération des informations
$tabRatio = array(
'r5' => array('evol'=>'r6', 'op' => 1000, 'titre'=>'CHIFFRE D\'AFFAIRES'),
'r7' => array('evol'=>'r8', 'op' => 1000, 'titre'=>'RESULTAT COURANT AVANT IMPOTS'),
'r10' => array('evol'=>'r11', 'op' => 1000, 'titre'=>'RESULTAT NET'),
'r18' => array('evol'=>'r19', 'op' => 1000, 'titre'=>'FONDS PROPRES'),
'r22' => array('evol'=>'r23', 'op' => 1000, 'titre'=>'TOTAL BILAN'),
'r231' => array('evol'=>'r235', 'op' => 1000, 'titre'=>'FONDS DE ROULEMENT'),
'r232' => array('evol'=>'r236', 'op' => 1000, 'titre'=>'BESOIN EN FONDS DE ROULEMENT'),
'r249' => array('evol'=>'r254', 'op' => 1000, 'titre'=>'TRESORERIE'),
'r24' => array('evol'=>'r24', 'op' => 1, 'titre'=>'EFFECTIF', 'unite' => 1),
);
$tabRatioGraph = array(
0 => array('ratio'=>'r236', 'op' => 1000),
1 => array('ratio'=>'r235', 'op' => 1000),
2 => array('ratio'=>'r6', 'op' => 1000),
3 => array('ratio'=>'r146', 'op' => 1000)
);
if($ratio!=''){
$tabRatio = array( $ratio => $tabRatio[$ratio] );
}
//Formattage des données
$ratiosData = new RatiosData($infos->Ratios);
$nbBilanN = $ratiosData->getNbBilan('N');
$nbBilanC = $ratiosData->getNbBilan('C');
if ($typeBilan == 'N' && $nbBilanN==0){
$typeBilan = 'C';
}
if ($nbBilanN!=0 || $nbBilanC!=0)
{
foreach($tabRatio as $idRatio => $valRatio){
$tabRatio[$idRatio]['comment'] = $ratiosData->wrapComment($idRatio);
}
$this->data->Synthese->tabRatio = $tabRatio;
$infosAnnee = $ratiosData->getBilansInfo($typeBilan);
$annees = array_keys($infosAnnee);
sort($annees);
if (count($annees)>1){
//Générer les différents graphiques d'évolutions
$ratiosGraph = new RatiosGraph($this->siret, $this->id);
$tabGraphEvol = array();
foreach($tabRatio as $idRatio => $infoRatio){
$dataGraphEvol = array();
foreach($annees as $annee){
$dataGraphEvol[] = array(
'date' => $annee,
'value' => ($ratiosData->getRatiosEntrep($typeBilan, $annee, $idRatio)!='NS') ?
$ratiosData->getRatiosEntrep($typeBilan, $annee, $idRatio)/$infoRatio['op'] : 0
);
}
$tabGraphEvol[$idRatio] = $ratiosGraph->syntheseGraphEvol($dataGraphEvol, $idRatio, $unite);
}
//Générer le graphique de comparaison
$dataGraph = array();
$i=0;
foreach($annees as $annee){
$dataGraph[$i]['date'] = $infosAnnee[$annee]->dateCloture;
$dataGraph[$i]['duree'] = $infosAnnee[$annee]->duree;
foreach($tabRatioGraph as $item){
$dataGraph[$i][$item['ratio']] = $ratiosData->getRatiosEntrep($typeBilan, $annee, $item['ratio'])/$item['op'];
}
$i++;
}
$graphLineCompare = $ratiosGraph->syntheseGraphLineCompare($dataGraph, $typeBilan);
$this->data->Synthese->graph = true;
} else {
$this->data->Synthese->graph = false;
}
//On prend les 3 derniers bilans pour l'affichage
$nbMaxBilan = 3;
rsort($annees);
$annees = array_slice($annees, 0, $nbMaxBilan);
sort($annees);
$tabResult = array();
foreach($annees as $annee){
$data = array();
$dataEvol = array();
//Formatter les données
foreach($tabRatio as $idRatio => $valRatio){
$data[$idRatio] = $ratiosData->dRatio($typeBilan, $annee, $idRatio);
$dataEvol[$idRatio] = $ratiosData->dEvol($typeBilan, $annee, $valRatio['evol']);
}
$tabResult[] = array(
'dateCloture' => WDate::dateT('Ymd','d/m/Y',$annee),
'duree' => $infosAnnee[$annee]->duree.' Mois',
'entrep' => $data,
'entrepEvol' => $dataEvol,
);
}
$this->data->Synthese->tabResult = $tabResult;
}
$this->data->Synthese->typeBilan = $typeBilan;
$this->data->Synthese->nbBilanN = $nbBilanN;
$this->data->Synthese->nbBilanC = $nbBilanC;
//Indiscore
$this->data->Indiscore->indiscore = $infos->Indiscore;
require_once 'Scores/RapportComment.php';
$rapportComment = new RapportComment(
$siren,
$this->id,
$infos->Indiscore->tabCommentaires->item,
$infos->Ratios->RatiosInfos,
$infos->Ratios->BilansInfos,
$infos->Ratios->RatiosSecteur,
$infos->Indiscore->tabVariables
);
$this->data->Indiscore->comment = $rapportComment->out();
//Global
$this->data->Global->raisonSociale = $infos->Identite->Nom;
}
public function getContent()
{
$content = '';
$this->getDataIndiscore3();
if ( array_key_exists($this->reportName, $this->report) ) {
foreach ( $this->report[$this->reportName] as $reportItem ) {
$view = $reportItem['view'];
$index = $reportItem['index'];
$this->view = new Scores_Partner_Report_Html(realpath(dirname(__FILE__)).'/Templates/'.$view);
if ( $index !== null ) {
foreach ($this->data->{$index} as $name => $value) {
$this->view->assignVars($name, $value);
}
}
$content.= $this->view->getHtml();
}
}
return $content;
}
}

View File

@ -0,0 +1,71 @@
<?php
require_once 'Scores/Siren.php';
class Scores_Partner_Report_Helpers
{
public function __construct()
{
}
public function partial($name, $values = null)
{
}
public function partialLoop($name, $values = null)
{
}
public function url()
{
return '#';
}
public function sirenTexte($siren)
{
return substr($siren, 0, 3).' '.
substr($siren, 3, 3).' '.
substr($siren, 6, 3);
}
public function FormatPct($pct)
{
$pct = round($pct / 10, 0) * 10;
if ($pct == 0) $pct = 10;
if ($pct > 100) $pct = 100;
return $pct;
}
public function RemplaceSiren($texte)
{
$pattern = "/((?:[0-9]{9,9})|(?:[0-9]{3,3} [0-9]{3,3} [0-9]{3,3})|(?:[0-9]{3,3}\.[0-9]{3,3}\.[0-9]{3,3})|(?:[0-9]{3,3}-[0-9]{3,3}-[0-9]{3,3}))/";
return preg_replace_callback($pattern, array($this, 'replace_siren'), $texte);
}
public function replace_siren($matches)
{
foreach ($matches as $i => $sirenBrut) {
$siren = strtr($sirenBrut, array(' '=>'', '.'=>'', '-'=>''));
if (strlen($sirenBrut)==9) {
$sirenBrut = implode(' ', str_split($sirenBrut, 3));
}
$sirenMethod = new Siren();
if ($sirenMethod->valide($siren)) {
if ($sirenMethod->exist($siren)){
$href = $this->view->url(array(
'controller' => 'identite',
'action' => 'fiche',
'siret' => $siren,
), null, true);
return '<a href="'.$href.'" title="Voir la fiche identité de cette entreprise">'.$sirenBrut.'</a>';
} else {
return $sirenBrut;
}
}
return $sirenBrut;
}
}
}

View File

@ -0,0 +1,34 @@
<?php
class Scores_Partner_Report_Html extends Scores_Partner_Report_Helpers
{
protected $views = array();
public function __construct($filename)
{
if (is_array($filename)){
$this->views = $filename;
} else {
$this->views = array($filename);
}
}
public function getHtml()
{
$content = '';
foreach( $this->views as $f ) {
if ( is_file( $f ) ) {
ob_start();
include $f;
$content.= ob_get_contents();
ob_end_clean();
}
}
return $content;
}
public function assignVars($name, $value)
{
$this->{$name} = $value;
}
}

View File

@ -0,0 +1,20 @@
<h1>ANNONCES LÉGALES</h1>
<?php if ($this->AutreSource){ ?>
<h2>EV&Eacute;NEMENTS L&Eacute;GAUX</h2>
<div class="paragraph">
Aucune annonces disponible pour cette entité.
</div>
<?php } else {?>
<h2>EV&Eacute;NEMENTS L&Eacute;GAUX</h2>
<div class="paragraph">
<?php if(count($this->annoncesBodacc)==0){ ?>
Néant
<?php } else {?>
<table class="data">
<?=$this->partialLoop('juridique/annonces-resume.phtml', $this->annoncesBodacc)?>
</table>
<?php }?>
</div>
<?php }?>

View File

@ -0,0 +1,37 @@
<h1>ÉLÉMENTS FINANCIERS - BILANS</h1>
<?php if($this->typeBilan == 'B' and $this->typeBilan == 'A'):?>
<div class="paragraph">
<table>
<tr>
<td width="30">&nbsp;</td>
<td colspan="2" class="StyleInfoLib" width="200">Bilan de banque/assurance non gérés</td>
</tr>
</table>
</div>
<?php else: ?>
<?php if ($this->nbBilanN==0 && $this->nbBilanN==0):?>
<div class="paragraph">
<table>
<tr>
<td width="30">&nbsp;</td>
<td colspan="2" class="StyleInfoLib" width="200">Aucun bilan disponible.</td>
</tr>
</table>
</div>
<?php else:?>
<h2>Bilan actif - passif</h2>
<?=$this->partial('finance/bilan/actif.phtml')?>
<?=$this->partial('finance/bilan/passif.phtml')?>
<h2>Soldes Intermédiaire de Gestion</h2>
<?=$this->partial('finance/bilan/sig.phtml')?>
<?php endif;?>
<?php endif;?>

View File

@ -0,0 +1,49 @@
<h1>DIRIGEANTS</h1>
<h2>Liste des dirigeants actifs</h2>
<div class="paragraph">
<?php if ( count($this->dirigeants)>0 ) { ?>
<table class="data">
<?php foreach ($this->dirigeants as $dir) {?>
<tr>
<td class="StyleInfoData" width="200"><?=$dir->Titre?></td>
<td class="StyleInfoData" width="320">
<?php if ($dir->Societe != '') { ?>
<?=$dir->Societe?>
<br/>
<?php }?>
<?php if ($dir->Nom != '') { ?>
<?=$dir->Nom.' '.$dir->Prenom?>
<?php
if (trim($dir->NaissDate) != '' && trim($dir->NaissVille.' '.$dir->NaissDepPays) != '') { ?>
<br/>né(e) le <?=$dir->NaissDate?> à <?=$dir->NaissVille?>
<?php if (trim($dir->NaissDepPays) != '') { ?>
&nbsp;(<?=$dir->NaissDepPays?>)
<?php }
} else if (trim($dir->NaissDate) != '') {
?>
né(e) le <?=$dir->NaissDate?>
<?php
} else if (trim($dir->NaissVille.' '.$dir->NaissDepPays) != '') {
?>
né(e) à <?=$dir->NaissVille?> &nbsp;(<?=$dir->NaissDepPays?>)
<?php } ?>
<?php } ?>
</td>
<td class="StyleInfoData" width="100" valign="top">
<?php if ($dir->Siren!='') {?>
<?=$this->SirenTexte($dir->Siren)?>
<?php }?>
</td>
</tr>
<?php } ?>
</table>
<?php } else { ?>
<table>
<tr>
<td class="StyleInfoData" width="550">
Aucune donn&eacute;e n'est pr&eacute;sente dans notre base
</td>
</tr>
</table>
<?php } ?>
</div>

View File

@ -0,0 +1,42 @@
<?php
$tabResult = $this->partial()->view->tabResultActif;
$tabRatio = $this->partial()->view->tabRatioActif;
?>
<div class="paragraph">
<table class="bilans">
<thead>
<tr>
<th>Actif</th>
<?php foreach($tabResult as $info) { ?>
<th class="date" >
<?=$info['dateCloture']?><br/><?=$info['duree']?>
</th>
<?php }?>
<?php $lastDateCloture = $info['dateCloture']; ?>
<th>% T.B.</th>
</tr>
</thead>
<tbody>
<?php foreach($tabRatio as $idRatio => $info) { ?>
<tr<?php if (!empty($info['class'])) echo ' class="'.$info['class'].'"'?>>
<td>
<?=$info['titre']?></td>
<?php foreach($tabResult as $value) { ?>
<td class="left"><?=$value['entrep'][$idRatio]?></td>
<?php }?>
<td><?=$value['total'][$idRatio]?></td>
<?php }?>
</tr>
</tbody>
</table>
</div>
<div class="paragraph">
<?=$this->action('bilangraph', 'finance', null, array(
'type' => 'actif',
'typeBilan' => $this->partial()->view->typeBilan,
'dateCloture' => $this->partial()->view->lastDateCloture,
'siret' => $this->partial()->view->siret,
'id' => $this->partial()->view->id,
))?>
</div>

View File

@ -0,0 +1,41 @@
<?php
$tabResult = $this->partial()->view->tabResultPassif;
$tabRatio = $this->partial()->view->tabRatioPassif;
?>
<div class="paragraph">
<table class="bilans">
<thead>
<tr>
<th>Passif</th>
<?php foreach($tabResult as $info) { ?>
<th class="date" >
<?=$info['dateCloture']?><br/><?=$info['duree']?>
</th>
<?php }?>
<th>% T.B.</th>
</tr>
</thead>
<tbody>
<?php foreach($tabRatio as $idRatio => $info) { ?>
<tr<?php if (!empty($info['class'])) echo ' class="'.$info['class'].'"'?>>
<td>
<?=$info['titre']?></td>
<?php foreach($tabResult as $value) { ?>
<td class="left"><?=$value['entrep'][$idRatio]?></td>
<?php }?>
<td><?=$value['total'][$idRatio]?></td>
<?php }?>
</tr>
</tbody>
</table>
</div>
<div class="paragraph">
<?=$this->action('bilangraph', 'finance', null, array(
'type' => 'passif',
'typeBilan' => $this->partial()->view->typeBilan,
'dateCloture' => $this->partial()->view->lastDateCloture,
'siret' => $this->partial()->view->siret,
'id' => $this->partial()->view->id,
))?>
</div>

View File

@ -0,0 +1,44 @@
<?php
$tabResult = $this->partial()->view->tabResultSig;
$tabRatio = $this->partial()->view->tabRatioSig;
?>
<div class="paragraph">
<table class="bilans">
<thead>
<tr>
<th colspan="2">SOLDES INTERMEDIAIRE DE GESTION</th>
<?php foreach($tabResult as $info) { ?>
<th class="date" >
<?=$info['dateCloture']?><br/><?=$info['duree']?>
</th>
<?php }?>
<th>% C.A.</th>
</tr>
</thead>
<tbody>
<?php foreach($tabRatio as $idRatio => $info) { ?>
<tr<?php if (!empty($info['class'])) echo ' class="'.$info['class'].'"'?>>
<?php if(empty($info['op'])){?>
<td colspan="2"><?=$info['titre']?></td>
<?php } else {?>
<td><?=$info['op']?></td><td><?=$info['titre']?></td>
<?php }?>
<?php foreach($tabResult as $value) { ?>
<td class="left"><?=$value['entrep'][$idRatio]?></td>
<?php }?>
<td><?=$value['total'][$idRatio]?></td>
<?php }?>
</tr>
</tbody>
</table>
</div>
<div class="paragraph">
<?=$this->action('bilangraph', 'finance', null, array(
'type' => 'sig',
'typeBilan' => $this->partial()->view->typeBilan,
'dateCloture' => $this->partial()->view->lastDateCloture,
'siret' => $this->partial()->view->siret,
'id' => $this->partial()->view->id,
))?>
</div>

View File

@ -0,0 +1,5 @@
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,16 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
<link href="./themes/default/styles/main.css" media="all" rel="stylesheet" type="text/css" >
</head>
<body>
<div id="global">
<div id="content">
<div id="center">
<h1>RAPPORT COMPLET</h1>
<div class="paragraph">
<p id="rsynthese">SOCIÉTÉ : <?=$this->raisonSociale?></p>
</div>

View File

@ -0,0 +1,68 @@
<h1>FICHE D'IDENTITÉ</h1>
<div class="paragraph">
<table>
<?php $items = array('Siret', 'SiretSiege,', 'TvaNumero', 'Isin', 'Capitalisation', 'NumRC', 'AutreId', 'Actif', 'SituationJuridique', 'AutreSiren');?>
<?php foreach ( $items as $item ) {?>
<?php if ( array_key_exists($item, $this->dBlock) && $this->dBlock[$item]['texte']!='' ) {?>
<tr>
<td width="50" class="aide"></td>
<td width="200" class="StyleInfoLib"><?=$this->dBlock[$item]['label']?></td>
<?php
if (!empty($this->dBlock[$item]['titre'])) {
$titre = ' title="'.$this->dBlock[$item]['titre'].'"';
} else {
$titre = '';
}
?>
<td width="350" class="StyleInfoData"<?=$titre?>><?=$this->dBlock[$item]['texte']?></td>
</tr>
<?php }?>
<?php }?>
</table>
</div>
<h2>Raison sociale &amp; Coordonnées</h2>
<div class="paragraph">
<table>
<?php $items = array('RaisonSociale', 'NomCommercial,', 'EnseigneSigle', 'FormeJuridique', 'DateImmat', 'DateCreaEn', 'DateCreaEt', 'Adresse', 'Zones', 'Tel', 'Fax', 'Web', 'Mail');?>
<?php foreach ( $items as $item ) {?>
<?php if ( array_key_exists($item, $this->dBlock) && $this->dBlock[$item]['texte']!='' ) {?>
<tr>
<td width="50" class="aide"></td>
<td width="200" class="StyleInfoLib"><?=$this->dBlock[$item]['label']?></td>
<?php
if (!empty($this->dBlock[$item]['titre'])) {
$titre = ' title="'.$this->dBlock[$item]['titre'].'"';
} else {
$titre = '';
}
?>
<td width="350" class="StyleInfoData"<?=$titre?>><?=$this->dBlock[$item]['texte']?></td>
</tr>
<?php }?>
<?php }?>
</table>
</div>
<h2>Activité(s) &amp; Chiffre d'affaires</h2>
<div class="paragraph">
<table>
<?php $items = array('ActiviteEn', 'ActiviteEt,', 'Naf4', 'Nace', 'NatureActivite', 'SurfaceMagasin', 'OrigineFond', 'TypeExploitation', 'Saisonnalite', 'NbEtabActif', 'Capital', 'ChiffreAffaire', 'Dirigeants', 'Effectif', 'EffectifEtab');?>
<?php foreach ( $items as $item ) {?>
<?php if ( array_key_exists($item, $this->dBlock) && $this->dBlock[$item]['texte']!='' ) {?>
<tr>
<td width="50" class="aide"></td>
<td width="200" class="StyleInfoLib"><?=$this->dBlock[$item]['label']?></td>
<?php
if (!empty($this->dBlock[$item]['titre'])) {
$titre = ' title="'.$this->dBlock[$item]['titre'].'"';
} else {
$titre = '';
}
?>
<td width="350" class="StyleInfoData"<?=$titre?>><?=$this->dBlock[$item]['texte']?></td>
</tr>
<?php }?>
<?php }?>
</table>
</div>

View File

@ -0,0 +1,164 @@
<h1>COMMENTAIRES</h1>
<div class="paragraph">
<div id="commentaires">
<?=$this->comment?>
</div>
</div>
<h1>INDISCORE©</h1>
<h2>Évaluation</h2>
<div class="paragraph">
<table>
<tr>
<td width="30">&nbsp;</td>
<td width="550" colspan="2" class="StyleInfoData">
L'&eacute;valuation indiScore&copy; est en partie basée sur les points notables suivants :<br/>
<h3><u>Conformit&eacute; l&eacute;gale :</u></h3>
<div class="stats gradiant_pic">
<ul>
<li>
<i><?=$this->indiscore->AnalyseConfor; ?></i>
<div class="blocdegrade clearfix">
<span class="textdegrade">Conformit&eacute;&nbsp;<? if ($this->edition) { echo '('.$this->indiscore->ScoreConfor.')';}?></span>
<div class="imgdegrade"><img class="borderimg" src="/themes/default/images/indiscore/imgscores-<?=$this->FormatPct($this->indiscore->ScoreConfor)?>.png"/></div>
<div class="regle"><img src="/themes/default/images/indiscore/sgradiant2.png" /></div>
</div>
</li>
</ul>
</div>
<h3><u>Dirigeance :</u></h3>
<div class="stats gradiant_pic">
<ul>
<li>
<i><?=$this->indiscore->AnalyseDirigeance?></i>
<div class="blocdegrade clearfix">
<span class="textdegrade">Dirigeance&nbsp;<? if ($this->edition) { echo '('.$this->indiscore->ScoreDirigeance.')';}?></span>
<div class="imgdegrade"><img class="borderimg" src="/themes/default/images/indiscore/imgscores-<?=$this->FormatPct($this->indiscore->ScoreDirigeance)?>.png"/></div>
<div class="regle"><img src="/themes/default/images/indiscore/sgradiant2.png" /></div>
</div>
</li>
</ul>
</div>
<h3><u>Solvabilit&eacute; :</u></h3>
<div class="stats gradiant_pic">
<ul>
<li>
<i>L'analyse de la solvabilit&eacute; est <?=$this->indiscore->AnalyseSolvabilite?></i>
<div class="blocdegrade clearfix">
<span class="textdegrade">Solvabilit&eacute;&nbsp;<? if ($this->edition) { echo '('.$this->indiscore->Indiscore.')';}?></span>
<div class="imgdegrade"><img class="borderimg" src="/themes/default/images/indiscore/imgscores-<?php echo $this->FormatPct($this->indiscore->Indiscore);?>.png"/></div>
<div class="regle"><img src="/themes/default/images/indiscore/sgradiant2.png" /></div>
</div>
</li>
</ul>
</div>
</td>
</tr>
<?php $millesimeMax = date('Ymd', mktime(0, 0, 0, date('m'), date('d'), date('Y')-2));?>
<?php if($this->indiscore->NbBilansScore > 0 && $this->indiscore->Bilans->item[0]->Millesime >= $millesimeMax):?>
<tr>
<td width="30">&nbsp;</td>
<td width="550" colspan="2" class="StyleInfoData">
A la lecture du dernier bilan, la situation financi&egrave;re de l'entreprise <?php echo $this->Nom;?> est <b><?php echo $this->indiscore->tabInfosNotations->SituationFinanciere;?></b>.<br/>
<!-- Cette notation financi&egrave;re est <?php echo $this->indiscore->tabInfosNotations->Notation;?>.<br/>-->
<?php
if (html_entity_decode($this->indiscore->tabInfosNotations->ProbabiliteDefaut) <> 'En défaut')
echo 'La probabilit&eacute; de d&eacute;faillance associ&eacute;e &agrave; cette note avoisine les '. number_format($this->indiscore->tabInfosNotations->ProbabiliteDefaut,3,',',' ') .' %';
else
echo 'Cette entreprise est d&eacute;faillante ou sur le point de le devenir.';
//[EquivalenceBDF]
?>
</td>
</tr>
<tr>
<td width="30">&nbsp;</td>
<td width="550" colspan="2" class="StyleInfoData">
<i>Pour information, les méthodes standards donnent : Conan &amp; Holder = <b><?php echo $this->indiscore->scores->ConanH;?></b>,
Afdcc2 = <b><?php echo $this->indiscore->scores->Afdcc2;?></b> et Score Z = <b><?php echo $this->indiscore->scores->Z;?></b>.</i>
</td>
</tr>
<?php else:?>
<tr>
<td width="30">&nbsp;</td>
<td width="550" colspan="2" class="StyleInfoData">
La situation financi&egrave;re de l'entreprise ne peut être évaluée en détail car
<?php
if($this->indiscore->Bilans->item[0]->Millesime < $millesimeMax && count($this->indiscore->Bilans) > 0 ) {
echo 'le dernier bilan disponible date de '.substr($this->indiscore->Bilans->item[0]->Millesime,0,4).'.';
} else {
echo 'aucun bilan n\'est disponible.';
} ?>
</td>
</tr>
<?php endif;?>
</table>
</div>
<h2>Paiements</h2>
<div class="paragraph">
<table>
<tr>
<td width="30">&nbsp;</td>
<td width="550" colspan="2" class="StyleInfoData">
<?php if(!empty($this->indiscore->infoPaiement)):?>
<?php echo html_entity_decode($this->indiscore->infoPaiement);?>
<?php else :?>
Aucune information sur les paiements disponible.
<?php endif;?>
</td>
</tr>
</table>
</div>
<h2>Conclusion</h2>
<div class="paragraph">
<table>
<tr>
<td width="30">&nbsp;</td>
<td width="550" colspan="2" class="StyleInfoData">
<span class="notvisible">
Compte tenu des informations disponibles aupr&egrave;s des sources officielles
Scores et D&eacute;cisions pr&eacute;sente la conclusion suivante :</span><br/>
<?php
switch($this->typeScore)
{
case '20':
$maxIndiscore = $this->typeScore;
$indiscore = $this->indiscore->Indiscore20;
break;
case '100':
default:
$maxIndiscore = empty($this->typeScore)? '100' : $this->typeScore;
$indiscore = $this->indiscore->Indiscore;
break;
}
?>
<h3 style="font-size:13px"><b>LE SCORE EST DE <?php echo $indiscore;?> SUR <?php echo $maxIndiscore;?> POINTS</b></h3>
<?php
if($this->indiscore->infoEncours != '' && !is_numeric($this->indiscore->encours) && $this->indiscore->encours == 'N/A'){ ?>
<h3><?php echo $this->indiscore->infoEncours;?></h3>
<?php
}else{ ?>
<?php
if ($indiscore!=0) { ?>
<i>La tendance de la note est <?php echo $this->indiscore->TendanceIndiscore;?></i>
<h3 style="font-size:13px"><b>L'ENCOURS MAXIMUM CONSEILL&Eacute; EST DE <?php echo round($this->indiscore->encours / 1000);?> K&euro;</b></h3>
<?php } ?>
<h3><?php echo $this->indiscore->infoEncours;?></h3>
<?php } ?>
</td>
</tr>
<tr><td colspan="3" align="center"><img class="notvisible" src="/themes/default/images/indiscore/logo_indiscore.png"/></td></tr>
</table>
</div>

View File

@ -0,0 +1,31 @@
<?php
$class = '';
if ($this->deleted!='') {
$class = ' class="deleted"';
}
?>
<tr<?=$class?>>
<td width="140" class="StyleInfoLib">
<span id="annoncesDate">Le <?=$this->date?></span>
</td>
<td>
<span id="annoncesImg">
<?php if (!empty($this->logo)) {?>
<img src="/themes/default/images/annonces/<?=$this->logo?>" title="<?=$this->title?>" />
<?php }?>
</span>
</td>
<td width="450" colspan="2" class="StyleInfoData">
<a class="tiptxt" href="<?=$this->partialLoop()->view->url(array(
'controller' => 'juridique',
'action' => 'annonces',
'siret' => $this->partialLoop()->view->siret,
'id' => $this->partialLoop()->view->id,
'idAnn' => $this->idAnn,
'vue' => $this->type,
))?>">
<?=$this->lib?>
</a>
<span style="display:none;"><?=$this->RemplaceSiren($this->texte)?></span>
</td>
</tr>

View File

@ -0,0 +1,127 @@
<h1>LIENS FINANCIERS</h1>
<style>
a.lienNom{color:#535353;}
a.lienNom:link{color:#535353;}
a.lienNom:hover{color:#535353;}
a.lienNom:active{color:#535353;}
a.lienNom:visited {color:#535353;}
</style>
<?php $liste = array('actionnaires', 'participations');?>
<?php foreach ($liste as $part) {?>
<?php if ($part == 'actionnaires') {?>
<h2>Actionnariat</h2>
<?php } else {?>
<h2>Participations</h2>
<?php }?>
<div class="paragraph">
<?php if ($this->PP && $part == 'actionnaires') {?>
Cette entreprise est une personne physique exerçant son activité en nom propre sous la forme d'une entreprise individuelle.
<?php } else {?>
<?php if ( count($this->$part)>0 ) {?>
<table class="data">
<?php foreach ($this->$part as $lien) {?>
<tr>
<td class="StyleInfoData" width="50">
<?php
if ($lien->PDetention>0) echo $lien->PDetention.'&nbsp;%';
elseif ($lien->MajMin=='+') echo 'major.'; // Traiter l'affichage ou les arbres comme si %=51
elseif ($lien->MajMin=='-') echo 'minor.';
elseif ($lien->MajMin=='C') echo 'contrôle'; // Traiter l'affichage ou les arbres comme si %=51
elseif ($lien->MajMin=='S') echo 'scission'; // Traiter l'affichage ou les arbres comme si %=0
elseif ($lien->MajMin=='F') echo 'absorption'; // Traiter l'affichage ou les arbres comme si %=100
elseif ($lien->MajMin=='P') echo 'projet fusion'; // Traiter l'affichage ou les arbres comme si %=100
elseif ($lien->MajMin=='T') echo 'TUP'; // Traiter l'affichage ou les arbres comme si %=100
elseif ($lien->MajMin=='L') echo 'tutelle';
elseif ($lien->MajMin=='E') echo 'franchise';
// elseif ($lien->MajMin=='A') echo 'absorbant';
else echo '&nbsp;';
?>
</td>
<td class="StyleInfoLib lienfiche" id="<?=$lien->idFiche?>" width="350">
<?php if (intval($lien->siren)!=0) {?>
<a class="lienNom" href="<?=$this->url(array('controller'=>'identite','action'=>'liens','siret'=>$lien->siren), null, true)?>">
<?php } else {?>
<a class="lienNom" href="<?=$this->url(array('controller'=>'identite','action'=>'liens','lienref'=>$lien->idFiche), null, true)?>">
<?php }?>
<?=$lien->nom?>
</a>
</td>
<td class="StyleInfoData" width="150">
<?php
if ( !empty($lien->siren) && intval($lien->siren)!=0 ) {
$href = $this->url(array(
'controller' => 'identite',
'action' => 'fiche',
'siret' => $lien->siren
), null, true);
echo 'Siren&nbsp;<a href="'.$href.'">'.$this->SirenTexte($lien->siren).'</a>';
}
else '&nbsp;';
if ($lien->pays<>'France') echo '<b>'.$lien->pays.'</b>';
?>
</td>
</tr>
<?php }?>
</table>
<?php } else {?>
<?php if ($part == 'actionnaires') {?>
<div>Aucun actionnaire r&eacute;f&eacute;renc&eacute; par nos services.</div>
<?php if ($this->lienStatuts) {?>
<?php if ($this->lienStatuts && $this->FJ1) {?>
<div>Afin didentifier l'unique actionnaire de cette entreprise, consulter ses <a href="<?=$this->lienStatuts?>">statuts</a>.</div>
<?php } elseif ($this->lienStatuts) {?>
<div>Afin didentifier les actionnaires de cette entreprise, consulter ses <a href="<?=$this->lienStatuts?>">statuts</a>.</div>
<?php }?>
<?php }?>
<?php } else {?>
<div>Aucune participation r&eacute;f&eacute;renc&eacute;e par nos services.</div>
<?php if ($this->lienBilans) {?>
<?php if ($this->lienStatuts) {?>
<div>Afin didentifier les participations de cette entreprise, consulter son <a href="<?=$this->lienBilans?>">dernier bilan publié</a>.</div>
<?php }?>
<?php }?>
<?php } ?>
<?php } ?>
<?php }?>
</div>
<?php }?>
<?php if ( count($this->directions)>0 ) {?>
<h2>Fonctions de directions</h2>
<div class="paragraph">
<table class="data">
<?php foreach ($this->directions as $lien) {?>
<tr>
<td class="StyleInfoData" width="100" valign="top"><strong><?=$lien->fonction?>&nbsp;de</strong></td>
<td class="StyleInfoData" width="500">
<b><?=$lien->nom?></b>
<?php if ( $lien->dirNom!='' ) {?>
<br/>représenté par <b><?=$lien->dirNom?></b>
<?php if( $lien->dirNaissDate && $lien->dirNaissDate!='0000-00-00' ) {?>
née le <?=substr($lien->dirNaissDate,8,2).'/'.substr($lien->dirNaissDate,5,2).'/'.substr($lien->dirNaissDate,0,4)?><?php }?>
<?php if( $lien->dirNaissLieu ) {?> à <b><?=$lien->dirNaissLieu?></b> <?php }?>
<?php }?>
</td>
<td class="StyleInfoData" width="150" valign="top">
<?php if ( !empty($lien->siren) && intval($lien->siren)!=0 ) {
$href = $this->url(array(
'controller' => 'identite',
'action' => 'fiche',
'siret' => $lien->siren
), null, true);
echo 'Siren&nbsp;<a href="'.$href.'">'.$this->SirenTexte($lien->siren).'</a>';
}?>
</td>
</tr>
<?php }?>
</table>
</div>
<?php }?>

View File

@ -0,0 +1,44 @@
<h1>RATIOS</h1>
<div class="paragraph">
<?php if(!isset($this->tabResult)){?>
<?php } else {?>
<table id="ratios" style="border-collapse:collapse">
<tbody>
<?php foreach ($this->tabResult as $item) { ?>
<?php if (isset($item['ratio'])) { ?>
<tr>
<td>
<a class="tooltip" title="<?=$item['comment']?>">
<?=$item['titre']?><br/><?=$item['stitre']?></a>
</td>
<td class="right"><?=$item['entrep']?></td>
<td class="right"><?=$item['secteur']?></td>
<td class="position">
<a class="rTip"
href=""
rel="<?=$this->url(array(
'controller'=>'finance',
'action'=>'ratiosgraph',
'siret' => $this->siret,
'id' => $this->id,
'ratio' => $item['ratio']
))?>" name="<?=$item['titre']?>">
<?=$item['position']?>
</a>
</td>
</tr>
<?php } else { ?>
<tr class="subhead">
<td class="center italique"><?=$item['titre']?></td>
<td>Entreprise</td>
<td>Secteur</td>
<td>Position</td>
</tr>
<?php } ?>
<?php } ?>
</tbody>
</table>
<?php }?>
</div>

View File

@ -0,0 +1,76 @@
<h1>SYNTHÈSE</h1>
<?php if (!isset($this->tabResult)){?>
<div class="paragraph">
Aucun bilan disponible.
</div>
<?php } else {?>
<div class="paragraph">
<table id="synthese">
<thead>
<tr>
<th align="center">
<?php if (count($this->tabRatio)==1){?>
<a href="<?=$this->url(array('controller'=>'finance', 'action'=>'synthese', 'siret'=>$this->siret, 'id'=>$this->id), null, true)?>">
<img src="/themes/default/images/finance/char_bar.png" alt="Retour à la page complète" />
</a>
<?php }?>
</th>
<th class="date"><?=$this->tabResult[0]['dateCloture']?><br/><?=$this->tabResult[0]['duree']?></th>
<th class="date">Evolution</th>
<th class="date"><?=$this->tabResult[1]['dateCloture']?><br/><?=$this->tabResult[1]['duree']?></th>
<th class="date">Evolution</th>
<th class="date"><?=$this->tabResult[2]['dateCloture']?><br/><?=$this->tabResult[2]['duree']?></th>
<th class="date">Evolution</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
<?php foreach($this->tabRatio as $ratio => $info) { ?>
<tr>
<td class="head">
<a class="tooltip" title="<?=$info['comment']?>"><?=$info['titre']?></a>
</td>
<td class="right"><?=$this->tabResult[0]['entrep'][$ratio]?></td>
<td class="right"><?=$this->tabResult[0]['entrepEvol'][$ratio]?></td>
<td class="right"><?=$this->tabResult[1]['entrep'][$ratio]?></td>
<td class="right"><?=$this->tabResult[1]['entrepEvol'][$ratio]?></td>
<td class="right"><?=$this->tabResult[2]['entrep'][$ratio]?></td>
<td class="right"><?=$this->tabResult[2]['entrepEvol'][$ratio]?></td>
<td>
<?php if ($this->graph): ?>
<a href="<?=$this->url(array(
'controller' => 'finance',
'action' => 'synthese',
'siret' => $this->siret,
'id' => $this->id,
'ratio' => $ratio,
))?>">
<img class="sTip" rel="<?=$this->url(array(
'controller' => 'finance',
'action' => 'synthesegraphevol',
'siret' => $this->siret,
'id' => $this->id,
'ratio' => $ratio,
))?>" title="<?=$info['titre']?>" src="/themes/default/images/finance/char_bar.png" alt="Visionner le graphique">
<?php endif;?>
</a>
</td>
</tr>
<?php }?>
</tbody>
</table>
</div>
<div class="paragraph">
<?php if ($this->graph) {?>
<?php //=$this->action('synthesegraphcompare', 'finance', null, array('siret'=>$this->siret, 'id'=>$this->id, 'typeBilan'=>$this->typeBilan))?>
<?php } else {?>
<b>Les informations sont insufisantes pour générer le graphique de synthèse.</b>
<?php }?>
</div>
<?php }?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 500 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 743 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 477 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 496 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 847 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 529 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 364 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 463 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 595 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 845 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 828 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 836 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 839 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 545 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 599 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 545 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 420 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 453 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 541 B

Some files were not shown because too many files have changed in this diff Show More