SdMetier to Metier

This commit is contained in:
Michael RICOIS 2016-08-30 11:46:27 +02:00
parent d30c0ff46c
commit ac575ff028
80 changed files with 96 additions and 168 deletions

View File

@ -9,8 +9,7 @@
"classmap": [
"application/",
"library/Metier/",
"library/Scores/",
"library/SdMetier/"
"library/Scores/"
]
},
"authors": [

2
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "2885e55fdffd98d7fc536419f4c28a4b",
"hash": "57b1e9ba2b310c9d4442c8189f385019",
"content-hash": "edbc67aa513e9f6521d39fb2bb6d3784",
"packages": [
{

View File

@ -1,5 +1,5 @@
<?php
class SdMetier_Defaillance_Detect
class Metier_Defaillance_Detect
{
protected $debug = false;
@ -8,37 +8,37 @@ class SdMetier_Defaillance_Detect
* @var string
*/
protected $FJ;
/**
* Date de cloture du bilan (AAAAMMJJ)
* @var string
*/
protected $BilanCloture;
/**
* Actif Insee
* @var int
*/
protected $InseeActif;
/**
* Actif RCS
* @var unknown
*/
protected $RcsActif;
/**
* Nombre d'établissement actif
* @var int
*/
protected $EtabActifNb;
/**
* Rgsitre des métiers
* @var int
*/
protected $NumRM;
/**
* RCS
* @var int
@ -63,7 +63,7 @@ class SdMetier_Defaillance_Detect
protected $ProcolMaxYear = 12;
protected $Even;
protected $EvenDateJugement;
protected $EvenDateJugement;
protected $EvenTxt;
protected $EvenDelete = 0;
@ -110,18 +110,18 @@ class SdMetier_Defaillance_Detect
{
$this->RcsActif = $val;
}
public function setEtabActif($val)
public function setEtabActif($val)
{
$this->EtabActifNb = $val;
}
public function setRM($val)
public function setRM($val)
{
$this->IsRM = $val;
}
public function setGreffe($val)
public function setGreffe($val)
{
$this->IsRCS = $val;
}
@ -161,7 +161,7 @@ class SdMetier_Defaillance_Detect
*/
public function planEnd()
{
$calc = \DateTime::createFromFormat('Ymd', $this->PlanDateStart);
$calc = \DateTime::createFromFormat('Ymd', $this->PlanDateStart);
$interval = new \DateInterval('P'.$this->PlanPeriod.'M');
$calc->add($interval);
$this->PlanDateEnd = $calc->format('Ymd');
@ -192,9 +192,9 @@ class SdMetier_Defaillance_Detect
public function parse($ann)
{
$this->Even = $ann->code;
$this->EvenDateJugement = $ann->date;
$this->EvenDateJugement = $ann->date;
$this->EvenTxt = $ann->txt;
if ($this->debug) {
file_put_contents('procol.log', "Annonce : ".$ann->date . '-' . $ann->code."\n", FILE_APPEND);
}
@ -218,7 +218,7 @@ class SdMetier_Defaillance_Detect
// Lancement des règles
$this->rules();
if ($this->debug) {
file_put_contents('procol.log', "\n", FILE_APPEND);
}
@ -233,7 +233,7 @@ class SdMetier_Defaillance_Detect
$setSituation = false;
// Parcours des règles
foreach ($rules as $rule) {
if ($this->debug) {
if ($this->debug) {
file_put_contents('procol.log', $rule['name']."\n", FILE_APPEND);
}
$result = $this->params($rule['params']);
@ -251,13 +251,13 @@ class SdMetier_Defaillance_Detect
);
file_put_contents('procol.log', print_r($this->Timeline,1)."\n", FILE_APPEND);
}
if ($this->debug) {
if ($result === true) {
file_put_contents('procol.log', "=> OK\n", FILE_APPEND);
} else {
file_put_contents('procol.log', "=> PASS\n", FILE_APPEND);
}
}
}
}
}
@ -270,19 +270,19 @@ class SdMetier_Defaillance_Detect
{
$cNb = count($conditions);
$cIncr = 1;
foreach ($conditions as $cond)
foreach ($conditions as $cond)
{
if ($this->debug) {
file_put_contents('procol.log', "\t".$cond['var']." ".$cond['op']." ".$cond['value']."\n", FILE_APPEND);
}
$result = $this->paramEval($cond['var'], $cond['op'], $cond['value']);
$result = $this->paramEval($cond['var'], $cond['op'], $cond['value']);
if ($result === false) {
return false;
}
if ($cNb == $cIncr) {
return true;
}
$cIncr++;
$cIncr++;
}
}
@ -300,15 +300,15 @@ class SdMetier_Defaillance_Detect
if ( is_array($val) ) {
return $val;
}
if ( is_string($val) && property_exists($this, $val)) {
return $this->{$val};
}
if ( is_string($val) && defined('self::'.$val) ) {
return constant('self::'.$val);
}
if ( is_string($val) ) {
return $val;
}
@ -324,10 +324,10 @@ class SdMetier_Defaillance_Detect
* @return boolean|NULL
*/
protected function paramEval($var, $op, $value)
{
{
// Operation
switch ($op) {
case 'SET':
case 'SET':
$this->{$var} = $value;
if ($this->debug) {
file_put_contents('procol.log', "\t\tSET ".$var." = ".$value."\n", FILE_APPEND);
@ -363,10 +363,10 @@ class SdMetier_Defaillance_Detect
if ($this->debug) {
file_put_contents('procol.log', "\t".$this->{$var}." = ".$value."\n", FILE_APPEND);
}
if ( in_array($this->{$var}, $valueReal) ) {
if ( in_array($this->{$var}, $valueReal) ) {
return true;
}
}
}
elseif ( $this->{$var} == $valueReal ) {
if ($this->debug) {
file_put_contents('procol.log', "\t".$this->{$var}." = ".$valueReal."\n", FILE_APPEND);

View File

View File

@ -1,5 +1,5 @@
<?php
class SdMetier_Graydon_Service extends Zend_Soap_Client
class Metier_Graydon_Service extends Zend_Soap_Client
{
protected $PartnerClientId = '32790';
protected $PartnerUserId = 'SESS38R7';

View File

@ -4,7 +4,7 @@ require_once dirname(__FILE__) . '/Service.php';
/**
* Infogreffe : Document Acte
*/
class SdMetier_Infogreffe_DocAC extends SdMetier_Infogreffe_Service
class Metier_Infogreffe_DocAC extends Metier_Infogreffe_Service
{
const INT = 1000;

View File

@ -4,7 +4,7 @@ require_once dirname(__FILE__) . '/Service.php';
/**
* Infogreffe : Document Bilan
*/
class SdMetier_Infogreffe_DocBI extends SdMetier_Infogreffe_Service
class Metier_Infogreffe_DocBI extends Metier_Infogreffe_Service
{
const INT = 1000;

View File

@ -4,7 +4,7 @@ require_once dirname(__FILE__) . '/Service.php';
/**
* Infogreffe : Document Statut
*/
class SdMetier_Infogreffe_DocST extends SdMetier_Infogreffe_Service
class Metier_Infogreffe_DocST extends Metier_Infogreffe_Service
{
/**

View File

@ -2,7 +2,7 @@
/**
* Infogreffe provider
*/
class SdMetier_Infogreffe_Service
class Metier_Infogreffe_Service
{
/**

View File

@ -1,36 +1,36 @@
<?php
class SdMetier_Intersud_Service
class Metier_Intersud_Service
{
/**
* Stockage du cookie
* @var string
*/
protected $ckfile;
protected $login = 'YLENA';
protected $pass = 'WYLFE';
/**
* Gestion des demandes d'enquêtes au service Infogreffe
*/
public function __construct(){}
public function setDemandeur()
{
}
public function setEnquete()
{
}
public function call()
{
$this->ckfile = __DIR__.'/'.uniqid('cookie-');
if (file_exists($ckfile)) unlink($ckfile);
// --- Authentification
$url = 'http://www.intersud.fr/espace_client/';
$data = array(
@ -38,12 +38,12 @@ class SdMetier_Intersud_Service
'pwd' => $this->pass,
);
$result = $this->page($url, $data);
// --- Post de la demande
$url = 'http://intersud.fr/espace_client/demande_enquete.php';
$data = array(
//Expediteur - Email
'email_exp' => 'support@scores-decisions.com',
@ -51,20 +51,20 @@ class SdMetier_Intersud_Service
'type_enk' => $enqType, // 0=Premier, 1=Gold, 2=Distrimat, 3=Star, 4=Avis bancaire, 5=Autre
'delai_enk' => $enqDelai, // 6=24h, 7=72h, 8=+de5jours
//Type enquete - Prestation Internationales
//Société
'soc' => $tabIdentite['Nom'],
'cible_enk' => 9, // 9
'siret' => $siren,
'acti' => '',
'soc_exp' => $tabInterSud['soc_exp'],
'nom_diri' => '',
'adr' => $tabIdentite['Adresse'],
'ref_exp' => $tabInterSud['ref_exp'],
'autre_type_enk' => '', // Texte libre
'adr2' => $tabIdentite['Adresse2'],
'ville' => $tabIdentite['Ville'],
'cp' => $tabIdentite['CP'],
'pays' => '', // International ?
@ -77,17 +77,17 @@ class SdMetier_Intersud_Service
'encours' => $infoEnq['Encours'],
'nb_ech' => $infoEnq['NbEcheances'],
'delai2_enk' => $tabInterSud['delai2_enk'], // International ?
'cred' => '',
'comment' => urlencode($comment),
'val_ret' => $tabInterSud['val_ret'],
);
$result = $this->page($url, $data);
}
protected function page($url, $curl_data = '', $override = null)
{
//$user_agent = 'Mozilla/5.0 (Windows NT 5.1; rv:9.0.1) Gecko/20100101 Firefox/9.0.1';
@ -103,7 +103,7 @@ class SdMetier_Intersud_Service
rtrim($fields,'&');
$post = true;
}
$options = array(
CURLOPT_RETURNTRANSFER => true, // return web page
CURLOPT_HEADER => false, // don't return headers
@ -123,12 +123,12 @@ class SdMetier_Intersud_Service
CURLOPT_COOKIEFILE => $ckfile,
CURLOPT_COOKIEJAR => $ckfile, // Stockage du cookie de session
);
//Override define CURL option
if (is_array($override) && count($override)>0 ) {
$options = $override + $options;
}
$ch = curl_init($url);
curl_setopt_array($ch,$options);
$content = curl_exec($ch);
@ -136,19 +136,19 @@ class SdMetier_Intersud_Service
$errmsg = curl_error($ch) ;
$header = curl_getinfo($ch);
curl_close($ch);
//Rewrite encoding to UTF-8
//text/html; charset=ISO-8859-1
//$encoding = getPageHeader('text\/html; charset=', '', $header['content_type']);
//$encoding = 'ISO-8859-1';
//$content = iconv($encoding, 'UTF-8//TRANSLIT', $content);
// $header['errno'] = $err;
// $header['errmsg'] = $errmsg;
// $header['content'] = $content;
return array('header'=>$header, 'content'=>$content);
}
}

View File

@ -1,5 +1,5 @@
<?php
class SdMetier_Liens_Base
class Metier_Liens_Base
{
/**
* Company Reference id

View File

@ -47,7 +47,7 @@ class Metier_Partenaires_MBanques
protected $iDb;
function __construct($db = null)
public function __construct($db = null)
{
if ( $db === null ) {
$this->iDb = new Metier_Util_Db();
@ -56,7 +56,7 @@ class Metier_Partenaires_MBanques
}
}
function getInfoBanque($codeBanque)
public function getInfoBanque($codeBanque)
{
$ret = $this->iDb->select(
'insee.BDF_Etabs',
@ -67,7 +67,7 @@ class Metier_Partenaires_MBanques
return $tabRet;
}
function getInfoGuichet($codeBanque, $codeGuichet)
public function getInfoGuichet($codeBanque, $codeGuichet)
{
$tabBanque=$this->getInfoBanque($codeBanque);
$tabTel=$this->getTelGuichet($codeBanque,$codeGuichet);
@ -84,66 +84,13 @@ class Metier_Partenaires_MBanques
return array_merge($tabRet, $tabBanque, $tabTel);
}
function getTelGuichet($codeBanque, $codeGuichet)
public function getTelGuichet($codeBanque, $codeGuichet)
{
$ret = $this->iDb->select(
'insee.Mandel_banques',
'Tel, Fax',
$ret = $this->iDb->select('insee.Mandel_banques', 'Tel, Fax',
"CodeB=$codeBanque AND CodeG=$codeGuichet",false, MYSQL_ASSOC);
if (isset($ret[0]))
return $ret[0];
else
return array();
}
function getListeBanques($siren)
{
$tabRet = array();
if ($siren*1>1000) {
$res=$this->iDb->select('insee.banques', 'codeBanque, codeGuichet, libBanqueGuichet, precis, dateSource*1 AS dateSource', "siren=$siren", false, MYSQL_ASSOC);
$tmp=$this->iDb->select('insee.fedRib', "codeBanque, codeGuichet, CONCAT(libBanque,' ',libGuichet) AS libBanqueGuichet, 0 AS precis, IF (dateInfo='0000-00-00', dateDispo*1, dateInfo*1) AS dateSource", "siren=$siren", false, MYSQL_ASSOC);
$res=array_merge($res, $tmp);
foreach ($res as $tabBanque) {
$dateSource=$tabBanque['dateSource'];
$codBanque=$tabBanque['codeBanque'];
$codGuichet=$tabBanque['codeGuichet'];
$libBanque=trim($tabBanque['libBanqueGuichet']);
$found=false;
$adrBanque1=$adrBanque2=$adrBanqueCP=$adrBanqueVille='';
if ($codBanque>0 && $codGuichet>0 && $dateSource>(date('Y')-4)*10000+101 && $dateSource<date('Ymd')) {
$tmp=$this->iDb->select('insee.BDF_Etabs b, insee.BDF_Guichets g', 'g.bdfFibCodeEtab AS banque, g.bdfFibCodeGuichet AS guichet, b.bdfFibDenom40 AS nomBanque, b.bdfFibDenom10 AS sigleBanque, g.bdfFibDenom20 AS nomGuichet, g.bdfFibAdresse1 AS adresse1, g.bdfFibAdresse2 AS adresse2, g.bdfFibAdresse3 AS adresse3, g.CP, g.Ville', "g.bdfFibCodeEtab=$codBanque AND g.bdfFibCodeGuichet=$codGuichet AND b.bdfFibCodeEtab=g.bdfFibCodeEtab", false, MYSQL_ASSOC);
if (isset($tmp[0])) {
$libBanque=trim($tmp[0]['nomBanque'].' '.$tmp[0]['nomGuichet']);
$adrBanque1=$tmp[0]['adresse1'];
$adrBanque2=trim($tmp[0]['adresse2'].' '.$tmp[0]['adresse3']);
$adrBanqueCP=$tmp[0]['CP'];
$adrBanqueVille=$tmp[0]['Ville'];
$found=true;
};
}
if (!$found && $codBanque>0 && $dateSource>(date('Y')-4)*10000+101 && $dateSource<date('Ymd')) {
$tmp=$this->iDb->select('insee.BDF_Etabs', "bdfFibCodeEtab AS banque, '' AS guichet, bdfFibDenom40 AS nomBanque, '' AS nomGuichet, '' AS adresse1, '' AS adresse2, '' AS adresse3, '' AS CP, '' AS Ville", "bdfFibCodeEtab=$codBanque", false, MYSQL_ASSOC);
if (isset($tmp[0])) {
$libBanque=trim($tmp[0]['nomBanque'].' '.$tmp[0]['nomGuichet']);
$adrBanque1=$tmp[0]['adresse1'];
$adrBanque2=trim($tmp[0]['adresse2'].' '.$tmp[0]['adresse3']);
$adrBanqueCP=$tmp[0]['CP'];
$adrBanqueVille=$tmp[0]['Ville'];
} else continue;
} else continue;
$tabRet[] = array(
'codeBanque' => $codBanque,
'codeGuichet' => $codGuichet,
'libBanque' => $libBanque,
'adresse1' => $adrBanque1,
'adresse2' => $adrBanque2,
'cp' => $adrBanqueCP,
'ville' => $adrBanqueVille,
);
}
}
return $tabRet;
}
}

View File

@ -1,5 +1,5 @@
<?php
class SdMetier_Rnvp_Adresse
class Metier_Rnvp_Adresse
{
protected $source;
protected $sourceId;
@ -102,7 +102,7 @@ class SdMetier_Rnvp_Adresse
$rnvp->L7 = $rnvpResult->L7rnvp;
$rnvp->ProcessCode = $rnvpResult->codeRetour;
$process = new SdMetier_Rnvp_Process();
$process = new Metier_Rnvp_Process();
$correction = '';
if ($rnvpResult->CorrectionImportante == 'I') {
$correction = $rnvpResult->CorrectionImportante;
@ -115,7 +115,7 @@ class SdMetier_Rnvp_Adresse
// Label CQadrs
$rnvp->QualityCode = $rnvpResult->CQadrs;
$quality = new SdMetier_Rnvp_Quality();
$quality = new Metier_Rnvp_Quality();
$rnvp->QualityLabel = $quality->getLabel($rnvp->QualityCode);
$rnvp->GeoInseeCommune = $rnvpResult->Insee;

View File

@ -1,5 +1,5 @@
<?php
class SdMetier_Rnvp_Process
class Metier_Rnvp_Process
{
public function __construct() {}

View File

@ -1,5 +1,5 @@
<?php
class SdMetier_Rnvp_Quality
class Metier_Rnvp_Quality
{
/**
* Libellé des codes qualités

View File

@ -2029,7 +2029,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
$RJMERE=$RJFILLE=false;
$SITUACT=$NICMERE=$SIRENMERE=$SIRETMERE=$NOMMERE='';
$lienM = new SdMetier_Liens_Base($siren, 'siren');
$lienM = new Metier_Liens_Base($siren, 'siren');
//Actionnaire
$tabA = $lienM->getActionnaires(null, true);

View File

@ -1,5 +1,5 @@
<?php
class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
class Metier_Scoring_Base extends Metier_Scoring_Vars
{
/**
* Activation du debug
@ -2012,7 +2012,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
$this->RJMERE=$this->RJFILLE=false;
$this->SITUACT=$this->NICMERE=$this->SIRENMERE=$this->SIRETMERE=$this->NOMMERE='';
$lienM = new SdMetier_Liens_Base($siren, 'siren');
$lienM = new Metier_Liens_Base($siren, 'siren');
// Actionnaire
$tabA = $lienM->getActionnaires(null, true);

View File

@ -1,5 +1,5 @@
<?php
class SdMetier_Scoring_Vars
class Metier_Scoring_Vars
{
protected $ACTIFINSEE;
protected $ACTIFRNCS;

View File

@ -1,5 +1,5 @@
<?php
class SdMetier_Search_Engine
class Metier_Search_Engine
{
protected $client = null;
protected $host = null;

View File

@ -14,7 +14,7 @@
* [OPTION opt_name = opt_value [, ...]]
*
*/
class SdMetier_Search_EngineQL
class Metier_Search_EngineQL
{
protected $host = null;
protected $port = null;

View File

View File

@ -79,7 +79,7 @@ SELECT
*/
class SdMetier_Search_Histo
class Metier_Search_Histo
{
protected $index = 'histo';
protected $host;

View File

@ -1,5 +1,5 @@
<?php
class SdMetier_Sfr_Compile
class Metier_Sfr_Compile
{
/**
* Database adaptater

View File

@ -1,7 +1,7 @@
<?php
require_once 'Metier/Scores/MScores.php';
class SdMetier_Sfr_Scoring
class Metier_Sfr_Scoring
{
/**
* Version of rules (for loading static files)
@ -631,7 +631,7 @@ class SdMetier_Sfr_Scoring
//Entreprise coté au CAC
/*$this->ValIsCAC = 0;
$liensM = new SdMetier_Liens_Base($siren, 'siren');
$liensM = new Metier_Liens_Base($siren, 'siren');
if ( $lienM->isInGroupeCAC40() ) {
$this->ValIsCAC = 1;
}

View File

@ -1,18 +0,0 @@
Scores & Decisions Business Libraries
=====================================
List of libraries and description
Graydon
Infogreffe
Scoring
Search
Sfr

View File

@ -116,7 +116,7 @@ foreach ($companies as $item)
if ($dateCalcul->compare($dateReal) == -1) {
echo "Inconnue à cette date\n";
} else {
$score = new SdMetier_Scoring_Base();
$score = new Metier_Scoring_Base();
$score->setEvenLimit($dateCalcul->toString('yyyyMMdd'));
$result = $score->calculIndiScore($item, '', false, 0);
$line['DateCreaEn'] = $result['DateCreaEn'];

View File

@ -1294,7 +1294,7 @@ function AdresseNormaliseData($siren, $nic, $values = false)
$infoRNVP = null;
try {
$rnvp = new SdMetier_Rnvp_Adresse();
$rnvp = new Metier_Rnvp_Adresse();
$rnvp->setCompanyId($source . $sourceId);
$infoRNVP = $rnvp->format();
} catch (Exception $e) {}
@ -1598,7 +1598,7 @@ function LienHeadEntete()
function LienHeadData($siren, $nic, $values)
{
global $dbJo;
$c = new SdMetier_Liens_Base($siren, 'siren', $dbJo);
$c = new Metier_Liens_Base($siren, 'siren', $dbJo);
$c->stopAtFirstIsin = true;
$id = $c->getHead();
$result = $c->getIdentity($id);
@ -1638,7 +1638,7 @@ function LienHeadUltimateEntete()
function LienHeadUltimateData($siren, $nic, $values)
{
global $dbJo;
$c = new SdMetier_Liens_Base($siren, 'siren', $dbJo);
$c = new Metier_Liens_Base($siren, 'siren', $dbJo);
$c->stopAtPP = false;
$id = $c->getHead();
$result = $c->getIdentity($id);
@ -1698,7 +1698,7 @@ function actionnairesEntete()
function actionnairesMultiple($siren, $nic)
{
global $dbJo;
$liensM = new SdMetier_Liens_Base($siren, 'siren', $dbJo);
$liensM = new Metier_Liens_Base($siren, 'siren', $dbJo);
$result = $liensM->getActionnaires(null, true);
$tabData = array();
if (count($result)>0) {
@ -1786,7 +1786,7 @@ function participationsEntete()
function participationsMultiple($siren, $nic)
{
global $dbJo;
$liensM = new SdMetier_Liens_Base($siren, 'siren', $dbJo);
$liensM = new Metier_Liens_Base($siren, 'siren', $dbJo);
$result = $liensM->getParticipations(null,true);
$tabData = array();
if (count($result)>0) {
@ -1890,7 +1890,7 @@ function groupesMultiple($siren, $nic, $values = false)
{
global $dbJo;
$tabData = array();
$c = new SdMetier_Liens_Base($siren, 'siren', $dbJo);
$c = new Metier_Liens_Base($siren, 'siren', $dbJo);
$identity = $c->getIdentity();
$level = 0;
@ -1925,7 +1925,7 @@ function groupesMultipleById($id, $values = false)
global $dbJo;
$tabData = array();
$c = new SdMetier_Liens_Base($id, 'ref', $dbJo);
$c = new Metier_Liens_Base($id, 'ref', $dbJo);
$identity = $c->getIdentity();
$level = 0;