Merge remote-tracking branch 'origin/develop'

This commit is contained in:
Michael RICOIS 2016-11-16 17:49:41 +01:00
commit f5bffeae06
10 changed files with 2759 additions and 1974 deletions

View File

@ -8,37 +8,43 @@ class Metier_Infogreffe_DocST extends Metier_Infogreffe_Service
{
/**
* Db Adapter
* @var Zend_Db_Adapter_Abstract
* PDO Connection with Doctrine
* @var \Doctrine\DBAL\Connection
*/
public $db;
protected $conn;
/**
*
* @param string $siren
* Infogreffe : Document Bilan
* @param \Doctrine\DBAL\Connection $conn
*/
public function __construct($siren, $db = null)
public function __construct($conn = null)
{
parent::__construct();
// Set Database
if ($conn === null) {
$this->conn = Zend_Registry::get('doctrine');
}
else {
$this->conn = $conn;
}
// Set type
$this->type_document = 'ST';
//Set Siren
$this->siren = $siren;
//Get defaut database adapter
if ($db === null) {
$this->db = Zend_Db_Table_Abstract::getDefaultAdapter();
} else {
$this->db = $db;
}
/**
* Défini le SIREN
* @param string $siren
* @return void
*/
public function setSiren($siren)
{
$this->siren = $siren;
}
public function getList()
{
}
{}
public function getCommandeT()
{
@ -67,11 +73,10 @@ class Metier_Infogreffe_DocST extends Metier_Infogreffe_Service
}
if ( $orderId !== null ) {
$commandeM = new Application_Model_Sdv1GreffeCommandesBi();
$commandeM->update(array(
$this->conn->update('sdv1.greffe_commandes_st', array(
'cmdUrl' => $url,
'dateCommande' => date('YmdHis'),
), 'id='.$orderId);
'dateCommande' => date('YmdHis')),
array('id' => $orderId));
}
//Récupérer le fichier
@ -117,10 +122,7 @@ class Metier_Infogreffe_DocST extends Metier_Infogreffe_Service
*/
public function getFilePath($type, $dateCloture)
{
if ($type=='') {
$type = 'sociaux';
}
return 'bilans' . '/' . $type . '/' . substr($dateCloture,0,4);
return 'statut/' . $type . '/' . substr($dateCloture,0,4);
}
/**

View File

@ -1010,7 +1010,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
e.enseigne, e.sigle, LPAD(e.adr_num,4,0) AS adr_num, e.adr_btq, e.adr_typeVoie, e.adr_libVoie,
e.adr_comp, LPAD(e.adr_cp,5,0) AS adr_cp, e.adr_ville, e.adr_dep, LPAD(e.adr_com,3,0) AS adr_com,
LPAD(e.tel,10,0) AS tel, LPAD(e.fax,10,0) AS fax, e.cj, e.ape_etab, e.ape_entrep, e.teff_etab,
CONCAT(siren, nic) AS siret, e.actif, e.identite_pre, IF(e.siege=2,0.5,e.siege) AS triSiege,
CONCAT(e.siren, e.nic) AS siret, e.actif, e.identite_pre, IF(e.siege=2,0.5,e.siege) AS triSiege,
IF (e.adr_dep=99,p.libPays,'France') AS libPays";
$strActif = $strDep = '';
@ -1201,12 +1201,12 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
$filtreActif = " AND WHERE actif=$actif";
}
$fields = "Etab' as Loc, e.id, e.source, e.source_id, e.triCode, e.autre_id,
$fields = "'Etab' as Loc, e.id, e.source, e.source_id, e.triCode, e.autre_id,
LPAD(e.siren, 9, 0) AS siren, LPAD(e.nic, 5, 0) AS nic, e.siege, e.raisonSociale,
e.enseigne, e.sigle, LPAD(e.adr_num,4,0) AS adr_num, e.adr_btq, e.adr_typeVoie,
e.adr_libVoie, e.adr_comp, LPAD(e.adr_cp,5,0) AS adr_cp, e.adr_ville, e.adr_dep,
LPAD(e.adr_com,3,0) AS adr_com, LPAD(e.tel,10,0) AS tel, LPAD(e.fax,10,0) AS fax,
e.cj, e.ape_etab, e.ape_entrep, CONCAT(e.siren, e.nic) as siret, e.actif,
e.enseigne, e.sigle, LPAD(e.adr_num,4,0) AS adr_num, e.adr_btq, e.adr_typeVoie, e.adr_libVoie,
e.adr_comp, LPAD(e.adr_cp,5,0) AS adr_cp, e.adr_ville, e.adr_dep, LPAD(e.adr_com,3,0) AS adr_com,
LPAD(e.tel,10,0) AS tel, LPAD(e.fax,10,0) AS fax, e.cj, e.ape_etab, e.ape_entrep,
CONCAT(e.siren, e.nic) AS siret, e.actif,
IF (e.adr_dep=99,p.libPays,'France') AS libPays";
if ($typeId == 'TEL') {
@ -1214,7 +1214,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
$stmt = $this->conn->executeQuery("SELECT count(*) AS nb FROM jo.etablissements
WHERE TEL=$id OR FAX=$id $filtreActif");
$result = $stmt->fetch(\PDO::FETCH_OBJ);
$nbTot = $$result->nb;
$nbTot = $result->nb;
$stmt = $this->conn->executeQuery("SELECT $fields FROM jo.etablissements e
LEFT JOIN jo.tabPays p ON p.codePaysInsee=e.adr_com
WHERE TEL=$id OR FAX=$id $filtreActif

View File

@ -205,7 +205,7 @@ class Metier_Liens_Base
/**
* Fonctions de direction
* @param boolean $actif
* @return Zend_Db_Table_Rowset_Abstract
* @return array
*/
public function getDirections($actif = null)
{
@ -309,7 +309,7 @@ class Metier_Liens_Base
/**
* Retourne les éléments identitaire présent dans lienRef
* @param string $id
* @return Zend_Db_Table_Rowset_Abstract
* @return array
*/
public function getIdentity($id = null)
{

View File

@ -8,10 +8,10 @@ class Metier_Partenaires_MCadastre
protected $siren = null;
/**
* Database
* @var Metier_Util_Db
* PDO Connection with Doctrine
* @var \Doctrine\DBAL\Connection
*/
protected $iDb;
protected $conn;
/**
* Droits des locaux
@ -162,17 +162,20 @@ class Metier_Partenaires_MCadastre
/**
* Cadastre
* @param string $siren
* @param Metier_Util_Db $db
* @param \Doctrine\DBAL\Connection $conn
*/
public function __construct($siren = null, $db = null)
public function __construct($conn = null)
{
$this->siren = $siren;
if ( $db === null ) {
$this->iDb = new Metier_Util_Db();
} else {
$this->iDb = $db;
$this->conn = Zend_Registry::get('doctrine');
}
/**
* Identifiant
* @param string $companyId
*/
public function setId($companyId)
{
$this->siren = $companyId;
}
/**
@ -230,15 +233,14 @@ class Metier_Partenaires_MCadastre
$siren = $this->siren;
}
$results = $this->iDb->select(
'sdv1.cad_perloc l, sdv1.cad_permor e',
'e.INTCIF, e.DNUPER, e.CCOGRM, e.DDENPM, e.DSIPMO, e.DFORME, e.DSIREN, e.DLIGN3, e.DLIGN4, e.DLIGN5, e.DLIGN6, e.CCODEP, e.CCOCOM AS companyCCOCOM,
l.CCODRO, l.CCOCOM, l.CCOPRF, l.CCOSEC, l.DNUPLA, l.DNUBAT, l.DESC, l.DNIV, l.DPOR, l.CCONLC, l.CCOAFF0, l.DSUPOD0, l.CCOAFF1, l.DSUPOD1, l.CCOAFF2, l.DSUPOD2, l.CCOAFF3, l.DSUPOD3, l.CCOAFF4, l.DSUPOD4, l.CCOAFF5, l.DSUPOD5, l.CCOAFF6, l.DSUPOD6, l.CCOAFF7, l.DSUPOD7, l.CCOAFF8, l.DSUPOD8, l.CCOAFF9, l.DSUPOD9, l.CCODEP, l.DLICOM, l.CCORIV, l.CNAVOI, l.DLIVOI, l.DNUVOI, l.DLTNUV',
"e.DSIREN='$siren' AND e.INTCIF=l.INTCIF AND e.DNUPER=l.DNUPER", false, MYSQL_ASSOC);
$sql = "SELECT e.INTCIF, e.DNUPER, e.CCOGRM, e.DDENPM, e.DSIPMO, e.DFORME, e.DSIREN, e.DLIGN3, e.DLIGN4, e.DLIGN5, e.DLIGN6, e.CCODEP, e.CCOCOM AS companyCCOCOM,
l.CCODRO, l.CCOCOM, l.CCOPRF, l.CCOSEC, l.DNUPLA, l.DNUBAT, l.DESC, l.DNIV, l.DPOR, l.CCONLC, l.CCOAFF0, l.DSUPOD0, l.CCOAFF1, l.DSUPOD1, l.CCOAFF2, l.DSUPOD2, l.CCOAFF3, l.DSUPOD3, l.CCOAFF4, l.DSUPOD4, l.CCOAFF5, l.DSUPOD5, l.CCOAFF6, l.DSUPOD6, l.CCOAFF7, l.DSUPOD7, l.CCOAFF8, l.DSUPOD8, l.CCOAFF9, l.DSUPOD9, l.CCODEP, l.DLICOM, l.CCORIV, l.CNAVOI, l.DLIVOI, l.DNUVOI, l.DLTNUV
FROM sdv1.cad_perloc l, sdv1.cad_permor e WHERE e.DSIREN='$siren' AND e.INTCIF=l.INTCIF AND e.DNUPER=l.DNUPER";
$stmt = $this->conn->executeQuery($sql);
$locaux = array();
if (count($results) > 0) {
foreach ($results as $i => $loc) {
if ($stmt->rowCount() > 0) {
while($loc = $stmt->fetch(\PDO::FETCH_ASSOC)) {
$format = array(
'idCentre' => $loc['INTCIF'],
'idPmMajic' => $loc['DNUPER'],
@ -306,15 +308,15 @@ class Metier_Partenaires_MCadastre
$siren = $this->siren;
};
$results = $this->iDb->select(
'sdv1.cad_perpar p, sdv1.cad_permor e',
'e.INTCIF, e.DNUPER, e.CCOGRM, e.DDENPM, e.DSIPMO, e.DFORME, e.DSIREN, e.DLIGN3, e.DLIGN4, e.DLIGN5, e.DLIGN6, e.CCODEP, e.CCOCOM AS companyCCOCOM,
p.CCODRO, p.CCOCOM, p.CCOPRF, p.CCOSEC, p.DNUPLA, p.DCNPAR, p.DSGRPF0, p.DCNSUF0, p.DSGRPF1, p.DCNSUF1, p.DSGRPF2, p.DCNSUF2, p.DSGRPF3, p.DCNSUF3, p.DSGRPF4, p.DCNSUF4, p.DSGRPF5, p.DCNSUF5, p.DSGRPF6, p.DCNSUF6, p.DSGRPF7, p.DCNSUF7, p.DSGRPF8, p.DCNSUF8, p.DSGRPF9, p.DCNSUF9, p.CCODEP, p.DLICOM, p.CCORIV, p.CNAVOI, p.DLIVOI, p.DNUVOI, p.DLTNUV',
"e.DSIREN='$siren' AND e.INTCIF=p.INTCIF AND e.DNUPER=p.DNUPER", false, MYSQL_ASSOC);
$sql = "SELECT e.INTCIF, e.DNUPER, e.CCOGRM, e.DDENPM, e.DSIPMO, e.DFORME, e.DSIREN, e.DLIGN3, e.DLIGN4, e.DLIGN5, e.DLIGN6, e.CCODEP, e.CCOCOM AS companyCCOCOM,
p.CCODRO, p.CCOCOM, p.CCOPRF, p.CCOSEC, p.DNUPLA, p.DCNPAR, p.DSGRPF0, p.DCNSUF0, p.DSGRPF1, p.DCNSUF1, p.DSGRPF2, p.DCNSUF2, p.DSGRPF3, p.DCNSUF3, p.DSGRPF4, p.DCNSUF4, p.DSGRPF5, p.DCNSUF5, p.DSGRPF6, p.DCNSUF6, p.DSGRPF7, p.DCNSUF7, p.DSGRPF8, p.DCNSUF8, p.DSGRPF9, p.DCNSUF9, p.CCODEP, p.DLICOM, p.CCORIV, p.CNAVOI, p.DLIVOI, p.DNUVOI, p.DLTNUV
FROM sdv1.cad_perpar p, sdv1.cad_permor e
WHERE e.DSIREN='$siren' AND e.INTCIF=p.INTCIF AND e.DNUPER=p.DNUPER";
$stmt = $this->conn->executeQuery($sql);
$parcelles = array();
if (count($results) > 0) {
foreach ($results as $i => $loc) {
if ($stmt->rowCount() > 0) {
while($loc = $stmt->fetch(\PDO::FETCH_ASSOC)) {
$format = array(
'idCentre' => $loc['INTCIF'],
'idPmMajic' => $loc['DNUPER'],
@ -382,19 +384,22 @@ class Metier_Partenaires_MCadastre
if ($droit != 'P') {
$droitSql = " AND l.CCODRO!='P'";
}
$results = $this->iDb->select('sdv1.cad_perloc l, sdv1.cad_permor e',
"count(*) AS itemTotal, (SUM(l.DSUPOD0) + SUM(l.DSUPOD1) + SUM(l.DSUPOD2) + SUM(l.DSUPOD3) + SUM(l.DSUPOD4) + SUM(l.DSUPOD5) + SUM(l.DSUPOD7) + SUM(l.DSUPOD8) + SUM(l.DSUPOD9)) AS surfaceTotal",
"e.DSIREN='".$this->siren."' AND e.INTCIF=l.INTCIF AND e.DNUPER=l.DNUPER".$droitSql, false, MYSQL_ASSOC);
$sql = "SELECT count(*) AS itemTotal, (SUM(l.DSUPOD0) + SUM(l.DSUPOD1) + SUM(l.DSUPOD2) + SUM(l.DSUPOD3) + SUM(l.DSUPOD4) + SUM(l.DSUPOD5) + SUM(l.DSUPOD7) + SUM(l.DSUPOD8) + SUM(l.DSUPOD9)) AS surfaceTotal
FROM sdv1.cad_perloc l, sdv1.cad_permor e
WHERE e.DSIREN='".$this->siren."' AND e.INTCIF=l.INTCIF AND e.DNUPER=l.DNUPER".$droitSql;
$stmt = $this->conn->executeQuery($sql);
$results = $stmt->fetchAll(\PDO::FETCH_ASSOC);
}
elseif ($type == 'parcelle') {
$droitSql = " AND p.CCODRO='P'";
if ($droit != 'P') {
$droitSql = " AND p.CCODRO!='P'";
}
$results = $this->iDb->select('sdv1.cad_perpar p, sdv1.cad_permor e',
"count(*) AS itemTotal, sum(p.DCNPAR) AS surfaceTotal",
"e.DSIREN='".$this->siren."' AND e.INTCIF=p.INTCIF AND e.DNUPER=p.DNUPER".$droitSql, false, MYSQL_ASSOC);
$sql = "SELECT count(*) AS itemTotal, sum(p.DCNPAR) AS surfaceTotal
FROM sdv1.cad_perpar p, sdv1.cad_permor e
WHERE e.DSIREN='".$this->siren."' AND e.INTCIF=p.INTCIF AND e.DNUPER=p.DNUPER".$droitSql;
$stmt = $this->conn->executeQuery($sql);
$results = $stmt->fetchAll(\PDO::FETCH_ASSOC);
}
return $results;
@ -487,13 +492,11 @@ class Metier_Partenaires_MCadastre
"WHERE e.DSIREN='$this->siren' AND e.INTCIF=p.INTCIF AND e.DNUPER=p.DNUPER";
$sql = "SELECT * FROM ( ($locauxSql) UNION ALL ($parcellesSql) ) results";
$db = Zend_Db_Table::getDefaultAdapter();
$results = $db->fetchAll($sql, null, Zend_Db::FETCH_ASSOC);
$stmt = $this->conn->executeQuery($sql);
$list = array();
if (count($results) > 0) {
foreach ($results as $result) {
if ($stmt->rowCount() > 0) {
while ($result = $stmt->fetch(\PDO::FETCH_ASSOC)) {
// Libellé role
$result['roleLib'] = self::$codeDroit[trim($result['role'])];
$list[] = $result;

File diff suppressed because it is too large Load Diff

View File

@ -3550,7 +3550,8 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
$CADTER_NB_NONPROP=0; // nombre de postes TERRAINS à l'adresse dont elle n'est pas propriétaire
$CADBAT_SURF_TOT=0; // Surface totale des batiments du SIREN
$CADTER_SURF_TOT=0; // Surface totale des terrains du SIREN
$iCadastre = new Metier_Partenaires_MCadastre($siren, $iDb);
$iCadastre = new Metier_Partenaires_MCadastre();
$iCadastre->setId($siren);
// Locaux
$batimentP = $iCadastre->getSurfaceTotal('local');
if (count($batimentP) > 0) {

View File

@ -1094,31 +1094,35 @@ class Metier_Scores_MSolvabilite
/**
*
* @return Ambigous <number, multitype:number >
* @return integer
*/
public function getPtActivite()
{
if (strlen($this->naf)==4)
if (isset($this->tabPtNaf[$this->naf]))
if (strlen($this->naf) == 4) {
if (isset($this->tabPtNaf[$this->naf])) {
$nbPoints = $this->tabPtNaf[$this->naf];
else
}
else {
$nbPoints = 5;
}
}
elseif (strlen($this->naf) == 5) {
$iCotation = new Metier_Scores_ICotation(array(), true, $this->iDb);
//print_r($iCotation->tabNaf21);
//die();
if (isset($iCotation->tabNaf21[$this->naf])) {
$naf4 = $iCotation->tabNaf21[$this->naf];
if (isset($this->tabPtNaf[$naf4]))
if (isset($this->tabPtNaf[$naf4])) {
$nbPoints = $this->tabPtNaf[$naf4];
else
}
else {
$nbPoints = 5;
}
}
else
$nbPoints = 5;
}
else
else {
$nbPoints = 5;
}
return $nbPoints;
}

View File

@ -1348,7 +1348,8 @@ class Entreprise extends Scores_Ws_Server
$db = Zend_Db_Table_Abstract::getDefaultAdapter();
$cadastre = new Metier_Partenaires_MCadastre($companyId, $db);
$cadastre = new Metier_Partenaires_MCadastre();
$cadastre->setId($companyId);
$patrimoine = array();
$results = $cadastre->patrimoine();