3 final class PhortuneAccountEditEngine
4 extends PhabricatorEditEngine
{
6 const ENGINECONST
= 'phortune.account';
8 public function getEngineName() {
9 return pht('Phortune Accounts');
12 public function getEngineApplicationClass() {
13 return 'PhabricatorPhortuneApplication';
16 public function getSummaryHeader() {
17 return pht('Configure Phortune Account Forms');
20 public function getSummaryText() {
21 return pht('Configure creation and editing forms in Phortune Accounts.');
24 public function isEngineConfigurable() {
28 protected function newEditableObject() {
29 return PhortuneAccount
::initializeNewAccount($this->getViewer());
32 protected function newObjectQuery() {
33 return new PhortuneAccountQuery();
36 protected function getObjectCreateTitleText($object) {
37 return pht('Create Payment Account');
40 protected function getObjectEditTitleText($object) {
41 return pht('Edit Account: %s', $object->getName());
44 protected function getObjectEditShortText($object) {
45 return $object->getName();
48 protected function getObjectCreateShortText() {
49 return pht('Create Account');
52 protected function getObjectName() {
53 return pht('Account');
56 protected function getObjectCreateCancelURI($object) {
57 return $this->getApplication()->getApplicationURI('/');
60 protected function getEditorURI() {
61 return $this->getApplication()->getApplicationURI('edit/');
64 protected function getObjectViewURI($object) {
65 if ($this->getIsCreate()) {
66 return $object->getURI();
68 return $object->getDetailsURI();
72 protected function buildCustomEditFields($object) {
73 $viewer = $this->getViewer();
75 if ($this->getIsCreate()) {
76 $member_phids = array($viewer->getPHID());
78 $member_phids = $object->getMemberPHIDs();
82 id(new PhabricatorTextEditField())
84 ->setLabel(pht('Name'))
85 ->setDescription(pht('Account name.'))
86 ->setConduitTypeDescription(pht('New account name.'))
88 PhortuneAccountNameTransaction
::TRANSACTIONTYPE
)
89 ->setValue($object->getName())
90 ->setIsRequired(true),
92 id(new PhabricatorUsersEditField())
94 ->setAliases(array('memberPHIDs', 'managerPHIDs'))
95 ->setLabel(pht('Managers'))
96 ->setUseEdgeTransactions(true)
97 ->setTransactionType(PhabricatorTransactions
::TYPE_EDGE
)
100 PhortuneAccountHasMemberEdgeType
::EDGECONST
)
101 ->setDescription(pht('Initial account managers.'))
102 ->setConduitDescription(pht('Set account managers.'))
103 ->setConduitTypeDescription(pht('New list of managers.'))
104 ->setInitialValue($object->getMemberPHIDs())
105 ->setValue($member_phids),
107 id(new PhabricatorTextEditField())
108 ->setKey('billingName')
109 ->setLabel(pht('Billing Name'))
110 ->setDescription(pht('Account name for billing purposes.'))
111 ->setConduitTypeDescription(pht('New account billing name.'))
112 ->setTransactionType(
113 PhortuneAccountBillingNameTransaction
::TRANSACTIONTYPE
)
114 ->setValue($object->getBillingName()),
116 id(new PhabricatorTextAreaEditField())
117 ->setKey('billingAddress')
118 ->setLabel(pht('Billing Address'))
119 ->setDescription(pht('Account billing address.'))
120 ->setConduitTypeDescription(pht('New account billing address.'))
121 ->setTransactionType(
122 PhortuneAccountBillingAddressTransaction
::TRANSACTIONTYPE
)
123 ->setValue($object->getBillingAddress()),