Correction
This commit is contained in:
parent
db52a51fd2
commit
e9386b670b
@ -542,13 +542,15 @@ if ( $opts->reprise ) {
|
||||
}
|
||||
|
||||
$row = 0;
|
||||
$extendNbRow = 0;
|
||||
$doublonList = array();
|
||||
|
||||
//Vérification et création des données
|
||||
foreach($tabIdentifiant as $item)
|
||||
{
|
||||
echo "Ligne ".($row+1)." - ";
|
||||
$extendNbRow = 0;
|
||||
$tabNewData = array();
|
||||
|
||||
echo "Ligne ".($row+1)." - ";
|
||||
|
||||
if ( $opts->reprise && $row < $rowReprise ) {
|
||||
//Reprise
|
||||
@ -581,26 +583,28 @@ foreach($tabIdentifiant as $item)
|
||||
}
|
||||
}
|
||||
|
||||
$tabNewData[$extendNbRow] = $tabData[$row];
|
||||
|
||||
//On définit le tableau de retour (les colonnes du fichier client sont déjà présentent)
|
||||
if ( $posKeySiret!==false ){
|
||||
$tabData[$extendNbRow]['siret'] = (string)$item;
|
||||
$tabNewData[$extendNbRow]['siret'] = (string)$item;
|
||||
} elseif ( $posKeySiren!==false && $posKeyNic!==false ){
|
||||
$tabData[$extendNbRowow]['siren'] = (string)$siren;
|
||||
$tabData[$extendNbRow]['nic'] = (string)$nic;
|
||||
$tabNewData[$extendNbRowow]['siren'] = (string)$siren;
|
||||
$tabNewData[$extendNbRow]['nic'] = (string)$nic;
|
||||
} elseif ( $posKeySiren !==false ){
|
||||
$tabData[$extendNbRow]['siren'] = (string)$siren;
|
||||
$tabNewData[$extendNbRow]['siren'] = (string)$siren;
|
||||
}
|
||||
|
||||
$tabData[$extendNbRow]['SiretValide'] = ($siretValide===true) ? 1 : 0;
|
||||
$tabNewData[$extendNbRow]['SiretValide'] = ($siretValide===true) ? 1 : 0;
|
||||
|
||||
//Clé de doublon
|
||||
$keyDoublon = null;
|
||||
if ( array_key_exists('keyDoublon', $tabData[$extendNbRow])) {
|
||||
$keyDoublon = $tabData[$extendNbRow]['keyDoublon'];
|
||||
if ( array_key_exists('keyDoublon', $tabData[$row])) {
|
||||
$keyDoublon = $tabData[$row]['keyDoublon'];
|
||||
}
|
||||
|
||||
if ( null !== $keyDoublon && in_array($keyDoublon, $doublonList) ) {
|
||||
$tabData[$extendNbRow]['doublon'] = 1;
|
||||
$tabNewData[$extendNbRow]['doublon'] = 1;
|
||||
} elseif ( $sirenValide===false || intval($siren)==0 ){
|
||||
//Siren faux
|
||||
} else {
|
||||
@ -637,8 +641,8 @@ foreach($tabIdentifiant as $item)
|
||||
}
|
||||
|
||||
if ( $posKeySiren!==false && $posKeyNic!==false ){
|
||||
$tabData[$extendNbRow]['siren'] = $siren;
|
||||
$tabData[$extendNbRow]['nic'] = $nicV;
|
||||
$tabNewData[$extendNbRow]['siren'] = $siren;
|
||||
$tabNewData[$extendNbRow]['nic'] = $nicV;
|
||||
}
|
||||
|
||||
//Récupération des données SQL
|
||||
@ -655,7 +659,7 @@ foreach($tabIdentifiant as $item)
|
||||
$stmt = $dbMetier->query(${$element.'SQL'});
|
||||
$result = $stmt->fetchAll();
|
||||
if ( count($result)>0 ) {
|
||||
$tabData[$extendNbRow] = array_merge( $tabData[$extendNbRow] , $result[0]);
|
||||
$tabNewData[$extendNbRow] = array_merge( $tabNewData[$extendNbRow] , $result[0]);
|
||||
}
|
||||
} catch (Zend_Db_Exception $e) {
|
||||
|
||||
@ -682,7 +686,7 @@ foreach($tabIdentifiant as $item)
|
||||
$values = ${$selectItem.'Data'};
|
||||
}
|
||||
$retour = call_user_func($selectItem.'Data', $siren, $nicV, $values);
|
||||
$tabData[$extendNbRow] = $tabData[$extendNbRow] + $retour;
|
||||
$tabNewData[$extendNbRow] = $tabNewData[$extendNbRow] + $retour;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -702,10 +706,10 @@ foreach($tabIdentifiant as $item)
|
||||
$retour = call_user_func($selectItem.'Multiple', $siren, $nicV);
|
||||
}
|
||||
if (count($retour)>0) {
|
||||
$originalLine = $tabData[$extendNbRow];
|
||||
$originalLine = $tabNewData[$extendNbRow];
|
||||
foreach($retour as $i => $retourItem) {
|
||||
$extendNbRow = $extendNbRow + $i;
|
||||
$tabData[$extendNbRow] = $originalLine + $retourItem;
|
||||
$tabNewData[$extendNbRow] = $originalLine + $retourItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -718,14 +722,14 @@ foreach($tabIdentifiant as $item)
|
||||
if ( in_array($cle.'Lib', $tabEntete) && isset(${'tab'.ucfirst($cle)}) )
|
||||
{
|
||||
$retour[$cle.'Lib'] = 'Non trouvé';
|
||||
$codeFromData = $tabData[$extendNbRow][$cle];
|
||||
$codeFromData = $tabNewData[$extendNbRow][$cle];
|
||||
foreach( ${'tab'.ucfirst($cle)} as $cleItem ) {
|
||||
if ( $codeFromData == $cleItem['code'] ) {
|
||||
$retour[$cle.'Lib'] = $cleItem['label'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
$tabData[$extendNbRow] = $tabData[$extendNbRow] + $retour;
|
||||
$tabNewData[$extendNbRow] = $tabNewData[$extendNbRow] + $retour;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -742,7 +746,7 @@ foreach($tabIdentifiant as $item)
|
||||
for($i=0;$i<$nbLine;$i++) {
|
||||
$tabSortie = array();
|
||||
foreach($tabEntete as $key){
|
||||
$tabSortie[] = isset($tabData[$row+i][$key]) ? $tabData[$row+$i][$key] : '';
|
||||
$tabSortie[] = isset($tabNewData[$row+i][$key]) ? $tabNewData[$row+$i][$key] : '';
|
||||
}
|
||||
fputcsv($fp, $tabSortie, ',', '"');
|
||||
}
|
||||
@ -1520,7 +1524,8 @@ function actionnairesEntete()
|
||||
function actionnairesMultiple($siren, $nic)
|
||||
{
|
||||
require_once 'Metier/partenaires/classMLiens2.php';
|
||||
$liensM = new MLiens2($siren, 'siren', $db);
|
||||
global $dbJo;
|
||||
$liensM = new MLiens2($siren, 'siren', $dbJo);
|
||||
$result = $liensM->getActionnaires();
|
||||
$tabData = array();
|
||||
if (count($result)>0) {
|
||||
@ -1570,16 +1575,78 @@ function actionnairesMultiple($siren, $nic)
|
||||
|
||||
function participationsEntete()
|
||||
{
|
||||
return array();
|
||||
return array(
|
||||
'ParSiren',
|
||||
'ParActif',
|
||||
'ParPDetention',
|
||||
'ParPVote',
|
||||
'ParType',
|
||||
'ParRS',
|
||||
'ParPP',
|
||||
'ParPPDateNaiss',
|
||||
'ParPPLieuNaiss',
|
||||
'ParPPNat',
|
||||
'ParAdresse',
|
||||
'ParIdLoc1Type',
|
||||
'ParIdLoc1Num',
|
||||
'ParIdLoc2Type',
|
||||
'ParIdLoc2Num',
|
||||
'ParIdLoc3Type',
|
||||
'ParIdLoc3Num',
|
||||
'ParDateEffetLien',
|
||||
'ParDate'
|
||||
);
|
||||
}
|
||||
|
||||
function participationsMultiple($siren, $nic)
|
||||
{
|
||||
global $dbJo;
|
||||
require_once 'Metier/partenaires/classMLiens2.php';
|
||||
$liensM = new MLiens2($siren, 'siren');
|
||||
//Formattage
|
||||
$liensM = new MLiens2($siren, 'siren', $dbJo);
|
||||
$result = $liensM->getParticipations();
|
||||
$tabData = array();
|
||||
if (count($result)>0) {
|
||||
foreach($result as $item) {
|
||||
$formatElement = array();
|
||||
$formatElement['ParSiren'] = $item->siren;
|
||||
$formatElement['ParActif'] = $item->actif;
|
||||
$formatElement['ParPDetention'] = $item->PDetention;
|
||||
$formatElement['ParPVote'] = $item->PVote;
|
||||
$formatElement['ParPpPm'] = $item->PpPm;
|
||||
$formatElement['ParRS'] = $item->RS;
|
||||
if ($item->PpPm == 'PP') {
|
||||
$formatElement['ParPP'] = $item->civilite.' '.
|
||||
$item->nom.' '.$item->prenom.
|
||||
' ('.$item->nom_usage.') '.
|
||||
$formatElement['ParPPDateNaiss'] = $item->naissance_date;
|
||||
$formatElement['ParPPLieuNaiss'] = $item->naissance_lieu;
|
||||
$formatElement['ParPPNat'] = $item->nat;
|
||||
} else {
|
||||
$formatElement['ParPP'] = '';
|
||||
$formatElement['ParPPDateNaiss'] = '';
|
||||
$formatElement['ParPPLieuNaiss'] = '';
|
||||
$formatElement['ParPPNat'] = '';
|
||||
}
|
||||
$formatElement['ParAdresse'] = $item->adresse_num.' '.$item->adresse_btq.' '.
|
||||
$item->adresse_codvoie.' '.$item->adresse_libvoie.' '.$item->adresse_comp.' '.
|
||||
$item->adresse_cp.' '.$item->adresse_ville.' '.$item->adresse_pays;
|
||||
$formatElement['ParIdLoc1Type'] = $item->idLoc1Type;
|
||||
$formatElement['ParIdLoc1Num'] = $item->idLoc1Num;
|
||||
$formatElement['ParIdLoc2Type'] = $item->idLoc2Type;
|
||||
$formatElement['ParIdLoc2Num'] = $item->idLoc2Num;
|
||||
$formatElement['ParIdLoc3Type'] = $item->idLoc3Type;
|
||||
$formatElement['ParIdLoc3Num'] = $item->idLoc3Num;
|
||||
$formatElement['ParDateEffetLien'] = $item->dateEffetLien;
|
||||
if ($item->dateUpdate!='0000-00-00 00:00:00') {
|
||||
$formatElement['ParDate'] = substr($item->dateUpdate,0,10);
|
||||
} else {
|
||||
$formatElement['ParDate'] = substr($item->dateInsert,0,10);
|
||||
}
|
||||
|
||||
$tabData[] = $formatElement;
|
||||
}
|
||||
}
|
||||
|
||||
$tabData = $liensM->getParticipations();
|
||||
return $tabData;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user