mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-09 16:32:39 +01:00
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
This commit is contained in:
parent
48666839fe
commit
a69ac888b3
6 changed files with 51 additions and 20 deletions
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE {$NAMESPACE}_phortune.phortune_merchant
|
||||
ADD contactInfo LONGTEXT COLLATE {$COLLATE_TEXT} NOT NULL;
|
|
@ -47,6 +47,7 @@ final class PhortuneMerchantEditController
|
|||
$e_name = true;
|
||||
$v_name = $merchant->getName();
|
||||
$v_desc = $merchant->getDescription();
|
||||
$v_cont = $merchant->getContactInfo();
|
||||
$v_members = $merchant->getMemberPHIDs();
|
||||
$e_members = null;
|
||||
|
||||
|
@ -54,12 +55,14 @@ final class PhortuneMerchantEditController
|
|||
if ($request->isFormPost()) {
|
||||
$v_name = $request->getStr('name');
|
||||
$v_desc = $request->getStr('desc');
|
||||
$v_cont = $request->getStr('cont');
|
||||
$v_view = $request->getStr('viewPolicy');
|
||||
$v_edit = $request->getStr('editPolicy');
|
||||
$v_members = $request->getArr('memberPHIDs');
|
||||
|
||||
$type_name = PhortuneMerchantTransaction::TYPE_NAME;
|
||||
$type_desc = PhortuneMerchantTransaction::TYPE_DESCRIPTION;
|
||||
$type_cont = PhortuneMerchantTransaction::TYPE_CONTACTINFO;
|
||||
$type_edge = PhabricatorTransactions::TYPE_EDGE;
|
||||
$type_view = PhabricatorTransactions::TYPE_VIEW_POLICY;
|
||||
|
||||
|
@ -75,6 +78,10 @@ final class PhortuneMerchantEditController
|
|||
->setTransactionType($type_desc)
|
||||
->setNewValue($v_desc);
|
||||
|
||||
$xactions[] = id(new PhortuneMerchantTransaction())
|
||||
->setTransactionType($type_cont)
|
||||
->setNewValue($v_cont);
|
||||
|
||||
$xactions[] = id(new PhortuneMerchantTransaction())
|
||||
->setTransactionType($type_view)
|
||||
->setNewValue($v_view);
|
||||
|
@ -127,6 +134,12 @@ final class PhortuneMerchantEditController
|
|||
->setName('desc')
|
||||
->setLabel(pht('Description'))
|
||||
->setValue($v_desc))
|
||||
->appendChild(
|
||||
id(new PhabricatorRemarkupControl())
|
||||
->setUser($viewer)
|
||||
->setName('cont')
|
||||
->setLabel(pht('Contact Info'))
|
||||
->setValue($v_cont))
|
||||
->appendControl(
|
||||
id(new AphrontFormTokenizerControl())
|
||||
->setDatasource(new PhabricatorPeopleDatasource())
|
||||
|
|
|
@ -36,7 +36,6 @@ final class PhortuneMerchantViewController
|
|||
->execute();
|
||||
|
||||
$details = $this->buildDetailsView($merchant, $providers);
|
||||
$description = $this->buildDescriptionView($merchant);
|
||||
$curtain = $this->buildCurtainView($merchant);
|
||||
|
||||
$provider_list = $this->buildProviderList(
|
||||
|
@ -53,7 +52,6 @@ final class PhortuneMerchantViewController
|
|||
->setCurtain($curtain)
|
||||
->setMainColumn(array(
|
||||
$details,
|
||||
$description,
|
||||
$provider_list,
|
||||
$timeline,
|
||||
));
|
||||
|
@ -130,30 +128,30 @@ final class PhortuneMerchantViewController
|
|||
|
||||
$view->addProperty(pht('Status'), $status_view);
|
||||
|
||||
$description = $merchant->getDescription();
|
||||
if (strlen($description)) {
|
||||
$description = new PHUIRemarkupView($viewer, $description);
|
||||
$view->addSectionHeader(
|
||||
pht('Description'),
|
||||
PHUIPropertyListView::ICON_SUMMARY);
|
||||
$view->addTextContent($description);
|
||||
}
|
||||
|
||||
$contact_info = $merchant->getContactInfo();
|
||||
if (strlen($contact_info)) {
|
||||
$contact_info = new PHUIRemarkupView($viewer, $contact_info);
|
||||
$view->addSectionHeader(
|
||||
pht('Contact Info'),
|
||||
PHUIPropertyListView::ICON_SUMMARY);
|
||||
$view->addTextContent($contact_info);
|
||||
}
|
||||
|
||||
return id(new PHUIObjectBoxView())
|
||||
->setHeaderText(pht('Details'))
|
||||
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
||||
->appendChild($view);
|
||||
}
|
||||
|
||||
private function buildDescriptionView(PhortuneMerchant $merchant) {
|
||||
$viewer = $this->getViewer();
|
||||
$view = id(new PHUIPropertyListView())
|
||||
->setUser($viewer);
|
||||
|
||||
$description = $merchant->getDescription();
|
||||
if (strlen($description)) {
|
||||
$description = new PHUIRemarkupView($viewer, $description);
|
||||
$view->addTextContent($description);
|
||||
return id(new PHUIObjectBoxView())
|
||||
->setHeaderText(pht('Description'))
|
||||
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
||||
->appendChild($view);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private function buildCurtainView(PhortuneMerchant $merchant) {
|
||||
$viewer = $this->getRequest()->getUser();
|
||||
$id = $merchant->getID();
|
||||
|
|
|
@ -16,6 +16,7 @@ final class PhortuneMerchantEditor
|
|||
|
||||
$types[] = PhortuneMerchantTransaction::TYPE_NAME;
|
||||
$types[] = PhortuneMerchantTransaction::TYPE_DESCRIPTION;
|
||||
$types[] = PhortuneMerchantTransaction::TYPE_CONTACTINFO;
|
||||
$types[] = PhabricatorTransactions::TYPE_VIEW_POLICY;
|
||||
$types[] = PhabricatorTransactions::TYPE_EDGE;
|
||||
|
||||
|
@ -30,6 +31,8 @@ final class PhortuneMerchantEditor
|
|||
return $object->getName();
|
||||
case PhortuneMerchantTransaction::TYPE_DESCRIPTION:
|
||||
return $object->getDescription();
|
||||
case PhortuneMerchantTransaction::TYPE_CONTACTINFO:
|
||||
return $object->getContactInfo();
|
||||
}
|
||||
|
||||
return parent::getCustomTransactionOldValue($object, $xaction);
|
||||
|
@ -42,6 +45,7 @@ final class PhortuneMerchantEditor
|
|||
switch ($xaction->getTransactionType()) {
|
||||
case PhortuneMerchantTransaction::TYPE_NAME:
|
||||
case PhortuneMerchantTransaction::TYPE_DESCRIPTION:
|
||||
case PhortuneMerchantTransaction::TYPE_CONTACTINFO:
|
||||
return $xaction->getNewValue();
|
||||
}
|
||||
|
||||
|
@ -59,6 +63,9 @@ final class PhortuneMerchantEditor
|
|||
case PhortuneMerchantTransaction::TYPE_DESCRIPTION:
|
||||
$object->setDescription($xaction->getNewValue());
|
||||
return;
|
||||
case PhortuneMerchantTransaction::TYPE_CONTACTINFO:
|
||||
$object->setContactInfo($xaction->getNewValue());
|
||||
return;
|
||||
}
|
||||
|
||||
return parent::applyCustomInternalTransaction($object, $xaction);
|
||||
|
@ -71,6 +78,7 @@ final class PhortuneMerchantEditor
|
|||
switch ($xaction->getTransactionType()) {
|
||||
case PhortuneMerchantTransaction::TYPE_NAME:
|
||||
case PhortuneMerchantTransaction::TYPE_DESCRIPTION:
|
||||
case PhortuneMerchantTransaction::TYPE_CONTACTINFO:
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ final class PhortuneMerchant extends PhortuneDAO
|
|||
protected $name;
|
||||
protected $viewPolicy;
|
||||
protected $description;
|
||||
protected $contactInfo;
|
||||
|
||||
private $memberPHIDs = self::ATTACHABLE;
|
||||
|
||||
|
@ -23,6 +24,7 @@ final class PhortuneMerchant extends PhortuneDAO
|
|||
self::CONFIG_COLUMN_SCHEMA => array(
|
||||
'name' => 'text255',
|
||||
'description' => 'text',
|
||||
'contactInfo' => 'text',
|
||||
),
|
||||
) + parent::getConfiguration();
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ final class PhortuneMerchantTransaction
|
|||
|
||||
const TYPE_NAME = 'merchant:name';
|
||||
const TYPE_DESCRIPTION = 'merchant:description';
|
||||
const TYPE_CONTACTINFO = 'merchant:contactinfo';
|
||||
|
||||
public function getApplicationName() {
|
||||
return 'phortune';
|
||||
|
@ -42,6 +43,10 @@ final class PhortuneMerchantTransaction
|
|||
return pht(
|
||||
'%s updated the description for this merchant.',
|
||||
$this->renderHandleLink($author_phid));
|
||||
case self::TYPE_CONTACTINFO:
|
||||
return pht(
|
||||
'%s updated the contact information for this merchant.',
|
||||
$this->renderHandleLink($author_phid));
|
||||
}
|
||||
|
||||
return parent::getTitle();
|
||||
|
@ -51,6 +56,7 @@ final class PhortuneMerchantTransaction
|
|||
$old = $this->getOldValue();
|
||||
switch ($this->getTransactionType()) {
|
||||
case self::TYPE_DESCRIPTION:
|
||||
case self::TYPE_CONTACTINFO:
|
||||
return ($old === null);
|
||||
}
|
||||
return parent::shouldHide();
|
||||
|
@ -60,6 +66,8 @@ final class PhortuneMerchantTransaction
|
|||
switch ($this->getTransactionType()) {
|
||||
case self::TYPE_DESCRIPTION:
|
||||
return ($this->getOldValue() !== null);
|
||||
case self::TYPE_CONTACTINFO:
|
||||
return ($this->getOldValue() !== null);
|
||||
}
|
||||
|
||||
return parent::hasChangeDetails();
|
||||
|
|
Loading…
Reference in a new issue