added automatic lead creation for sales email id

This commit is contained in:
Rushabh Mehta
2013-01-16 11:34:26 +05:30
parent 9942987c9c
commit 2e5db35856
18 changed files with 284 additions and 101 deletions

View File

@@ -6,34 +6,6 @@ install_docs = [
import webnotes
max_tickets_per_hour = 200
@webnotes.whitelist(allow_guest=True)
def send_message():
from webnotes.model.doc import Document
d = Document('Support Ticket')
d.subject = webnotes.form_dict.get('subject', 'Website Query')
d.description = webnotes.form_dict.get('message')
d.raised_by = webnotes.form_dict.get('sender')
d.status = webnotes.form_dict.get("status") or "Open"
if not d.description:
webnotes.response["message"] = 'Please write something'
return
if not d.raised_by:
webnotes.response["message"] = 'Email Id Required'
return
# guest method, cap max writes per hour
if webnotes.conn.sql("""select count(*) from `tabSupport Ticket`
where TIMEDIFF(NOW(), modified) < '01:00:00'""")[0][0] > max_tickets_per_hour:
webnotes.response["message"] = "Sorry: we believe we have received an unreasonably high number of requests of this kind. Please try later"
return
d.save()
webnotes.response["message"] = 'Thank You'
def get_site_address():
from webnotes.utils import get_request_site_address