Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/customfield/field/PhabricatorCustomFieldList.php
| Show First 20 Lines • Show All 193 Lines • ▼ Show 20 Lines | public function buildFieldTransactionsFromRequest( | ||||
| $xactions = array(); | $xactions = array(); | ||||
| $role = PhabricatorCustomField::ROLE_APPLICATIONTRANSACTIONS; | $role = PhabricatorCustomField::ROLE_APPLICATIONTRANSACTIONS; | ||||
| foreach ($this->fields as $field) { | foreach ($this->fields as $field) { | ||||
| if (!$field->shouldEnableForRole($role)) { | if (!$field->shouldEnableForRole($role)) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| $old_value = $field->getOldValueForApplicationTransactions(); | |||||
| $field->readValueFromRequest($request); | |||||
| $transaction_type = $field->getApplicationTransactionType(); | $transaction_type = $field->getApplicationTransactionType(); | ||||
| $xaction = id(clone $template) | $xaction = id(clone $template) | ||||
| ->setTransactionType($transaction_type) | ->setTransactionType($transaction_type); | ||||
| ->setMetadataValue('customfield:key', $field->getFieldKey()) | |||||
| ->setNewValue($field->getNewValueForApplicationTransactions()); | |||||
| if ($transaction_type == PhabricatorTransactions::TYPE_CUSTOMFIELD) { | if ($transaction_type == PhabricatorTransactions::TYPE_CUSTOMFIELD) { | ||||
| // For TYPE_CUSTOMFIELD transactions only, we provide the old value | // For TYPE_CUSTOMFIELD transactions only, we provide the old value | ||||
| // as an input. | // as an input. | ||||
| $old_value = $field->getOldValueForApplicationTransactions(); | |||||
| $xaction->setOldValue($old_value); | $xaction->setOldValue($old_value); | ||||
| } | } | ||||
| $field->readValueFromRequest($request); | |||||
| $xaction | |||||
| ->setNewValue($field->getNewValueForApplicationTransactions()); | |||||
| if ($transaction_type == PhabricatorTransactions::TYPE_CUSTOMFIELD) { | |||||
| // For TYPE_CUSTOMFIELD transactions, add the field key in metadata. | |||||
| $xaction->setMetadataValue('customfield:key', $field->getFieldKey()); | |||||
| } | |||||
| $metadata = $field->getApplicationTransactionMetadata(); | |||||
| foreach ($metadata as $key => $value) { | |||||
| $xaction->setMetadataValue($key, $value); | |||||
| } | |||||
| $xactions[] = $xaction; | $xactions[] = $xaction; | ||||
| } | } | ||||
| return $xactions; | return $xactions; | ||||
| } | } | ||||
| /** | /** | ||||
| ▲ Show 20 Lines • Show All 67 Lines • Show Last 20 Lines | |||||