mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-21 05:09:15 +00:00
Include the 'Ready for' time for the order cycle in the Notify Producers Email
This is so people can distinguish which order cycle the email is referring to. Fixes #6371
This commit is contained in:
@@ -36,6 +36,7 @@ class ProducerMailer < Spree::BaseMailer
|
||||
line_items = line_items_from(@order_cycle, @producer)
|
||||
|
||||
@grouped_line_items = line_items.group_by(&:product_and_full_name)
|
||||
@ready_for = @order_cycle.pickup_time_for(@coordinator)
|
||||
@receival_instructions = @order_cycle.receival_instructions_for(@producer)
|
||||
@total = total_from_line_items(line_items)
|
||||
@tax_total = tax_total_from_line_items(line_items)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
= t :producer_mail_greeting
|
||||
#{" " + @producer.name},
|
||||
%p
|
||||
= t :producer_mail_text_before
|
||||
= t :producer_mail_text_before, ready_for: @ready_for
|
||||
- if @receival_instructions
|
||||
%p
|
||||
%b
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#{t :producer_mail_greeting} #{@producer.name},
|
||||
\
|
||||
= t :producer_mail_text_before
|
||||
= t :producer_mail_text_before, ready_for: @ready_for
|
||||
\
|
||||
- if @receival_instructions
|
||||
= t :producer_mail_delivery_instructions
|
||||
|
||||
@@ -1656,7 +1656,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using
|
||||
mistakenly_sent: "Not sure why you have received this email? Please contact %{owner_email} for more information."
|
||||
|
||||
producer_mail_greeting: "Dear"
|
||||
producer_mail_text_before: "We now have all the consumer orders for the next food drop."
|
||||
producer_mail_text_before: "Please find below an update about the order cycle ready for %{ready_for}."
|
||||
producer_mail_order_text: "Here is a summary of the orders for your products:"
|
||||
producer_mail_delivery_instructions: "Stock pickup/delivery instructions:"
|
||||
producer_mail_text_after: ""
|
||||
|
||||
@@ -23,6 +23,7 @@ describe ProducerMailer, type: :mailer do
|
||||
let(:p5) { create(:product, name: "Daffodil", price: 56.78, supplier: s1) }
|
||||
let(:order_cycle) { create(:simple_order_cycle) }
|
||||
let!(:incoming_exchange) { order_cycle.exchanges.create! sender: s1, receiver: d1, incoming: true, receival_instructions: 'Outside shed.' }
|
||||
let!(:outgoing_exchange) { order_cycle.exchanges.create! sender: order_cycle.coordinator, receiver: order_cycle.coordinator, incoming: false, pickup_time: 'Tue, 23rd Dec' }
|
||||
|
||||
let!(:order) do
|
||||
order = create(:order, distributor: d1, order_cycle: order_cycle, state: 'complete')
|
||||
@@ -55,6 +56,10 @@ describe ProducerMailer, type: :mailer do
|
||||
expect(mail.reply_to).to eq [order_cycle.coordinator.contact.email]
|
||||
end
|
||||
|
||||
it "includes the pickup time" do
|
||||
expect(mail.body.encoded).to include 'Tue, 23rd Dec'
|
||||
end
|
||||
|
||||
it "includes receival instructions" do
|
||||
expect(mail.body.encoded).to include 'Outside shed.'
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user