From 7e1b51610338f65273c1f567d1e0f226da4e0c7a Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Thu, 15 Sep 2016 15:36:14 +0530 Subject: [PATCH] fixes for student admission (#6377) * fixes for student admission * Added Application Route to Student Admission --- .../student_admission/student_admission.js | 11 +++++-- .../student_admission/student_admission.json | 31 +++++++++++++++++-- .../student_admission/student_admission.py | 3 +- .../generators/student_admission.html | 4 ++- 4 files changed, 43 insertions(+), 6 deletions(-) diff --git a/erpnext/schools/doctype/student_admission/student_admission.js b/erpnext/schools/doctype/student_admission/student_admission.js index 463e929060..48f4c46aa9 100644 --- a/erpnext/schools/doctype/student_admission/student_admission.js +++ b/erpnext/schools/doctype/student_admission/student_admission.js @@ -2,7 +2,14 @@ // For license information, please see license.txt frappe.ui.form.on('Student Admission', { - refresh: function(frm) { - + program: function(frm) { + if (frm.doc.academic_year && frm.doc.program) { + frm.doc.route = frappe.model.scrub(frm.doc.program) + "-" + frappe.model.scrub(frm.doc.academic_year) + frm.refresh_field("route"); + } + }, + + academic_year: function(frm) { + frm.trigger("program"); } }); diff --git a/erpnext/schools/doctype/student_admission/student_admission.json b/erpnext/schools/doctype/student_admission/student_admission.json index abd4c93582..c956085ea7 100644 --- a/erpnext/schools/doctype/student_admission/student_admission.json +++ b/erpnext/schools/doctype/student_admission/student_admission.json @@ -163,7 +163,7 @@ "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, - "reqd": 0, + "reqd": 1, "search_index": 0, "set_only_once": 0, "unique": 0 @@ -227,6 +227,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "depends_on": "", "fieldname": "route", "fieldtype": "Data", "hidden": 0, @@ -243,6 +244,32 @@ "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 1 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "application_form_route", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Application Form Route", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, "reqd": 0, "search_index": 0, "set_only_once": 0, @@ -336,7 +363,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2016-09-15 02:59:15.180465", + "modified": "2016-09-15 05:59:18.435682", "modified_by": "Administrator", "module": "Schools", "name": "Student Admission", diff --git a/erpnext/schools/doctype/student_admission/student_admission.py b/erpnext/schools/doctype/student_admission/student_admission.py index e0ac983437..faf945622c 100644 --- a/erpnext/schools/doctype/student_admission/student_admission.py +++ b/erpnext/schools/doctype/student_admission/student_admission.py @@ -10,7 +10,8 @@ from frappe import _ class StudentAdmission(WebsiteGenerator): website = frappe._dict( template = "templates/generators/student_admission.html", - condition_field = "publish" + condition_field = "publish", + page_title_field = "route" ) def get_context(self, context): diff --git a/erpnext/templates/generators/student_admission.html b/erpnext/templates/generators/student_admission.html index 53c5311de1..bf138f0ea6 100644 --- a/erpnext/templates/generators/student_admission.html +++ b/erpnext/templates/generators/student_admission.html @@ -40,10 +40,12 @@ +{%- if application_form_route -%}

+ href='/{{ doc.application_form_route }}?program={{ doc.program }}&academic_year={{ doc.academic_year }}&new=1'> {{ _("Apply Now") }}

+{% endif %} {% endblock %}