This commit is contained in:
Michael RICOIS 2015-10-23 13:27:46 +00:00
commit 41a957c7d4
14 changed files with 1503 additions and 101 deletions

View File

@ -1,9 +1,246 @@
<?php
/** Auto generated class 2015-02-04 15:45:17*/
/** Auto generated class 2015-09-28 11:56:05*/
class MRatios
{
public $efftr = null;
/** Tableau de conversion des communes **/
public $tabZones2Ratios = array(
'R01a'=>'R[801]',
'R01b'=>'Rh[801]',
'R01c'=>'Rs[801]',
'R02a'=>'R[802]',
'R02b'=>'Rh[802]',
'R02c'=>'Rs[802]',
'R02d'=>'Rq[802]',
'R02e'=>'Rt[802]',
'R03a'=>'R[803]',
'R03b'=>'Rh[803]',
'R03c'=>'Rs[803]',
'R03d'=>'Rq[803]',
'R03e'=>'Rt[803]',
'R04a'=>'R[804]',
'R04b'=>'Rh[804]',
'R04c'=>'Rs[804]',
'R04d'=>'Rq[804]',
'R04e'=>'Rt[804]',
'R05a'=>'R[805]',
'R05b'=>'Rh[805]',
'R05c'=>'Rs[805]',
'R06a'=>'R[806]',
'R06b'=>'Rh[806]',
'R06c'=>'Rs[806]',
'R06d'=>'Rq[806]',
'R06e'=>'Rt[806]',
'R07a'=>'R[807]',
'R07b'=>'Rh[807]',
'R07c'=>'Rs[807]',
'R07d'=>'Rq[807]',
'R07e'=>'Rt[807]',
'R08a'=>'R[808]',
'R08b'=>'Rh[808]',
'R08c'=>'Rs[808]',
'R08d'=>'Rq[808]',
'R08e'=>'Rt[808]',
'R09a'=>'R[809]',
'R09b'=>'Rh[809]',
'R09c'=>'Rs[809]',
'R09d'=>'Rq[809]',
'R09e'=>'Rt[809]',
'R10a'=>'R[810]',
'R10b'=>'Rh[810]',
'R10c'=>'Rs[810]',
'R10d'=>'Rq[810]',
'R10e'=>'Rt[810]',
'R11a'=>'R[811]',
'R11b'=>'Rh[811]',
'R11c'=>'Rs[811]',
'R12a'=>'R[812]',
'R12b'=>'Rh[812]',
'R12c'=>'Rs[812]',
'R13a'=>'R[813]',
'R13b'=>'Rh[813]',
'R13c'=>'Rs[813]',
'R13d'=>'Rq[813]',
'R13e'=>'Rt[813]',
'R14a'=>'R[814]',
'R14b'=>'Rh[814]',
'R14c'=>'Rs[814]',
'R14d'=>'Rq[814]',
'R14e'=>'Rt[814]',
'R15a'=>'R[815]',
'R15b'=>'Rh[815]',
'R15c'=>'Rs[815]',
'R15d'=>'Rq[815]',
'R15e'=>'Rt[815]',
'R16a'=>'R[816]',
'R16b'=>'Rh[816]',
'R16c'=>'Rs[816]',
'R16d'=>'Rq[816]',
'R16e'=>'Rt[816]',
'R17a'=>'R[817]',
'R17b'=>'Rh[817]',
'R17c'=>'Rs[817]',
'R18a'=>'R[818]',
'R18b'=>'Rh[818]',
'R18c'=>'Rs[818]',
'R18d'=>'Rq[818]',
'R18e'=>'Rt[818]',
'R19a'=>'R[819]',
'R19b'=>'Rh[819]',
'R19c'=>'Rs[819]',
'R19d'=>'Rq[819]',
'R19e'=>'Rt[819]',
'R20a'=>'R[820]',
'R20b'=>'Rh[820]',
'R20c'=>'Rs[820]',
'R20d'=>'Rq[820]',
'R20e'=>'Rt[820]',
'R21a'=>'R[821]',
'R21b'=>'Rh[821]',
'R21c'=>'Rs[821]',
'R21d'=>'Rq[821]',
'R21e'=>'Rt[821]',
'R22a'=>'R[822]',
'R22b'=>'Rh[822]',
'R22c'=>'Rs[822]',
'R23a'=>'R[823]',
'R23b'=>'Rh[823]',
'R23c'=>'Rs[823]',
'R24a'=>'R[824]',
'R24b'=>'Rh[824]',
'R24c'=>'Rs[824]',
'R25a'=>'R[825]',
'R25b'=>'Rh[825]',
'R25c'=>'Rs[825]',
'R26a'=>'R[826]',
'R26b'=>'Rh[826]',
'R26c'=>'Rs[826]',
'R26d'=>'Rq[826]',
'R26e'=>'Rt[826]',
'R27a'=>'R[827]',
'R27b'=>'Rh[827]',
'R27c'=>'Rs[827]',
'R27d'=>'Rq[827]',
'R27e'=>'Rt[827]',
'R28a'=>'R[828]',
'R28b'=>'Rh[828]',
'R28c'=>'Rs[828]',
'R28d'=>'Rq[828]',
'R28e'=>'Rt[828]',
'R29a'=>'R[829]',
'R29b'=>'Rh[829]',
'R29c'=>'Rs[829]',
'R29d'=>'Rq[829]',
'R29e'=>'Rt[829]',
'R30a'=>'R[830]',
'R30b'=>'Rh[830]',
'R30c'=>'Rs[830]',
'R30d'=>'Rq[830]',
'R30e'=>'Rt[830]',
'R31a'=>'R[843]',
'R31b'=>'Rh[843]',
'R31c'=>'Rs[843]',
'R31d'=>'Rq[843]',
'R31e'=>'Rt[843]',
'R32a'=>'R[831]',
'R32b'=>'Rh[831]',
'R32c'=>'Rs[831]',
'R33a'=>'R[832]',
'R33b'=>'Rh[832]',
'R33c'=>'Rs[832]',
'R33d'=>'R[845]',
'R33e'=>'Rh[845]',
'R33f'=>'Rs[845]',
'R34a'=>'R[833]',
'R34b'=>'Rh[833]',
'R34c'=>'Rs[833]',
'R34d'=>'R[846]',
'R34e'=>'Rh[846]',
'R34f'=>'Rs[846]',
'R35a'=>'R[834]',
'R35b'=>'Rh[834]',
'R35c'=>'Rs[834]',
'R35d'=>'R[847]',
'R35e'=>'Rh[847]',
'R35f'=>'Rs[847]',
'R36a'=>'R[835]',
'R36b'=>'Rh[835]',
'R36c'=>'Rs[835]',
'R36d'=>'R[849]',
'R36e'=>'Rh[849]',
'R36f'=>'Rs[849]',
'R37a'=>'R[844]',
'R37b'=>'Rh[844]',
'R37c'=>'Rs[844]',
'R37d'=>'R[848]',
'R37e'=>'Rh[848]',
'R37f'=>'Rs[848]',
'R38a'=>'R[836]',
'R38b'=>'Rh[836]',
'R38c'=>'Rs[836]',
'R38d'=>'Rq[836]',
'R38e'=>'Rt[836]',
'R39a'=>'R[837]',
'R39b'=>'Rh[837]',
'R39c'=>'Rs[837]',
'R39d'=>'Rq[837]',
'R39e'=>'Rt[837]',
'R40a'=>'R[838]',
'R40b'=>'Rh[838]',
'R40c'=>'Rs[838]',
'R40d'=>'Rq[838]',
'R40e'=>'Rt[838]',
'R41a'=>'R[842]',
'R41b'=>'Rh[842]',
'R41c'=>'Rs[842]',
'R41d'=>'Rq[842]',
'R41e'=>'Rt[842]',
'R42a'=>'R[839]',
'R42b'=>'Rh[839]',
'R42c'=>'Rs[839]',
'R42d'=>'Rq[839]',
'R42e'=>'Rt[839]',
'R43a'=>'R[840]',
'R43b'=>'Rh[840]',
'R43c'=>'Rs[840]',
'R43d'=>'Rq[840]',
'R43e'=>'Rt[840]',
'R44a'=>'R[841]',
'R44b'=>'Rh[841]',
'R44c'=>'Rs[841]',
);
public function __construct($db = null)
{
if ( $db === null ) {
$this->iDb = new WDB();
} else {
$this->iDb = $db;
}
}
/**
* Conversion des zones pour les collectivités
* @param unknown $codeR
* @param unknown $zonesDB
* @return array
*/
public function convertZones($codeR, $zonesDB)
{
foreach($this->tabZones2Ratios as $oldR=>$newR) {
if (preg_match('/(\D+)\[(\d+)\]/Uis', $newR, $matches) && $matches[1]==$codeR) {
$iRatio=$matches[2];
if ($codeR=='R')
$ret[$iRatio]=$zonesDB[$oldR]*1000;
else
$ret[$iRatio]=$zonesDB[$oldR];
}
}
return $ret;
}
/**
* Donne le taux d'inflation pour une année donnée
* @param unknown $annee
@ -30,7 +267,7 @@ class MRatios
}
}
/**
/**
* Taux de tva
* @param string $date AAAAMM
* @return double
@ -72,13 +309,8 @@ class MRatios
$millesime = $p['DATE_CLOTURE'];
$tva = $this->getTxTva(substr($millesime,0,6));
// --- Utilisation des bilans N ou S uniquement
/*if ( !in_array($p['DATE_CLOTURE'], array('S', 'N')) ) {
continue;
}*/
// --- Calcul
$nm=$p['DUREE_MOIS'];
$nmp=$p['DUREE_MOIS_PRE'];
$R=array();
@ -631,7 +863,7 @@ class MRatios
$R[305]=$R[70]+$R[88]+$R[89]-$R[226];
if (!isset($R[305])) { $R[305] = 'NS'; }
$R[306]=($R[6]*(100-$this->getInflation(substr($millesime,-4))))/100;
$R[306]=($R[6]*(100-$this->getInflation(substr($millesime,4))))/100;
if (!isset($R[306])) { $R[306] = 'NS'; }
$R[307]=($R[140]*100)/$R[130];

View File

@ -1311,8 +1311,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
/** Divers éléments calculés **/
$iInsee->AnnoncesLegalesVisu = true;
//$companyAnnonces = $iInsee->getAnnoncesLegales($siren);
$companyAnnonces = array();
$companyAnnonces = $iInsee->getAnnoncesLegales($siren);
$iInsee->AnnoncesLegalesVisu = false;
// Annonces de dépôt des comptes
@ -1519,7 +1518,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
* 2725 Fusion/Absorption
*/
$tabDepotCpt = $iInsee->annoncesFilter($companyAnnonces, array(2700,2701,2702,2703,2710,2720,2721,2725,2726,2730,2740));
if (is_array($tabDepotCpt) && count($tabDepotCpt) > 0) {
if (is_array($tabDepotCpt) && count($tabDepotCpt) > 0){
foreach ($tabDepotCpt as $iDep=>$depot) {
if ($iDep == 0) {
$ANNONCEFUSDATE = $depot['DateParution'];
@ -2374,7 +2373,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
$DIR2_TYPE='PP';
}
$activeRechercheDir = false;
$activeRechercheDir = true;
if ($activeRechercheDir){
$tabDir = $iInsee->rechercheDir($dir['Nom'], $dir['Prenom'], '', $dir['NaissDate'], '', 0, 200, 200);
$tabDir = $tabDir['reponses'];
@ -2856,18 +2855,32 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
case 15:
case 16:
case 19:
if ($ENCOURS==0 &&
!$IMPAYE && !$PRIVILEGES && !$RISQUEGROUPE && !$DEFAUT &&
!$LCASSUR && $CSFACTO<>50 && !$RISQUEIMPAYE) {
$ENCOURS=$CAESTIME/36;
if ($noteSolvabilite>=50 && $AGE>=120) $plafond=7000;
elseif ($noteSolvabilite>=45 && $AGE>=60) $plafond=5000;
elseif ($noteSolvabilite>=45 && $AGE>=36) $plafond=3000;
elseif ($noteSolvabilite>=55) $plafond=2000;
if ( $DELAIPAY>$DELAIPAYp && $DELAIPAYp>0 && $DELAIPAY<=90 )
$plafond=$plafond/2;
elseif ($DELAIPAY>90) $plafond=0;
if ($ENCOURS>$plafond) $ENCOURS=$plafond;
if ($ENCOURS >= 0 && $ENCOURS <= 2000 && !$IMPAYE && !$PRIVILEGES && !$RISQUEGROUPE &&
!$DEFAUT && !$LCASSUR && $CSFACTO != 50 && !$RISQUEIMPAYE) {
$ENCOURS = $CAESTIME/36;
if ($noteSolvabilite >= 50 && $AGE >= 120) {
$plafond = 7000;
}
elseif ($noteSolvabilite >= 45 && $AGE >= 60) {
$plafond = 5000;
}
elseif ($noteSolvabilite >= 45 && $AGE >= 36) {
$plafond = 3000;
}
elseif ($noteSolvabilite >= 55) {
$plafond = 2000;
}
if ( $DELAIPAY > $DELAIPAYp && $DELAIPAYp > 0 && $DELAIPAY <= 90 ) {
$plafond = $plafond/2;
}
/*
elseif ($DELAIPAY > 90) {
$plafond=0;
}
*/
if ($ENCOURS > $plafond) {
$ENCOURS = $plafond;
}
}
break;
case 18: // Associé Gérant de société

View File

@ -55,6 +55,12 @@ class Scores_Ws_Server
*/
public $serviceVersion = null;
/**
* Activer le marqueur lorsqu'une action implémente des méthodes publiques afin de ne par logguer les appels
* @var boolean
*/
protected $serviceActionSubcall = false;
/**
* List all application IPs
* @var array

View File

@ -15,6 +15,12 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
*/
public $debug = false;
/**
* Connexion de la base de données
* @var object
*/
protected $db = null;
/**
* Identité depuis la méthode Insee::getIdentite
* @var array
@ -40,6 +46,12 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
*/
protected $companyEvenDateStop = null;
/**
* Cycle client pour les commentaires, 0 => aucun commentaire
* @var int
*/
protected $level = 0;
protected $nm;
protected $nmp;
protected $nmp2;
@ -59,8 +71,12 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
/**
*
*/
public function __construct()
public function __construct($db = null)
{
if ( $db === null ) {
$this->db = new WDB();
}
// --- Initialisation tableau libellé des variables
$this->tabVariables = include __DIR__ . '/Data/Variables.php';
@ -77,6 +93,15 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
$this->companyEvenDateStop = $date;
}
/**
* Défini le niveau des commentaires
* @param int $num
*/
public function setCommentLevel($num)
{
$this->level = $num;
}
public function injectAnnonces(){}
public function injectIdentite(){}
@ -704,14 +729,12 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
/**
* Compute the indiScore
* @param string $siren
* @param string $nic
* @param boolean $accesDist
* @param integer $cycleClient
* @param boolean $mailDebug
* @param string $type
* "scores" ou "valo"
* @param string $sourceModif
*
*/
public function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mailDebug=true, $type = 'scores', $sourceModif='jour', $db = null)
public function calculIndiScore($siren, $type = 'scores', $sourceModif='jour')
{
$timer = array('debutIndiscore'=>microtime(true));
if (strlen($siren)>9 || (substr(''.$siren,0,9)*1)<100 ) {
@ -720,13 +743,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
$this->NIVEAU = $cycleClient; // 1, 2, 3 ou 5 Niveau de version des commentaires
if ( $db === null ) {
$iDb = new WDB();
} else {
$iDb = $db;
}
$iInsee = new MInsee($iDb);
$iInsee = new MInsee($this->db);
if ($this->companyEvenDateStop !== null) {
$iInsee->setEvenLimit($this->companyEvenDateStop);
}
@ -841,7 +858,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
/**
* Différences INSEE/RNCS
*/
$iRncs = new MRncs($iDb);
$iRncs = new MRncs($this->db);
$tabIdentiteRncs = $iRncs->getInfosEntrep($siren);
$this->ACTIFRNCS = $tabIdentiteRncs['actif'];
$this->ACTIFINSEE = $tabIdentite['Actif'];
@ -932,7 +949,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
// --- Liste des bilans
$tabBilan = $tabBil = $this->tabRegX = array();
$mBil = new MBilans($siren, $iDb);
$mBil = new MBilans($siren, $this->db);
if ($this->companyEvenDateStop !== null) {
$mBil->setEvenLimit($this->companyEvenDateStop);
}
@ -1127,7 +1144,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
elseif (count($tabAnnees)>1) $strAnnees='AND annee BETWEEN '.$tabAnnees[1].' AND '.$tabAnnees[0];
else $strAnnees='AND annee='.$tabAnnees[0];
$tabTmp = $iDb->select('jo.ratios_secteurs',
$tabTmp = $this->db->select('jo.ratios_secteurs',
'annee, naf5, naf4, id, (montant/nombre) AS ratio, montant, nombre',
"1 $strNaf $strAnnees ORDER BY annee DESC, id ASC",
$this->debug, MYSQL_ASSOC);
@ -1210,7 +1227,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
$where = "insSIREN=$siren AND insEVE IN ('400','410','420','425','MPF','MNP') AND idFlux < '".
$this->companyEvenDateStop."' ORDER BY insDATEVE DESC";
}
$tabTmp = $iDb->select('insee.insee_even', 'insEVE, insDATEVE', $where, $this->debug, MYSQL_ASSOC);
$tabTmp = $this->db->select('insee.insee_even', 'insEVE, insDATEVE', $where, $this->debug, MYSQL_ASSOC);
if (count($tabTmp)>0) {
$tabModif = $tabTmp[0];
$this->ETATINSEE_MMAA = substr($tabModif['insDATEVE'],0,7);
@ -1246,7 +1263,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
}
/** Eléments provenant des évènements INSEE **/
$tabTmp = $iDb->select('insee.insee_even', 'COUNT(*) AS nb, MAX(insDATEVE) AS dateMaj',
$tabTmp = $this->db->select('insee.insee_even', 'COUNT(*) AS nb, MAX(insDATEVE) AS dateMaj',
"insSIREN=$siren", $this->debug, MYSQL_ASSOC);
$tabModif=$tabTmp[0];
$this->MODIFINSEE=$tabModif['nb'];
@ -1255,7 +1272,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
$this->MODIFINSEEDATE=$tabIdentite['DateMajINSEE'];
/** Eléments provenant des évènements RNCS **/
$tabTmp=$iDb->select('jo.rncs_modifs', 'COUNT(*) AS nb, MAX(flux) AS dateMaj',
$tabTmp=$this->db->select('jo.rncs_modifs', 'COUNT(*) AS nb, MAX(flux) AS dateMaj',
"siren=$siren", $this->debug, MYSQL_ASSOC);
$tabModif=$tabTmp[0];
$this->MODIFRNCS=$tabModif['nb'];
@ -1937,7 +1954,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
$tabIdentite['DateCreaEt'],
'',
$this->RECME,
$iDb
$this->db
);
$noteStructure = $isolv->getSolvabilite();
$timer['solv'] = microtime(true);
@ -2001,7 +2018,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
if (count($tabA)>0) {
foreach ($tabA as $i=>$lien)
{
$lienInsee = new MInsee($iDb);
$lienInsee = new MInsee($this->db);
if(intval($lien->siren)>100 && ( $lien->MajMin=='+' || $lien->PDetention>50))
{
$tabIdentiteA=$lienInsee->getIdentiteLight($lien->siren);
@ -2015,7 +2032,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
else
$this->TYPEMERE='PM';
}
$mBilA = new MBilans($lien->siren, $iDb);
$mBilA = new MBilans($lien->siren, $this->db);
$tabBilansA = $mBilA->listeBilans(false,2);
$nbBilansA = count($tabBilansA);
if ($nbBilansA > 0) {
@ -2042,7 +2059,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($iDb);
$lienInsee = new MInsee($this->db);
$this->NBFILLE++; // Nombre de participations à plus de 50%
if ($this->NBFILLE==1) {
$tabIdentiteP=$lienInsee->getIdentiteLight($lien->siren);
@ -2099,7 +2116,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
}
if ($numBil>2) break;
$icotation = new ICotation($item, true, $iDb);
$icotation = new ICotation($item, true, $this->db);
$secteur=$icotation->getSecteurActivite($isolv->getNaf4($naf));
$libSecteur=$icotation->tabLibActivite[$secteur];
$chiffeAffaire=$icotation->calculChiffreAffaires($isolv->getNaf4($naf));
@ -2467,7 +2484,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
// --- Cut Off
$this->ENQUETE='';
if ($this->companyEvenDateStop === null) {
$tabTmp = $iDb->select('jo.scores_cutoff',
$tabTmp = $this->db->select('jo.scores_cutoff',
'encours, scoreSolv, scoreDir, scoreConf, DATE(dateInsert)*1 AS dateInsert, DATE(dateUpdate)*1 AS dateUpdate',
"siren=$siren", $this->debug, MYSQL_ASSOC);
$timer['scores_cutoff'] = microtime(true);
@ -2500,7 +2517,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
$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($iDb);
$iFacto = new MFacto($this->db);
$infoFacto = $iFacto->getCoteSpeciale($siren);
$timer['factoCS']=microtime(true);
@ -2591,7 +2608,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($iDb);
$iPriv = new MPrivileges($this->db);
$tabPriv = $iPriv->getPrivilegesCumul($siren);
$noteSolvMax=100;
if (isset($tabPriv['03']['nb'])) {
@ -2833,18 +2850,31 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
case 15:
case 16:
case 19:
if ($this->ENCOURS==0 &&
!$this->IMPAYE && !$this->PRIVILEGES && !$this->RISQUEGROUPE && !$this->DEFAUT &&
!$this->LCASSUR && $this->CSFACTO<>50 && !$this->RISQUEIMPAYE) {
$this->ENCOURS=$this->CAESTIME/36;
if ($noteSolvabilite>=50 && $this->AGE>=120) $plafond=7000;
elseif ($noteSolvabilite>=45 && $this->AGE>=60) $plafond=5000;
elseif ($noteSolvabilite>=45 && $this->AGE>=36) $plafond=3000;
elseif ($noteSolvabilite>=55) $plafond=2000;
if ( $this->DELAIPAY>$this->DELAIPAYp && $this->DELAIPAYp>0 && $this->DELAIPAY<=90 )
$plafond=$plafond/2;
elseif ($this->DELAIPAY>90) $plafond=0;
if ($this->ENCOURS>$plafond) $this->ENCOURS=$plafond;
if ($this->ENCOURS == 0 && $this->ENCOURS <= 2000 && !$this->IMPAYE &&
!$this->PRIVILEGES && !$this->RISQUEGROUPE && !$this->DEFAUT &&
!$this->LCASSUR && $this->CSFACTO != 50 && !$this->RISQUEIMPAYE) {
$this->ENCOURS = $this->CAESTIME/36;
if ($noteSolvabilite >= 50 && $this->AGE >= 120) {
$plafond = 7000;
}
elseif ($noteSolvabilite >= 45 && $this->AGE >= 60) {
$plafond = 5000;
}
elseif ($noteSolvabilite >= 45 && $this->AGE >= 36) {
$plafond = 3000;
}
elseif ($noteSolvabilite >= 55) {
$plafond = 2000;
}
if ($this->DELAIPAY > $this->DELAIPAYp && $this->DELAIPAYp > 0 && $this->DELAIPAY <= 90) {
$plafond = $plafond/2;
}
/*elseif ($this->DELAIPAY > 90) {
$plafond = 0;
}*/
if ($this->ENCOURS > $plafond) {
$this->ENCOURS = $plafond;
}
}
break;
case 18: // Associé Gérant de société
@ -2863,7 +2893,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
case 92: // Association loi 1901 ou assimilé
case 93: // Fondation
case 99: // Fondation
$tabTmp=$iDb->select('jo.asso_bilans', 'dateCloture, dateCloture*1 as dateClotureNum', "siren=$siren ORDER BY dateCloture DESC LIMIT 0,5", $this->debug, MYSQL_ASSOC);
$tabTmp=$this->db->select('jo.asso_bilans', 'dateCloture, dateCloture*1 as dateClotureNum', "siren=$siren ORDER BY dateCloture DESC LIMIT 0,5", $this->debug, MYSQL_ASSOC);
$this->NBBILAN=count($tabTmp);
$this->BILANDATE=$tabTmp[0]['dateClotureNum'];
if ($this->BILANDATE>0 && $tabIdentite['SituationJuridique']=='' && $tabIdentite['Actif']==1) {
@ -2987,7 +3017,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
if ($genereComment)
{
// --- Grand Groupe
$tabTmp=$iDb->select('jo.surveillances_site', 'count(*) as nb',
$tabTmp=$this->db->select('jo.surveillances_site', 'count(*) as nb',
"login IN ('dgfipb', 'dgfipc', 'dgfipifu1', 'dgfipifu10', 'dgfipifu11', 'dgfipifu12', 'dgfipifu13', 'dgfipifu14', 'dgfipifu2', 'dgfipifu3', 'dgfipifu4', 'dgfipifu5', 'dgfipifu6', 'dgfipifu7', 'dgfipifu8', 'dgfipifu9') AND siren=$siren AND dateSuppr=0",
$this->debug, MYSQL_ASSOC);
$timer['GrandGroupe'] = microtime(true);
@ -2996,7 +3026,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
else $this->GRANDGROUPE = false;
// NBNIC
$tabTmp = $iDb->select('jo.etablissements', 'MAX(NIC) as NBNIC', "SIREN=$this->SIREN", $this->debug, MYSQL_ASSOC);
$tabTmp = $this->db->select('jo.etablissements', 'MAX(NIC) as NBNIC', "SIREN=$this->SIREN", $this->debug, MYSQL_ASSOC);
$this->NBNIC = $tabTmp[0]['NBNIC'];
$timer['nbNic']=microtime(true);
@ -3016,26 +3046,26 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
/** N° d'ordre de l'entreprise dans le classement des CA pour le marché de l'entreprise **/
$caTmp = round($this->CABIOUES,0);
$tabTmp = $iDb->select('jo.etablissements_act', 'count(*) AS nb', "siege=1 AND ape_entrep='$naf' AND bilFL>=$caTmp", $this->debug, MYSQL_ASSOC);
$tabTmp = $this->db->select('jo.etablissements_act', 'count(*) AS nb', "siege=1 AND ape_entrep='$naf' AND bilFL>=$caTmp", $this->debug, MYSQL_ASSOC);
if (count($tabTmp) > 0) {
$this->MARCHEPLACE = $tabTmp[0]['nb']*1;
}
$tabTmp = $iDb->select('jo.etablissements_act', 'count(*) AS nb', "siege=1 AND ape_entrep='$naf' AND bilFL>=$caTmp AND adr_dep='".$tabIdentite['Dept']."'", $this->debug, MYSQL_ASSOC);
$tabTmp = $this->db->select('jo.etablissements_act', 'count(*) AS nb', "siege=1 AND ape_entrep='$naf' AND bilFL>=$caTmp AND adr_dep='".$tabIdentite['Dept']."'", $this->debug, MYSQL_ASSOC);
if (count($tabTmp) > 0) {
$this->MARCHEPLACE_DEP = $tabTmp[0]['nb']*1;
}
$tabTmp = $iDb->select('jo.etablissements_act', 'count(*) AS nb', "siege=1 AND ape_entrep='$naf' AND adr_dep='".$tabIdentite['Dept']."' AND adr_com=".$tabIdentite['codeCommune'], $this->debug, MYSQL_ASSOC);
$tabTmp = $this->db->select('jo.etablissements_act', 'count(*) AS nb', "siege=1 AND ape_entrep='$naf' AND adr_dep='".$tabIdentite['Dept']."' AND adr_com=".$tabIdentite['codeCommune'], $this->debug, MYSQL_ASSOC);
if (count($tabTmp) > 0) {
$this->MARCHENBENT_VILLE = $tabTmp[0]['nb']*1;
}
$tabTmp = $iDb->select('jo.etablissements_act', 'count(*) AS nb', "siege=1 AND ape_entrep='$naf' AND adr_dep='".$tabIdentite['Dept']."'", $this->debug, MYSQL_ASSOC);
$tabTmp = $this->db->select('jo.etablissements_act', 'count(*) AS nb', "siege=1 AND ape_entrep='$naf' AND adr_dep='".$tabIdentite['Dept']."'", $this->debug, MYSQL_ASSOC);
if (count($tabTmp) > 0) {
$this->MARCHENBENT_DEP = $tabTmp[0]['nb']*1;
}
$timer['marcheEntrepPosition']=microtime(true);
/** Liste des communes couvertes **/
$tabTmp = $iDb->select(
$tabTmp = $this->db->select(
'jo.etablissements',
'siren, nic, adr_dep, adr_com',
"siren=$siren AND nic>0 AND actif=1 ORDER BY siege DESC, teff_etab DESC LIMIT 0,50",
@ -3061,7 +3091,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
/** Liste des risques Géo **/
$this->RISQUEGEO_NB=0; // Nombre d'établissements concernés: neutraliser si >= 10
$this->RISQUEGEO=array();
$tabTmp=$iDb->select('pollutions.prim_Risques','libCommune, risque',
$tabTmp=$this->db->select('pollutions.prim_Risques','libCommune, risque',
"codeInsee IN ('$strCom') ORDER BY risque", $this->debug, MYSQL_ASSOC);
foreach ($tabTmp as $iTmp=>$tabArret) {
$this->RISQUEGEO[]=$tabArret['risque']; // Libellé risque lié à la localisation l'un des etablissements (INNONDATION, TREMBLEMENT DE TERRE etc..)
@ -3075,7 +3105,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
/** Liste des arretes de cata **/
$this->RISQUEGEOARRETE_NB=0; // Nombre d'Arrété de catastrophe naturelle sur la commune de l'un des étab depuis 1982
$this->RISQUEGEOARRETE_VILLE=$this->RISQUEGEOARRETE=$this->RISQUEGEOARRETE_DATE=$this->RISQUEGEOARRETE_JODATE=$this->RISQUEGEOARRETE_EVTDATE=$this->RISQUEGEOARRETE_AA='';
$tabTmp=$iDb->select( 'pollutions.prim_Arrets',
$tabTmp=$this->db->select( 'pollutions.prim_Arrets',
'libCommune, risque, dateDeb, dateFin, dateArret, dateJO',
"codeInsee IN ('$strCom') ORDER BY dateFin DESC", $this->debug, MYSQL_ASSOC);
foreach ($tabTmp as $iTmp=>$tabArret) {
@ -3094,7 +3124,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
/** Liste des établissements polluants **/
$sirenDeb=$siren.'00000';
$sirenFin=$siren.'99999';
$tabTmp=$iDb->select(
$tabTmp=$this->db->select(
'pollutions.iREP_etablissements e, pollutions.iREP_rejets_etablissements r',
'e.codecommune, e.nom, e.codesiret, e.idetab, r.idrejet, r.coderejet, r.libellerejet, r.codeouvragedepollution, r.codeentitehydro, r.nomstep, r.nommilieu',
"e.codesiret BETWEEN $sirenDeb AND $sirenFin AND e.idetab=r.idetab GROUP BY e.codesiret, r.libellerejet LIMIT 0,50", $this->debug, MYSQL_ASSOC);
@ -3110,7 +3140,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
/** Bassin hydro : Le ou les libellés des bassins hydrographiques concernés
**/
$tabTmp=$iDb->select('pollutions.bassins', 'codeBassin',
$tabTmp=$this->db->select('pollutions.bassins', 'codeBassin',
"codeInsee IN ('$strCom') GROUP BY codeBassin", $this->debug, MYSQL_ASSOC);
$this->RISQUEACTBASSIN=array();
$tabBassins=array(
@ -3141,7 +3171,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
/** INFOS Orias **/
require_once 'Metier/partenaires/classMOrias.php';
$iOrias = new MOrias(false, $iDb);
$iOrias = new MOrias(false, $this->db);
$tabTmp = $iOrias->getInfosOrias($this->SIREN);
$this->ORIASID=$this->ORIASCAT=$this->ORIASID_DATE='';
if (count($tabTmp)>0) {
@ -3165,7 +3195,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
$this->MARQUENB_FR=0; // Nombre de marques déposées en FRANCE
$tabMarques['WW']=$tabMarques['EU']=$tabMarques['FR']=array();
//@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "Indiscore sur $siren : Marques", print_r($ret,true));
$iMarque = new MMarques($iDb);
$iMarque = new MMarques($this->db);
$ret = $iMarque->getMarques($siren);
if ($ret!==false && count($ret)>0) {
foreach ($ret as $i=>$marque) {
@ -3226,7 +3256,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
$this->FRANCHISE='';
if ($this->ENSEIGNE<>'') {
$tmp=addslashes($this->ENSEIGNE);
$tabTmp=$iDb->select( 'sdv1.franchiseurs',
$tabTmp=$this->db->select( 'sdv1.franchiseurs',
"id, enseigne, MATCH (enseigne) AGAINST ('$tmp') as score",
"MATCH (enseigne) AGAINST ('$tmp')
HAVING score>1 ORDER BY score DESC", $this->debug, MYSQL_ASSOC);
@ -3242,7 +3272,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
/** Population commune **/
$codeCommuneInsee=$tabIdentite['Dept'].$tabIdentite['codeCommune'];
$tabTmp = $iDb->select(
$tabTmp = $this->db->select(
'insee.insee_tabVilles', 'Pop_mun_2007, popMunZFU, popMunZUS',
"CODGEO='$codeCommuneInsee'", $this->debug, MYSQL_ASSOC
);
@ -3274,7 +3304,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
//if ($codeCommuneInsee>=75000 && $codeCommuneInsee<76000)
$this->VILLE=$tabIdentite['Ville']; // Ville ou ville + arrondissement de l'entreprise
$ya2ans=$this->ANNEEp2.'-'.date('m-d');
$ret = $iDb->query("SELECT MIN(b.VenteMt) AS vtMin, AVG(b.VenteMt) AS vtMoy, MAX(b.VenteMt) AS vtMax, COUNT(b.id) AS vtNb
$ret = $this->db->query("SELECT MIN(b.VenteMt) AS vtMin, AVG(b.VenteMt) AS vtMoy, MAX(b.VenteMt) AS vtMax, COUNT(b.id) AS vtNb
FROM (
SELECT v.id, v.VenteMt
FROM jo.scores_ventes v
@ -3284,7 +3314,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
AND v.VenteMt>1 AND v.VenteDev='EUR' $filtreCAEff
GROUP BY v.id)b");
if (count($ret)>0) {
while($ret=$iDb->fetch(MYSQL_ASSOC)) {
while($ret=$this->db->fetch(MYSQL_ASSOC)) {
$this->VENTEMAX_MT = $this->VENTEMAX_VILLE_MT = $this->VENTEMAX_VILLE_EU = $ret['vtMax']; // Plus grand montant de vente annonce VC niveau "ville"
$this->VENTEMOY_VILLE_MT = $this->VENTEMOY_VILLE_EU = $ret['vtMoy'];
$this->VENTEMIN_MT = $this->VENTEMIN_VILLE_MT = $this->VENTEMIN_VILLE_EU = $ret['vtMin']; // Plus petit montant de vente annonce VC niveau "ville"
@ -3294,7 +3324,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
// Par département
$this->DEPARTEMENT=$iInsee->getDepartement($tabIdentite['Dept']);
$this->DEPARTEMENT_DE=$iInsee->getDepartement($tabIdentite['Dept'], true);
$ret=$iDb->query("SELECT MIN(b.VenteMt) AS vtMin, AVG(b.VenteMt) AS vtMoy, MAX(b.VenteMt) AS vtMax, COUNT(b.id) AS vtNb
$ret=$this->db->query("SELECT MIN(b.VenteMt) AS vtMin, AVG(b.VenteMt) AS vtMoy, MAX(b.VenteMt) AS vtMax, COUNT(b.id) AS vtNb
FROM (
SELECT v.id, v.VenteMt
FROM jo.scores_ventes v
@ -3303,14 +3333,14 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
AND v.Bodacc_Date_Parution>='$ya2ans'
AND v.VenteMt>1 AND v.VenteDev='EUR' $filtreCAEff
GROUP BY v.id)b");
while($ret=$iDb->fetch(MYSQL_ASSOC)) {
while($ret=$this->db->fetch(MYSQL_ASSOC)) {
$this->VENTEMAX_DEP_MT = $this->VENTEMAX_DEP_EU = $ret['vtMax']; // Plus grand montant de vente annonce VC niveau "ville"
$this->VENTEMOY_DEP_MT = $this->VENTEMOY_DEP_EU = $ret['vtMoy'];
$this->VENTEMIN_DEP_MT = $this->VENTEMIN_DEP_EU = $ret['vtMin']; // Plus petit montant de vente annonce VC niveau "ville"
$this->VENTE_DEP_NB = $ret['vtNb']; // Nombre de ventes dans le niveau statistique "ville" dans les 24 derniers mois
}
// France entière
$ret=$iDb->query("SELECT MIN(b.VenteMt) AS vtMin, AVG(b.VenteMt) AS vtMoy, MAX(b.VenteMt) AS vtMax, COUNT(b.id) AS vtNb
$ret=$this->db->query("SELECT MIN(b.VenteMt) AS vtMin, AVG(b.VenteMt) AS vtMoy, MAX(b.VenteMt) AS vtMax, COUNT(b.id) AS vtNb
FROM (
SELECT v.id, v.VenteMt
FROM jo.scores_ventes v
@ -3318,7 +3348,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
AND v.Bodacc_Date_Parution>='$ya2ans'
AND v.VenteMt>1 AND v.VenteDev='EUR' $filtreCAEff
GROUP BY v.id)b");
while($ret=$iDb->fetch(MYSQL_ASSOC)) {
while($ret=$this->db->fetch(MYSQL_ASSOC)) {
$this->VENTEMAX_FRA_MT = $this->VENTEMAX_FRA_EU = $ret['vtMax']; // Plus grand montant de vente annonce VC niveau "ville"
$this->VENTEMOY_FRA_MT = $this->VENTEMOY_FRA_EU = $ret['vtMoy'];
$this->VENTEMIN_FRA_MT = $this->VENTEMIN_FRA_EU = $ret['vtMin']; // Plus petit montant de vente annonce VC niveau "ville"
@ -3342,7 +3372,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
*/
// Locaux
require_once 'Metier/partenaires/classMCadastre.php';
$iCadastre = new MCadastre($iDb);
$iCadastre = new MCadastre($this->db);
$tabTmp=$iCadastre->getLocaux($siren);
if(count($tabTmp)>0 ) {
foreach ($tabTmp as $iTmp=>$cad) {
@ -3363,7 +3393,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
$timer['cadastre']=microtime(true);
/** RPS : Entreprise avec négociations ou accord sur les RPS ? **/
$tabTmp = $iDb->select(
$tabTmp = $this->db->select(
'sdv1.gouv_rps',
'idfent, dateMAJ, negotiations, nbreunions, accordsigne, accorddate, absenceEchec',
"siren='$this->SIREN'", $this->debug, MYSQL_ASSOC
@ -3385,13 +3415,13 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
/** Taux de défaillance secteur **/
// Nb Entrep actives
$tabTmp=$iDb->select(
$tabTmp=$this->db->select(
'jo.scores_secteurs',"sum(nbEntrep) AS nb",
"annee=YEAR(NOW()) AND mois=MONTH(NOW())", $this->debug, MYSQL_ASSOC
);
$nbEntrep=$tabTmp[0]['nb'];
// Nb en défaut sur 12 mois glissant
$tabTmp=$iDb->select(
$tabTmp=$this->db->select(
'jo.scores_secteurs',
"sum(nbProcol) AS nb",
"annee=YEAR(NOW())-1 AND mois>=MONTH(NOW()) OR annee=YEAR(NOW())",
@ -3399,7 +3429,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
);
$nbEntrepProcol=$tabTmp[0]['nb'];
// Nb en défaut sur 12 mois glissant
$tabTmp=$iDb->select(
$tabTmp=$this->db->select(
'jo.scores_secteurs',
"MAX(nbEntrep) as nbSecteur, SUM(nbProcol) AS nb",
"naf5='$this->APEENT' AND (annee=YEAR(NOW())-1 AND mois>=MONTH(NOW()) OR annee=YEAR(NOW()))",
@ -3417,7 +3447,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
if ($this->NOTEDEFSEC<0) $this->NOTEDEFSEC=0;
/** Date de cessation des paiements et dernier numéro de jugement **/
$tabTmp=$iDb->select(
$tabTmp=$this->db->select(
'jo.annonces',
"MIN(dateCessationPaiement) AS cessPai, MAX(numero) AS numPC",
"siren=$siren", $this->debug, MYSQL_ASSOC
@ -3464,7 +3494,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
$naf2=substr($this->APEENT,0,2);
$naf3=substr($this->APEENT,0,3);
$naf4=substr($this->APEENT,0,4);
$tabTmp=$iDb->select('jo.tabNafValo', 'naf5, MINI, MAXI, TYPE, LENGTH(naf5) AS naf5len',
$tabTmp=$this->db->select('jo.tabNafValo', 'naf5, MINI, MAXI, TYPE, LENGTH(naf5) AS naf5len',
"naf5 LIKE '$naf2%' OR naf5 LIKE '$naf3%' OR naf5 LIKE '$naf4%' OR naf5='$this->APEENT' ORDER BY naf5len DESC LIMIT 0,1", $this->debug, MYSQL_ASSOC);
// On prend le 1er secteur trouvé le + précis
if (count($tabTmp) > 0) {
@ -3801,7 +3831,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
$this->ENCOURS = round($tabRet['encours']);
/** Historisation du score **/
$tabTmp = $iDb->select('jo.scores_surveillance s',
$tabTmp = $this->db->select('jo.scores_surveillance s',
"s.siren, s.actif, s.procol, s.indiScore, s.indiScore20, s.encours, s.indiScoreDate, scoreSolv, scoreConf, scoreDir, scoreZ, scoreCH, scoreAfdcc1, scoreAfdcc2, scoreAfdcc2note, scoreAltman, scoreAltmanCote, scoreCCF, situFi, infoNote, noteStruct, noteFin, tendance, nbModifs, s.dateUpdate, s.cs, s.csMoisMaj, s.csMoisFin",
"s.siren=$siren",
false, MYSQL_ASSOC);
@ -3836,7 +3866,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
//Scores identique au précedent, simple mise à jour
if ($indiScore==$indiScorePre && $this->ENCOURS==$encoursPre && $dateScore<>0 ) {
$tabUpdate2 = array('sourceModif'=>$sourceModif, 'nbModifs'=>$nbModifs);
if (!$iDb->update('jo.scores_surveillance', $tabUpdate2, "siren=$siren", false, 0, true)) {
if (!$this->db->update('jo.scores_surveillance', $tabUpdate2, "siren=$siren", false, 0, true)) {
debugLog('W', 'Erreur lors de la MAJ du score en surveillance pour '. $tabIdentite['Nom'], __LINE__, __FILE__, __FUNCTION__, __CLASS__);
}
}
@ -3929,18 +3959,18 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
// --- Sauvegarde et Historisation du score
if ( $actionHisto == 'insert' ) {
if (!$iDb->insert('jo.scores_surveillance', $tabUpdate, false, true)) {
if (!$this->db->insert('jo.scores_surveillance', $tabUpdate, false, true)) {
debugLog('W', "Erreur lors de l'ajout du score en surveillance pour ". $tabIdentite['Nom']." - ".mysql_error(), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
}
}
else {
if (!$iDb->update('jo.scores_surveillance', $tabUpdate, "siren=$siren", false, 0, true)) {
if (!$this->db->update('jo.scores_surveillance', $tabUpdate, "siren=$siren", false, 0, true)) {
debugLog('W', "Erreur lors de mise à jour du score en surveillance pour ". $tabIdentite['Nom']." - ".mysql_error(), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
}
}
// --- Historisation du score
if (!$iDb->insert('historiques.scores_surveillance', $tabUpdate)) {
if (!$this->db->insert('historiques.scores_surveillance', $tabUpdate)) {
debugLog('W', "Erreur lors de l'historisation du score pour ". $tabIdentite['Nom'], __LINE__, __FILE__, __FUNCTION__, __CLASS__);
}
}

View File

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

View File

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

View File

@ -16,7 +16,7 @@ class SdMetier_Search_Engine
if ($version == 1){
require_once 'Vendors/sphinxapi/sphinxapi-0.9.9.php';
} elseif ($version == 2){
require_once 'Vendors/sphinxapi/sphinxapi-2.2.9.php';
require_once 'Vendors/sphinxapi/sphinxapi-2.1.5.php';
}
}

View File

@ -0,0 +1,36 @@
<?php
/**
*
* @author mricois
*
* SELECT
* select_expr [, select_expr ...]
* FROM index [, index2 ...]
* [WHERE where_condition]
* [GROUP BY {col_name | expr_alias} [, {sol_name | expr_alias}]]
* [WITHIN GROUP ORDER BY {col_name | expr_alias} {ASC | DESC}]
* [ORDER BY {col_name | expr_alias} {ASC | DESC} [, ...]]
* [LIMIT [offset,] row_count]
* [OPTION opt_name = opt_value [, ...]]
*
*/
class SdMetier_Search_EngineQL
{
protected $host = null;
protected $port = null;
/* OPTION */
/**
* max time in milliseconds to wait for remote queries to complete,
* see agent-query-timeout under Index configuration options for details
* @var integer
*/
protected $agent_query_timeout;
public function __construct(){}
public function SetLimits( $offset, $limit, $max=0, $cutoff=0 ) {}
}

View File

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

View File

@ -0,0 +1,152 @@
<?php
/*
function rechercheHisto($formR, $deb, $nbRep, $max)
{
$gDatabaseJO = databaseJO();
$sphinx = clientSphinx($formR);
$index = 'histo';
$mode = 'SPH_MATCH_EXTENDED';
$pass = 0;
initSphinx($sphinx, $mode, $pass, $deb, $nbRep, $max);
if (!empty($formR['annee1']))
$sphinx->SetFilter('annee1', array(0=>$formR['annee1']));
$sphinx->SetRankingMode ( SPH_RANK_PROXIMITY_BM25 );
$sphinxreturn = $sphinx->Query($formR['recherche'], $index);
$gDatabaseJO->select_db('histobodacc');
foreach ( $sphinxreturn['matches'] as $doc => $docinfo )
{
$requette = "SELECT Histo as Loc, id, nomFichier, annee1, bod, texte FROM bodacc_cor WHERE id=$doc";
$req = $gDatabaseJO->query($requette);
$ligne = $req->fetch_assoc();
$etab = $ligne[0];
$tabRet[] = array(
'Localisation' => $etab['Loc'],
'id' => $doc,
'Pertinence' => $docinfo['weight'],
'Fichier' => $etab['nomFichier'],
'Annee' => $etab['annee1'],
'Code' => $etab['bod'],
'Texte' => $etab['texte'],
);
}
return array(
'results' => $tabRet,
'nbRet' => $sphinxreturn['total'],
'nbTot' => $sphinxreturn['total_found'],
'duration' => $sphinxreturn['time'],
'words' => $sphinxreturn['words'],
);
}
$dsn="mysql:host=127.0.0.1; dbname=test; charset=utf8;";
$username="member";
$password="";
$options = array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8');
$db=new PDO($dsn, $username, $password, $options);
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, FALSE);
$db->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
$query=$db->prepare("
SELECT *
FROM test WHERE MATCH (name, location) AGAINST (:search IN BOOLEAN MODE)
LIMIT 0, 10
");
$query->bindValue(':search', $search, PDO::PARAM_STR);
$query->execute();
while($data=$query->fetch(PDO::FETCH_ASSOC)){
}
SELECT
select_expr [, select_expr ...]
FROM index [, index2 ...]
[WHERE where_condition]
[GROUP BY {col_name | expr_alias} [, {sol_name | expr_alias}]]
[WITHIN GROUP ORDER BY {col_name | expr_alias} {ASC | DESC}]
[ORDER BY {col_name | expr_alias} {ASC | DESC} [, ...]]
[LIMIT [offset,] row_count]
[OPTION opt_name = opt_value [, ...]]
*/
class SdMetier_Search_Histo
{
protected $index = 'histo';
protected $host;
protected $port;
protected $username = 'member';
protected $password = '';
protected $db;
protected $query;
public function __construct()
{
$this->host = SPHINX_HISTO_HOST;
$this->port = SPHINX_HISTO_PORT;
$this->setDb();
}
protected function setDb()
{
$dsn="mysql:host=".$this->host."; dbname=".$this->index."; charset=utf8;";
$username="member";
$password="";
$options = array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8');
$this->db=new PDO($dsn, $this->username, $this->password, $options);
$this->db->setAttribute(PDO::ATTR_EMULATE_PREPARES, FALSE);
$this->db->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
}
protected function setQuery()
{
$this->query = "SELECT id";
$this->query.= " FROM ".$this->index."";
$this->query.= " WHERE annee1=".$annee." AND MATCH()";
$this->query.= " [GROUP BY {col_name | expr_alias} [, {sol_name | expr_alias}]]";
$this->query.= " [WITHIN GROUP ORDER BY {col_name | expr_alias} {ASC | DESC}]";
$this->query.= " [ORDER BY {col_name | expr_alias} {ASC | DESC} [, ...]]";
$this->query.= " [LIMIT [offset,] row_count]";
$this->query.= " OPTION ranker=proximity_bm25";
}
public function Query()
{
$query=$db->prepare("
SELECT
select_expr [, select_expr ...]
FROM ".$this->index."
[WHERE where_condition]
[GROUP BY {col_name | expr_alias} [, {sol_name | expr_alias}]]
[WITHIN GROUP ORDER BY {col_name | expr_alias} {ASC | DESC}]
[ORDER BY {col_name | expr_alias} {ASC | DESC} [, ...]]
[LIMIT [offset,] row_count]
[OPTION opt_name = opt_value [, ...]]
");
$query->bindValue(':search', $search, PDO::PARAM_STR);
$query->execute();
while($data=$query->fetch(PDO::FETCH_ASSOC)){
}
}
}

View File

@ -0,0 +1,605 @@
<?php
return array(
0 => array(
'name' => 'PO-NAF-GE',
'value' => '6000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'NAF', 'type' => 'LIST', 'value' => 'TabNafSFR'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '6'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
),
),
1 => array(
'name' => 'PO-NAF-GE',
'value' => '12000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'NAF', 'type' => 'LIST', 'value' => 'TabNafSFR'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '7'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
),
),
2 => array(
'name' => 'PO-NAF-GE',
'value' => '25000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'NAF', 'type' => 'LIST', 'value' => 'TabNafSFR'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '8'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
),
),
3 => array(
'name' => 'PO-NAF-GE',
'value' => '45000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'NAF', 'type' => 'LIST', 'value' => 'TabNafSFR'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '9'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
),
),
4 => array(
'name' => 'PO-NAF-PME',
'value' => '4600',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'NAF', 'type' => 'LIST', 'value' => 'TabNafSFR'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '6'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
),
),
5 => array(
'name' => 'PO-NAF-PME',
'value' => '5700',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'NAF', 'type' => 'LIST', 'value' => 'TabNafSFR'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '7'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
),
),
6 => array(
'name' => 'PO-NAF-PME',
'value' => '14000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'NAF', 'type' => 'LIST', 'value' => 'TabNafSFR'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '8'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
),
),
7 => array(
'name' => 'PO-NAF-PME',
'value' => '19000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'NAF', 'type' => 'LIST', 'value' => 'TabNafSFR'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '9'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
),
),
8 => array(
'name' => 'PO-NAF-PME',
'value' => '700',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'NAF', 'type' => 'LIST', 'value' => 'TabNafSFR'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '6'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
),
),
9 => array(
'name' => 'PO-NAF-PME',
'value' => '1000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'NAF', 'type' => 'LIST', 'value' => 'TabNafSFR'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '7'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
),
),
10 => array(
'name' => 'PO-NAF-PME',
'value' => '1100',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'NAF', 'type' => 'LIST', 'value' => 'TabNafSFR'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '8'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
),
),
11 => array(
'name' => 'PO-NAF-PME',
'value' => '2800',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'NAF', 'type' => 'LIST', 'value' => 'TabNafSFR'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '9'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
),
),
12 => array(
'name' => 'PO-Date-GE',
'value' => '3000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '5'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
),
),
13 => array(
'name' => 'PO-Date-GE',
'value' => '3000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '6'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
),
),
14 => array(
'name' => 'PO-Date-GE',
'value' => '3000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '7'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
),
),
15 => array(
'name' => 'PO-Date-GE',
'value' => '3000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '8'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
),
),
16 => array(
'name' => 'PO-Date-GE',
'value' => '5000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '9'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
),
),
17 => array(
'name' => 'PO-Date-GE',
'value' => '5000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '10'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
),
),
18 => array(
'name' => 'PO-Date-GE',
'value' => '5000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '11'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
),
),
19 => array(
'name' => 'PO-Date-GE',
'value' => '10000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '12'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
),
),
20 => array(
'name' => 'PO-Date-GE',
'value' => '10000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '13'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
),
),
21 => array(
'name' => 'PO-Date-GE',
'value' => '10000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '14'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
),
),
22 => array(
'name' => 'PO-Date-PME',
'value' => '3000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '5'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
),
),
23 => array(
'name' => 'PO-Date-PME',
'value' => '3000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '6'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
),
),
24 => array(
'name' => 'PO-Date-PME',
'value' => '3000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '7'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
),
),
25 => array(
'name' => 'PO-Date-PME',
'value' => '3000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '8'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
),
),
26 => array(
'name' => 'PO-Date-PME',
'value' => '6000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '9'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
),
),
27 => array(
'name' => 'PO-Date-PME',
'value' => '6000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '4'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '10'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
),
),
28 => array(
'name' => 'PO-Date-PME',
'value' => '6000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '11'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
),
),
29 => array(
'name' => 'PO-Date-PME',
'value' => '9000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '12'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
),
),
30 => array(
'name' => 'PO-Date-PME',
'value' => '9000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '13'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
),
),
31 => array(
'name' => 'PO-Date-PME',
'value' => '9000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '14'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
),
),
32 => array(
'name' => 'PO-Date-TPE',
'value' => '1000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '5'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
),
),
33 => array(
'name' => 'PO-Date-TPE',
'value' => '1000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '6'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
),
),
34 => array(
'name' => 'PO-Date-TPE',
'value' => '1000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '7'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
),
),
35 => array(
'name' => 'PO-Date-TPE',
'value' => '1000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '8'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
),
),
36 => array(
'name' => 'PO-Date-TPE',
'value' => '1500',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '9'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
),
),
37 => array(
'name' => 'PO-Date-TPE',
'value' => '1500',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '4'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '10'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
),
),
38 => array(
'name' => 'PO-Date-TPE',
'value' => '2000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '11'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
),
),
39 => array(
'name' => 'PO-Date-TPE',
'value' => '2000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '12'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
),
),
40 => array(
'name' => 'PO-Date-TPE',
'value' => '2000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '13'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
),
),
41 => array(
'name' => 'PO-Date-TPE',
'value' => '2000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '14'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
),
),
42 => array(
'name' => 'PO-STD-GE',
'value' => '6000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '5'),
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
),
),
43 => array(
'name' => 'PO-STD-GE',
'value' => '6000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '6'),
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
),
),
44 => array(
'name' => 'PO-STD-GE',
'value' => '10000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '7'),
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
),
),
45 => array(
'name' => 'PO-STD-GE',
'value' => '20000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '8'),
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
),
),
46 => array(
'name' => 'PO-STD-PME',
'value' => '3000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '5'),
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
),
),
47 => array(
'name' => 'PO-STD-PME',
'value' => '3000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '6'),
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
),
),
48 => array(
'name' => 'PO-STD-PME',
'value' => '3700',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '7'),
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
),
),
49 => array(
'name' => 'PO-STD-PME',
'value' => '5000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '8'),
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
),
),
50 => array(
'name' => 'PO-STD-PME',
'value' => '9000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '9'),
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
),
),
51 => array(
'name' => 'PO-STD-TPE',
'value' => '1000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '5'),
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
),
),
52 => array(
'name' => 'PO-STD-TPE',
'value' => '1000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '6'),
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
),
),
53 => array(
'name' => 'PO-STD-TPE',
'value' => '1000',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '7'),
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
),
),
54 => array(
'name' => 'PO-STD-TPE',
'value' => '1500',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '8'),
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
),
),
55 => array(
'name' => 'PO-STD-TPE',
'value' => '1500',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '9'),
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
),
),
);

View File

@ -0,0 +1,160 @@
<?php
return array(
0 => array(
'name' => 'VORd-11.1',
'value' => 'STOP',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'ContratAge', 'type' => 'EGAL', 'value' => 'UNDEFINE'),
1 => array( 'var' => 'IR', 'type' => 'EGAL', 'value' => 'UNDEFINE'),
),
),
1 => array(
'name' => 'VORd-11.2',
'value' => 'CONTINUE',
'comment' => "",
'po' => 0,
'params' => array(
),
),
2 => array(
'name' => 'VORd-11.3',
'value' => 'CONTINUE',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'ContratAge', 'type' => 'MIN', 'value' => '-1'),
1 => array( 'var' => 'IR', 'type' => 'EGAL', 'value' => 'UNDEFINE', 'define' => array( 'var' => 'IR', 'value' => '8')),
),
),
3 => array(
'name' => 'VORd-10.1',
'value' => 'ROUGE',
'comment' => "Société dont la solvabilité est limitée et qui rencontre des difficultés de paiement : Faire une DEC pour tout acte éligible",
'po' => 0,
'params' => array(
0 => array( 'var' => 'FEU', 'type' => 'EGAL', 'value' => 'VERT'),
1 => array( 'var' => 'IR', 'type' => 'MIN', 'value' => '4,9'),
2 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '7,1'),
3 => array( 'var' => 'ContratAge', 'type' => 'MAX', 'value' => '25'),
4 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '9'),
5 => array( 'var' => 'Indiscore', 'type' => 'MAX', 'value' => '12'),
),
),
4 => array(
'name' => 'VORd-10.2',
'value' => 'VERT',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'FEU', 'type' => 'EGAL', 'value' => 'VERT'),
1 => array( 'var' => 'IR', 'type' => 'MIN', 'value' => '4,9'),
2 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '7,1'),
3 => array( 'var' => 'ContratAge', 'type' => 'MIN', 'value' => '24'),
4 => array( 'var' => 'ContratAge', 'type' => 'MAX', 'value' => '36'),
5 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '9'),
6 => array( 'var' => 'Indiscore', 'type' => 'MAX', 'value' => '12'),
),
),
5 => array(
'name' => 'VORd-10.3',
'value' => 'VERT',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'FEU', 'type' => 'EGAL', 'value' => 'VERT'),
1 => array( 'var' => 'IR', 'type' => 'MIN', 'value' => '4,9'),
2 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '7,1'),
3 => array( 'var' => 'ContratAge', 'type' => 'MAX', 'value' => '25'),
4 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '11'),
5 => array( 'var' => 'Indiscore', 'type' => 'MAX', 'value' => '14'),
),
),
6 => array(
'name' => 'VORd-10.4',
'value' => 'ROUGE',
'comment' => "Société dont la solvabilité est limitée et qui rencontre des difficultés de paiement : Faire une DEC pour tout acte éligible",
'po' => 0,
'params' => array(
0 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '2,1'),
1 => array( 'var' => 'ContratAge', 'type' => 'MIN', 'value' => '35'),
),
),
7 => array(
'name' => 'VORd-10.5',
'value' => 'VERT',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'IR', 'type' => 'MIN', 'value' => '2'),
1 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '5'),
2 => array( 'var' => 'ContratAge', 'type' => 'MIN', 'value' => '36'),
3 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '7'),
),
),
8 => array(
'name' => 'VORd-10.6',
'value' => 'ROUGE',
'comment' => "Société dont la solvabilité est limitée et qui rencontre des difficultés de paiement : Faire une DEC pour tout acte éligible",
'po' => 0,
'params' => array(
0 => array( 'var' => 'EntrepRecente', 'type' => 'EGAL', 'value' => '1'),
1 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '2,1'),
2 => array( 'var' => 'ContratAge', 'type' => 'MAX', 'value' => '36'),
),
),
9 => array(
'name' => 'VORd-10.7',
'value' => 'ROUGE',
'comment' => "Société dont la solvabilité est limitée et qui rencontre des difficultés de paiement : Faire une DEC pour tout acte éligible",
'po' => 0,
'params' => array(
0 => array( 'var' => 'EntrepRecente', 'type' => 'EGAL', 'value' => '1'),
1 => array( 'var' => 'ContratAge', 'type' => 'MAX', 'value' => '25'),
2 => array( 'var' => 'IR', 'type' => 'MIN', 'value' => '4,9'),
3 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '7,1'),
4 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '9'),
5 => array( 'var' => 'Indiscore', 'type' => 'MAX', 'value' => '12'),
),
),
10 => array(
'name' => 'VORd-10.8',
'value' => 'VERT',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'EntrepRecente', 'type' => 'EGAL', 'value' => '1'),
1 => array( 'var' => 'IR', 'type' => 'MIN', 'value' => '4,9'),
2 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '7,1'),
3 => array( 'var' => 'ContratAge', 'type' => 'MIN', 'value' => '36'),
4 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '11'),
),
),
11 => array(
'name' => 'VORd-10.8-2',
'value' => 'VERT',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'EntrepRecente', 'type' => 'EGAL', 'value' => '1'),
1 => array( 'var' => 'IR', 'type' => 'MIN', 'value' => '4,9'),
2 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '7,1'),
3 => array( 'var' => 'ContratAge', 'type' => 'MIN', 'value' => '24'),
4 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '13'),
),
),
12 => array(
'name' => 'VORd-10.9',
'value' => 'VERT',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'FEU', 'type' => 'EGAL', 'value' => 'ROUGE'),
1 => array( 'var' => 'IR', 'type' => 'MIN', 'value' => '2'),
2 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '5'),
3 => array( 'var' => 'ContratAge', 'type' => 'MIN', 'value' => '36'),
4 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '3'),
),
),
);

View File

@ -0,0 +1,164 @@
<?php
return array(
0 => array(
'name' => 'VORp-1.0',
'value' => 'CONTINUE',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'IsCAC', 'type' => 'EGAL', 'value' => '1', 'define' => array( 'var' => 'TypeEntrep', 'value' => 'CAC')),
1 => array( 'var' => 'Effectif', 'type' => 'MIN', 'value' => '499', 'define' => array( 'var' => 'TypeEntrep', 'value' => 'GE')),
2 => array( 'var' => 'Effectif', 'type' => 'MIN', 'value' => '3', 'define' => array( 'var' => 'TypeEntrep', 'value' => 'PME')),
3 => array( 'var' => 'Effectif', 'type' => 'MIN', 'value' => '-1', 'define' => array( 'var' => 'TypeEntrep', 'value' => 'TPE')),
4 => array( 'var' => 'Effectif', 'type' => 'EGAL', 'value' => 'UNDEFINE', 'define' => array( 'var' => 'TypeEntrep', 'value' => 'TPE')),
),
),
1 => array(
'name' => 'VORp-2.1',
'value' => 'VERT',
'comment' => "Pas de limite de crédit sur ce siren",
'po' => 0,
'params' => array(
0 => array( 'var' => 'NAF', 'type' => 'LIST', 'value' => 'TabAdminNaf', 'define' => array( 'var' => 'IsAdmin', 'value' => '1')),
),
),
2 => array(
'name' => 'VORp-2.2',
'value' => 'VERT',
'comment' => "Pas de limite de crédit sur ce siren",
'po' => 0,
'params' => array(
0 => array( 'var' => 'FJ', 'type' => 'LIST', 'value' => 'TabAdminFj', 'define' => array( 'var' => 'IsAdmin', 'value' => '1')),
),
),
3 => array(
'name' => 'VORp-3.1',
'value' => 'ROUGE',
'comment' => "Société de droit étranger : faire une DEC si volonté de poursuivre l'affaire",
'po' => 0,
'params' => array(
0 => array( 'var' => 'NAF', 'type' => 'LIST', 'value' => 'TabEtrangerNaf', 'define' => array( 'var' => 'IsEtranger', 'value' => '1')),
),
),
4 => array(
'name' => 'VORp-3.2',
'value' => 'ROUGE',
'comment' => "Société de droit étranger : faire une DEC si volonté de poursuivre l'affaire",
'po' => 0,
'params' => array(
0 => array( 'var' => 'FJ', 'type' => 'LIST', 'value' => 'TabEtrangerFj', 'define' => array( 'var' => 'IsEtranger', 'value' => '1')),
),
),
5 => array(
'name' => 'VORp-4.1',
'value' => 'ROUGE',
'comment' => "Cette société fait l'objet d'un Redressement Judiciaire : faire une DEC si volonté de poursuivre l'affaire",
'po' => 0,
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'MAX', 'value' => '6'),
1 => array( 'var' => 'RJ', 'type' => 'EGAL', 'value' => '1'),
),
),
6 => array(
'name' => 'VORp-4.2',
'value' => 'ROUGE',
'comment' => "Cette société fait l'objet d'une liquidation judiciaire : pas d'entrée en relation possible",
'po' => 0,
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'MAX', 'value' => '6'),
1 => array( 'var' => 'LJ', 'type' => 'EGAL', 'value' => '1'),
),
),
7 => array(
'name' => 'VORp-4.3',
'value' => 'ROUGE',
'comment' => "Cette société fait l'objet d'une Sauvegarde Judiciaire : faire une DEC si volonté de poursuivre l'affaire",
'po' => 0,
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'MAX', 'value' => '6'),
1 => array( 'var' => 'SV', 'type' => 'EGAL', 'value' => '1'),
),
),
8 => array(
'name' => 'VORp-4.4',
'value' => 'ROUGE',
'comment' => "Cette entreprise n'est pas active à l'INSEE : pas d'entrée en relation possible",
'po' => 0,
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'MAX', 'value' => '6'),
1 => array( 'var' => 'InseeActif', 'type' => 'EGAL', 'value' => '0'),
),
),
9 => array(
'name' => 'VORp-5.0',
'value' => 'VERT',
'comment' => "Faire une DEC si dépassement de la PO proposée",
'po' => 1,
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'MAX', 'value' => '16'),
1 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '9'),
2 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37', 'define' => array( 'var' => 'EntrepRecente', 'value' => '1')),
3 => array( 'var' => 'TypeEntrep', 'type' => 'MIN', 'value' => 'PME'),
),
),
10 => array(
'name' => 'VORp-7.0',
'value' => 'VERT',
'comment' => "Cette entreprise fait l'objet d'une sauvegarde : faire une DEC si dépassement de la PO",
'po' => 1,
'params' => array(
0 => array( 'var' => 'FEU', 'type' => 'EGAL', 'value' => 'ROUGE'),
1 => array( 'var' => 'SV', 'type' => 'EGAL', 'value' => '1'),
2 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '4'),
),
),
11 => array(
'name' => 'VORp-8.0',
'value' => 'VERT',
'comment' => "Pas de limite de crédit sur ce siren",
'po' => 0,
'params' => array(
0 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '9'),
),
),
12 => array(
'name' => 'VORp-9.0',
'value' => 'VERT',
'comment' => "Pas de limite de crédit sur ce siren",
'po' => 0,
'params' => array(
0 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'CAC'),
1 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '5'),
),
),
13 => array(
'name' => 'VORp-6.1',
'value' => 'ROUGE',
'comment' => "Solvabilité et pérennité compromise : faire une DEC si volonté de poursuivre l'affaire",
'po' => 0,
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'MAX', 'value' => '6'),
),
),
14 => array(
'name' => 'VORp-6.2',
'value' => 'VERT',
'comment' => "Faire une DEC si dépassement de la PO proposée",
'po' => 1,
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'MAX', 'value' => '10'),
1 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '5'),
),
),
15 => array(
'name' => 'VORp-6.3',
'value' => 'VERT',
'comment' => "Pas de limite de crédit sur ce siren",
'po' => 0,
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'MAX', 'value' => '21'),
1 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '9'),
),
),
);

View File

@ -47,7 +47,7 @@ class WDB
} else {
$query = 'INSERT INTO '.$table.' ('.$fields.') VALUES ('.$values.');';
}
if ($debug) $tdeb=microtime_float();
if ($debug) $tdeb = microtime_float();
try {
$stmt = $this->db->query($query);
@ -60,7 +60,7 @@ class WDB
} catch(Zend_Db_Exception $e) {
$this->errorCode = $e->getCode();
$this->errorMsg = $e->getMessage();
$this->trace($query, $res, $tdeb);
$this->trace($query);
return false;
}
@ -178,6 +178,7 @@ class WDB
try {
$stmt = $this->db->query($query);
$this->result = $stmt;
} catch(Zend_Db_Exception $e) {
$this->errorCode = $e->getCode();
$this->errorMsg = $e->getMessage();