Clarify message for future recurring invoices

This commit is contained in:
Hillel Coren 2017-11-02 16:38:05 +02:00
parent a5ce4bce95
commit 62aaa65aa4
2 changed files with 20 additions and 11 deletions

View File

@ -2517,6 +2517,7 @@ $LANG = array(
'set_phone_for_two_factor' => 'Set your phone number to enable.', 'set_phone_for_two_factor' => 'Set your phone number to enable.',
'enabled_two_factor' => 'Successfully enabled Two-Factor Authentication', 'enabled_two_factor' => 'Successfully enabled Two-Factor Authentication',
'add_product' => 'Add Product', 'add_product' => 'Add Product',
'email_will_be_sent_on' => 'Note: the email will be sent on :date.',
); );

View File

@ -1306,12 +1306,20 @@
model.showClientForm(); model.showClientForm();
return false; return false;
} }
// warn invoice will be emailed when saving new recurring invoice
var title = "{!! trans("texts.confirm_recurring_email_invoice") !!}";
var text = '\n' + getSendToEmails(); var text = '\n' + getSendToEmails();
var startDate = moment($('#start_date').datepicker('getDate'));
// warn invoice will be emailed when saving new recurring invoice
if (model.invoice().start_date() == "{{ Utils::fromSqlDate(date('Y-m-d')) }}") { if (model.invoice().start_date() == "{{ Utils::fromSqlDate(date('Y-m-d')) }}") {
text += '\n\n' + "{!! trans("texts.confirm_recurring_timing") !!}"; text += '\n\n' + "{!! trans("texts.confirm_recurring_timing") !!}";
// check if the start date is in the future
} else if (startDate.isAfter(moment(), 'day')) {
var message = "{!! trans("texts.email_will_be_sent_on") !!}";
text += '\n\n' + message.replace(':date', model.invoice().start_date());
} }
var title = "{!! trans("texts.confirm_recurring_email_$entityType") !!}";
sweetConfirm(function() { sweetConfirm(function() {
model.invoice().is_public(true); model.invoice().is_public(true);
submitAction(''); submitAction('');