Merge branch 'develop' into call-summary-dialog
diff --git a/erpnext/education/doctype/course/test_records.json b/erpnext/education/doctype/course/test_records.json
index ec57dc7..1e7467a 100644
--- a/erpnext/education/doctype/course/test_records.json
+++ b/erpnext/education/doctype/course/test_records.json
@@ -1,17 +1,14 @@
 [
 	{
-		"course_name": "_Test Course",
-		"course_code": "TC100",
+		"course_name": "TC100",
 		"course_abbreviation": "TC"
 	},
 	{
-		"course_name": "_Test Course 1",
-		"course_code": "TC101",
+		"course_name": "TC101",
 		"course_abbreviation": "TC1"
 	},
 	{
-		"course_name": "_Test Course 2",
-		"course_code": "TC102",
+		"course_name": "TC102",
 		"course_abbreviation": "TC2"
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/education/doctype/program/test_records.json b/erpnext/education/doctype/program/test_records.json
index 7901db3..4013695 100644
--- a/erpnext/education/doctype/program/test_records.json
+++ b/erpnext/education/doctype/program/test_records.json
@@ -1,13 +1,11 @@
 [
 	{
-		"program_name": "_Test Program 1",
-		"program_code": "_TP1",
+		"program_name": "_TP1",
 		"description": "Test Description",
 		"program_abbreviation": "TP1"
 	},
 	{
-		"program_name": "_Test Program 2",
-		"program_code": "_TP2",
+		"program_name": "_TP2",
 		"description": "Test Description",
 		"program_abbreviation": "TP2"
 	}
diff --git a/erpnext/education/doctype/program_enrollment/program_enrollment.py b/erpnext/education/doctype/program_enrollment/program_enrollment.py
index d232e47..d5348ff 100644
--- a/erpnext/education/doctype/program_enrollment/program_enrollment.py
+++ b/erpnext/education/doctype/program_enrollment/program_enrollment.py
@@ -66,7 +66,7 @@
 			msgprint(_("Fee Records Created - {0}").format(comma_and(fee_list)))
 
 	def get_courses(self):
-		return frappe.db.sql('''select course, course_name from `tabProgram Course` where parent = %s and required = 1''', (self.program), as_dict=1)
+		return frappe.db.sql('''select course from `tabProgram Course` where parent = %s and required = 1''', (self.program), as_dict=1)
 
 	def create_course_enrollments(self):
 		student = frappe.get_doc("Student", self.student)
diff --git a/erpnext/www/lms/course.py b/erpnext/www/lms/course.py
index e7ed2e3..c18d64e 100644
--- a/erpnext/www/lms/course.py
+++ b/erpnext/www/lms/course.py
@@ -5,9 +5,16 @@
 no_cache = 1
 
 def get_context(context):
+	try:
+		program = frappe.form_dict['program']
+		course_name = frappe.form_dict['name']
+	except KeyError:
+		frappe.local.flags.redirect_location = '/lms'
+		raise frappe.Redirect
+
 	context.education_settings = frappe.get_single("Education Settings")
-	course = frappe.get_doc('Course', frappe.form_dict['name'])
-	context.program = frappe.form_dict['program']
+	course = frappe.get_doc('Course', course_name)
+	context.program = program
 	context.course = course
 
 	context.topics = course.get_topics()
diff --git a/erpnext/www/lms/program.py b/erpnext/www/lms/program.py
index 1fcb3d3..7badedc 100644
--- a/erpnext/www/lms/program.py
+++ b/erpnext/www/lms/program.py
@@ -6,10 +6,16 @@
 no_cache = 1
 
 def get_context(context):
+	try:
+		program = frappe.form_dict['program']
+	except KeyError:
+		frappe.local.flags.redirect_location = '/lms'
+		raise frappe.Redirect
+
 	context.education_settings = frappe.get_single("Education Settings")
-	context.program = get_program(frappe.form_dict['program'])
+	context.program = get_program(program)
 	context.courses = [frappe.get_doc("Course", course.course) for course in context.program.courses]
-	context.has_access = utils.allowed_program_access(frappe.form_dict['program'])
+	context.has_access = utils.allowed_program_access(program)
 	context.progress = get_course_progress(context.courses, context.program)
 
 def get_program(program_name):
diff --git a/erpnext/www/lms/topic.py b/erpnext/www/lms/topic.py
index 0af0778..f75ae8e 100644
--- a/erpnext/www/lms/topic.py
+++ b/erpnext/www/lms/topic.py
@@ -5,9 +5,13 @@
 no_cache = 1
 
 def get_context(context):
-	course = frappe.form_dict['course']
-	program = frappe.form_dict['program']
-	topic = frappe.form_dict['topic']
+	try:
+		course = frappe.form_dict['course']
+		program = frappe.form_dict['program']
+		topic = frappe.form_dict['topic']
+	except KeyError:
+		frappe.local.flags.redirect_location = '/lms'
+		raise frappe.Redirect
 
 	context.program = program
 	context.course = course