appraisal, don't validate points for self-appraisal
diff --git a/hr/doctype/appraisal/appraisal.py b/hr/doctype/appraisal/appraisal.py
index 82fb77b..849e48a 100644
--- a/hr/doctype/appraisal/appraisal.py
+++ b/hr/doctype/appraisal/appraisal.py
@@ -29,7 +29,15 @@
 	def __init__(self, doc, doclist=[]):
 		self.doc = doc
 		self.doclist = doclist
-	
+
+	def validate(self):
+		if not self.doc.status:
+			self.doc.status = "Draft"
+
+		self.validate_dates()
+		self.validate_existing_appraisal()
+		self.calculate_total()
+
 	def get_employee_name(self):
 		emp_nm = sql("select employee_name from `tabEmployee` where name=%s", self.doc.employee)
 		emp_nm= emp_nm and emp_nm[0][0] or ''
@@ -47,25 +55,19 @@
 			raise Exception
 	
 	def validate_existing_appraisal(self):
-		chk = sql("select name from `tabAppraisal` where employee=%s and (status='Submitted' or status='Completed') and ((start_date>=%s and start_date<=%s) or (end_date>=%s and end_date<=%s))",(self.doc.employee,self.doc.start_date,self.doc.end_date,self.doc.start_date,self.doc.end_date))
+		chk = sql("""select name from `tabAppraisal` where employee=%s 
+			and (status='Submitted' or status='Completed') 
+			and ((start_date>=%s and start_date<=%s) 
+			or (end_date>=%s and end_date<=%s))""",(self.doc.employee,self.doc.start_date,self.doc.end_date,self.doc.start_date,self.doc.end_date))
 		if chk:
 			msgprint("You have already created Appraisal "\
 				+cstr(chk[0][0])+" in the current date range for employee "\
 				+cstr(self.doc.employee_name))
 			raise Exception
-		
-	def validate(self):
-		if not self.doc.status:
-			self.doc.status = "Draft"
-
-		self.validate_dates()
-		self.validate_existing_appraisal()
-		self.calculate_total()
 	
 	def calculate_total(self):
 		total, total_w  = 0, 0
 		for d in getlist(self.doclist, 'appraisal_details'):
-			
 			if d.score:
 				d.score_earned = flt(d.score) * flt(d.per_weightage) / 100
 				total = total + d.score_earned
@@ -74,9 +76,12 @@
 		if int(total_w) != 100:
 			msgprint("Total weightage assigned should be 100%. It is :" + str(total_w) + "%", 
 				raise_exception=1)
+
+		if webnotes.conn.get_default("employee", webnotes.session.user) != self.doc.employee:
 		
-		if total==0:
-			msgprint("Total can't be zero. You must atleast give some points!", raise_exception=1)
+			if total==0:
+				msgprint("Total can't be zero. You must atleast give some points!", raise_exception=1)
+
 		self.doc.total_score = total
 			
 	def on_submit(self):
diff --git a/manufacturing/doctype/production_planning_tool/production_planning_tool.txt b/manufacturing/doctype/production_planning_tool/production_planning_tool.txt
index d4a0d94..5eeb82d 100644
--- a/manufacturing/doctype/production_planning_tool/production_planning_tool.txt
+++ b/manufacturing/doctype/production_planning_tool/production_planning_tool.txt
@@ -2,9 +2,9 @@
  {
   "owner": "jai@webnotestech.com", 
   "docstatus": 0, 
-  "creation": "2013-01-16 14:48:56", 
+  "creation": "2013-01-19 10:23:35", 
   "modified_by": "Administrator", 
-  "modified": "2013-01-17 11:39:55"
+  "modified": "2013-01-19 10:31:03"
  }, 
  {
   "read_only": 1, 
@@ -31,8 +31,8 @@
   "submit": 0, 
   "doctype": "DocPerm", 
   "write": 1, 
-  "report": 0, 
   "parenttype": "DocType", 
+  "report": 1, 
   "permlevel": 0, 
   "parentfield": "permissions"
  }, 
@@ -70,9 +70,9 @@
  {
   "doctype": "DocField", 
   "label": "Company", 
-  "reqd": 1, 
   "fieldname": "company", 
   "fieldtype": "Link", 
+  "reqd": 1, 
   "options": "Company"
  }, 
  {
@@ -161,9 +161,9 @@
   "default": "1", 
   "doctype": "DocField", 
   "label": "Use Multi-Level BOM", 
-  "reqd": 0, 
   "fieldname": "use_multi_level_bom", 
-  "fieldtype": "Check"
+  "fieldtype": "Check", 
+  "reqd": 0
  }, 
  {
   "doctype": "DocField", 
@@ -181,9 +181,9 @@
  }, 
  {
   "doctype": "DocField", 
+  "label": "Materials Requirement Planning (MRP)", 
   "fieldname": "sb5", 
-  "fieldtype": "Section Break", 
-  "options": "Simple"
+  "fieldtype": "Section Break"
  }, 
  {
   "description": "Download a report containing all raw materials with their latest inventory status", 
@@ -214,6 +214,10 @@
   "options": "raise_purchase_request"
  }, 
  {
+  "role": "System Manager", 
+  "doctype": "DocPerm"
+ }, 
+ {
   "role": "Manufacturing User", 
   "doctype": "DocPerm"
  }, 
diff --git a/patches/january_2013/change_patch_structure.py b/patches/january_2013/change_patch_structure.py
index 37c4f08..1370cdd 100644
--- a/patches/january_2013/change_patch_structure.py
+++ b/patches/january_2013/change_patch_structure.py
@@ -2,11 +2,12 @@
 
 def execute():
 	webnotes.reload_doc("core", "doctype", "patch_log")
-	for d in webnotes.conn.sql("""select patch from __PatchLog"""):
-		webnotes.doc({
-			"doctype": "Patch Log",
-			"patch": d[0]
-		}).insert()
+	if webnotes.conn.table_exists("__PatchLog"):
+		for d in webnotes.conn.sql("""select patch from __PatchLog"""):
+			webnotes.doc({
+				"doctype": "Patch Log",
+				"patch": d[0]
+			}).insert()
 	
-	webnotes.conn.commit()
-	webnotes.conn.sql("drop table __PatchLog")
\ No newline at end of file
+		webnotes.conn.commit()
+		webnotes.conn.sql("drop table __PatchLog")
\ No newline at end of file
diff --git a/website/helpers/contact.py b/website/helpers/contact.py
index df4510f..a9499ab 100644
--- a/website/helpers/contact.py
+++ b/website/helpers/contact.py
@@ -50,7 +50,7 @@
 		lead.ignore_permissions = True
 		lead.insert()
 	
-	make(content=message, sender=sender, 
+	make(content=message, sender=sender, subject=subject,
 		doctype="Lead", name=lead.doc.name, lead=lead.doc.name)