Page Menu
Home
GnuPG
Search
Configure Global Search
Log In
Files
F25703716
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Size
3 KB
Subscribers
None
View Options
diff --git a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldInt.php b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldInt.php
index 1c0c6677e..aafa30ea9 100644
--- a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldInt.php
+++ b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldInt.php
@@ -1,98 +1,113 @@
<?php
final class PhabricatorStandardCustomFieldInt
extends PhabricatorStandardCustomField {
public function getFieldType() {
return 'int';
}
public function buildFieldIndexes() {
$indexes = array();
$value = $this->getFieldValue();
if (strlen($value)) {
$indexes[] = $this->newNumericIndex((int)$value);
}
return $indexes;
}
public function getValueForStorage() {
$value = $this->getFieldValue();
if (strlen($value)) {
return $value;
} else {
return null;
}
}
public function setValueFromStorage($value) {
if (strlen($value)) {
$value = (int)$value;
} else {
$value = null;
}
return $this->setFieldValue($value);
}
public function readApplicationSearchValueFromRequest(
PhabricatorApplicationSearchEngine $engine,
AphrontRequest $request) {
return $request->getStr($this->getFieldKey());
}
public function applyApplicationSearchConstraintToQuery(
PhabricatorApplicationSearchEngine $engine,
PhabricatorCursorPagedPolicyAwareQuery $query,
$value) {
if (strlen($value)) {
$query->withApplicationSearchContainsConstraint(
$this->newNumericIndex(null),
$value);
}
}
public function appendToApplicationSearchForm(
PhabricatorApplicationSearchEngine $engine,
AphrontFormView $form,
$value,
array $handles) {
$form->appendChild(
id(new AphrontFormTextControl())
->setLabel($this->getFieldName())
->setName($this->getFieldKey())
->setValue($value));
}
public function validateApplicationTransactions(
PhabricatorApplicationTransactionEditor $editor,
$type,
array $xactions) {
$errors = parent::validateApplicationTransactions(
$editor,
$type,
$xactions);
foreach ($xactions as $xaction) {
$value = $xaction->getNewValue();
if (strlen($value)) {
if (!preg_match('/^-?\d+/', $value)) {
$errors[] = new PhabricatorApplicationTransactionValidationError(
$type,
pht('Invalid'),
pht('%s must be an integer.', $this->getFieldName()),
$xaction);
$this->setFieldError(pht('Invalid'));
}
}
}
return $errors;
}
+ public function getApplicationTransactionHasEffect(
+ PhabricatorApplicationTransaction $xaction) {
+
+ $old = $xaction->getOldValue();
+ $new = $xaction->getNewValue();
+ if (!strlen($old) && strlen($new)) {
+ return true;
+ } else if (strlen($old) && !strlen($new)) {
+ return true;
+ } else {
+ return ((int)$old !== (int)$new);
+ }
+ }
+
+
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Tue, Jul 8, 12:32 PM (17 h, 54 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
bc/52/cce668b82b042dc4f59ec341e8d9
Attached To
rPHAB Phabricator
Event Timeline
Log In to Comment