diff --git a/small_small_hr/__init__.py b/small_small_hr/__init__.py index 2097b5b..eef9640 100644 --- a/small_small_hr/__init__.py +++ b/small_small_hr/__init__.py @@ -1,7 +1,7 @@ """ Main init file for small_small_hr """ -VERSION = (0, 1, 5) +VERSION = (0, 1, 6) __version__ = '.'.join(str(v) for v in VERSION) # pylint: disable=invalid-name default_app_config = 'small_small_hr.apps.SmallSmallHrConfig' # noqa diff --git a/small_small_hr/emails.py b/small_small_hr/emails.py index 9e3637c..ce5937c 100644 --- a/small_small_hr/emails.py +++ b/small_small_hr/emails.py @@ -68,7 +68,7 @@ def leave_application_email(leave_obj: object): for admin_email in admin_emails: send_email( - name=leave_obj.staff.get_name(), + name=settings.SSHR_ADMIN_NAME, email=admin_email, subject=subj, message=msg, @@ -118,7 +118,7 @@ def overtime_application_email(overtime_obj: object): for admin_email in admin_emails: send_email( - name=overtime_obj.staff.get_name(), + name=settings.SSHR_ADMIN_NAME, email=admin_email, subject=subj, message=msg, diff --git a/small_small_hr/settings.py b/small_small_hr/settings.py index 9ae77c7..02546a0 100644 --- a/small_small_hr/settings.py +++ b/small_small_hr/settings.py @@ -25,6 +25,7 @@ {'day': 26, 'month': 12}, # Boxing day ] # these are days that are not counted when getting taken leave days # emails +SSHR_ADMIN_NAME = "HR" SSHR_ADMIN_EMAILS = [settings.DEFAULT_FROM_EMAIL] SSHR_ADMIN_LEAVE_EMAILS = SSHR_ADMIN_EMAILS SSHR_ADMIN_OVERTIME_EMAILS = SSHR_ADMIN_EMAILS diff --git a/small_small_hr/templates/small_small_hr/email/leave_application_email_body.html b/small_small_hr/templates/small_small_hr/email/leave_application_email_body.html index 7fed0ef..f0d3095 100644 --- a/small_small_hr/templates/small_small_hr/email/leave_application_email_body.html +++ b/small_small_hr/templates/small_small_hr/email/leave_application_email_body.html @@ -1,4 +1,4 @@ -Hello {{name}},

+Hello,

{{message|linebreaks}}

Thank you,
diff --git a/small_small_hr/templates/small_small_hr/email/leave_application_email_body.txt b/small_small_hr/templates/small_small_hr/email/leave_application_email_body.txt index ac06063..a1e77af 100644 --- a/small_small_hr/templates/small_small_hr/email/leave_application_email_body.txt +++ b/small_small_hr/templates/small_small_hr/email/leave_application_email_body.txt @@ -1,4 +1,4 @@ -Hello {{name}}, +Hello, {{message}} diff --git a/small_small_hr/templates/small_small_hr/email/overtime_application_email_body.html b/small_small_hr/templates/small_small_hr/email/overtime_application_email_body.html index 7fed0ef..f0d3095 100644 --- a/small_small_hr/templates/small_small_hr/email/overtime_application_email_body.html +++ b/small_small_hr/templates/small_small_hr/email/overtime_application_email_body.html @@ -1,4 +1,4 @@ -Hello {{name}},

+Hello,

{{message|linebreaks}}

Thank you,
diff --git a/small_small_hr/templates/small_small_hr/email/overtime_application_email_body.txt b/small_small_hr/templates/small_small_hr/email/overtime_application_email_body.txt index ac06063..a1e77af 100644 --- a/small_small_hr/templates/small_small_hr/email/overtime_application_email_body.txt +++ b/small_small_hr/templates/small_small_hr/email/overtime_application_email_body.txt @@ -1,4 +1,4 @@ -Hello {{name}}, +Hello, {{message}} diff --git a/tests/test_emails.py b/tests/test_emails.py index abeb5b1..2ec2846 100644 --- a/tests/test_emails.py +++ b/tests/test_emails.py @@ -21,7 +21,8 @@ @override_settings( SSHR_ADMIN_EMAILS=["admin@example.com"], SSHR_ADMIN_LEAVE_EMAILS=["hr@example.com"], - SSHR_ADMIN_OVERTIME_EMAILS=["ot@example.com"] + SSHR_ADMIN_OVERTIME_EMAILS=["ot@example.com"], + SSHR_ADMIN_NAME="mosh" ) class TestEmails(TestCase): """ @@ -55,7 +56,7 @@ def test_leave_application_email(self, mock): leave_application_email(leave) mock.assert_called_with( - name="Bob Ndoe", + name="mosh", email="hr@example.com", subject="New Leave Application", message="There has been a new leave application. Please log in to process it.", # noqa @@ -104,7 +105,7 @@ def test_overtime_application_email(self, mock): overtime_application_email(overtime) mock.assert_called_with( - name="Bob Ndoe", + name="mosh", email="ot@example.com", subject="New Overtime Application", message="There has been a new overtime application. Please log in to process it.", # noqa @@ -222,7 +223,7 @@ def test_send_email_templates(self, mock, site_mock): leave_application_email(leave) context = dict( - name="Bob Ndoe", + name="mosh", subject="New Leave Application", message="There has been a new leave application. Please log in to process it.", # noqa object=leave, @@ -260,7 +261,7 @@ def test_send_email_templates(self, mock, site_mock): overtime_application_email(overtime) context = dict( - name="Bob Ndoe", + name="mosh", subject="New Overtime Application", message="There has been a new overtime application. Please log in to process it.", # noqa object=overtime,