fixes to support ticket
diff --git a/setup/doctype/email_settings/email_settings.py b/setup/doctype/email_settings/email_settings.py
index b19e4e2..37de7bc 100644
--- a/setup/doctype/email_settings/email_settings.py
+++ b/setup/doctype/email_settings/email_settings.py
@@ -1,6 +1,7 @@
 import webnotes
 sql = webnotes.conn.sql
 	
+from webnotes.utils import cint, cstr
 
 class DocType:
 	def __init__(self,doc,doclist):
@@ -26,10 +27,14 @@
 			Sets or cancels the event in the scheduler
 		"""
 		# update control panel
-		map(self.set_cp_value, 'outgoing_mail_server', 'mail_login', 'mail_password', 'auto_email_id', 'mail_port', 'use_ssl')
+		for f in ('outgoing_mail_server', 'mail_login', 'mail_password', 'auto_email_id', 'mail_port', 'use_ssl'):
+			self.set_cp_value(f)
 
 		# setup scheduler for support emails
 		if cint(self.doc.sync_support_mails):
+			if not (self.doc.support_host and self.doc.support_username and self.doc.support_password):
+				webnotes.msgprint("You must give the incoming POP3 settings for support emails to activiate mailbox integration", raise_exception=1)
+			
 			from webnotes.utils.scheduler import set_event
 			set_event('support.doctype.support_ticket.get_support_mails', 60*5, 1)
 		else:
diff --git a/setup/doctype/email_settings/email_settings.txt b/setup/doctype/email_settings/email_settings.txt
index 1b50694..ef6efe6 100644
--- a/setup/doctype/email_settings/email_settings.txt
+++ b/setup/doctype/email_settings/email_settings.txt
@@ -5,14 +5,14 @@
 	{
 		'creation': '2010-08-08 17:08:59',
 		'docstatus': 0,
-		'modified': '2011-07-25 11:07:14',
+		'modified': '2011-07-25 15:03:51',
 		'modified_by': 'Administrator',
 		'owner': 'harshada@webnotestech.com'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1300962303',
+		'_last_update': '1311586371',
 		'allow_copy': 1,
 		'allow_email': 1,
 		'allow_print': 1,
@@ -24,7 +24,7 @@
 		'name': '__common__',
 		'section_style': 'Simple',
 		'server_code_error': ' ',
-		'version': 30
+		'version': 34
 	},
 
 	# These values are common for all DocField
@@ -80,9 +80,18 @@
 	# DocField
 	{
 		'doctype': 'DocField',
+		'fieldtype': 'HTML',
+		'idx': 2,
+		'label': '1',
+		'options': '<div class="help_box">Set your outgoing mail settings here. All system generated notifications, emails will go from this mail server</div>'
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
 		'fieldname': 'outgoing_mail_server',
 		'fieldtype': 'Data',
-		'idx': 2,
+		'idx': 3,
 		'label': 'Outgoing Mail Server'
 	},
 
@@ -91,7 +100,7 @@
 		'doctype': 'DocField',
 		'fieldname': 'mail_port',
 		'fieldtype': 'Data',
-		'idx': 3,
+		'idx': 4,
 		'label': 'Mail Port'
 	},
 
@@ -100,7 +109,7 @@
 		'doctype': 'DocField',
 		'fieldname': 'use_ssl',
 		'fieldtype': 'Check',
-		'idx': 4,
+		'idx': 5,
 		'label': 'Use SSL'
 	},
 
@@ -109,7 +118,7 @@
 		'doctype': 'DocField',
 		'fieldname': 'mail_login',
 		'fieldtype': 'Data',
-		'idx': 5,
+		'idx': 6,
 		'label': 'Login Id'
 	},
 
@@ -118,7 +127,7 @@
 		'doctype': 'DocField',
 		'fieldname': 'mail_password',
 		'fieldtype': 'Password',
-		'idx': 6,
+		'idx': 7,
 		'label': 'Mail Password'
 	},
 
@@ -127,43 +136,67 @@
 		'doctype': 'DocField',
 		'fieldname': 'auto_email_id',
 		'fieldtype': 'Data',
-		'idx': 7,
+		'idx': 8,
 		'label': 'Auto Email Id'
 	},
 
 	# DocField
 	{
+		'description': 'Set the POP3 email settings to pull emails directly from a mailbox and create Support Tickets',
 		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
-		'idx': 8,
+		'idx': 9,
 		'label': 'Support Ticket Mail Settings'
 	},
 
 	# DocField
 	{
 		'doctype': 'DocField',
+		'fieldtype': 'HTML',
+		'idx': 10,
+		'label': '2',
+		'options': '<div class="help_box">To automatically create Support Tickets from your incoming mail, set your pop3 settings here.</div>'
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldtype': 'Section Break',
+		'idx': 11,
+		'options': 'Simple'
+	},
+
+	# DocField
+	{
+		'colour': 'White:FFF',
+		'description': 'Check this to pull emails from your mailbox',
+		'doctype': 'DocField',
 		'fieldname': 'sync_support_mails',
 		'fieldtype': 'Check',
-		'idx': 9,
+		'idx': 12,
 		'label': 'Sync Support Mails'
 	},
 
 	# DocField
 	{
+		'colour': 'White:FFF',
+		'description': 'Your support email id - must be a valid email - this is where your emails will come!',
 		'doctype': 'DocField',
 		'fieldname': 'support_email',
 		'fieldtype': 'Data',
-		'idx': 10,
+		'idx': 13,
 		'label': 'Support Email'
 	},
 
 	# DocField
 	{
+		'colour': 'White:FFF',
+		'description': 'POP3 mail server (e.g. pop.gmail.com)',
 		'doctype': 'DocField',
 		'fieldname': 'support_host',
 		'fieldtype': 'Data',
-		'idx': 11,
-		'label': 'Mail Server'
+		'idx': 14,
+		'label': 'POP3 Mail Server'
 	},
 
 	# DocField
@@ -171,7 +204,7 @@
 		'doctype': 'DocField',
 		'fieldname': 'support_use_ssl',
 		'fieldtype': 'Check',
-		'idx': 12,
+		'idx': 15,
 		'label': 'Use SSL'
 	},
 
@@ -180,7 +213,7 @@
 		'doctype': 'DocField',
 		'fieldname': 'support_username',
 		'fieldtype': 'Data',
-		'idx': 13,
+		'idx': 16,
 		'label': 'User Name'
 	},
 
@@ -189,7 +222,7 @@
 		'doctype': 'DocField',
 		'fieldname': 'support_password',
 		'fieldtype': 'Password',
-		'idx': 14,
+		'idx': 17,
 		'label': 'Support Password'
 	},
 
@@ -197,24 +230,28 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Column Break',
-		'idx': 15
+		'idx': 18
 	},
 
 	# DocField
 	{
+		'colour': 'White:FFF',
+		'description': 'Signature to be appended at the end of every email',
 		'doctype': 'DocField',
 		'fieldname': 'support_signature',
 		'fieldtype': 'Text',
-		'idx': 16,
+		'idx': 19,
 		'label': 'Signature'
 	},
 
 	# DocField
 	{
+		'colour': 'White:FFF',
+		'description': 'Autoreply when a new mail is received',
 		'doctype': 'DocField',
 		'fieldname': 'support_autoreply',
 		'fieldtype': 'Text',
-		'idx': 17,
+		'idx': 20,
 		'label': 'Autoreply'
 	}
 ]
\ No newline at end of file