From 0803f5cb45cda9c13566385bc2e972793ca7040c Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 13 Sep 2013 09:35:39 -0700 Subject: [PATCH] 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 --- .../ManiphestBatchEditController.php | 2 +- .../controller/ManiphestExportController.php | 35 ++++++++++--------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/applications/maniphest/controller/ManiphestBatchEditController.php b/src/applications/maniphest/controller/ManiphestBatchEditController.php index 5b6fdbf2cf..27a38fccf5 100644 --- a/src/applications/maniphest/controller/ManiphestBatchEditController.php +++ b/src/applications/maniphest/controller/ManiphestBatchEditController.php @@ -33,7 +33,7 @@ final class ManiphestBatchEditController extends ManiphestController { $task_ids = implode(',', mpull($tasks, 'getID')); return id(new AphrontRedirectResponse()) - ->setURI('/maniphest/view/custom/?s=oc&tasks='.$task_ids); + ->setURI('/maniphest/query/?ids='.$task_ids); } $panel = new AphrontPanelView(); diff --git a/src/applications/maniphest/controller/ManiphestExportController.php b/src/applications/maniphest/controller/ManiphestExportController.php index effb2220d2..b0c39737fc 100644 --- a/src/applications/maniphest/controller/ManiphestExportController.php +++ b/src/applications/maniphest/controller/ManiphestExportController.php @@ -55,10 +55,11 @@ final class ManiphestExportController extends ManiphestController { // 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. - $query = id(new PhabricatorSearchQuery())->loadOneWhere( - 'queryKey = %s', - $this->key); - if (!$query) { + $saved = id(new PhabricatorSavedQueryQuery()) + ->setViewer($user) + ->withQueryKeys(array($this->key)) + ->executeOne(); + if (!$saved) { return new Aphront404Response(); } @@ -88,7 +89,6 @@ final class ManiphestExportController extends ManiphestController { $dialog->addCancelButton('/maniphest/'); $dialog->addSubmitButton(pht('Export to Excel')); return id(new AphrontDialogResponse())->setDialog($dialog); - } $format = idx($formats, $request->getStr("excel-format")); @@ -96,20 +96,23 @@ final class ManiphestExportController extends ManiphestController { throw new Exception('Excel format object not found.'); } - $query->setParameter('limit', null); - $query->setParameter('offset', null); - $query->setParameter('order', 'p'); - $query->setParameter('group', 'n'); + $saved->makeEphemeral(); + $saved->setParameter('limit', PHP_INT_MAX); - list($tasks, $handles) = ManiphestTaskListController::loadTasks( - $query, - $user); - // Ungroup tasks. - $tasks = array_mergev($tasks); + $engine = id(new ManiphestTaskSearchEngine()) + ->setViewer($user); + + $query = $engine->buildQueryFromSavedQuery($saved); + $query->setViewer($user); + $tasks = $query->execute(); $all_projects = array_mergev(mpull($tasks, 'getProjectPHIDs')); - $project_handles = $this->loadViewerHandles($all_projects); - $handles += $project_handles; + $all_assigned = mpull($tasks, 'getOwnerPHID'); + + $handles = id(new PhabricatorHandleQuery()) + ->setViewer($user) + ->withPHIDs(array_merge($all_projects, $all_assigned)) + ->execute(); $workbook = new PHPExcel(); $format->buildWorkbook($workbook, $tasks, $handles, $user);