Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15378887
D14125.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
8 KB
Referenced Files
None
Subscribers
None
D14125.diff
View Options
diff --git a/resources/sql/autopatches/20161025.phortune.contact.1.sql b/resources/sql/autopatches/20161025.phortune.contact.1.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20161025.phortune.contact.1.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_phortune.phortune_merchant
+ ADD contactInfo LONGTEXT COLLATE {$COLLATE_TEXT} NOT NULL;
diff --git a/src/applications/phortune/controller/PhortuneMerchantEditController.php b/src/applications/phortune/controller/PhortuneMerchantEditController.php
--- a/src/applications/phortune/controller/PhortuneMerchantEditController.php
+++ b/src/applications/phortune/controller/PhortuneMerchantEditController.php
@@ -47,6 +47,7 @@
$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 @@
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;
@@ -76,6 +79,10 @@
->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 @@
->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())
diff --git a/src/applications/phortune/controller/PhortuneMerchantViewController.php b/src/applications/phortune/controller/PhortuneMerchantViewController.php
--- a/src/applications/phortune/controller/PhortuneMerchantViewController.php
+++ b/src/applications/phortune/controller/PhortuneMerchantViewController.php
@@ -36,7 +36,6 @@
->execute();
$details = $this->buildDetailsView($merchant, $providers);
- $description = $this->buildDescriptionView($merchant);
$curtain = $this->buildCurtainView($merchant);
$provider_list = $this->buildProviderList(
@@ -53,7 +52,6 @@
->setCurtain($curtain)
->setMainColumn(array(
$details,
- $description,
$provider_list,
$timeline,
));
@@ -130,28 +128,28 @@
$view->addProperty(pht('Status'), $status_view);
- 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->addSectionHeader(
+ pht('Description'),
+ PHUIPropertyListView::ICON_SUMMARY);
$view->addTextContent($description);
- return id(new PHUIObjectBoxView())
- ->setHeaderText(pht('Description'))
- ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
- ->appendChild($view);
}
- return null;
+ $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 buildCurtainView(PhortuneMerchant $merchant) {
diff --git a/src/applications/phortune/editor/PhortuneMerchantEditor.php b/src/applications/phortune/editor/PhortuneMerchantEditor.php
--- a/src/applications/phortune/editor/PhortuneMerchantEditor.php
+++ b/src/applications/phortune/editor/PhortuneMerchantEditor.php
@@ -16,6 +16,7 @@
$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 @@
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 @@
switch ($xaction->getTransactionType()) {
case PhortuneMerchantTransaction::TYPE_NAME:
case PhortuneMerchantTransaction::TYPE_DESCRIPTION:
+ case PhortuneMerchantTransaction::TYPE_CONTACTINFO:
return $xaction->getNewValue();
}
@@ -59,6 +63,9 @@
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 @@
switch ($xaction->getTransactionType()) {
case PhortuneMerchantTransaction::TYPE_NAME:
case PhortuneMerchantTransaction::TYPE_DESCRIPTION:
+ case PhortuneMerchantTransaction::TYPE_CONTACTINFO:
return;
}
diff --git a/src/applications/phortune/storage/PhortuneMerchant.php b/src/applications/phortune/storage/PhortuneMerchant.php
--- a/src/applications/phortune/storage/PhortuneMerchant.php
+++ b/src/applications/phortune/storage/PhortuneMerchant.php
@@ -8,6 +8,7 @@
protected $name;
protected $viewPolicy;
protected $description;
+ protected $contactInfo;
private $memberPHIDs = self::ATTACHABLE;
@@ -23,6 +24,7 @@
self::CONFIG_COLUMN_SCHEMA => array(
'name' => 'text255',
'description' => 'text',
+ 'contactInfo' => 'text',
),
) + parent::getConfiguration();
}
diff --git a/src/applications/phortune/storage/PhortuneMerchantTransaction.php b/src/applications/phortune/storage/PhortuneMerchantTransaction.php
--- a/src/applications/phortune/storage/PhortuneMerchantTransaction.php
+++ b/src/applications/phortune/storage/PhortuneMerchantTransaction.php
@@ -5,6 +5,7 @@
const TYPE_NAME = 'merchant:name';
const TYPE_DESCRIPTION = 'merchant:description';
+ const TYPE_CONTACTINFO = 'merchant:contactinfo';
public function getApplicationName() {
return 'phortune';
@@ -42,6 +43,10 @@
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 @@
$old = $this->getOldValue();
switch ($this->getTransactionType()) {
case self::TYPE_DESCRIPTION:
+ case self::TYPE_CONTACTINFO:
return ($old === null);
}
return parent::shouldHide();
@@ -60,6 +66,8 @@
switch ($this->getTransactionType()) {
case self::TYPE_DESCRIPTION:
return ($this->getOldValue() !== null);
+ case self::TYPE_CONTACTINFO:
+ return ($this->getOldValue() !== null);
}
return parent::hasChangeDetails();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mar 14 2025, 5:33 PM (4 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7385841
Default Alt Text
D14125.diff (8 KB)
Attached To
Mode
D14125: Add Contact Information to Phortune Merchants
Attached
Detach File
Event Timeline
Log In to Comment