@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.

Give Phortune carts a proper `isInvoice` flag

Summary:
See some earlier discussion in D11593:

> One thing I'm vaguely thinking about is the possibilty that users may be able to invoice one another directly, eventually. For example, we might invoice a contracting client.
> We might need an `isInvoice` flag eventually, but `subscriptionPHID` is a reasonable stand-in for now.

This adds such a flag.

Test Plan:
- Generated an ad-hoc invoice and verified it showed up in the right place.
- Used `bin/phortune invoice` to invoice a subscription and verified it worked correctly.
- Paid an invoice and saw it leave "pending invoices" status.

{F377029}

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

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

+43 -30
+24 -23
resources/celerity/map.php
··· 7 7 */ 8 8 return array( 9 9 'names' => array( 10 - 'core.pkg.css' => 'bf29d341', 11 - 'core.pkg.js' => 'a626d14c', 10 + 'core.pkg.css' => '7d05ad2a', 11 + 'core.pkg.js' => 'dfea788f', 12 12 'darkconsole.pkg.js' => '8ab24e01', 13 13 'differential.pkg.css' => '3500921f', 14 14 'differential.pkg.js' => 'c0506961', ··· 27 27 'rsrc/css/aphront/panel-view.css' => '8427b78d', 28 28 'rsrc/css/aphront/phabricator-nav-view.css' => '7aeaf435', 29 29 'rsrc/css/aphront/table-view.css' => '59e2c0f8', 30 - 'rsrc/css/aphront/tokenizer.css' => 'c10c061e', 30 + 'rsrc/css/aphront/tokenizer.css' => '86a13f7f', 31 31 'rsrc/css/aphront/tooltip.css' => '7672b60f', 32 32 'rsrc/css/aphront/two-column.css' => '16ab3ad2', 33 33 'rsrc/css/aphront/typeahead-browse.css' => 'efe293a0', ··· 147 147 'rsrc/css/phui/phui-remarkup-preview.css' => '19ad512b', 148 148 'rsrc/css/phui/phui-spacing.css' => '042804d6', 149 149 'rsrc/css/phui/phui-status.css' => '888cedb8', 150 - 'rsrc/css/phui/phui-tag-view.css' => 'ea469f3a', 150 + 'rsrc/css/phui/phui-tag-view.css' => '402691cc', 151 151 'rsrc/css/phui/phui-text.css' => 'cf019f54', 152 152 'rsrc/css/phui/phui-timeline-view.css' => 'b0fbc4d7', 153 153 'rsrc/css/phui/phui-workboard-view.css' => '3279cbbf', ··· 450 450 'rsrc/js/core/KeyboardShortcutManager.js' => 'c1700f6f', 451 451 'rsrc/js/core/MultirowRowManager.js' => 'b5d57730', 452 452 'rsrc/js/core/Notification.js' => '0c6946e7', 453 - 'rsrc/js/core/Prefab.js' => 'b972bdcd', 453 + 'rsrc/js/core/Prefab.js' => '6920d200', 454 454 'rsrc/js/core/ShapedRequest.js' => '7cbe244b', 455 455 'rsrc/js/core/TextAreaUtils.js' => '5c93c52c', 456 456 'rsrc/js/core/Title.js' => 'df5e11d2', ··· 510 510 'aphront-pager-view-css' => '2e3539af', 511 511 'aphront-panel-view-css' => '8427b78d', 512 512 'aphront-table-view-css' => '59e2c0f8', 513 - 'aphront-tokenizer-control-css' => 'c10c061e', 513 + 'aphront-tokenizer-control-css' => '86a13f7f', 514 514 'aphront-tooltip-css' => '7672b60f', 515 515 'aphront-two-column-view-css' => '16ab3ad2', 516 516 'aphront-typeahead-control-css' => '0e403212', ··· 744 744 'phabricator-notification-menu-css' => '3c9d8aa1', 745 745 'phabricator-object-selector-css' => '029a133d', 746 746 'phabricator-phtize' => 'd254d646', 747 - 'phabricator-prefab' => 'b972bdcd', 747 + 'phabricator-prefab' => '6920d200', 748 748 'phabricator-profile-css' => '1a20dcbf', 749 749 'phabricator-remarkup-css' => 'e10512ff', 750 750 'phabricator-search-results-css' => '15c71110', ··· 806 806 'phui-remarkup-preview-css' => '19ad512b', 807 807 'phui-spacing-css' => '042804d6', 808 808 'phui-status-list-view-css' => '888cedb8', 809 - 'phui-tag-view-css' => 'ea469f3a', 809 + 'phui-tag-view-css' => '402691cc', 810 810 'phui-text-css' => 'cf019f54', 811 811 'phui-timeline-view-css' => 'b0fbc4d7', 812 812 'phui-workboard-view-css' => '3279cbbf', ··· 1296 1296 '6882e80a' => array( 1297 1297 'javelin-dom', 1298 1298 ), 1299 + '6920d200' => array( 1300 + 'javelin-install', 1301 + 'javelin-util', 1302 + 'javelin-dom', 1303 + 'javelin-typeahead', 1304 + 'javelin-tokenizer', 1305 + 'javelin-typeahead-preloaded-source', 1306 + 'javelin-typeahead-ondemand-source', 1307 + 'javelin-dom', 1308 + 'javelin-stratcom', 1309 + 'javelin-util', 1310 + ), 1299 1311 '69adf288' => array( 1300 1312 'javelin-install', 1301 1313 ), ··· 1468 1480 'javelin-stratcom', 1469 1481 'phabricator-tooltip', 1470 1482 'changeset-view-manager', 1483 + ), 1484 + '86a13f7f' => array( 1485 + 'aphront-typeahead-control-css', 1486 + 'phui-tag-view-css', 1471 1487 ), 1472 1488 '87cb6b51' => array( 1473 1489 'javelin-behavior', ··· 1707 1723 'javelin-dom', 1708 1724 'javelin-util', 1709 1725 ), 1710 - 'b972bdcd' => array( 1711 - 'javelin-install', 1712 - 'javelin-util', 1713 - 'javelin-dom', 1714 - 'javelin-typeahead', 1715 - 'javelin-tokenizer', 1716 - 'javelin-typeahead-preloaded-source', 1717 - 'javelin-typeahead-ondemand-source', 1718 - 'javelin-dom', 1719 - 'javelin-stratcom', 1720 - 'javelin-util', 1721 - ), 1722 1726 'bba9eedf' => array( 1723 1727 'javelin-behavior', 1724 1728 'javelin-stratcom', ··· 1763 1767 'javelin-dom', 1764 1768 'javelin-util', 1765 1769 'phabricator-shaped-request', 1766 - ), 1767 - 'c10c061e' => array( 1768 - 'aphront-typeahead-control-css', 1769 1770 ), 1770 1771 'c1700f6f' => array( 1771 1772 'javelin-install',
+2
resources/sql/autopatches/20150420.invoice.1.sql
··· 1 + ALTER TABLE {$NAMESPACE}_phortune.phortune_cart 2 + ADD isInvoice BOOL NOT NULL;
+2
resources/sql/autopatches/20150420.invoice.2.sql
··· 1 + UPDATE {$NAMESPACE}_phortune.phortune_cart 2 + SET isInvoice = 1 WHERE subscriptionPHID IS NOT NULL;
+1 -1
src/applications/phortune/controller/PhortuneCartViewController.php
··· 41 41 $resume_uri = null; 42 42 switch ($cart->getStatus()) { 43 43 case PhortuneCart::STATUS_READY: 44 - if ($authority && $request->getStr('invoice')) { 44 + if ($authority && $cart->getIsInvoice()) { 45 45 // We arrived here by following the ad-hoc invoice workflow, and 46 46 // are acting with merchant authority. 47 47
+4 -3
src/applications/phortune/controller/PhortuneMerchantInvoiceCreateController.php
··· 167 167 ->setMetadataValue('adhoc.name', $v_name) 168 168 ->save(); 169 169 170 - // TODO: Actually mark these as invoices. Right now, there's no easy 171 - // way to do that. 170 + $cart 171 + ->setIsInvoice(1) 172 + ->save(); 172 173 173 174 $cart->activateCart(); 174 175 $cart_id = $cart->getID(); 175 176 176 - $uri = "/merchant/{$merchant_id}/cart/{$cart_id}/?invoice=true"; 177 + $uri = "/merchant/{$merchant_id}/cart/{$cart_id}/"; 177 178 $uri = $this->getApplicationURI($uri); 178 179 179 180 return id(new AphrontRedirectResponse())->setURI($uri);
+2 -2
src/applications/phortune/query/PhortuneCartQuery.php
··· 203 203 if ($this->invoices) { 204 204 $where[] = qsprintf( 205 205 $conn, 206 - 'cart.status = %s AND cart.subscriptionPHID IS NOT NULL', 206 + 'cart.status = %s AND cart.isInvoice = 1', 207 207 PhortuneCart::STATUS_READY); 208 208 } else { 209 209 $where[] = qsprintf( 210 210 $conn, 211 - 'cart.status != %s OR cart.subscriptionPHID IS NULL', 211 + 'cart.status != %s OR cart.isInvoice = 0', 212 212 PhortuneCart::STATUS_READY); 213 213 } 214 214 }
+3
src/applications/phortune/storage/PhortuneCart.php
··· 21 21 protected $status; 22 22 protected $metadata = array(); 23 23 protected $mailKey; 24 + protected $isInvoice; 24 25 25 26 private $account = self::ATTACHABLE; 26 27 private $purchases = self::ATTACHABLE; ··· 35 36 ->setAuthorPHID($actor->getPHID()) 36 37 ->setStatus(self::STATUS_BUILDING) 37 38 ->setAccountPHID($account->getPHID()) 39 + ->setIsInvoice(0) 38 40 ->attachAccount($account) 39 41 ->setMerchantPHID($merchant->getPHID()) 40 42 ->attachMerchant($merchant); ··· 531 533 'cartClass' => 'text128', 532 534 'mailKey' => 'bytes20', 533 535 'subscriptionPHID' => 'phid?', 536 + 'isInvoice' => 'bool', 534 537 ), 535 538 self::CONFIG_KEY_SCHEMA => array( 536 539 'key_account' => array(
+5 -1
src/applications/phortune/worker/PhortuneSubscriptionWorker.php
··· 59 59 ->setMetadataValue('epoch.end', $next_epoch) 60 60 ->save(); 61 61 62 - $cart->setSubscriptionPHID($subscription->getPHID()); 62 + $cart 63 + ->setSubscriptionPHID($subscription->getPHID()) 64 + ->setIsInvoice(1) 65 + ->save(); 66 + 63 67 $cart->activateCart(); 64 68 65 69 try {