Update SdMetier

This commit is contained in:
Michael RICOIS 2016-02-19 16:43:02 +00:00
parent b8ad0968b2
commit 050eedf3e3
6 changed files with 47 additions and 57 deletions

View File

@ -201,13 +201,18 @@ class SdMetier_Infogreffe_DocAC extends SdMetier_Infogreffe_Service
$num = $row->num_acte;
$options = $row->numGreffe . '-' . substr($row->numRC,0,2) . '-' . substr($row->numRC,2,1) . '-' . substr($row->numRC,3) . '-' . $row->num_depot;
$dir = $this->getFilePath($date);
if ( ! file_exists($this->config->storage->path . '/' . $dir) ) {
mkdir($this->config->storage->path . '/' . $dir, 0777, true);
}
//Set filename
$filename = $this->getFilePath($date) . '/' . $this->getFileName($date, $num, $type, $options);
$filename = $dir . '/' . $this->getFileName($date, $num, $type, $options);
if ( $row->pdfLink != '' ) {
//Set the filename
$filename = $this->getFilePath($date) . '/' . $row->pdfLink;
$filename = $dir . '/' . $row->pdfLink;
//Check if filename exist
if ( !file_exists($this->config->storage->path . '/' . $filename) ) {
@ -355,11 +360,7 @@ class SdMetier_Infogreffe_DocAC extends SdMetier_Infogreffe_Service
*/
public function getFilePath($date)
{
$dir = 'actes/' . substr($date,0,4) . '/' . substr($date,5,2);
if ( !file_exists( $this->config->storage->path . '/' . $dir ) ) {
mkdir($this->config->storage->path . '/' . $dir, 0777, true);
}
return $dir;
return 'actes/' . substr($date,0,4) . '/' . substr($date,5,2);
}
/**

View File

@ -220,13 +220,18 @@ class SdMetier_Infogreffe_DocBI extends SdMetier_Infogreffe_Service
$this->date_cloture = $row->date_cloture;
$this->type_comptes = $row->type_comptes;
$dir = $this->getFilePath($type, $dateCloture);
if ( ! file_exists($this->config->storage->path . '/' . $dir) ) {
mkdir($this->config->storage->path . '/' . $dir, 0777, true);
}
//Set the filename
$filename = $this->getFilePath($type, $dateCloture) . '/' . $this->getFileName($type, $dateCloture);
$filename = $dir . '/' . $this->getFileName($type, $dateCloture);
if ($row->pdfLink != '') {
//Check if filename exist
if ( !file_exists($this->config->storage->path . '/' . $filename) ) {
if ( ! file_exists($this->config->storage->path . '/' . $filename) ) {
throw new Exception('File not found', self::INT);
}
@ -370,11 +375,7 @@ class SdMetier_Infogreffe_DocBI extends SdMetier_Infogreffe_Service
if ($type=='') {
$type = 'sociaux';
}
$dir = 'bilans' . '/' . $type . '/' . substr($dateCloture,0,4);
if ( !file_exists( $this->config->storage->path . '/' . $dir ) ) {
mkdir($this->config->storage->path . '/' . $dir, 0777, true);
}
return $dir;
return 'bilans' . '/' . $type . '/' . substr($dateCloture,0,4);
}
/**

View File

@ -46,8 +46,13 @@ class SdMetier_Infogreffe_DocST extends SdMetier_Infogreffe_Service
$this->mode_diffusion = 'T';
$this->reference_client = 'T'.date('YmdHis');
$dir = $this->getFilePath($type, $dateCloture);
if ( ! file_exists( $this->config->storage->path . '/' . $dir ) ) {
mkdir($this->config->storage->path . '/' . $dir, 0777, true);
}
//Set the filename
$filename = $this->getFilePath($type, $dateCloture) . '/' . $this->getFileName($type, $dateCloture);
$filename = $dir . '/' . $this->getFileName($type, $dateCloture);
try {
$xml = $this->callRequest();
@ -115,11 +120,7 @@ class SdMetier_Infogreffe_DocST extends SdMetier_Infogreffe_Service
if ($type=='') {
$type = 'sociaux';
}
$dir = 'bilans' . '/' . $type . '/' . substr($dateCloture,0,4);
if ( !file_exists( $this->config->storage->path . '/' . $dir ) ) {
mkdir($this->config->storage->path . '/' . $dir, 0777, true);
}
return $dir;
return 'bilans' . '/' . $type . '/' . substr($dateCloture,0,4);
}
/**

View File

@ -1,11 +1,4 @@
<?php
require_once 'Metier/partenaires/classMPrivileges.php';
require_once 'Metier/partenaires/classMMarques.php';
require_once 'Metier/scores/classMRegression.php';
require_once 'Metier/scores/classMSolvabilite.php';
require_once 'Metier/scores/classMRatios.php';
require_once 'Metier/scores/classMProjection.php';
class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
{
/**
@ -720,7 +713,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
*/
public function PROJEC($valeur, $nbAnnees)
{
$projec = new Projection();
$projec = new Metier_Scores_Projection();
$projec->tabRegX = $this->tabRegX;
$result = $projec->calc($valeur, $nbAnnees);
if ( $result !== false ) {
@ -749,7 +742,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
$this->NIVEAU = $cycleClient; // 1, 2, 3 ou 5 Niveau de version des commentaires
$iInsee = new MInsee($this->db);
$iInsee = new Metier_Insee_MInsee($this->db);
if ($this->companyEvenDateStop !== null) {
$iInsee->setEvenLimit($this->companyEvenDateStop);
}
@ -864,7 +857,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
/**
* Différences INSEE/RNCS
*/
$iRncs = new MRncs($this->db);
$iRncs = new Metier_Partenaires_MRncs($this->db);
$tabIdentiteRncs = $iRncs->getInfosEntrep($siren);
$this->ACTIFRNCS = $tabIdentiteRncs['actif'];
$this->ACTIFINSEE = $tabIdentite['Actif'];
@ -955,7 +948,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
// --- Liste des bilans
$tabBilan = $tabBil = $this->tabRegX = array();
$mBil = new MBilans($siren, $this->db);
$mBil = new Metier_Partenaires_MBilans($siren, $this->db);
if ($this->companyEvenDateStop !== null) {
$mBil->setEvenLimit($this->companyEvenDateStop);
}
@ -1046,7 +1039,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
$this->BILANANNEE5 = $this->BILANANNEE + 5;
// --- Calcul des ratios
$mRatios = new MRatios();
$mRatios = new Metier_Scores_MRatios();
$mRatios->setTrancheEffectif($efftr);
$tabRatios = $mRatios->calcul($tabBilan);
}
@ -1943,7 +1936,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
/**
* Solvabilité
*/
$isolv = new MSolvabilite(
$isolv = new Metier_Scores_MSolvabilite(
$siren,
$naf,
$tabIdentite['EffEnTr'],
@ -2020,7 +2013,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
if (count($tabA)>0) {
foreach ($tabA as $i=>$lien)
{
$lienInsee = new MInsee($this->db);
$lienInsee = new Metier_Insee_MInsee($this->db);
if(intval($lien->siren)>100 && ( $lien->MajMin=='+' || $lien->PDetention>50))
{
$tabIdentiteA=$lienInsee->getIdentiteLight($lien->siren);
@ -2034,11 +2027,11 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
else
$this->TYPEMERE='PM';
}
$mBilA = new MBilans($lien->siren, $this->db);
$mBilA = new Metier_Partenaires_MBilans($lien->siren, $this->db);
$tabBilansA = $mBilA->listeBilans(false,2);
$nbBilansA = count($tabBilansA);
if ($nbBilansA > 0) {
$mRatiosA = new MRatios();
$mRatiosA = new Metier_Scores_MRatios();
$mRatiosA->setTrancheEffectif($tabIdentiteA['EffEnTr']);
$tabRatiosA = $mRatiosA->calcul($tabBilansA);
$this->SITUACT=$tabRatiosA[0][19];
@ -2061,7 +2054,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
if (count($tabP)>0) {
foreach ($tabP as $i=>$lien) {
if ($lien->siren>100 && ( $lien->MajMin=='+' || $lien->PDetention>50)) {
$lienInsee = new MInsee($this->db);
$lienInsee = new Metier_Insee_MInsee($this->db);
$this->NBFILLE++; // Nombre de participations à plus de 50%
if ($this->NBFILLE==1) {
$tabIdentiteP=$lienInsee->getIdentiteLight($lien->siren);
@ -2116,7 +2109,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
}
if ($numBil>2) break;
$icotation = new ICotation($item, true, $this->db);
$icotation = new Metier_Scores_ICotation($item, true, $this->db);
$secteur=$icotation->getSecteurActivite($isolv->getNaf4($naf));
$libSecteur=$icotation->tabLibActivite[$secteur];
$chiffeAffaire=$icotation->calculChiffreAffaires($isolv->getNaf4($naf));
@ -2481,8 +2474,8 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
$this->DEFAUT_MMAA=$this->LCASSUR_MMAA=$this->RISQUEIMPAYE_MMAA=$this->CSFACTO_MMAA='';
$this->COTEOK=$this->IMPAYE=$this->PRIVILEGES=$this->RISQUEGROUPE=$this->DEFAUT=$this->LCASSUR=$this->RISQUEIMPAYE=$this->CSFACTO=false;
$this->MODIFPAIDATE=0;
require_once 'Metier/partenaires/classMFacto.php';
$iFacto = new MFacto($this->db);
$iFacto = new Metier_Partenaires_MFacto($this->db);
$infoFacto = $iFacto->getCoteSpeciale($siren);
$timer['factoCS']=microtime(true);
@ -2572,7 +2565,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
// Présence de Privilèges
$this->PRIVILEGESECU=$this->PRIVILEGESECU_MT=$this->PRIVILEGETRES=$this->PRIVILEGETRES_MT=0;
$iPriv = new MPrivileges($this->db);
$iPriv = new Metier_Partenaires_MPrivileges($this->db);
$tabPriv = $iPriv->getPrivilegesCumul($siren);
$noteSolvMax=100;
if (isset($tabPriv['03']['nb'])) {
@ -2713,7 +2706,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
if ($tabTmp[0]['scoreDir'] !== null) {
$this->SCOREDIRI = $tabTmp[0]['scoreDir'];
}
if ($this->SCOREDIRI > $this->ENQUETEMAXI) {
if ($this->SCOREDIRI > $this->ENQUETEMAXI) {
$this->SCOREDIRI = $this->ENQUETEMAXI;
}
if ($tabTmp[0]['scoreSolv'] !== null) {
@ -2857,7 +2850,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
if ($encoursForce != null) {
$this->ENCOURS = $encoursForce;
}
switch ($this->FJUR2) {
case 11:
case 12:
@ -3182,8 +3175,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
$timer['risquesBassins']=microtime(true);
/** INFOS Orias **/
require_once 'Metier/partenaires/classMOrias.php';
$iOrias = new MOrias(false, $this->db);
$iOrias = new Metier_Partenaires_MOrias(false, $this->db);
$tabTmp = $iOrias->getInfosOrias($this->SIREN);
$this->ORIASID=$this->ORIASCAT=$this->ORIASID_DATE='';
if (count($tabTmp)>0) {
@ -3204,7 +3196,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
$this->MARQUENB_EUR=0; // Nombre de marques déposées en EUROPE
$this->MARQUENB_FR=0; // Nombre de marques déposées en FRANCE
$tabMarques['WW']=$tabMarques['EU']=$tabMarques['FR']=array();
$iMarque = new MMarques($this->db);
$iMarque = new Metier_Partenaires_MMarques($this->db);
$ret = $iMarque->getMarques($siren);
if ($ret!==false && count($ret)>0) {
foreach ($ret as $i=>$marque) {
@ -3379,8 +3371,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
$CADTER_SURF_CUM=0; // Cumul Surfaces des terrains à l'addresse
*/
// Locaux
require_once 'Metier/partenaires/classMCadastre.php';
$iCadastre = new MCadastre($this->db);
$iCadastre = new Metier_Partenaires_MCadastre($this->db);
$tabTmp=$iCadastre->getLocaux($siren);
if(count($tabTmp)>0 ) {
foreach ($tabTmp as $iTmp=>$cad) {
@ -3517,13 +3508,13 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
$version = '414';
$tabCommentaires = include __DIR__ . '/Comment/ScoreTxt'.$version.'N'.$this->NIVEAU.'.php';
$tabTriAff = include __DIR__ . '/Comment/ScoreTri'.$version.'N'.$NIVEAU.'.php';
require_once 'Metier/scores/Formule/Score_'.$version.'.php';
require_once 'Metier/Scores/Formule/Score_'.$version.'.php';
break;
case 'valo':
$version = 'v209';
$tabCommentaires = include __DIR__ . '/Comment/ValoTxt'.$version.'N'.$this->NIVEAU.'.php';
$tabTriAff = include __DIR__ . '/Comment/ValoTri'.$version.'N'.$this->NIVEAU.'.php';
require_once 'Metier/scores/Formule/Valo_'.$version.'.php';
require_once 'Metier/Scores/Formule/Valo_'.$version.'.php';
break;
}

View File

@ -14,9 +14,9 @@ class SdMetier_Search_Engine
{
//Load the API following the version
if ($version == 1){
require_once 'Vendors/sphinxapi/sphinxapi-0.9.9.php';
require_once 'SphinxSearch/sphinxapi-0.9.9.php';
} elseif ($version == 2){
require_once 'Vendors/sphinxapi/sphinxapi-2.1.5.php';
require_once 'SphinxSearch/sphinxapi-2.1.5.php';
}
}

View File

@ -1,8 +1,4 @@
<?php
require_once 'Metier/insee/classMInsee.php';
require_once 'Metier/scores/classMScores.php';
/**
*
*
@ -450,7 +446,7 @@ class SdMetier_Sfr_Scoring
$this->ValContratAge = $measure->getValue();
}
$classInsee = new MInsee();
$classInsee = new Metier_Insee_MInsee();
//Values are already define ?
if ( $this->ValDateCalculIndiscore === null ) {