Only clear action if deactivating an automation

[MAILPOET-5982]
This commit is contained in:
Pavel Dohnal
2024-06-06 07:45:17 +02:00
committed by Veljko V
parent 4b14ae26cb
commit e51c20221a

View File

@@ -61,6 +61,7 @@ class UpdateAutomationController {
if (array_key_exists('name', $data)) {
$automation->setName($data['name']);
}
$originalStatus = $automation->getStatus();
if (array_key_exists('status', $data)) {
$this->checkAutomationStatus($data['status']);
@@ -76,7 +77,7 @@ class UpdateAutomationController {
}
}
if ($automation->getStatus() === Automation::STATUS_DRAFT) {
if (($automation->getStatus() === Automation::STATUS_DRAFT) && ($originalStatus === Automation::STATUS_ACTIVE)) {
$this->unscheduleAutomationRuns($automation);
}