mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-07 22:46:06 +00:00
@@ -7,5 +7,6 @@ class OrderCycleNotificationJob < ActiveJob::Base
|
||||
order_cycle.suppliers.each do |supplier|
|
||||
ProducerMailer.order_cycle_report(supplier, order_cycle).deliver_now
|
||||
end
|
||||
order_cycle.update_columns mails_sent: true
|
||||
end
|
||||
end
|
||||
|
||||
@@ -151,7 +151,7 @@ class OrderCycle < ApplicationRecord
|
||||
def clone!
|
||||
oc = dup
|
||||
oc.name = I18n.t("models.order_cycle.cloned_order_cycle_name", order_cycle: oc.name)
|
||||
oc.orders_open_at = oc.orders_close_at = nil
|
||||
oc.orders_open_at = oc.orders_close_at = oc.mails_sent = oc.processed_at = nil
|
||||
oc.coordinator_fee_ids = coordinator_fee_ids
|
||||
# rubocop:disable Layout/LineLength
|
||||
oc.preferred_product_selection_from_coordinator_inventory_only = preferred_product_selection_from_coordinator_inventory_only
|
||||
@@ -281,7 +281,9 @@ class OrderCycle < ApplicationRecord
|
||||
|
||||
def reset_processed_at
|
||||
return unless orders_close_at.present? && orders_close_at_was.present?
|
||||
return unless orders_close_at > orders_close_at_was
|
||||
|
||||
self.processed_at = nil if orders_close_at > orders_close_at_was
|
||||
self.processed_at = nil
|
||||
self.mails_sent = false
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
- content_for :page_actions do
|
||||
- if can? :notify_producers, @order_cycle
|
||||
%li
|
||||
- processed = @order_cycle.processed_at.present?
|
||||
- mails_sent = @order_cycle.mails_sent?
|
||||
- url = main_app.notify_producers_admin_order_cycle_path
|
||||
- confirm_msg = "#{t('.notify_producers_tip')} #{t(:are_you_sure)}"
|
||||
%a.button.icon-email.with-tip{ href: url, data: { method: 'post', confirm: confirm_msg }, 'data-powertip': t('.notify_producers_tip') }
|
||||
= processed ? t('.re_notify_producers') : t(:notify_producers)
|
||||
- if processed
|
||||
= mails_sent ? t('.re_notify_producers') : t(:notify_producers)
|
||||
- if mails_sent
|
||||
.badge.icon-ok.success
|
||||
|
||||
- content_for :page_title do
|
||||
|
||||
Reference in New Issue
Block a user