Provides better error message to the user
This commit is contained in:
parent
e7982f0f85
commit
21c649527a
@ -1,30 +1,43 @@
|
|||||||
cur_frm.cscript.refresh = function(doc, dt, dn) {
|
cur_frm.cscript.refresh = function(doc, dt, dn) {
|
||||||
|
doc = locals[dt][dn];
|
||||||
|
var save_msg = "You must <b>Save</b> the form before proceeding";
|
||||||
|
var err_msg = "There was an error. One probable reason could be that you haven't saved the form. Please contact support@erpnext.com if the problem persists."
|
||||||
cur_frm.add_custom_button('View Now', function() {
|
cur_frm.add_custom_button('View Now', function() {
|
||||||
$c_obj(make_doclist(dt, dn), 'get', '', function(r, rt) {
|
if(doc.__unsaved != 1) {
|
||||||
if(r.exc) {
|
$c_obj(make_doclist(dt, dn), 'get', '', function(r, rt) {
|
||||||
msgprint(r.exc);
|
if(r.exc) {
|
||||||
} else {
|
msgprint(err_msg);
|
||||||
//console.log(arguments);
|
console.log(r.exc);
|
||||||
var d = new wn.widgets.Dialog({
|
} else {
|
||||||
title: 'Email Digest: ' + dn,
|
//console.log(arguments);
|
||||||
width: 800
|
var d = new wn.widgets.Dialog({
|
||||||
});
|
title: 'Email Digest: ' + dn,
|
||||||
|
width: 800
|
||||||
|
});
|
||||||
|
|
||||||
$a(d.body, 'div', '', '', r['message'][1]);
|
$a(d.body, 'div', '', '', r['message'][1]);
|
||||||
|
|
||||||
d.show();
|
d.show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
msgprint(save_msg);
|
||||||
|
}
|
||||||
}, 1);
|
}, 1);
|
||||||
cur_frm.add_custom_button('Send Now', function() {
|
cur_frm.add_custom_button('Send Now', function() {
|
||||||
$c_obj(make_doclist(dt, dn), 'send', '', function(r, rt) {
|
if(doc.__unsaved != 1) {
|
||||||
if(r.exc) {
|
$c_obj(make_doclist(dt, dn), 'send', '', function(r, rt) {
|
||||||
msgprint(r.exc);
|
if(r.exc) {
|
||||||
} else {
|
msgprint(err_msg);
|
||||||
//console.log(arguments);
|
console.log(r.exc);
|
||||||
msgprint('Message Sent');
|
} else {
|
||||||
}
|
//console.log(arguments);
|
||||||
});
|
msgprint('Message Sent');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
msgprint(save_msg);
|
||||||
|
}
|
||||||
}, 1);
|
}, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user