parent
3cbebb31d1
commit
babbff54e2
@ -29,6 +29,7 @@ final class SangriaPageExportDataExtension extends Extension
|
||||
'ExportAppDevSurveyResults',
|
||||
'exportFoundationMembers',
|
||||
'exportCorporateSponsors',
|
||||
'exportDupUsers',
|
||||
));
|
||||
|
||||
|
||||
@ -40,6 +41,7 @@ final class SangriaPageExportDataExtension extends Extension
|
||||
'ExportAppDevSurveyResults',
|
||||
'exportFoundationMembers',
|
||||
'exportCorporateSponsors',
|
||||
'exportDupUsers',
|
||||
));
|
||||
}
|
||||
|
||||
@ -248,7 +250,6 @@ SQL;
|
||||
$filename = "survey_results" . $fileDate . ".csv";
|
||||
|
||||
return CSVExporter::getInstance()->export($filename, $data, ',');
|
||||
|
||||
}
|
||||
|
||||
// Export CSV of all App Dev Surveys
|
||||
@ -416,4 +417,37 @@ SQL;
|
||||
return CSVExporter::getInstance()->export($filename, $data);
|
||||
}
|
||||
|
||||
|
||||
public function exportDupUsers(){
|
||||
|
||||
$fileDate = date('Ymdhis');
|
||||
|
||||
SangriaPage_Controller::generateDateFilters('s');
|
||||
|
||||
$sql = <<< SQL
|
||||
select FirstName, Surname, count(FirstName) AS Qty , group_concat(Email SEPARATOR '|') AS Emails,group_concat(ID SEPARATOR '|') AS MemberIds
|
||||
from Member
|
||||
group by FirstName, Surname
|
||||
having count(FirstName) > 1
|
||||
order by FirstName, Surname;
|
||||
SQL;
|
||||
|
||||
$res = DB::query($sql);
|
||||
|
||||
$fields = array('FirstName','Surname','Qty','Emails','MemberIds');
|
||||
$data = array();
|
||||
|
||||
foreach ($res as $row) {
|
||||
$member = array();
|
||||
foreach ($fields as $field) {
|
||||
$member[$field] = $row[$field];
|
||||
}
|
||||
array_push($data, $member);
|
||||
}
|
||||
|
||||
$filename = "dup_users_report" . $fileDate . ".csv";
|
||||
|
||||
return CSVExporter::getInstance()->export($filename, $data, ',');
|
||||
}
|
||||
|
||||
}
|
@ -68,7 +68,12 @@
|
||||
<button style="padding: 5px" id="btn4_xls">Export Gerrit Users (XLS)</button>
|
||||
<button style="padding: 5px" id="btn4_csv">Export Gerrit Users (CSV)</button>
|
||||
</form>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
<h2>Duplicate Users Report</h2>
|
||||
<form method="get" id="form-export-dup-users-data" name="form-export-dup-users-data" action="$Link(exportDupUsers)">
|
||||
<button style="padding: 5px" id="btn5_csv">GET</button>
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user