Differential D19925 Diff 47552 src/applications/project/editor/PhabricatorProjectTransactionEditor.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/project/editor/PhabricatorProjectTransactionEditor.php
Show First 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | protected function validateAllTransactions( | ||||
// Prevent creating projects which are both subprojects and milestones, | // Prevent creating projects which are both subprojects and milestones, | ||||
// since this does not make sense, won't work, and will break everything. | // since this does not make sense, won't work, and will break everything. | ||||
$parent_xaction = null; | $parent_xaction = null; | ||||
foreach ($xactions as $xaction) { | foreach ($xactions as $xaction) { | ||||
switch ($xaction->getTransactionType()) { | switch ($xaction->getTransactionType()) { | ||||
case PhabricatorProjectParentTransaction::TRANSACTIONTYPE: | case PhabricatorProjectParentTransaction::TRANSACTIONTYPE: | ||||
case PhabricatorProjectMilestoneTransaction::TRANSACTIONTYPE: | case PhabricatorProjectMilestoneTransaction::TRANSACTIONTYPE: | ||||
if ($xaction->getNewValue() === null) { | if ($xaction->getNewValue() === null) { | ||||
continue; | continue 2; | ||||
} | } | ||||
if (!$parent_xaction) { | if (!$parent_xaction) { | ||||
$parent_xaction = $xaction; | $parent_xaction = $xaction; | ||||
continue; | continue 2; | ||||
} | } | ||||
$errors[] = new PhabricatorApplicationTransactionValidationError( | $errors[] = new PhabricatorApplicationTransactionValidationError( | ||||
$xaction->getTransactionType(), | $xaction->getTransactionType(), | ||||
pht('Invalid'), | pht('Invalid'), | ||||
pht( | pht( | ||||
'When creating a project, specify a maximum of one parent '. | 'When creating a project, specify a maximum of one parent '. | ||||
'project or milestone project. A project can not be both a '. | 'project or milestone project. A project can not be both a '. | ||||
'subproject and a milestone.'), | 'subproject and a milestone.'), | ||||
$xaction); | $xaction); | ||||
break; | break 2; | ||||
break; | |||||
} | } | ||||
} | } | ||||
$is_milestone = $this->getIsMilestone(); | $is_milestone = $this->getIsMilestone(); | ||||
$is_parent = $object->getHasSubprojects(); | $is_parent = $object->getHasSubprojects(); | ||||
foreach ($xactions as $xaction) { | foreach ($xactions as $xaction) { | ||||
▲ Show 20 Lines • Show All 336 Lines • Show Last 20 Lines |