Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15334334
D12681.id30496.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D12681.id30496.diff
View Options
diff --git a/src/applications/phortune/controller/PhortuneCartListController.php b/src/applications/phortune/controller/PhortuneCartListController.php
--- a/src/applications/phortune/controller/PhortuneCartListController.php
+++ b/src/applications/phortune/controller/PhortuneCartListController.php
@@ -6,6 +6,7 @@
private $merchant;
private $account;
private $subscription;
+ private $engine;
public function handleRequest(AphrontRequest $request) {
$viewer = $this->getViewer();
@@ -14,7 +15,8 @@
$account_id = $request->getURIData('accountID');
$subscription_id = $request->getURIData('subscriptionID');
- $engine = new PhortuneCartSearchEngine();
+ $engine = id(new PhortuneCartSearchEngine())
+ ->setViewer($viewer);
if ($merchant_id) {
$merchant = id(new PhortuneMerchantQuery())
@@ -65,6 +67,8 @@
$engine->setSubscription($subscription);
}
+ $this->engine = $engine;
+
$controller = id(new PhabricatorApplicationSearchController())
->setQueryKey($request->getURIData('queryKey'))
->setSearchEngine($engine)
@@ -79,9 +83,7 @@
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
- id(new PhortuneCartSearchEngine())
- ->setViewer($viewer)
- ->addNavigationItems($nav->getMenu());
+ $this->engine->addNavigationItems($nav->getMenu());
$nav->selectFilter(null);
diff --git a/src/applications/phortune/query/PhortuneCartSearchEngine.php b/src/applications/phortune/query/PhortuneCartSearchEngine.php
--- a/src/applications/phortune/query/PhortuneCartSearchEngine.php
+++ b/src/applications/phortune/query/PhortuneCartSearchEngine.php
@@ -55,15 +55,7 @@
public function buildQueryFromSavedQuery(PhabricatorSavedQuery $saved) {
$query = id(new PhortuneCartQuery())
- ->needPurchases(true)
- ->withStatuses(
- array(
- PhortuneCart::STATUS_PURCHASING,
- PhortuneCart::STATUS_CHARGED,
- PhortuneCart::STATUS_HOLD,
- PhortuneCart::STATUS_REVIEW,
- PhortuneCart::STATUS_PURCHASED,
- ));
+ ->needPurchases(true);
$viewer = $this->requireViewer();
@@ -107,6 +99,19 @@
$query->withSubscriptionPHIDs(array($subscription->getPHID()));
}
+ if ($saved->getParameter('invoices')) {
+ $query->withInvoices(true);
+ } else {
+ $query->withStatuses(
+ array(
+ PhortuneCart::STATUS_PURCHASING,
+ PhortuneCart::STATUS_CHARGED,
+ PhortuneCart::STATUS_HOLD,
+ PhortuneCart::STATUS_REVIEW,
+ PhortuneCart::STATUS_PURCHASED,
+ ));
+ }
+
return $query;
}
@@ -118,9 +123,9 @@
$merchant = $this->getMerchant();
$account = $this->getAccount();
if ($merchant) {
- return '/phortune/merchant/'.$merchant->getID().'/order/'.$path;
+ return '/phortune/merchant/orders/'.$merchant->getID().'/'.$path;
} else if ($account) {
- return '/phortune/'.$account->getID().'/order/';
+ return '/phortune/'.$account->getID().'/order/'.$path;
} else {
return '/phortune/order/'.$path;
}
@@ -128,7 +133,8 @@
protected function getBuiltinQueryNames() {
$names = array(
- 'all' => pht('All Orders'),
+ 'all' => pht('Order History'),
+ 'invoices' => pht('Unpaid Invoices'),
);
return $names;
@@ -142,6 +148,8 @@
switch ($query_key) {
case 'all':
return $query;
+ case 'invoices':
+ return $query->setParameter('invoices', true);
}
return parent::buildSavedQueryFromBuiltin($query_key);
@@ -180,12 +188,6 @@
$rows[] = array(
$cart->getID(),
- phutil_tag(
- 'a',
- array(
- 'href' => $href,
- ),
- $cart->getName()),
$handles[$cart->getPHID()]->renderLink(),
$handles[$merchant->getPHID()]->renderLink(),
$handles[$cart->getAuthorPHID()]->renderLink(),
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 9, 8:19 AM (2 d, 17 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7223997
Default Alt Text
D12681.id30496.diff (3 KB)
Attached To
Mode
D12681: Allow accounts and merchants to review unpaid invoices in Phortune
Attached
Detach File
Event Timeline
Log In to Comment