Add participations
This commit is contained in:
parent
e9386b670b
commit
e473d586d3
@ -14,9 +14,9 @@ class MLiens2
|
||||
protected $siren = null;
|
||||
|
||||
/**
|
||||
* @var Zend_Db
|
||||
* @var Zend_Db_Adapter_Abstract
|
||||
*/
|
||||
protected $db;
|
||||
protected $db = null;
|
||||
|
||||
/**
|
||||
* Array to list id find during list of childrens
|
||||
@ -32,7 +32,7 @@ class MLiens2
|
||||
*/
|
||||
public function __construct($id, $type = 'ref', $db=null)
|
||||
{
|
||||
if (null === $this->db) {
|
||||
if (null === $this->db && null === $db) {
|
||||
//Load configuration
|
||||
if (Zend_Registry::isRegistered('config')) {
|
||||
$c = Zend_Registry::get('config');
|
||||
@ -48,11 +48,15 @@ class MLiens2
|
||||
} catch (Zend_Exception $e) {
|
||||
throw new Exception($e->getMessage());
|
||||
}
|
||||
} else {
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
Zend_Db_Table::setDefaultAdapter($this->db);
|
||||
|
||||
if ( $type == 'siren' ) {
|
||||
$this->siren = $id;
|
||||
$refM = new Application_Model_JoLiensRef($this->db);
|
||||
$refM = new Application_Model_JoLiensRef();
|
||||
$sql = $refM->select()->where('siren=?', $id);
|
||||
$result = $refM->fetchRow($sql);
|
||||
if ( $result !== null ) {
|
||||
@ -178,7 +182,7 @@ class MLiens2
|
||||
public function getDirections($actif = null)
|
||||
{
|
||||
if ( null === $this->siren ) {
|
||||
$refM = new Application_Model_JoLiensRef($this->db);
|
||||
$refM = new Application_Model_JoLiensRef();
|
||||
$rows = $refM->find($this->idRef);
|
||||
$siren = str_pad($rows->current()->siren, 9, '0', STR_PAD_LEFT);
|
||||
} else {
|
||||
@ -189,7 +193,7 @@ class MLiens2
|
||||
|
||||
if ( null !== $siren && intval($siren) != 0 )
|
||||
{
|
||||
$directionsM = new Application_Model_JoRncsDirigeants($this->db);
|
||||
$directionsM = new Application_Model_JoRncsDirigeants();
|
||||
$sql = $directionsM->select()->from($directionsM, array(
|
||||
'siren','raisonSociale', 'dirSiren', 'dirRS', 'civilite', 'nom',
|
||||
'prenom', 'naissance_date', 'naissance_lieu', 'fonction_code', 'fonction_lib'
|
||||
@ -275,7 +279,7 @@ class MLiens2
|
||||
$id = $this->idRef;
|
||||
}
|
||||
|
||||
$refM = new Application_Model_JoLiensRef($this->db);
|
||||
$refM = new Application_Model_JoLiensRef();
|
||||
$row = $refM->find($id);
|
||||
if (null !== row) {
|
||||
return $row->current();
|
||||
|
Loading…
Reference in New Issue
Block a user