Skip to content

Commit

Permalink
Merge pull request #1446 from benero/fix_trigger
Browse files Browse the repository at this point in the history
Fix trigger
  • Loading branch information
benero authored Oct 29, 2024
2 parents ce32d10 + 1b17062 commit 66f800a
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions business_rules/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def _get_reference_variable_value(condition, defined_variables):
return int(value)
if field_type == 'numeric':
return float(value)
if field_type in ["string", 'select', 'text', 'radio']:
if field_type in ["string", "select", "text", "radio", "inputselect"]:
return str(value)
if field_type in ["multiselect", 'checkbox'] and isinstance(value, str):
return set(value.split(","))
Expand Down Expand Up @@ -217,7 +217,7 @@ def _get_real_variable_value(variable_value, field_type):
return DateTimeType(variable_value)
if field_type == "time":
return TimeType(variable_value)
if field_type in ["string", 'select', 'text', 'radio']:
if field_type in ["string", "select", "text", "radio", "inputselect"]:
return StringType(variable_value)


Expand Down
5 changes: 3 additions & 2 deletions business_rules/operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import inspect
import re
from django.utils.translation import gettext_lazy as _
from datetime import date, datetime, time
from decimal import Decimal
from functools import wraps
Expand Down Expand Up @@ -237,14 +238,14 @@ def _case_insensitive_equal_to(value_from_list, other_value):
else:
return value_from_list == other_value

@type_operator(FIELD_SELECT, assert_type_for_arguments=False)
@type_operator(FIELD_SELECT, assert_type_for_arguments=False, label=_("包含"))
def contains(self, other_value):
for val in self.value:
if self._case_insensitive_equal_to(val, other_value):
return True
return False

@type_operator(FIELD_SELECT, assert_type_for_arguments=False)
@type_operator(FIELD_SELECT, assert_type_for_arguments=False, label=_("不包含"))
def does_not_contain(self, other_value):
for val in self.value:
if self._case_insensitive_equal_to(val, other_value):
Expand Down
3 changes: 3 additions & 0 deletions docs/RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
## [Version: 2.7.1] - 2024-10-15
【新增】pipeline管理工具集成
【优化】多行文本兼容 JSON、Markdown 格式
【修复】修复可输入单选组件在触发器无法选择条件的问题
【修复】修复节点新增字段无法检测上一节点的字段值的问题


## [Version: 2.7.0] - 2024-10-10
【新增】通知人员黑名单过滤
Expand Down
4 changes: 3 additions & 1 deletion docs/RELEASE_EN.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Changelog
## [Version: 2.7.1] - 2024-10-15
【Feature】Integrated pipeline management tool.
【Improved】Ensure TEXT compatibility with JSON and Markdown formats.
【Improved】Ensure TEXT compatibility with JSON and Markdown formats.
【Fix】Resolve the issue where the inputselect component cannot select conditions in the trigger.
【Fix】Fix the issue where newly added fields in a node cannot detect from the previous node.


## [Version: 2.7.0] - 2024-10-10
Expand Down
2 changes: 1 addition & 1 deletion itsm/ticket/views/ticket.py
Original file line number Diff line number Diff line change
Expand Up @@ -1447,7 +1447,7 @@ def states_response(self, ticket, request, detail=False):

if many and detail:
status = status.filter(
~Q(status__in=["FINISHED", "TERMINATED"])
~Q(status__in=["TERMINATED"])
| Q(state_id=ticket.first_state_id)
)
show_all_fields = many or status.status != "FINISHED"
Expand Down
3 changes: 2 additions & 1 deletion itsm/workflow/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
DateTimeType,
TimeType,
BooleanType,
SelectMultipleType,
SelectMultipleType, SelectType,
)
from common.log import logger
from itsm.component.constants import (
Expand Down Expand Up @@ -204,6 +204,7 @@ def get_global_choices(self, request):
"bool": BooleanType.get_display_operators(),
"string": StringType.get_display_operators(),
"select": StringType.get_display_operators(),
"inputselect": SelectType.get_display_operators(),
"radio": StringType.get_display_operators(),
"text": StringType.get_display_operators(),
"datetime": DateTimeType.get_display_operators(),
Expand Down

0 comments on commit 66f800a

Please sign in to comment.