ソースを参照

communication / email cleanup

version-14
Rushabh Mehta 12年前
コミット
f12d7d8d22
3個のファイルの変更21行の追加11行の削除
  1. +7
    -4
      core/doctype/communication/communication.py
  2. +1
    -0
      public/js/legacy/widgets/form/form_fields.js
  3. +13
    -7
      public/js/wn/views/communication.js

+ 7
- 4
core/doctype/communication/communication.py ファイルの表示

@@ -42,7 +42,7 @@ def get_customer_supplier(args=None):
def make(doctype=None, name=None, content=None, subject=None, def make(doctype=None, name=None, content=None, subject=None,
sender=None, recipients=None, contact=None, lead=None, sender=None, recipients=None, contact=None, lead=None,
communication_medium="Email", send_email=False, print_html=None, communication_medium="Email", send_email=False, print_html=None,
attachments='[]'):
attachments='[]', send_me_a_copy=False):
# add to Communication # add to Communication


sent_via = None sent_via = None
@@ -61,10 +61,10 @@ def make(doctype=None, name=None, content=None, subject=None,
set_lead_and_contact(d) set_lead_and_contact(d)
d.communication_medium = communication_medium d.communication_medium = communication_medium
if send_email: if send_email:
send_comm_email(d, name, sent_via, print_html, attachments)
d.save(1)
send_comm_email(d, name, sent_via, print_html, attachments, send_me_a_copy)
d.save(1, ignore_fields=True)


def send_comm_email(d, name, sent_via=None, print_html=None, attachments='[]'):
def send_comm_email(d, name, sent_via=None, print_html=None, attachments='[]', send_me_a_copy=False):
from webnotes.utils.email_lib import sendmail from webnotes.utils.email_lib import sendmail
from json import loads from json import loads
@@ -80,6 +80,9 @@ def send_comm_email(d, name, sent_via=None, print_html=None, attachments='[]'):
mail = get_email(d.recipients.split(","), sender=d.sender, subject=d.subject, mail = get_email(d.recipients.split(","), sender=d.sender, subject=d.subject,
msg=d.content) msg=d.content)
if send_me_a_copy:
mail.cc.append(d.sender)
if print_html: if print_html:
mail.add_attachment(name.replace(' ','').replace('/','-') + '.html', print_html) mail.add_attachment(name.replace(' ','').replace('/','-') + '.html', print_html)




+ 1
- 0
public/js/legacy/widgets/form/form_fields.js ファイルの表示

@@ -260,6 +260,7 @@ _f.CodeField.prototype.make_input = function() {
this.label_span.innerHTML = this.df.label; this.label_span.innerHTML = this.df.label;


if(this.df.fieldtype=='Text Editor') { if(this.df.fieldtype=='Text Editor') {
$(this.input_area).css({"min-height":"360px"});
this.input = $a(this.input_area, 'text_area', '', {fontSize:'12px'}); this.input = $a(this.input_area, 'text_area', '', {fontSize:'12px'});
this.myid = wn.dom.set_unique_id(this.input); this.myid = wn.dom.set_unique_id(this.input);




+ 13
- 7
public/js/wn/views/communication.js ファイルの表示

@@ -108,6 +108,7 @@ wn.views.CommunicationComposer = Class.extend({
{label:"Message", fieldtype:"Text Editor", reqd: 1, fieldname:"content"}, {label:"Message", fieldtype:"Text Editor", reqd: 1, fieldname:"content"},
{label:"Add Reply", fieldtype:"Button"}, {label:"Add Reply", fieldtype:"Button"},
{label:"Send Email", fieldtype:"Check"}, {label:"Send Email", fieldtype:"Check"},
{label:"Send Me A Copy", fieldtype:"Check"},
{label:"Attach Document Print", fieldtype:"Check"}, {label:"Attach Document Print", fieldtype:"Check"},
{label:"Select Print Format", fieldtype:"Select"}, {label:"Select Print Format", fieldtype:"Select"},
{label:"Select Attachments", fieldtype:"HTML"} {label:"Select Attachments", fieldtype:"HTML"}
@@ -182,6 +183,7 @@ wn.views.CommunicationComposer = Class.extend({
name: me.doc.name, name: me.doc.name,
lead: me.doc.lead, lead: me.doc.lead,
contact: me.doc.contact, contact: me.doc.contact,
send_me_a_copy: form_values.send_me_a_copy,
send_email: form_values.send_email, send_email: form_values.send_email,
print_html: form_values.attach_document_print print_html: form_values.attach_document_print
? print_html : "", ? print_html : "",
@@ -199,16 +201,20 @@ wn.views.CommunicationComposer = Class.extend({
var comm_list = cur_frm.communication_view var comm_list = cur_frm.communication_view
? cur_frm.communication_view.list ? cur_frm.communication_view.list
: []; : [];
var signature = wn.boot.profile.email_signature || "";
if(signature.indexOf("<br>")==-1 && signature.indexOf("<p")==-1
&& signature.indexOf("<img")==-1 && signature.indexOf("<div")==-1) {
signature = signature.replace(/\n/g, "<br>");
}
if(comm_list.length > 0) { if(comm_list.length > 0) {
fields.content.input.set_input("<p></p>" fields.content.input.set_input("<p></p>"
+ (wn.boot.profile.email_signature || "")
+ signature
+"<p></p>" +"<p></p>"
+"-----In response to-----<p></p>" +"-----In response to-----<p></p>"
+ comm_list[0].content); + comm_list[0].content);
} else { } else {
fields.content.input.set_input("<p></p>"
+ (wn.boot.profile.email_signature || ""))
fields.content.input.set_input("<p></p>" + signature)
} }
}, },
setup_autosuggest: function() { setup_autosuggest: function() {
@@ -233,9 +239,9 @@ wn.views.CommunicationComposer = Class.extend({
wn.call({ wn.call({
method:'webnotes.utils.email_lib.get_contact_list', method:'webnotes.utils.email_lib.get_contact_list',
args: { args: {
'select': _e.email_as_field,
'from': _e.email_as_dt,
'where': _e.email_as_in,
'select': "email_id",
'from': "Contact",
'where': "email_id",
'txt': extractLast(request.term).value || '%' 'txt': extractLast(request.term).value || '%'
}, },
callback: function(r) { callback: function(r) {


読み込み中…
キャンセル
保存