sms fix
diff --git a/erpnext/selling/doctype/sms_center/sms_center.py b/erpnext/selling/doctype/sms_center/sms_center.py
index 0d54f72..16c0923 100644
--- a/erpnext/selling/doctype/sms_center/sms_center.py
+++ b/erpnext/selling/doctype/sms_center/sms_center.py
@@ -47,7 +47,6 @@
if self.doc.send_to == 'All Sales Partner Contact':
where_clause = self.doc.sales_partner and " and ifnull(is_sales_partner, 0) = 1 and sales_aprtner = '%s'" % self.doc.sales_partner or " and ifnull(is_sales_partner, 0) = 1"
if self.doc.send_to in ['All Contact', 'All Customer Contact', 'All Supplier Contact', 'All Sales Partner Contact']:
- msgprint("select CONCAT(ifnull(first_name,''),'',ifnull(last_name,'')), mobile_no from `tabContact` where ifnull(mobile_no,'')!='' and docstatus != 2 %s" % where_clause)
rec = sql("select CONCAT(ifnull(first_name,''),'',ifnull(last_name,'')), mobile_no from `tabContact` where ifnull(mobile_no,'')!='' and docstatus != 2 %s" % where_clause)
elif self.doc.send_to == 'All Lead (Open)':
rec = sql("select lead_name, mobile_no from tabLead where ifnull(mobile_no,'')!='' and docstatus != 2 and status = 'Open'")
diff --git a/erpnext/selling/page/selling_home/selling_home.html b/erpnext/selling/page/selling_home/selling_home.html
index 2b3414e..05f9858 100644
--- a/erpnext/selling/page/selling_home/selling_home.html
+++ b/erpnext/selling/page/selling_home/selling_home.html
@@ -78,6 +78,11 @@
title = "Sales campaigns"
href="#!List/Campaign">Campaign</a>
</div>
+ <div class="section-item">
+ <a class="section-link"
+ title = "Send mass SMS to your conatacts, leads and employees"
+ href="#!Form/SMS Center/SMS Center">SMS Center</a>
+ </div>
</div>
</div>
<div class="section">
@@ -93,7 +98,7 @@
title = "Analyze Sales and Purchase trends and slice them based on item, customer, groups etc"
href="#!Report/Profile/Trend Analyzer">Trend Analyzer</a>
</div>
- <!--><div class="section-item">
+ <!--<div class="section-item">
<a class="section-link"
title = "sales trends"
href="#!Sales Dashboard">Sales Dashboard</a>
diff --git a/erpnext/utilities/doctype/sms_control/sms_control.py b/erpnext/utilities/doctype/sms_control/sms_control.py
index f19ccf1..42a38fd 100644
--- a/erpnext/utilities/doctype/sms_control/sms_control.py
+++ b/erpnext/utilities/doctype/sms_control/sms_control.py
@@ -69,14 +69,6 @@
return validated_receiver_list
- # Connect Gateway
- # =========================================================
- def connect_gateway(self):
- "login to gateway"
- from webnotes.utils.webservice import FrameworkServer
- fw = FrameworkServer('www.erpnext.com', '/', '__system@webnotestech.com', 'password', https=1)
- return fw
-
def get_sender_name(self):
"returns name as SMS sender"
sender_name = webnotes.conn.get_value('Global Defaults', None, 'sms_sender_name') or 'ERPNXT'
@@ -117,8 +109,7 @@
if get_value('SMS Settings', None, 'sms_gateway_url'):
ret = self.send_via_personalized_gateway(arg)
msgprint(ret)
- else:
- ret = self.send_via_erpnext_gateway(arg)
+
# Send sms via personalized gateway
# ==========================================================
@@ -135,30 +126,6 @@
return resp
- # Send sms via ERPNext gateway
- # ==========================================================
- def send_via_erpnext_gateway(self, arg):
- fw = self.connect_gateway()
- ret = fw.run_method(method = 'erpnext_utils.sms_control.send_sms', args = arg)
-
- if ret.get('exc'):
- msgprint(ret['exc'])
- raise Exception
- elif ret['message']:
- sms_sent = cint(ret['message']['sms_sent'])
- sms_bal = cint(ret['message']['sms_balance'])
- self.create_sms_log(arg, ret['message']['sms_sent'])
-
- if not sms_sent:
- if sms_bal < len(arg['receiver_list']):
- msgprint("You do not have enough SMS balance. Current SMS Balance: " + cstr(sms_bal) + "\nYou can send mail to sales@erpnext.com to buy additional sms packages")
- raise Exception
- else:
- msgprint("Message sent failed. May be numbers are invalid or some other issues.")
- else:
- msgprint(cstr(sms_sent) + " message sucessfully sent!\nCurrent SMS Balance: " + cstr(cint(ret['message']['sms_balance']) - cint(ret['message']['sms_sent'])))
-
-
# Send Request
# =========================================================
def send_request(self, gateway_url, args):
@@ -182,8 +149,6 @@
api_url += '?'
return server, api_url
-
-
# Create SMS Log
# =========================================================
@@ -195,20 +160,4 @@
sl.message = arg['message']
sl.no_of_requested_sms = len(arg['receiver_list'])
sl.no_of_sent_sms = sent_sms
- sl.save(new=1)
-
- # Get SMS Balance
- # =========================================================
- def get_sms_balance(self):
- arg = { 'account_name' : webnotes.conn.get_value('Control Panel',None,'account_id') }
- if get_value('SMS Settings', None, 'sms_gateway_url'):
- ret = {}
- else:
- fw = self.connect_gateway()
- ret = fw.run_method(mothod = 'erpnext_utils.sms_control.get_sms_balance', args = arg)
-
- if ret.get('exc'):
- msgprint(ret['exc'])
- raise Exception
- else:
- msgprint("Current SMS Balance: " + cstr(ret['message']) + "\nYou can send mail to sales@erpnext.com to buy sms packages")
+ sl.save(new=1)
\ No newline at end of file