Fix psr2 CS
This commit is contained in:
parent
6356f3566c
commit
2598a463b7
@ -51,8 +51,7 @@ class Metier_Liens_Base
|
|||||||
{
|
{
|
||||||
if ($conn === null) {
|
if ($conn === null) {
|
||||||
$this->conn = Zend_Registry::get('doctrine');
|
$this->conn = Zend_Registry::get('doctrine');
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->conn = $conn;
|
$this->conn = $conn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -65,7 +64,7 @@ class Metier_Liens_Base
|
|||||||
public function setId($id, $type = 'ref')
|
public function setId($id, $type = 'ref')
|
||||||
{
|
{
|
||||||
// Get Id
|
// Get Id
|
||||||
if ( $type == 'siren' ) {
|
if ($type == 'siren') {
|
||||||
$this->siren = $id;
|
$this->siren = $id;
|
||||||
try {
|
try {
|
||||||
$sql = "SELECT * FROM jo.liensRef WHERE siren = :id AND dateSuppr = 0";
|
$sql = "SELECT * FROM jo.liensRef WHERE siren = :id AND dateSuppr = 0";
|
||||||
@ -76,12 +75,10 @@ class Metier_Liens_Base
|
|||||||
$result = $stmt->fetch(\PDO::FETCH_OBJ);
|
$result = $stmt->fetch(\PDO::FETCH_OBJ);
|
||||||
$this->idRef = $result->id;
|
$this->idRef = $result->id;
|
||||||
}
|
}
|
||||||
}
|
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||||
catch (\Doctrine\DBAL\DBALException $e) {
|
|
||||||
throw new Exception(__METHOD__ . ': ' . $e->getMessage());
|
throw new Exception(__METHOD__ . ': ' . $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->idRef = $id;
|
$this->idRef = $id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -94,13 +91,13 @@ class Metier_Liens_Base
|
|||||||
*/
|
*/
|
||||||
public function getActionnaires($id = null, $actif = null)
|
public function getActionnaires($id = null, $actif = null)
|
||||||
{
|
{
|
||||||
if ( null === $id ) {
|
if (null === $id) {
|
||||||
$id = $this->idRef;
|
$id = $this->idRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
$liens = array();
|
$liens = array();
|
||||||
|
|
||||||
if ( null === $id ) {
|
if (null === $id) {
|
||||||
return $liens;
|
return $liens;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,8 +118,8 @@ class Metier_Liens_Base
|
|||||||
->orderBy('l.PDetention', 'DESC');
|
->orderBy('l.PDetention', 'DESC');
|
||||||
|
|
||||||
// Actif / Inactif
|
// Actif / Inactif
|
||||||
if ( null !== $actif ) {
|
if (null !== $actif) {
|
||||||
if ( false === $actif ) {
|
if (false === $actif) {
|
||||||
$qb->andWhere('l.actif = 0');
|
$qb->andWhere('l.actif = 0');
|
||||||
} else {
|
} else {
|
||||||
$qb->andWhere('l.actif = 1');
|
$qb->andWhere('l.actif = 1');
|
||||||
@ -131,10 +128,9 @@ class Metier_Liens_Base
|
|||||||
|
|
||||||
// Don't display deleted - anomaly
|
// Don't display deleted - anomaly
|
||||||
$qb->andWhere("l.dateSuppr = '0000-00-00 00:00:00'");
|
$qb->andWhere("l.dateSuppr = '0000-00-00 00:00:00'");
|
||||||
$stmt = $qb->execute();
|
$stmt = $qb->execute();
|
||||||
$liens = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
$liens = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
||||||
}
|
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||||
catch (\Doctrine\DBAL\DBALException $e) {
|
|
||||||
throw new Exception(__METHOD__ . ': ' . $e->getMessage());
|
throw new Exception(__METHOD__ . ': ' . $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,11 +145,11 @@ class Metier_Liens_Base
|
|||||||
*/
|
*/
|
||||||
public function getParticipations($id = null, $actif = null)
|
public function getParticipations($id = null, $actif = null)
|
||||||
{
|
{
|
||||||
if ( null === $id ) {
|
if (null === $id) {
|
||||||
$id = $this->idRef;
|
$id = $this->idRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( false === $actif ) {
|
if (false === $actif) {
|
||||||
$actif = 0;
|
$actif = 0;
|
||||||
} else {
|
} else {
|
||||||
$actif = 1;
|
$actif = 1;
|
||||||
@ -161,7 +157,7 @@ class Metier_Liens_Base
|
|||||||
|
|
||||||
$liens = array();
|
$liens = array();
|
||||||
|
|
||||||
if ( null === $id ) {
|
if (null === $id) {
|
||||||
return $liens;
|
return $liens;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,8 +178,8 @@ class Metier_Liens_Base
|
|||||||
->orderBy('l.PDetention', 'DESC');
|
->orderBy('l.PDetention', 'DESC');
|
||||||
|
|
||||||
// Actif / Inactif
|
// Actif / Inactif
|
||||||
if ( null !== $actif ) {
|
if (null !== $actif) {
|
||||||
if ( false === $actif ) {
|
if (false === $actif) {
|
||||||
$qb->andWhere('l.actif = 0');
|
$qb->andWhere('l.actif = 0');
|
||||||
} else {
|
} else {
|
||||||
$qb->andWhere('l.actif = 1');
|
$qb->andWhere('l.actif = 1');
|
||||||
@ -194,8 +190,7 @@ class Metier_Liens_Base
|
|||||||
$qb->andWhere("l.dateSuppr = '0000-00-00 00:00:00'");
|
$qb->andWhere("l.dateSuppr = '0000-00-00 00:00:00'");
|
||||||
$stmt = $qb->execute();
|
$stmt = $qb->execute();
|
||||||
$liens = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
$liens = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
||||||
}
|
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||||
catch (\Doctrine\DBAL\DBALException $e) {
|
|
||||||
throw new Exception(__METHOD__ . ': ' . $e->getMessage());
|
throw new Exception(__METHOD__ . ': ' . $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,8 +210,7 @@ class Metier_Liens_Base
|
|||||||
$stmt->bindValue('id', $this->idRef);
|
$stmt->bindValue('id', $this->idRef);
|
||||||
$result = $stmt->fetch(\PDO::FETCH_OBJ);
|
$result = $stmt->fetch(\PDO::FETCH_OBJ);
|
||||||
$siren = $result->siren;
|
$siren = $result->siren;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$siren = $this->siren;
|
$siren = $this->siren;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,10 +226,9 @@ class Metier_Liens_Base
|
|||||||
->andWhere('dirSiren = :siren')->setParameter('siren', $siren);
|
->andWhere('dirSiren = :siren')->setParameter('siren', $siren);
|
||||||
// Actif / Inactif
|
// Actif / Inactif
|
||||||
if (null !== $actif) {
|
if (null !== $actif) {
|
||||||
if ( false === $actif ) {
|
if (false === $actif) {
|
||||||
$qb->andWhere('actif = 0');
|
$qb->andWhere('actif = 0');
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$qb->andWhere('actif = 1');
|
$qb->andWhere('actif = 1');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -261,7 +254,7 @@ class Metier_Liens_Base
|
|||||||
*/
|
*/
|
||||||
public function getHead($id = null, $detention = 0)
|
public function getHead($id = null, $detention = 0)
|
||||||
{
|
{
|
||||||
if ( null === $id ) {
|
if (null === $id) {
|
||||||
$id = $this->idRef;
|
$id = $this->idRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,32 +265,32 @@ class Metier_Liens_Base
|
|||||||
$liens = $this->getActionnaires($id, true);
|
$liens = $this->getActionnaires($id, true);
|
||||||
|
|
||||||
//Find the following up entity
|
//Find the following up entity
|
||||||
if ( count($liens)>0 ) {
|
if (count($liens)>0) {
|
||||||
foreach ( $liens as $item ) {
|
foreach ($liens as $item) {
|
||||||
//Don't through again and again
|
//Don't through again and again
|
||||||
if ( in_array($item->idAct, $this->findId) ) {
|
if (in_array($item->idAct, $this->findId)) {
|
||||||
return $item->idAct;
|
return $item->idAct;
|
||||||
} elseif ( $this->stopAtFirstIsin === true && !empty($item->isin)) {
|
} elseif ($this->stopAtFirstIsin === true && !empty($item->isin)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//Remove physical person
|
//Remove physical person
|
||||||
elseif ( $item->PpPm == 'PP' && $this->stopAtPP ) {
|
elseif ($item->PpPm == 'PP' && $this->stopAtPP) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//Same id
|
//Same id
|
||||||
elseif ( $item->idAct == $id ) {
|
elseif ($item->idAct == $id) {
|
||||||
return $id;
|
return $id;
|
||||||
}
|
}
|
||||||
//PDetention>50
|
//PDetention>50
|
||||||
elseif ( $item->PDetention > 50 && $item->idAct > 1000 ) {
|
elseif ($item->PDetention > 50 && $item->idAct > 1000) {
|
||||||
return $this->getHead($item->idAct, $detention);
|
return $this->getHead($item->idAct, $detention);
|
||||||
}
|
}
|
||||||
//MajMin=+
|
//MajMin=+
|
||||||
elseif ( $item->PDetention > $detention && $item->MajMin == '+' && $item->idAct > 1000 ) {
|
elseif ($item->PDetention > $detention && $item->MajMin == '+' && $item->idAct > 1000) {
|
||||||
return $this->getHead($item->idAct, $detention);
|
return $this->getHead($item->idAct, $detention);
|
||||||
}
|
}
|
||||||
//--
|
//--
|
||||||
elseif ( $item->PDetention > $detention && $item->idAct > 1000 ) {
|
elseif ($item->PDetention > $detention && $item->idAct > 1000) {
|
||||||
return $this->getHead($item->idAct, $detention);
|
return $this->getHead($item->idAct, $detention);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -313,7 +306,7 @@ class Metier_Liens_Base
|
|||||||
*/
|
*/
|
||||||
public function getIdentity($id = null)
|
public function getIdentity($id = null)
|
||||||
{
|
{
|
||||||
if ( null === $id ) {
|
if (null === $id) {
|
||||||
$id = $this->idRef;
|
$id = $this->idRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -338,15 +331,15 @@ class Metier_Liens_Base
|
|||||||
{
|
{
|
||||||
//Get identity to stop at isin
|
//Get identity to stop at isin
|
||||||
$itemWithIsin = null;
|
$itemWithIsin = null;
|
||||||
if ( $this->stopAtFirstIsin === true ) {
|
if ($this->stopAtFirstIsin === true) {
|
||||||
$id = $this->idRef;
|
$id = $this->idRef;
|
||||||
$identity = $this->getIdentity($this->idRef);
|
$identity = $this->getIdentity($this->idRef);
|
||||||
if ( !empty($identity->isin) ) {
|
if (!empty($identity->isin)) {
|
||||||
$itemWithIsin = true;
|
$itemWithIsin = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $itemWithIsin !== true ) {
|
if ($itemWithIsin !== true) {
|
||||||
//Récupération de la maison mère
|
//Récupération de la maison mère
|
||||||
$id = $this->getHead(null, 50);
|
$id = $this->getHead(null, 50);
|
||||||
//Informations de la maison mère
|
//Informations de la maison mère
|
||||||
@ -357,21 +350,21 @@ class Metier_Liens_Base
|
|||||||
$this->findId[] = $identity->id;
|
$this->findId[] = $identity->id;
|
||||||
|
|
||||||
$nom = $identity->RS;
|
$nom = $identity->RS;
|
||||||
if ( $identity->nom != '') {
|
if ($identity->nom != '') {
|
||||||
$nom = $identity->civilite.' '.$identity->nom.' '.$identity->prenom;
|
$nom = $identity->civilite.' '.$identity->nom.' '.$identity->prenom;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $this->country === null ) {
|
if ($this->country === null) {
|
||||||
$this->country = $this->getCountry();
|
$this->country = $this->getCountry();
|
||||||
}
|
}
|
||||||
|
|
||||||
$pays = $identity->adresse_pays;
|
$pays = $identity->adresse_pays;
|
||||||
if ( array_key_exists($identity->adresse_pays, $this->country) ) {
|
if (array_key_exists($identity->adresse_pays, $this->country)) {
|
||||||
$pays = $this->country[$identity->adresse_pays];
|
$pays = $this->country[$identity->adresse_pays];
|
||||||
}
|
}
|
||||||
|
|
||||||
//Retour
|
//Retour
|
||||||
$tabRet = array (
|
$tabRet = array(
|
||||||
'id' => $identity->id,
|
'id' => $identity->id,
|
||||||
'name' => $nom,
|
'name' => $nom,
|
||||||
'siren' => str_pad($identity->siren, 9, '0', STR_PAD_LEFT),
|
'siren' => str_pad($identity->siren, 9, '0', STR_PAD_LEFT),
|
||||||
@ -391,20 +384,22 @@ class Metier_Liens_Base
|
|||||||
* @param int $nbNiveaux
|
* @param int $nbNiveaux
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getTreeRecursive( $id, $pctMin=33, $niveau=0, $nbNiveaux=10 )
|
public function getTreeRecursive($id, $pctMin=33, $niveau=0, $nbNiveaux=10)
|
||||||
{
|
{
|
||||||
if ( $niveau > $nbNiveaux ) return array();
|
if ($niveau > $nbNiveaux) {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
$niveau++;
|
$niveau++;
|
||||||
|
|
||||||
$tabRet = array();
|
$tabRet = array();
|
||||||
$participations = $this->getParticipations($id, true);
|
$participations = $this->getParticipations($id, true);
|
||||||
if ( count($participations)>0 ) {
|
if (count($participations)>0) {
|
||||||
foreach ( $participations as $item ) {
|
foreach ($participations as $item) {
|
||||||
if ( $item->PDetention > $pctMin ) {
|
if ($item->PDetention > $pctMin) {
|
||||||
$identity = $this->getIdentity($item->idPar);
|
$identity = $this->getIdentity($item->idPar);
|
||||||
|
|
||||||
$nom = $identity->RS;
|
$nom = $identity->RS;
|
||||||
if ( $identity->nom != '') {
|
if ($identity->nom != '') {
|
||||||
$nom = $identity->civilite.' '.$identity->nom.' '.$identity->prenom;
|
$nom = $identity->civilite.' '.$identity->nom.' '.$identity->prenom;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -413,11 +408,11 @@ class Metier_Liens_Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
$pays = $identity->adresse_pays;
|
$pays = $identity->adresse_pays;
|
||||||
if ( array_key_exists($identity->adresse_pays, $this->country) ) {
|
if (array_key_exists($identity->adresse_pays, $this->country)) {
|
||||||
$pays = $this->country[$identity->adresse_pays];
|
$pays = $this->country[$identity->adresse_pays];
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = array (
|
$data = array(
|
||||||
'id' => $identity->id,
|
'id' => $identity->id,
|
||||||
'name' => $nom,
|
'name' => $nom,
|
||||||
'siren' => str_pad($identity->siren, 9, '0', STR_PAD_LEFT),
|
'siren' => str_pad($identity->siren, 9, '0', STR_PAD_LEFT),
|
||||||
@ -426,7 +421,7 @@ class Metier_Liens_Base
|
|||||||
'children' => array(),
|
'children' => array(),
|
||||||
);
|
);
|
||||||
//Pour éviter d'avoir des boucles infinis
|
//Pour éviter d'avoir des boucles infinis
|
||||||
if ( !in_array($identity->id, $this->findId) ){
|
if (!in_array($identity->id, $this->findId)) {
|
||||||
$this->findId[] = $identity->id;
|
$this->findId[] = $identity->id;
|
||||||
$data['children'] = $this->getTreeRecursive($identity->id, $pctMin, $niveau, $nbNiveaux);
|
$data['children'] = $this->getTreeRecursive($identity->id, $pctMin, $niveau, $nbNiveaux);
|
||||||
}
|
}
|
||||||
@ -450,7 +445,7 @@ class Metier_Liens_Base
|
|||||||
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
||||||
|
|
||||||
$output = array();
|
$output = array();
|
||||||
foreach ( $result as $item ) {
|
foreach ($result as $item) {
|
||||||
$output[] = $item->isin;
|
$output[] = $item->isin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -465,7 +460,7 @@ class Metier_Liens_Base
|
|||||||
public function getGroupeCAC40($pctMin = 50)
|
public function getGroupeCAC40($pctMin = 50)
|
||||||
{
|
{
|
||||||
$listeIsin = $this->getCAC40();
|
$listeIsin = $this->getCAC40();
|
||||||
$isin = "'".implode("','",$listeIsin)."'";
|
$isin = "'".implode("','", $listeIsin)."'";
|
||||||
|
|
||||||
$this->findId = array();
|
$this->findId = array();
|
||||||
|
|
||||||
@ -475,7 +470,7 @@ class Metier_Liens_Base
|
|||||||
$output = array();
|
$output = array();
|
||||||
if ($stmt->rowCount() > 0) {
|
if ($stmt->rowCount() > 0) {
|
||||||
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
||||||
foreach ( $result as $item ) {
|
foreach ($result as $item) {
|
||||||
$output = $output + $this->getListeGroupeCAC40($item->id, $pctMin);
|
$output = $output + $this->getListeGroupeCAC40($item->id, $pctMin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -489,24 +484,23 @@ class Metier_Liens_Base
|
|||||||
* @param number $pctMin
|
* @param number $pctMin
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getListeGroupeCAC40($id, $pctMin=50 )
|
public function getListeGroupeCAC40($id, $pctMin=50)
|
||||||
{
|
{
|
||||||
$participations = $this->getParticipations($id, true);
|
$participations = $this->getParticipations($id, true);
|
||||||
$output = array();
|
$output = array();
|
||||||
if ( count($participations)>0 ) {
|
if (count($participations)>0) {
|
||||||
foreach ( $participations as $item ) {
|
foreach ($participations as $item) {
|
||||||
if ( $item->PDetention > $pctMin ) {
|
if ($item->PDetention > $pctMin) {
|
||||||
$identity = $this->getIdentity($item->idPar);
|
$identity = $this->getIdentity($item->idPar);
|
||||||
|
|
||||||
if ( intval($identity->siren)!=0 ) {
|
if (intval($identity->siren)!=0) {
|
||||||
$output[] = $identity->siren;
|
$output[] = $identity->siren;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !in_array($identity->id, $this->findId) ){
|
if (!in_array($identity->id, $this->findId)) {
|
||||||
$this->findId[] = $identity->id;
|
$this->findId[] = $identity->id;
|
||||||
$output = $output + $this->getListeGroupeCAC40($identity->id, $pctMin);
|
$output = $output + $this->getListeGroupeCAC40($identity->id, $pctMin);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -521,12 +515,12 @@ class Metier_Liens_Base
|
|||||||
public function isInGroupeCAC40($pctMin = 50)
|
public function isInGroupeCAC40($pctMin = 50)
|
||||||
{
|
{
|
||||||
//Si pas d'actionnaires => false
|
//Si pas d'actionnaires => false
|
||||||
if ( count($this->getActionnaires()) == 0 ) {
|
if (count($this->getActionnaires()) == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$listeInGroupeCAC40 = $this->getGroupeCAC40($pctMin);
|
$listeInGroupeCAC40 = $this->getGroupeCAC40($pctMin);
|
||||||
if ( in_array($this->siren, $listeInGroupeCAC40) ) {
|
if (in_array($this->siren, $listeInGroupeCAC40)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -543,7 +537,7 @@ class Metier_Liens_Base
|
|||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
if ($stmt->rowCount() > 0) {
|
if ($stmt->rowCount() > 0) {
|
||||||
$data = array();
|
$data = array();
|
||||||
foreach($rows as $item) {
|
foreach ($rows as $item) {
|
||||||
$data[$item->codPays3] = $item->libPays;
|
$data[$item->codPays3] = $item->libPays;
|
||||||
}
|
}
|
||||||
return $data;
|
return $data;
|
||||||
@ -551,4 +545,4 @@ class Metier_Liens_Base
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user