Merge branch 'master' into latest

Conflicts:
	index.html
	version.num
diff --git a/erpnext/buying/doctype/purchase_other_charges/purchase_other_charges.txt b/erpnext/buying/doctype/purchase_other_charges/purchase_other_charges.txt
index 5c55039..8be1359 100644
--- a/erpnext/buying/doctype/purchase_other_charges/purchase_other_charges.txt
+++ b/erpnext/buying/doctype/purchase_other_charges/purchase_other_charges.txt
@@ -5,16 +5,18 @@
 	{
 		'creation': '2010-08-08 17:09:15',
 		'docstatus': 0,
-		'modified': '2010-09-20 17:30:25',
+		'modified': '2012-01-24 12:42:18',
 		'modified_by': 'Administrator',
 		'owner': 'wasim@webnotestech.com'
 	},
 
 	# These values are common for all DocType
 	{
+		'_last_update': '1325570646',
 		'allow_trash': 1,
 		'autoname': 'field:title',
 		'colour': 'White:FFF',
+		'default_print_format': 'Standard',
 		'doctype': 'DocType',
 		'document_type': 'Master',
 		'module': 'Buying',
@@ -22,7 +24,7 @@
 		'section_style': 'Simple',
 		'server_code_error': ' ',
 		'show_in_menu': 0,
-		'version': 16
+		'version': 18
 	},
 
 	# These values are common for all DocField
@@ -54,7 +56,6 @@
 	# DocPerm
 	{
 		'doctype': 'DocPerm',
-		'idx': 1,
 		'permlevel': 1,
 		'role': 'All'
 	},
@@ -65,7 +66,6 @@
 		'cancel': 0,
 		'create': 0,
 		'doctype': 'DocPerm',
-		'idx': 2,
 		'permlevel': 0,
 		'role': 'Purchase Manager',
 		'submit': 0,
@@ -77,7 +77,6 @@
 		'cancel': 1,
 		'create': 1,
 		'doctype': 'DocPerm',
-		'idx': 3,
 		'permlevel': 0,
 		'role': 'System Manager',
 		'write': 1
@@ -88,7 +87,6 @@
 		'cancel': 1,
 		'create': 1,
 		'doctype': 'DocPerm',
-		'idx': 4,
 		'permlevel': 0,
 		'role': 'Purchase Master Manager',
 		'submit': 0,
@@ -100,7 +98,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'title',
 		'fieldtype': 'Data',
-		'idx': 1,
 		'in_filter': 1,
 		'label': 'Title',
 		'oldfieldname': 'title',
@@ -112,9 +109,19 @@
 	# DocField
 	{
 		'doctype': 'DocField',
+		'fieldname': 'company',
+		'fieldtype': 'Link',
+		'in_filter': 1,
+		'label': 'Company',
+		'options': 'Company',
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
 		'fieldname': 'purchase_tax_details',
 		'fieldtype': 'Table',
-		'idx': 2,
 		'label': 'Purchase Tax Details',
 		'oldfieldname': 'purchase_tax_details',
 		'oldfieldtype': 'Table',
diff --git a/erpnext/patches/jan_mar_2012/customer_address_contact_patch.py b/erpnext/patches/jan_mar_2012/customer_address_contact_patch.py
index 6a7d405..b55acd4 100644
--- a/erpnext/patches/jan_mar_2012/customer_address_contact_patch.py
+++ b/erpnext/patches/jan_mar_2012/customer_address_contact_patch.py
@@ -31,7 +31,7 @@
 			GROUP BY sales_partner HAVING SUM(IFNULL(is_primary_contact, 0))=0
 		)
 	""", as_list=1)
-	names = ", ".join(["'" + str(r[0]) + "'" for r in res if r])
+	names = ", ".join(['"' + str(r[0]) + '"' for r in res if r])
 	if names: webnotes.conn.sql("UPDATE `tabContact` SET is_primary_contact=1 WHERE name IN (%s)" % names)
 
 def patch_primary_address():
@@ -54,5 +54,5 @@
 			AND SUM(IFNULL(is_shipping_address, 0))=0
 		)
 	""", as_list=1)
-	names = ", ".join(["'" + str(r[0]) + "'" for r in res if r])
+	names = ", ".join(['"' + str(r[0]) + '"' for r in res if r])
 	if names: webnotes.conn.sql("UPDATE `tabAddress` SET is_primary_address=1 WHERE name IN (%s)" % names)
diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py
index c0c7d1e..edce3c3 100644
--- a/erpnext/patches/patch_list.py
+++ b/erpnext/patches/patch_list.py
@@ -37,7 +37,7 @@
 	},
 	{
 		'patch_module': 'patches.jan_mar_2012',
-		'patch_file': 'customer_address_contact',
+		'patch_file': 'customer_address_contact_patch',
 		'description': "Install Customer Address Contact report and run patches regarding primary address and contact"
 	},
 ]
diff --git a/erpnext/support/doctype/support_ticket/support_ticket.py b/erpnext/support/doctype/support_ticket/support_ticket.py
index bdf3c9a..986a9b5 100644
--- a/erpnext/support/doctype/support_ticket/support_ticket.py
+++ b/erpnext/support/doctype/support_ticket/support_ticket.py
@@ -19,7 +19,7 @@
 		if not self.doc.new_response:
 			webnotes.msgprint("Please write something as a response", raise_exception=1)
 		
-		subject = '[' + self.doc.name + '] ' + self.doc.subject
+		subject = '[' + self.doc.name + '] ' + (self.doc.subject or 'No Subject Specified')
 		
 		response = self.doc.new_response + '\n\n[Please do not change the subject while responding.]'