Page MenuHomePhabricator

D19979.diff
No OneTemporary

D19979.diff

diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -91,7 +91,7 @@
'rsrc/css/application/pholio/pholio-inline-comments.css' => '722b48c2',
'rsrc/css/application/pholio/pholio.css' => '88ef5ef1',
'rsrc/css/application/phortune/phortune-credit-card-form.css' => '3b9868a8',
- 'rsrc/css/application/phortune/phortune-invoice.css' => 'e41765fc',
+ 'rsrc/css/application/phortune/phortune-invoice.css' => '4436b241',
'rsrc/css/application/phortune/phortune.css' => '12e8251a',
'rsrc/css/application/phrequent/phrequent.css' => 'bd79cc67',
'rsrc/css/application/phriction/phriction-document-css.css' => '03380da0',
@@ -788,7 +788,7 @@
'phortune-credit-card-form' => 'd12d214f',
'phortune-credit-card-form-css' => '3b9868a8',
'phortune-css' => '12e8251a',
- 'phortune-invoice-css' => 'e41765fc',
+ 'phortune-invoice-css' => '4436b241',
'phrequent-css' => 'bd79cc67',
'phriction-document-css' => '03380da0',
'phui-action-panel-css' => '6c386cbf',
diff --git a/resources/sql/autopatches/20190116.phortune.01.billing.sql b/resources/sql/autopatches/20190116.phortune.01.billing.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20190116.phortune.01.billing.sql
@@ -0,0 +1,3 @@
+ALTER TABLE {$NAMESPACE}_phortune.phortune_account
+ ADD billingName VARCHAR(255) NOT NULL COLLATE {$COLLATE_TEXT},
+ ADD billingAddress LONGTEXT NOT NULL COLLATE {$COLLATE_TEXT};
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -4905,7 +4905,9 @@
'PholioUploadedImageView' => 'applications/pholio/view/PholioUploadedImageView.php',
'PhortuneAccount' => 'applications/phortune/storage/PhortuneAccount.php',
'PhortuneAccountAddManagerController' => 'applications/phortune/controller/account/PhortuneAccountAddManagerController.php',
+ 'PhortuneAccountBillingAddressTransaction' => 'applications/phortune/xaction/PhortuneAccountBillingAddressTransaction.php',
'PhortuneAccountBillingController' => 'applications/phortune/controller/account/PhortuneAccountBillingController.php',
+ 'PhortuneAccountBillingNameTransaction' => 'applications/phortune/xaction/PhortuneAccountBillingNameTransaction.php',
'PhortuneAccountChargeListController' => 'applications/phortune/controller/account/PhortuneAccountChargeListController.php',
'PhortuneAccountController' => 'applications/phortune/controller/account/PhortuneAccountController.php',
'PhortuneAccountEditController' => 'applications/phortune/controller/account/PhortuneAccountEditController.php',
@@ -11067,7 +11069,9 @@
'PhabricatorPolicyInterface',
),
'PhortuneAccountAddManagerController' => 'PhortuneController',
+ 'PhortuneAccountBillingAddressTransaction' => 'PhortuneAccountTransactionType',
'PhortuneAccountBillingController' => 'PhortuneAccountProfileController',
+ 'PhortuneAccountBillingNameTransaction' => 'PhortuneAccountTransactionType',
'PhortuneAccountChargeListController' => 'PhortuneController',
'PhortuneAccountController' => 'PhortuneController',
'PhortuneAccountEditController' => 'PhortuneController',
diff --git a/src/applications/phortune/controller/cart/PhortuneCartViewController.php b/src/applications/phortune/controller/cart/PhortuneCartViewController.php
--- a/src/applications/phortune/controller/cart/PhortuneCartViewController.php
+++ b/src/applications/phortune/controller/cart/PhortuneCartViewController.php
@@ -226,25 +226,37 @@
->withPHIDs(array($buyer_phid))
->needProfileImage(true)
->executeOne();
- // TODO: Add account "Contact" info
$merchant_contact = new PHUIRemarkupView(
- $viewer, $merchant->getContactInfo());
- $description = null;
+ $viewer,
+ $merchant->getContactInfo());
+
+ $account_name = $account->getBillingName();
+ if (!strlen($account_name)) {
+ $account_name = $buyer->getRealName();
+ }
+
+ $account_contact = $account->getBillingAddress();
+ if (strlen($account_contact)) {
+ $account_contact = new PHUIRemarkupView(
+ $viewer,
+ $account_contact);
+ }
$view = id(new PhortuneInvoiceView())
->setMerchantName($merchant->getName())
->setMerchantLogo($merchant->getProfileImageURI())
->setMerchantContact($merchant_contact)
->setMerchantFooter($merchant->getInvoiceFooter())
- ->setAccountName($buyer->getRealName())
+ ->setAccountName($account_name)
+ ->setAccountContact($account_contact)
->setStatus($error_view)
- ->setContent(array(
- $description,
- $details,
- $cart_box,
- $charges,
- ));
+ ->setContent(
+ array(
+ $details,
+ $cart_box,
+ $charges,
+ ));
}
$page = $this->newPage()
diff --git a/src/applications/phortune/editor/PhortuneAccountEditEngine.php b/src/applications/phortune/editor/PhortuneAccountEditEngine.php
--- a/src/applications/phortune/editor/PhortuneAccountEditEngine.php
+++ b/src/applications/phortune/editor/PhortuneAccountEditEngine.php
@@ -99,6 +99,25 @@
->setConduitTypeDescription(pht('New list of managers.'))
->setInitialValue($object->getMemberPHIDs())
->setValue($member_phids),
+
+ id(new PhabricatorTextEditField())
+ ->setKey('billingName')
+ ->setLabel(pht('Billing Name'))
+ ->setDescription(pht('Account name for billing purposes.'))
+ ->setConduitTypeDescription(pht('New account billing name.'))
+ ->setTransactionType(
+ PhortuneAccountBillingNameTransaction::TRANSACTIONTYPE)
+ ->setValue($object->getBillingName()),
+
+ id(new PhabricatorTextAreaEditField())
+ ->setKey('billingAddress')
+ ->setLabel(pht('Billing Address'))
+ ->setDescription(pht('Account billing address.'))
+ ->setConduitTypeDescription(pht('New account billing address.'))
+ ->setTransactionType(
+ PhortuneAccountBillingAddressTransaction::TRANSACTIONTYPE)
+ ->setValue($object->getBillingAddress()),
+
);
return $fields;
diff --git a/src/applications/phortune/storage/PhortuneAccount.php b/src/applications/phortune/storage/PhortuneAccount.php
--- a/src/applications/phortune/storage/PhortuneAccount.php
+++ b/src/applications/phortune/storage/PhortuneAccount.php
@@ -12,11 +12,15 @@
PhabricatorPolicyInterface {
protected $name;
+ protected $billingName;
+ protected $billingAddress;
private $memberPHIDs = self::ATTACHABLE;
public static function initializeNewAccount(PhabricatorUser $actor) {
return id(new self())
+ ->setBillingName('')
+ ->setBillingAddress('')
->attachMemberPHIDs(array());
}
@@ -75,6 +79,8 @@
self::CONFIG_AUX_PHID => true,
self::CONFIG_COLUMN_SCHEMA => array(
'name' => 'text255',
+ 'billingName' => 'text255',
+ 'billingAddress' => 'text',
),
) + parent::getConfiguration();
}
diff --git a/src/applications/phortune/view/PhortuneInvoiceView.php b/src/applications/phortune/view/PhortuneInvoiceView.php
--- a/src/applications/phortune/view/PhortuneInvoiceView.php
+++ b/src/applications/phortune/view/PhortuneInvoiceView.php
@@ -82,7 +82,7 @@
array(
'class' => 'phortune-mini-header',
),
- pht('To:'));
+ pht('Bill To:'));
$bill_to = phutil_tag(
'td',
diff --git a/src/applications/phortune/xaction/PhortuneAccountBillingAddressTransaction.php b/src/applications/phortune/xaction/PhortuneAccountBillingAddressTransaction.php
new file mode 100644
--- /dev/null
+++ b/src/applications/phortune/xaction/PhortuneAccountBillingAddressTransaction.php
@@ -0,0 +1,39 @@
+<?php
+
+final class PhortuneAccountBillingAddressTransaction
+ extends PhortuneAccountTransactionType {
+
+ const TRANSACTIONTYPE = 'billing-address';
+
+ public function generateOldValue($object) {
+ return $object->getBillingAddress();
+ }
+
+ public function applyInternalEffects($object, $value) {
+ $object->setBillingAddress($value);
+ }
+
+ public function getTitle() {
+ return pht(
+ '%s updated the account billing address.',
+ $this->renderAuthor());
+ }
+
+ public function hasChangeDetailView() {
+ return true;
+ }
+
+ public function getMailDiffSectionHeader() {
+ return pht('CHANGES TO BILLING ADDRESS');
+ }
+
+ public function newChangeDetailView() {
+ $viewer = $this->getViewer();
+
+ return id(new PhabricatorApplicationTransactionTextDiffDetailView())
+ ->setViewer($viewer)
+ ->setOldText($this->getOldValue())
+ ->setNewText($this->getNewValue());
+ }
+
+}
diff --git a/src/applications/phortune/xaction/PhortuneAccountBillingNameTransaction.php b/src/applications/phortune/xaction/PhortuneAccountBillingNameTransaction.php
new file mode 100644
--- /dev/null
+++ b/src/applications/phortune/xaction/PhortuneAccountBillingNameTransaction.php
@@ -0,0 +1,56 @@
+<?php
+
+final class PhortuneAccountBillingNameTransaction
+ extends PhortuneAccountTransactionType {
+
+ const TRANSACTIONTYPE = 'billing-name';
+
+ public function generateOldValue($object) {
+ return $object->getBillingName();
+ }
+
+ public function applyInternalEffects($object, $value) {
+ $object->setBillingName($value);
+ }
+
+ public function getTitle() {
+ $old = $this->getOldValue();
+ $new = $this->getNewValue();
+
+ if (strlen($old) && strlen($new)) {
+ return pht(
+ '%s changed the billing name for this account from %s to %s.',
+ $this->renderAuthor(),
+ $this->renderOldValue(),
+ $this->renderNewValue());
+ } else if (strlen($old)) {
+ return pht(
+ '%s removed the billing name for this account (was %s).',
+ $this->renderAuthor(),
+ $this->renderOldValue());
+ } else {
+ return pht(
+ '%s set the billing name for this account to %s.',
+ $this->renderAuthor(),
+ $this->renderNewValue());
+ }
+ }
+
+ public function validateTransactions($object, array $xactions) {
+ $errors = array();
+
+ $max_length = $object->getColumnMaximumByteLength('billingName');
+ foreach ($xactions as $xaction) {
+ $new_value = $xaction->getNewValue();
+ $new_length = strlen($new_value);
+ if ($new_length > $max_length) {
+ $errors[] = $this->newRequiredError(
+ pht('The billing name can be no longer than %s characters.',
+ new PhutilNumber($max_length)));
+ }
+ }
+
+ return $errors;
+ }
+
+}
diff --git a/webroot/rsrc/css/application/phortune/phortune-invoice.css b/webroot/rsrc/css/application/phortune/phortune-invoice.css
--- a/webroot/rsrc/css/application/phortune/phortune-invoice.css
+++ b/webroot/rsrc/css/application/phortune/phortune-invoice.css
@@ -49,7 +49,7 @@
font-weight: bold;
text-transform: uppercase;
margin-bottom: 4px;
- letter-spacing: 0.3em;
+ letter-spacing: 0.25em;
}
.phortune-invoice-status {

File Metadata

Mime Type
text/plain
Expires
Sun, Mar 2, 1:50 PM (20 h, 21 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7216840
Default Alt Text
D19979.diff (10 KB)

Event Timeline