added unsubscribed fields in Lead and Contact and cleaned up sendmail function
This commit is contained in:
parent
a4fe7180f4
commit
f0018b5e05
@ -118,22 +118,6 @@ class DocType:
|
||||
out[dt][s[0]] = cint(cnt)
|
||||
return out
|
||||
|
||||
def send_feedback(self, args):
|
||||
args = json.loads(args)
|
||||
|
||||
fb_sender = sql("select concat_ws(' ',first_name, last_name), email from tabProfile where name=%s", session['user'])
|
||||
fb_subject = 'Feedback : ' + args['subject']
|
||||
|
||||
|
||||
fb_msg = '''
|
||||
<div style="font-size:14px; padding:8px; border:1px solid #DDF">
|
||||
<div style="margin-bottom:16px">%s wrote,</div>
|
||||
<div>%s</div>
|
||||
</div>
|
||||
''' % (fb_sender[0][0], args['feedback'])
|
||||
|
||||
sendmail('info@webnotestech.com', fb_sender[0][1], msg = fb_msg, subject=args['subject'],parts=[], cc=[], attach=[])
|
||||
|
||||
def get_dt_help(self,dt):
|
||||
return sql("select description from tabDocType where name=%s",dt)[0][0] or ''
|
||||
|
||||
|
@ -155,7 +155,6 @@ def sent_reminder_task():
|
||||
<p>If you have already completed this task, please update the system</p>
|
||||
<p>Good Luck!</p>
|
||||
<p>(This notification is autogenerated)</p>""" % i
|
||||
sendmail(i['allocated_to'], sender='automail@webnotestech.com', msg=msg2,send_now=1, \
|
||||
subject='A task has been assigned')
|
||||
sendmail(i['allocated_to'], msg=msg2, subject='A task has been assigned')
|
||||
sql("update `tabTask` set sent_reminder='1' where name='%(name)s' and allocated_to= '%(allocated_to)s'" % i)
|
||||
|
||||
|
@ -115,10 +115,7 @@ class DocType:
|
||||
<p><b>Expected End Date:</b> %(exp_end_date)s</p>
|
||||
<p><b>Details:</b> %(description)s</p>
|
||||
<p>(This notification is autogenerated)</p>""" % i
|
||||
sendmail(self.doc.allocated_to, sender='automail@webnotestech.com', msg=msg2,send_now=1,\
|
||||
subject= task_label + self.doc.subject)
|
||||
|
||||
|
||||
sendmail(self.doc.allocated_to, msg=msg2,subject= task_label + self.doc.subject)
|
||||
|
||||
#validate before closing task
|
||||
def validate_for_closed(self):
|
||||
|
@ -110,16 +110,6 @@ cur_frm.cscript['Create Customer'] = function(){
|
||||
);
|
||||
}
|
||||
|
||||
// send email
|
||||
// ===============================================================
|
||||
cur_frm.cscript.send_email = function(doc,cdt,cdn){
|
||||
if(doc.__islocal != 1){
|
||||
$c_obj(make_doclist(doc.doctype, doc.name),'send_mail','',function(r,rt){});
|
||||
}else{
|
||||
msgprint("Please save lead first before sending email")
|
||||
}
|
||||
}
|
||||
|
||||
// Create New Opportunity
|
||||
// ===============================================================
|
||||
cur_frm.cscript['Create Opportunity'] = function(){
|
||||
|
@ -82,15 +82,9 @@ class DocType:
|
||||
|
||||
|
||||
def on_update(self):
|
||||
# Add to calendar
|
||||
# ========================================================================
|
||||
if self.doc.contact_by:
|
||||
self.add_calendar_event()
|
||||
|
||||
if session['user'] == 'Guest':
|
||||
if self.doc.email_id:
|
||||
self.send_email_notification()
|
||||
|
||||
if not self.doc.naming_series:
|
||||
if session['user'] == 'Guest':
|
||||
import webnotes.model.doctype
|
||||
@ -102,37 +96,6 @@ class DocType:
|
||||
else:
|
||||
msgprint("Please specify naming series")
|
||||
raise Exception
|
||||
|
||||
def send_email_notification(self):
|
||||
if not validate_email_add(self.doc.email_id.strip(' ')):
|
||||
msgprint('error:%s is not a valid email id' % self.doc.email_id.strip(' '))
|
||||
raise Exception
|
||||
else:
|
||||
subject = 'Thank you for interest in erpnext'
|
||||
|
||||
sendmail([self.doc.email_id.strip(' ')], sender = sender_email[0][0], subject = subject , parts = [['text/html', self.get_notification_msg()]])
|
||||
msgprint("Mail Sent")
|
||||
|
||||
def get_notification_msg(self):
|
||||
t = """
|
||||
<html>
|
||||
<body>
|
||||
Dear %s,<br><br>
|
||||
|
||||
Thank you for contacting us.<br><br>
|
||||
|
||||
You have left following message for us,<br>
|
||||
%s
|
||||
<br><br>
|
||||
|
||||
You will receive reply on this shortly.<br><br>
|
||||
|
||||
Cheers!
|
||||
</body>
|
||||
</html>
|
||||
""" % (self.doc.lead_name, self.doc.remark)
|
||||
|
||||
return t
|
||||
|
||||
# Add to Calendar
|
||||
# ===========================================================================
|
||||
@ -157,25 +120,6 @@ class DocType:
|
||||
ev.ref_name = self.doc.name
|
||||
ev.save(1)
|
||||
|
||||
|
||||
#-----------------Email--------------------------------------------
|
||||
def send_emails(self, email=[], subject='', message=''):
|
||||
if email:
|
||||
sendmail(email, sender = webnotes.user.name, subject = subject , parts = [['text/html', message]])
|
||||
msgprint("Mail Sent")
|
||||
self.add_in_follow_up(message,'Email')
|
||||
|
||||
#-------------------------Checking Sent Mails Details----------------------------------------------
|
||||
def send_mail(self):
|
||||
if not self.doc.subject or not self.doc.message:
|
||||
msgprint("Please enter subject & message in their respective fields.")
|
||||
elif not self.doc.email_id:
|
||||
msgprint("Recipient not specified. Please add email id of lead in 'Email id' field provided in 'Contact Info' section.")
|
||||
raise Exception
|
||||
else :
|
||||
self.send_emails([self.doc.email_id.strip(' ')], subject = self.doc.subject ,message = self.doc.message)
|
||||
|
||||
#---------------------- Add details in follow up table----------------
|
||||
def add_in_follow_up(self,message,type):
|
||||
import datetime
|
||||
child = addchild( self.doc, 'follow_up', 'Communication Log', 1, self.doclist)
|
||||
|
@ -3,9 +3,9 @@
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-05-15 12:14:52',
|
||||
'creation': '2012-06-05 20:03:20',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-05-30 12:43:03',
|
||||
'modified': '2012-08-02 18:01:53',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
@ -505,23 +505,6 @@
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'description': u'Probability of lead converting to customer',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'rating',
|
||||
'fieldtype': u'Select',
|
||||
'in_filter': 1,
|
||||
'label': u'Rating',
|
||||
'oldfieldname': u'rating',
|
||||
'oldfieldtype': u'Select',
|
||||
'options': u'\nHot\nWarm\nCold',
|
||||
'permlevel': 0,
|
||||
'reqd': 0,
|
||||
'search_index': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'default': u'__user',
|
||||
@ -694,5 +677,14 @@
|
||||
'oldfieldtype': u'Small Text',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'unsubscribed',
|
||||
'fieldtype': u'Check',
|
||||
'label': u'Unsubscribed',
|
||||
'permlevel': 0
|
||||
}
|
||||
]
|
@ -4,8 +4,7 @@ wn.doclistviews['Lead'] = wn.views.ListView.extend({
|
||||
this.fields = this.fields.concat([
|
||||
'tabLead.lead_name',
|
||||
'tabLead.status',
|
||||
'tabLead.source',
|
||||
'tabLead.rating'
|
||||
'tabLead.source'
|
||||
]);
|
||||
this.stats = this.stats.concat(['status', 'source', 'rating', 'company']);
|
||||
},
|
||||
|
@ -197,118 +197,7 @@ class DocType(TransactionBase):
|
||||
set(self.doc, 'status', 'Opportunity Lost')
|
||||
set(self.doc, 'order_lost_reason', arg)
|
||||
return 'true'
|
||||
|
||||
|
||||
# On Send Email
|
||||
# ====================================================================================================================
|
||||
#def send_emails(self,email,sender,subject,message):
|
||||
# if email:
|
||||
# sendmail(email,sender,subject=subject or 'Opportunity',parts=[['text/plain',message or self.get_enq_summary()]])
|
||||
|
||||
# Prepare HTML Table and Enter Opportunity Items in it, which will be added in enq summary
|
||||
# ====================================================================================================================
|
||||
def quote_table(self):
|
||||
if getlist(self.doclist,'enq_details'):
|
||||
header_lbl = ['Item Code','Item Name','Description','Reqd Qty','UOM']
|
||||
item_tbl = '''<table style="width:90%%; border:1px solid #AAA; border-collapse:collapse"><tr>'''
|
||||
for i in header_lbl:
|
||||
item_header = '''<td style="width=20%%; border:1px solid #AAA; border-collapse:collapse;"><b>%s</b></td>''' % i
|
||||
item_tbl += item_header
|
||||
item_tbl += '''</tr>'''
|
||||
|
||||
for d in getlist(self.doclist,'enq_details'):
|
||||
item_det = '''
|
||||
<tr><td style="width:20%%; border:1px solid #AAA; border-collpase:collapse">%s</td>
|
||||
<td style="width:20%%; border:1px solid #AAA; border-collapse:collpase">%s</td>
|
||||
<td style="width:20%%; border:1px solid #AAA; border-collapse:collpase">%s</td>
|
||||
<td style="width:20%%; border:1px solid #AAA; border-collapse:collpase">%s</td>
|
||||
<td style="width:20%%; border:1px solid #AAA; border-collapse:collpase">%s</td></tr>
|
||||
''' % (d.item_code,d.item_name,d.description,d.reqd_qty,d.uom)
|
||||
item_tbl += item_det
|
||||
item_tbl += '''</table>'''
|
||||
return item_tbl
|
||||
|
||||
# Prepare HTML Page containing summary of Opportunity, which will be sent as message in E-mail
|
||||
# ====================================================================================================================
|
||||
def get_enq_summary(self):
|
||||
|
||||
t = """
|
||||
<html><head></head>
|
||||
<body>
|
||||
<div style="border:1px solid #AAA; padding:20px; width:100%%">
|
||||
<div style="text-align:center;font-size:14px"><b>Request For Quotation</b><br></div>
|
||||
<div style="text-align:center;font-size:12px"> %(from_company)s</div>
|
||||
<div style="text-align:center; font-size:10px"> %(company_address)s</div>
|
||||
<div style="border-bottom:1px solid #AAA; padding:10px"></div>
|
||||
|
||||
<div style="padding-top:10px"><b>Quotation Items</b></div>
|
||||
<div><table style="width:100%%">
|
||||
<tr><td style="width:40%%">Opportunity No:</td> <td style="width:60%%"> %(name)s</td></tr>
|
||||
<tr><td style="width:40%%">Opening Date:</td> <td style="width:60%%"> %(transaction_date)s</td></tr>
|
||||
<tr><td style="width:40%%">Expected By Date:</td> <td style="width:60%%"> %(expected_date)s</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div style="padding-top:10px"><b>Terms and Conditions</b></div>
|
||||
<div> %(terms_and_conditions)s</div>
|
||||
|
||||
<div style="padding-top:10px"><b>Contact Details</b></div>
|
||||
<div><table style="width:100%%">
|
||||
<tr><td style="width=40%%">Contact Person:</td><td style="width:60%%"> %(contact_person)s</td></tr>
|
||||
<tr><td style="width=40%%">Contact No:</td><td style="width:60%%"> %(contact_no)s</td></tr>
|
||||
<tr><td style="width=40%%">Email:</td><td style="width:60%%"> %(email)s</td></tr>
|
||||
</table></div>
|
||||
""" % (self.doc.fields)
|
||||
|
||||
t += """<br><div><b>Quotation Items</b><br></div><div style="width:100%%">%s</div>
|
||||
<br>
|
||||
To login into the system, use link : <div><a href='http://67.205.111.118/v160/login.html' target='_blank'>http://67.205.111.118/v160/login.html</a></div><br><br>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
""" % (self.quote_table())
|
||||
return t
|
||||
|
||||
#-----------------Email--------------------------------------------
|
||||
# ====================================================================================================================
|
||||
def send_emails(self, email=[], subject='', message=''):
|
||||
if email:
|
||||
sender_email= sql("Select email from `tabProfile` where name='%s'"%session['user'])
|
||||
if sender_email and sender_email[0][0]:
|
||||
attach_list=[]
|
||||
for at in getlist(self.doclist,'enquiry_attachment_detail'):
|
||||
if at.select_file:
|
||||
attach_list.append(at.select_file)
|
||||
cc_list=[]
|
||||
if self.doc.cc_to:
|
||||
for cl in (self.doc.cc_to.split(',')):
|
||||
if not validate_email_add(cl.strip(' ')):
|
||||
msgprint('error:%s is not a valid email id' % cl.strip(' '))
|
||||
raise Exception
|
||||
cc_list.append(cl.strip(' '))
|
||||
sendmail(cc_list, sender=sender_email[0][0], subject=subject, parts=[['text/html', message]], attach=attach_list)
|
||||
sendmail(email, sender=sender_email[0][0], subject=subject, parts=[['text/html', message]], cc=cc_list, attach=attach_list)
|
||||
#sendmail(cc_list, sender = sender_email[0][0], subject = subject , parts = [['text/html', message]],attach=attach_list)
|
||||
msgprint("Mail has been sent")
|
||||
self.add_in_follow_up(message,'Email')
|
||||
else:
|
||||
msgprint("Please enter your mail id in Profile")
|
||||
raise Exception
|
||||
|
||||
#-------------------------Checking Sent Mails Details----------------------------------------------
|
||||
# ====================================================================================================================
|
||||
def sent_mail(self):
|
||||
if not self.doc.subject or not self.doc.message:
|
||||
msgprint("Please enter subject & message in their respective fields.")
|
||||
elif not self.doc.email_id1:
|
||||
msgprint("Recipient not specified. Please add email id in 'Send To'.")
|
||||
raise Exception
|
||||
else :
|
||||
if not validate_email_add(self.doc.email_id1.strip(' ')):
|
||||
msgprint('error:%s is not a valid email id' % self.doc.email_id1)
|
||||
else:
|
||||
self.send_emails([self.doc.email_id1.strip(' ')], subject = self.doc.subject ,message = self.doc.message)
|
||||
|
||||
|
||||
#---------------------- Add details in follow up table----------------
|
||||
# ====================================================================================================================
|
||||
def add_in_follow_up(self,message,type):
|
||||
|
@ -415,7 +415,6 @@ class DocType:
|
||||
|
||||
from webnotes.utils.email_lib import sendmail
|
||||
try:
|
||||
#webnotes.msgprint('in send')
|
||||
sendmail(
|
||||
recipients=recipient_list,
|
||||
sender='notifications+email_digest@erpnext.com',
|
||||
|
@ -24,44 +24,24 @@ class DocType:
|
||||
self.doc,self.doclist = doc,doclist
|
||||
|
||||
def validate(self):
|
||||
"""
|
||||
Checks connectivity to email servers before saving
|
||||
"""
|
||||
"""Checks connectivity to email servers before saving"""
|
||||
self.validate_outgoing()
|
||||
self.validate_incoming()
|
||||
|
||||
|
||||
def validate_outgoing(self):
|
||||
"""
|
||||
Checks incoming email settings
|
||||
"""
|
||||
"""Checks incoming email settings"""
|
||||
if self.doc.outgoing_mail_server:
|
||||
from webnotes.utils import cint
|
||||
import _socket
|
||||
from webnotes.utils.email_lib.send import EMail
|
||||
import smtplib
|
||||
out_email = EMail()
|
||||
out_email.server = self.doc.outgoing_mail_server.encode('utf-8')
|
||||
out_email.port = cint(self.doc.mail_port)
|
||||
out_email.use_ssl = self.doc.use_ssl
|
||||
try:
|
||||
err_msg = "Login Id or Mail Password missing. Please enter and try again."
|
||||
if not (self.doc.mail_login and self.doc.mail_password):
|
||||
raise AttributeError, err_msg
|
||||
out_email.login = self.doc.mail_login.encode('utf-8')
|
||||
out_email.password = self.doc.mail_password.encode('utf-8')
|
||||
except AttributeError, e:
|
||||
webnotes.msgprint(err_msg)
|
||||
raise e
|
||||
from webnotes.utils.email_lib.smtp import SMTPServer
|
||||
smtpserver = SMTPServer(login = self.doc.mail_login,
|
||||
password = self.doc.mail_password,
|
||||
server = self.doc.outgoing_mail_server,
|
||||
port = cint(self.doc.mail_port),
|
||||
use_ssl = self.doc.use_ssl
|
||||
)
|
||||
|
||||
# exceptions are handled in smtp_connect
|
||||
sess = out_email.smtp_connect()
|
||||
|
||||
try:
|
||||
sess.quit()
|
||||
except:
|
||||
pass
|
||||
|
||||
# exceptions are handled in session connect
|
||||
sess = smtpserver.sess
|
||||
|
||||
def validate_incoming(self):
|
||||
"""
|
||||
|
@ -24,27 +24,26 @@ def execute_all():
|
||||
* get support email
|
||||
* recurring invoice
|
||||
"""
|
||||
try:
|
||||
from support.doctype.support_ticket import get_support_mails
|
||||
get_support_mails()
|
||||
except Exception, e:
|
||||
scheduler.log('get_support_mails')
|
||||
|
||||
try:
|
||||
from accounts.doctype.gl_control.gl_control import manage_recurring_invoices
|
||||
manage_recurring_invoices()
|
||||
except Exception, e:
|
||||
scheduler.log('manage_recurring_invoices')
|
||||
# pull emails
|
||||
from support.doctype.support_ticket import get_support_mails
|
||||
run_fn(get_support_mails)
|
||||
|
||||
# run recurring invoices
|
||||
from accounts.doctype.gl_control.gl_control import manage_recurring_invoices
|
||||
run_fn(manage_recurring_invoices)
|
||||
|
||||
# bulk email
|
||||
from webnotes.utils.email_lib.bulk import flush
|
||||
run_fn(flush)
|
||||
|
||||
def execute_daily():
|
||||
"""email digest"""
|
||||
try:
|
||||
from setup.doctype.email_digest.email_digest import send
|
||||
send()
|
||||
except Exception, e:
|
||||
scheduler.log('email_digest.send')
|
||||
# email digest
|
||||
from setup.doctype.email_digest.email_digest import send
|
||||
run_fn(send)
|
||||
|
||||
# send bulk emails
|
||||
from webnotes.utils.email_lib.bulk import cleanup
|
||||
run_fn(clear_outbox)
|
||||
|
||||
def execute_weekly():
|
||||
pass
|
||||
@ -54,3 +53,9 @@ def execute_monthly():
|
||||
|
||||
def execute_hourly():
|
||||
pass
|
||||
|
||||
def run_fn(fn):
|
||||
try:
|
||||
fn()
|
||||
except Exception, e:
|
||||
scheduler.log(fn.func_name)
|
||||
|
@ -181,27 +181,6 @@ class DocType:
|
||||
self.doc.is_asset_item = 'No'
|
||||
raise Exception
|
||||
|
||||
def check_min_inventory_level(self):
|
||||
if self.doc.minimum_inventory_level:
|
||||
total_qty = sql("select sum(projected_qty) from tabBin where item_code = %s",self.doc.name)
|
||||
if flt(total_qty) < flt(self.doc.minimum_inventory_level):
|
||||
msgprint("Your minimum inventory level is reached")
|
||||
send_to = []
|
||||
send = sql("select t1.email from `tabProfile` t1,`tabUserRole` t2 where t2.role IN ('Material Master Manager','Purchase Manager') and t2.parent = t1.name")
|
||||
for d in send:
|
||||
send_to.append(d[0])
|
||||
msg = '''
|
||||
Minimum Inventory Level Reached
|
||||
|
||||
Item Code: %s
|
||||
Item Name: %s
|
||||
Minimum Inventory Level: %s
|
||||
Total Available Qty: %s
|
||||
|
||||
''' % (self.doc.item_code, self.doc.item_name, self.doc.minimum_inventory_level, total_qty)
|
||||
|
||||
sendmail(send_to, sender='automail@webnotestech.com', subject='Minimum Inventory Level Reached', parts=[['text/plain', msg]])
|
||||
|
||||
def get_file_details(self, arg = ''):
|
||||
file = sql("select file_group, description from tabFile where name = %s", eval(arg)['file_name'], as_dict = 1)
|
||||
|
||||
|
@ -3,9 +3,9 @@
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-07-02 19:57:48',
|
||||
'creation': '2012-07-03 14:22:38',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-07-03 12:54:52',
|
||||
'modified': '2012-08-02 13:16:48',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
@ -38,133 +38,12 @@
|
||||
'parenttype': u'DocType'
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'doctype': u'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': u'Contact',
|
||||
'parentfield': u'permissions',
|
||||
'parenttype': u'DocType',
|
||||
'read': 1
|
||||
},
|
||||
|
||||
# DocType, Contact
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': u'Contact'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'System Manager',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Sales Master Manager',
|
||||
'submit': 0,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Purchase Master Manager',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Sales Manager',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Purchase Manager',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Maintenance Manager',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Accounts Manager',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Sales User',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Purchase User',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Maintenance User',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Accounts User',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 1,
|
||||
'role': u'All'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
@ -356,6 +235,15 @@
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'unsubscribed',
|
||||
'fieldtype': u'Check',
|
||||
'label': u'Unsubscribed',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
|
@ -1,29 +0,0 @@
|
||||
# DocType, Blog Subscriber
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-03-27 14:36:47',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-03-27 14:36:47',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'module': u'Website',
|
||||
'name': '__common__',
|
||||
'section_style': u'Simple',
|
||||
'show_in_menu': 0,
|
||||
'version': 1
|
||||
},
|
||||
|
||||
# DocType, Blog Subscriber
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': u'Blog Subscriber'
|
||||
}
|
||||
]
|
@ -1,13 +0,0 @@
|
||||
<div class="layout_wrapper">
|
||||
<div class="web-content">
|
||||
<h1>Unsubscribe</h1>
|
||||
<br>
|
||||
<div class="web-main-section">
|
||||
<input name="unsubscribe">
|
||||
<button class="btn" id="btn-unsubscribe">Unsubscribe</button>
|
||||
</div>
|
||||
<div class="web-side-section">
|
||||
</div>
|
||||
<div style="clear: both"></div>
|
||||
</div>
|
||||
</div>
|
@ -1,37 +0,0 @@
|
||||
// ERPNext - web based ERP (http://erpnext.com)
|
||||
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
pscript.onload_unsubscribe = function(wrapper) {
|
||||
var email = window.location.hash.split('/').splice(-1);
|
||||
$(wrapper).find('input[name="unsubscribe"]').val(email)
|
||||
|
||||
$('#btn-unsubscribe').click(function() {
|
||||
var email = $(wrapper).find('input[name="unsubscribe"]').val();
|
||||
if(email) {
|
||||
var btn = this;
|
||||
wn.call({
|
||||
module:'website',
|
||||
page:'unsubscribe',
|
||||
method:'unsubscribe',
|
||||
args:email,
|
||||
btn: this,
|
||||
callback: function() {
|
||||
$(wrapper).find('input[name="unsubscribe"]').val('');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
# ERPNext - web based ERP (http://erpnext.com)
|
||||
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import webnotes
|
||||
|
||||
@webnotes.whitelist()
|
||||
def unsubscribe(arg):
|
||||
"""unsubscribe from lists"""
|
||||
lists = [['Blog Subscriber', 'name']]
|
||||
for l in lists:
|
||||
webnotes.conn.sql("""delete from `tab%s` where %s=%s""" % (l[0], l[1], '%s'), arg)
|
||||
|
||||
webnotes.msgprint('Unsubscribed!')
|
@ -1,43 +0,0 @@
|
||||
# Page, unsubscribe
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-01-27 17:19:02',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-01-27 17:19:02',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all Page
|
||||
{
|
||||
'doctype': 'Page',
|
||||
'module': 'Website',
|
||||
'name': '__common__',
|
||||
'page_name': 'unsubscribe',
|
||||
'standard': 'Yes',
|
||||
'title': 'Unsubscribe'
|
||||
},
|
||||
|
||||
# These values are common for all Page Role
|
||||
{
|
||||
'doctype': 'Page Role',
|
||||
'name': '__common__',
|
||||
'parent': 'unsubscribe',
|
||||
'parentfield': 'roles',
|
||||
'parenttype': 'Page',
|
||||
'role': 'Guest'
|
||||
},
|
||||
|
||||
# Page, unsubscribe
|
||||
{
|
||||
'doctype': 'Page',
|
||||
'name': 'unsubscribe'
|
||||
},
|
||||
|
||||
# Page Role
|
||||
{
|
||||
'doctype': 'Page Role'
|
||||
}
|
||||
]
|
11
erpnext/website/templates/pages/unsubscribed.html
Normal file
11
erpnext/website/templates/pages/unsubscribed.html
Normal file
@ -0,0 +1,11 @@
|
||||
{% extends "html/outer.html" %}
|
||||
|
||||
{% block content %}
|
||||
<div class="content">
|
||||
<div class="layout-wrapper layout-main">
|
||||
<h3>Unsubscribed</h3>
|
||||
<br>
|
||||
<p><b>{{ webnotes.unsubscribed_email }}</b> has been unsubscribed.</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
Loading…
x
Reference in New Issue
Block a user