Groupe
This commit is contained in:
parent
18965841d6
commit
de9dcbca53
@ -28,9 +28,11 @@ try {
|
||||
$opts = new Zend_Console_Getopt(
|
||||
//Options
|
||||
array(
|
||||
'help|?' => "Aide.",
|
||||
'help|?' => "Aide.",
|
||||
'id=s' => "Identifiant du traitement",
|
||||
'file=s' => "Traitement manuel avec spécification du fichier",
|
||||
'key=s' => "Liste des clés pour l'enrichissement",
|
||||
'use-id=s' => "Utilise un autre id que SIREN/SIRET",
|
||||
'reprise' => "Reprendre un fichier à la ligne n-1",
|
||||
'ask' => "Interaction avec l'utilisateur lors d'une reprise manuelle",
|
||||
'doublon=s' => "Option dédoublonnage par fichier",
|
||||
@ -1497,6 +1499,7 @@ function TelOrderData($siren, $nic, $values)
|
||||
function LienHeadEntete()
|
||||
{
|
||||
return array(
|
||||
'HeadId',
|
||||
'HeadSiren',
|
||||
'HeadIsin',
|
||||
'HeadPpPm',
|
||||
@ -1511,11 +1514,13 @@ function LienHeadData($siren, $nic, $values)
|
||||
require_once 'Metier/partenaires/classMLiens2.php';
|
||||
|
||||
$c = new MLiens2($siren, 'siren', $dbJo);
|
||||
$c->stopAtFirstIsin = true;
|
||||
$id = $c->getHead();
|
||||
$result = $c->getIdentity($id);
|
||||
$tabData = array();
|
||||
if ( $result ) {
|
||||
$tabData = array(
|
||||
'HeadId' => $result->id,
|
||||
'HeadSiren' => $result->siren,
|
||||
'HeadIsin' => $result->isin,
|
||||
'HeadPpPm' => $result->PpPm,
|
||||
@ -1749,17 +1754,39 @@ function groupesEntete()
|
||||
'LienPmin',
|
||||
);
|
||||
}
|
||||
function groupesData()
|
||||
function groupesMultiple($siren, $nic, $values = false)
|
||||
{
|
||||
global $dbJo;
|
||||
$tabData = array();
|
||||
|
||||
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);
|
||||
}
|
||||
$identity = $c->getIdentity();
|
||||
|
||||
$level = 0;
|
||||
$tabData[] = array(
|
||||
'Niveau' => 'N'.$level,
|
||||
'LienSiren' => $identity->siren,
|
||||
'LienNom' => $identity->RS,
|
||||
'LienPays' => $identity->adresse_pays,
|
||||
'LienPmin' => '',
|
||||
);
|
||||
|
||||
$level = $level+1;
|
||||
$result = $c->getTreeRecursive($identity->id);
|
||||
foreach ($result as $item) {
|
||||
$tabData[] = array(
|
||||
'Niveau' => 'N'.$level,
|
||||
'LienSiren' => $item['siren'],
|
||||
'LienNom' => $item['name'],
|
||||
'LienPays' => $item['pays'],
|
||||
'LienPmin' => $item['pmin'],
|
||||
);
|
||||
$children = array();
|
||||
if ( count($item['children'])>0 ) {
|
||||
$children = groupesChildren($item['children'], $level+1);
|
||||
}
|
||||
$tabData = array_merge($tabData, $children);
|
||||
}
|
||||
return $tabData;
|
||||
}
|
||||
@ -1767,19 +1794,21 @@ function groupesChildren($tab, $level)
|
||||
{
|
||||
$result = array();
|
||||
if ( count($tab)>0 ) {
|
||||
foreach($tab as $item) {
|
||||
|
||||
$result[] = array(
|
||||
$head = array();
|
||||
foreach($tab as $k => $item) {
|
||||
$head[] = 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;
|
||||
$result = array_merge($result, $head);
|
||||
$children = array();
|
||||
if ( count($item['children'])>0 ) {
|
||||
$children = groupesChildren($item['children'], $level+1);
|
||||
}
|
||||
$result = array_merge($result, $children);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user