Skip to content

Commit

Permalink
[Bug]: CMF Admin Customer List export id ambiguity (#548)
Browse files Browse the repository at this point in the history
  • Loading branch information
kingjia90 authored Jan 14, 2025
1 parent b11c4cb commit 0998ce4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Controller/Admin/CustomersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,10 @@ public function exportAction(Request $request): JsonResponse
$listing = $this->buildListing($filters);

$idField = Service::getVersionDependentDatabaseColumnName('id');
$fromTable = $listing->getQueryBuilder()->getQueryPart('from')[0]['table'];
$query = $listing->getQueryBuilder()
->resetQueryPart('select')
->select($idField);
->select($fromTable . '.' . $idField);
$ids = Db::get()->fetchFirstColumn((string)$query);

$jobId = uniqid();
Expand Down Expand Up @@ -218,7 +219,9 @@ public function exportStepAction(Request $request): JsonResponse

$idField = Service::getVersionDependentDatabaseColumnName('id');
$listing = $this->buildListing();
$listing->addConditionParam($idField . ' in ('.implode(', ', $ids).')');

$fromTable = $listing->getQueryBuilder()->getQueryPart('from')[0]['table'];
$listing->addConditionParam($fromTable . '.' . $idField . ' in ('.implode(', ', $ids).')');

$exporter = $this->getExporter($listing, $data['exporter']);
$exportData = $exporter->getExportData();
Expand Down

0 comments on commit 0998ce4

Please sign in to comment.