Rushabh Mehta | ad45e31 | 2013-11-20 12:59:58 +0530 | [diff] [blame] | 1 | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors |
Anand Doshi | 330dae9 | 2013-09-10 13:46:15 +0530 | [diff] [blame] | 2 | # License: GNU General Public License v3. See license.txt |
| 3 | |
| 4 | from __future__ import unicode_literals |
Rushabh Mehta | 793ba6b | 2014-02-14 15:47:51 +0530 | [diff] [blame] | 5 | import frappe |
Anand Doshi | fb109ad | 2013-09-11 18:58:20 +0530 | [diff] [blame] | 6 | |
Rushabh Mehta | 793ba6b | 2014-02-14 15:47:51 +0530 | [diff] [blame] | 7 | @frappe.whitelist(allow_guest=True) |
Anand Doshi | fb109ad | 2013-09-11 18:58:20 +0530 | [diff] [blame] | 8 | def send_message(subject="Website Query", message="", sender="", status="Open"): |
Rushabh Mehta | 793ba6b | 2014-02-14 15:47:51 +0530 | [diff] [blame] | 9 | from frappe.templates.pages.contact import send_message as website_send_message |
Anand Doshi | 56f29cb | 2014-05-02 18:16:45 +0530 | [diff] [blame] | 10 | res = website_send_message(subject, message, sender) |
Anand Doshi | 5d591eb | 2014-04-18 16:15:31 +0530 | [diff] [blame] | 11 | |
Anand Doshi | 56f29cb | 2014-05-02 18:16:45 +0530 | [diff] [blame] | 12 | if not res: |
Anand Doshi | fb109ad | 2013-09-11 18:58:20 +0530 | [diff] [blame] | 13 | return |
Anand Doshi | 5d591eb | 2014-04-18 16:15:31 +0530 | [diff] [blame] | 14 | |
Anand Doshi | df01980 | 2013-12-04 16:27:30 +0530 | [diff] [blame] | 15 | if subject=="Support": |
| 16 | # create support ticket |
Rushabh Mehta | 1f84799 | 2013-12-12 19:12:19 +0530 | [diff] [blame] | 17 | from erpnext.support.doctype.support_ticket.get_support_mails import add_support_communication |
Anand Doshi | df01980 | 2013-12-04 16:27:30 +0530 | [diff] [blame] | 18 | add_support_communication(subject, message, sender, mail=None) |
| 19 | else: |
| 20 | # make lead / communication |
Rushabh Mehta | 1f84799 | 2013-12-12 19:12:19 +0530 | [diff] [blame] | 21 | from erpnext.selling.doctype.lead.get_leads import add_sales_communication |
Anand Doshi | 5d591eb | 2014-04-18 16:15:31 +0530 | [diff] [blame] | 22 | add_sales_communication(subject or "Website Query", message, sender, sender, |
Anand Doshi | df01980 | 2013-12-04 16:27:30 +0530 | [diff] [blame] | 23 | mail=None, status=status) |
Anand Doshi | 5d591eb | 2014-04-18 16:15:31 +0530 | [diff] [blame] | 24 | |
Anand Doshi | 56f29cb | 2014-05-02 18:16:45 +0530 | [diff] [blame] | 25 | return res |