communication cleanup + journal voucher: ref no, ref date conditional mandatory
This commit is contained in:
parent
0f69dbbd54
commit
a5055fdd1e
3 changed files with 71 additions and 69 deletions
|
|
@ -158,4 +158,66 @@ set_missing_values = function(doc, dict) {
|
|||
$.each(dict, function(i, v) { if (!doc[i]) { fields_to_set[i] = v; } });
|
||||
|
||||
if (fields_to_set) { set_multiple(doc.doctype, doc.name, fields_to_set); }
|
||||
}
|
||||
}
|
||||
|
||||
_f.Frm.prototype.get_doc = function() {
|
||||
return locals[this.doctype][this.docname];
|
||||
}
|
||||
|
||||
_f.Frm.prototype.get_doclist = function() {
|
||||
return make_doclist(this.doctype, this.docname);
|
||||
}
|
||||
|
||||
_f.Frm.prototype.field_map = function(fnames, fn) {
|
||||
if(typeof fnames=='string') {
|
||||
if(fnames == '*') {
|
||||
fnames = keys(this.fields_dict);
|
||||
} else {
|
||||
fnames = [fnames];
|
||||
}
|
||||
}
|
||||
$.each(fnames, function(i,f) {
|
||||
//var field = cur_frm.fields_dict[f]; - much better design
|
||||
var field = wn.meta.get_docfield(cur_frm.doctype, f, cur_frm.docname)
|
||||
if(field) {
|
||||
fn(field);
|
||||
cur_frm.refresh_field(f);
|
||||
};
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
_f.Frm.prototype.set_df_property = function(fieldname, property, value) {
|
||||
var field = wn.meta.get_docfield(cur_frm.doctype, fieldname, cur_frm.docname)
|
||||
if(field) {
|
||||
field[property] = value;
|
||||
cur_frm.refresh_field(fieldname);
|
||||
};
|
||||
}
|
||||
|
||||
_f.Frm.prototype.toggle_enable = function(fnames, enable) {
|
||||
cur_frm.field_map(fnames, function(field) { field.disabled = enable ? false : true; });
|
||||
}
|
||||
|
||||
_f.Frm.prototype.toggle_reqd = function(fnames, mandatory) {
|
||||
cur_frm.field_map(fnames, function(field) { field.reqd = mandatory ? true : false; });
|
||||
}
|
||||
|
||||
_f.Frm.prototype.toggle_display = function(fnames, show) {
|
||||
cur_frm.field_map(fnames, function(field) { field.hidden = show ? 0 : 1; });
|
||||
}
|
||||
|
||||
_f.Frm.prototype.call_server = function(method, args, callback) {
|
||||
$c_obj(cur_frm.get_doclist(), method, args, callback);
|
||||
}
|
||||
|
||||
_f.Frm.prototype.get_files = function() {
|
||||
return $.map((cur_frm.doc.file_list || "").split("\n"), function(f) {
|
||||
return f.split(",")[0] || null;
|
||||
});
|
||||
}
|
||||
|
||||
_f.Frm.prototype.set_value = function(field, value) {
|
||||
cur_frm.doc[field] = value;
|
||||
cur_frm.fields_dict[field].refresh();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1085,66 +1085,4 @@ _f.Frm.prototype.show_comments = function() {
|
|||
cur_frm.comments.list.dn = cur_frm.docname;
|
||||
cur_frm.comments.show();
|
||||
cur_frm.comments.list.run();
|
||||
}
|
||||
|
||||
_f.Frm.prototype.get_doc = function() {
|
||||
return locals[this.doctype][this.docname];
|
||||
}
|
||||
|
||||
_f.Frm.prototype.get_doclist = function() {
|
||||
return make_doclist(this.doctype, this.docname);
|
||||
}
|
||||
|
||||
_f.Frm.prototype.field_map = function(fnames, fn) {
|
||||
if(typeof fnames=='string') {
|
||||
if(fnames == '*') {
|
||||
fnames = keys(this.fields_dict);
|
||||
} else {
|
||||
fnames = [fnames];
|
||||
}
|
||||
}
|
||||
$.each(fnames, function(i,f) {
|
||||
//var field = cur_frm.fields_dict[f]; - much better design
|
||||
var field = wn.meta.get_docfield(cur_frm.doctype, f, cur_frm.docname)
|
||||
if(field) {
|
||||
fn(field);
|
||||
cur_frm.refresh_field(f);
|
||||
};
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
_f.Frm.prototype.set_df_property = function(fieldname, property, value) {
|
||||
var field = wn.meta.get_docfield(cur_frm.doctype, fieldname, cur_frm.docname)
|
||||
if(field) {
|
||||
field[property] = value;
|
||||
cur_frm.refresh_field(fieldname);
|
||||
};
|
||||
}
|
||||
|
||||
_f.Frm.prototype.toggle_enable = function(fnames, enable) {
|
||||
cur_frm.field_map(fnames, function(field) { field.disabled = enable ? false : true; });
|
||||
}
|
||||
|
||||
_f.Frm.prototype.toggle_reqd = function(fnames, mandatory) {
|
||||
cur_frm.field_map(fnames, function(field) { field.reqd = mandatory ? true : false; });
|
||||
}
|
||||
|
||||
_f.Frm.prototype.toggle_display = function(fnames, show) {
|
||||
cur_frm.field_map(fnames, function(field) { field.hidden = show ? 0 : 1; });
|
||||
}
|
||||
|
||||
_f.Frm.prototype.call_server = function(method, args, callback) {
|
||||
$c_obj(cur_frm.get_doclist(), method, args, callback);
|
||||
}
|
||||
|
||||
_f.Frm.prototype.get_files = function() {
|
||||
return $.map((cur_frm.doc.file_list || "").split("\n"), function(f) {
|
||||
return f.split(",")[0] || null;
|
||||
});
|
||||
}
|
||||
|
||||
_f.Frm.prototype.set_value = function(field, value) {
|
||||
cur_frm.doc[field] = value;
|
||||
cur_frm.fields_dict[field].refresh();
|
||||
}
|
||||
}
|
||||
|
|
@ -74,16 +74,18 @@ wn.views.CommunicationList = Class.extend({
|
|||
make_line: function(doc) {
|
||||
var me = this;
|
||||
var comm = $(repl('<tr><td title="Click to Expand / Collapse">\
|
||||
<p><b>%(_sender)s on %(when)s</b> \
|
||||
<a href="#Form/Communication/%(name)s" style="font-size: 90%">\
|
||||
Show Details</a></p>\
|
||||
<a href="#Form/Communication/%(name)s" style="font-size: 90%; float: right;">\
|
||||
Show Details</a>\
|
||||
<p class="comm-header"><b>%(_sender)s on %(when)s</b></p>\
|
||||
<div class="comm-content" style="border-top: 1px solid #ddd; \
|
||||
padding: 10px; overflow-x: auto; display: none;"></div>\
|
||||
</td></tr>', doc))
|
||||
.appendTo(this.body)
|
||||
|
||||
comm.find(".comm-header")
|
||||
.css({"cursor":"pointer"})
|
||||
.click(function() {
|
||||
$(this).find(".comm-content").toggle();
|
||||
$(this).parent().find(".comm-content").toggle();
|
||||
});
|
||||
|
||||
this.comm_list.push(comm);
|
||||
|
|
@ -106,8 +108,8 @@ wn.views.CommunicationComposer = Class.extend({
|
|||
{label:"To", fieldtype:"Data", reqd: 1, fieldname:"recipients",
|
||||
description:"Email addresses, separted by commas"},
|
||||
{label:"Subject", fieldtype:"Data", reqd: 1},
|
||||
{label:"Message", fieldtype:"Text Editor", reqd: 1, fieldname:"content"},
|
||||
{label:"Add Reply", fieldtype:"Button"},
|
||||
{label:"Message", fieldtype:"Text Editor", reqd: 1, fieldname:"content"},
|
||||
{label:"Send Email", fieldtype:"Check"},
|
||||
{label:"Send Me A Copy", fieldtype:"Check"},
|
||||
{label:"Attach Document Print", fieldtype:"Check"},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue