Commit 742a2eea authored by Ana Rute Mendes's avatar Ana Rute Mendes 🌈
Browse files

LOCAL:Maniphest:Apply approver rule to event type

Replicate the logic to auto-fill approver for `event` subtype.

Until now event and purchasing forms used the same template but
they were split in two - `purchasing` and `event` - after the
Snipe-IT integration that applied major changes in the purchasing
request form.
parent 0bbf57e3
...@@ -482,6 +482,15 @@ final class ManiphestTransactionEditor ...@@ -482,6 +482,15 @@ final class ManiphestTransactionEditor
} }
break; break;
case 'std:maniphest:event:project':
foreach ($xaction->getRequiredHandlePHIDs() as $p) {
if (!empty($p)) {
$purchasing_project = $p;
break;
}
}
break;
case 'std:maniphest:sysadmin:confidential-request': case 'std:maniphest:sysadmin:confidential-request':
if ($xaction->getNewValue() != $xaction->getOldValue()) { if ($xaction->getNewValue() != $xaction->getOldValue()) {
$changed_confidentiality = true; $changed_confidentiality = true;
...@@ -548,11 +557,11 @@ final class ManiphestTransactionEditor ...@@ -548,11 +557,11 @@ final class ManiphestTransactionEditor
} }
} }
// CCU: If this is a purchasing type, then try to assign the task to the // CCU: If this is a purchasing or event type, then try to assign the task to
// assignee, if empty. It's not overlay pleasant code, since we need // the assignee, if empty. It's not overlay pleasant code, since we need
// to iterate the transactions, rather than interrogate an object. // to iterate the transactions, rather than interrogate an object.
if ($this->getIsNewObject() && !$any_assign) { if ($this->getIsNewObject() && !$any_assign) {
if ($subtype == 'purchasing') { if (in_array($subtype, array('purchasing', 'event'))) {
if ($approver == null && $purchasing_project !== null) { if ($approver == null && $purchasing_project !== null) {
$p_proj = id(new PhabricatorProjectQuery()) $p_proj = id(new PhabricatorProjectQuery())
->setViewer($this->getActor()) ->setViewer($this->getActor())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment