diff --git a/hr/app_defines.py b/hr/app_defines.py index 128e409..35c300d 100644 --- a/hr/app_defines.py +++ b/hr/app_defines.py @@ -28,17 +28,20 @@ AUDIT_EVENT_STATUSCHANGE = 0 AUDIT_EVENT_NOTE = 1 AUDIT_EVENT_REJECTION = 2 AUDIT_EVENT_ACCEPTED = 3 +AUDIT_EVENT_MESSAGE = 4 AUDIT_EVENT_CHOICES = ( (AUDIT_EVENT_STATUSCHANGE, 'Status Change'), - (AUDIT_EVENT_NOTE, 'Note'), + (AUDIT_EVENT_NOTE, 'Staff Note'), (AUDIT_EVENT_REJECTION, 'Rejection Reason'), (AUDIT_EVENT_ACCEPTED, 'Accepted'), + (AUDIT_EVENT_MESSAGE, 'Message to User'), ) AUDIT_EVENT_LOOKUP = { AUDIT_EVENT_STATUSCHANGE: 'Status Change', - AUDIT_EVENT_NOTE: 'Note', + AUDIT_EVENT_NOTE: 'Staff Note', AUDIT_EVENT_REJECTION: 'Rejection Reason', AUDIT_EVENT_ACCEPTED: 'Accepted', + AUDIT_EVENT_MESSAGE: 'Message to User', } diff --git a/hr/urls.py b/hr/urls.py index 9b7c8df..a6fb52f 100644 --- a/hr/urls.py +++ b/hr/urls.py @@ -10,6 +10,7 @@ urlpatterns = patterns('', (r'^application/(?P\d+)/$', views.view_application), (r'^application/(?P\d+)/update/(?P\d+)/$', views.update_application), (r'^application/(?P\d+)/note/$', views.add_note), + (r'^application/(?P\d+)/message/$', views.add_message), (r'^application/(?P\d+)/reject/$', views.reject_application), (r'^application/(?P\d+)/accept/$', views.accept_application), diff --git a/hr/views.py b/hr/views.py index b914905..698f8cb 100644 --- a/hr/views.py +++ b/hr/views.py @@ -191,6 +191,19 @@ def add_note(request, applicationid): form = NoteForm() return render_to_response('hr/applications/add_note.html', locals(), context_instance=RequestContext(request)) +def add_message(request, applicationid): + if request.method == 'POST': + obj = Audit(application=Application.objects.get(id=applicationid), user=request.user, event=AUDIT_EVENT_MESSAGE) + form = NoteForm(request.POST, instance=obj) + if form.is_valid(): + form.save() + send_message(obj.application, 'message', note=obj.text) + return HttpResponseRedirect(reverse('hr.views.view_application', args=[applicationid])) + + form = NoteForm() + return render_to_response('hr/applications/add_message.html', locals(), context_instance=RequestContext(request)) + + @login_required def reject_application(request, applicationid): if request.method == 'POST': diff --git a/templates/hr/applications/add_message.html b/templates/hr/applications/add_message.html new file mode 100644 index 0000000..2c283f6 --- /dev/null +++ b/templates/hr/applications/add_message.html @@ -0,0 +1,12 @@ +{% extends "base.html" %} + +{% block title %}Send Message to Applicant{% endblock %} + +{% block content %} +
+ +{{ form.as_table }} +
+ +
+{% endblock %} diff --git a/templates/hr/applications/view.html b/templates/hr/applications/view.html index f43df89..81807cd 100644 --- a/templates/hr/applications/view.html +++ b/templates/hr/applications/view.html @@ -21,7 +21,8 @@ Submit Application,  {% endif %} {% if hrstaff %} -Add Note, +Add Note,  +Send Message to Applicant, {% if app.status < 2 or app.status = 4 %} Reject ApplicationAccept Application,  diff --git a/templates/hr/emails/message.txt b/templates/hr/emails/message.txt new file mode 100644 index 0000000..3cd0bed --- /dev/null +++ b/templates/hr/emails/message.txt @@ -0,0 +1,13 @@ +Hi {{ app.character }}, + +A message was sent to you regarding your current application to {{ app.corporation }}: + +{% if note %} +{{ note }} +{% endif %} + +If you have any further questions regarding your application, please contact {{ app.corporation }} via the normal channels. + +Regards, + +{{ app.corporation }} HR Bot diff --git a/templates/hr/emails/message_subject.txt b/templates/hr/emails/message_subject.txt new file mode 100644 index 0000000..41c6887 --- /dev/null +++ b/templates/hr/emails/message_subject.txt @@ -0,0 +1 @@ +A message regarding your application to {{ app.corporation }}.