2019-02-02 12:40:57 +01:00
|
|
|
module FoodsoftPrinter
|
|
|
|
module OrderPrinterJobs
|
|
|
|
def self.included(base) # :nodoc:
|
|
|
|
base.class_eval do
|
|
|
|
has_many :printer_jobs, dependent: :destroy
|
|
|
|
|
2023-05-12 13:01:12 +02:00
|
|
|
alias_method :foodsoft_printer_orig_finish!, :finish!
|
2019-02-02 12:40:57 +01:00
|
|
|
|
|
|
|
def finish!(user)
|
|
|
|
foodsoft_printer_orig_finish!(user)
|
2023-05-12 13:01:12 +02:00
|
|
|
return if finished?
|
|
|
|
|
|
|
|
printer_jobs.unfinished.each do |job|
|
|
|
|
job.add_update! 'ready'
|
2019-02-02 12:40:57 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.install
|
|
|
|
Order.send :include, self
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|