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

Add Contact Information to Phortune Merchants

Summary: Part of making this look/feel/be more professional is having decent receipts for billing, including contact information (whatever we want to put in there). I'm not using this anywhere at the moment, but will.

Test Plan: Add Contact Info, see Contact Info. Also, why is Remarkup not rendering with line breaks? Seems to be a OneOff thing... anywho... bears!

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T7607

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

+49 -18
+2
resources/sql/autopatches/20161025.phortune.contact.1.sql
··· 1 + ALTER TABLE {$NAMESPACE}_phortune.phortune_merchant 2 + ADD contactInfo LONGTEXT COLLATE {$COLLATE_TEXT} NOT NULL;
+13
src/applications/phortune/controller/PhortuneMerchantEditController.php
··· 47 47 $e_name = true; 48 48 $v_name = $merchant->getName(); 49 49 $v_desc = $merchant->getDescription(); 50 + $v_cont = $merchant->getContactInfo(); 50 51 $v_members = $merchant->getMemberPHIDs(); 51 52 $e_members = null; 52 53 ··· 54 55 if ($request->isFormPost()) { 55 56 $v_name = $request->getStr('name'); 56 57 $v_desc = $request->getStr('desc'); 58 + $v_cont = $request->getStr('cont'); 57 59 $v_view = $request->getStr('viewPolicy'); 58 60 $v_edit = $request->getStr('editPolicy'); 59 61 $v_members = $request->getArr('memberPHIDs'); 60 62 61 63 $type_name = PhortuneMerchantTransaction::TYPE_NAME; 62 64 $type_desc = PhortuneMerchantTransaction::TYPE_DESCRIPTION; 65 + $type_cont = PhortuneMerchantTransaction::TYPE_CONTACTINFO; 63 66 $type_edge = PhabricatorTransactions::TYPE_EDGE; 64 67 $type_view = PhabricatorTransactions::TYPE_VIEW_POLICY; 65 68 ··· 74 77 $xactions[] = id(new PhortuneMerchantTransaction()) 75 78 ->setTransactionType($type_desc) 76 79 ->setNewValue($v_desc); 80 + 81 + $xactions[] = id(new PhortuneMerchantTransaction()) 82 + ->setTransactionType($type_cont) 83 + ->setNewValue($v_cont); 77 84 78 85 $xactions[] = id(new PhortuneMerchantTransaction()) 79 86 ->setTransactionType($type_view) ··· 127 134 ->setName('desc') 128 135 ->setLabel(pht('Description')) 129 136 ->setValue($v_desc)) 137 + ->appendChild( 138 + id(new PhabricatorRemarkupControl()) 139 + ->setUser($viewer) 140 + ->setName('cont') 141 + ->setLabel(pht('Contact Info')) 142 + ->setValue($v_cont)) 130 143 ->appendControl( 131 144 id(new AphrontFormTokenizerControl()) 132 145 ->setDatasource(new PhabricatorPeopleDatasource())
+16 -18
src/applications/phortune/controller/PhortuneMerchantViewController.php
··· 36 36 ->execute(); 37 37 38 38 $details = $this->buildDetailsView($merchant, $providers); 39 - $description = $this->buildDescriptionView($merchant); 40 39 $curtain = $this->buildCurtainView($merchant); 41 40 42 41 $provider_list = $this->buildProviderList( ··· 53 52 ->setCurtain($curtain) 54 53 ->setMainColumn(array( 55 54 $details, 56 - $description, 57 55 $provider_list, 58 56 $timeline, 59 57 )); ··· 130 128 131 129 $view->addProperty(pht('Status'), $status_view); 132 130 133 - return id(new PHUIObjectBoxView()) 134 - ->setHeaderText(pht('Details')) 135 - ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) 136 - ->appendChild($view); 137 - } 138 - 139 - private function buildDescriptionView(PhortuneMerchant $merchant) { 140 - $viewer = $this->getViewer(); 141 - $view = id(new PHUIPropertyListView()) 142 - ->setUser($viewer); 143 - 144 131 $description = $merchant->getDescription(); 145 132 if (strlen($description)) { 146 133 $description = new PHUIRemarkupView($viewer, $description); 134 + $view->addSectionHeader( 135 + pht('Description'), 136 + PHUIPropertyListView::ICON_SUMMARY); 147 137 $view->addTextContent($description); 148 - return id(new PHUIObjectBoxView()) 149 - ->setHeaderText(pht('Description')) 150 - ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) 151 - ->appendChild($view); 152 138 } 153 139 154 - return null; 140 + $contact_info = $merchant->getContactInfo(); 141 + if (strlen($contact_info)) { 142 + $contact_info = new PHUIRemarkupView($viewer, $contact_info); 143 + $view->addSectionHeader( 144 + pht('Contact Info'), 145 + PHUIPropertyListView::ICON_SUMMARY); 146 + $view->addTextContent($contact_info); 147 + } 148 + 149 + return id(new PHUIObjectBoxView()) 150 + ->setHeaderText(pht('Details')) 151 + ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) 152 + ->appendChild($view); 155 153 } 156 154 157 155 private function buildCurtainView(PhortuneMerchant $merchant) {
+8
src/applications/phortune/editor/PhortuneMerchantEditor.php
··· 16 16 17 17 $types[] = PhortuneMerchantTransaction::TYPE_NAME; 18 18 $types[] = PhortuneMerchantTransaction::TYPE_DESCRIPTION; 19 + $types[] = PhortuneMerchantTransaction::TYPE_CONTACTINFO; 19 20 $types[] = PhabricatorTransactions::TYPE_VIEW_POLICY; 20 21 $types[] = PhabricatorTransactions::TYPE_EDGE; 21 22 ··· 30 31 return $object->getName(); 31 32 case PhortuneMerchantTransaction::TYPE_DESCRIPTION: 32 33 return $object->getDescription(); 34 + case PhortuneMerchantTransaction::TYPE_CONTACTINFO: 35 + return $object->getContactInfo(); 33 36 } 34 37 35 38 return parent::getCustomTransactionOldValue($object, $xaction); ··· 42 45 switch ($xaction->getTransactionType()) { 43 46 case PhortuneMerchantTransaction::TYPE_NAME: 44 47 case PhortuneMerchantTransaction::TYPE_DESCRIPTION: 48 + case PhortuneMerchantTransaction::TYPE_CONTACTINFO: 45 49 return $xaction->getNewValue(); 46 50 } 47 51 ··· 59 63 case PhortuneMerchantTransaction::TYPE_DESCRIPTION: 60 64 $object->setDescription($xaction->getNewValue()); 61 65 return; 66 + case PhortuneMerchantTransaction::TYPE_CONTACTINFO: 67 + $object->setContactInfo($xaction->getNewValue()); 68 + return; 62 69 } 63 70 64 71 return parent::applyCustomInternalTransaction($object, $xaction); ··· 71 78 switch ($xaction->getTransactionType()) { 72 79 case PhortuneMerchantTransaction::TYPE_NAME: 73 80 case PhortuneMerchantTransaction::TYPE_DESCRIPTION: 81 + case PhortuneMerchantTransaction::TYPE_CONTACTINFO: 74 82 return; 75 83 } 76 84
+2
src/applications/phortune/storage/PhortuneMerchant.php
··· 8 8 protected $name; 9 9 protected $viewPolicy; 10 10 protected $description; 11 + protected $contactInfo; 11 12 12 13 private $memberPHIDs = self::ATTACHABLE; 13 14 ··· 23 24 self::CONFIG_COLUMN_SCHEMA => array( 24 25 'name' => 'text255', 25 26 'description' => 'text', 27 + 'contactInfo' => 'text', 26 28 ), 27 29 ) + parent::getConfiguration(); 28 30 }
+8
src/applications/phortune/storage/PhortuneMerchantTransaction.php
··· 5 5 6 6 const TYPE_NAME = 'merchant:name'; 7 7 const TYPE_DESCRIPTION = 'merchant:description'; 8 + const TYPE_CONTACTINFO = 'merchant:contactinfo'; 8 9 9 10 public function getApplicationName() { 10 11 return 'phortune'; ··· 42 43 return pht( 43 44 '%s updated the description for this merchant.', 44 45 $this->renderHandleLink($author_phid)); 46 + case self::TYPE_CONTACTINFO: 47 + return pht( 48 + '%s updated the contact information for this merchant.', 49 + $this->renderHandleLink($author_phid)); 45 50 } 46 51 47 52 return parent::getTitle(); ··· 51 56 $old = $this->getOldValue(); 52 57 switch ($this->getTransactionType()) { 53 58 case self::TYPE_DESCRIPTION: 59 + case self::TYPE_CONTACTINFO: 54 60 return ($old === null); 55 61 } 56 62 return parent::shouldHide(); ··· 59 65 public function hasChangeDetails() { 60 66 switch ($this->getTransactionType()) { 61 67 case self::TYPE_DESCRIPTION: 68 + return ($this->getOldValue() !== null); 69 + case self::TYPE_CONTACTINFO: 62 70 return ($this->getOldValue() !== null); 63 71 } 64 72