diff --git a/app/models/service_template.rb b/app/models/service_template.rb index e88bcbe2188..285a38ce779 100644 --- a/app/models/service_template.rb +++ b/app/models/service_template.rb @@ -406,6 +406,11 @@ def queue_order(user_id, options, request_options) ) end + def miq_schedules + schedule_ids = Reserve.where(:resource_type => "MiqSchedule").collect { |r| r.resource_id if r.reserved == {:resource_id => id} }.compact + MiqSchedule.where(:towhat => "ServiceTemplate", :id => schedule_ids) + end + def order(user_or_id, options = nil, request_options = nil, schedule_time = nil) user = user_or_id.kind_of?(User) ? user_or_id : User.find(user_or_id) workflow = provision_workflow(user, options, request_options)