Added the ability for HR staff to message the end user

This commit is contained in:
2010-05-28 09:24:25 +01:00
parent 364c23dd48
commit 981a1843a6
7 changed files with 47 additions and 3 deletions

View File

@@ -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',
}

View File

@@ -10,6 +10,7 @@ urlpatterns = patterns('',
(r'^application/(?P<applicationid>\d+)/$', views.view_application),
(r'^application/(?P<applicationid>\d+)/update/(?P<status>\d+)/$', views.update_application),
(r'^application/(?P<applicationid>\d+)/note/$', views.add_note),
(r'^application/(?P<applicationid>\d+)/message/$', views.add_message),
(r'^application/(?P<applicationid>\d+)/reject/$', views.reject_application),
(r'^application/(?P<applicationid>\d+)/accept/$', views.accept_application),

View File

@@ -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':

View File

@@ -0,0 +1,12 @@
{% extends "base.html" %}
{% block title %}Send Message to Applicant{% endblock %}
{% block content %}
<form action="{% url hr.views.add_message applicationid %}" method="post">
<table>
{{ form.as_table }}
</table>
<input type="submit" value="Apply" />
</form>
{% endblock %}

View File

@@ -21,7 +21,8 @@
<a href="{% url hr.views.update_application app.id 1 %}">Submit Application</a>,&nbsp;
{% endif %}
{% if hrstaff %}
<a href="{% url hr.views.add_note app.id %}">Add Note</a>,
<a href="{% url hr.views.add_note app.id %}">Add Note</a>,&nbsp;
<a href="{% url hr.views.add_message app.id %}">Send Message to Applicant</a>,
{% if app.status < 2 or app.status = 4 %}
<a href="{% url hr.views.reject_application app.id %}">Reject Application</a>,&nbsp;
<a href="{% url hr.views.accept_application app.id %}">Accept Application</a>,&nbsp;

View File

@@ -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

View File

@@ -0,0 +1 @@
A message regarding your application to {{ app.corporation }}.