Fix: show message if contact doesn't have email if notification control is enabled
This commit is contained in:
parent
f51e52c1be
commit
d194e6b5cf
@ -10,7 +10,6 @@ cur_frm.cscript.select_transaction = function(doc, dt, dn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.notify = function(doc, args) {
|
cur_frm.cscript.notify = function(doc, args) {
|
||||||
if(validate_email(args['send_to'] || doc.contact_email || '')) {
|
|
||||||
$c_obj('Notification Control', 'get_formatted_message', {
|
$c_obj('Notification Control', 'get_formatted_message', {
|
||||||
type: args['type'],
|
type: args['type'],
|
||||||
doctype: args['doctype'],
|
doctype: args['doctype'],
|
||||||
@ -22,11 +21,11 @@ cur_frm.cscript.notify = function(doc, args) {
|
|||||||
if(user!='Administrator') {
|
if(user!='Administrator') {
|
||||||
return user;
|
return user;
|
||||||
} else {
|
} else {
|
||||||
var cp = locals['Control Panel']['Control Panel'];
|
return (wn.control_panel.auto_email_id || 'automail@erpnext.com');
|
||||||
return (cp.auto_email_id || 'automail@erpnext.com');
|
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
if(res.send) {
|
if(res.send) {
|
||||||
|
if(validate_email(args['send_to'] || doc.contact_email || '')) {
|
||||||
var print_heading = (doc.select_print_heading || args['type'])
|
var print_heading = (doc.select_print_heading || args['type'])
|
||||||
sendmail(
|
sendmail(
|
||||||
args['send_to'] || doc.contact_email,
|
args['send_to'] || doc.contact_email,
|
||||||
@ -38,9 +37,11 @@ cur_frm.cscript.notify = function(doc, args) {
|
|||||||
);
|
);
|
||||||
msgprint('This ' + print_heading + ' is being sent to <b>'
|
msgprint('This ' + print_heading + ' is being sent to <b>'
|
||||||
+ (args['send_to'] || doc.contact_email) + '</b><br />...');
|
+ (args['send_to'] || doc.contact_email) + '</b><br />...');
|
||||||
|
} else {
|
||||||
|
msgprint('Invalid/Missing Email Address. ' + print_heading + ' not sent.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//console.log(JSON.parse(r.message));
|
//console.log(JSON.parse(r.message));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user