1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-27 09:12:41 +01:00

Update batch edit and export to excel for "pro" queries

Summary: Point these at the new data and URIs.

Test Plan:
  - Batch edited some tasks.
  - Exported some tasks to excel.

{F58112}

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D6978
This commit is contained in:
epriestley 2013-09-13 09:35:39 -07:00
parent 9864d562dd
commit 0803f5cb45
2 changed files with 20 additions and 17 deletions

View file

@ -33,7 +33,7 @@ final class ManiphestBatchEditController extends ManiphestController {
$task_ids = implode(',', mpull($tasks, 'getID')); $task_ids = implode(',', mpull($tasks, 'getID'));
return id(new AphrontRedirectResponse()) return id(new AphrontRedirectResponse())
->setURI('/maniphest/view/custom/?s=oc&tasks='.$task_ids); ->setURI('/maniphest/query/?ids='.$task_ids);
} }
$panel = new AphrontPanelView(); $panel = new AphrontPanelView();

View file

@ -55,10 +55,11 @@ final class ManiphestExportController extends ManiphestController {
// TODO: PHPExcel has a dependency on the PHP zip extension. We should test // TODO: PHPExcel has a dependency on the PHP zip extension. We should test
// for that here, since it fatals if we don't have the ZipArchive class. // for that here, since it fatals if we don't have the ZipArchive class.
$query = id(new PhabricatorSearchQuery())->loadOneWhere( $saved = id(new PhabricatorSavedQueryQuery())
'queryKey = %s', ->setViewer($user)
$this->key); ->withQueryKeys(array($this->key))
if (!$query) { ->executeOne();
if (!$saved) {
return new Aphront404Response(); return new Aphront404Response();
} }
@ -88,7 +89,6 @@ final class ManiphestExportController extends ManiphestController {
$dialog->addCancelButton('/maniphest/'); $dialog->addCancelButton('/maniphest/');
$dialog->addSubmitButton(pht('Export to Excel')); $dialog->addSubmitButton(pht('Export to Excel'));
return id(new AphrontDialogResponse())->setDialog($dialog); return id(new AphrontDialogResponse())->setDialog($dialog);
} }
$format = idx($formats, $request->getStr("excel-format")); $format = idx($formats, $request->getStr("excel-format"));
@ -96,20 +96,23 @@ final class ManiphestExportController extends ManiphestController {
throw new Exception('Excel format object not found.'); throw new Exception('Excel format object not found.');
} }
$query->setParameter('limit', null); $saved->makeEphemeral();
$query->setParameter('offset', null); $saved->setParameter('limit', PHP_INT_MAX);
$query->setParameter('order', 'p');
$query->setParameter('group', 'n');
list($tasks, $handles) = ManiphestTaskListController::loadTasks( $engine = id(new ManiphestTaskSearchEngine())
$query, ->setViewer($user);
$user);
// Ungroup tasks. $query = $engine->buildQueryFromSavedQuery($saved);
$tasks = array_mergev($tasks); $query->setViewer($user);
$tasks = $query->execute();
$all_projects = array_mergev(mpull($tasks, 'getProjectPHIDs')); $all_projects = array_mergev(mpull($tasks, 'getProjectPHIDs'));
$project_handles = $this->loadViewerHandles($all_projects); $all_assigned = mpull($tasks, 'getOwnerPHID');
$handles += $project_handles;
$handles = id(new PhabricatorHandleQuery())
->setViewer($user)
->withPHIDs(array_merge($all_projects, $all_assigned))
->execute();
$workbook = new PHPExcel(); $workbook = new PHPExcel();
$format->buildWorkbook($workbook, $tasks, $handles, $user); $format->buildWorkbook($workbook, $tasks, $handles, $user);