mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
Improve warning messages when sending emails
This commit is contained in:
parent
a26cb74170
commit
028743e440
@ -2046,7 +2046,8 @@ $LANG = array(
|
|||||||
'error_title' => 'Something went wrong',
|
'error_title' => 'Something went wrong',
|
||||||
'error_contact_text' => 'If you\'d like help please email us at :mailaddress',
|
'error_contact_text' => 'If you\'d like help please email us at :mailaddress',
|
||||||
'no_undo' => 'Warning: this can\'t be undone.',
|
'no_undo' => 'Warning: this can\'t be undone.',
|
||||||
|
'no_contact_selected' => 'Please select a contact',
|
||||||
|
'no_client_selected' => 'Please select a client',
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1195,7 +1195,7 @@
|
|||||||
model.invoice().invoice_footer(model.invoice().default_footer());
|
model.invoice().invoice_footer(model.invoice().default_footer());
|
||||||
refreshPDF();
|
refreshPDF();
|
||||||
});
|
});
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1215,10 +1215,22 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var clientId = parseInt($('input[name=client]').val(), 10) || 0;
|
||||||
|
if (clientId == 0 ) {
|
||||||
|
swal("{!! trans('texts.no_client_selected') !!}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isContactSelected()) {
|
||||||
|
swal("{!! trans('texts.no_contact_selected') !!}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!isEmailValid()) {
|
if (!isEmailValid()) {
|
||||||
swal("{!! trans('texts.provide_email') !!}");
|
swal("{!! trans('texts.provide_email') !!}");
|
||||||
return;
|
return;
|
||||||
8 }
|
8 }
|
||||||
|
|
||||||
|
|
||||||
sweetConfirm(function() {
|
sweetConfirm(function() {
|
||||||
var accountLanguageId = parseInt({{ $account->language_id ?: '0' }});
|
var accountLanguageId = parseInt({{ $account->language_id ?: '0' }});
|
||||||
@ -1349,8 +1361,7 @@
|
|||||||
return isValid;
|
return isValid;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isEmailValid() {
|
function isContactSelected() {
|
||||||
var isValid = true;
|
|
||||||
var sendTo = false;
|
var sendTo = false;
|
||||||
var client = model.invoice().client();
|
var client = model.invoice().client();
|
||||||
for (var i=0; i<client.contacts().length; i++) {
|
for (var i=0; i<client.contacts().length; i++) {
|
||||||
@ -1359,14 +1370,29 @@
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (isValidEmailAddress(contact.email())) {
|
if (isValidEmailAddress(contact.email())) {
|
||||||
isValid = true;
|
|
||||||
sendTo = true;
|
sendTo = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sendTo;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function isEmailValid() {
|
||||||
|
var isValid = true;
|
||||||
|
var client = model.invoice().client();
|
||||||
|
for (var i=0; i<client.contacts().length; i++) {
|
||||||
|
var contact = client.contacts()[i];
|
||||||
|
if ( ! contact.send_invoice()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (isValidEmailAddress(contact.email())) {
|
||||||
|
isValid = true;
|
||||||
} else {
|
} else {
|
||||||
isValid = false;
|
isValid = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (isValid && sendTo)
|
return isValid;
|
||||||
}
|
}
|
||||||
|
|
||||||
function onMarkClick() {
|
function onMarkClick() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user