Provides better error message to the user
This commit is contained in:
parent
e7982f0f85
commit
21c649527a
@ -1,8 +1,13 @@
|
|||||||
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() {
|
||||||
|
if(doc.__unsaved != 1) {
|
||||||
$c_obj(make_doclist(dt, dn), 'get', '', function(r, rt) {
|
$c_obj(make_doclist(dt, dn), 'get', '', function(r, rt) {
|
||||||
if(r.exc) {
|
if(r.exc) {
|
||||||
msgprint(r.exc);
|
msgprint(err_msg);
|
||||||
|
console.log(r.exc);
|
||||||
} else {
|
} else {
|
||||||
//console.log(arguments);
|
//console.log(arguments);
|
||||||
var d = new wn.widgets.Dialog({
|
var d = new wn.widgets.Dialog({
|
||||||
@ -15,16 +20,24 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {
|
|||||||
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() {
|
||||||
|
if(doc.__unsaved != 1) {
|
||||||
$c_obj(make_doclist(dt, dn), 'send', '', function(r, rt) {
|
$c_obj(make_doclist(dt, dn), 'send', '', function(r, rt) {
|
||||||
if(r.exc) {
|
if(r.exc) {
|
||||||
msgprint(r.exc);
|
msgprint(err_msg);
|
||||||
|
console.log(r.exc);
|
||||||
} else {
|
} else {
|
||||||
//console.log(arguments);
|
//console.log(arguments);
|
||||||
msgprint('Message Sent');
|
msgprint('Message Sent');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
msgprint(save_msg);
|
||||||
|
}
|
||||||
}, 1);
|
}, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user