@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Allow accounts and merchants to review unpaid invoices in Phortune

Summary:
Ref T6881. Allows accounts to browse all unpaid invoices (although we currently show all of them on the account screen anyway).

Also allows merchants to browse unpaid invoices, which they could not do before. This will let us start suspending instances for nonpayment eventually.

Test Plan:
- Browsed unpaid invoices as various users.
- Browsed merchant unpaid invoices.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T6881

Differential Revision: https://secure.phabricator.com/D12681

+26 -22
+6 -4
src/applications/phortune/controller/PhortuneCartListController.php
··· 6 6 private $merchant; 7 7 private $account; 8 8 private $subscription; 9 + private $engine; 9 10 10 11 public function handleRequest(AphrontRequest $request) { 11 12 $viewer = $this->getViewer(); ··· 14 15 $account_id = $request->getURIData('accountID'); 15 16 $subscription_id = $request->getURIData('subscriptionID'); 16 17 17 - $engine = new PhortuneCartSearchEngine(); 18 + $engine = id(new PhortuneCartSearchEngine()) 19 + ->setViewer($viewer); 18 20 19 21 if ($merchant_id) { 20 22 $merchant = id(new PhortuneMerchantQuery()) ··· 65 67 $engine->setSubscription($subscription); 66 68 } 67 69 70 + $this->engine = $engine; 71 + 68 72 $controller = id(new PhabricatorApplicationSearchController()) 69 73 ->setQueryKey($request->getURIData('queryKey')) 70 74 ->setSearchEngine($engine) ··· 79 83 $nav = new AphrontSideNavFilterView(); 80 84 $nav->setBaseURI(new PhutilURI($this->getApplicationURI())); 81 85 82 - id(new PhortuneCartSearchEngine()) 83 - ->setViewer($viewer) 84 - ->addNavigationItems($nav->getMenu()); 86 + $this->engine->addNavigationItems($nav->getMenu()); 85 87 86 88 $nav->selectFilter(null); 87 89
+20 -18
src/applications/phortune/query/PhortuneCartSearchEngine.php
··· 55 55 56 56 public function buildQueryFromSavedQuery(PhabricatorSavedQuery $saved) { 57 57 $query = id(new PhortuneCartQuery()) 58 - ->needPurchases(true) 59 - ->withStatuses( 60 - array( 61 - PhortuneCart::STATUS_PURCHASING, 62 - PhortuneCart::STATUS_CHARGED, 63 - PhortuneCart::STATUS_HOLD, 64 - PhortuneCart::STATUS_REVIEW, 65 - PhortuneCart::STATUS_PURCHASED, 66 - )); 58 + ->needPurchases(true); 67 59 68 60 $viewer = $this->requireViewer(); 69 61 ··· 107 99 $query->withSubscriptionPHIDs(array($subscription->getPHID())); 108 100 } 109 101 102 + if ($saved->getParameter('invoices')) { 103 + $query->withInvoices(true); 104 + } else { 105 + $query->withStatuses( 106 + array( 107 + PhortuneCart::STATUS_PURCHASING, 108 + PhortuneCart::STATUS_CHARGED, 109 + PhortuneCart::STATUS_HOLD, 110 + PhortuneCart::STATUS_REVIEW, 111 + PhortuneCart::STATUS_PURCHASED, 112 + )); 113 + } 114 + 110 115 return $query; 111 116 } 112 117 ··· 118 123 $merchant = $this->getMerchant(); 119 124 $account = $this->getAccount(); 120 125 if ($merchant) { 121 - return '/phortune/merchant/'.$merchant->getID().'/order/'.$path; 126 + return '/phortune/merchant/orders/'.$merchant->getID().'/'.$path; 122 127 } else if ($account) { 123 - return '/phortune/'.$account->getID().'/order/'; 128 + return '/phortune/'.$account->getID().'/order/'.$path; 124 129 } else { 125 130 return '/phortune/order/'.$path; 126 131 } ··· 128 133 129 134 protected function getBuiltinQueryNames() { 130 135 $names = array( 131 - 'all' => pht('All Orders'), 136 + 'all' => pht('Order History'), 137 + 'invoices' => pht('Unpaid Invoices'), 132 138 ); 133 139 134 140 return $names; ··· 142 148 switch ($query_key) { 143 149 case 'all': 144 150 return $query; 151 + case 'invoices': 152 + return $query->setParameter('invoices', true); 145 153 } 146 154 147 155 return parent::buildSavedQueryFromBuiltin($query_key); ··· 180 188 181 189 $rows[] = array( 182 190 $cart->getID(), 183 - phutil_tag( 184 - 'a', 185 - array( 186 - 'href' => $href, 187 - ), 188 - $cart->getName()), 189 191 $handles[$cart->getPHID()]->renderLink(), 190 192 $handles[$merchant->getPHID()]->renderLink(), 191 193 $handles[$cart->getAuthorPHID()]->renderLink(),