18 return get_called_class();
42 if ($this->target ===
null)
62 return 'Base trigger';
69 $currentStatus = $this->
getTarget()->getDocumentStatus();
70 $allStatuses = array_keys($this->
getTarget()->getDocumentStatusList());
72 $needleKey = array_search($currentStatus, $allStatuses);
74 if ($needleKey ===
false)
79 $forwardStatuses = array_slice($allStatuses, $needleKey + 1);
81 $code = static::getCode();
83 $targetTriggers = $this->
getTarget()->getTriggers($allStatuses);
85 foreach ($targetTriggers as $row)
87 if ($row[
'CODE'] !== $code)
92 if (!in_array($row[
'DOCUMENT_STATUS'], $forwardStatuses))
95 !isset($row[
'APPLY_RULES'][
'ALLOW_BACKWARDS'])
97 $row[
'APPLY_RULES'][
'ALLOW_BACKWARDS'] !==
'Y'
104 $rows[$row[
'DOCUMENT_STATUS']][] = $row;
109 foreach ($allStatuses as $needleStatus)
111 if (isset($rows[$needleStatus]))
113 $triggers = array_merge($triggers, $rows[$needleStatus]);
123 $conditionRules = is_array($trigger[
'APPLY_RULES']) && isset($trigger[
'APPLY_RULES'][
'Condition'])
124 ? $trigger[
'APPLY_RULES'][
'Condition'] :
null;
130 $result = $conditionGroup->evaluate(
$target);
134 $target->setAppliedTriggerConditionResults($conditionGroup->getEvaluateResults());
154 $this->returnValues = $values;
166 'NAME' => static::getName(),
167 'CODE' => static::getCode(),
168 'RETURN' => static::getReturnProperties(),
169 'DESCRIPTION' => static::getDescription(),
170 'GROUP' => static::getGroup(),
171 'SETTINGS' => static::getSettings(),
187 $map = static::getPropertiesMap();
190 return [
'Properties' => array_values($map)];
static getPropertiesMap()
static getReturnProperties()
setTarget(BaseTarget $target)
setReturnValues(array $values)
checkApplyRules(array $trigger)