Correction multiligne

This commit is contained in:
Michael RICOIS 2013-02-20 10:17:50 +00:00
parent 0eb3862689
commit c8108cfe18

View File

@ -589,7 +589,7 @@ foreach($tabIdentifiant as $item)
if ( $posKeySiret!==false ){ if ( $posKeySiret!==false ){
$tabNewData[$extendNbRow]['siret'] = (string)$item; $tabNewData[$extendNbRow]['siret'] = (string)$item;
} elseif ( $posKeySiren!==false && $posKeyNic!==false ){ } elseif ( $posKeySiren!==false && $posKeyNic!==false ){
$tabNewData[$extendNbRowow]['siren'] = (string)$siren; $tabNewData[$extendNbRow]['siren'] = (string)$siren;
$tabNewData[$extendNbRow]['nic'] = (string)$nic; $tabNewData[$extendNbRow]['nic'] = (string)$nic;
} elseif ( $posKeySiren !==false ){ } elseif ( $posKeySiren !==false ){
$tabNewData[$extendNbRow]['siren'] = (string)$siren; $tabNewData[$extendNbRow]['siren'] = (string)$siren;
@ -708,8 +708,7 @@ foreach($tabIdentifiant as $item)
if (count($retour)>0) { if (count($retour)>0) {
$originalLine = $tabNewData[$extendNbRow]; $originalLine = $tabNewData[$extendNbRow];
foreach($retour as $i => $retourItem) { foreach($retour as $i => $retourItem) {
$extendNbRow = $extendNbRow + $i; $tabNewData[$extendNbRow+$i] = array_merge($originalLine,$retourItem);
$tabNewData[$extendNbRow] = $originalLine + $retourItem;
} }
} }
} }
@ -742,11 +741,11 @@ foreach($tabIdentifiant as $item)
} }
//Trier pour la sortie //Trier pour la sortie
$nbLine = $extendNbRow - $row; $nbLines = count($tabNewData);
for($i=0;$i<$nbLine;$i++) { for($i=0;$i<$nbLines;$i++) {
$tabSortie = array(); $tabSortie = array();
foreach($tabEntete as $key){ foreach($tabEntete as $key){
$tabSortie[] = isset($tabNewData[$row+i][$key]) ? $tabNewData[$row+$i][$key] : ''; $tabSortie[] = isset($tabNewData[$i][$key]) ? $tabNewData[$i][$key] : '';
} }
fputcsv($fp, $tabSortie, ',', '"'); fputcsv($fp, $tabSortie, ',', '"');
} }