This commit is contained in:
Michael RICOIS 2014-04-14 14:31:39 +00:00
commit b7abe3c733
2 changed files with 56 additions and 3 deletions

View File

@ -14,7 +14,7 @@ class MTel
public $iDb;
public function __construct($accesDistant=false)
public function __construct($accesDistant=false, $db=null)
{
$this->accesDistant=$accesDistant;
$this->accesDistant=false; // Accès bloqué par "pagespro"
@ -26,7 +26,12 @@ class MTel
$this->body=$page['body'];
$this->codeRetour=$page['code'];
}
$this->iDb=new WDB('jo');
if ( $db === null ) {
$this->iDb=new WDB('jo');
} else {
$this->iDb = $db;
}
}
/**

View File

@ -1473,9 +1473,10 @@ function TelOrderEntete()
}
function TelOrderData($siren, $nic, $values)
{
global $iDb;
require_once 'Metier/partenaires/classMTel.php';
$c = new MTel();
$c = new MTel(false, $iDb);
$result = $c->getTel($siren, 0, true, 1);
$tabData = array();
if ( count($result)>0 ) {
@ -1736,6 +1737,53 @@ function annoncetxtMultiple($siren, $nic, $values = false)
return $tabData;
}
function groupesEntete()
{
return array(
'Niveau',
'LienSiren',
'LienNom',
'LienPays',
'LienPmin',
);
}
function groupesData()
{
global $dbJo;
require_once 'Metier/partenaires/classMLiens2.php';
$c = new MLiens2($siren, 'siren', $dbJo);
$result = $c->getTree();
$tabData = array();
if ( count($result)>0 ) {
foreach($result as $item) {
$tabData = groupesChildren($item, 0);
}
}
return $tabData;
}
function groupesChildren($tab, $level)
{
$result = array();
if ( count($tab)>0 ) {
foreach($tab as $item) {
$result[] = array(
'Niveau' => 'N'.$level,
'LienSiren' => $item['siren'],
'LienNom' => $item['name'],
'LienPays' => $item['pays'],
'LienPmin' => $item['pmin'],
);
$children = groupesChildren($item['children'], $level+1);
$result = $result + children;
}
}
return $result;
}
/* == FUNCTION == */
/**