Library Update

This commit is contained in:
Michael RICOIS 2017-01-23 16:23:03 +01:00
parent 87c283fd2d
commit 7abb183e7a
16 changed files with 562 additions and 413 deletions

View File

@ -2001,7 +2001,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
} }
// Géocodage de l'adresse // Géocodage de l'adresse
$mMap = new Metier_Partenaires_MMap(false, $this->iDb); $mMap = new Metier_Partenaires_MMap();
$mMap->geoCodeAdresse($etab['adr_num'], '', $etab['adr_typeVoie'], $this->getCodeVoie($etab['adr_typeVoie']), $mMap->geoCodeAdresse($etab['adr_num'], '', $etab['adr_typeVoie'], $this->getCodeVoie($etab['adr_typeVoie']),
$etab['adr_libVoie'], $etab['adr_cp'], $etab['adr_ville'], 'France', $etab['adr_libVoie'], $etab['adr_cp'], $etab['adr_ville'], 'France',
trim($tabInsee['ADR_DEP'].$tabInsee['ADR_COM'].$tabInsee['CODEVOIE'])); trim($tabInsee['ADR_DEP'].$tabInsee['ADR_COM'].$tabInsee['CODEVOIE']));
@ -2019,7 +2019,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
$tdeb = microtime(1); $tdeb = microtime(1);
} }
$iAmabis = new Metier_Partenaires_MAmabis($this->iDb); $iAmabis = new Metier_Partenaires_MAmabis();
$repAmabis = $iAmabis->getZonage($etab['adr_num'], $etab['adr_btq'], $etab['adr_typeVoie'], $etab['adr_libVoie'], $repAmabis = $iAmabis->getZonage($etab['adr_num'], $etab['adr_btq'], $etab['adr_typeVoie'], $etab['adr_libVoie'],
$etab['adr_cp'], $etab['adr_ville'], trim($tabInsee['ADR_DEP'].$tabInsee['ADR_COM'].$tabInsee['CODEVOIE']), $etab['adr_cp'], $etab['adr_ville'], trim($tabInsee['ADR_DEP'].$tabInsee['ADR_COM'].$tabInsee['CODEVOIE']),
false, 'TEST', false); false, 'TEST', false);
@ -3494,7 +3494,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
} }
// Recherche des infos boursières // Recherche des infos boursières
$iBourse = new Metier_Partenaires_MBourse($siren, $this->iDb); $iBourse = new Metier_Partenaires_MBourse();
$bourse = $iBourse->getInfosBourse($siren); $bourse = $iBourse->getInfosBourse($siren);
$tabRet['Bourse'] = array( $tabRet['Bourse'] = array(
'placeCotation' => $bourse['placeCotation'], 'placeCotation' => $bourse['placeCotation'],

View File

@ -5,23 +5,24 @@ ini_set('default_socket_timeout', 30);
class Metier_Partenaires_MAmabis class Metier_Partenaires_MAmabis
{ {
protected $client; protected $client;
protected $iDb;
public function __construct($db = null) /**
* PDO Connection with Doctrine
* @var \Doctrine\DBAL\Connection
*/
protected $conn;
public function __construct()
{ {
if ($db === null) { $this->conn = Zend_Registry::get('doctrine');
$this->iDb = new Metier_Util_Db();
} else {
$this->iDb = $db;
}
$this->client = new SoapClient(null, array( $this->client = new SoapClient(null, array(
'location' => 'http://sw2.amabis.com:5100/', 'location' => 'http://sw2.amabis.com:5100/',
'uri' => 'http://www.amabis.com/ns.xsd', 'uri' => 'http://www.amabis.com/ns.xsd',
'connection_timeout' => 2, 'connection_timeout' => 2,
'soap_version' => SOAP_1_1, 'soap_version' => SOAP_1_1,
'trace' => 1, 'trace' => 1,
'style' => SOAP_RPC, 'style' => SOAP_RPC,
'use' => SOAP_ENCODED, 'use' => SOAP_ENCODED,
)); ));
} }
@ -51,14 +52,16 @@ class Metier_Partenaires_MAmabis
$ville = addslashes($ville); $ville = addslashes($ville);
$majForcee = false; $majForcee = false;
$ret = $this->iDb->select( $sql = "SELECT zus, zru, zfu, cucs, rnvpStatut, rnvpCorr, rnvpTrt, adr3, adr4, adr5, adr6,
'jo.zonage', 'zus, zru, zfu, cucs, rnvpStatut, rnvpCorr, rnvpTrt, adr3, adr4, adr5, adr6, adr7, numVoieA, indRepA, adr7, numVoieA, indRepA, typeVoieAlong, typeVoieAcourt, corpVoie, motDir, motDirD,
typeVoieAlong, typeVoieAcourt, corpVoie, motDir, motDirD, libVoieSec, adr4n32, adr4n38, clePostaleVoie, libVoieSec, adr4n32, adr4n38, clePostaleVoie, secteur, cleRoutage, cpx, cleAd,
secteur, cleRoutage, cpx, cleAd, codPaysIso2, codPaysIso3, libPays, codeInsee', codPaysIso2, codPaysIso3, libPays, codeInsee
"address='$adresse' AND adr_cp='$cp' AND adr_ville='$ville'", false, MYSQL_ASSOC); FROM jo.zonage WHERE address='$adresse' AND adr_cp='$cp' AND adr_ville='$ville'";
$stmt = $this->conn->prepare($sql);
$stmt->execute();
if (count($ret) > 0) { if ($stmt->rowCount() > 0) {
$zones = $ret[0]; $zones = $stmt->fetch(\PDO::FETCH_ASSOC);
if ($zones['rnvpStatut'] === null && $rnvp) { if ($zones['rnvpStatut'] === null && $rnvp) {
$majForcee = true; $majForcee = true;
} }
@ -110,7 +113,7 @@ class Metier_Partenaires_MAmabis
} }
} }
if (count($ret) == 0 || $majForcee) { if ($stmt->rowCount() == 0 || $majForcee) {
try { try {
// Le RNVP ne fonctionne pas sans la Raison Sociale qui est la 1ère ligne d'adresse // Le RNVP ne fonctionne pas sans la Raison Sociale qui est la 1ère ligne d'adresse
if (trim($raisonSociale) == '') { if (trim($raisonSociale) == '') {
@ -169,88 +172,99 @@ class Metier_Partenaires_MAmabis
if (strtoupper(@trim($tabZones['ADR7']))=='FRANCE') { if (strtoupper(@trim($tabZones['ADR7']))=='FRANCE') {
$tabZones['ADR7']=''; $tabZones['ADR7']='';
} }
$tabTmp=explode('|', $tabZones['VOIEA']); $tabTmp = explode('|', $tabZones['VOIEA']);
$typeVoieAcourt=@trim($tabTmp[1]); $typeVoieAcourt = @trim($tabTmp[1]);
$tabInsert=array( $tabInsert = array(
'address'=>$adresse, 'address' => $adresse,
'adr_cp'=>$cp, 'adr_cp' => $cp,
'adr_ville'=>$ville, 'adr_ville' => $ville,
'zus'=>@$tabRep['NZUS'], 'zus' => @$tabRep['NZUS'],
'zru'=>@$tabRep['NZRU'], 'zru' => @$tabRep['NZRU'],
'zfu'=>@$tabRep['NZFU'], 'zfu' => @$tabRep['NZFU'],
'cucs'=>@$tabRep['NCUCS'], 'cucs' => @$tabRep['NCUCS'],
); );
$tabUpdate=array( $tabUpdate=array(
'adrNum'=>$adrNum, 'adrNum' => $adrNum,
'adrIndRep'=>$adrIndRep, 'adrIndRep' => $adrIndRep,
'adrTypeVoie'=>$adrTypeVoie, 'adrTypeVoie' => $adrTypeVoie,
'adrLibVoie'=>$adrLibVoie, 'adrLibVoie' => $adrLibVoie,
'rivoli'=>$codeRivoli, 'rivoli' => $codeRivoli,
// Ajouté le 16/12/2013 // Ajouté le 16/12/2013
'rnvpStatut' => substr($tabZones['STATUTC'], 0, 2), 'rnvpStatut' => substr($tabZones['STATUTC'], 0, 2),
'rnvpCorr' => substr($tabZones['STATUTC'], 2, 1), 'rnvpCorr' => substr($tabZones['STATUTC'], 2, 1),
'rnvpTrt' => trim(substr($tabZones['STATUTC'], 3, 2)), 'rnvpTrt' => trim(substr($tabZones['STATUTC'], 3, 2)),
'adr3' => @trim($tabZones['ADR3']), 'adr3' => @trim($tabZones['ADR3']),
'adr4' => @trim($tabZones['ADR4']), 'adr4' => @trim($tabZones['ADR4']),
'adr5' => @trim($tabZones['ADR5']), 'adr5' => @trim($tabZones['ADR5']),
'adr6' => @trim($tabZones['ADR6']), 'adr6' => @trim($tabZones['ADR6']),
'adr7' => trim($tabZones['ADR7']), 'adr7' => trim($tabZones['ADR7']),
'numVoieA' => @trim($tabZones['NUM1']), 'numVoieA' => @trim($tabZones['NUM1']),
'indRepA' => @trim($tabZones['BTQC1']), 'indRepA' => @trim($tabZones['BTQC1']),
'typeVoieAlong' => @trim($tabZones['TYPVOIEL']), 'typeVoieAlong' => @trim($tabZones['TYPVOIEL']),
'typeVoieAcourt' => $typeVoieAcourt, 'typeVoieAcourt' => $typeVoieAcourt,
'corpVoie' => @trim($tabZones['CORPSVOIE']), 'corpVoie' => @trim($tabZones['CORPSVOIE']),
'motDir' => @trim($tabZones['MOTDIR']), 'motDir' => @trim($tabZones['MOTDIR']),
'motDirD' => @trim($tabZones['MOTDIRD']), 'motDirD' => @trim($tabZones['MOTDIRD']),
'libVoieSec' => @trim($tabZones['VOIREFLIBS']), 'libVoieSec' => @trim($tabZones['VOIREFLIBS']),
'adr4n32' => @trim($tabZones['VOIREFLIBPOS']), 'adr4n32' => @trim($tabZones['VOIREFLIBPOS']),
'adr4n38' => @trim($tabZones['VOIREFLIBPOS2']), 'adr4n38' => @trim($tabZones['VOIREFLIBPOS2']),
'clePostaleVoie' => @trim($tabZones['VOIREFCLEPOST']), 'clePostaleVoie' => @trim($tabZones['VOIREFCLEPOST']),
'secteur' => @trim($tabZones['SECTEUR']), 'secteur' => @trim($tabZones['SECTEUR']),
'cleRoutage' => @trim($tabZones['CLER']), 'cleRoutage' => @trim($tabZones['CLER']),
'cpx' => @trim($tabZones['CPX']), 'cpx' => @trim($tabZones['CPX']),
'cleAd' => @trim($tabZones['CLEAD']), 'cleAd' => @trim($tabZones['CLEAD']),
'codPaysIso2' => @trim($tabZones['NATREFISO2']), 'codPaysIso2' => @trim($tabZones['NATREFISO2']),
'codPaysIso3' => @trim($tabZones['NATREFISO3']), 'codPaysIso3' => @trim($tabZones['NATREFISO3']),
'libPays' => @trim($tabZones['NATREFLIB']), 'libPays' => @trim($tabZones['NATREFLIB']),
'codeInsee' => @trim($tabZones['LOCREFCLEO']), 'codeInsee' => @trim($tabZones['LOCREFCLEO']),
'source' => 'Amabis', 'source' => 'Amabis',
); );
$dateInsert=0; $dateInsert = 0;
if ($majForcee) { if ($majForcee) {
$adresseL=addslashes($adresse); $adresseL = addslashes($adresse);
$villeL=addslashes($ville); $villeL = addslashes($ville);
$sql = "SELECT dateInsert*1 as dateInsert FROM jo.zonage
$ret = $this->iDb->select('jo.zonage', 'dateInsert*1 as dateInsert', "address='$adresseL' AND adr_cp='$cp' AND adr_ville='$villeL'", false); WHERE address='$adresseL' AND adr_cp='$cp' AND adr_ville='$villeL'";
$dateInsert=@$ret[0]['dateInsert']*1; $stmt = $this->conn->prepare($sql);
$this->iDb->update('jo.zonage', array_merge($tabUpdate, array('dateInsert'=>$dateInsert)), "address='$adresseL' AND adr_cp='$cp' AND adr_ville='$villeL'", false); $stmt->execute();
//echo "Mise à jour de l'adresse du $dateInsert pour address='$adresseL' AND adr_cp='$cp' AND adr_ville='$villeL'".PHP_EOL; if ($stmt->rowCount() > 0) {
$result = $stmt->fetch(\PDO::FETCH_OBJ);
$dateInsert = $result->dateInsert;
if ($dateInsert != 0) {
$this->conn->update('jo.zonage', array_merge($tabUpdate,
array('dateInsert' => $dateInsert)),
array(
'address' => $adresseL,
'adr_cp' => $cp,
'adr_ville' => $villeL,
));
}
}
} }
if ($dateInsert==0) { if ($dateInsert == 0) {
$this->iDb->insert('jo.zonage', array_merge($tabInsert, $tabUpdate), false); $this->conn->insert('jo.zonage', array_merge($tabInsert, $tabUpdate));
//echo "Insertion de l'adresse (".$zones['rnvpStatut'].")!".PHP_EOL;
} }
$tabTmp[0]=explode(',', $tabZones['LOCREFCLEP']); $tabTmp[0] = explode(',', $tabZones['LOCREFCLEP']);
$tabTmp[1]=explode(',', $tabZones['LOCREFCP']); $tabTmp[1] = explode(',', $tabZones['LOCREFCP']);
$tabTmp[2]=explode(',', $tabZones['LOCREFTYPP']); $tabTmp[2] = explode(',', $tabZones['LOCREFTYPP']);
$tabTmp[3]=explode(',', $tabZones['LOCREFLIBD']); $tabTmp[3] = explode(',', $tabZones['LOCREFLIBD']);
$tabTmp[4]=explode(',', $tabZones['LOCREFLIBD2']); $tabTmp[4] = explode(',', $tabZones['LOCREFLIBD2']);
foreach ($tabTmp[0] as $iCleP=>$cleP) { foreach ($tabTmp[0] as $iCleP=>$cleP) {
$tabInsert = array( $tabInsert = array(
'codeInsee' => @trim($tabZones['LOCREFCLEO']), 'codeInsee' => @trim($tabZones['LOCREFCLEO']),
'villeLib' => @trim($tabZones['LOCREFLIBP']), 'villeLib' => @trim($tabZones['LOCREFLIBP']),
'villePopu' => @trim($tabZones['LOCREFPOP']), 'villePopu' => @trim($tabZones['LOCREFPOP']),
'cleAchPost'=> $cleP, 'cleAchPost' => $cleP,
'codePostal'=> $tabTmp[1][$iCleP], 'codePostal' => $tabTmp[1][$iCleP],
'typePostal'=> $tabTmp[2][$iCleP], 'typePostal' => $tabTmp[2][$iCleP],
'libAchP32' => @preg_replace('/^\//', '', $tabTmp[3][$iCleP]), 'libAchP32' => @preg_replace('/^\//', '', $tabTmp[3][$iCleP]),
'libAchP38' => @preg_replace('/^\//', '', $tabTmp[4][$iCleP]), 'libAchP38' => @preg_replace('/^\//', '', $tabTmp[4][$iCleP]),
'source' => 'Amabis', 'source' => 'Amabis',
'dateInsert'=> date('YmdHis'), 'dateInsert' => date('YmdHis'),
); );
$this->iDb->insert('jo.villesCP', $tabInsert, false); $this->conn->insert('jo.villesCP', $tabInsert);
} }
/** Autres Informations de la RNVP **/ /** Autres Informations de la RNVP **/
@ -266,19 +280,30 @@ class Metier_Partenaires_MAmabis
fwrite($fp, date('d-m-Y H:i:s').' - ERREUR SOAP : Requete = '.$this->client->__getLastRequest()."\n Reponse = ".$this->client->__getLastResponse()."\n============================================================================\n"); fwrite($fp, date('d-m-Y H:i:s').' - ERREUR SOAP : Requete = '.$this->client->__getLastRequest()."\n Reponse = ".$this->client->__getLastResponse()."\n============================================================================\n");
fclose($fp); fclose($fp);
} }
//return $tabRep;
} }
/** Zonages AFR et ZRR /** Zonages AFR et ZRR **/
**/ $codeInsee = substr($codeRivoli, 0, 5);
$codeInsee=substr($codeRivoli, 0, 5); $sql = "SELECT typeZone, arreteDate, decretDate, decretNum, decretModifieDate, decretModifieNum, dateDebut, dateFin
$ret = $this->iDb->select('jo.zonageInsee', 'typeZone, arreteDate, decretDate, decretNum, decretModifieDate, decretModifieNum, dateDebut, dateFin', "codeInsee='$codeInsee'", false, MYSQL_ASSOC); FROM jo.zonageInsee WHERE codeInsee=:code";
$tabRep['ZRR']=$tabRep['AFR']='NON'; $stmt = $this->conn->prepare($sql);
foreach ($ret as $zones) { $stmt->bindValue('code', $codeInsee);
switch ($zones['typeZone']) { $stmt->execute();
case 'ZRR': $tabRep['ZRR']='OUI'; $tabRep['NZRR']=$codeInsee; break; $tabRep['ZRR'] = $tabRep['AFR'] = 'NON';
case 'ZAFR': $tabRep['AFR']='OUI'; $tabRep['NAFR']=$codeInsee; break; if ($stmt->rowCount() > 0) {
default: break; while ($zones = $stmt->fetch(\PDO::FETCH_ASSOC)) {
switch ($zones['typeZone']) {
case 'ZRR':
$tabRep['ZRR'] = 'OUI';
$tabRep['NZRR'] = $codeInsee;
break;
case 'ZAFR':
$tabRep['AFR']='OUI';
$tabRep['NAFR']=$codeInsee;
break;
default:
break;
}
} }
} }

View File

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

View File

@ -1,18 +1,30 @@
<?php <?php
class Metier_Partenaires_MBourse class Metier_Partenaires_MBourse
{ {
/**
* SIREN
* @var string
*/
protected $siren = false; protected $siren = false;
protected $iDb;
public function __construct($siren=0, $db = null) /**
* PDO Connection with Doctrine
* @var \Doctrine\DBAL\Connection
*/
protected $conn;
public function __construct()
{ {
$this->siren = $siren; $this->conn = Zend_Registry::get('doctrine');
}
if ($db === null) { /**
$this->iDb = new Metier_Util_Db(); * Set SIREN
} else { * @param string $id
$this->iDb = $db; */
} public function setCompany($id)
{
$this->siren = $id;
} }
/** /**
@ -92,14 +104,22 @@ class Metier_Partenaires_MBourse
* @param string $siren * @param string $siren
* @return string * @return string
*/ */
public function getCodeIsin($siren=false) public function getCodeIsin($siren = false)
{ {
if (!$siren) { if (!$siren) {
$siren = $this->siren; $siren = $this->siren;
} }
$tabTmp = $this->iDb->select('jo.infos_entrep', 'isin', "siren=$siren AND isin!=''", false, MYSQL_ASSOC); $sql = "SELECT isin FROM jo.infos_entrep WHERE siren=:siren AND isin!='' LIMIT 0,1";
return trim(@$tabTmp[0]['isin']); $stmt = $this->conn->prepare($sql);
$stmt->bindValue('siren', $siren);
$stmt->execute();
if ($stmt->rowCount() > 0) {
$result = $stmt->fetch(\PDO::FETCH_ASSOC);
return trim($result['isin']);
}
return '';
} }
/** /**
@ -109,8 +129,16 @@ class Metier_Partenaires_MBourse
*/ */
public function getCodeSiren($isin) public function getCodeSiren($isin)
{ {
$tabTmp = $this->iDb->select('jo.infos_entrep', 'siren', "isin='$isin' AND siren!=0", false, MYSQL_ASSOC); $sql = "SELECT siren FROM jo.infos_entrep WHERE isin=:isin AND siren!=0 LIMIT 0,1";
return trim($tabTmp[0]['siren']); $stmt = $this->conn->prepare($sql);
$stmt->bindValue('isin', $isin);
$stmt->execute();
if ($stmt->rowCount() > 0) {
$result = $stmt->fetch(\PDO::FETCH_ASSOC);
return trim($result['siren']);
}
return '';
} }
/** /**
@ -119,56 +147,51 @@ class Metier_Partenaires_MBourse
* @param integer $id * @param integer $id
* @return array * @return array
*/ */
public function getInfosReg($siren=false, $id=null) public function getInfosReg($siren = false, $id = null)
{ {
if (!$siren) { if (!$siren) {
$siren = $this->siren; $siren = $this->siren;
} }
$isin = $this->getCodeIsin($siren); $isin = $this->getCodeIsin($siren);
$tabRet = array(); $result = array();
if ($isin!='') { if ($isin != '') {
$sqlID = ''; $sqlID = '';
if (null !== $id) { if (null !== $id) {
$sqlID=" AND id=$id "; $sqlID =" AND id=$id";
} }
$bodaccSql = "SELECT id, companyName, companyIsin, companySiren, companyWebSite,
pressReleaseDate, pressReleaseTitle, pressReleaseText, pressReleaseHtml,
pressReleaseAttachments, pressReleaseUrl, source, dateInsert
FROM presse.articles
WHERE companyIsin=:isin $sqlID ORDER BY pressReleaseDate DESC";
$bodaccStmt = $this->conn->prepare($bodaccSql);
$bodaccStmt->bindValue('isin', $isin);
$bodaccStmt->execute();
$bodacc = $this->iDb->select( if ($bodaccStmt->rowCount() > 0) {
'presse.articles', while($ann = $bodaccStmt->fetch(\PDO::FETCH_ASSOC)) {
'id, companyName, companyIsin, companySiren, companyWebSite, pressReleaseDate, pressReleaseTitle, '. $format = array(
'pressReleaseText, pressReleaseHtml, pressReleaseAttachments, pressReleaseUrl, source, dateInsert', 'id' => $ann['id'],
"companyIsin='$isin' $sqlID ORDER BY pressReleaseDate DESC", true, MYSQL_ASSOC); 'source' => $this->getLibSource($ann['source']),
if (count($bodacc)>0) { 'DateParution' => $ann['pressReleaseDate'],
foreach ($bodacc as $k=>$ann) { 'raisonSociale' => $ann['companyName'],
if ($id) { 'titre' => $ann['pressReleaseTitle'],
$tabRet[$k]=array( 'pj' => $ann['pressReleaseAttachments'],
'id'=>$ann['id'], 'url' => $ann['pressReleaseUrl'],
'source'=>$this->getLibSource($ann['source']), 'dateInsertionSD' => $ann['dateInsert'],
'DateParution'=>$ann['pressReleaseDate'], );
'raisonSociale'=>$ann['companyName'], if (null != $id) {
'titre'=>$ann['pressReleaseTitle'], $format['communique'] = $ann['pressReleaseText'];
'communique'=>$ann['pressReleaseText'], $format['communiqueHtml'] = $ann['pressReleaseHtml'];
'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'],
);
} }
$result[] = $format;
} }
} }
} }
return $tabRet;
return $result;
} }
/** /**
@ -185,29 +208,37 @@ class Metier_Partenaires_MBourse
$isin = $this->getCodeIsin($siren); $isin = $this->getCodeIsin($siren);
$tabRet = array(); $result = array();
if ($isin != '') { if ($isin != '') {
$tabRes = $this->iDb->select( $sql = "SELECT siren, raisonSociale, adresse, effectif, code_sicovam, code_mnemo,
'sdv1.bourse_isin b, sdv1.bourse_cours c', code_bloomberg, code_datastream, code_isin, logo, code_ric, dateIntroduction,
'siren, raisonSociale, adresse, effectif, code_sicovam, code_mnemo, code_bloomberg, code_datastream, code_isin, logo, code_ric, '. dateDerAG, dateRadiation, autre_isin, eligibleSRD, eligiblePEA, nombreTitres,
'dateIntroduction, dateDerAG, dateRadiation, autre_isin, eligibleSRD, eligiblePEA, nombreTitres, tel1, tel2, fax1, fax2, web, mail, '. tel1, tel2, fax1, fax2, web, mail, marche, placeCotation, description, secteur,
'marche, placeCotation, description, secteur, activite, activiteDet, dirigeants, actionnaires, chiffresTrim, '. activite, activiteDet, dirigeants, actionnaires, chiffresTrim, c.autre,
'c.autre, c.`date`, c.`heure`, c.`open` , c.`high` , c.`low` , c.`close` , c.`volume`', 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); FROM sdv1.bourse_isin b, sdv1.bourse_cours c
if (count($tabRes) > 0) { WHERE code_isin=:isin AND b.code_isin=c.isin AND c.autre IN('','e','f','g','m','s','u')
$tabRet = $tabRes[0]; ORDER BY c.`date` DESC, c.`heure` DESC LIMIT 0,1";
$tabRes = $this->iDb->select('sdv1.bourse_cours', $stmt = $this->conn->prepare($sql);
'min(close) AS coursMin, avg(close) AS coursMoy, max(close) AS coursMax', $stmt->bindValue('isin', $isin);
"isin='$isin' GROUP BY isin", false, MYSQL_ASSOC); $stmt->execute();
if (count($tabRes) > 0) { if ($stmt->rowCount() > 0) {
$tabTmp = $tabRes[0]; $result = $stmt->fetch(\PDO::FETCH_ASSOC);
$tabRet['coursMin'] = $tabTmp['coursMin']; $courSql = "SELECT min(close) AS coursMin, avg(close) AS coursMoy,
$tabRet['coursMoy'] = $tabTmp['coursMoy']; max(close) AS coursMax FROM sdv1.bourse_cours
$tabRet['coursMax'] = $tabTmp['coursMax']; WHERE isin=:isin GROUP BY isin";
$courStmt = $this->conn->prepare($courSql);
$courStmt->bindValue('isin', $isin);
$courStmt->execute();
if ($courStmt->rowCount() > 0) {
$cour = $courStmt->fetch(\PDO::FETCH_ASSOC);
$result['coursMin'] = $cour['coursMin'];
$result['coursMoy'] = $cour['coursMoy'];
$result['coursMax'] = $cour['coursMax'];
} }
} }
} }
return $tabRet; return $result;
} }
} }

View File

@ -4,8 +4,6 @@ require_once __DIR__ . '/MMapFunctions.php';
class Metier_Partenaires_MMap class Metier_Partenaires_MMap
{ {
protected $iDb;
private $accesDist = true;
private $referer =''; private $referer ='';
private $body = ''; private $body = '';
private $header = ''; private $header = '';
@ -36,14 +34,29 @@ class Metier_Partenaires_MMap
private $apiKeyY='klII0gzV34Ho2TCsN3XiXeh4No033AifxMeDXfFXj8TDCXO3WAtOLj9c74VsV45HcII-'; private $apiKeyY='klII0gzV34Ho2TCsN3XiXeh4No033AifxMeDXfFXj8TDCXO3WAtOLj9c74VsV45HcII-';
private $apiKeyC='ae5216123e414fcd84b8ca9a0f43a68c'; private $apiKeyC='ae5216123e414fcd84b8ca9a0f43a68c';
public function __construct($accesDist=true, $db = null) /**
* Flag to get remote data
* @var string
*/
protected $remote = false;
/**
* PDO Connection with Doctrine
* @var \Doctrine\DBAL\Connection
*/
protected $conn;
public function __construct()
{ {
if ($db === null) { $this->conn = Zend_Registry::get('doctrine');
$this->iDb = new Metier_Util_Db(); }
} else {
$this->iDb = $db; /**
} * Active la récupération des données distantes
$this->accesDist=$accesDist; */
public function setRemote()
{
$this->remote = true;
} }
/* /*
@ -334,12 +347,12 @@ class Metier_Partenaires_MMap
$this->codeRetourY='INVALID_REQUEST'; $this->codeRetourY='INVALID_REQUEST';
} }
} }
if ($this->latitudeDec==0 && ($this->longitudeDec==0 || $this->precision==0)) { if ($this->latitudeDec==0 && ($this->longitudeDec==0 || $this->precision==0)) {
//die('Réponse Yahoo = '.$this->body.PHP_EOL); //die('Réponse Yahoo = '.$this->body.PHP_EOL);
return false; return false;
} }
return true;//array("lat"=>$lat,"lng"=>$lng,"address"=>$address); return true;//array("lat"=>$lat,"lng"=>$lng,"address"=>$address);
} else { } else {
$this->codeRetourY='INVALID_REQUEST'; $this->codeRetourY='INVALID_REQUEST';
@ -459,13 +472,17 @@ class Metier_Partenaires_MMap
$adresse = addslashes(trim(preg_replace('/ +/', ' ', "$adrNum $adrIndRep $adrTypeVoieLong $adrLibVoie"))); $adresse = addslashes(trim(preg_replace('/ +/', ' ', "$adrNum $adrIndRep $adrTypeVoieLong $adrLibVoie")));
$adresseCourt = addslashes(trim(preg_replace('/ +/', ' ', "$adrNum $adrIndRep $adrTypeVoieCourt $adrLibVoie"))); $adresseCourt = addslashes(trim(preg_replace('/ +/', ' ', "$adrNum $adrIndRep $adrTypeVoieCourt $adrLibVoie")));
$ville = addslashes($ville); $ville = addslashes($ville);
$ret = $this->iDb->select('jo.zonageXY', 'lat, lon, l93_x, l93_y, alt, precis, adresseValidee, IF(dateUpdate>dateInsert, dateUpdate, dateInsert) AS dateInsert ',
"(address='$adresse' OR address='$adresseCourt') AND adr_cp='$cp' AND adr_ville='$ville' ORDER BY dateInsert DESC LIMIT 1",
false, MYSQL_ASSOC);
//Existe dans la base
if (count($ret)>0) { $sql = "SELECT lat, lon, l93_x, l93_y, alt, precis, adresseValidee, IF(dateUpdate>dateInsert, dateUpdate, dateInsert) AS dateInsert
$zonage=$ret[0]; FROM jo.zonageXY WHERE (address='$adresse' OR address='$adresseCourt') AND adr_cp='$cp' AND adr_ville='$ville'
ORDER BY dateInsert DESC LIMIT 1";
$stmt = $this->conn->prepare($sql);
$stmt->execute();
// Existe dans la base
if ($stmt->rowCount() > 0) {
$zonage = $stmt->fetch(\PDO::FETCH_ASSOC);
$this->precision=$zonage['precis']*1; $this->precision=$zonage['precis']*1;
$this->adresseValidee=strtoupper($zonage['adresseValidee']); $this->adresseValidee=strtoupper($zonage['adresseValidee']);
$this->latitudeDec=$zonage['lat']*1; $this->latitudeDec=$zonage['lat']*1;
@ -474,7 +491,7 @@ class Metier_Partenaires_MMap
$this->l93y=$zonage['l93_y']; $this->l93y=$zonage['l93_y'];
$this->altitude=$zonage['alt']; $this->altitude=$zonage['alt'];
if ($this->altitude==null && $this->precision>5) { if ($this->altitude==null && $this->precision>5) {
if ($this->accesDist) { if ($this->remote) {
$alt=$this->getAltitude($this->latitudeDec, $this->longitudeDec); $alt=$this->getAltitude($this->latitudeDec, $this->longitudeDec);
$this->altitude=$alt['alt']; $this->altitude=$alt['alt'];
} }
@ -490,7 +507,11 @@ class Metier_Partenaires_MMap
'l93_x'=>$this->l93x, 'l93_x'=>$this->l93x,
'l93_y'=>$this->l93y 'l93_y'=>$this->l93y
); );
$this->iDb->update('jo.zonageXY', $tabUpdate, "address='$adresse' AND adr_cp='$cp' AND adr_ville='$ville'"); $this->conn->update('jo.zonageXY', $tabUpdate, array(
'address' => $adresse,
'adr_cp' => $cp,
'adr_ville' => $ville,
));
} }
$this->latitudeDeg = dec2dms($this->latitudeDec); $this->latitudeDeg = dec2dms($this->latitudeDec);
@ -500,7 +521,7 @@ class Metier_Partenaires_MMap
} }
//Acces Distant //Acces Distant
elseif ($this->accesDist) { elseif ($this->remote) {
$this->enCache=false; $this->enCache=false;
$retG=$retY=$retC=$retM=false; $retG=$retY=$retC=$retM=false;
if (substr($codeRivoli, 0, 3)*1==971) { if (substr($codeRivoli, 0, 3)*1==971) {
@ -556,37 +577,31 @@ class Metier_Partenaires_MMap
$this->l93x=$tmp['x_93']; $this->l93x=$tmp['x_93'];
$this->l93y=$tmp['y_93']; $this->l93y=$tmp['y_93'];
//echo ('$retG='.$retG.PHP_EOL.'$retY='.$retY.PHP_EOL.'$retC='.$retC.PHP_EOL.'$retM='.$retM.PHP_EOL);
if ($retG || $retY || $retM || $retC) { if ($retG || $retY || $retM || $retC) {
$adresse=stripslashes(strtoupper(trim(preg_replace('/ +/', ' ', "$adrNum $adrIndRep $adrTypeVoieLong $adrLibVoie")))); $adresse=stripslashes(strtoupper(trim(preg_replace('/ +/', ' ', "$adrNum $adrIndRep $adrTypeVoieLong $adrLibVoie"))));
$ville=stripslashes($ville); $ville=stripslashes($ville);
$tabInsert=array( 'address'=>$adresse, $tabInsert = array(
'adr_cp'=>$cp, 'address' => $adresse,
'adr_ville'=>$ville, 'adr_cp' => $cp,
'adrNum'=>$adrNum, 'adr_ville' => $ville,
'adrIndRep'=>$adrIndRep, 'adrNum' => $adrNum,
'adrTypeVoie'=>$adrTypeVoieCourt, 'adrIndRep' => $adrIndRep,
'adrLibVoie'=>$adrLibVoie, 'adrTypeVoie' => $adrTypeVoieCourt,
'rivoli'=>$codeRivoli, 'adrLibVoie' => $adrLibVoie,
'adresseValidee'=>$this->adresseValidee, 'rivoli' => $codeRivoli,
'lat'=>$this->latitudeDec, 'adresseValidee'=> $this->adresseValidee,
'lon'=>$this->longitudeDec, 'lat' => $this->latitudeDec,
'l93_x'=>$this->l93x, 'lon' => $this->longitudeDec,
'l93_y'=>$this->l93y, 'l93_x' => $this->l93x,
'alt'=>$this->altitude, 'l93_y' => $this->l93y,
'precis'=>$this->precision, 'alt' => $this->altitude,
'source'=>$this->geocodeur, 'precis' => $this->precision,
'dateInsert'=>date('YmdHis'), 'source' => $this->geocodeur,
); 'dateInsert' => date('YmdHis'),
/** Insertion de l'adresse que si elle est possible );
**/ /** Insertion de l'adresse que si elle est possible **/
//echo ('Avant Insert '.$this->latitudeDec.PHP_EOL.$this->longitudeDec.PHP_EOL);
if ($this->latitudeDec<>0 && $this->longitudeDec<>0 && $this->precision>0) { if ($this->latitudeDec<>0 && $this->longitudeDec<>0 && $this->precision>0) {
// print_r($tabInsert); $this->conn->insert('jo.zonageXY', $tabInsert);
//echo ($this->latitudeDec.PHP_EOL.$this->longitudeDec.PHP_EOL);
$this->iDb->insert('jo.zonageXY', $tabInsert);
/*if (mysql_errno()>0) echo mysql_error().die(PHP_EOL);*/
} else { } else {
$this->precision=$this->latitudeDec=$this->longitudeDec=0; $this->precision=$this->latitudeDec=$this->longitudeDec=0;
$this->adresseValidee=''; $this->adresseValidee='';

View File

@ -3,13 +3,15 @@ class Metier_Partenaires_MMarques
{ {
private $iDb; private $iDb;
public function __construct($db = null) /**
* PDO Connection with Doctrine
* @var \Doctrine\DBAL\Connection
*/
protected $conn;
public function __construct()
{ {
if ($db === null) { $this->conn = Zend_Registry::get('doctrine');
$this->iDb = new Metier_Util_Db();
} else {
$this->iDb = $db;
}
} }
@ -21,25 +23,81 @@ class Metier_Partenaires_MMarques
public function getMarques($siren, $idDepot=0) public function getMarques($siren, $idDepot=0)
{ {
$marques = array(); $marques = array();
$strSql = "1 "; $sql = "SELECT nomMarque, rayonMarque, detailDeposant, sirenDeposant, dateDepot, lieuDepot,
numeroMarque, classesMarque, periMarque, detailDeposant, detailMandataire, detailStatut,
dateExpir, idObjetImg, idObjetPdf FROM bopi.marques WHERE";
if ($siren > 0) { if ($siren > 0) {
$strSql.= "AND sirenDeposant=$siren "; if (substr($sql, -5) != "WHERE") {
$sql.= " AND ";
}
$sql.= "sirenDeposant=$siren";
} }
if ($idDepot > 0) { if ($idDepot > 0) {
$strSql.= "AND numeroMarque=$idDepot "; if (substr($sql, -5) != "WHERE") {
$sql.= " AND ";
}
$sql.= "numeroMarque=$idDepot";
} }
$res = $this->iDb->select('bopi.marques', $stmt = $this->conn->prepare($sql);
'nomMarque, rayonMarque, detailDeposant, sirenDeposant, dateDepot, lieuDepot, numeroMarque, classesMarque, periMarque, detailDeposant, detailMandataire, detailStatut, dateExpir, idObjetImg, idObjetPdf', $stmt->execute();
"$strSql ORDER BY dateDepot DESC"); if ($stmt->rowCount() > 0) {
if (count($res) > 0) { while ($marque = $stmt->fetch(\PDO::FETCH_ASSOC)) {
foreach ($res as $i => $marque) {
if ($marque['nomMarque'] == '&nbsp;') { if ($marque['nomMarque'] == '&nbsp;') {
$nomMarque = '(figurative)'; $nomMarque = '(figurative)';
} else { } else {
$nomMarque = $marque['nomMarque']; $nomMarque = $marque['nomMarque'];
} }
$marques[$i] = array( if ($idDepot != 0) {
if ($marque['numeroMarque'] == $idDepot) {
//Produits et Services
$psSql = "SELECT remarque FROM bopi.marques_classes WHERE numeroMarque=:id";
$psStmt = $this->conn->prepare($psSql);
$psStmt->bindValue('id', $idDepot);
$psStmt->execute();
$txt = array();
if ($psStmt->rowCount() > 0) {
while ($ps = $psStmt->fetch(\PDO::FETCH_ASSOC)) {
$txt[] = $ps['remarque'];
}
}
$marque['PS'] = $txt;
//Historique
$hSql = "SELECT histo2 FROM bopi.marques_histo WHERE numeroMarque=:id ORDER BY dat DESC";
$hStmt = $this->conn->prepare($psSql);
$hStmt->bindValue('id', $idDepot);
$hStmt->execute();
$txt = array();
if ($hStmt->rowCount() > 0) {
while ($h = $hStmt->fetch(\PDO::FETCH_ASSOC)) {
$txt[] = $h['histo2'];
}
}
$marque['histo'] = $txt;
return 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'],
'PS' => $marque['PS'],
'histo' => $marque['histo'],
);
}
}
$marques[] = array(
'nomMarque' => $nomMarque, 'nomMarque' => $nomMarque,
'rayonMarque' => $marque['rayonMarque'], 'rayonMarque' => $marque['rayonMarque'],
'detailDeposant' => $marque['detailDeposant'], 'detailDeposant' => $marque['detailDeposant'],
@ -55,33 +113,8 @@ class Metier_Partenaires_MMarques
'imgLink' => $marque['idObjetImg'], 'imgLink' => $marque['idObjetImg'],
'pdfLink' => $marque['idObjetPdf'], '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 $marques;
} }

View File

@ -68,13 +68,15 @@ class Metier_Partenaires_MPrivileges
protected $iDb; protected $iDb;
public function __construct($db = null) /**
* PDO Connection with Doctrine
* @var \Doctrine\DBAL\Connection
*/
protected $conn;
public function __construct()
{ {
if ($db === null) { $this->conn = Zend_Registry::get('doctrine');
$this->iDb = new Metier_Util_Db();
} else {
$this->iDb = $db;
}
} }
/** /**
@ -90,49 +92,66 @@ class Metier_Partenaires_MPrivileges
if ($strTypes != '') { if ($strTypes != '') {
$strTypes=" AND i.insType IN ('$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(); $iRncs = new Metier_Partenaires_MRncs();
$tabRet = array(); $tabRet = array();
$tabPriv = $this->iDb->select($tables, $fields, $where, true, MYSQL_ASSOC);
if (count($tabPriv) > 0) { $sql = "SELECT i.id, i.dateEven, i.greffe , i.numDebiteur, i.sirenage, i.typeEven, i.dateFraiche,
foreach ($tabPriv as $i => $priv) { i.codeRev , i.debRaisonSociale , i.debSigle , i.debCiv , i.debNom , i.debPrenom ,
if ($i >0 && $priv['dateFraiche'] != $dateFraiche) { 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
FROM jo.greffes_privileges i
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 **/ )
ORDER BY i.dateFraiche DESC, i.insType ASC, i.insDate ASC";
$stmt = $this->conn->prepare($sql);
$stmt->execute();
if ($stmt->rowCount() > 0) {
$i = 0;
while ($priv = $stmt->fetch(\PDO::FETCH_ASSOC)) {
if ($i > 0 && $priv['datefaiche'] != $dateFraiche) {
break; break;
} }
$tabRet[] = array( $tabRet[] = array(
'numDebiteur' => $priv['numDebiteur'], 'numDebiteur' => $priv['numDebiteur'],
'greffe' => $priv['greffe'], 'greffe' => $priv['greffe'],
'greffeLib' => $iRncs->getLibTribunal($priv['greffe']), 'greffeLib' => $iRncs->getLibTribunal($priv['greffe']),
'dateEven' => $priv['dateEven'], 'dateEven' => $priv['dateEven'],
'dateFraiche' => $priv['dateFraiche'], 'dateFraiche' => $priv['dateFraiche'],
'dateSD' => $priv['dateInsert'], 'dateSD' => $priv['dateInsert'],
'insType' => $priv['insType'], 'insType' => $priv['insType'],
'insTypeLib' => $this->tabTypePriv[$priv['insType']], 'insTypeLib' => $this->tabTypePriv[$priv['insType']],
'insNum' => $priv['insNum'], 'insNum' => $priv['insNum'],
'insDate' => $priv['insDate'], 'insDate' => $priv['insDate'],
'insDateEch' => $priv['insDateEch'], 'insDateEch' => $priv['insDateEch'],
'insObjet' => $priv['insObjet'], 'insObjet' => $priv['insObjet'],
'insMontant' => $priv['insMontant'], 'insMontant' => $priv['insMontant'],
'insDev' => $priv['insDev'], 'insDev' => $priv['insDev'],
'insDateFin' => $priv['insDateFin'], 'insDateFin' => $priv['insDateFin'],
'radDate' => $priv['radDate'], 'radDate' => $priv['radDate'],
'radMention' => $priv['radMention'], 'radMention' => $priv['radMention'],
'radPartiel' => $priv['radPartiel'], 'radPartiel' => $priv['radPartiel'],
'radPartMt' => $priv['radPartMt'], 'radPartMt' => $priv['radPartMt'],
'radDev' => $priv['radDev'], 'radDev' => $priv['radDev'],
'creNom' => $priv['creNom'], 'creNom' => $priv['creNom'],
'creAdresse1' => trim(preg_replace('/ +/', ' ', $priv['creNumVoi'].' '.$priv['creTypVoi'].' '.$priv['creLibVoi'])), 'creAdresse1' => trim(preg_replace('/ +/', ' ', $priv['creNumVoi'].' '.
'creAdresse2' => $priv['creAdrComp1'], $priv['creTypVoi'].' '.$priv['creLibVoi'])),
'creAdresse3' => $priv['creAdrComp2'], 'creAdresse2' => $priv['creAdrComp1'],
'creCP' => $priv['creCP'], 'creAdresse3' => $priv['creAdrComp2'],
'creVille' => $priv['creVille'], 'creCP' => $priv['creCP'],
'crePays' => $priv['crePays'], 'creVille' => $priv['creVille'],
'creAutres' => $priv['creAutres'], 'crePays' => $priv['crePays'],
'creAutres' => $priv['creAutres'],
); );
$i++;
$dateFraiche = $priv['dateFraiche']; $dateFraiche = $priv['dateFraiche'];
} }
} }

View File

@ -323,7 +323,8 @@ class Metier_Partenaires_MRncs
if ($fj > 0 && $fj < 10000) { if ($fj > 0 && $fj < 10000) {
$stmt = $this->conn->executeQuery("SELECT libelle AS LibFJ FROM jo.tabFJur WHERE code=$fj"); $stmt = $this->conn->executeQuery("SELECT libelle AS LibFJ FROM jo.tabFJur WHERE code=$fj");
if ($stmt->rowCount() > 0) { if ($stmt->rowCount() > 0) {
$label = $stmt->fetchColumn('LibFJ'); $result = $stmt->fetch(\PDO::FETCH_ASSOC);
$label = $result['LibFJ'];
} }
} }
@ -341,7 +342,8 @@ class Metier_Partenaires_MRncs
UNION SELECT libNaf5 AS LibNaf FROM jo.tabNaf5 WHERE codNaf5='$codeNaf'"); UNION SELECT libNaf5 AS LibNaf FROM jo.tabNaf5 WHERE codNaf5='$codeNaf'");
$label = "Inconnu"; $label = "Inconnu";
if ($stmt->rowCount() > 0) { if ($stmt->rowCount() > 0) {
$label = $stmt->fetchColumn('LibNaf'); $result = $stmt->fetch(\PDO::FETCH_ASSOC);
$label = $result['LibNaf'];
} }
return $label; return $label;

View File

@ -22,7 +22,7 @@ class Metier_Partenaires_MTel
*/ */
public function getTel($siret, $nic=0, $last=false, $actif=null) public function getTel($siret, $nic=0, $last=false, $actif=null)
{ {
$tabRet=array(); $tabRet = array();
if (strlen($siret) > 9) { if (strlen($siret) > 9) {
$nic = substr($siret, -5)*1; $nic = substr($siret, -5)*1;
@ -75,7 +75,8 @@ class Metier_Partenaires_MTel
$an8Stmt = $this->conn->executeQuery($sql); $an8Stmt = $this->conn->executeQuery($sql);
$infoTel = ''; $infoTel = '';
if ($an8Stmt->rowCount() > 0) { if ($an8Stmt->rowCount() > 0) {
$label = $an8Stmt->fetchColumn('libAn8'); $result = $an8Stmt->fetch(\PDO::FETCH_ASSOC);
$label = $result['libAn8'];
$infoTel = ucfirst(strtolower($label)); $infoTel = ucfirst(strtolower($label));
} }
} else { } else {

View File

@ -79,11 +79,11 @@ class Metier_Partenaires_MTva
$stmt->execute(); $stmt->execute();
if ($stmt->rowCount() > 0) { if ($stmt->rowCount() > 0) {
$exist = true; $exist = true;
$tab = $stmt->fetch(\PDO::FETCH_ASSOC); $result = $stmt->fetch(\PDO::FETCH_OBJ);
$cle = $tab['cle']; $cle = $result->cle;
$dateRef = new DateTime(); $dateRef = new DateTime();
$dateRef->sub(new DateInterval('P6M')); $dateRef->sub(new DateInterval('P6M'));
$dateMaj = DateTime::createFromFormat('Ymd', $tab['DateMAJ']); $dateMaj = DateTime::createFromFormat('Ymd', $result->DateMAJ);
$this->vatNumber = "FR".$this->cle.$this->siren; $this->vatNumber = "FR".$this->cle.$this->siren;
if ($cle !== null | $cle != 0) { if ($cle !== null | $cle != 0) {
$this->vatDefined = true; $this->vatDefined = true;
@ -158,18 +158,18 @@ class Metier_Partenaires_MTva
if ($response->getStatusCode() == 200) { if ($response->getStatusCode() == 200) {
$body = $response->getBody(); $body = $response->getBody();
if (preg_match('/Yes, valid VAT number/i', $body) if (preg_match('/Yes, valid VAT number/i', $body)
|| preg_match('/Oui, numéro de TVA valide/i', $body)) { || preg_match('/Oui, numéro de TVA valide/i', $body)) {
if ($exist) { if ($exist) {
$this->conn->update('sdv1.siren_tva', array('cle' => intval($this->cle), $this->conn->update('sdv1.siren_tva', array('cle' => intval($this->cle),
'duree' => $time), array('siren' => $this->siren)); 'duree' => $time), array('siren' => $this->siren));
} else { } else {
$this->conn->insert('sdv1.siren_tva', array('siren' => $this->siren, $this->conn->insert('sdv1.siren_tva', array('siren' => $this->siren,
'cle' => intval($this->cle), 'duree' => $time)); 'cle' => intval($this->cle), 'duree' => $time));
}
$this->vatNumber = "FR".$this->cle.$this->siren;
$this->vatDefined = true;
return true;
} }
$this->vatNumber = "FR".$this->cle.$this->siren;
$this->vatDefined = true;
return true;
}
} }
} catch (RequestException $e) { } catch (RequestException $e) {
Metier_Util_Log::write('I', "TVA ".$e->getMessage(), __LINE__, __FILE__, __FUNCTION__, __CLASS__); Metier_Util_Log::write('I', "TVA ".$e->getMessage(), __LINE__, __FILE__, __FUNCTION__, __CLASS__);

View File

@ -2190,16 +2190,9 @@ class Metier_Scores_ICotation
public $societeEnBourse = false; public $societeEnBourse = false;
public $valeurCCF = 0; public $valeurCCF = 0;
protected $iDb;
public function __construct($tabBilan, $retraitementAutomatique = true, $db = null) public function __construct($tabBilan, $retraitementAutomatique = true)
{ {
if ($db === null) {
$this->iDb = new Metier_Util_Db();
} else {
$this->iDb = $db;
}
$this->reTrtAuto = $retraitementAutomatique; $this->reTrtAuto = $retraitementAutomatique;
$this->tabBilan = $tabBilan; $this->tabBilan = $tabBilan;
@ -3151,7 +3144,7 @@ class Metier_Scores_ICotation
public function scoreAltman($enBourse=true) public function scoreAltman($enBourse=true)
{ {
$iBourse = new Metier_Partenaires_MBourse(@$this->tabBilan['SIREN'], $this->iDb); $iBourse = new Metier_Partenaires_MBourse();
$bourse = $iBourse->getInfosBourse(@$this->tabBilan['SIREN']); $bourse = $iBourse->getInfosBourse(@$this->tabBilan['SIREN']);
if (count($bourse)>0) { if (count($bourse)>0) {
$this->societeEnBourse=true; $this->societeEnBourse=true;
@ -3690,15 +3683,15 @@ class Metier_Scores_ICotation
for ($i=1; $i<$nbSecteurs; $i++) { for ($i=1; $i<$nbSecteurs; $i++) {
for ($j=0; isset($this->tabActivite[$i][$j]); $j++) { for ($j=0; isset($this->tabActivite[$i][$j]); $j++) {
if ($this->tabActivite[$i][$j]==$naf) { if ($this->tabActivite[$i][$j]==$naf) {
// echo 'NAF '.$naf.' TROUV<EFBFBD> !<br>'; // echo 'NAF '.$naf.' TROUVé !<br>';
return $i; return $i;
} }
} }
} }
// echo 'NAF '.$naf.' non trouv<EFBFBD> !<br>'; // echo 'NAF '.$naf.' non trouvé !<br>';
$naf=substr($naf, 0, strlen($naf)-1); $naf=substr($naf, 0, strlen($naf)-1);
} }
return 17; // Secteur d'activit<EFBFBD> par d<>faut si non trouv<75> return 17; // Secteur d'activité par défaut si non trouvé
} }
public function getBorne($note, $borne, $secteur) public function getBorne($note, $borne, $secteur)
@ -3726,7 +3719,7 @@ class Metier_Scores_ICotation
} }
} }
} }
return 3; // On retourne la plus basse note par d<EFBFBD>faut return 3; // On retourne la plus basse note par défaut
} }

View File

@ -1,8 +1,7 @@
<?php <?php
/** Auto generated class 2016-08-09 11:48:55*/ /** Auto generated class 2017-01-19 16:16:49*/
class Metier_Scores_MRatios class Metier_Scores_MRatios
{ {
public $efftr = null; public $efftr = null;
/** Tableau de conversion des communes **/ /** Tableau de conversion des communes **/
@ -212,13 +211,8 @@ class Metier_Scores_MRatios
'R44c'=>'Rs[841]', 'R44c'=>'Rs[841]',
); );
public function __construct($db = null) public function __construct()
{ {
if ( $db === null ) {
$this->iDb = new Metier_Util_Db();
} else {
$this->iDb = $db;
}
} }
/** /**

View File

@ -2130,8 +2130,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
$tabIdentite['DateCreaEn'], $tabIdentite['DateCreaEn'],
$tabIdentite['DateCreaEt'], $tabIdentite['DateCreaEt'],
'', '',
$RECME, $RECME
$iDb
); );
$noteStructure=$isolv->getSolvabilite(); $noteStructure=$isolv->getSolvabilite();
$timer['solv']=microtime(true); $timer['solv']=microtime(true);
@ -2298,7 +2297,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
break; break;
} }
$icotation = new Metier_Scores_ICotation($item, true, $iDb); $icotation = new Metier_Scores_ICotation($item, true);
$secteur=$icotation->getSecteurActivite($isolv->getNaf4($naf)); $secteur=$icotation->getSecteurActivite($isolv->getNaf4($naf));
$libSecteur=$icotation->tabLibActivite[$secteur]; $libSecteur=$icotation->tabLibActivite[$secteur];
$chiffeAffaire=$icotation->calculChiffreAffaires($isolv->getNaf4($naf)); $chiffeAffaire=$icotation->calculChiffreAffaires($isolv->getNaf4($naf));
@ -2835,7 +2834,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
// Présence de Privilèges // Présence de Privilèges
$PRIVILEGESECU=$PRIVILEGESECU_MT=$PRIVILEGETRES=$PRIVILEGETRES_MT=0; $PRIVILEGESECU=$PRIVILEGESECU_MT=$PRIVILEGETRES=$PRIVILEGETRES_MT=0;
$iPriv = new Metier_Partenaires_MPrivileges($iDb); $iPriv = new Metier_Partenaires_MPrivileges();
$tabPriv = $iPriv->getPrivilegesCumul($siren); $tabPriv = $iPriv->getPrivilegesCumul($siren);
$noteSolvMax=100; $noteSolvMax=100;
if (isset($tabPriv['03']['nb'])) { if (isset($tabPriv['03']['nb'])) {
@ -3662,7 +3661,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
$MARQUENB_EUR=0; // Nombre de marques déposées en EUROPE $MARQUENB_EUR=0; // Nombre de marques déposées en EUROPE
$MARQUENB_FR=0; // Nombre de marques déposées en FRANCE $MARQUENB_FR=0; // Nombre de marques déposées en FRANCE
$tabMarques['WW']=$tabMarques['EU']=$tabMarques['FR']=array(); $tabMarques['WW']=$tabMarques['EU']=$tabMarques['FR']=array();
$iMarque = new Metier_Partenaires_MMarques($iDb); $iMarque = new Metier_Partenaires_MMarques();
$ret = $iMarque->getMarques($siren); $ret = $iMarque->getMarques($siren);
if ($ret!==false && count($ret)>0) { if ($ret!==false && count($ret)>0) {
foreach ($ret as $i=>$marque) { foreach ($ret as $i=>$marque) {

View File

@ -1,7 +1,6 @@
<?php <?php
class Metier_Scores_MSolvabilite class Metier_Scores_MSolvabilite
{ {
protected $iDb;
private $naf; private $naf;
private $trEff; private $trEff;
private $dep; private $dep;
@ -1039,14 +1038,8 @@ class Metier_Scores_MSolvabilite
* @param number $recme * @param number $recme
* @return boolean * @return boolean
*/ */
public function __construct($siren, $naf='', $trancheEff='', $effectifReel='', $depSiege_CodePosSiege='', $fj='', $capital='', $capitalDev='', $dateCreaEn='', $dateCreaSiege='', $singularite='', $recme=0, $db = null) public function __construct($siren, $naf='', $trancheEff='', $effectifReel='', $depSiege_CodePosSiege='', $fj='', $capital='', $capitalDev='', $dateCreaEn='', $dateCreaSiege='', $singularite='', $recme=0)
{ {
if ($db === null) {
$this->iDb = new Metier_Util_Db();
} else {
$this->iDb = $db;
}
$this->naf=$naf; $this->naf=$naf;
$this->trEff=$trancheEff; $this->trEff=$trancheEff;
if ($this->trEff=='NN' || $this->trEff=='00' || ($this->trEff*1)==0) { if ($this->trEff=='NN' || $this->trEff=='00' || ($this->trEff*1)==0) {
@ -1133,7 +1126,7 @@ class Metier_Scores_MSolvabilite
$nbPoints = 5; $nbPoints = 5;
} }
} elseif (strlen($this->naf) == 5) { } elseif (strlen($this->naf) == 5) {
$iCotation = new Metier_Scores_ICotation(array(), true, $this->iDb); $iCotation = new Metier_Scores_ICotation(array(), true);
if (isset($iCotation->tabNaf21[$this->naf])) { if (isset($iCotation->tabNaf21[$this->naf])) {
$naf4 = $iCotation->tabNaf21[$this->naf]; $naf4 = $iCotation->tabNaf21[$this->naf];
if (isset($this->tabPtNaf[$naf4])) { if (isset($this->tabPtNaf[$naf4])) {
@ -1163,7 +1156,7 @@ class Metier_Scores_MSolvabilite
} }
if (strlen($naf5)==5) { if (strlen($naf5)==5) {
$iCotation = new Metier_Scores_ICotation(array(), true, $this->iDb); $iCotation = new Metier_Scores_ICotation(array(), true);
return $iCotation->tabNaf21[$naf5]; return $iCotation->tabNaf21[$naf5];
} }
return $naf5; return $naf5;

View File

@ -2073,9 +2073,7 @@ class Metier_Scoring_Base extends Metier_Scoring_Vars
$tabIdentite['DateCreaEn'], $tabIdentite['DateCreaEn'],
$tabIdentite['DateCreaEt'], $tabIdentite['DateCreaEt'],
'', '',
$this->RECME, $this->RECME);
$this->db
);
$noteStructure = $isolv->getSolvabilite(); $noteStructure = $isolv->getSolvabilite();
$timer['solv'] = microtime(true); $timer['solv'] = microtime(true);
@ -2241,7 +2239,7 @@ class Metier_Scoring_Base extends Metier_Scoring_Vars
break; break;
} }
$icotation = new Metier_Scores_ICotation($item, true, $this->db); $icotation = new Metier_Scores_ICotation($item, true);
$secteur=$icotation->getSecteurActivite($isolv->getNaf4($naf)); $secteur=$icotation->getSecteurActivite($isolv->getNaf4($naf));
$libSecteur=$icotation->tabLibActivite[$secteur]; $libSecteur=$icotation->tabLibActivite[$secteur];
$chiffeAffaire=$icotation->calculChiffreAffaires($isolv->getNaf4($naf)); $chiffeAffaire=$icotation->calculChiffreAffaires($isolv->getNaf4($naf));
@ -2779,7 +2777,7 @@ class Metier_Scoring_Base extends Metier_Scoring_Vars
// Présence de Privilèges // Présence de Privilèges
$this->PRIVILEGESECU=$this->PRIVILEGESECU_MT=$this->PRIVILEGETRES=$this->PRIVILEGETRES_MT=0; $this->PRIVILEGESECU=$this->PRIVILEGESECU_MT=$this->PRIVILEGETRES=$this->PRIVILEGETRES_MT=0;
$iPriv = new Metier_Partenaires_MPrivileges($this->db); $iPriv = new Metier_Partenaires_MPrivileges();
$tabPriv = $iPriv->getPrivilegesCumul($siren); $tabPriv = $iPriv->getPrivilegesCumul($siren);
$noteSolvMax=100; $noteSolvMax=100;
if (isset($tabPriv['03']['nb'])) { if (isset($tabPriv['03']['nb'])) {
@ -3605,7 +3603,7 @@ class Metier_Scoring_Base extends Metier_Scoring_Vars
$this->MARQUENB_EUR=0; // Nombre de marques déposées en EUROPE $this->MARQUENB_EUR=0; // Nombre de marques déposées en EUROPE
$this->MARQUENB_FR=0; // Nombre de marques déposées en FRANCE $this->MARQUENB_FR=0; // Nombre de marques déposées en FRANCE
$tabMarques['WW']=$tabMarques['EU']=$tabMarques['FR']=array(); $tabMarques['WW']=$tabMarques['EU']=$tabMarques['FR']=array();
$iMarque = new Metier_Partenaires_MMarques($this->db); $iMarque = new Metier_Partenaires_MMarques();
$ret = $iMarque->getMarques($siren); $ret = $iMarque->getMarques($siren);
if ($ret!==false && count($ret)>0) { if ($ret!==false && count($ret)>0) {
foreach ($ret as $i=>$marque) { foreach ($ret as $i=>$marque) {

View File

@ -1481,7 +1481,7 @@ function GPSData($siren, $nic, $values = false)
if (count($result)>0) { if (count($result)>0) {
$MInsee = new Metier_Insee_MInsee($iDb); $MInsee = new Metier_Insee_MInsee($iDb);
$etab = $result[0]; $etab = $result[0];
$mMap=new Metier_Partenaires_MMap(false, $iDb); $mMap=new Metier_Partenaires_MMap();
$mMap->geoCodeAdresse( $mMap->geoCodeAdresse(
$etab['adr_num'] $etab['adr_num']
,'', ,'',
@ -1561,7 +1561,7 @@ function TelOrderEntete()
function TelOrderData($siren, $nic, $values) function TelOrderData($siren, $nic, $values)
{ {
global $iDb; global $iDb;
$c = new Metier_Partenaires_MTel($iDb); $c = new Metier_Partenaires_MTel();
$result = $c->getTel($siren, $nic, true, 1); $result = $c->getTel($siren, $nic, true, 1);
$tabData = array(); $tabData = array();
if ( count($result)>0 ) { if ( count($result)>0 ) {
@ -1688,7 +1688,7 @@ function ZonePrioritaireData($siren, $nic, $value) {
"i.SIREN=e.siren AND i.NIC=e.nic AND e.siren=$siren AND e.nic=$nic", false, MYSQL_ASSOC); "i.SIREN=e.siren AND i.NIC=e.nic AND e.siren=$siren AND e.nic=$nic", false, MYSQL_ASSOC);
if (count($result) > 0) { if (count($result) > 0) {
$r = $result[0]; $r = $result[0];
$iAmabis = new Metier_Partenaires_MAmabis($iDb); $iAmabis = new Metier_Partenaires_MAmabis();
$tabData = $iAmabis->getZonage($r['adr_num'], $r['adr_btq'], $r['adr_typeVoie'], $r['adr_libVoie'], $tabData = $iAmabis->getZonage($r['adr_num'], $r['adr_btq'], $r['adr_typeVoie'], $r['adr_libVoie'],
$r['adr_cp'], $r['adr_ville'], trim($r['ADR_DEP'].$r['ADR_COM'].$r['CODEVOIE']), $r['adr_cp'], $r['adr_ville'], trim($r['ADR_DEP'].$r['ADR_COM'].$r['CODEVOIE']),
false, 'TEST', false); false, 'TEST', false);