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:
Cillian O'Ruanaidh
2020-12-18 17:16:49 +00:00
parent 9639c2af57
commit 110d692ffa
5 changed files with 9 additions and 3 deletions

View File

@@ -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)

View File

@@ -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

View File

@@ -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

View File

@@ -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: ""

View File

@@ -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