Library Update

This commit is contained in:
Michael RICOIS 2016-11-25 11:07:44 +01:00
parent c6b6d63c77
commit aa0230fcf5
95 changed files with 44180 additions and 42199 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,43 +1,75 @@
<?php
class Metier_Bodacc_MBalo
{
public function getLibEven($strEven)
{
$even=9015;
$strEven=trim($strEven);
if (preg_match("/AUTRES OP.RATIONS . Décisions prises par des assemblées d'obligataires et homologation de résolutions/iu", $strEven)) $even=9001;
elseif (preg_match("/AUTRES OP.RATIONS . Désignation de teneurs? de comptes de titres nominatifs/iu", $strEven)) $even=9002;
elseif (preg_match("/AUTRES OP.RATIONS . Fusions et scissions/iu", $strEven)) $even=9003;
elseif (preg_match("/AUTRES OP.RATIONS . Liquidations/iu", $strEven)) $even=9004;
elseif (preg_match("/AUTRES OP.RATIONS . Offre de remboursement d'obligations/iu", $strEven)) $even=9005;
elseif (preg_match("/AUTRES OP.RATIONS . Réduction de capital/iu", $strEven)) $even=9006;
elseif (preg_match("/AUTRES OP.RATIONS . Regroupement d'actions/iu", $strEven)) $even=9007;
elseif (preg_match("/AUTRES OP.RATIONS/iu", $strEven)) $even=9000;
elseif (preg_match("/BULLETIN OFFICIEL de l'AMF/iu", $strEven)) $even=9010;
elseif (preg_match("/BULLETIN OFFICIEL du CMF/iu", $strEven)) $even=9011;
elseif (preg_match("/CONVOCATIONS . Assemblées? d'actionnaires et de porteurs de parts/iu", $strEven)) $even=9020;
elseif (preg_match("/CONVOCATIONS . Assemblées? d'obligataires ou de porteurs de titres d'emprunt/iu", $strEven)) $even=9021;
elseif (preg_match("/CONVOCATIONS . Assemblées? de porteurs de certificats d'investissement/iu", $strEven)) $even=9022;
elseif (preg_match("/CONVOCATIONS . Assemblées? de porteurs de parts de fondateur/iu", $strEven)) $even=9023;
elseif (preg_match("/CONVOCATIONS . Assemblées? de porteurs de titres participatifs/iu", $strEven)) $even=9024;
elseif (preg_match("/MISSIONS ET COTATIONS - Organismes internationaux - Bons, obligations et autres titres/iu", $strEven)) $even=9030;
elseif (preg_match("/MISSIONS ET COTATIONS . Valeurs étrangères . Actions et parts/iu", $strEven)) $even=9031;
elseif (preg_match("/MISSIONS ET COTATIONS . Valeurs étrangères . Bons d'options? sur titres et sur indices/iu", $strEven)) $even=9032;
elseif (preg_match("/MISSIONS ET COTATIONS . Valeurs étrangères . Bons, obligations et autres titres/iu", $strEven)) $even=9033;
elseif (preg_match("/MISSIONS ET COTATIONS . Valeurs européennes . Actions et parts/iu", $strEven)) $even=9034;
elseif (preg_match("/MISSIONS ET COTATIONS . Valeurs françaises . Actions et parts/iu", $strEven)) $even=9035;
elseif (preg_match("/MISSIONS ET COTATIONS . Valeurs françaises . Bons d'options? sur titres et sur indices/iu", $strEven)) $even=9036;
elseif (preg_match("/MISSIONS ET COTATIONS . Valeurs françaises . Bons, obligations et autres titres/iu", $strEven)) $even=9037;
elseif (preg_match("/MISSIONS ET COTATIONS . Valeurs françaises . Certificats d'investissement/iu", $strEven)) $even=9038;
elseif (preg_match("/PUBLICATIONS P.RIODIQUES . Entreprises d'assurances et organismes de retraites/iu", $strEven)) $even=9040;
elseif (preg_match("/PUBLICATIONS P.RIODIQUES . Sociétés commerciales et industrielles/iu", $strEven)) $even=9041;
elseif (preg_match("/PUBLICATIONS P.RIODIQUES . Sociétés commerciales et industrielles (Chiffres d'affaires)/iu", $strEven)) $even=9042;
elseif (preg_match("/PUBLICATIONS P.RIODIQUES . Sociétés commerciales et industrielles (comptes annuels)/iu", $strEven)) $even=9045;
elseif (preg_match("/PUBLICATIONS P.RIODIQUES . Sociétés commerciales et industrielles (Tableaux d'activités et résultats)/iu", $strEven)) $even=9044;
elseif (preg_match("/PUBLICATIONS P.RIODIQUES . Sociétés commerciales et industrielles (Chiffres d'affaires et situations trimestrielles)/iu", $strEven))$even=9043;
elseif (preg_match("/PUBLICATIONS P.RIODIQUES . Sociétés commerciales et industrielles (Comptes intermédiaires)/iu", $strEven)) $even=9046;
//else/*if (preg_match("/AVIS DIVERS/i", $strEven))*/ $even=9015;
return $even;
}
}
<?php
class Metier_Bodacc_MBalo
{
public function getLibEven($strEven)
{
$even=9015;
$strEven=trim($strEven);
if (preg_match("/AUTRES OP.RATIONS . Décisions prises par des assemblées d'obligataires et homologation de résolutions/iu", $strEven)) {
$even=9001;
} elseif (preg_match("/AUTRES OP.RATIONS . Désignation de teneurs? de comptes de titres nominatifs/iu", $strEven)) {
$even=9002;
} elseif (preg_match("/AUTRES OP.RATIONS . Fusions et scissions/iu", $strEven)) {
$even=9003;
} elseif (preg_match("/AUTRES OP.RATIONS . Liquidations/iu", $strEven)) {
$even=9004;
} elseif (preg_match("/AUTRES OP.RATIONS . Offre de remboursement d'obligations/iu", $strEven)) {
$even=9005;
} elseif (preg_match("/AUTRES OP.RATIONS . Réduction de capital/iu", $strEven)) {
$even=9006;
} elseif (preg_match("/AUTRES OP.RATIONS . Regroupement d'actions/iu", $strEven)) {
$even=9007;
} elseif (preg_match("/AUTRES OP.RATIONS/iu", $strEven)) {
$even=9000;
} elseif (preg_match("/BULLETIN OFFICIEL de l'AMF/iu", $strEven)) {
$even=9010;
} elseif (preg_match("/BULLETIN OFFICIEL du CMF/iu", $strEven)) {
$even=9011;
} elseif (preg_match("/CONVOCATIONS . Assemblées? d'actionnaires et de porteurs de parts/iu", $strEven)) {
$even=9020;
} elseif (preg_match("/CONVOCATIONS . Assemblées? d'obligataires ou de porteurs de titres d'emprunt/iu", $strEven)) {
$even=9021;
} elseif (preg_match("/CONVOCATIONS . Assemblées? de porteurs de certificats d'investissement/iu", $strEven)) {
$even=9022;
} elseif (preg_match("/CONVOCATIONS . Assemblées? de porteurs de parts de fondateur/iu", $strEven)) {
$even=9023;
} elseif (preg_match("/CONVOCATIONS . Assemblées? de porteurs de titres participatifs/iu", $strEven)) {
$even=9024;
} elseif (preg_match("/MISSIONS ET COTATIONS - Organismes internationaux - Bons, obligations et autres titres/iu", $strEven)) {
$even=9030;
} elseif (preg_match("/MISSIONS ET COTATIONS . Valeurs étrangères . Actions et parts/iu", $strEven)) {
$even=9031;
} elseif (preg_match("/MISSIONS ET COTATIONS . Valeurs étrangères . Bons d'options? sur titres et sur indices/iu", $strEven)) {
$even=9032;
} elseif (preg_match("/MISSIONS ET COTATIONS . Valeurs étrangères . Bons, obligations et autres titres/iu", $strEven)) {
$even=9033;
} elseif (preg_match("/MISSIONS ET COTATIONS . Valeurs européennes . Actions et parts/iu", $strEven)) {
$even=9034;
} elseif (preg_match("/MISSIONS ET COTATIONS . Valeurs françaises . Actions et parts/iu", $strEven)) {
$even=9035;
} elseif (preg_match("/MISSIONS ET COTATIONS . Valeurs françaises . Bons d'options? sur titres et sur indices/iu", $strEven)) {
$even=9036;
} elseif (preg_match("/MISSIONS ET COTATIONS . Valeurs françaises . Bons, obligations et autres titres/iu", $strEven)) {
$even=9037;
} elseif (preg_match("/MISSIONS ET COTATIONS . Valeurs françaises . Certificats d'investissement/iu", $strEven)) {
$even=9038;
} elseif (preg_match("/PUBLICATIONS P.RIODIQUES . Entreprises d'assurances et organismes de retraites/iu", $strEven)) {
$even=9040;
} elseif (preg_match("/PUBLICATIONS P.RIODIQUES . Sociétés commerciales et industrielles/iu", $strEven)) {
$even=9041;
} elseif (preg_match("/PUBLICATIONS P.RIODIQUES . Sociétés commerciales et industrielles (Chiffres d'affaires)/iu", $strEven)) {
$even=9042;
} elseif (preg_match("/PUBLICATIONS P.RIODIQUES . Sociétés commerciales et industrielles (comptes annuels)/iu", $strEven)) {
$even=9045;
} elseif (preg_match("/PUBLICATIONS P.RIODIQUES . Sociétés commerciales et industrielles (Tableaux d'activités et résultats)/iu", $strEven)) {
$even=9044;
} elseif (preg_match("/PUBLICATIONS P.RIODIQUES . Sociétés commerciales et industrielles (Chiffres d'affaires et situations trimestrielles)/iu", $strEven)) {
$even=9043;
} elseif (preg_match("/PUBLICATIONS P.RIODIQUES . Sociétés commerciales et industrielles (Comptes intermédiaires)/iu", $strEven)) {
$even=9046;
}
//else/*if (preg_match("/AVIS DIVERS/i", $strEven))*/ $even=9015;
return $even;
}
}

View File

@ -3,40 +3,41 @@ class Metier_Bodacc_MBoamp
{
public function getCodEvenSd($codEvenBoamp, $strEvenBoamp='')
{
$codEvenBoamp=str_replace('R','',$codEvenBoamp)*1;
$codEvenBoamp=str_replace('R', '', $codEvenBoamp)*1;
switch ($codEvenBoamp) {
case 10: $libEvenSd='Annulation'; break;
case 11: $libEvenSd='Annulation - Rectificatif'; break;
case 20: $libEvenSd='Rectificatif'; break;
case 22: $libEvenSd='Procédures accélérées'; break;
case 30: $libEvenSd='Avis d\'appel public à la concurrence - Délai d\'urgence'; break;
case 33: $libEvenSd='Avis de mise en concurrence'; break;
case 44: $libEvenSd='Concessions'; break;
case 50: $libEvenSd='Avis d\'appel public à la concurrence'; break;
case 51: $libEvenSd='Avis informatifs'; break;
case 55: $libEvenSd='Avis d\'appel public à la concurrence'; break;
case 6 : $libEvenSd='Avis d\'attribution'; break;
case 8 : $libEvenSd='Avis d\'attribution'; break;
case 81: $libEvenSd='Avis d\'attribution - Annulation'; break;
case 82: $libEvenSd='Avis d\'attribution - Rectificatif'; break;
case 83: $libEvenSd='Avis d\'attribution - Rectificatif'; break;
case 84: $libEvenSd='Avis d\'attribution comportant des lots infructueux'; break;
case 9 : $libEvenSd='Résultat de marché'; break;
case 91: $libEvenSd='Résultat de marché - Annulation'; break;
case 92: $libEvenSd='Résultat de marché - Rectificatif'; break;
case 93: $libEvenSd='Résultat de marché Infructueux/Sans suite'; break;
case 94: $libEvenSd='Résultat de marché comportant des lots infructueux'; break;
case 96: $libEvenSd='Annulation/Rectificatif/Sans suite/Infructueux'; break;
default: $libEvenSd=$strEvenBoamp; break;
case 10: $libEvenSd='Annulation'; break;
case 11: $libEvenSd='Annulation - Rectificatif'; break;
case 20: $libEvenSd='Rectificatif'; break;
case 22: $libEvenSd='Procédures accélérées'; break;
case 30: $libEvenSd='Avis d\'appel public à la concurrence - Délai d\'urgence'; break;
case 33: $libEvenSd='Avis de mise en concurrence'; break;
case 44: $libEvenSd='Concessions'; break;
case 50: $libEvenSd='Avis d\'appel public à la concurrence'; break;
case 51: $libEvenSd='Avis informatifs'; break;
case 55: $libEvenSd='Avis d\'appel public à la concurrence'; break;
case 6: $libEvenSd='Avis d\'attribution'; break;
case 8: $libEvenSd='Avis d\'attribution'; break;
case 81: $libEvenSd='Avis d\'attribution - Annulation'; break;
case 82: $libEvenSd='Avis d\'attribution - Rectificatif'; break;
case 83: $libEvenSd='Avis d\'attribution - Rectificatif'; break;
case 84: $libEvenSd='Avis d\'attribution comportant des lots infructueux'; break;
case 9: $libEvenSd='Résultat de marché'; break;
case 91: $libEvenSd='Résultat de marché - Annulation'; break;
case 92: $libEvenSd='Résultat de marché - Rectificatif'; break;
case 93: $libEvenSd='Résultat de marché Infructueux/Sans suite'; break;
case 94: $libEvenSd='Résultat de marché comportant des lots infructueux'; break;
case 96: $libEvenSd='Annulation/Rectificatif/Sans suite/Infructueux'; break;
default: $libEvenSd=$strEvenBoamp; break;
}
if ($strEvenBoamp<>'') {
return $libEvenSd;
}
if ($strEvenBoamp<>'') return $libEvenSd;
return substr('95'.$codEvenBoamp.'00',0,4)*1;
return substr('95'.$codEvenBoamp.'00', 0, 4)*1;
}
public function getLibEvenBoamp($codEvenBoamp, $strEvenBoamp='')
{
return $this->getCodEvenSd($codEvenBoamp, $strEvenBoamp);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -82,7 +82,9 @@ class Metier_Defaillance_Detect
*/
public function __construct()
{
if ($this->debug) file_put_contents('procol.log', "=== Situation Juridique ===\n");
if ($this->debug) {
file_put_contents('procol.log', "=== Situation Juridique ===\n");
}
// Définir la date du jour
$this->DateToday = date('Ymd');
@ -163,7 +165,7 @@ class Metier_Defaillance_Detect
*/
public function planPeriod($txt)
{
if ( preg_match('/dur.e(?:.*)plan(?:.*)(\d+)\s+ans?/Uisu', $txt, $matches) ) {
if (preg_match('/dur.e(?:.*)plan(?:.*)(\d+)\s+ans?/Uisu', $txt, $matches)) {
$this->PlanPeriod = $matches[1] * 12; // 10 ans = 120 mois
}
}
@ -261,7 +263,7 @@ class Metier_Defaillance_Detect
'DateStart' => $this->SituationDateStart,
'DateEnd' => $this->SituationDateEnd,
);
file_put_contents('procol.log', print_r($this->Timeline,1)."\n", FILE_APPEND);
file_put_contents('procol.log', print_r($this->Timeline, 1)."\n", FILE_APPEND);
}
if ($this->debug) {
@ -282,8 +284,7 @@ class Metier_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);
}
@ -305,23 +306,23 @@ class Metier_Defaillance_Detect
*/
protected function paramValue($val)
{
if ( is_numeric($val) ) {
if (is_numeric($val)) {
return (float) $val;
}
if ( is_array($val) ) {
if (is_array($val)) {
return $val;
}
if ( is_string($val) && property_exists($this, $val)) {
if (is_string($val) && property_exists($this, $val)) {
return $this->{$val};
}
if ( is_string($val) && defined('self::'.$val) ) {
if (is_string($val) && defined('self::'.$val)) {
return constant('self::'.$val);
}
if ( is_string($val) ) {
if (is_string($val)) {
return $val;
}
@ -352,7 +353,7 @@ class Metier_Defaillance_Detect
if ($this->debug) {
file_put_contents('procol.log', "\t".$this->{$var}." > ".$valueReal."\n", FILE_APPEND);
}
if ( $this->{$var} !== null && $this->{$var} > $valueReal ) {
if ($this->{$var} !== null && $this->{$var} > $valueReal) {
return true;
}
return false;
@ -363,7 +364,7 @@ class Metier_Defaillance_Detect
if ($this->debug) {
file_put_contents('procol.log', "\t".$this->{$var}." < ".$valueReal."\n", FILE_APPEND);
}
if ( $this->{$var} !== null && $this->{$var} < $valueReal ) {
if ($this->{$var} !== null && $this->{$var} < $valueReal) {
return true;
}
return false;
@ -371,15 +372,14 @@ class Metier_Defaillance_Detect
case 'EGAL':
$valueReal = $this->paramValue($value);
if ( is_array($valueReal) ) {
if (is_array($valueReal)) {
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 ) {
} elseif ($this->{$var} == $valueReal) {
if ($this->debug) {
file_put_contents('procol.log', "\t".$this->{$var}." = ".$valueReal."\n", FILE_APPEND);
}
@ -391,9 +391,9 @@ class Metier_Defaillance_Detect
case 'LIST':
$valueReal = $this->paramValue($value);
if ($this->debug) {
file_put_contents('procol.log', "\t".$this->{$var}." = ".print_r($valueReal,1)."\n", FILE_APPEND);
file_put_contents('procol.log', "\t".$this->{$var}." = ".print_r($valueReal, 1)."\n", FILE_APPEND);
}
if ( $valueReal !== null && in_array($this->{$var}, $valueReal) ) {
if ($valueReal !== null && in_array($this->{$var}, $valueReal)) {
return true;
}
return false;
@ -402,5 +402,4 @@ class Metier_Defaillance_Detect
return null;
}
}
}

View File

@ -61,6 +61,7 @@ return array(
array( 'var' => 'PlanPeriod', 'op' => 'SET', 'value' => 180),
),
),
// --- Period par default pour FJ spécifique
array(
'name' => 'PLAN-DUREE-FJ2',
'value' => 'CONTINUE',
@ -77,7 +78,7 @@ return array(
array( 'var' => 'PlanPeriod', 'op' => 'SET', 'value' => '180'),
),
),
// --- Elimination du plan
// --- Elimination du plan : période atteinte
array(
'name' => 'PLAN-PERIOD-ATTEINTE',
'value' => 'CONTINUE',
@ -87,6 +88,7 @@ return array(
array( 'var' => 'Situation', 'op' => 'SET', 'value' => ''),
),
),
// --- Elimination du plan : appel de jugement
array(
'name' => 'PLAN-APPEL-JUGEMENT',
'value' => 'CONTINUE',
@ -96,6 +98,7 @@ return array(
array( 'var' => 'Situation', 'op' => 'SET', 'value' => 'PA'),
),
),
// --- Elimination du plan : cutoff
array(
'name' => 'PLAN-CUT-OFF',
'value' => 'CONTINUE',
@ -106,7 +109,6 @@ return array(
array( 'var' => 'Situation', 'op' => 'SET', 'value' => ''),
),
),
// --- Début de procol
array(
'name' => 'PROCOL-START',
@ -126,7 +128,7 @@ return array(
array( 'var' => 'Situation', 'op' => 'SET', 'value' => ''),
),
),
// --- Ne pas mentionner la procol si CJ=1xxx OU si actif et CJ!=9xxx et even de plus d'un mois
// --- Ne pas mentionner la procol si CJ=1xxx
array(
'name' => 'PROCOL-EFFACEMENT-2.1',
'value' => 'CONTINUE',
@ -138,6 +140,7 @@ return array(
array( 'var' => 'Situation', 'op' => 'SET', 'value' => ''),
),
),
// --- Ne pas mentionner la procol si actif et CJ!=9xxx et even de plus d'un mois
array(
'name' => 'PROCOL-EFFACEMENT-2.2',
'value' => 'CONTINUE',
@ -196,13 +199,13 @@ return array(
array( 'var' => 'Situation', 'op' => 'SET', 'value' => ''),
),
),
// --- En Procol mais présence d'une annonce LJ avec Bilan publié ultérieurement
// --- En Procol mais présence d'une annonce LJ avec Bilan publié ultérieurement, uniquement FJ!=1xxx
array(
'name' => 'PROCOL-CLOTURE',
'value' => 'CONTINUE',
'params' => array(
array( 'var' => 'Situation', 'op' => 'EGAL', 'value' => 'P'),
array( 'var' => 'FJ', 'op' => 'EGAL' ),
array( 'var' => 'FJ', 'op' => 'MIN', 'value' => 1999),
//Si l'evenement procol de départ, précédent est
array( 'var' => 'SituationLastEven', 'op' => 'EGAL', 'value' => array(
1300,1301,1302,1303,1304,1305,1306,1307,1308,1309,1311,1312,1313,1314,1417
@ -214,9 +217,7 @@ return array(
array( 'var' => 'Situation', 'op' => 'SET', 'value' => 'CL'),
),
),
// Règle des FJ=1xxx
// --- Cutoff manuel
// --- En procol mais cutoff manuel
array(
'name' => 'PROCOL-CUT-OFF',
'value' => 'CONTINUE',
@ -237,8 +238,7 @@ return array(
array( 'var' => 'Situation', 'op' => 'SET', 'value' => 'A'),
),
),
// --- Dissolution
// --- Dissolution ?? ICI uniquement lorsque Situation = ''
array(
'name' => 'DISSOLUTION',
'value' => 'CONTINUE',
@ -248,8 +248,7 @@ return array(
array( 'var' => 'Situation', 'op' => 'SET', 'value' => 'D'),
),
),
// --- Dissolution mais bilan après événements
// --- Dissolution mais bilan après événements ?? ICI uniquement lorsque Situation = ''
array(
'name' => 'DISSOLUTION-AVEC-BILAN',
'value' => 'CONTINUE',
@ -260,7 +259,6 @@ return array(
array( 'var' => 'Situation', 'op' => 'SET', 'value' => ''),
),
),
// --- Radiation RM
array(
'name' => 'RADIATION-RM',
@ -272,11 +270,6 @@ return array(
array( 'var' => 'Situation', 'op' => 'SET', 'value' => 'RR'),
),
),
// Situation = ''
// NumRM
// InseeActif = 0
// SituationJuridique = RR
// --- Radiation RCS
array(
'name' => 'RADIATION-RCS',
@ -288,11 +281,6 @@ return array(
array( 'var' => 'Situation', 'op' => 'SET', 'value' => 'RR'),
),
),
// Situation = ''
// NumGreffe
// InseeActif = 0
// SituationJuridique = RR
// --- Radiation Publié 1
array(
'name' => 'RADIATION-PUB1',
@ -304,11 +292,6 @@ return array(
array( 'var' => 'Situation', 'op' => 'SET', 'value' => 'RP'),
),
),
// Situation = ''
// EtabActifNb = 0
// Even = ListEvenRadiation
// SituationJuridique = RP
// Radiation Publié 2
array(
'name' => 'RADIATION-PUB2',
@ -321,9 +304,4 @@ return array(
array( 'var' => 'Situation', 'op' => 'SET', 'value' => 'RP'),
),
),
// Situation = ''
// NumGreffe && InseeActif = 0
// Even = ListEvenRadiation
// SituationJuridique = RP
);
);

View File

@ -2,4 +2,4 @@
return array(
2720, //Fusion/Absorption (entitée absorbée)
2721, //Fusion/Absorption (entitée absorbée non identifiée)
);
);

View File

@ -6,4 +6,4 @@ return array(
2210, //Déclaration de dissolution par l'associé unique.
2211, //Clôture de la liquidation
2212, //Liquidation amiable
);
);

View File

@ -168,7 +168,3 @@ return array(
1901, //Radiation de la liste des CAC
1999, //Autre procédure collective
);

View File

@ -1,46 +1,46 @@
<?php
return array(
1005 => 1, //Vente aux enchères suite à saisie
1010 => 1, //Déclaration de cessation de paiement
1050 => 1, //Homologation de la conciliation
1055 => 1, //Résolution de la conciliation
1110 => 1, //Ouverture Sauvegarde Financière Accélérée
1111 => 1, //Ouverture Sauvegarde Accélérée
1115 => 1, //Plan de Sauvegarde Financière Accélérée
1116 => 1, //Plan de Sauvegarde Accélérée
1118 => 1, //Clôture de sauvegarde accélérée
1119 => 1, //Clôture de sauvegarde financière accélérée
1120 => 1, //Exécution du plan de sauvegarde
1203 => 1, //Avis de dépôt de l'état de collocation
1207 => 1, //Règlements amiables
1416 => 1, //Jugement constatant la bonne exécution du plan
1435 => 1, //Suspension de l'exécution provisoire
1436 => 1, //Suspension provisoire des poursuites
1500 => 2, //Clôture de la procédure
1501 => 2, //Clôture de la procédure après cession totale
1502 => 1, //Clôture de la procédure pour extinction du passif
1503 => 2, //Clôture de la procédure pour insuffisance d'actif
1504 => 2, //Clôture sauvegarde pour absence de projet de plan
1505 => 1, //Appel de jugement
1506 => 1, //Infirmation Jugement
1507 => 4, //Extrait d'arrêt de la cour d'appel
1514 => 1, //Clôture de la procédure de sauvegarde
1515 => 1, //Arrêt divers
1517 => 1, //Rectification d'une erreur matérielle
1520 => 1, //Ordonnance
1522 => 1, //Clôture de la procédure par dissolution de l'union
1525 => 4, //Appel du ministère public
1541 => 1, //Rétractation de prononcé de liquidation judiciaire sur tierce opposition
1542 => 1, //Rétractation de jugement d'ouverture d'une procédure de sauvegarde sur tierce opposition
1543 => 1, //Rétractation de jugement d'ouverture d'une procédure de redressement judiciaire sur tierce opposition
1544 => 1, //Rétractation de jugement d'ouverture d'une procédure de liquidation judiciaire sur tierce opposition
1545 => 1, //Rétractation de jugement d'ouverture sur tierce opposition
1550 => 1, //Jugement d'homologation de l'accord
1645 => 1, //Clôture du Rétablissement Professionnel
1650 => 1, //Rétablissement Personnel
1700 => 1, //Décision soumise à publicité
1800 => 1, //Suppression des mentions relatives à une procédure collective du K-Bis (Art. R123-135)
1801 => 1, //Clôture de la procédure collective (mention faite au K-Bis, Art. R631-43)
1900 => 1, //Interdiction temporaire d'exercice de la profession de CAC
1901 => 1, //Radiation de la liste des CAC
1005 => 1, //Vente aux enchères suite à saisie
1010 => 1, //Déclaration de cessation de paiement
1050 => 1, //Homologation de la conciliation
1055 => 1, //Résolution de la conciliation
1110 => 1, //Ouverture Sauvegarde Financière Accélérée
1111 => 1, //Ouverture Sauvegarde Accélérée
1115 => 1, //Plan de Sauvegarde Financière Accélérée
1116 => 1, //Plan de Sauvegarde Accélérée
1118 => 1, //Clôture de sauvegarde accélérée
1119 => 1, //Clôture de sauvegarde financière accélérée
1120 => 1, //Exécution du plan de sauvegarde
1203 => 1, //Avis de dépôt de l'état de collocation
1207 => 1, //Règlements amiables
1416 => 1, //Jugement constatant la bonne exécution du plan
1435 => 1, //Suspension de l'exécution provisoire
1436 => 1, //Suspension provisoire des poursuites
1500 => 2, //Clôture de la procédure
1501 => 2, //Clôture de la procédure après cession totale
1502 => 1, //Clôture de la procédure pour extinction du passif
1503 => 2, //Clôture de la procédure pour insuffisance d'actif
1504 => 2, //Clôture sauvegarde pour absence de projet de plan
1505 => 1, //Appel de jugement
1506 => 1, //Infirmation Jugement
1507 => 4, //Extrait d'arrêt de la cour d'appel
1514 => 1, //Clôture de la procédure de sauvegarde
1515 => 1, //Arrêt divers
1517 => 1, //Rectification d'une erreur matérielle
1520 => 1, //Ordonnance
1522 => 1, //Clôture de la procédure par dissolution de l'union
1525 => 4, //Appel du ministère public
1541 => 1, //Rétractation de prononcé de liquidation judiciaire sur tierce opposition
1542 => 1, //Rétractation de jugement d'ouverture d'une procédure de sauvegarde sur tierce opposition
1543 => 1, //Rétractation de jugement d'ouverture d'une procédure de redressement judiciaire sur tierce opposition
1544 => 1, //Rétractation de jugement d'ouverture d'une procédure de liquidation judiciaire sur tierce opposition
1545 => 1, //Rétractation de jugement d'ouverture sur tierce opposition
1550 => 1, //Jugement d'homologation de l'accord
1645 => 1, //Clôture du Rétablissement Professionnel
1650 => 1, //Rétablissement Personnel
1700 => 1, //Décision soumise à publicité
1800 => 1, //Suppression des mentions relatives à une procédure collective du K-Bis (Art. R123-135)
1801 => 1, //Clôture de la procédure collective (mention faite au K-Bis, Art. R631-43)
1900 => 1, //Interdiction temporaire d'exercice de la profession de CAC
1901 => 1, //Radiation de la liste des CAC
);

View File

@ -1,51 +1,51 @@
<?php
class Metier_Graydon_Service extends Zend_Soap_Client
{
protected $PartnerClientId = '32790';
protected $PartnerUserId = 'SESS38R7';
protected $ParterPassword = 'E88MSU4p';
protected $PartnerClientId = '32790';
protected $PartnerUserId = 'SESS38R7';
protected $ParterPassword = 'E88MSU4p';
public function __construct()
{
//Set the WSDL
$this->_wsdl = __DIR__ . DIRECTORY_SEPARATOR . 'GraydonCompanyData.wsdl';
public function __construct()
{
//Set the WSDL
$this->_wsdl = __DIR__ . DIRECTORY_SEPARATOR . 'GraydonCompanyData.wsdl';
//Set options
$options = array(
'features' => SOAP_USE_XSI_ARRAY_TYPE + SOAP_SINGLE_ELEMENT_ARRAYS,
'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | SOAP_COMPRESSION_DEFLATE,
);
}
//Set options
$options = array(
'features' => SOAP_USE_XSI_ARRAY_TYPE + SOAP_SINGLE_ELEMENT_ARRAYS,
'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | SOAP_COMPRESSION_DEFLATE,
);
}
/**
*
* @return stdClass
*/
protected function _AuthenticationParameters()
{
$params = new stdClass();
$params->PartnerUserId = $this->PartnerUserId;
$params->PartnerPassword = $this->ParterPassword;
$params->PartnerClientId = '';
$params->SessionID = '';
return $params;
}
/**
*
* @return stdClass
*/
protected function _AuthenticationParameters()
{
$params = new stdClass();
$params->PartnerUserId = $this->PartnerUserId;
$params->PartnerPassword = $this->ParterPassword;
$params->PartnerClientId = '';
$params->SessionID = '';
return $params;
}
/**
*
* @param string $country
*/
public function getCountryAvailability( $country = null )
{
$client = $this->getSoapClient();
/**
*
* @param string $country
*/
public function getCountryAvailability($country = null)
{
$client = $this->getSoapClient();
$params = new stdClass();
$params->Authentication_Parameters = $this->_AuthenticationParameters();
$params = new stdClass();
$params->Authentication_Parameters = $this->_AuthenticationParameters();
if ( $country !== null ) {
$params->Country = $country;
}
if ($country !== null) {
$params->Country = $country;
}
return $client->getCountryAvailability($params);
}
}
return $client->getCountryAvailability($params);
}
}

View File

@ -1,66 +1,61 @@
<?php
/*
* Created on 12 Feb 2009
* This PHP script demonstrates how to consume a Graydon Web Service <companyproducts>.
* The output will consist of a list of the transaction identifier, the user id, the company name
* and a list of the product codes for that company.
* Command line arguments
* 1) Username
* 2) Password
* 3) Order State ( <Delivered>, <ReCompleted>, <Completed>, <Notified>, <Assigned>, <Initialised> )
* 4) Order Reference
* 5) Client Reference
* 6) Date ( YYYY-MM-DD xsd format )
*/
// Create a soap client
$client = new SoapClient("GraydonCompanyData.wsdl",array('features' => SOAP_SINGLE_ELEMENT_ARRAYS));
// Create the authentication parameters object
$authentication = new StdClass();
// Initialise the authentication parameters
$authentication->PartnerUserId = $argv[1];
$authentication->PartnerPassword = $argv[2];
$authentication->PartnerClientId = '';
$authentication->SessionID = '';
// Create a new request parameters object
$request = new StdClass();
// Initialise the parameters object
$request->Authentication_Parameters = $authentication;
$request->OrderState = $argv[3];
$request->OrderReference = $argv[4];
$request->ClientReference = $argv[5];
$request->DateFrom = $argv[6];
try
{
// Make request to the web service
$result = $client->checkOrders($request);
// Print out the result
print "\nThe Returned data: ";
print "\n * Service Log: ";
print "\n * Transaction Identifier - ";
print $result->Service_Log->TransactionIdentifier;
print "\n * Partner User Id - ";
print $result->Service_Log->PartnerUserId;
print "\n * Orders: ";
// Get the orders returned from the request
$orders = $result->CheckOrders->OrderStatus;
$count = count($orders);
// For each order
for($i = 0; $i < $count; $i ++)
{
// Print out the order details
print "\n *Order: ";
print print $orders[$i]->Order->Name;
print "\n * Order Reference - ";
print $orders[$i]->OrderReference;
print "\n * Order State - ";
print $orders[$i]->OrderState;
}
<?php
/*
* Created on 12 Feb 2009
* This PHP script demonstrates how to consume a Graydon Web Service <companyproducts>.
* The output will consist of a list of the transaction identifier, the user id, the company name
* and a list of the product codes for that company.
* Command line arguments
* 1) Username
* 2) Password
* 3) Order State ( <Delivered>, <ReCompleted>, <Completed>, <Notified>, <Assigned>, <Initialised> )
* 4) Order Reference
* 5) Client Reference
* 6) Date ( YYYY-MM-DD xsd format )
*/
// Create a soap client
$client = new SoapClient("GraydonCompanyData.wsdl", array('features' => SOAP_SINGLE_ELEMENT_ARRAYS));
// Create the authentication parameters object
$authentication = new StdClass();
// Initialise the authentication parameters
$authentication->PartnerUserId = $argv[1];
$authentication->PartnerPassword = $argv[2];
$authentication->PartnerClientId = '';
$authentication->SessionID = '';
// Create a new request parameters object
$request = new StdClass();
// Initialise the parameters object
$request->Authentication_Parameters = $authentication;
$request->OrderState = $argv[3];
$request->OrderReference = $argv[4];
$request->ClientReference = $argv[5];
$request->DateFrom = $argv[6];
try {
// Make request to the web service
$result = $client->checkOrders($request);
// Print out the result
print "\nThe Returned data: ";
print "\n * Service Log: ";
print "\n * Transaction Identifier - ";
print $result->Service_Log->TransactionIdentifier;
print "\n * Partner User Id - ";
print $result->Service_Log->PartnerUserId;
print "\n * Orders: ";
// Get the orders returned from the request
$orders = $result->CheckOrders->OrderStatus;
$count = count($orders);
// For each order
for ($i = 0; $i < $count; $i ++) {
// Print out the order details
print "\n *Order: ";
print print $orders[$i]->Order->Name;
print "\n * Order Reference - ";
print $orders[$i]->OrderReference;
print "\n * Order State - ";
print $orders[$i]->OrderState;
}
} catch (SoapFault $exception) {
// Print the exception
print "\n Exception ";
var_dump($exception->detail);
}
catch( SoapFault $exception )
{
// Print the exception
print "\n Exception ";
var_dump($exception->detail);
}
?>

View File

@ -1,60 +1,55 @@
<?php
/*
* Created on 11 Feb 2009
* This PHP script demonstrates how to consume a Graydon Web Service <companyproducts>.
* The output will consist of a list of the transaction identifier, the user id, the company name
* and a list of the product codes for that company.
* Command line arguments
* 1) Username
* 2) Password
* 3) Company Match Identifier
*/
// Create a soap client
$client = new SoapClient("GraydonCompanyData.wsdl");
// Create the authentication parameters object
$authentication = new StdClass();
// Initialise the authentication parameters
$authentication->PartnerUserId = $argv[1];
$authentication->PartnerPassword = $argv[2];
$authentication->PartnerClientId = '';
$authentication->SessionID = '';
// Create the company identifier object
$identifier = $argv[3];
// Create the getCompanyProducts parameters object
$parameters = new StdClass();
// Initialise the parameters
$parameters->Authentication_Parameters = $authentication;
$parameters->CompanyMatchIdentifier = $identifier;
try
{
// Make a request on the webservice
$result = $client->getCompanyProducts($parameters);
// Output the xml
print "\nThe Returned data: ";
print "\n * Service Log: ";
print "\n * Transaction Identifier - ";
print $result->Service_Log->TransactionIdentifier;
print "\n * Partner User Id - ";
print $result->Service_Log->PartnerUserId;
print "\n * Company: ";
print $result->Company->Name;
print "\n * Products: ";
$array = $result->Products->Product;
$count = count($array);
// For each Product
for($i = 0; $i < $count; $i ++)
{
// Output the product name
print "\n * Product Code - ";
print $array[$i]->Code;
}
}
catch( SoapFault $exception )
{
// Print the exception
print "\n Exception ";
var_dump($exception->detail);
}
?>
<?php
/*
* Created on 11 Feb 2009
* This PHP script demonstrates how to consume a Graydon Web Service <companyproducts>.
* The output will consist of a list of the transaction identifier, the user id, the company name
* and a list of the product codes for that company.
* Command line arguments
* 1) Username
* 2) Password
* 3) Company Match Identifier
*/
// Create a soap client
$client = new SoapClient("GraydonCompanyData.wsdl");
// Create the authentication parameters object
$authentication = new StdClass();
// Initialise the authentication parameters
$authentication->PartnerUserId = $argv[1];
$authentication->PartnerPassword = $argv[2];
$authentication->PartnerClientId = '';
$authentication->SessionID = '';
// Create the company identifier object
$identifier = $argv[3];
// Create the getCompanyProducts parameters object
$parameters = new StdClass();
// Initialise the parameters
$parameters->Authentication_Parameters = $authentication;
$parameters->CompanyMatchIdentifier = $identifier;
try {
// Make a request on the webservice
$result = $client->getCompanyProducts($parameters);
// Output the xml
print "\nThe Returned data: ";
print "\n * Service Log: ";
print "\n * Transaction Identifier - ";
print $result->Service_Log->TransactionIdentifier;
print "\n * Partner User Id - ";
print $result->Service_Log->PartnerUserId;
print "\n * Company: ";
print $result->Company->Name;
print "\n * Products: ";
$array = $result->Products->Product;
$count = count($array);
// For each Product
for ($i = 0; $i < $count; $i ++) {
// Output the product name
print "\n * Product Code - ";
print $array[$i]->Code;
}
} catch (SoapFault $exception) {
// Print the exception
print "\n Exception ";
var_dump($exception->detail);
}

View File

@ -1,69 +1,64 @@
<?php
/*
* Created on 12 Feb 2009
* This PHP script demonstrates how to consume a Graydon Web Service <companyproducts>.
* The output will consist of the transaction identifier, the user id and for each company matching
* to the keyword its name and its CompanyMatchIdentifier.
* Command line arguments
* 1) Username
* 2) Password
* 3) Country
* 4) Keyword
* 5) City
* 6) PostCode
*/
// Create a soap client
$client = new SoapClient("GraydonCompanyData.wsdl");
// Create the authentication parameters object
$authentication = new StdClass();
// Initialise the authentication parameters
$authentication->PartnerUserId = $argv[1];
$authentication->PartnerPassword = $argv[2];
$authentication->PartnerClientId = '';
$authentication->SessionID = '';
// Create a new country parameters object
$company = new StdClass();
// Initialise the country object
$company->Country = $argv[3];
$company->ClientReference = '';
// Create the request parameters
$request = new StdClass();
// Initialise the request object
$request->Authentication_Parameters = $authentication;
$request->CompanyMatches_Parameters = $company;
$request->Keyword = $argv[4];
$request->City = $argv[5];
$request->PostCode = $argv[6];
try
{
// Make a request on the web service
$result = $client->getCompanyMatchesByKeyword($request);
// Print out the result
print "\nThe Returned data: ";
print "\n * Service Log: ";
print "\n * Transaction Identifier - ";
print $result->Service_Log->TransactionIdentifier;
print "\n * Partner User Id - ";
print $result->Service_Log->PartnerUserId;
print "\n * Companies: ";
// Get the list of companies
$companies = $result->CompanyMatches->Company;
$count = count($companies);
for($i = 0; $i < $count; $i ++)
{
print "\n * Company - ";
print $companies[$i]->Name;
print "\n * Company Match Identifier - ";
print $companies[$i]->CompanyMatchIdentifier;
}
}
catch( SoapFault $exception )
{
// Print the exception
print "\n Exception ";
var_dump($exception->detail);
}
?>
<?php
/*
* Created on 12 Feb 2009
* This PHP script demonstrates how to consume a Graydon Web Service <companyproducts>.
* The output will consist of the transaction identifier, the user id and for each company matching
* to the keyword its name and its CompanyMatchIdentifier.
* Command line arguments
* 1) Username
* 2) Password
* 3) Country
* 4) Keyword
* 5) City
* 6) PostCode
*/
// Create a soap client
$client = new SoapClient("GraydonCompanyData.wsdl");
// Create the authentication parameters object
$authentication = new StdClass();
// Initialise the authentication parameters
$authentication->PartnerUserId = $argv[1];
$authentication->PartnerPassword = $argv[2];
$authentication->PartnerClientId = '';
$authentication->SessionID = '';
// Create a new country parameters object
$company = new StdClass();
// Initialise the country object
$company->Country = $argv[3];
$company->ClientReference = '';
// Create the request parameters
$request = new StdClass();
// Initialise the request object
$request->Authentication_Parameters = $authentication;
$request->CompanyMatches_Parameters = $company;
$request->Keyword = $argv[4];
$request->City = $argv[5];
$request->PostCode = $argv[6];
try {
// Make a request on the web service
$result = $client->getCompanyMatchesByKeyword($request);
// Print out the result
print "\nThe Returned data: ";
print "\n * Service Log: ";
print "\n * Transaction Identifier - ";
print $result->Service_Log->TransactionIdentifier;
print "\n * Partner User Id - ";
print $result->Service_Log->PartnerUserId;
print "\n * Companies: ";
// Get the list of companies
$companies = $result->CompanyMatches->Company;
$count = count($companies);
for ($i = 0; $i < $count; $i ++) {
print "\n * Company - ";
print $companies[$i]->Name;
print "\n * Company Match Identifier - ";
print $companies[$i]->CompanyMatchIdentifier;
}
} catch (SoapFault $exception) {
// Print the exception
print "\n Exception ";
var_dump($exception->detail);
}

View File

@ -6,30 +6,28 @@ require_once dirname(__FILE__) . '/Service.php';
*/
class Metier_Infogreffe_DocAC extends Metier_Infogreffe_Service
{
const INT = 1000;
/**
* PDO Connection with Doctrine
* @var \Doctrine\DBAL\Connection
*/
protected $conn;
/**
* PDO Connection with Doctrine
* @var \Doctrine\DBAL\Connection
*/
protected $conn;
/**
* Infogreffe : Document Bilan
* @param \Doctrine\DBAL\Connection $conn
*/
* Infogreffe : Document Bilan
* @param \Doctrine\DBAL\Connection $conn
*/
public function __construct($conn = null)
{
parent::__construct();
parent::__construct();
// Set Database
if ($conn === null) {
$this->conn = Zend_Registry::get('doctrine');
}
else {
$this->conn = $conn;
}
// Set Database
if ($conn === null) {
$this->conn = Zend_Registry::get('doctrine');
} else {
$this->conn = $conn;
}
// Set type
$this->type_document = 'AC';
@ -56,26 +54,26 @@ class Metier_Infogreffe_DocAC extends Metier_Infogreffe_Service
// Requete WebService
$actesXML = null;
if ( $onlyDb === false ) {
//Infogreffe webservice
try {
$xml = $this->callRequest();
$requestOk = true;
} catch( Exception $e ) {
$requestOk = false;
//file_put_contents('debug.log', $e->getMessage());
//@todo : get error message
//echo $e->getMessage();
}
if ( $requestOk === true ) {
// Set All line state to 0
try {
$this->conn->update('jo.greffes_actes',
array('actif' => 0), array('siren' => $this->siren));
}
catch(\Doctrine\DBAL\DBALException $e) {}
if ($onlyDb === false) {
//Infogreffe webservice
try {
$xml = $this->callRequest();
$requestOk = true;
} catch (Exception $e) {
$requestOk = false;
//file_put_contents('debug.log', $e->getMessage());
//@todo : get error message
//echo $e->getMessage();
}
if ($requestOk === true) {
// Set All line state to 0
try {
$this->conn->update('jo.greffes_actes',
array('actif' => 0), array('siren' => $this->siren));
} catch (\Doctrine\DBAL\DBALException $e) {
}
$actesXML = $this->formatList($xml);
}
}
}
// Lecture de la base de données
@ -104,15 +102,14 @@ class Metier_Infogreffe_DocAC extends Metier_Infogreffe_Service
->orderBy('date_depot', 'DESC')->orderBy('num_depot', 'DESC')
->orderBy('num_acte', 'ASC')->orderBy('date_acte', 'DESC');
$stmt = $qb->execute();
}
catch(\Doctrine\DBAL\DBALException $e) {
} catch (\Doctrine\DBAL\DBALException $e) {
throw new Exception(__METHOD__ . ': ' . $e->getMessage());
}
$actes = array();
if ($stmt->rowCount() > 0) {
$rows = $stmt->fetchAll(\PDO::FETCH_OBJ);
foreach ( $rows as $row ) {
foreach ($rows as $row) {
$item = new stdClass();
$item->File = $row->pdfLink;
$item->FileSize = $row->pdfSize;
@ -136,9 +133,9 @@ class Metier_Infogreffe_DocAC extends Metier_Infogreffe_Service
$item->infos[] = $decisions;
$mode_diffusion = explode(',', $row->mode_diffusion);
if (in_array('T',$mode_diffusion) || !empty($item->File)) {
if (in_array('T', $mode_diffusion) || !empty($item->File)) {
$item->ModeDiffusion = 'T';
} elseif (in_array('C',$mode_diffusion)) {
} elseif (in_array('C', $mode_diffusion)) {
$item->ModeDiffusion = 'C';
} else {
$item->ModeDiffusion = '';
@ -151,18 +148,18 @@ class Metier_Infogreffe_DocAC extends Metier_Infogreffe_Service
return $actes;
}
/**
* Commande Téléchargement
* @param string $depotDate
* @param int $depotNum
* @param string $acteType
* @param string $acteDate
* @param int $acteNum
* @param int $orderId
* @throws Exception
* @return string
* Return the full path of the file
*/
/**
* Commande Téléchargement
* @param string $depotDate
* @param int $depotNum
* @param string $acteType
* @param string $acteDate
* @param int $acteNum
* @param int $orderId
* @throws Exception
* @return string
* Return the full path of the file
*/
public function getCommandeT($depotDate, $depotNum, $acteType, $acteDate, $acteNum, $orderId = null)
{
// Lire dans la base de données
@ -187,7 +184,7 @@ class Metier_Infogreffe_DocAC extends Metier_Infogreffe_Service
->andWhere('type_acte=:acteType')->setParameter('acteType', $acteType);
$stmt = $qb->execute();
if ( $stmt->rowCount() == 0 ) {
if ($stmt->rowCount() == 0) {
throw new Exception('Not exist');
}
@ -196,9 +193,9 @@ class Metier_Infogreffe_DocAC extends Metier_Infogreffe_Service
$this->mode_diffusion = 'T';
$this->reference_client = 'T'.date('YmdHis');
$this->greffe = $row->numGreffe;
$this->dossier_millesime = substr($row->numRC,0,2);
$this->dossier_statut = substr($row->numRC,2,1);
$this->dossier_chrono = substr($row->numRC,3);
$this->dossier_millesime = substr($row->numRC, 0, 2);
$this->dossier_statut = substr($row->numRC, 2, 1);
$this->dossier_chrono = substr($row->numRC, 3);
$this->date_depot = $row->date_depot;
$this->num_depot = $row->num_depot;
$this->date_acte = $row->date_acte;
@ -206,32 +203,31 @@ class Metier_Infogreffe_DocAC extends Metier_Infogreffe_Service
//Needed element for filename
$date = $row->date_acte;
if ( $date == '0000-00-00' ) {
if ($date == '0000-00-00') {
$date = $row->date_depot;
}
$type = $row->type_acte;
$num = $row->num_acte;
$options = $row->numGreffe . '-' . substr($row->numRC,0,2) . '-' . substr($row->numRC,2,1) . '-' . substr($row->numRC,3) . '-' . $row->num_depot;
$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) ) {
if (! file_exists($this->config->storage->path . '/' . $dir)) {
mkdir($this->config->storage->path . '/' . $dir, 0777, true);
}
// Set filename
$filename = $dir . '/' . $this->getFileName($date, $num, $type, $options);
if ( $row->pdfLink != '' ) {
if ($row->pdfLink != '') {
// Set the filename
$filename = $dir . '/' . $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);
}
} elseif ( file_exists($this->config->storage->path . '/' . $filename) ) {
} elseif (file_exists($this->config->storage->path . '/' . $filename)) {
// Analyser le fichier - Nombre de page et taille
$infos = $this->pdfInfos($this->config->storage->path . '/' . $filename);
@ -242,12 +238,10 @@ class Metier_Infogreffe_DocAC extends Metier_Infogreffe_Service
} else {
$this->dbSetFile(basename($filename));
}
} else {
try {
$xml = $this->callRequest();
} catch(Exception $e) {
} catch (Exception $e) {
throw new Exception($e->getMessage(), $e->getCode());
}
@ -257,7 +251,7 @@ class Metier_Infogreffe_DocAC extends Metier_Infogreffe_Service
throw new Exception('File url not given');
}
if ( $orderId !== null ) {
if ($orderId !== null) {
$this->conn->update('sdv1.greffe_commandes_ac', array(
'cmdUrl' => $url,
'dateCommande' => date('YmdHis')),
@ -327,9 +321,9 @@ class Metier_Infogreffe_DocAC extends Metier_Infogreffe_Service
// Générer les paramètres de commande depuis la base de données
$this->greffe = $row->numGreffe;
$this->dossier_millesime = substr($row->numRC,0,2);
$this->dossier_statut = substr($row->numRC,2,1);
$this->dossier_chrono = substr($row->numRC,3);
$this->dossier_millesime = substr($row->numRC, 0, 2);
$this->dossier_statut = substr($row->numRC, 2, 1);
$this->dossier_chrono = substr($row->numRC, 3);
$this->num_depot = $row->num_depot;
$this->type_acte = $row->type_acte;
$this->date_acte = $row->date_acte;
@ -338,9 +332,9 @@ class Metier_Infogreffe_DocAC extends Metier_Infogreffe_Service
// Faire la requete
try {
$xml = $this->callRequest();
} catch(Exception $e) {
// La prise en charge du courrier est effective
if ( $e->getCode() != 17 ) {
} catch (Exception $e) {
// La prise en charge du courrier est effective
if ($e->getCode() != 17) {
throw new Exception($e->getMessage());
}
}
@ -362,7 +356,7 @@ class Metier_Infogreffe_DocAC extends Metier_Infogreffe_Service
*/
public function getFileName($date, $num, $type, $options)
{
$date = substr($date,0,4) . substr($date,5,2) . substr($date,8,2);
$date = substr($date, 0, 4) . substr($date, 5, 2) . substr($date, 8, 2);
return 'acte-' . $this->siren . '-' . $type . '-' . $date . '-' . $options . '-' . $num . '.pdf';
}
@ -374,7 +368,7 @@ class Metier_Infogreffe_DocAC extends Metier_Infogreffe_Service
*/
public function getFilePath($date)
{
return 'actes/' . substr($date,0,4) . '/' . substr($date,5,2);
return 'actes/' . substr($date, 0, 4) . '/' . substr($date, 5, 2);
}
/**
@ -390,8 +384,7 @@ class Metier_Infogreffe_DocAC extends Metier_Infogreffe_Service
$liste_depot_acte = $doc->getElementsByTagName('liste_depot_acte')->item(0);
$depot_actes = $liste_depot_acte->getElementsByTagName('depot_acte');
$actes = array();
foreach($depot_actes as $depot_acte)
{
foreach ($depot_actes as $depot_acte) {
$acte = array();
$acte['num_gest'] = array();
@ -407,8 +400,7 @@ class Metier_Infogreffe_DocAC extends Metier_Infogreffe_Service
$infoActes = $depot_acte->getElementsByTagName('acte');
$acte['depot'] = array();
foreach($infoActes as $infoActe)
{
foreach ($infoActes as $infoActe) {
$actenum = array();
$actenum['date_acte'] = $infoActe->getElementsByTagName('date_acte')->item(0)->nodeValue;
if ($infoActe->getElementsByTagName('date_acte')->item(0)->nodeValue == '') {
@ -419,8 +411,7 @@ class Metier_Infogreffe_DocAC extends Metier_Infogreffe_Service
$actenum['type_acte_libelle'] = $infoActe->getElementsByTagName('type_acte_libelle')->item(0)->nodeValue;
$actenum['nbpages_acte'] = $infoActe->getElementsByTagName('nbpages_acte')->item(0)->nodeValue;
$decision = $infoActe->getElementsByTagName('decision')->item(0);
if($decision)
{
if ($decision) {
$actenum['decision'] = array();
$actenum['decision']['nature'] = $decision->getElementsByTagName('nature')->item(0)->nodeValue;
$actenum['decision']['libelle'] = $decision->getElementsByTagName('libelle')->item(0)->nodeValue;
@ -428,8 +419,7 @@ class Metier_Infogreffe_DocAC extends Metier_Infogreffe_Service
$actenum['mode_diffusion'] = array();
$mode_diffusion = $infoActe->getElementsByTagName('mode_diffusion')->item(0)->getElementsByTagName('mode');
foreach($mode_diffusion as $mode)
{
foreach ($mode_diffusion as $mode) {
$actenum['mode_diffusion'][] = $mode->getAttribute('type');
}
$acte['depot'][] = $actenum;
@ -440,22 +430,22 @@ class Metier_Infogreffe_DocAC extends Metier_Infogreffe_Service
$this->dbUpdateItem($acte);
//Génération de l'index pour le tri
if(!empty($acte['date_depot'])){ $date = $acte['date_depot']; }
else { $date = ''; }
if (!empty($acte['date_depot'])) {
$date = $acte['date_depot'];
} else {
$date = '';
}
if(!empty($date))
{
$datef = substr($date,0,4).substr($date,5,2).substr($date,8,2);
if (!empty($date)) {
$datef = substr($date, 0, 4).substr($date, 5, 2).substr($date, 8, 2);
$key = $datef.'-'.$acte['num_depot'];
//Affectation liste générale avec un index permettant le tri
$actes[$key] = $acte;
}
//Prise en compte de l'acte -1
if($acte['num_depot']==-1)
{
if ($acte['num_depot']==-1) {
$actes[0] = $acte;
}
}
//Tri suivant la date d'acte ou de depot
@ -491,8 +481,7 @@ class Metier_Infogreffe_DocAC extends Metier_Infogreffe_Service
$infoActes = $depot_acte->getElementsByTagName('acte');
$info['actes'] = array();
foreach($infoActes as $infoActe)
{
foreach ($infoActes as $infoActe) {
$actenum = array();
$actenum['date_acte'] = $infoActe->getElementsByTagName('date_acte')->item(0)->nodeValue;
$actenum['num_acte'] = $infoActe->getElementsByTagName('num_acte')->item(0)->nodeValue;
@ -501,8 +490,7 @@ class Metier_Infogreffe_DocAC extends Metier_Infogreffe_Service
$actenum['nbpages_acte'] = $infoActe->getElementsByTagName('nbpages_acte')->item(0)->nodeValue;
$decision = $infoActe->getElementsByTagName('decision')->item(0);
if($decision)
{
if ($decision) {
$actenum['decision'] = array();
$actenum['decision']['nature'] = $decision->getElementsByTagName('nature')->item(0)->nodeValue;
$actenum['decision']['libelle'] = $decision->getElementsByTagName('libelle')->item(0)->nodeValue;
@ -535,7 +523,7 @@ class Metier_Infogreffe_DocAC extends Metier_Infogreffe_Service
'nbpages_acte' => $depot['nbpages_acte'],
'decision_nature' => empty($depot['decision']['nature']) ? '' : $depot['decision']['nature'] ,
'decision_libelle' => empty($depot['decision']['libelle']) ? '' : $depot['decision']['libelle'] ,
'mode_diffusion' => join(',',$depot['mode_diffusion']),
'mode_diffusion' => join(',', $depot['mode_diffusion']),
'actif' => 1,
);
@ -554,8 +542,7 @@ class Metier_Infogreffe_DocAC extends Metier_Infogreffe_Service
$data['dateInsert'] = date('YmdHis');
try {
$result = $this->conn->insert('jo.greffes_actes', $data);
}
catch (\Doctrine\DBAL\DBALException $e) {
} catch (\Doctrine\DBAL\DBALException $e) {
throw new Exception($e->getMessage());
}
}
@ -573,8 +560,7 @@ class Metier_Infogreffe_DocAC extends Metier_Infogreffe_Service
'id' => $rowDel->id));
}
$this->conn->commit();
}
catch (\Doctrine\DBAL\DBALException $e) {
} catch (\Doctrine\DBAL\DBALException $e) {
$this->conn->rollBack();
throw new Exception($e->getMessage());
}
@ -584,13 +570,11 @@ class Metier_Infogreffe_DocAC extends Metier_Infogreffe_Service
try {
$result = $this->conn->update('jo.greffes_actes', $data,
array('id' => $item->id));
}
catch (\Doctrine\DBAL\DBALException $e) {
} catch (\Doctrine\DBAL\DBALException $e) {
throw new Exception($e->getMessage());
}
}
}
catch (\Doctrine\DBAL\DBALException $e) {
} catch (\Doctrine\DBAL\DBALException $e) {
throw new Exception($e->getMessage());
}
}
@ -623,14 +607,14 @@ class Metier_Infogreffe_DocAC extends Metier_Infogreffe_Service
$identifier = array(
'siren' => $this->siren,
'num_depot' => $this->num_depot,
'date_depot' => $this->date_depot,
'date_depot' => $this->date_depot,
'date_acte' => $this->date_acte,
'num_acte' => $this->num,
);
try {
$result = $this->conn->update('jo.greffes_actes', $data, $identifier);
} catch(\Doctrine\DBAL\DBALException $e) {
} catch (\Doctrine\DBAL\DBALException $e) {
throw new Exception($e->getMessage());
}
@ -640,4 +624,4 @@ class Metier_Infogreffe_DocAC extends Metier_Infogreffe_Service
return false;
}
}
}

View File

@ -13,18 +13,18 @@ class Metier_Infogreffe_DocBI extends Metier_Infogreffe_Service
* consolides|sociaux
* @var string
*/
public $type_comptes;
public $type_comptes;
/**
* PDO Connection with Doctrine
* @var \Doctrine\DBAL\Connection
*/
protected $conn;
/**
* PDO Connection with Doctrine
* @var \Doctrine\DBAL\Connection
*/
protected $conn;
/**
* Infogreffe : Document Bilan
* @param \Doctrine\DBAL\Connection $conn
*/
/**
* Infogreffe : Document Bilan
* @param \Doctrine\DBAL\Connection $conn
*/
public function __construct($conn = null)
{
parent::__construct();
@ -32,8 +32,7 @@ class Metier_Infogreffe_DocBI extends Metier_Infogreffe_Service
// Set Database
if ($conn === null) {
$this->conn = Zend_Registry::get('doctrine');
}
else {
} else {
$this->conn = $conn;
}
@ -63,24 +62,24 @@ class Metier_Infogreffe_DocBI extends Metier_Infogreffe_Service
// Requete WebService
$bilansXML = null;
if ( $onlyDb === false ) {
if ($onlyDb === false) {
// Infogreffe webservice
try {
$xml = $this->callRequest();
$requestOk = true;
} catch( Exception $e ) {
$requestOk = false;
// @todo : get error message
}
if ( $requestOk === true ) {
// Set All line state to 0
try {
$this->conn->update('jo.greffes_bilans',
array('actif' => 0), array('siren' => $this->siren));
}
catch(\Doctrine\DBAL\DBALException $e) {}
try {
$xml = $this->callRequest();
$requestOk = true;
} catch (Exception $e) {
$requestOk = false;
// @todo : get error message
}
if ($requestOk === true) {
// Set All line state to 0
try {
$this->conn->update('jo.greffes_bilans',
array('actif' => 0), array('siren' => $this->siren));
} catch (\Doctrine\DBAL\DBALException $e) {
}
$bilansXML = $this->formatList($xml);
}
}
}
// Lecture de la base de données
@ -108,15 +107,14 @@ class Metier_Infogreffe_DocBI extends Metier_Infogreffe_Service
->orderBy('date_cloture', 'DESC')->orderBy('num_depot', 'DESC')
->orderBy('date_cloture', 'DESC');
$stmt = $qb->execute();
}
catch(\Doctrine\DBAL\DBALException $e) {
} catch (\Doctrine\DBAL\DBALException $e) {
throw new Exception(__METHOD__ . ': ' . $e->getMessage());
}
$bilans = array();
if ($stmt->rowCount() > 0) {
$rows = $stmt->fetchAll(\PDO::FETCH_OBJ);
foreach ( $rows as $row ) {
foreach ($rows as $row) {
$item = new stdClass();
$item->File = $row->pdfLink;
$item->FileSize = $row->pdfSize;
@ -124,7 +122,7 @@ class Metier_Infogreffe_DocBI extends Metier_Infogreffe_Service
$item->Millesime = $row->millesime;
$item->NumDepot = $row->num_depot;
$item->DateCloture = $row->date_cloture;
if ( empty($row->type_comptes) ) {
if (empty($row->type_comptes)) {
$item->Type = 'sociaux';
} else {
$item->Type = $row->type_comptes;
@ -133,7 +131,7 @@ class Metier_Infogreffe_DocBI extends Metier_Infogreffe_Service
if (in_array('T', $mode_diffusion) || !empty($item->File)) {
$item->ModeDiffusion = 'T';
} elseif (in_array('C',$mode_diffusion)) {
} elseif (in_array('C', $mode_diffusion)) {
$item->ModeDiffusion = 'C';
} else {
$item->ModeDiffusion = '';
@ -146,30 +144,30 @@ class Metier_Infogreffe_DocBI extends Metier_Infogreffe_Service
*/
$item->SaisieDate = $row->saisie_date;
$item->SaisieCode = $row->saisie_code;
switch ( $row->saisie_code ) {
case '00': $item->SaisieLabel = "Bilan saisi sans anomalie"; break;
case '01': $item->SaisieLabel = "Bilan saisi avec des incohérences comptables à la source du document (issues du remettant)"; break;
case '02': $item->SaisieLabel = "Bilan avec Actif, Passif ou Compte de Résultat nul"; break;
case '03': $item->SaisieLabel = "Bilan incomplet (des pages manquent)"; break;
case '04': $item->SaisieLabel = "Bilan complet non détaillé (seuls les totaux et sous totaux sont renseignés)"; break;
case '05': $item->SaisieLabel = "Bilan reçu en double exemplaire"; break;
case '06': $item->SaisieLabel = "Bilan intermédiaire - Situation provisoire"; break;
case '07': $item->SaisieLabel = "Bilan illisible"; break;
case 'A7': $item->SaisieLabel = "Bilan illisible, présentant un cadre gris très foncés (dans lesquels sont inscrits en général les totaux)"; break;
case 'B7': $item->SaisieLabel = "Bilan manuscrits"; break;
case 'C7': $item->SaisieLabel = "Bilan illisible, présentant des caractères trop gras"; break;
case 'D7': $item->SaisieLabel = "Bilan scanné en biais ou qui présentent des pages rognées"; break;
case 'E7': $item->SaisieLabel = "Bilan numérisés trop clairement (comme une imprimante dont la cartouche est presque vide)"; break;
case 'F7': $item->SaisieLabel = "Bilan illisible"; break;
case '08': $item->SaisieLabel = "Bilan consolidé"; break;
case '09': $item->SaisieLabel = "Déclaration d'impôts"; break;
case '10': $item->SaisieLabel = "Document autre que bilan"; break;
case '11': $item->SaisieLabel = "Bilan de clôture de liquidation"; break;
case '12': $item->SaisieLabel = "Bilan de Société financière"; break;
case '13': $item->SaisieLabel = "Bilan de Société d'assurance"; break;
case '14': $item->SaisieLabel = "Bilan de Société immobilière"; break;
case '15': $item->SaisieLabel = "Bilan de Société étrangère"; break;
default: $item->SaisieLabel = ""; break;
switch ($row->saisie_code) {
case '00': $item->SaisieLabel = "Bilan saisi sans anomalie"; break;
case '01': $item->SaisieLabel = "Bilan saisi avec des incohérences comptables à la source du document (issues du remettant)"; break;
case '02': $item->SaisieLabel = "Bilan avec Actif, Passif ou Compte de Résultat nul"; break;
case '03': $item->SaisieLabel = "Bilan incomplet (des pages manquent)"; break;
case '04': $item->SaisieLabel = "Bilan complet non détaillé (seuls les totaux et sous totaux sont renseignés)"; break;
case '05': $item->SaisieLabel = "Bilan reçu en double exemplaire"; break;
case '06': $item->SaisieLabel = "Bilan intermédiaire - Situation provisoire"; break;
case '07': $item->SaisieLabel = "Bilan illisible"; break;
case 'A7': $item->SaisieLabel = "Bilan illisible, présentant un cadre gris très foncés (dans lesquels sont inscrits en général les totaux)"; break;
case 'B7': $item->SaisieLabel = "Bilan manuscrits"; break;
case 'C7': $item->SaisieLabel = "Bilan illisible, présentant des caractères trop gras"; break;
case 'D7': $item->SaisieLabel = "Bilan scanné en biais ou qui présentent des pages rognées"; break;
case 'E7': $item->SaisieLabel = "Bilan numérisés trop clairement (comme une imprimante dont la cartouche est presque vide)"; break;
case 'F7': $item->SaisieLabel = "Bilan illisible"; break;
case '08': $item->SaisieLabel = "Bilan consolidé"; break;
case '09': $item->SaisieLabel = "Déclaration d'impôts"; break;
case '10': $item->SaisieLabel = "Document autre que bilan"; break;
case '11': $item->SaisieLabel = "Bilan de clôture de liquidation"; break;
case '12': $item->SaisieLabel = "Bilan de Société financière"; break;
case '13': $item->SaisieLabel = "Bilan de Société d'assurance"; break;
case '14': $item->SaisieLabel = "Bilan de Société immobilière"; break;
case '15': $item->SaisieLabel = "Bilan de Société étrangère"; break;
default: $item->SaisieLabel = ""; break;
}
$bilans[] = $item;
}
@ -179,18 +177,18 @@ class Metier_Infogreffe_DocBI extends Metier_Infogreffe_Service
}
/**
* Download file
* @param string $dateCloture
* Format AAAA-MM-DD
* @param string $type
* sociaux ou consolides
* @params int $orderId
* Id de commande pour l'enregistrement dans la table de gestion
* @throws Exception
* @return string
* Return path (not complete) and filename
*/
/**
* Download file
* @param string $dateCloture
* Format AAAA-MM-DD
* @param string $type
* sociaux ou consolides
* @params int $orderId
* Id de commande pour l'enregistrement dans la table de gestion
* @throws Exception
* @return string
* Return path (not complete) and filename
*/
public function getCommandeT($dateCloture = null, $type = 'sociaux', $orderId = null)
{
// Lire dans la base de données
@ -208,7 +206,7 @@ class Metier_Infogreffe_DocBI extends Metier_Infogreffe_Service
$qb->select($columns)->from('jo.greffes_bilans')
->where('siren=:siren')->setParameter('siren', $this->siren)
->andWhere('date_cloture=:date')->setParameter('date', $dateCloture);
if ( $type == 'sociaux' || $type == '' ) {
if ($type == 'sociaux' || $type == '') {
$qb->andWhere("(type_comptes='sociaux' OR type_comptes='')");
} else {
$qb->andWhere('type_comptes=:type')->setParameter('type', $type);
@ -216,7 +214,7 @@ class Metier_Infogreffe_DocBI extends Metier_Infogreffe_Service
$qb->orderBy('dateInsert', 'DESC')->orderBy('num_depot', 'DESC');
$stmt = $qb->execute();
if ( $stmt->rowCount() == 0 ) {
if ($stmt->rowCount() == 0) {
throw new Exception("Element doesn't exist");
}
@ -225,15 +223,15 @@ class Metier_Infogreffe_DocBI extends Metier_Infogreffe_Service
$this->mode_diffusion = 'T';
$this->reference_client = 'T'.date('YmdHis');
$this->greffe = $row->numGreffe;
$this->dossier_millesime = substr($row->numRC,0,2);
$this->dossier_statut = substr($row->numRC,2,1);
$this->dossier_chrono = substr($row->numRC,3);
$this->dossier_millesime = substr($row->numRC, 0, 2);
$this->dossier_statut = substr($row->numRC, 2, 1);
$this->dossier_chrono = substr($row->numRC, 3);
$this->num_depot = $row->num_depot;
$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) ) {
if (! file_exists($this->config->storage->path . '/' . $dir)) {
mkdir($this->config->storage->path . '/' . $dir, 0777, true);
}
@ -243,11 +241,10 @@ class Metier_Infogreffe_DocBI extends Metier_Infogreffe_Service
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);
}
} elseif ( file_exists($this->config->storage->path . '/' . $filename) ) {
} elseif (file_exists($this->config->storage->path . '/' . $filename)) {
//Analyser le fichier - Nombre de page et taille
$infos = $this->pdfInfos($this->config->storage->path . '/' . $filename);
@ -258,22 +255,20 @@ class Metier_Infogreffe_DocBI extends Metier_Infogreffe_Service
} else {
$this->dbSetFile(basename($filename));
}
} else {
try {
$xml = $this->callRequest();
} catch(Exception $e) {
} catch (Exception $e) {
throw new Exception($e->getMessage(), $e->getCode());
}
$bilan = $this->formatItem($xml);
$url = $bilan['url_acces'];
if ( empty($url) ) {
if (empty($url)) {
throw new Exception('File url not given');
}
if ( $orderId !== null ) {
if ($orderId !== null) {
$this->conn->update('sdv1.greffe_commandes_bi', array(
'cmdUrl' => $url,
'dateCommande' => date('YmdHis')),
@ -331,7 +326,7 @@ class Metier_Infogreffe_DocBI extends Metier_Infogreffe_Service
}
$stmt = $qb->execute();
if ( $stmt->rowCount() == 0 ) {
if ($stmt->rowCount() == 0) {
throw new Exception('Not exist');
}
@ -341,18 +336,18 @@ class Metier_Infogreffe_DocBI extends Metier_Infogreffe_Service
//Générer les paramètres de commande depuis la base de données
$this->greffe = $row->numGreffe;
$this->dossier_millesime = substr($row->numRC,0,2);
$this->dossier_statut = substr($row->numRC,2,1);
$this->dossier_chrono = substr($row->numRC,3);
$this->dossier_millesime = substr($row->numRC, 0, 2);
$this->dossier_statut = substr($row->numRC, 2, 1);
$this->dossier_chrono = substr($row->numRC, 3);
$this->num_depot = $row->num_depot;
$this->date_cloture = $row->date_cloture;
//Faire la requete
try {
$xml = $this->callRequest();
} catch(Exception $e) {
} catch (Exception $e) {
//La prise en charge du courrier est effective
if ( $e->getCode() != 17 ) {
if ($e->getCode() != 17) {
throw new Exception($e->getMessage());
}
}
@ -372,7 +367,7 @@ class Metier_Infogreffe_DocBI extends Metier_Infogreffe_Service
if ($type == '') {
$type = 'sociaux';
}
$date = substr($dateCloture,0,4).substr($dateCloture,5,2).substr($dateCloture,8,2);
$date = substr($dateCloture, 0, 4).substr($dateCloture, 5, 2).substr($dateCloture, 8, 2);
return 'bilan-' . $this->siren . '-' . $type . '-' . $date . '.pdf';
}
@ -389,7 +384,7 @@ class Metier_Infogreffe_DocBI extends Metier_Infogreffe_Service
if ($type == '') {
$type = 'sociaux';
}
return 'bilans' . '/' . $type . '/' . substr($dateCloture,0,4);
return 'bilans' . '/' . $type . '/' . substr($dateCloture, 0, 4);
}
/**
@ -407,7 +402,7 @@ class Metier_Infogreffe_DocBI extends Metier_Infogreffe_Service
$bilans = array();
if (count($bilan_complet) > 0) {
foreach( $bilan_complet as $element ) {
foreach ($bilan_complet as $element) {
$bilan = array();
$num_gest = $element->getElementsByTagName('num_gest')->item(0);
$bilan['num_gest']['greffe'] = $num_gest->getElementsByTagName('greffe')->item(0)->nodeValue;
@ -424,7 +419,7 @@ class Metier_Infogreffe_DocBI extends Metier_Infogreffe_Service
$bilan['num_depot'] = $element->getElementsByTagName('num_depot')->item(0)->nodeValue;
$bilan['type_comptes'] = $element->getElementsByTagName('type_comptes')->item(0)->nodeValue;
$mode_diffusion = $element->getElementsByTagName('mode_diffusion')->item(0)->getElementsByTagName('mode');
foreach($mode_diffusion as $mode) {
foreach ($mode_diffusion as $mode) {
$bilan['mode_diffusion'][] = $mode->getAttribute('type');
}
@ -433,10 +428,10 @@ class Metier_Infogreffe_DocBI extends Metier_Infogreffe_Service
//Génération de l'index pour le tri
$date = $bilan['date_cloture_iso'];
if( !empty($date) ) {
$key = substr($date,0,4).substr($date,5,2).substr($date,8,2).'-'.$bilan['num_depot'];
//Affectation liste générale avec un index permettant le tri
$bilans[$key] = $bilan;
if (!empty($date)) {
$key = substr($date, 0, 4).substr($date, 5, 2).substr($date, 8, 2).'-'.$bilan['num_depot'];
//Affectation liste générale avec un index permettant le tri
$bilans[$key] = $bilan;
}
}
}
@ -490,7 +485,7 @@ class Metier_Infogreffe_DocBI extends Metier_Infogreffe_Service
'num_depot' => $list['num_depot'],
'date_cloture' => $list['date_cloture_iso'],
'type_comptes' => $list['type_comptes'],
'mode_diffusion' => join(',',$list['mode_diffusion']),
'mode_diffusion' => join(',', $list['mode_diffusion']),
'actif' => 1,
);
@ -507,8 +502,7 @@ class Metier_Infogreffe_DocBI extends Metier_Infogreffe_Service
$data['dateInsert'] = date('YmdHis');
try {
$result = $this->conn->insert('jo.greffes_bilans', $data);
}
catch (\Doctrine\DBAL\DBALException $e) {
} catch (\Doctrine\DBAL\DBALException $e) {
throw new Exception($e->getMessage());
}
}
@ -522,12 +516,11 @@ class Metier_Infogreffe_DocBI extends Metier_Infogreffe_Service
$this->conn->beginTransaction();
try {
while ($rowDel = $stmt->fetch(\PDO::FETCH_OBJ)) {
$this->conn->delete('jo.greffes_bilans', array(
$this->conn->delete('jo.greffes_bilans', array(
'id' => $rowDel->id));
}
$this->conn->commit();
}
catch (\Doctrine\DBAL\DBALException $e) {
} catch (\Doctrine\DBAL\DBALException $e) {
$this->conn->rollBack();
throw new Exception($e->getMessage());
}
@ -537,14 +530,11 @@ class Metier_Infogreffe_DocBI extends Metier_Infogreffe_Service
try {
$result = $this->conn->update('jo.greffes_bilans', $data,
array('id' => $item->id));
}
catch (\Doctrine\DBAL\DBALException $e) {
} catch (\Doctrine\DBAL\DBALException $e) {
throw new Exception($e->getMessage());
}
}
}
catch (\Doctrine\DBAL\DBALException $e) {
} catch (\Doctrine\DBAL\DBALException $e) {
throw new Exception($e->getMessage());
}
@ -570,7 +560,7 @@ class Metier_Infogreffe_DocBI extends Metier_Infogreffe_Service
'pdfSize' => $size,
'pdfPage' => $numberOfPage,
'pdfVer' => $version,
'pdfDate' => date('Ymd'),
'pdfDate' => date('Ymd'),
);
$identifier = array(
@ -581,7 +571,7 @@ class Metier_Infogreffe_DocBI extends Metier_Infogreffe_Service
try {
$result = $this->conn->update('jo.greffes_bilans', $data, $identifier);
} catch(\Doctrine\DBAL\DBALException $e) {
} catch (\Doctrine\DBAL\DBALException $e) {
throw new Exception($e->getMessage());
}
@ -591,4 +581,4 @@ class Metier_Infogreffe_DocBI extends Metier_Infogreffe_Service
return false;
}
}
}

View File

@ -8,52 +8,51 @@ class Metier_Infogreffe_DocST extends Metier_Infogreffe_Service
{
/**
* PDO Connection with Doctrine
* @var \Doctrine\DBAL\Connection
*/
protected $conn;
* PDO Connection with Doctrine
* @var \Doctrine\DBAL\Connection
*/
protected $conn;
/**
* Infogreffe : Document Bilan
* @param \Doctrine\DBAL\Connection $conn
*/
public function __construct($conn = null)
{
parent::__construct();
/**
* Infogreffe : Document Bilan
* @param \Doctrine\DBAL\Connection $conn
*/
public function __construct($conn = null)
{
parent::__construct();
// Set Database
if ($conn === null) {
$this->conn = Zend_Registry::get('doctrine');
}
else {
$this->conn = $conn;
}
// Set Database
if ($conn === null) {
$this->conn = Zend_Registry::get('doctrine');
} else {
$this->conn = $conn;
}
// Set type
$this->type_document = 'ST';
}
// Set type
$this->type_document = 'ST';
}
/**
* Défini le SIREN
* @param string $siren
* @return void
*/
public function setSiren($siren)
{
$this->siren = $siren;
}
/**
* Défini le SIREN
* @param string $siren
* @return void
*/
public function setSiren($siren)
{
$this->siren = $siren;
}
public function getList()
{}
{
}
public function getCommandeT()
{
$this->mode_diffusion = 'T';
$this->reference_client = 'T'.date('YmdHis');
$dir = $this->getFilePath($type, $dateCloture);
if ( ! file_exists( $this->config->storage->path . '/' . $dir ) ) {
if (! file_exists($this->config->storage->path . '/' . $dir)) {
mkdir($this->config->storage->path . '/' . $dir, 0777, true);
}
@ -62,17 +61,17 @@ class Metier_Infogreffe_DocST extends Metier_Infogreffe_Service
try {
$xml = $this->callRequest();
} catch(Exception $e) {
} catch (Exception $e) {
throw new Exception($e->getMessage(), $e->getCode());
}
$item = $this->formatItem($xml);
$url = $item['url_acces'];
if ( empty($url) ) {
if (empty($url)) {
throw new Exception('File url not given');
}
if ( $orderId !== null ) {
if ($orderId !== null) {
$this->conn->update('sdv1.greffe_commandes_st', array(
'cmdUrl' => $url,
'dateCommande' => date('YmdHis')),
@ -108,7 +107,7 @@ class Metier_Infogreffe_DocST extends Metier_Infogreffe_Service
if ($type=='') {
$type = 'sociaux';
}
$date = substr($dateCloture,0,4).substr($dateCloture,5,2).substr($dateCloture,8,2);
$date = substr($dateCloture, 0, 4).substr($dateCloture, 5, 2).substr($dateCloture, 8, 2);
return 'ST-' . $this->siren . '-' . $type . '-' . $date . '.pdf';
}
@ -122,7 +121,7 @@ class Metier_Infogreffe_DocST extends Metier_Infogreffe_Service
*/
public function getFilePath($type, $dateCloture)
{
return 'statut/' . $type . '/' . substr($dateCloture,0,4);
return 'statut/' . $type . '/' . substr($dateCloture, 0, 4);
}
/**
@ -132,7 +131,6 @@ class Metier_Infogreffe_DocST extends Metier_Infogreffe_Service
*/
protected function formatList($xml)
{
}
/**
@ -142,7 +140,6 @@ class Metier_Infogreffe_DocST extends Metier_Infogreffe_Service
*/
protected function formatItem($xml)
{
}
/**
@ -152,7 +149,6 @@ class Metier_Infogreffe_DocST extends Metier_Infogreffe_Service
*/
protected function dbUpdateItem($list)
{
}
/**
@ -165,6 +161,5 @@ class Metier_Infogreffe_DocST extends Metier_Infogreffe_Service
*/
public function dbSetFile($filename, $size = 0, $numberOfPage = '', $version = '')
{
}
}
}

View File

@ -124,13 +124,13 @@ class Metier_Infogreffe_Service
public function __construct()
{
//Load configuration
if ( Zend_Registry::isRegistered('config') ){
if (Zend_Registry::isRegistered('config')) {
$c = Zend_Registry::get('config');
} else {
$c = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', 'production');
}
$this->config = $c->profil->infogreffe;
if ( null === $this->config ) {
if (null === $this->config) {
throw new Exception('Unable to load configuration file.');
}
@ -140,7 +140,7 @@ class Metier_Infogreffe_Service
public function callRequest()
{
$fromCache = false;
if ( $this->mode_diffusion == 'XL' && $this->fileIsCache() ){
if ($this->mode_diffusion == 'XL' && $this->fileIsCache()) {
$fromCache = true;
}
@ -152,7 +152,7 @@ class Metier_Infogreffe_Service
$this->error($xml);
if ( $this->mode_diffusion == 'XL' ){
if ($this->mode_diffusion == 'XL') {
$this->fileTocache($xml);
}
@ -190,22 +190,22 @@ class Metier_Infogreffe_Service
{
$filename = $this->type_document . '-' . $this->siren . '.xml';
$file = $file = $this->config->cache->path . DIRECTORY_SEPARATOR . $filename;
if ( !file_exists($file) ) {
if (!file_exists($file)) {
return false;
}
$dateFile = filemtime($file);
$now = mktime(date('G'), date('i'), date('s'), date('m') , date('d'), date('Y'));
$now = mktime(date('G'), date('i'), date('s'), date('m'), date('d'), date('Y'));
$maxTime = mktime(
date('G',$dateFile)+$this->cacheFiletime,
date('i',$dateFile),
date('s',$dateFile),
date("m",$dateFile),
date("d",$dateFile),
date("Y",$dateFile)
date('G', $dateFile)+$this->cacheFiletime,
date('i', $dateFile),
date('s', $dateFile),
date("m", $dateFile),
date("d", $dateFile),
date("Y", $dateFile)
);
if ( $now>$maxTime ) {
if ($now>$maxTime) {
return true;
}
@ -219,19 +219,16 @@ class Metier_Infogreffe_Service
*/
protected function error($xml)
{
if ( !empty($xml) ) {
if (!empty($xml)) {
$doc = new DOMDocument();
$load = $doc->loadXML($xml, LIBXML_NOERROR | LIBXML_NOWARNING);
if ( !$load ) {
if (!$load) {
$tmp = explode('-', $xml);
$errNum = intval($tmp[0]);
$errMsg = $tmp[1];
throw new Exception($errMsg, $errNum);
}
}
else {
} else {
throw new Exception('XML content is empty.');
}
}
@ -252,17 +249,17 @@ class Metier_Infogreffe_Service
$client = new Zend_Http_Client($url);
$client->setStream();
$response = $client->request('GET');
if ( $response->isSuccessful() && substr($response->getBody(),0,4)=='%PDF' ) {
if ( copy($response->getStreamName(), $file) ) {
if ($response->isSuccessful() && substr($response->getBody(), 0, 4)=='%PDF') {
if (copy($response->getStreamName(), $file)) {
return $file;
} else {
throw new Exception( "Erreur lors de l'ecriture du fichier" );
throw new Exception("Erreur lors de l'ecriture du fichier");
}
} else {
throw new Exception( "Fichier non PDF" );
throw new Exception("Fichier non PDF");
}
} catch (Zend_Http_Client_Exception $e) {
throw new Exception( $e->getMessage() );
throw new Exception($e->getMessage());
}
}
@ -276,9 +273,9 @@ class Metier_Infogreffe_Service
*/
public function pdfInfos($pdf)
{
if ( false !== ( $file = file_get_contents( $pdf ) ) ) {
if (false !== ($file = file_get_contents($pdf))) {
//Number of page
$pages = preg_match_all( "/\/Page\W/", $file, $matches );
$pages = preg_match_all("/\/Page\W/", $file, $matches);
//Pdf Version
preg_match("/^\%PDF\-(.*)\s/U", $file, $matches);
@ -320,8 +317,7 @@ class Metier_Infogreffe_Service
// Mode de diffusion : C = Courrier, T = Téléchargement, M = Mail, XL = XML
$mode_diffusion = $code_requete->addChild('mode_diffusion');
if ( $this->mode_diffusion=='XL' )
{
if ($this->mode_diffusion=='XL') {
//On ajoute tout les types de diffusions pour XL
$mode_diffusion->addChild('mode')->addAttribute('type', 'C');
$mode_diffusion->addChild('mode')->addAttribute('type', 'T');
@ -333,29 +329,26 @@ class Metier_Infogreffe_Service
$commande = $xml->addChild('commande');
$commande->addChild('num_siren', $this->siren);
if ( $this->mode_diffusion!='XL' )
{
if ($this->mode_diffusion!='XL') {
// Commande de documents : bilan saisie ou bilan complet
if ( ($this->type_document=='BS' || $this->type_document=='BI') )
{
if (($this->type_document=='BS' || $this->type_document=='BI')) {
$num_gest = $commande->addChild('num_gest');
$num_gest->addChild('greffe',$this->greffe);
$num_gest->addChild('dossier_millesime',$this->dossier_millesime);
$num_gest->addChild('dossier_statut',$this->dossier_statut);
$num_gest->addChild('dossier_chrono',$this->dossier_chrono);
$commande->addChild('num_depot',$this->num_depot);
$num_gest->addChild('greffe', $this->greffe);
$num_gest->addChild('dossier_millesime', $this->dossier_millesime);
$num_gest->addChild('dossier_statut', $this->dossier_statut);
$num_gest->addChild('dossier_chrono', $this->dossier_chrono);
$commande->addChild('num_depot', $this->num_depot);
//Date de cloture au format dd/MM/yyyy
$commande->addChild('date_cloture', $this->date_cloture);
}
// Commande de documents : actes
elseif ( $this->type_document=='AC' )
{
elseif ($this->type_document=='AC') {
$num_gest = $commande->addChild('num_gest');
$num_gest->addChild('greffe',$this->greffe);
$num_gest->addChild('dossier_millesime',$this->dossier_millesime);
$num_gest->addChild('dossier_statut',$this->dossier_statut);
$num_gest->addChild('dossier_chrono',$this->dossier_chrono);
$commande->addChild('num_depot',$this->num_depot);
$num_gest->addChild('greffe', $this->greffe);
$num_gest->addChild('dossier_millesime', $this->dossier_millesime);
$num_gest->addChild('dossier_statut', $this->dossier_statut);
$num_gest->addChild('dossier_chrono', $this->dossier_chrono);
$commande->addChild('num_depot', $this->num_depot);
$liste_actes = $commande->addChild('liste_actes');
$liste_actes->addChild('acte')->addAttribute('num', $this->num);
}
@ -402,20 +395,20 @@ class Metier_Infogreffe_Service
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->config->url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_COOKIEFILE,TRUE);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_COOKIEFILE, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$response = curl_exec($ch);
if ( curl_errno($ch) ) {
throw new Exception( curl_error($ch) );
if (curl_errno($ch)) {
throw new Exception(curl_error($ch));
}
//Remove SOAP part of XML
$response = str_replace("<?xml version='1.0' encoding='UTF-8'?><SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'><SOAP-ENV:Body><ns0:getProduitsWebServicesXMLResponse xmlns:ns0='urn:local' SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'><return xsi:type='xsd:string'>", '', $response);
$response = str_replace('</return></ns0:getProduitsWebServicesXMLResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>','', $response);
$response = str_replace('</return></ns0:getProduitsWebServicesXMLResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>', '', $response);
if ($this->debug) {
file_put_contents($this->type_document.'-'.$this->siren.'-'.$this->mode_diffusion.'.response', $response);
@ -423,4 +416,4 @@ class Metier_Infogreffe_Service
return $response;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -140,7 +140,7 @@ class Metier_Insee_Table
'974' => "Réunion",
'975' => "Saint-Pierre-et-Miquelon",
'976' => "Mayotte",
'985' => "Mayotte", // Codification au Bodacc
'985' => "Mayotte", // Codification au Bodacc
'986' => "Wallis-et-Futuna",
'987' => "Polynésie-Française",
'988' => "Nouvelle-Calédonie",
@ -265,7 +265,7 @@ class Metier_Insee_Table
'974' => "de la Réunion",
'975' => "de Saint-Pierre-et-Miquelon",
'976' => "de Mayotte",
'985' => "de Mayotte", // Codification au Bodacc
'985' => "de Mayotte", // Codification au Bodacc
'986' => "de Wallis-et-Futuna",
'987' => "de la Polynésie-Française",
'988' => "de la Nouvelle-Calédonie",
@ -441,7 +441,7 @@ class Metier_Insee_Table
protected static $tabOrigine = array(
'0' => "Non renseigné",
'1' => "Création pure",
'2' => "Création suite à déménagement", // Création S&D du 20/04/2011 ancien 'Réinstallation après transfert'
'2' => "Création suite à déménagement", // Création S&D du 20/04/2011 ancien 'Réinstallation après transfert'
'3' => "Achat",
'4' => "Apport",
'5' => "Reprise au conjoint ou apport reçu",
@ -498,9 +498,9 @@ class Metier_Insee_Table
'iME' => "Modification établissement",
'iMS' => "Modification siège",
'iMTDE' => "Modification établissement départ (transfert)",
'iMTAE' => "Modification établissement arrivée (transfert)",
'iMTDS' => "Modification siège départ (transfert)",
'iMTAS' => "Modification siège arrivée (transfert)",
'iMTAE' => "Modification établissement arrivée (transfert)",
'iMTDS' => "Modification siège départ (transfert)",
'iMTAS' => "Modification siège arrivée (transfert)",
'iMU' => "Modification entreprise",
'iRE' => "Réactivation établissement",
'iRS' => "Réactivation siège",
@ -552,7 +552,7 @@ class Metier_Insee_Table
'iMNP' => "Etablissement présumé fermé (retour de courrier en NPAI)",
// Décret n°2010-1042 du 01/09/2010 relatif à l'inscription au registre du commerce et des sociétés et au répertoire national mentionné à l'article R. 123-220 du code de commerce
// Codification provisoire à changer dans l'attente de l'INSEE
'i810' => "Suppression du SIREN suite au refus d'inscription au Registre du Commerce et des Sociétés", // Anciennement iRCS
'i810' => "Suppression du SIREN suite au refus d'inscription au Registre du Commerce et des Sociétés", // Anciennement iRCS
// Nouveaux évènements Sirene3 de la quotidienne Insee
'i110' => "Création de l'entreprise",
'i120' => "Réactivation de l'entreprise",
@ -730,32 +730,32 @@ class Metier_Insee_Table
*/
protected $HistoRoleConvert = array(
'' => '2318',
'a' => '2308', // Chg de dénomination(RS,Ens,Sigle)
'b' => '2300', // Changement d'Adresse
'c' => '2101', // Chg.Capital/Cess.apport de parts
'd' => '2315', // Changement de Dirigeants
'e' => '2313', // Mod Act/obj.soc./Cess./Mise somm.
'f' => '2307', // Changement de Forme juridique
'g' => '2318', // Opération sur Participations
'h' => '2725', // Fusion Absorption
'i' => '2318', // Mod.garantie financière/Caution
'j' => '2401', // Changement de régime matrimonial
'k' => '2319', // Non dissolution anticipée
'l' => '2318', // Non dissolution anticipée
'm' => '2318', // Dissolution anticipée (ou non)
'n' => '2303', // Mod.date cloture exercice social
'o' => '2300;2101', // Mod.Adresse + Capital
'p' => '2300;2315', // Mod.Adresse + Dirigeants
'q' => '2300;2313', // Mod.Adresse + Activité
'r' => '2300;2307', // Mod.Adresse + F.Juridique
's' => '2101;2315', // Modification Capital + Dirigeants
't' => '2101;2313', // Modification Capital + Activité
'u' => '2101;2307', // Mod.Capital + Forme Juridique
'v' => '2315;2313', // Mod.Dirigeants + Activité
'w' => '2315;2307', // Mod.Dirigeants + Forme Juridique
'x' => '2313;2307', // Mod.Activité + Forme Juridique
'y' => '2318', // Changement de Dirigeants ?
'z' => '2318', //
'a' => '2308', // Chg de dénomination(RS,Ens,Sigle)
'b' => '2300', // Changement d'Adresse
'c' => '2101', // Chg.Capital/Cess.apport de parts
'd' => '2315', // Changement de Dirigeants
'e' => '2313', // Mod Act/obj.soc./Cess./Mise somm.
'f' => '2307', // Changement de Forme juridique
'g' => '2318', // Opération sur Participations
'h' => '2725', // Fusion Absorption
'i' => '2318', // Mod.garantie financière/Caution
'j' => '2401', // Changement de régime matrimonial
'k' => '2319', // Non dissolution anticipée
'l' => '2318', // Non dissolution anticipée
'm' => '2318', // Dissolution anticipée (ou non)
'n' => '2303', // Mod.date cloture exercice social
'o' => '2300;2101', // Mod.Adresse + Capital
'p' => '2300;2315', // Mod.Adresse + Dirigeants
'q' => '2300;2313', // Mod.Adresse + Activité
'r' => '2300;2307', // Mod.Adresse + F.Juridique
's' => '2101;2315', // Modification Capital + Dirigeants
't' => '2101;2313', // Modification Capital + Activité
'u' => '2101;2307', // Mod.Capital + Forme Juridique
'v' => '2315;2313', // Mod.Dirigeants + Activité
'w' => '2315;2307', // Mod.Dirigeants + Forme Juridique
'x' => '2313;2307', // Mod.Activité + Forme Juridique
'y' => '2318', // Changement de Dirigeants ?
'z' => '2318', //
//'K'=>
);
@ -961,4 +961,4 @@ class Metier_Insee_Table
'ZUP' => "Zone à urbaniser en priorité",
'Z U P' => "Zone à urbaniser en priorité",
);
}
}

View File

@ -13,29 +13,30 @@ class Metier_Intersud_Service
/**
* Gestion des demandes d'enquêtes au service Infogreffe
*/
public function __construct(){}
public function __construct()
{
}
public function setDemandeur()
{
}
public function setEnquete()
{
}
public function call()
{
$this->ckfile = __DIR__.'/'.uniqid('cookie-');
if (file_exists($ckfile)) unlink($ckfile);
if (file_exists($ckfile)) {
unlink($ckfile);
}
// --- Authentification
$url = 'http://www.intersud.fr/espace_client/';
$data = array(
'login' => $this->login,
'pwd' => $this->pass,
'login' => $this->login,
'pwd' => $this->pass,
);
$result = $this->page($url, $data);
@ -46,45 +47,44 @@ class Metier_Intersud_Service
$data = array(
//Expediteur - Email
'email_exp' => 'support@scores-decisions.com',
'email_exp' => 'support@scores-decisions.com',
//Type enquete - Prestation Nationales
'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_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'],
'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'],
'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 ?
'nom_exp' => $tabInterSud['nom_exp'],
'tel' => $tabIdentite['Tel'],
'port' => $infoEnq['Entrep']['AutreTel'],
'tel_exp' => $tabInterSud['tel_exp'],
'bank' => trim(implode(' ', $infoEnq['Entrep']['Rib'])),
'int_enk' => $tabInterSud['int_enk'], // International ?
'encours' => $infoEnq['Encours'],
'nb_ech' => $infoEnq['NbEcheances'],
'delai2_enk' => $tabInterSud['delai2_enk'], // International ?
'ville' => $tabIdentite['Ville'],
'cp' => $tabIdentite['CP'],
'pays' => '', // International ?
'nom_exp' => $tabInterSud['nom_exp'],
'tel' => $tabIdentite['Tel'],
'port' => $infoEnq['Entrep']['AutreTel'],
'tel_exp' => $tabInterSud['tel_exp'],
'bank' => trim(implode(' ', $infoEnq['Entrep']['Rib'])),
'int_enk' => $tabInterSud['int_enk'], // International ?
'encours' => $infoEnq['Encours'],
'nb_ech' => $infoEnq['NbEcheances'],
'delai2_enk' => $tabInterSud['delai2_enk'], // International ?
'cred' => '',
'comment' => urlencode($comment),
'val_ret' => $tabInterSud['val_ret'],
'cred' => '',
'comment' => urlencode($comment),
'val_ret' => $tabInterSud['val_ret'],
);
$result = $this->page($url, $data);
}
@ -97,40 +97,40 @@ class Metier_Intersud_Service
$post = false;
$fields = '';
if (is_array($curl_data) && count($curl_data)>0) {
foreach($curl_data as $key=>$value) {
foreach ($curl_data as $key=>$value) {
$fields .= $key.'='.$value.'&';
}
rtrim($fields,'&');
rtrim($fields, '&');
$post = true;
}
$options = array(
CURLOPT_RETURNTRANSFER => true, // return web page
CURLOPT_HEADER => false, // don't return headers
CURLOPT_FOLLOWLOCATION => false, // follow redirects
CURLOPT_ENCODING => "", // handle all encodings
CURLOPT_USERAGENT => $user_agent, // who am i
CURLOPT_AUTOREFERER => true, // set referer on redirect
CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect
CURLOPT_TIMEOUT => 120, // timeout on response
CURLOPT_MAXREDIRS => 10, // stop after 10 redirects
CURLOPT_POST => $post, // i am sending post data
CURLOPT_POSTFIELDS => $fields, // this are my post vars
CURLOPT_SSL_VERIFYHOST => 0, // don't verify ssl
CURLOPT_SSL_VERIFYPEER => false, //
CURLOPT_VERBOSE => $verbose , //
CURLOPT_RETURNTRANSFER => true, // return web page
CURLOPT_HEADER => false, // don't return headers
CURLOPT_FOLLOWLOCATION => false, // follow redirects
CURLOPT_ENCODING => "", // handle all encodings
CURLOPT_USERAGENT => $user_agent, // who am i
CURLOPT_AUTOREFERER => true, // set referer on redirect
CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect
CURLOPT_TIMEOUT => 120, // timeout on response
CURLOPT_MAXREDIRS => 10, // stop after 10 redirects
CURLOPT_POST => $post, // i am sending post data
CURLOPT_POSTFIELDS => $fields, // this are my post vars
CURLOPT_SSL_VERIFYHOST => 0, // don't verify ssl
CURLOPT_SSL_VERIFYPEER => false, //
CURLOPT_VERBOSE => $verbose , //
//CURLOPT_COOKIESESSION => true,
CURLOPT_COOKIEFILE => $ckfile,
CURLOPT_COOKIEJAR => $ckfile, // Stockage du cookie de session
CURLOPT_COOKIEFILE => $ckfile,
CURLOPT_COOKIEJAR => $ckfile, // Stockage du cookie de session
);
//Override define CURL option
if (is_array($override) && count($override)>0 ) {
if (is_array($override) && count($override)>0) {
$options = $override + $options;
}
$ch = curl_init($url);
curl_setopt_array($ch,$options);
curl_setopt_array($ch, $options);
$content = curl_exec($ch);
$err = curl_errno($ch);
$errmsg = curl_error($ch) ;
@ -148,7 +148,4 @@ class Metier_Intersud_Service
// $header['content'] = $content;
return array('header'=>$header, 'content'=>$content);
}
}
}

View File

@ -1,49 +1,49 @@
<?php
class Metier_Liens_Base
{
/**
* Company Reference id
* @var int
*/
/**
* Company Reference id
* @var int
*/
protected $idRef = null;
/**
* Company SIREN
* @var string
*/
protected $siren = null;
protected $siren = null;
/**
* Array to list id find during list of childrens
* @var array
*/
protected $findId = array();
/**
* Array to list id find during list of childrens
* @var array
*/
protected $findId = array();
/**
* Coutry List ISO3 => Label
* @var array
*/
protected $country = null;
/**
* Coutry List ISO3 => Label
* @var array
*/
protected $country = null;
/**
* Stop the process to looks for company group head
* @var boolean
*/
public $stopAtFirstIsin = false;
/**
* Stop the process to looks for company group head
* @var boolean
*/
public $stopAtFirstIsin = false;
/**
* Stop the process to looks for physical person
* @var boolean
*/
public $stopAtPP = true;
/**
* Stop the process to looks for physical person
* @var boolean
*/
public $stopAtPP = true;
/**
* PDO Connection with Doctrine
* @var \Doctrine\DBAL\Connection
*/
protected $conn;
/**
* PDO Connection with Doctrine
* @var \Doctrine\DBAL\Connection
*/
protected $conn;
/**
/**
* Gestion des liens inter entreprises
* @param \Doctrine\DBAL\Connection $conn
*/
@ -51,122 +51,118 @@ class Metier_Liens_Base
{
if ($conn === null) {
$this->conn = Zend_Registry::get('doctrine');
}
else {
} else {
$this->conn = $conn;
}
}
/**
* Identifiant
* @param string $id
* @param string $type ref|siren
*/
public function setId($id, $type = 'ref')
{
// Get Id
if ( $type == 'siren' ) {
$this->siren = $id;
try {
$sql = "SELECT * FROM jo.liensRef WHERE siren = :id AND dateSuppr = 0";
/**
* Identifiant
* @param string $id
* @param string $type ref|siren
*/
public function setId($id, $type = 'ref')
{
// Get Id
if ($type == 'siren') {
$this->siren = $id;
try {
$sql = "SELECT * FROM jo.liensRef WHERE siren = :id AND dateSuppr = 0";
$stmt = $this->conn->prepare($sql);
$stmt->bindValue('id', $id);
$stmt->execute();
if ($stmt->rowCount() > 0) {
$result = $stmt->fetch(\PDO::FETCH_OBJ);
$this->idRef = $result->id;
}
}
catch (\Doctrine\DBAL\DBALException $e) {
throw new Exception(__METHOD__ . ': ' . $e->getMessage());
}
}
else {
$this->idRef = $id;
}
}
if ($stmt->rowCount() > 0) {
$result = $stmt->fetch(\PDO::FETCH_OBJ);
$this->idRef = $result->id;
}
} catch (\Doctrine\DBAL\DBALException $e) {
throw new Exception(__METHOD__ . ': ' . $e->getMessage());
}
} else {
$this->idRef = $id;
}
}
/**
* Retourne les actionnaires
* @param int $id
* @param boolean $actif
* @return array Tableau d'actionnaires
*/
public function getActionnaires($id = null, $actif = null)
{
if ( null === $id ) {
$id = $this->idRef;
}
/**
* Retourne les actionnaires
* @param int $id
* @param boolean $actif
* @return array Tableau d'actionnaires
*/
public function getActionnaires($id = null, $actif = null)
{
if (null === $id) {
$id = $this->idRef;
}
$liens = array();
$liens = array();
if ( null === $id ) {
return $liens;
}
if (null === $id) {
return $liens;
}
try {
$qb = $this->conn->createQueryBuilder();
$qb->select(array(
'l.id', 'l.idAct', 'l.PDetention', 'l.Pvote', 'l.MajMin', 'l.idPar',
'l.dateEffetLien', 'l.dateInsert', 'l.dateUpdate',
'LPAD(r.siren, 9, 0) AS siren', 'r.PpPm', 'r.RS', 'r.sigle', 'r.civilite', 'r.nom',
'r.prenom', 'r.nom_usage', 'r.naissance_date', 'r.naissance_dept_pays',
'r.naissance_lieu', 'r.nat', 'r.adresse_num', 'r.adresse_btq', 'r.adresse_codvoie',
'r.adresse_libvoie', 'r.adresse_comp', 'r.adresse_cp', 'r.adresse_ville',
'r.adresse_pays', 'r.idLoc1Type', 'r.idLoc1Num', 'r.idLoc2Type', 'r.idLoc2Num',
'r.idLoc3Type', 'r.idLoc3Num'
)
)->from('jo.liens2', 'l')->join('l', 'jo.liensRef', 'r', 'l.idAct = r.id')
->where('l.idPar = :id')->setParameter('id', $id)
->orderBy('l.PDetention', 'DESC');
try {
$qb = $this->conn->createQueryBuilder();
$qb->select(array(
'l.id', 'l.idAct', 'l.PDetention', 'l.Pvote', 'l.MajMin', 'l.idPar',
'l.dateEffetLien', 'l.dateInsert', 'l.dateUpdate',
'LPAD(r.siren, 9, 0) AS siren', 'r.PpPm', 'r.RS', 'r.sigle', 'r.civilite', 'r.nom',
'r.prenom', 'r.nom_usage', 'r.naissance_date', 'r.naissance_dept_pays',
'r.naissance_lieu', 'r.nat', 'r.adresse_num', 'r.adresse_btq', 'r.adresse_codvoie',
'r.adresse_libvoie', 'r.adresse_comp', 'r.adresse_cp', 'r.adresse_ville',
'r.adresse_pays', 'r.idLoc1Type', 'r.idLoc1Num', 'r.idLoc2Type', 'r.idLoc2Num',
'r.idLoc3Type', 'r.idLoc3Num'
)
)->from('jo.liens2', 'l')->join('l', 'jo.liensRef', 'r', 'l.idAct = r.id')
->where('l.idPar = :id')->setParameter('id', $id)
->orderBy('l.PDetention', 'DESC');
// Actif / Inactif
if ( null !== $actif ) {
if ( false === $actif ) {
$qb->andWhere('l.actif = 0');
} else {
$qb->andWhere('l.actif = 1');
}
}
// Actif / Inactif
if (null !== $actif) {
if (false === $actif) {
$qb->andWhere('l.actif = 0');
} else {
$qb->andWhere('l.actif = 1');
}
}
// Don't display deleted - anomaly
$qb->andWhere("l.dateSuppr = '0000-00-00 00:00:00'");
$stmt = $qb->execute();
$liens = $stmt->fetchAll(\PDO::FETCH_OBJ);
}
catch (\Doctrine\DBAL\DBALException $e) {
throw new Exception(__METHOD__ . ': ' . $e->getMessage());
}
// Don't display deleted - anomaly
$qb->andWhere("l.dateSuppr = '0000-00-00 00:00:00'");
$stmt = $qb->execute();
$liens = $stmt->fetchAll(\PDO::FETCH_OBJ);
} catch (\Doctrine\DBAL\DBALException $e) {
throw new Exception(__METHOD__ . ': ' . $e->getMessage());
}
return $liens;
}
return $liens;
}
/**
* Retourne les participations
* @param int $id
* @param boolean $actif
* @return array Tableau des participations
*/
public function getParticipations($id = null, $actif = null)
{
if ( null === $id ) {
$id = $this->idRef;
}
/**
* Retourne les participations
* @param int $id
* @param boolean $actif
* @return array Tableau des participations
*/
public function getParticipations($id = null, $actif = null)
{
if (null === $id) {
$id = $this->idRef;
}
if ( false === $actif ) {
$actif = 0;
} else {
$actif = 1;
}
if (false === $actif) {
$actif = 0;
} else {
$actif = 1;
}
$liens = array();
$liens = array();
if ( null === $id ) {
return $liens;
}
if (null === $id) {
return $liens;
}
try {
$qb = $this->conn->createQueryBuilder();
try {
$qb = $this->conn->createQueryBuilder();
$qb->select(array(
'l.id', 'l.idAct', 'l.PDetention', 'l.Pvote', 'l.MajMin', 'l.idPar',
'l.dateEffetLien', 'l.dateInsert', 'l.dateUpdate',
@ -181,374 +177,372 @@ class Metier_Liens_Base
->where('l.idAct = :id')->setParameter('id', $id)
->orderBy('l.PDetention', 'DESC');
// Actif / Inactif
if ( null !== $actif ) {
if ( false === $actif ) {
$qb->andWhere('l.actif = 0');
} else {
$qb->andWhere('l.actif = 1');
}
}
// Actif / Inactif
if (null !== $actif) {
if (false === $actif) {
$qb->andWhere('l.actif = 0');
} else {
$qb->andWhere('l.actif = 1');
}
}
//Don't display deleted - anomaly
$qb->andWhere("l.dateSuppr = '0000-00-00 00:00:00'");
//Don't display deleted - anomaly
$qb->andWhere("l.dateSuppr = '0000-00-00 00:00:00'");
$stmt = $qb->execute();
$liens = $stmt->fetchAll(\PDO::FETCH_OBJ);
}
catch (\Doctrine\DBAL\DBALException $e) {
throw new Exception(__METHOD__ . ': ' . $e->getMessage());
}
} catch (\Doctrine\DBAL\DBALException $e) {
throw new Exception(__METHOD__ . ': ' . $e->getMessage());
}
return $liens;
}
return $liens;
}
/**
* Fonctions de direction
* @param boolean $actif
* @return array
*/
public function getDirections($actif = null)
{
if (null === $this->siren) {
/**
* Fonctions de direction
* @param boolean $actif
* @return array
*/
public function getDirections($actif = null)
{
if (null === $this->siren) {
$sql = "SELECT LPAD(siren, 9, 0) AS siren FROM jo.liensRef WHERE id = :id";
$stmt = $this->conn->prepare($sql);
$stmt->bindValue('id', $this->idRef);
$result = $stmt->fetch(\PDO::FETCH_OBJ);
$siren = $result->siren;
}
else {
$siren = $this->siren;
}
$siren = $result->siren;
} else {
$siren = $this->siren;
}
$result = array();
$result = array();
if (null !== $siren && intval($siren) != 0) {
try {
$qb = $this->conn->createQueryBuilder();
$qb->select(array('LPAD(siren, 9, 0) AS siren', 'raisonSociale',
'dirSiren', 'dirRS', 'civilite', 'nom', 'prenom', 'naissance_date',
'naissance_lieu', 'fonction_code', 'fonction_lib')
if (null !== $siren && intval($siren) != 0) {
try {
$qb = $this->conn->createQueryBuilder();
$qb->select(array('LPAD(siren, 9, 0) AS siren', 'raisonSociale',
'dirSiren', 'dirRS', 'civilite', 'nom', 'prenom', 'naissance_date',
'naissance_lieu', 'fonction_code', 'fonction_lib')
)->from('jo.rncs_dirigeants')->where("typeDir IN ('PM', 'PP')")
->andWhere('dirSiren = :siren')->setParameter('siren', $siren);
// Actif / Inactif
if (null !== $actif) {
if ( false === $actif ) {
$qb->andWhere('actif = 0');
}
else {
// Actif / Inactif
if (null !== $actif) {
if (false === $actif) {
$qb->andWhere('actif = 0');
} else {
$qb->andWhere('actif = 1');
}
}
}
$qb->orderBy('fonction_code', 'DESC');
$qb->orderBy('raisonSociale', 'ASC');
$stmt = $qb->execute();
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
} catch (\Doctrine\DBAL\DBALException $e) {
throw new Exception(__METHOD__ . ': ' . $e->getMessage());
}
}
} catch (\Doctrine\DBAL\DBALException $e) {
throw new Exception(__METHOD__ . ': ' . $e->getMessage());
}
}
return $result;
}
return $result;
}
/**
* Retourne la maison mère
* @param int $id
* Id de la fiche de départ
* @param int $detention
* Niveau de détention (Une filiale est une entreprise détenue à plus de 50% par une autre entreprise)
* @return int
*/
public function getHead($id = null, $detention = 0)
{
if ( null === $id ) {
$id = $this->idRef;
}
/**
* Retourne la maison mère
* @param int $id
* Id de la fiche de départ
* @param int $detention
* Niveau de détention (Une filiale est une entreprise détenue à plus de 50% par une autre entreprise)
* @return int
*/
public function getHead($id = null, $detention = 0)
{
if (null === $id) {
$id = $this->idRef;
}
//Add ID to the list of known
$this->findId[] = $id;
//Add ID to the list of known
$this->findId[] = $id;
//Through the list
$liens = $this->getActionnaires($id, true);
//Through the list
$liens = $this->getActionnaires($id, true);
//Find the following up entity
if ( count($liens)>0 ) {
foreach ( $liens as $item ) {
//Don't through again and again
if ( in_array($item->idAct, $this->findId) ) {
return $item->idAct;
} elseif ( $this->stopAtFirstIsin === true && !empty($item->isin)) {
break;
}
//Remove physical person
elseif ( $item->PpPm == 'PP' && $this->stopAtPP ) {
continue;
}
//Same id
elseif ( $item->idAct == $id ) {
return $id;
}
//PDetention>50
elseif ( $item->PDetention > 50 && $item->idAct > 1000 ) {
return $this->getHead($item->idAct, $detention);
}
//MajMin=+
elseif ( $item->PDetention > $detention && $item->MajMin == '+' && $item->idAct > 1000 ) {
return $this->getHead($item->idAct, $detention);
}
//--
elseif ( $item->PDetention > $detention && $item->idAct > 1000 ) {
return $this->getHead($item->idAct, $detention);
}
}
}
//Find the following up entity
if (count($liens)>0) {
foreach ($liens as $item) {
//Don't through again and again
if (in_array($item->idAct, $this->findId)) {
return $item->idAct;
} elseif ($this->stopAtFirstIsin === true && !empty($item->isin)) {
break;
}
//Remove physical person
elseif ($item->PpPm == 'PP' && $this->stopAtPP) {
continue;
}
//Same id
elseif ($item->idAct == $id) {
return $id;
}
//PDetention>50
elseif ($item->PDetention > 50 && $item->idAct > 1000) {
return $this->getHead($item->idAct, $detention);
}
//MajMin=+
elseif ($item->PDetention > $detention && $item->MajMin == '+' && $item->idAct > 1000) {
return $this->getHead($item->idAct, $detention);
}
//--
elseif ($item->PDetention > $detention && $item->idAct > 1000) {
return $this->getHead($item->idAct, $detention);
}
}
}
return $id;
}
return $id;
}
/**
* Retourne les éléments identitaire présent dans lienRef
* @param string $id
* @return array
*/
public function getIdentity($id = null)
{
if ( null === $id ) {
$id = $this->idRef;
}
/**
* Retourne les éléments identitaire présent dans lienRef
* @param string $id
* @return array
*/
public function getIdentity($id = null)
{
if (null === $id) {
$id = $this->idRef;
}
$sql = "SELECT * FROM jo.liensRef WHERE id = :id";
$stmt = $this->conn->prepare($sql);
$stmt->bindValue('id', $id);
$stmt->execute();
if ($stmt->rowCount() > 0) {
return $stmt->fetch(\PDO::FETCH_OBJ);
}
$sql = "SELECT * FROM jo.liensRef WHERE id = :id";
$stmt = $this->conn->prepare($sql);
$stmt->bindValue('id', $id);
$stmt->execute();
if ($stmt->rowCount() > 0) {
return $stmt->fetch(\PDO::FETCH_OBJ);
}
return null;
}
return null;
}
/**
* Retourne l'arborescence pour les groupes
* @param int $pctMin
* @param int $nbNiveaux
* @return array
*/
public function getTree($pctMin = 33, $nbNiveaux = 10)
{
//Get identity to stop at isin
$itemWithIsin = null;
if ( $this->stopAtFirstIsin === true ) {
$id = $this->idRef;
$identity = $this->getIdentity($this->idRef);
if ( !empty($identity->isin) ) {
$itemWithIsin = true;
}
}
/**
* Retourne l'arborescence pour les groupes
* @param int $pctMin
* @param int $nbNiveaux
* @return array
*/
public function getTree($pctMin = 33, $nbNiveaux = 10)
{
//Get identity to stop at isin
$itemWithIsin = null;
if ($this->stopAtFirstIsin === true) {
$id = $this->idRef;
$identity = $this->getIdentity($this->idRef);
if (!empty($identity->isin)) {
$itemWithIsin = true;
}
}
if ( $itemWithIsin !== true ) {
//Récupération de la maison mère
$id = $this->getHead(null, 50);
//Informations de la maison mère
$identity = $this->getIdentity($id);
}
if ($itemWithIsin !== true) {
//Récupération de la maison mère
$id = $this->getHead(null, 50);
//Informations de la maison mère
$identity = $this->getIdentity($id);
}
$this->findId = array();
$this->findId[] = $identity->id;
$this->findId = array();
$this->findId[] = $identity->id;
$nom = $identity->RS;
if ( $identity->nom != '') {
$nom = $identity->civilite.' '.$identity->nom.' '.$identity->prenom;
}
$nom = $identity->RS;
if ($identity->nom != '') {
$nom = $identity->civilite.' '.$identity->nom.' '.$identity->prenom;
}
if ( $this->country === null ) {
$this->country = $this->getCountry();
}
if ($this->country === null) {
$this->country = $this->getCountry();
}
$pays = $identity->adresse_pays;
if ( array_key_exists($identity->adresse_pays, $this->country) ) {
$pays = $this->country[$identity->adresse_pays];
}
$pays = $identity->adresse_pays;
if (array_key_exists($identity->adresse_pays, $this->country)) {
$pays = $this->country[$identity->adresse_pays];
}
//Retour
$tabRet = array (
'id' => $identity->id,
'name' => $nom,
'siren' => str_pad($identity->siren, 9, '0', STR_PAD_LEFT),
'pmin' => $item->PDetention,
'pays' => $pays,
'children' => $this->getTreeRecursive($identity->id, $pctMin, 1, $nbNiveaux),
);
//Retour
$tabRet = array(
'id' => $identity->id,
'name' => $nom,
'siren' => str_pad($identity->siren, 9, '0', STR_PAD_LEFT),
'pmin' => $item->PDetention,
'pays' => $pays,
'children' => $this->getTreeRecursive($identity->id, $pctMin, 1, $nbNiveaux),
);
return $tabRet;
}
return $tabRet;
}
/**
* Retourne un sous élement de l'arborescence pour les groupes
* @param int $id
* @param int $pctMin
* @param int $niveau
* @param int $nbNiveaux
* @return array
*/
public function getTreeRecursive( $id, $pctMin=33, $niveau=0, $nbNiveaux=10 )
{
if ( $niveau > $nbNiveaux ) return array();
$niveau++;
/**
* Retourne un sous élement de l'arborescence pour les groupes
* @param int $id
* @param int $pctMin
* @param int $niveau
* @param int $nbNiveaux
* @return array
*/
public function getTreeRecursive($id, $pctMin=33, $niveau=0, $nbNiveaux=10)
{
if ($niveau > $nbNiveaux) {
return array();
}
$niveau++;
$tabRet = array();
$participations = $this->getParticipations($id, true);
if ( count($participations)>0 ) {
foreach ( $participations as $item ) {
if ( $item->PDetention > $pctMin ) {
$identity = $this->getIdentity($item->idPar);
$tabRet = array();
$participations = $this->getParticipations($id, true);
if (count($participations)>0) {
foreach ($participations as $item) {
if ($item->PDetention > $pctMin) {
$identity = $this->getIdentity($item->idPar);
$nom = $identity->RS;
if ( $identity->nom != '') {
$nom = $identity->civilite.' '.$identity->nom.' '.$identity->prenom;
}
$nom = $identity->RS;
if ($identity->nom != '') {
$nom = $identity->civilite.' '.$identity->nom.' '.$identity->prenom;
}
if ($this->country === null) {
$this->country = $this->getCountry();
}
if ($this->country === null) {
$this->country = $this->getCountry();
}
$pays = $identity->adresse_pays;
if ( array_key_exists($identity->adresse_pays, $this->country) ) {
$pays = $this->country[$identity->adresse_pays];
}
$pays = $identity->adresse_pays;
if (array_key_exists($identity->adresse_pays, $this->country)) {
$pays = $this->country[$identity->adresse_pays];
}
$data = array (
'id' => $identity->id,
'name' => $nom,
'siren' => str_pad($identity->siren, 9, '0', STR_PAD_LEFT),
'pmin' => $item->PDetention,
'pays' => $pays,
'children' => array(),
);
//Pour éviter d'avoir des boucles infinis
if ( !in_array($identity->id, $this->findId) ){
$this->findId[] = $identity->id;
$data['children'] = $this->getTreeRecursive($identity->id, $pctMin, $niveau, $nbNiveaux);
}
$tabRet[] = $data;
}
}
}
return $tabRet;
}
$data = array(
'id' => $identity->id,
'name' => $nom,
'siren' => str_pad($identity->siren, 9, '0', STR_PAD_LEFT),
'pmin' => $item->PDetention,
'pays' => $pays,
'children' => array(),
);
//Pour éviter d'avoir des boucles infinis
if (!in_array($identity->id, $this->findId)) {
$this->findId[] = $identity->id;
$data['children'] = $this->getTreeRecursive($identity->id, $pctMin, $niveau, $nbNiveaux);
}
$tabRet[] = $data;
}
}
}
return $tabRet;
}
/**
* Liste des entités du CAC40
* @return array
*/
public function getCAC40()
{
$sql = "SELECT isin, nom, MAX(date) AS dateMAJ FROM sdv1.bourse_listes
/**
* Liste des entités du CAC40
* @return array
*/
public function getCAC40()
{
$sql = "SELECT isin, nom, MAX(date) AS dateMAJ FROM sdv1.bourse_listes
WHERE lstCode='xcac40p' GROUP BY lstCode, isin HAVING MAX(date) ORDER BY dateMAJ DESC;";
$stmt = $this->conn->prepare($sql);
$stmt->execute();
$stmt = $this->conn->prepare($sql);
$stmt->execute();
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
$output = array();
foreach ( $result as $item ) {
$output[] = $item->isin;
}
$output = array();
foreach ($result as $item) {
$output[] = $item->isin;
}
return $output;
}
return $output;
}
/**
*
* @param number $pctMin
* @return array
*/
public function getGroupeCAC40($pctMin = 50)
{
$listeIsin = $this->getCAC40();
$isin = "'".implode("','",$listeIsin)."'";
/**
*
* @param number $pctMin
* @return array
*/
public function getGroupeCAC40($pctMin = 50)
{
$listeIsin = $this->getCAC40();
$isin = "'".implode("','", $listeIsin)."'";
$this->findId = array();
$this->findId = array();
$sql = "SELECT id FROM jo.liensRef WHERE (idLoc1Type=63 AND idLoc1Num IN (".$isin."))
$sql = "SELECT id FROM jo.liensRef WHERE (idLoc1Type=63 AND idLoc1Num IN (".$isin."))
OR (idLoc2Type=63 AND idLoc2Num IN (".$isin.")) OR (idLoc3Type=63 AND idLoc3Num IN (".$isin."))";
$stmt = $this->conn->executeQuery($sql);
$output = array();
if ($stmt->rowCount() > 0) {
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
foreach ( $result as $item ) {
$output = $output + $this->getListeGroupeCAC40($item->id, $pctMin);
}
}
$stmt = $this->conn->executeQuery($sql);
$output = array();
if ($stmt->rowCount() > 0) {
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
foreach ($result as $item) {
$output = $output + $this->getListeGroupeCAC40($item->id, $pctMin);
}
}
return $output;
}
return $output;
}
/**
*
* @param int $id
* @param number $pctMin
* @return array
*/
public function getListeGroupeCAC40($id, $pctMin=50 )
{
$participations = $this->getParticipations($id, true);
$output = array();
if ( count($participations)>0 ) {
foreach ( $participations as $item ) {
if ( $item->PDetention > $pctMin ) {
$identity = $this->getIdentity($item->idPar);
/**
*
* @param int $id
* @param number $pctMin
* @return array
*/
public function getListeGroupeCAC40($id, $pctMin=50)
{
$participations = $this->getParticipations($id, true);
$output = array();
if (count($participations)>0) {
foreach ($participations as $item) {
if ($item->PDetention > $pctMin) {
$identity = $this->getIdentity($item->idPar);
if ( intval($identity->siren)!=0 ) {
$output[] = $identity->siren;
}
if (intval($identity->siren)!=0) {
$output[] = $identity->siren;
}
if ( !in_array($identity->id, $this->findId) ){
$this->findId[] = $identity->id;
$output = $output + $this->getListeGroupeCAC40($identity->id, $pctMin);
}
if (!in_array($identity->id, $this->findId)) {
$this->findId[] = $identity->id;
$output = $output + $this->getListeGroupeCAC40($identity->id, $pctMin);
}
}
}
}
return $output;
}
}
}
}
return $output;
}
/**
*
* @param number $pctMin
* @return boolean
*/
public function isInGroupeCAC40($pctMin = 50)
{
//Si pas d'actionnaires => false
if (count($this->getActionnaires()) == 0) {
return false;
}
/**
*
* @param number $pctMin
* @return boolean
*/
public function isInGroupeCAC40($pctMin = 50)
{
//Si pas d'actionnaires => false
if ( count($this->getActionnaires()) == 0 ) {
return false;
}
$listeInGroupeCAC40 = $this->getGroupeCAC40($pctMin);
if (in_array($this->siren, $listeInGroupeCAC40)) {
return true;
}
$listeInGroupeCAC40 = $this->getGroupeCAC40($pctMin);
if ( in_array($this->siren, $listeInGroupeCAC40) ) {
return true;
}
return false;
}
return false;
}
/**
* Get all countries
*/
protected function getCountry()
{
$sql = "SELECT codPays3, libPays FROM jo.tabPays WHERE codPays3 IS NOT NULL";
$stmt = $this->conn->prepare($sql);
/**
* Get all countries
*/
protected function getCountry()
{
$sql = "SELECT codPays3, libPays FROM jo.tabPays WHERE codPays3 IS NOT NULL";
$stmt = $this->conn->prepare($sql);
$stmt->execute();
if ($stmt->rowCount() > 0) {
$data = array();
foreach($rows as $item) {
foreach ($rows as $item) {
$data[$item->codPays3] = $item->libPays;
}
return $data;
}
return false;
}
}
return false;
}
}

View File

@ -1,307 +1,311 @@
<?php
ini_set('soap.wsdl_cache_enabled', 0);
ini_set('default_socket_timeout', 30);
class Metier_Partenaires_MAmabis
{
protected $client;
protected $iDb;
public function __construct($db = null)
{
if ( $db === null ) {
$this->iDb = new Metier_Util_Db();
} else {
$this->iDb = $db;
}
$this->client = new SoapClient(null, array(
'location' => 'http://sw2.amabis.com:5100/',
'uri' => 'http://www.amabis.com/ns.xsd',
'connection_timeout' => 2,
'soap_version' => SOAP_1_1,
'trace' => 1,
'style' => SOAP_RPC,
'use' => SOAP_ENCODED,
));
}
public function getZonage($adrNum, $adrIndRep, $adrTypeVoie, $adrLibVoie, $cp, $ville='', $codeRivoli='', $rnvp=false, $raisonSociale='TEST', $debug=false)
{
$tabRep = array();
if (!$rnvp) {
if ($cp < 10000) {
$cp='0'.$cp;
}
$dep2 = substr($cp,0,2)*1;
$dep3 = substr($cp,0,3)*1;
switch ($dep2) {
case 0:
case 97: // DOM
case 98: // TOM
case 99: // Etranger
return $tabRep;
break;
default:
break;
}
}
$adresse = addslashes(trim(preg_replace('/ +/',' ', "$adrNum $adrIndRep $adrTypeVoie $adrLibVoie")));
$ville = addslashes($ville);
$majForcee = false;
$ret = $this->iDb->select(
'jo.zonage', 'zus, zru, zfu, cucs, rnvpStatut, rnvpCorr, rnvpTrt, adr3, adr4, adr5, adr6, adr7, numVoieA, indRepA,
<?php
ini_set('soap.wsdl_cache_enabled', 0);
ini_set('default_socket_timeout', 30);
class Metier_Partenaires_MAmabis
{
protected $client;
protected $iDb;
public function __construct($db = null)
{
if ($db === null) {
$this->iDb = new Metier_Util_Db();
} else {
$this->iDb = $db;
}
$this->client = new SoapClient(null, array(
'location' => 'http://sw2.amabis.com:5100/',
'uri' => 'http://www.amabis.com/ns.xsd',
'connection_timeout' => 2,
'soap_version' => SOAP_1_1,
'trace' => 1,
'style' => SOAP_RPC,
'use' => SOAP_ENCODED,
));
}
public function getZonage($adrNum, $adrIndRep, $adrTypeVoie, $adrLibVoie, $cp, $ville='', $codeRivoli='', $rnvp=false, $raisonSociale='TEST', $debug=false)
{
$tabRep = array();
if (!$rnvp) {
if ($cp < 10000) {
$cp='0'.$cp;
}
$dep2 = substr($cp, 0, 2)*1;
$dep3 = substr($cp, 0, 3)*1;
switch ($dep2) {
case 0:
case 97: // DOM
case 98: // TOM
case 99: // Etranger
return $tabRep;
break;
default:
break;
}
}
$adresse = addslashes(trim(preg_replace('/ +/', ' ', "$adrNum $adrIndRep $adrTypeVoie $adrLibVoie")));
$ville = addslashes($ville);
$majForcee = false;
$ret = $this->iDb->select(
'jo.zonage', 'zus, zru, zfu, cucs, rnvpStatut, rnvpCorr, rnvpTrt, adr3, adr4, adr5, adr6, adr7, numVoieA, indRepA,
typeVoieAlong, typeVoieAcourt, corpVoie, motDir, motDirD, libVoieSec, adr4n32, adr4n38, clePostaleVoie,
secteur, cleRoutage, cpx, cleAd, codPaysIso2, codPaysIso3, libPays, codeInsee',
"address='$adresse' AND adr_cp='$cp' AND adr_ville='$ville'",false, MYSQL_ASSOC);
if (count($ret) > 0) {
$zones = $ret[0];
if ($zones['rnvpStatut'] === null && $rnvp) {
$majForcee = true;
}
$tabRep['ZUS'] = $tabRep['ZFU'] = $tabRep['ZRU'] = $tabRep['CUCS'] = 'NON';
if (trim($zones['zus']) != '') {
if (trim($zones['zus']) == 'NSP') {
$tabRep['ZUS'] = 'NSP';
}
else {
$tabRep['ZUS'] = 'OUI';
}
$tabRep['NZUS'] = $zones['zus'];
}
if (trim($zones['zru']) != '') {
if (trim($zones['zru']) == 'NSP') {
$tabRep['ZRU'] = 'NSP';
}
else {
$tabRep['ZRU'] = 'OUI';
}
$tabRep['NZRU'] = $zones['zru'];
}
if (trim($zones['zfu']) != '') {
if (trim($zones['zfu']) == 'NSP') {
$tabRep['ZFU'] = 'NSP';
}
else {
$tabRep['ZFU'] = 'OUI';
}
$tabRep['NZFU'] = $zones['zfu'];
}
if (trim($zones['cucs']) != '') {
if (trim($zones['cucs']) == 'NSP') {
$tabRep['CUCS'] = 'NSP';
}
else {
$tabRep['CUCS'] = 'OUI';
}
$tabRep['NCUCS'] = $zones['cucs'];
}
/** Autres Informations de la RNVP **/
if ($rnvp) {
if (strtoupper(@trim($zones['adr7'])) == 'FRANCE') {
$zones['adr7'] = '';
}
$tabRep['ADR3'] = @trim($zones['adr3']);
$tabRep['ADR4'] = @trim($zones['adr4']);
$tabRep['ADR5'] = @trim($zones['adr5']);
$tabRep['ADR6'] = @trim($zones['adr6']);
$tabRep['ADR7'] = trim($zones['adr7']);
}
}
if (count($ret) == 0 || $majForcee) {
try {
// Le RNVP ne fonctionne pas sans la Raison Sociale qui est la 1ère ligne d'adresse
if (trim($raisonSociale) == '') {
$raisonSociale = 'TEST';
}
$rep = $this->client->zonage(
new SoapParam(strtr(
"$raisonSociale:$adresse:$cp:$ville",
'¿°ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûýýþÿ??',
' aaaaaaaceeeeiiiidnoooooouuuuybsaaaaaaaceeeeiiiidnoooooouuuyybyRr'),'adresse'),
new SoapParam(':','separateur'),
new SoapParam('type=M','options')
);
/** Découpage des ZFU, CUCS etcs... **/
$fp = fopen(LOG_PATH.'/amabis.log', 'a');
fwrite($fp, date('d-m-Y H:i:s').' - '.implode("\n", $rep)."\n============================================================================\n");
fclose($fp);
$tabZones = explode(',',$rep['zonage']); // ZUS=OUI,NZUS=1127020,ZFU=OUI,NZFU=11270ZF,CUCS=OUI,NCUCS=1127020
foreach ($tabZones as $zone) {
$tabTmp = explode('=',$zone);
if (trim($tabTmp[0]) != '') {
$tabRep[$tabTmp[0]]=$tabTmp[1];
}
}
if (@$tabRep['ZUS']=='NSP') $tabRep['NZUS']='NSP';
if (@$tabRep['ZRU']=='NSP') $tabRep['NZRU']='NSP';
if (@$tabRep['ZFU']=='NSP') $tabRep['NZFU']='NSP';
if (@$tabRep['CUCS']=='NSP') $tabRep['NCUCS']='NSP';
$adresse=stripslashes(trim(preg_replace('/ +/',' ', "$adrNum $adrIndRep $adrTypeVoie $adrLibVoie")));
$ville=stripslashes($ville);
$tabRepTmp=array();
$tabTmp=explode('=',utf8_decode($rep['objdesc']));
//print_r($tabTmp);
//die();
$tabZones=array();
foreach ($tabTmp as $iZone=>$zone) {
$pos=strrpos($zone,',');
if ($iZone==0) {
$nomZoneSuiv=$zone;
continue;
}
$tabZones[$nomZoneSuiv]=substr($zone,0,$pos);
$nomZoneSuiv=substr($zone,$pos+1);
}
if (strtoupper(@trim($tabZones['ADR7']))=='FRANCE') $tabZones['ADR7']='';
$tabTmp=explode('|', $tabZones['VOIEA']);
$typeVoieAcourt=@trim($tabTmp[1]);
$tabInsert=array(
'address'=>$adresse,
'adr_cp'=>$cp,
'adr_ville'=>$ville,
'zus'=>@$tabRep['NZUS'],
'zru'=>@$tabRep['NZRU'],
'zfu'=>@$tabRep['NZFU'],
'cucs'=>@$tabRep['NCUCS'],
);
$tabUpdate=array(
'adrNum'=>$adrNum,
'adrIndRep'=>$adrIndRep,
'adrTypeVoie'=>$adrTypeVoie,
'adrLibVoie'=>$adrLibVoie,
'rivoli'=>$codeRivoli,
// Ajouté le 16/12/2013
'rnvpStatut' => substr($tabZones['STATUTC'],0,2),
'rnvpCorr' => substr($tabZones['STATUTC'],2,1),
'rnvpTrt' => trim(substr($tabZones['STATUTC'],3,2)),
'adr3' => @trim($tabZones['ADR3']),
'adr4' => @trim($tabZones['ADR4']),
'adr5' => @trim($tabZones['ADR5']),
'adr6' => @trim($tabZones['ADR6']),
'adr7' => trim($tabZones['ADR7']),
'numVoieA' => @trim($tabZones['NUM1']),
'indRepA' => @trim($tabZones['BTQC1']),
'typeVoieAlong' => @trim($tabZones['TYPVOIEL']),
'typeVoieAcourt' => $typeVoieAcourt,
'corpVoie' => @trim($tabZones['CORPSVOIE']),
'motDir' => @trim($tabZones['MOTDIR']),
'motDirD' => @trim($tabZones['MOTDIRD']),
'libVoieSec' => @trim($tabZones['VOIREFLIBS']),
'adr4n32' => @trim($tabZones['VOIREFLIBPOS']),
'adr4n38' => @trim($tabZones['VOIREFLIBPOS2']),
'clePostaleVoie' => @trim($tabZones['VOIREFCLEPOST']),
'secteur' => @trim($tabZones['SECTEUR']),
'cleRoutage' => @trim($tabZones['CLER']),
'cpx' => @trim($tabZones['CPX']),
'cleAd' => @trim($tabZones['CLEAD']),
'codPaysIso2' => @trim($tabZones['NATREFISO2']),
'codPaysIso3' => @trim($tabZones['NATREFISO3']),
'libPays' => @trim($tabZones['NATREFLIB']),
'codeInsee' => @trim($tabZones['LOCREFCLEO']),
'source' => 'Amabis',
);
$dateInsert=0;
if ($majForcee) {
$adresseL=addslashes($adresse);
$villeL=addslashes($ville);
$ret = $this->iDb->select('jo.zonage', 'dateInsert*1 as dateInsert', "address='$adresseL' AND adr_cp='$cp' AND adr_ville='$villeL'", false);
$dateInsert=@$ret[0]['dateInsert']*1;
$this->iDb->update('jo.zonage', array_merge($tabUpdate,array('dateInsert'=>$dateInsert)), "address='$adresseL' AND adr_cp='$cp' AND adr_ville='$villeL'", false);
//echo "Mise à jour de l'adresse du $dateInsert pour address='$adresseL' AND adr_cp='$cp' AND adr_ville='$villeL'".PHP_EOL;
}
if ($dateInsert==0) {
$this->iDb->insert('jo.zonage', array_merge($tabInsert,$tabUpdate), false);
//echo "Insertion de l'adresse (".$zones['rnvpStatut'].")!".PHP_EOL;
}
$tabTmp[0]=explode(',', $tabZones['LOCREFCLEP']);
$tabTmp[1]=explode(',', $tabZones['LOCREFCP']);
$tabTmp[2]=explode(',', $tabZones['LOCREFTYPP']);
$tabTmp[3]=explode(',', $tabZones['LOCREFLIBD']);
$tabTmp[4]=explode(',', $tabZones['LOCREFLIBD2']);
foreach($tabTmp[0] as $iCleP=>$cleP) {
$tabInsert = array(
'codeInsee' => @trim($tabZones['LOCREFCLEO']),
'villeLib' => @trim($tabZones['LOCREFLIBP']),
'villePopu' => @trim($tabZones['LOCREFPOP']),
'cleAchPost'=> $cleP,
'codePostal'=> $tabTmp[1][$iCleP],
'typePostal'=> $tabTmp[2][$iCleP],
'libAchP32' => @preg_replace('/^\//','',$tabTmp[3][$iCleP]),
'libAchP38' => @preg_replace('/^\//','',$tabTmp[4][$iCleP]),
'source' => 'Amabis',
'dateInsert'=> date('YmdHis'),
);
$this->iDb->insert('jo.villesCP', $tabInsert, false);
}
/** Autres Informations de la RNVP **/
if ($rnvp) {
$tabRep['ADR3'] = @trim($tabZones['ADR3']);
$tabRep['ADR4'] = @trim($tabZones['ADR4']);
$tabRep['ADR5'] = @trim($tabZones['ADR5']);
$tabRep['ADR6'] = @trim($tabZones['ADR6']);
$tabRep['ADR7'] = trim($tabZones['ADR7']);
}
} catch (SoapFault $fault) {
$fp = fopen(LOG_PATH.'/amabis.log', 'a');
fwrite($fp, date('d-m-Y H:i:s').' - ERREUR SOAP : Requete = '.$this->client->__getLastRequest()."\n Reponse = ".$this->client->__getLastResponse()."\n============================================================================\n");
fclose($fp);
}
//return $tabRep;
}
/** Zonages AFR et ZRR
**/
$codeInsee=substr($codeRivoli,0,5);
$ret = $this->iDb->select('jo.zonageInsee', 'typeZone, arreteDate, decretDate, decretNum, decretModifieDate, decretModifieNum, dateDebut, dateFin', "codeInsee='$codeInsee'",false, MYSQL_ASSOC);
$tabRep['ZRR']=$tabRep['AFR']='NON';
foreach ($ret as $zones)
switch ($zones['typeZone']) {
case 'ZRR': $tabRep['ZRR']='OUI'; $tabRep['NZRR']=$codeInsee; break;
case 'ZAFR': $tabRep['AFR']='OUI'; $tabRep['NAFR']=$codeInsee; break;
default: break;
}
return $tabRep;
}
public function searchByTelFax($tel)
{
return $this->getTelFax('','','','',$tel);
}
public function getTelFax($nom, $cp, $ville='', $prenom='', $tel='')
{
if (trim($tel) != '') {
$query = "<telep>$tel</telep><scoremini>10</scoremini><distinction>30</distinction>";
}
elseif (trim($prenom) == '') {
$query = "<rs>$nom</rs><cpville>$cp $ville</cpville><scoremini>90</scoremini><distinction>30</distinction>";
}
else {
$query = "<nom>$nom</nom><prenom>$prenom</prenom><cpville>$cp $ville</cpville><scoremini>90</scoremini><distinction>30</distinction>";
}
$rep = $this->client->rechtel($query);
$fp = fopen(LOG_PATH.'/amabis.log', 'a');
fwrite($fp, date('d-m-Y H:i:s')." - $query - ".implode("\n", $rep)."\n============================================================================\n");
fwrite($fp, "Requête : ".$this->client->__getLastRequest()."\n");
fwrite($fp, "Réponse : ".$this->client->__getLastResponse()."\n");
fclose($fp);
}
}
secteur, cleRoutage, cpx, cleAd, codPaysIso2, codPaysIso3, libPays, codeInsee',
"address='$adresse' AND adr_cp='$cp' AND adr_ville='$ville'", false, MYSQL_ASSOC);
if (count($ret) > 0) {
$zones = $ret[0];
if ($zones['rnvpStatut'] === null && $rnvp) {
$majForcee = true;
}
$tabRep['ZUS'] = $tabRep['ZFU'] = $tabRep['ZRU'] = $tabRep['CUCS'] = 'NON';
if (trim($zones['zus']) != '') {
if (trim($zones['zus']) == 'NSP') {
$tabRep['ZUS'] = 'NSP';
} else {
$tabRep['ZUS'] = 'OUI';
}
$tabRep['NZUS'] = $zones['zus'];
}
if (trim($zones['zru']) != '') {
if (trim($zones['zru']) == 'NSP') {
$tabRep['ZRU'] = 'NSP';
} else {
$tabRep['ZRU'] = 'OUI';
}
$tabRep['NZRU'] = $zones['zru'];
}
if (trim($zones['zfu']) != '') {
if (trim($zones['zfu']) == 'NSP') {
$tabRep['ZFU'] = 'NSP';
} else {
$tabRep['ZFU'] = 'OUI';
}
$tabRep['NZFU'] = $zones['zfu'];
}
if (trim($zones['cucs']) != '') {
if (trim($zones['cucs']) == 'NSP') {
$tabRep['CUCS'] = 'NSP';
} else {
$tabRep['CUCS'] = 'OUI';
}
$tabRep['NCUCS'] = $zones['cucs'];
}
/** Autres Informations de la RNVP **/
if ($rnvp) {
if (strtoupper(@trim($zones['adr7'])) == 'FRANCE') {
$zones['adr7'] = '';
}
$tabRep['ADR3'] = @trim($zones['adr3']);
$tabRep['ADR4'] = @trim($zones['adr4']);
$tabRep['ADR5'] = @trim($zones['adr5']);
$tabRep['ADR6'] = @trim($zones['adr6']);
$tabRep['ADR7'] = trim($zones['adr7']);
}
}
if (count($ret) == 0 || $majForcee) {
try {
// Le RNVP ne fonctionne pas sans la Raison Sociale qui est la 1ère ligne d'adresse
if (trim($raisonSociale) == '') {
$raisonSociale = 'TEST';
}
$rep = $this->client->zonage(
new SoapParam(strtr(
"$raisonSociale:$adresse:$cp:$ville",
'¿°ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûýýþÿ??',
' aaaaaaaceeeeiiiidnoooooouuuuybsaaaaaaaceeeeiiiidnoooooouuuyybyRr'), 'adresse'),
new SoapParam(':', 'separateur'),
new SoapParam('type=M', 'options')
);
/** Découpage des ZFU, CUCS etcs... **/
$fp = fopen(LOG_PATH.'/amabis.log', 'a');
fwrite($fp, date('d-m-Y H:i:s').' - '.implode("\n", $rep)."\n============================================================================\n");
fclose($fp);
$tabZones = explode(',', $rep['zonage']); // ZUS=OUI,NZUS=1127020,ZFU=OUI,NZFU=11270ZF,CUCS=OUI,NCUCS=1127020
foreach ($tabZones as $zone) {
$tabTmp = explode('=', $zone);
if (trim($tabTmp[0]) != '') {
$tabRep[$tabTmp[0]]=$tabTmp[1];
}
}
if (@$tabRep['ZUS']=='NSP') {
$tabRep['NZUS']='NSP';
}
if (@$tabRep['ZRU']=='NSP') {
$tabRep['NZRU']='NSP';
}
if (@$tabRep['ZFU']=='NSP') {
$tabRep['NZFU']='NSP';
}
if (@$tabRep['CUCS']=='NSP') {
$tabRep['NCUCS']='NSP';
}
$adresse=stripslashes(trim(preg_replace('/ +/', ' ', "$adrNum $adrIndRep $adrTypeVoie $adrLibVoie")));
$ville=stripslashes($ville);
$tabRepTmp=array();
$tabTmp=explode('=', utf8_decode($rep['objdesc']));
//print_r($tabTmp);
//die();
$tabZones=array();
foreach ($tabTmp as $iZone=>$zone) {
$pos=strrpos($zone, ',');
if ($iZone==0) {
$nomZoneSuiv=$zone;
continue;
}
$tabZones[$nomZoneSuiv]=substr($zone, 0, $pos);
$nomZoneSuiv=substr($zone, $pos+1);
}
if (strtoupper(@trim($tabZones['ADR7']))=='FRANCE') {
$tabZones['ADR7']='';
}
$tabTmp=explode('|', $tabZones['VOIEA']);
$typeVoieAcourt=@trim($tabTmp[1]);
$tabInsert=array(
'address'=>$adresse,
'adr_cp'=>$cp,
'adr_ville'=>$ville,
'zus'=>@$tabRep['NZUS'],
'zru'=>@$tabRep['NZRU'],
'zfu'=>@$tabRep['NZFU'],
'cucs'=>@$tabRep['NCUCS'],
);
$tabUpdate=array(
'adrNum'=>$adrNum,
'adrIndRep'=>$adrIndRep,
'adrTypeVoie'=>$adrTypeVoie,
'adrLibVoie'=>$adrLibVoie,
'rivoli'=>$codeRivoli,
// Ajouté le 16/12/2013
'rnvpStatut' => substr($tabZones['STATUTC'], 0, 2),
'rnvpCorr' => substr($tabZones['STATUTC'], 2, 1),
'rnvpTrt' => trim(substr($tabZones['STATUTC'], 3, 2)),
'adr3' => @trim($tabZones['ADR3']),
'adr4' => @trim($tabZones['ADR4']),
'adr5' => @trim($tabZones['ADR5']),
'adr6' => @trim($tabZones['ADR6']),
'adr7' => trim($tabZones['ADR7']),
'numVoieA' => @trim($tabZones['NUM1']),
'indRepA' => @trim($tabZones['BTQC1']),
'typeVoieAlong' => @trim($tabZones['TYPVOIEL']),
'typeVoieAcourt' => $typeVoieAcourt,
'corpVoie' => @trim($tabZones['CORPSVOIE']),
'motDir' => @trim($tabZones['MOTDIR']),
'motDirD' => @trim($tabZones['MOTDIRD']),
'libVoieSec' => @trim($tabZones['VOIREFLIBS']),
'adr4n32' => @trim($tabZones['VOIREFLIBPOS']),
'adr4n38' => @trim($tabZones['VOIREFLIBPOS2']),
'clePostaleVoie' => @trim($tabZones['VOIREFCLEPOST']),
'secteur' => @trim($tabZones['SECTEUR']),
'cleRoutage' => @trim($tabZones['CLER']),
'cpx' => @trim($tabZones['CPX']),
'cleAd' => @trim($tabZones['CLEAD']),
'codPaysIso2' => @trim($tabZones['NATREFISO2']),
'codPaysIso3' => @trim($tabZones['NATREFISO3']),
'libPays' => @trim($tabZones['NATREFLIB']),
'codeInsee' => @trim($tabZones['LOCREFCLEO']),
'source' => 'Amabis',
);
$dateInsert=0;
if ($majForcee) {
$adresseL=addslashes($adresse);
$villeL=addslashes($ville);
$ret = $this->iDb->select('jo.zonage', 'dateInsert*1 as dateInsert', "address='$adresseL' AND adr_cp='$cp' AND adr_ville='$villeL'", false);
$dateInsert=@$ret[0]['dateInsert']*1;
$this->iDb->update('jo.zonage', array_merge($tabUpdate, array('dateInsert'=>$dateInsert)), "address='$adresseL' AND adr_cp='$cp' AND adr_ville='$villeL'", false);
//echo "Mise à jour de l'adresse du $dateInsert pour address='$adresseL' AND adr_cp='$cp' AND adr_ville='$villeL'".PHP_EOL;
}
if ($dateInsert==0) {
$this->iDb->insert('jo.zonage', array_merge($tabInsert, $tabUpdate), false);
//echo "Insertion de l'adresse (".$zones['rnvpStatut'].")!".PHP_EOL;
}
$tabTmp[0]=explode(',', $tabZones['LOCREFCLEP']);
$tabTmp[1]=explode(',', $tabZones['LOCREFCP']);
$tabTmp[2]=explode(',', $tabZones['LOCREFTYPP']);
$tabTmp[3]=explode(',', $tabZones['LOCREFLIBD']);
$tabTmp[4]=explode(',', $tabZones['LOCREFLIBD2']);
foreach ($tabTmp[0] as $iCleP=>$cleP) {
$tabInsert = array(
'codeInsee' => @trim($tabZones['LOCREFCLEO']),
'villeLib' => @trim($tabZones['LOCREFLIBP']),
'villePopu' => @trim($tabZones['LOCREFPOP']),
'cleAchPost'=> $cleP,
'codePostal'=> $tabTmp[1][$iCleP],
'typePostal'=> $tabTmp[2][$iCleP],
'libAchP32' => @preg_replace('/^\//', '', $tabTmp[3][$iCleP]),
'libAchP38' => @preg_replace('/^\//', '', $tabTmp[4][$iCleP]),
'source' => 'Amabis',
'dateInsert'=> date('YmdHis'),
);
$this->iDb->insert('jo.villesCP', $tabInsert, false);
}
/** Autres Informations de la RNVP **/
if ($rnvp) {
$tabRep['ADR3'] = @trim($tabZones['ADR3']);
$tabRep['ADR4'] = @trim($tabZones['ADR4']);
$tabRep['ADR5'] = @trim($tabZones['ADR5']);
$tabRep['ADR6'] = @trim($tabZones['ADR6']);
$tabRep['ADR7'] = trim($tabZones['ADR7']);
}
} catch (SoapFault $fault) {
$fp = fopen(LOG_PATH.'/amabis.log', 'a');
fwrite($fp, date('d-m-Y H:i:s').' - ERREUR SOAP : Requete = '.$this->client->__getLastRequest()."\n Reponse = ".$this->client->__getLastResponse()."\n============================================================================\n");
fclose($fp);
}
//return $tabRep;
}
/** Zonages AFR et ZRR
**/
$codeInsee=substr($codeRivoli, 0, 5);
$ret = $this->iDb->select('jo.zonageInsee', 'typeZone, arreteDate, decretDate, decretNum, decretModifieDate, decretModifieNum, dateDebut, dateFin', "codeInsee='$codeInsee'", false, MYSQL_ASSOC);
$tabRep['ZRR']=$tabRep['AFR']='NON';
foreach ($ret as $zones) {
switch ($zones['typeZone']) {
case 'ZRR': $tabRep['ZRR']='OUI'; $tabRep['NZRR']=$codeInsee; break;
case 'ZAFR': $tabRep['AFR']='OUI'; $tabRep['NAFR']=$codeInsee; break;
default: break;
}
}
return $tabRep;
}
public function searchByTelFax($tel)
{
return $this->getTelFax('', '', '', '', $tel);
}
public function getTelFax($nom, $cp, $ville='', $prenom='', $tel='')
{
if (trim($tel) != '') {
$query = "<telep>$tel</telep><scoremini>10</scoremini><distinction>30</distinction>";
} elseif (trim($prenom) == '') {
$query = "<rs>$nom</rs><cpville>$cp $ville</cpville><scoremini>90</scoremini><distinction>30</distinction>";
} else {
$query = "<nom>$nom</nom><prenom>$prenom</prenom><cpville>$cp $ville</cpville><scoremini>90</scoremini><distinction>30</distinction>";
}
$rep = $this->client->rechtel($query);
$fp = fopen(LOG_PATH.'/amabis.log', 'a');
fwrite($fp, date('d-m-Y H:i:s')." - $query - ".implode("\n", $rep)."\n============================================================================\n");
fwrite($fp, "Requête : ".$this->client->__getLastRequest()."\n");
fwrite($fp, "Réponse : ".$this->client->__getLastResponse()."\n");
fclose($fp);
}
}

View File

@ -1,310 +1,308 @@
<?php
define ('ARTISANAT_DISPO_WEB', 1);
require_once 'framework/common/curl.php';
class Metier_Partenaires_MArtisanat
{
public $body = '';
public $header = '';
public $codeRetour = 0;
public $referer='';
public $libErreur='';
public $cookie='';
public $iDb;
protected $remote = false;
public function __construct()
{
$this->iDb = new Metier_Util_Db();
}
/**
* Active la récupération des données distantes
*/
public function setRemote()
{
$this->remote = true;
}
public function getIdentite($siren)
{
$siren = $siren * 1;
$res = $this->iDb->select('jo.artisanat', 'id, siren, actif, numRM, denomination, sigle, nomCommercial, enseigne, fj, effectif, aprm, debutActivite, activite, adresse, cp, ville, cessation, radiation, nbInscriptions, nom, prenom, nomUsage, dateNaiss, lieuNaiss, natio, qualite, qualif, dateQualif, dateFctDeb, dateFctFin, IF(dateInsert>dateUpdate,dateInsert,dateUpdate) AS dateUpdate', "siren=$siren", false, MYSQL_ASSOC);
if (count($res)>0 && !$this->remote) {
$tabInsert = $res[0];
} elseif (ARTISANAT_DISPO_WEB) {
$tabInsert = $this->getRemoteIdentite();
}
return $tabInsert;
}
public function getRemoteIdentite()
{
$url = 'http://www.cma-paris.fr/CMP/rm_recherche.php?dom=Gerer&fonction=recherche';
$page = getUrl($url, '', '', $this->referer, false, 'www.cma-paris.fr', false, '', '', 21);
$this->body = $page['body'];
$this->codeRetour = $page['code'];
if ($this->codeRetour != '200') {
$this->libErreur = 'Erreur Artisanat 200a !';
return false;
}
$this->cookie = $page['header']['Set-Cookie'];
$this->referer = $url;
$url = 'http://www.cma-paris.fr/CMP/rm_recherche.php?dom=Gerer&fonction=cherche';
$postData = array(
'siren_op' => '%3D',
'siren' => $siren,
'den_rent_op' => '%25',
'den_rent' => '',
'adresse_op' => 'contient',
'adresse' => '',
'bde_rent_op' => '%25',
'bde_rent' => '',
'nom_rdir_op' => '%25',
'nom_rdir' => '',
'pren_rdir_op' => '%25',
'pren_rdir' => '',
'table' => 'rentreprise',//'rentrad',
'x' => 56,
'y' => 14,
);
sleep(rand(1, 2));
$page = getUrl($url, $this->cookie, $postData, $this->referer, false, 'www.cma-paris.fr', false, '', '', 21);
$this->body = $page['body'];
$this->codeRetour = $page['code'];
if ($this->codeRetour != '200') {
$this->libErreur = 'Erreur Artisanat 200b !';
return false;
}
$this->referer = $url;
if (preg_match('/<span.class="rouge">aucune.entreprise.ne.correspond(?:.*)vos.crit(?:.*)de.recherche<\/span>/Uis', $this->body, $matches)) {
$url = 'http://www.cma-paris.fr/CMP/rm_recherche.php?dom=Gerer&fonction=cherche';
$postData = array(
'siren_op' => '%3D',
'siren' => $siren,
'den_rent_op' => '%25',
'den_rent' => '',
'adresse_op' => 'contient',
'adresse' => '',
'bde_rent_op' => '%25',
'bde_rent' => '',
'nom_rdir_op' => '%25',
'nom_rdir' => '',
'pren_rdir_op' => '%25',
'pren_rdir' => '',
'table' => 'rentrad',
'x' => 56,
'y' => 14,
);
sleep(rand(1, 2));
$page=getUrl($url, $this->cookie, $postData, $this->referer, false, 'www.cma-paris.fr', false, '', '', 21);
$this->body = $page['body'];
$this->codeRetour = $page['code'];
if ($this->codeRetour != '200') {
$this->libErreur='Erreur Artisanat 200c !';
return false;
}
$this->referer=$url;
}
/** Gestion des multi-inscriptions au RM **/
if (preg_match('/<b class="gris">(.*)entreprises.correspondent(?:.*)vos.crit(?:.*)de.recherche<\/span>/Uis', $this->body, $matches)) {
$nbRep = trim($matches[1])*1;
$iRadMax = -1;
if (preg_match_all('/<a class="turquoise" href="(rm\.php\?dom=Gerer&amp;fonction=dossier&amp;(.*))">/Uis', $this->body, $matches)) {
$tabUrls = array_unique($matches[1]);
$anRadMax = 0;
// Recherche de la dernière inscription
foreach ($tabUrls as $iUrl => $url) {
// On prend la dernière inscription
$tabTmp = explode('&amp;',$url);
if (substr($tabTmp[3],0,8) == 'an_rera=') {
$anRad=substr($tabTmp[3],8);
if ($anRad > $anRadMax) {
$anRadMax = $anRad;
$iRadMax = $iUrl;
}
}
}
}
if ($iRadMax==-1) die('$iRadMax==-1 Cas impossible !'.PHP_EOL.print_r($tabUrls,true).PHP_EOL.print_r($matches,true));
// Accès à la dernière fiche
$url = 'http://www.cma-paris.fr/CMP/'.strtr(trim($tabUrls[$iRadMax]),array('&amp;'=>'&'));
sleep(rand(1, 2));
$page = getUrl($url, $this->cookie, '', $this->referer, false, 'www.cma-paris.fr', false, '', '', 21);
$this->body = $page['body'];
$this->codeRetour = $page['code'];
if ($this->codeRetour != '200') {
$this->libErreur = 'Erreur Artisanat 200c !';
return false;
}
$this->referer = $url;
}
$tabInsert = array();
if (preg_match('/n&deg; d\'identification \(SIREN\)<\/span><\/td>(?:.*)<td align="left" nowrap>(.*)&nbsp;<\/td>((?:.*)n&deg; de gestion rm<\/span><\/td>(?:.*)<td align="left" nowrap>(.*)<\/td>)?/Uis', $this->body, $matches)) {
$sirenLu = $matches[1]*1;
if ($siren == $sirenLu) {
$tabInsert['siren'] = $matches[1];
$tabInsert['numRM'] = @$matches[2];
}
else {
$this->libErreur = 'Erreur Siren $sirenLu<>$siren !';
return false;
}
}
elseif (preg_match('/<span class="rouge">aucune entreprise ne correspond &agrave; vos crit&egrave;res de recherche<\/span>/Uis', $this->body, $matches)) {
$this->libErreur = 'Erreur Artisan absent de la base Artisanat !';
return false;
}
else {
$this->libErreur = 'Erreur Siren absent dans la page !';
return false;
}
$actif = null;
if (preg_match("/Renseignements.relatif(?:.*)entreprise(.*)<\/b>/Uis", $this->body, $matches)) {
switch (trim(strtr($matches[1],array(chr(160)=>'')))) {
case 'en activit&eacute;': $actif = 1; break;
case 'radi&eacute;e': $actif = 0; break;
default: print_r($matches); die(); break;
}
}
$tabInsert['actif'] = $actif;
if ($actif === null) {
$this->libErreur = 'Erreur Actif/Radié non trouvé !';
return false;
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">d&eacute;nomination<\/span><\/td>(?:.*)<td align="left" colspan="5">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['denomination'] = $matches[1];
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">d&eacute;nomination<\/span><\/td>(?:.*)<td align="left" colspan="5">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['denomination']=$matches[1];
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">sigle<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['sigle']=$matches[1];
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">&nbsp;nom&nbsp;commercial<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['nomCommercial']=$matches[1];
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">enseigne<\/span><\/td>(?:.*)<td align="left" colspan="4">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['enseigne']=$matches[1];
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">forme&nbsp;juridique<\/span><\/td>(?:.*)<td align="left" colspan="5">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['fj']=$matches[1];
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">effectif<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['effectif']=$matches[1];
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">code APRM<\/span><\/td>(?:.*)<td align="left">(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['aprm']=$matches[1];
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">d&eacute;but&nbsp;d\'activit&eacute;<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['debutActivite']=Metier_Util_Date::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches[1]),chr(160),' ')));
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">&nbsp;activit&eacute;\(s\) exerc&eacute;e\(s\) donnant lieu &agrave; immatriculation<\/span>(?:.*)<td colspan="5">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['activite']=trim($matches[1]);
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">adresse&nbsp;de&nbsp;l\'entreprise<\/span><\/td>(?:.*)<td align="left" colspan="5">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['adresse']=trim($matches[1]);
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">code postal<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['cp']=trim($matches[1]);
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">ville<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['ville']=trim($matches[1]);
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">cessation d\'activit&eacute;<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['cessation']=Metier_Util_Date::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches[1]),chr(160),' ')));
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">radiation du RM<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['radiation']=Metier_Util_Date::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches[1]),chr(160),' ')));
}
$tabEtabs=array();
if (preg_match('/<!--deb Etablissements secondaires-->(?:.*)<b class="gris">Aucune inscription compl&eacute;mentaire<\/b>(?:.*)<!--fin Etablissements secondaires-->/Uis', $this->body, $matches)) {
$tabInsert['nbInscriptions']=0;
}
elseif (preg_match('/<!--deb Etablissements secondaires-->(?:.*)<b class="gris">Inscription compl&eacute;mentaire<\/b>(.*)<!--fin Etablissements secondaires-->/Uis', $this->body, $matches)) {
$tabInsert['nbInscriptions']=0;
if (preg_match_all('/<tr>(?:.*)<td><img alt="" src="inter\/pixtrans\.gif" width="30" height="1"><\/td>(?:.*)<td nowrap>(?:.*)<!-- adresse -->(.*)<\/td>(?:.*)<td nowrap>(?:.*)<!-- code postal et ville -->(.*)<\/td>(?:.*)<td nowrap>(?:.*)<!-- enseigne -->(.*)<\/td>(?:.*)<td>(?:.*)<!-- debut activite -->(.*)<\/td>(?:.*)<td>(?:.*)<!-- fin activite -->(.*)<\/td>(?:.*)<\/tr>/Uis', $matches[1], $matches2)) {
foreach ($matches2[1] as $i=>$adresse) {
$tabEtabs[$i]['siren'] = $siren;
$tabEtabs[$i]['num'] = $i;
$tabEtabs[$i]['adresse'] = trim(strtr(html_entity_decode($adresse),chr(160),' '));
$tabEtabs[$i]['cpVille'] = trim(strtr(html_entity_decode($matches2[2][$i]),chr(160),' '));
$tabEtabs[$i]['enseigne']= trim(strtr(html_entity_decode($matches2[3][$i]),chr(160),' '));
$tabEtabs[$i]['actDeb'] = Metier_Util_Date::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches2[4][$i]),chr(160),' ')));
$tabEtabs[$i]['actFin'] = Metier_Util_Date::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches2[5][$i]),chr(160),' ')));
$tabInsert['nbInscriptions']++;
}
}
}
/** Informations sur la Personne Physique **/
if (preg_match('/<a class="turquoise" href="(rm\.php\?dom=Gerer&amp;fonction=dirigeant&amp;dept_re(.*))" onclick="window\.open\(this\.href/Uis', $this->body, $matches)) {
$urlDir='http://www.cma-paris.fr/CMP/'.strtr(trim($matches[1]),array('&amp;'=>'&'));
//die($urlDir);
sleep(rand(1, 2));
$page = getUrl($urlDir, $this->cookie, '', $this->referer, false, 'www.cma-paris.fr', false, '', '', 21);
$this->body = $page['body'];
$this->codeRetour = $page['code'];
if ($this->codeRetour != '200') {
$this->libErreur = 'Erreur Artisanat 200d !';
return false;
}
$this->referer = $url;
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">nom<\/span><\/td>(?:.*)<td align="left" nowrap>(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['nom']=trim(strtr(html_entity_decode($matches[1]),chr(160),' '));
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">pr&eacute;nom<\/span><\/td>(?:.*)<td align="left" nowrap>(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['prenom']=trim(strtr(html_entity_decode($matches[1]),chr(160),' '));
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">nom d\'usage<\/span><\/td>(?:.*)<td align="left" nowrap>(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['nomUsage']=trim(strtr(html_entity_decode($matches[1]),chr(160),' '));
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"(?:.*)<span class="turquoise">&nbsp;date&nbsp;de&nbsp;naissance<\/span><\/td>(?:.*)-->(?:.*)<td(?: +)align="left">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['dateNaiss']=Metier_Util_Date::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches[1]),chr(160),' ')));
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">&nbsp;lieu&nbsp;de&nbsp;naissance<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['lieuNaiss']=trim(strtr(html_entity_decode($matches[1]),chr(160),' '));
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">nationalit&eacute;<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['natio']=trim(strtr(html_entity_decode($matches[1]),chr(160),' '));
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">qualit&eacute;<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['qualite']=trim(strtr(html_entity_decode($matches[1]),chr(160),' '));
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right" nowrap><span class="turquoise">qualification&nbsp;artisanale<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['qualif']=trim(strtr(html_entity_decode($matches[1]),chr(160),' '));
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">date&nbsp;d\'obtention<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['datequalif']=Metier_Util_Date::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches[1]),chr(160),' ')));
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">prise de fonction<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['dateFctDeb']=Metier_Util_Date::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches[1]),chr(160),' ')));
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">fin de fonction<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['dateFctFin']=Metier_Util_Date::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches[1]),chr(160),' ')));
}
}
// Insertion en base de données
$tabInsert['dateInsert'] = date('Y-m-d H:i:s');
$id = $this->iDb->insert('jo.artisanat', $tabInsert, true);
$tabInsert['id'] = $id;
foreach ($tabEtabs as $tabInsert2) {
$tabInsert2['dateInsert'] = $tabInsert['dateInsert'];
$id2 = $this->iDb->insert('jo.artisanat_etab', $tabInsert2, true);
}
$tabInsert['dateUpdate'] = substr($tabInsert['dateInsert'],0,10);
unset($tabInsert['dateInsert']);
return $tabInsert;
}
}
<?php
define('ARTISANAT_DISPO_WEB', 1);
require_once 'framework/common/curl.php';
class Metier_Partenaires_MArtisanat
{
public $body = '';
public $header = '';
public $codeRetour = 0;
public $referer='';
public $libErreur='';
public $cookie='';
public $iDb;
protected $remote = false;
public function __construct()
{
$this->iDb = new Metier_Util_Db();
}
/**
* Active la récupération des données distantes
*/
public function setRemote()
{
$this->remote = true;
}
public function getIdentite($siren)
{
$siren = $siren * 1;
$res = $this->iDb->select('jo.artisanat', 'id, siren, actif, numRM, denomination, sigle, nomCommercial, enseigne, fj, effectif, aprm, debutActivite, activite, adresse, cp, ville, cessation, radiation, nbInscriptions, nom, prenom, nomUsage, dateNaiss, lieuNaiss, natio, qualite, qualif, dateQualif, dateFctDeb, dateFctFin, IF(dateInsert>dateUpdate,dateInsert,dateUpdate) AS dateUpdate', "siren=$siren", false, MYSQL_ASSOC);
if (count($res)>0 && !$this->remote) {
$tabInsert = $res[0];
} elseif (ARTISANAT_DISPO_WEB) {
$tabInsert = $this->getRemoteIdentite();
}
return $tabInsert;
}
public function getRemoteIdentite()
{
$url = 'http://www.cma-paris.fr/CMP/rm_recherche.php?dom=Gerer&fonction=recherche';
$page = getUrl($url, '', '', $this->referer, false, 'www.cma-paris.fr', false, '', '', 21);
$this->body = $page['body'];
$this->codeRetour = $page['code'];
if ($this->codeRetour != '200') {
$this->libErreur = 'Erreur Artisanat 200a !';
return false;
}
$this->cookie = $page['header']['Set-Cookie'];
$this->referer = $url;
$url = 'http://www.cma-paris.fr/CMP/rm_recherche.php?dom=Gerer&fonction=cherche';
$postData = array(
'siren_op' => '%3D',
'siren' => $siren,
'den_rent_op' => '%25',
'den_rent' => '',
'adresse_op' => 'contient',
'adresse' => '',
'bde_rent_op' => '%25',
'bde_rent' => '',
'nom_rdir_op' => '%25',
'nom_rdir' => '',
'pren_rdir_op' => '%25',
'pren_rdir' => '',
'table' => 'rentreprise',//'rentrad',
'x' => 56,
'y' => 14,
);
sleep(rand(1, 2));
$page = getUrl($url, $this->cookie, $postData, $this->referer, false, 'www.cma-paris.fr', false, '', '', 21);
$this->body = $page['body'];
$this->codeRetour = $page['code'];
if ($this->codeRetour != '200') {
$this->libErreur = 'Erreur Artisanat 200b !';
return false;
}
$this->referer = $url;
if (preg_match('/<span.class="rouge">aucune.entreprise.ne.correspond(?:.*)vos.crit(?:.*)de.recherche<\/span>/Uis', $this->body, $matches)) {
$url = 'http://www.cma-paris.fr/CMP/rm_recherche.php?dom=Gerer&fonction=cherche';
$postData = array(
'siren_op' => '%3D',
'siren' => $siren,
'den_rent_op' => '%25',
'den_rent' => '',
'adresse_op' => 'contient',
'adresse' => '',
'bde_rent_op' => '%25',
'bde_rent' => '',
'nom_rdir_op' => '%25',
'nom_rdir' => '',
'pren_rdir_op' => '%25',
'pren_rdir' => '',
'table' => 'rentrad',
'x' => 56,
'y' => 14,
);
sleep(rand(1, 2));
$page=getUrl($url, $this->cookie, $postData, $this->referer, false, 'www.cma-paris.fr', false, '', '', 21);
$this->body = $page['body'];
$this->codeRetour = $page['code'];
if ($this->codeRetour != '200') {
$this->libErreur='Erreur Artisanat 200c !';
return false;
}
$this->referer=$url;
}
/** Gestion des multi-inscriptions au RM **/
if (preg_match('/<b class="gris">(.*)entreprises.correspondent(?:.*)vos.crit(?:.*)de.recherche<\/span>/Uis', $this->body, $matches)) {
$nbRep = trim($matches[1])*1;
$iRadMax = -1;
if (preg_match_all('/<a class="turquoise" href="(rm\.php\?dom=Gerer&amp;fonction=dossier&amp;(.*))">/Uis', $this->body, $matches)) {
$tabUrls = array_unique($matches[1]);
$anRadMax = 0;
// Recherche de la dernière inscription
foreach ($tabUrls as $iUrl => $url) {
// On prend la dernière inscription
$tabTmp = explode('&amp;', $url);
if (substr($tabTmp[3], 0, 8) == 'an_rera=') {
$anRad=substr($tabTmp[3], 8);
if ($anRad > $anRadMax) {
$anRadMax = $anRad;
$iRadMax = $iUrl;
}
}
}
}
if ($iRadMax==-1) {
die('$iRadMax==-1 Cas impossible !'.PHP_EOL.print_r($tabUrls, true).PHP_EOL.print_r($matches, true));
}
// Accès à la dernière fiche
$url = 'http://www.cma-paris.fr/CMP/'.strtr(trim($tabUrls[$iRadMax]), array('&amp;'=>'&'));
sleep(rand(1, 2));
$page = getUrl($url, $this->cookie, '', $this->referer, false, 'www.cma-paris.fr', false, '', '', 21);
$this->body = $page['body'];
$this->codeRetour = $page['code'];
if ($this->codeRetour != '200') {
$this->libErreur = 'Erreur Artisanat 200c !';
return false;
}
$this->referer = $url;
}
$tabInsert = array();
if (preg_match('/n&deg; d\'identification \(SIREN\)<\/span><\/td>(?:.*)<td align="left" nowrap>(.*)&nbsp;<\/td>((?:.*)n&deg; de gestion rm<\/span><\/td>(?:.*)<td align="left" nowrap>(.*)<\/td>)?/Uis', $this->body, $matches)) {
$sirenLu = $matches[1]*1;
if ($siren == $sirenLu) {
$tabInsert['siren'] = $matches[1];
$tabInsert['numRM'] = @$matches[2];
} else {
$this->libErreur = 'Erreur Siren $sirenLu<>$siren !';
return false;
}
} elseif (preg_match('/<span class="rouge">aucune entreprise ne correspond &agrave; vos crit&egrave;res de recherche<\/span>/Uis', $this->body, $matches)) {
$this->libErreur = 'Erreur Artisan absent de la base Artisanat !';
return false;
} else {
$this->libErreur = 'Erreur Siren absent dans la page !';
return false;
}
$actif = null;
if (preg_match("/Renseignements.relatif(?:.*)entreprise(.*)<\/b>/Uis", $this->body, $matches)) {
switch (trim(strtr($matches[1], array(chr(160)=>'')))) {
case 'en activit&eacute;': $actif = 1; break;
case 'radi&eacute;e': $actif = 0; break;
default: print_r($matches); die(); break;
}
}
$tabInsert['actif'] = $actif;
if ($actif === null) {
$this->libErreur = 'Erreur Actif/Radié non trouvé !';
return false;
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">d&eacute;nomination<\/span><\/td>(?:.*)<td align="left" colspan="5">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['denomination'] = $matches[1];
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">d&eacute;nomination<\/span><\/td>(?:.*)<td align="left" colspan="5">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['denomination']=$matches[1];
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">sigle<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['sigle']=$matches[1];
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">&nbsp;nom&nbsp;commercial<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['nomCommercial']=$matches[1];
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">enseigne<\/span><\/td>(?:.*)<td align="left" colspan="4">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['enseigne']=$matches[1];
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">forme&nbsp;juridique<\/span><\/td>(?:.*)<td align="left" colspan="5">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['fj']=$matches[1];
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">effectif<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['effectif']=$matches[1];
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">code APRM<\/span><\/td>(?:.*)<td align="left">(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['aprm']=$matches[1];
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">d&eacute;but&nbsp;d\'activit&eacute;<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['debutActivite']=Metier_Util_Date::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches[1]), chr(160), ' ')));
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">&nbsp;activit&eacute;\(s\) exerc&eacute;e\(s\) donnant lieu &agrave; immatriculation<\/span>(?:.*)<td colspan="5">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['activite']=trim($matches[1]);
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">adresse&nbsp;de&nbsp;l\'entreprise<\/span><\/td>(?:.*)<td align="left" colspan="5">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['adresse']=trim($matches[1]);
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">code postal<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['cp']=trim($matches[1]);
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">ville<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['ville']=trim($matches[1]);
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">cessation d\'activit&eacute;<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['cessation']=Metier_Util_Date::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches[1]), chr(160), ' ')));
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">radiation du RM<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['radiation']=Metier_Util_Date::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches[1]), chr(160), ' ')));
}
$tabEtabs=array();
if (preg_match('/<!--deb Etablissements secondaires-->(?:.*)<b class="gris">Aucune inscription compl&eacute;mentaire<\/b>(?:.*)<!--fin Etablissements secondaires-->/Uis', $this->body, $matches)) {
$tabInsert['nbInscriptions']=0;
} elseif (preg_match('/<!--deb Etablissements secondaires-->(?:.*)<b class="gris">Inscription compl&eacute;mentaire<\/b>(.*)<!--fin Etablissements secondaires-->/Uis', $this->body, $matches)) {
$tabInsert['nbInscriptions']=0;
if (preg_match_all('/<tr>(?:.*)<td><img alt="" src="inter\/pixtrans\.gif" width="30" height="1"><\/td>(?:.*)<td nowrap>(?:.*)<!-- adresse -->(.*)<\/td>(?:.*)<td nowrap>(?:.*)<!-- code postal et ville -->(.*)<\/td>(?:.*)<td nowrap>(?:.*)<!-- enseigne -->(.*)<\/td>(?:.*)<td>(?:.*)<!-- debut activite -->(.*)<\/td>(?:.*)<td>(?:.*)<!-- fin activite -->(.*)<\/td>(?:.*)<\/tr>/Uis', $matches[1], $matches2)) {
foreach ($matches2[1] as $i=>$adresse) {
$tabEtabs[$i]['siren'] = $siren;
$tabEtabs[$i]['num'] = $i;
$tabEtabs[$i]['adresse'] = trim(strtr(html_entity_decode($adresse), chr(160), ' '));
$tabEtabs[$i]['cpVille'] = trim(strtr(html_entity_decode($matches2[2][$i]), chr(160), ' '));
$tabEtabs[$i]['enseigne']= trim(strtr(html_entity_decode($matches2[3][$i]), chr(160), ' '));
$tabEtabs[$i]['actDeb'] = Metier_Util_Date::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches2[4][$i]), chr(160), ' ')));
$tabEtabs[$i]['actFin'] = Metier_Util_Date::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches2[5][$i]), chr(160), ' ')));
$tabInsert['nbInscriptions']++;
}
}
}
/** Informations sur la Personne Physique **/
if (preg_match('/<a class="turquoise" href="(rm\.php\?dom=Gerer&amp;fonction=dirigeant&amp;dept_re(.*))" onclick="window\.open\(this\.href/Uis', $this->body, $matches)) {
$urlDir='http://www.cma-paris.fr/CMP/'.strtr(trim($matches[1]), array('&amp;'=>'&'));
//die($urlDir);
sleep(rand(1, 2));
$page = getUrl($urlDir, $this->cookie, '', $this->referer, false, 'www.cma-paris.fr', false, '', '', 21);
$this->body = $page['body'];
$this->codeRetour = $page['code'];
if ($this->codeRetour != '200') {
$this->libErreur = 'Erreur Artisanat 200d !';
return false;
}
$this->referer = $url;
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">nom<\/span><\/td>(?:.*)<td align="left" nowrap>(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['nom']=trim(strtr(html_entity_decode($matches[1]), chr(160), ' '));
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">pr&eacute;nom<\/span><\/td>(?:.*)<td align="left" nowrap>(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['prenom']=trim(strtr(html_entity_decode($matches[1]), chr(160), ' '));
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">nom d\'usage<\/span><\/td>(?:.*)<td align="left" nowrap>(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['nomUsage']=trim(strtr(html_entity_decode($matches[1]), chr(160), ' '));
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"(?:.*)<span class="turquoise">&nbsp;date&nbsp;de&nbsp;naissance<\/span><\/td>(?:.*)-->(?:.*)<td(?: +)align="left">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['dateNaiss']=Metier_Util_Date::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches[1]), chr(160), ' ')));
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">&nbsp;lieu&nbsp;de&nbsp;naissance<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['lieuNaiss']=trim(strtr(html_entity_decode($matches[1]), chr(160), ' '));
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">nationalit&eacute;<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['natio']=trim(strtr(html_entity_decode($matches[1]), chr(160), ' '));
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">qualit&eacute;<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['qualite']=trim(strtr(html_entity_decode($matches[1]), chr(160), ' '));
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right" nowrap><span class="turquoise">qualification&nbsp;artisanale<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['qualif']=trim(strtr(html_entity_decode($matches[1]), chr(160), ' '));
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">date&nbsp;d\'obtention<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['datequalif']=Metier_Util_Date::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches[1]), chr(160), ' ')));
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">prise de fonction<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['dateFctDeb']=Metier_Util_Date::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches[1]), chr(160), ' ')));
}
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">fin de fonction<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabInsert['dateFctFin']=Metier_Util_Date::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches[1]), chr(160), ' ')));
}
}
// Insertion en base de données
$tabInsert['dateInsert'] = date('Y-m-d H:i:s');
$id = $this->iDb->insert('jo.artisanat', $tabInsert, true);
$tabInsert['id'] = $id;
foreach ($tabEtabs as $tabInsert2) {
$tabInsert2['dateInsert'] = $tabInsert['dateInsert'];
$id2 = $this->iDb->insert('jo.artisanat_etab', $tabInsert2, true);
}
$tabInsert['dateUpdate'] = substr($tabInsert['dateInsert'], 0, 10);
unset($tabInsert['dateInsert']);
return $tabInsert;
}
}

View File

@ -1,96 +1,98 @@
<?php
class Metier_Partenaires_MBanques
{
public $tabActivite = array(
0=>'établissements et services autorisés à effectuer des opérations de banque',
1=>'banques',
2=>'banques mutualistes ou coopératives',
4=>'caisses de crédit municipal',
5=>'sociétés financières 5', // la distinction entre les codes 5 et 6 ne concerne que les
6=>'sociétés financières 6', // applications internes à la Banque de France
7=>'institutions financières spécialisées',
9=>'entreprises d\'investissement'
);
public $tabNatureGuichet = array(
1=>'Guichet permanent de plein exercice domiciliataire (ouvert au public)',
2=>'Identifiant de domiciliation (adresse active 5 jours par semaine)',
3=>'Guichet permanent non domiciliataire (ouvert au public)',
4=>'Libre Prestation de services (LPS)',
'A'=>'Guichet fictif',
'P'=>'Guichet fictif'
);
public $tabOrgane = array(
0=>'Association française des établissements de crédit et des entreprises d\'investissement',
11=>'Association française des sociétés financières',
12=>'Groupement des institutions financières spécialisées',
13=>'Conférence permanente des caisses de crédit municipal',
14=>'Association française des entreprises d\'investissement',
15=>'Association française des entreprises d\'investissement-courtiers',
16=>'Association française des fonds et sociétés d\'investissements et de gestion d\'actifs financiers',
17=>'Association française des intermédiaires transmetteurs d\'ordres ',
18=>'Fédération bancaire française',
19=>'Ass Franc Marchés Financiers',
20=>'Caisse nationale de crédit agricole',
21=>'Chambre syndicale des banques populaires',
22=>'Confédération nationale du crédit mutuel',
23=>'Caisse centrale de crédit coopératif',
25=>'Caisse nationale des caisses d\'épargne et de prévoyance',
27=>'Chambre syndicale des SACI',
28=>'Double affiliation CNCE-BFBP',
29=>'Crédit Immobilier France Développement',
30=>'BPCE',
98=>'non concerné',
99=>'en instance d\'adhésion'
);
protected $iDb;
public function __construct($db = null)
{
if ( $db === null ) {
$this->iDb = new Metier_Util_Db();
} else {
$this->iDb = $db;
}
}
public function getInfoBanque($codeBanque)
{
$ret = $this->iDb->select(
'insee.BDF_Etabs',
'bdfFibCodeEtab, bdfFibCodeSituation, bdfFibDenom40, bdfFibDenom10, bdfFibCodeActivite, bdfFibCodeOrganeRepr, bdfFibDateAgrement, bdfFibDateRetraitAgr, bdfFibDateFinDiffus, bdfFibAdresse1, bdfFibAdresse2, bdfFibAdresse3, CP, Ville, bdfFibCodeEtabAbsorb, bdfFibOptionIdInvar, bdfFibDateOptIdInvar',
"bdfFibCodeEtab=$codeBanque",false, MYSQL_ASSOC);
//echo mysql_error();
$tabRet=$ret[0];
return $tabRet;
}
public function getInfoGuichet($codeBanque, $codeGuichet)
{
$tabBanque=$this->getInfoBanque($codeBanque);
$tabTel=$this->getTelGuichet($codeBanque,$codeGuichet);
$ret = $this->iDb->select(
'insee.BDF_Guichets',
'bdfFibCodeEtab, bdfFibCodeGuichet, bdfFibCodeSituation AS guichetCodeSituation, bdfFibDenom40 AS guichetDenom40, bdfFibDenom20 AS guichetDenom20, bdfFibCodeEtabCible, bdfFibCodeGuichetRepr, bdfFibCodeGeoInsee, bdfFibCodeLocalite1, bdfFibCodeLocalite2, bdfFibComptoirBDF, bdfFibAdresse1 AS guichetAdresse1, bdfFibAdresse2 AS guichetAdresse2, bdfFibAdresse3 AS guichetAdresse3, CP AS guichetCP, Ville AS guichetVille, bdfFibAdresseSWIFT, bdfFibDateOuverture, bdfFibDateFermeture, bdfFibDateFinDiffus, bdfFibCodeRoutage, bdfFibLibelleRIB, bdfFibNatureGuichet, bdfFibCodeAchOperBDF, bdfFibNomComptoirBDF',
"bdfFibCodeEtab=$codeBanque AND bdfFibCodeGuichet=$codeGuichet",false, MYSQL_ASSOC);
//echo mysql_error();
if (isset($ret[0]))
$tabRet=@$ret[0];
else
$tabRet=array();
return array_merge($tabRet, $tabBanque, $tabTel);
}
public function getTelGuichet($codeBanque, $codeGuichet)
{
$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();
}
}
<?php
class Metier_Partenaires_MBanques
{
public $tabActivite = array(
0=>'établissements et services autorisés à effectuer des opérations de banque',
1=>'banques',
2=>'banques mutualistes ou coopératives',
4=>'caisses de crédit municipal',
5=>'sociétés financières 5', // la distinction entre les codes 5 et 6 ne concerne que les
6=>'sociétés financières 6', // applications internes à la Banque de France
7=>'institutions financières spécialisées',
9=>'entreprises d\'investissement'
);
public $tabNatureGuichet = array(
1=>'Guichet permanent de plein exercice domiciliataire (ouvert au public)',
2=>'Identifiant de domiciliation (adresse active 5 jours par semaine)',
3=>'Guichet permanent non domiciliataire (ouvert au public)',
4=>'Libre Prestation de services (LPS)',
'A'=>'Guichet fictif',
'P'=>'Guichet fictif'
);
public $tabOrgane = array(
0=>'Association française des établissements de crédit et des entreprises d\'investissement',
11=>'Association française des sociétés financières',
12=>'Groupement des institutions financières spécialisées',
13=>'Conférence permanente des caisses de crédit municipal',
14=>'Association française des entreprises d\'investissement',
15=>'Association française des entreprises d\'investissement-courtiers',
16=>'Association française des fonds et sociétés d\'investissements et de gestion d\'actifs financiers',
17=>'Association française des intermédiaires transmetteurs d\'ordres ',
18=>'Fédération bancaire française',
19=>'Ass Franc Marchés Financiers',
20=>'Caisse nationale de crédit agricole',
21=>'Chambre syndicale des banques populaires',
22=>'Confédération nationale du crédit mutuel',
23=>'Caisse centrale de crédit coopératif',
25=>'Caisse nationale des caisses d\'épargne et de prévoyance',
27=>'Chambre syndicale des SACI',
28=>'Double affiliation CNCE-BFBP',
29=>'Crédit Immobilier France Développement',
30=>'BPCE',
98=>'non concerné',
99=>'en instance d\'adhésion'
);
protected $iDb;
public function __construct($db = null)
{
if ($db === null) {
$this->iDb = new Metier_Util_Db();
} else {
$this->iDb = $db;
}
}
public function getInfoBanque($codeBanque)
{
$ret = $this->iDb->select(
'insee.BDF_Etabs',
'bdfFibCodeEtab, bdfFibCodeSituation, bdfFibDenom40, bdfFibDenom10, bdfFibCodeActivite, bdfFibCodeOrganeRepr, bdfFibDateAgrement, bdfFibDateRetraitAgr, bdfFibDateFinDiffus, bdfFibAdresse1, bdfFibAdresse2, bdfFibAdresse3, CP, Ville, bdfFibCodeEtabAbsorb, bdfFibOptionIdInvar, bdfFibDateOptIdInvar',
"bdfFibCodeEtab=$codeBanque", false, MYSQL_ASSOC);
//echo mysql_error();
$tabRet=$ret[0];
return $tabRet;
}
public function getInfoGuichet($codeBanque, $codeGuichet)
{
$tabBanque=$this->getInfoBanque($codeBanque);
$tabTel=$this->getTelGuichet($codeBanque, $codeGuichet);
$ret = $this->iDb->select(
'insee.BDF_Guichets',
'bdfFibCodeEtab, bdfFibCodeGuichet, bdfFibCodeSituation AS guichetCodeSituation, bdfFibDenom40 AS guichetDenom40, bdfFibDenom20 AS guichetDenom20, bdfFibCodeEtabCible, bdfFibCodeGuichetRepr, bdfFibCodeGeoInsee, bdfFibCodeLocalite1, bdfFibCodeLocalite2, bdfFibComptoirBDF, bdfFibAdresse1 AS guichetAdresse1, bdfFibAdresse2 AS guichetAdresse2, bdfFibAdresse3 AS guichetAdresse3, CP AS guichetCP, Ville AS guichetVille, bdfFibAdresseSWIFT, bdfFibDateOuverture, bdfFibDateFermeture, bdfFibDateFinDiffus, bdfFibCodeRoutage, bdfFibLibelleRIB, bdfFibNatureGuichet, bdfFibCodeAchOperBDF, bdfFibNomComptoirBDF',
"bdfFibCodeEtab=$codeBanque AND bdfFibCodeGuichet=$codeGuichet", false, MYSQL_ASSOC);
//echo mysql_error();
if (isset($ret[0])) {
$tabRet=@$ret[0];
} else {
$tabRet=array();
}
return array_merge($tabRet, $tabBanque, $tabTel);
}
public function getTelGuichet($codeBanque, $codeGuichet)
{
$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();
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,255 +1,254 @@
<?php
class Metier_Partenaires_MBilansInput
{
public $CtrlEcartMax = 10;
public $CtrlEcartMax = 10;
public $Ctrl = array (
// --- Bilan Simplifié
'S' => array(
// Actif Simplifié
'010-012=013'=>'Fonds commercial (Brut,Amor/Prov et Net incohérents)',
'014-016=017'=>'Immos incorpo. autres (Brut,Amor/Prov et Net incohérents)',
'028-030=031'=>'Immos corpo. (Brut,Amor/Prov et Net incohérents)',
'040-042=043'=>'Immos finan. (Brut,Amor/Prov et Net incohérents)',
'044-048=049'=>'Total (I) Actif Immos (Brut,Amor/Prov et Net incohérents)',
'010+014+028+040=044'=>'Total Actif immobilisé Brut',
'012+016+030+042=048'=>'Total Actif immobilisé Amor/Prov',
'013+017+031+043=049'=>'Total Actif immobilisé Net',
'050-052=053'=>'Stocks MP (Brut,Amor/Prov et Net incohérents)',
'060-062=063'=>'Stocks Marchandises (Brut,Amor/Prov et Net incohérents)',
'064-066=067'=>'Avances et acomptes/cmds (Brut,Amor/Prov et Net incohérents)',
'068-070=071'=>'Créances clients et CR (Brut,Amor/Prov et Net incohérents)',
'072-074=075'=>'Autres créances (Brut,Amor/Prov et Net incohérents)',
'080-082=083'=>'VMP (Brut,Amor/Prov et Net incohérents)',
'084-086=087'=>'Disponibilités (Brut,Amor/Prov et Net incohérents)',
'088-090=091'=>' (Brut,Amor/Prov et Net incohérents)',
'092-094=095'=>'Ch. constatées d\'avance (Brut,Amor/Prov et Net incohérents)',
'096-098=099'=>'Total (II) Actif Circulant (Brut,Amor/Prov et Net incohérents)',
'110-112=113'=>'Total ACTIF (Brut,Amor/Prov et Net incohérents)',
'050+060+064+068+072+080+084+088+092=096'=>'Total Actif circulant Brut',
'052+062+066+070+074+082+086+090+094=098'=>'Total Actif circulant Amor/Prov',
'053+063+067+071+075+083+087+091+092=099'=>'Total Actif circulant Net',
'044+096=110'=>'Total ACTIF Brut',
'048+098=112'=>'Total ACTIF Amor/Prov',
'049+099=113'=>'Total ACTIF Net',
// Passif Simplifié
'120+124+126+130+132+134+136+140=142'=>'Total Capitaux Propres',
'156+164+166+172+174=176'=>'Total Dettes',
'142+154+176=180'=>'Total Passif',
'113=180'=>'Actif=Passif',
// CDR Simplifié
'210+214+218+222+224+226+230=232'=>'Total des produits d\'exploitation',
'234+236+238+240+242+244+250+252+254+256+262=264'=>'Total des charges d\'exploitation',
'210+214+218+222+224+226+230=232'=>'Total des produits d\'exploitation',
'232-264=270'=>'Résultat d\'exploitation',
'232+280+290-264-294-300-306=310'=>'Résultat d\'exploitation',
),
// --- Bilan Réel Normal
'N' => array(
// Actif immobilisé
'AA=AA2'=>'Capital souscrit non appelé',
'AB-AC=AC1'=>'Frais d\'étab. (Brut,Amor/Prov et Net incohérents)',
'AD-AE=AE1'=>'Frais de R&D (Brut,Amor/Prov et Net incohérents)',
'AF-AG=AG1'=>'Brevets (Brut,Amor/Prov et Net incohérents)',
'AH-AI=AI1'=>'Fonds commercial (Brut,Amor/Prov et Net incohérents)',
'AJ-AK=AK1'=>'Autres immo inc. (Brut,Amor/Prov et Net incohérents)',
'AL-AM=AM1'=>'Acomptes immo inc. (Brut,Amor/Prov et Net incohérents)',
'AN-AO=AO1'=>'Terrains (Brut,Amor/Prov et Net incohérents)',
'AP-AQ=AQ1'=>'Constructions (Brut,Amor/Prov et Net incohérents)',
'AR-AS=AS1'=>'Installations (Brut,Amor/Prov et Net incohérents)',
'AT-AU=AU1'=>'Autres immo corp. (Brut,Amor/Prov et Net incohérents)',
'AV-AW=AW1'=>'Immos en cours (Brut,Amor/Prov et Net incohérents)',
'AX-AY=AY1'=>'Acomptes immo corp. (Brut,Amor/Prov et Net incohérents)',
'CS-CT=CT1'=>'Immo Fi participations/équiv. (Brut,Amor/Prov et Net incohérents)',
'CU-CV=CV1'=>'Autres participations (Brut,Amor/Prov et Net incohérents)',
'BB-BC=BC1'=>'Créances rattachées à des particip. (Brut,Amor/Prov et Net incohérents)',
'BD-BE=BE1'=>'Autres titres immo. (Brut,Amor/Prov et Net incohérents)',
'BF-BG=BG1'=>'Prêts (Brut,Amor/Prov et Net incohérents)',
'BH-BI=BI1'=>'Autres Immo Financières (Brut,Amor/Prov et Net incohérents)',
'BJ-BK=BK1'=>'Total de l\'Actif Immobilisé (Brut,Amor/Prov et Net incohérents)',
'AB+AD+AF+AH+AJ+AL+AN+AP+AR+AT+AV+AX+CS+CU+BB+BD+BF+BH=BJ'=>'Total des Immobilisations (Brut)',
'AC+AE+AG+AI+AK+AM+AO+AQ+AS+AU+AW+AY+CT+CV+BC+BE+BG+BI=BK'=>'Total des Immobilisations (Amor.)',
'AC1+AE1+AG1+AI1+AK1+AM1+AO1+AQ1+AS1+AU1+AW1+AY1+CT1+CV1+BC1+BE1+BG1+BI1=BK1'=>'Total des Immobilisations (Net)',
// Actif circulant
'BL-BM=BM1'=>'Stocks de MP (Brut,Amor/Prov et Net incohérents)',
'BN-BO=BO1'=>'Stocks en cours de prod. biens (Brut,Amor/Prov et Net incohérents)',
'BP-BQ=BQ1'=>'Stocks en cours de prod. services (Brut,Amor/Prov et Net incohérents)',
'BR-BS=BS1'=>'Stocks produits finis (Brut,Amor/Prov et Net incohérents)',
'BT-BU=BU1'=>'Stocks de marchandises (Brut,Amor/Prov et Net incohérents)',
'BV-BW=BW1'=>'Avances et acomptes/cmds (Brut,Amor/Prov et Net incohérents)',
'BX-BY=BY1'=>'Créances clients (Brut,Amor/Prov et Net incohérents)',
'BZ-CA=CA1'=>'Autres créances (Brut,Amor/Prov et Net incohérents)',
'CB-CC=CC1'=>'Capital souscrit appelé non versé (Brut,Amor/Prov et Net incohérents)',
'CD-CE=CE1'=>'VMP (Brut,Amor/Prov et Net incohérents)',
'CF-CG=CG1'=>'Disponibilités (Brut,Amor/Prov et Net incohérents)',
'CH-CI=CI1'=>'Charges Const. d\'avance(Brut,Amor/Prov et Net incohérents)',
'CJ-CK=CK1'=>'Total de l\'Actif Circulant (Brut,Amor/Prov et Net incohérents)',
'BL+BN+BP+BR+BT+BV+BX+BZ+CB+CD+CF+CH=CJ'=>'Total l\'Actif Circulant (Brut)',
'BM+BO+BQ+BS+BU+BW+BY+CA+CC+CE+CG+CI=CK'=>'Total l\'Actif Circulant (Amor.)',
'BM1+BO1+BQ1+BS1+BU1+BW1+BY1+CA1+CC1+CE1+CG1+CI1=CK1'=>'Total l\'Actif Circulant (Net)',
'CL=CL2'=>'Charges / plus. ex. (Brut<>Net)',
'CM=CM2'=>'Primes de Rbt obligations (Brut<>Net)',
'CN=CN2'=>'Ecarts de conversion d\'actif (Brut<>Net)',
'CO-1A=1A1'=>'Total Actif (Brut,Amor/Prov et Net incohérents)',
'AA+BJ+CJ+CL+CM+CN=CO'=>'Total Actif Brut',
'BK+CK=1A'=>'Total Actif (Amor.)',
'AA2+BK1+CK1+CL2+CM2+CN2=1A1'=>'Total Actif Net',
// PASSIF
'DA+DB+DC+DD+DE+DF+DG+DH+DI+DJ+DK=DL'=>'Passif : s/total I (Capitaux Propres)',
'DM+DN=DO'=>'Passif : s/total II (Autres fonds propres)',
'DP+DQ=DR'=>'Passif : s/total III (Provisions)',
'DS+DT+DU+DV+DW+DX+DY+DZ+EA+EB=EC'=>'Passif : s/total IV (Dettes+Cpt régul. PCA)',
'DL+DO+DR+EC+ED=EE'=>'Total Passif',
'EE=1A1'=>'Total Actif=Total Passif',
// CDR
'FA+FB=FC'=>'Total Ventes de marchandises',
'FD+FE=FF'=>'Total Production vendue de biens',
'FG+FH=FI'=>'Total Production vendue de services',
'FJ+FK=FL'=>'Total Chiffe d\'Affaires France+Export',
'FA+FD+FG=FJ'=>'Total C.A. France',
'FB+FE+FH=FK'=>'Total C.A. Export',
'FC+FF+FI=FL'=>'Total C.A. Total (Vtes+Biens+Services)',
'FL+FM+FN+FO+FP+FQ=FR'=>'Total I : Produits d\'Exploitation',
'FS+FT+FU+FV+FW+FX+FY+FZ+GA+GB+GC+GD+GE=GF'=>'Total II :Charges d\'Exploitation',
'FR-GF=GG'=>'1 - Résultat d\'Exploitation',
'GJ+GK+GL+GM+GN+GO=GP'=>'Total V : Produits Financiers',
'GQ+GR+GS+GT=GU'=>'Total VI : Charges Financières',
'GP-GU=GV'=>'2 - Résultat Financier',
'GG+GH-GI+GV=GW'=>'3 - R.C.A.I.',
'HA+HB+HC=HD'=>'Total VII : Produits Exceptionnels',
'HE+HF+HG=HH'=>'Total VIII : Charges Exceptionnels',
'HD-HH=HI'=>'4 - Résultat Exceptionnel',
'FR+GH+GP+HD=HL'=>'CDR : Total des Produits',
'GF+GI+GU+HH+HJ+HK=HM'=>'CDR : Total des Charges',
'HL-HM=HN'=>'5 - Résultat de l\'exercice',
),
);
public $Ctrl = array(
// --- Bilan Simplifié
'S' => array(
// Actif Simplifié
'010-012=013'=>'Fonds commercial (Brut,Amor/Prov et Net incohérents)',
'014-016=017'=>'Immos incorpo. autres (Brut,Amor/Prov et Net incohérents)',
'028-030=031'=>'Immos corpo. (Brut,Amor/Prov et Net incohérents)',
'040-042=043'=>'Immos finan. (Brut,Amor/Prov et Net incohérents)',
'044-048=049'=>'Total (I) Actif Immos (Brut,Amor/Prov et Net incohérents)',
'010+014+028+040=044'=>'Total Actif immobilisé Brut',
'012+016+030+042=048'=>'Total Actif immobilisé Amor/Prov',
'013+017+031+043=049'=>'Total Actif immobilisé Net',
'050-052=053'=>'Stocks MP (Brut,Amor/Prov et Net incohérents)',
'060-062=063'=>'Stocks Marchandises (Brut,Amor/Prov et Net incohérents)',
'064-066=067'=>'Avances et acomptes/cmds (Brut,Amor/Prov et Net incohérents)',
'068-070=071'=>'Créances clients et CR (Brut,Amor/Prov et Net incohérents)',
'072-074=075'=>'Autres créances (Brut,Amor/Prov et Net incohérents)',
'080-082=083'=>'VMP (Brut,Amor/Prov et Net incohérents)',
'084-086=087'=>'Disponibilités (Brut,Amor/Prov et Net incohérents)',
'088-090=091'=>' (Brut,Amor/Prov et Net incohérents)',
'092-094=095'=>'Ch. constatées d\'avance (Brut,Amor/Prov et Net incohérents)',
'096-098=099'=>'Total (II) Actif Circulant (Brut,Amor/Prov et Net incohérents)',
'110-112=113'=>'Total ACTIF (Brut,Amor/Prov et Net incohérents)',
'050+060+064+068+072+080+084+088+092=096'=>'Total Actif circulant Brut',
'052+062+066+070+074+082+086+090+094=098'=>'Total Actif circulant Amor/Prov',
'053+063+067+071+075+083+087+091+092=099'=>'Total Actif circulant Net',
'044+096=110'=>'Total ACTIF Brut',
'048+098=112'=>'Total ACTIF Amor/Prov',
'049+099=113'=>'Total ACTIF Net',
// Passif Simplifié
'120+124+126+130+132+134+136+140=142'=>'Total Capitaux Propres',
'156+164+166+172+174=176'=>'Total Dettes',
'142+154+176=180'=>'Total Passif',
'113=180'=>'Actif=Passif',
// CDR Simplifié
'210+214+218+222+224+226+230=232'=>'Total des produits d\'exploitation',
'234+236+238+240+242+244+250+252+254+256+262=264'=>'Total des charges d\'exploitation',
'210+214+218+222+224+226+230=232'=>'Total des produits d\'exploitation',
'232-264=270'=>'Résultat d\'exploitation',
'232+280+290-264-294-300-306=310'=>'Résultat d\'exploitation',
),
// --- Bilan Réel Normal
'N' => array(
// Actif immobilisé
'AA=AA2'=>'Capital souscrit non appelé',
'AB-AC=AC1'=>'Frais d\'étab. (Brut,Amor/Prov et Net incohérents)',
'AD-AE=AE1'=>'Frais de R&D (Brut,Amor/Prov et Net incohérents)',
'AF-AG=AG1'=>'Brevets (Brut,Amor/Prov et Net incohérents)',
'AH-AI=AI1'=>'Fonds commercial (Brut,Amor/Prov et Net incohérents)',
'AJ-AK=AK1'=>'Autres immo inc. (Brut,Amor/Prov et Net incohérents)',
'AL-AM=AM1'=>'Acomptes immo inc. (Brut,Amor/Prov et Net incohérents)',
'AN-AO=AO1'=>'Terrains (Brut,Amor/Prov et Net incohérents)',
'AP-AQ=AQ1'=>'Constructions (Brut,Amor/Prov et Net incohérents)',
'AR-AS=AS1'=>'Installations (Brut,Amor/Prov et Net incohérents)',
'AT-AU=AU1'=>'Autres immo corp. (Brut,Amor/Prov et Net incohérents)',
'AV-AW=AW1'=>'Immos en cours (Brut,Amor/Prov et Net incohérents)',
'AX-AY=AY1'=>'Acomptes immo corp. (Brut,Amor/Prov et Net incohérents)',
'CS-CT=CT1'=>'Immo Fi participations/équiv. (Brut,Amor/Prov et Net incohérents)',
'CU-CV=CV1'=>'Autres participations (Brut,Amor/Prov et Net incohérents)',
'BB-BC=BC1'=>'Créances rattachées à des particip. (Brut,Amor/Prov et Net incohérents)',
'BD-BE=BE1'=>'Autres titres immo. (Brut,Amor/Prov et Net incohérents)',
'BF-BG=BG1'=>'Prêts (Brut,Amor/Prov et Net incohérents)',
'BH-BI=BI1'=>'Autres Immo Financières (Brut,Amor/Prov et Net incohérents)',
'BJ-BK=BK1'=>'Total de l\'Actif Immobilisé (Brut,Amor/Prov et Net incohérents)',
'AB+AD+AF+AH+AJ+AL+AN+AP+AR+AT+AV+AX+CS+CU+BB+BD+BF+BH=BJ'=>'Total des Immobilisations (Brut)',
'AC+AE+AG+AI+AK+AM+AO+AQ+AS+AU+AW+AY+CT+CV+BC+BE+BG+BI=BK'=>'Total des Immobilisations (Amor.)',
'AC1+AE1+AG1+AI1+AK1+AM1+AO1+AQ1+AS1+AU1+AW1+AY1+CT1+CV1+BC1+BE1+BG1+BI1=BK1'=>'Total des Immobilisations (Net)',
// Actif circulant
'BL-BM=BM1'=>'Stocks de MP (Brut,Amor/Prov et Net incohérents)',
'BN-BO=BO1'=>'Stocks en cours de prod. biens (Brut,Amor/Prov et Net incohérents)',
'BP-BQ=BQ1'=>'Stocks en cours de prod. services (Brut,Amor/Prov et Net incohérents)',
'BR-BS=BS1'=>'Stocks produits finis (Brut,Amor/Prov et Net incohérents)',
'BT-BU=BU1'=>'Stocks de marchandises (Brut,Amor/Prov et Net incohérents)',
'BV-BW=BW1'=>'Avances et acomptes/cmds (Brut,Amor/Prov et Net incohérents)',
'BX-BY=BY1'=>'Créances clients (Brut,Amor/Prov et Net incohérents)',
'BZ-CA=CA1'=>'Autres créances (Brut,Amor/Prov et Net incohérents)',
'CB-CC=CC1'=>'Capital souscrit appelé non versé (Brut,Amor/Prov et Net incohérents)',
'CD-CE=CE1'=>'VMP (Brut,Amor/Prov et Net incohérents)',
'CF-CG=CG1'=>'Disponibilités (Brut,Amor/Prov et Net incohérents)',
'CH-CI=CI1'=>'Charges Const. d\'avance(Brut,Amor/Prov et Net incohérents)',
'CJ-CK=CK1'=>'Total de l\'Actif Circulant (Brut,Amor/Prov et Net incohérents)',
'BL+BN+BP+BR+BT+BV+BX+BZ+CB+CD+CF+CH=CJ'=>'Total l\'Actif Circulant (Brut)',
'BM+BO+BQ+BS+BU+BW+BY+CA+CC+CE+CG+CI=CK'=>'Total l\'Actif Circulant (Amor.)',
'BM1+BO1+BQ1+BS1+BU1+BW1+BY1+CA1+CC1+CE1+CG1+CI1=CK1'=>'Total l\'Actif Circulant (Net)',
'CL=CL2'=>'Charges / plus. ex. (Brut<>Net)',
'CM=CM2'=>'Primes de Rbt obligations (Brut<>Net)',
'CN=CN2'=>'Ecarts de conversion d\'actif (Brut<>Net)',
'CO-1A=1A1'=>'Total Actif (Brut,Amor/Prov et Net incohérents)',
'AA+BJ+CJ+CL+CM+CN=CO'=>'Total Actif Brut',
'BK+CK=1A'=>'Total Actif (Amor.)',
'AA2+BK1+CK1+CL2+CM2+CN2=1A1'=>'Total Actif Net',
// PASSIF
'DA+DB+DC+DD+DE+DF+DG+DH+DI+DJ+DK=DL'=>'Passif : s/total I (Capitaux Propres)',
'DM+DN=DO'=>'Passif : s/total II (Autres fonds propres)',
'DP+DQ=DR'=>'Passif : s/total III (Provisions)',
'DS+DT+DU+DV+DW+DX+DY+DZ+EA+EB=EC'=>'Passif : s/total IV (Dettes+Cpt régul. PCA)',
'DL+DO+DR+EC+ED=EE'=>'Total Passif',
'EE=1A1'=>'Total Actif=Total Passif',
// CDR
'FA+FB=FC'=>'Total Ventes de marchandises',
'FD+FE=FF'=>'Total Production vendue de biens',
'FG+FH=FI'=>'Total Production vendue de services',
'FJ+FK=FL'=>'Total Chiffe d\'Affaires France+Export',
'FA+FD+FG=FJ'=>'Total C.A. France',
'FB+FE+FH=FK'=>'Total C.A. Export',
'FC+FF+FI=FL'=>'Total C.A. Total (Vtes+Biens+Services)',
'FL+FM+FN+FO+FP+FQ=FR'=>'Total I : Produits d\'Exploitation',
'FS+FT+FU+FV+FW+FX+FY+FZ+GA+GB+GC+GD+GE=GF'=>'Total II :Charges d\'Exploitation',
'FR-GF=GG'=>'1 - Résultat d\'Exploitation',
'GJ+GK+GL+GM+GN+GO=GP'=>'Total V : Produits Financiers',
'GQ+GR+GS+GT=GU'=>'Total VI : Charges Financières',
'GP-GU=GV'=>'2 - Résultat Financier',
'GG+GH-GI+GV=GW'=>'3 - R.C.A.I.',
'HA+HB+HC=HD'=>'Total VII : Produits Exceptionnels',
'HE+HF+HG=HH'=>'Total VIII : Charges Exceptionnels',
'HD-HH=HI'=>'4 - Résultat Exceptionnel',
'FR+GH+GP+HD=HL'=>'CDR : Total des Produits',
'GF+GI+GU+HH+HJ+HK=HM'=>'CDR : Total des Charges',
'HL-HM=HN'=>'5 - Résultat de l\'exercice',
),
);
public $LibCodeCtrl = array(
'_0' => '-',
'_1' => 'Corrigé',
'_3' => 'Capital',
'_5' => 'Calculs', // Anciennement 2 mais maintenant >=5 correspond à une erreur grave
'_7' => 'Effectif',
'_9' => 'Unité',
);
public $LibCodeCtrl = array(
'_0' => '-',
'_1' => 'Corrigé',
'_3' => 'Capital',
'_5' => 'Calculs', // Anciennement 2 mais maintenant >=5 correspond à une erreur grave
'_7' => 'Effectif',
'_9' => 'Unité',
);
public $LibCodeSaisie = array(
// Code Saisie Bilans par Infogreffe
'_00' => 'Bilan saisi sans anomalie',
'_01' => 'Bilan saisi avec des incohérences comptables à la source du document (issues du remettant)',
'_02' => 'Bilan avec Actif, Passif ou Compte de Résultat nul',
'_03' => 'Bilan incomplet (des pages manquent)',
'_04' => 'Bilan complet non détaillé (seuls les totaux et sous totaux sont renseignés)',
'_05' => 'Bilan reçu en double exemplaire',
'_06' => 'Bilan intermédiaire - Situation provisoire',
'_07' => 'Bilan illisible',
'_A7' => 'Bilan illisible, présentant un cadre gris très foncés (dans lesquels sont inscrits en général les totaux)',
'_B7' => 'Bilan manuscrits',
'_C7' => 'Bilan illisible, présentant des caractères trop gras',
'_D7' => 'Bilan scanné en biais ou qui présentent des pages rognées',
'_E7' => 'Bilan numérisés trop clairement (comme une imprimante dont la cartouche est presque vide)',
'_F7' => 'Bilan illisible',
'_08' => 'Bilan consolidé',
'_09' => 'Déclaration d\'impôts',
'_10' => 'Document autre que bilan',
'_11' => 'Bilan de clôture de liquidation',
'_12' => 'Bilan de Société financière',
'_13' => 'Bilan de Société d\'assurance',
'_14' => 'Bilan de Société immobilière',
'_15' => 'Bilan de Société étrangère',
// Codes saisie de Bilans spécifique às S&D
'_70' => 'Document relatif à une autre société',
);
public $LibCodeSaisie = array(
// Code Saisie Bilans par Infogreffe
'_00' => 'Bilan saisi sans anomalie',
'_01' => 'Bilan saisi avec des incohérences comptables à la source du document (issues du remettant)',
'_02' => 'Bilan avec Actif, Passif ou Compte de Résultat nul',
'_03' => 'Bilan incomplet (des pages manquent)',
'_04' => 'Bilan complet non détaillé (seuls les totaux et sous totaux sont renseignés)',
'_05' => 'Bilan reçu en double exemplaire',
'_06' => 'Bilan intermédiaire - Situation provisoire',
'_07' => 'Bilan illisible',
'_A7' => 'Bilan illisible, présentant un cadre gris très foncés (dans lesquels sont inscrits en général les totaux)',
'_B7' => 'Bilan manuscrits',
'_C7' => 'Bilan illisible, présentant des caractères trop gras',
'_D7' => 'Bilan scanné en biais ou qui présentent des pages rognées',
'_E7' => 'Bilan numérisés trop clairement (comme une imprimante dont la cartouche est presque vide)',
'_F7' => 'Bilan illisible',
'_08' => 'Bilan consolidé',
'_09' => 'Déclaration d\'impôts',
'_10' => 'Document autre que bilan',
'_11' => 'Bilan de clôture de liquidation',
'_12' => 'Bilan de Société financière',
'_13' => 'Bilan de Société d\'assurance',
'_14' => 'Bilan de Société immobilière',
'_15' => 'Bilan de Société étrangère',
// Codes saisie de Bilans spécifique às S&D
'_70' => 'Document relatif à une autre société',
);
/**
* Décompose le tableau de controle
* @param string $type (S | N)
* Type du bilan
* @return array
* Retourne un tableau
* [
* operation => Chaine de caractère contenant l'operation à effectuer sur les postes
* total => Code du poste résultant de l'operation pour comparaison
* ]
*/
protected function formules($type)
{
$formules = array();
if ( array_key_exists($type, $this->Ctrl) ) {
foreach ( $this->Ctrl[$type] as $formule => $lib ) {
$posEgal = strpos($formule, '=');
$partLeft = substr($formule, 0, $posEgal);
preg_match_all('/([A-Z0-9]+|(\+|\-))/', $partLeft, $matches);
$total = substr($formule, $posEgal+1);
$formules[] = array(
'operation' => $matches[0],
'total' => $total,
);
}
}
/**
* Décompose le tableau de controle
* @param string $type (S | N)
* Type du bilan
* @return array
* Retourne un tableau
* [
* operation => Chaine de caractère contenant l'operation à effectuer sur les postes
* total => Code du poste résultant de l'operation pour comparaison
* ]
*/
protected function formules($type)
{
$formules = array();
if (array_key_exists($type, $this->Ctrl)) {
foreach ($this->Ctrl[$type] as $formule => $lib) {
$posEgal = strpos($formule, '=');
$partLeft = substr($formule, 0, $posEgal);
preg_match_all('/([A-Z0-9]+|(\+|\-))/', $partLeft, $matches);
$total = substr($formule, $posEgal+1);
$formules[] = array(
'operation' => $matches[0],
'total' => $total,
);
}
}
return $formules;
}
return $formules;
}
/**
* Control les postes
* @param string $type (S | N)
* Type du bilan
* @param array $postes
* Tableau des postes d'un bilan Code => Valeur
* @throws Exception
* @return boolean
*/
public function control($type, $postes = array() )
{
$formules = $this->formules($type);
/**
* Control les postes
* @param string $type (S | N)
* Type du bilan
* @param array $postes
* Tableau des postes d'un bilan Code => Valeur
* @throws Exception
* @return boolean
*/
public function control($type, $postes = array())
{
$formules = $this->formules($type);
if ( count($formules) > 0 ) {
foreach ( $formules as $formule ) {
$checkPostes = array();
if (count($formules) > 0) {
foreach ($formules as $formule) {
$checkPostes = array();
// --- Réaliser le calcul
$calc = 0;
$signe = null;
foreach ( $formule['operation'] as $operation ) {
if ( $operation == '-' ) {
$signe = '-';
} elseif ( $operation == '+' ) {
$signe = '+';
} else {
$checkPostes[] = $operation;
// --- Vérification valeur poste
if ( !array_key_exists($operation, $postes) ) {
$postes[$operation] = 0;
}
// --- Calcul
if ( empty($signe) ) {
$calc = $postes[$operation];
} elseif ( $signe == '+' ) {
$calc+= $postes[$operation];
} elseif ( $signe == '-' ) {
$calc-= $postes[$operation];
}
}
}
// --- Réaliser le calcul
$calc = 0;
$signe = null;
foreach ($formule['operation'] as $operation) {
if ($operation == '-') {
$signe = '-';
} elseif ($operation == '+') {
$signe = '+';
} else {
$checkPostes[] = $operation;
// --- Vérification valeur poste
if (!array_key_exists($operation, $postes)) {
$postes[$operation] = 0;
}
// --- Calcul
if (empty($signe)) {
$calc = $postes[$operation];
} elseif ($signe == '+') {
$calc+= $postes[$operation];
} elseif ($signe == '-') {
$calc-= $postes[$operation];
}
}
}
$checkPostes[] = $formule['total'];
// --- Effecteur la vérification avec le total
if ( !array_key_exists($formule['total'], $postes) ) {
$total = 0;
} else {
$total = $postes[$formule['total']];
}
if ($calc != $total && !( ($calc - $this->CtrlEcartMax < $total) && ($calc + $this->CtrlEcartMax > $total) ) ) {
throw new Exception(join(';',$checkPostes));
}
}
$checkPostes[] = $formule['total'];
// --- Effecteur la vérification avec le total
if (!array_key_exists($formule['total'], $postes)) {
$total = 0;
} else {
$total = $postes[$formule['total']];
}
if ($calc != $total && !(($calc - $this->CtrlEcartMax < $total) && ($calc + $this->CtrlEcartMax > $total))) {
throw new Exception(join(';', $checkPostes));
}
}
return true;
}
return true;
}
return false;
}
}
return false;
}
}

View File

@ -1,209 +1,213 @@
<?php
class Metier_Partenaires_MBourse
{
protected $siren = false;
protected $iDb;
public function __construct($siren=0, $db = null)
{
$this->siren = $siren;
if ( $db === null ) {
$this->iDb = new Metier_Util_Db();
} else {
$this->iDb = $db;
}
}
/**
* Libellé de la source
*
* @param string $source
* @return string
*/
public function getLibSource($code)
{
switch ($code) {
case 'B':
return 'Business Wire';
break;
case 'H':
return 'Hugin';
break;
case 'A':
return 'ActusNews';
break;
case 'D':
return 'DiRelease';
break;
case 'E':
return 'Les Echos';
break;
default:
return 'N/C';
break;
}
}
/**
* Vérifie la validité de la structure d'un code ISIN
*
* @param string $isin
* @return boolean
*/
public function isIsin($isin)
{
if (strlen(trim($isin))) {
$cle = substr($isin, -1);
$isinLeft = substr($isin, 0, strlen($isin)-1);
$letter2number = array(
'A'=>10, 'B'=>11, 'C'=>12, 'D'=>13, 'E'=>14,
'F'=>15, 'G'=>16, 'H'=>17, 'I'=>18, 'J'=>19,
'K'=>20, 'L'=>21, 'M'=>22, 'N'=>23, 'O'=>24,
'P'=>25, 'Q'=>26, 'R'=>27, 'S'=>28, 'T'=>29,
'U'=>30, 'V'=>31, 'W'=>32, 'X'=>33, 'Y'=>34, 'Z'=>35
);
$isinConvertion = strtr($isinLeft, $letter2number);
$sum = '';
$sumFinal = 0;
for($i=0; $i<strlen($isinConvertion); ++$i) {
$sum .= (($i % 2) ? 1 : 2) * $isinConvertion[$i];
}
for($i=0; $i<strlen($sum); ++$i) {
$sumFinal += $sum[$i];
}
if ($sumFinal % 10){
$cleVerif = ((int)($sumFinal / 10) + 1) * 10 - $sumFinal;
} else {
$cleVerif = 0;
}
if ($cle == $cleVerif) {
return true;
} else {
return false;
}
} else return false;
}
/**
* Obtenir le code ISIN à partir d'un siren
* @param string $siren
* @return string
*/
public function getCodeIsin($siren=false)
{
if (!$siren) {
$siren = $this->siren;
}
$tabTmp = $this->iDb->select('jo.infos_entrep', 'isin', "siren=$siren AND isin!=''", false, MYSQL_ASSOC);
return trim(@$tabTmp[0]['isin']);
}
/**
* Obtenir le SIREN à partir d'un code ISIN
* @param string $isin
* @return string
*/
public function getCodeSiren($isin)
{
$tabTmp = $this->iDb->select('jo.infos_entrep', 'siren', "isin='$isin' AND siren!=0", false, MYSQL_ASSOC);
return trim($tabTmp[0]['siren']);
}
/**
* A partir d'un siren, récupère les informations règlementés
* @param string $siren
* @param integer $id
* @return array
*/
public function getInfosReg($siren=false, $id=null)
{
if (!$siren) $siren = $this->siren;
$isin = $this->getCodeIsin($siren);
$tabRet = array();
if ($isin!='') {
$sqlID = '';
if (null !== $id) {
$sqlID=" AND id=$id ";
}
$bodacc = $this->iDb->select(
'presse.articles',
'id, companyName, companyIsin, companySiren, companyWebSite, pressReleaseDate, pressReleaseTitle, '.
'pressReleaseText, pressReleaseHtml, pressReleaseAttachments, pressReleaseUrl, source, dateInsert',
"companyIsin='$isin' $sqlID ORDER BY pressReleaseDate DESC", true, MYSQL_ASSOC);
if (count($bodacc)>0) {
foreach ($bodacc as $k=>$ann) {
if ($id)
$tabRet[$k]=array(
'id'=>$ann['id'],
'source'=>$this->getLibSource($ann['source']),
'DateParution'=>$ann['pressReleaseDate'],
'raisonSociale'=>$ann['companyName'],
'titre'=>$ann['pressReleaseTitle'],
'communique'=>$ann['pressReleaseText'],
'communiqueHtml'=>$ann['pressReleaseHtml'],
'pj'=>$ann['pressReleaseAttachments'],
'url'=>$ann['pressReleaseUrl'],
'dateInsertionSD'=>$ann['dateInsert'],
);
else
$tabRet[$k]=array(
'id'=>$ann['id'],
'source'=>$this->getLibSource($ann['source']),
'DateParution'=>$ann['pressReleaseDate'],
'raisonSociale'=>$ann['companyName'],
'titre'=>$ann['pressReleaseTitle'],
'pj'=>$ann['pressReleaseAttachments'],
'url'=>$ann['pressReleaseUrl'],
'dateInsertionSD'=>$ann['dateInsert'],
);
}
}
}
return $tabRet;
}
/**
* A partir d'un siren, récupère les informations boursières
*
* @param string $siren
* @return array
*/
public function getInfosBourse($siren=false)
{
if (!$siren) {
$siren = $this->siren;
}
$isin = $this->getCodeIsin($siren);
$tabRet = array();
if ($isin != '') {
$tabRes = $this->iDb->select(
'sdv1.bourse_isin b, sdv1.bourse_cours c',
'siren, raisonSociale, adresse, effectif, code_sicovam, code_mnemo, code_bloomberg, code_datastream, code_isin, logo, code_ric, '.
'dateIntroduction, dateDerAG, dateRadiation, autre_isin, eligibleSRD, eligiblePEA, nombreTitres, tel1, tel2, fax1, fax2, web, mail, '.
'marche, placeCotation, description, secteur, activite, activiteDet, dirigeants, actionnaires, chiffresTrim, '.
'c.autre, c.`date`, c.`heure`, c.`open` , c.`high` , c.`low` , c.`close` , c.`volume`',
"code_isin='$isin' /*OR siren=$siren)*/ AND b.code_isin=c.isin AND c.autre IN('','e','f','g','m','s','u') ORDER BY c.`date` DESC, c.`heure` DESC LIMIT 0,1", false, MYSQL_ASSOC);
if (count($tabRes) > 0) {
$tabRet = $tabRes[0];
$tabRes = $this->iDb->select('sdv1.bourse_cours',
'min(close) AS coursMin, avg(close) AS coursMoy, max(close) AS coursMax',
"isin='$isin' GROUP BY isin", false, MYSQL_ASSOC);
if (count($tabRes) > 0) {
$tabTmp = $tabRes[0];
$tabRet['coursMin'] = $tabTmp['coursMin'];
$tabRet['coursMoy'] = $tabTmp['coursMoy'];
$tabRet['coursMax'] = $tabTmp['coursMax'];
}
}
}
return $tabRet;
}
}
<?php
class Metier_Partenaires_MBourse
{
protected $siren = false;
protected $iDb;
public function __construct($siren=0, $db = null)
{
$this->siren = $siren;
if ($db === null) {
$this->iDb = new Metier_Util_Db();
} else {
$this->iDb = $db;
}
}
/**
* Libellé de la source
*
* @param string $source
* @return string
*/
public function getLibSource($code)
{
switch ($code) {
case 'B':
return 'Business Wire';
break;
case 'H':
return 'Hugin';
break;
case 'A':
return 'ActusNews';
break;
case 'D':
return 'DiRelease';
break;
case 'E':
return 'Les Echos';
break;
default:
return 'N/C';
break;
}
}
/**
* Vérifie la validité de la structure d'un code ISIN
*
* @param string $isin
* @return boolean
*/
public function isIsin($isin)
{
if (strlen(trim($isin))) {
$cle = substr($isin, -1);
$isinLeft = substr($isin, 0, strlen($isin)-1);
$letter2number = array(
'A'=>10, 'B'=>11, 'C'=>12, 'D'=>13, 'E'=>14,
'F'=>15, 'G'=>16, 'H'=>17, 'I'=>18, 'J'=>19,
'K'=>20, 'L'=>21, 'M'=>22, 'N'=>23, 'O'=>24,
'P'=>25, 'Q'=>26, 'R'=>27, 'S'=>28, 'T'=>29,
'U'=>30, 'V'=>31, 'W'=>32, 'X'=>33, 'Y'=>34, 'Z'=>35
);
$isinConvertion = strtr($isinLeft, $letter2number);
$sum = '';
$sumFinal = 0;
for ($i=0; $i<strlen($isinConvertion); ++$i) {
$sum .= (($i % 2) ? 1 : 2) * $isinConvertion[$i];
}
for ($i=0; $i<strlen($sum); ++$i) {
$sumFinal += $sum[$i];
}
if ($sumFinal % 10) {
$cleVerif = ((int)($sumFinal / 10) + 1) * 10 - $sumFinal;
} else {
$cleVerif = 0;
}
if ($cle == $cleVerif) {
return true;
} else {
return false;
}
} else {
return false;
}
}
/**
* Obtenir le code ISIN à partir d'un siren
* @param string $siren
* @return string
*/
public function getCodeIsin($siren=false)
{
if (!$siren) {
$siren = $this->siren;
}
$tabTmp = $this->iDb->select('jo.infos_entrep', 'isin', "siren=$siren AND isin!=''", false, MYSQL_ASSOC);
return trim(@$tabTmp[0]['isin']);
}
/**
* Obtenir le SIREN à partir d'un code ISIN
* @param string $isin
* @return string
*/
public function getCodeSiren($isin)
{
$tabTmp = $this->iDb->select('jo.infos_entrep', 'siren', "isin='$isin' AND siren!=0", false, MYSQL_ASSOC);
return trim($tabTmp[0]['siren']);
}
/**
* A partir d'un siren, récupère les informations règlementés
* @param string $siren
* @param integer $id
* @return array
*/
public function getInfosReg($siren=false, $id=null)
{
if (!$siren) {
$siren = $this->siren;
}
$isin = $this->getCodeIsin($siren);
$tabRet = array();
if ($isin!='') {
$sqlID = '';
if (null !== $id) {
$sqlID=" AND id=$id ";
}
$bodacc = $this->iDb->select(
'presse.articles',
'id, companyName, companyIsin, companySiren, companyWebSite, pressReleaseDate, pressReleaseTitle, '.
'pressReleaseText, pressReleaseHtml, pressReleaseAttachments, pressReleaseUrl, source, dateInsert',
"companyIsin='$isin' $sqlID ORDER BY pressReleaseDate DESC", true, MYSQL_ASSOC);
if (count($bodacc)>0) {
foreach ($bodacc as $k=>$ann) {
if ($id) {
$tabRet[$k]=array(
'id'=>$ann['id'],
'source'=>$this->getLibSource($ann['source']),
'DateParution'=>$ann['pressReleaseDate'],
'raisonSociale'=>$ann['companyName'],
'titre'=>$ann['pressReleaseTitle'],
'communique'=>$ann['pressReleaseText'],
'communiqueHtml'=>$ann['pressReleaseHtml'],
'pj'=>$ann['pressReleaseAttachments'],
'url'=>$ann['pressReleaseUrl'],
'dateInsertionSD'=>$ann['dateInsert'],
);
} else {
$tabRet[$k]=array(
'id'=>$ann['id'],
'source'=>$this->getLibSource($ann['source']),
'DateParution'=>$ann['pressReleaseDate'],
'raisonSociale'=>$ann['companyName'],
'titre'=>$ann['pressReleaseTitle'],
'pj'=>$ann['pressReleaseAttachments'],
'url'=>$ann['pressReleaseUrl'],
'dateInsertionSD'=>$ann['dateInsert'],
);
}
}
}
}
return $tabRet;
}
/**
* A partir d'un siren, récupère les informations boursières
*
* @param string $siren
* @return array
*/
public function getInfosBourse($siren=false)
{
if (!$siren) {
$siren = $this->siren;
}
$isin = $this->getCodeIsin($siren);
$tabRet = array();
if ($isin != '') {
$tabRes = $this->iDb->select(
'sdv1.bourse_isin b, sdv1.bourse_cours c',
'siren, raisonSociale, adresse, effectif, code_sicovam, code_mnemo, code_bloomberg, code_datastream, code_isin, logo, code_ric, '.
'dateIntroduction, dateDerAG, dateRadiation, autre_isin, eligibleSRD, eligiblePEA, nombreTitres, tel1, tel2, fax1, fax2, web, mail, '.
'marche, placeCotation, description, secteur, activite, activiteDet, dirigeants, actionnaires, chiffresTrim, '.
'c.autre, c.`date`, c.`heure`, c.`open` , c.`high` , c.`low` , c.`close` , c.`volume`',
"code_isin='$isin' /*OR siren=$siren)*/ AND b.code_isin=c.isin AND c.autre IN('','e','f','g','m','s','u') ORDER BY c.`date` DESC, c.`heure` DESC LIMIT 0,1", false, MYSQL_ASSOC);
if (count($tabRes) > 0) {
$tabRet = $tabRes[0];
$tabRes = $this->iDb->select('sdv1.bourse_cours',
'min(close) AS coursMin, avg(close) AS coursMoy, max(close) AS coursMax',
"isin='$isin' GROUP BY isin", false, MYSQL_ASSOC);
if (count($tabRes) > 0) {
$tabTmp = $tabRes[0];
$tabRet['coursMin'] = $tabTmp['coursMin'];
$tabRet['coursMoy'] = $tabTmp['coursMoy'];
$tabRet['coursMax'] = $tabTmp['coursMax'];
}
}
}
return $tabRet;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,406 +1,480 @@
<?php
/*
2. Concernant la date de fin de CS, devons nous comprendre les cas suivants de la sorte :
A. 026 820 043 I 2009-10-31 La CS était valide jusq'au 31/10/2009... L'entreprise n'a plus de CS ? ou la CS est encore à prendre en compte ?
Lorsqu'une cs manuelle arrive à échéance, elle est soumise à l'examen de l'analyste chaque mois. Si l'analyste n'intervient pas l'acheteur reste en cs.
B. 077 250 025 I 0000-00-00 La CS I n'est plus à prendre en compte ou au contraire, elle n'a pas de date de fin ?
L'acheteur a été sorti de cs entre le traitement de fin de mois et l'extraction ( qui a été déclenchée tardivement à la main ). L'acheteur n'est donc plus en cs.
C. 067 103 598 I 2999-12-31 La CS I n'a pas de date de fin sauf changement ultérieur de CS
Ce cas fait partie des nettoyages à faire par le Crédit ( échéance illimitée sur une cs qui ne le justifie pas ).
D. 067 200 329 I 2010-06-30 La CS est valide jusq'au 30/06/2010... Quid après ?
Cette cs ayant été positionnée par l'analyste, elle sera de nouveau soumise à son examen.
3. Globalement, j'ai l'impression que la CS "Paiements" à une durée de 6-12 mois et la CS "Privilèges" de 12-24 mois ?
La cs paiement a une durée de 6 ou 12 mois pour les cas graves.
La cs privilège a une durée de 27 mois ( sauf bien sur les cs manuelles qui sont à la convenance de l'analyste, en général 12 mois ).
*/
class Metier_Partenaires_MFacto
{
public $risqueImpaye=false; // Y a t'il un risque d'impayé ?
public $risqueImpayeMois=0;
public $profilPayeur=0; // 0:N/D, 1:Excellent, 2=Bon, 3=Normal, 4=Lent, 5=Mauvais ou Défaut
private $typeFlux = 0; // Type de flux en chargement 0:Acheteur, 1=CS, 2=Paiements
private $iDb;
public $DELAIPAY=0;
public $DELAIPAYp='';
public $DELAIPAY_MMAA='';
private $tabInfoCS = array(
'_00' => array('risque'=>0,'type'=>'OK', 'libInt'=>'Néant', 'libExt'=>'Aucune difficulté significative ne nous a été signalée'),
'_10' => array('risque'=>3,'type'=>'IP', 'libInt'=>'Impayé BDF', 'libExt'=>"A surveiller. Présence d'impayé(s)"),
'_11' => array('risque'=>3,'type'=>'IP', 'libInt'=>'Retard de paiement - Prorogation', 'libExt'=>'A suivre. Retard(s) de paiement(s) signalé(s)'),
'_12' => array('risque'=>3,'type'=>'IP', 'libInt'=>'Impayé Groupe Facto', 'libExt'=>"A surveiller. Présence d'impayé(s)"),
'_13' => array('risque'=>3,'type'=>'IP', 'libInt'=>'Impayé BDF (sup. à limite)', 'libExt'=>"A surveiller. Présence d'impayé(s)"),
'_15' => array('risque'=>3,'type'=>'PR', 'libInt'=>'PRIVILEGES URSSAF', 'libExt'=>'A surveiller. Présence de privilèges'),
'_16' => array('risque'=>3,'type'=>'PR', 'libInt'=>'AUTRES PRIVILEGES', 'libExt'=>'A surveiller. Présence de Privilèges'),
'_20' => array('risque'=>4,'type'=>'BL', 'libInt'=>'LIQUIDATION JUDICIAIRE', 'libExt'=>'Liquidation Judiciaire'),
'_21' => array('risque'=>1,'type'=>'BC', 'libInt'=>'CESSATION D\'ACTIVITE', 'libExt'=>'A suivre. Informations terrain. Risque de fermeture'),
'_22' => array('risque'=>1,'type'=>'BD', 'libInt'=>'RADIATION RCS', 'libExt'=>'Radiation du RCS'),
'_23' => array('risque'=>1,'type'=>'BG', 'libInt'=>'LOCATION GERANCE', 'libExt'=>'Prise en location Gérance'),
'_24' => array('risque'=>2,'type'=>'RG', 'libInt'=>'GROUPE EN DIFFICULTE', 'libExt'=>'A suivre. Entreprise(s) du groupe à suivre'),
'_25' => array('risque'=>2,'type'=>'DEF', 'libInt'=>'INFORMATIONS NEGATIVES', 'libExt'=>'A suivre. Informations terrain récentes négatives'),
'_26' => array('risque'=>4,'type'=>'BP', 'libInt'=>'PLAN DE CESSION / DE REDRESSEMENT ', 'libExt'=>'Plan de cession/redressement'),
'_27' => array('risque'=>4,'type'=>'BR', 'libInt'=>'REDRESSEMENT JUDICIAIRE', 'libExt'=>'Redressement Judiciaire'),
'_28' => array('risque'=>4,'type'=>'BH', 'libInt'=>'HOMOLOGATION CONCILIATION / REG.AMIABLE', 'libExt'=>'Conciliation, Homologation ou règlement amiable'),
'_29' => array('risque'=>1,'type'=>'BF', 'libInt'=>'FUSION - ABSORPTION', 'libExt'=>'Fusion/Absorption'),
'_30' => array('risque'=>3,'type'=>'IP', 'libInt'=>'MAUVAISE COTE BDF : .8 ou .9', 'libExt'=>"Présence d'impayé(s)"),
'_31' => array('risque'=>1,'type'=>'TC', 'libInt'=>'CESSATION ANNONCEE', 'libExt'=>'Fin d\'activité programmée'),
'_33' => array('risque'=>4,'type'=>'BS', 'libInt'=>'PROCEDURE DE SAUVEGARDE JUGEMENT', 'libExt'=>'Procédure de Sauvegarde'),
'_34' => array('risque'=>4,'type'=>'BV', 'libInt'=>'PLAN DE SAUVEGARDE', 'libExt'=>'Plan de sauvegarde'),
'_35' => array('risque'=>2,'type'=>'DEF', 'libInt'=>'ANALYSE FINANCIERE NEGATIVE', 'libExt'=>'A suivre. Informations terrain récentes négatives'),
'_36' => array('risque'=>2,'type'=>'DEF', 'libInt'=>'BILAN NEGATIF', 'libExt'=>'A suivre. Informations terrain récentes négatives'),
'_37' => array('risque'=>2,'type'=>'DEF', 'libInt'=>'TRESORERIE SERREE', 'libExt'=>'A suivre. Informations terrain récentes négatives'),
'_39' => array('risque'=>2,'type'=>'DEF', 'libInt'=>'PREVISIONS NEGATIVES', 'libExt'=>'A suivre. Informations terrain récentes négatives'),
'_43' => array('risque'=>2,'type'=>'LC', 'libInt'=>'LC SFAC', 'libExt'=>"A suivre. Garantie d'assurance crédit limitée"),
'_45' => array('risque'=>2,'type'=>'LC', 'libInt'=>'REFUS SFAC DOM-TOM', 'libExt'=>"A suivre. Garantie d'assurance crédit limitée"),
//'_47' =>array('risque'=>2,'type'=>'LC', 'libInt'=>'LISTE CONFIDENTIELLE LEASER', 'libExt'=>"A suivre. Garantie d'assurance crédit limitée"),
'_50' => array('risque'=>2,'type'=>'KO', 'libInt'=>'LIENS AVEC UNE ORGANISATION TERRORISTE', 'libExt'=>'Attention, liens internationaux très risqués'),
//Nouveaux regroupements GE
'_I' => array('risque'=>3,'type'=>'IP', 'libInt'=>'Impayés', 'libExt'=>"A surveiller. Présence d'impayé(s) dans les 12 derniers mois"),
'_P' => array('risque'=>3,'type'=>'PR', 'libInt'=>'PRIVILEGES', 'libExt'=>'A surveiller. Présence de privilèges dans les 24 derniers mois'),
'_D' => array('risque'=>2,'type'=>'DEF', 'libInt'=>'PREVISIONS NEGATIVES', 'libExt'=>'A suivre. Informations terrain récentes négatives'),
'_T' => array('risque'=>2,'type'=>'LC', 'libInt'=>'LC Quelconque', 'libExt'=>"Nombreuses demandes d'avis de crédit"),
);
private $tabTranches = array(
0=>6,
30=>36,
60=>66,
90=>96,
120=>126,
150=>156,
180=>999,
);
private $tabMontants = array(
1=>500,
2=>2000,
10=>10000,
20=>20000,
50=>50000,
100=>100000,
200=>200000,
999=>999999
);
public function __construct($db = null)
{
if ( $db === null ) {
$this->iDb = new Metier_Util_Db();
} else {
$this->iDb = $db;
}
}
public function setTypeFic($typeFic)
{
$this->typeFlux = $typeFic;
}
public function readFic($a)
{
switch ($this->typeFlux)
{
case 0: // Acheteur GESCDCLT - Line length (120 + CRLF = 122)
$tab = array(
'NUMACH'=> trim(substr($a, 0, 7)), // 0-7 | 7
'SIRENE'=> trim(substr($a, 7, 9)), // 7-16 | 9
'RAISOC'=> trim(substr($a, 16, 35)), // 16-51 | 35
'NUMVOI'=> trim(substr($a, 51, 4)), // 51-55 | 4
'TYPVOI'=> trim(substr($a, 55, 3)), // 55-58 | 3
'LIBVOI'=> trim(substr($a, 58, 30)), // 58-88 | 30
'VILLE'=> trim(substr($a, 88, 26)), // 88-114 | 26
'CODPOS'=> trim(substr($a,114, 5)), // 114-119 | 5
'FILLER'=> trim(substr($a,119, 2)), // 119-120 | 1
);
break;
case 1: // CS - GESDACH - Line Length (19 + CRLF = 21)
$tab = array(
'siren' => trim(substr($a, 0, 9)), // 0-9 | 9
'cs' => trim(substr($a, 9, 2)), // 9-11 | 2
'dateFin'=> trim(substr($a, 11, 8)), // 11-9 | 8
);
break;
case 2: // Paiements - GESCDMVT - Line length (73 + CRLF = 75)
$tab = array(
'NUMACH'=> trim(substr($a, 0, 7)), // 0-7 | 7
'DATPIE'=> substr($a, 7, 8), // 7-15 | 8
'DATECH'=> substr($a, 15, 8), // 15-23 | 8
'DATPAI'=> substr($a, 23, 8), // 23-31 | 8
'MNTPIE'=> trim(substr($a, 31, 13)), // 31-44 | 13
'MNTFRF'=> trim(substr($a, 44, 13)), // 44-57 | 13
'MNTLIT'=> trim(substr($a, 57, 13)), // 57-70 | 13
'CODDEV'=> trim(substr($a, 70, 3)), // 70-73 | 3
);
break;
}
return $tab;
}
public function getCoteSpeciale($siren)
{
$ret=$this->iDb->select(
'sdv1.ge_cs2',
'siren, cs, dateFin, dateInsert, dateConf',
"siren=$siren AND (dateSuppr=0 OR dateConf>dateSuppr) AND (dateFin=0 OR dateFin>NOW()) AND cs NOT IN (20,22,27,33,34) ORDER BY dateConf DESC, dateInsert DESC", false, MYSQL_ASSOC);
$tabRet=array();
foreach ($ret as $i=>$tabCS)
{
$dateEven=$tabCS['dateConf'];
if ($dateEven=='0000-00-00') {
$dateEven=$tabCS['dateInsert'];
}
$tabRet[]=array(
'DateEven' => $dateEven,
'DateFin' => $tabCS['dateFin'],
'CoteCS' => $tabCS['cs'],
//'CoteCSpre' => $tabCS['CSAVAN'],
'LibCS' => $this->tabInfoCS['_'.$tabCS['cs']]['libExt'],
//'LibCSpre' => $this->tabInfoCS[$tabCS['CSAVAN']*1]['libExt'],
'NivRisque' => $this->tabInfoCS['_'.$tabCS['cs']]['risque'],
//'NivRisquePre' => $this->tabInfoCS[$tabCS['CSAVAN']*1]['risque'],
'CodeRisque' => $this->tabInfoCS['_'.$tabCS['cs']]['type'],
);
}
return $tabRet;
}
public function getCoteSpecialeOld($siren)
{
$ret=$this->iDb->select( 'sdv1.ge_cs c LEFT JOIN sdv1.ge_acheteurs a ON a.NUMACH=c.NUMGFH',
'DATMAJ1, NUMGFH, CSAVAN, CSAPRE, SIRENE',
"a.SIRENE=$siren ORDER BY a.SIRENE ASC, c.DATMAJ1 DESC", false, MYSQL_ASSOC);
$tabRet=array();
foreach ($ret as $i=>$tabCS) {
$tabRet[]=array(
'DateEven' => $tabCS['DATMAJ1'],
'CoteCS' => $tabCS['CSAPRE'],
'CoteCSpre' => $tabCS['CSAVAN'],
'LibCS' => $this->tabInfoCS[$tabCS['CSAPRE']*1]['libExt'],
'LibCSpre' => $this->tabInfoCS[$tabCS['CSAVAN']*1]['libExt'],
'NivRisque' => $this->tabInfoCS[$tabCS['CSAPRE']*1]['risque'],
'NivRisquePre' => $this->tabInfoCS[$tabCS['CSAVAN']*1]['risque'],
'CodeRisque' => $this->tabInfoCS[$tabCS['CSAPRE']*1]['type'],
);
}
return $tabRet;
}
public function getPaiements($siren, $echelle='mois')
{
if ($echelle=='jour')
$strGroupBy="GROUP BY p.DATPIE ";
elseif ($echelle=='' || $echelle=='mois')
$strGroupBy="GROUP BY mois HAVING nbPieces>2 ";
elseif ($echelle=='trim')
$strGroupBy="GROUP BY trimestre HAVING nbPieces>2 ";
else // En mois par défaut
$strGroupBy="GROUP BY mois HAVING nbPieces>2 ";
$ret=$this->iDb->select( 'sdv1.ge_paiements p LEFT JOIN sdv1.ge_acheteurs a ON a.NUMACH=p.NUMACH',
"p.NUMACH, DATE_FORMAT(p.DATPIE, '%Y-%m') AS mois,
<?php
/*
2. Concernant la date de fin de CS, devons nous comprendre les cas suivants de la sorte :
A. 026 820 043 I 2009-10-31 La CS était valide jusq'au 31/10/2009... L'entreprise n'a plus de CS ? ou la CS est encore à prendre en compte ?
Lorsqu'une cs manuelle arrive à échéance, elle est soumise à l'examen de l'analyste chaque mois. Si l'analyste n'intervient pas l'acheteur reste en cs.
B. 077 250 025 I 0000-00-00 La CS I n'est plus à prendre en compte ou au contraire, elle n'a pas de date de fin ?
L'acheteur a été sorti de cs entre le traitement de fin de mois et l'extraction ( qui a été déclenchée tardivement à la main ). L'acheteur n'est donc plus en cs.
C. 067 103 598 I 2999-12-31 La CS I n'a pas de date de fin sauf changement ultérieur de CS
Ce cas fait partie des nettoyages à faire par le Crédit ( échéance illimitée sur une cs qui ne le justifie pas ).
D. 067 200 329 I 2010-06-30 La CS est valide jusq'au 30/06/2010... Quid après ?
Cette cs ayant été positionnée par l'analyste, elle sera de nouveau soumise à son examen.
3. Globalement, j'ai l'impression que la CS "Paiements" à une durée de 6-12 mois et la CS "Privilèges" de 12-24 mois ?
La cs paiement a une durée de 6 ou 12 mois pour les cas graves.
La cs privilège a une durée de 27 mois ( sauf bien sur les cs manuelles qui sont à la convenance de l'analyste, en général 12 mois ).
*/
class Metier_Partenaires_MFacto
{
public $risqueImpaye=false; // Y a t'il un risque d'impayé ?
public $risqueImpayeMois=0;
public $profilPayeur=0; // 0:N/D, 1:Excellent, 2=Bon, 3=Normal, 4=Lent, 5=Mauvais ou Défaut
private $typeFlux = 0; // Type de flux en chargement 0:Acheteur, 1=CS, 2=Paiements
private $iDb;
public $DELAIPAY=0;
public $DELAIPAYp='';
public $DELAIPAY_MMAA='';
private $tabInfoCS = array(
'_00' => array('risque'=>0,'type'=>'OK', 'libInt'=>'Néant', 'libExt'=>'Aucune difficulté significative ne nous a été signalée'),
'_10' => array('risque'=>3,'type'=>'IP', 'libInt'=>'Impayé BDF', 'libExt'=>"A surveiller. Présence d'impayé(s)"),
'_11' => array('risque'=>3,'type'=>'IP', 'libInt'=>'Retard de paiement - Prorogation', 'libExt'=>'A suivre. Retard(s) de paiement(s) signalé(s)'),
'_12' => array('risque'=>3,'type'=>'IP', 'libInt'=>'Impayé Groupe Facto', 'libExt'=>"A surveiller. Présence d'impayé(s)"),
'_13' => array('risque'=>3,'type'=>'IP', 'libInt'=>'Impayé BDF (sup. à limite)', 'libExt'=>"A surveiller. Présence d'impayé(s)"),
'_15' => array('risque'=>3,'type'=>'PR', 'libInt'=>'PRIVILEGES URSSAF', 'libExt'=>'A surveiller. Présence de privilèges'),
'_16' => array('risque'=>3,'type'=>'PR', 'libInt'=>'AUTRES PRIVILEGES', 'libExt'=>'A surveiller. Présence de Privilèges'),
'_20' => array('risque'=>4,'type'=>'BL', 'libInt'=>'LIQUIDATION JUDICIAIRE', 'libExt'=>'Liquidation Judiciaire'),
'_21' => array('risque'=>1,'type'=>'BC', 'libInt'=>'CESSATION D\'ACTIVITE', 'libExt'=>'A suivre. Informations terrain. Risque de fermeture'),
'_22' => array('risque'=>1,'type'=>'BD', 'libInt'=>'RADIATION RCS', 'libExt'=>'Radiation du RCS'),
'_23' => array('risque'=>1,'type'=>'BG', 'libInt'=>'LOCATION GERANCE', 'libExt'=>'Prise en location Gérance'),
'_24' => array('risque'=>2,'type'=>'RG', 'libInt'=>'GROUPE EN DIFFICULTE', 'libExt'=>'A suivre. Entreprise(s) du groupe à suivre'),
'_25' => array('risque'=>2,'type'=>'DEF', 'libInt'=>'INFORMATIONS NEGATIVES', 'libExt'=>'A suivre. Informations terrain récentes négatives'),
'_26' => array('risque'=>4,'type'=>'BP', 'libInt'=>'PLAN DE CESSION / DE REDRESSEMENT ', 'libExt'=>'Plan de cession/redressement'),
'_27' => array('risque'=>4,'type'=>'BR', 'libInt'=>'REDRESSEMENT JUDICIAIRE', 'libExt'=>'Redressement Judiciaire'),
'_28' => array('risque'=>4,'type'=>'BH', 'libInt'=>'HOMOLOGATION CONCILIATION / REG.AMIABLE', 'libExt'=>'Conciliation, Homologation ou règlement amiable'),
'_29' => array('risque'=>1,'type'=>'BF', 'libInt'=>'FUSION - ABSORPTION', 'libExt'=>'Fusion/Absorption'),
'_30' => array('risque'=>3,'type'=>'IP', 'libInt'=>'MAUVAISE COTE BDF : .8 ou .9', 'libExt'=>"Présence d'impayé(s)"),
'_31' => array('risque'=>1,'type'=>'TC', 'libInt'=>'CESSATION ANNONCEE', 'libExt'=>'Fin d\'activité programmée'),
'_33' => array('risque'=>4,'type'=>'BS', 'libInt'=>'PROCEDURE DE SAUVEGARDE JUGEMENT', 'libExt'=>'Procédure de Sauvegarde'),
'_34' => array('risque'=>4,'type'=>'BV', 'libInt'=>'PLAN DE SAUVEGARDE', 'libExt'=>'Plan de sauvegarde'),
'_35' => array('risque'=>2,'type'=>'DEF', 'libInt'=>'ANALYSE FINANCIERE NEGATIVE', 'libExt'=>'A suivre. Informations terrain récentes négatives'),
'_36' => array('risque'=>2,'type'=>'DEF', 'libInt'=>'BILAN NEGATIF', 'libExt'=>'A suivre. Informations terrain récentes négatives'),
'_37' => array('risque'=>2,'type'=>'DEF', 'libInt'=>'TRESORERIE SERREE', 'libExt'=>'A suivre. Informations terrain récentes négatives'),
'_39' => array('risque'=>2,'type'=>'DEF', 'libInt'=>'PREVISIONS NEGATIVES', 'libExt'=>'A suivre. Informations terrain récentes négatives'),
'_43' => array('risque'=>2,'type'=>'LC', 'libInt'=>'LC SFAC', 'libExt'=>"A suivre. Garantie d'assurance crédit limitée"),
'_45' => array('risque'=>2,'type'=>'LC', 'libInt'=>'REFUS SFAC DOM-TOM', 'libExt'=>"A suivre. Garantie d'assurance crédit limitée"),
//'_47' =>array('risque'=>2,'type'=>'LC', 'libInt'=>'LISTE CONFIDENTIELLE LEASER', 'libExt'=>"A suivre. Garantie d'assurance crédit limitée"),
'_50' => array('risque'=>2,'type'=>'KO', 'libInt'=>'LIENS AVEC UNE ORGANISATION TERRORISTE', 'libExt'=>'Attention, liens internationaux très risqués'),
//Nouveaux regroupements GE
'_I' => array('risque'=>3,'type'=>'IP', 'libInt'=>'Impayés', 'libExt'=>"A surveiller. Présence d'impayé(s) dans les 12 derniers mois"),
'_P' => array('risque'=>3,'type'=>'PR', 'libInt'=>'PRIVILEGES', 'libExt'=>'A surveiller. Présence de privilèges dans les 24 derniers mois'),
'_D' => array('risque'=>2,'type'=>'DEF', 'libInt'=>'PREVISIONS NEGATIVES', 'libExt'=>'A suivre. Informations terrain récentes négatives'),
'_T' => array('risque'=>2,'type'=>'LC', 'libInt'=>'LC Quelconque', 'libExt'=>"Nombreuses demandes d'avis de crédit"),
);
private $tabTranches = array(
0=>6,
30=>36,
60=>66,
90=>96,
120=>126,
150=>156,
180=>999,
);
private $tabMontants = array(
1=>500,
2=>2000,
10=>10000,
20=>20000,
50=>50000,
100=>100000,
200=>200000,
999=>999999
);
public function __construct($db = null)
{
if ($db === null) {
$this->iDb = new Metier_Util_Db();
} else {
$this->iDb = $db;
}
}
public function setTypeFic($typeFic)
{
$this->typeFlux = $typeFic;
}
public function readFic($a)
{
switch ($this->typeFlux) {
case 0: // Acheteur GESCDCLT - Line length (120 + CRLF = 122)
$tab = array(
'NUMACH'=> trim(substr($a, 0, 7)), // 0-7 | 7
'SIRENE'=> trim(substr($a, 7, 9)), // 7-16 | 9
'RAISOC'=> trim(substr($a, 16, 35)), // 16-51 | 35
'NUMVOI'=> trim(substr($a, 51, 4)), // 51-55 | 4
'TYPVOI'=> trim(substr($a, 55, 3)), // 55-58 | 3
'LIBVOI'=> trim(substr($a, 58, 30)), // 58-88 | 30
'VILLE'=> trim(substr($a, 88, 26)), // 88-114 | 26
'CODPOS'=> trim(substr($a, 114, 5)), // 114-119 | 5
'FILLER'=> trim(substr($a, 119, 2)), // 119-120 | 1
);
break;
case 1: // CS - GESDACH - Line Length (19 + CRLF = 21)
$tab = array(
'siren' => trim(substr($a, 0, 9)), // 0-9 | 9
'cs' => trim(substr($a, 9, 2)), // 9-11 | 2
'dateFin'=> trim(substr($a, 11, 8)), // 11-9 | 8
);
break;
case 2: // Paiements - GESCDMVT - Line length (73 + CRLF = 75)
$tab = array(
'NUMACH'=> trim(substr($a, 0, 7)), // 0-7 | 7
'DATPIE'=> substr($a, 7, 8), // 7-15 | 8
'DATECH'=> substr($a, 15, 8), // 15-23 | 8
'DATPAI'=> substr($a, 23, 8), // 23-31 | 8
'MNTPIE'=> trim(substr($a, 31, 13)), // 31-44 | 13
'MNTFRF'=> trim(substr($a, 44, 13)), // 44-57 | 13
'MNTLIT'=> trim(substr($a, 57, 13)), // 57-70 | 13
'CODDEV'=> trim(substr($a, 70, 3)), // 70-73 | 3
);
break;
}
return $tab;
}
public function getCoteSpeciale($siren)
{
$ret=$this->iDb->select(
'sdv1.ge_cs2',
'siren, cs, dateFin, dateInsert, dateConf',
"siren=$siren AND (dateSuppr=0 OR dateConf>dateSuppr) AND (dateFin=0 OR dateFin>NOW()) AND cs NOT IN (20,22,27,33,34) ORDER BY dateConf DESC, dateInsert DESC", false, MYSQL_ASSOC);
$tabRet=array();
foreach ($ret as $i=>$tabCS) {
$dateEven=$tabCS['dateConf'];
if ($dateEven=='0000-00-00') {
$dateEven=$tabCS['dateInsert'];
}
$tabRet[]=array(
'DateEven' => $dateEven,
'DateFin' => $tabCS['dateFin'],
'CoteCS' => $tabCS['cs'],
//'CoteCSpre' => $tabCS['CSAVAN'],
'LibCS' => $this->tabInfoCS['_'.$tabCS['cs']]['libExt'],
//'LibCSpre' => $this->tabInfoCS[$tabCS['CSAVAN']*1]['libExt'],
'NivRisque' => $this->tabInfoCS['_'.$tabCS['cs']]['risque'],
//'NivRisquePre' => $this->tabInfoCS[$tabCS['CSAVAN']*1]['risque'],
'CodeRisque' => $this->tabInfoCS['_'.$tabCS['cs']]['type'],
);
}
return $tabRet;
}
public function getCoteSpecialeOld($siren)
{
$ret=$this->iDb->select('sdv1.ge_cs c LEFT JOIN sdv1.ge_acheteurs a ON a.NUMACH=c.NUMGFH',
'DATMAJ1, NUMGFH, CSAVAN, CSAPRE, SIRENE',
"a.SIRENE=$siren ORDER BY a.SIRENE ASC, c.DATMAJ1 DESC", false, MYSQL_ASSOC);
$tabRet=array();
foreach ($ret as $i=>$tabCS) {
$tabRet[]=array(
'DateEven' => $tabCS['DATMAJ1'],
'CoteCS' => $tabCS['CSAPRE'],
'CoteCSpre' => $tabCS['CSAVAN'],
'LibCS' => $this->tabInfoCS[$tabCS['CSAPRE']*1]['libExt'],
'LibCSpre' => $this->tabInfoCS[$tabCS['CSAVAN']*1]['libExt'],
'NivRisque' => $this->tabInfoCS[$tabCS['CSAPRE']*1]['risque'],
'NivRisquePre' => $this->tabInfoCS[$tabCS['CSAVAN']*1]['risque'],
'CodeRisque' => $this->tabInfoCS[$tabCS['CSAPRE']*1]['type'],
);
}
return $tabRet;
}
public function getPaiements($siren, $echelle='mois')
{
if ($echelle=='jour') {
$strGroupBy="GROUP BY p.DATPIE ";
} elseif ($echelle=='' || $echelle=='mois') {
$strGroupBy="GROUP BY mois HAVING nbPieces>2 ";
} elseif ($echelle=='trim') {
$strGroupBy="GROUP BY trimestre HAVING nbPieces>2 ";
} else { // En mois par défaut
$strGroupBy="GROUP BY mois HAVING nbPieces>2 ";
}
$ret=$this->iDb->select('sdv1.ge_paiements p LEFT JOIN sdv1.ge_acheteurs a ON a.NUMACH=p.NUMACH',
"p.NUMACH, DATE_FORMAT(p.DATPIE, '%Y-%m') AS mois,
CONCAT(DATE_FORMAT(p.DATPIE,'%Y'),'-',IF(DATE_FORMAT(p.DATPIE,'%m')<4,1,IF(DATE_FORMAT(p.DATPIE,'%m')<7,2,IF(DATE_FORMAT(p.DATPIE,'%m')<10,3,4)))) AS trimestre,
count(*) AS nbPieces,
AVG(DATEDIFF(NOW(), p.DATECH)) AS nbJourRetard, AVG(DATEDIFF(p.DATPAI, p.DATECH)) AS nbJourPaiement,
ROUND(AVG(DATEDIFF(NOW(), p.DATECH) - DATEDIFF(p.DATPAI, p.DATECH))) AS nbJourMoyens,
IF(AVG(DATEDIFF(NOW(), p.DATECH) - DATEDIFF( p.DATPAI, p.DATECH ) ) <6, 0, if( AVG( DATEDIFF( NOW( ) , p.DATECH ) - DATEDIFF( p.DATPAI, p.DATECH ) ) <36, 30, if( AVG( DATEDIFF( NOW( ) , p.DATECH ) - DATEDIFF( p.DATPAI, p.DATECH ) ) <66, 60, if( AVG( DATEDIFF( NOW( ) , p.DATECH ) - DATEDIFF( p.DATPAI, p.DATECH ) ) <96, 90, 120 ) ) ) ) AS nbJours,
SUM(p.MNTPIE) AS mtPieces, SUM(p.MNTFRF) AS mtPaiements, SUM(p.MNTLIT) AS mtLitiges,
p.CODDEV, a.SIRENE, a.RAISOC, a.CODPOS, a.VILLE",
"a.SIRENE=$siren AND DATEDIFF(NOW(),p.DATECH)<736 AND p.DATECH<NOW() $strGroupBy ORDER BY p.DATPIE DESC", false, MYSQL_ASSOC);
$tabRet=array();
foreach ($ret as $i=>$tabPai)
{
$nbJoursMoyen=$tabPai['nbJourRetard']-$tabPai['nbJourPaiement'];
if ($nbJoursMoyen<6) $tranche=0;
elseif ($nbJoursMoyen<36) $tranche=30;
elseif ($nbJoursMoyen<66) $tranche=60;
elseif ($nbJoursMoyen<96) $tranche=90;
elseif ($nbJoursMoyen<126) $tranche=120;
elseif ($nbJoursMoyen<156) $tranche=150;
else $tranche=180;
$tabRet[]=array(
'trimestre' => $tabPai['trimestre'],
'mois' => $tabPai['mois'],
'nbPieces' => $tabPai['nbPieces'],
'nbJourRetard' => $tabPai['nbJourRetard'],
'nbJourPaiement'=> $tabPai['nbJourPaiement'],
'nbJourMoyen' => $nbJoursMoyen,
'nbJourMoyen2' => $tabPai['nbJourMoyens'],
'tranchePaiement'=>$tranche,
'tranchePaie90' =>$tabPai['nbJours'],
'mtPieces' => $tabPai['mtPieces'],
'mtPaiements' => $tabPai['mtPaiements'],
'mtLitiges' => $tabPai['mtLitiges'],
'devise' => $tabPai['CODDEV'],
);
}
return $tabRet;
}
public function getProfilPayeur($siren)
{
if ($siren<1000) return '';
$libProfil='';
/*if ($this->siren==$siren)
$tabPaie=$this->tabPaiements;
else*/
$tabPaie=$this->getPaiements($siren);
if (count($tabPaie)>=3) {
$tabProfil=array();
$paie_min=180;
$paie_max=$totFactures=$totPaiements=$totLitiges=0;
foreach ($tabPaie as $i=>$tabPai) {
if ($i==0) { $this->risqueImpayeMois=$tabPai['mois'];
// Dernier délai de paiement en jour
$this->DELAIPAY=$tabPai['tranchePaiement'];
} elseif ($this->DELAIPAYp=='' && $tabPai['tranchePaiement']<>$this->DELAIPAY ) {
$this->DELAIPAYp=$tabPai['tranchePaiement'];
$this->DELAIPAY_MMAA=$tabPai['mois'];
}
$tabProfil[$i]=$tabPai['tranchePaiement'];
$totFactures+=$tabPai['mtPieces'];
$totPaiements+=$tabPai['mtPaiements'];
$totLitiges+=$tabPai['mtLitiges'];
if ($tabPai['tranchePaiement']<$paie_min) $paie_min=$tabPai['tranchePaiement'];
if ($tabPai['tranchePaiement']>$paie_max) $paie_max=$tabPai['tranchePaiement'];
}
$tauxLitige=$totLitiges/$totFactures;
if ($tauxLitige>=0.5) $libProfil.='Litiges très importants. ';
elseif ($tauxLitige>0.25) $libProfil.='Litiges importants. ';
elseif ($tauxLitige>0.05) $libProfil.='Présence de litiges. ';
if ($tabProfil[0]==$tabProfil[1] && $tabProfil[1]==$tabProfil[2]) {
if ($tranche=0) { $libProfil.='Paiements à échéance'; $this->profilPayeur=1; }
elseif ($tranche<=30) { $libProfil.='Paiements à 30 jours maximum'; $this->profilPayeur=2; }
elseif ($tranche<=60) { $libProfil.='Paiements à 60 jours maximum'; $this->profilPayeur=3; }
elseif ($tranche<=90) { $libProfil.='Paiements à 90 jours maximum'; $this->profilPayeur=4; $this->risqueImpaye=true;}
else { $libProfil.='Paiements à plus de 90 jours'; $this->profilPayeur=4; $this->risqueImpaye=true;}
} elseif ( ($tabProfil[0]<>$tabProfil[1] && $tabProfil[1]==$tabProfil[2]) ||
($tabProfil[0]==$tabProfil[1] && $tabProfil[1]<>$tabProfil[2]) ) {
// Récent changement de profil payeur
$tranche=$tabProfil[0];
$tr_prec=$tabProfil[1];
$tr_prec2=$tabProfil[2];
if ($tranche<$tr_prec) $libProfil.='Amélioration des délais. ';
elseif ($tranche==$tr_prec && $tr_prec<$tr_prec2) $libProfil.='Amélioration des délais. ';
else { $this->risqueImpaye=true; $libProfil.='Allongement des délais. '; }
if ($tranche=0) { $libProfil.='Paiements à échéance'; $this->profilPayeur=1; }
elseif ($tranche<=30) { $libProfil.='Paiements à 30 jours maximum'; $this->profilPayeur=2; }
elseif ($tranche<=60) { $libProfil.='Paiements à 60 jours maximum'; $this->profilPayeur=3; }
elseif ($tranche<=90) { $libProfil.='Paiements à 90 jours maximum'; $this->profilPayeur=4; $this->risqueImpaye=true;}
else { $libProfil.='Paiements à plus de 90 jours'; $this->profilPayeur=4; $this->risqueImpaye=true;}
} else {
if ($paie_max<=30) $this->profilPayeur=1;
elseif ($paie_max<=60) $this->profilPayeur=2;
elseif ($paie_max<=90) $this->profilPayeur=3;
elseif ($paie_max>90) $this->profilPayeur=4;
$libProfil.="Paiements entre $paie_min et $paie_max jour(s)";
}
}
if (trim($libProfil)=='' && $siren<>552100554 && $siren<>552144503 && $siren<>479974115
&& $siren<>0 && $siren<>494967938 ) {
$ret=$this->iDb->select('jo.surveillances_listes',
'ref, dateAjout, dateConf, dateSuppr, dateDerEnvoi',
"idClient='SURBODPRDFTSRECOCASH' AND siren=$siren AND dateSuppr=0
p.CODDEV, a.SIRENE, a.RAISOC, a.CODPOS, a.VILLE",
"a.SIRENE=$siren AND DATEDIFF(NOW(),p.DATECH)<736 AND p.DATECH<NOW() $strGroupBy ORDER BY p.DATPIE DESC", false, MYSQL_ASSOC);
$tabRet=array();
foreach ($ret as $i=>$tabPai) {
$nbJoursMoyen=$tabPai['nbJourRetard']-$tabPai['nbJourPaiement'];
if ($nbJoursMoyen<6) {
$tranche=0;
} elseif ($nbJoursMoyen<36) {
$tranche=30;
} elseif ($nbJoursMoyen<66) {
$tranche=60;
} elseif ($nbJoursMoyen<96) {
$tranche=90;
} elseif ($nbJoursMoyen<126) {
$tranche=120;
} elseif ($nbJoursMoyen<156) {
$tranche=150;
} else {
$tranche=180;
}
$tabRet[]=array(
'trimestre' => $tabPai['trimestre'],
'mois' => $tabPai['mois'],
'nbPieces' => $tabPai['nbPieces'],
'nbJourRetard' => $tabPai['nbJourRetard'],
'nbJourPaiement'=> $tabPai['nbJourPaiement'],
'nbJourMoyen' => $nbJoursMoyen,
'nbJourMoyen2' => $tabPai['nbJourMoyens'],
'tranchePaiement'=>$tranche,
'tranchePaie90' =>$tabPai['nbJours'],
'mtPieces' => $tabPai['mtPieces'],
'mtPaiements' => $tabPai['mtPaiements'],
'mtLitiges' => $tabPai['mtLitiges'],
'devise' => $tabPai['CODDEV'],
);
}
return $tabRet;
}
public function getProfilPayeur($siren)
{
if ($siren<1000) {
return '';
}
$libProfil='';
/*if ($this->siren==$siren)
$tabPaie=$this->tabPaiements;
else*/
$tabPaie=$this->getPaiements($siren);
if (count($tabPaie)>=3) {
$tabProfil=array();
$paie_min=180;
$paie_max=$totFactures=$totPaiements=$totLitiges=0;
foreach ($tabPaie as $i=>$tabPai) {
if ($i==0) {
$this->risqueImpayeMois=$tabPai['mois'];
// Dernier délai de paiement en jour
$this->DELAIPAY=$tabPai['tranchePaiement'];
} elseif ($this->DELAIPAYp=='' && $tabPai['tranchePaiement']<>$this->DELAIPAY) {
$this->DELAIPAYp=$tabPai['tranchePaiement'];
$this->DELAIPAY_MMAA=$tabPai['mois'];
}
$tabProfil[$i]=$tabPai['tranchePaiement'];
$totFactures+=$tabPai['mtPieces'];
$totPaiements+=$tabPai['mtPaiements'];
$totLitiges+=$tabPai['mtLitiges'];
if ($tabPai['tranchePaiement']<$paie_min) {
$paie_min=$tabPai['tranchePaiement'];
}
if ($tabPai['tranchePaiement']>$paie_max) {
$paie_max=$tabPai['tranchePaiement'];
}
}
$tauxLitige=$totLitiges/$totFactures;
if ($tauxLitige>=0.5) {
$libProfil.='Litiges très importants. ';
} elseif ($tauxLitige>0.25) {
$libProfil.='Litiges importants. ';
} elseif ($tauxLitige>0.05) {
$libProfil.='Présence de litiges. ';
}
if ($tabProfil[0]==$tabProfil[1] && $tabProfil[1]==$tabProfil[2]) {
if ($tranche=0) {
$libProfil.='Paiements à échéance';
$this->profilPayeur=1;
} elseif ($tranche<=30) {
$libProfil.='Paiements à 30 jours maximum';
$this->profilPayeur=2;
} elseif ($tranche<=60) {
$libProfil.='Paiements à 60 jours maximum';
$this->profilPayeur=3;
} elseif ($tranche<=90) {
$libProfil.='Paiements à 90 jours maximum';
$this->profilPayeur=4;
$this->risqueImpaye=true;
} else {
$libProfil.='Paiements à plus de 90 jours';
$this->profilPayeur=4;
$this->risqueImpaye=true;
}
} elseif (($tabProfil[0]<>$tabProfil[1] && $tabProfil[1]==$tabProfil[2]) ||
($tabProfil[0]==$tabProfil[1] && $tabProfil[1]<>$tabProfil[2])) {
// Récent changement de profil payeur
$tranche=$tabProfil[0];
$tr_prec=$tabProfil[1];
$tr_prec2=$tabProfil[2];
if ($tranche<$tr_prec) {
$libProfil.='Amélioration des délais. ';
} elseif ($tranche==$tr_prec && $tr_prec<$tr_prec2) {
$libProfil.='Amélioration des délais. ';
} else {
$this->risqueImpaye=true;
$libProfil.='Allongement des délais. ';
}
if ($tranche=0) {
$libProfil.='Paiements à échéance';
$this->profilPayeur=1;
} elseif ($tranche<=30) {
$libProfil.='Paiements à 30 jours maximum';
$this->profilPayeur=2;
} elseif ($tranche<=60) {
$libProfil.='Paiements à 60 jours maximum';
$this->profilPayeur=3;
} elseif ($tranche<=90) {
$libProfil.='Paiements à 90 jours maximum';
$this->profilPayeur=4;
$this->risqueImpaye=true;
} else {
$libProfil.='Paiements à plus de 90 jours';
$this->profilPayeur=4;
$this->risqueImpaye=true;
}
} else {
if ($paie_max<=30) {
$this->profilPayeur=1;
} elseif ($paie_max<=60) {
$this->profilPayeur=2;
} elseif ($paie_max<=90) {
$this->profilPayeur=3;
} elseif ($paie_max>90) {
$this->profilPayeur=4;
}
$libProfil.="Paiements entre $paie_min et $paie_max jour(s)";
}
}
if (trim($libProfil)=='' && $siren<>552100554 && $siren<>552144503 && $siren<>479974115
&& $siren<>0 && $siren<>494967938) {
$ret=$this->iDb->select('jo.surveillances_listes',
'ref, dateAjout, dateConf, dateSuppr, dateDerEnvoi',
"idClient='SURBODPRDFTSRECOCASH' AND siren=$siren AND dateSuppr=0
AND ABS(DATEDIFF(dateAjout, NOW()))<365
ORDER BY dateConf DESC, dateAjout DESC", false, MYSQL_ASSOC);
foreach ($ret as $i=>$tabCS) {
$dateMAJ = Metier_Util_Date::dateT('Y-m-d', 'M Y', $tabCS['dateAjout']);
$libProfil="En date du $dateMAJ : Contentieux importants.";
$this->risqueImpaye=true;
$this->risqueImpayeMois=Metier_Util_Date::dateT('Y-m', 'Ym', $tabCS['dateAjout']);
$this->profilPayeur=4;
break;
}
}
return $libProfil;
}
public function getTabPaiements($siren)
{
if ($siren<1000) return false;
$tabNbr=array(); // Tableau de travail du nombre de factures par trimestre et par tranches de délais de paiements
$tabMtAn=array(); // Tableau de travail du nombre de factures par montant et par tranches de délais de paiements
$tabNbr2=array(); // Tableau retour du nombre de factures par trimestre et par tranches de délais de paiements
$tabMtAn2=array(); // Tableau retour du nombre de factures par montant et par tranches de délais de paiements
$tabPaie=$this->getPaiements($siren, 'jour');
foreach ($tabPaie as $i=>$tabPai)
{
@$tabNbr[$tabPai['trimestre']]['d='.$tabPai['tranchePaiement']]+=$tabPai['nbPieces'];
@$tabNbr[$tabPai['trimestre']]['all']+=$tabPai['nbPieces'];
$mt=$tabPai['mtPieces']/$tabPai['nbPieces'];
//echo "$i\t".$tabPai['trimestre']." (".$tabPai['tranchePaiement']." j)\t$mt=".$tabPai['mtPieces'].'/'.$tabPai['nbPieces'].PHP_EOL;
if ($mt<500) { @$tabMtAn[1]['d='.$tabPai['tranchePaiement']]++; @$tabMtAn[1]['all']++; }
elseif ($mt<2000) { @$tabMtAn[2]['d='.$tabPai['tranchePaiement']]++; @$tabMtAn[2]['all']++; }
elseif ($mt<10000) { @$tabMtAn[10]['d='.$tabPai['tranchePaiement']]++; @$tabMtAn[10]['all']++; }
elseif ($mt<20000) { @$tabMtAn[20]['d='.$tabPai['tranchePaiement']]++; @$tabMtAn[20]['all']++; }
elseif ($mt<50000) { @$tabMtAn[50]['d='.$tabPai['tranchePaiement']]++; @$tabMtAn[50]['all']++; }
elseif ($mt<100000) { @$tabMtAn[100]['d='.$tabPai['tranchePaiement']]++; @$tabMtAn[100]['all']++; }
elseif ($mt<200000) { @$tabMtAn[200]['d='.$tabPai['tranchePaiement']]++; @$tabMtAn[200]['all']++; }
else { @$tabMtAn[999]['d='.$tabPai['tranchePaiement']]++; @$tabMtAn[999]['all']++; }
//@$tabMtAn['all'][$tabPai['tranchePaiement']]++;
}
// Recalcul des délais par Trimestre
foreach ($tabNbr as $trim=>$tabTranche)
{
ksort($tabTranche);
// Initialisation des tranches à 0
foreach ($this->tabTranches as $tranche=>$vide)
$tabNbr2[$trim]['nb']=$tabNbr2[$trim]['d='.$tranche]=0;
foreach ($tabTranche as $tranche=>$mt3)
{
$tranche=str_replace('d=','',$tranche);
if ($tranche=='all') $tabNbr2[$trim]['nb']=$mt3;
else $tabNbr2[$trim]['d='.$tranche]=round(($mt3/$tabNbr2[$trim]['nb'])*100,1);
}
}
// Initialisation des tranches à 0 par Montants
foreach ($this->tabMontants as $mt=>$vide)
{
$tabMtAn2['_'.$mt]['nb']=0;
foreach ($this->tabTranches as $tranche=>$vide)
$tabMtAn2['_'.$mt]['d='.$tranche]=0;
}
// Recalcul des délais par Montants
ksort($tabMtAn);
foreach ($tabMtAn as $mt=>$tabTranche)
{
ksort($tabTranche);
foreach ($tabTranche as $tranche=>$mt2)
{
$tranche=str_replace('d=','',$tranche);
if ($tranche=='all') $tabMtAn2['_'.$mt]['nb']=$mt2;
else $tabMtAn2['_'.$mt]['d='.$tranche]=round(($mt2/$tabMtAn2['_'.$mt]['nb'])*100,1);
}
}
return array(
'parMont'=>$tabMtAn2,
'parTrim'=>$tabNbr2
);
}
public function getLibInfoCS($cs)
{
return array(
'CoteCS' => $cs,
'LibCS' => $this->tabInfoCS["_$cs"]['libExt'],
'NivRisque' => $this->tabInfoCS["_$cs"]['risque'],
'CodeRisque' => $this->tabInfoCS["_$cs"]['type'],
);
}
}
ORDER BY dateConf DESC, dateAjout DESC", false, MYSQL_ASSOC);
foreach ($ret as $i=>$tabCS) {
$dateMAJ = Metier_Util_Date::dateT('Y-m-d', 'M Y', $tabCS['dateAjout']);
$libProfil="En date du $dateMAJ : Contentieux importants.";
$this->risqueImpaye=true;
$this->risqueImpayeMois=Metier_Util_Date::dateT('Y-m', 'Ym', $tabCS['dateAjout']);
$this->profilPayeur=4;
break;
}
}
return $libProfil;
}
public function getTabPaiements($siren)
{
if ($siren<1000) {
return false;
}
$tabNbr=array(); // Tableau de travail du nombre de factures par trimestre et par tranches de délais de paiements
$tabMtAn=array(); // Tableau de travail du nombre de factures par montant et par tranches de délais de paiements
$tabNbr2=array(); // Tableau retour du nombre de factures par trimestre et par tranches de délais de paiements
$tabMtAn2=array(); // Tableau retour du nombre de factures par montant et par tranches de délais de paiements
$tabPaie=$this->getPaiements($siren, 'jour');
foreach ($tabPaie as $i=>$tabPai) {
@$tabNbr[$tabPai['trimestre']]['d='.$tabPai['tranchePaiement']]+=$tabPai['nbPieces'];
@$tabNbr[$tabPai['trimestre']]['all']+=$tabPai['nbPieces'];
$mt=$tabPai['mtPieces']/$tabPai['nbPieces'];
//echo "$i\t".$tabPai['trimestre']." (".$tabPai['tranchePaiement']." j)\t$mt=".$tabPai['mtPieces'].'/'.$tabPai['nbPieces'].PHP_EOL;
if ($mt<500) {
@$tabMtAn[1]['d='.$tabPai['tranchePaiement']]++;
@$tabMtAn[1]['all']++;
} elseif ($mt<2000) {
@$tabMtAn[2]['d='.$tabPai['tranchePaiement']]++;
@$tabMtAn[2]['all']++;
} elseif ($mt<10000) {
@$tabMtAn[10]['d='.$tabPai['tranchePaiement']]++;
@$tabMtAn[10]['all']++;
} elseif ($mt<20000) {
@$tabMtAn[20]['d='.$tabPai['tranchePaiement']]++;
@$tabMtAn[20]['all']++;
} elseif ($mt<50000) {
@$tabMtAn[50]['d='.$tabPai['tranchePaiement']]++;
@$tabMtAn[50]['all']++;
} elseif ($mt<100000) {
@$tabMtAn[100]['d='.$tabPai['tranchePaiement']]++;
@$tabMtAn[100]['all']++;
} elseif ($mt<200000) {
@$tabMtAn[200]['d='.$tabPai['tranchePaiement']]++;
@$tabMtAn[200]['all']++;
} else {
@$tabMtAn[999]['d='.$tabPai['tranchePaiement']]++;
@$tabMtAn[999]['all']++;
}
//@$tabMtAn['all'][$tabPai['tranchePaiement']]++;
}
// Recalcul des délais par Trimestre
foreach ($tabNbr as $trim=>$tabTranche) {
ksort($tabTranche);
// Initialisation des tranches à 0
foreach ($this->tabTranches as $tranche=>$vide) {
$tabNbr2[$trim]['nb']=$tabNbr2[$trim]['d='.$tranche]=0;
}
foreach ($tabTranche as $tranche=>$mt3) {
$tranche=str_replace('d=', '', $tranche);
if ($tranche=='all') {
$tabNbr2[$trim]['nb']=$mt3;
} else {
$tabNbr2[$trim]['d='.$tranche]=round(($mt3/$tabNbr2[$trim]['nb'])*100, 1);
}
}
}
// Initialisation des tranches à 0 par Montants
foreach ($this->tabMontants as $mt=>$vide) {
$tabMtAn2['_'.$mt]['nb']=0;
foreach ($this->tabTranches as $tranche=>$vide) {
$tabMtAn2['_'.$mt]['d='.$tranche]=0;
}
}
// Recalcul des délais par Montants
ksort($tabMtAn);
foreach ($tabMtAn as $mt=>$tabTranche) {
ksort($tabTranche);
foreach ($tabTranche as $tranche=>$mt2) {
$tranche=str_replace('d=', '', $tranche);
if ($tranche=='all') {
$tabMtAn2['_'.$mt]['nb']=$mt2;
} else {
$tabMtAn2['_'.$mt]['d='.$tranche]=round(($mt2/$tabMtAn2['_'.$mt]['nb'])*100, 1);
}
}
}
return array(
'parMont'=>$tabMtAn2,
'parTrim'=>$tabNbr2
);
}
public function getLibInfoCS($cs)
{
return array(
'CoteCS' => $cs,
'LibCS' => $this->tabInfoCS["_$cs"]['libExt'],
'NivRisque' => $this->tabInfoCS["_$cs"]['risque'],
'CodeRisque' => $this->tabInfoCS["_$cs"]['type'],
);
}
}

View File

@ -1,123 +1,122 @@
<?php
class Metier_Partenaires_MGreffes
{
public $iDb;
public function __construct($db = null)
{
if ( $db === null ) {
$this->iDb = new Metier_Util_Db();
} else {
$this->iDb = $db;
}
}
/**
* Retourne Identite Greffe
* @param string $siren
*/
public function getIdentite($siren)
{
$id = false;
$res = $this->iDb->select('jo.greffes_identite',
'id, siren, nom, nomCommercial, adresse, adresse2, cp, ville, enseigne, siege, fj, fjLib, naf, nafLib, numRC, numRC2, typeRCS, numGreffe, libGreffe, dateCreation, dateRadiation, dateCloture, ca, res, eff, dateInsert',
"siren=$siren");
if (count($res) > 0) {
$ent=$res[0];
$id=$ent['id'];
$siren=$ent['siren'];
$siege=$ent['siege'];
$nom=$ent['nom'];
$nomCom=$ent['nomCommercial'];
$ens=$ent['ens'];
$adr=$ent['adresse'];
$adr2=$ent['adresse2'];
$cp=$ent['cp'];
$ville=$ent['ville'];
$cj=$ent['fj'];
$cjLib=$ent['fjLib'];
$naf=$ent['naf'];
$nafLib=$ent['nafLib'];
$numRC=$ent['numRC'];
$numRC2=$ent['numRC2'];
$greffe_num=$ent['numGreffe'];
$typeRCS=$ent['typeRCS'];
$dateCre=$ent['dateCreation'];
$dateRad=$ent['dateRadiation'];
$dateCloture=$ent['dateCloture'];
$dateInsert=$ent['dateInsert'];
}
if ($id) {
$tabRet = array(
'id' => $id,// A calculer après insert
'Pertinence' => 100,
'Siret' => $siren.'00000',
'Siege' => $siege,
'Nom' => $nom,
'Nom2' => $nomCom,
'Sigle' => '',
'Enseigne' => $ens,
'Adresse' => $adr,
'Adresse2' => $adr2,
'CP' => $cp,
'Ville' => $ville,
'Tel' => '',
'Fax' => '',
'FJ' => $cj,
'FJLib' => $cjLib,
'Siren' => $siren,
'Nic' => '00000',
'Actif' => 0,
'NafEtab' => $naf,
'NafEtabLib' => $nafLib,
'NafEnt' => $naf,
'NafEntLib' => $nafLib,
'NumRC' => $numRC,
'NumRC2' => $numRC2,
'NumGreffe' => $greffe_num,
'DateCreation' => $dateCre,
'DateRadiation' => $dateRad,
'DateCloture' => $dateCloture,
'DateUpdate' => substr($dateInsert,0,10),
);
return $tabRet;
}
return false;
}
/**
* Cession
* @param string $siren
*/
public function getInfosCessions($siren)
{
$ret=$this->iDb->select('jo.greffes_cessions', 'id, siren, nom, libGreffe, inscrit, etat, dateImmat, dateJuge, dateConv, dateLJS, dateInventaire, dateBodacc, caDeclare, effectif, descriptif, pdfLink, pdfSize, pdfVer, pdfPage, descDateDepot, dateLimite, mandataire, dateInsert', "siren=$siren", false, MYSQL_ASSOC);
if (count($ret)>0) {
$tabCes=$ret[0];
if (count($ret)>1) {
$mail = new Metier_Common_Mail();
$mail->send('debug@scores-decisions.com', 'ylenaour@scores-decisions.com', "classMGreffes.php : Debug getInfosCessions $siren", "Plus de 1 cession pour ce siren");
}
return array(
'cessJuge'=> $tabCes['etat'],
'cessDateJuge'=>$tabCes['dateJuge'],
'cessDateConv'=>$tabCes['dateConv'],
'cessDateLJS'=> $tabCes['dateLJS'],
'cessDateInv'=> $tabCes['dateInventaire'],
'cessDateBod'=> $tabCes['dateBodacc'],
'cessCAdec'=> $tabCes['caDeclare'],
'cessEffectif'=>$tabCes['effectif'],
'cessDesc'=> $tabCes['descriptif'],
'cessDateDesc'=>$tabCes['descDateDepot'],
'cessDateLim'=> $tabCes['dateLimite'],
'cessMand'=> $tabCes['mandataire'],
);
}
else {
return false;
}
}
}
<?php
class Metier_Partenaires_MGreffes
{
public $iDb;
public function __construct($db = null)
{
if ($db === null) {
$this->iDb = new Metier_Util_Db();
} else {
$this->iDb = $db;
}
}
/**
* Retourne Identite Greffe
* @param string $siren
*/
public function getIdentite($siren)
{
$id = false;
$res = $this->iDb->select('jo.greffes_identite',
'id, siren, nom, nomCommercial, adresse, adresse2, cp, ville, enseigne, siege, fj, fjLib, naf, nafLib, numRC, numRC2, typeRCS, numGreffe, libGreffe, dateCreation, dateRadiation, dateCloture, ca, res, eff, dateInsert',
"siren=$siren");
if (count($res) > 0) {
$ent=$res[0];
$id=$ent['id'];
$siren=$ent['siren'];
$siege=$ent['siege'];
$nom=$ent['nom'];
$nomCom=$ent['nomCommercial'];
$ens=$ent['ens'];
$adr=$ent['adresse'];
$adr2=$ent['adresse2'];
$cp=$ent['cp'];
$ville=$ent['ville'];
$cj=$ent['fj'];
$cjLib=$ent['fjLib'];
$naf=$ent['naf'];
$nafLib=$ent['nafLib'];
$numRC=$ent['numRC'];
$numRC2=$ent['numRC2'];
$greffe_num=$ent['numGreffe'];
$typeRCS=$ent['typeRCS'];
$dateCre=$ent['dateCreation'];
$dateRad=$ent['dateRadiation'];
$dateCloture=$ent['dateCloture'];
$dateInsert=$ent['dateInsert'];
}
if ($id) {
$tabRet = array(
'id' => $id,// A calculer après insert
'Pertinence' => 100,
'Siret' => $siren.'00000',
'Siege' => $siege,
'Nom' => $nom,
'Nom2' => $nomCom,
'Sigle' => '',
'Enseigne' => $ens,
'Adresse' => $adr,
'Adresse2' => $adr2,
'CP' => $cp,
'Ville' => $ville,
'Tel' => '',
'Fax' => '',
'FJ' => $cj,
'FJLib' => $cjLib,
'Siren' => $siren,
'Nic' => '00000',
'Actif' => 0,
'NafEtab' => $naf,
'NafEtabLib' => $nafLib,
'NafEnt' => $naf,
'NafEntLib' => $nafLib,
'NumRC' => $numRC,
'NumRC2' => $numRC2,
'NumGreffe' => $greffe_num,
'DateCreation' => $dateCre,
'DateRadiation' => $dateRad,
'DateCloture' => $dateCloture,
'DateUpdate' => substr($dateInsert, 0, 10),
);
return $tabRet;
}
return false;
}
/**
* Cession
* @param string $siren
*/
public function getInfosCessions($siren)
{
$ret=$this->iDb->select('jo.greffes_cessions', 'id, siren, nom, libGreffe, inscrit, etat, dateImmat, dateJuge, dateConv, dateLJS, dateInventaire, dateBodacc, caDeclare, effectif, descriptif, pdfLink, pdfSize, pdfVer, pdfPage, descDateDepot, dateLimite, mandataire, dateInsert', "siren=$siren", false, MYSQL_ASSOC);
if (count($ret)>0) {
$tabCes=$ret[0];
if (count($ret)>1) {
$mail = new Metier_Common_Mail();
$mail->send('debug@scores-decisions.com', 'ylenaour@scores-decisions.com', "classMGreffes.php : Debug getInfosCessions $siren", "Plus de 1 cession pour ce siren");
}
return array(
'cessJuge'=> $tabCes['etat'],
'cessDateJuge'=>$tabCes['dateJuge'],
'cessDateConv'=>$tabCes['dateConv'],
'cessDateLJS'=> $tabCes['dateLJS'],
'cessDateInv'=> $tabCes['dateInventaire'],
'cessDateBod'=> $tabCes['dateBodacc'],
'cessCAdec'=> $tabCes['caDeclare'],
'cessEffectif'=>$tabCes['effectif'],
'cessDesc'=> $tabCes['descriptif'],
'cessDateDesc'=>$tabCes['descDateDepot'],
'cessDateLim'=> $tabCes['dateLimite'],
'cessMand'=> $tabCes['mandataire'],
);
} else {
return false;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,15 @@
<?php
function supprDecimales($dec) {
if ($dec>0 )
function supprDecimales($dec)
{
if ($dec>0) {
return floor($dec);
else
return ceil($dec);
} else {
return ceil($dec);
}
}
function dec2dms($dec) {
function dec2dms($dec)
{
$d = supprDecimales($dec);
$m = supprDecimales(($dec - $d) * 60);
$s = abs(round(((($dec - $d) * 60) - $m) * 60));
@ -15,24 +18,25 @@ function dec2dms($dec) {
}
/**/
function ALG0001($phi,$e) {
$temp = ( 1 - ( $e * sin( $phi ) ) ) / ( 1 + ( $e * sin( $phi ) ) );
$L = log ( tan ( (pi()/4) + ($phi/2) ) * pow ($temp, ($e/2) ));
function ALG0001($phi, $e)
{
$temp = (1 - ($e * sin($phi))) / (1 + ($e * sin($phi)));
$L = log(tan((pi()/4) + ($phi/2)) * pow($temp, ($e/2)));
return $L;
}
/** Calcul de la latitude à partir de la latitude isométrique
**/
function ALG0002($L,$e,$epsilon) {
function ALG0002($L, $e, $epsilon)
{
$phi[0] = 2 * atan(exp($L)) - (pi()/2);
$i=0;
do {
$i++;
$temp = ( 1 + ( $e * sin( $phi[$i-1] ) ) ) / ( 1 - ( $e * sin( $phi[$i-1] ) ) );
$phi[$i] = 2 * atan ( pow ($temp, ($e/2)) * exp ($L) ) - pi()/2;
}
while (abs($phi[$i] - $phi[$i - 1]) >= $epsilon);
$temp = (1 + ($e * sin($phi[$i-1]))) / (1 - ($e * sin($phi[$i-1])));
$phi[$i] = 2 * atan(pow($temp, ($e/2)) * exp($L)) - pi()/2;
} while (abs($phi[$i] - $phi[$i - 1]) >= $epsilon);
return $phi[$i];
}
@ -50,15 +54,16 @@ function ALG0002($L,$e,$epsilon) {
** @return array lambda Longitude par rapport au méridien origine
** phi Latitude
**/
function ALG0004($X,$Y,$n,$c,$Xs,$Ys,$lambdac,$e,$epsilon) {
$R = sqrt( pow(($X - $Xs),2) + pow(($Y - $Ys),2) );
function ALG0004($X, $Y, $n, $c, $Xs, $Ys, $lambdac, $e, $epsilon)
{
$R = sqrt(pow(($X - $Xs), 2) + pow(($Y - $Ys), 2));
$gamma = atan(($X - $Xs)/($Ys - $Y));
$lambda = $lambdac + ($gamma / $n);
$L = (-1 / $n) * log(abs($R/$c));
$phi = ALG0002($L,$e,$epsilon);
$phi = ALG0002($L, $e, $epsilon);
$coords['lambda']=$lambda;
$coords['phi']=$phi;
@ -69,14 +74,15 @@ function ALG0004($X,$Y,$n,$c,$Xs,$Ys,$lambdac,$e,$epsilon) {
/** Transformation des coordonnées géographiques ellipsoïdales en coordonnées cartésiennes
**
**/
function ALG0009($lambda,$phi,$he,$a,$e) {
$N = ALG0021($phi,$a,$e);
function ALG0009($lambda, $phi, $he, $a, $e)
{
$N = ALG0021($phi, $a, $e);
$X = ($N + $he) * cos($phi) * cos($lambda);
$Y = ($N + $he) * cos($phi) * sin($lambda);
$Z = ($N * (1 - $e*$e) + $he) * sin ($phi);
$Z = ($N * (1 - $e*$e) + $he) * sin($phi);
$coords['X']=$X;
$coords['Y']=$Y;
@ -86,20 +92,19 @@ function ALG0009($lambda,$phi,$he,$a,$e) {
}
/**/
function ALG0012($X,$Y,$Z,$a,$e,$epsilon) {
$lambda = atan ($Y/$X);
function ALG0012($X, $Y, $Z, $a, $e, $epsilon)
{
$lambda = atan($Y/$X);
$P = sqrt($X*$X + $Y*$Y);
$phi[0] = atan ($Z/ ($P * (1 - ( ($a*$e*$e)/sqrt($X*$X + $Y*$Y + $Z*$Z) ) ) ) );
$phi[0] = atan($Z/ ($P * (1 - (($a*$e*$e)/sqrt($X*$X + $Y*$Y + $Z*$Z)))));
$i = 0;
do
{
do {
$i++;
$temp = pow((1 - ( $a * $e*$e * cos($phi[$i - 1] )/( $P * sqrt(1 - $e*$e * sin($phi[$i - 1])*sin($phi[$i - 1]))))),-1);
$phi[$i] = atan( $temp * $Z / $P );
}
while (abs($phi[$i] - $phi[$i - 1]) >= $epsilon);
$temp = pow((1 - ($a * $e*$e * cos($phi[$i - 1])/($P * sqrt(1 - $e*$e * sin($phi[$i - 1])*sin($phi[$i - 1]))))), -1);
$phi[$i] = atan($temp * $Z / $P);
} while (abs($phi[$i] - $phi[$i - 1]) >= $epsilon);
$phix = $phi[$i];
@ -123,7 +128,8 @@ function ALG0012($X,$Y,$Z,$a,$e,$epsilon) {
** @param double $U Vecteur de coordonnées cartésiennes tridimensionnelles dans le système 1 : U=(Ux,Uy,Uz)
** @return array Vecteur de coordonnées cartésiennes tridimensionnelles dans le système 2, V=(Vx,Vy,Vz)
*/
function ALG0013($Tx,$Ty,$Tz,$D,$Rx,$Ry,$Rz,$U) {
function ALG0013($Tx, $Ty, $Tz, $D, $Rx, $Ry, $Rz, $U)
{
$V=array();
$V['X'] = $Tx + $U['X'] * (1 + $D) + $U['Z'] * $Ry - $U['Y'] * $Rz;
$V['Y'] = $Ty + $U['Y'] * (1 + $D) + $U['X'] * $Rz - $U['Z'] * $Rx;
@ -135,12 +141,13 @@ function ALG0013($Tx,$Ty,$Tz,$D,$Rx,$Ry,$Rz,$U) {
** dans le cas tangent, avec ou sans facteur d'échelle en fonction des paramètres de définition usuels
** @return array n, C, lambdac, Xs, Ys
**/
function ALG0019($lambda0,$phi0,$k0,$X0,$Y0,$a,$e) {
function ALG0019($lambda0, $phi0, $k0, $X0, $Y0, $a, $e)
{
$lambdac = $lambda0;
$n = sin($phi0);
$C = $k0 * ALG0021($phi0,$a,$e) * tan (pi()/2 - $phi0) * exp ( $n * ALG0001($phi0,$e) );
$C = $k0 * ALG0021($phi0, $a, $e) * tan(pi()/2 - $phi0) * exp($n * ALG0001($phi0, $e));
$Xs = $X0;
$Ys = $Y0 + $k0 * ALG0021($phi0,$a,$e) * tan (pi()/2 - $phi0) ;
$Ys = $Y0 + $k0 * ALG0021($phi0, $a, $e) * tan(pi()/2 - $phi0) ;
$tab ['e'] = $e;
$tab ['n'] = $n;
@ -150,7 +157,6 @@ function ALG0019($lambda0,$phi0,$k0,$X0,$Y0,$a,$e) {
$tab ['Ys'] = $Ys;
return $tab;
}
/** Calcul de la grande normale de l'ellipsoïde
@ -159,8 +165,9 @@ function ALG0019($lambda0,$phi0,$k0,$X0,$Y0,$a,$e) {
** @param double $e Première excentricité de l'ellipsoïde
** @return double
**/
function ALG0021($phi,$a,$e) {
$N = $a/sqrt( 1 - $e * $e * sin($phi) * sin($phi) );
function ALG0021($phi, $a, $e)
{
$N = $a/sqrt(1 - $e * $e * sin($phi) * sin($phi));
return $N;
}
@ -175,19 +182,20 @@ function ALG0021($phi,$a,$e) {
** @param double $e Première excentricité de l'ellipsoïde
** @return array n, C, lambdac, Xs, Ys
**/
function ALG0054($lambda0,$phi0,$X0,$Y0,$phi1,$phi2,$a,$e) {
function ALG0054($lambda0, $phi0, $X0, $Y0, $phi1, $phi2, $a, $e)
{
$lambdac = $lambda0;
$n = ( (log( (ALG0021($phi2,$a,$e)*cos($phi2))/(ALG0021($phi1,$a,$e)*cos($phi1)) ))/(ALG0001($phi1,$e) - ALG0001($phi2,$e) ));
$C = ((ALG0021($phi1,$a,$e)* cos($phi1))/$n) * exp($n * ALG0001($phi1,$e));
$n = ((log((ALG0021($phi2, $a, $e)*cos($phi2))/(ALG0021($phi1, $a, $e)*cos($phi1))))/(ALG0001($phi1, $e) - ALG0001($phi2, $e)));
$C = ((ALG0021($phi1, $a, $e)* cos($phi1))/$n) * exp($n * ALG0001($phi1, $e));
if ($phi0 == (pi()/2)) {
$Xs = $X0;
$Ys = $Y0;
} else {
$Xs = $X0;
$Ys = $Y0 + $C * exp(-1 * $n * ALG0001($phi0,$e));
$Ys = $Y0 + $C * exp(-1 * $n * ALG0001($phi0, $e));
}
$tab=array( 'e' => $e,
$tab=array( 'e' => $e,
'n' => $n,
'C' => $C,
'lambdac' => $lambdac,
@ -196,13 +204,14 @@ function ALG0054($lambda0,$phi0,$X0,$Y0,$phi1,$phi2,$a,$e) {
return $tab;
}
function Lambert2WGS84($X,$Y,$orig='L93') {
function Lambert2WGS84($X, $Y, $orig='L93')
{
$epsilon = 0.00000000001;
$lambdac = 0.04079234433; // pour greenwich
$e = 0.08248325676; // première excentricité de l ellipsoïde Clarke 1880 français
$lambdac = 0.04079234433; // pour greenwich
$e = 0.08248325676; // première excentricité de l ellipsoïde Clarke 1880 français
$he = 100;
$a = 6378249.2; // demi-grand axe de l'ellipsoide
$a = 6378249.2; // demi-grand axe de l'ellipsoide
$Tx = -168;
$Ty = -60;
@ -213,7 +222,7 @@ function Lambert2WGS84($X,$Y,$orig='L93') {
$orig=strtoupper($orig);
switch ($orig) {
case 'LI':
case 'L1': $n = 0.7604059656;
case 'L1': $n = 0.7604059656;
$c = 11603796.98;
$Xs = 600000;
$Ys = 5657616.674;
@ -221,38 +230,40 @@ function Lambert2WGS84($X,$Y,$orig='L93') {
case 'LII':
case 'LIIE':
case 'L2E':
case 'L2': $n = 0.7289686274;
case 'L2': $n = 0.7289686274;
$c = 11745793.39;
$Xs = 600000;
if ($orig=='L2E' || $orig=='LIIE')
if ($orig=='L2E' || $orig=='LIIE') {
$Ys = 8199695.768;
else $Ys = 6199695.768;
} else {
$Ys = 6199695.768;
}
break;
case 'LIII':
case 'L3': $n = 0.6959127966;
case 'L3': $n = 0.6959127966;
$c = 11947992.52;
$Xs = 600000;
$Ys = 6791905.085;
break;
case 'LIV':
case 'L4': $n = 0.6712679322;
case 'L4': $n = 0.6712679322;
$c = 12136281.99;
$Xs = 234.358;
$Ys = 7239161.542;
break;
case 'L93':
default: $n = 0.7256077650;
default: $n = 0.7256077650;
$c = 11745255.426;
$Xs = 700000;
$Ys = 12655612.050;
break;
}
$coords = ALG0004($X,$Y,$n,$c,$Xs,$Ys,$lambdac,$e,$epsilon);
$coords = ALG0004($X, $Y, $n, $c, $Xs, $Ys, $lambdac, $e, $epsilon);
$coords = ALG0009($coords['lambda'],$coords['phi'],$he,$a,$e);
$coords = ALG0009($coords['lambda'], $coords['phi'], $he, $a, $e);
$coords = ALG0013($Tx,$Ty,$Tz,$D,$Rx,$Ry,$Rz,$coords);
$coords = ALG0013($Tx, $Ty, $Tz, $D, $Rx, $Ry, $Rz, $coords);
$a = 6378137.0; // ellipsoïdes WGS84
$f = 1/298.257223563;
@ -262,7 +273,7 @@ function Lambert2WGS84($X,$Y,$orig='L93') {
$X = $coords['X'];
$Y = $coords['Y'];
$Z = $coords['Z'];
$coords = ALG0012($X,$Y,$Z,$a,$e,$epsilon);
$coords = ALG0012($X, $Y, $Z, $a, $e, $epsilon);
$xy['long'] = rad2deg($coords['lambda']);
$xy['lat'] = rad2deg($coords['phi']);
@ -273,7 +284,8 @@ function Lambert2WGS84($X,$Y,$orig='L93') {
* Function to convert geographic coordinates to "lambert 2 etendue" coordinates
* from: http://www.forumsig.org/showthread.php?p=64050#post64050
**/
function geos2lambert($latitude,$longitude) {
function geos2lambert($latitude, $longitude)
{
//0)degres-minutes-secondes + orientation (d,m,s,o) en radian
$lambda_w = $longitude * pi()/180 ;
$phi_w = $latitude * pi()/180 ;
@ -285,7 +297,7 @@ function geos2lambert($latitude,$longitude) {
$e2_w = ($a_w*$a_w-$b_w*$b_w)/($a_w*$a_w);
//et on a la grande normale de l'ellipsoide WGS84
$N = $a_w/sqrt(1-$e2_w*pow(sin($phi_w),2));
$N = $a_w/sqrt(1-$e2_w*pow(sin($phi_w), 2));
//ainsi on obtient
$X_w = $N * cos($phi_w) * cos($lambda_w);
@ -310,14 +322,14 @@ function geos2lambert($latitude,$longitude) {
$e2_n = ($a_n*$a_n-$b_n*$b_n)/($a_n*$a_n);
//on définit une tolérance de convergence
$epsilon = pow(10,-10);
$epsilon = pow(10, -10);
//puis on amorce une boucle de calcul
$p0=atan($Z_n/sqrt($X_n*$X_n+$Y_n*$Y_n)*(1-($a_n*$e2_n)/(sqrt($X_n*$X_n+$Y_n*$Y_n+$Z_n*$Z_n))));
$p1=atan(($Z_n/sqrt($X_n*$X_n+$Y_n*$Y_n))/(1-($a_n*$e2_n*cos($p0))/(sqrt(($X_n*$X_n+$Y_n*$Y_n)*(1-$e2_n*pow(sin($p0),2))))));
while(!(abs($p1-$p0)<$epsilon)){
$p1=atan(($Z_n/sqrt($X_n*$X_n+$Y_n*$Y_n))/(1-($a_n*$e2_n*cos($p0))/(sqrt(($X_n*$X_n+$Y_n*$Y_n)*(1-$e2_n*pow(sin($p0), 2))))));
while (!(abs($p1-$p0)<$epsilon)) {
$p0 = $p1;
$p1 = atan(($Z_n/sqrt($X_n*$X_n+$Y_n*$Y_n))/(1-($a_n*$e2_n*cos($p0))/(sqrt(($X_n*$X_n+$Y_n*$Y_n)*(1-$e2_n*pow(sin($p0),2))))));
$p1 = atan(($Z_n/sqrt($X_n*$X_n+$Y_n*$Y_n))/(1-($a_n*$e2_n*cos($p0))/(sqrt(($X_n*$X_n+$Y_n*$Y_n)*(1-$e2_n*pow(sin($p0), 2))))));
}
$phi_n = $p1;
$lambda_n = atan($Y_n/$X_n);
@ -331,7 +343,7 @@ function geos2lambert($latitude,$longitude) {
$e_n = sqrt($e2_n);
$lambda0 = 0.04079234433198; //correspond à la longitude en radian de Paris (2°20'14.025" E) par rapport à Greenwich
//puis on calcule la latitude isométrique
$L = log(tan(pi()/4 + $phi_n/2) * pow(((1-$e_n*sin($phi_n))/(1+$e_n*sin($phi_n))),($e_n/2)));
$L = log(tan(pi()/4 + $phi_n/2) * pow(((1-$e_n*sin($phi_n))/(1+$e_n*sin($phi_n))), ($e_n/2)));
//enfin on projette
$X_l2e = $Xs + $c*exp((-$n*$L))*sin($n*($lambda_n-$lambda0));
@ -345,20 +357,21 @@ function geos2lambert($latitude,$longitude) {
** NTG_71.pdf
** http://www.ign.fr/affiche_rubrique.asp?rbr_id=1700&lng_id=FR
**/
function geos2lambert93($latitude,$longitude) {
function geos2lambert93($latitude, $longitude)
{
// Système WGS84
$a=6378137; // demi grand axe de l'ellipsoide (m)
$e=0.08181919106; // première excentricitè de l'ellipsoide
$a=6378137; // demi grand axe de l'ellipsoide (m)
$e=0.08181919106; // première excentricitè de l'ellipsoide
// Paramètres de projections
$l0=$lc=deg2rad(3); // longitude de référence
$phi0=deg2rad(46.5); // latitude d'origine en radian
$phi1=deg2rad(44); // 1er parallele automécoïque
$phi2=deg2rad(49); // 2eme parallele automécoïque
$l0=$lc=deg2rad(3); // longitude de référence
$phi0=deg2rad(46.5); // latitude d'origine en radian
$phi1=deg2rad(44); // 1er parallele automécoïque
$phi2=deg2rad(49); // 2eme parallele automécoïque
$x0=700000; //coordonnées à l'origine
$y0=6600000; //coordonnées à l'origine
$x0=700000; //coordonnées à l'origine
$y0=6600000; //coordonnées à l'origine
// coordonnées du point à traduire
$phi=deg2rad($latitude);
@ -369,10 +382,10 @@ function geos2lambert93($latitude,$longitude) {
$gN2=$a/sqrt(1-$e*$e*sin($phi2)*sin($phi2));
//calculs de slatitudes isométriques
$gl1=log(tan(pi()/4+$phi1/2)*pow((1-$e*sin($phi1))/(1+$e*sin($phi1)),$e/2));
$gl2=log(tan(pi()/4+$phi2/2)*pow((1-$e*sin($phi2))/(1+$e*sin($phi2)),$e/2));
$gl0=log(tan(pi()/4+$phi0/2)*pow((1-$e*sin($phi0))/(1+$e*sin($phi0)),$e/2));
$gl=log(tan(pi()/4+$phi/2)*pow((1-$e*sin($phi))/(1+$e*sin($phi)),$e/2));
$gl1=log(tan(pi()/4+$phi1/2)*pow((1-$e*sin($phi1))/(1+$e*sin($phi1)), $e/2));
$gl2=log(tan(pi()/4+$phi2/2)*pow((1-$e*sin($phi2))/(1+$e*sin($phi2)), $e/2));
$gl0=log(tan(pi()/4+$phi0/2)*pow((1-$e*sin($phi0))/(1+$e*sin($phi0)), $e/2));
$gl=log(tan(pi()/4+$phi/2)*pow((1-$e*sin($phi))/(1+$e*sin($phi)), $e/2));
//calcul de l'exposant de la projection
$n=(log(($gN2*cos($phi2))/($gN1*cos($phi1))))/($gl1-$gl2);//ok
@ -388,4 +401,4 @@ function geos2lambert93($latitude,$longitude) {
$y93=$ys-$c*exp(-1*$n*$gl)*cos($n*($l-$lc));
return array("x_93"=>$x93,"y_93"=>$y93);
}
}

View File

@ -1,93 +1,92 @@
<?php
require_once 'framework/common/curl.php';
class Metier_Partenaires_MMarques
{
private $iDb;
public function __construct($db = null)
{
if ( $db === null ) {
$this->iDb = new Metier_Util_Db();
} else {
$this->iDb = $db;
}
}
/**
* Liste des marques pour un siren donné ou détail d'une marque d'une entreprise
* @param $siren int
* @param $idDepot int Numéro de la marque ou Néant/0 si liste des marques
*/
public function getMarques($siren, $idDepot=0)
{
$marques = array();
$strSql = "1 ";
if ($siren > 0) {
$strSql.= "AND sirenDeposant=$siren ";
}
if ($idDepot > 0) {
$strSql.= "AND numeroMarque=$idDepot ";
}
$res = $this->iDb->select('bopi.marques',
'nomMarque, rayonMarque, detailDeposant, sirenDeposant, dateDepot, lieuDepot, numeroMarque, classesMarque, periMarque, detailDeposant, detailMandataire, detailStatut, dateExpir, idObjetImg, idObjetPdf',
"$strSql ORDER BY dateDepot DESC");
if (count($res) > 0) {
foreach ($res as $i => $marque) {
if ($marque['nomMarque'] == '&nbsp;') {
$nomMarque = '(figurative)';
}
else {
$nomMarque = $marque['nomMarque'];
}
$marques[$i] = array (
'nomMarque' => $nomMarque,
'rayonMarque' => $marque['rayonMarque'],
'detailDeposant' => $marque['detailDeposant'],
'detailMandataire' => $marque['detailMandataire'],
'detailStatut' => $marque['detailStatut'],
'sirenDeposant' => $marque['sirenDeposant'],
'dateDepot' => $marque['dateDepot'],
'lieuDepot' => $marque['lieuDepot'],
'classesMarque' => $marque['classesMarque'],
'periMarque' => $marque['periMarque'],
'dateExpir' => $marque['dateExpir'],
'numeroMarque' => $marque['numeroMarque'],
'imgLink' => $marque['idObjetImg'],
'pdfLink' => $marque['idObjetPdf'],
);
if ($idDepot != 0) {
if ($marque['numeroMarque'] == $idDepot) {
//Produits et Services
$resPS = $this->iDb->select('bopi.marques_classes', 'remarque', "numeroMarque=$idDepot");
if (count($resPS)>0) {
$txt = array();
foreach ($resPS as $item) {
$txt[] = $item['remarque'];
}
$marques[$i]['PS'] = $txt;
}
//Historique
$resHisto = $this->iDb->select('bopi.marques_histo', 'histo2', "numeroMarque=$idDepot ORDER BY dat DESC");
if (count($resHisto) > 0) {
$txt = array();
foreach ($resHisto as $item) {
$txt[] = $item['histo2'];
}
$marques[$i]['histo'] = $txt;
}
return array($marques[$i]);
}
}
}
return $marques;
}
return false;
}
}
<?php
require_once 'framework/common/curl.php';
class Metier_Partenaires_MMarques
{
private $iDb;
public function __construct($db = null)
{
if ($db === null) {
$this->iDb = new Metier_Util_Db();
} else {
$this->iDb = $db;
}
}
/**
* Liste des marques pour un siren donné ou détail d'une marque d'une entreprise
* @param $siren int
* @param $idDepot int Numéro de la marque ou Néant/0 si liste des marques
*/
public function getMarques($siren, $idDepot=0)
{
$marques = array();
$strSql = "1 ";
if ($siren > 0) {
$strSql.= "AND sirenDeposant=$siren ";
}
if ($idDepot > 0) {
$strSql.= "AND numeroMarque=$idDepot ";
}
$res = $this->iDb->select('bopi.marques',
'nomMarque, rayonMarque, detailDeposant, sirenDeposant, dateDepot, lieuDepot, numeroMarque, classesMarque, periMarque, detailDeposant, detailMandataire, detailStatut, dateExpir, idObjetImg, idObjetPdf',
"$strSql ORDER BY dateDepot DESC");
if (count($res) > 0) {
foreach ($res as $i => $marque) {
if ($marque['nomMarque'] == '&nbsp;') {
$nomMarque = '(figurative)';
} else {
$nomMarque = $marque['nomMarque'];
}
$marques[$i] = array(
'nomMarque' => $nomMarque,
'rayonMarque' => $marque['rayonMarque'],
'detailDeposant' => $marque['detailDeposant'],
'detailMandataire' => $marque['detailMandataire'],
'detailStatut' => $marque['detailStatut'],
'sirenDeposant' => $marque['sirenDeposant'],
'dateDepot' => $marque['dateDepot'],
'lieuDepot' => $marque['lieuDepot'],
'classesMarque' => $marque['classesMarque'],
'periMarque' => $marque['periMarque'],
'dateExpir' => $marque['dateExpir'],
'numeroMarque' => $marque['numeroMarque'],
'imgLink' => $marque['idObjetImg'],
'pdfLink' => $marque['idObjetPdf'],
);
if ($idDepot != 0) {
if ($marque['numeroMarque'] == $idDepot) {
//Produits et Services
$resPS = $this->iDb->select('bopi.marques_classes', 'remarque', "numeroMarque=$idDepot");
if (count($resPS)>0) {
$txt = array();
foreach ($resPS as $item) {
$txt[] = $item['remarque'];
}
$marques[$i]['PS'] = $txt;
}
//Historique
$resHisto = $this->iDb->select('bopi.marques_histo', 'histo2', "numeroMarque=$idDepot ORDER BY dat DESC");
if (count($resHisto) > 0) {
$txt = array();
foreach ($resHisto as $item) {
$txt[] = $item['histo2'];
}
$marques[$i]['histo'] = $txt;
}
return array($marques[$i]);
}
}
}
return $marques;
}
return false;
}
}

View File

@ -1,291 +1,296 @@
<?php
require_once 'framework/common/curl.php';
class Metier_Partenaires_MOrias
{
private $referer ='';
private $body = '';
private $header = '';
private $cookie = '';
private $codeRetour = 0;
private $accesDist=true;
private $iDb;
public $enCache=false;
public $force=false;
public $annee=0;
public $erreur='';
public function __construct($accesDist = true, $db = null)
{
$this->accesDist = $accesDist;
if ( $db === null ) {
$this->iDb = new Metier_Util_Db();
} else {
$this->iDb = $db;
}
}
public function getMaxOrias($annee = 0)
{
if ($annee*1 > 0 && $annee*1 < 100) {
$this->annee = '20'.$annee;
$annee++;
$strWhere = "(numOrias/1000000)<=$annee";
} elseif ($annee*1 > 1900 && $annee*1 < 9999) {
$this->annee = $annee;
$annee = substr(''.$annee,2,2)*1+1;
$strWhere = "(numOrias/1000000)<=$annee";
} else {
$strWhere = '1';
$this->annee = date('Y')*1;
}
$ret = $this->iDb->select('sdv1.orias','MAX(numOrias) AS numOrias', $strWhere, false, MYSQL_ASSOC);
return sprintf('%08d',$ret[0]['numOrias']);
}
public function getInfosOrias($siren, $numOrias=0)
{
if ($siren*1 > 1000) {
$strWhere = "siren=$siren";
}
elseif ($numOrias*1 > 0) {
$strWhere = "numOrias=$numOrias";
} else {
return false;
}
$ret = $this->iDb->select('sdv1.orias','siren, id, nom, cp, ville, adresse, numOrias, numOriasAttribue',
$strWhere, false, MYSQL_ASSOC);
if (!$this->force && count($ret) > 0) {
$this->enCache = true;
$tabRet = $ret[0];//array();
$ret = $this->iDb->select('sdv1.orias','categorie, cat, dateInscription, typeStatut, rcsVille, rcsCode, rcsSiren, contact, encaissement, nature, paysPresta, paysEtab',$strWhere, false, MYSQL_ASSOC);
foreach ($ret as $i=>$tabTmp) {
$tabRet['categories'][]=$tabTmp;
}
}
elseif ($this->accesDist == true) {
$this->enCache = false;
// Initialisation Cookies
if ($numOrias>0) {
$this->referer='http://www.orias.fr/orias/public/index.jsp';
}
else {
$this->referer='http://www.orias.fr/orias/public/rechercheavance.html';
}
$page = getUrl($this->referer, '', '', '', false, '', '', 15);
if ($page['code'] == 200) {
$this->cookie = str_replace(' Path=/orias', '',$page['header']['Set-Cookie']);
if(preg_match('/id="javax\.faces\.ViewState" value="(.*)"/Ui', $page['body'], $matches))
$this->codeRetour = $matches[1];
else {
echo 'Erreur Url='.$this->referer.PHP_EOL;
print_r($page['body']);
return false;
}
} else {
return false;
}
if ($numOrias>0) {
$url = 'http://www.orias.fr/orias/public/index.html';
$post = array(
'menu%3AiasSearchForm'=>'menu%3AiasSearchForm',
'menu%3AiasSearchForm%3AiasInputText'=>sprintf('%08s',$numOrias),
'javax.faces.ViewState'=>$this->codeRetour,
'menu%3AiasSearchForm%3AiasSearch'=>'menu%3AiasSearchForm%3AiasSearch',
);
} else {
// Recherche avec Siren
$url = 'http://www.orias.fr/orias/public/rechercheavance.html';
$post = array(
'j_id_id45'=>'j_id_id45',
'j_id_id45%3Aj_id_id52'=>'',
'j_id_id45%3AtagRCS'=>'',
'j_id_id45%3AtagSIREN'=>$siren,//441921574,
'j_id_id45%3Aj_id_id160'=>'',
'j_id_id45%3Aj_id_id167'=>'',
'j_id_id45%3Aj_id_id175'=>'',
'javax.faces.ViewState'=>$this->codeRetour,
'j_id_id45%3Aj_id_id203'=>'j_id_id45%3Aj_id_id203'
);
$this->referer = 'http://www.orias.fr/orias/public/list.html';
}
sleep(rand(1, 2));
$page = getUrl($url, $this->cookie, $post, $this->referer, false, '', '', 15);
$this->referer = $url;
if ($page['code'] == 302) {
$url = $page['header']['Location'];
}
else {
if (preg_match("/Le num&eacute;ro d'immatriculation n'existe pas/", $page['body'])) {
$tabInsert = array(
'actif' => 0,
'numOrias' => $numOrias,
'numOriasAttribue' => 0,
'dateInsert' => date('YmdHis')
);
$this->erreur = 'Numéro Orias inexistant';
// On enregistre ce numéro comme non attribué si < au dernier numéro attribué
if ($numOrias < $this->getMaxOrias()) {
$this->iDb->insert('sdv1.orias', $tabInsert);
}
}
return false;
}
if ($url == 'http://www.orias.fr/orias/public/intermediaire.html') {
$page = getUrl($url, $this->cookie, '', $this->referer, false, '', '', 24);
$this->referer = $url;
$this->body = $page['body'];
echo "Recherche par Orias : url=$url".PHP_EOL;
die(print_r($page));
}
// Liste contenant l'entreprise
$url = 'http://www.orias.fr/orias/public/list.html';
sleep(rand(1, 2));
$page = getUrl($url, $this->cookie, '', $this->referer, false, '', '', 24);
$this->referer = $url;
$this->body = $page['body'];
if (preg_match('/<td>R\&eacute\;sultat\(s\) de votre recherche \:(?:.*)<strong>(.*)<(?:.*)Interm\&eacute\;diaire\(s\)/Uis',$this->body, $matches)) {
$nbInter = trim($matches[1])*1;
if ($nbInter == 0) {
return false;
}
if ($nbInter > 1) {
return false;
}
}
// Initalisation du tableau retour
$tabRet = array('siren'=>$siren);
//id="formResult:intermediariesList:13910
if (preg_match('/<td class="dr-table-cell rich-table-cell haut " id="formResult\:intermediariesList\:(.*)\:j_id_id117">(?:.*)<center>(.*)<\/center>/Uis',$this->body, $matches)) {
$tabRet['id'] = trim($matches[1]);
$tabRet['nom'] = html_entity_decode(trim($matches[2]));
}
if (preg_match('/<td class="dr-table-cell rich-table-cell r.cp_ville " id="formResult\:intermediariesList\:(?:.*)\:j_id_id124">(?:.*)<center>(.*)<\/center>/Uis',$this->body, $matches)) {
$tabTmp = explode('&nbsp;',$matches[1]);
$tabRet['cp'] = trim($tabTmp[0]);
$tabRet['ville'] = html_entity_decode(trim($tabTmp[1]));
}
if (preg_match('/<td class="dr-table-cell rich-table-cell r.adresse " id="formResult\:intermediariesList\:(?:.*)\:j_id_id133">(.*)<\/td>/Uis',$this->body, $matches))
$tabRet['adresse'] = html_entity_decode(trim($matches[1]));
$tabRet['actif'] = 1;
$tabRet['numOriasAttribue'] = 1;
if (preg_match('/<td class="dr-table-cell rich-table-cell r.immat " id="formResult\:intermediariesList\:(?:.*)\:j_id_id138">(?:.*|)(<span style="white-space\: no-wrap;">|Radi\&eacute\; le \:)(.*)(?:<\/span>|<\/td>)/Uis',$this->body, $matches)) {
$str = trim(strtr($matches[2],array('&nbsp;'=>'',' '=>'')));
if (html_entity_decode(trim(str_replace(':','', $matches[1]))) == 'Radié le') {
$tabRet['actif'] = 0;
$tabRet['numOrias'] = $numOrias;
$tabRet['dateRadiation'] = $str;
}
else {
$tabRet['numOrias'] = $str;
}
}
if (preg_match('/ id="javax\.faces\.ViewState" value="(.*)" /Uis',$this->body, $matches)) {
$this->codeRetour = $matches[1];
}
$tabTmp = explode("<a href=\"#\" onclick=\"if(typeof jsfcljs == 'function'){jsfcljs(document.getElementById('formResult'),{'", $this->body);
foreach ($tabTmp as $i => $strCat) {
if ($i == 0) {
if (count($tabTmp) == 1) {
$tabInsert = array_merge($tabRet, array('dateInsert'=>date('YmdHis')));
$this->iDb->insert('sdv1.orias', $tabInsert);
}
$tabRet['categories'] = array();
continue;
}
$tabCat = array();
if (preg_match('/<span style="text-align\: left">(.*)<\/span>/Ui',$strCat, $matches)) {
$tabCat['categorie'] = html_entity_decode(trim($matches[1]));
}
if (preg_match('/intermediaryRoleIdParam\'\:\'(.*)\'/Uis',$strCat, $matches)) {
$tabCat['cat'] = $matches[1];
}
// Tout est dans la même page Html
if ($i==1) {
// Construction du lien vers la fiche d'identité de l'entreprise
$url = 'http://www.orias.fr/orias/public/list.html';
$post = array(
'formResult' => 'formResult',
'formResult%3AajaxLoadingModalBoxOpenedState' => '',
'javax.faces.ViewState' => $this->codeRetour,
'intermediaryIdParam' => $tabRet['id'],
'intermediaryRoleIdParam' => $tabCat['cat'],
);
if (preg_match('/(formResult\:intermediariesList\:(?:.*)),intermediaryIdParam,/Ui', $strCat, $matches)) {
$tabTmp2 = explode(',', $matches[1]);
$post[urlencode($tabTmp2[0])] = urlencode($tabTmp2[1]);
}
sleep(rand(1, 2));
$page = getUrl($url, $this->cookie, $post, $this->referer, false, '', '', 24);
$tmpCat = explode('class="dr-tbpnl-cntnt-pstn rich-tabpanel-content-position"', $page['body']);
}
if (preg_match('/<dd class="col3">Date d\'inscription \: <strong>(.*)<\/strong><\/dd>/Uis',$tmpCat[$i], $matches)) {
$tabCat['dateInscription'] = trim($matches[1]);
}
if (preg_match('/<td align="right"(?: |)>Statut \:<\/td>(.*)<\/strong>/Uis',$tmpCat[$i], $matches)) {
$tabCat['typeStatut'] = trim(strip_tags($matches[1]));
}
if (preg_match('/<td align="right">RCS \:<\/td>(?:.*)<td width="5%"><\/td>(?:.*)<td width="70%"><strong>(.*)<\/strong>(.*)SIREN \:(?:.*)<strong>(.*)<\/strong>/Uis',$tmpCat[$i], $matches)) {
$tabCat['rcsVille'] = trim($matches[1]);
$tabCat['rcsCode'] = trim(strtr(strip_tags($matches[2]), array(' '=>'','&nbsp;'=>'',chr(160)=>'',"\r"=>'',"\n"=>'')));
$tabCat['rcsSiren'] = trim($matches[3]);
if ($siren == 0) {
$tabRet['siren'] = $tabCat['rcsSiren'];
}
}
if (preg_match('/<td align="right">Contact<\/td>(.*)<\/tr>/Uis', $tmpCat[$i], $matches)) {
$tabCat['contact'] = html_entity_decode(trim(strip_tags($matches[1])));
}
if (preg_match("/<strong>(.*)Cet interm&eacute;diaire n'est pas autoris&eacute; &agrave; encaisser les primes ou cotisations d'assurances(.*)<\/strong>/Uis", $tmpCat[$i])) {
$tabCat['encaissement'] = 0;
}
else {
$tabCat['encaissement'] = 1;
}
if (preg_match('/<span class="txt_ssTitre">(?:.*)Nature de l\'activit\&eacute\; d\'interm\&eacute\;diation(.*)<\/dd>/Uis',$tmpCat[$i], $matches)) {
$tabCat['nature'] = html_entity_decode(trim(strip_tags($matches[1])));
}
if (preg_match('/<td width="50%" valign="top" align="left">\- Etats dans lesquels cet interm\&eacute\;diaire exerce en libre prestation de service(.*)<\/table>(.*)<\/tr>/Uis',$tmpCat[$i], $matches)) {
$tabCat['paysPresta'] = trim(strip_tags($matches[1]));
}
if (preg_match('/<td width="222" align="left">\- Etats dans lesquels cet interm\&eacute\;diaire exerce en libert\&eacute\; d\'\&eacute\;tablissement(.*)<\/table>(.*)<\/tr>/Uis',$tmpCat[$i], $matches)) {
$tabCat['paysEtab'] =trim(strip_tags($matches[1]));
}
$tabRet['categories'][] = $tabCat;
$tabInsert = $tabRet;
unset($tabInsert['categories']);
$tabInsert = array_merge($tabInsert, $tabCat, array('dateInsert'=>date('YmdHis')));
$this->iDb->insert('sdv1.orias', $tabInsert);
}
}
return $tabRet;
}
}
<?php
require_once 'framework/common/curl.php';
class Metier_Partenaires_MOrias
{
private $referer ='';
private $body = '';
private $header = '';
private $cookie = '';
private $codeRetour = 0;
private $accesDist=true;
private $iDb;
public $enCache=false;
public $force=false;
public $annee=0;
public $erreur='';
protected $remote = false;
public function __construct($accesDist = true, $db = null)
{
$this->accesDist = $accesDist;
if ($db === null) {
$this->iDb = new Metier_Util_Db();
} else {
$this->iDb = $db;
}
}
/**
* Active la récupération des données distantes
*/
public function setRemote()
{
$this->remote = true;
}
public function getMaxOrias($annee = 0)
{
if ($annee*1 > 0 && $annee*1 < 100) {
$this->annee = '20'.$annee;
$annee++;
$strWhere = "(numOrias/1000000)<=$annee";
} elseif ($annee*1 > 1900 && $annee*1 < 9999) {
$this->annee = $annee;
$annee = substr(''.$annee, 2, 2)*1+1;
$strWhere = "(numOrias/1000000)<=$annee";
} else {
$strWhere = '1';
$this->annee = date('Y')*1;
}
$ret = $this->iDb->select('sdv1.orias', 'MAX(numOrias) AS numOrias', $strWhere, false, MYSQL_ASSOC);
return sprintf('%08d', $ret[0]['numOrias']);
}
public function getInfosOrias($siren, $numOrias=0)
{
if ($siren*1 > 1000) {
$strWhere = "siren=$siren";
} elseif ($numOrias*1 > 0) {
$strWhere = "numOrias=$numOrias";
} else {
return false;
}
$ret = $this->iDb->select('sdv1.orias', 'siren, id, nom, cp, ville, adresse, numOrias, numOriasAttribue',
$strWhere, false, MYSQL_ASSOC);
if (!$this->force && count($ret) > 0) {
$this->enCache = true;
$tabRet = $ret[0];//array();
$ret = $this->iDb->select('sdv1.orias', 'categorie, cat, dateInscription, typeStatut, rcsVille, rcsCode, rcsSiren, contact, encaissement, nature, paysPresta, paysEtab', $strWhere, false, MYSQL_ASSOC);
foreach ($ret as $i=>$tabTmp) {
$tabRet['categories'][]=$tabTmp;
}
} elseif ($this->accesDist == true) {
$this->enCache = false;
// Initialisation Cookies
if ($numOrias>0) {
$this->referer='http://www.orias.fr/orias/public/index.jsp';
} else {
$this->referer='http://www.orias.fr/orias/public/rechercheavance.html';
}
$page = getUrl($this->referer, '', '', '', false, '', '', 15);
if ($page['code'] == 200) {
$this->cookie = str_replace(' Path=/orias', '', $page['header']['Set-Cookie']);
if (preg_match('/id="javax\.faces\.ViewState" value="(.*)"/Ui', $page['body'], $matches)) {
$this->codeRetour = $matches[1];
} else {
echo 'Erreur Url='.$this->referer.PHP_EOL;
print_r($page['body']);
return false;
}
} else {
return false;
}
if ($numOrias>0) {
$url = 'http://www.orias.fr/orias/public/index.html';
$post = array(
'menu%3AiasSearchForm'=>'menu%3AiasSearchForm',
'menu%3AiasSearchForm%3AiasInputText'=>sprintf('%08s', $numOrias),
'javax.faces.ViewState'=>$this->codeRetour,
'menu%3AiasSearchForm%3AiasSearch'=>'menu%3AiasSearchForm%3AiasSearch',
);
} else {
// Recherche avec Siren
$url = 'http://www.orias.fr/orias/public/rechercheavance.html';
$post = array(
'j_id_id45'=>'j_id_id45',
'j_id_id45%3Aj_id_id52'=>'',
'j_id_id45%3AtagRCS'=>'',
'j_id_id45%3AtagSIREN'=>$siren,//441921574,
'j_id_id45%3Aj_id_id160'=>'',
'j_id_id45%3Aj_id_id167'=>'',
'j_id_id45%3Aj_id_id175'=>'',
'javax.faces.ViewState'=>$this->codeRetour,
'j_id_id45%3Aj_id_id203'=>'j_id_id45%3Aj_id_id203'
);
$this->referer = 'http://www.orias.fr/orias/public/list.html';
}
sleep(rand(1, 2));
$page = getUrl($url, $this->cookie, $post, $this->referer, false, '', '', 15);
$this->referer = $url;
if ($page['code'] == 302) {
$url = $page['header']['Location'];
} else {
if (preg_match("/Le num&eacute;ro d'immatriculation n'existe pas/", $page['body'])) {
$tabInsert = array(
'actif' => 0,
'numOrias' => $numOrias,
'numOriasAttribue' => 0,
'dateInsert' => date('YmdHis')
);
$this->erreur = 'Numéro Orias inexistant';
// On enregistre ce numéro comme non attribué si < au dernier numéro attribué
if ($numOrias < $this->getMaxOrias()) {
$this->iDb->insert('sdv1.orias', $tabInsert);
}
}
return false;
}
if ($url == 'http://www.orias.fr/orias/public/intermediaire.html') {
$page = getUrl($url, $this->cookie, '', $this->referer, false, '', '', 24);
$this->referer = $url;
$this->body = $page['body'];
echo "Recherche par Orias : url=$url".PHP_EOL;
die(print_r($page));
}
// Liste contenant l'entreprise
$url = 'http://www.orias.fr/orias/public/list.html';
sleep(rand(1, 2));
$page = getUrl($url, $this->cookie, '', $this->referer, false, '', '', 24);
$this->referer = $url;
$this->body = $page['body'];
if (preg_match('/<td>R\&eacute\;sultat\(s\) de votre recherche \:(?:.*)<strong>(.*)<(?:.*)Interm\&eacute\;diaire\(s\)/Uis', $this->body, $matches)) {
$nbInter = trim($matches[1])*1;
if ($nbInter == 0) {
return false;
}
if ($nbInter > 1) {
return false;
}
}
// Initalisation du tableau retour
$tabRet = array('siren'=>$siren);
//id="formResult:intermediariesList:13910
if (preg_match('/<td class="dr-table-cell rich-table-cell haut " id="formResult\:intermediariesList\:(.*)\:j_id_id117">(?:.*)<center>(.*)<\/center>/Uis', $this->body, $matches)) {
$tabRet['id'] = trim($matches[1]);
$tabRet['nom'] = html_entity_decode(trim($matches[2]));
}
if (preg_match('/<td class="dr-table-cell rich-table-cell r.cp_ville " id="formResult\:intermediariesList\:(?:.*)\:j_id_id124">(?:.*)<center>(.*)<\/center>/Uis', $this->body, $matches)) {
$tabTmp = explode('&nbsp;', $matches[1]);
$tabRet['cp'] = trim($tabTmp[0]);
$tabRet['ville'] = html_entity_decode(trim($tabTmp[1]));
}
if (preg_match('/<td class="dr-table-cell rich-table-cell r.adresse " id="formResult\:intermediariesList\:(?:.*)\:j_id_id133">(.*)<\/td>/Uis', $this->body, $matches)) {
$tabRet['adresse'] = html_entity_decode(trim($matches[1]));
}
$tabRet['actif'] = 1;
$tabRet['numOriasAttribue'] = 1;
if (preg_match('/<td class="dr-table-cell rich-table-cell r.immat " id="formResult\:intermediariesList\:(?:.*)\:j_id_id138">(?:.*|)(<span style="white-space\: no-wrap;">|Radi\&eacute\; le \:)(.*)(?:<\/span>|<\/td>)/Uis', $this->body, $matches)) {
$str = trim(strtr($matches[2], array('&nbsp;'=>'', ' '=>'')));
if (html_entity_decode(trim(str_replace(':', '', $matches[1]))) == 'Radié le') {
$tabRet['actif'] = 0;
$tabRet['numOrias'] = $numOrias;
$tabRet['dateRadiation'] = $str;
} else {
$tabRet['numOrias'] = $str;
}
}
if (preg_match('/ id="javax\.faces\.ViewState" value="(.*)" /Uis', $this->body, $matches)) {
$this->codeRetour = $matches[1];
}
$tabTmp = explode("<a href=\"#\" onclick=\"if(typeof jsfcljs == 'function'){jsfcljs(document.getElementById('formResult'),{'", $this->body);
foreach ($tabTmp as $i => $strCat) {
if ($i == 0) {
if (count($tabTmp) == 1) {
$tabInsert = array_merge($tabRet, array('dateInsert'=>date('YmdHis')));
$this->iDb->insert('sdv1.orias', $tabInsert);
}
$tabRet['categories'] = array();
continue;
}
$tabCat = array();
if (preg_match('/<span style="text-align\: left">(.*)<\/span>/Ui', $strCat, $matches)) {
$tabCat['categorie'] = html_entity_decode(trim($matches[1]));
}
if (preg_match('/intermediaryRoleIdParam\'\:\'(.*)\'/Uis', $strCat, $matches)) {
$tabCat['cat'] = $matches[1];
}
// Tout est dans la même page Html
if ($i==1) {
// Construction du lien vers la fiche d'identité de l'entreprise
$url = 'http://www.orias.fr/orias/public/list.html';
$post = array(
'formResult' => 'formResult',
'formResult%3AajaxLoadingModalBoxOpenedState' => '',
'javax.faces.ViewState' => $this->codeRetour,
'intermediaryIdParam' => $tabRet['id'],
'intermediaryRoleIdParam' => $tabCat['cat'],
);
if (preg_match('/(formResult\:intermediariesList\:(?:.*)),intermediaryIdParam,/Ui', $strCat, $matches)) {
$tabTmp2 = explode(',', $matches[1]);
$post[urlencode($tabTmp2[0])] = urlencode($tabTmp2[1]);
}
sleep(rand(1, 2));
$page = getUrl($url, $this->cookie, $post, $this->referer, false, '', '', 24);
$tmpCat = explode('class="dr-tbpnl-cntnt-pstn rich-tabpanel-content-position"', $page['body']);
}
if (preg_match('/<dd class="col3">Date d\'inscription \: <strong>(.*)<\/strong><\/dd>/Uis', $tmpCat[$i], $matches)) {
$tabCat['dateInscription'] = trim($matches[1]);
}
if (preg_match('/<td align="right"(?: |)>Statut \:<\/td>(.*)<\/strong>/Uis', $tmpCat[$i], $matches)) {
$tabCat['typeStatut'] = trim(strip_tags($matches[1]));
}
if (preg_match('/<td align="right">RCS \:<\/td>(?:.*)<td width="5%"><\/td>(?:.*)<td width="70%"><strong>(.*)<\/strong>(.*)SIREN \:(?:.*)<strong>(.*)<\/strong>/Uis', $tmpCat[$i], $matches)) {
$tabCat['rcsVille'] = trim($matches[1]);
$tabCat['rcsCode'] = trim(strtr(strip_tags($matches[2]), array(' '=>'', '&nbsp;'=>'', chr(160)=>'', "\r"=>'', "\n"=>'')));
$tabCat['rcsSiren'] = trim($matches[3]);
if ($siren == 0) {
$tabRet['siren'] = $tabCat['rcsSiren'];
}
}
if (preg_match('/<td align="right">Contact<\/td>(.*)<\/tr>/Uis', $tmpCat[$i], $matches)) {
$tabCat['contact'] = html_entity_decode(trim(strip_tags($matches[1])));
}
if (preg_match("/<strong>(.*)Cet interm&eacute;diaire n'est pas autoris&eacute; &agrave; encaisser les primes ou cotisations d'assurances(.*)<\/strong>/Uis", $tmpCat[$i])) {
$tabCat['encaissement'] = 0;
} else {
$tabCat['encaissement'] = 1;
}
if (preg_match('/<span class="txt_ssTitre">(?:.*)Nature de l\'activit\&eacute\; d\'interm\&eacute\;diation(.*)<\/dd>/Uis', $tmpCat[$i], $matches)) {
$tabCat['nature'] = html_entity_decode(trim(strip_tags($matches[1])));
}
if (preg_match('/<td width="50%" valign="top" align="left">\- Etats dans lesquels cet interm\&eacute\;diaire exerce en libre prestation de service(.*)<\/table>(.*)<\/tr>/Uis', $tmpCat[$i], $matches)) {
$tabCat['paysPresta'] = trim(strip_tags($matches[1]));
}
if (preg_match('/<td width="222" align="left">\- Etats dans lesquels cet interm\&eacute\;diaire exerce en libert\&eacute\; d\'\&eacute\;tablissement(.*)<\/table>(.*)<\/tr>/Uis', $tmpCat[$i], $matches)) {
$tabCat['paysEtab'] =trim(strip_tags($matches[1]));
}
$tabRet['categories'][] = $tabCat;
$tabInsert = $tabRet;
unset($tabInsert['categories']);
$tabInsert = array_merge($tabInsert, $tabCat, array('dateInsert'=>date('YmdHis')));
$this->iDb->insert('sdv1.orias', $tabInsert);
}
}
return $tabRet;
}
}

View File

@ -1,181 +1,181 @@
<?php
class Metier_Partenaires_MPrivileges
{
public $tabCodeAR = array(
'00' => "Surveillance RCS posée/Demande de suppression acceptée/Surveillance PRIV posée : pas d'inscription existante sur le dossier",
'01' => "Surveillance PRIV posée : inscription existante sur le dossier",
'02' => "GAGI,GREFTEL,INTERGREFFE-code 1-surveillance acceptée mais qui n'a pas encore fait l'objet d'un AR",
'03' => "GAGI,GREFTEL,INTERGREFFE-code 2 - surveillance acceptée avec CREATION d'une fiche débiteur, qui n'a pas fait l'objet d'un AR",
'04' => "GAGI-surveillance en attente envoyée au GAGI",
'05' => "Surveillance en attente de validation au greffe",
'06' => "Erreur de chargement",
'10' => "Surveillance impossible car société radiée",
'11' => "Surveillance impossible car société transférée dans un autre greffe",
'12' => "SIREN inconnu",
'13' => "Raison sociale erronée",
'14' => "Adresse erronée",
'15' => "Surveillance impossible sur un établissement secondaire",
'16' => "Demande incomplète ou incorrecte",
'17' => "Surveillance Privilège impossible",
'18' => "Surveillance impossible par le greffe",
'19' => "Surveillance RCS impossible",
'20' => "Cette surveillance concerne un autre Greffe",
'21' => "Surveillance BILAN impossible car la ste n'est pas tenue de déposer ses Comptes Annuels (ste de droit étranger)",
'22' => "Plusieurs Bottins (débiteurs) (GAGI)",
'23' => "Société de fait (GAGI) : Société non enregistrée au Registre du Commerce",
'24' => "Surveillance impossible car société en liquidation judiciaire",
'25' => "Greffe inconnu",
'26' => "Millésime bilan à surveiller incorrect",
'27' => "Références EXTELIA erronées ou incomplètes (ces reférences sont obligatoires en cas de demande de suppression)",
'28' => "Surveillance impossible sur un dossier non informatisé (dossier dit non repris ou figé)",
'30' => "Siren absent (ne concerne que les surveillances de type WebService)",
'31' => "Surveillance BILAN impossible sur une société non commerciale (statut <> B)",
'50' => "Ce greffe ne traite pas les surveillances car le groupement de ce greffe n'est pas surveillé",
'51' => "Etablissement non trouvé",
'52' => "Code catalogue de la surveillance non renseigné ou incorrect",
'53' => "le siren est déjà sous surveillance",
'54' => "DOSSIER AGORA : votre prestation ne comprend pas la couverture de ce groupement",
'55' => "DOSSIER INTERGREFFE : votre prestation ne comprend pas la couverture de ce groupement de greffes",
'56' => "Le siren est déjà en attente de validation par le greffe",
'57' => "Surveillance impossible sur un dossier dit non inscrit au RCS (statut F:artisan)",
'58' => "Surveillance impossible sur un agent commercial (statut P ou M)",
'59' => 'Surveillance impossible sur une société non RCS ?',
'88' => "Rejet temporaire : surveillance sur un greffe absorbé rejetée pendant la phase de rechargement",
'99' => "Surveillance impossible pour raisons à examiner",
);
public $tabTypePriv = array(
'01' => "NANTISSEMENTS DU FONDS DE COMMERCE",
'02' => "PRIVILEGES DE VENDEUR ET ACTION RESOLUTOIRE",
'03' => "PRIVILEGES DE LA SECURITE SOCIALE ET DES REGIMES COMPLEMENTAIRES",
'04' => "PRIVILEGES DU TRESOR PUBLIC",
'05' => "OPERATIONS DE CREDIT-BAIL EN MATIERE MOBILIERE",
'06' => "PROTETS",
'07' => "NANTISSEMENTS DE L'OUTILLAGE, MATERIEL ET EQUIPEMENT",
'08' => "WARRANTS (HOTELIER, PETROLIER, INDUSTRIEL OU AGRICOLE)",
'10' => "NANTISSEMENTS DE PARTS DE SOCIETE CIVILE",
'17' => "PUBLICITES DE CONTRATS DE LOCATION",
'18' => "PUBLICITES DE CLAUSES DE RESERVE DE PROPRIETE",
'19' => "PRETS ET DELAIS",
'20' => "DECLARATIONS DE CREANCES",
'21' => "NANTISSEMENTS JUDICIAIRES",
'23' => "BIENS INALIENABLES",
'24' => "HYPOTHEQUES FLUVIALES",
'25' => "NANTISSEMENTS DU FONDS ARTISANAL",
'27' => "GAGE SANS DEPOSSESSION",
'28' => "GAGE DES STOCKS",
);
protected $iDb;
public function __construct($db = null)
{
if ( $db === null ) {
$this->iDb = new Metier_Util_Db();
} else {
$this->iDb = $db;
}
}
/**
* Détail des privileges
*
* @param string $siren
* @param array $tabTypes
* @return array
*/
public function getPrivilegesDetail($siren, $tabTypes=array('03','04'))
{
$strTypes = implode("','", $tabTypes);
if ($strTypes != '') {
$strTypes=" AND i.insType IN ('$strTypes') ";
}
$fields = "i.id, i.dateEven, i.greffe , i.numDebiteur, i.sirenage, i.typeEven, i.dateFraiche, i.codeRev , i.debRaisonSociale , i.debSigle , i.debCiv , i.debNom , i.debPrenom , i.debConjoint , i.debUsage , i.debEnseigne , i.debActivite , i.debFj , i.debFjLib , i.debResidence , i.debNumVoie , i.debTypVoie , i.debLibVoie , i.debAdrComp , i.debCP , i.debVille , i.debPays , i.insType , i.insLib , i.insNum , i.insDate , i.insObjet , i.insMontant , i.insDev , i.insDateEch , i.insDateFin , i.insNanTx , i.insNanTitre , i.insNanOppo , i.insProNat , i.insProHui , i.insProRep , i.insNSCA , i.insNSCParts , i.insNSCSigni , i.creNom , i.creNumVoi, i.creTypVoi, i.creLibVoi, i.creAdrComp1, i.creAdrComp2, i.creCP, i.creVille, i.crePays, i.creAutres, i.radDate, i.radMention, i.radPartiel, i.radPartMt, i.radDev, i.radDiv, i.idFichier, i.dateInsert";
$where = "i.siren=$siren $strTypes AND ( (i.insType='03' AND DATEDIFF(NOW(),i.insDate)<=900) /** Durée de vie PRIV Sécu **/ OR (i.insType='04' AND DATEDIFF(NOW(),i.insDate)<=1460) /** Durée de vie PRIV Trésor **/ )";
$where.= " ORDER BY i.dateFraiche DESC, i.insType ASC, i.insDate ASC;";
$tables = "jo.greffes_privileges i";
$iRncs = new Metier_Partenaires_MRncs($this->iDb);
$tabRet = array();
$tabPriv = $this->iDb->select($tables, $fields, $where, true, MYSQL_ASSOC);
if (count($tabPriv) > 0) {
foreach ($tabPriv as $i => $priv) {
if ($i >0 && $priv['dateFraiche'] != $dateFraiche) {
break;
}
$tabRet[] = array(
'numDebiteur' => $priv['numDebiteur'],
'greffe' => $priv['greffe'],
'greffeLib' => $iRncs->getLibTribunal($priv['greffe']),
'dateEven' => $priv['dateEven'],
'dateFraiche' => $priv['dateFraiche'],
'dateSD' => $priv['dateInsert'],
'insType' => $priv['insType'],
'insTypeLib' => $this->tabTypePriv[$priv['insType']],
'insNum' => $priv['insNum'],
'insDate' => $priv['insDate'],
'insDateEch' => $priv['insDateEch'],
'insObjet' => $priv['insObjet'],
'insMontant' => $priv['insMontant'],
'insDev' => $priv['insDev'],
'insDateFin' => $priv['insDateFin'],
'radDate' => $priv['radDate'],
'radMention' => $priv['radMention'],
'radPartiel' => $priv['radPartiel'],
'radPartMt' => $priv['radPartMt'],
'radDev' => $priv['radDev'],
'creNom' => $priv['creNom'],
'creAdresse1' => trim(preg_replace('/ +/', ' ', $priv['creNumVoi'].' '.$priv['creTypVoi'].' '.$priv['creLibVoi'])),
'creAdresse2' => $priv['creAdrComp1'],
'creAdresse3' => $priv['creAdrComp2'],
'creCP' => $priv['creCP'],
'creVille' => $priv['creVille'],
'crePays' => $priv['crePays'],
'creAutres' => $priv['creAutres'],
);
$dateFraiche = $priv['dateFraiche'];
}
}
return $tabRet;
}
/**
* Cummul des privilèges
*
* @param string $siren
* @param array $tabTypes
* @return array
*/
public function getPrivilegesCumul($siren, $tabTypes=array('03','04'))
{
$iRncs = new Metier_Partenaires_MRncs($this->iDb);
$tabRet = array();
$tabTmp = $this->getPrivilegesDetail($siren, $tabTypes);
if (count($tabTmp) > 0) {
foreach($tabTmp as $i => $priv) {
$type = $priv['insType'];
if (array_key_exists($type, $tabRet)) {
$tStock = $tabRet[$type];
$tStock['nb'] ++;
$tStock['insCumul'] += $priv['insMontant'];
} else {
$tStock['nb'] = 1;
$tStock['insCumul'] = $priv['insMontant'];
}
$tStock['insTypeLib'] = $priv['insTypeLib'];
$tStock['dateFraiche'] = $priv['dateFraiche'];
$tStock['dateDerInsc'] = $priv['insDate'];
$tStock['nomDerCre'] = $priv['creNom'];
$tStock['numDebiteur'] = $priv['numDebiteur'];
$tStock['greffeLib'] = $iRncs->getLibTribunal($priv['greffe']);
$tStock['dateMajSD'] = $priv['dateSD'];
$tabRet[$type] = $tStock;
}
}
return $tabRet;
}
}
<?php
class Metier_Partenaires_MPrivileges
{
public $tabCodeAR = array(
'00' => "Surveillance RCS posée/Demande de suppression acceptée/Surveillance PRIV posée : pas d'inscription existante sur le dossier",
'01' => "Surveillance PRIV posée : inscription existante sur le dossier",
'02' => "GAGI,GREFTEL,INTERGREFFE-code 1-surveillance acceptée mais qui n'a pas encore fait l'objet d'un AR",
'03' => "GAGI,GREFTEL,INTERGREFFE-code 2 - surveillance acceptée avec CREATION d'une fiche débiteur, qui n'a pas fait l'objet d'un AR",
'04' => "GAGI-surveillance en attente envoyée au GAGI",
'05' => "Surveillance en attente de validation au greffe",
'06' => "Erreur de chargement",
'10' => "Surveillance impossible car société radiée",
'11' => "Surveillance impossible car société transférée dans un autre greffe",
'12' => "SIREN inconnu",
'13' => "Raison sociale erronée",
'14' => "Adresse erronée",
'15' => "Surveillance impossible sur un établissement secondaire",
'16' => "Demande incomplète ou incorrecte",
'17' => "Surveillance Privilège impossible",
'18' => "Surveillance impossible par le greffe",
'19' => "Surveillance RCS impossible",
'20' => "Cette surveillance concerne un autre Greffe",
'21' => "Surveillance BILAN impossible car la ste n'est pas tenue de déposer ses Comptes Annuels (ste de droit étranger)",
'22' => "Plusieurs Bottins (débiteurs) (GAGI)",
'23' => "Société de fait (GAGI) : Société non enregistrée au Registre du Commerce",
'24' => "Surveillance impossible car société en liquidation judiciaire",
'25' => "Greffe inconnu",
'26' => "Millésime bilan à surveiller incorrect",
'27' => "Références EXTELIA erronées ou incomplètes (ces reférences sont obligatoires en cas de demande de suppression)",
'28' => "Surveillance impossible sur un dossier non informatisé (dossier dit non repris ou figé)",
'30' => "Siren absent (ne concerne que les surveillances de type WebService)",
'31' => "Surveillance BILAN impossible sur une société non commerciale (statut <> B)",
'50' => "Ce greffe ne traite pas les surveillances car le groupement de ce greffe n'est pas surveillé",
'51' => "Etablissement non trouvé",
'52' => "Code catalogue de la surveillance non renseigné ou incorrect",
'53' => "le siren est déjà sous surveillance",
'54' => "DOSSIER AGORA : votre prestation ne comprend pas la couverture de ce groupement",
'55' => "DOSSIER INTERGREFFE : votre prestation ne comprend pas la couverture de ce groupement de greffes",
'56' => "Le siren est déjà en attente de validation par le greffe",
'57' => "Surveillance impossible sur un dossier dit non inscrit au RCS (statut F:artisan)",
'58' => "Surveillance impossible sur un agent commercial (statut P ou M)",
'59' => 'Surveillance impossible sur une société non RCS ?',
'88' => "Rejet temporaire : surveillance sur un greffe absorbé rejetée pendant la phase de rechargement",
'99' => "Surveillance impossible pour raisons à examiner",
);
public $tabTypePriv = array(
'01' => "NANTISSEMENTS DU FONDS DE COMMERCE",
'02' => "PRIVILEGES DE VENDEUR ET ACTION RESOLUTOIRE",
'03' => "PRIVILEGES DE LA SECURITE SOCIALE ET DES REGIMES COMPLEMENTAIRES",
'04' => "PRIVILEGES DU TRESOR PUBLIC",
'05' => "OPERATIONS DE CREDIT-BAIL EN MATIERE MOBILIERE",
'06' => "PROTETS",
'07' => "NANTISSEMENTS DE L'OUTILLAGE, MATERIEL ET EQUIPEMENT",
'08' => "WARRANTS (HOTELIER, PETROLIER, INDUSTRIEL OU AGRICOLE)",
'10' => "NANTISSEMENTS DE PARTS DE SOCIETE CIVILE",
'17' => "PUBLICITES DE CONTRATS DE LOCATION",
'18' => "PUBLICITES DE CLAUSES DE RESERVE DE PROPRIETE",
'19' => "PRETS ET DELAIS",
'20' => "DECLARATIONS DE CREANCES",
'21' => "NANTISSEMENTS JUDICIAIRES",
'23' => "BIENS INALIENABLES",
'24' => "HYPOTHEQUES FLUVIALES",
'25' => "NANTISSEMENTS DU FONDS ARTISANAL",
'27' => "GAGE SANS DEPOSSESSION",
'28' => "GAGE DES STOCKS",
);
protected $iDb;
public function __construct($db = null)
{
if ($db === null) {
$this->iDb = new Metier_Util_Db();
} else {
$this->iDb = $db;
}
}
/**
* Détail des privileges
*
* @param string $siren
* @param array $tabTypes
* @return array
*/
public function getPrivilegesDetail($siren, $tabTypes=array('03', '04'))
{
$strTypes = implode("','", $tabTypes);
if ($strTypes != '') {
$strTypes=" AND i.insType IN ('$strTypes') ";
}
$fields = "i.id, i.dateEven, i.greffe , i.numDebiteur, i.sirenage, i.typeEven, i.dateFraiche, i.codeRev , i.debRaisonSociale , i.debSigle , i.debCiv , i.debNom , i.debPrenom , i.debConjoint , i.debUsage , i.debEnseigne , i.debActivite , i.debFj , i.debFjLib , i.debResidence , i.debNumVoie , i.debTypVoie , i.debLibVoie , i.debAdrComp , i.debCP , i.debVille , i.debPays , i.insType , i.insLib , i.insNum , i.insDate , i.insObjet , i.insMontant , i.insDev , i.insDateEch , i.insDateFin , i.insNanTx , i.insNanTitre , i.insNanOppo , i.insProNat , i.insProHui , i.insProRep , i.insNSCA , i.insNSCParts , i.insNSCSigni , i.creNom , i.creNumVoi, i.creTypVoi, i.creLibVoi, i.creAdrComp1, i.creAdrComp2, i.creCP, i.creVille, i.crePays, i.creAutres, i.radDate, i.radMention, i.radPartiel, i.radPartMt, i.radDev, i.radDiv, i.idFichier, i.dateInsert";
$where = "i.siren=$siren $strTypes AND ( (i.insType='03' AND DATEDIFF(NOW(),i.insDate)<=900) /** Durée de vie PRIV Sécu **/ OR (i.insType='04' AND DATEDIFF(NOW(),i.insDate)<=1460) /** Durée de vie PRIV Trésor **/ )";
$where.= " ORDER BY i.dateFraiche DESC, i.insType ASC, i.insDate ASC;";
$tables = "jo.greffes_privileges i";
$iRncs = new Metier_Partenaires_MRncs($this->iDb);
$tabRet = array();
$tabPriv = $this->iDb->select($tables, $fields, $where, true, MYSQL_ASSOC);
if (count($tabPriv) > 0) {
foreach ($tabPriv as $i => $priv) {
if ($i >0 && $priv['dateFraiche'] != $dateFraiche) {
break;
}
$tabRet[] = array(
'numDebiteur' => $priv['numDebiteur'],
'greffe' => $priv['greffe'],
'greffeLib' => $iRncs->getLibTribunal($priv['greffe']),
'dateEven' => $priv['dateEven'],
'dateFraiche' => $priv['dateFraiche'],
'dateSD' => $priv['dateInsert'],
'insType' => $priv['insType'],
'insTypeLib' => $this->tabTypePriv[$priv['insType']],
'insNum' => $priv['insNum'],
'insDate' => $priv['insDate'],
'insDateEch' => $priv['insDateEch'],
'insObjet' => $priv['insObjet'],
'insMontant' => $priv['insMontant'],
'insDev' => $priv['insDev'],
'insDateFin' => $priv['insDateFin'],
'radDate' => $priv['radDate'],
'radMention' => $priv['radMention'],
'radPartiel' => $priv['radPartiel'],
'radPartMt' => $priv['radPartMt'],
'radDev' => $priv['radDev'],
'creNom' => $priv['creNom'],
'creAdresse1' => trim(preg_replace('/ +/', ' ', $priv['creNumVoi'].' '.$priv['creTypVoi'].' '.$priv['creLibVoi'])),
'creAdresse2' => $priv['creAdrComp1'],
'creAdresse3' => $priv['creAdrComp2'],
'creCP' => $priv['creCP'],
'creVille' => $priv['creVille'],
'crePays' => $priv['crePays'],
'creAutres' => $priv['creAutres'],
);
$dateFraiche = $priv['dateFraiche'];
}
}
return $tabRet;
}
/**
* Cummul des privilèges
*
* @param string $siren
* @param array $tabTypes
* @return array
*/
public function getPrivilegesCumul($siren, $tabTypes=array('03', '04'))
{
$iRncs = new Metier_Partenaires_MRncs($this->iDb);
$tabRet = array();
$tabTmp = $this->getPrivilegesDetail($siren, $tabTypes);
if (count($tabTmp) > 0) {
foreach ($tabTmp as $i => $priv) {
$type = $priv['insType'];
if (array_key_exists($type, $tabRet)) {
$tStock = $tabRet[$type];
$tStock['nb'] ++;
$tStock['insCumul'] += $priv['insMontant'];
} else {
$tStock['nb'] = 1;
$tStock['insCumul'] = $priv['insMontant'];
}
$tStock['insTypeLib'] = $priv['insTypeLib'];
$tStock['dateFraiche'] = $priv['dateFraiche'];
$tStock['dateDerInsc'] = $priv['insDate'];
$tStock['nomDerCre'] = $priv['creNom'];
$tStock['numDebiteur'] = $priv['numDebiteur'];
$tStock['greffeLib'] = $iRncs->getLibTribunal($priv['greffe']);
$tStock['dateMajSD'] = $priv['dateSD'];
$tabRet[$type] = $tStock;
}
}
return $tabRet;
}
}

View File

@ -1,339 +1,332 @@
<?php
class Metier_Partenaires_MQualibat
{
private $referer ='';
private $body = '';
private $header = '';
private $cookie = '';
private $codeRetour = 0;
private $accesDist=true;
private $iDb;
private $iBodacc;
private $iInsee;
public $enCache=false;
public $force=false;
public $annee=0;
public function __construct($accesDist = true)
{
$this->accesDist = $accesDist;
$this->iDb = new Metier_Util_Db();
$this->iBodacc = new Metier_Bodacc_MBodacc();
$this->iInsee = new Metier_Insee_MInsee();
}
private function getCodeFctDirigeant($strLibDirigeant, $siren = 0)
{
$tabTmp = $this->iBodacc->getDirigeants($strLibDirigeant);
if (isset($tabTmp[0]['fonction']) && $tabTmp[0]['fonction'] > 0) {
return $tabTmp[0]['fonction'];
}
else {
if (preg_match("/directeur.{1,6}agence/iu")) {
return 8;
}
elseif (preg_match("/directeur.{1,6}ETABLISSEMENT/iu")) {
return 8;
}
elseif (preg_match("/directeur.{1,6}technique/iu")) {
return 19;
}
elseif (preg_match("/chef.{1,8}agence/iu")) {
return 38;
}
elseif (preg_match("/cadre.{1,8}Comptable/iu")) {
return 55;
}
elseif (preg_match("/Charg.{1,6}affair/iu")) {
return 60;
}
elseif (preg_match("/chef.{1,8}Atelier/iu")) {
return 60;
}
elseif (preg_match("/(conducteur|chef).{1,9}travaux/iu")) {
return 61;
}
elseif (preg_match("/directeur.{1,6}technique/iu")) {
return 19;
}
elseif (preg_match("/resp.{1,16}technique/iu")) {
return 49;
}
elseif (preg_match("/resp.{1,16}Expl/iu")) {
return 37;
}
elseif (preg_match("/di.{1,16}Expl/iu")) {
return 7;
}
elseif (preg_match("/Chef.{1,6}Ent/iu")) {
$tabTmp = $this->iInsee->getIdentiteLight($siren);
if ($tabTmp['FJ']>=1000 && $tabTmp['FJ']<2000) {
return 1050;
}
}
return false;
}
}
public function getMaxQualibat()
{
$ret = $this->iDb->select('sdv1.qualibat','MAX(id) AS id', '1', false, MYSQL_ASSOC);
return $ret[0]['id'];
}
public function getTabQualibatManquants()
{
$tabRet = $tabQualibatCalc = $tabQualibatBase = array();
// Liste des Qualibat Calculés
$maxQualibat = $this->getMaxQualibat();
for($i=1; $i<=$maxQualibat; $i++) {
$tabQualibatCalc[]=$i;
}
// Liste des Qualibat en base
$ret = $this->iDb->select('sdv1.qualibat','id', '1 ORDER BY id ASC', false, MYSQL_ASSOC);
foreach ($ret as $i=>$res) {
$tabQualibatBase[]=$res['id'];
}
return array_diff($tabQualibatCalc, $tabQualibatBase);
}
public function getInfosQualibat($siren, $idQualibat=0)
{
if ($siren*1 > 1000) {
$strWhere = "siren=$siren";
}
elseif ($idQualibat*1 > 0) {
$strWhere = "id=$idQualibat";
} else {
return false;
}
$ret = $this->iDb->select(
'sdv1.qualibat','siren, actif, id, nom, adresse, cp, ville, tel, fax, email, web,
eff, teff, ca, tca, libFJ, nace, dateFondation, dateDeb, dateFin, dateInsert',
$strWhere, false, MYSQL_ASSOC);
// In database
if (!$this->force && count($ret) > 0) {
$this->enCache=true;
$tabRet = $ret[0];//array();
// Ajout des qualifications
$ret = $this->iDb->select(
'sdv1.qualibatqualif','code, periodQualif, niveauQualif, mentions, nomQualif, dateAttrib, dateEch',
$strWhere, false, MYSQL_ASSOC);
foreach ($ret as $i => $tabTmp) {
$tabRet['qualifications'][] = $tabTmp;
}
// Ajout des dirigeants
$ret = $this->iDb->select(
'sdv1.qualibatdir','civNomPrenom, civilite, nom, prenom, fonction',
$strWhere, false, MYSQL_ASSOC);
foreach ($ret as $i => $tabTmp) {
$tabRet['dirigeants'][] = $tabTmp;
}
}
// WebSite
elseif ($this->accesDist == true) {
$this->enCache = false;
$url = 'http://www.qualibat.com/Views/EntreprisesRechercheDetail.aspx?id='.$idQualibat;
$page = getUrl($url, '', '', '', false, '', '', 3);
if ($page['code'] != 200) {
return false;
}
$body = $page['body'];
$tabRet['id'] = $idQualibat;
if (preg_match('/<th>(?:.*)Raison sociale(?:.*)<\/th>(?:.*)<td>(.*)<\/td>/Uis', $body, $matches)) {
$tabRet['nom'] = trim(strip_tags($matches[1]));
if (preg_match('/<th>(?:.*)Adresse(?:.*)<\/th>(?:.*)<td>(.*)<br \/>(.*)<\/td>/Uis', $body, $matches)) {
$tabRet['adresse'] =strtoupper(trim($matches[1]));
$adresse2 = trim(preg_replace('/ +/',' ',strtr(strip_tags($matches[2]),"\r\n\t".chr(160),' ')));
$tabRet['cp'] = substr($adresse2,0,5);
$tabRet['ville'] = trim(substr($adresse2,5));
}
if (preg_match('/<th>(?:.*)Téléphone(?:.*)<\/th>(?:.*)<td>(.*)<\/td>/Uisu', $body, $matches)) {
$tabRet['tel'] = trim(str_replace(' ','',$matches[1]));
}
if (preg_match('/<th>(?:.*)Fax(?:.*)<\/th>(?:.*)<td>(.*)<\/td>/Uis', $body, $matches)) {
$tabRet['fax'] = trim(str_replace(' ','',$matches[1]));
}
if (preg_match('/<th>E-mail<\/th><td>(?:.*)<a href= "mailto\:(.*)">/Uis', $body, $matches)) {
$tabRet['email'] = trim($matches[1]);
}
if (preg_match('/<th>(?:.*)SIREN(?:.*)<\/th>(?:.*)<td>(.*)<\/td>/Uis', $body, $matches)) {
$tabRet['siren']= $siren = trim(str_replace(' ','',$matches[1]));
}
if (preg_match('/<th>(?:.*)Effectif total(?:.*)<\/th>(?:.*)<td>(.*)\(Classification - (.*)\)(?:.*)<\/td>/Uis', $body, $matches)) {
$tabRet['eff'] = trim(str_replace(' ','',$matches[1]));
$tabRet['teff'] = trim($matches[2]);
}
if (preg_match('/<th>(?:.*)CA total(?:.*)<\/th>(?:.*)<td >(.*)\(Classification - (.*)\)(?:.*)<\/td>/Uis', $body, $matches)) {
$tabRet['ca'] = trim(str_replace(' ','',$matches[1]));
if ($tabRet['ca'] == '') {
$tabRet['ca'] = null;
}
$tabRet['tca'] = trim($matches[2]);
if ($tabRet['tca'] == '') {
$tabRet['tca'] = null;
}
}
if (preg_match('/<th>(?:.*)Forme Juridique(?:.*)<\/th>(?:.*)<td>(.*)<\/td>/Uis', $body, $matches)) {
$tabRet['libFJ'] = trim($matches[1]);
}
if (preg_match('/<th>(?:.*)NACE(?:.*)<\/th>(?:.*)<td>(.*)<\/td>/Uis', $body, $matches)) {
$tabRet['nace'] = trim($matches[1]);
}
if (preg_match('/<th>(?:.*)Fondation(?:.*)<\/th>(?:.*)<td>(.*)<\/td>/Uis', $body, $matches)) {
$tabRet['dateFondation'] = Metier_Util_Date::dateT('d/m/Y', 'Y-m-d', trim($matches[1]));
}
if (preg_match('/<tr><td align="center"><img src="(?:.*)internet_contact\.gif(?:.*)<\/td><td> <a href= "(.*)" target="_blank">/Uis', $body, $matches)) {
$tabRet['web'] = trim($matches[1]);
}
/** Qualifications ? **/
$qualifs = '';
if (preg_match('/<table class="recherche_entreprise_detail">(?:.*)<th colspan="4">(?:.*)(Qualifications professionnelles|Certifications m..tier)(?:.*)<tbody>(.*)<\/table>/Uisu', $body, $matches)) {
$typeQualifs = trim($matches[1]);
$qualifs = trim($matches[2]);
}
if (preg_match('/<th>(?:.*)Fondation(?:.*)<\/th>(?:.*)<td>(.*)<\/td>(.*)<div class="buttons">/Uis', $body, $matches)) {
$tabRet['tmpDirQualif'] = trim($matches[2]);
$tabRet['tmpLenDirQualif'] = strlen(trim($matches[2]));
}
$tabDateAttrib = $tabDateFin = array();
if (preg_match_all('/<tr>(?:.*)<td>(.*)<\/td>(?:.*)<td>(.*)<\/td>(?:.*)<td>(.*)<\/td>(?:.*)<td>(.*)<\/td>(?:.*)<\/tr>/Uis', $qualifs, $matches)) {
foreach ($matches[1] as $i => $code) {
$tabTmp = explode(' ', trim($code));
$nomQualif = trim($matches[2][$i]);
if (preg_match("/\(Tech?nicit. (.*)\)/Uiu", $nomQualif, $matches2)) {
$niveau = trim($matches2[1]);
}
else {
$niveau = '';
}
$tabMentions = array();
if (preg_match_all('/Mention (.*)(?:,|$)/Uis', $nomQualif, $matches2)) {
foreach ($matches2[1] as $i2 => $mention) {
$tabMentions[] = $mention;
}
}
$tabRet['qualifications'][$i] = array(
'code' => trim($tabTmp[0]),
'periodQualif' => trim($tabTmp[1]),
'nomQualif' => $nomQualif,
'niveauQualif' => $niveau,
'typeQualif' => $typeQualifs,
'mentions' => implode(', ', $tabMentions),
'dateAttrib' => Metier_Util_Date::dateT('d/m/Y', 'Y-m-d', trim($matches[3][$i])),
'dateEch' => Metier_Util_Date::dateT('d/m/Y', 'Y-m-d', trim($matches[4][$i]))
);
$tabDateAttrib[] = Metier_Util_Date::dateT('d/m/Y', 'Ymd', trim($matches[3][$i]))*1;
$tabDateFin[] = Metier_Util_Date::dateT('d/m/Y', 'Ymd', trim($matches[4][$i]))*1;
}
}
sort($tabDateAttrib);
rsort($tabDateFin);
/** Dirigeants ? **/
$dirs='';
if (preg_match('/<table class="recherche_entreprise_detail">(?:.*)<th colspan="2">(?:.*)Dirigeants(?:.*)<tbody>(.*)<\/table>/Uis', $body, $matches)) {
$dirs = trim($matches[1]);
}
if (preg_match_all('/<tr>(?:.*)<td>(.*)<\/td>(?:.*)<td>(.*)<\/td>(?:.*)<\/tr>/Uis', $dirs, $matches)) {
foreach ($matches[1] as $i => $nom) {
$strNom = trim($nom);
switch (strtoupper(substr($strNom, 0, 6))) {
case 'MONSIE': $civ='M'; $pDeb=8; break;
case 'MADAME': $civ='MME'; $pDeb=6; break;
case 'MADEMO': $civ='MLLE';$pDeb=12; break;
default: $civ=''; $pDeb=0; break;
}
$libFonction = ucwords(strtolower(trim($matches[2][$i])));
$tabRet['dirigeants'][$i] = array(
'civNomPrenom' => $strNom,
'civilite' => $civ,
'nom' => strtoupper(trim(substr($strNom,$pDeb,65))),
'prenom' => ucwords(strtolower(trim(substr($strNom,$pDeb+66)))),
'fonction' => $libFonction,
'fonctionCode' => $this->getCodeFctDirigeant($libFonction, $siren),
);
}
}
/** Insertion de l'entreprise **/
$tabInsert = array_merge($tabRet, array(
'idQualibatAttribue' => 1,
'dateInsert' => date('YmdHis'),
'dateDeb' => @$tabDateAttrib[0],
'dateFin' => @$tabDateFin[0]));
unset($tabInsert['qualifications']);
if (!$this->iDb->insert('sdv1.qualibat', $tabInsert)) {
$this->iDb->update('sdv1.qualibat', $tabInsert, "id=$idQualibat");
}
/** Insertion des qualifications **/
if (isset($tabRet['qualifications']) && count($tabRet['qualifications']) > 0)
foreach ($tabRet['qualifications'] as $i => $tabInsert) {
$tabInsert['id'] = $idQualibat;
$tabInsert['siren'] = $siren;
$tabInsert['dateInsert'] = date('YmdHis');
if (!$this->iDb->insert('sdv1.qualibatqualif', $tabInsert)) {
$this->iDb->update('sdv1.qualibatqualif', $tabInsert, "id=$idQualibat AND code='".$tabInsert['code']."' AND periodQualif='".$tabInsert['periodQualif']."'");
}
}
/** Insertion des dirigeants **/
if (isset($tabRet['dirigeants']) && count($tabRet['dirigeants']) > 0) {
foreach ($tabRet['dirigeants'] as $i => $tabInsert) {
$tabInsert['id'] = $idQualibat;
$tabInsert['siren'] = $siren;
$tabInsert['dateInsert'] = date('YmdHis');
if (!$this->iDb->insert('sdv1.qualibatdir', $tabInsert)) {
$this->iDb->update('sdv1.qualibatdir', $tabInsert, "id=$idQualibat AND civNomPrenom='".addslashes($tabInsert['civNomPrenom'])."' AND fonction='".addslashes($tabInsert['fonction'])."'");
}
unset($tabRet['dirigeants'][$i]['civNomPrenom']);
}
}
return $tabRet;
}
else {
$tabInsert = array(
'actif' => 0,
'id' => $idQualibat,
'idQualibatAttribue' => 0,
'dateInsert' => date('YmdHis')
);
$this->erreur = 'Numéro Qualibat inexistant';
// On enregistre ce numéro comme non attribué si < au dernier numéro attribué
if ($idQualibat < $this->getMaxQualibat()) {
$this->iDb->insert('sdv1.qualibat', $tabInsert);
}
return false;
}
}
return false;
}
}
<?php
class Metier_Partenaires_MQualibat
{
private $referer ='';
private $body = '';
private $header = '';
private $cookie = '';
private $codeRetour = 0;
private $accesDist=true;
private $iDb;
private $iBodacc;
private $iInsee;
public $enCache=false;
public $force=false;
public $annee=0;
protected $remote = false;
public function __construct($accesDist = true)
{
$this->accesDist = $accesDist;
$this->iDb = new Metier_Util_Db();
$this->iBodacc = new Metier_Bodacc_MBodacc();
$this->iInsee = new Metier_Insee_MInsee();
}
/**
* Active la récupération des données distantes
*/
public function setRemote()
{
$this->remote = true;
}
private function getCodeFctDirigeant($strLibDirigeant, $siren = 0)
{
$tabTmp = $this->iBodacc->getDirigeants($strLibDirigeant);
if (isset($tabTmp[0]['fonction']) && $tabTmp[0]['fonction'] > 0) {
return $tabTmp[0]['fonction'];
} else {
if (preg_match("/directeur.{1,6}agence/iu")) {
return 8;
} elseif (preg_match("/directeur.{1,6}ETABLISSEMENT/iu")) {
return 8;
} elseif (preg_match("/directeur.{1,6}technique/iu")) {
return 19;
} elseif (preg_match("/chef.{1,8}agence/iu")) {
return 38;
} elseif (preg_match("/cadre.{1,8}Comptable/iu")) {
return 55;
} elseif (preg_match("/Charg.{1,6}affair/iu")) {
return 60;
} elseif (preg_match("/chef.{1,8}Atelier/iu")) {
return 60;
} elseif (preg_match("/(conducteur|chef).{1,9}travaux/iu")) {
return 61;
} elseif (preg_match("/directeur.{1,6}technique/iu")) {
return 19;
} elseif (preg_match("/resp.{1,16}technique/iu")) {
return 49;
} elseif (preg_match("/resp.{1,16}Expl/iu")) {
return 37;
} elseif (preg_match("/di.{1,16}Expl/iu")) {
return 7;
} elseif (preg_match("/Chef.{1,6}Ent/iu")) {
$tabTmp = $this->iInsee->getIdentiteLight($siren);
if ($tabTmp['FJ']>=1000 && $tabTmp['FJ']<2000) {
return 1050;
}
}
return false;
}
}
public function getMaxQualibat()
{
$ret = $this->iDb->select('sdv1.qualibat', 'MAX(id) AS id', '1', false, MYSQL_ASSOC);
return $ret[0]['id'];
}
public function getTabQualibatManquants()
{
$tabRet = $tabQualibatCalc = $tabQualibatBase = array();
// Liste des Qualibat Calculés
$maxQualibat = $this->getMaxQualibat();
for ($i=1; $i<=$maxQualibat; $i++) {
$tabQualibatCalc[]=$i;
}
// Liste des Qualibat en base
$ret = $this->iDb->select('sdv1.qualibat', 'id', '1 ORDER BY id ASC', false, MYSQL_ASSOC);
foreach ($ret as $i=>$res) {
$tabQualibatBase[]=$res['id'];
}
return array_diff($tabQualibatCalc, $tabQualibatBase);
}
public function getInfosQualibat($siren, $idQualibat=0)
{
if ($siren*1 > 1000) {
$strWhere = "siren=$siren";
} elseif ($idQualibat*1 > 0) {
$strWhere = "id=$idQualibat";
} else {
return false;
}
$ret = $this->iDb->select(
'sdv1.qualibat', 'siren, actif, id, nom, adresse, cp, ville, tel, fax, email, web,
eff, teff, ca, tca, libFJ, nace, dateFondation, dateDeb, dateFin, dateInsert',
$strWhere, false, MYSQL_ASSOC);
// In database
if (!$this->force && count($ret) > 0) {
$this->enCache=true;
$tabRet = $ret[0];//array();
// Ajout des qualifications
$ret = $this->iDb->select(
'sdv1.qualibatqualif', 'code, periodQualif, niveauQualif, mentions, nomQualif, dateAttrib, dateEch',
$strWhere, false, MYSQL_ASSOC);
foreach ($ret as $i => $tabTmp) {
$tabRet['qualifications'][] = $tabTmp;
}
// Ajout des dirigeants
$ret = $this->iDb->select(
'sdv1.qualibatdir', 'civNomPrenom, civilite, nom, prenom, fonction',
$strWhere, false, MYSQL_ASSOC);
foreach ($ret as $i => $tabTmp) {
$tabRet['dirigeants'][] = $tabTmp;
}
}
// WebSite
elseif ($this->accesDist == true) {
$this->enCache = false;
$url = 'http://www.qualibat.com/Views/EntreprisesRechercheDetail.aspx?id='.$idQualibat;
$page = getUrl($url, '', '', '', false, '', '', 3);
if ($page['code'] != 200) {
return false;
}
$body = $page['body'];
$tabRet['id'] = $idQualibat;
if (preg_match('/<th>(?:.*)Raison sociale(?:.*)<\/th>(?:.*)<td>(.*)<\/td>/Uis', $body, $matches)) {
$tabRet['nom'] = trim(strip_tags($matches[1]));
if (preg_match('/<th>(?:.*)Adresse(?:.*)<\/th>(?:.*)<td>(.*)<br \/>(.*)<\/td>/Uis', $body, $matches)) {
$tabRet['adresse'] =strtoupper(trim($matches[1]));
$adresse2 = trim(preg_replace('/ +/', ' ', strtr(strip_tags($matches[2]), "\r\n\t".chr(160), ' ')));
$tabRet['cp'] = substr($adresse2, 0, 5);
$tabRet['ville'] = trim(substr($adresse2, 5));
}
if (preg_match('/<th>(?:.*)Téléphone(?:.*)<\/th>(?:.*)<td>(.*)<\/td>/Uisu', $body, $matches)) {
$tabRet['tel'] = trim(str_replace(' ', '', $matches[1]));
}
if (preg_match('/<th>(?:.*)Fax(?:.*)<\/th>(?:.*)<td>(.*)<\/td>/Uis', $body, $matches)) {
$tabRet['fax'] = trim(str_replace(' ', '', $matches[1]));
}
if (preg_match('/<th>E-mail<\/th><td>(?:.*)<a href= "mailto\:(.*)">/Uis', $body, $matches)) {
$tabRet['email'] = trim($matches[1]);
}
if (preg_match('/<th>(?:.*)SIREN(?:.*)<\/th>(?:.*)<td>(.*)<\/td>/Uis', $body, $matches)) {
$tabRet['siren']= $siren = trim(str_replace(' ', '', $matches[1]));
}
if (preg_match('/<th>(?:.*)Effectif total(?:.*)<\/th>(?:.*)<td>(.*)\(Classification - (.*)\)(?:.*)<\/td>/Uis', $body, $matches)) {
$tabRet['eff'] = trim(str_replace(' ', '', $matches[1]));
$tabRet['teff'] = trim($matches[2]);
}
if (preg_match('/<th>(?:.*)CA total(?:.*)<\/th>(?:.*)<td >(.*)\(Classification - (.*)\)(?:.*)<\/td>/Uis', $body, $matches)) {
$tabRet['ca'] = trim(str_replace(' ', '', $matches[1]));
if ($tabRet['ca'] == '') {
$tabRet['ca'] = null;
}
$tabRet['tca'] = trim($matches[2]);
if ($tabRet['tca'] == '') {
$tabRet['tca'] = null;
}
}
if (preg_match('/<th>(?:.*)Forme Juridique(?:.*)<\/th>(?:.*)<td>(.*)<\/td>/Uis', $body, $matches)) {
$tabRet['libFJ'] = trim($matches[1]);
}
if (preg_match('/<th>(?:.*)NACE(?:.*)<\/th>(?:.*)<td>(.*)<\/td>/Uis', $body, $matches)) {
$tabRet['nace'] = trim($matches[1]);
}
if (preg_match('/<th>(?:.*)Fondation(?:.*)<\/th>(?:.*)<td>(.*)<\/td>/Uis', $body, $matches)) {
$tabRet['dateFondation'] = Metier_Util_Date::dateT('d/m/Y', 'Y-m-d', trim($matches[1]));
}
if (preg_match('/<tr><td align="center"><img src="(?:.*)internet_contact\.gif(?:.*)<\/td><td> <a href= "(.*)" target="_blank">/Uis', $body, $matches)) {
$tabRet['web'] = trim($matches[1]);
}
/** Qualifications ? **/
$qualifs = '';
if (preg_match('/<table class="recherche_entreprise_detail">(?:.*)<th colspan="4">(?:.*)(Qualifications professionnelles|Certifications m..tier)(?:.*)<tbody>(.*)<\/table>/Uisu', $body, $matches)) {
$typeQualifs = trim($matches[1]);
$qualifs = trim($matches[2]);
}
if (preg_match('/<th>(?:.*)Fondation(?:.*)<\/th>(?:.*)<td>(.*)<\/td>(.*)<div class="buttons">/Uis', $body, $matches)) {
$tabRet['tmpDirQualif'] = trim($matches[2]);
$tabRet['tmpLenDirQualif'] = strlen(trim($matches[2]));
}
$tabDateAttrib = $tabDateFin = array();
if (preg_match_all('/<tr>(?:.*)<td>(.*)<\/td>(?:.*)<td>(.*)<\/td>(?:.*)<td>(.*)<\/td>(?:.*)<td>(.*)<\/td>(?:.*)<\/tr>/Uis', $qualifs, $matches)) {
foreach ($matches[1] as $i => $code) {
$tabTmp = explode(' ', trim($code));
$nomQualif = trim($matches[2][$i]);
if (preg_match("/\(Tech?nicit. (.*)\)/Uiu", $nomQualif, $matches2)) {
$niveau = trim($matches2[1]);
} else {
$niveau = '';
}
$tabMentions = array();
if (preg_match_all('/Mention (.*)(?:,|$)/Uis', $nomQualif, $matches2)) {
foreach ($matches2[1] as $i2 => $mention) {
$tabMentions[] = $mention;
}
}
$tabRet['qualifications'][$i] = array(
'code' => trim($tabTmp[0]),
'periodQualif' => trim($tabTmp[1]),
'nomQualif' => $nomQualif,
'niveauQualif' => $niveau,
'typeQualif' => $typeQualifs,
'mentions' => implode(', ', $tabMentions),
'dateAttrib' => Metier_Util_Date::dateT('d/m/Y', 'Y-m-d', trim($matches[3][$i])),
'dateEch' => Metier_Util_Date::dateT('d/m/Y', 'Y-m-d', trim($matches[4][$i]))
);
$tabDateAttrib[] = Metier_Util_Date::dateT('d/m/Y', 'Ymd', trim($matches[3][$i]))*1;
$tabDateFin[] = Metier_Util_Date::dateT('d/m/Y', 'Ymd', trim($matches[4][$i]))*1;
}
}
sort($tabDateAttrib);
rsort($tabDateFin);
/** Dirigeants ? **/
$dirs='';
if (preg_match('/<table class="recherche_entreprise_detail">(?:.*)<th colspan="2">(?:.*)Dirigeants(?:.*)<tbody>(.*)<\/table>/Uis', $body, $matches)) {
$dirs = trim($matches[1]);
}
if (preg_match_all('/<tr>(?:.*)<td>(.*)<\/td>(?:.*)<td>(.*)<\/td>(?:.*)<\/tr>/Uis', $dirs, $matches)) {
foreach ($matches[1] as $i => $nom) {
$strNom = trim($nom);
switch (strtoupper(substr($strNom, 0, 6))) {
case 'MONSIE': $civ='M'; $pDeb=8; break;
case 'MADAME': $civ='MME'; $pDeb=6; break;
case 'MADEMO': $civ='MLLE';$pDeb=12; break;
default: $civ=''; $pDeb=0; break;
}
$libFonction = ucwords(strtolower(trim($matches[2][$i])));
$tabRet['dirigeants'][$i] = array(
'civNomPrenom' => $strNom,
'civilite' => $civ,
'nom' => strtoupper(trim(substr($strNom, $pDeb, 65))),
'prenom' => ucwords(strtolower(trim(substr($strNom, $pDeb+66)))),
'fonction' => $libFonction,
'fonctionCode' => $this->getCodeFctDirigeant($libFonction, $siren),
);
}
}
/** Insertion de l'entreprise **/
$tabInsert = array_merge($tabRet, array(
'idQualibatAttribue' => 1,
'dateInsert' => date('YmdHis'),
'dateDeb' => @$tabDateAttrib[0],
'dateFin' => @$tabDateFin[0]));
unset($tabInsert['qualifications']);
if (!$this->iDb->insert('sdv1.qualibat', $tabInsert)) {
$this->iDb->update('sdv1.qualibat', $tabInsert, "id=$idQualibat");
}
/** Insertion des qualifications **/
if (isset($tabRet['qualifications']) && count($tabRet['qualifications']) > 0) {
foreach ($tabRet['qualifications'] as $i => $tabInsert) {
$tabInsert['id'] = $idQualibat;
$tabInsert['siren'] = $siren;
$tabInsert['dateInsert'] = date('YmdHis');
if (!$this->iDb->insert('sdv1.qualibatqualif', $tabInsert)) {
$this->iDb->update('sdv1.qualibatqualif', $tabInsert, "id=$idQualibat AND code='".$tabInsert['code']."' AND periodQualif='".$tabInsert['periodQualif']."'");
}
}
}
/** Insertion des dirigeants **/
if (isset($tabRet['dirigeants']) && count($tabRet['dirigeants']) > 0) {
foreach ($tabRet['dirigeants'] as $i => $tabInsert) {
$tabInsert['id'] = $idQualibat;
$tabInsert['siren'] = $siren;
$tabInsert['dateInsert'] = date('YmdHis');
if (!$this->iDb->insert('sdv1.qualibatdir', $tabInsert)) {
$this->iDb->update('sdv1.qualibatdir', $tabInsert, "id=$idQualibat AND civNomPrenom='".addslashes($tabInsert['civNomPrenom'])."' AND fonction='".addslashes($tabInsert['fonction'])."'");
}
unset($tabRet['dirigeants'][$i]['civNomPrenom']);
}
}
return $tabRet;
} else {
$tabInsert = array(
'actif' => 0,
'id' => $idQualibat,
'idQualibatAttribue' => 0,
'dateInsert' => date('YmdHis')
);
$this->erreur = 'Numéro Qualibat inexistant';
// On enregistre ce numéro comme non attribué si < au dernier numéro attribué
if ($idQualibat < $this->getMaxQualibat()) {
$this->iDb->insert('sdv1.qualibat', $tabInsert);
}
return false;
}
}
return false;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,294 +1,314 @@
<?php
require_once 'framework/common/curl.php';
class Metier_Partenaires_MTel
{
public $body = '';
public $header = '';
public $codeRetour = 0;
public $cookie='';
public $urlBase='http://www.pagespro.com/recherche.php';
public $url='';
public $referer='';
public $enCache=false;
private $accesDistant=false;
public $iDb;
public function __construct($accesDistant=false, $db=null)
{
$this->accesDistant=$accesDistant;
$this->accesDistant=false; // Accès bloqué par "pagespro"
if ($this->accesDistant) {
$this->url=$this->urlBase;
$page=getUrl($this->url,$this->cookie,'',$this->referer, false, '', '', 3);
$this->referer=$this->url;
$this->cookie=$page['header']['Set-Cookie'];
$this->body=$page['body'];
$this->codeRetour=$page['code'];
}
if ( $db === null ) {
$this->iDb = new Metier_Util_Db();
} else {
$this->iDb = $db;
}
}
/**
* Information contact
* @param string $siret
* @param string $nic
* @param boolean $last
* @param int $actif
* @return array Retourne une liste de téléphone
*/
public function getTel($siret, $nic=0, $last=false, $actif=null)
{
$tabRet=array();
if (strlen($siret)>9) {
$nic = substr($siret,-5)*1;
$siren = round($siret/100000)*1;
} else {
$siren=$siret*1;
}
if ($siren<1000) return $tabRet;
/** Si le siren est de taille < à 9, on ajoute des 0 significatifs **/
if (strlen($siren)<=9) {
$siren = str_pad($siren, 9, '0', STR_PAD_LEFT);
}
if (strlen($nic)>0) {
$nic = str_pad($nic, 5, '0', STR_PAD_LEFT);
}
$strNic='';
if ($nic*1>0) $strNic="AND (nic=$nic OR nic=0)";
$strActif='';
if ($actif==1) $strActif=" AND actif=1 ";
elseif($actif==0) $strActif=" AND actif=0 ";
$ret=$this->iDb->select(
'jo.telephonie',
'siren,nic,dateProvPartenaire,typeTel,infoTel,LPAD(telephone,10,0) AS telephone,actif,partenaire,idUtilisateur,dateInsert,dateInsert*1 AS dateInsertYmd,dateConfPartenaire,partenaireConf,nbConf,idUpdate,dateUpdate,dateUpdate*1 AS dateUpdateYmd',
"siren=$siren $strNic $strActif AND dateSuppr=0 ORDER BY typeTel ASC, nbConf DESC", false, MYSQL_ASSOC);
if (count($ret)>0)
{
$this->enCache=true;
foreach ($ret as $tabTel)
{
if ($tabTel['typeTel']=='an8' && $tabTel['infoTel']*1>0) {
$an8=$tabTel['infoTel']*1;
$retTmp=$this->iDb->select('jo.tabAn8', 'libAn8', "codAn8='$an8'", false, MYSQL_ASSOC);
$infoTel=ucfirst(strtolower($retTmp[0]['libAn8']));
} else {
$infoTel=$tabTel['infoTel'];
}
if ($tabTel['partenaireConf']>0) $source=$tabTel['partenaireConf'];
else $source=$tabTel['partenaire'];
if ($tabTel['dateUpdateYmd']>$tabTel['dateInsertYmd']) $dateMAJ=$tabTel['dateUpdateYmd'];
else $dateMAJ=$tabTel['dateInsertYmd'];
$tabR = array(
'siren'=>$siren,
'nic'=>$tabTel['nic'],
'typeTel'=>$tabTel['typeTel'],
'infoTel'=>$infoTel,
'telephone'=>$tabTel['telephone'],
'actif'=>$tabTel['actif'],
'source'=>$source,
'dateMAJ'=>$dateMAJ,
);
$tabRet[]=$tabR;
if ($last) {
if ($source==175 && !@isset($tabLast[$tabTel['typeTel']][1])) @$tabLast[$tabTel['typeTel']][1]=$tabR;
elseif(($source==118 ||
$source==250 ||
$source==253) && !@isset($tabLast[$tabTel['typeTel']][2])) @$tabLast[$tabTel['typeTel']][2]=$tabR;
elseif ($source<>2 && !@isset($tabLast[$tabTel['typeTel']][3])) @$tabLast[$tabTel['typeTel']][3]=$tabR;
elseif ($source==2 && !@isset($tabLast[$tabTel['typeTel']][4])) @$tabLast[$tabTel['typeTel']][4]=$tabR;
}
}
}
elseif ($this->accesDistant)
{
$this->enCache=false;
$tabPost = array(
'p_ACTION'=>'',
'p_ORDRE'=>'AfficheRes',
'a_PAGE'=>'1',
'a_TAG'=>'',
'a_OccRecherche'=>'',
'typeRecherche'=>'express',
'satellite'=>'siret',
'a_activ'=>'',
'a_rai_soc'=>'',
'a_naf'=>'',
'a_siren'=>$siret,
'a_tel'=>'',
'a_geo'=>'',
'typeTri'=>'',
'ordreTri'=>'',
'a_session'=>'',
);
//$page=getUrl($this->url,$this->cookie,'',$this->referer, false, '', '', 3);
$page=getUrl($this->url,$this->cookie,$tabPost,$this->referer,false,'','',3);
$this->referer=$this->url;
$this->body=$page['body'];
$this->codeRetour=$page['code'];
$nbResults=0;
if (preg_match('/<b class="total_responses_nr">(.*)réponses<\/b>/Uisu', $this->body, $matches))
$nbResults=trim(strtr(strip_tags($matches[1]), array('&nbsp;'=>'','&ndash;'=>'')));
if ($nbResults>0) {
$tabResultsHtml=explode('<div class="results_part1">', $this->body);
for ($i=1; isset($tabResultsHtml[$i]);$i++) {
$res=$tabTel=array();
$body=$tabResultsHtml[$i];
$res['nom']=trim(htm2txt(@getTextInHtml($body, '<div class="results_title">', '_title">', '</div>')));
$res['adresse']=trim(htm2txt(@getTextInHtml($body, '<div class="coordonnees">','<div>','<table id="t_coord_')));
$res['urlSite']=trim(htm2txt(@getTextInHtml($body, '<b class="siteweb">Site Web :</b>&nbsp;', "javascript:SiteURL('", "','")));
$res['urlMail']=trim(htm2txt(@getTextInHtml($body, '<b>E-mail :</b>', "&amp;mail=", "', ")));
$res['urlLogo']=trim(htm2txt(@getTextInHtml($body, '<div class="results_inset_logo">', '" src="', '" border="')));
$res['tefet']=trim(htm2txt(@getTextInHtml($body, '<b>Effectif établ : </b>','</b>','</div>')));
$res['tefet']=trim(htm2txt(@getTextInHtml($body, '<b>Effectif établ : </b>','</b>','</div>')));
$res['siret']=trim(htm2txt(@getTextInHtml($body, '<b>Siret : </b>','</b>','</div>')));
$res['nafet']=trim(htm2txt(strip_tags(@getTextInHtml($body, '<b>Code NAF : </b>','</b>','</div>'))));
$res['domaines']=trim(preg_replace('/ +/', ' ', preg_replace('/\r+|\n+|\s+/',' ',htm2txt(strip_tags(@getTextInHtml($body, '<div class="puce_domaine">','<strong>','</div>'))))));
if ($res['urlSite']<>'') {
$this->iDb->insert('jo.telephonie', array(
'siren'=>$siren,
'nic'=>substr($res['siret'],-5),
'dateProvPartenaire'=>date('Ymd'),
'typeTel'=>'web',
'infoTel'=>$res['urlSite'],
'telephone'=>0,
'actif'=>1,
'partenaire'=>253,
));
$tabRet[] = array(
'siren'=>$siren,
'nic'=>substr($res['siret'],-5),
'typeTel'=>'web',
'infoTel'=>$res['urlSite'],
'telephone'=>0,
);
}
if ($res['urlLogo']<>'') {
$this->iDb->insert('jo.telephonie', array(
'siren'=>$siren,
'nic'=>substr($res['siret'],-5),
'dateProvPartenaire'=>date('Ymd'),
'typeTel'=>'logo',
'infoTel'=>$res['urlLogo'],
'telephone'=>0,
'actif'=>1,
'partenaire'=>253,
));
$tabRet[] = array(
'siren'=>$siren,
'nic'=>substr($res['siret'],-5),
'typeTel'=>'logo',
'infoTel'=>$res['urlLogo'],
'telephone'=>0,
);
}
if ($res['domaines']<>'') {
$this->iDb->insert('jo.telephonie', array(
'siren'=>$siren,
'nic'=>substr($res['siret'],-5),
'dateProvPartenaire'=>date('Ymd'),
'typeTel'=>'domaines',
'infoTel'=>$res['domaines'],
'telephone'=>0,
'actif'=>1,
'partenaire'=>253,
));
$tabRet[]=array(
'siren'=>$siren,
'nic'=>substr($res['siret'],-5),
'typeTel'=>'domaines',
'infoTel'=>$res['domaines'],
'telephone'=>0,
);
}
if ($res['urlMail']<>'') {
$this->iDb->insert('jo.telephonie', array(
'siren'=>$siren,
'nic'=>substr($res['siret'],-5),
'dateProvPartenaire'=>date('Ymd'),
'typeTel'=>'mail',
'infoTel'=>$res['urlMail'],
'telephone'=>0,
'actif'=>1,
'partenaire'=>253,
));
$tabRet[]=array(
'siren'=>$siren,
'nic'=>substr($res['siret'],-5),
'typeTel'=>'mail',
'infoTel'=>$res['urlMail'],
'telephone'=>0,
);
}
if (preg_match_all('/<tr>(?:.*)<th>(?:.*)<span>(.*)(tél|fax)(?:.*)<\/span>(?:.*)<\/th>(?:.*)<td>(?:.*)<span>(.*)<\/span>(?:.*)<\/td>(?:.*)<\/tr>/Uis', $body, $matches))
{
foreach ($matches[2] as $j=>$tmp)
{
$lib=$tmp;
$precis=trim(strtr($matches[1][$j], array('-'=>' ')));
$num=trim(strtr($matches[3][$j],array('&nbsp;'=>'','<br />'=>'')));
$tabTel["$lib-$num"]=array('telFax'=>$lib,'type'=>$precis, 'telNum'=>$num);
}
$tabTel=array_values($tabTel);
foreach ($tabTel as $tabT)
{
$tabRet[]=array(
'siren'=>$siren,
'nic'=>substr($res['siret'],-5),
'typeTel'=>Metier_Util_String::trimAccent($tabT['telFax']),
'infoTel'=>$tabT['type'],
'telephone'=>$tabT['telNum'],
'actif'=>1,
);
$this->iDb->insert('jo.telephonie', array(
'siren'=>$siren,
'nic'=>substr($res['siret'],-5),
'dateProvPartenaire'=>date('Ymd'),
'typeTel'=>Metier_Util_String::trimAccent($tabT['telFax']),
'infoTel'=>$tabT['type'],
'telephone'=>$tabT['telNum'],
'actif'=>1,
'partenaire'=>253,
));
}
}
}
}
}
if ($last) {
$tabRet = array();
if ($tabLast != null && count($tabLast) > 0 ) {
foreach($tabLast as $typeTel=>$tabPriorite) {
ksort($tabPriorite);
$tabRet[]=current($tabPriorite);
}
}
}
return $tabRet;
}
}
<?php
require_once 'framework/common/curl.php';
class Metier_Partenaires_MTel
{
public $body = '';
public $header = '';
public $codeRetour = 0;
public $cookie='';
public $urlBase='http://www.pagespro.com/recherche.php';
public $url='';
public $referer='';
public $enCache=false;
private $accesDistant=false;
public $iDb;
protected $remote = false;
public function __construct($accesDistant=false, $db=null)
{
$this->accesDistant=$accesDistant;
$this->accesDistant=false; // Accès bloqué par "pagespro"
if ($this->accesDistant) {
$this->url=$this->urlBase;
$page=getUrl($this->url, $this->cookie, '', $this->referer, false, '', '', 3);
$this->referer=$this->url;
$this->cookie=$page['header']['Set-Cookie'];
$this->body=$page['body'];
$this->codeRetour=$page['code'];
}
if ($db === null) {
$this->iDb = new Metier_Util_Db();
} else {
$this->iDb = $db;
}
}
/**
* Active la récupération des données distantes
*/
public function setRemote()
{
$this->remote = true;
}
/**
* Information contact
* @param string $siret
* @param string $nic
* @param boolean $last
* @param int $actif
* @return array Retourne une liste de téléphone
*/
public function getTel($siret, $nic=0, $last=false, $actif=null)
{
$tabRet=array();
if (strlen($siret)>9) {
$nic = substr($siret, -5)*1;
$siren = round($siret/100000)*1;
} else {
$siren=$siret*1;
}
if ($siren<1000) {
return $tabRet;
}
/** Si le siren est de taille < à 9, on ajoute des 0 significatifs **/
if (strlen($siren)<=9) {
$siren = str_pad($siren, 9, '0', STR_PAD_LEFT);
}
if (strlen($nic)>0) {
$nic = str_pad($nic, 5, '0', STR_PAD_LEFT);
}
$strNic='';
if ($nic*1>0) {
$strNic="AND (nic=$nic OR nic=0)";
}
$strActif='';
if ($actif==1) {
$strActif=" AND actif=1 ";
} elseif ($actif==0) {
$strActif=" AND actif=0 ";
}
$ret=$this->iDb->select(
'jo.telephonie',
'siren,nic,dateProvPartenaire,typeTel,infoTel,LPAD(telephone,10,0) AS telephone,actif,partenaire,idUtilisateur,dateInsert,dateInsert*1 AS dateInsertYmd,dateConfPartenaire,partenaireConf,nbConf,idUpdate,dateUpdate,dateUpdate*1 AS dateUpdateYmd',
"siren=$siren $strNic $strActif AND dateSuppr=0 ORDER BY typeTel ASC, nbConf DESC", false, MYSQL_ASSOC);
if (count($ret)>0) {
$this->enCache=true;
foreach ($ret as $tabTel) {
if ($tabTel['typeTel']=='an8' && $tabTel['infoTel']*1>0) {
$an8=$tabTel['infoTel']*1;
$retTmp=$this->iDb->select('jo.tabAn8', 'libAn8', "codAn8='$an8'", false, MYSQL_ASSOC);
$infoTel=ucfirst(strtolower($retTmp[0]['libAn8']));
} else {
$infoTel=$tabTel['infoTel'];
}
if ($tabTel['partenaireConf']>0) {
$source=$tabTel['partenaireConf'];
} else {
$source=$tabTel['partenaire'];
}
if ($tabTel['dateUpdateYmd']>$tabTel['dateInsertYmd']) {
$dateMAJ=$tabTel['dateUpdateYmd'];
} else {
$dateMAJ=$tabTel['dateInsertYmd'];
}
$tabR = array(
'siren'=>$siren,
'nic'=>$tabTel['nic'],
'typeTel'=>$tabTel['typeTel'],
'infoTel'=>$infoTel,
'telephone'=>$tabTel['telephone'],
'actif'=>$tabTel['actif'],
'source'=>$source,
'dateMAJ'=>$dateMAJ,
);
$tabRet[]=$tabR;
if ($last) {
if ($source==175 && !@isset($tabLast[$tabTel['typeTel']][1])) {
@$tabLast[$tabTel['typeTel']][1]=$tabR;
} elseif (($source==118 ||
$source==250 ||
$source==253) && !@isset($tabLast[$tabTel['typeTel']][2])) {
@$tabLast[$tabTel['typeTel']][2]=$tabR;
} elseif ($source<>2 && !@isset($tabLast[$tabTel['typeTel']][3])) {
@$tabLast[$tabTel['typeTel']][3]=$tabR;
} elseif ($source==2 && !@isset($tabLast[$tabTel['typeTel']][4])) {
@$tabLast[$tabTel['typeTel']][4]=$tabR;
}
}
}
} elseif ($this->accesDistant) {
$this->enCache=false;
$tabPost = array(
'p_ACTION'=>'',
'p_ORDRE'=>'AfficheRes',
'a_PAGE'=>'1',
'a_TAG'=>'',
'a_OccRecherche'=>'',
'typeRecherche'=>'express',
'satellite'=>'siret',
'a_activ'=>'',
'a_rai_soc'=>'',
'a_naf'=>'',
'a_siren'=>$siret,
'a_tel'=>'',
'a_geo'=>'',
'typeTri'=>'',
'ordreTri'=>'',
'a_session'=>'',
);
//$page=getUrl($this->url,$this->cookie,'',$this->referer, false, '', '', 3);
$page=getUrl($this->url, $this->cookie, $tabPost, $this->referer, false, '', '', 3);
$this->referer=$this->url;
$this->body=$page['body'];
$this->codeRetour=$page['code'];
$nbResults=0;
if (preg_match('/<b class="total_responses_nr">(.*)réponses<\/b>/Uisu', $this->body, $matches)) {
$nbResults=trim(strtr(strip_tags($matches[1]), array('&nbsp;'=>'', '&ndash;'=>'')));
}
if ($nbResults>0) {
$tabResultsHtml=explode('<div class="results_part1">', $this->body);
for ($i=1; isset($tabResultsHtml[$i]);$i++) {
$res=$tabTel=array();
$body=$tabResultsHtml[$i];
$res['nom']=trim(htm2txt(@getTextInHtml($body, '<div class="results_title">', '_title">', '</div>')));
$res['adresse']=trim(htm2txt(@getTextInHtml($body, '<div class="coordonnees">', '<div>', '<table id="t_coord_')));
$res['urlSite']=trim(htm2txt(@getTextInHtml($body, '<b class="siteweb">Site Web :</b>&nbsp;', "javascript:SiteURL('", "','")));
$res['urlMail']=trim(htm2txt(@getTextInHtml($body, '<b>E-mail :</b>', "&amp;mail=", "', ")));
$res['urlLogo']=trim(htm2txt(@getTextInHtml($body, '<div class="results_inset_logo">', '" src="', '" border="')));
$res['tefet']=trim(htm2txt(@getTextInHtml($body, '<b>Effectif établ : </b>', '</b>', '</div>')));
$res['tefet']=trim(htm2txt(@getTextInHtml($body, '<b>Effectif établ : </b>', '</b>', '</div>')));
$res['siret']=trim(htm2txt(@getTextInHtml($body, '<b>Siret : </b>', '</b>', '</div>')));
$res['nafet']=trim(htm2txt(strip_tags(@getTextInHtml($body, '<b>Code NAF : </b>', '</b>', '</div>'))));
$res['domaines']=trim(preg_replace('/ +/', ' ', preg_replace('/\r+|\n+|\s+/', ' ', htm2txt(strip_tags(@getTextInHtml($body, '<div class="puce_domaine">', '<strong>', '</div>'))))));
if ($res['urlSite']<>'') {
$this->iDb->insert('jo.telephonie', array(
'siren'=>$siren,
'nic'=>substr($res['siret'], -5),
'dateProvPartenaire'=>date('Ymd'),
'typeTel'=>'web',
'infoTel'=>$res['urlSite'],
'telephone'=>0,
'actif'=>1,
'partenaire'=>253,
));
$tabRet[] = array(
'siren'=>$siren,
'nic'=>substr($res['siret'], -5),
'typeTel'=>'web',
'infoTel'=>$res['urlSite'],
'telephone'=>0,
);
}
if ($res['urlLogo']<>'') {
$this->iDb->insert('jo.telephonie', array(
'siren'=>$siren,
'nic'=>substr($res['siret'], -5),
'dateProvPartenaire'=>date('Ymd'),
'typeTel'=>'logo',
'infoTel'=>$res['urlLogo'],
'telephone'=>0,
'actif'=>1,
'partenaire'=>253,
));
$tabRet[] = array(
'siren'=>$siren,
'nic'=>substr($res['siret'], -5),
'typeTel'=>'logo',
'infoTel'=>$res['urlLogo'],
'telephone'=>0,
);
}
if ($res['domaines']<>'') {
$this->iDb->insert('jo.telephonie', array(
'siren'=>$siren,
'nic'=>substr($res['siret'], -5),
'dateProvPartenaire'=>date('Ymd'),
'typeTel'=>'domaines',
'infoTel'=>$res['domaines'],
'telephone'=>0,
'actif'=>1,
'partenaire'=>253,
));
$tabRet[]=array(
'siren'=>$siren,
'nic'=>substr($res['siret'], -5),
'typeTel'=>'domaines',
'infoTel'=>$res['domaines'],
'telephone'=>0,
);
}
if ($res['urlMail']<>'') {
$this->iDb->insert('jo.telephonie', array(
'siren'=>$siren,
'nic'=>substr($res['siret'], -5),
'dateProvPartenaire'=>date('Ymd'),
'typeTel'=>'mail',
'infoTel'=>$res['urlMail'],
'telephone'=>0,
'actif'=>1,
'partenaire'=>253,
));
$tabRet[]=array(
'siren'=>$siren,
'nic'=>substr($res['siret'], -5),
'typeTel'=>'mail',
'infoTel'=>$res['urlMail'],
'telephone'=>0,
);
}
if (preg_match_all('/<tr>(?:.*)<th>(?:.*)<span>(.*)(tél|fax)(?:.*)<\/span>(?:.*)<\/th>(?:.*)<td>(?:.*)<span>(.*)<\/span>(?:.*)<\/td>(?:.*)<\/tr>/Uis', $body, $matches)) {
foreach ($matches[2] as $j=>$tmp) {
$lib=$tmp;
$precis=trim(strtr($matches[1][$j], array('-'=>' ')));
$num=trim(strtr($matches[3][$j], array('&nbsp;'=>'', '<br />'=>'')));
$tabTel["$lib-$num"]=array('telFax'=>$lib,'type'=>$precis, 'telNum'=>$num);
}
$tabTel=array_values($tabTel);
foreach ($tabTel as $tabT) {
$tabRet[]=array(
'siren'=>$siren,
'nic'=>substr($res['siret'], -5),
'typeTel'=>Metier_Util_String::trimAccent($tabT['telFax']),
'infoTel'=>$tabT['type'],
'telephone'=>$tabT['telNum'],
'actif'=>1,
);
$this->iDb->insert('jo.telephonie', array(
'siren'=>$siren,
'nic'=>substr($res['siret'], -5),
'dateProvPartenaire'=>date('Ymd'),
'typeTel'=>Metier_Util_String::trimAccent($tabT['telFax']),
'infoTel'=>$tabT['type'],
'telephone'=>$tabT['telNum'],
'actif'=>1,
'partenaire'=>253,
));
}
}
}
}
}
if ($last) {
$tabRet = array();
if ($tabLast != null && count($tabLast) > 0) {
foreach ($tabLast as $typeTel=>$tabPriorite) {
ksort($tabPriorite);
$tabRet[]=current($tabPriorite);
}
}
}
return $tabRet;
}
}

View File

@ -1,282 +1,301 @@
<?php
require_once 'framework/common/curl.php';
class Metier_Partenaires_MTva
{
public $vatNumber = ''; // Numéro de TVA retourné
public $vatDefined = false; // Le numéro de TVA est il validé ?
public $errnum = 0; // Numéro de l'erreur en cas d'erreur
public $errmsg = ''; // Message de l'erreur en cas d'erreur
private $siren;
protected $iDb;
public function __construct($siren, $accesDist=true, $db = null)
{
$sirenIn = $siren*1;
if ( $sirenIn<000001000 ) {
$this->vatNumber = 'FR00000000000';
$this->vatDefined = false;
return false;
}
if ( $db === null ) {
$this->iDb = new Metier_Util_Db();
} else {
$this->iDb = $db;
}
$siren = str_pad($siren, 9, '0', STR_PAD_LEFT);
$this->siren = $siren;
$cleAlgo=$this->genereCleFr();
if ($cleAlgo<10) $cleAlgo='0'.$cleAlgo;
else $cleAlgo=''.$cleAlgo;
$tabRep=array();
if (!$this->valideSiren($siren) && substr($siren,0,4)<>'0000') {
$this->errnum=102;
$this->errmsg='Siren invalide';
return false;
}
$info = $this->iDb->select('sdv1.siren_tva', "LPAD(cle,2,0) AS cle, DATE_FORMAT(dateMod,'%Y%m%d') as DateMAJ", "siren=$siren", false, MYSQL_ASSOC);
$tab=$info[0];
if (count($tab)>0) {
if ( $tab['cle']<>NULL || ( $tab['cle']==NULL && $tab['DateMAJ']>=date('Ymd',mktime(0,0,0,date('m')-6,date('d'),date('Y'))) )) {
$cle=$tab['cle'];
if ($cle==NULL) { $attribue=false; $cle=$cleAlgo; }
else $attribue=true;
$this->vatNumber="FR$cle$siren";
$this->vatDefined=$attribue;
return true;
}
}
$cle=$cleAlgo;
$nbIndispo=0;
if ($accesDist) {
while(true) {
$postData=array( //'Lang'=>'FR',
'ms'=>'FR',
'iso'=>'FR',
'vat'=>$cle.$siren,
'BtnSubmitVat'=>'Verify');
/*$postData=array(
* 'Lang'=>'FR',
'VAT'=>$cle.$siren,
'ISO'=>'FR',
'MS'=>'FR'
);*/
$tdeb = microtime(true);
// $url='http://ec.europa.eu/taxation_customs/vies/cgi-bin/viesquer';
// $referer='http://ec.europa.eu/taxation_customs/vies/fr/vieshome.htm';
$url='http://ec.europa.eu/taxation_customs/vies/viesquer.do';
$referer='http://ec.europa.eu/taxation_customs/vies/';
$page=getUrl($url, '', $postData, $referer, false, 'ec.europa.eu', '', 15);
$duree = round(microtime(true)-$tdeb, 3);
if ($page['err_num']<>0) {
Metier_Util_Log::write('W', 'TVA Erreur CURL n°'. $page['err_num'] .', '. $page['err_msg'] ." sur le Siren $siren, numéro de TVA = FR $cle $siren. Durée = $duree s !", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
$this->vatNumber="FR$cle$siren";
$this->vatDefined=false;
return true;
}
$code=$page['code'];// Code réponse Serveur
$body=$page['body'];
$header=$page['header'];
if (preg_match('/Yes, valid VAT number/i', $body)) {
$tabInsert=array('siren'=>$siren,'cle'=>$cle, 'duree'=>$duree);
$tabUpdate=array('cle'=>$cle, 'duree'=>$duree);
if (!$this->iDb->insert('sdv1.siren_tva', $tabInsert))
if (!$this->iDb->update('sdv1.siren_tva', $tabUpdate, "siren=$siren"))
Metier_Util_Log::write('W', "Siren $siren, numéro de TVA = FR $cle $siren, impossible de MAJ la clef ($duree s) - ERREUR MySql n°". mysql_errno() .' : '. mysql_error(), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
//echo date ('Y/m/d - H:i:s') ." - Ligne $k/$nbk, N°TVA FR $cle $siren validé .".$eol;
Metier_Util_Log::write('I', "Siren $siren, numéro de TVA = FR $cle $siren ($duree s)", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
$this->vatNumber="FR$cle$siren";
$this->vatDefined=true;
return true;
//return array('error'=>array('errnum'=>0, 'errmsg'=>''), 'result'=>array('siren'=>$siren, 'vatNumber'=>"FR$cle$siren", 'vatDefined'=>true));
} elseif (strpos($body, 'Service non disponible')>0 || strpos($body, 'ponse trop long.')>0) {
$nbIndispo++;
if ($nbIndispo<3) {
//echo date ('Y/m/d - H:i:s') .' - '.$eol;
Metier_Util_Log::write('I', "TVA Siren $siren, Service de l'état membre indisponible. Mise en sommeil...", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
sleep(rand(1, 2));
$nbIndispo=0;
//echo date ('Y/m/d - H:i:s') .' - Reprise du Siren = '. $siren . $eol;
} else {
$tabInsert=array('siren'=>$siren,'cle'=>'NULL', 'duree'=>$duree);
$tabUpdate=array('cle'=>'NULL', 'duree'=>$duree);
if (!$this->iDb->insert('sdv1.siren_tva', $tabInsert))
if (!$this->iDb->update('sdv1.siren_tva', $tabUpdate, "siren=$siren"))
Metier_Util_Log::write('W', "Siren $siren, numéro de TVA = FR $cle $siren, impossible de MAJ la clef ($duree s) - ERREUR MySql n°". mysql_errno() .' : '. mysql_error(), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
Metier_Util_Log::write('I', "Siren $siren, numéro de TVA = FR $cle $siren vérification non disponible ($duree s)", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
$this->vatNumber="FR$cle$siren";
$this->vatDefined=false;
return true;
}
//echo date ('Y/m/d - H:i:s') .' - Temporisation n°'.$nbIndispo . $eol;
} else {
$tabInsert=array('siren'=>$siren,'cle'=>'NULL', 'duree'=>$duree);
$tabUpdate=array('cle'=>'NULL', 'duree'=>$duree);
if (!$this->iDb->insert('sdv1.siren_tva', $tabInsert))
if (!$this->iDb->update('sdv1.siren_tva', $tabUpdate, "siren=$siren"))
Metier_Util_Log::write('W', "Siren $siren, numéro de TVA = FR $cle $siren, impossible de MAJ la clef ($duree s) - ERREUR MySql n°". mysql_errno() .' : '. mysql_error(), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
Metier_Util_Log::write('I', "Siren $siren, numéro de TVA = FR $cle $siren non attribué ($duree s)", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
$this->vatNumber="FR$cle$siren";
$this->vatDefined=false;
return true;
}
}
} else {
$this->errnum=999;
$this->errmsg="Pas d'accès à la base TVA";
$this->vatNumber="FR$cle$siren";
$this->vatDefined=false;
return true;
}
Metier_Util_Log::write('W', "Erreur impossible (car l'algo ne devrait pas passer par ici) sur le Siren $siren, numéro de TVA = FR $cle $siren. Durée = $duree s. Cas impossible !", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
return true;//array('error'=>array('errnum'=>800, 'errmsg'=>'Erreur SGBDR'), 'result'=>$tabRet);
}
/**
* Génère la clé du numéro de TVA pour le siren fournit
* (la validité du numéro de siren et son existance n'est pas effectué par cette méthode)
*
* @return number
* La clé du numéro de TVA
*/
private function genereCleFr()
{
// Position du chiffre SIREN (1 à 9)
$tabFirst = array(
array( 0, 0, 0, 0, 0, 0, 0, 0, 0),
array(62,47,94,89,40,06,22,43,16),
array(14,81,78,68,67,96,31,73,19),
array(63,18,62,47,94,89,40,06,22),
array(15,52,46,26,24,82,49,36,25),
array(64,86,30,05,51,75,58,66,28),
array(16,23,14,81,78,68,67,96,31),
array(65,57,95,60,08,61,76,29,34),
array(17,91,79,39,35,54,85,59,37),
array(66,28,63,18,62,47,94,89,40),
);
// Chiffre 0 à 9
$tabPoids = array(1,34,-16,-21,27,-7,9,30,3);
$cle = $first = 0;
for($pos=0; $pos<9; $pos++) {
$chiffre = $this->siren[$pos];
if ($first == 0) {
$first = $cle = $tabFirst[$chiffre][$pos];
} else {
$cle += $tabPoids[$pos] * $chiffre;
}
}
while(true) {
if ($cle > 96) {
$cle = $cle - 97;
}
elseif ($cle < 0) {
$cle = $cle + 97;
}
else {
break;
}
}
if ($cle == 0) {
return 96;
}
return ($cle-1);
}
/**
* Test de la validité du siren demandé
*
* @param int SIREN à tester
* @param int NIC (facultatif)
* @param mixed Message textuel d'erreur à afficher en cas d'erreur ou false
* @return mixed true, false ou Message d'erreur passé en paramètre
*/
private function valideSiren($siren, $nic='', $erreur=false)
{
$siren = str_pad($siren, 9, '0', STR_PAD_LEFT);
if (!empty($nic)) {
$nic = str_pad($nic, 5, '0', STR_PAD_LEFT);
}
//Siren non précisé ou incorrect.
if (!Metier_Util_String::valideData($siren, 9, 9,'N')) {
return $erreur;
}
// Siren vide
elseif (intval($siren) == 0) {
return $erreur;
}
else {
if (!isset($nic) || trim($nic)=='') {
$somme = 0;
// Traitement IMPAIR
for ($i=0; $i<=8; $i+=2) {
$somme+= (integer) substr($siren,$i,1);
}
// Traitement PAIR
for ($i=1; $i<=7; $i+=2) {
$var_tmp = (string) (2*((integer)substr($siren,$i,1)));
$som_tmp = 0;
for($j=0; $j<strlen($var_tmp);$j++) {
$som_tmp+= (integer)substr($var_tmp,$j,1);
}
$somme+= $som_tmp;
}
// Le Siren est faux
if ((integer) ($somme/10) != ($somme/10)) {
// Les siren débutant par 200 sont toujours valides (sirens provisoires de la BDF?!)
if (substr($siren,0,3) != '200') {
return $erreur;
}
}
}
else {
// Nic de format incorrect.
if (!Metier_Util_String::valideData($nic,1,5,'N')) {
return $erreur;
}
$SIRET = $siren.$nic;
if ($siren == '356000000') {
// Cas particulier du siren de LA POSTE : 356 000 000 00000
$somme = 14;
for ($i=9; $i<=13; $i++) {
$somme+= (integer)substr($SIRET,$i,1);
}
// Le NIC de l'établissement de LA POSTE est faux !
if ($somme%5 != 0) {
return $erreur;
}
} else {
$somme=0;
// Traitement PAIR
for ($i=0; $i<=12; $i+=2) {
$var_tmp = (string) (2*((integer)substr($SIRET,$i,1)));
$som_tmp = 0;
for($j=0; $j<strlen($var_tmp); $j++) {
$som_tmp+= (integer) substr($var_tmp,$j,1);
}
$somme+= $som_tmp;
}
// Traitement IMPAIR
for ($i=1; $i<=13; $i+=2) {
$somme+= (integer) substr($SIRET,$i,1);
}
// Le Siret est faux
if ((integer) ($somme/10) != ($somme/10)) {
return $erreur;
}
}
}
}
return true;
}
}
<?php
require_once 'framework/common/curl.php';
class Metier_Partenaires_MTva
{
public $vatNumber = ''; // Numéro de TVA retourné
public $vatDefined = false; // Le numéro de TVA est il validé ?
public $errnum = 0; // Numéro de l'erreur en cas d'erreur
public $errmsg = ''; // Message de l'erreur en cas d'erreur
private $siren;
protected $iDb;
protected $remote = false;
public function __construct($siren, $accesDist=true, $db = null)
{
$sirenIn = $siren*1;
if ($sirenIn<000001000) {
$this->vatNumber = 'FR00000000000';
$this->vatDefined = false;
return false;
}
if ($db === null) {
$this->iDb = new Metier_Util_Db();
} else {
$this->iDb = $db;
}
$siren = str_pad($siren, 9, '0', STR_PAD_LEFT);
$this->siren = $siren;
$cleAlgo = $this->genereCleFr();
if ($cleAlgo<10) {
$cleAlgo='0'.$cleAlgo;
} else {
$cleAlgo=''.$cleAlgo;
}
$tabRep=array();
if (!$this->valideSiren($siren) && substr($siren, 0, 4)<>'0000') {
$this->errnum=102;
$this->errmsg='Siren invalide';
return false;
}
$info = $this->iDb->select('sdv1.siren_tva', "LPAD(cle,2,0) AS cle, DATE_FORMAT(dateMod,'%Y%m%d') as DateMAJ", "siren=$siren", false, MYSQL_ASSOC);
$tab=$info[0];
if (count($tab)>0) {
if ($tab['cle']<>null || ($tab['cle']==null && $tab['DateMAJ']>=date('Ymd', mktime(0, 0, 0, date('m')-6, date('d'), date('Y'))))) {
$cle=$tab['cle'];
if ($cle==null) {
$attribue=false;
$cle=$cleAlgo;
} else {
$attribue=true;
}
$this->vatNumber="FR$cle$siren";
$this->vatDefined=$attribue;
return true;
}
}
$cle=$cleAlgo;
$nbIndispo=0;
if ($accesDist) {
while (true) {
$postData=array( //'Lang'=>'FR',
'ms'=>'FR',
'iso'=>'FR',
'vat'=>$cle.$siren,
'BtnSubmitVat'=>'Verify');
/*$postData=array(
* 'Lang'=>'FR',
'VAT'=>$cle.$siren,
'ISO'=>'FR',
'MS'=>'FR'
);*/
$tdeb = microtime(true);
// $url='http://ec.europa.eu/taxation_customs/vies/cgi-bin/viesquer';
// $referer='http://ec.europa.eu/taxation_customs/vies/fr/vieshome.htm';
$url='http://ec.europa.eu/taxation_customs/vies/viesquer.do';
$referer='http://ec.europa.eu/taxation_customs/vies/';
$page=getUrl($url, '', $postData, $referer, false, 'ec.europa.eu', '', 15);
$duree = round(microtime(true)-$tdeb, 3);
if ($page['err_num']<>0) {
Metier_Util_Log::write('W', 'TVA Erreur CURL n°'. $page['err_num'] .', '. $page['err_msg'] ." sur le Siren $siren, numéro de TVA = FR $cle $siren. Durée = $duree s !", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
$this->vatNumber="FR$cle$siren";
$this->vatDefined=false;
return true;
}
$code=$page['code'];// Code réponse Serveur
$body=$page['body'];
$header=$page['header'];
if (preg_match('/Yes, valid VAT number/i', $body)) {
$tabInsert=array('siren'=>$siren,'cle'=>$cle, 'duree'=>$duree);
$tabUpdate=array('cle'=>$cle, 'duree'=>$duree);
if (!$this->iDb->insert('sdv1.siren_tva', $tabInsert)) {
if (!$this->iDb->update('sdv1.siren_tva', $tabUpdate, "siren=$siren")) {
Metier_Util_Log::write('W', "Siren $siren, numéro de TVA = FR $cle $siren, impossible de MAJ la clef ($duree s) - ERREUR MySql n°". mysql_errno() .' : '. mysql_error(), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
}
}
//echo date ('Y/m/d - H:i:s') ." - Ligne $k/$nbk, N°TVA FR $cle $siren validé .".$eol;
Metier_Util_Log::write('I', "Siren $siren, numéro de TVA = FR $cle $siren ($duree s)", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
$this->vatNumber="FR$cle$siren";
$this->vatDefined=true;
return true;
//return array('error'=>array('errnum'=>0, 'errmsg'=>''), 'result'=>array('siren'=>$siren, 'vatNumber'=>"FR$cle$siren", 'vatDefined'=>true));
} elseif (strpos($body, 'Service non disponible')>0 || strpos($body, 'ponse trop long.')>0) {
$nbIndispo++;
if ($nbIndispo<3) {
//echo date ('Y/m/d - H:i:s') .' - '.$eol;
Metier_Util_Log::write('I', "TVA Siren $siren, Service de l'état membre indisponible. Mise en sommeil...", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
sleep(rand(1, 2));
$nbIndispo=0;
//echo date ('Y/m/d - H:i:s') .' - Reprise du Siren = '. $siren . $eol;
} else {
$tabInsert=array('siren'=>$siren,'cle'=>'NULL', 'duree'=>$duree);
$tabUpdate=array('cle'=>'NULL', 'duree'=>$duree);
if (!$this->iDb->insert('sdv1.siren_tva', $tabInsert)) {
if (!$this->iDb->update('sdv1.siren_tva', $tabUpdate, "siren=$siren")) {
Metier_Util_Log::write('W', "Siren $siren, numéro de TVA = FR $cle $siren, impossible de MAJ la clef ($duree s) - ERREUR MySql n°". mysql_errno() .' : '. mysql_error(), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
}
}
Metier_Util_Log::write('I', "Siren $siren, numéro de TVA = FR $cle $siren vérification non disponible ($duree s)", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
$this->vatNumber="FR$cle$siren";
$this->vatDefined=false;
return true;
}
//echo date ('Y/m/d - H:i:s') .' - Temporisation n°'.$nbIndispo . $eol;
} else {
$tabInsert=array('siren'=>$siren,'cle'=>'NULL', 'duree'=>$duree);
$tabUpdate=array('cle'=>'NULL', 'duree'=>$duree);
if (!$this->iDb->insert('sdv1.siren_tva', $tabInsert)) {
if (!$this->iDb->update('sdv1.siren_tva', $tabUpdate, "siren=$siren")) {
Metier_Util_Log::write('W', "Siren $siren, numéro de TVA = FR $cle $siren, impossible de MAJ la clef ($duree s) - ERREUR MySql n°". mysql_errno() .' : '. mysql_error(), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
}
}
Metier_Util_Log::write('I', "Siren $siren, numéro de TVA = FR $cle $siren non attribué ($duree s)", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
$this->vatNumber="FR$cle$siren";
$this->vatDefined=false;
return true;
}
}
} else {
$this->errnum=999;
$this->errmsg="Pas d'accès à la base TVA";
$this->vatNumber="FR$cle$siren";
$this->vatDefined=false;
return true;
}
Metier_Util_Log::write('W', "Erreur impossible (car l'algo ne devrait pas passer par ici) sur le Siren $siren, numéro de TVA = FR $cle $siren. Durée = $duree s. Cas impossible !", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
return true;//array('error'=>array('errnum'=>800, 'errmsg'=>'Erreur SGBDR'), 'result'=>$tabRet);
}
/**
* Active la récupération des données distantes
*/
public function setRemote()
{
$this->remote = true;
}
/**
* Génère la clé du numéro de TVA pour le siren fournit
* (la validité du numéro de siren et son existance n'est pas effectué par cette méthode)
*
* @return number
* La clé du numéro de TVA
*/
private function genereCleFr()
{
// Position du chiffre SIREN (1 à 9)
$tabFirst = array(
array( 0, 0, 0, 0, 0, 0, 0, 0, 0),
array(62,47,94,89,40,06,22,43,16),
array(14,81,78,68,67,96,31,73,19),
array(63,18,62,47,94,89,40,06,22),
array(15,52,46,26,24,82,49,36,25),
array(64,86,30,05,51,75,58,66,28),
array(16,23,14,81,78,68,67,96,31),
array(65,57,95,60,08,61,76,29,34),
array(17,91,79,39,35,54,85,59,37),
array(66,28,63,18,62,47,94,89,40),
);
// Chiffre 0 à 9
$tabPoids = array(1,34,-16,-21,27,-7,9,30,3);
$cle = $first = 0;
for ($pos=0; $pos<9; $pos++) {
$chiffre = $this->siren[$pos];
if ($first == 0) {
$first = $cle = $tabFirst[$chiffre][$pos];
} else {
$cle += $tabPoids[$pos] * $chiffre;
}
}
while (true) {
if ($cle > 96) {
$cle = $cle - 97;
} elseif ($cle < 0) {
$cle = $cle + 97;
} else {
break;
}
}
if ($cle == 0) {
return 96;
}
return ($cle-1);
}
/**
* Test de la validité du siren demandé
*
* @param int SIREN à tester
* @param int NIC (facultatif)
* @param mixed Message textuel d'erreur à afficher en cas d'erreur ou false
* @return mixed true, false ou Message d'erreur passé en paramètre
*/
private function valideSiren($siren, $nic='', $erreur=false)
{
$siren = str_pad($siren, 9, '0', STR_PAD_LEFT);
if (!empty($nic)) {
$nic = str_pad($nic, 5, '0', STR_PAD_LEFT);
}
//Siren non précisé ou incorrect.
if (!Metier_Util_String::valideData($siren, 9, 9, 'N')) {
return $erreur;
}
// Siren vide
elseif (intval($siren) == 0) {
return $erreur;
} else {
if (!isset($nic) || trim($nic)=='') {
$somme = 0;
// Traitement IMPAIR
for ($i=0; $i<=8; $i+=2) {
$somme+= (integer) substr($siren, $i, 1);
}
// Traitement PAIR
for ($i=1; $i<=7; $i+=2) {
$var_tmp = (string) (2*((integer)substr($siren, $i, 1)));
$som_tmp = 0;
for ($j=0; $j<strlen($var_tmp);$j++) {
$som_tmp+= (integer)substr($var_tmp, $j, 1);
}
$somme+= $som_tmp;
}
// Le Siren est faux
if ((integer) ($somme/10) != ($somme/10)) {
// Les siren débutant par 200 sont toujours valides (sirens provisoires de la BDF?!)
if (substr($siren, 0, 3) != '200') {
return $erreur;
}
}
} else {
// Nic de format incorrect.
if (!Metier_Util_String::valideData($nic, 1, 5, 'N')) {
return $erreur;
}
$SIRET = $siren.$nic;
if ($siren == '356000000') {
// Cas particulier du siren de LA POSTE : 356 000 000 00000
$somme = 14;
for ($i=9; $i<=13; $i++) {
$somme+= (integer)substr($SIRET, $i, 1);
}
// Le NIC de l'établissement de LA POSTE est faux !
if ($somme%5 != 0) {
return $erreur;
}
} else {
$somme=0;
// Traitement PAIR
for ($i=0; $i<=12; $i+=2) {
$var_tmp = (string) (2*((integer)substr($SIRET, $i, 1)));
$som_tmp = 0;
for ($j=0; $j<strlen($var_tmp); $j++) {
$som_tmp+= (integer) substr($var_tmp, $j, 1);
}
$somme+= $som_tmp;
}
// Traitement IMPAIR
for ($i=1; $i<=13; $i+=2) {
$somme+= (integer) substr($SIRET, $i, 1);
}
// Le Siret est faux
if ((integer) ($somme/10) != ($somme/10)) {
return $erreur;
}
}
}
}
return true;
}
}

View File

@ -49,8 +49,7 @@ class Metier_Rnvp_Adresse
{
if ($conn === null) {
$this->conn = Zend_Registry::get('doctrine');
}
else {
} else {
$this->conn = $conn;
}
}
@ -61,8 +60,8 @@ class Metier_Rnvp_Adresse
*/
public function setCompanyId($companyId)
{
$this->source = substr($companyId,0,3);
$this->sourceId = substr($companyId,3,20);
$this->source = substr($companyId, 0, 3);
$this->sourceId = substr($companyId, 3, 20);
}
/**
@ -77,13 +76,12 @@ class Metier_Rnvp_Adresse
$sql = "SELECT LPAD(source,3,0) AS source AND LPAD(source_id,20,0) AS source_id
FROM jo.etablissements WHERE siren=:siren AND nic=:nic";
$stmt = $this->conn->prepare($sql);
$stmt->bindValue('siren', substr($companyId,0,9));
$stmt->bindValue('nic', substr($companyId,9,5));
$stmt->bindValue('siren', substr($companyId, 0, 9));
$stmt->bindValue('nic', substr($companyId, 9, 5));
$stmt->execute();
if ($stmt->rowCount() == 0) {
return null;
}
else {
} else {
$etabResult = $stmt->fetch(\PDO::FETCH_OBJ);
$this->source = $etabResult->source;
$this->sourceId = $etabResult->source_id;
@ -155,11 +153,10 @@ class Metier_Rnvp_Adresse
$rnvp->CedexaCdxL6 = $rnvpResult->Cdx_V6Cdx;
$rnvp->DateInsert = $rnvpResult->dateInsert;
$rnvp->DateUpdate = $rnvpResult->dateUpdate;
}
catch (\Doctrine\DBAL\DBALException $e) {
} catch (\Doctrine\DBAL\DBALException $e) {
throw new Exception($e->getMessage(), 'ERR');
}
return $rnvp;
}
}
}

View File

@ -1,7 +1,9 @@
<?php
class Metier_Rnvp_Process
{
public function __construct() {}
public function __construct()
{
}
/**
* Libelle de traitement
@ -11,7 +13,7 @@ class Metier_Rnvp_Process
public function getLabel($code, $correction)
{
$label = '';
switch($code) {
switch ($code) {
case 'ND':
$label = "ND";
break;
@ -31,4 +33,4 @@ class Metier_Rnvp_Process
return $label;
}
}
}

View File

@ -25,7 +25,9 @@ class Metier_Rnvp_Quality
'90' => "Etranger détecté",
);
public function __construct(){}
public function __construct()
{
}
/**
* Label qualité en fonction du code
@ -40,4 +42,4 @@ class Metier_Rnvp_Quality
return $label;
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,118 +1,117 @@
<?php
class Metier_Scores_Projection
{
/**
* Tableau des années de millesime de bilans
*/
public $tabRegX;
/**
* Tableau des années de millesime de bilans
*/
public $tabRegX;
/**
* Tableau des années en paramètres
*/
protected $Y;
/**
* Tableau des années en paramètres
*/
protected $Y;
/**
* + $nbAnnees Projetées
*/
protected $Yaff;
/**
* + $nbAnnees Projetées
*/
protected $Yaff;
/**
* Taux de projection de n à n+$nbAnnees
*/
protected $PROJECTAUX;
/**
* Taux de projection de n à n+$nbAnnees
*/
protected $PROJECTAUX;
/**
* Coef de corélation linéaire
*/
protected $PROJECCOEF;
/**
* Coef de corélation linéaire
*/
protected $PROJECCOEF;
public function getY()
{
return $this->Y;
}
public function getY()
{
return $this->Y;
}
public function getYaff()
{
return $this->Yaff;
}
public function getYaff()
{
return $this->Yaff;
}
public function getProjecTaux()
{
return $this->PROJECTAUX;
}
public function getProjecTaux()
{
return $this->PROJECTAUX;
}
public function getProjecCoeff()
{
return $this->PROJECCOEF;
}
public function getProjecCoeff()
{
return $this->PROJECCOEF;
}
/**
* Remplace la function PROJECCOEF
* @param array $tabRegY
* @param array $nbAnnees
* @return boolean|number
*/
public function calcCOEF($tabRegY, $nbAnnees)
{
if ( count($this->tabRegX) == 0 || count($tabRegY) == 0 ) {
return false;
}
/**
* Remplace la function PROJECCOEF
* @param array $tabRegY
* @param array $nbAnnees
* @return boolean|number
*/
public function calcCOEF($tabRegY, $nbAnnees)
{
if (count($this->tabRegX) == 0 || count($tabRegY) == 0) {
return false;
}
$oReg = new Metier_Scores_Regression($tabRegY, $this->tabRegX);
return $oReg->vCoefCorLin;
}
$oReg = new Metier_Scores_Regression($tabRegY, $this->tabRegX);
return $oReg->vCoefCorLin;
}
/**
* Remplace la function PROJEC
* @param array $tabRegY
* @param array $nbAnnees
* @return boolean|mixed
*/
public function calc($tabRegY, $nbAnnees)
{
if ( count($this->tabRegX) == 0 || count($tabRegY) == 0 ) {
return false;
}
/**
* Remplace la function PROJEC
* @param array $tabRegY
* @param array $nbAnnees
* @return boolean|mixed
*/
public function calc($tabRegY, $nbAnnees)
{
if (count($this->tabRegX) == 0 || count($tabRegY) == 0) {
return false;
}
$oReg = new Metier_Scores_Regression($tabRegY, $this->tabRegX);
$tab = $oReg->GetProjectionDebut($nbAnnees);
$oReg = new Metier_Scores_Regression($tabRegY, $this->tabRegX);
$tab = $oReg->GetProjectionDebut($nbAnnees);
$this->Y = $this->Yaff = array();
$nbRegX = count($this->tabRegX);
// Début des clés pour le tableau Y des critères
$j = 0 - $nbRegX;
foreach($tab as $i=>$valeur) {
$j++;
if ( isset($this->tabRegX[$i]) ) {
$this->Yaff[''.$this->tabRegX[$i].' '] = $this->Y[$j] = $tab[$i];
$lastX = $this->tabRegX[$i];
} else {
$lastX++;
$this->Yaff[''.$lastX.' '] = $this->Y[$j] = $tab[$i];
}
}
$this->Y = $this->Yaff = array();
$nbRegX = count($this->tabRegX);
// Début des clés pour le tableau Y des critères
$j = 0 - $nbRegX;
foreach ($tab as $i=>$valeur) {
$j++;
if (isset($this->tabRegX[$i])) {
$this->Yaff[''.$this->tabRegX[$i].' '] = $this->Y[$j] = $tab[$i];
$lastX = $this->tabRegX[$i];
} else {
$lastX++;
$this->Yaff[''.$lastX.' '] = $this->Y[$j] = $tab[$i];
}
}
$this->PROJECTAUX = $oReg->TauxProgression($nbAnnees);
$this->PROJECCOEF = $oReg->vCoefCorLin*100;
$this->PROJECTAUX = $oReg->TauxProgression($nbAnnees);
$this->PROJECCOEF = $oReg->vCoefCorLin*100;
return end($tab);
}
return end($tab);
}
/**
* Remplace la function PROJECTAUX
* @param array $tabRegY
* @param array $nbAnnees
* @return boolean|number
*/
public function calcTAUX($tabRegY, $nbAnnees)
{
if ( count($this->tabRegX) == 0 || count($tabRegY) == 0 ) {
return false;
}
/**
* Remplace la function PROJECTAUX
* @param array $tabRegY
* @param array $nbAnnees
* @return boolean|number
*/
public function calcTAUX($tabRegY, $nbAnnees)
{
if (count($this->tabRegX) == 0 || count($tabRegY) == 0) {
return false;
}
$oReg = new Metier_Scores_Regression($tabRegY, $this->tabRegX);
return $oReg->TauxProgression($nbAnnees);
}
}
$oReg = new Metier_Scores_Regression($tabRegY, $this->tabRegX);
return $oReg->TauxProgression($nbAnnees);
}
}

View File

@ -1,219 +1,224 @@
<?php
class Metier_Scores_Regression
{
/*
But: Fournir un objet assez complet permettant d'opérer facilement une régression
linéaire, plus connu sur le nom de courbe de tendance sous Excel.
Usage: 0- Dans votre fichier PHP insérer include ("CrbTendance.php");
1- Déclarer l'objet RegLin
ex: $oReg= new RegLin($tDonnees) ou $oReg= new RegLin($tY, $tX)
Les deux syntaxe sont disponible, si une seul tableau est fourni
alors le second est initialisé du même nombre d'occurence commençant à 0
avec un pas de 1
2- Lancer le calcul, avec méthodes fournie de 0 à 4, par défaut 0 sera pris. Pour
tout élément supérieur à 4, la cinquième sera prise.
Cette méthode retourne un tableau à Trois positions,
-avec dans la case "A" le coef directeur de la droite,
-dans la case "B" le positionnement vertical
-dans la case "Cor" le coef de corrélation
-et dans la case "Meth" le numéro de la méthode utlisée
Ex: print_r($oReg0->OptMV(0));
==>Array ( [A] => -649.029426204
[B] => 3037796.68186
[Cor] => -0.143065138366
[Meth] => 0 )
3- De manière optionnel vous pouvez lancer la méthode GetOpt();,
qui vous fournira le point de votre droite en fonction de votre
tableau d'abscisses, si ce dernier n'est pas fourni
vous aurez un tableau de 0 à nb-1 d'occurence du premier tableau
Ex: print_r($oReg1->GetOpt());
==>Array ( [1] => 3037147.65243
[7] => 3033253.47587
[20] => 3024816.09333
[21] => 3024167.06391
[22] => 3023518.03448)
*/
//champ de l'objet
private $tDonnees;
private $tAbscisse;
private $vNbElt; //Nombre déléments des tableaux
private $vMoyX; //Moyenne des X
private $vMoyY; //Moyenne des Y
private $vSumXY;
private $vSumX;
private $vSumY;
private $vSumX2;
private $tPtG; //Le point moyen G est un tableau tPtG(X,Y)=(vMoyX,vMoyY)
//La variance, c'est la moyenne des carrés soustrait du carré de la moyenne
private $vVarianceX;
private $vVarianceY;
//L'écart Type, c'est la racine carrée de la variance
private $vEcartTX;
private $vEcartTY;
//La covariance, la moyenne des produits moins le produit des moyennes
private $vCovariance;
private $vA; //Coef directeur de la droite liée à la régression
private $vB; //Coef B de la droite liée à la régression
public $vCoefCorLin;//Coef de corrélation linéaire
public $tTest;
public function __construct($tDataY,$tDataX=NULL)
{
$this->tDonnees = $tDataY;
$this->tAbscisse = $tDataX;
$this->vNbElt = $n=count($this->tDonnees); // Nombres d'éléments
//Mise en place des abscisses
if (isset($tDataX))
for($i=0;$i<$this->vNbElt;$i++)
$this->tAbscisse[$i]=$i;
//parcours des donnees pour récupération formule nécessaire au calcul des éléments
$sumX=0; //somme des X
$sumY=0; //somme des Y
$sumX2=0; //somme des X²
$sumY2=0; //somme des y²
$sumXY=0; //somme des x*y
for ($i=0;$i<$n;$i++) {
$xVal=$this->tAbscisse[$i];
$yVal=$this->tDonnees[$i];
$sumX+=$xVal;
$sumY+=$yVal;
$sumX2+=$xVal*$xVal;
$sumY2+=$yVal*$yVal;
$sumXY+=$xVal*$yVal;
}
$this->vMoyX=$sumX/$n; //moyenne X
$this->vMoyY=$sumY/$n; //moyenne Y
$this->vSumXY=$sumXY;
$this->vSumX=$sumX;
$this->vSumY=$sumY;
$this->vSumX2=$sumX2;
$this->tPtG=array('X'=>$this->vMoyX,'Y'=>$this->vMoyY); //point moyen G
//La variance, c'est la moyenne des carrés soustrait du carré de la moyenne: Rappel
$this->vVarianceX=($sumX2/$n)-($this->vMoyX*$this->vMoyX);
$this->vVarianceY=($sumY2/$n)-($this->vMoyY*$this->vMoyY);
//L'écart Type, c'est la racine carrée de la variance: Rappel
$this->vEcartTX=sqrt(abs($this->vVarianceX));
$this->vEcartTY=sqrt(abs($this->vVarianceY));
//La covariance, la moyenne des produits moins le produit des moyennes
$this->vCovariance=($sumXY/$n)-($this->vMoyX*$this->vMoyY);
// coef de coorélation linéaire: Covariance que divise l'écart Type X multiplié par l'écart Type de Y
$this->vCoefCorLin=$this->vCovariance/($this->vEcartTX*$this->vEcartTY);
// Calcul de la droite
$this->CoefsDroite(0);
$this->tTest=array(
'vMoyX'=>$this->vMoyX,
'vMoyY'=>$this->vMoyY,
'vA'=>$this->vA, // Coef directeur de la droite liée à la régression
'vB'=>$this->vB, // Coef B de la droite liée à la régression
'tPtG'=>$this->tPtG,
'vVarianceX'=>$this->vVarianceX,
'vVarianceY'=>$this->vVarianceY,
'vEcartTX'=>$this->vEcartTX,
'vEcartTY'=>$this->vEcartTY,
'vCovariance'=>$this->vCovariance,
'vCoefCorLin'=>$this->vCoefCorLin,
);
}
/**
* Calcul de la droite
* (calcul de coef directeur de la régression par théorie de la régression linéaire
* le coef a est obtenu des manières suivantes avec 5 variantes disponibles)
*/
private function CoefsDroite($met=0)
{
switch ($met) {
case 0:
$this->vA=$this->vCovariance/$this->vVarianceX;
break;
case 1:
$this->vA=$this->vVarianceY/$this->vCovariance;
break;
case 2:
$this->vA=($this->vCovariance*$this->vEcartTY)/(abs($this->vCovariance)*$this->vEcartTX);
break;
/*
case 4:
$this->vA=($this->vSumXY-(($this->vSumX*$this->vSumY)/$this->vNbElt)/($this->vSumX2-(pow(2,$this->vSumX)/$this->vNbElt)));
break; */
case 3:
$this->vA=($this->vVarianceY-$this->vVarianceX+sqrt(pow($this->vVarianceY-$this->vVarianceX,2)+pow(2*$this->vCovariance,2)))/(2*$this->vCovariance);
break;
case 4:
$this->vA=($this->vSumXY-($this->vSumX*$this->vSumY/$this->vNbElt))/($this->vSumX2-(pow($this->vSumX,2)/$this->vNbElt));
break;
}
$this->vB=$this->vMoyY-($this->vA*$this->vMoyX);
}
/**
* Calcul la régression Linéaire
*/
public function OptMV($meth=0)
{
$this->CoefsDroite($meth);
$this->CoefCorLin();
return array("A"=>$this->vA,"B"=>$this->vB,"Cor"=>$this->vCoefCorLin,"Meth"=>$meth,"TauxProg"=>(1-$this->vA)*100);
}
/**
* Renvoi le tableau des points optimisés
*/
public function GetOpt()
{
$tOpt=array();
foreach($this->tAbscisse as $i)
$tOpt[$i]=$this->vA*$i+$this->vB;
return $tOpt;
}
public function GetProjection($nbPeriodes)
{
$iMax=end($this->tAbscisse)+$nbPeriodes+1;
$tOpt=array();
for ($i=end($this->tAbscisse); $i<$iMax; $i++)
$tOpt[$i]=$this->vA*$i+$this->vB;
return $tOpt;
}
public function GetProjectionDebut($nbPeriodes)
{
$iMax=end($this->tAbscisse)+$nbPeriodes+1;
$tOpt=array();
reset($this->tAbscisse);
for ($i=current($this->tAbscisse); $i<$iMax; $i++)
$tOpt[$i]=$this->vA*$i+$this->vB;
return $tOpt;
}
public function TauxProgression($nbPeriodes)
{
$tOpt=$this->GetProjection($nbPeriodes);
reset($tOpt);
//print_r($tOpt);
$deb=abs(current($tOpt));
$fin=abs(end($tOpt));
return (($fin-$deb)*100)/$deb;
}
}
<?php
class Metier_Scores_Regression
{
/*
But: Fournir un objet assez complet permettant d'opérer facilement une régression
linéaire, plus connu sur le nom de courbe de tendance sous Excel.
Usage: 0- Dans votre fichier PHP insérer include ("CrbTendance.php");
1- Déclarer l'objet RegLin
ex: $oReg= new RegLin($tDonnees) ou $oReg= new RegLin($tY, $tX)
Les deux syntaxe sont disponible, si une seul tableau est fourni
alors le second est initialisé du même nombre d'occurence commençant à 0
avec un pas de 1
2- Lancer le calcul, avec méthodes fournie de 0 à 4, par défaut 0 sera pris. Pour
tout élément supérieur à 4, la cinquième sera prise.
Cette méthode retourne un tableau à Trois positions,
-avec dans la case "A" le coef directeur de la droite,
-dans la case "B" le positionnement vertical
-dans la case "Cor" le coef de corrélation
-et dans la case "Meth" le numéro de la méthode utlisée
Ex: print_r($oReg0->OptMV(0));
==>Array ( [A] => -649.029426204
[B] => 3037796.68186
[Cor] => -0.143065138366
[Meth] => 0 )
3- De manière optionnel vous pouvez lancer la méthode GetOpt();,
qui vous fournira le point de votre droite en fonction de votre
tableau d'abscisses, si ce dernier n'est pas fourni
vous aurez un tableau de 0 à nb-1 d'occurence du premier tableau
Ex: print_r($oReg1->GetOpt());
==>Array ( [1] => 3037147.65243
[7] => 3033253.47587
[20] => 3024816.09333
[21] => 3024167.06391
[22] => 3023518.03448)
*/
//champ de l'objet
private $tDonnees;
private $tAbscisse;
private $vNbElt; //Nombre déléments des tableaux
private $vMoyX; //Moyenne des X
private $vMoyY; //Moyenne des Y
private $vSumXY;
private $vSumX;
private $vSumY;
private $vSumX2;
private $tPtG; //Le point moyen G est un tableau tPtG(X,Y)=(vMoyX,vMoyY)
//La variance, c'est la moyenne des carrés soustrait du carré de la moyenne
private $vVarianceX;
private $vVarianceY;
//L'écart Type, c'est la racine carrée de la variance
private $vEcartTX;
private $vEcartTY;
//La covariance, la moyenne des produits moins le produit des moyennes
private $vCovariance;
private $vA; //Coef directeur de la droite liée à la régression
private $vB; //Coef B de la droite liée à la régression
public $vCoefCorLin;//Coef de corrélation linéaire
public $tTest;
public function __construct($tDataY, $tDataX=null)
{
$this->tDonnees = $tDataY;
$this->tAbscisse = $tDataX;
$this->vNbElt = $n=count($this->tDonnees); // Nombres d'éléments
//Mise en place des abscisses
if (isset($tDataX)) {
for ($i=0;$i<$this->vNbElt;$i++) {
$this->tAbscisse[$i]=$i;
}
}
//parcours des donnees pour récupération formule nécessaire au calcul des éléments
$sumX=0; //somme des X
$sumY=0; //somme des Y
$sumX2=0; //somme des X²
$sumY2=0; //somme des y²
$sumXY=0; //somme des x*y
for ($i=0;$i<$n;$i++) {
$xVal=$this->tAbscisse[$i];
$yVal=$this->tDonnees[$i];
$sumX+=$xVal;
$sumY+=$yVal;
$sumX2+=$xVal*$xVal;
$sumY2+=$yVal*$yVal;
$sumXY+=$xVal*$yVal;
}
$this->vMoyX=$sumX/$n; //moyenne X
$this->vMoyY=$sumY/$n; //moyenne Y
$this->vSumXY=$sumXY;
$this->vSumX=$sumX;
$this->vSumY=$sumY;
$this->vSumX2=$sumX2;
$this->tPtG=array('X'=>$this->vMoyX,'Y'=>$this->vMoyY); //point moyen G
//La variance, c'est la moyenne des carrés soustrait du carré de la moyenne: Rappel
$this->vVarianceX=($sumX2/$n)-($this->vMoyX*$this->vMoyX);
$this->vVarianceY=($sumY2/$n)-($this->vMoyY*$this->vMoyY);
//L'écart Type, c'est la racine carrée de la variance: Rappel
$this->vEcartTX=sqrt(abs($this->vVarianceX));
$this->vEcartTY=sqrt(abs($this->vVarianceY));
//La covariance, la moyenne des produits moins le produit des moyennes
$this->vCovariance=($sumXY/$n)-($this->vMoyX*$this->vMoyY);
// coef de coorélation linéaire: Covariance que divise l'écart Type X multiplié par l'écart Type de Y
$this->vCoefCorLin=$this->vCovariance/($this->vEcartTX*$this->vEcartTY);
// Calcul de la droite
$this->CoefsDroite(0);
$this->tTest=array(
'vMoyX'=>$this->vMoyX,
'vMoyY'=>$this->vMoyY,
'vA'=>$this->vA, // Coef directeur de la droite liée à la régression
'vB'=>$this->vB, // Coef B de la droite liée à la régression
'tPtG'=>$this->tPtG,
'vVarianceX'=>$this->vVarianceX,
'vVarianceY'=>$this->vVarianceY,
'vEcartTX'=>$this->vEcartTX,
'vEcartTY'=>$this->vEcartTY,
'vCovariance'=>$this->vCovariance,
'vCoefCorLin'=>$this->vCoefCorLin,
);
}
/**
* Calcul de la droite
* (calcul de coef directeur de la régression par théorie de la régression linéaire
* le coef a est obtenu des manières suivantes avec 5 variantes disponibles)
*/
private function CoefsDroite($met=0)
{
switch ($met) {
case 0:
$this->vA=$this->vCovariance/$this->vVarianceX;
break;
case 1:
$this->vA=$this->vVarianceY/$this->vCovariance;
break;
case 2:
$this->vA=($this->vCovariance*$this->vEcartTY)/(abs($this->vCovariance)*$this->vEcartTX);
break;
/*
case 4:
$this->vA=($this->vSumXY-(($this->vSumX*$this->vSumY)/$this->vNbElt)/($this->vSumX2-(pow(2,$this->vSumX)/$this->vNbElt)));
break; */
case 3:
$this->vA=($this->vVarianceY-$this->vVarianceX+sqrt(pow($this->vVarianceY-$this->vVarianceX, 2)+pow(2*$this->vCovariance, 2)))/(2*$this->vCovariance);
break;
case 4:
$this->vA=($this->vSumXY-($this->vSumX*$this->vSumY/$this->vNbElt))/($this->vSumX2-(pow($this->vSumX, 2)/$this->vNbElt));
break;
}
$this->vB=$this->vMoyY-($this->vA*$this->vMoyX);
}
/**
* Calcul la régression Linéaire
*/
public function OptMV($meth=0)
{
$this->CoefsDroite($meth);
$this->CoefCorLin();
return array("A"=>$this->vA,"B"=>$this->vB,"Cor"=>$this->vCoefCorLin,"Meth"=>$meth,"TauxProg"=>(1-$this->vA)*100);
}
/**
* Renvoi le tableau des points optimisés
*/
public function GetOpt()
{
$tOpt=array();
foreach ($this->tAbscisse as $i) {
$tOpt[$i]=$this->vA*$i+$this->vB;
}
return $tOpt;
}
public function GetProjection($nbPeriodes)
{
$iMax=end($this->tAbscisse)+$nbPeriodes+1;
$tOpt=array();
for ($i=end($this->tAbscisse); $i<$iMax; $i++) {
$tOpt[$i]=$this->vA*$i+$this->vB;
}
return $tOpt;
}
public function GetProjectionDebut($nbPeriodes)
{
$iMax=end($this->tAbscisse)+$nbPeriodes+1;
$tOpt=array();
reset($this->tAbscisse);
for ($i=current($this->tAbscisse); $i<$iMax; $i++) {
$tOpt[$i]=$this->vA*$i+$this->vB;
}
return $tOpt;
}
public function TauxProgression($nbPeriodes)
{
$tOpt=$this->GetProjection($nbPeriodes);
reset($tOpt);
//print_r($tOpt);
$deb=abs(current($tOpt));
$fin=abs(end($tOpt));
return (($fin-$deb)*100)/$deb;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -9,8 +9,8 @@ class Metier_Scoring_Vars
protected $ADRDOM;
protected $AGE;
protected $ANNEEp;
protected $ANNEEp2;
protected $ANNEEp3;
protected $ANNEEp2;
protected $ANNEEp3;
protected $ANNEE;
protected $ANNEE1;
protected $ANNEE2;
@ -207,8 +207,8 @@ class Metier_Scoring_Vars
protected $EFFECTIF_POPU;
protected $ELIMINE;
protected $ENCOURSDEM;
protected $ENCOURS; // Encours final attribué
protected $ENCOURSCALC; // Encours calculé sans cut-off
protected $ENCOURS; // Encours final attribué
protected $ENCOURSCALC; // Encours calculé sans cut-off
protected $ENQUETE;
protected $ENQUETELIM;
protected $ENQUETEMAXI;
@ -269,17 +269,17 @@ class Metier_Scoring_Vars
protected $MARCHEPUBLIC3_NB;
protected $MARCHEPUBLIC3_MT;
protected $MARCHEPUBLIC3_POURC;
protected $MARCHEPUBLICAPP3_NB; // Nombre d'avis de marchés attribués par une administration sur les 3 dernières années
protected $MARCHEPUBLIC3APP_MT; // Montant des avis de marchés attribués par une administration sur les 3 dernières années
protected $MARCHEPUBLIC3APP_POURC; // % Par rapport au total des produits de fonctionnement
protected $MARCHEPUBLICAPP3_NB; // Nombre d'avis de marchés attribués par une administration sur les 3 dernières années
protected $MARCHEPUBLIC3APP_MT; // Montant des avis de marchés attribués par une administration sur les 3 dernières années
protected $MARCHEPUBLIC3APP_POURC; // % Par rapport au total des produits de fonctionnement
protected $MARCHEPUBLICDER_OBJ;
protected $MARCHEPUBLICDER_CLI;
protected $MARCHEPUBLICDER_MT;
protected $MARCHEPUBLICDER_DATE;
protected $MARCHEPUBLICDERAPP_OBJ; // @todo
protected $MARCHEPUBLICDERAPP_BEN; // Bénéficiaire
protected $MARCHEPUBLICDERAPP_MT; // ..
protected $MARCHEPUBLICDERAPP_DATE; // ..
protected $MARCHEPUBLICDERAPP_OBJ; // @todo
protected $MARCHEPUBLICDERAPP_BEN; // Bénéficiaire
protected $MARCHEPUBLICDERAPP_MT; // ..
protected $MARCHEPUBLICDERAPP_DATE; // ..
protected $MARQUENB;
protected $MARQUENB_INT;
protected $MARQUENB_EUR;
@ -350,8 +350,8 @@ class Metier_Scoring_Vars
protected $PRIVILEGETRES;
protected $PRIVILEGETRES_MT;
protected $PRODPART;
protected $PROJECCOEF;
protected $PROJECTAUX; // Taux de pojection de n à n+$nbAnnee
protected $PROJECCOEF;
protected $PROJECTAUX; // Taux de pojection de n à n+$nbAnnee
protected $R;
protected $RCAI_COEF;
protected $RCAI_TAUX;
@ -547,7 +547,7 @@ class Metier_Scoring_Vars
protected $TVAINTRAFACULT;
protected $TYPEMERE;
protected $VALCOEFMINCA; //Table baremCA
protected $VALCOEFMAXCA; // Table baremCA
protected $VALCOEFMAXCA; // Table baremCA
protected $VAL319_EU;
protected $VAL320_EU;
protected $VAL322_EU;
@ -602,9 +602,9 @@ class Metier_Scoring_Vars
protected $VENTEMIN_FRA_EU;
protected $VENTEMIN_FRA_MT;
protected $VENTE_FRA_NB;
protected $VENTEMAX_MT; // A supprimer après la 4.02
protected $VENTEMIN_MT; // A supprimer après la 4.02
protected $VENTE_NB; // A supprimer après la 4.02
protected $VENTEMAX_MT; // A supprimer après la 4.02
protected $VENTEMIN_MT; // A supprimer après la 4.02
protected $VENTE_NB; // A supprimer après la 4.02
protected $WALDEC;
protected $Y;
protected $Yaff;
@ -616,4 +616,4 @@ class Metier_Scoring_Vars
protected $ZONEPRIZRR;
protected $ZONEPRIZRU;
protected $ZONEPRIZUS;
}
}

View File

@ -1,98 +1,96 @@
<?php
class Metier_Search_Engine
{
protected $client = null;
protected $host = null;
protected $port = null;
protected $timeout = 1;
protected $offset = 0;
protected $limit = 300;
protected $max_matches = 1000;
protected $query = null;
protected $client = null;
protected $host = null;
protected $port = null;
protected $timeout = 1;
protected $offset = 0;
protected $limit = 300;
protected $max_matches = 1000;
protected $query = null;
public function __construct($version = null)
{
//Load the API following the version
if ($version == 1){
require_once 'SphinxSearch/sphinxapi-0.9.9.php';
} elseif ($version == 2){
require_once 'SphinxSearch/sphinxapi-2.1.5.php';
}
}
public function __construct($version = null)
{
//Load the API following the version
if ($version == 1) {
require_once 'SphinxSearch/sphinxapi-0.9.9.php';
} elseif ($version == 2) {
require_once 'SphinxSearch/sphinxapi-2.1.5.php';
}
}
/**
*
* @return boolean
*/
protected function loadClient()
{
if ( null === $this->host ) {
return false;
}
/**
*
* @return boolean
*/
protected function loadClient()
{
if (null === $this->host) {
return false;
}
if ( null === $this->port ) {
return false;
}
if (null === $this->port) {
return false;
}
$this->client = new SphinxClient();
$this->client->SetServer( $this->host, $this->port );
$this->client->SetConnectTimeout( $timeout );
$this->client = new SphinxClient();
$this->client->SetServer($this->host, $this->port);
$this->client->SetConnectTimeout($timeout);
return true;
}
return true;
}
/**
*
* @param unknown $value
*/
protected function setHost($value)
{
$this->host = $value;
}
/**
*
* @param unknown $value
*/
protected function setHost($value)
{
$this->host = $value;
}
/**
*
* @param unknown $value
*/
protected function setPort($value)
{
$this->port = $value;
}
/**
*
* @param unknown $value
*/
protected function setPort($value)
{
$this->port = $value;
}
/**
*
* @param unknown $value
*/
protected function setOffset($value)
{
$this->offset = $value;
}
/**
*
* @param unknown $value
*/
protected function setOffset($value)
{
$this->offset = $value;
}
/**
*
* @param unknown $value
*/
protected function setLimit($value)
{
$this->limit = $value;
}
/**
*
* @param unknown $value
*/
protected function setMaxMatches($value)
{
$this->max_matches = $value;
}
/**
*
*/
protected function constructQuery($p)
{
$this->query = $p;
}
/**
*
* @param unknown $value
*/
protected function setLimit($value)
{
$this->limit = $value;
}
/**
*
* @param unknown $value
*/
protected function setMaxMatches($value)
{
$this->max_matches = $value;
}
/**
*
*/
protected function constructQuery($p)
{
$this->query = $p;
}
}

View File

@ -17,20 +17,22 @@
class Metier_Search_EngineQL
{
protected $host = null;
protected $port = null;
protected $port = null;
/* OPTION */
/* 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;
/**
* 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 __construct()
{
}
public function SetLimits( $offset, $limit, $max=0, $cutoff=0 ) {}
}
public function SetLimits($offset, $limit, $max=0, $cutoff=0)
{
}
}

View File

@ -2,47 +2,47 @@
/*
function rechercheHisto($formR, $deb, $nbRep, $max)
{
$gDatabaseJO = databaseJO();
$gDatabaseJO = databaseJO();
$sphinx = clientSphinx($formR);
$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']));
$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 );
$sphinx->SetRankingMode ( SPH_RANK_PROXIMITY_BM25 );
$sphinxreturn = $sphinx->Query($formR['recherche'], $index);
$sphinxreturn = $sphinx->Query($formR['recherche'], $index);
$gDatabaseJO->select_db('histobodacc');
$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'],
);
}
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'],
);
return array(
'results' => $tabRet,
'nbRet' => $sphinxreturn['total'],
'nbTot' => $sphinxreturn['total_found'],
'duration' => $sphinxreturn['time'],
'words' => $sphinxreturn['words'],
);
}
@ -107,8 +107,8 @@ class Metier_Search_Histo
$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);
$this->db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
$this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
protected function setQuery()
@ -142,11 +142,7 @@ class Metier_Search_Histo
");
$query->bindValue(':search', $search, PDO::PARAM_STR);
$query->execute();
while($data=$query->fetch(PDO::FETCH_ASSOC)){
while ($data=$query->fetch(PDO::FETCH_ASSOC)) {
}
}
}

View File

@ -1,93 +1,100 @@
<?php
class Metier_Sfr_Compile
{
/**
* Database adaptater
* @var Zend_Db_Adapter_Abstract
*/
protected $db;
/**
* Version
* @var string
*/
protected $version = null;
/**
* TXT to write in file
* @var string
*/
protected $compileTxt = "<?php\n";
/**
*
* @var string
*/
protected $version = null;
/**
* PDO Connection with Doctrine
* @var \Doctrine\DBAL\Connection
*/
protected $conn;
/**
* Bodacc
* @param \Doctrine\DBAL\Connection $conn
*/
public function __construct($conn = null)
{
if ($conn === null) {
$this->conn = Zend_Registry::get('doctrine');
} else {
$this->conn = $conn;
}
}
protected $compileTxt = "<?php\n";
public function setVersion($version)
{
$this->version = $version;
}
public function __construct($db = null)
{
if ( null === $db) {
$this->db = Zend_Db_Table_Abstract::getDefaultAdapter();
} else {
$this->db = $db;
}
}
public function getRulesFromDb($type)
{
$version = str_replace('.', '', $this->version);
$sql = "SELECT * FROM jo.sfr_rules_".$version." AS r WHERE r.type='".$type."' ORDER BY r.ordre";
$stmt = $this->conn->executeQuery($sql);
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
return $result;
}
public function setVersion($version)
{
$this->version = $version;
}
public function getParamsFromDb($type, $codif)
{
$version = str_replace('.', '', $this->version);
$sql = "SELECT * FROM jo.sfr_params_".$version." AS p WHERE p.type='".$type."' AND p.codif='".$codif."' ORDER BY p.ordre";
$stmt = $this->conn->executeQuery($sql);
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
return $result;
}
public function getRulesFromDb($type)
{
$version = str_replace('.','',$this->version);
$sql = "SELECT * FROM jo.sfr_rules_".$version." AS r WHERE r.type='".$type."' ORDER BY r.ordre";
$result = $this->db->fetchAll($sql, array(), Zend_Db::FETCH_OBJ);
return $result;
}
public function construct($type)
{
$rules = $this->getRulesFromDb($type);
if (count($rules) > 0) {
$this->compileTxt.= "return array(\n";
$this->addRules($rules);
$this->compileTxt.= ");\n";
}
public function getParamsFromDb($type, $codif)
{
$version = str_replace('.','',$this->version);
$sql = "SELECT * FROM jo.sfr_params_".$version." AS p WHERE p.type='".$type."' AND p.codif='".$codif."' ORDER BY p.ordre";
$result = $this->db->fetchAll($sql, array(), Zend_Db::FETCH_OBJ);
return $result;
}
$filename = realpath(__DIR__).'/Rules'.ucfirst(strtolower($type)).'-'.$this->version.'.php';
public function construct($type)
{
$rules = $this->getRulesFromDb($type);
if ( count($rules) > 0 ) {
$this->compileTxt.= "return array(\n";
$this->addRules($rules);
$this->compileTxt.= ");\n";
}
file_put_contents($filename, $this->compileTxt);
}
$filename = realpath(__DIR__).'/Rules'.ucfirst(strtolower($type)).'-'.$this->version.'.php';
public function addRules($rules)
{
foreach ($rules as $i => $rule) {
$this->compileTxt.= "\t".$i." => array(\n";
$this->compileTxt.= "\t\t'name' => '".$rule->label."',\n";
$this->compileTxt.= "\t\t'value' => '".$rule->value."',\n";
$this->compileTxt.= "\t\t'comment' => \"".$rule->comment."\",\n";
$this->compileTxt.= "\t\t'po' => ".$rule->po.",\n";
$this->compileTxt.= "\t\t'params' => array(\n";
$this->addParams($rule->type, $rule->codif);
$this->compileTxt.= "\t\t),\n";
$this->compileTxt.= "\t),\n";
}
}
file_put_contents($filename, $this->compileTxt);
}
public function addRules($rules)
{
foreach ( $rules as $i => $rule ) {
$this->compileTxt.= "\t".$i." => array(\n";
$this->compileTxt.= "\t\t'name' => '".$rule->label."',\n";
$this->compileTxt.= "\t\t'value' => '".$rule->value."',\n";
$this->compileTxt.= "\t\t'comment' => \"".$rule->comment."\",\n";
$this->compileTxt.= "\t\t'po' => ".$rule->po.",\n";
$this->compileTxt.= "\t\t'params' => array(\n";
$this->addParams($rule->type, $rule->codif);
$this->compileTxt.= "\t\t),\n";
$this->compileTxt.= "\t),\n";
}
}
public function addParams($type, $codif)
{
$params = $this->getParamsFromDb($type, $codif);
if ( count($params) > 0 ) {
foreach ( $params as $i => $param ) {
if ( $param->define == '') {
$this->compileTxt.= "\t\t\t".$i." => array( 'var' => '".$param->var."', 'type' => '".$param->cond."', 'value' => '".$param->value."'),\n";
} else {
$this->compileTxt.= "\t\t\t".$i." => array( 'var' => '".$param->var."', 'type' => '".$param->cond."', 'value' => '".$param->value."', 'define' => array( 'var' => '".$param->define."', 'value' => '".$param->define_value."')),\n";
}
}
}
}
}
public function addParams($type, $codif)
{
$params = $this->getParamsFromDb($type, $codif);
if (count($params) > 0) {
foreach ($params as $i => $param) {
if ($param->define == '') {
$this->compileTxt.= "\t\t\t".$i." => array( 'var' => '".$param->var."', 'type' => '".$param->cond."', 'value' => '".$param->value."'),\n";
} else {
$this->compileTxt.= "\t\t\t".$i." => array( 'var' => '".$param->var."', 'type' => '".$param->cond."', 'value' => '".$param->value."', 'define' => array( 'var' => '".$param->define."', 'value' => '".$param->define_value."')),\n";
}
}
}
}
}

View File

@ -1,492 +1,492 @@
<?php
return array(
0 => array(
'name' => 'PO-NAF-GE',
'value' => '6000',
'comment' => "",
'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' => "",
'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' => "",
'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' => "",
'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' => "",
'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' => "",
'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' => "",
'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' => "",
'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' => "",
'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' => "",
'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' => "",
'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' => "",
'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' => "",
'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'),
),
),
13 => array(
'name' => 'PO-Date-GE',
'value' => '3000',
'comment' => "",
'params' => array(
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '4'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '7'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
),
),
14 => array(
'name' => 'PO-Date-GE',
'value' => '3000',
'comment' => "",
'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'),
),
),
15 => array(
'name' => 'PO-Date-GE',
'value' => '5000',
'comment' => "",
'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'),
),
),
16 => array(
'name' => 'PO-Date-GE',
'value' => '5000',
'comment' => "",
'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'),
),
),
17 => array(
'name' => 'PO-Date-GE',
'value' => '5000',
'comment' => "",
'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'),
),
),
18 => array(
'name' => 'PO-Date-GE',
'value' => '10000',
'comment' => "",
'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'),
),
),
19 => array(
'name' => 'PO-Date-GE',
'value' => '10000',
'comment' => "",
'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'),
),
),
20 => array(
'name' => 'PO-Date-GE',
'value' => '10000',
'comment' => "",
'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'),
),
),
21 => array(
'name' => 'PO-Date-PME',
'value' => '1500',
'comment' => "",
'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'),
),
),
22 => array(
'name' => 'PO-Date-PME',
'value' => '1500',
'comment' => "",
'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'),
),
),
23 => array(
'name' => 'PO-Date-PME',
'value' => '1500',
'comment' => "",
'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'),
),
),
24 => array(
'name' => 'PO-Date-PME',
'value' => '6000',
'comment' => "",
'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'),
),
),
25 => array(
'name' => 'PO-Date-PME',
'value' => '6000',
'comment' => "",
'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'),
),
),
26 => array(
'name' => 'PO-Date-PME',
'value' => '6000',
'comment' => "",
'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'),
),
),
27 => array(
'name' => 'PO-Date-PME',
'value' => '9000',
'comment' => "",
'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'),
),
),
28 => array(
'name' => 'PO-Date-PME',
'value' => '9000',
'comment' => "",
'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'),
),
),
29 => array(
'name' => 'PO-Date-PME',
'value' => '9000',
'comment' => "",
'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'),
),
),
30 => array(
'name' => 'PO-Date-TPE',
'value' => '500',
'comment' => "",
'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'),
),
),
31 => array(
'name' => 'PO-Date-TPE',
'value' => '500',
'comment' => "",
'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'),
),
),
32 => array(
'name' => 'PO-Date-TPE',
'value' => '500',
'comment' => "",
'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'),
),
),
33 => array(
'name' => 'PO-Date-TPE',
'value' => '1000',
'comment' => "",
'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'),
),
),
34 => array(
'name' => 'PO-Date-TPE',
'value' => '1000',
'comment' => "",
'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'),
),
),
35 => array(
'name' => 'PO-Date-TPE',
'value' => '1000',
'comment' => "",
'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'),
),
),
36 => array(
'name' => 'PO-Date-TPE',
'value' => '1500',
'comment' => "",
'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'),
),
),
37 => array(
'name' => 'PO-Date-TPE',
'value' => '1500',
'comment' => "",
'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'),
),
),
38 => array(
'name' => 'PO-Date-TPE',
'value' => '1500',
'comment' => "",
'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'),
),
),
39 => array(
'name' => 'PO-STD-GE',
'value' => '6000',
'comment' => "",
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '6'),
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
),
),
40 => array(
'name' => 'PO-STD-GE',
'value' => '10000',
'comment' => "",
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '7'),
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
),
),
41 => array(
'name' => 'PO-STD-GE',
'value' => '20000',
'comment' => "",
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '8'),
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
),
),
42 => array(
'name' => 'PO-STD-PME',
'value' => '3000',
'comment' => "",
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '6'),
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
),
),
43 => array(
'name' => 'PO-STD-PME',
'value' => '3700',
'comment' => "",
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '7'),
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
),
),
44 => array(
'name' => 'PO-STD-PME',
'value' => '5000',
'comment' => "",
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '8'),
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
),
),
45 => array(
'name' => 'PO-STD-PME',
'value' => '9000',
'comment' => "",
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '9'),
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
),
),
46 => array(
'name' => 'PO-STD-TPE',
'value' => '500',
'comment' => "",
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '6'),
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
),
),
47 => array(
'name' => 'PO-STD-TPE',
'value' => '600',
'comment' => "",
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '7'),
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
),
),
48 => array(
'name' => 'PO-STD-TPE',
'value' => '1000',
'comment' => "",
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '8'),
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
),
),
49 => array(
'name' => 'PO-STD-TPE',
'value' => '1300',
'comment' => "",
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '9'),
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
),
),
0 => array(
'name' => 'PO-NAF-GE',
'value' => '6000',
'comment' => "",
'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' => "",
'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' => "",
'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' => "",
'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' => "",
'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' => "",
'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' => "",
'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' => "",
'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' => "",
'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' => "",
'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' => "",
'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' => "",
'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' => "",
'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'),
),
),
13 => array(
'name' => 'PO-Date-GE',
'value' => '3000',
'comment' => "",
'params' => array(
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '4'),
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '7'),
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
),
),
14 => array(
'name' => 'PO-Date-GE',
'value' => '3000',
'comment' => "",
'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'),
),
),
15 => array(
'name' => 'PO-Date-GE',
'value' => '5000',
'comment' => "",
'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'),
),
),
16 => array(
'name' => 'PO-Date-GE',
'value' => '5000',
'comment' => "",
'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'),
),
),
17 => array(
'name' => 'PO-Date-GE',
'value' => '5000',
'comment' => "",
'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'),
),
),
18 => array(
'name' => 'PO-Date-GE',
'value' => '10000',
'comment' => "",
'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'),
),
),
19 => array(
'name' => 'PO-Date-GE',
'value' => '10000',
'comment' => "",
'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'),
),
),
20 => array(
'name' => 'PO-Date-GE',
'value' => '10000',
'comment' => "",
'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'),
),
),
21 => array(
'name' => 'PO-Date-PME',
'value' => '1500',
'comment' => "",
'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'),
),
),
22 => array(
'name' => 'PO-Date-PME',
'value' => '1500',
'comment' => "",
'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'),
),
),
23 => array(
'name' => 'PO-Date-PME',
'value' => '1500',
'comment' => "",
'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'),
),
),
24 => array(
'name' => 'PO-Date-PME',
'value' => '6000',
'comment' => "",
'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'),
),
),
25 => array(
'name' => 'PO-Date-PME',
'value' => '6000',
'comment' => "",
'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'),
),
),
26 => array(
'name' => 'PO-Date-PME',
'value' => '6000',
'comment' => "",
'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'),
),
),
27 => array(
'name' => 'PO-Date-PME',
'value' => '9000',
'comment' => "",
'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'),
),
),
28 => array(
'name' => 'PO-Date-PME',
'value' => '9000',
'comment' => "",
'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'),
),
),
29 => array(
'name' => 'PO-Date-PME',
'value' => '9000',
'comment' => "",
'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'),
),
),
30 => array(
'name' => 'PO-Date-TPE',
'value' => '500',
'comment' => "",
'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'),
),
),
31 => array(
'name' => 'PO-Date-TPE',
'value' => '500',
'comment' => "",
'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'),
),
),
32 => array(
'name' => 'PO-Date-TPE',
'value' => '500',
'comment' => "",
'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'),
),
),
33 => array(
'name' => 'PO-Date-TPE',
'value' => '1000',
'comment' => "",
'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'),
),
),
34 => array(
'name' => 'PO-Date-TPE',
'value' => '1000',
'comment' => "",
'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'),
),
),
35 => array(
'name' => 'PO-Date-TPE',
'value' => '1000',
'comment' => "",
'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'),
),
),
36 => array(
'name' => 'PO-Date-TPE',
'value' => '1500',
'comment' => "",
'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'),
),
),
37 => array(
'name' => 'PO-Date-TPE',
'value' => '1500',
'comment' => "",
'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'),
),
),
38 => array(
'name' => 'PO-Date-TPE',
'value' => '1500',
'comment' => "",
'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'),
),
),
39 => array(
'name' => 'PO-STD-GE',
'value' => '6000',
'comment' => "",
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '6'),
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
),
),
40 => array(
'name' => 'PO-STD-GE',
'value' => '10000',
'comment' => "",
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '7'),
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
),
),
41 => array(
'name' => 'PO-STD-GE',
'value' => '20000',
'comment' => "",
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '8'),
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
),
),
42 => array(
'name' => 'PO-STD-PME',
'value' => '3000',
'comment' => "",
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '6'),
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
),
),
43 => array(
'name' => 'PO-STD-PME',
'value' => '3700',
'comment' => "",
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '7'),
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
),
),
44 => array(
'name' => 'PO-STD-PME',
'value' => '5000',
'comment' => "",
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '8'),
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
),
),
45 => array(
'name' => 'PO-STD-PME',
'value' => '9000',
'comment' => "",
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '9'),
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
),
),
46 => array(
'name' => 'PO-STD-TPE',
'value' => '500',
'comment' => "",
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '6'),
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
),
),
47 => array(
'name' => 'PO-STD-TPE',
'value' => '600',
'comment' => "",
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '7'),
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
),
),
48 => array(
'name' => 'PO-STD-TPE',
'value' => '1000',
'comment' => "",
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '8'),
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
),
),
49 => array(
'name' => 'PO-STD-TPE',
'value' => '1300',
'comment' => "",
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '9'),
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
),
),
);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,453 +1,453 @@
<?php
return array(
0 => 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'),
),
),
1 => 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'),
),
),
2 => 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'),
),
),
3 => 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'),
),
),
4 => 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'),
),
),
5 => 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'),
),
),
6 => 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'),
),
),
7 => 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'),
),
),
8 => 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'),
),
),
9 => 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'),
),
),
10 => 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'),
),
),
11 => 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'),
),
),
12 => 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'),
),
),
13 => 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'),
),
),
14 => 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'),
),
),
15 => 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'),
),
),
16 => 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'),
),
),
17 => 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'),
),
),
18 => 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'),
),
),
19 => 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'),
),
),
20 => 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'),
),
),
21 => 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'),
),
),
22 => 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'),
),
),
23 => 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'),
),
),
24 => 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'),
),
),
25 => 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'),
),
),
26 => 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'),
),
),
27 => 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'),
),
),
28 => 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'),
),
),
29 => 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'),
),
),
30 => 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'),
),
),
31 => 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'),
),
),
32 => 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'),
),
),
33 => 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'),
),
),
34 => 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'),
),
),
35 => 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'),
),
),
36 => 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'),
),
),
37 => 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'),
),
),
38 => 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'),
),
),
39 => 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'),
),
),
40 => 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'),
),
),
41 => 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'),
),
),
0 => 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'),
),
),
1 => 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'),
),
),
2 => 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'),
),
),
3 => 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'),
),
),
4 => 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'),
),
),
5 => 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'),
),
),
6 => 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'),
),
),
7 => 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'),
),
),
8 => 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'),
),
),
9 => 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'),
),
),
10 => 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'),
),
),
11 => 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'),
),
),
12 => 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'),
),
),
13 => 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'),
),
),
14 => 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'),
),
),
15 => 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'),
),
),
16 => 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'),
),
),
17 => 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'),
),
),
18 => 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'),
),
),
19 => 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'),
),
),
20 => 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'),
),
),
21 => 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'),
),
),
22 => 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'),
),
),
23 => 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'),
),
),
24 => 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'),
),
),
25 => 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'),
),
),
26 => 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'),
),
),
27 => 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'),
),
),
28 => 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'),
),
),
29 => 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'),
),
),
30 => 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'),
),
),
31 => 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'),
),
),
32 => 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'),
),
),
33 => 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'),
),
),
34 => 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'),
),
),
35 => 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'),
),
),
36 => 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'),
),
),
37 => 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'),
),
),
38 => 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'),
),
),
39 => 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'),
),
),
40 => 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'),
),
),
41 => 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'),
),
),
);

View File

@ -1,168 +1,168 @@
<?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(
0 => array( 'var' => 'ContratAge', 'type' => 'EGAL', 'value' => 'UNDEFINE'),
1 => array( 'var' => 'IR', 'type' => 'MIN', 'value' => '-1', 'define' => array( 'var' => 'ContratAge', 'value' => '24')),
),
),
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' => 'ORANGE',
'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' => 'ORANGE',
'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' => 'FEU', 'type' => 'EGAL', 'value' => 'ORANGE'),
1 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '2.1'),
2 => array( 'var' => 'ContratAge', 'type' => 'MIN', 'value' => '35'),
),
),
7 => array(
'name' => 'VORd-10.5',
'value' => 'VERT',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'FEU', 'type' => 'EGAL', 'value' => 'ORANGE'),
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' => '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' => 'FEU', 'type' => 'EGAL', 'value' => 'ORANGE'),
1 => array( 'var' => 'EntrepRecente', 'type' => 'EGAL', 'value' => '1'),
2 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '2.1'),
3 => 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' => 'FEU', 'type' => 'EGAL', 'value' => 'ORANGE'),
1 => array( 'var' => 'EntrepRecente', 'type' => 'EGAL', 'value' => '1'),
2 => array( 'var' => 'ContratAge', 'type' => 'MAX', 'value' => '25'),
3 => array( 'var' => 'IR', 'type' => 'MIN', 'value' => '4.9'),
4 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '7.1'),
5 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '9'),
6 => array( 'var' => 'Indiscore', 'type' => 'MAX', 'value' => '12'),
),
),
10 => array(
'name' => 'VORd-10.8',
'value' => 'VERT',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'FEU', 'type' => 'EGAL', 'value' => 'ORANGE'),
1 => array( 'var' => 'EntrepRecente', 'type' => 'EGAL', 'value' => '1'),
2 => array( 'var' => 'IR', 'type' => 'MIN', 'value' => '4.9'),
3 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '7.1'),
4 => array( 'var' => 'ContratAge', 'type' => 'MIN', 'value' => '36'),
5 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '11'),
),
),
11 => array(
'name' => 'VORd-10.8-2',
'value' => 'VERT',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'FEU', 'type' => 'EGAL', 'value' => 'ORANGE'),
1 => array( 'var' => 'EntrepRecente', 'type' => 'EGAL', 'value' => '1'),
2 => array( 'var' => 'IR', 'type' => 'MIN', 'value' => '4.9'),
3 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '7.1'),
4 => array( 'var' => 'ContratAge', 'type' => 'MIN', 'value' => '24'),
5 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '13'),
),
),
12 => array(
'name' => 'VORd-10.9',
'value' => 'ORANGE',
'comment' => "Faire une DEC si dépassement de la PO proposée",
'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'),
),
),
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(
0 => array( 'var' => 'ContratAge', 'type' => 'EGAL', 'value' => 'UNDEFINE'),
1 => array( 'var' => 'IR', 'type' => 'MIN', 'value' => '-1', 'define' => array( 'var' => 'ContratAge', 'value' => '24')),
),
),
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' => 'ORANGE',
'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' => 'ORANGE',
'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' => 'FEU', 'type' => 'EGAL', 'value' => 'ORANGE'),
1 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '2.1'),
2 => array( 'var' => 'ContratAge', 'type' => 'MIN', 'value' => '35'),
),
),
7 => array(
'name' => 'VORd-10.5',
'value' => 'VERT',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'FEU', 'type' => 'EGAL', 'value' => 'ORANGE'),
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' => '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' => 'FEU', 'type' => 'EGAL', 'value' => 'ORANGE'),
1 => array( 'var' => 'EntrepRecente', 'type' => 'EGAL', 'value' => '1'),
2 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '2.1'),
3 => 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' => 'FEU', 'type' => 'EGAL', 'value' => 'ORANGE'),
1 => array( 'var' => 'EntrepRecente', 'type' => 'EGAL', 'value' => '1'),
2 => array( 'var' => 'ContratAge', 'type' => 'MAX', 'value' => '25'),
3 => array( 'var' => 'IR', 'type' => 'MIN', 'value' => '4.9'),
4 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '7.1'),
5 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '9'),
6 => array( 'var' => 'Indiscore', 'type' => 'MAX', 'value' => '12'),
),
),
10 => array(
'name' => 'VORd-10.8',
'value' => 'VERT',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'FEU', 'type' => 'EGAL', 'value' => 'ORANGE'),
1 => array( 'var' => 'EntrepRecente', 'type' => 'EGAL', 'value' => '1'),
2 => array( 'var' => 'IR', 'type' => 'MIN', 'value' => '4.9'),
3 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '7.1'),
4 => array( 'var' => 'ContratAge', 'type' => 'MIN', 'value' => '36'),
5 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '11'),
),
),
11 => array(
'name' => 'VORd-10.8-2',
'value' => 'VERT',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'FEU', 'type' => 'EGAL', 'value' => 'ORANGE'),
1 => array( 'var' => 'EntrepRecente', 'type' => 'EGAL', 'value' => '1'),
2 => array( 'var' => 'IR', 'type' => 'MIN', 'value' => '4.9'),
3 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '7.1'),
4 => array( 'var' => 'ContratAge', 'type' => 'MIN', 'value' => '24'),
5 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '13'),
),
),
12 => array(
'name' => 'VORd-10.9',
'value' => 'ORANGE',
'comment' => "Faire une DEC si dépassement de la PO proposée",
'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

@ -1,168 +1,168 @@
<?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(
0 => array( 'var' => 'ContratAge', 'type' => 'EGAL', 'value' => 'UNDEFINE'),
1 => array( 'var' => 'IR', 'type' => 'MIN', 'value' => '-1', 'define' => array( 'var' => 'ContratAge', 'value' => '24')),
),
),
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' => 'ORANGE',
'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' => 'ORANGE',
'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' => 'FEU', 'type' => 'EGAL', 'value' => 'ORANGE'),
1 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '2.1'),
2 => array( 'var' => 'ContratAge', 'type' => 'MIN', 'value' => '35'),
),
),
7 => array(
'name' => 'VORd-10.5',
'value' => 'VERT',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'FEU', 'type' => 'EGAL', 'value' => 'ORANGE'),
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' => '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' => 'FEU', 'type' => 'EGAL', 'value' => 'ORANGE'),
1 => array( 'var' => 'EntrepRecente', 'type' => 'EGAL', 'value' => '1'),
2 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '2.1'),
3 => 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' => 'FEU', 'type' => 'EGAL', 'value' => 'ORANGE'),
1 => array( 'var' => 'EntrepRecente', 'type' => 'EGAL', 'value' => '1'),
2 => array( 'var' => 'ContratAge', 'type' => 'MAX', 'value' => '25'),
3 => array( 'var' => 'IR', 'type' => 'MIN', 'value' => '4.9'),
4 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '7.1'),
5 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '9'),
6 => array( 'var' => 'Indiscore', 'type' => 'MAX', 'value' => '12'),
),
),
10 => array(
'name' => 'VORd-10.8',
'value' => 'VERT',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'FEU', 'type' => 'EGAL', 'value' => 'ORANGE'),
1 => array( 'var' => 'EntrepRecente', 'type' => 'EGAL', 'value' => '1'),
2 => array( 'var' => 'IR', 'type' => 'MIN', 'value' => '4.9'),
3 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '7.1'),
4 => array( 'var' => 'ContratAge', 'type' => 'MIN', 'value' => '36'),
5 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '11'),
),
),
11 => array(
'name' => 'VORd-10.8-2',
'value' => 'VERT',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'FEU', 'type' => 'EGAL', 'value' => 'ORANGE'),
1 => array( 'var' => 'EntrepRecente', 'type' => 'EGAL', 'value' => '1'),
2 => array( 'var' => 'IR', 'type' => 'MIN', 'value' => '4.9'),
3 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '7.1'),
4 => array( 'var' => 'ContratAge', 'type' => 'MIN', 'value' => '24'),
5 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '13'),
),
),
12 => array(
'name' => 'VORd-10.9',
'value' => 'ORANGE',
'comment' => "Faire une DEC si dépassement de la PO proposée",
'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'),
),
),
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(
0 => array( 'var' => 'ContratAge', 'type' => 'EGAL', 'value' => 'UNDEFINE'),
1 => array( 'var' => 'IR', 'type' => 'MIN', 'value' => '-1', 'define' => array( 'var' => 'ContratAge', 'value' => '24')),
),
),
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' => 'ORANGE',
'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' => 'ORANGE',
'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' => 'FEU', 'type' => 'EGAL', 'value' => 'ORANGE'),
1 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '2.1'),
2 => array( 'var' => 'ContratAge', 'type' => 'MIN', 'value' => '35'),
),
),
7 => array(
'name' => 'VORd-10.5',
'value' => 'VERT',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'FEU', 'type' => 'EGAL', 'value' => 'ORANGE'),
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' => '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' => 'FEU', 'type' => 'EGAL', 'value' => 'ORANGE'),
1 => array( 'var' => 'EntrepRecente', 'type' => 'EGAL', 'value' => '1'),
2 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '2.1'),
3 => 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' => 'FEU', 'type' => 'EGAL', 'value' => 'ORANGE'),
1 => array( 'var' => 'EntrepRecente', 'type' => 'EGAL', 'value' => '1'),
2 => array( 'var' => 'ContratAge', 'type' => 'MAX', 'value' => '25'),
3 => array( 'var' => 'IR', 'type' => 'MIN', 'value' => '4.9'),
4 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '7.1'),
5 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '9'),
6 => array( 'var' => 'Indiscore', 'type' => 'MAX', 'value' => '12'),
),
),
10 => array(
'name' => 'VORd-10.8',
'value' => 'VERT',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'FEU', 'type' => 'EGAL', 'value' => 'ORANGE'),
1 => array( 'var' => 'EntrepRecente', 'type' => 'EGAL', 'value' => '1'),
2 => array( 'var' => 'IR', 'type' => 'MIN', 'value' => '4.9'),
3 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '7.1'),
4 => array( 'var' => 'ContratAge', 'type' => 'MIN', 'value' => '36'),
5 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '11'),
),
),
11 => array(
'name' => 'VORd-10.8-2',
'value' => 'VERT',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'FEU', 'type' => 'EGAL', 'value' => 'ORANGE'),
1 => array( 'var' => 'EntrepRecente', 'type' => 'EGAL', 'value' => '1'),
2 => array( 'var' => 'IR', 'type' => 'MIN', 'value' => '4.9'),
3 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '7.1'),
4 => array( 'var' => 'ContratAge', 'type' => 'MIN', 'value' => '24'),
5 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '13'),
),
),
12 => array(
'name' => 'VORd-10.9',
'value' => 'ORANGE',
'comment' => "Faire une DEC si dépassement de la PO proposée",
'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

@ -1,160 +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'),
),
),
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

@ -1,160 +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'),
),
),
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

@ -1,164 +1,164 @@
<?php
return array(
0 => array(
'name' => 'VORp-1.0',
'value' => 'DEFINE',
'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' => "",
'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' => "",
'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' => 'ORANGE',
'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' => 'ORANGE',
'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' => "",
'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' => "",
'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' => 'ORANGE',
'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' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'MAX', 'value' => '21'),
1 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '9'),
),
),
0 => array(
'name' => 'VORp-1.0',
'value' => 'DEFINE',
'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' => "",
'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' => "",
'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' => 'ORANGE',
'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' => 'ORANGE',
'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' => "",
'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' => "",
'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' => 'ORANGE',
'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' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'MAX', 'value' => '21'),
1 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '9'),
),
),
);

View File

@ -1,164 +1,164 @@
<?php
return array(
0 => array(
'name' => 'VORp-1.0',
'value' => 'DEFINE',
'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' => "",
'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' => "",
'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' => 'ORANGE',
'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' => 'ORANGE',
'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' => "",
'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' => "",
'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' => '5'),
),
),
14 => array(
'name' => 'VORp-6.2',
'value' => 'ORANGE',
'comment' => "Faire une DEC si dépassement de la PO proposée",
'po' => 1,
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'MAX', 'value' => '9'),
1 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '4'),
),
),
15 => array(
'name' => 'VORp-6.3',
'value' => 'VERT',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'MAX', 'value' => '21'),
1 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '8'),
),
),
0 => array(
'name' => 'VORp-1.0',
'value' => 'DEFINE',
'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' => "",
'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' => "",
'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' => 'ORANGE',
'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' => 'ORANGE',
'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' => "",
'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' => "",
'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' => '5'),
),
),
14 => array(
'name' => 'VORp-6.2',
'value' => 'ORANGE',
'comment' => "Faire une DEC si dépassement de la PO proposée",
'po' => 1,
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'MAX', 'value' => '9'),
1 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '4'),
),
),
15 => array(
'name' => 'VORp-6.3',
'value' => 'VERT',
'comment' => "",
'po' => 0,
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'MAX', 'value' => '21'),
1 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '8'),
),
),
);

View File

@ -1,164 +1,164 @@
<?php
return array(
0 => array(
'name' => 'VORp-1.0',
'value' => 'DEFINE',
'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'),
),
),
0 => array(
'name' => 'VORp-1.0',
'value' => 'DEFINE',
'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

@ -1,164 +1,164 @@
<?php
return array(
0 => array(
'name' => 'VORp-1.0',
'value' => 'DEFINE',
'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 DEC nécessaire 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 DEC nécessaire 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 DEC nécessaire 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 DEC nécessaire 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' => '9'),
1 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '5'),
),
),
15 => array(
'name' => 'VORp-6.3',
'value' => 'VERT',
'comment' => "Pas de DEC nécessaire sur ce siren",
'po' => 0,
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'MAX', 'value' => '21'),
1 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '8'),
),
),
0 => array(
'name' => 'VORp-1.0',
'value' => 'DEFINE',
'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 DEC nécessaire 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 DEC nécessaire 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 DEC nécessaire 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 DEC nécessaire 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' => '9'),
1 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '5'),
),
),
15 => array(
'name' => 'VORp-6.3',
'value' => 'VERT',
'comment' => "Pas de DEC nécessaire sur ce siren",
'po' => 0,
'params' => array(
0 => array( 'var' => 'Indiscore', 'type' => 'MAX', 'value' => '21'),
1 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '8'),
),
),
);

File diff suppressed because it is too large Load Diff

View File

@ -45,4 +45,4 @@ class Metier_Util_Chiffre
{
return array_search($chiffre, self::$tabChiffresEnLEttres);
}
}
}

View File

@ -12,12 +12,12 @@ class Metier_Util_Csoundex2
* public sString
* main string we work on
*/
var $sString = '';
public $sString = '';
/**
* vowels replacement array
*/
var $aReplaceVoy1 = array (
public $aReplaceVoy1 = array(
'E' => 'A',
'I' => 'A',
'O' => 'A',
@ -27,7 +27,7 @@ class Metier_Util_Csoundex2
/**
* consonnants replacement array
*/
var $aReplaceGrp1 = array (
public $aReplaceGrp1 = array(
'GUI' => 'KI',
'GUE' => 'KE',
'GA' => 'KA',
@ -44,7 +44,7 @@ class Metier_Util_Csoundex2
/**
* other replacement array
*/
var $aReplaceGrp2 = array (
public $aReplaceGrp2 = array(
'ASA' => 'AZA',
'KN' => 'NN',
'PF' => 'FF',
@ -55,7 +55,7 @@ class Metier_Util_Csoundex2
/**
* endings replacement array
*/
var $aEnd = array (
public $aEnd = array(
'A',
'T',
'D',
@ -67,64 +67,65 @@ class Metier_Util_Csoundex2
* core function of the class, go through the whole process
* @Param string sString : the string we want to check
*/
function build ($sString) {
public function build($sString)
{
/**
* let's check it's a real string...
*/
if (is_string ($sString) && !empty ($sString)) {
if (is_string($sString) && !empty($sString)) {
$this -> sString = $sString;
} else {
trigger_error ('Parameter string must not be empty', E_USER_ERROR);
trigger_error('Parameter string must not be empty', E_USER_ERROR);
}
/**
* remove starting and ending spaces
*/
$this -> sString = trim ($this -> sString);
$this -> sString = trim($this -> sString);
/**
* remove special french characters
*/
$this -> trimAccent ();
$this -> trimAccent();
/**
* string to upper case
*/
$this -> sString = strtoupper ($this -> sString );
$this -> sString = strtoupper($this -> sString);
/**
* let's remove every space in the string
*/
$this -> sString = str_replace (' ', '', $this -> sString);
$this -> sString = str_replace(' ', '', $this -> sString);
/**
* let's remove every '-' in the string
*/
$this -> sString = str_replace ('-', '', $this -> sString);
$this -> sString = str_replace('-', '', $this -> sString);
/**
* let's process through the first replacement array
*/
$this -> arrReplace ($this -> aReplaceGrp1);
$this -> arrReplace($this -> aReplaceGrp1);
/**
* let's process through th vowels replacement
*/
$sChar = substr ($this -> sString, 0, 1);
$this -> sString = substr ($this -> sString, 1, strlen ($this -> sString) - 1);
$this -> arrReplace ($this -> aReplaceVoy1);
$sChar = substr($this -> sString, 0, 1);
$this -> sString = substr($this -> sString, 1, strlen($this -> sString) - 1);
$this -> arrReplace($this -> aReplaceVoy1);
$this -> sString = $sChar.$this -> sString;
/**
* let's process through the second replacement array
*/
$this -> arrReplace ($this -> aReplaceGrp2, true);
$this -> arrReplace($this -> aReplaceGrp2, true);
/**
* let's remove every 'H' but those prededed by a 'C' or an 'S'
*/
$this -> sString = preg_replace ('/(?<![CS])H/', '', $this -> sString);
$this -> sString = preg_replace('/(?<![CS])H/', '', $this -> sString);
/**
* let's remove every 'Y' but those preceded by an 'A'
*/
$this -> sString = preg_replace ('/(?<!A)Y/', '', $this -> sString);
$this -> sString = preg_replace('/(?<!A)Y/', '', $this -> sString);
/**
* remove endings in aEnd
*/
$length = strlen ($this -> sString) - 1;
if (in_array ($this -> sString{$length}, $this -> aEnd)) {
$this -> sString = substr ($this -> sString, 0, $length);
$length = strlen($this -> sString) - 1;
if (in_array($this -> sString{$length}, $this -> aEnd)) {
$this -> sString = substr($this -> sString, 0, $length);
}
/**
* let's remove every 'A', but the one at the beginning of the string, if any.
@ -133,27 +134,28 @@ class Metier_Util_Csoundex2
if ($this -> sString{0} === 'A') {
$sChar = 'A';
}
$this -> sString = str_replace ('A', '', $this -> sString);
$this -> sString = str_replace('A', '', $this -> sString);
$this -> sString = $sChar.$this -> sString;
/**
* let's have only 1 occurence of each letter
*/
$this -> sString = preg_replace( '/(.)\1/', '$1', $this -> sString );
$this -> sString = preg_replace('/(.)\1/', '$1', $this -> sString);
/**
* let's have the final code : a 4 letters string
*/
$this -> getFinal ();
$this -> getFinal();
}
/**
* private function getFinal
* gets the first 4 letters, pads the string with white space if the string length < 4
*/
function getFinal () {
if (strlen ($this -> sString) < 4) {
$this -> sString = str_pad ($this -> sString, 4, ' ', STR_PAD_RIGHT);
public function getFinal()
{
if (strlen($this -> sString) < 4) {
$this -> sString = str_pad($this -> sString, 4, ' ', STR_PAD_RIGHT);
} else {
$this -> sString = substr ($this -> sString, 0, 4);
$this -> sString = substr($this -> sString, 0, 4);
}
}
@ -161,11 +163,12 @@ class Metier_Util_Csoundex2
* private function trimAccent
* remove every special French letters
*/
function trimAccent () {
$this -> sString = htmlentities(strtolower($this -> sString ));
$this -> sString = preg_replace("/&(.)(acute|cedil|circ|ring|tilde|uml|grave);/", "$1", $this -> sString );
$this -> sString = preg_replace("/([^a-z0-9]+)/", "-", html_entity_decode($this -> sString ));
$this -> sString = trim($this -> sString , "-");
public function trimAccent()
{
$this -> sString = htmlentities(strtolower($this -> sString));
$this -> sString = preg_replace("/&(.)(acute|cedil|circ|ring|tilde|uml|grave);/", "$1", $this -> sString);
$this -> sString = preg_replace("/([^a-z0-9]+)/", "-", html_entity_decode($this -> sString));
$this -> sString = trim($this -> sString, "-");
}
/**
@ -174,18 +177,19 @@ class Metier_Util_Csoundex2
* @Param array tab : the replacement array to be used
* @Param bool pref : if false, just replace keys by values; if true, do the same but only with prefix
*/
function arrReplace (array $tab, $pref = false) {
$fromRep = array_keys ($tab);
$toRep = array_values ($tab);
public function arrReplace(array $tab, $pref = false)
{
$fromRep = array_keys($tab);
$toRep = array_values($tab);
if (false === $pref) {
$this -> sString = str_replace ($fromRep, $toRep, $this -> sString);
$this -> sString = str_replace($fromRep, $toRep, $this -> sString);
} else {
foreach ($fromRep as $clef => $val) {
$length = strlen ($val);
if (substr ($this -> sString, 0, $length) === $val) {
$this -> sString = substr_replace ($this -> sString, $toRep[$clef], 0, $length);
$length = strlen($val);
if (substr($this -> sString, 0, $length) === $val) {
$this -> sString = substr_replace($this -> sString, $toRep[$clef], 0, $length);
}
}
}
}
}
}

View File

@ -24,10 +24,10 @@ class Metier_Util_Date
public static function getNumMois($moisEnLettres)
{
foreach (self::$tabMoisEnLettres as $num=>$mois) {
$tabMoisSansAccents[$num]=strtr($mois, 'ééûÉÉÛ','eeueeu');
$tabMoisSansAccents[$num]=strtr($mois, 'ééûÉÉÛ', 'eeueeu');
}
return array_search(ucfirst(strtolower(strtr($moisEnLettres, 'ééûÉÉÛ','eeuEEU'))), $tabMoisSansAccents);
return array_search(ucfirst(strtolower(strtr($moisEnLettres, 'ééûÉÉÛ', 'eeuEEU'))), $tabMoisSansAccents);
}
/**
@ -57,8 +57,8 @@ class Metier_Util_Date
if (empty($dateFin)) {
$dateFin = date('Ymd');
}
$dDeb = explode('-', self::dateT('Ymd','Y-m-d', $dateDeb));
$dFin = explode('-', self::dateT('Ymd','Y-m-d', $dateFin));
$dDeb = explode('-', self::dateT('Ymd', 'Y-m-d', $dateDeb));
$dFin = explode('-', self::dateT('Ymd', 'Y-m-d', $dateFin));
return ($dFin[0]*12+$dFin[1])-($dDeb[0]*12+$dDeb[1]);
}
@ -77,8 +77,7 @@ class Metier_Util_Date
public static function dateT($formatIN, $formatOUT, $date)
{
$M = '';
switch ($formatIN)
{
switch ($formatIN) {
case 'd M Y':
$tmp = explode(' ', $date);
$d = str_replace('1er', '1', $tmp[0]);
@ -86,31 +85,29 @@ class Metier_Util_Date
$Y = $tmp[2];
break;
case 'dMY':
$Y = substr($date,-4);
if (substr($date,0,3) == '1er'){
$Y = substr($date, -4);
if (substr($date, 0, 3) == '1er') {
$d = 1;
$posM = 3;
}
elseif (is_numeric(substr($date,1,1))) {
$d = substr($date,0,2);
} elseif (is_numeric(substr($date, 1, 1))) {
$d = substr($date, 0, 2);
$posM = 2;
}
else {
$d = substr($date,0,1);
} else {
$d = substr($date, 0, 1);
$posM = 1;
}
$M = trim(substr($date, $posM, strlen($date)-4-$posM));
$m = self::getNumMois($M);
break;
case 'Ymd':
$d = substr($date,6,2);
$m = substr($date,4,2);
$Y = substr($date,0,4);
$d = substr($date, 6, 2);
$m = substr($date, 4, 2);
$Y = substr($date, 0, 4);
break;
case 'ymd':
$d = substr($date,4,2);
$m = substr($date,2,2);
$Y = substr($date,0,2);
$d = substr($date, 4, 2);
$m = substr($date, 2, 2);
$Y = substr($date, 0, 2);
if ($Y<50) {
$Y = '20'.$Y;
} else {
@ -118,14 +115,14 @@ class Metier_Util_Date
}
break;
case 'Y-m-d':
$d = substr($date,8,2);
$m = substr($date,5,2);
$Y = substr($date,0,4);
$d = substr($date, 8, 2);
$m = substr($date, 5, 2);
$Y = substr($date, 0, 4);
break;
case 'Y-m':
$d = 1;
$m = substr($date,5,2);
$Y = substr($date,0,4);
$m = substr($date, 5, 2);
$Y = substr($date, 0, 4);
break;
case 'd/m/Y':
$tmp = explode('/', $date);
@ -162,14 +159,14 @@ class Metier_Util_Date
$Y = $tmp[2];
break;
case 'dmY':
$d = substr($date,0,2);
$m = substr($date,2,2);
$Y = substr($date,4,4);
$d = substr($date, 0, 2);
$m = substr($date, 2, 2);
$Y = substr($date, 4, 4);
break;
case 'dmy':
$d = substr($date,0,2);
$m = substr($date,2,2);
$Y = substr($date,4,2);
$d = substr($date, 0, 2);
$m = substr($date, 2, 2);
$Y = substr($date, 4, 2);
if ($Y<50) {
$Y = '20'.$Y;
} else {
@ -187,8 +184,7 @@ class Metier_Util_Date
$d='0'.($d*1);
}
switch ($formatOUT)
{
switch ($formatOUT) {
case 'd/m/Y':
return $d.'/'.$m.'/'.$Y;
break;
@ -240,9 +236,9 @@ class Metier_Util_Date
if ($dateV != $dateIN) {
return null;
}
$d = substr($dateIN,6,2);
$m = substr($dateIN,4,2);
$Y = substr($dateIN,0,4);
$d = substr($dateIN, 6, 2);
$m = substr($dateIN, 4, 2);
$Y = substr($dateIN, 0, 4);
$period = strtolower(trim(strtr($period, "-.,", ' ')));
if ($period == '') {
return null;
@ -250,15 +246,13 @@ class Metier_Util_Date
$tabP = explode(' ', $period);
if ($tabP[0]*1 > 0) {
$chiffre = $tabP[0]*1*1;
}
else {
} else {
$chiffre = Metier_Util_Chiffre::ChiffresEnLettres($tabP[0]);
}
if ($inThePast) {
$chiffre = -1*$chiffre;
}
switch (end($tabP))
{
switch (end($tabP)) {
case 'mois':
$dateOUT = date('Ymd', mktime(0, 0, 0, $m+$chiffre, $d, $Y));
break;
@ -287,50 +281,78 @@ class Metier_Util_Date
**/
public function jourFerie($date, $weekend=false)
{
$date = str_replace('-','',strtr($date, '/.:','---'));
$date = str_replace('-', '', strtr($date, '/.:', '---'));
$jour = self::dateT('Ymd', 'd', $date);
$mois = self::dateT('Ymd', 'm', $date);
$annee = self::dateT('Ymd', 'Y', $date);
$ferie = false;
// Jours feriées fixes
if($jour == 1 && $mois == 1) $ferie = true; // 1er janvier
if($jour == 1 && $mois == 5) $ferie = true; // 1er mai
if($jour == 8 && $mois == 5) $ferie = true; // 8 mai
if($jour == 14 && $mois == 7) $ferie = true; // 14 juillet
if($jour == 15 && $mois == 8) $ferie = true; // 15 aout
if($jour == 1 && $mois == 11) $ferie = true; // 1 novembre
if($jour == 11 && $mois == 11) $ferie = true; // 11 novembre
if($jour == 25 && $mois == 12) $ferie = true; // 25 décembre
if ($jour == 1 && $mois == 1) {
$ferie = true;
} // 1er janvier
if ($jour == 1 && $mois == 5) {
$ferie = true;
} // 1er mai
if ($jour == 8 && $mois == 5) {
$ferie = true;
} // 8 mai
if ($jour == 14 && $mois == 7) {
$ferie = true;
} // 14 juillet
if ($jour == 15 && $mois == 8) {
$ferie = true;
} // 15 aout
if ($jour == 1 && $mois == 11) {
$ferie = true;
} // 1 novembre
if ($jour == 11 && $mois == 11) {
$ferie = true;
} // 11 novembre
if ($jour == 25 && $mois == 12) {
$ferie = true;
} // 25 décembre
// fêtes religieuses mobiles
$pak = @easter_date($annee);
$jp = date("d", $pak);
$mp = date("m", $pak);
if($jp == $jour && $mp == $mois){ $ferie = true;} // Pâques
$lpk = mktime(date("H", $pak), date("i", $pak), date("s", $pak), date("m", $pak), date("d", $pak) +1, date("Y", $pak) );
if ($jp == $jour && $mp == $mois) {
$ferie = true;
} // Pâques
$lpk = mktime(date("H", $pak), date("i", $pak), date("s", $pak), date("m", $pak), date("d", $pak) +1, date("Y", $pak));
$jp = date("d", $lpk);
$mp = date("m", $lpk);
if($jp == $jour && $mp == $mois){ $ferie = true; }// Lundi de Pâques
$asc = mktime(date("H", $pak), date("i", $pak), date("s", $pak), date("m", $pak), date("d", $pak) + 39, date("Y", $pak) );
if ($jp == $jour && $mp == $mois) {
$ferie = true;
}// Lundi de Pâques
$asc = mktime(date("H", $pak), date("i", $pak), date("s", $pak), date("m", $pak), date("d", $pak) + 39, date("Y", $pak));
$jp = date("d", $asc);
$mp = date("m", $asc);
if($jp == $jour && $mp == $mois){ $ferie = true;}//ascension
$pe = mktime(date("H", $pak), date("i", $pak), date("s", $pak), date("m", $pak), date("d", $pak) + 49, date("Y", $pak) );
if ($jp == $jour && $mp == $mois) {
$ferie = true;
}//ascension
$pe = mktime(date("H", $pak), date("i", $pak), date("s", $pak), date("m", $pak), date("d", $pak) + 49, date("Y", $pak));
$jp = date("d", $pe);
$mp = date("m", $pe);
if($jp == $jour && $mp == $mois) {$ferie = true;}// Pentecôte
$lp = mktime(date("H", $asc), date("i", $pak), date("s", $pak), date("m", $pak), date("d", $pak) + 50, date("Y", $pak) );
if ($jp == $jour && $mp == $mois) {
$ferie = true;
}// Pentecôte
$lp = mktime(date("H", $asc), date("i", $pak), date("s", $pak), date("m", $pak), date("d", $pak) + 50, date("Y", $pak));
$jp = date("d", $lp);
$mp = date("m", $lp);
if($jp == $jour && $mp == $mois) {$ferie = true;}// lundi Pentecôte
if ($jp == $jour && $mp == $mois) {
$ferie = true;
}// lundi Pentecôte
// Samedis et Dimanches
if ($weekend) {
$jour_sem = date('N',mktime(0,0,0, $mois, $jour, $annee));
if($jour_sem>5) $ferie = true;
$jour_sem = date('N', mktime(0, 0, 0, $mois, $jour, $annee));
if ($jour_sem>5) {
$ferie = true;
}
}
return $ferie;
}
}
}

View File

@ -16,7 +16,7 @@ class Metier_Util_Db
protected $errorMsg = '';
public function __construct( $db = null )
public function __construct($db = null)
{
if ($db === null) {
$this->db = Zend_Db_Table::getDefaultAdapter();
@ -36,35 +36,40 @@ class Metier_Util_Db
$this->errorMsg = '';
$fields = implode(array_keys($toAdd), ',');
foreach (array_values($toAdd) as $key=>$array_values)
foreach (array_values($toAdd) as $key=>$array_values) {
$tmp[$key] = addslashes($array_values);
}
$values = "'".implode(array_values($tmp), "','")."'"; # better
$values = "'".implode(array_values($tmp), "','")."'"; # better
$values = str_replace("'NULL'", 'NULL', $values);
if ($low_priority) {
$query = 'INSERT INTO '.$table.' ('.$fields.') VALUES ('.$values.');';
} else {
$query = 'INSERT INTO '.$table.' ('.$fields.') VALUES ('.$values.');';
}
if ($debug) $tdeb = microtime(true);
if ($low_priority) {
$query = 'INSERT INTO '.$table.' ('.$fields.') VALUES ('.$values.');';
} else {
$query = 'INSERT INTO '.$table.' ('.$fields.') VALUES ('.$values.');';
}
if ($debug) {
$tdeb = microtime(true);
}
try {
$stmt = $this->db->query($query);
$res = $this->db->lastInsertId();
if ($debug) $this->trace($query, $res, $tdeb);
if ( $res == 0 ) {
return true;
}
return $res;
} catch(Zend_Db_Exception $e) {
$this->errorCode = $e->getCode();
$this->errorMsg = $e->getMessage();
$this->trace($query);
return false;
try {
$stmt = $this->db->query($query);
$res = $this->db->lastInsertId();
if ($debug) {
$this->trace($query, $res, $tdeb);
}
if ($res == 0) {
return true;
}
return $res;
} catch (Zend_Db_Exception $e) {
$this->errorCode = $e->getCode();
$this->errorMsg = $e->getMessage();
$this->trace($query);
return false;
}
return false;
}
/**
@ -97,19 +102,25 @@ class Metier_Util_Db
}
$query = str_replace("'NULL'", 'NULL', $query);
$query.=' WHERE '.$where;
if ($limit>0) $query.=" LIMIT $limit";
if ($limit>0) {
$query.=" LIMIT $limit";
}
if ($debug) $tdeb = microtime(true);
if ($debug) {
$tdeb = microtime(true);
}
try {
$stmt = $this->db->query($query);
$res = $stmt->rowCount();
if ($debug) $this->trace($query, $res, $tdeb);
if ( $res == 0 ) {
if ($debug) {
$this->trace($query, $res, $tdeb);
}
if ($res == 0) {
return false;
}
return $res;
} catch(Zend_Db_Exception $e) {
} catch (Zend_Db_Exception $e) {
$this->errorCode = $e->getCode();
$this->errorMsg = $e->getMessage();
$this->trace($query, $res, $tdeb);
@ -134,22 +145,25 @@ class Metier_Util_Db
if ($low_priority) {
$query='DELETE QUICK FROM '.$table.' WHERE '.$where.';';
}
else {
} else {
$query='DELETE FROM '.$table.' WHERE '.$where.';';
}
if ($debug) $tdeb = microtime(true);
if ($debug) {
$tdeb = microtime(true);
}
try {
$stmt = $this->db->query($query);
$res = $this->db->lastInsertId();
if ($debug) $this->trace($query, $res, $tdeb);
if ( $res == 0 ) {
if ($debug) {
$this->trace($query, $res, $tdeb);
}
if ($res == 0) {
$res = true;
}
return $res;
} catch(Zend_Db_Exception $e) {
} catch (Zend_Db_Exception $e) {
$this->errorCode = $e->getCode();
$this->errorMsg = $e->getMessage();
$this->trace($query, $res, $tdeb);
@ -176,20 +190,22 @@ class Metier_Util_Db
$query="SELECT $fields FROM $table WHERE $where;";
if ($debug) $tdeb = microtime(true);
if ($debug) {
$tdeb = microtime(true);
}
try {
$stmt = $this->db->query($query);
$this->result = $stmt;
} catch(Zend_Db_Exception $e) {
} catch (Zend_Db_Exception $e) {
$this->errorCode = $e->getCode();
$this->errorMsg = $e->getMessage();
$this->trace($query);
return false;
}
if ( !$huge ) {
switch($assoc) {
if (!$huge) {
switch ($assoc) {
case MYSQL_NUM:
$mode = Zend_Db::FETCH_NUM;
break;
@ -201,11 +217,15 @@ class Metier_Util_Db
break;
}
$tab = $stmt->fetchAll($mode);
if ($debug) $this->trace($query, sizeof($tab), $tdeb);
if ($debug) {
$this->trace($query, sizeof($tab), $tdeb);
}
return $tab;
} else {
$nbRows = $stmt->rowCount();
if ($debug) $this->trace($query, $nbRows, $tdeb);
if ($debug) {
$this->trace($query, $nbRows, $tdeb);
}
return $nbRows;
}
}
@ -217,7 +237,7 @@ class Metier_Util_Db
*/
public function fetch($assoc=MYSQL_BOTH)
{
switch($assoc) {
switch ($assoc) {
case MYSQL_NUM:
$mode = Zend_Db::FETCH_NUM;
break;
@ -239,7 +259,7 @@ class Metier_Util_Db
*/
public function trace($query, $res='', $tdeb = null)
{
if ( $tdeb === null) {
if ($tdeb === null) {
$duree = microtime(true)-$tdeb;
} else {
$duree = 'N/D';
@ -263,7 +283,7 @@ class Metier_Util_Db
try {
$stmt = $this->db->query($query);
$this->result = $stmt;
} catch(Zend_Db_Exception $e) {
} catch (Zend_Db_Exception $e) {
$this->errorCode = $e->getCode();
$this->errorMsg = $e->getMessage();
$this->trace($query);
@ -309,11 +329,13 @@ class Metier_Util_Db
{
$i = 0;
$fp = fopen($fileCsv, 'w');
if (!$fp) return false;
if (!$fp) {
return false;
}
$res = $this->query($query);
$nbLignes = count($res);
for($i=0; $i<$nbLignes; $i++) {
for ($i=0; $i<$nbLignes; $i++) {
$ligne = $res[$i];
//Header
@ -337,4 +359,4 @@ class Metier_Util_Db
fclose($fp);
return $nbLignes;
}
}
}

View File

@ -12,7 +12,7 @@ class Metier_Util_Log
*/
public static function write($level, $message, $line, $file, $function, $class)
{
if ($level=='E'){
if ($level=='E') {
if (!file_exists(LOG_PATH.'/debugError.log')) {
file_put_contents(LOG_PATH.'/debugError.log', 'Date/Heure;Niveau;Script;Login;Password;Adresse IP;Action SOAP;Ligne;Fichier;Fonction;Classe;Domaine;POST DATA;Message'.PHP_EOL);
} else {
@ -32,4 +32,4 @@ class Metier_Util_Log
}
}
}
}
}

View File

@ -20,13 +20,13 @@ class Metier_Util_Luhn
$sum = 0;
$flip = 1;
// Sum digits (last one is check digit, which is not in parameter)
for($i=$length-1;$i>=0;--$i) {
for ($i=$length-1;$i>=0;--$i) {
$sum += $this->sumTable[$flip++ & 0x1][$number[$i]];
}
// Multiply by 9
$sum *= 9;
// Last digit of sum is check digit
return (int)substr($sum,-1,1);
return (int)substr($sum, -1, 1);
}
/**
@ -39,11 +39,10 @@ class Metier_Util_Luhn
public function validate(string $number, int $digit)
{
$calculated = $this->calculate($number);
if($digit == $calculated) {
if ($digit == $calculated) {
return true;
}
else {
} else {
return false;
}
}
}
}

View File

@ -10,14 +10,14 @@ class Metier_Util_Mail
* @param string $html
* @param array $tabAttachedFiles
*/
function send($from, $to, $subject, $text='', $html='', $tabAttachedFiles=array())
public function send($from, $to, $subject, $text='', $html='', $tabAttachedFiles=array())
{
$to = preg_split("/[\s,;]+/", $to);
$mail = new Scores_Mail_Method();
$mail->setFrom($from);
if ( count($to) > 0 ) {
foreach ( $to as $item ) {
if (count($to) > 0) {
foreach ($to as $item) {
$mail->addTo($item);
}
}
@ -30,9 +30,9 @@ class Metier_Util_Mail
$mail->setBodyHtml($html);
}
if ( count($tabAttachedFiles) > 0 ) {
if (count($tabAttachedFiles) > 0) {
foreach ($tabAttachedFiles as $file) {
$at = new Zend_Mime_Part( file_get_contents( $file ) );
$at = new Zend_Mime_Part(file_get_contents($file));
$mail->addAttachment($at);
}
}
@ -45,5 +45,4 @@ class Metier_Util_Mail
file_put_contents(LOG_PATH.'/sendMailError.log', date('Y-m-d H:i:s')." - ".$e->getMessage()."\n", FILE_APPEND);
}
}
}
}

View File

@ -71,4 +71,4 @@ class Metier_Util_PdoLib
{
return $this->conn;
}
}
}

View File

@ -45,10 +45,10 @@ class Metier_Util_String
*/
public static function trimAccent($strWithAccent)
{
$strWithAccent = htmlentities(strtolower($strWithAccent ));
$strWithAccent = preg_replace("/&(.)(acute|cedil|circ|ring|tilde|uml|grave);/", "$1", $strWithAccent );
$strWithAccent = preg_replace("/([^a-z0-9]+)/", " ", html_entity_decode($strWithAccent ));
$strWithAccent = trim($strWithAccent , "-");
$strWithAccent = htmlentities(strtolower($strWithAccent));
$strWithAccent = preg_replace("/&(.)(acute|cedil|circ|ring|tilde|uml|grave);/", "$1", $strWithAccent);
$strWithAccent = preg_replace("/([^a-z0-9]+)/", " ", html_entity_decode($strWithAccent));
$strWithAccent = trim($strWithAccent, "-");
return $strWithAccent;
}
@ -58,7 +58,7 @@ class Metier_Util_String
*/
public static function htm2txt($str)
{
return trim(strip_tags( str_replace(chr(160), ' ',
return trim(strip_tags(str_replace(chr(160), ' ',
str_replace('&#156;', 'oe',
str_replace('&#146;', '\'', html_entity_decode($str, ENT_QUOTES))))));
}
@ -74,25 +74,23 @@ class Metier_Util_String
*/
public static function valideData($variable, $taille_min, $taille_max, $type_variable, $erreur=false)
{
if ( strlen((string)$variable) < $taille_min ) {
if (strlen((string)$variable) < $taille_min) {
return $erreur;
}
if ( strlen((string)$variable) > $taille_max ) {
if (strlen((string)$variable) > $taille_max) {
return $erreur;
}
if ( $type_variable == 'A' ) {
if ( is_string($variable) == true ) {
if ($type_variable == 'A') {
if (is_string($variable) == true) {
return true;
}
else {
} else {
return $erreur;
}
}
elseif ( $type_variable == 'N') {
} elseif ($type_variable == 'N') {
for ($i=0; $i < strlen((string)$variable); $i++) {
$car = substr((string)$variable,$i,1);
$car = substr((string)$variable, $i, 1);
if ($car<'0' || $car>'9') {
return $erreur;
}
@ -102,5 +100,4 @@ class Metier_Util_String
return $erreur;
}
}
}

View File

@ -1,5 +1,7 @@
<?php
class Metier_Sphinx_Engine
class Metier_sphinx_Engine
{
public function __construct() {}
}
public function __construct()
{
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,29 +1,29 @@
<?php
return array (
return array(
//RECHERCHE
'RECHCSV' => "Export des résultats de la recherche",
'IPARI' => "Investigation par l'image IparI&copy;",
'HISTOBODACC' => "Historique des annonces bodacc",
'INVESTIG' => "Investigation",
'HISTOBODACC' => "Historique des annonces bodacc",
'INVESTIG' => "Investigation",
'SEARCHENT' => "Recherche Entreprise",
'SEARCHDIR' => "Recherche Dirigeant",
'SEARCHACT' => "Recherche Actionnaire",
//IDENTITE
'IDENTITE' => "Fiche d'identité",
'IDPROCOL' => 'Fiche procédure collective',
'IDPROCOL' => 'Fiche procédure collective',
'LIENS' => "Liens inter-entreprise",
'ETABLISSEMENTS' => "Liste des établissements",
'GROUPE' => "Informations et organigramme du groupe",
'EVENINSEE' => '&Eacute;vènements INSEE',
'AVISINSEE' => 'Avis de situation INSEE',
'AVISRNCS' => 'Avis de situation RNCS',
'GROUPE' => "Informations et organigramme du groupe",
'EVENINSEE' => '&Eacute;vènements INSEE',
'AVISINSEE' => 'Avis de situation INSEE',
'AVISRNCS' => 'Avis de situation RNCS',
'RNVP' => "Normalisation postale",
//DIRIGEANT
'DIRIGEANTS' => "Liste des dirigeants",
'DIRIGEANTSOP' => "Liste des dirigeants opérationnels",
'DIRIGEANTS' => "Liste des dirigeants",
'DIRIGEANTSOP' => "Liste des dirigeants opérationnels",
//FINANCE
'SYNTHESE' => "Synthèse",
@ -31,7 +31,7 @@ return array (
'FLUX' => "Flux de trésorerie",
'LIASSE' => "Liasse fiscale",
'LIASSEXLS' => "Export des Liasses au format XLS",
'UPLOADBILAN' => "Saisie de bilan",
'UPLOADBILAN' => "Saisie de bilan",
'BOURSE' => "Bourse & cotations",
'BANQUE' => "Relations bancaires",
@ -40,46 +40,46 @@ return array (
'INFOSREG' => "Informations réglementée",
'COMPETENCES' => "Compétences territoriales",
'CONVENTIONS' => "Conventions collectives",
'MARQUES' => "Marques déposées",
'MARQUES' => "Marques déposées",
'CONTENTIEUX' => "Contentieux Judiciaires",
//EVALUATION
'INDISCORE' => "indiScore&copy;",
'INDISCORE2' => "Rapport synthetique",
'INDISCORE3' => "Rapport complet",
'INDISCOREP' => "indiScore+",
'INDISCORE2P' => "Rapport synthetique+",
'INDISCORE3P' => "Rapport complet+",
'VALORISATION' => "Valorisation",
'SCORECSF' => "Score CSF",
'ENQUETEC' => "Enquête commerciale",
'AVISCREDIT' => "Avis de crédit personnalisé",
'INDISCORE' => "indiScore&copy;",
'INDISCORE2' => "Rapport synthetique",
'INDISCORE3' => "Rapport complet",
'INDISCOREP' => "indiScore+",
'INDISCORE2P' => "Rapport synthetique+",
'INDISCORE3P' => "Rapport complet+",
'VALORISATION' => "Valorisation",
'SCORECSF' => "Score CSF",
'ENQUETEC' => "Enquête commerciale",
'AVISCREDIT' => "Avis de crédit personnalisé",
//PIECES
'KBIS' => "Extrait RCS",
'ACTES' => "Pièces officielles",
'PRIVILEGES' => "Privilèges",
'KBIS' => "Extrait RCS",
'ACTES' => "Pièces officielles",
'PRIVILEGES' => "Privilèges",
//SURVEILLANCES
'SURVANNONCE' => "Surveillance des annonces légales",
'SURVINSEE' => "Surveillance des événements INSEE",
'SURVBILAN' => "Surveillance des bilans saisies (liasse fiscale)",
'SURVSCORE' => "Surveillance des événements sur le score",
'SURVACTES' => "Surveillance des pieces officielles (comptes annuels, actes)",
'SURVDIRIGEANTS'=> "Surveillance des dirigeants",
'SURVPAIEMENTS' => "Surveillance des paiements",
'SURVLIENS' => "Surveillance des liens financiers",
'SURVPRIV' => "Surveillance des privilèges",
'SURVANNONCE' => "Surveillance des annonces légales",
'SURVINSEE' => "Surveillance des événements INSEE",
'SURVBILAN' => "Surveillance des bilans saisies (liasse fiscale)",
'SURVSCORE' => "Surveillance des événements sur le score",
'SURVACTES' => "Surveillance des pieces officielles (comptes annuels, actes)",
'SURVDIRIGEANTS'=> "Surveillance des dirigeants",
'SURVPAIEMENTS' => "Surveillance des paiements",
'SURVLIENS' => "Surveillance des liens financiers",
'SURVPRIV' => "Surveillance des privilèges",
//OPTIONS
'MONPROFIL' => "Mon profil",
'EDITION' => "Mode Edition",
'PORTEFEUILLE' => "Portefeuille",
'SURVLISTE' => "Liste des surveillances",
'MONPROFIL' => "Mon profil",
'EDITION' => "Mode Edition",
'PORTEFEUILLE' => "Portefeuille",
'SURVLISTE' => "Liste des surveillances",
//DIVERS
'INTERNATIONAL' => "Recherche Internationale",
'BDF' => "Banque de France",
'WORLDCHECK' => "World-Check Risk Intelligence",
'INTERNATIONAL' => "Recherche Internationale",
'BDF' => "Banque de France",
'WORLDCHECK' => "World-Check Risk Intelligence",
);
);

View File

@ -109,4 +109,4 @@ return array(
'BDF'
),
),
);
);

View File

@ -1,124 +1,124 @@
<?php
class Scores_Auth_Adapter_Db implements Zend_Auth_Adapter_Interface
{
protected $_username;
protected $_username;
protected $_password;
protected $_password;
protected $_hash;
protected $_hash;
protected $_timeout = 3600;
protected $_timeout = 3600;
protected $checkWs = false;
protected $checkWs = false;
protected $clients = array();
protected $clients = array();
/**
*
* @param string $username
* @param string $password
* @param boolean $checkWs
*/
public function __construct($username, $password, $checkWs = false)
{
$this->_username = $username;
$this->_password = $password;
$this->_hash = md5($username.'|'.$password);
$this->checkWs = $checkWs;
}
/**
*
* @param string $username
* @param string $password
* @param boolean $checkWs
*/
public function __construct($username, $password, $checkWs = false)
{
$this->_username = $username;
$this->_password = $password;
$this->_hash = md5($username.'|'.$password);
$this->checkWs = $checkWs;
}
/**
* Limit access to only client IDs
* @param array $id
*/
public function limitClient($id = null)
{
if (is_array($id) && count($id)>0) {
$this->clients = $id;
}
}
/**
* Limit access to only client IDs
* @param array $id
*/
public function limitClient($id = null)
{
if (is_array($id) && count($id)>0) {
$this->clients = $id;
}
}
/**
* Override the timeout
* @param integer $seconds
*/
public function setTimeout($seconds = null)
{
if ($seconds===null)
return;
/**
* Override the timeout
* @param integer $seconds
*/
public function setTimeout($seconds = null)
{
if ($seconds===null) {
return;
}
$this->_timeout = $seconds;
}
$this->_timeout = $seconds;
}
/**
* (non-PHPdoc)
* @see Zend_Auth_Adapter_Interface::authenticate()
*/
public function authenticate()
{
$userM = new Application_Model_Sdv1Utilisateurs();
/**
* (non-PHPdoc)
* @see Zend_Auth_Adapter_Interface::authenticate()
*/
public function authenticate()
{
$userM = new Application_Model_Sdv1Utilisateurs();
$sql = $userM->select()
->setIntegrityCheck(false)
->from(array('u'=>'sdv1.utilisateurs'), array('u.idClient', 'u.id', 'u.login', 'u.password'))
->join(array('c'=>'sdv1.clients'), 'u.idClient = c.id', array('c.timeout'))
->where('u.login=?', $this->_username)
->where('u.actif=?', 1)
->where('u.deleted=?', 0)
->where('c.actif=?','Oui');
$sql = $userM->select()
->setIntegrityCheck(false)
->from(array('u'=>'sdv1.utilisateurs'), array('u.idClient', 'u.id', 'u.login', 'u.password'))
->join(array('c'=>'sdv1.clients'), 'u.idClient = c.id', array('c.timeout'))
->where('u.login=?', $this->_username)
->where('u.actif=?', 1)
->where('u.deleted=?', 0)
->where('c.actif=?', 'Oui');
if ( count($this->clients) > 0 ) {
$sql->where('u.idClient IN('.join(',',$this->clients).')');
}
if (count($this->clients) > 0) {
$sql->where('u.idClient IN('.join(',', $this->clients).')');
}
if ($this->checkWs) {
$sql->where('u.accesWS=?',1);
}
if ($this->checkWs) {
$sql->where('u.accesWS=?', 1);
}
$result = $userM->fetchRow($sql);
$result = $userM->fetchRow($sql);
$identity = new stdClass();
$identity->username = $this->_username;
$identity->hash = $this->_hash;
$identity = new stdClass();
$identity->username = $this->_username;
$identity->hash = $this->_hash;
if ( null === $result ) {
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND, $identity, array("Identifiant ou mot de passe invalid"));
} else {
if ( $this->_password == $result->password
|| $this->_password == md5($result->login.'|'.$result->password) ) {
if (null === $result) {
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND, $identity, array("Identifiant ou mot de passe invalid"));
} else {
if ($this->_password == $result->password
|| $this->_password == md5($result->login.'|'.$result->password)) {
/**
* Date de debut de compte
*/
if ( !empty($result->dateDebutCompte) && $result->dateDebutCompte!='0000-00-00' ) {
$today = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
$dateDebutCompte = mktime(0, 0, 0, substr($result->dateDebutCompte,5,2), substr($result->dateDebutCompte,8,2), substr($result->dateDebutCompte,0,4));
if ( $today < $dateDebutCompte ) {
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, $identity, array("Date de validité dépassé"));
}
}
/**
* Date de debut de compte
*/
if (!empty($result->dateDebutCompte) && $result->dateDebutCompte!='0000-00-00') {
$today = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
$dateDebutCompte = mktime(0, 0, 0, substr($result->dateDebutCompte, 5, 2), substr($result->dateDebutCompte, 8, 2), substr($result->dateDebutCompte, 0, 4));
if ($today < $dateDebutCompte) {
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, $identity, array("Date de validité dépassé"));
}
}
/**
* Date de fin de compte
*/
if ( !empty($result->dateFinCompte) && $result->dateFinCompte!='0000-00-00' ) {
$today = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
$dateFinCompte = mktime(0, 0, 0, substr($result->dateFinCompte,5,2), substr($result->dateFinCompte,8,2), substr($result->dateFinCompte,0,4));
if ( $today > $dateFinCompte ) {
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, $identity, array("Date de validité dépassé"));
}
}
/**
* Date de fin de compte
*/
if (!empty($result->dateFinCompte) && $result->dateFinCompte!='0000-00-00') {
$today = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
$dateFinCompte = mktime(0, 0, 0, substr($result->dateFinCompte, 5, 2), substr($result->dateFinCompte, 8, 2), substr($result->dateFinCompte, 0, 4));
if ($today > $dateFinCompte) {
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, $identity, array("Date de validité dépassé"));
}
}
$identity->id = $result->id;
$identity->idClient = $result->idClient;
$timeout = (!empty($result->timeout)) ? $result->timeout : $this->_timeout;
$identity->timeout = $timeout;
$identity->time = time() + $timeout;
return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $identity);
} else {
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, $identity, array("Identification impossible"));
}
}
}
}
$identity->id = $result->id;
$identity->idClient = $result->idClient;
$timeout = (!empty($result->timeout)) ? $result->timeout : $this->_timeout;
$identity->timeout = $timeout;
$identity->time = time() + $timeout;
return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $identity);
} else {
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, $identity, array("Identification impossible"));
}
}
}
}

View File

@ -1,190 +1,189 @@
<?php
class Scores_Auth_Adapter_Ws implements Zend_Auth_Adapter_Interface
{
/**
* Identifiant de l'utilisateur
* @var string
*/
protected $_username;
/**
* Identifiant de l'utilisateur
* @var string
*/
protected $_username;
/**
* Password
* @var string
*/
protected $_password;
/**
* Password
* @var string
*/
protected $_password;
/**
* Timeout
* @var int
*/
protected $_timeout = 1800;
/**
* Timeout
* @var int
*/
protected $_timeout = 1800;
/**
* Marqueur de vérification IP (en iponly)
* @var boolean
*/
protected $_checkIp = false;
/**
* Marqueur de vérification IP (en iponly)
* @var boolean
*/
protected $_checkIp = false;
/**
* Marqueur de vérification de hach
* @var boolean
*/
protected $_checkHach = false;
/**
* Marqueur de vérification de hach
* @var boolean
*/
protected $_checkHach = false;
/**
* Liste des IPs des frontends (proxy)
* @var array
*/
protected $listProxyIp = array(
'62.210.222.34',
);
/**
* Liste des IPs des frontends (proxy)
* @var array
*/
protected $listProxyIp = array(
'62.210.222.34',
);
/**
* Authentification par WS
* @param string $username
* @param string $password
* @param string $mode
*/
public function __construct($username, $password, $mode = null)
{
$this->_username = $username;
$this->_password = $password;
/**
* Authentification par WS
* @param string $username
* @param string $password
* @param string $mode
*/
public function __construct($username, $password, $mode = null)
{
$this->_username = $username;
$this->_password = $password;
if ($mode == 'hach') {
$this->_checkHach = true;
}
if ($mode == 'hach') {
$this->_checkHach = true;
}
if ($mode == 'iponly'){
$ip = $_SERVER['REMOTE_ADDR'];
if ( isset($_SERVER['HTTP_X_FORWARDED_FOR']) && in_array($ip, $this->listProxyIp)) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
$this->_password = 'iponly:'.$ip;
$this->_checkIp = true;
}
}
if ($mode == 'iponly') {
$ip = $_SERVER['REMOTE_ADDR'];
if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && in_array($ip, $this->listProxyIp)) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
$this->_password = 'iponly:'.$ip;
$this->_checkIp = true;
}
}
/**
* (non-PHPdoc)
* @see Zend_Auth_Adapter_Interface::authenticate()
*/
public function authenticate()
{
/**
* (non-PHPdoc)
* @see Zend_Auth_Adapter_Interface::authenticate()
*/
public function authenticate()
{
$ip = $_SERVER['REMOTE_ADDR'];
if ( isset($_SERVER['HTTP_X_FORWARDED_FOR']) && in_array($ip, $this->listProxyIp)) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && in_array($ip, $this->listProxyIp)) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
$ws = new Scores_Ws_Client('gestion', '0.3');
$ws->setHttpLogin($this->_username);
$ws->setHttpPassword($this->_password);
$adressIp = $_SERVER['REMOTE_ADDR'];
$parameters = new stdClass();
$parameters->login = $this->_username;
$parameters->ipUtilisateur = $ip;
$parameters->from = 'auth';
$InfosLogin = $ws->getInfosLogin($parameters);
$ws = new Scores_Ws_Client('gestion', '0.3');
$ws->setHttpLogin($this->_username);
$ws->setHttpPassword($this->_password);
$adressIp = $_SERVER['REMOTE_ADDR'];
$parameters = new stdClass();
$parameters->login = $this->_username;
$parameters->ipUtilisateur = $ip;
$parameters->from = 'auth';
$InfosLogin = $ws->getInfosLogin($parameters);
// --- Renvoi
if ( is_string($InfosLogin) || $InfosLogin->error->errnum != 0 ) {
$message = $InfosLogin;
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, $identity, array($message));
}
// --- Assignation identity
elseif ( $InfosLogin !== false && !empty($InfosLogin->result->login)) {
$identity = new stdClass();
if ($this->_checkIp || $this->_checkHach) {
Zend_Registry::get('firebug')->info("IN");
$identity->password = $this->_password;
} else {
$identity->password = md5($InfosLogin->result->login.'|'.$this->_password);
}
Zend_Registry::get('firebug')->info($identity->password);
$identity->username = $InfosLogin->result->login;
$identity->email = $InfosLogin->result->email;
$identity->profil = $InfosLogin->result->profil;
$identity->pref = $InfosLogin->result->pref;
$identity->droits = $InfosLogin->result->droits;
$identity->droitsClients = $InfosLogin->result->droitsClients;
$identity->nom = $InfosLogin->result->nom;
$identity->prenom = $InfosLogin->result->prenom;
$identity->tel = $InfosLogin->result->tel;
$identity->fax = $InfosLogin->result->fax;
$identity->mobile = $InfosLogin->result->mobile;
$identity->id = $InfosLogin->result->id;
$identity->idClient = $InfosLogin->result->idClient;
$identity->reference = $InfosLogin->result->reference;
$identity->nbReponses = $InfosLogin->result->nbReponses;
$identity->typeScore = $InfosLogin->result->typeScore;
$identity->dateValidation = $InfosLogin->result->dateValidation;
$identity->nombreConnexions = $InfosLogin->result->nombreConnexions;
$identity->dateDerniereConnexion = $InfosLogin->result->dateDerniereConnexion;
$identity->dateDebutCompte = $InfosLogin->result->dateDebutCompte;
$identity->dateFinCompte = $InfosLogin->result->dateFinCompte;
$identity->acceptationCGU = $InfosLogin->result->acceptationCGU;
$identity->ip = $ip;
$identity->version = $InfosLogin->result->version;
$identity->modeEdition = false;
// --- Renvoi
if (is_string($InfosLogin) || $InfosLogin->error->errnum != 0) {
$message = $InfosLogin;
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, $identity, array($message));
}
// --- Assignation identity
elseif ($InfosLogin !== false && !empty($InfosLogin->result->login)) {
$identity = new stdClass();
if ($this->_checkIp || $this->_checkHach) {
Zend_Registry::get('firebug')->info("IN");
$identity->password = $this->_password;
} else {
$identity->password = md5($InfosLogin->result->login.'|'.$this->_password);
}
Zend_Registry::get('firebug')->info($identity->password);
$identity->username = $InfosLogin->result->login;
$identity->email = $InfosLogin->result->email;
$identity->profil = $InfosLogin->result->profil;
$identity->pref = $InfosLogin->result->pref;
$identity->droits = $InfosLogin->result->droits;
$identity->droitsClients = $InfosLogin->result->droitsClients;
$identity->nom = $InfosLogin->result->nom;
$identity->prenom = $InfosLogin->result->prenom;
$identity->tel = $InfosLogin->result->tel;
$identity->fax = $InfosLogin->result->fax;
$identity->mobile = $InfosLogin->result->mobile;
$identity->id = $InfosLogin->result->id;
$identity->idClient = $InfosLogin->result->idClient;
$identity->reference = $InfosLogin->result->reference;
$identity->nbReponses = $InfosLogin->result->nbReponses;
$identity->typeScore = $InfosLogin->result->typeScore;
$identity->dateValidation = $InfosLogin->result->dateValidation;
$identity->nombreConnexions = $InfosLogin->result->nombreConnexions;
$identity->dateDerniereConnexion = $InfosLogin->result->dateDerniereConnexion;
$identity->dateDebutCompte = $InfosLogin->result->dateDebutCompte;
$identity->dateFinCompte = $InfosLogin->result->dateFinCompte;
$identity->acceptationCGU = $InfosLogin->result->acceptationCGU;
$identity->ip = $ip;
$identity->version = $InfosLogin->result->version;
$identity->modeEdition = false;
$timeout = (!empty($InfosLogin->result->timeout)) ? $InfosLogin->result->timeout : $this->_timeout;
$identity->timeout = $timeout;
$identity->time = time() + $timeout;
$lang = in_array($InfosLogin->result->lang, array('fr','en')) ? $InfosLogin->result->lang : 'fr';
$identity->lang = $lang;
$identity->langtmp = $lang;
$timeout = (!empty($InfosLogin->result->timeout)) ? $InfosLogin->result->timeout : $this->_timeout;
$identity->timeout = $timeout;
$identity->time = time() + $timeout;
$lang = in_array($InfosLogin->result->lang, array('fr', 'en')) ? $InfosLogin->result->lang : 'fr';
$identity->lang = $lang;
$identity->langtmp = $lang;
// --- Adresse Ip interdites
$ipInterdites = array(
'81.252.88.0-81.252.88.7', // CTE D AGGLOMERATION DE SOPHIA
'195.200.187.163', // PacWan
'213.11.81.41', // Verizon France SAS
'83.206.171.252', // FR-BASE-D-INFORMATIONS-LEGALES-BI
'81.255.32.139',
'212.155.191.100-212.155.191.199', // Satair A/S
'212.37.196.156', // GENERALE-MULTIMEDIA-SUD
'80.245.60.121', // Planete Marseille - Mailclub
'213.246.57.101', // IKOULA
'193.104.158.0-193.104.158.255', // Altares.fr
'195.6.3.0-195.6.3.255', // ORT
'217.144.112.0-217.144.116.63', // Coface
);
// --- Adresse Ip interdites
$ipInterdites = array(
'81.252.88.0-81.252.88.7', // CTE D AGGLOMERATION DE SOPHIA
'195.200.187.163', // PacWan
'213.11.81.41', // Verizon France SAS
'83.206.171.252', // FR-BASE-D-INFORMATIONS-LEGALES-BI
'81.255.32.139',
'212.155.191.100-212.155.191.199', // Satair A/S
'212.37.196.156', // GENERALE-MULTIMEDIA-SUD
'80.245.60.121', // Planete Marseille - Mailclub
'213.246.57.101', // IKOULA
'193.104.158.0-193.104.158.255', // Altares.fr
'195.6.3.0-195.6.3.255', // ORT
'217.144.112.0-217.144.116.63', // Coface
);
// --- Validation IP
$overallIpValidate = false;
foreach ( $ipInterdites as $filtre ) {
if ( strpos($filtre, '*') ) {
foreach ($ipInterdites as $filtre) {
if (strpos($filtre, '*')) {
$filtre = str_replace('*', '0', $filtre) . '-' . str_replace('*', '255', $filtre);
}
// Is it a range ?
if ( strpos($filtre, '-') ) {
if (strpos($filtre, '-')) {
$validateIp = new Scores_Validate_IpInNetwork();
$validateIp->setNetworkNotation($filtre);
$overallIpValidate = $validateIp->isValid($ipToValidate);
}
// Ip only
else {
if ( $filtre === $ipToValidate ) {
if ($filtre === $ipToValidate) {
$overallIpValidate = true;
}
}
// Break foreach
if ( $overallIpValidate === true ) {
if ($overallIpValidate === true) {
break;
}
}
// Exit with error
if ( $overallIpValidate === false ) {
if ($overallIpValidate === false) {
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_UNCATEGORIZED, $identity);
}
// --- OK connecté
$this->_username = $identity->username;
$this->_password = $identity->password;
return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $identity);
} else {
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_UNCATEGORIZED, $identity, array("Identification impossible"));
}
}
}
// --- OK connecté
$this->_username = $identity->username;
$this->_password = $identity->password;
return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $identity);
} else {
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_UNCATEGORIZED, $identity, array("Identification impossible"));
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -4,84 +4,85 @@
*/
class Scores_Locale_String
{
/**
* Clean up a string value.
*
* Resulting string contains only alphanumerics and separators.
*
* @param $string
* A string to clean.
* @param $clean_slash
* Whether to clean slashes from the given string.
* @return
* The cleaned string.
*/
public static function cleanstring($string)
{
$transliterate = TRUE;
$reduce_ascii = FALSE;
$output = $string;
// Remove accents and transliterate
if ($transliterate) {
static $i18n_loaded = false;
static $translations = array();
if (!$i18n_loaded) {
$path = realpath(dirname(__FILE__));
if (is_file($path .'/i18n-ascii.txt')) {
$translations = parse_ini_file($path .'/String/i18n-ascii.txt');
}
$i18n_loaded = true;
}
$output = strtr($output, $translations);
}
// Reduce to the subset of ASCII96 letters and numbers
if ($reduce_ascii) {
$pattern = '/[^a-zA-Z0-9\/]+/ ';
$output = preg_replace($pattern, $separator, $output);
}
return $output;
}
public static function cleanutf8($string)
{
$transliterate = TRUE;
$output = $string;
// Remove accents and transliterate
if ($transliterate) {
static $i18n_loaded = false;
static $translations = array();
if (!$i18n_loaded) {
$path = realpath(dirname(__FILE__));
if (is_file($path .'/i18n-ascii.txt')) {
$translations = parse_ini_file($path .'/String/i18n-ascii.txt');
}
$i18n_loaded = true;
}
$output = strtr($output, $translations);
}
return $output;
}
// Fixes the encoding to uf8
public static function fixEncoding($in_str)
{
$cur_encoding = mb_detect_encoding($in_str) ;
if($cur_encoding == "UTF-8" && mb_check_encoding($in_str,"UTF-8"))
return $in_str;
else
return utf8_encode($in_str);
} // fixEncoding
public static function cleanstring_deep($value)
{
$value = is_array($value) ?
array_map('self::cleanstring_deep', $value) :
cleanstring($value);
return $value;
}
}
/**
* Clean up a string value.
*
* Resulting string contains only alphanumerics and separators.
*
* @param $string
* A string to clean.
* @param $clean_slash
* Whether to clean slashes from the given string.
* @return
* The cleaned string.
*/
public static function cleanstring($string)
{
$transliterate = true;
$reduce_ascii = false;
$output = $string;
// Remove accents and transliterate
if ($transliterate) {
static $i18n_loaded = false;
static $translations = array();
if (!$i18n_loaded) {
$path = realpath(dirname(__FILE__));
if (is_file($path .'/i18n-ascii.txt')) {
$translations = parse_ini_file($path .'/String/i18n-ascii.txt');
}
$i18n_loaded = true;
}
$output = strtr($output, $translations);
}
// Reduce to the subset of ASCII96 letters and numbers
if ($reduce_ascii) {
$pattern = '/[^a-zA-Z0-9\/]+/ ';
$output = preg_replace($pattern, $separator, $output);
}
return $output;
}
public static function cleanutf8($string)
{
$transliterate = true;
$output = $string;
// Remove accents and transliterate
if ($transliterate) {
static $i18n_loaded = false;
static $translations = array();
if (!$i18n_loaded) {
$path = realpath(dirname(__FILE__));
if (is_file($path .'/i18n-ascii.txt')) {
$translations = parse_ini_file($path .'/String/i18n-ascii.txt');
}
$i18n_loaded = true;
}
$output = strtr($output, $translations);
}
return $output;
}
// Fixes the encoding to uf8
public static function fixEncoding($in_str)
{
$cur_encoding = mb_detect_encoding($in_str) ;
if ($cur_encoding == "UTF-8" && mb_check_encoding($in_str, "UTF-8")) {
return $in_str;
} else {
return utf8_encode($in_str);
}
} // fixEncoding
public static function cleanstring_deep($value)
{
$value = is_array($value) ?
array_map('self::cleanstring_deep', $value) :
cleanstring($value);
return $value;
}
}

View File

@ -56,12 +56,11 @@ class Scores_Logger_Sql implements SQLLogger
$this->query['executionTotal'] = $this->total;
$this->query['executionMS'] = $time;
if ($this->nb == 0) {
file_put_contents('logger.log', print_r($this->query,1));
}
else {
file_put_contents('logger.log', print_r($this->query,1), FILE_APPEND);
file_put_contents('logger.log', print_r($this->query, 1));
} else {
file_put_contents('logger.log', print_r($this->query, 1), FILE_APPEND);
}
$this->nb++;
}
}
}
}

View File

@ -1,130 +1,129 @@
<?php
class Scores_Mail_Method extends Zend_Mail
{
protected $config;
protected $transport;
protected $config;
protected $transport;
/**
* Gestion de l'envoi des mails en fonction de la configuration
* Fournir un objet de configuration ou utiliser la configuration de l'application
* method => smtp, sendmail, file
* Si method = smtp
* (host => IP, dns)
*
* Activer l'authentification
* (auth => login, plain, ....)
* (username => )
* (password => )
*/
public function __construct( $config = null )
{
if ($config === null) {
$c = Zend_Registry::get('config');
$this->config = $c->profil->mail;
} else {
/**
* Gestion de l'envoi des mails en fonction de la configuration
* Fournir un objet de configuration ou utiliser la configuration de l'application
* method => smtp, sendmail, file
* Si method = smtp
* (host => IP, dns)
*
* Activer l'authentification
* (auth => login, plain, ....)
* (username => )
* (password => )
*/
public function __construct($config = null)
{
if ($config === null) {
$c = Zend_Registry::get('config');
$this->config = $c->profil->mail;
} else {
$this->config = $config;
}
}
$this->_charset = 'ISO-8859-15';
$this->_charset = 'ISO-8859-15';
// --- Configuration du transport SMTP
if ( $this->config->method == 'smtp' ) {
// --- Configuration du transport SMTP
if ($this->config->method == 'smtp') {
$config = array();
$config = array();
if ( isset($this->config->auth) ) {
if (isset($this->config->auth)) {
$config['auth'] = $this->config->auth;
if ( isset($this->config->username) ) {
if (isset($this->config->username)) {
$config['username'] = $this->config->username;
}
if ( isset($this->config->password) ) {
if (isset($this->config->password)) {
$config['password'] = $this->config->password;
}
}
if ( isset($this->config->port) ) {
if (isset($this->config->port)) {
$config['port'] = $this->config->port;
}
$tr = new Zend_Mail_Transport_Smtp($this->config->host, $config);
}
}
// --- Configuration transport Sendmail
if ( $this->config->method == 'sendmail' ) {
$tr = new Zend_Mail_Transport_Sendmail();
}
// --- Configuration transport Sendmail
if ($this->config->method == 'sendmail') {
$tr = new Zend_Mail_Transport_Sendmail();
}
// --- Configuration transport File
if ( $this->config->method == 'file' ) {
$tr = new Zend_Mail_Transport_File(array('callback' => array($this, 'recipientFilename')));
}
// --- Configuration transport File
if ($this->config->method == 'file') {
$tr = new Zend_Mail_Transport_File(array('callback' => array($this, 'recipientFilename')));
}
$this->transport = $tr;
}
$this->transport = $tr;
}
/**
* Champ From en fonction de la clé de configuration
* @param string $configKey
*/
public function setFromKey($configKey)
{
$email = $this->config->email->$configKey;
$this->setFrom($email, ucfirst($configKey));
}
/**
* Champ From en fonction de la clé de configuration
* @param string $configKey
*/
public function setFromKey($configKey)
{
$email = $this->config->email->$configKey;
$this->setFrom($email, ucfirst($configKey));
}
/**
* Champ To en fonction de la clé de configuration
* @param string $configKey
*/
public function addToKey($configKey)
{
$email = $this->config->email->$configKey;
$this->addTo($email, ucfirst($configKey));
}
/**
* Champ To en fonction de la clé de configuration
* @param string $configKey
*/
public function addToKey($configKey)
{
$email = $this->config->email->$configKey;
$this->addTo($email, ucfirst($configKey));
}
/**
* Définit le sujet de l'email
* @param string $texte
*/
public function setSubjectC($texte = '')
{
$this->setSubject($this->txtConvert($texte));
}
/**
* Définit le sujet de l'email
* @param string $texte
*/
public function setSubjectC($texte = '')
{
$this->setSubject($this->txtConvert($texte));
}
/**
* Définit le corps de l'email au format texte
* @param string $texte
*/
public function setBodyTextC($texte = '')
{
$this->setBodyText($this->txtConvert($texte));
}
/**
* Définit le corps de l'email au format texte
* @param string $texte
*/
public function setBodyTextC($texte = '')
{
$this->setBodyText($this->txtConvert($texte));
}
/**
* Définit le corps de l'email au format html
* @param string $html
*/
public function setBodyHtmlC($html = '')
{
$this->setBodyHtml($this->txtConvert($html));
}
/**
* Définit le corps de l'email au format html
* @param string $html
*/
public function setBodyHtmlC($html = '')
{
$this->setBodyHtml($this->txtConvert($html));
}
/**
* Envoi de l'emai
*/
public function execute()
{
return $this->send($this->transport);
}
/**
* Envoi de l'emai
*/
public function execute()
{
return $this->send($this->transport);
}
//We suppose that character encoding of strings is UTF-8 on PHP script.
protected function txtConvert($string)
{
return mb_convert_encoding($string, 'ISO-8859-1', 'UTF-8');
}
//We suppose that character encoding of strings is UTF-8 on PHP script.
protected function txtConvert($string)
{
return mb_convert_encoding($string, 'ISO-8859-1', 'UTF-8');
}
protected function recipientFilename($transport)
protected function recipientFilename($transport)
{
return $transport->recipients . '_' . mt_rand() . '.tmp';
}
}
}

View File

@ -63,13 +63,14 @@ class Scores_Validate_IpInNetwork extends Zend_Validate_Ip
* @param array $options
* @return void
*/
public function __construct($options = array()) {
if ( !empty($options) && is_array($options) ) {
if ( array_key_exists('throw',$options) ) {
public function __construct($options = array())
{
if (!empty($options) && is_array($options)) {
if (array_key_exists('throw', $options)) {
$this->setThrow4Notation($options['throw']);
unset($options['throw']);
}
if ( array_key_exists('network',$options) ) {
if (array_key_exists('network', $options)) {
$this->setNetworkNotation($options['network']);
unset($options['network']);
}
@ -84,7 +85,8 @@ class Scores_Validate_IpInNetwork extends Zend_Validate_Ip
* (non-PHPdoc)
* @see Zend_Validate_Abstract::setMessages()
*/
public function setMessages(array $messages) {
public function setMessages(array $messages)
{
$newMessages = array(
self::MISSING_NETWORK => 'No valid network has been given to validate against',
self::INVALID_NETWORK => 'The network is not an accepted format',
@ -93,10 +95,10 @@ class Scores_Validate_IpInNetwork extends Zend_Validate_Ip
self::HIGH_IN_NETWORK => "The ip '%value%' is higher in range than the provided network",
);
foreach ( $newMessages as $messageKey => $messageString ) {
if ( !isset($this->_messageTemplates[$messageKey]) ) {
foreach ($newMessages as $messageKey => $messageString) {
if (!isset($this->_messageTemplates[$messageKey])) {
$this->_messageTemplates[$messageKey] = $messageString;
} elseif ( !empty($messages) && array_key_exists($messageKey,$messages) ) {
} elseif (!empty($messages) && array_key_exists($messageKey, $messages)) {
$this->_messageTemplates[$messageKey] = $messages[$messageKey];
unset($messages[$messageKey]);
}
@ -111,24 +113,25 @@ class Scores_Validate_IpInNetwork extends Zend_Validate_Ip
* (non-PHPdoc)
* @see Zend_Validate_Ip::isValid()
*/
public function isValid($value) {
if ( true === parent::isValid($value) ) {
public function isValid($value)
{
if (true === parent::isValid($value)) {
$notation = $this->_getNotation();
if ( !empty($notation) ) {
if (!empty($notation)) {
// a valid notation has been set
$network = $this->_getNetwork();
if ( !empty($network) ) {
if ( true === $this->_validateIpInNetwork($value) ) {
if (!empty($network)) {
if (true === $this->_validateIpInNetwork($value)) {
return true;
}
} else {
if ( true === $this->_validateIpInRange($value) ) {
if (true === $this->_validateIpInRange($value)) {
return true;
}
}
// NOTE: Errors are only available in regards to the value (ip address) and not the network/netmask (notation)
$errors = $this->getErrors();
if ( empty($errors) ) {
if (empty($errors)) {
$this->_error(self::NOT_IN_NETWORK);
}
} else {
@ -150,14 +153,15 @@ class Scores_Validate_IpInNetwork extends Zend_Validate_Ip
* @param string $ip
* @return bool
*/
protected function _validateIpInNetwork($ip) {
protected function _validateIpInNetwork($ip)
{
$netmask = $this->getCidr();
$network = $this->_getNetwork();
// lets get this out of the way first
if ( 32 === $netmask ) {
if (32 === $netmask) {
// this network has to match the IP
if ( $network === $ip ) {
if ($network === $ip) {
return true;
} else {
$this->_error(self::NOT_IN_NETWORK);
@ -170,7 +174,7 @@ class Scores_Validate_IpInNetwork extends Zend_Validate_Ip
$lNetwork_uDec = $this->_makeUnsignedAddress($network);
// let verify the IP against the lower end of the range
if ( $ip_addr_uDec < $lNetwork_uDec ) {
if ($ip_addr_uDec < $lNetwork_uDec) {
// the ip is below the network range
$this->_error(self::LOW_IN_NETWORK);
return false;
@ -183,7 +187,7 @@ class Scores_Validate_IpInNetwork extends Zend_Validate_Ip
$netmask_uDec = pow(2, 32-$netmask) - 1 ;
$uNetwork_uDec = $lNetwork_uDec + $netmask_uDec;
if ( $ip_addr_uDec > $uNetwork_uDec ) {
if ($ip_addr_uDec > $uNetwork_uDec) {
// the ip is above the network range
$this->_error(self::HIGH_IN_NETWORK);
return false;
@ -203,17 +207,18 @@ class Scores_Validate_IpInNetwork extends Zend_Validate_Ip
* @param string $ip
* @return bool
*/
protected function _validateIpInRange($ip) {
protected function _validateIpInRange($ip)
{
$uInt_Ip = $this->_makeUnsignedAddress($ip);
if ( is_numeric($this->_rangeFrom) && $uInt_Ip >= $this->_rangeFrom ) {
if ( $uInt_Ip <= $this->_rangeTo ) {
if (is_numeric($this->_rangeFrom) && $uInt_Ip >= $this->_rangeFrom) {
if ($uInt_Ip <= $this->_rangeTo) {
return true;
} elseif ( is_numeric($this->_rangeTo) ) {
} elseif (is_numeric($this->_rangeTo)) {
$this->_error(self::HIGH_IN_NETWORK);
return false;
}
} elseif ( is_numeric($this->_rangeFrom) ) {
} elseif (is_numeric($this->_rangeFrom)) {
$this->_error(self::LOW_IN_NETWORK);
return false;
}
@ -234,12 +239,13 @@ class Scores_Validate_IpInNetwork extends Zend_Validate_Ip
* string $notation network/address (128.0.0.0/24) (128.0.0.0/255.255.255.0) or (128.0.0.0-128.0.0.255)
* @return object|false Awd_Validate_IpInNetwork
*/
public function setNetworkNotation($notation) {
public function setNetworkNotation($notation)
{
$network = false !== strpos($notation, '/') ? $this->_evaluateNetmask($notation) : false ;
if ( false !== $network) {
if (false !== $network) {
// a valid CIDR/netmask has been found
if ( true === parent::isValid($network) ) {
if ( $this->_validateNetwork($network) ) {
if (true === parent::isValid($network)) {
if ($this->_validateNetwork($network)) {
$this->_network = $network;
$this->_notation = $notation;
@ -248,9 +254,9 @@ class Scores_Validate_IpInNetwork extends Zend_Validate_Ip
} else {
$this->_invalidNetwork(__LINE__);
}
} elseif ( false !== strpos($notation, '-') ) {
} elseif (false !== strpos($notation, '-')) {
// the notation is looking like a from-to IP range
if ( true === $this->_validateRange($notation) ) {
if (true === $this->_validateRange($notation)) {
$this->_notation = $notation;
return $this;
@ -272,10 +278,11 @@ class Scores_Validate_IpInNetwork extends Zend_Validate_Ip
* bool $throw
* @return object Awd_Validate_IpInNetwork
*/
public function setThrow4Notation($throw = false) {
if ( !is_bool($throw) ) {
public function setThrow4Notation($throw = false)
{
if (!is_bool($throw)) {
$msg = '[AWD] Programming error: The argument is not a boolean value';
trigger_error($msg,E_USER_WARNING);
trigger_error($msg, E_USER_WARNING);
}
@ -293,7 +300,8 @@ class Scores_Validate_IpInNetwork extends Zend_Validate_Ip
* an error was found in the submitted network notation. The default is false.</p>
* @return bool
*/
public function getThrow4Notation() {
public function getThrow4Notation()
{
return (bool) $this->_throw;
}
@ -307,7 +315,8 @@ class Scores_Validate_IpInNetwork extends Zend_Validate_Ip
* verify if setting a network range or notation was successful with the constructor.</p>
* @return string
*/
public function getNetworkNotation() {
public function getNetworkNotation()
{
return (string) $this->_getNotation();
}
@ -323,7 +332,8 @@ class Scores_Validate_IpInNetwork extends Zend_Validate_Ip
* (protected) the same result as the public method getNetworkNotation().</p>
* @return string|null
*/
protected function _getNotation() {
protected function _getNotation()
{
return empty($this->_notation) ? null : (string) $this->_notation ;
}
@ -338,7 +348,8 @@ class Scores_Validate_IpInNetwork extends Zend_Validate_Ip
* network range has been set this value will be empty.</p>
* @return string
*/
protected function _getNetwork() {
protected function _getNetwork()
{
return (string) $this->_network;
}
@ -352,7 +363,8 @@ class Scores_Validate_IpInNetwork extends Zend_Validate_Ip
* network/CIDR. If the notation was not valid or a network range has been set this value will be empty.</p>
* @return int
*/
public function getCidr() {
public function getCidr()
{
return (int) $this->_cidr;
}
@ -370,30 +382,31 @@ class Scores_Validate_IpInNetwork extends Zend_Validate_Ip
* @param string $notation
* @return string|bool (false)
*/
protected function _evaluateNetmask($notation) {
protected function _evaluateNetmask($notation)
{
// split the notation in network and netmask information
list($network, $netmask) = explode('/', $notation, 2);
if ( is_numeric($netmask) ) {
if (is_numeric($netmask)) {
// does look like a CIDR netmask
$between = new Zend_Validate_Between(array('min'=>1,'max'=>32));
if ( true === $between->isValid($netmask) ) {
$between = new Zend_Validate_Between(array('min'=>1, 'max'=>32));
if (true === $between->isValid($netmask)) {
$this->_cidr = (int) $netmask;
return $network;
} else {
$error_msgs = $between->getMessages();
if ( !empty($error_msgs) && is_array($error_msgs) ) {
if (!empty($error_msgs) && is_array($error_msgs)) {
$msg = array_shift($error_msgs);
} else {
// fallback, should not really be an option
$msg = sprintf('The netmask [ %s ] is not a valid option',$netmask);
$msg = sprintf('The netmask [ %s ] is not a valid option', $netmask);
}
// oops, this CIDR is not a valid range
return $this->_invalidNetwork(__LINE__.' - '.$msg);
}
} elseif ( !empty($netmask) ) {
} elseif (!empty($netmask)) {
// looks more like 32-bit (like 255.255.255.0) format
if ( true === ($line = $this->_validateNetmask($netmask)) ) {
if (true === ($line = $this->_validateNetmask($netmask))) {
return $network;
}
@ -416,17 +429,19 @@ class Scores_Validate_IpInNetwork extends Zend_Validate_Ip
* @param string $netmask
* @return true|string
*/
protected function _validateNetmask($netmask) {
protected function _validateNetmask($netmask)
{
$classes = explode('.', $netmask);
if ( 4 !== count($classes) ) {
if (4 !== count($classes)) {
return __LINE__;
}
$cidr = 0; $end = false;
foreach ( $classes as $index => $segment ) {
if ( !is_numeric($segment) ) {
$cidr = 0;
$end = false;
foreach ($classes as $index => $segment) {
if (!is_numeric($segment)) {
return __LINE__;
} elseif ( 0 === (int) $segment ) {
} elseif (0 === (int) $segment) {
$end = true; // all following segment have to be 0 (zero) as well
continue;
}
@ -434,19 +449,21 @@ class Scores_Validate_IpInNetwork extends Zend_Validate_Ip
// evaluate the binary representation of the segment
$bin = decbin($segment);
if ( 8 !== strlen($bin) || 0 === preg_match('/^([1]{1,8})([0]*)$/', decbin($segment), $matches) ) {
if ( 8 !== strlen($bin) ) {
if (8 !== strlen($bin) || 0 === preg_match('/^([1]{1,8})([0]*)$/', decbin($segment), $matches)) {
if (8 !== strlen($bin)) {
// this segment is not a complete byte (8 bits) i.e. a value below 128
return __LINE__.':'.++$index; // NOTE: Index begins at 0 (zero)
}
// this segment is a complete byte (8 bits), i.e. a value above 128, but not a valid binary mask (like 11110000)
return __LINE__.':'.++$index; // NOTE: Index begins at 0 (zero)
} elseif ( true === $end ) {
} elseif (true === $end) {
// a mask was found in the previous segment; therefore, this segment should be 0 (zero)
return __LINE__.':'.++$index; // NOTE: Index begins at 0 (zero)
}
$len = strlen($matches[1]);
if ( $len < 8 ) { $end = true; }
if ($len < 8) {
$end = true;
}
$cidr += $len;
}
@ -468,12 +485,13 @@ class Scores_Validate_IpInNetwork extends Zend_Validate_Ip
* @param string $network
* @return true|string
*/
protected function _validateNetwork($network) {
protected function _validateNetwork($network)
{
$cidr = $this->getCidr();
$class = $cidr / 8;
// an integer indicates a classful (unicast) network
if ( is_int($class) ) {
if (is_int($class)) {
$iClass = $class;
$maskBits = 0;
} else {
@ -492,18 +510,18 @@ class Scores_Validate_IpInNetwork extends Zend_Validate_Ip
for ($index = $iClass; $index < 4; $index++) {
$subNetwork = (int) $segments[$index];
if ( 0 === $maskBits ) {
if (0 === $maskBits) {
// this class has no subnets (aka classful network)
// all 0 (zero) are expected as (sub)network numbers
if ( 0 !== $subNetwork ) {
if (0 !== $subNetwork) {
return $this->_invalidNetwork(__LINE__.':'.++$index); // NOTE: Index begins at 0 (zero)
}
continue;
} else {
// this class has subnets (aka a classless (subnetted) network)
if ( true === $complete ) {
if (true === $complete) {
// for all following networks 0 (zero) is expected as (sub)network number
if ( 0 !== $subNetwork ) {
if (0 !== $subNetwork) {
return $this->_invalidNetwork(__LINE__.':'.++$index); // NOTE: Index begins at 0 (zero)
}
continue;
@ -512,7 +530,7 @@ class Scores_Validate_IpInNetwork extends Zend_Validate_Ip
// the (sub)network must be a fact or hosts(/subnets)
$block = $subNetwork / $hosts;
if ( is_int($block) ) {
if (is_int($block)) {
// all clear
// NOTE: We do NOT return yet because we may have to verify any following segments
continue;
@ -536,14 +554,15 @@ class Scores_Validate_IpInNetwork extends Zend_Validate_Ip
* @param string $range
* @return bool
*/
protected function _validateRange($range) {
list($from,$to) = explode('-', $range); // Note: we do NOT care if more IP ranges have been set, i.e. the range would be invalid
protected function _validateRange($range)
{
list($from, $to) = explode('-', $range); // Note: we do NOT care if more IP ranges have been set, i.e. the range would be invalid
if ( false === ($uInt_from = $this->_makeUnsignedAddress($from)) || false === ($uInt_to = $this->_makeUnsignedAddress($to)) ) {
if (false === ($uInt_from = $this->_makeUnsignedAddress($from)) || false === ($uInt_to = $this->_makeUnsignedAddress($to))) {
return $this->_invalidNetwork(__LINE__); // at least one of the addresses is not a valid IP address
}
if ( $uInt_from <= $uInt_to ) {
if ($uInt_from <= $uInt_to) {
$this->_rangeFrom = $uInt_from;
$this->_rangeTo = $uInt_to;
} else {
@ -567,8 +586,9 @@ class Scores_Validate_IpInNetwork extends Zend_Validate_Ip
* @param string $ip
* @return string
*/
private function _makeUnsignedAddress($ip) {
if ( false === ($ip_addr_long = ip2long($ip)) ) {
private function _makeUnsignedAddress($ip)
{
if (false === ($ip_addr_long = ip2long($ip))) {
// not a valid IP address
return false;
}
@ -581,7 +601,7 @@ class Scores_Validate_IpInNetwork extends Zend_Validate_Ip
// 128.0.0.0 = -2147483648
// convert to unsigned decimal number
return sprintf('%u',$ip_addr_long);
return sprintf('%u', $ip_addr_long);
}
/**
@ -597,18 +617,16 @@ class Scores_Validate_IpInNetwork extends Zend_Validate_Ip
* @param string|int $line
* @return bool (false)
*/
private function _invalidNetwork($line) {
private function _invalidNetwork($line)
{
$error_msg = 'The provided network information is not a recognized format [#'.$line.']';
$this->_error(self::INVALID_NETWORK,$error_msg);
$this->_error(self::INVALID_NETWORK, $error_msg);
$msg = '[SCORES] Application error: '.$error_msg;
if ( false === $this->_throw ) {
trigger_error($msg,E_USER_WARNING);
if (false === $this->_throw) {
trigger_error($msg, E_USER_WARNING);
return false;
} else {
throw new Exception($msg);
}
}
}

View File

@ -1,92 +1,84 @@
<?php
class Scores_Ws_Discover
{
protected $serviceWsdl = null;
protected $serviceOptions = array();
protected $serviceStructure = array();
protected $serviceStructureTypes = array();
protected $serviceTypes;
protected $serviceFunctions;
protected $serviceWsdl = null;
protected $serviceOptions = array();
protected $serviceStructure = array();
protected $serviceStructureTypes = array();
protected $serviceTypes;
protected $serviceFunctions;
public function __construct($wsdl, $options = array())
{
$this->serviceWsdl = $wsdl;
$this->serviceOptions = $options;
$this->setStructure();
}
public function __construct($wsdl, $options = array())
{
$this->serviceWsdl = $wsdl;
$this->serviceOptions = $options;
$this->setStructure();
}
public function getStructure()
{
return $this->serviceStructure;
}
public function getStructure()
{
return $this->serviceStructure;
}
public function getStructureParam()
{
return $this->serviceStructureTypes;
}
public function getStructureParam()
{
return $this->serviceStructureTypes;
}
protected function setStructure()
{
$client = new Zend_Soap_Client(
$this->serviceWsdl,
$this->serviceOptions
);
$this->serviceFunctions = $client->getFunctions();
$this->serviceTypes = $client->getTypes();
protected function setStructure()
{
$client = new Zend_Soap_Client(
$this->serviceWsdl,
$this->serviceOptions
);
$this->serviceFunctions = $client->getFunctions();
$this->serviceTypes = $client->getTypes();
foreach($this->serviceFunctions as $func)
{
$this->setFunction($func);
}
foreach ($this->serviceFunctions as $func) {
$this->setFunction($func);
}
foreach($this->serviceTypes as $type){
$this->setType($type);
}
}
foreach ($this->serviceTypes as $type) {
$this->setType($type);
}
}
protected function setFunction($func)
{
if (preg_match('/[^\s]+\s([^\s]+)\((.*)\)/', $func, $matches))
{
$funcName = $matches[1];
$funcParams = $matches[2];
$this->serviceStructure[$funcName] = array();
if (preg_match_all('/([^\s]+)\s([^\s]+),?/', $funcParams, $mParams))
{
$nbParams = count($mParams[0]);
for($i=0;$i<$nbParams;$i++)
{
$type = $mParams[1][$i];
$name = $mParams[2][$i];
$this->serviceStructure[$funcName][$i] = array(
'name' => $name,
'type' => $type
);
}
}
}
}
protected function setType($type)
{
$type = str_replace("\n", '', $type);
if (preg_match('/struct\s([^\s]+)\s\{(.*)\}$/m', $type, $matches))
{
$struct = trim($matches[1]);
$params = trim($matches[2]);
preg_match_all('/([^\s]+)\s([^\s]+);/', $params, $paramsMatches);
$nbParams = count($paramsMatches[0]);
$this->serviceStructureTypes[$struct] = array();
for($i=0; $i<$nbParams;$i++)
{
$this->serviceStructureTypes[$struct][$i] = array(
'name' => $paramsMatches[2][$i],
'type' => $paramsMatches[1][$i],
);
}
}
}
protected function setFunction($func)
{
if (preg_match('/[^\s]+\s([^\s]+)\((.*)\)/', $func, $matches)) {
$funcName = $matches[1];
$funcParams = $matches[2];
$this->serviceStructure[$funcName] = array();
if (preg_match_all('/([^\s]+)\s([^\s]+),?/', $funcParams, $mParams)) {
$nbParams = count($mParams[0]);
for ($i=0;$i<$nbParams;$i++) {
$type = $mParams[1][$i];
$name = $mParams[2][$i];
$this->serviceStructure[$funcName][$i] = array(
'name' => $name,
'type' => $type
);
}
}
}
}
protected function setType($type)
{
$type = str_replace("\n", '', $type);
if (preg_match('/struct\s([^\s]+)\s\{(.*)\}$/m', $type, $matches)) {
$struct = trim($matches[1]);
$params = trim($matches[2]);
preg_match_all('/([^\s]+)\s([^\s]+);/', $params, $paramsMatches);
$nbParams = count($paramsMatches[0]);
$this->serviceStructureTypes[$struct] = array();
for ($i=0; $i<$nbParams;$i++) {
$this->serviceStructureTypes[$struct][$i] = array(
'name' => $paramsMatches[2][$i],
'type' => $paramsMatches[1][$i],
);
}
}
}
}

View File

@ -1,187 +1,181 @@
<?php
class Scores_Ws_Doc
{
private $serviceClass;
private $serviceClass;
private $classmap = array();
private $classmap = array();
private $serviceMethods = array();
private $serviceMethods = array();
private $serviceTypes = array();
private $serviceTypes = array();
public function __construct($serviceClass = null, $classmap = null, $path)
{
$this->serviceClass = $serviceClass;
$this->classmap = $classmap;
require_once $path . 'Service.php';
$this->parseService();
$this->parseTypes();
}
public function __construct($serviceClass = null, $classmap = null, $path)
{
$this->serviceClass = $serviceClass;
$this->classmap = $classmap;
require_once $path . 'Service.php';
$this->parseService();
$this->parseTypes();
}
/**
* Retourne la liste des services et leurs paramètres
* @return array
*/
public function getServiceMethods()
{
return $this->serviceMethods;
}
/**
* Retourne la liste des services et leurs paramètres
* @return array
*/
public function getServiceMethods()
{
return $this->serviceMethods;
}
/**
* Retourne la liste des types de données et leurs paramètres
* @return array
*/
public function getServiceTypes()
{
return $this->serviceTypes;
}
/**
* Retourne la liste des types de données et leurs paramètres
* @return array
*/
public function getServiceTypes()
{
return $this->serviceTypes;
}
private function parseService()
{
$class = new Zend_Server_Reflection();
$methods = $class->reflectClass($this->serviceClass)
->getMethods();
$methodsElement = array();
foreach ($methods as $method) {
private function parseService()
{
$class = new Zend_Server_Reflection();
$methods = $class->reflectClass($this->serviceClass)
->getMethods();
$methodsElement = array();
foreach ($methods as $method) {
$prototype = null;
$maxNumArgumentsOfPrototype = -1;
foreach ($method->getPrototypes() as $tmpPrototype) {
$numParams = count($tmpPrototype->getParameters());
if ($numParams > $maxNumArgumentsOfPrototype) {
$maxNumArgumentsOfPrototype = $numParams;
$prototype = $tmpPrototype;
}
}
$prototype = null;
$maxNumArgumentsOfPrototype = -1;
foreach ($method->getPrototypes() as $tmpPrototype) {
$numParams = count($tmpPrototype->getParameters());
if ($numParams > $maxNumArgumentsOfPrototype) {
$maxNumArgumentsOfPrototype = $numParams;
$prototype = $tmpPrototype;
}
}
$paramsElement = array();
foreach ($prototype->getParameters() as $param) {
$paramElement = array(
'type' => $param->getType(),
'name' => $param->getName(),
'description' => $param->getDescription(),
$paramsElement = array();
foreach ($prototype->getParameters() as $param) {
$paramElement = array(
'type' => $param->getType(),
'name' => $param->getName(),
'description' => $param->getDescription(),
);
if ($param->isOptional()) {
$paramElement['optional'] = $param->isOptional();
$paramElement['defaultValue'] = $param->getDefaultValue();
}
$paramsElement[] = $paramElement;
}
);
if ($param->isOptional()){
$paramElement['optional'] = $param->isOptional();
$paramElement['defaultValue'] = $param->getDefaultValue();
}
$paramsElement[] = $paramElement;
}
$methodElement = array(
'name' => $method->getName(),
'desc' => $method->getDescription(),
'params' => $paramsElement,
'return' => $prototype->getReturnType(),
);
$methodElement = array(
'name' => $method->getName(),
'desc' => $method->getDescription(),
'params' => $paramsElement,
'return' => $prototype->getReturnType(),
);
$methodsElement[] = $methodElement;
}
$this->serviceMethods = $methodsElement;
}
$methodsElement[] = $methodElement;
}
$this->serviceMethods = $methodsElement;
}
private function parseTypes()
{
$typesElement = array();
if (count($this->classmap)>0) {
foreach ($this->classmap as $className) {
$class = new ReflectionClass($className);
$paramsElement = array();
foreach ($class->getProperties() as $property) {
if ($property->isPublic() && preg_match_all('/@var\s+([^\s]+)/m', $property->getDocComment(), $matches)) {
$name = $property->getName();
$type = $matches[1][0];
private function parseTypes()
{
$typesElement = array();
if (count($this->classmap)>0)
{
foreach ($this->classmap as $className)
{
$class = new ReflectionClass($className);
$paramsElement = array();
foreach ($class->getProperties() as $property) {
if ($property->isPublic() && preg_match_all('/@var\s+([^\s]+)/m', $property->getDocComment(), $matches)) {
/**
* Traitement éléments de documentation à placer dans le WSDL
* Supprime les retours chariots.
* Récupére les éléments de documentation
*/
$comment = '';
$docBlock = preg_replace('/\n/', '', $property->getDocComment());
if (preg_match('/\/\*\*(.+) \* @var\s+[^\s]+\s+(?:\*|@)/m', $docBlock, $docBlockMatches)) {
$comment.= preg_replace(
array('/\r/', '/\*/' ),
array('', ''), $docBlockMatches[1]
);
}
$name = $property->getName();
$type = $matches[1][0];
/**
* Traitement éléments de documentation à placer dans le WSDL
* Supprime les retours chariots.
* Récupére les éléments de documentation
*/
$comment = '';
$docBlock = preg_replace('/\n/', '', $property->getDocComment() );
if (preg_match('/\/\*\*(.+) \* @var\s+[^\s]+\s+(?:\*|@)/m', $docBlock, $docBlockMatches)) {
$comment.= preg_replace(
array('/\r/', '/\*/' ),
array('' , ''), $docBlockMatches[1]
);
}
/**
* Traitement des @xsd (Provisoire)
* Définition des longueurs dans la documentation
* @xsd minLength=[\d]+ => (Longueur min = [\d]+)
* @xsd maxLength=[\d]+ => (Longueur max = [\d]+)
* @xsd enumeration=element,element
*/
if (preg_match_all('/@xsd\s+(minLength|maxLength)=([\d]+)\s+(?:\*|@)/m', $property->getDocComment(), $resMatches, PREG_SET_ORDER)){
$comment.= '(';
$parcourCpt = 0;
foreach ($resMatches as $res ) {
switch ($res[1]){
case 'minLength':
$comment.= 'Longueur min = '.$res[2];
break;
case 'maxLength':
$comment.= 'Longueur max = '.$res[2];
break;
}
$parcourCpt++;
if ($parcourCpt>0 && $parcourCpt<count($resMatches)) {
$comment.= ', ';
}
}
$comment.= ')';
}
/**
* Traitement des références
* @ref fichier:titre:nom_du_fichier
* => http://vhost/ref/fichier/
* @ref mysql:titre:requete.sql
* => http://vhost/ref/table/
*/
if (preg_match_all('/@ref\s+(fichier|mysql):(.*):(.*)\.(?:csv|sql)\s+(?:\*|@)/m', $property->getDocComment(), $refMatches, PREG_SET_ORDER)){
$view = new Zend_View();
$comment.= ', Référence(s) : ';
foreach ($refMatches as $ref){
switch ($ref[1]){
case 'fichier':
$urlFichier = $view->url(array(
'controller' => 'ref',
'action' => 'fichier',
'q' => $ref[3],
), null, true);
$comment.= '<a href="'.$urlFichier.'">'.$ref[2].'</a>';
break;
case 'mysql':
$urlMysql = $view->url(array(
'controller' => 'ref',
'action' => 'table',
'q' => $ref[3],
), null, true);
$comment.= '<a href="'.$urlMysql.'">'.$ref[2].'</a>';
break;
}
$comment.= ', ';
}
}
$paramElement = array(
'name' => $name,
'type' => $type,
'description' => trim($comment)
);
}
$paramsElement[] = $paramElement;
}
$typesElement[$className] = $paramsElement;
}
$this->serviceTypes = $typesElement;
}
}
/**
* Traitement des @xsd (Provisoire)
* Définition des longueurs dans la documentation
* @xsd minLength=[\d]+ => (Longueur min = [\d]+)
* @xsd maxLength=[\d]+ => (Longueur max = [\d]+)
* @xsd enumeration=element,element
*/
if (preg_match_all('/@xsd\s+(minLength|maxLength)=([\d]+)\s+(?:\*|@)/m', $property->getDocComment(), $resMatches, PREG_SET_ORDER)) {
$comment.= '(';
$parcourCpt = 0;
foreach ($resMatches as $res) {
switch ($res[1]) {
case 'minLength':
$comment.= 'Longueur min = '.$res[2];
break;
case 'maxLength':
$comment.= 'Longueur max = '.$res[2];
break;
}
$parcourCpt++;
if ($parcourCpt>0 && $parcourCpt<count($resMatches)) {
$comment.= ', ';
}
}
$comment.= ')';
}
/**
* Traitement des références
* @ref fichier:titre:nom_du_fichier
* => http://vhost/ref/fichier/
* @ref mysql:titre:requete.sql
* => http://vhost/ref/table/
*/
if (preg_match_all('/@ref\s+(fichier|mysql):(.*):(.*)\.(?:csv|sql)\s+(?:\*|@)/m', $property->getDocComment(), $refMatches, PREG_SET_ORDER)) {
$view = new Zend_View();
$comment.= ', Référence(s) : ';
foreach ($refMatches as $ref) {
switch ($ref[1]) {
case 'fichier':
$urlFichier = $view->url(array(
'controller' => 'ref',
'action' => 'fichier',
'q' => $ref[3],
), null, true);
$comment.= '<a href="'.$urlFichier.'">'.$ref[2].'</a>';
break;
case 'mysql':
$urlMysql = $view->url(array(
'controller' => 'ref',
'action' => 'table',
'q' => $ref[3],
), null, true);
$comment.= '<a href="'.$urlMysql.'">'.$ref[2].'</a>';
break;
}
$comment.= ', ';
}
}
$paramElement = array(
'name' => $name,
'type' => $type,
'description' => trim($comment)
);
}
$paramsElement[] = $paramElement;
}
$typesElement[$className] = $paramsElement;
}
$this->serviceTypes = $typesElement;
}
}
}

View File

@ -1,2 +1,4 @@
<?php
class Scores_Ws_Exception extends Zend_Exception {}
class Scores_Ws_Exception extends Zend_Exception
{
}

View File

@ -1,24 +1,23 @@
<?php
class Scores_Ws_Form_GetIdentite extends Zend_Form
{
public function init()
{
$this->setName('soapform');
$this->setAction('/demo/requete');
$this->setMethod('post');
$this->addElement('text', 'siret', array(
'filters' => array('StringTrim'),
'validators' => array(
array('stringLength',false,array(9,14)),
array('NotEmpty', true),
),
'label' => 'Siret : ',
'required' => 'true',
)
);
$this->addElement('submit', 'submit', array(
'label' => 'Envoyez',
));
}
}
public function init()
{
$this->setName('soapform');
$this->setAction('/demo/requete');
$this->setMethod('post');
$this->addElement('text', 'siret', array(
'filters' => array('StringTrim'),
'validators' => array(
array('stringLength', false, array(9, 14)),
array('NotEmpty', true),
),
'label' => 'Siret : ',
'required' => 'true',
)
);
$this->addElement('submit', 'submit', array(
'label' => 'Envoyez',
));
}
}

File diff suppressed because it is too large Load Diff

View File

@ -17,7 +17,7 @@ class Scores_Ws_Trigger
*/
protected function hasTrigger()
{
if ( $this->userInfos['Service'] === null ) {
if ($this->userInfos['Service'] === null) {
$service = 'default';
}
@ -28,8 +28,8 @@ class Scores_Ws_Trigger
->where('service=?', $service)
->where('login=? OR login=""', $login);
$result = $model->fetchAll($sql);
if ( count($result)>0 ) {
foreach ( $result as $item ) {
if (count($result)>0) {
foreach ($result as $item) {
$tmp->action = $item->action;
$tmp->params = json_decode($item->actionParams, true);
}
@ -45,15 +45,15 @@ class Scores_Ws_Trigger
*/
protected function executeAllTrigger($args)
{
if ( count($this->events)>0 ) {
foreach ( $this->events as $action ) {
$args = array_merge($args, $action->params);
switch ( $action->action ) {
case 'surveillance':
return $this->surveillance($args);
break;
}
}
if (count($this->events)>0) {
foreach ($this->events as $action) {
$args = array_merge($args, $action->params);
switch ($action->action) {
case 'surveillance':
return $this->surveillance($args);
break;
}
}
}
}
@ -65,48 +65,47 @@ class Scores_Ws_Trigger
*/
protected function surveillance($args)
{
if ( !array_key_exists('source', $args) ) {
if (!array_key_exists('source', $args)) {
return false;
}
if ( !array_key_exists('siren', $args) ) {
if (!array_key_exists('siren', $args)) {
return false;
}
if ( !array_key_exists('nic', $args) ) {
if (!array_key_exists('nic', $args)) {
return false;
}
if ( empty(trim($this->userInfos['email'])) ) {
if (empty(trim($this->userInfos['email']))) {
return false;
}
if ( array_key_exists('ref', $args)) {
$ref = $args['ref'];
if (array_key_exists('ref', $args)) {
$ref = $args['ref'];
}
try {
$model = new Application_Model_JoSurveillancesSite();
$data = array(
'source' => $args['source'],
'login' => $this->userInfos['login'],
'email' => $this->userInfos['email'],
'siren' => $args['siren'],
'nic' => $args['nic'],
'ref' => $ref,
'encoursClient' => 0,
'rs' => $args['Nom'],
'cp' => $args['CP'],
'ville' => $args['Ville'],
'dateAjout' => date('Y-m-d'),
'dateSuppr' => 0,
);
'source' => $args['source'],
'login' => $this->userInfos['login'],
'email' => $this->userInfos['email'],
'siren' => $args['siren'],
'nic' => $args['nic'],
'ref' => $ref,
'encoursClient' => 0,
'rs' => $args['Nom'],
'cp' => $args['CP'],
'ville' => $args['Ville'],
'dateAjout' => date('Y-m-d'),
'dateSuppr' => 0,
);
$model->insert($data);
return true;
} catch (Zend_Db_Exception $e) {
}
return false;
}
}
}