lib/openwfe/expressions/fe_cursor.rb in openwferu-0.9.2 vs lib/openwfe/expressions/fe_cursor.rb in openwferu-0.9.3

- old
+ new

@@ -38,10 +38,11 @@ # # John Mettraux at openwfe.org # require 'openwfe/expressions/flowexpression' +require 'openwfe/expressions/fe_condition' # # 'cursor' and 'loop' expressions # @@ -214,20 +215,28 @@ # # 'skip', 'continue', and the like # class CursorCommandExpression < FlowExpression + include ConditionMixin def apply (workitem) - command = @fei.expression_name + conditional = eval_condition(:if, workitem) + # + # for example : <break if="${approved} == true"/> - step = lookup_attribute(A_STEP, workitem, "1") - step = Integer(step) + if conditional == nil or conditional - command = "#{command} #{step}" if step != 1 + command = @fei.expression_name - workitem.attributes[F_COMMAND] = command + step = lookup_attribute(A_STEP, workitem, "1") + step = Integer(step) + + command = "#{command} #{step}" if step != 1 + + workitem.attributes[F_COMMAND] = command + end reply_to_parent(workitem) end end