Merge pull request #4846 from KanchanChauhan/job-applicant

Added feature to allow people to apply for job from website
This commit is contained in:
Rushabh Mehta 2016-02-29 17:22:01 +05:30
commit ae7dc31d14
7 changed files with 106 additions and 5 deletions

View File

@ -68,6 +68,13 @@ website_route_rules = [
"doctype": "Delivery Note",
"parents": [{"title": _("Shipments"), "name": "shipments"}]
}
},
{"from_route": "/jobs", "to_route": "Job Opening"},
{"from_route": "/jobs/<path:name>", "to_route": "job_opening",
"defaults": {
"doctype": "Job Opening",
"parents": [{"title": _("Job Opening"), "name": "jobs"}]
}
}
]

View File

@ -108,7 +108,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "job_opening",
"fieldname": "job_title",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
@ -184,7 +184,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2016-02-12 00:38:31.773297",
"modified": "2016-02-19 16:43:24.705867",
"modified_by": "Administrator",
"module": "HR",
"name": "Job Applicant",
@ -204,11 +204,33 @@
"print": 1,
"read": 1,
"report": 1,
"restrict": 0,
"restricted": 0,
"role": "HR User",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 0,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 0,
"read": 1,
"report": 0,
"role": "Guest",
"set_user_permissions": 0,
"share": 0,
"submit": 0,
"write": 0
}
],
"read_only": 0,

View File

@ -7,10 +7,12 @@ from __future__ import unicode_literals
from frappe.model.document import Document
import frappe
from frappe import _
from frappe.utils import comma_and
from frappe.utils import comma_and, validate_email_add
sender_field = "email_id"
class DuplicationError(frappe.ValidationError): pass
class JobApplicant(Document):
def onload(self):
offer_letter = frappe.get_all("Offer Letter", filters={"job_applicant": self.name})
@ -25,6 +27,14 @@ class JobApplicant(Document):
def validate(self):
self.check_email_id_is_unique()
validate_email_add(self.email_id, True)
if frappe.db.sql("""select applicant_name from `tabJob Applicant` where email_id= %s and job_title= %s""",
(self.email_id, self.job_title)):
frappe.throw(_("Application already exist for {0} against Job Opening - {1}")
.format(self.applicant_name, self.job_title), DuplicationError)
if not self.get("__islocal") and not self.upload_cv:
frappe.throw(_("CV Required"))
def check_email_id_is_unique(self):
if self.email_id:
@ -33,3 +43,5 @@ class JobApplicant(Document):
if names:
frappe.throw(_("Email id must be unique, already exists for {0}").format(comma_and(names)), frappe.DuplicateEntryError)

View File

@ -25,6 +25,7 @@
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
@ -48,6 +49,7 @@
"options": "Open\nClosed",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -71,6 +73,7 @@
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -89,7 +92,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2015-11-16 06:29:48.769149",
"modified": "2016-02-17 17:29:04.401527",
"modified_by": "Administrator",
"module": "HR",
"name": "Job Opening",
@ -114,8 +117,29 @@
"share": 1,
"submit": 0,
"write": 1
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 0,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 0,
"read": 1,
"report": 0,
"role": "Guest",
"set_user_permissions": 0,
"share": 0,
"submit": 0,
"write": 0
}
],
"read_only": 0,
"read_only_onload": 0
"read_only_onload": 0,
"sort_order": "ASC"
}

View File

@ -0,0 +1,20 @@
<head>
<title>{{doc.job_title}}</title>
</head>
{% extends "templates/web.html" %}
{% block header %}
<h1>{{ doc.job_title }}</h1>
{% endblock %}
{% block breadcrumbs %}
{% include "templates/includes/breadcrumbs.html" %}
{% endblock %}
{% block page_content %}
<p>{{ doc.description }}</p>
<input class="btn btn-large btn-primary" type="button" onclick="location.href='/job_application?job_title={{ doc.job_title }}';" value="Apply Now" />
{% endblock %}

View File

@ -0,0 +1,16 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
def get_context(context):
context.no_cache = 1
context.doc = frappe.get_doc(frappe.form_dict.doctype, frappe.form_dict.name)
context.parents = frappe.form_dict.parents
if not context.doc.has_website_permission("read"):
frappe.throw(_("Not Permitted"), frappe.PermissionError)