Commit 54dddba0 authored by Ana Rute Mendes's avatar Ana Rute Mendes 🌈

purchasing: avoid multiple items creation

phabricator creates xactions as previews when someone is editing
the tickect through the comments section. We do not want to trigger
the asset creation in Snipe IT in theses cases, otherwise we will
end up with duplicated items in snipe IT.
parent 049a98f2
......@@ -398,8 +398,8 @@ final class ManiphestTransactionEditor
$new_status = $xaction->getNewValue();
// CCU: create Item in the inventory system if it's a Purchase request and
// its status was changed to "resolved" (Closed)
if (!$this->getIsNewObject()) {
// its status was changed to "resolved" (Closed) and it's not a preview
if (!$this->getIsNewObject() && !$this->getIsPreview()) {
try {
$asset_transactions = $snipe_api->createAssetItem($new_status, $object, $xactions);
} catch (Exception $e) {
......
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