Skip to content

Commit

Permalink
unique filenames for import/export
Browse files Browse the repository at this point in the history
  • Loading branch information
cerhardt committed Apr 25, 2023
1 parent f3d910b commit 0beada3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@
$output = fopen("php://output",'w') or die("Can't open php://output");
fwrite($output, "\xEF\xBB\xBF");
header("Content-Type:application/csv");
header("Content-Disposition:attachment;filename=psn_export.csv");
header("Content-Disposition:attachment;filename=psn_export_".$module->getProjectSetting("gpas_domain")."_".date("Ymd_His").".csv");
fputcsv($output, array_keys($aHeader), ";");
foreach($aCSV as $row) {
$Vals = array();
Expand Down Expand Up @@ -548,7 +548,7 @@
$aCSV[$i]['psn'] = $sPSN;
}

$aCSV[$i]['imported'] = "OK";
$aCSV[$i]['imported'] = $sPSN_mode;
Logging::logEvent('', $module->getModuleName(), "OTHER", '', $_POST['extPSN'].": ".$oPseudoService->trimZero($sPSN), "extPSN: psn created");

// create REDCap entry
Expand Down Expand Up @@ -647,7 +647,7 @@
$aCSV[$i]['psn'] = $sPSN;
}

$aCSV[$i]['imported'] = "OK";
$aCSV[$i]['imported'] = $sPSN_mode;
Logging::logEvent('', $module->getModuleName(), "OTHER", '', $oPseudoService->trimZero($sPSN), "PSN created");

// create REDCap entry
Expand All @@ -666,7 +666,7 @@
$output = fopen("php://output",'w') or die("Can't open php://output");
fwrite($output, "\xEF\xBB\xBF");
header("Content-Type:application/csv");
header("Content-Disposition:attachment;filename=psn_import_result.csv");
header("Content-Disposition:attachment;filename=psn_import_".$module->getProjectSetting("gpas_domain")."_".date("Ymd_His").".csv");
fputcsv($output, $aHeader, ";");
foreach($aCSV as $row) {
fputcsv($output,$row, ";");
Expand Down

0 comments on commit 0beada3

Please sign in to comment.