PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 11.1.0
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v11.1.0
11.1.1 11.1.0 11.0.5 11.0.4 11.0.3 11.0.2 11.0.1 11.0.0 10.11.1 10.11.0 10.10.2 10.10.1 10.10.0 10.9.1 trunk 10.0.0 10.0.1 10.1.0 10.1.1 10.1.2 10.1.3 10.1.4 10.2.0 10.2.1 10.2.2 All 62 releases
← All changes | back/Classes/ScenarioClass.php +5 -0 10.11.1 → 11.1.0 View file →
@@ -12,8 +12,9 @@
12 12 const TYPE_ACTION = 'action';
13 13
14 14 private ScenarioStepClass $scenarioStepClass;
15 15
16 + // This is a list of all the step ids we have to save when saving a scenario, this way we can delete all the steps that are not in this list
16 17 private array $stepIdsToKeep = [];
17 18
18 19 public function __construct()
19 20 {
@@ -49,8 +50,9 @@
49 50 $filters[] = 'scenario.active = 0';
50 51 }
51 52 }
52 53
54 + // We don't filter by status on the status query this way we can select other statuses
53 55 if (!empty($filters)) {
54 56 $query .= ' WHERE ('.implode(') AND (', $filters).')';
55 57 $queryCount .= ' WHERE ('.implode(') AND (', $filters).')';
56 58 }
@@ -81,8 +83,9 @@
81 83 $flow = [];
82 84 if (!empty($element->flow)) {
83 85 $flow = json_decode($element->flow, true);
84 86
87 + // The first step should the trigger
85 88 if (empty($flow[0]['params'])) {
86 89 return 0;
87 90 }
88 91
@@ -126,8 +129,9 @@
126 129
127 130 private function saveFlow(array $flow, int $scenarioId): void
128 131 {
129 132 if (!empty($flow[0]['children'][0])) {
133 + // We save all the step
130 134 $this->saveStep($flow[0]['children'][0], $scenarioId);
131 135 }
132 136 $this->cleanSteps($scenarioId);
133 137 }
@@ -133,8 +137,9 @@
133 137 }
134 138
135 139 private function saveStep(array $currentStep, int $scenarioId, ?string $previousStepId = null, ?int $conditionValid = null): void
136 140 {
141 + // If this is a direct child of a condition we pass it, it's a hidden object for the javascript
137 142 if (isset($currentStep['conditionEnd'])) {
138 143 if ($currentStep['conditionEnd'] && !empty($currentStep['children'])) {
139 144 $isConditionValid = empty($currentStep['conditionValid']) ? 0 : 1;
140 145 $this->saveStep($currentStep['children'][0], $scenarioId, $previousStepId, $isConditionValid);