mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 08:24:47 +00:00
added job application
This commit is contained in:
55
hr/doctype/job_applicant/get_job_applications.py
Normal file
55
hr/doctype/job_applicant/get_job_applications.py
Normal file
@@ -0,0 +1,55 @@
|
||||
# ERPNext - web based ERP (http://erpnext.com)
|
||||
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes.utils import cstr, cint
|
||||
from webnotes.utils.email_lib.receive import POP3Mailbox
|
||||
from core.doctype.communication.communication import make
|
||||
|
||||
class JobsMailbox(POP3Mailbox):
|
||||
def setup(self):
|
||||
self.settings = webnotes.doc("Jobs Email Settings", "Jobs Email Settings")
|
||||
|
||||
def check_mails(self):
|
||||
return webnotes.conn.sql("select user from tabSessions where \
|
||||
time_to_sec(timediff(now(), lastupdate)) < 1800")
|
||||
|
||||
def get_existing_application(self, email_id):
|
||||
name = webnotes.conn.sql("""select name from `tabJob Applicant` where
|
||||
email_id = %s""", email_id)
|
||||
return name and name[0][0] or None
|
||||
|
||||
def process_message(self, mail):
|
||||
name = self.get_existing_application(mail.from_email)
|
||||
if name:
|
||||
applicant = webnotes.model_wrapper("Job Applicant", name)
|
||||
else:
|
||||
applicant = webnotes.model_wrapper({
|
||||
"doctype":"Job Applicant",
|
||||
"applicant_name": mail.from_real_name or mail.from_email,
|
||||
"email_id": mail.from_email
|
||||
})
|
||||
applicant.insert()
|
||||
|
||||
mail.save_attachments_in_doc(applicant.doc)
|
||||
|
||||
make(content=mail.content, sender=mail.from_email,
|
||||
doctype="Job Applicant", name=applicant.doc.name, set_lead=False)
|
||||
|
||||
def get_job_applications():
|
||||
if cint(webnotes.conn.get_value('Jobs Email Settings', None, 'extract_emails')):
|
||||
JobsMailbox()
|
||||
22
hr/doctype/job_applicant/job_applicant.js
Normal file
22
hr/doctype/job_applicant/job_applicant.js
Normal file
@@ -0,0 +1,22 @@
|
||||
// For license information, please see license.txt
|
||||
|
||||
cur_frm.cscript = {
|
||||
refresh: function(doc) {
|
||||
cur_frm.set_intro("");
|
||||
if(doc.extract_emails) {
|
||||
cur_frm.set_intro(wn._("Active: Will extract emails from ") + doc.email_id);
|
||||
} else {
|
||||
cur_frm.set_intro(wn._("Not Active"));
|
||||
}
|
||||
cur_frm.cscript.make_listing(doc);
|
||||
},
|
||||
make_listing: function(doc) {
|
||||
var wrapper = cur_frm.fields_dict['thread_html'].wrapper;
|
||||
cur_frm.communication_view = new wn.views.CommunicationList({
|
||||
list: comm_list,
|
||||
parent: wn.model.get("Communication", {"job_applicant": doc.name}),
|
||||
doc: doc,
|
||||
recipients: doc.email_id
|
||||
})
|
||||
},
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
"docstatus": 0,
|
||||
"creation": "2013-01-15 16:32:13",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2013-01-15 16:32:13"
|
||||
"modified": "2013-01-15 17:08:46"
|
||||
},
|
||||
{
|
||||
"autoname": "field:applicant_name",
|
||||
@@ -47,6 +47,12 @@
|
||||
"fieldtype": "Data",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Email Id",
|
||||
"fieldname": "email_id",
|
||||
"fieldtype": "Data"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Status",
|
||||
|
||||
@@ -4,9 +4,10 @@
|
||||
"docstatus": 0,
|
||||
"creation": "2013-01-15 16:13:36",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2013-01-15 16:13:36"
|
||||
"modified": "2013-01-15 16:43:05"
|
||||
},
|
||||
{
|
||||
"autoname": "field:job_title",
|
||||
"description": "Description of a Job Opening",
|
||||
"doctype": "DocType",
|
||||
"module": "HR",
|
||||
|
||||
Reference in New Issue
Block a user