Merge
This commit is contained in:
commit
252835f303
@ -345,7 +345,7 @@ $tabEntete = array();
|
||||
$tabIdentifiant = array();
|
||||
$tabData = array();
|
||||
|
||||
$posKeySiren = $posKeySiret = $posKeyNic = false;
|
||||
$posKeySiren = $posKeySiret = $posKeyNic = $posKeySpecial = false;
|
||||
|
||||
//Fichier de définition
|
||||
$inFile = $config->profil->path->data.'/clients/'.$file.'.csv';
|
||||
@ -359,41 +359,67 @@ if (($handle = fopen($inFile, 'r')) !== FALSE) {
|
||||
//Traitement de la première ligne
|
||||
if ($row == 0) {
|
||||
for ($c=0; $c < $num; $c++) {
|
||||
//Détection clé importante
|
||||
switch(strtolower($data[$c])) {
|
||||
case 'siren':
|
||||
$posKeySiren = $c;
|
||||
break;
|
||||
case 'nic':
|
||||
$posKeyNic = $c;
|
||||
break;
|
||||
case 'siret':
|
||||
$posKeySiret = $c;
|
||||
break;
|
||||
case 'ref':
|
||||
$posKeyRef = $c;
|
||||
break;
|
||||
}
|
||||
|
||||
//Détection clé spécifique
|
||||
if ( $opts->use-id ) {
|
||||
|
||||
if ( strtolower($data[$c]) == strtolower($opts->use-id) ) {
|
||||
$posKeySpecial = $c;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
//Détection clé importante
|
||||
switch(strtolower($data[$c])) {
|
||||
case 'siren':
|
||||
$posKeySiren = $c;
|
||||
break;
|
||||
case 'nic':
|
||||
$posKeyNic = $c;
|
||||
break;
|
||||
case 'siret':
|
||||
$posKeySiret = $c;
|
||||
break;
|
||||
case 'ref':
|
||||
$posKeyRef = $c;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
$tabExtract[] = $data[$c];
|
||||
}
|
||||
if ($posKeySiren!==false && $posKeyNic!==false && $posKeySiret!==false || $posKeySiren!==false && $posKeySiret!==false ){
|
||||
die("Trop de clé!");
|
||||
}
|
||||
if ($posKeySiren===false && $posKeySiret===false){
|
||||
die("Aucune clé détecté!");
|
||||
|
||||
if ( !$opts->use-id ) {
|
||||
|
||||
if ($posKeySiren!==false && $posKeyNic!==false && $posKeySiret!==false || $posKeySiren!==false && $posKeySiret!==false ){
|
||||
die("Trop de clé!");
|
||||
}
|
||||
|
||||
if ($posKeySiren===false && $posKeySiret===false){
|
||||
die("Aucune clé détecté!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Traitement des identifiants
|
||||
} else {
|
||||
|
||||
//Gestion des identifiants obligatoire (SIREN, NIC, SIRET)
|
||||
if ( $posKeySiret!==false ){
|
||||
$tabIdentifiant[] = $data[$posKeySiret];
|
||||
} elseif ( $posKeySiren!==false && $posKeyNic!==false ){
|
||||
$tabIdentifiant[] = $data[$posKeySiren].$data[$posKeyNic];
|
||||
} elseif ( $posKeySiren !==false ){
|
||||
$tabIdentifiant[] = $data[$posKeySiren];
|
||||
}
|
||||
if ( $opts->use-id ) {
|
||||
|
||||
$tabIdentifiant[] = $data[$posKeySpecial];
|
||||
|
||||
} else {
|
||||
|
||||
//Gestion des identifiants obligatoire (SIREN, NIC, SIRET)
|
||||
if ( $posKeySiret!==false ){
|
||||
$tabIdentifiant[] = $data[$posKeySiret];
|
||||
} elseif ( $posKeySiren!==false && $posKeyNic!==false ){
|
||||
$tabIdentifiant[] = $data[$posKeySiren].$data[$posKeyNic];
|
||||
} elseif ( $posKeySiren !==false ){
|
||||
$tabIdentifiant[] = $data[$posKeySiren];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Gestion des autres colonnes fournies par le client
|
||||
for ($c=0; $c < $num; $c++) {
|
||||
@ -582,196 +608,242 @@ foreach($tabIdentifiant as $item)
|
||||
echo "Ligne ".($row+1)." - ";
|
||||
|
||||
if ( $opts->reprise && $row < $rowReprise ) {
|
||||
|
||||
//Reprise
|
||||
$row++;
|
||||
echo "Reprise";
|
||||
|
||||
} else {
|
||||
|
||||
$siretValide = false;
|
||||
$sirenValide = false;
|
||||
if ( $opts->use-id ) {
|
||||
|
||||
$siren = substr($item, 0, 9);
|
||||
$nic = substr($item, 9);
|
||||
$id = $item;
|
||||
$tabNewData[$extendNbRow] = $tabData[$row];
|
||||
|
||||
//Simple vérification, seulement des chiffres
|
||||
if (!preg_match('/[0-9]{9}/', $siren)) {
|
||||
$siretValide = $sirenValide = false;
|
||||
} else {
|
||||
//Vérification par algorithme
|
||||
$siretValide = siretValide($item);
|
||||
if ($posKeySiret!==false) {
|
||||
if ($siretValide===false) {
|
||||
$sirenValide = sirenValide($siren);
|
||||
} else {
|
||||
$sirenValide = true;
|
||||
}
|
||||
}
|
||||
//Récupération des données SQL
|
||||
foreach($tabDico as $element => $select)
|
||||
{
|
||||
//Retour lignes multiples
|
||||
if ( $element == 'multiple' )
|
||||
{
|
||||
$values = false;
|
||||
$isSelected = false;
|
||||
foreach($select as $selectItem){
|
||||
if ( in_array($selectItem, $tabExtract) ) {
|
||||
$isSelected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$retour = array();
|
||||
if ( $isSelected && function_exists($selectItem.'Multiple') ) {
|
||||
if( ${$selectItem.'Data'}!=false ){
|
||||
$values = ${$selectItem.'Data'};
|
||||
}
|
||||
$retour = call_user_func($selectItem.'MultipleById', $id, $values);
|
||||
}
|
||||
if (count($retour)>0) {
|
||||
$originalLine = $tabNewData[$extendNbRow];
|
||||
foreach($retour as $i => $retourItem) {
|
||||
$tabNewData[$extendNbRow+$i] = array_merge($originalLine,$retourItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($posKeySiren!==false && $posKeyNic!==false) {
|
||||
$sirenValide = sirenValide($siren);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$tabNewData[$extendNbRow] = $tabData[$row];
|
||||
} else {
|
||||
|
||||
//On définit le tableau de retour (les colonnes du fichier client sont déjà présentent)
|
||||
if ( $posKeySiret!==false ){
|
||||
$tabNewData[$extendNbRow]['siret'] = (string)$item;
|
||||
} elseif ( $posKeySiren!==false && $posKeyNic!==false ){
|
||||
$tabNewData[$extendNbRow]['siren'] = (string)$siren;
|
||||
$tabNewData[$extendNbRow]['nic'] = (string)$nic;
|
||||
} elseif ( $posKeySiren !==false ){
|
||||
$tabNewData[$extendNbRow]['siren'] = (string)$siren;
|
||||
}
|
||||
$siretValide = false;
|
||||
$sirenValide = false;
|
||||
|
||||
$tabNewData[$extendNbRow]['SiretValide'] = ($siretValide===true) ? 1 : 0;
|
||||
$siren = substr($item, 0, 9);
|
||||
$nic = substr($item, 9);
|
||||
|
||||
//Clé de doublon
|
||||
$keyDoublon = null;
|
||||
if ( array_key_exists('keyDoublon', $tabData[$row])) {
|
||||
$keyDoublon = $tabData[$row]['keyDoublon'];
|
||||
}
|
||||
//Simple vérification, seulement des chiffres
|
||||
if ( !preg_match('/[0-9]{9}/', $siren) ) {
|
||||
|
||||
if ( null !== $keyDoublon && in_array($keyDoublon, $doublonList) ) {
|
||||
$tabNewData[$extendNbRow]['doublon'] = 1;
|
||||
} elseif ( $sirenValide===false || intval($siren)==0 ){
|
||||
//Siren faux
|
||||
} else {
|
||||
$siretValide = $sirenValide = false;
|
||||
|
||||
//Vérifier les nic, ou sélectionner le nic du siege actif
|
||||
$nicV = $nic; //Surcharge pour le nic
|
||||
$strNic = '';
|
||||
$sqlNic = 'SELECT LPAD(nic,5,0) AS nicTmp, cj AS cjTmp, IF(siege=1,1,0) AS triSiege FROM jo.etablissements WHERE siren='.$siren;
|
||||
} else {
|
||||
|
||||
//Si identifiant est un siret, char(14) alors on vérifie que le NIC existe
|
||||
if ( strlen($item)==14 && intval($nic)>0 ) {
|
||||
$stmt = $dbMetier->query($sqlNic.' AND nic='.$nic);
|
||||
$result = $stmt->fetchAll();
|
||||
if (count($result)==0){
|
||||
$nicV = 0;
|
||||
$fJur = '0000';
|
||||
} else {
|
||||
//nic : On considère qu'il est vrai si on a un résultat
|
||||
$fJur = $result[0]['cjTmp'];
|
||||
}
|
||||
}
|
||||
//Vérification par algorithme
|
||||
$siretValide = siretValide($item);
|
||||
if ($posKeySiret!==false) {
|
||||
if ($siretValide===false) {
|
||||
$sirenValide = sirenValide($siren);
|
||||
} else {
|
||||
$sirenValide = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( intval($nicV)==0 ) {
|
||||
$strNic = ' AND nic>-1 AND actif>-1 ORDER BY triSiege DESC, actif DESC, nicTmp DESC LIMIT 0,1';
|
||||
$stmt = $dbMetier->query($sqlNic.$strNic);
|
||||
$result = $stmt->fetchAll();
|
||||
if (count($result)>0){
|
||||
$nicV = $result[0]['nicTmp'];
|
||||
$fJur = $result[0]['cjTmp'];
|
||||
} else {
|
||||
$nicV = '00000';
|
||||
$fJur = '0000';
|
||||
}
|
||||
}
|
||||
if ($posKeySiren!==false && $posKeyNic!==false) {
|
||||
$sirenValide = sirenValide($siren);
|
||||
}
|
||||
|
||||
if ( $posKeySiren!==false && $posKeyNic!==false ){
|
||||
$tabNewData[$extendNbRow]['siren'] = $siren;
|
||||
$tabNewData[$extendNbRow]['nic'] = $nic;
|
||||
}
|
||||
}
|
||||
|
||||
//Récupération des données SQL
|
||||
foreach($tabDico as $element => $select)
|
||||
{
|
||||
//Traitement par requete SQL
|
||||
if (isset(${$element.'Fields'})){
|
||||
$tabNewData[$extendNbRow] = $tabData[$row];
|
||||
|
||||
$where = $select['where'];
|
||||
eval( "\$where = \"$where\";" );
|
||||
//On définit le tableau de retour (les colonnes du fichier client sont déjà présentent)
|
||||
if ( $posKeySiret!==false ){
|
||||
$tabNewData[$extendNbRow]['siret'] = (string)$item;
|
||||
} elseif ( $posKeySiren!==false && $posKeyNic!==false ){
|
||||
$tabNewData[$extendNbRow]['siren'] = (string)$siren;
|
||||
$tabNewData[$extendNbRow]['nic'] = (string)$nic;
|
||||
} elseif ( $posKeySiren !==false ){
|
||||
$tabNewData[$extendNbRow]['siren'] = (string)$siren;
|
||||
}
|
||||
|
||||
${$element.'SQL'} = 'SELECT '.${$element.'Fields'}.' FROM '.$select['db'].$where;
|
||||
try {
|
||||
$stmt = $dbMetier->query(${$element.'SQL'});
|
||||
$result = $stmt->fetchAll();
|
||||
if ( count($result)>0 ) {
|
||||
$tabNewData[$extendNbRow] = array_merge( $tabNewData[$extendNbRow] , $result[0]);
|
||||
}
|
||||
} catch (Zend_Db_Exception $e) {
|
||||
$tabNewData[$extendNbRow]['SiretValide'] = ($siretValide===true) ? 1 : 0;
|
||||
|
||||
//Enregistrement du message d'erreur
|
||||
if ($opts->id) {
|
||||
$commandesM->update(array('error'=>$e->getMessage()), "id = ".$commande->id);
|
||||
}
|
||||
//Clé de doublon
|
||||
$keyDoublon = null;
|
||||
if ( array_key_exists('keyDoublon', $tabData[$row])) {
|
||||
$keyDoublon = $tabData[$row]['keyDoublon'];
|
||||
}
|
||||
|
||||
//Arret du script
|
||||
exit;
|
||||
}
|
||||
if ( null !== $keyDoublon && in_array($keyDoublon, $doublonList) ) {
|
||||
$tabNewData[$extendNbRow]['doublon'] = 1;
|
||||
} elseif ( $sirenValide===false || intval($siren)==0 ){
|
||||
//Siren faux
|
||||
} else {
|
||||
|
||||
}
|
||||
//Vérifier les nic, ou sélectionner le nic du siege actif
|
||||
$nicV = $nic; //Surcharge pour le nic
|
||||
$strNic = '';
|
||||
$sqlNic = 'SELECT LPAD(nic,5,0) AS nicTmp, cj AS cjTmp, IF(siege=1,1,0) AS triSiege FROM jo.etablissements WHERE siren='.$siren;
|
||||
|
||||
//Traitement par fonction
|
||||
if( $element == 'data' )
|
||||
{
|
||||
foreach($select as $selectItem)
|
||||
{
|
||||
if ( isset(${$selectItem.'Data'}) )
|
||||
{
|
||||
$values = false;
|
||||
if( ${$selectItem.'Data'}!=false ){
|
||||
$values = ${$selectItem.'Data'};
|
||||
}
|
||||
$retour = call_user_func($selectItem.'Data', $siren, $nicV, $values);
|
||||
$tabNewData[$extendNbRow] = $tabNewData[$extendNbRow] + $retour;
|
||||
}
|
||||
}
|
||||
}
|
||||
//Si identifiant est un siret, char(14) alors on vérifie que le NIC existe
|
||||
if ( strlen($item)==14 && intval($nic)>0 ) {
|
||||
$stmt = $dbMetier->query($sqlNic.' AND nic='.$nic);
|
||||
$result = $stmt->fetchAll();
|
||||
if (count($result)==0){
|
||||
$nicV = 0;
|
||||
$fJur = '0000';
|
||||
} else {
|
||||
//nic : On considère qu'il est vrai si on a un résultat
|
||||
$fJur = $result[0]['cjTmp'];
|
||||
}
|
||||
}
|
||||
|
||||
//Retour lignes multiples
|
||||
elseif ( $element == 'multiple' )
|
||||
{
|
||||
$values = false;
|
||||
$isSelected = false;
|
||||
foreach($select as $selectItem){
|
||||
if ( in_array($selectItem, $tabExtract) ) {
|
||||
$isSelected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$retour = array();
|
||||
if ( $isSelected && function_exists($selectItem.'Multiple') ) {
|
||||
if( ${$selectItem.'Data'}!=false ){
|
||||
$values = ${$selectItem.'Data'};
|
||||
}
|
||||
$retour = call_user_func($selectItem.'Multiple', $siren, $nicV, $values);
|
||||
}
|
||||
if (count($retour)>0) {
|
||||
$originalLine = $tabNewData[$extendNbRow];
|
||||
foreach($retour as $i => $retourItem) {
|
||||
$tabNewData[$extendNbRow+$i] = array_merge($originalLine,$retourItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( intval($nicV)==0 ) {
|
||||
$strNic = ' AND nic>-1 AND actif>-1 ORDER BY triSiege DESC, actif DESC, nicTmp DESC LIMIT 0,1';
|
||||
$stmt = $dbMetier->query($sqlNic.$strNic);
|
||||
$result = $stmt->fetchAll();
|
||||
if (count($result)>0){
|
||||
$nicV = $result[0]['nicTmp'];
|
||||
$fJur = $result[0]['cjTmp'];
|
||||
} else {
|
||||
$nicV = '00000';
|
||||
$fJur = '0000';
|
||||
}
|
||||
}
|
||||
|
||||
//Traitement des libellés génériques
|
||||
else
|
||||
{
|
||||
foreach($select['cle'] as $cle => $values)
|
||||
if ( $posKeySiren!==false && $posKeyNic!==false ){
|
||||
$tabNewData[$extendNbRow]['siren'] = $siren;
|
||||
$tabNewData[$extendNbRow]['nic'] = $nic;
|
||||
}
|
||||
|
||||
//Récupération des données SQL
|
||||
foreach($tabDico as $element => $select)
|
||||
{
|
||||
//Traitement par requete SQL
|
||||
if (isset(${$element.'Fields'})){
|
||||
|
||||
$where = $select['where'];
|
||||
eval( "\$where = \"$where\";" );
|
||||
|
||||
${$element.'SQL'} = 'SELECT '.${$element.'Fields'}.' FROM '.$select['db'].$where;
|
||||
try {
|
||||
$stmt = $dbMetier->query(${$element.'SQL'});
|
||||
$result = $stmt->fetchAll();
|
||||
if ( count($result)>0 ) {
|
||||
$tabNewData[$extendNbRow] = array_merge( $tabNewData[$extendNbRow] , $result[0]);
|
||||
}
|
||||
} catch (Zend_Db_Exception $e) {
|
||||
|
||||
//Enregistrement du message d'erreur
|
||||
if ($opts->id) {
|
||||
$commandesM->update(array('error'=>$e->getMessage()), "id = ".$commande->id);
|
||||
}
|
||||
|
||||
//Arret du script
|
||||
exit;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Traitement par fonction
|
||||
if( $element == 'data' )
|
||||
{
|
||||
if ( in_array($cle.'Lib', $tabEntete) && isset(${'tab'.ucfirst($cle)}) )
|
||||
{
|
||||
$retour[$cle.'Lib'] = 'Non trouvé';
|
||||
$codeFromData = $tabNewData[$extendNbRow][$cle];
|
||||
foreach( ${'tab'.ucfirst($cle)} as $cleItem ) {
|
||||
if ( $codeFromData == $cleItem['code'] ) {
|
||||
$retour[$cle.'Lib'] = $cleItem['label'];
|
||||
break;
|
||||
}
|
||||
foreach($select as $selectItem)
|
||||
{
|
||||
if ( isset(${$selectItem.'Data'}) )
|
||||
{
|
||||
$values = false;
|
||||
if( ${$selectItem.'Data'}!=false ){
|
||||
$values = ${$selectItem.'Data'};
|
||||
}
|
||||
$retour = call_user_func($selectItem.'Data', $siren, $nicV, $values);
|
||||
$tabNewData[$extendNbRow] = $tabNewData[$extendNbRow] + $retour;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Retour lignes multiples
|
||||
elseif ( $element == 'multiple' )
|
||||
{
|
||||
$values = false;
|
||||
$isSelected = false;
|
||||
foreach($select as $selectItem){
|
||||
if ( in_array($selectItem, $tabExtract) ) {
|
||||
$isSelected = true;
|
||||
break;
|
||||
}
|
||||
$tabNewData[$extendNbRow] = $tabNewData[$extendNbRow] + $retour;
|
||||
}
|
||||
$retour = array();
|
||||
if ( $isSelected && function_exists($selectItem.'Multiple') ) {
|
||||
if( ${$selectItem.'Data'}!=false ){
|
||||
$values = ${$selectItem.'Data'};
|
||||
}
|
||||
$retour = call_user_func($selectItem.'Multiple', $siren, $nicV, $values);
|
||||
}
|
||||
if (count($retour)>0) {
|
||||
$originalLine = $tabNewData[$extendNbRow];
|
||||
foreach($retour as $i => $retourItem) {
|
||||
$tabNewData[$extendNbRow+$i] = array_merge($originalLine,$retourItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Enregistrement clés de doublon pour rappel
|
||||
if ( null !== $keyDoublon ) {
|
||||
$doublonList[] = $keyDoublon;
|
||||
}
|
||||
//Traitement des libellés génériques
|
||||
else
|
||||
{
|
||||
foreach($select['cle'] as $cle => $values)
|
||||
{
|
||||
if ( in_array($cle.'Lib', $tabEntete) && isset(${'tab'.ucfirst($cle)}) )
|
||||
{
|
||||
$retour[$cle.'Lib'] = 'Non trouvé';
|
||||
$codeFromData = $tabNewData[$extendNbRow][$cle];
|
||||
foreach( ${'tab'.ucfirst($cle)} as $cleItem ) {
|
||||
if ( $codeFromData == $cleItem['code'] ) {
|
||||
$retour[$cle.'Lib'] = $cleItem['label'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
$tabNewData[$extendNbRow] = $tabNewData[$extendNbRow] + $retour;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Enregistrement clés de doublon pour rappel
|
||||
if ( null !== $keyDoublon ) {
|
||||
$doublonList[] = $keyDoublon;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Trier pour la sortie
|
||||
$nbLines = count($tabNewData);
|
||||
@ -1450,8 +1522,8 @@ function NaceEntData($siren, $nic, $values)
|
||||
{
|
||||
global $iDb;
|
||||
$tabData = array(
|
||||
'NaceEn' => '',
|
||||
'NaceEnLib' => '',
|
||||
'NaceEn' => '',
|
||||
'NaceEnLib' => '',
|
||||
);
|
||||
$result = $iDb->select('jo.etablissements e, jo.tabNaf5 n, insee.tabNace i',
|
||||
"CONCAT(n.codNaf1, SUBSTRING(n.codNaf5,1,4)) AS codNace, i.libelleFR",
|
||||
@ -1469,7 +1541,7 @@ function TelOrderEntete()
|
||||
'TelOrderTypeTel',
|
||||
'TelOrderInfoTel',
|
||||
'TelOrderTelephone',
|
||||
'TelOderSource',
|
||||
'TelOrderSource',
|
||||
'TelOrderDate',
|
||||
);
|
||||
}
|
||||
@ -1482,15 +1554,18 @@ function TelOrderData($siren, $nic, $values)
|
||||
$result = $c->getTel($siren, $nic, true, 1);
|
||||
$tabData = array();
|
||||
if ( count($result)>0 ) {
|
||||
$element = array(
|
||||
'TelOrderTypeTel' => $result['typeTel'],
|
||||
'TelOrderInfoTel' => $result['infoTel'],
|
||||
'TelOrderTelephone' => $result['telephone'],
|
||||
'TelOderSource' => $result['source'],
|
||||
'TelOrderDate' => $result['dateMAJ'],
|
||||
);
|
||||
|
||||
$tabData[] = $element;
|
||||
foreach ($result as $p) {
|
||||
if ($p['typeTel']=='tel') {
|
||||
$tabData = array(
|
||||
'TelOrderTypeTel' => $p['typeTel'],
|
||||
'TelOrderInfoTel' => $p['infoTel'],
|
||||
'TelOrderTelephone' => $p['telephone'],
|
||||
'TelOrderSource' => $p['source'],
|
||||
'TelOrderDate' => $p['dateMAJ'],
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $tabData;
|
||||
@ -1773,7 +1848,43 @@ function groupesMultiple($siren, $nic, $values = false)
|
||||
);
|
||||
|
||||
$level = $level+1;
|
||||
$result = $c->getTreeRecursive($identity->id);
|
||||
$result = $c->getTreeRecursive($identity->id, 33, $level, 6);
|
||||
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;
|
||||
}
|
||||
function groupesMultipleById($id, $values = false)
|
||||
{
|
||||
global $dbJo;
|
||||
$tabData = array();
|
||||
|
||||
require_once 'Metier/partenaires/classMLiens2.php';
|
||||
$c = new MLiens2($id, 'ref', $dbJo);
|
||||
$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, 33, $level, 6);
|
||||
foreach ($result as $item) {
|
||||
$tabData[] = array(
|
||||
'Niveau' => 'N'.$level,
|
||||
|
Loading…
Reference in New Issue
Block a user