blob: 7ba4a9d911ec12b2194f7eee774cc50a39b1c8fe [file] [log] [blame]
Rushabh Mehtaad45e312013-11-20 12:59:58 +05301# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
Anand Doshi330dae92013-09-10 13:46:15 +05302# License: GNU General Public License v3. See license.txt
3
4from __future__ import unicode_literals
Rushabh Mehta793ba6b2014-02-14 15:47:51 +05305import frappe
Anand Doshifb109ad2013-09-11 18:58:20 +05306
Rushabh Mehta793ba6b2014-02-14 15:47:51 +05307@frappe.whitelist(allow_guest=True)
Anand Doshifb109ad2013-09-11 18:58:20 +05308def send_message(subject="Website Query", message="", sender="", status="Open"):
Rushabh Mehta793ba6b2014-02-14 15:47:51 +05309 from frappe.templates.pages.contact import send_message as website_send_message
Anand Doshi5d591eb2014-04-18 16:15:31 +053010
Anand Doshifb109ad2013-09-11 18:58:20 +053011 if not website_send_message(subject, message, sender):
12 return
Anand Doshi5d591eb2014-04-18 16:15:31 +053013
Anand Doshidf019802013-12-04 16:27:30 +053014 if subject=="Support":
15 # create support ticket
Rushabh Mehta1f847992013-12-12 19:12:19 +053016 from erpnext.support.doctype.support_ticket.get_support_mails import add_support_communication
Anand Doshidf019802013-12-04 16:27:30 +053017 add_support_communication(subject, message, sender, mail=None)
18 else:
19 # make lead / communication
Rushabh Mehta1f847992013-12-12 19:12:19 +053020 from erpnext.selling.doctype.lead.get_leads import add_sales_communication
Anand Doshi5d591eb2014-04-18 16:15:31 +053021 add_sales_communication(subject or "Website Query", message, sender, sender,
Anand Doshidf019802013-12-04 16:27:30 +053022 mail=None, status=status)
Anand Doshi5d591eb2014-04-18 16:15:31 +053023