app/models/concerns/order_state_config.rb
# Specifies conditions under which a given event is permitted
# Returns boolean
Specifies conditions under which a given event is permitted
Returns boolean
Specifies conditions under which a given event is permitted Returns boolean
def event_permitted(event)
      case event
      when :review
        [:pending, :requested].include? current_state
      when :confirm
        if !has_digital_items?
          [:pending, :reviewing].include? current_state
        else
          current_state == :reviewing
        end
      when :begin_work
        current_state == :pending && any_items_ready?
      when :complete_work
        current_state == :in_progress
      when :fulfill
        if reproduction_order?
          current_state == :work_complete
        else
          all_items_ready? && (current_state == :confirmed)
        end
      when :activate
        current_state == :fulfilled
      when :close
        if reproduction_order?
          current_state == :fulfilled
        else
          (current_state == :fulfilled) && finished?
        end
      end
    end
def event_permitted ( event ) case event when :review [ :pending , :requested ] . include? current_state when :confirm if ! has_digital_items? [ :pending , :reviewing ] . include? current_state else current_state == :reviewing end when :begin_work current_state == :pending && any_items_ready? when :complete_work current_state == :in_progress when :fulfill if reproduction_order? current_state == :work_complete else all_items_ready? && ( current_state == :confirmed ) end when :activate current_state == :fulfilled when :close if reproduction_order? current_state == :fulfilled else ( current_state == :fulfilled ) && finished? end end end
Specifies conditions under which a given event is permitted
Returns boolean
Specifies conditions under which a given event is permitted Returns boolean
event
<not_specific>